@stylexjs/babel-plugin 0.16.2 → 0.17.0

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.
Files changed (45) hide show
  1. package/lib/index.d.ts +5 -5
  2. package/lib/index.js +893 -1775
  3. package/lib/index.js.flow +2 -1
  4. package/lib/shared/common-types.d.ts +3 -4
  5. package/lib/shared/index.d.ts +1 -1
  6. package/lib/shared/index.js.flow +1 -1
  7. package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +4 -0
  8. package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +5 -0
  9. package/lib/shared/stylex-create-theme.d.ts +1 -1
  10. package/lib/shared/stylex-define-vars.d.ts +3 -3
  11. package/lib/shared/types/index.js.flow +12 -12
  12. package/lib/shared/utils/object-utils.js.flow +1 -1
  13. package/lib/shared/when/when.d.ts +5 -5
  14. package/lib/shared/when/when.js.flow +5 -5
  15. package/lib/utils/add-sourcemap-data.js.flow +2 -2
  16. package/lib/utils/ast-helpers.js.flow +3 -3
  17. package/lib/utils/evaluate-path.d.ts +1 -0
  18. package/lib/utils/evaluate-path.js.flow +3 -2
  19. package/lib/utils/js-to-ast.d.ts +0 -4
  20. package/lib/utils/js-to-ast.js.flow +1 -7
  21. package/lib/utils/state-manager.d.ts +37 -19
  22. package/lib/utils/state-manager.js.flow +37 -22
  23. package/lib/utils/validate.d.ts +1 -0
  24. package/lib/utils/validate.js.flow +2 -0
  25. package/lib/visitors/imports.js.flow +2 -2
  26. package/lib/visitors/parse-stylex-create-arg.js.flow +2 -2
  27. package/lib/visitors/stylex-create-theme.js.flow +2 -2
  28. package/lib/visitors/stylex-create.js.flow +2 -2
  29. package/lib/visitors/stylex-default-marker.js.flow +2 -2
  30. package/lib/visitors/stylex-define-consts.js.flow +2 -2
  31. package/lib/visitors/stylex-define-marker.d.ts +22 -0
  32. package/lib/visitors/stylex-define-marker.js.flow +22 -0
  33. package/lib/visitors/stylex-define-vars.js.flow +2 -2
  34. package/lib/visitors/stylex-keyframes.js.flow +2 -2
  35. package/lib/visitors/stylex-merge.js.flow +2 -2
  36. package/lib/visitors/stylex-position-try.js.flow +2 -2
  37. package/lib/visitors/stylex-props.js.flow +2 -2
  38. package/lib/visitors/stylex-view-transition-class.js.flow +2 -2
  39. package/package.json +4 -3
  40. package/flow_modules/@babel/core/index.js.flow +0 -854
  41. package/flow_modules/@babel/generator/index.js.flow +0 -216
  42. package/flow_modules/@babel/helper-module-imports/index.js.flow +0 -182
  43. package/flow_modules/@babel/parser/index.js.flow +0 -253
  44. package/flow_modules/@babel/traverse/index.js.flow +0 -1007
  45. package/flow_modules/@babel/types/index.js.flow +0 -5225
package/lib/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var t = require('@babel/types');
4
- var path = require('path');
5
- var fs = require('fs');
6
- var url$1 = require('url');
4
+ var path = require('node:path');
5
+ var fs = require('node:fs');
6
+ var url$1 = require('node:url');
7
7
  var importMetaResolve = require('@dual-bundle/import-meta-resolve');
8
- var require$$0 = require('assert');
8
+ var helperModuleImports = require('@babel/helper-module-imports');
9
+ var parser = require('postcss-value-parser');
9
10
  var core = require('@babel/core');
10
11
  var traverse = require('@babel/traverse');
11
12
  var stylex = require('@stylexjs/stylex');
@@ -48,6 +49,12 @@ const boolean = (message = defaultMessage('a boolean')) => (value, name) => {
48
49
  }
49
50
  return value;
50
51
  };
52
+ const func = (message = defaultMessage('a function')) => (value, name) => {
53
+ if (typeof value !== 'function') {
54
+ return new Error(message(value, name));
55
+ }
56
+ return value;
57
+ };
51
58
  const literal = (expected, message = defaultMessage(`the literal ${JSON.stringify(expected)}`)) => (value, name) => {
52
59
  if (value === expected) {
53
60
  return expected;
@@ -128,6 +135,25 @@ const unionOf3 = (a, b, c, message = defaultUnionMessage('one of')) => (value, n
128
135
  }
129
136
  return new Error(`${message(value, name)}${indent(resultA.message)}${indent(resultB.message)}${indent(resultC.message)}\nBut got: ${JSON.stringify(value)}`);
130
137
  };
138
+ const unionOf4 = (a, b, c, d, message = defaultUnionMessage('one of')) => (value, name) => {
139
+ const resultA = a(value);
140
+ if (!(resultA instanceof Error)) {
141
+ return resultA;
142
+ }
143
+ const resultB = b(value);
144
+ if (!(resultB instanceof Error)) {
145
+ return resultB;
146
+ }
147
+ const resultC = c(value);
148
+ if (!(resultC instanceof Error)) {
149
+ return resultC;
150
+ }
151
+ const resultD = d(value);
152
+ if (!(resultD instanceof Error)) {
153
+ return resultD;
154
+ }
155
+ return new Error(`${message(value, name)}${indent(resultA.message)}${indent(resultB.message)}${indent(resultC.message)}${indent(resultD.message)}\nBut got: ${JSON.stringify(value)}`);
156
+ };
131
157
  const logAndDefault = (check, value, def, name) => {
132
158
  const result = check(value, name);
133
159
  if (result instanceof Error) {
@@ -137,524 +163,6 @@ const logAndDefault = (check, value, def, name) => {
137
163
  return result;
138
164
  };
139
165
 
140
- function getDefaultExportFromCjs (x) {
141
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
142
- }
143
-
144
- var lib$2 = {};
145
-
146
- var importInjector = {};
147
-
148
- var importBuilder = {};
149
-
150
- var hasRequiredImportBuilder;
151
-
152
- function requireImportBuilder () {
153
- if (hasRequiredImportBuilder) return importBuilder;
154
- hasRequiredImportBuilder = 1;
155
-
156
- Object.defineProperty(importBuilder, "__esModule", {
157
- value: true
158
- });
159
- importBuilder.default = void 0;
160
- var _assert = require$$0;
161
- var _t = t;
162
- const {
163
- callExpression,
164
- cloneNode,
165
- expressionStatement,
166
- identifier,
167
- importDeclaration,
168
- importDefaultSpecifier,
169
- importNamespaceSpecifier,
170
- importSpecifier,
171
- memberExpression,
172
- stringLiteral,
173
- variableDeclaration,
174
- variableDeclarator
175
- } = _t;
176
- class ImportBuilder {
177
- constructor(importedSource, scope, hub) {
178
- this._statements = [];
179
- this._resultName = null;
180
- this._importedSource = void 0;
181
- this._scope = scope;
182
- this._hub = hub;
183
- this._importedSource = importedSource;
184
- }
185
- done() {
186
- return {
187
- statements: this._statements,
188
- resultName: this._resultName
189
- };
190
- }
191
- import() {
192
- this._statements.push(importDeclaration([], stringLiteral(this._importedSource)));
193
- return this;
194
- }
195
- require() {
196
- this._statements.push(expressionStatement(callExpression(identifier("require"), [stringLiteral(this._importedSource)])));
197
- return this;
198
- }
199
- namespace(name = "namespace") {
200
- const local = this._scope.generateUidIdentifier(name);
201
- const statement = this._statements[this._statements.length - 1];
202
- _assert(statement.type === "ImportDeclaration");
203
- _assert(statement.specifiers.length === 0);
204
- statement.specifiers = [importNamespaceSpecifier(local)];
205
- this._resultName = cloneNode(local);
206
- return this;
207
- }
208
- default(name) {
209
- const id = this._scope.generateUidIdentifier(name);
210
- const statement = this._statements[this._statements.length - 1];
211
- _assert(statement.type === "ImportDeclaration");
212
- _assert(statement.specifiers.length === 0);
213
- statement.specifiers = [importDefaultSpecifier(id)];
214
- this._resultName = cloneNode(id);
215
- return this;
216
- }
217
- named(name, importName) {
218
- if (importName === "default") return this.default(name);
219
- const id = this._scope.generateUidIdentifier(name);
220
- const statement = this._statements[this._statements.length - 1];
221
- _assert(statement.type === "ImportDeclaration");
222
- _assert(statement.specifiers.length === 0);
223
- statement.specifiers = [importSpecifier(id, identifier(importName))];
224
- this._resultName = cloneNode(id);
225
- return this;
226
- }
227
- var(name) {
228
- const id = this._scope.generateUidIdentifier(name);
229
- let statement = this._statements[this._statements.length - 1];
230
- if (statement.type !== "ExpressionStatement") {
231
- _assert(this._resultName);
232
- statement = expressionStatement(this._resultName);
233
- this._statements.push(statement);
234
- }
235
- this._statements[this._statements.length - 1] = variableDeclaration("var", [variableDeclarator(id, statement.expression)]);
236
- this._resultName = cloneNode(id);
237
- return this;
238
- }
239
- defaultInterop() {
240
- return this._interop(this._hub.addHelper("interopRequireDefault"));
241
- }
242
- wildcardInterop() {
243
- return this._interop(this._hub.addHelper("interopRequireWildcard"));
244
- }
245
- _interop(callee) {
246
- const statement = this._statements[this._statements.length - 1];
247
- if (statement.type === "ExpressionStatement") {
248
- statement.expression = callExpression(callee, [statement.expression]);
249
- } else if (statement.type === "VariableDeclaration") {
250
- _assert(statement.declarations.length === 1);
251
- statement.declarations[0].init = callExpression(callee, [statement.declarations[0].init]);
252
- } else {
253
- _assert.fail("Unexpected type.");
254
- }
255
- return this;
256
- }
257
- prop(name) {
258
- const statement = this._statements[this._statements.length - 1];
259
- if (statement.type === "ExpressionStatement") {
260
- statement.expression = memberExpression(statement.expression, identifier(name));
261
- } else if (statement.type === "VariableDeclaration") {
262
- _assert(statement.declarations.length === 1);
263
- statement.declarations[0].init = memberExpression(statement.declarations[0].init, identifier(name));
264
- } else {
265
- _assert.fail("Unexpected type:" + statement.type);
266
- }
267
- return this;
268
- }
269
- read(name) {
270
- this._resultName = memberExpression(this._resultName, identifier(name));
271
- }
272
- }
273
- importBuilder.default = ImportBuilder;
274
-
275
-
276
- return importBuilder;
277
- }
278
-
279
- var isModule = {};
280
-
281
- var hasRequiredIsModule;
282
-
283
- function requireIsModule () {
284
- if (hasRequiredIsModule) return isModule;
285
- hasRequiredIsModule = 1;
286
-
287
- Object.defineProperty(isModule, "__esModule", {
288
- value: true
289
- });
290
- isModule.default = isModule$1;
291
- function isModule$1(path) {
292
- return path.node.sourceType === "module";
293
- }
294
-
295
-
296
- return isModule;
297
- }
298
-
299
- var hasRequiredImportInjector;
300
-
301
- function requireImportInjector () {
302
- if (hasRequiredImportInjector) return importInjector;
303
- hasRequiredImportInjector = 1;
304
-
305
- Object.defineProperty(importInjector, "__esModule", {
306
- value: true
307
- });
308
- importInjector.default = void 0;
309
- var _assert = require$$0;
310
- var _t = t;
311
- var _importBuilder = requireImportBuilder();
312
- var _isModule = requireIsModule();
313
- const {
314
- identifier,
315
- importSpecifier,
316
- numericLiteral,
317
- sequenceExpression,
318
- isImportDeclaration
319
- } = _t;
320
- class ImportInjector {
321
- constructor(path, importedSource, opts) {
322
- this._defaultOpts = {
323
- importedSource: null,
324
- importedType: "commonjs",
325
- importedInterop: "babel",
326
- importingInterop: "babel",
327
- ensureLiveReference: false,
328
- ensureNoContext: false,
329
- importPosition: "before"
330
- };
331
- const programPath = path.find(p => p.isProgram());
332
- this._programPath = programPath;
333
- this._programScope = programPath.scope;
334
- this._hub = programPath.hub;
335
- this._defaultOpts = this._applyDefaults(importedSource, opts, true);
336
- }
337
- addDefault(importedSourceIn, opts) {
338
- return this.addNamed("default", importedSourceIn, opts);
339
- }
340
- addNamed(importName, importedSourceIn, opts) {
341
- _assert(typeof importName === "string");
342
- return this._generateImport(this._applyDefaults(importedSourceIn, opts), importName);
343
- }
344
- addNamespace(importedSourceIn, opts) {
345
- return this._generateImport(this._applyDefaults(importedSourceIn, opts), null);
346
- }
347
- addSideEffect(importedSourceIn, opts) {
348
- return this._generateImport(this._applyDefaults(importedSourceIn, opts), void 0);
349
- }
350
- _applyDefaults(importedSource, opts, isInit = false) {
351
- let newOpts;
352
- if (typeof importedSource === "string") {
353
- newOpts = Object.assign({}, this._defaultOpts, {
354
- importedSource
355
- }, opts);
356
- } else {
357
- _assert(!opts, "Unexpected secondary arguments.");
358
- newOpts = Object.assign({}, this._defaultOpts, importedSource);
359
- }
360
- if (!isInit && opts) {
361
- if (opts.nameHint !== undefined) newOpts.nameHint = opts.nameHint;
362
- if (opts.blockHoist !== undefined) newOpts.blockHoist = opts.blockHoist;
363
- }
364
- return newOpts;
365
- }
366
- _generateImport(opts, importName) {
367
- const isDefault = importName === "default";
368
- const isNamed = !!importName && !isDefault;
369
- const isNamespace = importName === null;
370
- const {
371
- importedSource,
372
- importedType,
373
- importedInterop,
374
- importingInterop,
375
- ensureLiveReference,
376
- ensureNoContext,
377
- nameHint,
378
- importPosition,
379
- blockHoist
380
- } = opts;
381
- let name = nameHint || importName;
382
- const isMod = (0, _isModule.default)(this._programPath);
383
- const isModuleForNode = isMod && importingInterop === "node";
384
- const isModuleForBabel = isMod && importingInterop === "babel";
385
- if (importPosition === "after" && !isMod) {
386
- throw new Error(`"importPosition": "after" is only supported in modules`);
387
- }
388
- const builder = new _importBuilder.default(importedSource, this._programScope, this._hub);
389
- if (importedType === "es6") {
390
- if (!isModuleForNode && !isModuleForBabel) {
391
- throw new Error("Cannot import an ES6 module from CommonJS");
392
- }
393
- builder.import();
394
- if (isNamespace) {
395
- builder.namespace(nameHint || importedSource);
396
- } else if (isDefault || isNamed) {
397
- builder.named(name, importName);
398
- }
399
- } else if (importedType !== "commonjs") {
400
- throw new Error(`Unexpected interopType "${importedType}"`);
401
- } else if (importedInterop === "babel") {
402
- if (isModuleForNode) {
403
- name = name !== "default" ? name : importedSource;
404
- const es6Default = `${importedSource}$es6Default`;
405
- builder.import();
406
- if (isNamespace) {
407
- builder.default(es6Default).var(name || importedSource).wildcardInterop();
408
- } else if (isDefault) {
409
- if (ensureLiveReference) {
410
- builder.default(es6Default).var(name || importedSource).defaultInterop().read("default");
411
- } else {
412
- builder.default(es6Default).var(name).defaultInterop().prop(importName);
413
- }
414
- } else if (isNamed) {
415
- builder.default(es6Default).read(importName);
416
- }
417
- } else if (isModuleForBabel) {
418
- builder.import();
419
- if (isNamespace) {
420
- builder.namespace(name || importedSource);
421
- } else if (isDefault || isNamed) {
422
- builder.named(name, importName);
423
- }
424
- } else {
425
- builder.require();
426
- if (isNamespace) {
427
- builder.var(name || importedSource).wildcardInterop();
428
- } else if ((isDefault || isNamed) && ensureLiveReference) {
429
- if (isDefault) {
430
- name = name !== "default" ? name : importedSource;
431
- builder.var(name).read(importName);
432
- builder.defaultInterop();
433
- } else {
434
- builder.var(importedSource).read(importName);
435
- }
436
- } else if (isDefault) {
437
- builder.var(name).defaultInterop().prop(importName);
438
- } else if (isNamed) {
439
- builder.var(name).prop(importName);
440
- }
441
- }
442
- } else if (importedInterop === "compiled") {
443
- if (isModuleForNode) {
444
- builder.import();
445
- if (isNamespace) {
446
- builder.default(name || importedSource);
447
- } else if (isDefault || isNamed) {
448
- builder.default(importedSource).read(name);
449
- }
450
- } else if (isModuleForBabel) {
451
- builder.import();
452
- if (isNamespace) {
453
- builder.namespace(name || importedSource);
454
- } else if (isDefault || isNamed) {
455
- builder.named(name, importName);
456
- }
457
- } else {
458
- builder.require();
459
- if (isNamespace) {
460
- builder.var(name || importedSource);
461
- } else if (isDefault || isNamed) {
462
- if (ensureLiveReference) {
463
- builder.var(importedSource).read(name);
464
- } else {
465
- builder.prop(importName).var(name);
466
- }
467
- }
468
- }
469
- } else if (importedInterop === "uncompiled") {
470
- if (isDefault && ensureLiveReference) {
471
- throw new Error("No live reference for commonjs default");
472
- }
473
- if (isModuleForNode) {
474
- builder.import();
475
- if (isNamespace) {
476
- builder.default(name || importedSource);
477
- } else if (isDefault) {
478
- builder.default(name);
479
- } else if (isNamed) {
480
- builder.default(importedSource).read(name);
481
- }
482
- } else if (isModuleForBabel) {
483
- builder.import();
484
- if (isNamespace) {
485
- builder.default(name || importedSource);
486
- } else if (isDefault) {
487
- builder.default(name);
488
- } else if (isNamed) {
489
- builder.named(name, importName);
490
- }
491
- } else {
492
- builder.require();
493
- if (isNamespace) {
494
- builder.var(name || importedSource);
495
- } else if (isDefault) {
496
- builder.var(name);
497
- } else if (isNamed) {
498
- if (ensureLiveReference) {
499
- builder.var(importedSource).read(name);
500
- } else {
501
- builder.var(name).prop(importName);
502
- }
503
- }
504
- }
505
- } else {
506
- throw new Error(`Unknown importedInterop "${importedInterop}".`);
507
- }
508
- const {
509
- statements,
510
- resultName
511
- } = builder.done();
512
- this._insertStatements(statements, importPosition, blockHoist);
513
- if ((isDefault || isNamed) && ensureNoContext && resultName.type !== "Identifier") {
514
- return sequenceExpression([numericLiteral(0), resultName]);
515
- }
516
- return resultName;
517
- }
518
- _insertStatements(statements, importPosition = "before", blockHoist = 3) {
519
- if (importPosition === "after") {
520
- if (this._insertStatementsAfter(statements)) return;
521
- } else {
522
- if (this._insertStatementsBefore(statements, blockHoist)) return;
523
- }
524
- this._programPath.unshiftContainer("body", statements);
525
- }
526
- _insertStatementsBefore(statements, blockHoist) {
527
- if (statements.length === 1 && isImportDeclaration(statements[0]) && isValueImport(statements[0])) {
528
- const firstImportDecl = this._programPath.get("body").find(p => {
529
- return p.isImportDeclaration() && isValueImport(p.node);
530
- });
531
- if ((firstImportDecl == null ? void 0 : firstImportDecl.node.source.value) === statements[0].source.value && maybeAppendImportSpecifiers(firstImportDecl.node, statements[0])) {
532
- return true;
533
- }
534
- }
535
- statements.forEach(node => {
536
- node._blockHoist = blockHoist;
537
- });
538
- const targetPath = this._programPath.get("body").find(p => {
539
- const val = p.node._blockHoist;
540
- return Number.isFinite(val) && val < 4;
541
- });
542
- if (targetPath) {
543
- targetPath.insertBefore(statements);
544
- return true;
545
- }
546
- return false;
547
- }
548
- _insertStatementsAfter(statements) {
549
- const statementsSet = new Set(statements);
550
- const importDeclarations = new Map();
551
- for (const statement of statements) {
552
- if (isImportDeclaration(statement) && isValueImport(statement)) {
553
- const source = statement.source.value;
554
- if (!importDeclarations.has(source)) importDeclarations.set(source, []);
555
- importDeclarations.get(source).push(statement);
556
- }
557
- }
558
- let lastImportPath = null;
559
- for (const bodyStmt of this._programPath.get("body")) {
560
- if (bodyStmt.isImportDeclaration() && isValueImport(bodyStmt.node)) {
561
- lastImportPath = bodyStmt;
562
- const source = bodyStmt.node.source.value;
563
- const newImports = importDeclarations.get(source);
564
- if (!newImports) continue;
565
- for (const decl of newImports) {
566
- if (!statementsSet.has(decl)) continue;
567
- if (maybeAppendImportSpecifiers(bodyStmt.node, decl)) {
568
- statementsSet.delete(decl);
569
- }
570
- }
571
- }
572
- }
573
- if (statementsSet.size === 0) return true;
574
- if (lastImportPath) lastImportPath.insertAfter(Array.from(statementsSet));
575
- return !!lastImportPath;
576
- }
577
- }
578
- importInjector.default = ImportInjector;
579
- function isValueImport(node) {
580
- return node.importKind !== "type" && node.importKind !== "typeof";
581
- }
582
- function hasNamespaceImport(node) {
583
- return node.specifiers.length === 1 && node.specifiers[0].type === "ImportNamespaceSpecifier" || node.specifiers.length === 2 && node.specifiers[1].type === "ImportNamespaceSpecifier";
584
- }
585
- function hasDefaultImport(node) {
586
- return node.specifiers.length > 0 && node.specifiers[0].type === "ImportDefaultSpecifier";
587
- }
588
- function maybeAppendImportSpecifiers(target, source) {
589
- if (!target.specifiers.length) {
590
- target.specifiers = source.specifiers;
591
- return true;
592
- }
593
- if (!source.specifiers.length) return true;
594
- if (hasNamespaceImport(target) || hasNamespaceImport(source)) return false;
595
- if (hasDefaultImport(source)) {
596
- if (hasDefaultImport(target)) {
597
- source.specifiers[0] = importSpecifier(source.specifiers[0].local, identifier("default"));
598
- } else {
599
- target.specifiers.unshift(source.specifiers.shift());
600
- }
601
- }
602
- target.specifiers.push(...source.specifiers);
603
- return true;
604
- }
605
-
606
-
607
- return importInjector;
608
- }
609
-
610
- var hasRequiredLib$2;
611
-
612
- function requireLib$2 () {
613
- if (hasRequiredLib$2) return lib$2;
614
- hasRequiredLib$2 = 1;
615
- (function (exports) {
616
-
617
- Object.defineProperty(exports, "__esModule", {
618
- value: true
619
- });
620
- Object.defineProperty(exports, "ImportInjector", {
621
- enumerable: true,
622
- get: function () {
623
- return _importInjector.default;
624
- }
625
- });
626
- exports.addDefault = addDefault;
627
- exports.addNamed = addNamed;
628
- exports.addNamespace = addNamespace;
629
- exports.addSideEffect = addSideEffect;
630
- Object.defineProperty(exports, "isModule", {
631
- enumerable: true,
632
- get: function () {
633
- return _isModule.default;
634
- }
635
- });
636
- var _importInjector = requireImportInjector();
637
- var _isModule = requireIsModule();
638
- function addDefault(path, importedSource, opts) {
639
- return new _importInjector.default(path).addDefault(importedSource, opts);
640
- }
641
- function addNamed(path, name, importedSource, opts) {
642
- return new _importInjector.default(path).addNamed(name, importedSource, opts);
643
- }
644
- function addNamespace(path, importedSource, opts) {
645
- return new _importInjector.default(path).addNamespace(importedSource, opts);
646
- }
647
- function addSideEffect(path, importedSource, opts) {
648
- return new _importInjector.default(path).addSideEffect(importedSource, opts);
649
- }
650
-
651
-
652
- } (lib$2));
653
- return lib$2;
654
- }
655
-
656
- var libExports$2 = requireLib$2();
657
-
658
166
  function hoistExpression(path, astExpression) {
659
167
  const programStatementPath = getProgramStatement(path);
660
168
  if (programStatementPath == null) {
@@ -690,7 +198,7 @@ function getProgramPath(path) {
690
198
  return programPath;
691
199
  }
692
200
  function addNamedImport(statementPath, as, from, options) {
693
- const identifier = libExports$2.addNamed(statementPath, as, from, options);
201
+ const identifier = helperModuleImports.addNamed(statementPath, as, from, options);
694
202
  const programPath = getProgramPath(statementPath);
695
203
  if (programPath == null) {
696
204
  return identifier;
@@ -718,7 +226,7 @@ function addNamedImport(statementPath, as, from, options) {
718
226
  return importName;
719
227
  }
720
228
  function addDefaultImport(statementPath, from, options) {
721
- const identifier = libExports$2.addDefault(statementPath, from, options);
229
+ const identifier = helperModuleImports.addDefault(statementPath, from, options);
722
230
  const programPath = getProgramPath(statementPath);
723
231
  if (programPath == null) {
724
232
  return identifier;
@@ -770,13 +278,18 @@ function getProgramStatement(path) {
770
278
  return programPath;
771
279
  }
772
280
 
773
- const CheckModuleResolution = unionOf3(object({
281
+ const CheckModuleResolution = unionOf4(object({
774
282
  type: literal('commonJS'),
775
283
  rootDir: unionOf(nullish(), string()),
776
284
  themeFileExtension: unionOf(nullish(), string())
777
285
  }), object({
778
286
  type: literal('haste'),
779
287
  themeFileExtension: unionOf(nullish(), string())
288
+ }), object({
289
+ type: literal('custom'),
290
+ themeFileExtension: unionOf(nullish(), string()),
291
+ filePathResolver: func(),
292
+ getCanonicalFilePath: func()
780
293
  }), object({
781
294
  type: literal('experimental_crossFileParsing'),
782
295
  rootDir: string(),
@@ -803,6 +316,7 @@ class StateManager {
803
316
  stylexKeyframesImport = new Set();
804
317
  stylexPositionTryImport = new Set();
805
318
  stylexDefineVarsImport = new Set();
319
+ stylexDefineMarkerImport = new Set();
806
320
  stylexDefineConstsImport = new Set();
807
321
  stylexCreateThemeImport = new Set();
808
322
  stylexTypesImport = new Set();
@@ -828,7 +342,7 @@ class StateManager {
828
342
  const enableFontSizePxToRem = logAndDefault(boolean(), options.enableFontSizePxToRem ?? false, false, 'options.enableFontSizePxToRem');
829
343
  const enableInlinedConditionalMerge = logAndDefault(boolean(), options.enableInlinedConditionalMerge ?? true, true, 'options.enableInlinedConditionalMerge');
830
344
  const enableMinifiedKeys = logAndDefault(boolean(), options.enableMinifiedKeys ?? true, true, 'options.enableMinifiedKeys');
831
- const enableMediaQueryOrder = logAndDefault(boolean(), options.enableMediaQueryOrder ?? false, false, 'options.enableMediaQueryOrder');
345
+ const enableMediaQueryOrder = logAndDefault(boolean(), options.enableMediaQueryOrder ?? true, true, 'options.enableMediaQueryOrder');
832
346
  const enableLegacyValueFlipping = logAndDefault(boolean(), options.enableLegacyValueFlipping ?? false, false, 'options.enableLegacyValueFlipping');
833
347
  const enableLogicalStylesPolyfill = logAndDefault(boolean(), options.enableLogicalStylesPolyfill ?? false, false, 'options.enableLogicalStylesPolyfill');
834
348
  const enableLTRRTLComments = logAndDefault(boolean(), options.enableLTRRTLComments ?? false, false, 'options.enableLTRRTLComments');
@@ -935,12 +449,20 @@ class StateManager {
935
449
  get fileNameForHashing() {
936
450
  const filename = this.filename;
937
451
  const themeFileExtension = this.options.unstable_moduleResolution?.themeFileExtension ?? '.stylex';
938
- if (filename == null || !matchesFileSuffix(themeFileExtension)(filename) || this.options.unstable_moduleResolution == null) {
452
+ const constsFileExtension = `${themeFileExtension}.const`;
453
+ if (filename == null || this.options.unstable_moduleResolution == null) {
454
+ return null;
455
+ }
456
+ const isThemeFile = matchesFileSuffix(themeFileExtension)(filename);
457
+ const isConstsOnlyFile = matchesFileSuffix(constsFileExtension)(filename);
458
+ if (!isThemeFile && !isConstsOnlyFile) {
939
459
  return null;
940
460
  }
941
- switch (this.options.unstable_moduleResolution.type) {
461
+ switch (this.options.unstable_moduleResolution?.type) {
942
462
  case 'haste':
943
463
  return path.basename(filename);
464
+ case 'custom':
465
+ return this.options.unstable_moduleResolution.getCanonicalFilePath(filename);
944
466
  default:
945
467
  return this.getCanonicalFilePath(filename);
946
468
  }
@@ -983,10 +505,12 @@ class StateManager {
983
505
  return false;
984
506
  }
985
507
  const themeFileExtension = this.options.unstable_moduleResolution?.themeFileExtension ?? '.stylex';
508
+ const constsFileExtension = `${themeFileExtension}.const`;
986
509
  const transformedVarsFileExtension = '.transformed';
987
510
  const isValidStylexFile = matchesFileSuffix(themeFileExtension)(importPath);
988
511
  const isValidTransformedVarsFile = matchesFileSuffix(transformedVarsFileExtension)(importPath);
989
- if (!isValidStylexFile && !isValidTransformedVarsFile) {
512
+ const isValidConstsOnlyFile = matchesFileSuffix(constsFileExtension)(importPath);
513
+ if (!isValidStylexFile && !isValidTransformedVarsFile && !isValidConstsOnlyFile) {
990
514
  return false;
991
515
  }
992
516
  switch (this.options.unstable_moduleResolution?.type) {
@@ -1000,6 +524,13 @@ class StateManager {
1000
524
  {
1001
525
  return ['themeNameRef', addFileExtension(importPath, sourceFilePath)];
1002
526
  }
527
+ case 'custom':
528
+ {
529
+ const aliases = this.options.aliases;
530
+ const moduleResolution = this.options.unstable_moduleResolution;
531
+ const result = moduleResolution.filePathResolver(importPath, sourceFilePath, aliases);
532
+ return result ? ['themeNameRef', moduleResolution.getCanonicalFilePath(result)] : false;
533
+ }
1003
534
  case 'experimental_crossFileParsing':
1004
535
  {
1005
536
  const aliases = this.options.aliases;
@@ -1169,6 +700,9 @@ function readImportDeclarations(path, state) {
1169
700
  if (importedName === 'defineVars') {
1170
701
  state.stylexDefineVarsImport.add(localName);
1171
702
  }
703
+ if (importedName === 'defineMarker') {
704
+ state.stylexDefineMarkerImport.add(localName);
705
+ }
1172
706
  if (importedName === 'defineConsts') {
1173
707
  state.stylexDefineConstsImport.add(localName);
1174
708
  }
@@ -1232,6 +766,9 @@ function readRequires(path, state) {
1232
766
  if (prop.key.name === 'defineVars') {
1233
767
  state.stylexDefineVarsImport.add(value.name);
1234
768
  }
769
+ if (prop.key.name === 'defineMarker') {
770
+ state.stylexDefineMarkerImport.add(value.name);
771
+ }
1235
772
  if (prop.key.name === 'defineConsts') {
1236
773
  state.stylexDefineConstsImport.add(value.name);
1237
774
  }
@@ -1492,593 +1029,6 @@ const expansions$3 = {
1492
1029
  ...aliases$2
1493
1030
  };
1494
1031
 
1495
- var parse;
1496
- var hasRequiredParse;
1497
-
1498
- function requireParse () {
1499
- if (hasRequiredParse) return parse;
1500
- hasRequiredParse = 1;
1501
- var openParentheses = "(".charCodeAt(0);
1502
- var closeParentheses = ")".charCodeAt(0);
1503
- var singleQuote = "'".charCodeAt(0);
1504
- var doubleQuote = '"'.charCodeAt(0);
1505
- var backslash = "\\".charCodeAt(0);
1506
- var slash = "/".charCodeAt(0);
1507
- var comma = ",".charCodeAt(0);
1508
- var colon = ":".charCodeAt(0);
1509
- var star = "*".charCodeAt(0);
1510
- var uLower = "u".charCodeAt(0);
1511
- var uUpper = "U".charCodeAt(0);
1512
- var plus = "+".charCodeAt(0);
1513
- var isUnicodeRange = /^[a-f0-9?-]+$/i;
1514
-
1515
- parse = function(input) {
1516
- var tokens = [];
1517
- var value = input;
1518
-
1519
- var next,
1520
- quote,
1521
- prev,
1522
- token,
1523
- escape,
1524
- escapePos,
1525
- whitespacePos,
1526
- parenthesesOpenPos;
1527
- var pos = 0;
1528
- var code = value.charCodeAt(pos);
1529
- var max = value.length;
1530
- var stack = [{ nodes: tokens }];
1531
- var balanced = 0;
1532
- var parent;
1533
-
1534
- var name = "";
1535
- var before = "";
1536
- var after = "";
1537
-
1538
- while (pos < max) {
1539
- // Whitespaces
1540
- if (code <= 32) {
1541
- next = pos;
1542
- do {
1543
- next += 1;
1544
- code = value.charCodeAt(next);
1545
- } while (code <= 32);
1546
- token = value.slice(pos, next);
1547
-
1548
- prev = tokens[tokens.length - 1];
1549
- if (code === closeParentheses && balanced) {
1550
- after = token;
1551
- } else if (prev && prev.type === "div") {
1552
- prev.after = token;
1553
- prev.sourceEndIndex += token.length;
1554
- } else if (
1555
- code === comma ||
1556
- code === colon ||
1557
- (code === slash &&
1558
- value.charCodeAt(next + 1) !== star &&
1559
- (!parent ||
1560
- (parent && parent.type === "function" && parent.value !== "calc")))
1561
- ) {
1562
- before = token;
1563
- } else {
1564
- tokens.push({
1565
- type: "space",
1566
- sourceIndex: pos,
1567
- sourceEndIndex: next,
1568
- value: token
1569
- });
1570
- }
1571
-
1572
- pos = next;
1573
-
1574
- // Quotes
1575
- } else if (code === singleQuote || code === doubleQuote) {
1576
- next = pos;
1577
- quote = code === singleQuote ? "'" : '"';
1578
- token = {
1579
- type: "string",
1580
- sourceIndex: pos,
1581
- quote: quote
1582
- };
1583
- do {
1584
- escape = false;
1585
- next = value.indexOf(quote, next + 1);
1586
- if (~next) {
1587
- escapePos = next;
1588
- while (value.charCodeAt(escapePos - 1) === backslash) {
1589
- escapePos -= 1;
1590
- escape = !escape;
1591
- }
1592
- } else {
1593
- value += quote;
1594
- next = value.length - 1;
1595
- token.unclosed = true;
1596
- }
1597
- } while (escape);
1598
- token.value = value.slice(pos + 1, next);
1599
- token.sourceEndIndex = token.unclosed ? next : next + 1;
1600
- tokens.push(token);
1601
- pos = next + 1;
1602
- code = value.charCodeAt(pos);
1603
-
1604
- // Comments
1605
- } else if (code === slash && value.charCodeAt(pos + 1) === star) {
1606
- next = value.indexOf("*/", pos);
1607
-
1608
- token = {
1609
- type: "comment",
1610
- sourceIndex: pos,
1611
- sourceEndIndex: next + 2
1612
- };
1613
-
1614
- if (next === -1) {
1615
- token.unclosed = true;
1616
- next = value.length;
1617
- token.sourceEndIndex = next;
1618
- }
1619
-
1620
- token.value = value.slice(pos + 2, next);
1621
- tokens.push(token);
1622
-
1623
- pos = next + 2;
1624
- code = value.charCodeAt(pos);
1625
-
1626
- // Operation within calc
1627
- } else if (
1628
- (code === slash || code === star) &&
1629
- parent &&
1630
- parent.type === "function" &&
1631
- parent.value === "calc"
1632
- ) {
1633
- token = value[pos];
1634
- tokens.push({
1635
- type: "word",
1636
- sourceIndex: pos - before.length,
1637
- sourceEndIndex: pos + token.length,
1638
- value: token
1639
- });
1640
- pos += 1;
1641
- code = value.charCodeAt(pos);
1642
-
1643
- // Dividers
1644
- } else if (code === slash || code === comma || code === colon) {
1645
- token = value[pos];
1646
-
1647
- tokens.push({
1648
- type: "div",
1649
- sourceIndex: pos - before.length,
1650
- sourceEndIndex: pos + token.length,
1651
- value: token,
1652
- before: before,
1653
- after: ""
1654
- });
1655
- before = "";
1656
-
1657
- pos += 1;
1658
- code = value.charCodeAt(pos);
1659
-
1660
- // Open parentheses
1661
- } else if (openParentheses === code) {
1662
- // Whitespaces after open parentheses
1663
- next = pos;
1664
- do {
1665
- next += 1;
1666
- code = value.charCodeAt(next);
1667
- } while (code <= 32);
1668
- parenthesesOpenPos = pos;
1669
- token = {
1670
- type: "function",
1671
- sourceIndex: pos - name.length,
1672
- value: name,
1673
- before: value.slice(parenthesesOpenPos + 1, next)
1674
- };
1675
- pos = next;
1676
-
1677
- if (name === "url" && code !== singleQuote && code !== doubleQuote) {
1678
- next -= 1;
1679
- do {
1680
- escape = false;
1681
- next = value.indexOf(")", next + 1);
1682
- if (~next) {
1683
- escapePos = next;
1684
- while (value.charCodeAt(escapePos - 1) === backslash) {
1685
- escapePos -= 1;
1686
- escape = !escape;
1687
- }
1688
- } else {
1689
- value += ")";
1690
- next = value.length - 1;
1691
- token.unclosed = true;
1692
- }
1693
- } while (escape);
1694
- // Whitespaces before closed
1695
- whitespacePos = next;
1696
- do {
1697
- whitespacePos -= 1;
1698
- code = value.charCodeAt(whitespacePos);
1699
- } while (code <= 32);
1700
- if (parenthesesOpenPos < whitespacePos) {
1701
- if (pos !== whitespacePos + 1) {
1702
- token.nodes = [
1703
- {
1704
- type: "word",
1705
- sourceIndex: pos,
1706
- sourceEndIndex: whitespacePos + 1,
1707
- value: value.slice(pos, whitespacePos + 1)
1708
- }
1709
- ];
1710
- } else {
1711
- token.nodes = [];
1712
- }
1713
- if (token.unclosed && whitespacePos + 1 !== next) {
1714
- token.after = "";
1715
- token.nodes.push({
1716
- type: "space",
1717
- sourceIndex: whitespacePos + 1,
1718
- sourceEndIndex: next,
1719
- value: value.slice(whitespacePos + 1, next)
1720
- });
1721
- } else {
1722
- token.after = value.slice(whitespacePos + 1, next);
1723
- token.sourceEndIndex = next;
1724
- }
1725
- } else {
1726
- token.after = "";
1727
- token.nodes = [];
1728
- }
1729
- pos = next + 1;
1730
- token.sourceEndIndex = token.unclosed ? next : pos;
1731
- code = value.charCodeAt(pos);
1732
- tokens.push(token);
1733
- } else {
1734
- balanced += 1;
1735
- token.after = "";
1736
- token.sourceEndIndex = pos + 1;
1737
- tokens.push(token);
1738
- stack.push(token);
1739
- tokens = token.nodes = [];
1740
- parent = token;
1741
- }
1742
- name = "";
1743
-
1744
- // Close parentheses
1745
- } else if (closeParentheses === code && balanced) {
1746
- pos += 1;
1747
- code = value.charCodeAt(pos);
1748
-
1749
- parent.after = after;
1750
- parent.sourceEndIndex += after.length;
1751
- after = "";
1752
- balanced -= 1;
1753
- stack[stack.length - 1].sourceEndIndex = pos;
1754
- stack.pop();
1755
- parent = stack[balanced];
1756
- tokens = parent.nodes;
1757
-
1758
- // Words
1759
- } else {
1760
- next = pos;
1761
- do {
1762
- if (code === backslash) {
1763
- next += 1;
1764
- }
1765
- next += 1;
1766
- code = value.charCodeAt(next);
1767
- } while (
1768
- next < max &&
1769
- !(
1770
- code <= 32 ||
1771
- code === singleQuote ||
1772
- code === doubleQuote ||
1773
- code === comma ||
1774
- code === colon ||
1775
- code === slash ||
1776
- code === openParentheses ||
1777
- (code === star &&
1778
- parent &&
1779
- parent.type === "function" &&
1780
- parent.value === "calc") ||
1781
- (code === slash &&
1782
- parent.type === "function" &&
1783
- parent.value === "calc") ||
1784
- (code === closeParentheses && balanced)
1785
- )
1786
- );
1787
- token = value.slice(pos, next);
1788
-
1789
- if (openParentheses === code) {
1790
- name = token;
1791
- } else if (
1792
- (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
1793
- plus === token.charCodeAt(1) &&
1794
- isUnicodeRange.test(token.slice(2))
1795
- ) {
1796
- tokens.push({
1797
- type: "unicode-range",
1798
- sourceIndex: pos,
1799
- sourceEndIndex: next,
1800
- value: token
1801
- });
1802
- } else {
1803
- tokens.push({
1804
- type: "word",
1805
- sourceIndex: pos,
1806
- sourceEndIndex: next,
1807
- value: token
1808
- });
1809
- }
1810
-
1811
- pos = next;
1812
- }
1813
- }
1814
-
1815
- for (pos = stack.length - 1; pos; pos -= 1) {
1816
- stack[pos].unclosed = true;
1817
- stack[pos].sourceEndIndex = value.length;
1818
- }
1819
-
1820
- return stack[0].nodes;
1821
- };
1822
- return parse;
1823
- }
1824
-
1825
- var walk;
1826
- var hasRequiredWalk;
1827
-
1828
- function requireWalk () {
1829
- if (hasRequiredWalk) return walk;
1830
- hasRequiredWalk = 1;
1831
- walk = function walk(nodes, cb, bubble) {
1832
- var i, max, node, result;
1833
-
1834
- for (i = 0, max = nodes.length; i < max; i += 1) {
1835
- node = nodes[i];
1836
- if (!bubble) {
1837
- result = cb(node, i, nodes);
1838
- }
1839
-
1840
- if (
1841
- result !== false &&
1842
- node.type === "function" &&
1843
- Array.isArray(node.nodes)
1844
- ) {
1845
- walk(node.nodes, cb, bubble);
1846
- }
1847
-
1848
- if (bubble) {
1849
- cb(node, i, nodes);
1850
- }
1851
- }
1852
- };
1853
- return walk;
1854
- }
1855
-
1856
- var stringify_1;
1857
- var hasRequiredStringify;
1858
-
1859
- function requireStringify () {
1860
- if (hasRequiredStringify) return stringify_1;
1861
- hasRequiredStringify = 1;
1862
- function stringifyNode(node, custom) {
1863
- var type = node.type;
1864
- var value = node.value;
1865
- var buf;
1866
- var customResult;
1867
-
1868
- if (custom && (customResult = custom(node)) !== undefined) {
1869
- return customResult;
1870
- } else if (type === "word" || type === "space") {
1871
- return value;
1872
- } else if (type === "string") {
1873
- buf = node.quote || "";
1874
- return buf + value + (node.unclosed ? "" : buf);
1875
- } else if (type === "comment") {
1876
- return "/*" + value + (node.unclosed ? "" : "*/");
1877
- } else if (type === "div") {
1878
- return (node.before || "") + value + (node.after || "");
1879
- } else if (Array.isArray(node.nodes)) {
1880
- buf = stringify(node.nodes, custom);
1881
- if (type !== "function") {
1882
- return buf;
1883
- }
1884
- return (
1885
- value +
1886
- "(" +
1887
- (node.before || "") +
1888
- buf +
1889
- (node.after || "") +
1890
- (node.unclosed ? "" : ")")
1891
- );
1892
- }
1893
- return value;
1894
- }
1895
-
1896
- function stringify(nodes, custom) {
1897
- var result, i;
1898
-
1899
- if (Array.isArray(nodes)) {
1900
- result = "";
1901
- for (i = nodes.length - 1; ~i; i -= 1) {
1902
- result = stringifyNode(nodes[i], custom) + result;
1903
- }
1904
- return result;
1905
- }
1906
- return stringifyNode(nodes, custom);
1907
- }
1908
-
1909
- stringify_1 = stringify;
1910
- return stringify_1;
1911
- }
1912
-
1913
- var unit;
1914
- var hasRequiredUnit;
1915
-
1916
- function requireUnit () {
1917
- if (hasRequiredUnit) return unit;
1918
- hasRequiredUnit = 1;
1919
- var minus = "-".charCodeAt(0);
1920
- var plus = "+".charCodeAt(0);
1921
- var dot = ".".charCodeAt(0);
1922
- var exp = "e".charCodeAt(0);
1923
- var EXP = "E".charCodeAt(0);
1924
-
1925
- // Check if three code points would start a number
1926
- // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
1927
- function likeNumber(value) {
1928
- var code = value.charCodeAt(0);
1929
- var nextCode;
1930
-
1931
- if (code === plus || code === minus) {
1932
- nextCode = value.charCodeAt(1);
1933
-
1934
- if (nextCode >= 48 && nextCode <= 57) {
1935
- return true;
1936
- }
1937
-
1938
- var nextNextCode = value.charCodeAt(2);
1939
-
1940
- if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
1941
- return true;
1942
- }
1943
-
1944
- return false;
1945
- }
1946
-
1947
- if (code === dot) {
1948
- nextCode = value.charCodeAt(1);
1949
-
1950
- if (nextCode >= 48 && nextCode <= 57) {
1951
- return true;
1952
- }
1953
-
1954
- return false;
1955
- }
1956
-
1957
- if (code >= 48 && code <= 57) {
1958
- return true;
1959
- }
1960
-
1961
- return false;
1962
- }
1963
-
1964
- // Consume a number
1965
- // https://www.w3.org/TR/css-syntax-3/#consume-number
1966
- unit = function(value) {
1967
- var pos = 0;
1968
- var length = value.length;
1969
- var code;
1970
- var nextCode;
1971
- var nextNextCode;
1972
-
1973
- if (length === 0 || !likeNumber(value)) {
1974
- return false;
1975
- }
1976
-
1977
- code = value.charCodeAt(pos);
1978
-
1979
- if (code === plus || code === minus) {
1980
- pos++;
1981
- }
1982
-
1983
- while (pos < length) {
1984
- code = value.charCodeAt(pos);
1985
-
1986
- if (code < 48 || code > 57) {
1987
- break;
1988
- }
1989
-
1990
- pos += 1;
1991
- }
1992
-
1993
- code = value.charCodeAt(pos);
1994
- nextCode = value.charCodeAt(pos + 1);
1995
-
1996
- if (code === dot && nextCode >= 48 && nextCode <= 57) {
1997
- pos += 2;
1998
-
1999
- while (pos < length) {
2000
- code = value.charCodeAt(pos);
2001
-
2002
- if (code < 48 || code > 57) {
2003
- break;
2004
- }
2005
-
2006
- pos += 1;
2007
- }
2008
- }
2009
-
2010
- code = value.charCodeAt(pos);
2011
- nextCode = value.charCodeAt(pos + 1);
2012
- nextNextCode = value.charCodeAt(pos + 2);
2013
-
2014
- if (
2015
- (code === exp || code === EXP) &&
2016
- ((nextCode >= 48 && nextCode <= 57) ||
2017
- ((nextCode === plus || nextCode === minus) &&
2018
- nextNextCode >= 48 &&
2019
- nextNextCode <= 57))
2020
- ) {
2021
- pos += nextCode === plus || nextCode === minus ? 3 : 2;
2022
-
2023
- while (pos < length) {
2024
- code = value.charCodeAt(pos);
2025
-
2026
- if (code < 48 || code > 57) {
2027
- break;
2028
- }
2029
-
2030
- pos += 1;
2031
- }
2032
- }
2033
-
2034
- return {
2035
- number: value.slice(0, pos),
2036
- unit: value.slice(pos)
2037
- };
2038
- };
2039
- return unit;
2040
- }
2041
-
2042
- var lib$1;
2043
- var hasRequiredLib$1;
2044
-
2045
- function requireLib$1 () {
2046
- if (hasRequiredLib$1) return lib$1;
2047
- hasRequiredLib$1 = 1;
2048
- var parse = requireParse();
2049
- var walk = requireWalk();
2050
- var stringify = requireStringify();
2051
-
2052
- function ValueParser(value) {
2053
- if (this instanceof ValueParser) {
2054
- this.nodes = parse(value);
2055
- return this;
2056
- }
2057
- return new ValueParser(value);
2058
- }
2059
-
2060
- ValueParser.prototype.toString = function() {
2061
- return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
2062
- };
2063
-
2064
- ValueParser.prototype.walk = function(cb, bubble) {
2065
- walk(this.nodes, cb, bubble);
2066
- return this;
2067
- };
2068
-
2069
- ValueParser.unit = requireUnit();
2070
-
2071
- ValueParser.walk = walk;
2072
-
2073
- ValueParser.stringify = stringify;
2074
-
2075
- lib$1 = ValueParser;
2076
- return lib$1;
2077
- }
2078
-
2079
- var libExports$1 = requireLib$1();
2080
- var parser = /*@__PURE__*/getDefaultExportFromCjs(libExports$1);
2081
-
2082
1032
  function printNode(node) {
2083
1033
  switch (node.type) {
2084
1034
  case 'word':
@@ -2106,6 +1056,8 @@ function splitValue(str) {
2106
1056
  return nodes;
2107
1057
  }
2108
1058
 
1059
+ const LOGICAL_FLOAT_START_VAR = '--stylex-logical-start';
1060
+ const LOGICAL_FLOAT_END_VAR = '--stylex-logical-end';
2109
1061
  const listStyleGlobalValues = new Set(['inherit', 'initial', 'revert', 'unset']);
2110
1062
  const listStylePositionValues = new Set(['inside', 'outside']);
2111
1063
  const listStyleTypeRegex = /^([a-z-]+|".*?"|'.*?')$/;
@@ -2295,7 +1247,23 @@ const aliases$1 = {
2295
1247
  paddingBlockEnd: val => [['paddingBottom', val]],
2296
1248
  paddingInline: shorthands$1.paddingHorizontal,
2297
1249
  scrollMarginBlockStart: value => [['scrollMarginTop', value]],
2298
- scrollMarginBlockEnd: value => [['scrollMarginBottom', value]]
1250
+ scrollMarginBlockEnd: value => [['scrollMarginBottom', value]],
1251
+ float: value => {
1252
+ if (value === 'inline-start' || value === 'start') {
1253
+ return [['float', `var(${LOGICAL_FLOAT_START_VAR})`]];
1254
+ } else if (value === 'inline-end' || value === 'end') {
1255
+ return [['float', `var(${LOGICAL_FLOAT_END_VAR})`]];
1256
+ }
1257
+ return [['float', value]];
1258
+ },
1259
+ clear: value => {
1260
+ if (value === 'inline-start' || value === 'start') {
1261
+ return [['clear', `var(${LOGICAL_FLOAT_START_VAR})`]];
1262
+ } else if (value === 'inline-end' || value === 'end') {
1263
+ return [['clear', `var(${LOGICAL_FLOAT_END_VAR})`]];
1264
+ }
1265
+ return [['clear', value]];
1266
+ }
2299
1267
  };
2300
1268
  const expansions$2 = {
2301
1269
  ...shorthands$1,
@@ -2423,7 +1391,7 @@ function flatMapExpandedShorthands(objEntry, options) {
2423
1391
  return [[key, value]];
2424
1392
  }
2425
1393
 
2426
- var lib = {};
1394
+ var lib$1 = {};
2427
1395
 
2428
1396
  var tokenParser = {};
2429
1397
 
@@ -4018,7 +2986,7 @@ function requireMediaQuery () {
4018
2986
  })), mediaAndRulesParser, mediaOrRulesParser, simplePairParser, mediaWordRuleParser, () => notParser, () => mediaOrRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen), () => mediaAndRulesParser.surroundedBy(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.tokens.CloseParen)).skip(_tokenParser.TokenParser.tokens.Whitespace.optional);
4019
2987
  notParser = _tokenParser.TokenParser.sequence(_tokenParser.TokenParser.tokens.OpenParen, _tokenParser.TokenParser.string('not'), _tokenParser.TokenParser.tokens.Whitespace, getNormalRuleParser(), _tokenParser.TokenParser.tokens.CloseParen).map(([_openParen, _not, _space, rule, _closeParen]) => ({
4020
2988
  type: 'not',
4021
- rule
2989
+ rule: rule
4022
2990
  }));
4023
2991
  function isNumericLength(val) {
4024
2992
  return typeof val === 'object' && val !== null && !Array.isArray(val) && typeof val.value === 'number' && typeof val.unit === 'string' && (val.type === 'integer' || val.type === 'number');
@@ -4362,11 +3330,11 @@ function requireMediaQueryTransform () {
4362
3330
  return mediaQueryTransform;
4363
3331
  }
4364
3332
 
4365
- var hasRequiredLib;
3333
+ var hasRequiredLib$1;
4366
3334
 
4367
- function requireLib () {
4368
- if (hasRequiredLib) return lib;
4369
- hasRequiredLib = 1;
3335
+ function requireLib$1 () {
3336
+ if (hasRequiredLib$1) return lib$1;
3337
+ hasRequiredLib$1 = 1;
4370
3338
  (function (exports) {
4371
3339
 
4372
3340
  Object.defineProperty(exports, "__esModule", {
@@ -4385,11 +3353,11 @@ function requireLib () {
4385
3353
  exports.properties = _properties;
4386
3354
  var _mediaQueryTransform = requireMediaQueryTransform();
4387
3355
  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); }
4388
- } (lib));
4389
- return lib;
3356
+ } (lib$1));
3357
+ return lib$1;
4390
3358
  }
4391
3359
 
4392
- var libExports = requireLib();
3360
+ var libExports$1 = requireLib$1();
4393
3361
 
4394
3362
  const illegalArgumentLength = (fn, argLength) => `${fn}() should have ${argLength} argument${argLength === 1 ? '' : 's'}.`;
4395
3363
  const nonStaticValue = fn => `Only static values are allowed inside of a ${fn}() call.`;
@@ -4680,10 +3648,6 @@ const logicalToPhysical$1 = {
4680
3648
  'inline-start': 'left',
4681
3649
  'inline-end': 'right'
4682
3650
  };
4683
- const legacyValuesPolyfill$1 = {
4684
- float: ([key, val]) => [key, logicalToPhysical$1[val] ?? val],
4685
- clear: ([key, val]) => [key, logicalToPhysical$1[val] ?? val]
4686
- };
4687
3651
  const inlinePropertyToLTR = {
4688
3652
  'margin-inline-start': ([_key, val]) => ['margin-left', val],
4689
3653
  'margin-inline-end': ([_key, val]) => ['margin-right', val],
@@ -4735,9 +3699,6 @@ function generateLTR(pair, options = defaultOptions) {
4735
3699
  const [key] = pair;
4736
3700
  if (styleResolution === 'legacy-expand-shorthands') {
4737
3701
  if (!enableLogicalStylesPolyfill) {
4738
- if (legacyValuesPolyfill$1[key]) {
4739
- return legacyValuesPolyfill$1[key](pair);
4740
- }
4741
3702
  return pair;
4742
3703
  }
4743
3704
  if (inlinePropertyToLTR[key]) {
@@ -4810,10 +3771,6 @@ const logicalToPhysical = {
4810
3771
  'inline-start': 'right',
4811
3772
  'inline-end': 'left'
4812
3773
  };
4813
- const legacyValuesPolyfill = {
4814
- float: ([key, val]) => [key, logicalToPhysical[val] ?? val],
4815
- clear: ([key, val]) => [key, logicalToPhysical[val] ?? val]
4816
- };
4817
3774
  const inlinePropertyToRTL = {
4818
3775
  'margin-inline-start': ([_key, val]) => ['margin-right', val],
4819
3776
  'margin-inline-end': ([_key, val]) => ['margin-left', val],
@@ -4891,9 +3848,6 @@ function generateRTL(pair, options = defaultOptions) {
4891
3848
  const [key] = pair;
4892
3849
  if (styleResolution === 'legacy-expand-shorthands') {
4893
3850
  if (!enableLogicalStylesPolyfill) {
4894
- if (legacyValuesPolyfill[key]) {
4895
- return legacyValuesPolyfill[key](pair);
4896
- }
4897
3851
  return null;
4898
3852
  }
4899
3853
  if (inlinePropertyToRTL[key]) {
@@ -4906,569 +3860,633 @@ function generateRTL(pair, options = defaultOptions) {
4906
3860
  return propertyToRTL[key](pair, options);
4907
3861
  }
4908
3862
 
4909
- const longHandPhysical = new Set();
4910
- const longHandLogical = new Set();
4911
- const shorthandsOfLonghands = new Set();
4912
- const shorthandsOfShorthands = new Set();
4913
- longHandLogical.add('background-blend-mode');
4914
- longHandLogical.add('isolation');
4915
- longHandLogical.add('mix-blend-mode');
4916
- shorthandsOfShorthands.add('animation');
4917
- longHandLogical.add('animation-composition');
4918
- longHandLogical.add('animation-delay');
4919
- longHandLogical.add('animation-direction');
4920
- longHandLogical.add('animation-duration');
4921
- longHandLogical.add('animation-fill-mode');
4922
- longHandLogical.add('animation-iteration-count');
4923
- longHandLogical.add('animation-name');
4924
- longHandLogical.add('animation-play-state');
4925
- shorthandsOfLonghands.add('animation-range');
4926
- longHandLogical.add('animation-range-end');
4927
- longHandLogical.add('animation-range-start');
4928
- longHandLogical.add('animation-timing-function');
4929
- longHandLogical.add('animation-timeline');
4930
- shorthandsOfLonghands.add('scroll-timeline');
4931
- longHandLogical.add('scroll-timeline-axis');
4932
- longHandLogical.add('scroll-timeline-name');
4933
- longHandLogical.add('timeline-scope');
4934
- shorthandsOfLonghands.add('view-timeline');
4935
- longHandLogical.add('view-timeline-axis');
4936
- longHandLogical.add('view-timeline-inset');
4937
- longHandLogical.add('view-timeline-name');
4938
- shorthandsOfShorthands.add('background');
4939
- longHandLogical.add('background-attachment');
4940
- longHandLogical.add('background-clip');
4941
- longHandLogical.add('background-color');
4942
- longHandLogical.add('background-image');
4943
- longHandLogical.add('background-origin');
4944
- longHandLogical.add('background-repeat');
4945
- longHandLogical.add('background-size');
4946
- shorthandsOfLonghands.add('background-position');
4947
- longHandLogical.add('background-position-x');
4948
- longHandLogical.add('background-position-y');
4949
- shorthandsOfShorthands.add('border');
4950
- shorthandsOfLonghands.add('border-color');
4951
- shorthandsOfLonghands.add('border-style');
4952
- shorthandsOfLonghands.add('border-width');
4953
- shorthandsOfShorthands.add('border-block');
4954
- longHandLogical.add('border-block-color');
4955
- longHandLogical.add('border-block-stylex');
4956
- longHandLogical.add('border-block-width');
4957
- shorthandsOfLonghands.add('border-block-start');
4958
- shorthandsOfLonghands.add('border-top');
4959
- longHandLogical.add('border-block-start-color');
4960
- longHandPhysical.add('border-top-color');
4961
- longHandLogical.add('border-block-start-style');
4962
- longHandPhysical.add('border-top-style');
4963
- longHandLogical.add('border-block-start-width');
4964
- longHandPhysical.add('border-top-width');
4965
- shorthandsOfLonghands.add('border-block-end');
4966
- shorthandsOfLonghands.add('border-bottom');
4967
- longHandLogical.add('border-block-end-color');
4968
- longHandPhysical.add('border-bottom-color');
4969
- longHandLogical.add('border-block-end-style');
4970
- longHandPhysical.add('border-bottom-style');
4971
- longHandLogical.add('border-block-end-width');
4972
- longHandPhysical.add('border-bottom-width');
4973
- shorthandsOfShorthands.add('border-inline');
4974
- shorthandsOfLonghands.add('border-inline-color');
4975
- shorthandsOfLonghands.add('border-inline-style');
4976
- shorthandsOfLonghands.add('border-inline-width');
4977
- shorthandsOfLonghands.add('border-inline-start');
4978
- shorthandsOfLonghands.add('border-left');
4979
- longHandLogical.add('border-inline-start-color');
4980
- longHandPhysical.add('border-left-color');
4981
- longHandLogical.add('border-inline-start-style');
4982
- longHandPhysical.add('border-left-style');
4983
- longHandLogical.add('border-inline-start-width');
4984
- longHandPhysical.add('border-left-width');
4985
- shorthandsOfLonghands.add('border-inline-end');
4986
- shorthandsOfLonghands.add('border-right');
4987
- longHandLogical.add('border-inline-end-color');
4988
- longHandPhysical.add('border-right-color');
4989
- longHandLogical.add('border-inline-end-style');
4990
- longHandPhysical.add('border-right-style');
4991
- longHandLogical.add('border-inline-end-width');
4992
- longHandPhysical.add('border-right-width');
4993
- shorthandsOfLonghands.add('border-image');
4994
- longHandLogical.add('border-image-outset');
4995
- longHandLogical.add('border-image-repeat');
4996
- longHandLogical.add('border-image-slice');
4997
- longHandLogical.add('border-image-source');
4998
- longHandLogical.add('border-image-width');
4999
- shorthandsOfLonghands.add('border-radius');
5000
- longHandLogical.add('border-start-end-radius');
5001
- longHandLogical.add('border-start-start-radius');
5002
- longHandLogical.add('border-end-end-radius');
5003
- longHandLogical.add('border-end-start-radius');
5004
- longHandPhysical.add('border-top-left-radius');
5005
- longHandPhysical.add('border-top-right-radius');
5006
- longHandPhysical.add('border-bottom-left-radius');
5007
- longHandPhysical.add('border-bottom-right-radius');
5008
- longHandLogical.add('box-shadow');
5009
- longHandLogical.add('accent-color');
5010
- longHandLogical.add('appearance');
5011
- longHandLogical.add('aspect-ratio');
5012
- shorthandsOfLonghands.add('caret');
5013
- longHandLogical.add('caret-color');
5014
- longHandLogical.add('caret-shape');
5015
- longHandLogical.add('cursor');
5016
- longHandLogical.add('ime-mode');
5017
- longHandLogical.add('input-security');
5018
- shorthandsOfLonghands.add('outline');
5019
- longHandLogical.add('outline-color');
5020
- longHandLogical.add('outline-offset');
5021
- longHandLogical.add('outline-style');
5022
- longHandLogical.add('outline-width');
5023
- longHandLogical.add('pointer-events');
5024
- longHandLogical.add('resize');
5025
- longHandLogical.add('text-overflow');
5026
- longHandLogical.add('user-select');
5027
- shorthandsOfLonghands.add('grid-gap');
5028
- shorthandsOfLonghands.add('gap');
5029
- longHandLogical.add('grid-row-gap');
5030
- longHandLogical.add('row-gap');
5031
- longHandLogical.add('grid-column-gap');
5032
- longHandLogical.add('column-gap');
5033
- shorthandsOfLonghands.add('place-content');
5034
- longHandLogical.add('align-content');
5035
- longHandLogical.add('justify-content');
5036
- shorthandsOfLonghands.add('place-items');
5037
- longHandLogical.add('align-items');
5038
- longHandLogical.add('justify-items');
5039
- shorthandsOfLonghands.add('place-self');
5040
- longHandLogical.add('align-self');
5041
- longHandLogical.add('justify-self');
5042
- longHandLogical.add('box-sizing');
5043
- longHandLogical.add('block-size');
5044
- longHandPhysical.add('height');
5045
- longHandLogical.add('inline-size');
5046
- longHandPhysical.add('width');
5047
- longHandLogical.add('max-block-size');
5048
- longHandPhysical.add('max-height');
5049
- longHandLogical.add('max-inline-size');
5050
- longHandPhysical.add('max-width');
5051
- longHandLogical.add('min-block-size');
5052
- longHandPhysical.add('min-height');
5053
- longHandLogical.add('min-inline-size');
5054
- longHandPhysical.add('min-width');
5055
- shorthandsOfShorthands.add('margin');
5056
- shorthandsOfLonghands.add('margin-block');
5057
- longHandLogical.add('margin-block-start');
5058
- longHandPhysical.add('margin-top');
5059
- longHandLogical.add('margin-block-end');
5060
- longHandPhysical.add('margin-bottom');
5061
- shorthandsOfLonghands.add('margin-inline');
5062
- longHandLogical.add('margin-inline-start');
5063
- longHandPhysical.add('margin-left');
5064
- longHandLogical.add('margin-inline-end');
5065
- longHandPhysical.add('margin-right');
5066
- longHandLogical.add('margin-trim');
5067
- shorthandsOfLonghands.add('overscroll-behavior');
5068
- longHandLogical.add('overscroll-behavior-block');
5069
- longHandPhysical.add('overscroll-behavior-y');
5070
- longHandLogical.add('overscroll-behavior-inline');
5071
- longHandPhysical.add('overscroll-behavior-x');
5072
- shorthandsOfShorthands.add('padding');
5073
- shorthandsOfLonghands.add('padding-block');
5074
- longHandLogical.add('padding-block-start');
5075
- longHandPhysical.add('padding-top');
5076
- longHandLogical.add('padding-block-end');
5077
- longHandPhysical.add('padding-bottom');
5078
- shorthandsOfLonghands.add('padding-inline');
5079
- longHandLogical.add('padding-inline-start');
5080
- longHandPhysical.add('padding-left');
5081
- longHandLogical.add('padding-inline-end');
5082
- longHandPhysical.add('padding-right');
5083
- longHandLogical.add('visibility');
5084
- longHandLogical.add('color');
5085
- longHandLogical.add('color-scheme');
5086
- longHandLogical.add('forced-color-adjust');
5087
- longHandLogical.add('opacity');
5088
- longHandLogical.add('print-color-adjust');
5089
- shorthandsOfLonghands.add('columns');
5090
- longHandLogical.add('column-count');
5091
- longHandLogical.add('column-width');
5092
- longHandLogical.add('column-fill');
5093
- longHandLogical.add('column-span');
5094
- shorthandsOfLonghands.add('column-rule');
5095
- longHandLogical.add('column-rule-color');
5096
- longHandLogical.add('column-rule-style');
5097
- longHandLogical.add('column-rule-width');
5098
- longHandLogical.add('contain');
5099
- shorthandsOfLonghands.add('contain-intrinsic-size');
5100
- longHandLogical.add('contain-intrinsic-block-size');
5101
- longHandLogical.add('contain-intrinsic-width');
5102
- longHandLogical.add('contain-intrinsic-height');
5103
- longHandLogical.add('contain-intrinsic-inline-size');
5104
- shorthandsOfLonghands.add('container');
5105
- longHandLogical.add('container-name');
5106
- longHandLogical.add('container-type');
5107
- longHandLogical.add('content-visibility');
5108
- longHandLogical.add('counter-increment');
5109
- longHandLogical.add('counter-reset');
5110
- longHandLogical.add('counter-set');
5111
- longHandLogical.add('display');
5112
- shorthandsOfLonghands.add('flex');
5113
- longHandLogical.add('flex-basis');
5114
- longHandLogical.add('flex-grow');
5115
- longHandLogical.add('flex-shrink');
5116
- shorthandsOfLonghands.add('flex-flow');
5117
- longHandLogical.add('flex-direction');
5118
- longHandLogical.add('flex-wrap');
5119
- longHandLogical.add('order');
5120
- shorthandsOfShorthands.add('font');
5121
- longHandLogical.add('font-family');
5122
- longHandLogical.add('font-size');
5123
- longHandLogical.add('font-stretch');
5124
- longHandLogical.add('font-style');
5125
- longHandLogical.add('font-weight');
5126
- longHandLogical.add('line-height');
5127
- shorthandsOfLonghands.add('font-variant');
5128
- longHandLogical.add('font-variant-alternates');
5129
- longHandLogical.add('font-variant-caps');
5130
- longHandLogical.add('font-variant-east-asian');
5131
- longHandLogical.add('font-variant-emoji');
5132
- longHandLogical.add('font-variant-ligatures');
5133
- longHandLogical.add('font-variant-numeric');
5134
- longHandLogical.add('font-variant-position');
5135
- longHandLogical.add('font-feature-settings');
5136
- longHandLogical.add('font-kerning');
5137
- longHandLogical.add('font-language-override');
5138
- longHandLogical.add('font-optical-sizing');
5139
- longHandLogical.add('font-palette');
5140
- longHandLogical.add('font-variation-settings');
5141
- longHandLogical.add('font-size-adjust');
5142
- longHandLogical.add('font-smooth');
5143
- longHandLogical.add('font-synthesis-position');
5144
- longHandLogical.add('font-synthesis-small-caps');
5145
- longHandLogical.add('font-synthesis-style');
5146
- longHandLogical.add('font-synthesis-weight');
5147
- longHandLogical.add('line-height-step');
5148
- longHandLogical.add('box-decoration-break');
5149
- longHandLogical.add('break-after');
5150
- longHandLogical.add('break-before');
5151
- longHandLogical.add('break-inside');
5152
- longHandLogical.add('orphans');
5153
- longHandLogical.add('widows');
5154
- longHandLogical.add('content');
5155
- longHandLogical.add('quotes');
5156
- shorthandsOfShorthands.add('grid');
5157
- longHandLogical.add('grid-auto-flow');
5158
- longHandLogical.add('grid-auto-rows');
5159
- longHandLogical.add('grid-auto-columns');
5160
- shorthandsOfShorthands.add('grid-template');
5161
- shorthandsOfLonghands.add('grid-template-areas');
5162
- longHandLogical.add('grid-template-columns');
5163
- longHandLogical.add('grid-template-rows');
5164
- shorthandsOfShorthands.add('grid-area');
5165
- shorthandsOfLonghands.add('grid-row');
5166
- longHandLogical.add('grid-row-start');
5167
- longHandLogical.add('grid-row-end');
5168
- shorthandsOfLonghands.add('grid-column');
5169
- longHandLogical.add('grid-column-start');
5170
- longHandLogical.add('grid-column-end');
5171
- longHandLogical.add('align-tracks');
5172
- longHandLogical.add('justify-tracks');
5173
- longHandLogical.add('masonry-auto-flow');
5174
- longHandLogical.add('image-orientation');
5175
- longHandLogical.add('image-rendering');
5176
- longHandLogical.add('image-resolution');
5177
- longHandLogical.add('object-fit');
5178
- longHandLogical.add('object-position');
5179
- longHandLogical.add('initial-letter');
5180
- longHandLogical.add('initial-letter-align');
5181
- shorthandsOfLonghands.add('list-style');
5182
- longHandLogical.add('list-style-image');
5183
- longHandLogical.add('list-style-position');
5184
- longHandLogical.add('list-style-type');
5185
- longHandLogical.add('clip');
5186
- longHandLogical.add('clip-path');
5187
- shorthandsOfLonghands.add('mask');
5188
- longHandLogical.add('mask-clip');
5189
- longHandLogical.add('mask-composite');
5190
- longHandLogical.add('mask-image');
5191
- longHandLogical.add('mask-mode');
5192
- longHandLogical.add('mask-origin');
5193
- longHandLogical.add('mask-position');
5194
- longHandLogical.add('mask-repeat');
5195
- longHandLogical.add('mask-size');
5196
- longHandLogical.add('mask-type');
5197
- shorthandsOfLonghands.add('mask-border');
5198
- longHandLogical.add('mask-border-mode');
5199
- longHandLogical.add('mask-border-outset');
5200
- longHandLogical.add('mask-border-repeat');
5201
- longHandLogical.add('mask-border-slice');
5202
- longHandLogical.add('mask-border-source');
5203
- longHandLogical.add('mask-border-width');
5204
- shorthandsOfShorthands.add('all');
5205
- longHandLogical.add('text-rendering');
5206
- shorthandsOfLonghands.add('offset');
5207
- longHandLogical.add('offset-anchor');
5208
- longHandLogical.add('offset-distance');
5209
- longHandLogical.add('offset-path');
5210
- longHandLogical.add('offset-position');
5211
- longHandLogical.add('offset-rotate');
5212
- longHandLogical.add('-webkit-box-orient');
5213
- longHandLogical.add('-webkit-line-clamp');
5214
- shorthandsOfLonghands.add('overflow');
5215
- longHandLogical.add('overflow-block');
5216
- longHandPhysical.add('overflow-y');
5217
- longHandLogical.add('overflow-inline');
5218
- longHandPhysical.add('overflow-x');
5219
- longHandLogical.add('overflow-clip-margin');
5220
- longHandLogical.add('scroll-gutter');
5221
- longHandLogical.add('scroll-behavior');
5222
- longHandLogical.add('page');
5223
- longHandLogical.add('page-break-after');
5224
- longHandLogical.add('page-break-before');
5225
- longHandLogical.add('page-break-inside');
5226
- shorthandsOfShorthands.add('inset');
5227
- shorthandsOfLonghands.add('inset-block');
5228
- longHandLogical.add('inset-block-start');
5229
- longHandPhysical.add('top');
5230
- longHandLogical.add('inset-block-end');
5231
- longHandPhysical.add('bottom');
5232
- shorthandsOfLonghands.add('inset-inline');
5233
- longHandLogical.add('inset-inline-start');
5234
- longHandPhysical.add('left');
5235
- longHandLogical.add('inset-inline-end');
5236
- longHandPhysical.add('right');
5237
- longHandLogical.add('clear');
5238
- longHandLogical.add('float');
5239
- longHandLogical.add('position');
5240
- longHandLogical.add('z-index');
5241
- longHandLogical.add('ruby-align');
5242
- longHandLogical.add('ruby-merge');
5243
- longHandLogical.add('ruby-position');
5244
- longHandLogical.add('overflow-anchor');
5245
- shorthandsOfShorthands.add('scroll-margin');
5246
- shorthandsOfLonghands.add('scroll-margin-block');
5247
- longHandLogical.add('scroll-margin-block-start');
5248
- longHandPhysical.add('scroll-margin-top');
5249
- longHandLogical.add('scroll-margin-block-end');
5250
- longHandPhysical.add('scroll-margin-bottom');
5251
- shorthandsOfLonghands.add('scroll-margin-inline');
5252
- longHandLogical.add('scroll-margin-inline-start');
5253
- longHandPhysical.add('scroll-margin-left');
5254
- longHandLogical.add('scroll-margin-inline-end');
5255
- longHandPhysical.add('scroll-margin-right');
5256
- shorthandsOfShorthands.add('scroll-padding');
5257
- shorthandsOfLonghands.add('scroll-padding-block');
5258
- longHandLogical.add('scroll-padding-block-start');
5259
- longHandPhysical.add('scroll-padding-top');
5260
- longHandLogical.add('scroll-padding-block-end');
5261
- longHandPhysical.add('scroll-padding-bottom');
5262
- shorthandsOfLonghands.add('scroll-padding-inline');
5263
- longHandLogical.add('scroll-padding-inline-start');
5264
- longHandPhysical.add('scroll-padding-left');
5265
- longHandLogical.add('scroll-padding-inline-end');
5266
- longHandPhysical.add('scroll-padding-right');
5267
- longHandLogical.add('scroll-snap-align');
5268
- longHandLogical.add('scroll-snap-stop');
5269
- shorthandsOfLonghands.add('scroll-snap-type');
5270
- longHandLogical.add('scrollbar-color');
5271
- longHandLogical.add('scrollbar-width');
5272
- longHandLogical.add('shape-image-threshold');
5273
- longHandLogical.add('shape-margin');
5274
- longHandLogical.add('shape-outside');
5275
- longHandLogical.add('azimuth');
5276
- longHandLogical.add('border-collapse');
5277
- longHandLogical.add('border-spacing');
5278
- longHandLogical.add('caption-side');
5279
- longHandLogical.add('empty-cells');
5280
- longHandLogical.add('table-layout');
5281
- longHandLogical.add('vertical-align');
5282
- shorthandsOfLonghands.add('text-decoration');
5283
- longHandLogical.add('text-decoration-color');
5284
- longHandLogical.add('text-decoration-line');
5285
- longHandLogical.add('text-decoration-skip');
5286
- longHandLogical.add('text-decoration-skip-ink');
5287
- longHandLogical.add('text-decoration-style');
5288
- longHandLogical.add('text-decoration-thickness');
5289
- shorthandsOfLonghands.add('text-emphasis');
5290
- longHandLogical.add('text-emphasis-color');
5291
- longHandLogical.add('text-emphasis-position');
5292
- longHandLogical.add('text-emphasis-style');
5293
- longHandLogical.add('text-shadow');
5294
- longHandLogical.add('text-underline-offset');
5295
- longHandLogical.add('text-underline-position');
5296
- longHandLogical.add('hanging-punctuation');
5297
- longHandLogical.add('hyphenate-character');
5298
- longHandLogical.add('hyphenate-limit-chars');
5299
- longHandLogical.add('hyphens');
5300
- longHandLogical.add('letter-spacing');
5301
- longHandLogical.add('line-break');
5302
- longHandLogical.add('overflow-wrap');
5303
- longHandLogical.add('paint-order');
5304
- longHandLogical.add('tab-size');
5305
- longHandLogical.add('text-align');
5306
- longHandLogical.add('text-align-last');
5307
- longHandLogical.add('text-indent');
5308
- longHandLogical.add('text-justify');
5309
- longHandLogical.add('text-size-adjust');
5310
- longHandLogical.add('text-transform');
5311
- longHandLogical.add('text-wrap');
5312
- longHandLogical.add('white-space');
5313
- longHandLogical.add('white-space-collapse');
5314
- longHandLogical.add('word-break');
5315
- longHandLogical.add('word-spacing');
5316
- longHandLogical.add('word-wrap');
5317
- longHandLogical.add('backface-visibility');
5318
- longHandLogical.add('perspective');
5319
- longHandLogical.add('perspective-origin');
5320
- longHandLogical.add('rotate');
5321
- longHandLogical.add('scale');
5322
- longHandLogical.add('transform');
5323
- longHandLogical.add('transform-box');
5324
- longHandLogical.add('transform-origin');
5325
- longHandLogical.add('transform-style');
5326
- longHandLogical.add('translate');
5327
- shorthandsOfLonghands.add('transition');
5328
- longHandLogical.add('transition-delay');
5329
- longHandLogical.add('transition-duration');
5330
- longHandLogical.add('transition-property');
5331
- longHandLogical.add('transition-timing-function');
5332
- longHandLogical.add('view-transition-name');
5333
- longHandLogical.add('will-change');
5334
- longHandLogical.add('direction');
5335
- longHandLogical.add('text-combine-upright');
5336
- longHandLogical.add('text-orientation');
5337
- longHandLogical.add('unicode-bidi');
5338
- longHandLogical.add('writing-mode');
5339
- longHandLogical.add('backdrop-filter');
5340
- longHandLogical.add('filter');
5341
- longHandLogical.add('math-depth');
5342
- longHandLogical.add('math-shift');
5343
- longHandLogical.add('math-style');
5344
- longHandLogical.add('touch-action');
5345
- const PSEUDO_CLASS_PRIORITIES = {
5346
- ':is': 40,
5347
- ':where': 40,
5348
- ':not': 40,
5349
- ':has': 45,
5350
- ':dir': 50,
5351
- ':lang': 51,
5352
- ':first-child': 52,
5353
- ':first-of-type': 53,
5354
- ':last-child': 54,
5355
- ':last-of-type': 55,
5356
- ':only-child': 56,
5357
- ':only-of-type': 57,
5358
- ':nth-child': 60,
5359
- ':nth-last-child': 61,
5360
- ':nth-of-type': 62,
5361
- ':nth-last-of-type': 63,
5362
- ':empty': 70,
5363
- ':link': 80,
5364
- ':any-link': 81,
5365
- ':local-link': 82,
5366
- ':target-within': 83,
5367
- ':target': 84,
5368
- ':visited': 85,
5369
- ':enabled': 91,
5370
- ':disabled': 92,
5371
- ':required': 93,
5372
- ':optional': 94,
5373
- ':read-only': 95,
5374
- ':read-write': 96,
5375
- ':placeholder-shown': 97,
5376
- ':in-range': 98,
5377
- ':out-of-range': 99,
5378
- ':default': 100,
5379
- ':checked': 101,
5380
- ':indeterminate': 101,
5381
- ':blank': 102,
5382
- ':valid': 103,
5383
- ':invalid': 104,
5384
- ':user-invalid': 105,
5385
- ':autofill': 110,
5386
- ':picture-in-picture': 120,
5387
- ':modal': 121,
5388
- ':fullscreen': 122,
5389
- ':paused': 123,
5390
- ':playing': 124,
5391
- ':current': 125,
5392
- ':past': 126,
5393
- ':future': 127,
5394
- ':hover': 130,
5395
- ':focusWithin': 140,
5396
- ':focus': 150,
5397
- ':focusVisible': 160,
5398
- ':active': 170
5399
- };
5400
- const AT_RULE_PRIORITIES = {
5401
- '@supports': 30,
5402
- '@media': 200,
5403
- '@container': 300
5404
- };
5405
- const PSEUDO_ELEMENT_PRIORITY = 5000;
5406
- const RELATIONAL_SELECTORS = {
5407
- ANCESTOR: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+\*\)$/,
5408
- DESCENDANT: /^:where\(:has\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/,
5409
- SIBLING_BEFORE: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+~\s+\*\)$/,
5410
- SIBLING_AFTER: /^:where\(:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/,
5411
- ANY_SIBLING: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+~\s+\*,\s+:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/
5412
- };
5413
- function getPriority(key) {
5414
- if (key.startsWith('--')) {
5415
- return 1;
5416
- }
5417
- if (key.startsWith('@supports')) {
5418
- return AT_RULE_PRIORITIES['@supports'];
5419
- }
5420
- if (key.startsWith('@media')) {
5421
- return AT_RULE_PRIORITIES['@media'];
5422
- }
5423
- if (key.startsWith('@container')) {
5424
- return AT_RULE_PRIORITIES['@container'];
5425
- }
5426
- if (key.startsWith('::')) {
5427
- return PSEUDO_ELEMENT_PRIORITY;
5428
- }
5429
- const pseudoBase = p => (PSEUDO_CLASS_PRIORITIES[p] ?? 40) / 100;
5430
- const ancestorMatch = RELATIONAL_SELECTORS.ANCESTOR.exec(key);
5431
- if (ancestorMatch) {
5432
- return 10 + pseudoBase(ancestorMatch[1]);
5433
- }
5434
- const descendantMatch = RELATIONAL_SELECTORS.DESCENDANT.exec(key);
5435
- if (descendantMatch) {
5436
- return 15 + pseudoBase(descendantMatch[1]);
5437
- }
5438
- const anySiblingMatch = RELATIONAL_SELECTORS.ANY_SIBLING.exec(key);
5439
- if (anySiblingMatch) return 20 + Math.max(pseudoBase(anySiblingMatch[1]), pseudoBase(anySiblingMatch[2]));
5440
- const siblingBeforeMatch = RELATIONAL_SELECTORS.SIBLING_BEFORE.exec(key);
5441
- if (siblingBeforeMatch) {
5442
- return 30 + pseudoBase(siblingBeforeMatch[1]);
5443
- }
5444
- const siblingAfterMatch = RELATIONAL_SELECTORS.SIBLING_AFTER.exec(key);
5445
- if (siblingAfterMatch) {
5446
- return 40 + pseudoBase(siblingAfterMatch[1]);
5447
- }
5448
- if (key.startsWith(':')) {
5449
- const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
5450
- return PSEUDO_CLASS_PRIORITIES[prop] ?? 40;
5451
- }
5452
- if (shorthandsOfShorthands.has(key)) {
5453
- return 1000;
5454
- }
5455
- if (shorthandsOfLonghands.has(key)) {
5456
- return 2000;
5457
- }
5458
- if (longHandLogical.has(key)) {
5459
- return 3000;
5460
- }
5461
- if (longHandPhysical.has(key)) {
5462
- return 4000;
5463
- }
5464
- return 3000;
3863
+ var lib = {};
3864
+
3865
+ var propertyPriorities = {};
3866
+
3867
+ var hasRequiredPropertyPriorities;
3868
+
3869
+ function requirePropertyPriorities () {
3870
+ if (hasRequiredPropertyPriorities) return propertyPriorities;
3871
+ hasRequiredPropertyPriorities = 1;
3872
+
3873
+ Object.defineProperty(propertyPriorities, "__esModule", {
3874
+ value: true
3875
+ });
3876
+ propertyPriorities.PSEUDO_ELEMENT_PRIORITY = propertyPriorities.PSEUDO_CLASS_PRIORITIES = propertyPriorities.AT_RULE_PRIORITIES = void 0;
3877
+ propertyPriorities.default = getPriority;
3878
+ propertyPriorities.getAtRulePriority = getAtRulePriority;
3879
+ propertyPriorities.getDefaultPriority = getDefaultPriority;
3880
+ propertyPriorities.getPseudoClassPriority = getPseudoClassPriority;
3881
+ propertyPriorities.getPseudoElementPriority = getPseudoElementPriority;
3882
+ const longHandPhysical = new Set();
3883
+ const longHandLogical = new Set();
3884
+ const shorthandsOfLonghands = new Set();
3885
+ const shorthandsOfShorthands = new Set();
3886
+ longHandLogical.add('background-blend-mode');
3887
+ longHandLogical.add('isolation');
3888
+ longHandLogical.add('mix-blend-mode');
3889
+ shorthandsOfShorthands.add('animation');
3890
+ longHandLogical.add('animation-composition');
3891
+ longHandLogical.add('animation-delay');
3892
+ longHandLogical.add('animation-direction');
3893
+ longHandLogical.add('animation-duration');
3894
+ longHandLogical.add('animation-fill-mode');
3895
+ longHandLogical.add('animation-iteration-count');
3896
+ longHandLogical.add('animation-name');
3897
+ longHandLogical.add('animation-play-state');
3898
+ shorthandsOfLonghands.add('animation-range');
3899
+ longHandLogical.add('animation-range-end');
3900
+ longHandLogical.add('animation-range-start');
3901
+ longHandLogical.add('animation-timing-function');
3902
+ longHandLogical.add('animation-timeline');
3903
+ shorthandsOfLonghands.add('scroll-timeline');
3904
+ longHandLogical.add('scroll-timeline-axis');
3905
+ longHandLogical.add('scroll-timeline-name');
3906
+ longHandLogical.add('timeline-scope');
3907
+ shorthandsOfLonghands.add('view-timeline');
3908
+ longHandLogical.add('view-timeline-axis');
3909
+ longHandLogical.add('view-timeline-inset');
3910
+ longHandLogical.add('view-timeline-name');
3911
+ shorthandsOfShorthands.add('background');
3912
+ longHandLogical.add('background-attachment');
3913
+ longHandLogical.add('background-clip');
3914
+ longHandLogical.add('background-color');
3915
+ longHandLogical.add('background-image');
3916
+ longHandLogical.add('background-origin');
3917
+ longHandLogical.add('background-repeat');
3918
+ longHandLogical.add('background-size');
3919
+ shorthandsOfLonghands.add('background-position');
3920
+ longHandLogical.add('background-position-x');
3921
+ longHandLogical.add('background-position-y');
3922
+ shorthandsOfShorthands.add('border');
3923
+ shorthandsOfLonghands.add('border-color');
3924
+ shorthandsOfLonghands.add('border-style');
3925
+ shorthandsOfLonghands.add('border-width');
3926
+ shorthandsOfShorthands.add('border-block');
3927
+ longHandLogical.add('border-block-color');
3928
+ longHandLogical.add('border-block-stylex');
3929
+ longHandLogical.add('border-block-width');
3930
+ shorthandsOfLonghands.add('border-block-start');
3931
+ shorthandsOfLonghands.add('border-top');
3932
+ longHandLogical.add('border-block-start-color');
3933
+ longHandPhysical.add('border-top-color');
3934
+ longHandLogical.add('border-block-start-style');
3935
+ longHandPhysical.add('border-top-style');
3936
+ longHandLogical.add('border-block-start-width');
3937
+ longHandPhysical.add('border-top-width');
3938
+ shorthandsOfLonghands.add('border-block-end');
3939
+ shorthandsOfLonghands.add('border-bottom');
3940
+ longHandLogical.add('border-block-end-color');
3941
+ longHandPhysical.add('border-bottom-color');
3942
+ longHandLogical.add('border-block-end-style');
3943
+ longHandPhysical.add('border-bottom-style');
3944
+ longHandLogical.add('border-block-end-width');
3945
+ longHandPhysical.add('border-bottom-width');
3946
+ shorthandsOfShorthands.add('border-inline');
3947
+ shorthandsOfLonghands.add('border-inline-color');
3948
+ shorthandsOfLonghands.add('border-inline-style');
3949
+ shorthandsOfLonghands.add('border-inline-width');
3950
+ shorthandsOfLonghands.add('border-inline-start');
3951
+ shorthandsOfLonghands.add('border-left');
3952
+ longHandLogical.add('border-inline-start-color');
3953
+ longHandPhysical.add('border-left-color');
3954
+ longHandLogical.add('border-inline-start-style');
3955
+ longHandPhysical.add('border-left-style');
3956
+ longHandLogical.add('border-inline-start-width');
3957
+ longHandPhysical.add('border-left-width');
3958
+ shorthandsOfLonghands.add('border-inline-end');
3959
+ shorthandsOfLonghands.add('border-right');
3960
+ longHandLogical.add('border-inline-end-color');
3961
+ longHandPhysical.add('border-right-color');
3962
+ longHandLogical.add('border-inline-end-style');
3963
+ longHandPhysical.add('border-right-style');
3964
+ longHandLogical.add('border-inline-end-width');
3965
+ longHandPhysical.add('border-right-width');
3966
+ shorthandsOfLonghands.add('border-image');
3967
+ longHandLogical.add('border-image-outset');
3968
+ longHandLogical.add('border-image-repeat');
3969
+ longHandLogical.add('border-image-slice');
3970
+ longHandLogical.add('border-image-source');
3971
+ longHandLogical.add('border-image-width');
3972
+ shorthandsOfLonghands.add('border-radius');
3973
+ longHandLogical.add('border-start-end-radius');
3974
+ longHandLogical.add('border-start-start-radius');
3975
+ longHandLogical.add('border-end-end-radius');
3976
+ longHandLogical.add('border-end-start-radius');
3977
+ longHandPhysical.add('border-top-left-radius');
3978
+ longHandPhysical.add('border-top-right-radius');
3979
+ longHandPhysical.add('border-bottom-left-radius');
3980
+ longHandPhysical.add('border-bottom-right-radius');
3981
+ longHandLogical.add('box-shadow');
3982
+ longHandLogical.add('accent-color');
3983
+ longHandLogical.add('appearance');
3984
+ longHandLogical.add('aspect-ratio');
3985
+ shorthandsOfLonghands.add('caret');
3986
+ longHandLogical.add('caret-color');
3987
+ longHandLogical.add('caret-shape');
3988
+ longHandLogical.add('cursor');
3989
+ longHandLogical.add('ime-mode');
3990
+ longHandLogical.add('input-security');
3991
+ shorthandsOfLonghands.add('outline');
3992
+ longHandLogical.add('outline-color');
3993
+ longHandLogical.add('outline-offset');
3994
+ longHandLogical.add('outline-style');
3995
+ longHandLogical.add('outline-width');
3996
+ longHandLogical.add('pointer-events');
3997
+ longHandLogical.add('resize');
3998
+ longHandLogical.add('text-overflow');
3999
+ longHandLogical.add('user-select');
4000
+ shorthandsOfLonghands.add('grid-gap');
4001
+ shorthandsOfLonghands.add('gap');
4002
+ longHandLogical.add('grid-row-gap');
4003
+ longHandLogical.add('row-gap');
4004
+ longHandLogical.add('grid-column-gap');
4005
+ longHandLogical.add('column-gap');
4006
+ shorthandsOfLonghands.add('place-content');
4007
+ longHandLogical.add('align-content');
4008
+ longHandLogical.add('justify-content');
4009
+ shorthandsOfLonghands.add('place-items');
4010
+ longHandLogical.add('align-items');
4011
+ longHandLogical.add('justify-items');
4012
+ shorthandsOfLonghands.add('place-self');
4013
+ longHandLogical.add('align-self');
4014
+ longHandLogical.add('justify-self');
4015
+ longHandLogical.add('box-sizing');
4016
+ longHandLogical.add('block-size');
4017
+ longHandPhysical.add('height');
4018
+ longHandLogical.add('inline-size');
4019
+ longHandPhysical.add('width');
4020
+ longHandLogical.add('max-block-size');
4021
+ longHandPhysical.add('max-height');
4022
+ longHandLogical.add('max-inline-size');
4023
+ longHandPhysical.add('max-width');
4024
+ longHandLogical.add('min-block-size');
4025
+ longHandPhysical.add('min-height');
4026
+ longHandLogical.add('min-inline-size');
4027
+ longHandPhysical.add('min-width');
4028
+ shorthandsOfShorthands.add('margin');
4029
+ shorthandsOfLonghands.add('margin-block');
4030
+ longHandLogical.add('margin-block-start');
4031
+ longHandPhysical.add('margin-top');
4032
+ longHandLogical.add('margin-block-end');
4033
+ longHandPhysical.add('margin-bottom');
4034
+ shorthandsOfLonghands.add('margin-inline');
4035
+ longHandLogical.add('margin-inline-start');
4036
+ longHandPhysical.add('margin-left');
4037
+ longHandLogical.add('margin-inline-end');
4038
+ longHandPhysical.add('margin-right');
4039
+ longHandLogical.add('margin-trim');
4040
+ shorthandsOfLonghands.add('overscroll-behavior');
4041
+ longHandLogical.add('overscroll-behavior-block');
4042
+ longHandPhysical.add('overscroll-behavior-y');
4043
+ longHandLogical.add('overscroll-behavior-inline');
4044
+ longHandPhysical.add('overscroll-behavior-x');
4045
+ shorthandsOfShorthands.add('padding');
4046
+ shorthandsOfLonghands.add('padding-block');
4047
+ longHandLogical.add('padding-block-start');
4048
+ longHandPhysical.add('padding-top');
4049
+ longHandLogical.add('padding-block-end');
4050
+ longHandPhysical.add('padding-bottom');
4051
+ shorthandsOfLonghands.add('padding-inline');
4052
+ longHandLogical.add('padding-inline-start');
4053
+ longHandPhysical.add('padding-left');
4054
+ longHandLogical.add('padding-inline-end');
4055
+ longHandPhysical.add('padding-right');
4056
+ longHandLogical.add('visibility');
4057
+ longHandLogical.add('color');
4058
+ longHandLogical.add('color-scheme');
4059
+ longHandLogical.add('forced-color-adjust');
4060
+ longHandLogical.add('opacity');
4061
+ longHandLogical.add('print-color-adjust');
4062
+ shorthandsOfLonghands.add('columns');
4063
+ longHandLogical.add('column-count');
4064
+ longHandLogical.add('column-width');
4065
+ longHandLogical.add('column-fill');
4066
+ longHandLogical.add('column-span');
4067
+ shorthandsOfLonghands.add('column-rule');
4068
+ longHandLogical.add('column-rule-color');
4069
+ longHandLogical.add('column-rule-style');
4070
+ longHandLogical.add('column-rule-width');
4071
+ longHandLogical.add('contain');
4072
+ shorthandsOfLonghands.add('contain-intrinsic-size');
4073
+ longHandLogical.add('contain-intrinsic-block-size');
4074
+ longHandLogical.add('contain-intrinsic-width');
4075
+ longHandLogical.add('contain-intrinsic-height');
4076
+ longHandLogical.add('contain-intrinsic-inline-size');
4077
+ shorthandsOfLonghands.add('container');
4078
+ longHandLogical.add('container-name');
4079
+ longHandLogical.add('container-type');
4080
+ longHandLogical.add('content-visibility');
4081
+ longHandLogical.add('counter-increment');
4082
+ longHandLogical.add('counter-reset');
4083
+ longHandLogical.add('counter-set');
4084
+ longHandLogical.add('display');
4085
+ shorthandsOfLonghands.add('flex');
4086
+ longHandLogical.add('flex-basis');
4087
+ longHandLogical.add('flex-grow');
4088
+ longHandLogical.add('flex-shrink');
4089
+ shorthandsOfLonghands.add('flex-flow');
4090
+ longHandLogical.add('flex-direction');
4091
+ longHandLogical.add('flex-wrap');
4092
+ longHandLogical.add('order');
4093
+ shorthandsOfShorthands.add('font');
4094
+ longHandLogical.add('font-family');
4095
+ longHandLogical.add('font-size');
4096
+ longHandLogical.add('font-stretch');
4097
+ longHandLogical.add('font-style');
4098
+ longHandLogical.add('font-weight');
4099
+ longHandLogical.add('line-height');
4100
+ shorthandsOfLonghands.add('font-variant');
4101
+ longHandLogical.add('font-variant-alternates');
4102
+ longHandLogical.add('font-variant-caps');
4103
+ longHandLogical.add('font-variant-east-asian');
4104
+ longHandLogical.add('font-variant-emoji');
4105
+ longHandLogical.add('font-variant-ligatures');
4106
+ longHandLogical.add('font-variant-numeric');
4107
+ longHandLogical.add('font-variant-position');
4108
+ longHandLogical.add('font-feature-settings');
4109
+ longHandLogical.add('font-kerning');
4110
+ longHandLogical.add('font-language-override');
4111
+ longHandLogical.add('font-optical-sizing');
4112
+ longHandLogical.add('font-palette');
4113
+ longHandLogical.add('font-variation-settings');
4114
+ longHandLogical.add('font-size-adjust');
4115
+ longHandLogical.add('font-smooth');
4116
+ longHandLogical.add('font-synthesis-position');
4117
+ longHandLogical.add('font-synthesis-small-caps');
4118
+ longHandLogical.add('font-synthesis-style');
4119
+ longHandLogical.add('font-synthesis-weight');
4120
+ longHandLogical.add('line-height-step');
4121
+ longHandLogical.add('box-decoration-break');
4122
+ longHandLogical.add('break-after');
4123
+ longHandLogical.add('break-before');
4124
+ longHandLogical.add('break-inside');
4125
+ longHandLogical.add('orphans');
4126
+ longHandLogical.add('widows');
4127
+ longHandLogical.add('content');
4128
+ longHandLogical.add('quotes');
4129
+ shorthandsOfShorthands.add('grid');
4130
+ longHandLogical.add('grid-auto-flow');
4131
+ longHandLogical.add('grid-auto-rows');
4132
+ longHandLogical.add('grid-auto-columns');
4133
+ shorthandsOfShorthands.add('grid-template');
4134
+ shorthandsOfLonghands.add('grid-template-areas');
4135
+ longHandLogical.add('grid-template-columns');
4136
+ longHandLogical.add('grid-template-rows');
4137
+ shorthandsOfShorthands.add('grid-area');
4138
+ shorthandsOfLonghands.add('grid-row');
4139
+ longHandLogical.add('grid-row-start');
4140
+ longHandLogical.add('grid-row-end');
4141
+ shorthandsOfLonghands.add('grid-column');
4142
+ longHandLogical.add('grid-column-start');
4143
+ longHandLogical.add('grid-column-end');
4144
+ longHandLogical.add('align-tracks');
4145
+ longHandLogical.add('justify-tracks');
4146
+ longHandLogical.add('masonry-auto-flow');
4147
+ longHandLogical.add('image-orientation');
4148
+ longHandLogical.add('image-rendering');
4149
+ longHandLogical.add('image-resolution');
4150
+ longHandLogical.add('object-fit');
4151
+ longHandLogical.add('object-position');
4152
+ longHandLogical.add('initial-letter');
4153
+ longHandLogical.add('initial-letter-align');
4154
+ shorthandsOfLonghands.add('list-style');
4155
+ longHandLogical.add('list-style-image');
4156
+ longHandLogical.add('list-style-position');
4157
+ longHandLogical.add('list-style-type');
4158
+ longHandLogical.add('clip');
4159
+ longHandLogical.add('clip-path');
4160
+ shorthandsOfLonghands.add('mask');
4161
+ longHandLogical.add('mask-clip');
4162
+ longHandLogical.add('mask-composite');
4163
+ longHandLogical.add('mask-image');
4164
+ longHandLogical.add('mask-mode');
4165
+ longHandLogical.add('mask-origin');
4166
+ longHandLogical.add('mask-position');
4167
+ longHandLogical.add('mask-repeat');
4168
+ longHandLogical.add('mask-size');
4169
+ longHandLogical.add('mask-type');
4170
+ shorthandsOfLonghands.add('mask-border');
4171
+ longHandLogical.add('mask-border-mode');
4172
+ longHandLogical.add('mask-border-outset');
4173
+ longHandLogical.add('mask-border-repeat');
4174
+ longHandLogical.add('mask-border-slice');
4175
+ longHandLogical.add('mask-border-source');
4176
+ longHandLogical.add('mask-border-width');
4177
+ shorthandsOfShorthands.add('all');
4178
+ longHandLogical.add('text-rendering');
4179
+ shorthandsOfLonghands.add('offset');
4180
+ longHandLogical.add('offset-anchor');
4181
+ longHandLogical.add('offset-distance');
4182
+ longHandLogical.add('offset-path');
4183
+ longHandLogical.add('offset-position');
4184
+ longHandLogical.add('offset-rotate');
4185
+ longHandLogical.add('-webkit-box-orient');
4186
+ longHandLogical.add('-webkit-line-clamp');
4187
+ shorthandsOfLonghands.add('overflow');
4188
+ longHandLogical.add('overflow-block');
4189
+ longHandPhysical.add('overflow-y');
4190
+ longHandLogical.add('overflow-inline');
4191
+ longHandPhysical.add('overflow-x');
4192
+ longHandLogical.add('overflow-clip-margin');
4193
+ longHandLogical.add('scroll-gutter');
4194
+ longHandLogical.add('scroll-behavior');
4195
+ longHandLogical.add('page');
4196
+ longHandLogical.add('page-break-after');
4197
+ longHandLogical.add('page-break-before');
4198
+ longHandLogical.add('page-break-inside');
4199
+ shorthandsOfShorthands.add('inset');
4200
+ shorthandsOfLonghands.add('inset-block');
4201
+ longHandLogical.add('inset-block-start');
4202
+ longHandPhysical.add('top');
4203
+ longHandLogical.add('inset-block-end');
4204
+ longHandPhysical.add('bottom');
4205
+ shorthandsOfLonghands.add('inset-inline');
4206
+ longHandLogical.add('inset-inline-start');
4207
+ longHandPhysical.add('left');
4208
+ longHandLogical.add('inset-inline-end');
4209
+ longHandPhysical.add('right');
4210
+ longHandLogical.add('clear');
4211
+ longHandLogical.add('float');
4212
+ longHandLogical.add('position');
4213
+ longHandLogical.add('z-index');
4214
+ longHandLogical.add('ruby-align');
4215
+ longHandLogical.add('ruby-merge');
4216
+ longHandLogical.add('ruby-position');
4217
+ longHandLogical.add('overflow-anchor');
4218
+ shorthandsOfShorthands.add('scroll-margin');
4219
+ shorthandsOfLonghands.add('scroll-margin-block');
4220
+ longHandLogical.add('scroll-margin-block-start');
4221
+ longHandPhysical.add('scroll-margin-top');
4222
+ longHandLogical.add('scroll-margin-block-end');
4223
+ longHandPhysical.add('scroll-margin-bottom');
4224
+ shorthandsOfLonghands.add('scroll-margin-inline');
4225
+ longHandLogical.add('scroll-margin-inline-start');
4226
+ longHandPhysical.add('scroll-margin-left');
4227
+ longHandLogical.add('scroll-margin-inline-end');
4228
+ longHandPhysical.add('scroll-margin-right');
4229
+ shorthandsOfShorthands.add('scroll-padding');
4230
+ shorthandsOfLonghands.add('scroll-padding-block');
4231
+ longHandLogical.add('scroll-padding-block-start');
4232
+ longHandPhysical.add('scroll-padding-top');
4233
+ longHandLogical.add('scroll-padding-block-end');
4234
+ longHandPhysical.add('scroll-padding-bottom');
4235
+ shorthandsOfLonghands.add('scroll-padding-inline');
4236
+ longHandLogical.add('scroll-padding-inline-start');
4237
+ longHandPhysical.add('scroll-padding-left');
4238
+ longHandLogical.add('scroll-padding-inline-end');
4239
+ longHandPhysical.add('scroll-padding-right');
4240
+ longHandLogical.add('scroll-snap-align');
4241
+ longHandLogical.add('scroll-snap-stop');
4242
+ shorthandsOfLonghands.add('scroll-snap-type');
4243
+ longHandLogical.add('scrollbar-color');
4244
+ longHandLogical.add('scrollbar-width');
4245
+ longHandLogical.add('shape-image-threshold');
4246
+ longHandLogical.add('shape-margin');
4247
+ longHandLogical.add('shape-outside');
4248
+ longHandLogical.add('azimuth');
4249
+ longHandLogical.add('border-collapse');
4250
+ longHandLogical.add('border-spacing');
4251
+ longHandLogical.add('caption-side');
4252
+ longHandLogical.add('empty-cells');
4253
+ longHandLogical.add('table-layout');
4254
+ longHandLogical.add('vertical-align');
4255
+ shorthandsOfLonghands.add('text-decoration');
4256
+ longHandLogical.add('text-decoration-color');
4257
+ longHandLogical.add('text-decoration-line');
4258
+ longHandLogical.add('text-decoration-skip');
4259
+ longHandLogical.add('text-decoration-skip-ink');
4260
+ longHandLogical.add('text-decoration-style');
4261
+ longHandLogical.add('text-decoration-thickness');
4262
+ shorthandsOfLonghands.add('text-emphasis');
4263
+ longHandLogical.add('text-emphasis-color');
4264
+ longHandLogical.add('text-emphasis-position');
4265
+ longHandLogical.add('text-emphasis-style');
4266
+ longHandLogical.add('text-shadow');
4267
+ longHandLogical.add('text-underline-offset');
4268
+ longHandLogical.add('text-underline-position');
4269
+ longHandLogical.add('hanging-punctuation');
4270
+ longHandLogical.add('hyphenate-character');
4271
+ longHandLogical.add('hyphenate-limit-chars');
4272
+ longHandLogical.add('hyphens');
4273
+ longHandLogical.add('letter-spacing');
4274
+ longHandLogical.add('line-break');
4275
+ longHandLogical.add('overflow-wrap');
4276
+ longHandLogical.add('paint-order');
4277
+ longHandLogical.add('tab-size');
4278
+ longHandLogical.add('text-align');
4279
+ longHandLogical.add('text-align-last');
4280
+ longHandLogical.add('text-indent');
4281
+ longHandLogical.add('text-justify');
4282
+ longHandLogical.add('text-size-adjust');
4283
+ longHandLogical.add('text-transform');
4284
+ longHandLogical.add('text-wrap');
4285
+ longHandLogical.add('white-space');
4286
+ longHandLogical.add('white-space-collapse');
4287
+ longHandLogical.add('word-break');
4288
+ longHandLogical.add('word-spacing');
4289
+ longHandLogical.add('word-wrap');
4290
+ longHandLogical.add('backface-visibility');
4291
+ longHandLogical.add('perspective');
4292
+ longHandLogical.add('perspective-origin');
4293
+ longHandLogical.add('rotate');
4294
+ longHandLogical.add('scale');
4295
+ longHandLogical.add('transform');
4296
+ longHandLogical.add('transform-box');
4297
+ longHandLogical.add('transform-origin');
4298
+ longHandLogical.add('transform-style');
4299
+ longHandLogical.add('translate');
4300
+ shorthandsOfLonghands.add('transition');
4301
+ longHandLogical.add('transition-delay');
4302
+ longHandLogical.add('transition-duration');
4303
+ longHandLogical.add('transition-property');
4304
+ longHandLogical.add('transition-timing-function');
4305
+ longHandLogical.add('view-transition-name');
4306
+ longHandLogical.add('will-change');
4307
+ longHandLogical.add('direction');
4308
+ longHandLogical.add('text-combine-upright');
4309
+ longHandLogical.add('text-orientation');
4310
+ longHandLogical.add('unicode-bidi');
4311
+ longHandLogical.add('writing-mode');
4312
+ longHandLogical.add('backdrop-filter');
4313
+ longHandLogical.add('filter');
4314
+ longHandLogical.add('math-depth');
4315
+ longHandLogical.add('math-shift');
4316
+ longHandLogical.add('math-style');
4317
+ longHandLogical.add('touch-action');
4318
+ const PSEUDO_CLASS_PRIORITIES = propertyPriorities.PSEUDO_CLASS_PRIORITIES = {
4319
+ ':is': 40,
4320
+ ':where': 40,
4321
+ ':not': 40,
4322
+ ':has': 45,
4323
+ ':dir': 50,
4324
+ ':lang': 51,
4325
+ ':first-child': 52,
4326
+ ':first-of-type': 53,
4327
+ ':last-child': 54,
4328
+ ':last-of-type': 55,
4329
+ ':only-child': 56,
4330
+ ':only-of-type': 57,
4331
+ ':nth-child': 60,
4332
+ ':nth-last-child': 61,
4333
+ ':nth-of-type': 62,
4334
+ ':nth-last-of-type': 63,
4335
+ ':empty': 70,
4336
+ ':link': 80,
4337
+ ':any-link': 81,
4338
+ ':local-link': 82,
4339
+ ':target-within': 83,
4340
+ ':target': 84,
4341
+ ':visited': 85,
4342
+ ':enabled': 91,
4343
+ ':disabled': 92,
4344
+ ':required': 93,
4345
+ ':optional': 94,
4346
+ ':read-only': 95,
4347
+ ':read-write': 96,
4348
+ ':placeholder-shown': 97,
4349
+ ':in-range': 98,
4350
+ ':out-of-range': 99,
4351
+ ':default': 100,
4352
+ ':checked': 101,
4353
+ ':indeterminate': 101,
4354
+ ':blank': 102,
4355
+ ':valid': 103,
4356
+ ':invalid': 104,
4357
+ ':user-invalid': 105,
4358
+ ':autofill': 110,
4359
+ ':picture-in-picture': 120,
4360
+ ':modal': 121,
4361
+ ':fullscreen': 122,
4362
+ ':paused': 123,
4363
+ ':playing': 124,
4364
+ ':current': 125,
4365
+ ':past': 126,
4366
+ ':future': 127,
4367
+ ':hover': 130,
4368
+ ':focusWithin': 140,
4369
+ ':focus': 150,
4370
+ ':focusVisible': 160,
4371
+ ':active': 170
4372
+ };
4373
+ const AT_RULE_PRIORITIES = propertyPriorities.AT_RULE_PRIORITIES = {
4374
+ '@supports': 30,
4375
+ '@media': 200,
4376
+ '@container': 300
4377
+ };
4378
+ const PSEUDO_ELEMENT_PRIORITY = propertyPriorities.PSEUDO_ELEMENT_PRIORITY = 5000;
4379
+ const RELATIONAL_SELECTORS = {
4380
+ ANCESTOR: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+\*\)$/,
4381
+ DESCENDANT: /^:where\(:has\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/,
4382
+ SIBLING_BEFORE: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+~\s+\*\)$/,
4383
+ SIBLING_AFTER: /^:where\(:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/,
4384
+ ANY_SIBLING: /^:where\(\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\s+~\s+\*,\s+:has\(~\s\.[0-9a-zA-Z_-]+(:[a-zA-Z-]+)\)\)$/
4385
+ };
4386
+ function getAtRulePriority(key) {
4387
+ if (key.startsWith('--')) {
4388
+ return 1;
4389
+ }
4390
+ if (key.startsWith('@supports')) {
4391
+ return AT_RULE_PRIORITIES['@supports'];
4392
+ }
4393
+ if (key.startsWith('@media')) {
4394
+ return AT_RULE_PRIORITIES['@media'];
4395
+ }
4396
+ if (key.startsWith('@container')) {
4397
+ return AT_RULE_PRIORITIES['@container'];
4398
+ }
4399
+ }
4400
+ function getPseudoElementPriority(key) {
4401
+ if (key.startsWith('::')) {
4402
+ return PSEUDO_ELEMENT_PRIORITY;
4403
+ }
4404
+ }
4405
+ function getPseudoClassPriority(key) {
4406
+ const pseudoBase = p => (PSEUDO_CLASS_PRIORITIES[p] ?? 40) / 100;
4407
+ const ancestorMatch = RELATIONAL_SELECTORS.ANCESTOR.exec(key);
4408
+ if (ancestorMatch) {
4409
+ return 10 + pseudoBase(ancestorMatch[1]);
4410
+ }
4411
+ const descendantMatch = RELATIONAL_SELECTORS.DESCENDANT.exec(key);
4412
+ if (descendantMatch) {
4413
+ return 15 + pseudoBase(descendantMatch[1]);
4414
+ }
4415
+ const anySiblingMatch = RELATIONAL_SELECTORS.ANY_SIBLING.exec(key);
4416
+ if (anySiblingMatch) return 20 + Math.max(pseudoBase(anySiblingMatch[1]), pseudoBase(anySiblingMatch[2]));
4417
+ const siblingBeforeMatch = RELATIONAL_SELECTORS.SIBLING_BEFORE.exec(key);
4418
+ if (siblingBeforeMatch) {
4419
+ return 30 + pseudoBase(siblingBeforeMatch[1]);
4420
+ }
4421
+ const siblingAfterMatch = RELATIONAL_SELECTORS.SIBLING_AFTER.exec(key);
4422
+ if (siblingAfterMatch) {
4423
+ return 40 + pseudoBase(siblingAfterMatch[1]);
4424
+ }
4425
+ if (key.startsWith(':')) {
4426
+ const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
4427
+ return PSEUDO_CLASS_PRIORITIES[prop] ?? 40;
4428
+ }
4429
+ }
4430
+ function getDefaultPriority(key) {
4431
+ if (shorthandsOfShorthands.has(key)) {
4432
+ return 1000;
4433
+ }
4434
+ if (shorthandsOfLonghands.has(key)) {
4435
+ return 2000;
4436
+ }
4437
+ if (longHandLogical.has(key)) {
4438
+ return 3000;
4439
+ }
4440
+ if (longHandPhysical.has(key)) {
4441
+ return 4000;
4442
+ }
4443
+ }
4444
+ function getPriority(key) {
4445
+ const atRulePriority = getAtRulePriority(key);
4446
+ if (atRulePriority) return atRulePriority;
4447
+ const pseudoElementPriority = getPseudoElementPriority(key);
4448
+ if (pseudoElementPriority) return pseudoElementPriority;
4449
+ const pseudoClassPriority = getPseudoClassPriority(key);
4450
+ if (pseudoClassPriority) return pseudoClassPriority;
4451
+ const defaultPriority = getDefaultPriority(key);
4452
+ if (defaultPriority) return defaultPriority;
4453
+ return 3000;
4454
+ }
4455
+ return propertyPriorities;
5465
4456
  }
5466
4457
 
4458
+ var hasRequiredLib;
4459
+
4460
+ function requireLib () {
4461
+ if (hasRequiredLib) return lib;
4462
+ hasRequiredLib = 1;
4463
+
4464
+ Object.defineProperty(lib, "__esModule", {
4465
+ value: true
4466
+ });
4467
+ lib.getPseudoElementPriority = lib.getPseudoClassPriority = lib.getPriority = lib.getDefaultPriority = lib.getAtRulePriority = lib.PSEUDO_ELEMENT_PRIORITY = lib.PSEUDO_CLASS_PRIORITIES = lib.AT_RULE_PRIORITIES = void 0;
4468
+ var _propertyPriorities = _interopRequireWildcard(requirePropertyPriorities());
4469
+ 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); }
4470
+ lib.getAtRulePriority = _propertyPriorities.getAtRulePriority;
4471
+ lib.getPseudoElementPriority = _propertyPriorities.getPseudoElementPriority;
4472
+ lib.getPseudoClassPriority = _propertyPriorities.getPseudoClassPriority;
4473
+ lib.getDefaultPriority = _propertyPriorities.getDefaultPriority;
4474
+ lib.getPriority = _propertyPriorities.default;
4475
+ lib.PSEUDO_CLASS_PRIORITIES = _propertyPriorities.PSEUDO_CLASS_PRIORITIES;
4476
+ lib.AT_RULE_PRIORITIES = _propertyPriorities.AT_RULE_PRIORITIES;
4477
+ lib.PSEUDO_ELEMENT_PRIORITY = _propertyPriorities.PSEUDO_ELEMENT_PRIORITY;
4478
+ return lib;
4479
+ }
4480
+
4481
+ var libExports = requireLib();
4482
+
5467
4483
  const THUMB_VARIANTS = ['::-webkit-slider-thumb', '::-moz-range-thumb', '::-ms-thumb'];
5468
4484
  function buildNestedCSSRule(className, decls, pseudos, atRules, constRules) {
5469
4485
  const pseudo = pseudos.filter(p => p !== '::thumb').join('');
5470
4486
  const combinedAtRules = atRules.concat(constRules);
5471
- let selectorForAtRules = `.${className}` + combinedAtRules.map(() => `.${className}`).join('') + pseudo;
4487
+ const hasWhere = pseudo.includes(':where(');
4488
+ const extraClassForWhere = hasWhere ? `.${className}` : '';
4489
+ let selectorForAtRules = `.${className}` + extraClassForWhere + combinedAtRules.map(() => `.${className}`).join('') + pseudo;
5472
4490
  if (pseudos.includes('::thumb')) {
5473
4491
  selectorForAtRules = THUMB_VARIANTS.map(suffix => selectorForAtRules + suffix).join(', ');
5474
4492
  }
@@ -5481,7 +4499,7 @@ function generateCSSRule(className, key, value, pseudos, atRules, constRules, op
5481
4499
  const rtlDecls = pairs.map(pair => generateRTL(pair, options)).filter(Boolean).map(pair => pair.join(':')).join(';');
5482
4500
  const ltrRule = buildNestedCSSRule(className, ltrDecls, pseudos, atRules, constRules);
5483
4501
  const rtlRule = !rtlDecls ? null : buildNestedCSSRule(className, rtlDecls, pseudos, atRules, constRules);
5484
- const priority = getPriority(key) + pseudos.map(getPriority).reduce((a, b) => a + b, 0) + atRules.map(getPriority).reduce((a, b) => a + b, 0) + constRules.map(getPriority).reduce((a, b) => a + b, 0);
4502
+ const priority = libExports.getPriority(key) + pseudos.map(libExports.getPriority).reduce((a, b) => a + b, 0) + atRules.map(libExports.getPriority).reduce((a, b) => a + b, 0) + constRules.map(libExports.getPriority).reduce((a, b) => a + b, 0);
5485
4503
  return {
5486
4504
  priority,
5487
4505
  ltr: ltrRule,
@@ -5692,7 +4710,7 @@ class PreRuleSet {
5692
4710
  function flattenRawStyleObject(style, options) {
5693
4711
  let processedStyle = style;
5694
4712
  try {
5695
- processedStyle = options.enableMediaQueryOrder ? libExports.lastMediaQueryWinsTransform(style) : style;
4713
+ processedStyle = options.enableMediaQueryOrder ? libExports$1.lastMediaQueryWinsTransform(style) : style;
5696
4714
  } catch (error) {
5697
4715
  throw new Error(INVALID_MEDIA_QUERY_SYNTAX);
5698
4716
  }
@@ -6350,7 +5368,27 @@ function genFileBasedIdentifier({
6350
5368
  return `${fileName}//${exportName}${key != null ? `.${key}` : ''}`;
6351
5369
  }
6352
5370
 
5371
+ function fromProxy(value) {
5372
+ if (typeof value === 'object' && value != null && value.__IS_PROXY === true && typeof value.toString === 'function') {
5373
+ return value.toString();
5374
+ }
5375
+ return null;
5376
+ }
5377
+ function fromStyleXStyle(value) {
5378
+ if (typeof value === 'object' && value != null && value.$$css === true) {
5379
+ return Object.keys(value).find(key => key !== '$$css');
5380
+ }
5381
+ return null;
5382
+ }
6353
5383
  function getDefaultMarkerClassName(options = defaultOptions) {
5384
+ const valueFromProxy = fromProxy(options);
5385
+ if (valueFromProxy != null) {
5386
+ return valueFromProxy;
5387
+ }
5388
+ const valueFromStyleXStyle = fromStyleXStyle(options);
5389
+ if (valueFromStyleXStyle != null) {
5390
+ return valueFromStyleXStyle;
5391
+ }
6354
5392
  const prefix = options.classNamePrefix != null ? `${options.classNamePrefix}-` : '';
6355
5393
  return `${prefix}default-marker`;
6356
5394
  }
@@ -6507,13 +5545,7 @@ function convertToTestStyles(obj, varName, state) {
6507
5545
  }
6508
5546
 
6509
5547
  function convertObjectToAST(obj) {
6510
- return t__namespace.objectExpression(Object.entries(obj).map(([key, value]) => t__namespace.objectProperty(canBeIdentifier(key) ? t__namespace.identifier(key) : t__namespace.stringLiteral(key), typeof value === 'string' ? t__namespace.stringLiteral(value) : typeof value === 'number' ? t__namespace.numericLiteral(value) : typeof value === 'boolean' ? t__namespace.booleanLiteral(value) : value === null ? t__namespace.nullLiteral() : convertObjectToAST(value))));
6511
- }
6512
- function removeObjectsWithSpreads(obj) {
6513
- return Object.fromEntries(Object.entries(obj).filter(Boolean));
6514
- }
6515
- function canBeIdentifier(str) {
6516
- return str.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/) != null;
5548
+ return t__namespace.objectExpression(Object.entries(obj).map(([key, value]) => t__namespace.objectProperty(t__namespace.isValidIdentifier(key, false) ? t__namespace.identifier(key) : t__namespace.stringLiteral(key), typeof value === 'string' ? t__namespace.stringLiteral(value) : typeof value === 'number' ? t__namespace.numericLiteral(value) : typeof value === 'boolean' ? t__namespace.booleanLiteral(value) : value === null ? t__namespace.nullLiteral() : convertObjectToAST(value))));
6517
5549
  }
6518
5550
 
6519
5551
  const IMPORT_FILE_PARSING_ERROR = `There was error when attempting to parse the imported file.
@@ -6557,7 +5589,7 @@ function deopt(path, state, reason) {
6557
5589
  state.deoptReason = reason;
6558
5590
  }
6559
5591
  function evaluateImportedFile(filePath, namedExport, state, bindingPath) {
6560
- const fs = require('fs');
5592
+ const fs = require('node:fs');
6561
5593
  const fileContents = fs.readFileSync(filePath, 'utf8');
6562
5594
  const ast = core.parseSync(fileContents, {
6563
5595
  babelrc: true
@@ -6623,6 +5655,15 @@ function evaluateThemeRef(fileName, exportName, state) {
6623
5655
  };
6624
5656
  const proxy = new Proxy({}, {
6625
5657
  get(_, key) {
5658
+ if (key === '__IS_PROXY') {
5659
+ return true;
5660
+ }
5661
+ if (key === 'toString') {
5662
+ return () => state.traversalState.options.classNamePrefix + utils.hash(utils.genFileBasedIdentifier({
5663
+ fileName,
5664
+ exportName
5665
+ }));
5666
+ }
6626
5667
  return resolveKey(key);
6627
5668
  },
6628
5669
  set(_, key, value) {
@@ -6771,7 +5812,7 @@ function _evaluate(path, state) {
6771
5812
  const imported = importSpecifierNode.imported;
6772
5813
  const importedName = imported.type === 'Identifier' ? imported.name : imported.value;
6773
5814
  const importPath = binding.path.parentPath;
6774
- if (importPath && importPath.isImportDeclaration()) {
5815
+ if (importPath && importPath.isImportDeclaration() && !state.functions.disableImports) {
6775
5816
  const absPath = state.traversalState.importPathResolver(importPath.node.source.value);
6776
5817
  if (!absPath) {
6777
5818
  return deopt(binding.path, state, IMPORT_PATH_RESOLUTION_ERROR);
@@ -7115,7 +6156,8 @@ function evaluateQuasis(path, quasis, state, raw = false) {
7115
6156
  const importsForState = new WeakMap();
7116
6157
  function evaluate(path, traversalState, functions = {
7117
6158
  identifiers: {},
7118
- memberExpressions: {}
6159
+ memberExpressions: {},
6160
+ disableImports: false
7119
6161
  }, seen = new Map()) {
7120
6162
  const addedImports = importsForState.get(traversalState) ?? new Set();
7121
6163
  importsForState.set(traversalState, addedImports);
@@ -7464,7 +6506,7 @@ function transformStyleXCreate(path, state) {
7464
6506
  };
7465
6507
  }
7466
6508
  if (varName != null && isTopLevel(path)) {
7467
- const stylesToRemember = removeObjectsWithSpreads(compiledStyles);
6509
+ const stylesToRemember = Object.fromEntries(Object.entries(compiledStyles));
7468
6510
  state.styleMap.set(varName, stylesToRemember);
7469
6511
  state.styleVars.set(varName, path.parentPath);
7470
6512
  }
@@ -8269,6 +7311,13 @@ function genBitwiseOrOfConditions$1(conditions) {
8269
7311
  });
8270
7312
  }
8271
7313
 
7314
+ class ConditionalStyle {
7315
+ constructor(test, primary, fallback) {
7316
+ this.test = test;
7317
+ this.primary = primary;
7318
+ this.fallback = fallback;
7319
+ }
7320
+ }
8272
7321
  function skipStylexPropsChildren(path, state) {
8273
7322
  if (!isCalleeIdentifier(path, state) && !isCalleeMemberExpression(path, state)) {
8274
7323
  return;
@@ -8276,15 +7325,12 @@ function skipStylexPropsChildren(path, state) {
8276
7325
  path.skip();
8277
7326
  }
8278
7327
  function transformStylexProps(path, state) {
8279
- const {
8280
- node
8281
- } = path;
8282
7328
  if (!isCalleeIdentifier(path, state) && !isCalleeMemberExpression(path, state)) {
8283
7329
  return;
8284
7330
  }
8285
7331
  let bailOut = false;
8286
7332
  let conditional = 0;
8287
- const args = node.arguments.flatMap(arg => arg.type === 'ArrayExpression' ? arg.elements : [arg]);
7333
+ const argsPath = path.get('arguments').flatMap(argPath => argPath.isArrayExpression() ? argPath.get('elements') : [argPath]);
8288
7334
  let currentIndex = -1;
8289
7335
  let bailOutIndex = null;
8290
7336
  const identifiers = {};
@@ -8301,67 +7347,57 @@ function transformStylexProps(path, state) {
8301
7347
  });
8302
7348
  const evaluatePathFnConfig = {
8303
7349
  identifiers,
8304
- memberExpressions
7350
+ memberExpressions,
7351
+ disableImports: true
8305
7352
  };
8306
7353
  const resolvedArgs = [];
8307
- for (const arg of args) {
7354
+ for (const argPath of argsPath) {
8308
7355
  currentIndex++;
8309
- switch (arg.type) {
8310
- case 'MemberExpression':
8311
- {
8312
- const resolved = parseNullableStyle(arg, state);
8313
- if (resolved === 'other') {
8314
- bailOutIndex = currentIndex;
8315
- bailOut = true;
8316
- } else {
8317
- resolvedArgs.push(resolved);
8318
- }
8319
- break;
8320
- }
8321
- case 'ConditionalExpression':
8322
- {
8323
- const {
8324
- test,
8325
- consequent,
8326
- alternate
8327
- } = arg;
8328
- const primary = parseNullableStyle(consequent, state);
8329
- const fallback = parseNullableStyle(alternate, state);
8330
- if (primary === 'other' || fallback === 'other') {
8331
- bailOutIndex = currentIndex;
8332
- bailOut = true;
8333
- } else {
8334
- resolvedArgs.push([test, primary, fallback]);
8335
- conditional++;
8336
- }
8337
- break;
8338
- }
8339
- case 'LogicalExpression':
8340
- {
8341
- if (arg.operator !== '&&') {
8342
- bailOutIndex = currentIndex;
8343
- bailOut = true;
8344
- break;
8345
- }
8346
- const {
8347
- left,
8348
- right
8349
- } = arg;
8350
- const leftResolved = parseNullableStyle(left, state);
8351
- const rightResolved = parseNullableStyle(right, state);
8352
- if (leftResolved !== 'other' || rightResolved === 'other') {
8353
- bailOutIndex = currentIndex;
8354
- bailOut = true;
8355
- } else {
8356
- resolvedArgs.push([left, rightResolved, null]);
8357
- conditional++;
8358
- }
8359
- break;
8360
- }
8361
- default:
7356
+ if (argPath.isObjectExpression() || argPath.isIdentifier() || argPath.isMemberExpression()) {
7357
+ const resolved = parseNullableStyle(argPath, state, evaluatePathFnConfig);
7358
+ if (resolved === 'other') {
7359
+ bailOutIndex = currentIndex;
7360
+ bailOut = true;
7361
+ } else {
7362
+ resolvedArgs.push(resolved);
7363
+ }
7364
+ } else if (argPath.isConditionalExpression()) {
7365
+ const arg = argPath.node;
7366
+ const {
7367
+ test
7368
+ } = arg;
7369
+ const consequentPath = argPath.get('consequent');
7370
+ const alternatePath = argPath.get('alternate');
7371
+ const primary = parseNullableStyle(consequentPath, state, evaluatePathFnConfig);
7372
+ const fallback = parseNullableStyle(alternatePath, state, evaluatePathFnConfig);
7373
+ if (primary === 'other' || fallback === 'other') {
7374
+ bailOutIndex = currentIndex;
7375
+ bailOut = true;
7376
+ } else {
7377
+ resolvedArgs.push(new ConditionalStyle(test, primary, fallback));
7378
+ conditional++;
7379
+ }
7380
+ } else if (argPath.isLogicalExpression()) {
7381
+ const arg = argPath.node;
7382
+ if (arg.operator !== '&&') {
8362
7383
  bailOutIndex = currentIndex;
8363
7384
  bailOut = true;
8364
7385
  break;
7386
+ }
7387
+ const leftPath = argPath.get('left');
7388
+ const rightPath = argPath.get('right');
7389
+ const leftResolved = parseNullableStyle(leftPath, state, evaluatePathFnConfig);
7390
+ const rightResolved = parseNullableStyle(rightPath, state, evaluatePathFnConfig);
7391
+ if (leftResolved !== 'other' || rightResolved === 'other') {
7392
+ bailOutIndex = currentIndex;
7393
+ bailOut = true;
7394
+ } else {
7395
+ resolvedArgs.push(new ConditionalStyle(leftPath.node, rightResolved, null));
7396
+ conditional++;
7397
+ }
7398
+ } else {
7399
+ bailOutIndex = currentIndex;
7400
+ bailOut = true;
8365
7401
  }
8366
7402
  if (conditional > 4) {
8367
7403
  bailOut = true;
@@ -8406,7 +7442,7 @@ function transformStylexProps(path, state) {
8406
7442
  confident,
8407
7443
  value: styleValue
8408
7444
  } = evaluate(path, state, evaluatePathFnConfig);
8409
- if (!confident || styleValue == null) {
7445
+ if (!confident || styleValue == null || styleValue.__IS_PROXY === true) {
8410
7446
  nonNullProps = true;
8411
7447
  styleNonNullProps = true;
8412
7448
  } else {
@@ -8457,7 +7493,8 @@ function transformStylexProps(path, state) {
8457
7493
  path.replaceWith(stringExpression);
8458
7494
  }
8459
7495
  }
8460
- function parseNullableStyle(node, state) {
7496
+ function parseNullableStyle(path, state, evaluatePathFnConfig) {
7497
+ const node = path.node;
8461
7498
  if (t__namespace.isNullLiteral(node) || t__namespace.isIdentifier(node) && node.name === 'undefined') {
8462
7499
  return null;
8463
7500
  }
@@ -8484,10 +7521,17 @@ function parseNullableStyle(node, state) {
8484
7521
  }
8485
7522
  }
8486
7523
  }
7524
+ const parsedObj = evaluate(path, state, evaluatePathFnConfig);
7525
+ if (parsedObj.confident && parsedObj.value != null && typeof parsedObj.value === 'object') {
7526
+ if (parsedObj.value.__IS_PROXY === true) {
7527
+ return 'other';
7528
+ }
7529
+ return parsedObj.value;
7530
+ }
8487
7531
  return 'other';
8488
7532
  }
8489
7533
  function makeStringExpression(values) {
8490
- const conditions = values.filter(v => Array.isArray(v)).map(v => v[0]);
7534
+ const conditions = values.filter(v => v instanceof ConditionalStyle).map(v => v.test);
8491
7535
  if (conditions.length === 0) {
8492
7536
  const result = stylex.props(values);
8493
7537
  return convertObjectToAST(result);
@@ -8496,8 +7540,11 @@ function makeStringExpression(values) {
8496
7540
  const objEntries = conditionPermutations.map(permutation => {
8497
7541
  let i = 0;
8498
7542
  const args = values.map(v => {
8499
- if (Array.isArray(v)) {
8500
- const [_test, primary, fallback] = v;
7543
+ if (v instanceof ConditionalStyle) {
7544
+ const {
7545
+ primary,
7546
+ fallback
7547
+ } = v;
8501
7548
  return permutation[i++] ? primary : fallback;
8502
7549
  } else {
8503
7550
  return v;
@@ -8686,6 +7733,56 @@ function transformStyleXDefaultMarker(path, state) {
8686
7733
  }
8687
7734
  }
8688
7735
 
7736
+ function transformStyleXDefineMarker(path, state) {
7737
+ const {
7738
+ node
7739
+ } = path;
7740
+ if (node.type !== 'CallExpression') {
7741
+ return;
7742
+ }
7743
+ const isDefineMarkerCall = node.callee.type === 'Identifier' && state.stylexDefineMarkerImport.has(node.callee.name) || node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'defineMarker' && state.stylexImport.has(node.callee.object.name);
7744
+ if (!isDefineMarkerCall) {
7745
+ return;
7746
+ }
7747
+ validateStyleXDefineMarker(path);
7748
+ const variableDeclaratorPath = path.parentPath;
7749
+ if (!variableDeclaratorPath.isVariableDeclarator()) {
7750
+ return;
7751
+ }
7752
+ const variableDeclaratorNode = variableDeclaratorPath.node;
7753
+ if (variableDeclaratorNode.id.type !== 'Identifier') {
7754
+ return;
7755
+ }
7756
+ if (node.arguments.length !== 0) {
7757
+ throw path.buildCodeFrameError(illegalArgumentLength('defineMarker', 0), SyntaxError);
7758
+ }
7759
+ const fileName = state.fileNameForHashing;
7760
+ if (fileName == null) {
7761
+ throw new Error(cannotGenerateHash('defineMarker'));
7762
+ }
7763
+ const exportName = variableDeclaratorNode.id.name;
7764
+ const exportId = utils.genFileBasedIdentifier({
7765
+ fileName,
7766
+ exportName
7767
+ });
7768
+ const id = state.options.classNamePrefix + utils.hash(exportId);
7769
+ const markerObj = {
7770
+ [id]: id,
7771
+ $$css: true
7772
+ };
7773
+ path.replaceWith(convertObjectToAST(markerObj));
7774
+ }
7775
+ function validateStyleXDefineMarker(path) {
7776
+ const variableDeclaratorPath = path.parentPath;
7777
+ const exportNamedDeclarationPath = variableDeclaratorPath.parentPath?.parentPath;
7778
+ if (variableDeclaratorPath == null || variableDeclaratorPath.isExpressionStatement() || !variableDeclaratorPath.isVariableDeclarator() || variableDeclaratorPath.node.id.type !== 'Identifier') {
7779
+ throw path.buildCodeFrameError(unboundCallValue('defineMarker'), SyntaxError);
7780
+ }
7781
+ if (exportNamedDeclarationPath == null || !exportNamedDeclarationPath.isExportNamedDeclaration()) {
7782
+ throw path.buildCodeFrameError(nonExportNamedDeclaration('defineMarker'), SyntaxError);
7783
+ }
7784
+ }
7785
+
8689
7786
  const NAME = 'stylex';
8690
7787
  function styleXTransform() {
8691
7788
  let state;
@@ -8843,6 +7940,7 @@ function styleXTransform() {
8843
7940
  transformStyleXPositionTry(parentPath, state);
8844
7941
  }
8845
7942
  transformStyleXDefaultMarker(path, state);
7943
+ transformStyleXDefineMarker(path, state);
8846
7944
  transformStyleXDefineVars(path, state);
8847
7945
  transformStyleXDefineConsts(path, state);
8848
7946
  transformStyleXCreateTheme(path, state);
@@ -8864,6 +7962,25 @@ function isExported(path) {
8864
7962
  }
8865
7963
  return isExported(path.parentPath);
8866
7964
  }
7965
+ function getLogicalFloatVars(rules) {
7966
+ const hasLogicalFloat = rules.some(([, {
7967
+ ltr,
7968
+ rtl
7969
+ }]) => {
7970
+ const ltrStr = String(ltr);
7971
+ const rtlStr = rtl ? String(rtl) : '';
7972
+ return ltrStr.includes(LOGICAL_FLOAT_START_VAR) || ltrStr.includes(LOGICAL_FLOAT_END_VAR) || rtlStr.includes(LOGICAL_FLOAT_START_VAR) || rtlStr.includes(LOGICAL_FLOAT_END_VAR);
7973
+ });
7974
+ return hasLogicalFloat ? `:root, [dir="ltr"] {
7975
+ ${LOGICAL_FLOAT_START_VAR}: left;
7976
+ ${LOGICAL_FLOAT_END_VAR}: right;
7977
+ }
7978
+ [dir="rtl"] {
7979
+ ${LOGICAL_FLOAT_START_VAR}: right;
7980
+ ${LOGICAL_FLOAT_END_VAR}: left;
7981
+ }
7982
+ ` : '';
7983
+ }
8867
7984
  function processStylexRules(rules, config) {
8868
7985
  const {
8869
7986
  useLayers = false,
@@ -8961,6 +8078,7 @@ function processStylexRules(rules, config) {
8961
8078
  acc.push([[key, styleObj, priority]]);
8962
8079
  return acc;
8963
8080
  }, []);
8081
+ const logicalFloatVars = getLogicalFloatVars(nonConstantRules);
8964
8082
  const header = useLayers ? '\n@layer ' + grouped.map((_, index) => `priority${index + 1}`).join(', ') + ';\n' : '';
8965
8083
  const collectedCSS = grouped.map((group, index) => {
8966
8084
  const pri = group[0][2];
@@ -8983,7 +8101,7 @@ function processStylexRules(rules, config) {
8983
8101
  }).join('\n');
8984
8102
  return useLayers && pri > 0 ? `@layer priority${index + 1}{\n${collectedCSS}\n}` : collectedCSS;
8985
8103
  }).join('\n');
8986
- return header + collectedCSS;
8104
+ return logicalFloatVars + header + collectedCSS;
8987
8105
  }
8988
8106
  styleXTransform.processStylexRules = processStylexRules;
8989
8107
  function addAncestorSelector(selector, ancestorSelector) {