@stylexjs/babel-plugin 0.17.3 → 0.17.5
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/lib/index.browser.js +100 -55
- package/lib/index.d.ts +6 -1
- package/lib/index.js +76 -33
- package/lib/shared/common-types.d.ts +1 -0
- package/lib/shared/common-types.js.flow +1 -0
- package/lib/shared/preprocess-rules/application-order.d.ts +2 -0
- package/lib/shared/preprocess-rules/application-order.js.flow +1 -0
- package/lib/shared/preprocess-rules/index.d.ts +4 -1
- package/lib/shared/preprocess-rules/index.js.flow +1 -0
- package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +2 -0
- package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +1 -0
- package/lib/shared/types/index.d.ts +1 -0
- package/lib/shared/utils/normalizers/zero-dimensions.d.ts +1 -1
- package/lib/shared/utils/normalizers/zero-dimensions.js.flow +1 -1
- package/lib/utils/ast-helpers.d.ts +1 -1
- package/lib/utils/ast-helpers.js.flow +1 -1
- package/lib/utils/state-manager.d.ts +2 -0
- package/lib/utils/state-manager.js.flow +1 -0
- package/package.json +5 -5
package/lib/index.browser.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var parser = require('postcss-value-parser');
|
|
5
|
-
var stylex = require('@stylexjs/stylex');
|
|
1
|
+
import { packages } from '@babel/standalone';
|
|
2
|
+
import parser from 'postcss-value-parser';
|
|
3
|
+
import { legacyMerge, props } from '@stylexjs/stylex';
|
|
6
4
|
|
|
7
5
|
const {
|
|
8
6
|
arrayExpression, arrowFunctionExpression, binaryExpression, booleanLiteral,
|
|
@@ -16,7 +14,7 @@ const {
|
|
|
16
14
|
isUpdateExpression, isValidIdentifier, isVariableDeclaration, jsxAttribute,
|
|
17
15
|
jsxIdentifier, memberExpression, nullLiteral, numericLiteral, objectExpression,
|
|
18
16
|
objectProperty, stringLiteral, unaryExpression, variableDeclaration, variableDeclarator
|
|
19
|
-
} =
|
|
17
|
+
} = packages.types;
|
|
20
18
|
|
|
21
19
|
var types = /*#__PURE__*/Object.freeze({
|
|
22
20
|
__proto__: null,
|
|
@@ -79,7 +77,11 @@ function getAugmentedNamespace(n) {
|
|
|
79
77
|
var f = n.default;
|
|
80
78
|
if (typeof f == "function") {
|
|
81
79
|
var a = function a () {
|
|
82
|
-
|
|
80
|
+
var isInstance = false;
|
|
81
|
+
try {
|
|
82
|
+
isInstance = this instanceof a;
|
|
83
|
+
} catch {}
|
|
84
|
+
if (isInstance) {
|
|
83
85
|
return Reflect.construct(f, arguments, this.constructor);
|
|
84
86
|
}
|
|
85
87
|
return f.apply(this, arguments);
|
|
@@ -1238,22 +1240,22 @@ var hasRequiredLib$2;
|
|
|
1238
1240
|
function requireLib$2 () {
|
|
1239
1241
|
if (hasRequiredLib$2) return lib$2;
|
|
1240
1242
|
hasRequiredLib$2 = 1;
|
|
1241
|
-
(function (exports) {
|
|
1243
|
+
(function (exports$1) {
|
|
1242
1244
|
|
|
1243
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1245
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
1244
1246
|
value: true
|
|
1245
1247
|
});
|
|
1246
|
-
Object.defineProperty(exports, "ImportInjector", {
|
|
1248
|
+
Object.defineProperty(exports$1, "ImportInjector", {
|
|
1247
1249
|
enumerable: true,
|
|
1248
1250
|
get: function () {
|
|
1249
1251
|
return _importInjector.default;
|
|
1250
1252
|
}
|
|
1251
1253
|
});
|
|
1252
|
-
exports.addDefault = addDefault;
|
|
1253
|
-
exports.addNamed = addNamed;
|
|
1254
|
-
exports.addNamespace = addNamespace;
|
|
1255
|
-
exports.addSideEffect = addSideEffect;
|
|
1256
|
-
Object.defineProperty(exports, "isModule", {
|
|
1254
|
+
exports$1.addDefault = addDefault;
|
|
1255
|
+
exports$1.addNamed = addNamed;
|
|
1256
|
+
exports$1.addNamespace = addNamespace;
|
|
1257
|
+
exports$1.addSideEffect = addSideEffect;
|
|
1258
|
+
Object.defineProperty(exports$1, "isModule", {
|
|
1257
1259
|
enumerable: true,
|
|
1258
1260
|
get: function () {
|
|
1259
1261
|
return _isModule.default;
|
|
@@ -1396,42 +1398,50 @@ function getProgramStatement(path) {
|
|
|
1396
1398
|
return programPath;
|
|
1397
1399
|
}
|
|
1398
1400
|
function isVariableNamedExported(path) {
|
|
1399
|
-
const declaration = path.parentPath;
|
|
1400
1401
|
const idPath = path.get('id');
|
|
1401
|
-
if (!
|
|
1402
|
-
return false;
|
|
1403
|
-
}
|
|
1402
|
+
if (!idPath.isIdentifier()) return false;
|
|
1404
1403
|
const variableName = idPath.node.name;
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
}
|
|
1404
|
+
const binding = path.scope.getBinding(variableName);
|
|
1405
|
+
if (!binding) return false;
|
|
1408
1406
|
const programPath = getProgramPath(path);
|
|
1409
1407
|
if (programPath == null) {
|
|
1410
1408
|
return false;
|
|
1411
1409
|
}
|
|
1412
|
-
let
|
|
1410
|
+
let exported = false;
|
|
1413
1411
|
programPath.traverse({
|
|
1414
1412
|
ExportNamedDeclaration(p) {
|
|
1415
1413
|
const node = p.node;
|
|
1416
|
-
if (node.source != null)
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1414
|
+
if (node.source != null) return;
|
|
1415
|
+
if (node.declaration) {
|
|
1416
|
+
if (node.declaration.type === 'VariableDeclaration' && node.declaration.declarations.some(d => d.id.type === 'Identifier' && p.scope.getBinding(d.id.name) === binding)) {
|
|
1417
|
+
exported = true;
|
|
1418
|
+
p.stop();
|
|
1419
|
+
}
|
|
1420
1420
|
return;
|
|
1421
1421
|
}
|
|
1422
|
-
|
|
1423
|
-
|
|
1422
|
+
for (const s of node.specifiers ?? []) {
|
|
1423
|
+
if (s.type !== 'ExportSpecifier') continue;
|
|
1424
|
+
if (s.local.type !== 'Identifier') continue;
|
|
1425
|
+
if (s.exported.type !== 'Identifier') continue;
|
|
1426
|
+
if (s.exportKind === 'type') continue;
|
|
1427
|
+
if (s.local.name !== s.exported.name) continue;
|
|
1428
|
+
const localBinding = p.scope.getBinding(s.local.name);
|
|
1429
|
+
if (localBinding === binding) {
|
|
1430
|
+
exported = true;
|
|
1431
|
+
p.stop();
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1424
1434
|
}
|
|
1425
|
-
result = result || node.specifiers.some(s => s.type === 'ExportSpecifier' && s.local.type === 'Identifier' && s.exported.type === 'Identifier' && s.local.name === variableName && s.exported.name === variableName);
|
|
1426
1435
|
}
|
|
1427
1436
|
});
|
|
1428
|
-
return
|
|
1437
|
+
return exported;
|
|
1429
1438
|
}
|
|
1430
1439
|
|
|
1431
1440
|
const defaultOptions = {
|
|
1432
1441
|
classNamePrefix: 'x',
|
|
1433
1442
|
dev: false,
|
|
1434
1443
|
debug: false,
|
|
1444
|
+
propertyValidationMode: 'silent',
|
|
1435
1445
|
enableDebugClassNames: false,
|
|
1436
1446
|
enableDevClassNames: false,
|
|
1437
1447
|
enableDebugDataProp: true,
|
|
@@ -1523,6 +1533,7 @@ class StateManager {
|
|
|
1523
1533
|
const configuredImportSources = logAndDefault(checkImportSources, options.importSources ?? defaultOptions.importSources, [], 'options.importSources');
|
|
1524
1534
|
const importSources = [name, 'stylex', ...configuredImportSources];
|
|
1525
1535
|
const styleResolution = logAndDefault(unionOf3(literal('application-order'), literal('property-specificity'), literal('legacy-expand-shorthands')), options.styleResolution ?? defaultOptions.styleResolution, 'property-specificity', 'options.styleResolution');
|
|
1536
|
+
const propertyValidationMode = logAndDefault(unionOf3(literal('throw'), literal('warn'), literal('silent')), options.propertyValidationMode ?? defaultOptions.propertyValidationMode, 'silent', 'options.propertyValidationMode');
|
|
1526
1537
|
const unstable_moduleResolution = logAndDefault(unionOf(nullish(), CheckModuleResolution), options.unstable_moduleResolution, null, 'options.unstable_moduleResolution');
|
|
1527
1538
|
const treeshakeCompensation = logAndDefault(boolean(), options.treeshakeCompensation ?? defaultOptions.treeshakeCompensation, false, 'options.treeshakeCompensation');
|
|
1528
1539
|
const aliasesOption = logAndDefault(unionOf(nullish(), objectOf(unionOf(string(), array(string())))), options.aliases, null, 'options.aliases');
|
|
@@ -1539,6 +1550,7 @@ class StateManager {
|
|
|
1539
1550
|
debug,
|
|
1540
1551
|
definedStylexCSSVariables: {},
|
|
1541
1552
|
dev,
|
|
1553
|
+
propertyValidationMode,
|
|
1542
1554
|
enableDebugClassNames,
|
|
1543
1555
|
enableDebugDataProp,
|
|
1544
1556
|
enableDevClassNames,
|
|
@@ -2059,6 +2071,15 @@ const shorthands$2 = {
|
|
|
2059
2071
|
borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
|
|
2060
2072
|
borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
|
|
2061
2073
|
borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
|
|
2074
|
+
cornerShape: value => [['cornerShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null], ['cornerEndStartShape', null], ['cornerEndEndShape', null], ['cornerTopLeftShape', null], ['cornerTopRightShape', null], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
2075
|
+
cornerStartStartShape: value => [['cornerStartStartShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
|
|
2076
|
+
cornerStartEndShape: value => [['cornerStartEndShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
|
|
2077
|
+
cornerEndStartShape: value => [['cornerEndStartShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
2078
|
+
cornerEndEndShape: value => [['cornerEndEndShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
2079
|
+
cornerTopLeftShape: value => [['cornerTopLeftShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
|
|
2080
|
+
cornerTopRightShape: value => [['cornerTopRightShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
|
|
2081
|
+
cornerBottomLeftShape: value => [['cornerBottomLeftShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
|
|
2082
|
+
cornerBottomRightShape: value => [['cornerBottomRightShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
|
|
2062
2083
|
borderImage: value => [['borderImage', value], ['borderImageOutset', null], ['borderImageRepeat', null], ['borderImageSlice', null], ['borderImageSource', null], ['borderImageWidth', null]],
|
|
2063
2084
|
columnRule: value => [['columnRule', value], ['columnRuleColor', null], ['columnRuleStyle', null], ['columnRuleWidth', null]],
|
|
2064
2085
|
columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
|
|
@@ -2556,7 +2577,19 @@ function flatMapExpandedShorthands(objEntry, options) {
|
|
|
2556
2577
|
if (Array.isArray(value)) {
|
|
2557
2578
|
throw new Error('Cannot use fallbacks for shorthands. Use the expansion instead.');
|
|
2558
2579
|
}
|
|
2559
|
-
|
|
2580
|
+
try {
|
|
2581
|
+
return expansion(value);
|
|
2582
|
+
} catch (error) {
|
|
2583
|
+
const validationMode = options.propertyValidationMode ?? 'silent';
|
|
2584
|
+
if (validationMode === 'throw') {
|
|
2585
|
+
throw error;
|
|
2586
|
+
} else if (validationMode === 'warn') {
|
|
2587
|
+
console.warn(`[stylex] ${error.message}`);
|
|
2588
|
+
return [];
|
|
2589
|
+
} else {
|
|
2590
|
+
return [];
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2560
2593
|
}
|
|
2561
2594
|
return [[key, value]];
|
|
2562
2595
|
}
|
|
@@ -2574,8 +2607,8 @@ var hasRequiredDist;
|
|
|
2574
2607
|
function requireDist () {
|
|
2575
2608
|
if (hasRequiredDist) return dist;
|
|
2576
2609
|
hasRequiredDist = 1;
|
|
2577
|
-
(function (exports) {
|
|
2578
|
-
class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports.HashType.ID);const t=consumeIdentSequence(e,n);return [exports.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports.TokenType=void 0,(c=exports.TokenType||(exports.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports.NumberType=void 0,(a=exports.NumberType||(exports.NumberType={})).Integer="integer",a.Number="number",exports.HashType=void 0,(u=exports.HashType||(exports.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports.TokenType);exports.ParseError=ParseError,exports.ParseErrorMessage=e,exports.ParseErrorWithToken=ParseErrorWithToken,exports.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports.TokenType.AtKeyword},exports.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports.TokenType.BadString},exports.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports.TokenType.BadURL},exports.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports.TokenType.CDC},exports.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports.TokenType.CDO},exports.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports.TokenType.CloseCurly},exports.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports.TokenType.CloseParen},exports.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports.TokenType.CloseSquare},exports.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports.TokenType.Colon},exports.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports.TokenType.Comma},exports.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports.TokenType.Comment},exports.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports.TokenType.Delim},exports.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports.TokenType.Dimension},exports.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports.TokenType.EOF},exports.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports.TokenType.Function},exports.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports.TokenType.Hash},exports.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports.TokenType.Ident},exports.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports.TokenType.Number},exports.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports.TokenType.Dimension:case exports.TokenType.Number:case exports.TokenType.Percentage:return true;default:return false}},exports.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports.TokenType.OpenCurly},exports.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports.TokenType.OpenParen},exports.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports.TokenType.OpenSquare},exports.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports.TokenType.Percentage},exports.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports.TokenType.Semicolon},exports.isTokenString=function isTokenString(e){return !!e&&e[0]===exports.TokenType.String},exports.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports.TokenType.URL},exports.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports.TokenType.UnicodeRange},exports.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports.TokenType.Whitespace:case exports.TokenType.Comment:return true;default:return false}},exports.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports.TokenType.Whitespace},exports.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports.TokenType.OpenParen:return [exports.TokenType.CloseParen,")",-1,-1,void 0];case exports.TokenType.CloseParen:return [exports.TokenType.OpenParen,"(",-1,-1,void 0];case exports.TokenType.OpenCurly:return [exports.TokenType.CloseCurly,"}",-1,-1,void 0];case exports.TokenType.CloseCurly:return [exports.TokenType.OpenCurly,"{",-1,-1,void 0];case exports.TokenType.OpenSquare:return [exports.TokenType.CloseSquare,"]",-1,-1,void 0];case exports.TokenType.CloseSquare:return [exports.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports.TokenType.OpenParen:return exports.TokenType.CloseParen;case exports.TokenType.CloseParen:return exports.TokenType.OpenParen;case exports.TokenType.OpenCurly:return exports.TokenType.CloseCurly;case exports.TokenType.CloseCurly:return exports.TokenType.OpenCurly;case exports.TokenType.OpenSquare:return exports.TokenType.CloseSquare;case exports.TokenType.CloseSquare:return exports.TokenType.OpenSquare;default:return null}},exports.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports.tokenizer=tokenizer;
|
|
2610
|
+
(function (exports$1) {
|
|
2611
|
+
class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports$1.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports$1.HashType.ID);const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports$1.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports$1.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports$1.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports$1.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports$1.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports$1.TokenType=void 0,(c=exports$1.TokenType||(exports$1.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports$1.NumberType=void 0,(a=exports$1.NumberType||(exports$1.NumberType={})).Integer="integer",a.Number="number",exports$1.HashType=void 0,(u=exports$1.HashType||(exports$1.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports$1.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports$1.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports$1.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports$1.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports$1.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports$1.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports$1.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports$1.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports$1.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports$1.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports$1.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports$1.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports$1.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports$1.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports$1.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports$1.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports$1.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports$1.TokenType);exports$1.ParseError=ParseError,exports$1.ParseErrorMessage=e,exports$1.ParseErrorWithToken=ParseErrorWithToken,exports$1.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports$1.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports$1.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports$1.TokenType.AtKeyword},exports$1.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports$1.TokenType.BadString},exports$1.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports$1.TokenType.BadURL},exports$1.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports$1.TokenType.CDC},exports$1.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports$1.TokenType.CDO},exports$1.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports$1.TokenType.CloseCurly},exports$1.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports$1.TokenType.CloseParen},exports$1.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports$1.TokenType.CloseSquare},exports$1.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports$1.TokenType.Colon},exports$1.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports$1.TokenType.Comma},exports$1.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports$1.TokenType.Comment},exports$1.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports$1.TokenType.Delim},exports$1.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports$1.TokenType.Dimension},exports$1.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports$1.TokenType.EOF},exports$1.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports$1.TokenType.Function},exports$1.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports$1.TokenType.Hash},exports$1.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports$1.TokenType.Ident},exports$1.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports$1.TokenType.Number},exports$1.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Dimension:case exports$1.TokenType.Number:case exports$1.TokenType.Percentage:return true;default:return false}},exports$1.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports$1.TokenType.OpenCurly},exports$1.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports$1.TokenType.OpenParen},exports$1.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports$1.TokenType.OpenSquare},exports$1.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports$1.TokenType.Percentage},exports$1.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports$1.TokenType.Semicolon},exports$1.isTokenString=function isTokenString(e){return !!e&&e[0]===exports$1.TokenType.String},exports$1.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports$1.TokenType.URL},exports$1.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports$1.TokenType.UnicodeRange},exports$1.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Whitespace:case exports$1.TokenType.Comment:return true;default:return false}},exports$1.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports$1.TokenType.Whitespace},exports$1.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports$1.TokenType.OpenParen:return [exports$1.TokenType.CloseParen,")",-1,-1,void 0];case exports$1.TokenType.CloseParen:return [exports$1.TokenType.OpenParen,"(",-1,-1,void 0];case exports$1.TokenType.OpenCurly:return [exports$1.TokenType.CloseCurly,"}",-1,-1,void 0];case exports$1.TokenType.CloseCurly:return [exports$1.TokenType.OpenCurly,"{",-1,-1,void 0];case exports$1.TokenType.OpenSquare:return [exports$1.TokenType.CloseSquare,"]",-1,-1,void 0];case exports$1.TokenType.CloseSquare:return [exports$1.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports$1.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports$1.TokenType.OpenParen:return exports$1.TokenType.CloseParen;case exports$1.TokenType.CloseParen:return exports$1.TokenType.OpenParen;case exports$1.TokenType.OpenCurly:return exports$1.TokenType.CloseCurly;case exports$1.TokenType.CloseCurly:return exports$1.TokenType.OpenCurly;case exports$1.TokenType.OpenSquare:return exports$1.TokenType.CloseSquare;case exports$1.TokenType.CloseSquare:return exports$1.TokenType.OpenSquare;default:return null}},exports$1.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports$1.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports$1.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports$1.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports$1.tokenizer=tokenizer;
|
|
2579
2612
|
} (dist));
|
|
2580
2613
|
return dist;
|
|
2581
2614
|
}
|
|
@@ -3851,36 +3884,36 @@ var hasRequiredProperties;
|
|
|
3851
3884
|
function requireProperties () {
|
|
3852
3885
|
if (hasRequiredProperties) return properties;
|
|
3853
3886
|
hasRequiredProperties = 1;
|
|
3854
|
-
(function (exports) {
|
|
3887
|
+
(function (exports$1) {
|
|
3855
3888
|
|
|
3856
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3889
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
3857
3890
|
value: true
|
|
3858
3891
|
});
|
|
3859
|
-
Object.defineProperty(exports, "BorderRadiusIndividual", {
|
|
3892
|
+
Object.defineProperty(exports$1, "BorderRadiusIndividual", {
|
|
3860
3893
|
enumerable: true,
|
|
3861
3894
|
get: function () {
|
|
3862
3895
|
return _borderRadius.BorderRadiusIndividual;
|
|
3863
3896
|
}
|
|
3864
3897
|
});
|
|
3865
|
-
Object.defineProperty(exports, "BorderRadiusShorthand", {
|
|
3898
|
+
Object.defineProperty(exports$1, "BorderRadiusShorthand", {
|
|
3866
3899
|
enumerable: true,
|
|
3867
3900
|
get: function () {
|
|
3868
3901
|
return _borderRadius.BorderRadiusShorthand;
|
|
3869
3902
|
}
|
|
3870
3903
|
});
|
|
3871
|
-
Object.defineProperty(exports, "BoxShadow", {
|
|
3904
|
+
Object.defineProperty(exports$1, "BoxShadow", {
|
|
3872
3905
|
enumerable: true,
|
|
3873
3906
|
get: function () {
|
|
3874
3907
|
return _boxShadow.BoxShadow;
|
|
3875
3908
|
}
|
|
3876
3909
|
});
|
|
3877
|
-
Object.defineProperty(exports, "BoxShadowList", {
|
|
3910
|
+
Object.defineProperty(exports$1, "BoxShadowList", {
|
|
3878
3911
|
enumerable: true,
|
|
3879
3912
|
get: function () {
|
|
3880
3913
|
return _boxShadow.BoxShadowList;
|
|
3881
3914
|
}
|
|
3882
3915
|
});
|
|
3883
|
-
Object.defineProperty(exports, "Transform", {
|
|
3916
|
+
Object.defineProperty(exports$1, "Transform", {
|
|
3884
3917
|
enumerable: true,
|
|
3885
3918
|
get: function () {
|
|
3886
3919
|
return _transform.Transform;
|
|
@@ -4505,22 +4538,22 @@ var hasRequiredLib$1;
|
|
|
4505
4538
|
function requireLib$1 () {
|
|
4506
4539
|
if (hasRequiredLib$1) return lib$1;
|
|
4507
4540
|
hasRequiredLib$1 = 1;
|
|
4508
|
-
(function (exports) {
|
|
4541
|
+
(function (exports$1) {
|
|
4509
4542
|
|
|
4510
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4543
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
4511
4544
|
value: true
|
|
4512
4545
|
});
|
|
4513
|
-
Object.defineProperty(exports, "lastMediaQueryWinsTransform", {
|
|
4546
|
+
Object.defineProperty(exports$1, "lastMediaQueryWinsTransform", {
|
|
4514
4547
|
enumerable: true,
|
|
4515
4548
|
get: function () {
|
|
4516
4549
|
return _mediaQueryTransform.lastMediaQueryWinsTransform;
|
|
4517
4550
|
}
|
|
4518
4551
|
});
|
|
4519
|
-
exports.tokenParser = exports.properties = void 0;
|
|
4552
|
+
exports$1.tokenParser = exports$1.properties = void 0;
|
|
4520
4553
|
var _tokenParser = _interopRequireWildcard(requireTokenParser());
|
|
4521
|
-
exports.tokenParser = _tokenParser;
|
|
4554
|
+
exports$1.tokenParser = _tokenParser;
|
|
4522
4555
|
var _properties = _interopRequireWildcard(requireProperties());
|
|
4523
|
-
exports.properties = _properties;
|
|
4556
|
+
exports$1.properties = _properties;
|
|
4524
4557
|
var _mediaQueryTransform = requireMediaQueryTransform();
|
|
4525
4558
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
4526
4559
|
} (lib$1));
|
|
@@ -4703,7 +4736,10 @@ const angles = ['deg', 'grad', 'turn', 'rad'];
|
|
|
4703
4736
|
const timings = ['ms', 's'];
|
|
4704
4737
|
const fraction = 'fr';
|
|
4705
4738
|
const percentage$1 = '%';
|
|
4706
|
-
function normalizeZeroDimensions(ast,
|
|
4739
|
+
function normalizeZeroDimensions(ast, key) {
|
|
4740
|
+
if (typeof key === 'string' && key.startsWith('--')) {
|
|
4741
|
+
return ast;
|
|
4742
|
+
}
|
|
4707
4743
|
let endFunction = 0;
|
|
4708
4744
|
ast.walk(node => {
|
|
4709
4745
|
if (node.type === 'function' && !endFunction) {
|
|
@@ -5148,6 +5184,15 @@ function requirePropertyPriorities () {
|
|
|
5148
5184
|
longHandPhysical.add('border-top-right-radius');
|
|
5149
5185
|
longHandPhysical.add('border-bottom-left-radius');
|
|
5150
5186
|
longHandPhysical.add('border-bottom-right-radius');
|
|
5187
|
+
shorthandsOfLonghands.add('corner-shape');
|
|
5188
|
+
longHandLogical.add('corner-start-start-shape');
|
|
5189
|
+
longHandLogical.add('corner-start-end-shape');
|
|
5190
|
+
longHandLogical.add('corner-end-start-shape');
|
|
5191
|
+
longHandLogical.add('corner-end-end-shape');
|
|
5192
|
+
longHandPhysical.add('corner-top-left-shape');
|
|
5193
|
+
longHandPhysical.add('corner-top-right-shape');
|
|
5194
|
+
longHandPhysical.add('corner-bottom-left-shape');
|
|
5195
|
+
longHandPhysical.add('corner-bottom-right-shape');
|
|
5151
5196
|
longHandLogical.add('box-shadow');
|
|
5152
5197
|
longHandLogical.add('accent-color');
|
|
5153
5198
|
longHandLogical.add('appearance');
|
|
@@ -6734,9 +6779,9 @@ function convertObjectToAST(obj) {
|
|
|
6734
6779
|
return objectExpression(Object.entries(obj).map(([key, value]) => objectProperty(isValidIdentifier(key, false) ? identifier(key) : stringLiteral(key), typeof value === 'string' ? stringLiteral(value) : typeof value === 'number' ? numericLiteral(value) : typeof value === 'boolean' ? booleanLiteral(value) : value === null ? nullLiteral() : convertObjectToAST(value))));
|
|
6735
6780
|
}
|
|
6736
6781
|
|
|
6737
|
-
const parseSync =
|
|
6782
|
+
const parseSync = packages.parser.parse;
|
|
6738
6783
|
|
|
6739
|
-
var traverse =
|
|
6784
|
+
var traverse = packages.traverse.default;
|
|
6740
6785
|
|
|
6741
6786
|
const IMPORT_FILE_PARSING_ERROR = `There was error when attempting to parse the imported file.
|
|
6742
6787
|
Please ensure that the 'babelrc' file is configured to be able to parse this file.
|
|
@@ -8497,7 +8542,7 @@ function parseNullableStyle$1(node, state) {
|
|
|
8497
8542
|
function makeStringExpression$1(values) {
|
|
8498
8543
|
const conditions = values.filter(v => Array.isArray(v)).map(v => v[0]);
|
|
8499
8544
|
if (conditions.length === 0) {
|
|
8500
|
-
return stringLiteral(
|
|
8545
|
+
return stringLiteral(legacyMerge(...values));
|
|
8501
8546
|
}
|
|
8502
8547
|
const conditionPermutations = genConditionPermutations$1(conditions.length);
|
|
8503
8548
|
const objEntries = conditionPermutations.map(permutation => {
|
|
@@ -8511,7 +8556,7 @@ function makeStringExpression$1(values) {
|
|
|
8511
8556
|
}
|
|
8512
8557
|
});
|
|
8513
8558
|
const key = permutation.reduce((soFar, bool) => soFar << 1 | (bool ? 1 : 0), 0);
|
|
8514
|
-
return objectProperty(numericLiteral(key), stringLiteral(
|
|
8559
|
+
return objectProperty(numericLiteral(key), stringLiteral(legacyMerge(...args)));
|
|
8515
8560
|
});
|
|
8516
8561
|
const objExpressions = objectExpression(objEntries);
|
|
8517
8562
|
const conditionsToKey = genBitwiseOrOfConditions$1(conditions);
|
|
@@ -8760,7 +8805,7 @@ function parseNullableStyle(path, state, evaluatePathFnConfig) {
|
|
|
8760
8805
|
function makeStringExpression(values) {
|
|
8761
8806
|
const conditions = values.filter(v => v instanceof ConditionalStyle).map(v => v.test);
|
|
8762
8807
|
if (conditions.length === 0) {
|
|
8763
|
-
const result =
|
|
8808
|
+
const result = props(values);
|
|
8764
8809
|
return convertObjectToAST(result);
|
|
8765
8810
|
}
|
|
8766
8811
|
const conditionPermutations = genConditionPermutations(conditions.length);
|
|
@@ -8778,7 +8823,7 @@ function makeStringExpression(values) {
|
|
|
8778
8823
|
}
|
|
8779
8824
|
});
|
|
8780
8825
|
const key = permutation.reduce((soFar, bool) => soFar << 1 | (bool ? 1 : 0), 0);
|
|
8781
|
-
return objectProperty(numericLiteral(key), convertObjectToAST(
|
|
8826
|
+
return objectProperty(numericLiteral(key), convertObjectToAST(props(args)));
|
|
8782
8827
|
});
|
|
8783
8828
|
const objExpressions = objectExpression(objEntries);
|
|
8784
8829
|
const conditionsToKey = genBitwiseOrOfConditions(conditions);
|
|
@@ -9356,4 +9401,4 @@ function addSpecificityLevel(selector, index) {
|
|
|
9356
9401
|
return `${beforeCurly}${pseudo}${afterCurly}`;
|
|
9357
9402
|
}
|
|
9358
9403
|
|
|
9359
|
-
|
|
9404
|
+
export { styleXTransform as default };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
2
7
|
/**
|
|
3
8
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
9
|
*
|
package/lib/index.js
CHANGED
|
@@ -284,42 +284,50 @@ function getProgramStatement(path) {
|
|
|
284
284
|
return programPath;
|
|
285
285
|
}
|
|
286
286
|
function isVariableNamedExported(path) {
|
|
287
|
-
const declaration = path.parentPath;
|
|
288
287
|
const idPath = path.get('id');
|
|
289
|
-
if (!
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
288
|
+
if (!idPath.isIdentifier()) return false;
|
|
292
289
|
const variableName = idPath.node.name;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
}
|
|
290
|
+
const binding = path.scope.getBinding(variableName);
|
|
291
|
+
if (!binding) return false;
|
|
296
292
|
const programPath = getProgramPath(path);
|
|
297
293
|
if (programPath == null) {
|
|
298
294
|
return false;
|
|
299
295
|
}
|
|
300
|
-
let
|
|
296
|
+
let exported = false;
|
|
301
297
|
programPath.traverse({
|
|
302
298
|
ExportNamedDeclaration(p) {
|
|
303
299
|
const node = p.node;
|
|
304
|
-
if (node.source != null)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
300
|
+
if (node.source != null) return;
|
|
301
|
+
if (node.declaration) {
|
|
302
|
+
if (node.declaration.type === 'VariableDeclaration' && node.declaration.declarations.some(d => d.id.type === 'Identifier' && p.scope.getBinding(d.id.name) === binding)) {
|
|
303
|
+
exported = true;
|
|
304
|
+
p.stop();
|
|
305
|
+
}
|
|
308
306
|
return;
|
|
309
307
|
}
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
for (const s of node.specifiers ?? []) {
|
|
309
|
+
if (s.type !== 'ExportSpecifier') continue;
|
|
310
|
+
if (s.local.type !== 'Identifier') continue;
|
|
311
|
+
if (s.exported.type !== 'Identifier') continue;
|
|
312
|
+
if (s.exportKind === 'type') continue;
|
|
313
|
+
if (s.local.name !== s.exported.name) continue;
|
|
314
|
+
const localBinding = p.scope.getBinding(s.local.name);
|
|
315
|
+
if (localBinding === binding) {
|
|
316
|
+
exported = true;
|
|
317
|
+
p.stop();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
312
320
|
}
|
|
313
|
-
result = result || node.specifiers.some(s => s.type === 'ExportSpecifier' && s.local.type === 'Identifier' && s.exported.type === 'Identifier' && s.local.name === variableName && s.exported.name === variableName);
|
|
314
321
|
}
|
|
315
322
|
});
|
|
316
|
-
return
|
|
323
|
+
return exported;
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
const defaultOptions = {
|
|
320
327
|
classNamePrefix: 'x',
|
|
321
328
|
dev: false,
|
|
322
329
|
debug: false,
|
|
330
|
+
propertyValidationMode: 'silent',
|
|
323
331
|
enableDebugClassNames: false,
|
|
324
332
|
enableDevClassNames: false,
|
|
325
333
|
enableDebugDataProp: true,
|
|
@@ -411,6 +419,7 @@ class StateManager {
|
|
|
411
419
|
const configuredImportSources = logAndDefault(checkImportSources, options.importSources ?? defaultOptions.importSources, [], 'options.importSources');
|
|
412
420
|
const importSources = [name, 'stylex', ...configuredImportSources];
|
|
413
421
|
const styleResolution = logAndDefault(unionOf3(literal('application-order'), literal('property-specificity'), literal('legacy-expand-shorthands')), options.styleResolution ?? defaultOptions.styleResolution, 'property-specificity', 'options.styleResolution');
|
|
422
|
+
const propertyValidationMode = logAndDefault(unionOf3(literal('throw'), literal('warn'), literal('silent')), options.propertyValidationMode ?? defaultOptions.propertyValidationMode, 'silent', 'options.propertyValidationMode');
|
|
414
423
|
const unstable_moduleResolution = logAndDefault(unionOf(nullish(), CheckModuleResolution), options.unstable_moduleResolution, null, 'options.unstable_moduleResolution');
|
|
415
424
|
const treeshakeCompensation = logAndDefault(boolean(), options.treeshakeCompensation ?? defaultOptions.treeshakeCompensation, false, 'options.treeshakeCompensation');
|
|
416
425
|
const aliasesOption = logAndDefault(unionOf(nullish(), objectOf(unionOf(string(), array(string())))), options.aliases, null, 'options.aliases');
|
|
@@ -427,6 +436,7 @@ class StateManager {
|
|
|
427
436
|
debug,
|
|
428
437
|
definedStylexCSSVariables: {},
|
|
429
438
|
dev,
|
|
439
|
+
propertyValidationMode,
|
|
430
440
|
enableDebugClassNames,
|
|
431
441
|
enableDebugDataProp,
|
|
432
442
|
enableDevClassNames,
|
|
@@ -947,6 +957,15 @@ const shorthands$2 = {
|
|
|
947
957
|
borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
|
|
948
958
|
borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
|
|
949
959
|
borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
|
|
960
|
+
cornerShape: value => [['cornerShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null], ['cornerEndStartShape', null], ['cornerEndEndShape', null], ['cornerTopLeftShape', null], ['cornerTopRightShape', null], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
961
|
+
cornerStartStartShape: value => [['cornerStartStartShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
|
|
962
|
+
cornerStartEndShape: value => [['cornerStartEndShape', value], ['cornerTopLeftShape', null], ['cornerTopRightShape', null]],
|
|
963
|
+
cornerEndStartShape: value => [['cornerEndStartShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
964
|
+
cornerEndEndShape: value => [['cornerEndEndShape', value], ['cornerBottomLeftShape', null], ['cornerBottomRightShape', null]],
|
|
965
|
+
cornerTopLeftShape: value => [['cornerTopLeftShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
|
|
966
|
+
cornerTopRightShape: value => [['cornerTopRightShape', value], ['cornerStartStartShape', null], ['cornerStartEndShape', null]],
|
|
967
|
+
cornerBottomLeftShape: value => [['cornerBottomLeftShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
|
|
968
|
+
cornerBottomRightShape: value => [['cornerBottomRightShape', value], ['cornerEndStartShape', null], ['cornerEndEndShape', null]],
|
|
950
969
|
borderImage: value => [['borderImage', value], ['borderImageOutset', null], ['borderImageRepeat', null], ['borderImageSlice', null], ['borderImageSource', null], ['borderImageWidth', null]],
|
|
951
970
|
columnRule: value => [['columnRule', value], ['columnRuleColor', null], ['columnRuleStyle', null], ['columnRuleWidth', null]],
|
|
952
971
|
columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
|
|
@@ -1444,7 +1463,19 @@ function flatMapExpandedShorthands(objEntry, options) {
|
|
|
1444
1463
|
if (Array.isArray(value)) {
|
|
1445
1464
|
throw new Error('Cannot use fallbacks for shorthands. Use the expansion instead.');
|
|
1446
1465
|
}
|
|
1447
|
-
|
|
1466
|
+
try {
|
|
1467
|
+
return expansion(value);
|
|
1468
|
+
} catch (error) {
|
|
1469
|
+
const validationMode = options.propertyValidationMode ?? 'silent';
|
|
1470
|
+
if (validationMode === 'throw') {
|
|
1471
|
+
throw error;
|
|
1472
|
+
} else if (validationMode === 'warn') {
|
|
1473
|
+
console.warn(`[stylex] ${error.message}`);
|
|
1474
|
+
return [];
|
|
1475
|
+
} else {
|
|
1476
|
+
return [];
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1448
1479
|
}
|
|
1449
1480
|
return [[key, value]];
|
|
1450
1481
|
}
|
|
@@ -1462,8 +1493,8 @@ var hasRequiredDist;
|
|
|
1462
1493
|
function requireDist () {
|
|
1463
1494
|
if (hasRequiredDist) return dist;
|
|
1464
1495
|
hasRequiredDist = 1;
|
|
1465
|
-
(function (exports) {
|
|
1466
|
-
class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports.HashType.ID);const t=consumeIdentSequence(e,n);return [exports.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports.TokenType=void 0,(c=exports.TokenType||(exports.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports.NumberType=void 0,(a=exports.NumberType||(exports.NumberType={})).Integer="integer",a.Number="number",exports.HashType=void 0,(u=exports.HashType||(exports.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports.TokenType);exports.ParseError=ParseError,exports.ParseErrorMessage=e,exports.ParseErrorWithToken=ParseErrorWithToken,exports.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports.TokenType.AtKeyword},exports.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports.TokenType.BadString},exports.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports.TokenType.BadURL},exports.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports.TokenType.CDC},exports.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports.TokenType.CDO},exports.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports.TokenType.CloseCurly},exports.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports.TokenType.CloseParen},exports.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports.TokenType.CloseSquare},exports.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports.TokenType.Colon},exports.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports.TokenType.Comma},exports.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports.TokenType.Comment},exports.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports.TokenType.Delim},exports.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports.TokenType.Dimension},exports.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports.TokenType.EOF},exports.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports.TokenType.Function},exports.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports.TokenType.Hash},exports.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports.TokenType.Ident},exports.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports.TokenType.Number},exports.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports.TokenType.Dimension:case exports.TokenType.Number:case exports.TokenType.Percentage:return true;default:return false}},exports.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports.TokenType.OpenCurly},exports.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports.TokenType.OpenParen},exports.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports.TokenType.OpenSquare},exports.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports.TokenType.Percentage},exports.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports.TokenType.Semicolon},exports.isTokenString=function isTokenString(e){return !!e&&e[0]===exports.TokenType.String},exports.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports.TokenType.URL},exports.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports.TokenType.UnicodeRange},exports.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports.TokenType.Whitespace:case exports.TokenType.Comment:return true;default:return false}},exports.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports.TokenType.Whitespace},exports.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports.TokenType.OpenParen:return [exports.TokenType.CloseParen,")",-1,-1,void 0];case exports.TokenType.CloseParen:return [exports.TokenType.OpenParen,"(",-1,-1,void 0];case exports.TokenType.OpenCurly:return [exports.TokenType.CloseCurly,"}",-1,-1,void 0];case exports.TokenType.CloseCurly:return [exports.TokenType.OpenCurly,"{",-1,-1,void 0];case exports.TokenType.OpenSquare:return [exports.TokenType.CloseSquare,"]",-1,-1,void 0];case exports.TokenType.CloseSquare:return [exports.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports.TokenType.OpenParen:return exports.TokenType.CloseParen;case exports.TokenType.CloseParen:return exports.TokenType.OpenParen;case exports.TokenType.OpenCurly:return exports.TokenType.CloseCurly;case exports.TokenType.CloseCurly:return exports.TokenType.OpenCurly;case exports.TokenType.OpenSquare:return exports.TokenType.CloseSquare;case exports.TokenType.CloseSquare:return exports.TokenType.OpenSquare;default:return null}},exports.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports.tokenizer=tokenizer;
|
|
1496
|
+
(function (exports$1) {
|
|
1497
|
+
class ParseError extends Error{sourceStart;sourceEnd;parserState;constructor(e,n,o,t){super(e),this.name="ParseError",this.sourceStart=n,this.sourceEnd=o,this.parserState=t;}}class ParseErrorWithToken extends ParseError{token;constructor(e,n,o,t,r){super(e,n,o,t),this.token=r;}}const e={UnexpectedNewLineInString:"Unexpected newline while consuming a string token.",UnexpectedEOFInString:"Unexpected EOF while consuming a string token.",UnexpectedEOFInComment:"Unexpected EOF while consuming a comment.",UnexpectedEOFInURL:"Unexpected EOF while consuming a url token.",UnexpectedEOFInEscapedCodePoint:"Unexpected EOF while consuming an escaped code point.",UnexpectedCharacterInURL:"Unexpected character while consuming a url token.",InvalidEscapeSequenceInURL:"Invalid escape sequence while consuming a url token.",InvalidEscapeSequenceAfterBackslash:'Invalid escape sequence after "\\"'},n="undefined"!=typeof globalThis&&"structuredClone"in globalThis;const o=13,t=45,r=10,s=43,i=65533;function checkIfFourCodePointsWouldStartCDO(e){return 60===e.source.codePointAt(e.cursor)&&33===e.source.codePointAt(e.cursor+1)&&e.source.codePointAt(e.cursor+2)===t&&e.source.codePointAt(e.cursor+3)===t}function isDigitCodePoint(e){return e>=48&&e<=57}function isUppercaseLetterCodePoint(e){return e>=65&&e<=90}function isLowercaseLetterCodePoint(e){return e>=97&&e<=122}function isHexDigitCodePoint(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function isLetterCodePoint(e){return isLowercaseLetterCodePoint(e)||isUppercaseLetterCodePoint(e)}function isIdentStartCodePoint(e){return isLetterCodePoint(e)||isNonASCII_IdentCodePoint(e)||95===e}function isIdentCodePoint(e){return isIdentStartCodePoint(e)||isDigitCodePoint(e)||e===t}function isNonASCII_IdentCodePoint(e){return 183===e||8204===e||8205===e||8255===e||8256===e||8204===e||(192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||(0===e||(!!isSurrogate(e)||e>=65536)))}function isNewLine(e){return e===r||e===o||12===e}function isWhitespace(e){return 32===e||e===r||9===e||e===o||12===e}function isSurrogate(e){return e>=55296&&e<=57343}function checkIfTwoCodePointsAreAValidEscape(e){return 92===e.source.codePointAt(e.cursor)&&!isNewLine(e.source.codePointAt(e.cursor+1)??-1)}function checkIfThreeCodePointsWouldStartAnIdentSequence(e,n){return n.source.codePointAt(n.cursor)===t?n.source.codePointAt(n.cursor+1)===t||(!!isIdentStartCodePoint(n.source.codePointAt(n.cursor+1)??-1)||92===n.source.codePointAt(n.cursor+1)&&!isNewLine(n.source.codePointAt(n.cursor+2)??-1)):!!isIdentStartCodePoint(n.source.codePointAt(n.cursor)??-1)||checkIfTwoCodePointsAreAValidEscape(n)}function checkIfThreeCodePointsWouldStartANumber(e){return e.source.codePointAt(e.cursor)===s||e.source.codePointAt(e.cursor)===t?!!isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1)||46===e.source.codePointAt(e.cursor+1)&&isDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1):46===e.source.codePointAt(e.cursor)?isDigitCodePoint(e.source.codePointAt(e.cursor+1)??-1):isDigitCodePoint(e.source.codePointAt(e.cursor)??-1)}function checkIfTwoCodePointsStartAComment(e){return 47===e.source.codePointAt(e.cursor)&&42===e.source.codePointAt(e.cursor+1)}function checkIfThreeCodePointsWouldStartCDC(e){return e.source.codePointAt(e.cursor)===t&&e.source.codePointAt(e.cursor+1)===t&&62===e.source.codePointAt(e.cursor+2)}var c,a,u;function consumeComment(n,o){for(o.advanceCodePoint(2);;){const t=o.readCodePoint();if(void 0===t){const t=[exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInComment,o.representationStart,o.representationEnd,["4.3.2. Consume comments","Unexpected EOF"],t)),t}if(42===t&&(void 0!==o.source.codePointAt(o.cursor)&&47===o.source.codePointAt(o.cursor))){o.advanceCodePoint();break}}return [exports$1.TokenType.Comment,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0]}function consumeEscapedCodePoint(n,t){const s=t.readCodePoint();if(void 0===s)return n.onParseError(new ParseError(e.UnexpectedEOFInEscapedCodePoint,t.representationStart,t.representationEnd,["4.3.7. Consume an escaped code point","Unexpected EOF"])),i;if(isHexDigitCodePoint(s)){const e=[s];let n;for(;void 0!==(n=t.source.codePointAt(t.cursor))&&isHexDigitCodePoint(n)&&e.length<6;)e.push(n),t.advanceCodePoint();isWhitespace(t.source.codePointAt(t.cursor)??-1)&&(t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint());const c=parseInt(String.fromCodePoint(...e),16);return 0===c||isSurrogate(c)||c>1114111?i:c}return 0===s||isSurrogate(s)?i:s}function consumeIdentSequence(e,n){const o=[];for(;;){const t=n.source.codePointAt(n.cursor)??-1;if(0===t||isSurrogate(t))o.push(i),n.advanceCodePoint(+(t>65535)+1);else if(isIdentCodePoint(t))o.push(t),n.advanceCodePoint(+(t>65535)+1);else {if(!checkIfTwoCodePointsAreAValidEscape(n))return o;n.advanceCodePoint(),o.push(consumeEscapedCodePoint(e,n));}}}function consumeHashToken(e,n){n.advanceCodePoint();const o=n.source.codePointAt(n.cursor);if(void 0!==o&&(isIdentCodePoint(o)||checkIfTwoCodePointsAreAValidEscape(n))){let o=exports$1.HashType.Unrestricted;checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)&&(o=exports$1.HashType.ID);const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Hash,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...t),type:o}]}return [exports$1.TokenType.Delim,"#",n.representationStart,n.representationEnd,{value:"#"}]}function consumeNumber(e,n){let o=exports$1.NumberType.Integer;for(n.source.codePointAt(n.cursor)!==s&&n.source.codePointAt(n.cursor)!==t||n.advanceCodePoint();isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(46===n.source.codePointAt(n.cursor)&&isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint(2),o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();if(101===n.source.codePointAt(n.cursor)||69===n.source.codePointAt(n.cursor)){if(isDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))n.advanceCodePoint(2);else {if(n.source.codePointAt(n.cursor+1)!==t&&n.source.codePointAt(n.cursor+1)!==s||!isDigitCodePoint(n.source.codePointAt(n.cursor+2)??-1))return o;n.advanceCodePoint(3);}for(o=exports$1.NumberType.Number;isDigitCodePoint(n.source.codePointAt(n.cursor)??-1);)n.advanceCodePoint();}return o}function consumeNumericToken(e,n){let o;{const e=n.source.codePointAt(n.cursor);e===t?o="-":e===s&&(o="+");}const r=consumeNumber(0,n),i=parseFloat(n.source.slice(n.representationStart,n.representationEnd+1));if(checkIfThreeCodePointsWouldStartAnIdentSequence(0,n)){const t=consumeIdentSequence(e,n);return [exports$1.TokenType.Dimension,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r,unit:String.fromCodePoint(...t)}]}return 37===n.source.codePointAt(n.cursor)?(n.advanceCodePoint(),[exports$1.TokenType.Percentage,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o}]):[exports$1.TokenType.Number,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:i,signCharacter:o,type:r}]}function consumeWhiteSpace(e){for(;isWhitespace(e.source.codePointAt(e.cursor)??-1);)e.advanceCodePoint();return [exports$1.TokenType.Whitespace,e.source.slice(e.representationStart,e.representationEnd+1),e.representationStart,e.representationEnd,void 0]}exports$1.TokenType=void 0,(c=exports$1.TokenType||(exports$1.TokenType={})).Comment="comment",c.AtKeyword="at-keyword-token",c.BadString="bad-string-token",c.BadURL="bad-url-token",c.CDC="CDC-token",c.CDO="CDO-token",c.Colon="colon-token",c.Comma="comma-token",c.Delim="delim-token",c.Dimension="dimension-token",c.EOF="EOF-token",c.Function="function-token",c.Hash="hash-token",c.Ident="ident-token",c.Number="number-token",c.Percentage="percentage-token",c.Semicolon="semicolon-token",c.String="string-token",c.URL="url-token",c.Whitespace="whitespace-token",c.OpenParen="(-token",c.CloseParen=")-token",c.OpenSquare="[-token",c.CloseSquare="]-token",c.OpenCurly="{-token",c.CloseCurly="}-token",c.UnicodeRange="unicode-range-token",exports$1.NumberType=void 0,(a=exports$1.NumberType||(exports$1.NumberType={})).Integer="integer",a.Number="number",exports$1.HashType=void 0,(u=exports$1.HashType||(exports$1.HashType={})).Unrestricted="unrestricted",u.ID="id";class Reader{cursor=0;source="";representationStart=0;representationEnd=-1;constructor(e){this.source=e;}advanceCodePoint(e=1){this.cursor=this.cursor+e,this.representationEnd=this.cursor-1;}readCodePoint(){const e=this.source.codePointAt(this.cursor);if(void 0!==e)return this.cursor=this.cursor+1,this.representationEnd=this.cursor-1,e}unreadCodePoint(e=1){this.cursor=this.cursor-e,this.representationEnd=this.cursor-1;}resetRepresentation(){this.representationStart=this.cursor,this.representationEnd=-1;}}function consumeStringToken(n,t){let s="";const c=t.readCodePoint();for(;;){const a=t.readCodePoint();if(void 0===a){const o=[exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInString,t.representationStart,t.representationEnd,["4.3.5. Consume a string token","Unexpected EOF"],o)),o}if(isNewLine(a)){t.unreadCodePoint();const s=[exports$1.TokenType.BadString,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedNewLineInString,t.representationStart,t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r?t.representationEnd+2:t.representationEnd+1,["4.3.5. Consume a string token","Unexpected newline"],s)),s}if(a===c)return [exports$1.TokenType.String,t.source.slice(t.representationStart,t.representationEnd+1),t.representationStart,t.representationEnd,{value:s}];if(92!==a)0===a||isSurrogate(a)?s+=String.fromCodePoint(i):s+=String.fromCodePoint(a);else {if(void 0===t.source.codePointAt(t.cursor))continue;if(isNewLine(t.source.codePointAt(t.cursor)??-1)){t.source.codePointAt(t.cursor)===o&&t.source.codePointAt(t.cursor+1)===r&&t.advanceCodePoint(),t.advanceCodePoint();continue}s+=String.fromCodePoint(consumeEscapedCodePoint(n,t));}}}function checkIfCodePointsMatchURLIdent(e){return !(3!==e.length||117!==e[0]&&85!==e[0]||114!==e[1]&&82!==e[1]||108!==e[2]&&76!==e[2])}function consumeBadURL(e,n){for(;;){const o=n.source.codePointAt(n.cursor);if(void 0===o)return;if(41===o)return void n.advanceCodePoint();checkIfTwoCodePointsAreAValidEscape(n)?(n.advanceCodePoint(),consumeEscapedCodePoint(e,n)):n.advanceCodePoint();}}function consumeUrlToken(n,o){for(;isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();let t="";for(;;){if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected EOF"],r)),r}if(41===o.source.codePointAt(o.cursor))return o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];if(isWhitespace(o.source.codePointAt(o.cursor)??-1)){for(o.advanceCodePoint();isWhitespace(o.source.codePointAt(o.cursor)??-1);)o.advanceCodePoint();if(void 0===o.source.codePointAt(o.cursor)){const r=[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}];return n.onParseError(new ParseErrorWithToken(e.UnexpectedEOFInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Consume as much whitespace as possible","Unexpected EOF"],r)),r}return 41===o.source.codePointAt(o.cursor)?(o.advanceCodePoint(),[exports$1.TokenType.URL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,{value:t}]):(consumeBadURL(n,o),[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0])}const s=o.source.codePointAt(o.cursor);if(34===s||39===s||40===s||(11===(r=s??-1)||127===r||0<=r&&r<=8||14<=r&&r<=31)){consumeBadURL(n,o);const t=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.UnexpectedCharacterInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"],t)),t}if(92===s){if(checkIfTwoCodePointsAreAValidEscape(o)){o.advanceCodePoint(),t+=String.fromCodePoint(consumeEscapedCodePoint(n,o));continue}consumeBadURL(n,o);const r=[exports$1.TokenType.BadURL,o.source.slice(o.representationStart,o.representationEnd+1),o.representationStart,o.representationEnd,void 0];return n.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceInURL,o.representationStart,o.representationEnd,["4.3.6. Consume a url token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],r)),r}0===o.source.codePointAt(o.cursor)||isSurrogate(o.source.codePointAt(o.cursor)??-1)?(t+=String.fromCodePoint(i),o.advanceCodePoint()):(t+=o.source[o.cursor],o.advanceCodePoint());}var r;}function consumeIdentLikeToken(e,n){const o=consumeIdentSequence(e,n);if(40!==n.source.codePointAt(n.cursor))return [exports$1.TokenType.Ident,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];if(checkIfCodePointsMatchURLIdent(o)){n.advanceCodePoint();let t=0;for(;;){const e=isWhitespace(n.source.codePointAt(n.cursor)??-1),r=isWhitespace(n.source.codePointAt(n.cursor+1)??-1);if(e&&r){t+=1,n.advanceCodePoint(1);continue}const s=e?n.source.codePointAt(n.cursor+1):n.source.codePointAt(n.cursor);if(34===s||39===s)return t>0&&n.unreadCodePoint(t),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}];break}return consumeUrlToken(e,n)}return n.advanceCodePoint(),[exports$1.TokenType.Function,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{value:String.fromCodePoint(...o)}]}function checkIfThreeCodePointsWouldStartAUnicodeRange(e){return !(117!==e.source.codePointAt(e.cursor)&&85!==e.source.codePointAt(e.cursor)||e.source.codePointAt(e.cursor+1)!==s||63!==e.source.codePointAt(e.cursor+2)&&!isHexDigitCodePoint(e.source.codePointAt(e.cursor+2)??-1))}function consumeUnicodeRangeToken(e,n){n.advanceCodePoint(2);const o=[],r=[];let s;for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&isHexDigitCodePoint(s);)o.push(s),n.advanceCodePoint();for(;void 0!==(s=n.source.codePointAt(n.cursor))&&o.length<6&&63===s;)0===r.length&&r.push(...o),o.push(48),r.push(70),n.advanceCodePoint();if(!r.length&&n.source.codePointAt(n.cursor)===t&&isHexDigitCodePoint(n.source.codePointAt(n.cursor+1)??-1))for(n.advanceCodePoint();void 0!==(s=n.source.codePointAt(n.cursor))&&r.length<6&&isHexDigitCodePoint(s);)r.push(s),n.advanceCodePoint();if(!r.length){const e=parseInt(String.fromCodePoint(...o),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:e,endOfRange:e}]}const i=parseInt(String.fromCodePoint(...o),16),c=parseInt(String.fromCodePoint(...r),16);return [exports$1.TokenType.UnicodeRange,n.source.slice(n.representationStart,n.representationEnd+1),n.representationStart,n.representationEnd,{startOfRange:i,endOfRange:c}]}function tokenizer(n,i){const c=n.css.valueOf(),a=n.unicodeRangesAllowed??false,u=new Reader(c),d={onParseError:i?.onParseError??noop};return {nextToken:function nextToken(){u.resetRepresentation();const n=u.source.codePointAt(u.cursor);if(void 0===n)return [exports$1.TokenType.EOF,"",-1,-1,void 0];if(47===n&&checkIfTwoCodePointsStartAComment(u))return consumeComment(d,u);if(a&&(117===n||85===n)&&checkIfThreeCodePointsWouldStartAUnicodeRange(u))return consumeUnicodeRangeToken(0,u);if(isIdentStartCodePoint(n))return consumeIdentLikeToken(d,u);if(isDigitCodePoint(n))return consumeNumericToken(d,u);switch(n){case 44:return u.advanceCodePoint(),[exports$1.TokenType.Comma,",",u.representationStart,u.representationEnd,void 0];case 58:return u.advanceCodePoint(),[exports$1.TokenType.Colon,":",u.representationStart,u.representationEnd,void 0];case 59:return u.advanceCodePoint(),[exports$1.TokenType.Semicolon,";",u.representationStart,u.representationEnd,void 0];case 40:return u.advanceCodePoint(),[exports$1.TokenType.OpenParen,"(",u.representationStart,u.representationEnd,void 0];case 41:return u.advanceCodePoint(),[exports$1.TokenType.CloseParen,")",u.representationStart,u.representationEnd,void 0];case 91:return u.advanceCodePoint(),[exports$1.TokenType.OpenSquare,"[",u.representationStart,u.representationEnd,void 0];case 93:return u.advanceCodePoint(),[exports$1.TokenType.CloseSquare,"]",u.representationStart,u.representationEnd,void 0];case 123:return u.advanceCodePoint(),[exports$1.TokenType.OpenCurly,"{",u.representationStart,u.representationEnd,void 0];case 125:return u.advanceCodePoint(),[exports$1.TokenType.CloseCurly,"}",u.representationStart,u.representationEnd,void 0];case 39:case 34:return consumeStringToken(d,u);case 35:return consumeHashToken(d,u);case s:case 46:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]);case r:case o:case 12:case 9:case 32:return consumeWhiteSpace(u);case t:return checkIfThreeCodePointsWouldStartANumber(u)?consumeNumericToken(d,u):checkIfThreeCodePointsWouldStartCDC(u)?(u.advanceCodePoint(3),[exports$1.TokenType.CDC,"--\x3e",u.representationStart,u.representationEnd,void 0]):checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)?consumeIdentLikeToken(d,u):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"-",u.representationStart,u.representationEnd,{value:"-"}]);case 60:return checkIfFourCodePointsWouldStartCDO(u)?(u.advanceCodePoint(4),[exports$1.TokenType.CDO,"\x3c!--",u.representationStart,u.representationEnd,void 0]):(u.advanceCodePoint(),[exports$1.TokenType.Delim,"<",u.representationStart,u.representationEnd,{value:"<"}]);case 64:if(u.advanceCodePoint(),checkIfThreeCodePointsWouldStartAnIdentSequence(0,u)){const e=consumeIdentSequence(d,u);return [exports$1.TokenType.AtKeyword,u.source.slice(u.representationStart,u.representationEnd+1),u.representationStart,u.representationEnd,{value:String.fromCodePoint(...e)}]}return [exports$1.TokenType.Delim,"@",u.representationStart,u.representationEnd,{value:"@"}];case 92:{if(checkIfTwoCodePointsAreAValidEscape(u))return consumeIdentLikeToken(d,u);u.advanceCodePoint();const n=[exports$1.TokenType.Delim,"\\",u.representationStart,u.representationEnd,{value:"\\"}];return d.onParseError(new ParseErrorWithToken(e.InvalidEscapeSequenceAfterBackslash,u.representationStart,u.representationEnd,["4.3.1. Consume a token","U+005C REVERSE SOLIDUS (\\)","The input stream does not start with a valid escape sequence"],n)),n}}return u.advanceCodePoint(),[exports$1.TokenType.Delim,u.source[u.representationStart],u.representationStart,u.representationEnd,{value:u.source[u.representationStart]}]},endOfFile:function endOfFile(){return void 0===u.source.codePointAt(u.cursor)}}}function noop(){}function serializeIdent(e){let n=0;if(0===e[0])e.splice(0,1,i),n=1;else if(e[0]===t&&e[1]===t)n=2;else if(e[0]===t&&e[1])n=2,isIdentStartCodePoint(e[1])||(n+=insertEscapedCodePoint(e,1,e[1]));else {if(e[0]===t&&!e[1])return [92,e[0]];isIdentStartCodePoint(e[0])?n=1:(n=1,n+=insertEscapedCodePoint(e,0,e[0]));}for(let o=n;o<e.length;o++)0!==e[o]?isIdentCodePoint(e[o])||(o+=insertEscapedCharacter(e,o,e[o])):(e.splice(o,1,i),o++);return e}function insertEscapedCharacter(e,n,o){return e.splice(n,1,92,o),1}function insertEscapedCodePoint(e,n,o){const t=o.toString(16),r=[];for(const e of t)r.push(e.codePointAt(0));return e.splice(n,1,92,...r,32),1+r.length}const d=Object.values(exports$1.TokenType);exports$1.ParseError=ParseError,exports$1.ParseErrorMessage=e,exports$1.ParseErrorWithToken=ParseErrorWithToken,exports$1.cloneTokens=function cloneTokens(e){return n?structuredClone(e):JSON.parse(JSON.stringify(e))},exports$1.isToken=function isToken(e){return !!Array.isArray(e)&&(!(e.length<4)&&(!!d.includes(e[0])&&("string"==typeof e[1]&&("number"==typeof e[2]&&"number"==typeof e[3]))))},exports$1.isTokenAtKeyword=function isTokenAtKeyword(e){return !!e&&e[0]===exports$1.TokenType.AtKeyword},exports$1.isTokenBadString=function isTokenBadString(e){return !!e&&e[0]===exports$1.TokenType.BadString},exports$1.isTokenBadURL=function isTokenBadURL(e){return !!e&&e[0]===exports$1.TokenType.BadURL},exports$1.isTokenCDC=function isTokenCDC(e){return !!e&&e[0]===exports$1.TokenType.CDC},exports$1.isTokenCDO=function isTokenCDO(e){return !!e&&e[0]===exports$1.TokenType.CDO},exports$1.isTokenCloseCurly=function isTokenCloseCurly(e){return !!e&&e[0]===exports$1.TokenType.CloseCurly},exports$1.isTokenCloseParen=function isTokenCloseParen(e){return !!e&&e[0]===exports$1.TokenType.CloseParen},exports$1.isTokenCloseSquare=function isTokenCloseSquare(e){return !!e&&e[0]===exports$1.TokenType.CloseSquare},exports$1.isTokenColon=function isTokenColon(e){return !!e&&e[0]===exports$1.TokenType.Colon},exports$1.isTokenComma=function isTokenComma(e){return !!e&&e[0]===exports$1.TokenType.Comma},exports$1.isTokenComment=function isTokenComment(e){return !!e&&e[0]===exports$1.TokenType.Comment},exports$1.isTokenDelim=function isTokenDelim(e){return !!e&&e[0]===exports$1.TokenType.Delim},exports$1.isTokenDimension=function isTokenDimension(e){return !!e&&e[0]===exports$1.TokenType.Dimension},exports$1.isTokenEOF=function isTokenEOF(e){return !!e&&e[0]===exports$1.TokenType.EOF},exports$1.isTokenFunction=function isTokenFunction(e){return !!e&&e[0]===exports$1.TokenType.Function},exports$1.isTokenHash=function isTokenHash(e){return !!e&&e[0]===exports$1.TokenType.Hash},exports$1.isTokenIdent=function isTokenIdent(e){return !!e&&e[0]===exports$1.TokenType.Ident},exports$1.isTokenNumber=function isTokenNumber(e){return !!e&&e[0]===exports$1.TokenType.Number},exports$1.isTokenNumeric=function isTokenNumeric(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Dimension:case exports$1.TokenType.Number:case exports$1.TokenType.Percentage:return true;default:return false}},exports$1.isTokenOpenCurly=function isTokenOpenCurly(e){return !!e&&e[0]===exports$1.TokenType.OpenCurly},exports$1.isTokenOpenParen=function isTokenOpenParen(e){return !!e&&e[0]===exports$1.TokenType.OpenParen},exports$1.isTokenOpenSquare=function isTokenOpenSquare(e){return !!e&&e[0]===exports$1.TokenType.OpenSquare},exports$1.isTokenPercentage=function isTokenPercentage(e){return !!e&&e[0]===exports$1.TokenType.Percentage},exports$1.isTokenSemicolon=function isTokenSemicolon(e){return !!e&&e[0]===exports$1.TokenType.Semicolon},exports$1.isTokenString=function isTokenString(e){return !!e&&e[0]===exports$1.TokenType.String},exports$1.isTokenURL=function isTokenURL(e){return !!e&&e[0]===exports$1.TokenType.URL},exports$1.isTokenUnicodeRange=function isTokenUnicodeRange(e){return !!e&&e[0]===exports$1.TokenType.UnicodeRange},exports$1.isTokenWhiteSpaceOrComment=function isTokenWhiteSpaceOrComment(e){if(!e)return false;switch(e[0]){case exports$1.TokenType.Whitespace:case exports$1.TokenType.Comment:return true;default:return false}},exports$1.isTokenWhitespace=function isTokenWhitespace(e){return !!e&&e[0]===exports$1.TokenType.Whitespace},exports$1.mirrorVariant=function mirrorVariant(e){switch(e[0]){case exports$1.TokenType.OpenParen:return [exports$1.TokenType.CloseParen,")",-1,-1,void 0];case exports$1.TokenType.CloseParen:return [exports$1.TokenType.OpenParen,"(",-1,-1,void 0];case exports$1.TokenType.OpenCurly:return [exports$1.TokenType.CloseCurly,"}",-1,-1,void 0];case exports$1.TokenType.CloseCurly:return [exports$1.TokenType.OpenCurly,"{",-1,-1,void 0];case exports$1.TokenType.OpenSquare:return [exports$1.TokenType.CloseSquare,"]",-1,-1,void 0];case exports$1.TokenType.CloseSquare:return [exports$1.TokenType.OpenSquare,"[",-1,-1,void 0];default:return null}},exports$1.mirrorVariantType=function mirrorVariantType(e){switch(e){case exports$1.TokenType.OpenParen:return exports$1.TokenType.CloseParen;case exports$1.TokenType.CloseParen:return exports$1.TokenType.OpenParen;case exports$1.TokenType.OpenCurly:return exports$1.TokenType.CloseCurly;case exports$1.TokenType.CloseCurly:return exports$1.TokenType.OpenCurly;case exports$1.TokenType.OpenSquare:return exports$1.TokenType.CloseSquare;case exports$1.TokenType.CloseSquare:return exports$1.TokenType.OpenSquare;default:return null}},exports$1.mutateIdent=function mutateIdent(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=String.fromCodePoint(...serializeIdent(o));e[1]=t,e[4].value=n;},exports$1.mutateUnit=function mutateUnit(e,n){const o=[];for(const e of n)o.push(e.codePointAt(0));const t=serializeIdent(o);101===t[0]&&insertEscapedCodePoint(t,0,t[0]);const r=String.fromCodePoint(...t),s="+"===e[4].signCharacter?e[4].signCharacter:"",i=e[4].value.toString();e[1]=`${s}${i}${r}`,e[4].unit=n;},exports$1.stringify=function stringify(...e){let n="";for(let o=0;o<e.length;o++)n+=e[o][1];return n},exports$1.tokenize=function tokenize(e,n){const o=tokenizer(e,n),t=[];for(;!o.endOfFile();)t.push(o.nextToken());return t.push(o.nextToken()),t},exports$1.tokenizer=tokenizer;
|
|
1467
1498
|
} (dist));
|
|
1468
1499
|
return dist;
|
|
1469
1500
|
}
|
|
@@ -2739,36 +2770,36 @@ var hasRequiredProperties;
|
|
|
2739
2770
|
function requireProperties () {
|
|
2740
2771
|
if (hasRequiredProperties) return properties;
|
|
2741
2772
|
hasRequiredProperties = 1;
|
|
2742
|
-
(function (exports) {
|
|
2773
|
+
(function (exports$1) {
|
|
2743
2774
|
|
|
2744
|
-
Object.defineProperty(exports, "__esModule", {
|
|
2775
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
2745
2776
|
value: true
|
|
2746
2777
|
});
|
|
2747
|
-
Object.defineProperty(exports, "BorderRadiusIndividual", {
|
|
2778
|
+
Object.defineProperty(exports$1, "BorderRadiusIndividual", {
|
|
2748
2779
|
enumerable: true,
|
|
2749
2780
|
get: function () {
|
|
2750
2781
|
return _borderRadius.BorderRadiusIndividual;
|
|
2751
2782
|
}
|
|
2752
2783
|
});
|
|
2753
|
-
Object.defineProperty(exports, "BorderRadiusShorthand", {
|
|
2784
|
+
Object.defineProperty(exports$1, "BorderRadiusShorthand", {
|
|
2754
2785
|
enumerable: true,
|
|
2755
2786
|
get: function () {
|
|
2756
2787
|
return _borderRadius.BorderRadiusShorthand;
|
|
2757
2788
|
}
|
|
2758
2789
|
});
|
|
2759
|
-
Object.defineProperty(exports, "BoxShadow", {
|
|
2790
|
+
Object.defineProperty(exports$1, "BoxShadow", {
|
|
2760
2791
|
enumerable: true,
|
|
2761
2792
|
get: function () {
|
|
2762
2793
|
return _boxShadow.BoxShadow;
|
|
2763
2794
|
}
|
|
2764
2795
|
});
|
|
2765
|
-
Object.defineProperty(exports, "BoxShadowList", {
|
|
2796
|
+
Object.defineProperty(exports$1, "BoxShadowList", {
|
|
2766
2797
|
enumerable: true,
|
|
2767
2798
|
get: function () {
|
|
2768
2799
|
return _boxShadow.BoxShadowList;
|
|
2769
2800
|
}
|
|
2770
2801
|
});
|
|
2771
|
-
Object.defineProperty(exports, "Transform", {
|
|
2802
|
+
Object.defineProperty(exports$1, "Transform", {
|
|
2772
2803
|
enumerable: true,
|
|
2773
2804
|
get: function () {
|
|
2774
2805
|
return _transform.Transform;
|
|
@@ -3393,22 +3424,22 @@ var hasRequiredLib$1;
|
|
|
3393
3424
|
function requireLib$1 () {
|
|
3394
3425
|
if (hasRequiredLib$1) return lib$1;
|
|
3395
3426
|
hasRequiredLib$1 = 1;
|
|
3396
|
-
(function (exports) {
|
|
3427
|
+
(function (exports$1) {
|
|
3397
3428
|
|
|
3398
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3429
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
3399
3430
|
value: true
|
|
3400
3431
|
});
|
|
3401
|
-
Object.defineProperty(exports, "lastMediaQueryWinsTransform", {
|
|
3432
|
+
Object.defineProperty(exports$1, "lastMediaQueryWinsTransform", {
|
|
3402
3433
|
enumerable: true,
|
|
3403
3434
|
get: function () {
|
|
3404
3435
|
return _mediaQueryTransform.lastMediaQueryWinsTransform;
|
|
3405
3436
|
}
|
|
3406
3437
|
});
|
|
3407
|
-
exports.tokenParser = exports.properties = void 0;
|
|
3438
|
+
exports$1.tokenParser = exports$1.properties = void 0;
|
|
3408
3439
|
var _tokenParser = _interopRequireWildcard(requireTokenParser());
|
|
3409
|
-
exports.tokenParser = _tokenParser;
|
|
3440
|
+
exports$1.tokenParser = _tokenParser;
|
|
3410
3441
|
var _properties = _interopRequireWildcard(requireProperties());
|
|
3411
|
-
exports.properties = _properties;
|
|
3442
|
+
exports$1.properties = _properties;
|
|
3412
3443
|
var _mediaQueryTransform = requireMediaQueryTransform();
|
|
3413
3444
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
3414
3445
|
} (lib$1));
|
|
@@ -3591,7 +3622,10 @@ const angles = ['deg', 'grad', 'turn', 'rad'];
|
|
|
3591
3622
|
const timings = ['ms', 's'];
|
|
3592
3623
|
const fraction = 'fr';
|
|
3593
3624
|
const percentage$1 = '%';
|
|
3594
|
-
function normalizeZeroDimensions(ast,
|
|
3625
|
+
function normalizeZeroDimensions(ast, key) {
|
|
3626
|
+
if (typeof key === 'string' && key.startsWith('--')) {
|
|
3627
|
+
return ast;
|
|
3628
|
+
}
|
|
3595
3629
|
let endFunction = 0;
|
|
3596
3630
|
ast.walk(node => {
|
|
3597
3631
|
if (node.type === 'function' && !endFunction) {
|
|
@@ -4036,6 +4070,15 @@ function requirePropertyPriorities () {
|
|
|
4036
4070
|
longHandPhysical.add('border-top-right-radius');
|
|
4037
4071
|
longHandPhysical.add('border-bottom-left-radius');
|
|
4038
4072
|
longHandPhysical.add('border-bottom-right-radius');
|
|
4073
|
+
shorthandsOfLonghands.add('corner-shape');
|
|
4074
|
+
longHandLogical.add('corner-start-start-shape');
|
|
4075
|
+
longHandLogical.add('corner-start-end-shape');
|
|
4076
|
+
longHandLogical.add('corner-end-start-shape');
|
|
4077
|
+
longHandLogical.add('corner-end-end-shape');
|
|
4078
|
+
longHandPhysical.add('corner-top-left-shape');
|
|
4079
|
+
longHandPhysical.add('corner-top-right-shape');
|
|
4080
|
+
longHandPhysical.add('corner-bottom-left-shape');
|
|
4081
|
+
longHandPhysical.add('corner-bottom-right-shape');
|
|
4039
4082
|
longHandLogical.add('box-shadow');
|
|
4040
4083
|
longHandLogical.add('accent-color');
|
|
4041
4084
|
longHandLogical.add('appearance');
|
|
@@ -41,6 +41,7 @@ export type StyleXOptions = Readonly<{
|
|
|
41
41
|
debug: null | undefined | boolean;
|
|
42
42
|
definedStylexCSSVariables?: { [key: string]: unknown };
|
|
43
43
|
dev: boolean;
|
|
44
|
+
propertyValidationMode?: 'throw' | 'warn' | 'silent';
|
|
44
45
|
enableDebugClassNames?: null | undefined | boolean;
|
|
45
46
|
enableDebugDataProp?: null | undefined | boolean;
|
|
46
47
|
enableDevClassNames?: null | undefined | boolean;
|
|
@@ -48,6 +48,7 @@ export type StyleXOptions = $ReadOnly<{
|
|
|
48
48
|
debug: ?boolean,
|
|
49
49
|
definedStylexCSSVariables?: { [key: string]: mixed },
|
|
50
50
|
dev: boolean,
|
|
51
|
+
propertyValidationMode?: 'throw' | 'warn' | 'silent',
|
|
51
52
|
enableDebugClassNames?: ?boolean,
|
|
52
53
|
enableDebugDataProp?: ?boolean,
|
|
53
54
|
enableDevClassNames?: ?boolean,
|
|
@@ -23,6 +23,7 @@ import type { TStyleValue } from '../common-types';
|
|
|
23
23
|
* - [x] border-inline-start
|
|
24
24
|
* - [x] border-left
|
|
25
25
|
* - [x] border-radius
|
|
26
|
+
* - [x] corner-shape
|
|
26
27
|
* - [x] border-right
|
|
27
28
|
* - [x] border-style
|
|
28
29
|
* - [x] border-top
|
|
@@ -74,6 +75,7 @@ import type { TStyleValue } from '../common-types';
|
|
|
74
75
|
* - [x] border-inline-start
|
|
75
76
|
* - [x] border-left
|
|
76
77
|
* - [x] border-radius
|
|
78
|
+
* - [x] corner-shape
|
|
77
79
|
* - [x] border-right
|
|
78
80
|
* - [x] border-style
|
|
79
81
|
* - [x] border-top
|
|
@@ -13,6 +13,9 @@ export declare function getExpandedKeys(
|
|
|
13
13
|
): ReadonlyArray<string>;
|
|
14
14
|
declare function flatMapExpandedShorthands(
|
|
15
15
|
objEntry: Readonly<[string, TStyleValue]>,
|
|
16
|
-
options: Readonly<{
|
|
16
|
+
options: Readonly<{
|
|
17
|
+
styleResolution: StyleXOptions['styleResolution'];
|
|
18
|
+
propertyValidationMode?: StyleXOptions['propertyValidationMode'];
|
|
19
|
+
}>,
|
|
17
20
|
): ReadonlyArray<[string, TStyleValue]>;
|
|
18
21
|
export default flatMapExpandedShorthands;
|
|
@@ -17,6 +17,7 @@ declare export default function flatMapExpandedShorthands(
|
|
|
17
17
|
objEntry: $ReadOnly<[string, TStyleValue]>,
|
|
18
18
|
options: $ReadOnly<{
|
|
19
19
|
styleResolution: StyleXOptions['styleResolution'],
|
|
20
|
+
propertyValidationMode?: StyleXOptions['propertyValidationMode'],
|
|
20
21
|
...
|
|
21
22
|
}>,
|
|
22
23
|
): $ReadOnlyArray<[string, TStyleValue]>;
|
|
@@ -27,6 +27,7 @@ export declare type LOGICAL_FLOAT_END_VAR = typeof LOGICAL_FLOAT_END_VAR;
|
|
|
27
27
|
* - [x] border-inline-start
|
|
28
28
|
* - [ ] border-left
|
|
29
29
|
* - [x] border-radius
|
|
30
|
+
* - [ ] corner-shape
|
|
30
31
|
* - [ ] border-right
|
|
31
32
|
* - [x] border-style
|
|
32
33
|
* - [ ] border-top
|
|
@@ -74,6 +75,7 @@ export declare type LOGICAL_FLOAT_END_VAR = typeof LOGICAL_FLOAT_END_VAR;
|
|
|
74
75
|
* - [x] border-inline-start
|
|
75
76
|
* - [ ] border-left
|
|
76
77
|
* - [x] border-radius
|
|
78
|
+
* - [ ] corner-shape
|
|
77
79
|
* - [ ] border-right
|
|
78
80
|
* - [x] border-style
|
|
79
81
|
* - [ ] border-top
|
|
@@ -41,7 +41,7 @@ export declare function getProgramStatement(path: NodePath): NodePath;
|
|
|
41
41
|
* - Direct named exports: `export const x = ...`
|
|
42
42
|
* - Locally declared named exports: `const x = ...; export { x }`
|
|
43
43
|
*
|
|
44
|
-
* Default exports and re-exports from other files (e.g., `export { x } from './other'`) are NOT allowed.
|
|
44
|
+
* Default exports, aliasing and re-exports from other files (e.g., `export { x } from './other'`) are NOT allowed.
|
|
45
45
|
*/
|
|
46
46
|
export declare function isVariableNamedExported(
|
|
47
47
|
path: NodePath<t.VariableDeclarator>,
|
|
@@ -49,7 +49,7 @@ declare export function getProgramStatement(path: NodePath<>): NodePath<>;
|
|
|
49
49
|
* - Direct named exports: `export const x = ...`
|
|
50
50
|
* - Locally declared named exports: `const x = ...; export { x }`
|
|
51
51
|
*
|
|
52
|
-
* Default exports and re-exports from other files (e.g., `export { x } from './other'`) are NOT allowed.
|
|
52
|
+
* Default exports, aliasing and re-exports from other files (e.g., `export { x } from './other'`) are NOT allowed.
|
|
53
53
|
*/
|
|
54
54
|
declare export function isVariableNamedExported(
|
|
55
55
|
path: NodePath<t.VariableDeclarator>,
|
|
@@ -50,6 +50,7 @@ export type StyleXOptions = Readonly<
|
|
|
50
50
|
| null
|
|
51
51
|
| undefined
|
|
52
52
|
| Readonly<{ [$$Key$$: string]: string | ReadonlyArray<string> }>;
|
|
53
|
+
propertyValidationMode?: 'throw' | 'warn' | 'silent';
|
|
53
54
|
enableDebugClassNames?: boolean;
|
|
54
55
|
enableDebugDataProp?: boolean;
|
|
55
56
|
enableDevClassNames?: boolean;
|
|
@@ -76,6 +77,7 @@ export type StyleXOptions = Readonly<
|
|
|
76
77
|
| null
|
|
77
78
|
| undefined
|
|
78
79
|
| Readonly<{ [$$Key$$: string]: string | ReadonlyArray<string> }>;
|
|
80
|
+
propertyValidationMode?: 'throw' | 'warn' | 'silent';
|
|
79
81
|
enableDebugClassNames?: boolean;
|
|
80
82
|
enableDebugDataProp?: boolean;
|
|
81
83
|
enableDevClassNames?: boolean;
|
|
@@ -47,6 +47,7 @@ type ModuleResolution =
|
|
|
47
47
|
export type StyleXOptions = $ReadOnly<{
|
|
48
48
|
...RuntimeOptions,
|
|
49
49
|
aliases?: ?$ReadOnly<{ [string]: string | $ReadOnlyArray<string> }>,
|
|
50
|
+
propertyValidationMode?: 'throw' | 'warn' | 'silent',
|
|
50
51
|
enableDebugClassNames?: boolean,
|
|
51
52
|
enableDebugDataProp?: boolean,
|
|
52
53
|
enableDevClassNames?: boolean,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stylexjs/babel-plugin",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.5",
|
|
4
4
|
"description": "StyleX babel plugin.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"browser": "lib/index.browser.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"prebuild": "gen-types -i src/ -o lib/",
|
|
15
15
|
"build": "rollup --config ./rollup.config.mjs",
|
|
16
|
-
"build-haste": "HASTE=true rollup --config ./rollup.config.mjs",
|
|
16
|
+
"build-haste": "cross-env HASTE=true rollup --config ./rollup.config.mjs",
|
|
17
17
|
"build-watch": "rollup --config ./rollup.config.mjs --watch",
|
|
18
18
|
"test": "jest --coverage"
|
|
19
19
|
},
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"@babel/traverse": "^7.26.8",
|
|
24
24
|
"@babel/types": "^7.26.8",
|
|
25
25
|
"@dual-bundle/import-meta-resolve": "^4.1.0",
|
|
26
|
-
"@stylexjs/shared": "0.17.
|
|
27
|
-
"@stylexjs/stylex": "0.17.
|
|
26
|
+
"@stylexjs/shared": "0.17.5",
|
|
27
|
+
"@stylexjs/stylex": "0.17.5",
|
|
28
28
|
"postcss-value-parser": "^4.1.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"babel-plugin-syntax-hermes-parser": "^0.32.1",
|
|
38
38
|
"path-browserify": "^1.0.1",
|
|
39
39
|
"rollup": "^4.24.0",
|
|
40
|
-
"scripts": "0.17.
|
|
40
|
+
"scripts": "0.17.5"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"flow_modules/*",
|