123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817 |
- 'use strict';
- const keywordSets = {};
- keywordSets.nonLengthUnits = new Set([
- // Relative length units
- '%',
- // Time length units
- 's',
- 'ms',
- // Angle
- 'deg',
- 'grad',
- 'turn',
- 'rad',
- // Frequency
- 'Hz',
- 'kHz',
- // Resolution
- 'dpi',
- 'dpcm',
- 'dppx',
- ]);
- keywordSets.lengthUnits = new Set([
- // Relative length units
- 'em',
- 'ex',
- 'ch',
- 'rem',
- 'rlh',
- 'lh',
- // Viewport-percentage lengths
- 'dvh',
- 'dvmax',
- 'dvmin',
- 'dvw',
- 'lvh',
- 'lvmax',
- 'lvmin',
- 'lvw',
- 'svh',
- 'svmax',
- 'svmin',
- 'svw',
- 'vh',
- 'vw',
- 'vmin',
- 'vmax',
- 'vm',
- // Absolute length units
- 'px',
- 'mm',
- 'cm',
- 'in',
- 'pt',
- 'pc',
- 'q',
- 'mozmm',
- // Flexible length units
- 'fr',
- ]);
- keywordSets.units = uniteSets(keywordSets.nonLengthUnits, keywordSets.lengthUnits);
- keywordSets.camelCaseFunctionNames = new Set([
- 'translateX',
- 'translateY',
- 'translateZ',
- 'scaleX',
- 'scaleY',
- 'scaleZ',
- 'rotateX',
- 'rotateY',
- 'rotateZ',
- 'skewX',
- 'skewY',
- ]);
- keywordSets.basicKeywords = new Set(['initial', 'inherit', 'revert', 'revert-layer', 'unset']);
- keywordSets.systemFontValues = uniteSets(keywordSets.basicKeywords, [
- 'caption',
- 'icon',
- 'menu',
- 'message-box',
- 'small-caption',
- 'status-bar',
- ]);
- keywordSets.fontFamilyKeywords = uniteSets(keywordSets.basicKeywords, [
- 'serif',
- 'sans-serif',
- 'cursive',
- 'fantasy',
- 'monospace',
- 'system-ui',
- ]);
- keywordSets.fontWeightRelativeKeywords = new Set(['bolder', 'lighter']);
- keywordSets.fontWeightAbsoluteKeywords = new Set(['bold']);
- keywordSets.fontWeightNumericKeywords = new Set([
- '100',
- '200',
- '300',
- '400',
- '500',
- '600',
- '700',
- '800',
- '900',
- ]);
- keywordSets.fontWeightKeywords = uniteSets(
- keywordSets.basicKeywords,
- keywordSets.fontWeightRelativeKeywords,
- keywordSets.fontWeightAbsoluteKeywords,
- keywordSets.fontWeightNumericKeywords,
- );
- keywordSets.animationNameKeywords = uniteSets(keywordSets.basicKeywords, ['none']);
- keywordSets.animationTimingFunctionKeywords = uniteSets(keywordSets.basicKeywords, [
- 'linear',
- 'ease',
- 'ease-in',
- 'ease-in-out',
- 'ease-out',
- 'step-start',
- 'step-end',
- 'steps',
- 'cubic-bezier',
- ]);
- keywordSets.animationIterationCountKeywords = new Set(['infinite']);
- keywordSets.animationDirectionKeywords = uniteSets(keywordSets.basicKeywords, [
- 'normal',
- 'reverse',
- 'alternate',
- 'alternate-reverse',
- ]);
- keywordSets.animationFillModeKeywords = new Set(['none', 'forwards', 'backwards', 'both']);
- keywordSets.animationPlayStateKeywords = uniteSets(keywordSets.basicKeywords, [
- 'running',
- 'paused',
- ]);
- // cf. https://developer.mozilla.org/en-US/docs/Web/CSS/animation
- keywordSets.animationShorthandKeywords = uniteSets(
- keywordSets.basicKeywords,
- keywordSets.animationNameKeywords,
- keywordSets.animationTimingFunctionKeywords,
- keywordSets.animationIterationCountKeywords,
- keywordSets.animationDirectionKeywords,
- keywordSets.animationFillModeKeywords,
- keywordSets.animationPlayStateKeywords,
- );
- // These are the ones that can have single-colon notation
- keywordSets.levelOneAndTwoPseudoElements = new Set([
- 'before',
- 'after',
- 'first-line',
- 'first-letter',
- ]);
- keywordSets.levelThreeAndUpPseudoElements = new Set([
- 'before',
- 'after',
- 'first-line',
- 'first-letter',
- // These are the ones that require double-colon notation
- 'backdrop',
- 'content',
- 'cue',
- 'file-selector-button',
- 'grammar-error',
- 'marker',
- 'placeholder',
- 'selection',
- 'shadow',
- 'slotted',
- 'spelling-error',
- 'target-text',
- ]);
- keywordSets.shadowTreePseudoElements = new Set(['part']);
- keywordSets.webkitScrollbarPseudoElements = new Set([
- '-webkit-resizer',
- '-webkit-scrollbar',
- '-webkit-scrollbar-button',
- '-webkit-scrollbar-corner',
- '-webkit-scrollbar-thumb',
- '-webkit-scrollbar-track',
- '-webkit-scrollbar-track-piece',
- ]);
- keywordSets.vendorSpecificPseudoElements = new Set([
- '-moz-focus-inner',
- '-moz-focus-outer',
- '-moz-list-bullet',
- '-moz-meter-bar',
- '-moz-placeholder',
- '-moz-progress-bar',
- '-moz-range-progress',
- '-moz-range-thumb',
- '-moz-range-track',
- '-ms-browse',
- '-ms-check',
- '-ms-clear',
- '-ms-expand',
- '-ms-fill',
- '-ms-fill-lower',
- '-ms-fill-upper',
- '-ms-reveal',
- '-ms-thumb',
- '-ms-ticks-after',
- '-ms-ticks-before',
- '-ms-tooltip',
- '-ms-track',
- '-ms-value',
- '-webkit-color-swatch',
- '-webkit-color-swatch-wrapper',
- '-webkit-calendar-picker-indicator',
- '-webkit-clear-button',
- '-webkit-date-and-time-value',
- '-webkit-datetime-edit',
- '-webkit-datetime-edit-ampm-field',
- '-webkit-datetime-edit-day-field',
- '-webkit-datetime-edit-fields-wrapper',
- '-webkit-datetime-edit-hour-field',
- '-webkit-datetime-edit-millisecond-field',
- '-webkit-datetime-edit-minute-field',
- '-webkit-datetime-edit-month-field',
- '-webkit-datetime-edit-second-field',
- '-webkit-datetime-edit-text',
- '-webkit-datetime-edit-week-field',
- '-webkit-datetime-edit-year-field',
- '-webkit-details-marker',
- '-webkit-distributed',
- '-webkit-file-upload-button',
- '-webkit-input-placeholder',
- '-webkit-keygen-select',
- '-webkit-meter-bar',
- '-webkit-meter-even-less-good-value',
- '-webkit-meter-inner-element',
- '-webkit-meter-optimum-value',
- '-webkit-meter-suboptimum-value',
- '-webkit-progress-bar',
- '-webkit-progress-inner-element',
- '-webkit-progress-value',
- '-webkit-search-cancel-button',
- '-webkit-search-decoration',
- '-webkit-search-results-button',
- '-webkit-search-results-decoration',
- '-webkit-slider-runnable-track',
- '-webkit-slider-thumb',
- '-webkit-textfield-decoration-container',
- '-webkit-validation-bubble',
- '-webkit-validation-bubble-arrow',
- '-webkit-validation-bubble-arrow-clipper',
- '-webkit-validation-bubble-heading',
- '-webkit-validation-bubble-message',
- '-webkit-validation-bubble-text-block',
- ...keywordSets.webkitScrollbarPseudoElements,
- ]);
- keywordSets.pseudoElements = uniteSets(
- keywordSets.levelOneAndTwoPseudoElements,
- keywordSets.levelThreeAndUpPseudoElements,
- keywordSets.vendorSpecificPseudoElements,
- keywordSets.shadowTreePseudoElements,
- );
- keywordSets.aNPlusBNotationPseudoClasses = new Set([
- 'nth-column',
- 'nth-last-column',
- 'nth-last-of-type',
- 'nth-of-type',
- ]);
- keywordSets.linguisticPseudoClasses = new Set(['dir', 'lang']);
- keywordSets.atRulePagePseudoClasses = new Set(['first', 'right', 'left', 'blank']);
- keywordSets.logicalCombinationsPseudoClasses = new Set(['has', 'is', 'matches', 'not', 'where']);
- keywordSets.aNPlusBOfSNotationPseudoClasses = new Set(['nth-child', 'nth-last-child']);
- keywordSets.otherPseudoClasses = new Set([
- 'active',
- 'any-link',
- 'autofill',
- 'blank',
- 'checked',
- 'current',
- 'default',
- 'defined',
- 'disabled',
- 'empty',
- 'enabled',
- 'first-child',
- 'first-of-type',
- 'focus',
- 'focus-within',
- 'focus-visible',
- 'fullscreen',
- 'fullscreen-ancestor',
- 'future',
- 'host',
- 'host-context',
- 'hover',
- 'indeterminate',
- 'in-range',
- 'invalid',
- 'last-child',
- 'last-of-type',
- 'link',
- 'only-child',
- 'only-of-type',
- 'optional',
- 'out-of-range',
- 'past',
- 'placeholder-shown',
- 'playing',
- 'picture-in-picture',
- 'paused',
- 'read-only',
- 'read-write',
- 'required',
- 'root',
- 'scope',
- 'state',
- 'target',
- 'unresolved',
- 'user-invalid',
- 'user-valid',
- 'valid',
- 'visited',
- 'window-inactive', // for ::selection (chrome)
- ]);
- keywordSets.vendorSpecificPseudoClasses = new Set([
- '-khtml-drag',
- '-moz-any',
- '-moz-any-link',
- '-moz-broken',
- '-moz-drag-over',
- '-moz-first-node',
- '-moz-focusring',
- '-moz-full-screen',
- '-moz-full-screen-ancestor',
- '-moz-last-node',
- '-moz-loading',
- '-moz-meter-optimum',
- '-moz-meter-sub-optimum',
- '-moz-meter-sub-sub-optimum',
- '-moz-placeholder',
- '-moz-submit-invalid',
- '-moz-suppressed',
- '-moz-ui-invalid',
- '-moz-ui-valid',
- '-moz-user-disabled',
- '-moz-window-inactive',
- '-ms-fullscreen',
- '-ms-input-placeholder',
- '-webkit-drag',
- '-webkit-any',
- '-webkit-any-link',
- '-webkit-autofill',
- '-webkit-full-screen',
- '-webkit-full-screen-ancestor',
- ]);
- // https://webkit.org/blog/363/styling-scrollbars/
- keywordSets.webkitScrollbarPseudoClasses = new Set([
- 'horizontal',
- 'vertical',
- 'decrement',
- 'increment',
- 'start',
- 'end',
- 'double-button',
- 'single-button',
- 'no-button',
- 'corner-present',
- 'window-inactive',
- ]);
- keywordSets.pseudoClasses = uniteSets(
- keywordSets.aNPlusBNotationPseudoClasses,
- keywordSets.linguisticPseudoClasses,
- keywordSets.logicalCombinationsPseudoClasses,
- keywordSets.aNPlusBOfSNotationPseudoClasses,
- keywordSets.otherPseudoClasses,
- keywordSets.vendorSpecificPseudoClasses,
- );
- keywordSets.shorthandTimeProperties = new Set(['transition', 'animation']);
- keywordSets.longhandTimeProperties = new Set([
- 'transition-duration',
- 'transition-delay',
- 'animation-duration',
- 'animation-delay',
- ]);
- keywordSets.timeProperties = uniteSets(
- keywordSets.shorthandTimeProperties,
- keywordSets.longhandTimeProperties,
- );
- keywordSets.camelCaseKeywords = new Set([
- 'optimizeSpeed',
- 'optimizeQuality',
- 'optimizeLegibility',
- 'geometricPrecision',
- 'currentColor',
- 'crispEdges',
- 'visiblePainted',
- 'visibleFill',
- 'visibleStroke',
- 'sRGB',
- 'linearRGB',
- ]);
- // https://developer.mozilla.org/docs/Web/CSS/counter-increment
- keywordSets.counterIncrementKeywords = uniteSets(keywordSets.basicKeywords, ['none']);
- keywordSets.counterResetKeywords = uniteSets(keywordSets.basicKeywords, ['none']);
- keywordSets.gridRowKeywords = uniteSets(keywordSets.basicKeywords, ['auto', 'span']);
- keywordSets.gridColumnKeywords = uniteSets(keywordSets.basicKeywords, ['auto', 'span']);
- keywordSets.gridAreaKeywords = uniteSets(keywordSets.basicKeywords, ['auto', 'span']);
- // https://developer.mozilla.org/ru/docs/Web/CSS/list-style-type
- keywordSets.listStyleTypeKeywords = uniteSets(keywordSets.basicKeywords, [
- 'none',
- 'disc',
- 'circle',
- 'square',
- 'decimal',
- 'cjk-decimal',
- 'decimal-leading-zero',
- 'lower-roman',
- 'upper-roman',
- 'lower-greek',
- 'lower-alpha',
- 'lower-latin',
- 'upper-alpha',
- 'upper-latin',
- 'arabic-indic',
- 'armenian',
- 'bengali',
- 'cambodian',
- 'cjk-earthly-branch',
- 'cjk-ideographic',
- 'devanagari',
- 'ethiopic-numeric',
- 'georgian',
- 'gujarati',
- 'gurmukhi',
- 'hebrew',
- 'hiragana',
- 'hiragana-iroha',
- 'japanese-formal',
- 'japanese-informal',
- 'kannada',
- 'katakana',
- 'katakana-iroha',
- 'khmer',
- 'korean-hangul-formal',
- 'korean-hanja-formal',
- 'korean-hanja-informal',
- 'lao',
- 'lower-armenian',
- 'malayalam',
- 'mongolian',
- 'myanmar',
- 'oriya',
- 'persian',
- 'simp-chinese-formal',
- 'simp-chinese-informal',
- 'tamil',
- 'telugu',
- 'thai',
- 'tibetan',
- 'trad-chinese-formal',
- 'trad-chinese-informal',
- 'upper-armenian',
- 'disclosure-open',
- 'disclosure-closed',
- // Non-standard extensions (without prefixe)
- 'ethiopic-halehame',
- 'ethiopic-halehame-am',
- 'ethiopic-halehame-ti-er',
- 'ethiopic-halehame-ti-et',
- 'hangul',
- 'hangul-consonant',
- 'urdu',
- ]);
- keywordSets.listStylePositionKeywords = uniteSets(keywordSets.basicKeywords, ['inside', 'outside']);
- keywordSets.listStyleImageKeywords = uniteSets(keywordSets.basicKeywords, ['none']);
- keywordSets.listStyleShorthandKeywords = uniteSets(
- keywordSets.basicKeywords,
- keywordSets.listStyleTypeKeywords,
- keywordSets.listStylePositionKeywords,
- keywordSets.listStyleImageKeywords,
- );
- keywordSets.fontStyleKeywords = uniteSets(keywordSets.basicKeywords, [
- 'normal',
- 'italic',
- 'oblique',
- ]);
- keywordSets.fontVariantKeywords = uniteSets(keywordSets.basicKeywords, [
- 'normal',
- 'none',
- 'historical-forms',
- 'none',
- 'common-ligatures',
- 'no-common-ligatures',
- 'discretionary-ligatures',
- 'no-discretionary-ligatures',
- 'historical-ligatures',
- 'no-historical-ligatures',
- 'contextual',
- 'no-contextual',
- 'small-caps',
- 'small-caps',
- 'all-small-caps',
- 'petite-caps',
- 'all-petite-caps',
- 'unicase',
- 'titling-caps',
- 'lining-nums',
- 'oldstyle-nums',
- 'proportional-nums',
- 'tabular-nums',
- 'diagonal-fractions',
- 'stacked-fractions',
- 'ordinal',
- 'slashed-zero',
- 'jis78',
- 'jis83',
- 'jis90',
- 'jis04',
- 'simplified',
- 'traditional',
- 'full-width',
- 'proportional-width',
- 'ruby',
- ]);
- keywordSets.fontStretchKeywords = uniteSets(keywordSets.basicKeywords, [
- 'semi-condensed',
- 'condensed',
- 'extra-condensed',
- 'ultra-condensed',
- 'semi-expanded',
- 'expanded',
- 'extra-expanded',
- 'ultra-expanded',
- ]);
- keywordSets.fontSizeKeywords = uniteSets(keywordSets.basicKeywords, [
- 'xx-small',
- 'x-small',
- 'small',
- 'medium',
- 'large',
- 'x-large',
- 'xx-large',
- 'larger',
- 'smaller',
- ]);
- keywordSets.lineHeightKeywords = uniteSets(keywordSets.basicKeywords, ['normal']);
- keywordSets.fontShorthandKeywords = uniteSets(
- keywordSets.basicKeywords,
- keywordSets.fontStyleKeywords,
- keywordSets.fontVariantKeywords,
- keywordSets.fontWeightKeywords,
- keywordSets.fontStretchKeywords,
- keywordSets.fontSizeKeywords,
- keywordSets.lineHeightKeywords,
- keywordSets.fontFamilyKeywords,
- );
- keywordSets.keyframeSelectorKeywords = new Set(['from', 'to']);
- // https://www.w3.org/TR/css-page-3/#syntax-page-selector
- keywordSets.pageMarginAtRules = new Set([
- 'top-left-corner',
- 'top-left',
- 'top-center',
- 'top-right',
- 'top-right-corner',
- 'bottom-left-corner',
- 'bottom-left',
- 'bottom-center',
- 'bottom-right',
- 'bottom-right-corner',
- 'left-top',
- 'left-middle',
- 'left-bottom',
- 'right-top',
- 'right-middle',
- 'right-bottom',
- ]);
- // https://developer.mozilla.org/en/docs/Web/CSS/At-rule
- keywordSets.atRules = uniteSets(keywordSets.pageMarginAtRules, [
- 'annotation',
- 'apply',
- 'character-variant',
- 'charset',
- 'counter-style',
- 'custom-media',
- 'custom-selector',
- 'document',
- 'font-face',
- 'font-feature-values',
- 'import',
- 'keyframes',
- 'media',
- 'namespace',
- 'nest',
- 'ornaments',
- 'page',
- 'property',
- 'styleset',
- 'stylistic',
- 'supports',
- 'swash',
- 'viewport',
- ]);
- // https://drafts.csswg.org/mediaqueries/#descdef-media-update
- keywordSets.deprecatedMediaFeatureNames = new Set([
- 'device-aspect-ratio',
- 'device-height',
- 'device-width',
- 'max-device-aspect-ratio',
- 'max-device-height',
- 'max-device-width',
- 'min-device-aspect-ratio',
- 'min-device-height',
- 'min-device-width',
- ]);
- // https://drafts.csswg.org/mediaqueries/#descdef-media-update
- keywordSets.mediaFeatureNames = uniteSets(keywordSets.deprecatedMediaFeatureNames, [
- 'any-hover',
- 'any-pointer',
- 'aspect-ratio',
- 'color',
- 'color-gamut',
- 'color-index',
- 'dynamic-range',
- 'forced-colors',
- 'grid',
- 'height',
- 'hover',
- 'inverted-colors',
- 'light-level',
- 'max-aspect-ratio',
- 'max-color',
- 'max-color-index',
- 'max-height',
- 'max-monochrome',
- 'max-resolution',
- 'max-width',
- 'min-aspect-ratio',
- 'min-color',
- 'min-color-index',
- 'min-height',
- 'min-monochrome',
- 'min-resolution',
- 'min-width',
- 'monochrome',
- 'orientation',
- 'overflow-block',
- 'overflow-inline',
- 'pointer',
- 'prefers-color-scheme',
- 'prefers-contrast',
- 'prefers-reduced-motion',
- 'prefers-reduced-transparency',
- 'resolution',
- 'scan',
- 'scripting',
- 'update',
- 'video-dynamic-range',
- 'width',
- ]);
- // https://www.w3.org/TR/CSS22/ui.html#system-colors
- keywordSets.systemColors = new Set([
- 'activeborder',
- 'activecaption',
- 'appworkspace',
- 'background',
- 'buttonface',
- 'buttonhighlight',
- 'buttonshadow',
- 'buttontext',
- 'captiontext',
- 'graytext',
- 'highlight',
- 'highlighttext',
- 'inactiveborder',
- 'inactivecaption',
- 'inactivecaptiontext',
- 'infobackground',
- 'infotext',
- 'menu',
- 'menutext',
- 'scrollbar',
- 'threeddarkshadow',
- 'threedface',
- 'threedhighlight',
- 'threedlightshadow',
- 'threedshadow',
- 'window',
- 'windowframe',
- 'windowtext',
- ]);
- // htmlTags includes only "standard" tags. So we augment it with older tags etc.
- keywordSets.nonStandardHtmlTags = new Set([
- 'acronym',
- 'applet',
- 'basefont',
- 'big',
- 'blink',
- 'center',
- 'content',
- 'dir',
- 'font',
- 'frame',
- 'frameset',
- 'hgroup',
- 'isindex',
- 'keygen',
- 'listing',
- 'marquee',
- 'nobr',
- 'noembed',
- 'plaintext',
- 'spacer',
- 'strike',
- 'tt',
- 'xmp',
- ]);
- keywordSets.validMixedCaseSvgElements = new Set([
- 'altGlyph',
- 'altGlyphDef',
- 'altGlyphItem',
- 'animateColor',
- 'animateMotion',
- 'animateTransform',
- 'clipPath',
- 'feBlend',
- 'feColorMatrix',
- 'feComponentTransfer',
- 'feComposite',
- 'feConvolveMatrix',
- 'feDiffuseLighting',
- 'feDisplacementMap',
- 'feDistantLight',
- 'feDropShadow',
- 'feFlood',
- 'feFuncA',
- 'feFuncB',
- 'feFuncG',
- 'feFuncR',
- 'feGaussianBlur',
- 'feImage',
- 'feMerge',
- 'feMergeNode',
- 'feMorphology',
- 'feOffset',
- 'fePointLight',
- 'feSpecularLighting',
- 'feSpotLight',
- 'feTile',
- 'feTurbulence',
- 'foreignObject',
- 'glyphRef',
- 'linearGradient',
- 'radialGradient',
- 'textPath',
- ]);
- /**
- * @param {(string[] | Set<string>)[]} args
- */
- function uniteSets(...args) {
- return new Set([...args].reduce((result, set) => [...result, ...set], []));
- }
- module.exports = keywordSets;
|