@tbela99/css-parser 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/index-umd-web.js +288 -173
- package/dist/index.cjs +288 -173
- package/dist/index.d.ts +24 -7
- package/dist/lib/ast/minify.js +1 -2
- package/dist/lib/ast/types.js +9 -0
- package/dist/lib/ast/utils/utils.js +104 -0
- package/dist/lib/parser/parse.js +24 -41
- package/dist/lib/renderer/color/utils/constants.js +1 -1
- package/dist/lib/syntax/syntax.js +4 -0
- package/dist/lib/validation/config.json.js +63 -63
- package/dist/lib/validation/parser/parse.js +14 -31
- package/dist/lib/validation/syntax.js +182 -37
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -14,8 +14,17 @@ var SyntaxValidationResult;
|
|
|
14
14
|
*/
|
|
15
15
|
exports.ValidationLevel = void 0;
|
|
16
16
|
(function (ValidationLevel) {
|
|
17
|
+
/**
|
|
18
|
+
* disable validation
|
|
19
|
+
*/
|
|
17
20
|
ValidationLevel[ValidationLevel["None"] = 0] = "None";
|
|
21
|
+
/**
|
|
22
|
+
* validate selectors and at-rules
|
|
23
|
+
*/
|
|
18
24
|
ValidationLevel[ValidationLevel["Default"] = 1] = "Default";
|
|
25
|
+
/**
|
|
26
|
+
* validate selectors, at-rules and declarations
|
|
27
|
+
*/
|
|
19
28
|
ValidationLevel[ValidationLevel["All"] = 2] = "All"; // selectors + at-rules + declarations
|
|
20
29
|
})(exports.ValidationLevel || (exports.ValidationLevel = {}));
|
|
21
30
|
/**
|
|
@@ -256,7 +265,7 @@ const D50 = [0.3457 / 0.3585, 1.00000, (1.0 - 0.3457 - 0.3585) / 0.3585];
|
|
|
256
265
|
const k = Math.pow(29, 3) / Math.pow(3, 3);
|
|
257
266
|
const e = Math.pow(6, 3) / Math.pow(29, 3);
|
|
258
267
|
// color module v4
|
|
259
|
-
const systemColors = new Set(['ActiveText', 'ButtonBorder', 'ButtonFace', 'ButtonText', 'Canvas', 'CanvasText', 'Field', 'FieldText', 'GrayText', 'Highlight', 'HighlightText', 'LinkText', 'Mark', 'MarkText', 'VisitedText'].map(m => m.toLowerCase()));
|
|
268
|
+
const systemColors = new Set(['ActiveText', 'ButtonBorder', 'ButtonFace', 'ButtonText', 'Canvas', 'CanvasText', 'Field', 'FieldText', 'GrayText', 'Highlight', 'HighlightText', 'LinkText', 'Mark', 'MarkText', 'VisitedText', '-webkit-focus-ring-color'].map(m => m.toLowerCase()));
|
|
260
269
|
// deprecated
|
|
261
270
|
const deprecatedSystemColors = 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'].map(t => t.toLowerCase()));
|
|
262
271
|
// name to color
|
|
@@ -4285,6 +4294,8 @@ const pseudoElements = [':before', ':after', ':first-line', ':first-letter'];
|
|
|
4285
4294
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/WebKit_Extensions
|
|
4286
4295
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/Mozilla_Extensions
|
|
4287
4296
|
const pseudoAliasMap = {
|
|
4297
|
+
'-moz-center': 'center',
|
|
4298
|
+
'-webkit-center': 'center',
|
|
4288
4299
|
'-ms-grid-columns': 'grid-template-columns',
|
|
4289
4300
|
'-ms-grid-rows': 'grid-template-rows',
|
|
4290
4301
|
'-ms-grid-row': 'grid-row-start',
|
|
@@ -4297,6 +4308,7 @@ const pseudoAliasMap = {
|
|
|
4297
4308
|
'::-ms-input-placeholder': '::placeholder',
|
|
4298
4309
|
':-moz-any()': ':is',
|
|
4299
4310
|
'-moz-user-modify': 'user-modify',
|
|
4311
|
+
'-webkit-match-parent': 'match-parent',
|
|
4300
4312
|
'-moz-background-clip': 'background-clip',
|
|
4301
4313
|
'-moz-background-origin': 'background-origin',
|
|
4302
4314
|
'-ms-input-placeholder': 'placeholder',
|
|
@@ -4453,6 +4465,7 @@ const webkitExtensions = new Set([
|
|
|
4453
4465
|
'-webkit-min-logical-height',
|
|
4454
4466
|
'-webkit-min-logical-width',
|
|
4455
4467
|
'-webkit-nbsp-mode',
|
|
4468
|
+
'-webkit-match-parent',
|
|
4456
4469
|
'-webkit-perspective-origin-x',
|
|
4457
4470
|
'-webkit-perspective-origin-y',
|
|
4458
4471
|
'-webkit-rtl-ordering',
|
|
@@ -7454,7 +7467,7 @@ var declarations = {
|
|
|
7454
7467
|
syntax: "auto | after"
|
|
7455
7468
|
},
|
|
7456
7469
|
"-ms-overflow-style": {
|
|
7457
|
-
syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar"
|
|
7470
|
+
syntax: "auto | none | scrollbar | -ms-autohiding-scrollbar auto | none | scrollbar | -ms-autohiding-scrollbar"
|
|
7458
7471
|
},
|
|
7459
7472
|
"-ms-scroll-chaining": {
|
|
7460
7473
|
syntax: "chained | none"
|
|
@@ -7564,9 +7577,6 @@ var declarations = {
|
|
|
7564
7577
|
"-moz-force-broken-image-icon": {
|
|
7565
7578
|
syntax: "0 | 1"
|
|
7566
7579
|
},
|
|
7567
|
-
"-moz-image-region": {
|
|
7568
|
-
syntax: "<shape> | auto"
|
|
7569
|
-
},
|
|
7570
7580
|
"-moz-orient": {
|
|
7571
7581
|
syntax: "inline | block | horizontal | vertical"
|
|
7572
7582
|
},
|
|
@@ -7607,7 +7617,7 @@ var declarations = {
|
|
|
7607
7617
|
syntax: "default | menu | tooltip | sheet | none"
|
|
7608
7618
|
},
|
|
7609
7619
|
"-webkit-appearance": {
|
|
7610
|
-
syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button"
|
|
7620
|
+
syntax: "none | button | button-bevel | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button none | button | button-bevel | caps-lock-indicator | caret | checkbox | default-button | inner-spin-button | listbox | listitem | media-controls-background | media-controls-fullscreen-background | media-current-time-display | media-enter-fullscreen-button | media-exit-fullscreen-button | media-fullscreen-button | media-mute-button | media-overlay-play-button | media-play-button | media-seek-back-button | media-seek-forward-button | media-slider | media-sliderthumb | media-time-remaining-display | media-toggle-closed-captions-button | media-volume-slider | media-volume-slider-container | media-volume-sliderthumb | menulist | menulist-button | menulist-text | menulist-textfield | meter | progress-bar | progress-bar-value | push-button | radio | scrollbarbutton-down | scrollbarbutton-left | scrollbarbutton-right | scrollbarbutton-up | scrollbargripper-horizontal | scrollbargripper-vertical | scrollbarthumb-horizontal | scrollbarthumb-vertical | scrollbartrack-horizontal | scrollbartrack-vertical | searchfield | searchfield-cancel-button | searchfield-decoration | searchfield-results-button | searchfield-results-decoration | slider-horizontal | slider-vertical | sliderthumb-horizontal | sliderthumb-vertical | square-button | textarea | textfield | -apple-pay-button"
|
|
7611
7621
|
},
|
|
7612
7622
|
"-webkit-border-before": {
|
|
7613
7623
|
syntax: "<'border-width'> || <'border-style'> || <color>"
|
|
@@ -7691,7 +7701,7 @@ var declarations = {
|
|
|
7691
7701
|
syntax: "read-only | read-write | read-write-plaintext-only"
|
|
7692
7702
|
},
|
|
7693
7703
|
"-webkit-user-select": {
|
|
7694
|
-
syntax: "auto | text | none | all"
|
|
7704
|
+
syntax: "auto | text | none | all auto | none | text | all"
|
|
7695
7705
|
},
|
|
7696
7706
|
"accent-color": {
|
|
7697
7707
|
syntax: "auto | <color>"
|
|
@@ -7709,7 +7719,7 @@ var declarations = {
|
|
|
7709
7719
|
syntax: "[ normal | <baseline-position> | <content-distribution> | <overflow-position>? <content-position> ]#"
|
|
7710
7720
|
},
|
|
7711
7721
|
"alignment-baseline": {
|
|
7712
|
-
syntax: "baseline | alphabetic | ideographic | middle | central | mathematical | text-before-edge | text-after-edge"
|
|
7722
|
+
syntax: "baseline | alphabetic | ideographic | middle | central | mathematical | text-before-edge | text-after-edge auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical"
|
|
7713
7723
|
},
|
|
7714
7724
|
all: {
|
|
7715
7725
|
syntax: "initial | inherit | unset | revert | revert-layer"
|
|
@@ -7733,7 +7743,7 @@ var declarations = {
|
|
|
7733
7743
|
syntax: "<single-animation-direction>#"
|
|
7734
7744
|
},
|
|
7735
7745
|
"animation-duration": {
|
|
7736
|
-
syntax: "<time
|
|
7746
|
+
syntax: "[ auto | <time [0s,∞]> ]#"
|
|
7737
7747
|
},
|
|
7738
7748
|
"animation-fill-mode": {
|
|
7739
7749
|
syntax: "<single-animation-fill-mode>#"
|
|
@@ -7811,7 +7821,7 @@ var declarations = {
|
|
|
7811
7821
|
syntax: "<bg-size>#"
|
|
7812
7822
|
},
|
|
7813
7823
|
"baseline-shift": {
|
|
7814
|
-
syntax: "<length-percentage> | sub | super | baseline"
|
|
7824
|
+
syntax: "<length-percentage> | sub | super | baseline baseline | sub | super | <svg-length>"
|
|
7815
7825
|
},
|
|
7816
7826
|
"block-size": {
|
|
7817
7827
|
syntax: "<'width'>"
|
|
@@ -8150,7 +8160,7 @@ var declarations = {
|
|
|
8150
8160
|
syntax: "[ <counter-name> <integer>? ]+ | none"
|
|
8151
8161
|
},
|
|
8152
8162
|
cursor: {
|
|
8153
|
-
syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ]"
|
|
8163
|
+
syntax: "[ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing ] ] [ [ <url> [ <x> <y> ]? , ]* [ auto | default | none | context-menu | help | pointer | progress | wait | cell | crosshair | text | vertical-text | alias | copy | move | no-drop | not-allowed | e-resize | n-resize | ne-resize | nw-resize | s-resize | se-resize | sw-resize | w-resize | ew-resize | ns-resize | nesw-resize | nwse-resize | col-resize | row-resize | all-scroll | zoom-in | zoom-out | grab | grabbing | hand | -webkit-grab | -webkit-grabbing | -webkit-zoom-in | -webkit-zoom-out | -moz-grab | -moz-grabbing | -moz-zoom-in | -moz-zoom-out ] ]"
|
|
8154
8164
|
},
|
|
8155
8165
|
cx: {
|
|
8156
8166
|
syntax: "<length> | <percentage>"
|
|
@@ -8165,10 +8175,10 @@ var declarations = {
|
|
|
8165
8175
|
syntax: "ltr | rtl"
|
|
8166
8176
|
},
|
|
8167
8177
|
display: {
|
|
8168
|
-
syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy
|
|
8178
|
+
syntax: "[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> | <-non-standard-display>"
|
|
8169
8179
|
},
|
|
8170
8180
|
"dominant-baseline": {
|
|
8171
|
-
syntax: "auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top"
|
|
8181
|
+
syntax: "auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top auto | use-script | no-change | reset-size | ideographic | alphabetic | hanging | mathematical | central | middle | text-after-edge | text-before-edge"
|
|
8172
8182
|
},
|
|
8173
8183
|
"empty-cells": {
|
|
8174
8184
|
syntax: "show | hide"
|
|
@@ -8180,13 +8190,13 @@ var declarations = {
|
|
|
8180
8190
|
syntax: "<paint>"
|
|
8181
8191
|
},
|
|
8182
8192
|
"fill-opacity": {
|
|
8183
|
-
syntax: "<'opacity'>"
|
|
8193
|
+
syntax: "<'opacity'> <number-zero-one>"
|
|
8184
8194
|
},
|
|
8185
8195
|
"fill-rule": {
|
|
8186
8196
|
syntax: "nonzero | evenodd"
|
|
8187
8197
|
},
|
|
8188
8198
|
filter: {
|
|
8189
|
-
syntax: "none | <filter-value-list>"
|
|
8199
|
+
syntax: "none | <filter-value-list> | <-ms-filter-function-list>"
|
|
8190
8200
|
},
|
|
8191
8201
|
flex: {
|
|
8192
8202
|
syntax: "none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]"
|
|
@@ -8219,7 +8229,7 @@ var declarations = {
|
|
|
8219
8229
|
syntax: "<'opacity'>"
|
|
8220
8230
|
},
|
|
8221
8231
|
font: {
|
|
8222
|
-
syntax: "[ [ <'font-style'> || <font-variant-css2> || <'font-weight'> || <font-width-css3> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'># ] | <system-family-name>"
|
|
8232
|
+
syntax: "[ [ <'font-style'> || <font-variant-css2> || <'font-weight'> || <font-width-css3> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'># ] | <system-family-name> [ [ <'font-style'> || <font-variant-css2> || <'font-weight'> || <font-width-css3> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'># ] | <system-family-name> | <-non-standard-font>"
|
|
8223
8233
|
},
|
|
8224
8234
|
"font-family": {
|
|
8225
8235
|
syntax: "[ <family-name> | <generic-family> ]#"
|
|
@@ -8366,7 +8376,7 @@ var declarations = {
|
|
|
8366
8376
|
syntax: "none | [ first || [ force-end | allow-end ] || last ]"
|
|
8367
8377
|
},
|
|
8368
8378
|
height: {
|
|
8369
|
-
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>"
|
|
8379
|
+
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | <-non-standard-size>"
|
|
8370
8380
|
},
|
|
8371
8381
|
"hyphenate-character": {
|
|
8372
8382
|
syntax: "auto | <string>"
|
|
@@ -8381,7 +8391,7 @@ var declarations = {
|
|
|
8381
8391
|
syntax: "from-image | <angle> | [ <angle>? flip ]"
|
|
8382
8392
|
},
|
|
8383
8393
|
"image-rendering": {
|
|
8384
|
-
syntax: "auto | crisp-edges | pixelated | smooth| optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
|
|
8394
|
+
syntax: "auto | crisp-edges | pixelated | smooth | optimizeSpeed | optimizeQuality | <-non-standard-image-rendering>"
|
|
8385
8395
|
},
|
|
8386
8396
|
"image-resolution": {
|
|
8387
8397
|
syntax: "[ from-image || <resolution> ] && snap?"
|
|
@@ -8441,7 +8451,7 @@ var declarations = {
|
|
|
8441
8451
|
syntax: "<length> | <percentage> | auto"
|
|
8442
8452
|
},
|
|
8443
8453
|
"letter-spacing": {
|
|
8444
|
-
syntax: "normal | <length>"
|
|
8454
|
+
syntax: "normal | <length> normal | <length-percentage>"
|
|
8445
8455
|
},
|
|
8446
8456
|
"lighting-color": {
|
|
8447
8457
|
syntax: "<color>"
|
|
@@ -8585,7 +8595,7 @@ var declarations = {
|
|
|
8585
8595
|
syntax: "<'max-width'>"
|
|
8586
8596
|
},
|
|
8587
8597
|
"max-height": {
|
|
8588
|
-
syntax: "none | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>"
|
|
8598
|
+
syntax: "none | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | <-non-standard-size>"
|
|
8589
8599
|
},
|
|
8590
8600
|
"max-inline-size": {
|
|
8591
8601
|
syntax: "<'max-width'>"
|
|
@@ -8594,19 +8604,19 @@ var declarations = {
|
|
|
8594
8604
|
syntax: "none | <integer>"
|
|
8595
8605
|
},
|
|
8596
8606
|
"max-width": {
|
|
8597
|
-
syntax: "none | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>"
|
|
8607
|
+
syntax: "none | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | <-non-standard-size>"
|
|
8598
8608
|
},
|
|
8599
8609
|
"min-block-size": {
|
|
8600
8610
|
syntax: "<'min-width'>"
|
|
8601
8611
|
},
|
|
8602
8612
|
"min-height": {
|
|
8603
|
-
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>"
|
|
8613
|
+
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | <-non-standard-size>"
|
|
8604
8614
|
},
|
|
8605
8615
|
"min-inline-size": {
|
|
8606
8616
|
syntax: "<'min-width'>"
|
|
8607
8617
|
},
|
|
8608
8618
|
"min-width": {
|
|
8609
|
-
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>"
|
|
8619
|
+
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | <-non-standard-size>"
|
|
8610
8620
|
},
|
|
8611
8621
|
"mix-blend-mode": {
|
|
8612
8622
|
syntax: "<blend-mode> | plus-lighter"
|
|
@@ -8663,7 +8673,7 @@ var declarations = {
|
|
|
8663
8673
|
syntax: "<line-width>"
|
|
8664
8674
|
},
|
|
8665
8675
|
overflow: {
|
|
8666
|
-
syntax: "[ visible | hidden | clip | scroll | auto ]{1,2}"
|
|
8676
|
+
syntax: "[ visible | hidden | clip | scroll | auto ]{1,2} | <-non-standard-overflow>"
|
|
8667
8677
|
},
|
|
8668
8678
|
"overflow-anchor": {
|
|
8669
8679
|
syntax: "auto | none"
|
|
@@ -8684,10 +8694,10 @@ var declarations = {
|
|
|
8684
8694
|
syntax: "normal | break-word | anywhere"
|
|
8685
8695
|
},
|
|
8686
8696
|
"overflow-x": {
|
|
8687
|
-
syntax: "visible | hidden | clip | scroll | auto"
|
|
8697
|
+
syntax: "visible | hidden | clip | scroll | auto | <-non-standard-overflow>"
|
|
8688
8698
|
},
|
|
8689
8699
|
"overflow-y": {
|
|
8690
|
-
syntax: "visible | hidden | clip | scroll | auto"
|
|
8700
|
+
syntax: "visible | hidden | clip | scroll | auto | <-non-standard-overflow>"
|
|
8691
8701
|
},
|
|
8692
8702
|
overlay: {
|
|
8693
8703
|
syntax: "none | auto"
|
|
@@ -8774,7 +8784,7 @@ var declarations = {
|
|
|
8774
8784
|
syntax: "auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit"
|
|
8775
8785
|
},
|
|
8776
8786
|
position: {
|
|
8777
|
-
syntax: "static | relative | absolute | sticky | fixed| -webkit-sticky"
|
|
8787
|
+
syntax: "static | relative | absolute | sticky | fixed | -webkit-sticky"
|
|
8778
8788
|
},
|
|
8779
8789
|
"position-anchor": {
|
|
8780
8790
|
syntax: "auto | <anchor-name>"
|
|
@@ -8981,25 +8991,25 @@ var declarations = {
|
|
|
8981
8991
|
syntax: "<color>"
|
|
8982
8992
|
},
|
|
8983
8993
|
"stroke-dasharray": {
|
|
8984
|
-
syntax: "none | <dasharray>"
|
|
8994
|
+
syntax: "none | <dasharray> none | [ <svg-length>+ ]#"
|
|
8985
8995
|
},
|
|
8986
8996
|
"stroke-dashoffset": {
|
|
8987
|
-
syntax: "<length-percentage> | <number>"
|
|
8997
|
+
syntax: "<length-percentage> | <number> <svg-length>"
|
|
8988
8998
|
},
|
|
8989
8999
|
"stroke-linecap": {
|
|
8990
9000
|
syntax: "butt | round | square"
|
|
8991
9001
|
},
|
|
8992
9002
|
"stroke-linejoin": {
|
|
8993
|
-
syntax: "miter | miter-clip | round | bevel | arcs"
|
|
9003
|
+
syntax: "miter | miter-clip | round | bevel | arcs miter | round | bevel"
|
|
8994
9004
|
},
|
|
8995
9005
|
"stroke-miterlimit": {
|
|
8996
|
-
syntax: "<number>"
|
|
9006
|
+
syntax: "<number> <number-one-or-greater>"
|
|
8997
9007
|
},
|
|
8998
9008
|
"stroke-opacity": {
|
|
8999
9009
|
syntax: "<'opacity'>"
|
|
9000
9010
|
},
|
|
9001
9011
|
"stroke-width": {
|
|
9002
|
-
syntax: "<length-percentage> | <number>"
|
|
9012
|
+
syntax: "<length-percentage> | <number> <svg-length>"
|
|
9003
9013
|
},
|
|
9004
9014
|
"tab-size": {
|
|
9005
9015
|
syntax: "<integer> | <length>"
|
|
@@ -9008,7 +9018,7 @@ var declarations = {
|
|
|
9008
9018
|
syntax: "auto | fixed"
|
|
9009
9019
|
},
|
|
9010
9020
|
"text-align": {
|
|
9011
|
-
syntax: "start | end | left | right | center | justify | match-parent"
|
|
9021
|
+
syntax: "start | end | left | right | center | justify | match-parent | <-non-standard-text-align>"
|
|
9012
9022
|
},
|
|
9013
9023
|
"text-align-last": {
|
|
9014
9024
|
syntax: "auto | start | end | left | right | center | justify"
|
|
@@ -9146,7 +9156,7 @@ var declarations = {
|
|
|
9146
9156
|
syntax: "none | <length-percentage> [ <length-percentage> <length>? ]?"
|
|
9147
9157
|
},
|
|
9148
9158
|
"unicode-bidi": {
|
|
9149
|
-
syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext"
|
|
9159
|
+
syntax: "normal | embed | isolate | bidi-override | isolate-override | plaintext | -moz-isolate | -moz-isolate-override | -moz-plaintext | -webkit-isolate | -webkit-isolate-override | -webkit-plaintext"
|
|
9150
9160
|
},
|
|
9151
9161
|
"user-select": {
|
|
9152
9162
|
syntax: "auto | text | none | all"
|
|
@@ -9188,7 +9198,7 @@ var declarations = {
|
|
|
9188
9198
|
syntax: "<integer>"
|
|
9189
9199
|
},
|
|
9190
9200
|
width: {
|
|
9191
|
-
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>"
|
|
9201
|
+
syntax: "auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()> | stretch | <-non-standard-size>"
|
|
9192
9202
|
},
|
|
9193
9203
|
"will-change": {
|
|
9194
9204
|
syntax: "auto | <animateable-feature>#"
|
|
@@ -9203,7 +9213,7 @@ var declarations = {
|
|
|
9203
9213
|
syntax: "normal | break-word"
|
|
9204
9214
|
},
|
|
9205
9215
|
"writing-mode": {
|
|
9206
|
-
syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr"
|
|
9216
|
+
syntax: "horizontal-tb | vertical-rl | vertical-lr | sideways-rl | sideways-lr | <svg-writing-mode>"
|
|
9207
9217
|
},
|
|
9208
9218
|
x: {
|
|
9209
9219
|
syntax: "<length> | <percentage>"
|
|
@@ -9239,7 +9249,7 @@ var declarations = {
|
|
|
9239
9249
|
syntax: "auto | grayscale"
|
|
9240
9250
|
},
|
|
9241
9251
|
"-moz-user-select": {
|
|
9242
|
-
syntax: "none | text | all | -moz-none"
|
|
9252
|
+
syntax: "none | text | all | -moz-none | auto"
|
|
9243
9253
|
},
|
|
9244
9254
|
"-ms-flex-align": {
|
|
9245
9255
|
syntax: "start | end | center | baseline | stretch"
|
|
@@ -9846,10 +9856,10 @@ var syntaxes = {
|
|
|
9846
9856
|
syntax: "<url>"
|
|
9847
9857
|
},
|
|
9848
9858
|
color: {
|
|
9849
|
-
syntax: "<color-base> | currentColor | <system-color> | <light-dark()> |
|
|
9859
|
+
syntax: "<color-base> | currentColor | <system-color> | <device-cmyk()> | <light-dark()> | <-non-standard-color>"
|
|
9850
9860
|
},
|
|
9851
9861
|
"color()": {
|
|
9852
|
-
syntax: "color(
|
|
9862
|
+
syntax: "color( <colorspace-params> [ / [ <alpha-value> | none ] ]? )"
|
|
9853
9863
|
},
|
|
9854
9864
|
"color-base": {
|
|
9855
9865
|
syntax: "<hex-color> | <color-function> | <named-color> | <color-mix()> | transparent"
|
|
@@ -9861,7 +9871,7 @@ var syntaxes = {
|
|
|
9861
9871
|
syntax: "in [ <rectangular-color-space> | <polar-color-space> <hue-interpolation-method>? | <custom-color-space> ]"
|
|
9862
9872
|
},
|
|
9863
9873
|
"color-mix()": {
|
|
9864
|
-
syntax: "color-mix( <color-interpolation-method> , [ <color> && <percentage [0,100]>? ]#{2})"
|
|
9874
|
+
syntax: "color-mix( <color-interpolation-method> , [ <color> && <percentage [0,100]>? ]#{2} )"
|
|
9865
9875
|
},
|
|
9866
9876
|
"color-stop": {
|
|
9867
9877
|
syntax: "<color-stop-length> | <color-stop-angle>"
|
|
@@ -9876,10 +9886,10 @@ var syntaxes = {
|
|
|
9876
9886
|
syntax: "<linear-color-stop> , [ <linear-color-hint>? , <linear-color-stop> ]#?"
|
|
9877
9887
|
},
|
|
9878
9888
|
"colorspace-params": {
|
|
9879
|
-
syntax: "[
|
|
9889
|
+
syntax: "[ <predefined-rgb-params> | <xyz-params>]"
|
|
9880
9890
|
},
|
|
9881
9891
|
combinator: {
|
|
9882
|
-
syntax: "'>' | '+' | '~' | [ '
|
|
9892
|
+
syntax: "'>' | '+' | '~' | [ '|' '|' ]"
|
|
9883
9893
|
},
|
|
9884
9894
|
"common-lig-values": {
|
|
9885
9895
|
syntax: "[ common-ligatures | no-common-ligatures ]"
|
|
@@ -9888,7 +9898,7 @@ var syntaxes = {
|
|
|
9888
9898
|
syntax: "searchfield | textarea | push-button | slider-horizontal | checkbox | radio | square-button | menulist | listbox | meter | progress-bar | button"
|
|
9889
9899
|
},
|
|
9890
9900
|
"complex-selector": {
|
|
9891
|
-
syntax: "<
|
|
9901
|
+
syntax: "<complex-selector-unit> [ <combinator>? <complex-selector-unit> ]*"
|
|
9892
9902
|
},
|
|
9893
9903
|
"complex-selector-list": {
|
|
9894
9904
|
syntax: "<complex-selector>#"
|
|
@@ -9900,7 +9910,7 @@ var syntaxes = {
|
|
|
9900
9910
|
syntax: "add | subtract | intersect | exclude"
|
|
9901
9911
|
},
|
|
9902
9912
|
"compound-selector": {
|
|
9903
|
-
syntax: "[ <type-selector>? <subclass-selector>*
|
|
9913
|
+
syntax: "[ <type-selector>? <subclass-selector>* ]!"
|
|
9904
9914
|
},
|
|
9905
9915
|
"compound-selector-list": {
|
|
9906
9916
|
syntax: "<compound-selector>#"
|
|
@@ -9912,7 +9922,7 @@ var syntaxes = {
|
|
|
9912
9922
|
syntax: "[ [ [ from [ <angle> | <zero> ] ]? [ at <position> ]? ] || <color-interpolation-method> ]? , <angular-color-stop-list>"
|
|
9913
9923
|
},
|
|
9914
9924
|
"container-condition": {
|
|
9915
|
-
syntax: "
|
|
9925
|
+
syntax: "not <query-in-parens> | <query-in-parens> [ [ and <query-in-parens> ]* | [ or <query-in-parens> ]* ]"
|
|
9916
9926
|
},
|
|
9917
9927
|
"container-name": {
|
|
9918
9928
|
syntax: "<custom-ident>"
|
|
@@ -9924,7 +9934,7 @@ var syntaxes = {
|
|
|
9924
9934
|
syntax: "space-between | space-around | space-evenly | stretch"
|
|
9925
9935
|
},
|
|
9926
9936
|
"content-list": {
|
|
9927
|
-
syntax: "[ <string> | contents | <image> | <counter> | <quote> | <target> | <leader()> ]+"
|
|
9937
|
+
syntax: "[ <string> | contents | <image> | <counter> | <quote> | <target> | <leader()> | <attr()> ]+"
|
|
9928
9938
|
},
|
|
9929
9939
|
"content-position": {
|
|
9930
9940
|
syntax: "center | start | end | flex-start | flex-end"
|
|
@@ -9939,7 +9949,7 @@ var syntaxes = {
|
|
|
9939
9949
|
syntax: "contrast( [ <number> | <percentage> ]? )"
|
|
9940
9950
|
},
|
|
9941
9951
|
"coord-box": {
|
|
9942
|
-
syntax: "
|
|
9952
|
+
syntax: "content-box | padding-box | border-box | fill-box | stroke-box | view-box"
|
|
9943
9953
|
},
|
|
9944
9954
|
"cos()": {
|
|
9945
9955
|
syntax: "cos( <calc-sum> )"
|
|
@@ -9969,7 +9979,7 @@ var syntaxes = {
|
|
|
9969
9979
|
syntax: "cubic-bezier( [ <number [0,1]>, <number> ]#{2} )"
|
|
9970
9980
|
},
|
|
9971
9981
|
"cubic-bezier-easing-function": {
|
|
9972
|
-
syntax: "ease | ease-in | ease-out | ease-in-out |
|
|
9982
|
+
syntax: "ease | ease-in | ease-out | ease-in-out | cubic-bezier( <number [0,1]> , <number> , <number [0,1]> , <number> )"
|
|
9973
9983
|
},
|
|
9974
9984
|
"custom-color-space": {
|
|
9975
9985
|
syntax: "<dashed-ident>"
|
|
@@ -10020,7 +10030,7 @@ var syntaxes = {
|
|
|
10020
10030
|
syntax: "[ full-width | proportional-width ]"
|
|
10021
10031
|
},
|
|
10022
10032
|
"element()": {
|
|
10023
|
-
syntax: "element( <id-selector> )"
|
|
10033
|
+
syntax: "element( <custom-ident> , [ first | start | last | first-except ]? ) | element( <id-selector> )"
|
|
10024
10034
|
},
|
|
10025
10035
|
"ellipse()": {
|
|
10026
10036
|
syntax: "ellipse( <radial-size>? [ at <position> ]? )"
|
|
@@ -10101,10 +10111,10 @@ var syntaxes = {
|
|
|
10101
10111
|
syntax: "serif | sans-serif | system-ui | cursive | fantasy | math | monospace"
|
|
10102
10112
|
},
|
|
10103
10113
|
"general-enclosed": {
|
|
10104
|
-
syntax: "[ <function-token> <any-value
|
|
10114
|
+
syntax: "[ <function-token> <any-value>? ) ] | [ ( <any-value>? ) ]"
|
|
10105
10115
|
},
|
|
10106
10116
|
"generic-family": {
|
|
10107
|
-
syntax: "<generic-complete> | <generic-incomplete> |
|
|
10117
|
+
syntax: "<generic-script-specific>| <generic-complete> | <generic-incomplete> | <-non-standard-generic-family>"
|
|
10108
10118
|
},
|
|
10109
10119
|
"generic-incomplete": {
|
|
10110
10120
|
syntax: "ui-serif | ui-sans-serif | ui-monospace | ui-rounded"
|
|
@@ -10113,7 +10123,7 @@ var syntaxes = {
|
|
|
10113
10123
|
syntax: "<shape-box> | fill-box | stroke-box | view-box"
|
|
10114
10124
|
},
|
|
10115
10125
|
gradient: {
|
|
10116
|
-
syntax: "
|
|
10126
|
+
syntax: "| <-legacy-gradient>"
|
|
10117
10127
|
},
|
|
10118
10128
|
"grayscale()": {
|
|
10119
10129
|
syntax: "grayscale( [ <number> | <percentage> ]? )"
|
|
@@ -10401,7 +10411,7 @@ var syntaxes = {
|
|
|
10401
10411
|
syntax: "A5 | A4 | A3 | B5 | B4 | JIS-B5 | JIS-B4 | letter | legal | ledger"
|
|
10402
10412
|
},
|
|
10403
10413
|
paint: {
|
|
10404
|
-
syntax: "none | <color> | <url> [none | <color>]? | context-fill | context-stroke"
|
|
10414
|
+
syntax: "none | <color> | <url> [ none | <color> ]? | context-fill | context-stroke"
|
|
10405
10415
|
},
|
|
10406
10416
|
"paint()": {
|
|
10407
10417
|
syntax: "paint( <ident>, <declaration-value>? )"
|
|
@@ -10431,7 +10441,7 @@ var syntaxes = {
|
|
|
10431
10441
|
syntax: "[ [ left | center | right ] || [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]"
|
|
10432
10442
|
},
|
|
10433
10443
|
"position-area": {
|
|
10434
|
-
syntax: "[ left | center | right | span-left | span-right | x-start | x-end | span-x-start | span-x-end | x-self-start | x-self-end | span-x-self-start | span-x-self-end | span-all ] || [ top | center | bottom | span-top | span-bottom | y-start | y-end | span-y-start | span-y-end | y-self-start | y-self-end | span-y-self-start | span-y-self-end | span-all ] | [ block-start | center | block-end | span-block-start | span-block-end | span-all ] || [ inline-start | center | inline-end | span-inline-start | span-inline-end | span-all ] | [ self-block-start | center | self-block-end | span-self-block-start | span-self-block-end | span-all ] || [ self-inline-start | center | self-inline-end | span-self-inline-start | span-self-inline-end | span-all ] | [ start | center | end | span-start | span-end | span-all ]{1,2} | [ self-start | center | self-end | span-self-start | span-self-end | span-all ]{1,2}"
|
|
10444
|
+
syntax: "[ [ left | center | right | span-left | span-right | x-start | x-end | span-x-start | span-x-end | x-self-start | x-self-end | span-x-self-start | span-x-self-end | span-all ] || [ top | center | bottom | span-top | span-bottom | y-start | y-end | span-y-start | span-y-end | y-self-start | y-self-end | span-y-self-start | span-y-self-end | span-all ] | [ block-start | center | block-end | span-block-start | span-block-end | span-all ] || [ inline-start | center | inline-end | span-inline-start | span-inline-end | span-all ] | [ self-block-start | center | self-block-end | span-self-block-start | span-self-block-end | span-all ] || [ self-inline-start | center | self-inline-end | span-self-inline-start | span-self-inline-end | span-all ] | [ start | center | end | span-start | span-end | span-all ]{1,2} | [ self-start | center | self-end | span-self-start | span-self-end | span-all ]{1,2} ]"
|
|
10435
10445
|
},
|
|
10436
10446
|
"pow()": {
|
|
10437
10447
|
syntax: "pow( <calc-sum>, <calc-sum> )"
|
|
@@ -10446,13 +10456,13 @@ var syntaxes = {
|
|
|
10446
10456
|
syntax: "':' <ident-token> | ':' <function-token> <any-value> ')'"
|
|
10447
10457
|
},
|
|
10448
10458
|
"pseudo-element-selector": {
|
|
10449
|
-
syntax: "':' <pseudo-class-selector>"
|
|
10459
|
+
syntax: "':' <pseudo-class-selector> | <legacy-pseudo-element-selector>"
|
|
10450
10460
|
},
|
|
10451
10461
|
"pseudo-page": {
|
|
10452
10462
|
syntax: ": [ left | right | first | blank ]"
|
|
10453
10463
|
},
|
|
10454
10464
|
"query-in-parens": {
|
|
10455
|
-
syntax: "( <container-
|
|
10465
|
+
syntax: "( <container-condition> ) | ( <size-feature> ) | style( <style-query> ) | <general-enclosed>"
|
|
10456
10466
|
},
|
|
10457
10467
|
quote: {
|
|
10458
10468
|
syntax: "open-quote | close-quote | no-open-quote | no-close-quote"
|
|
@@ -10560,10 +10570,10 @@ var syntaxes = {
|
|
|
10560
10570
|
syntax: "scaleZ( [ <number> | <percentage> ] )"
|
|
10561
10571
|
},
|
|
10562
10572
|
"scope-end": {
|
|
10563
|
-
syntax: "<selector-list>"
|
|
10573
|
+
syntax: "<forgiving-selector-list>"
|
|
10564
10574
|
},
|
|
10565
10575
|
"scope-start": {
|
|
10566
|
-
syntax: "<selector-list>"
|
|
10576
|
+
syntax: "<forgiving-selector-list>"
|
|
10567
10577
|
},
|
|
10568
10578
|
"scroll()": {
|
|
10569
10579
|
syntax: "scroll( [ <scroller> || <axis> ]? )"
|
|
@@ -10596,7 +10606,7 @@ var syntaxes = {
|
|
|
10596
10606
|
syntax: "[ <length>{2,3} && <color>? ]"
|
|
10597
10607
|
},
|
|
10598
10608
|
shape: {
|
|
10599
|
-
syntax: "rect(<top>, <right>, <bottom>, <left>)"
|
|
10609
|
+
syntax: "rect( <top>, <right>, <bottom>, <left> ) | rect( <top> <right> <bottom> <left> )"
|
|
10600
10610
|
},
|
|
10601
10611
|
"shape-box": {
|
|
10602
10612
|
syntax: "<visual-box> | margin-box"
|
|
@@ -10647,7 +10657,7 @@ var syntaxes = {
|
|
|
10647
10657
|
syntax: "closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}"
|
|
10648
10658
|
},
|
|
10649
10659
|
"size-feature": {
|
|
10650
|
-
syntax: "<
|
|
10660
|
+
syntax: "<mf-plain> | <mf-boolean> | <mf-range>"
|
|
10651
10661
|
},
|
|
10652
10662
|
"skew()": {
|
|
10653
10663
|
syntax: "skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? )"
|
|
@@ -10674,10 +10684,10 @@ var syntaxes = {
|
|
|
10674
10684
|
syntax: "<declaration>"
|
|
10675
10685
|
},
|
|
10676
10686
|
"style-in-parens": {
|
|
10677
|
-
syntax: "( <style-
|
|
10687
|
+
syntax: "( <style-condition> ) | ( <style-feature> ) | <general-enclosed>"
|
|
10678
10688
|
},
|
|
10679
10689
|
"style-query": {
|
|
10680
|
-
syntax: "
|
|
10690
|
+
syntax: "<style-condition> | <style-feature>"
|
|
10681
10691
|
},
|
|
10682
10692
|
"subclass-selector": {
|
|
10683
10693
|
syntax: "<id-selector> | <class-selector> | <attribute-selector> | <pseudo-class-selector>"
|
|
@@ -10806,7 +10816,7 @@ var syntaxes = {
|
|
|
10806
10816
|
syntax: "xyz | xyz-d50 | xyz-d65"
|
|
10807
10817
|
},
|
|
10808
10818
|
"xyz-params": {
|
|
10809
|
-
syntax: "<xyz> [ <number> | <percentage> | none ]{3}"
|
|
10819
|
+
syntax: "<xyz-space> [ <number> | <percentage> | none ]{3}"
|
|
10810
10820
|
},
|
|
10811
10821
|
"-legacy-gradient": {
|
|
10812
10822
|
syntax: "<-webkit-gradient()> | <-legacy-linear-gradient> | <-legacy-repeating-linear-gradient> | <-legacy-radial-gradient> | <-legacy-repeating-radial-gradient>"
|
|
@@ -11001,10 +11011,13 @@ var syntaxes = {
|
|
|
11001
11011
|
syntax: "not <style-in-parens> | <style-in-parens> [ [ and <style-in-parens> ]* | [ or <style-in-parens> ]* ]"
|
|
11002
11012
|
},
|
|
11003
11013
|
"-non-standard-display": {
|
|
11004
|
-
syntax: "-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box"
|
|
11014
|
+
syntax: "-ms-inline-flexbox | -ms-grid | -ms-inline-grid | -webkit-flex | -webkit-inline-flex | -webkit-box | -webkit-inline-box | -moz-inline-stack | -moz-box | -moz-inline-box | -ms-flexbox"
|
|
11005
11015
|
},
|
|
11006
11016
|
"inset-area": {
|
|
11007
11017
|
syntax: "[ [ left | center | right | span-left | span-right | x-start | x-end | span-x-start | span-x-end | x-self-start | x-self-end | span-x-self-start | span-x-self-end | span-all ] || [ top | center | bottom | span-top | span-bottom | y-start | y-end | span-y-start | span-y-end | y-self-start | y-self-end | span-y-self-start | span-y-self-end | span-all ] | [ block-start | center | block-end | span-block-start | span-block-end | span-all ] || [ inline-start | center | inline-end | span-inline-start | span-inline-end | span-all ] | [ self-block-start | self-block-end | span-self-block-start | span-self-block-end | span-all ] || [ self-inline-start | self-inline-end | span-self-inline-start | span-self-inline-end | span-all ] | [ start | center | end | span-start | span-end | span-all ]{1,2} | [ self-start | center | self-end | span-self-start | span-self-end | span-all ]{1,2} ]"
|
|
11018
|
+
},
|
|
11019
|
+
"-non-standard-text-align": {
|
|
11020
|
+
syntax: "| -moz-center | -webkit-center | -webkit-match-parent"
|
|
11008
11021
|
}
|
|
11009
11022
|
};
|
|
11010
11023
|
var selectors = {
|
|
@@ -11653,20 +11666,6 @@ var ValidationSyntaxGroupEnum;
|
|
|
11653
11666
|
ValidationSyntaxGroupEnum["AtRules"] = "atRules";
|
|
11654
11667
|
})(ValidationSyntaxGroupEnum || (ValidationSyntaxGroupEnum = {}));
|
|
11655
11668
|
|
|
11656
|
-
var WalkValidationTokenEnum;
|
|
11657
|
-
(function (WalkValidationTokenEnum) {
|
|
11658
|
-
WalkValidationTokenEnum[WalkValidationTokenEnum["IgnoreChildren"] = 0] = "IgnoreChildren";
|
|
11659
|
-
WalkValidationTokenEnum[WalkValidationTokenEnum["IgnoreNode"] = 1] = "IgnoreNode";
|
|
11660
|
-
WalkValidationTokenEnum[WalkValidationTokenEnum["IgnoreAll"] = 2] = "IgnoreAll";
|
|
11661
|
-
})(WalkValidationTokenEnum || (WalkValidationTokenEnum = {}));
|
|
11662
|
-
var WalkValidationTokenKeyTypeEnum;
|
|
11663
|
-
(function (WalkValidationTokenKeyTypeEnum) {
|
|
11664
|
-
WalkValidationTokenKeyTypeEnum["Array"] = "array";
|
|
11665
|
-
WalkValidationTokenKeyTypeEnum["Children"] = "chi";
|
|
11666
|
-
WalkValidationTokenKeyTypeEnum["Left"] = "l";
|
|
11667
|
-
WalkValidationTokenKeyTypeEnum["Right"] = "r";
|
|
11668
|
-
WalkValidationTokenKeyTypeEnum["Prelude"] = "prelude";
|
|
11669
|
-
})(WalkValidationTokenKeyTypeEnum || (WalkValidationTokenKeyTypeEnum = {}));
|
|
11670
11669
|
const skipped = [
|
|
11671
11670
|
ValidationTokenEnum.Star,
|
|
11672
11671
|
ValidationTokenEnum.HashMark,
|
|
@@ -11680,18 +11679,6 @@ const objectProperties = {
|
|
|
11680
11679
|
writable: true,
|
|
11681
11680
|
configurable: true
|
|
11682
11681
|
};
|
|
11683
|
-
// syntaxes: keyword | <'property'> | <function>
|
|
11684
|
-
// "none | [ [<dashed-ident> || <try-tactic>] | inset-area( <'inset-area'> ) ]#"
|
|
11685
|
-
// ""
|
|
11686
|
-
// : "<outline-radius>{1,4} [ / <outline-radius>{1,4} ]?
|
|
11687
|
-
// ""
|
|
11688
|
-
// false | true
|
|
11689
|
-
// [ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#
|
|
11690
|
-
// false | true | green | pipe
|
|
11691
|
-
// keyword | <'property'> | <function>
|
|
11692
|
-
// [<dashed-ident> || <try-tactic>]
|
|
11693
|
-
// [ <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || [ <box> | border | padding | content | text ] || [ <box> | border | padding | content ] ]#
|
|
11694
|
-
// none | [ [<dashed-ident> || <try-tactic>] | inset-area( <'inset-area'> ) ]
|
|
11695
11682
|
function* tokenize(syntax, position = { ind: 0, lin: 1, col: 0 }, currentPosition = {
|
|
11696
11683
|
ind: -1,
|
|
11697
11684
|
lin: 1,
|
|
@@ -11854,7 +11841,6 @@ function matchParens(syntax, iterator) {
|
|
|
11854
11841
|
let items = [];
|
|
11855
11842
|
let match = 0;
|
|
11856
11843
|
while ((item = iterator.next()) && !item.done) {
|
|
11857
|
-
// console.error(JSON.stringify({match, val: item.value,func}, null, 1));
|
|
11858
11844
|
switch (item.value.typ) {
|
|
11859
11845
|
case ValidationTokenEnum.OpenParenthesis:
|
|
11860
11846
|
if (match > 0) {
|
|
@@ -12530,7 +12516,7 @@ function getTokenType$1(token, position, currentPosition) {
|
|
|
12530
12516
|
if (token.startsWith('<')) {
|
|
12531
12517
|
// <number [1,1000]>
|
|
12532
12518
|
// <length [0,∞]>
|
|
12533
|
-
let match = token.match(/<([a-z0-9-]+)(\s+\[([0-9]+),(([0-9]+)|∞)\])?>/);
|
|
12519
|
+
let match = token.match(/<([a-z0-9-]+)(\s+\[([0-9]+[a-zA-Z]*),(([0-9]+[a-zA-Z]*)|∞)\])?>/);
|
|
12534
12520
|
if (match == null) {
|
|
12535
12521
|
let match = token.match(/<([a-zA-Z0-9-]+)\(\)>/);
|
|
12536
12522
|
if (match != null) {
|
|
@@ -12542,10 +12528,12 @@ function getTokenType$1(token, position, currentPosition) {
|
|
|
12542
12528
|
throw new Error('invalid token at position: ' + position.lin + ':' + position.col + ' ' + token);
|
|
12543
12529
|
}
|
|
12544
12530
|
if (match[2] != null) {
|
|
12531
|
+
const type = getTokenType(match[3]);
|
|
12545
12532
|
return Object.defineProperty({
|
|
12546
12533
|
typ: ValidationTokenEnum.PropertyType,
|
|
12547
12534
|
val: match[1],
|
|
12548
|
-
|
|
12535
|
+
unit: exports.EnumToken[type.typ],
|
|
12536
|
+
range: [+type.val, match[4] == '\u221e' ? null : +match[4]]
|
|
12549
12537
|
}, 'pos', { ...objectProperties, value: pos });
|
|
12550
12538
|
}
|
|
12551
12539
|
return Object.defineProperty({
|
|
@@ -12616,7 +12604,7 @@ function renderSyntax(token, parent) {
|
|
|
12616
12604
|
case ValidationTokenEnum.Bracket:
|
|
12617
12605
|
return '[' + token.chi.reduce((acc, curr) => acc + renderSyntax(curr), '') + ']' + renderAttributes(token);
|
|
12618
12606
|
case ValidationTokenEnum.PropertyType:
|
|
12619
|
-
return '<' + token.val + '>' + renderAttributes(token);
|
|
12607
|
+
return '<' + token.val + (Array.isArray(token.range) ? `[${token?.range?.[0]}, ${token?.range?.[1] ?? '\u221e'}]` : '') + '>' + renderAttributes(token);
|
|
12620
12608
|
case ValidationTokenEnum.DeclarationType:
|
|
12621
12609
|
return "<'" + token.val + "'>" + renderAttributes(token);
|
|
12622
12610
|
case ValidationTokenEnum.Number:
|
|
@@ -13484,12 +13472,25 @@ function createContext(input) {
|
|
|
13484
13472
|
update(context) {
|
|
13485
13473
|
// @ts-ignore
|
|
13486
13474
|
const newIndex = result.indexOf(context.current());
|
|
13487
|
-
if (newIndex
|
|
13488
|
-
// console.error({newIndex, v: result[newIndex]});
|
|
13489
|
-
// console.error(new Error('update'))
|
|
13475
|
+
if (newIndex > this.index) {
|
|
13490
13476
|
this.index = newIndex;
|
|
13491
13477
|
}
|
|
13492
13478
|
},
|
|
13479
|
+
consume(token, howMany) {
|
|
13480
|
+
let newIndex = result.indexOf(token, this.index + 1);
|
|
13481
|
+
if (newIndex == -1 || newIndex < this.index) {
|
|
13482
|
+
return false;
|
|
13483
|
+
}
|
|
13484
|
+
howMany ??= 0;
|
|
13485
|
+
let splice = 1;
|
|
13486
|
+
if (result[newIndex - 1]?.typ == exports.EnumToken.WhitespaceTokenType) {
|
|
13487
|
+
splice++;
|
|
13488
|
+
newIndex--;
|
|
13489
|
+
}
|
|
13490
|
+
result.splice(this.index + 1, 0, ...result.splice(newIndex, splice + howMany));
|
|
13491
|
+
this.index += howMany + splice;
|
|
13492
|
+
return true;
|
|
13493
|
+
},
|
|
13493
13494
|
done() {
|
|
13494
13495
|
return this.index + 1 >= result.length;
|
|
13495
13496
|
},
|
|
@@ -13514,13 +13515,21 @@ function createContext(input) {
|
|
|
13514
13515
|
return result.slice(this.index + 1);
|
|
13515
13516
|
},
|
|
13516
13517
|
clone() {
|
|
13517
|
-
const context = createContext(
|
|
13518
|
+
const context = createContext(result.slice());
|
|
13518
13519
|
context.index = this.index;
|
|
13519
13520
|
return context;
|
|
13521
|
+
},
|
|
13522
|
+
// @ts-ignore
|
|
13523
|
+
toJSON() {
|
|
13524
|
+
return {
|
|
13525
|
+
index: this.index,
|
|
13526
|
+
slice: this.slice(),
|
|
13527
|
+
tokens: this.tokens()
|
|
13528
|
+
};
|
|
13520
13529
|
}
|
|
13521
13530
|
};
|
|
13522
13531
|
}
|
|
13523
|
-
function evaluateSyntax(node, options
|
|
13532
|
+
function evaluateSyntax(node, options) {
|
|
13524
13533
|
let ast;
|
|
13525
13534
|
let result;
|
|
13526
13535
|
switch (node.typ) {
|
|
@@ -13656,7 +13665,8 @@ function doEvaluateSyntax(syntaxes, context, options) {
|
|
|
13656
13665
|
}
|
|
13657
13666
|
context.update(result.context);
|
|
13658
13667
|
}
|
|
13659
|
-
|
|
13668
|
+
// @ts-ignore
|
|
13669
|
+
return result ?? {
|
|
13660
13670
|
valid: SyntaxValidationResult.Valid,
|
|
13661
13671
|
node: null,
|
|
13662
13672
|
syntax: syntaxes[i - 1],
|
|
@@ -13798,7 +13808,7 @@ function match(syntax, context, options) {
|
|
|
13798
13808
|
}
|
|
13799
13809
|
return {
|
|
13800
13810
|
valid: SyntaxValidationResult.Drop,
|
|
13801
|
-
node: context.
|
|
13811
|
+
node: context.current(),
|
|
13802
13812
|
syntax,
|
|
13803
13813
|
error: `expected '${ValidationTokenEnum[syntax.typ].toLowerCase()}', got '${context.done() ? null : renderToken(context.peek())}'`,
|
|
13804
13814
|
context
|
|
@@ -13833,7 +13843,7 @@ function match(syntax, context, options) {
|
|
|
13833
13843
|
}
|
|
13834
13844
|
switch (syntax.typ) {
|
|
13835
13845
|
case ValidationTokenEnum.Keyword:
|
|
13836
|
-
success = (token.typ == exports.EnumToken.IdenTokenType || token.typ == exports.EnumToken.DashedIdenTokenType) &&
|
|
13846
|
+
success = (token.typ == exports.EnumToken.IdenTokenType || token.typ == exports.EnumToken.DashedIdenTokenType || isIdentColor(token)) &&
|
|
13837
13847
|
(token.val == syntax.val ||
|
|
13838
13848
|
syntax.val.localeCompare(token.val, undefined, { sensitivity: 'base' }) == 0 ||
|
|
13839
13849
|
// config.declarations.all
|
|
@@ -13862,19 +13872,11 @@ function match(syntax, context, options) {
|
|
|
13862
13872
|
context
|
|
13863
13873
|
};
|
|
13864
13874
|
}
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
13868
|
-
|
|
13869
|
-
|
|
13870
|
-
occurence: null,
|
|
13871
|
-
atLeastOnce: null
|
|
13872
|
-
});
|
|
13873
|
-
if (result.valid == SyntaxValidationResult.Valid) {
|
|
13874
|
-
context.next();
|
|
13875
|
-
result.context = context;
|
|
13876
|
-
return result;
|
|
13877
|
-
}
|
|
13875
|
+
result = match(getParsedSyntax("syntaxes" /* ValidationSyntaxGroupEnum.Syntaxes */, syntax.val + '()')?.[0], context, options);
|
|
13876
|
+
if (result.valid == SyntaxValidationResult.Valid) {
|
|
13877
|
+
context.next();
|
|
13878
|
+
result.context = context;
|
|
13879
|
+
return result;
|
|
13878
13880
|
}
|
|
13879
13881
|
break;
|
|
13880
13882
|
case ValidationTokenEnum.DeclarationType:
|
|
@@ -13972,6 +13974,7 @@ function match(syntax, context, options) {
|
|
|
13972
13974
|
}
|
|
13973
13975
|
function matchPropertyType(syntax, context, options) {
|
|
13974
13976
|
if (![
|
|
13977
|
+
'bg-position',
|
|
13975
13978
|
'length-percentage', 'flex', 'calc-sum', 'color', 'color-base', 'system-color', 'deprecated-system-color',
|
|
13976
13979
|
'pseudo-class-selector', 'pseudo-element-selector'
|
|
13977
13980
|
].includes(syntax.val)) {
|
|
@@ -14001,6 +14004,96 @@ function matchPropertyType(syntax, context, options) {
|
|
|
14001
14004
|
return { ...result, context };
|
|
14002
14005
|
}
|
|
14003
14006
|
switch (syntax.val) {
|
|
14007
|
+
case 'bg-position': {
|
|
14008
|
+
let val;
|
|
14009
|
+
let keyworkMatchCount = 0;
|
|
14010
|
+
let lengthMatchCount = 0;
|
|
14011
|
+
let functionMatchCount = 0;
|
|
14012
|
+
let isBGX = false;
|
|
14013
|
+
let isBGY = false;
|
|
14014
|
+
while (token != null && keyworkMatchCount + lengthMatchCount + functionMatchCount < 3) {
|
|
14015
|
+
// match one value: keyword or length
|
|
14016
|
+
success = (token.typ == exports.EnumToken.FunctionTokenType && wildCardFuncs.includes(token.val));
|
|
14017
|
+
if (success) {
|
|
14018
|
+
functionMatchCount++;
|
|
14019
|
+
context.next();
|
|
14020
|
+
token = context.peek();
|
|
14021
|
+
continue;
|
|
14022
|
+
}
|
|
14023
|
+
if (token.typ == exports.EnumToken.WhitespaceTokenType) {
|
|
14024
|
+
context.next();
|
|
14025
|
+
token = context.peek();
|
|
14026
|
+
continue;
|
|
14027
|
+
}
|
|
14028
|
+
if (token.typ == exports.EnumToken.IdenTokenType) {
|
|
14029
|
+
val = token.val.toLowerCase();
|
|
14030
|
+
success = ['left', 'center', 'right', 'top', 'center', 'bottom'].includes(val);
|
|
14031
|
+
if (!success) {
|
|
14032
|
+
break;
|
|
14033
|
+
}
|
|
14034
|
+
keyworkMatchCount++;
|
|
14035
|
+
if (keyworkMatchCount > 2) {
|
|
14036
|
+
return {
|
|
14037
|
+
valid: SyntaxValidationResult.Drop,
|
|
14038
|
+
node: token,
|
|
14039
|
+
syntax,
|
|
14040
|
+
error: `expected <length-percentage>`,
|
|
14041
|
+
context
|
|
14042
|
+
};
|
|
14043
|
+
}
|
|
14044
|
+
if (val == 'left' || val == 'right') {
|
|
14045
|
+
if (isBGX) {
|
|
14046
|
+
return {
|
|
14047
|
+
valid: SyntaxValidationResult.Drop,
|
|
14048
|
+
node: token,
|
|
14049
|
+
syntax,
|
|
14050
|
+
error: `top | bottom | <length-percentage>`,
|
|
14051
|
+
context
|
|
14052
|
+
};
|
|
14053
|
+
}
|
|
14054
|
+
isBGX = true;
|
|
14055
|
+
}
|
|
14056
|
+
if (val == 'top' || val == 'bottom') {
|
|
14057
|
+
if (isBGY) {
|
|
14058
|
+
return {
|
|
14059
|
+
valid: SyntaxValidationResult.Drop,
|
|
14060
|
+
node: token,
|
|
14061
|
+
syntax,
|
|
14062
|
+
error: `expected left | right | <length-percentage>`,
|
|
14063
|
+
context
|
|
14064
|
+
};
|
|
14065
|
+
}
|
|
14066
|
+
isBGY = true;
|
|
14067
|
+
}
|
|
14068
|
+
context.next();
|
|
14069
|
+
token = context.peek();
|
|
14070
|
+
continue;
|
|
14071
|
+
}
|
|
14072
|
+
success = token.typ == exports.EnumToken.LengthTokenType || token.typ == exports.EnumToken.PercentageTokenType || (token.typ == exports.EnumToken.NumberTokenType && token.val == '0');
|
|
14073
|
+
if (!success) {
|
|
14074
|
+
break;
|
|
14075
|
+
}
|
|
14076
|
+
lengthMatchCount++;
|
|
14077
|
+
context.next();
|
|
14078
|
+
token = context.peek();
|
|
14079
|
+
}
|
|
14080
|
+
if (keyworkMatchCount + lengthMatchCount + functionMatchCount == 0) {
|
|
14081
|
+
return {
|
|
14082
|
+
valid: SyntaxValidationResult.Drop,
|
|
14083
|
+
node: token,
|
|
14084
|
+
syntax,
|
|
14085
|
+
error: `expected <bg-position>`,
|
|
14086
|
+
context
|
|
14087
|
+
};
|
|
14088
|
+
}
|
|
14089
|
+
return {
|
|
14090
|
+
valid: SyntaxValidationResult.Valid,
|
|
14091
|
+
node: token,
|
|
14092
|
+
syntax,
|
|
14093
|
+
error: '',
|
|
14094
|
+
context
|
|
14095
|
+
};
|
|
14096
|
+
}
|
|
14004
14097
|
case 'calc-sum':
|
|
14005
14098
|
success = (token.typ == exports.EnumToken.FunctionTokenType && mathFuncs.includes(token.val)) ||
|
|
14006
14099
|
// @ts-ignore
|
|
@@ -14069,8 +14162,8 @@ function matchPropertyType(syntax, context, options) {
|
|
|
14069
14162
|
case 'number':
|
|
14070
14163
|
case 'number-token':
|
|
14071
14164
|
success = token.typ == exports.EnumToken.NumberTokenType;
|
|
14072
|
-
if ('range' in syntax) {
|
|
14073
|
-
success =
|
|
14165
|
+
if (success && 'range' in syntax) {
|
|
14166
|
+
success = +token.val >= +syntax.range[0] && (syntax.range[1] == null || +token.val <= +syntax.range[1]);
|
|
14074
14167
|
}
|
|
14075
14168
|
break;
|
|
14076
14169
|
case 'angle':
|
|
@@ -14127,7 +14220,6 @@ function matchPropertyType(syntax, context, options) {
|
|
|
14127
14220
|
['length-percentage', 'length', 'number', 'number-token', 'angle', 'percentage', 'dimension'].includes(syntax.val)) {
|
|
14128
14221
|
if (!success) {
|
|
14129
14222
|
success = mathFuncs.includes(token.val.toLowerCase()) &&
|
|
14130
|
-
// (token as FunctionToken).val + '()' in config[ValidationSyntaxGroupEnum.Syntaxes] &&
|
|
14131
14223
|
doEvaluateSyntax(getParsedSyntax("syntaxes" /* ValidationSyntaxGroupEnum.Syntaxes */, token.val + '()')?.[0]?.chi ?? [], createContext(token.chi), {
|
|
14132
14224
|
...options,
|
|
14133
14225
|
isRepeatable: null,
|
|
@@ -14208,24 +14300,28 @@ function anyOf(syntaxes, context, options) {
|
|
|
14208
14300
|
function allOf(syntax, context, options) {
|
|
14209
14301
|
let result;
|
|
14210
14302
|
let i;
|
|
14211
|
-
|
|
14212
|
-
// 1px var(...) 2px => 1px 2px var(...)
|
|
14213
|
-
const slice = context.slice();
|
|
14303
|
+
let slice = context.slice();
|
|
14214
14304
|
const vars = [];
|
|
14215
14305
|
const tokens = [];
|
|
14306
|
+
const repeatable = [];
|
|
14307
|
+
// match optional syntax first
|
|
14308
|
+
// <length>{2,3}&&<color>? => <color>?&&<length>{2,3}
|
|
14309
|
+
for (i = 0; i < syntax.length; i++) {
|
|
14310
|
+
if (syntax[i].length == 1 && syntax[i][0].occurence != null) {
|
|
14311
|
+
repeatable.push(syntax[i]);
|
|
14312
|
+
syntax.splice(i--, 1);
|
|
14313
|
+
}
|
|
14314
|
+
}
|
|
14315
|
+
if (repeatable.length > 0) {
|
|
14316
|
+
syntax.push(...repeatable);
|
|
14317
|
+
}
|
|
14318
|
+
// sort tokens -> wildCard -> last
|
|
14319
|
+
// 1px var(...) 2px => 1px 2px var(...)
|
|
14216
14320
|
for (i = 0; i < slice.length; i++) {
|
|
14217
14321
|
if (slice[i].typ == exports.EnumToken.FunctionTokenType && wildCardFuncs.includes(slice[i].val.toLowerCase())) {
|
|
14218
14322
|
vars.push(slice[i]);
|
|
14219
|
-
slice
|
|
14220
|
-
|
|
14221
|
-
vars.push(slice[i]);
|
|
14222
|
-
slice.splice(i, 1);
|
|
14223
|
-
if (i > 0) {
|
|
14224
|
-
i--;
|
|
14225
|
-
}
|
|
14226
|
-
}
|
|
14227
|
-
if (i > 0) {
|
|
14228
|
-
i--;
|
|
14323
|
+
if (slice[i + 1]?.typ == exports.EnumToken.WhitespaceTokenType) {
|
|
14324
|
+
vars.push(slice[++i]);
|
|
14229
14325
|
}
|
|
14230
14326
|
continue;
|
|
14231
14327
|
}
|
|
@@ -14239,7 +14335,44 @@ function allOf(syntax, context, options) {
|
|
|
14239
14335
|
tokens.push(...vars);
|
|
14240
14336
|
}
|
|
14241
14337
|
const con = createContext(tokens);
|
|
14338
|
+
let cp;
|
|
14339
|
+
let j;
|
|
14242
14340
|
for (i = 0; i < syntax.length; i++) {
|
|
14341
|
+
if (syntax[i].length == 1 && syntax[i][0].isOptional) {
|
|
14342
|
+
syntax[i][0].isOptional = false;
|
|
14343
|
+
j = 0;
|
|
14344
|
+
cp = con.clone();
|
|
14345
|
+
slice = cp.slice();
|
|
14346
|
+
if (cp.done()) {
|
|
14347
|
+
syntax[i][0].isOptional = true;
|
|
14348
|
+
syntax.splice(i, 1);
|
|
14349
|
+
i = -1;
|
|
14350
|
+
continue;
|
|
14351
|
+
}
|
|
14352
|
+
while (!cp.done()) {
|
|
14353
|
+
result = doEvaluateSyntax(syntax[i], cp.clone(), options);
|
|
14354
|
+
if (result.valid == SyntaxValidationResult.Valid) {
|
|
14355
|
+
let end = slice.indexOf(cp.current());
|
|
14356
|
+
if (end == -1) {
|
|
14357
|
+
end = 0;
|
|
14358
|
+
}
|
|
14359
|
+
else {
|
|
14360
|
+
end -= j - 1;
|
|
14361
|
+
}
|
|
14362
|
+
con.consume(slice[j], end < 0 ? 0 : end);
|
|
14363
|
+
break;
|
|
14364
|
+
}
|
|
14365
|
+
cp.next();
|
|
14366
|
+
j++;
|
|
14367
|
+
}
|
|
14368
|
+
syntax[i][0].isOptional = true;
|
|
14369
|
+
// @ts-ignore
|
|
14370
|
+
if (result?.valid == SyntaxValidationResult.Valid) {
|
|
14371
|
+
syntax.splice(i, 1);
|
|
14372
|
+
i = -1;
|
|
14373
|
+
}
|
|
14374
|
+
continue;
|
|
14375
|
+
}
|
|
14243
14376
|
result = doEvaluateSyntax(syntax[i], con.clone(), options);
|
|
14244
14377
|
if (result.valid == SyntaxValidationResult.Valid) {
|
|
14245
14378
|
con.update(result.context);
|
|
@@ -16184,11 +16317,13 @@ async function doParse(iterator, options = {}) {
|
|
|
16184
16317
|
const src = options.src;
|
|
16185
16318
|
const stack = [];
|
|
16186
16319
|
const stats = {
|
|
16320
|
+
src: options.src ?? '',
|
|
16187
16321
|
bytesIn: 0,
|
|
16188
16322
|
importedBytesIn: 0,
|
|
16189
16323
|
parse: `0ms`,
|
|
16190
16324
|
minify: `0ms`,
|
|
16191
|
-
total: `0ms
|
|
16325
|
+
total: `0ms`,
|
|
16326
|
+
imports: []
|
|
16192
16327
|
};
|
|
16193
16328
|
let ast = {
|
|
16194
16329
|
typ: exports.EnumToken.StyleSheetNodeType,
|
|
@@ -16234,7 +16369,7 @@ async function doParse(iterator, options = {}) {
|
|
|
16234
16369
|
ast.loc.end = item.end;
|
|
16235
16370
|
}
|
|
16236
16371
|
if (item.token == ';' || item.token == '{') {
|
|
16237
|
-
node = parseNode(tokens, context,
|
|
16372
|
+
node = parseNode(tokens, context, options, errors, src, map, rawTokens);
|
|
16238
16373
|
rawTokens.length = 0;
|
|
16239
16374
|
if (node != null) {
|
|
16240
16375
|
if ('chi' in node) {
|
|
@@ -16273,7 +16408,7 @@ async function doParse(iterator, options = {}) {
|
|
|
16273
16408
|
map = new Map;
|
|
16274
16409
|
}
|
|
16275
16410
|
else if (item.token == '}') {
|
|
16276
|
-
parseNode(tokens, context,
|
|
16411
|
+
parseNode(tokens, context, options, errors, src, map, rawTokens);
|
|
16277
16412
|
rawTokens.length = 0;
|
|
16278
16413
|
if (context.loc != null) {
|
|
16279
16414
|
context.loc.end = item.end;
|
|
@@ -16294,7 +16429,7 @@ async function doParse(iterator, options = {}) {
|
|
|
16294
16429
|
}
|
|
16295
16430
|
}
|
|
16296
16431
|
if (tokens.length > 0) {
|
|
16297
|
-
node = parseNode(tokens, context,
|
|
16432
|
+
node = parseNode(tokens, context, options, errors, src, map, rawTokens);
|
|
16298
16433
|
rawTokens.length = 0;
|
|
16299
16434
|
if (node != null) {
|
|
16300
16435
|
if (node.typ == exports.EnumToken.AtRuleNodeType && node.nam == 'import') {
|
|
@@ -16319,7 +16454,6 @@ async function doParse(iterator, options = {}) {
|
|
|
16319
16454
|
const url = token.typ == exports.EnumToken.StringTokenType ? token.val.slice(1, -1) : token.val;
|
|
16320
16455
|
try {
|
|
16321
16456
|
const root = await options.load(url, options.src).then((src) => {
|
|
16322
|
-
// console.error({url, src: options.src, resolved: options.resolve!(url, options.src as string)})
|
|
16323
16457
|
return doParse(src, Object.assign({}, options, {
|
|
16324
16458
|
minify: false,
|
|
16325
16459
|
setParent: false,
|
|
@@ -16327,6 +16461,7 @@ async function doParse(iterator, options = {}) {
|
|
|
16327
16461
|
}));
|
|
16328
16462
|
});
|
|
16329
16463
|
stats.importedBytesIn += root.stats.bytesIn;
|
|
16464
|
+
stats.imports.push(root.stats);
|
|
16330
16465
|
node.parent.chi.splice(node.parent.chi.indexOf(node), 1, ...root.ast.chi);
|
|
16331
16466
|
if (root.errors.length > 0) {
|
|
16332
16467
|
errors.push(...root.errors);
|
|
@@ -16418,7 +16553,7 @@ function getLastNode(context) {
|
|
|
16418
16553
|
}
|
|
16419
16554
|
return null;
|
|
16420
16555
|
}
|
|
16421
|
-
function parseNode(results, context,
|
|
16556
|
+
function parseNode(results, context, options, errors, src, map, rawTokens) {
|
|
16422
16557
|
let tokens = [];
|
|
16423
16558
|
for (const t of results) {
|
|
16424
16559
|
const node = getTokenType(t.token, t.hint);
|
|
@@ -16646,9 +16781,11 @@ function parseNode(results, context, stats, options, errors, src, map, rawTokens
|
|
|
16646
16781
|
removeComments: true
|
|
16647
16782
|
}), '');
|
|
16648
16783
|
}
|
|
16649
|
-
// }
|
|
16650
16784
|
context.chi.push(node);
|
|
16651
|
-
Object.defineProperties(node, {
|
|
16785
|
+
Object.defineProperties(node, {
|
|
16786
|
+
parent: { ...definedPropertySettings, value: context },
|
|
16787
|
+
validSyntax: { ...definedPropertySettings, value: valid.valid == SyntaxValidationResult.Valid }
|
|
16788
|
+
});
|
|
16652
16789
|
return node;
|
|
16653
16790
|
}
|
|
16654
16791
|
else {
|
|
@@ -16686,11 +16823,9 @@ function parseNode(results, context, stats, options, errors, src, map, rawTokens
|
|
|
16686
16823
|
let t = renderToken(curr, { minify: false });
|
|
16687
16824
|
if (t == ',') {
|
|
16688
16825
|
acc.push([]);
|
|
16689
|
-
// uniqTokens.push([]);
|
|
16690
16826
|
}
|
|
16691
16827
|
else {
|
|
16692
16828
|
acc[acc.length - 1].push(t);
|
|
16693
|
-
// uniqTokens[uniqTokens.length - 1].push(curr);
|
|
16694
16829
|
}
|
|
16695
16830
|
return acc;
|
|
16696
16831
|
}, [[]]).reduce((acc, curr) => {
|
|
@@ -16722,7 +16857,6 @@ function parseNode(results, context, stats, options, errors, src, map, rawTokens
|
|
|
16722
16857
|
// @ts-ignore
|
|
16723
16858
|
context.chi.push(node);
|
|
16724
16859
|
Object.defineProperty(node, 'parent', { ...definedPropertySettings, value: context });
|
|
16725
|
-
// if (options.validation) {
|
|
16726
16860
|
// @ts-ignore
|
|
16727
16861
|
const valid = options.validation == exports.ValidationLevel.None ? {
|
|
16728
16862
|
valid: SyntaxValidationResult.Valid,
|
|
@@ -16739,24 +16873,10 @@ function parseNode(results, context, stats, options, errors, src, map, rawTokens
|
|
|
16739
16873
|
location
|
|
16740
16874
|
});
|
|
16741
16875
|
}
|
|
16742
|
-
|
|
16743
|
-
|
|
16744
|
-
|
|
16745
|
-
|
|
16746
|
-
// enumerable: false,
|
|
16747
|
-
// value: tokens.slice()
|
|
16748
|
-
// });
|
|
16749
|
-
//
|
|
16750
|
-
// let raw: string[][] = [...uniq.values()];
|
|
16751
|
-
//
|
|
16752
|
-
// Object.defineProperty(node, 'raw', {
|
|
16753
|
-
// enumerable: false,
|
|
16754
|
-
// configurable: true,
|
|
16755
|
-
// writable: true,
|
|
16756
|
-
// value: raw
|
|
16757
|
-
// });
|
|
16758
|
-
// }
|
|
16759
|
-
Object.defineProperty(node, 'validSyntax', { ...definedPropertySettings, value: valid.valid == SyntaxValidationResult.Valid });
|
|
16876
|
+
Object.defineProperty(node, 'validSyntax', {
|
|
16877
|
+
...definedPropertySettings,
|
|
16878
|
+
value: valid.valid == SyntaxValidationResult.Valid
|
|
16879
|
+
});
|
|
16760
16880
|
return node;
|
|
16761
16881
|
}
|
|
16762
16882
|
else {
|
|
@@ -16806,9 +16926,7 @@ function parseNode(results, context, stats, options, errors, src, map, rawTokens
|
|
|
16806
16926
|
parseColor(tokens[i]);
|
|
16807
16927
|
}
|
|
16808
16928
|
}
|
|
16809
|
-
tokens.splice(i
|
|
16810
|
-
// i++;
|
|
16811
|
-
i--;
|
|
16929
|
+
tokens.splice(i--, 0, { typ: exports.EnumToken.ColonTokenType });
|
|
16812
16930
|
continue;
|
|
16813
16931
|
}
|
|
16814
16932
|
if ('chi' in tokens[i]) {
|
|
@@ -16893,11 +17011,15 @@ function parseNode(results, context, stats, options, errors, src, map, rawTokens
|
|
|
16893
17011
|
const result = parseDeclarationNode(node, errors, location);
|
|
16894
17012
|
Object.defineProperty(result, 'parent', { ...definedPropertySettings, value: context });
|
|
16895
17013
|
if (result != null) {
|
|
16896
|
-
// console.error(doRender(result), result.val, location);
|
|
16897
17014
|
if (options.validation == exports.ValidationLevel.All) {
|
|
16898
17015
|
const valid = evaluateSyntax(result, options);
|
|
16899
|
-
Object.defineProperty(result, 'validSyntax', {
|
|
17016
|
+
Object.defineProperty(result, 'validSyntax', {
|
|
17017
|
+
...definedPropertySettings,
|
|
17018
|
+
value: valid.valid == SyntaxValidationResult.Valid
|
|
17019
|
+
});
|
|
16900
17020
|
if (valid.valid == SyntaxValidationResult.Drop) {
|
|
17021
|
+
// console.error({result, valid});
|
|
17022
|
+
// console.error(JSON.stringify({result, options, valid}, null, 1));
|
|
16901
17023
|
errors.push({
|
|
16902
17024
|
action: 'drop',
|
|
16903
17025
|
message: valid.error,
|
|
@@ -17691,12 +17813,6 @@ function parseTokens(tokens, options = {}) {
|
|
|
17691
17813
|
if (t.chi[0].val.slice(1, 5) != 'data:' && urlTokenMatcher.test(value)) {
|
|
17692
17814
|
// @ts-ignore
|
|
17693
17815
|
t.chi[0].typ = exports.EnumToken.UrlTokenTokenType;
|
|
17694
|
-
// console.error({t, v: t.chi[0], value,
|
|
17695
|
-
// src: options.src,
|
|
17696
|
-
// resolved: options.src !== '' && options.resolveUrls ? options.resolve(value, options.src).absolute : null,
|
|
17697
|
-
// val2: options.src !== '' && options.resolveUrls ? options.resolve(value, options.src).absolute : value});
|
|
17698
|
-
//
|
|
17699
|
-
// console.error(new Error('resolved'));
|
|
17700
17816
|
// @ts-ignore
|
|
17701
17817
|
t.chi[0].val = options.src !== '' && options.resolveUrls ? options.resolve(value, options.src).absolute : value;
|
|
17702
17818
|
}
|
|
@@ -21032,8 +21148,7 @@ function doMinify(ast, options = {}, recursive = false, errors, nestingContent,
|
|
|
21032
21148
|
}
|
|
21033
21149
|
let rule = selector.map(s => {
|
|
21034
21150
|
if (s[0] == '&') {
|
|
21035
|
-
|
|
21036
|
-
s[0] = node.optimized.optimized[0];
|
|
21151
|
+
s.splice(0, 1, ...node.optimized.optimized);
|
|
21037
21152
|
}
|
|
21038
21153
|
return s.join('');
|
|
21039
21154
|
}).join(',');
|