@stylexjs/babel-plugin 0.2.0-beta.8 → 0.2.0-beta.9

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 (3) hide show
  1. package/README.md +35 -0
  2. package/lib/index.js +824 -475
  3. package/package.json +3 -2
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@ var t = require('@babel/types');
6
6
  var require$$0 = require('postcss-value-parser');
7
7
  var path = require('path');
8
8
  var require$$0$1 = require('invariant');
9
+ var require$$1 = require('styleq');
9
10
 
10
11
  function _interopNamespaceDefault(e) {
11
12
  var n = Object.create(null);
@@ -73,7 +74,7 @@ class StateManager {
73
74
  importSources: options.importSources ?? [name, 'stylex'],
74
75
  definedStylexCSSVariables: options.definedStylexCSSVariables ?? {},
75
76
  genConditionalClasses: !!options.genConditionalClasses,
76
- allowUnsafeProperties: !!options.allowUnsafeProperties
77
+ skipShorthandExpansion: !!options.skipShorthandExpansion
77
78
  };
78
79
  return this._state.opts;
79
80
  }
@@ -257,8 +258,8 @@ function murmurhash2_32_gc(str, seed) {
257
258
  return h >>> 0;
258
259
  }
259
260
  const hash = str => murmurhash2_32_gc(str, 1).toString(36);
260
- var _default$1 = hash;
261
- hash$1.default = _default$1;
261
+ var _default$4 = hash;
262
+ hash$1.default = _default$4;
262
263
 
263
264
  var dashify$1 = {};
264
265
 
@@ -330,8 +331,8 @@ Object.defineProperty(leadingZero, "__esModule", {
330
331
  value: true
331
332
  });
332
333
  leadingZero.default = normalizeLeadingZero;
333
- var _postcssValueParser$5 = _interopRequireDefault$d(require$$0);
334
- function _interopRequireDefault$d(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
334
+ var _postcssValueParser$5 = _interopRequireDefault$h(require$$0);
335
+ function _interopRequireDefault$h(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
335
336
  /**
336
337
  * Remove leading zeros from numbers
337
338
  */
@@ -399,8 +400,8 @@ Object.defineProperty(timings$1, "__esModule", {
399
400
  value: true
400
401
  });
401
402
  timings$1.default = normalizeTimings;
402
- var _postcssValueParser$4 = _interopRequireDefault$c(require$$0);
403
- function _interopRequireDefault$c(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
403
+ var _postcssValueParser$4 = _interopRequireDefault$g(require$$0);
404
+ function _interopRequireDefault$g(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
404
405
  /**
405
406
  * Turn millisecond values to seconds (shorter), except when < 10ms
406
407
  */
@@ -494,8 +495,8 @@ Object.defineProperty(zeroDimensions, "__esModule", {
494
495
  value: true
495
496
  });
496
497
  zeroDimensions.default = normalizeZeroDimensions;
497
- var _postcssValueParser$3 = _interopRequireDefault$b(require$$0);
498
- function _interopRequireDefault$b(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
498
+ var _postcssValueParser$3 = _interopRequireDefault$f(require$$0);
499
+ function _interopRequireDefault$f(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
499
500
  const angles = ['deg', 'grad', 'turn', 'rad'];
500
501
  const timings = ['ms', 's'];
501
502
 
@@ -541,7 +542,7 @@ var messages$4 = {};
541
542
  Object.defineProperty(messages$4, "__esModule", {
542
543
  value: true
543
544
  });
544
- messages$4.UNKNOWN_PROP_KEY = messages$4.UNKNOWN_NAMESPACE = messages$4.UNEXPECTED_ARGUMENT = messages$4.UNBOUND_STYLEX_CALL_VALUE = messages$4.ONLY_TOP_LEVEL = messages$4.NO_PARENT_PATH = messages$4.NO_CONDITIONAL_SHORTHAND = messages$4.NON_STATIC_VALUE = messages$4.NON_OBJECT_FOR_STYLEX_CALL = messages$4.MULTIPLE_DIRECTIONS_IN_SHORTHAND = messages$4.LOCAL_ONLY = messages$4.LINT_UNCLOSED_FUNCTION = messages$4.INVALID_SPREAD = messages$4.INVALID_PSEUDO = messages$4.ILLEGAL_PROP_VALUE = messages$4.ILLEGAL_PROP_ARRAY_VALUE = messages$4.ILLEGAL_NESTED_PSEUDO = messages$4.ILLEGAL_NAMESPACE_VALUE = messages$4.ILLEGAL_NAMESPACE_TYPE = messages$4.ILLEGAL_ARGUMENT_LENGTH = messages$4.EXPECTED_FUNCTION_CALL = messages$4.ESCAPED_STYLEX_VALUE = void 0;
545
+ messages$4.UNKNOWN_PROP_KEY = messages$4.UNKNOWN_NAMESPACE = messages$4.UNEXPECTED_ARGUMENT = messages$4.UNBOUND_STYLEX_CALL_VALUE = messages$4.ONLY_TOP_LEVEL = messages$4.NO_PARENT_PATH = messages$4.NO_CONDITIONAL_SHORTHAND = messages$4.NON_STATIC_VALUE = messages$4.NON_OBJECT_FOR_STYLEX_CALL = messages$4.LOCAL_ONLY = messages$4.LINT_UNCLOSED_FUNCTION = messages$4.INVALID_SPREAD = messages$4.INVALID_PSEUDO = messages$4.ILLEGAL_PROP_VALUE = messages$4.ILLEGAL_PROP_ARRAY_VALUE = messages$4.ILLEGAL_NESTED_PSEUDO = messages$4.ILLEGAL_NAMESPACE_VALUE = messages$4.ILLEGAL_NAMESPACE_TYPE = messages$4.ILLEGAL_ARGUMENT_LENGTH = messages$4.EXPECTED_FUNCTION_CALL = messages$4.ESCAPED_STYLEX_VALUE = void 0;
545
546
  const ILLEGAL_ARGUMENT_LENGTH = 'stylex() should have 1 argument.';
546
547
  messages$4.ILLEGAL_ARGUMENT_LENGTH = ILLEGAL_ARGUMENT_LENGTH;
547
548
  const NON_STATIC_VALUE = 'Only static values are allowed inside of a stylex.create() call.';
@@ -564,7 +565,7 @@ const ILLEGAL_NAMESPACE_TYPE = 'Only a string literal namespace is allowed here.
564
565
  messages$4.ILLEGAL_NAMESPACE_TYPE = ILLEGAL_NAMESPACE_TYPE;
565
566
  const UNKNOWN_NAMESPACE = 'Unknown namespace';
566
567
  messages$4.UNKNOWN_NAMESPACE = UNKNOWN_NAMESPACE;
567
- const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested.";
568
+ const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
568
569
  messages$4.ILLEGAL_NESTED_PSEUDO = ILLEGAL_NESTED_PSEUDO;
569
570
  const ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
570
571
  messages$4.ILLEGAL_PROP_VALUE = ILLEGAL_PROP_VALUE;
@@ -584,8 +585,6 @@ const EXPECTED_FUNCTION_CALL = 'Expected a simple function call but found someth
584
585
  messages$4.EXPECTED_FUNCTION_CALL = EXPECTED_FUNCTION_CALL;
585
586
  const NO_PARENT_PATH = 'Unexpected AST node without a parent path.';
586
587
  messages$4.NO_PARENT_PATH = NO_PARENT_PATH;
587
- const MULTIPLE_DIRECTIONS_IN_SHORTHAND = 'Shorthand properties cannot contain different values for different directions.';
588
- messages$4.MULTIPLE_DIRECTIONS_IN_SHORTHAND = MULTIPLE_DIRECTIONS_IN_SHORTHAND;
589
588
 
590
589
  /**
591
590
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -600,9 +599,9 @@ Object.defineProperty(detectUnclosedFns$1, "__esModule", {
600
599
  value: true
601
600
  });
602
601
  detectUnclosedFns$1.default = detectUnclosedFns;
603
- var messages$3 = _interopRequireWildcard$4(messages$4);
604
- function _getRequireWildcardCache$4(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$4 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
605
- function _interopRequireWildcard$4(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$4(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
602
+ var messages$3 = _interopRequireWildcard$3(messages$4);
603
+ function _getRequireWildcardCache$3(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$3 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
604
+ function _interopRequireWildcard$3(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$3(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
606
605
  /**
607
606
  * Remove leading zeros from numbers
608
607
  */
@@ -629,19 +628,22 @@ Object.defineProperty(normalizeValue$1, "__esModule", {
629
628
  value: true
630
629
  });
631
630
  normalizeValue$1.default = normalizeValue;
632
- var _fontSizePxToRem = _interopRequireDefault$a(fontSizePxToRem);
633
- var _leadingZero = _interopRequireDefault$a(leadingZero);
634
- var _quotes = _interopRequireDefault$a(quotes);
635
- var _timings = _interopRequireDefault$a(timings$1);
636
- var _whitespace = _interopRequireDefault$a(whitespace);
637
- var _zeroDimensions = _interopRequireDefault$a(zeroDimensions);
638
- var _detectUnclosedFns = _interopRequireDefault$a(detectUnclosedFns$1);
639
- var _postcssValueParser$2 = _interopRequireDefault$a(require$$0);
640
- function _interopRequireDefault$a(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
631
+ var _fontSizePxToRem = _interopRequireDefault$e(fontSizePxToRem);
632
+ var _leadingZero = _interopRequireDefault$e(leadingZero);
633
+ var _quotes = _interopRequireDefault$e(quotes);
634
+ var _timings = _interopRequireDefault$e(timings$1);
635
+ var _whitespace = _interopRequireDefault$e(whitespace);
636
+ var _zeroDimensions = _interopRequireDefault$e(zeroDimensions);
637
+ var _detectUnclosedFns = _interopRequireDefault$e(detectUnclosedFns$1);
638
+ var _postcssValueParser$2 = _interopRequireDefault$e(require$$0);
639
+ function _interopRequireDefault$e(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
641
640
  // `Timings` should be before `LeadingZero`, because it
642
641
  // changes 500ms to 0.5s, then `LeadingZero` makes it .5s
643
642
  const normalizers = [_detectUnclosedFns.default, _whitespace.default, _timings.default, _zeroDimensions.default, _leadingZero.default, _quotes.default, _fontSizePxToRem.default];
644
643
  function normalizeValue(value, key) {
644
+ if (value == null) {
645
+ return value;
646
+ }
645
647
  const parsedAST = (0, _postcssValueParser$2.default)(value);
646
648
  return normalizers.reduce((ast, fn) => fn(ast, key), parsedAST).toString();
647
649
  }
@@ -650,8 +652,8 @@ Object.defineProperty(transformValue$1, "__esModule", {
650
652
  value: true
651
653
  });
652
654
  transformValue$1.default = transformValue;
653
- var _normalizeValue = _interopRequireDefault$9(normalizeValue$1);
654
- function _interopRequireDefault$9(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
655
+ var _normalizeValue = _interopRequireDefault$d(normalizeValue$1);
656
+ function _interopRequireDefault$d(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
655
657
  /**
656
658
  * Copyright (c) Meta Platforms, Inc. and affiliates.
657
659
  *
@@ -847,8 +849,8 @@ Object.defineProperty(generateRtl, "__esModule", {
847
849
  value: true
848
850
  });
849
851
  generateRtl.default = generateRTL;
850
- var _postcssValueParser$1 = _interopRequireDefault$8(require$$0);
851
- function _interopRequireDefault$8(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
852
+ var _postcssValueParser$1 = _interopRequireDefault$c(require$$0);
853
+ function _interopRequireDefault$c(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
852
854
  /**
853
855
  * Copyright (c) Meta Platforms, Inc. and affiliates.
854
856
  *
@@ -1083,14 +1085,132 @@ function generateCSSRule$1(className, decls, pseudo) {
1083
1085
  }
1084
1086
  const THUMB_VARIANTS = ['::-webkit-slider-thumb', '::-moz-range-thumb', '::-ms-thumb'];
1085
1087
 
1088
+ var propertyPriorities = {};
1089
+
1090
+ Object.defineProperty(propertyPriorities, "__esModule", {
1091
+ value: true
1092
+ });
1093
+ propertyPriorities.default = getPriority;
1094
+ /**
1095
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1096
+ *
1097
+ * This source code is licensed under the MIT license found in the
1098
+ * LICENSE file in the root directory of this source tree.
1099
+ *
1100
+ *
1101
+ */
1102
+
1103
+ const PRIORITIES = {
1104
+ // These should never exist at runtime:
1105
+ border: 1,
1106
+ 'border-block-end': 2,
1107
+ 'border-block-start': 2,
1108
+ 'border-top': 2.1,
1109
+ 'border-bottom': 2.1,
1110
+ 'border-inline-end': 2,
1111
+ 'border-inline-start': 2,
1112
+ 'border-left': 2,
1113
+ 'border-right': 2,
1114
+ // End of never-exist-at-runtime properties.
1115
+
1116
+ // These are shorthands of shorthands:
1117
+ grid: 2,
1118
+ 'grid-area': 2,
1119
+ // These are shorthands of final properties:
1120
+ 'border-color': 3,
1121
+ 'border-style': 3,
1122
+ 'border-width': 3,
1123
+ 'border-image': 3,
1124
+ 'border-radius': 3,
1125
+ animation: 3,
1126
+ background: 3,
1127
+ 'column-rule': 3,
1128
+ columns: 3,
1129
+ flex: 3,
1130
+ 'flex-flow': 3,
1131
+ font: 3,
1132
+ gap: 3,
1133
+ 'grid-column': 3,
1134
+ 'grid-row': 3,
1135
+ 'grid-template': 3,
1136
+ 'list-style': 3,
1137
+ margin: 3,
1138
+ mask: 3,
1139
+ offset: 3,
1140
+ outline: 3,
1141
+ overflow: 3,
1142
+ padding: 3,
1143
+ 'place-content': 3,
1144
+ 'place-items': 3,
1145
+ 'place-self': 3,
1146
+ 'scroll-margin': 3,
1147
+ 'scroll-padding': 3,
1148
+ 'text-decoration': 3,
1149
+ 'text-emphasis': 3,
1150
+ transition: 3,
1151
+ ':has': 4.5,
1152
+ ':dir': 5,
1153
+ ':lang': 5.1,
1154
+ ':first-child': 5.2,
1155
+ ':last-child': 5.3,
1156
+ ':only-child': 5.4,
1157
+ ':nth-child': 6,
1158
+ ':nth-of-type': 6.1,
1159
+ ':only-of-type': 6.2,
1160
+ ':empty': 7,
1161
+ ':link': 8,
1162
+ ':any-link': 8.1,
1163
+ ':target': 8.2,
1164
+ ':visited': 8.3,
1165
+ ':enabled': 9.1,
1166
+ ':disabled': 9.2,
1167
+ ':required': 9.3,
1168
+ ':optional': 9.4,
1169
+ ':read-only': 9.5,
1170
+ ':read-write': 9.6,
1171
+ ':placeholder-shown': 9.7,
1172
+ ':default': 10,
1173
+ ':checked': 10.1,
1174
+ ':indeterminate': 10.1,
1175
+ ':blank': 10.2,
1176
+ ':valid': 10.3,
1177
+ ':invalid': 10.4,
1178
+ ':autofill': 11,
1179
+ ':picture-in-picture': 12,
1180
+ ':fullscreen': 12.1,
1181
+ ':paused': 12.2,
1182
+ ':playing': 12.3,
1183
+ ':hover': 13,
1184
+ ':focusWithin': 14,
1185
+ ':focusVisible': 15,
1186
+ ':focus': 16,
1187
+ ':active': 17
1188
+ };
1189
+ function getPriority(key) {
1190
+ if (key.startsWith('@supports')) {
1191
+ return 20;
1192
+ }
1193
+ if (key.startsWith('@media')) {
1194
+ return 21;
1195
+ }
1196
+ const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
1197
+ let priority = PRIORITIES[prop] ?? 4;
1198
+ if (key.toLowerCase().includes('left') || key.toLowerCase().includes('right')) {
1199
+ // Bump priority for physical left/right values.
1200
+ priority += 0.1;
1201
+ }
1202
+ return priority;
1203
+ }
1204
+
1086
1205
  Object.defineProperty(generateCssRule, "__esModule", {
1087
1206
  value: true
1088
1207
  });
1089
1208
  generateCssRule.default = generateCSSRule;
1090
- var _generateLtr$1 = _interopRequireDefault$7(generateLtr);
1091
- var _generateRtl$1 = _interopRequireDefault$7(generateRtl);
1092
- var _genCSSRule = _interopRequireDefault$7(genCSSRule);
1093
- function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1209
+ var _generateLtr$1 = _interopRequireDefault$b(generateLtr);
1210
+ var _generateRtl$1 = _interopRequireDefault$b(generateRtl);
1211
+ var _genCSSRule = _interopRequireDefault$b(genCSSRule);
1212
+ var _propertyPriorities = _interopRequireDefault$b(propertyPriorities);
1213
+ function _interopRequireDefault$b(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1094
1214
  /**
1095
1215
  * Copyright (c) Meta Platforms, Inc. and affiliates.
1096
1216
  *
@@ -1100,61 +1220,32 @@ function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : {
1100
1220
  *
1101
1221
  */
1102
1222
 
1103
- function generateCSSRule(className, key, value, pseudo) {
1223
+ function generateCSSRule(className, key,
1224
+ // pre-dashed
1225
+ value, pseudo) {
1104
1226
  const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
1105
1227
  const ltrPairs = pairs.map(_generateLtr$1.default);
1106
1228
  const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
1107
1229
  const rtlDecls = pairs.map(_generateRtl$1.default).filter(Boolean).map(pair => pair.join(':')).join(';');
1108
1230
  const ltrRule = (0, _genCSSRule.default)(className, ltrDecls, pseudo);
1109
1231
  const rtlRule = !rtlDecls ? null : (0, _genCSSRule.default)(className, rtlDecls, pseudo);
1110
- let priority = 1;
1111
- if (pseudo != null) {
1112
- if (pseudo[0] === '@') {
1113
- priority = 2;
1114
- } else if (pseudo[0] === ':') {
1115
- priority = pseudoPriorities[pseudo] ?? 2;
1116
- if (pseudo.startsWith(':nth-child')) {
1117
- priority = 6;
1118
- }
1119
- if (pseudo.startsWith(':nth-of-type')) {
1120
- priority = 7;
1121
- }
1122
- }
1123
- }
1124
- if (key.toLowerCase().includes('left') || key.toLowerCase().includes('right')) {
1125
- // Bump priority for physical left/right values.
1126
- priority += 0.1;
1127
- }
1232
+ const priority = (0, _propertyPriorities.default)(key) + (pseudo ? (0, _propertyPriorities.default)(pseudo) : 0);
1128
1233
  return {
1129
1234
  priority,
1130
1235
  ltr: ltrRule,
1131
1236
  rtl: rtlRule
1132
1237
  };
1133
1238
  }
1134
- const pseudoPriorities = {
1135
- // Might become unsupported:
1136
- ':first-child': 3,
1137
- ':last-child': 4,
1138
- ':only-child': 5,
1139
- ':nth-child': 6,
1140
- ':nth-of-type': 7,
1141
- ':hover': 8,
1142
- ':focus': 9,
1143
- ':active': 10,
1144
- ':disabled': 11,
1145
- '::placeholder': 12,
1146
- '::thumb': 13
1147
- };
1148
1239
 
1149
1240
  Object.defineProperty(convertToClassName$1, "__esModule", {
1150
1241
  value: true
1151
1242
  });
1152
1243
  convertToClassName$1.default = convertToClassName;
1153
- var _hash$1 = _interopRequireDefault$6(hash$1);
1154
- var _dashify$1 = _interopRequireDefault$6(dashify$1);
1155
- var _transformValue$1 = _interopRequireDefault$6(transformValue$1);
1156
- var _generateCssRule = _interopRequireDefault$6(generateCssRule);
1157
- function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1244
+ var _hash$1 = _interopRequireDefault$a(hash$1);
1245
+ var _dashify$1 = _interopRequireDefault$a(dashify$1);
1246
+ var _transformValue$1 = _interopRequireDefault$a(transformValue$1);
1247
+ var _generateCssRule = _interopRequireDefault$a(generateCssRule);
1248
+ function _interopRequireDefault$a(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1158
1249
  /**
1159
1250
  * Copyright (c) Meta Platforms, Inc. and affiliates.
1160
1251
  *
@@ -1185,19 +1276,18 @@ function convertToClassName(objEntry, pseudo) {
1185
1276
  return [key, className, cssRules];
1186
1277
  }
1187
1278
 
1188
- var expandShorthands = {};
1279
+ var preprocessRules = {};
1280
+
1281
+ var applicationOrder = {};
1282
+
1283
+ var splitCssValue = {};
1189
1284
 
1190
- Object.defineProperty(expandShorthands, "__esModule", {
1285
+ Object.defineProperty(splitCssValue, "__esModule", {
1191
1286
  value: true
1192
1287
  });
1193
- expandShorthands.BANNED_PROPERTIES = void 0;
1194
- expandShorthands.default = flatMapExpandedShorthands;
1195
- expandShorthands.expandedKeys = void 0;
1196
- _interopRequireWildcard$3(messages$4);
1197
- var _postcssValueParser = _interopRequireDefault$5(require$$0);
1198
- function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1199
- function _getRequireWildcardCache$3(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$3 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
1200
- function _interopRequireWildcard$3(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$3(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1288
+ splitCssValue.default = splitValue;
1289
+ var _postcssValueParser = _interopRequireDefault$9(require$$0);
1290
+ function _interopRequireDefault$9(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1201
1291
  /**
1202
1292
  * Copyright (c) Meta Platforms, Inc. and affiliates.
1203
1293
  *
@@ -1205,6 +1295,7 @@ function _interopRequireWildcard$3(obj, nodeInterop) { if (!nodeInterop && obj &
1205
1295
  * LICENSE file in the root directory of this source tree.
1206
1296
  *
1207
1297
  *
1298
+ *
1208
1299
  */
1209
1300
 
1210
1301
  function printNode(node) {
@@ -1221,6 +1312,11 @@ function printNode(node) {
1221
1312
 
1222
1313
  // Using split(' ') Isn't enough bcause of values like calc.
1223
1314
  function splitValue(str) {
1315
+ if (str == null || typeof str === 'number') {
1316
+ return [str];
1317
+ }
1318
+
1319
+ // This will never happen, but keeping here for Flow.
1224
1320
  if (Array.isArray(str)) {
1225
1321
  return str;
1226
1322
  }
@@ -1232,283 +1328,408 @@ function splitValue(str) {
1232
1328
  return nodes;
1233
1329
  }
1234
1330
 
1235
- // TODO: to be added later.
1236
- // const aliases = {
1237
- // marginInlineStart: (rawValue) => [['marginStart', rawValue]],
1238
- // marginInlineEnd: (rawValue) => [['marginEnd', rawValue]],
1239
- // marginInline: (rawValue) => [
1240
- // ['marginStart', rawValue],
1241
- // ['marginEnd', rawValue],
1242
- // ],
1243
- // paddingInlineStart: (rawValue) => [['paddingStart', rawValue]],
1244
- // paddingInlineEnd: (rawValue) => [['paddingEnd', rawValue]],
1245
- // paddingInline: (rawValue) => [
1246
- // ['paddingStart', rawValue],
1247
- // ['paddingEnd', rawValue],
1248
- // ],
1249
- // // 'borderInlineStart': (rawValue) => [['borderStart', rawValue]],
1250
- // // 'borderInlineEnd': (rawValue) => [['borderEnd', rawValue]],
1251
- // // // This will need to change.
1252
- // // 'borderInline': (rawValue) => [
1253
- // // ['borderStart', rawValue],
1254
- // // ['borderEnd', rawValue],
1255
- // // ],
1256
- // };
1257
-
1331
+ Object.defineProperty(applicationOrder, "__esModule", {
1332
+ value: true
1333
+ });
1334
+ applicationOrder.default = void 0;
1335
+ var _splitCssValue$2 = _interopRequireDefault$8(splitCssValue);
1336
+ function _interopRequireDefault$8(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1258
1337
  /**
1259
- * Shorthand properties:
1260
- * - [!] all - BANNED
1261
- * - [!] animation - BANNED
1262
- * - [!] background - BANNED
1263
- * - [x] border - adequate for now
1264
- * - [ ] border-block-end
1265
- * - [ ] border-block-start
1266
- * - [x] border-bottom
1267
- * - [x] border-color
1268
- * - [o] border-image - Only the shorthand is allowed.
1269
- * - [ ] border-inline-end
1270
- * - [ ] border-inline-start
1271
- * - [!] border-left - BANNED
1272
- * - [x] border-radius
1273
- * - [!] border-right
1274
- * - [x] border-style
1275
- * - [ ] border-top
1276
- * - [x] border-width
1277
- * - [o] column-rule - Only the shorthand is allowed.
1278
- * - [!] columns - BANNED
1279
- * - [!] flex - BANNED
1280
- * - [!] flex-flow - BANNED
1281
- * - [!] font - BANNED
1282
- * - [x] gap
1283
- * - [!] grid - BANNED
1284
- * - [!] grid-area - BANNED
1285
- * - [!] grid-column - BANNED
1286
- * - [!] grid-row - BANNED
1287
- * - [!] grid-template - BANNED
1288
- * - [!] grid-template-areas - BANNED
1289
- *
1290
- * - [o] list-style - Only the shorthand is allowed.
1291
- * - [x] margin
1292
- * - [o] mask - Only the shorthand is allowed.
1293
- * - [o] offset - Only the shorthand is allowed.
1294
- * - [o] outline - Only the shorthand is allowed.
1295
- * - [x] overflow
1296
- * - [x] padding
1297
- * - [x] place-content
1298
- * - [x] place-items
1299
- * - [x] place-self
1300
- * - [X] scroll-margin
1301
- * - [x] scroll-padding
1302
- * - [o] text-decoration - Only the shorthand is allowed.
1303
- * - [o] text-emphasis - Only the shorthand is allowed.
1304
- * - [!] transition - BANNED
1338
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1339
+ *
1340
+ * This source code is licensed under the MIT license found in the
1341
+ * LICENSE file in the root directory of this source tree.
1342
+ *
1343
+ *
1305
1344
  */
1306
1345
 
1307
- const BANNED_PROPERTIES = {
1308
- all: '`all` is not supported. Use individual properties instead.',
1309
- animation: '`animation` is not supported. Use individual properties like `animationName`, `animationDuration`, etc. instead.',
1310
- background: '`background` is not supported. Use individual properties like `backgroundImage`, `backgroundPosition`, etc. instead.',
1311
- borderColor: '`borderColor` is not supported. Use `border`, `borderTop`, `borderEnd`, `borderBottom` or `borderStart` instead.',
1312
- borderStyle: '`borderStyle` is not supported. Use `border`, `borderTop`, `borderEnd`, `borderBottom` or `borderStart` instead.',
1313
- borderWidth: '`borderWidth` is not supported. Use `border`, `borderTop`, `borderEnd`, `borderBottom` or `borderStart` instead.',
1314
- borderTopColor: '`borderTopColor` is not supported. Use `borderTop` instead.',
1315
- borderTopStyle: '`borderTopStyle` is not supported. Use `borderTop` instead.',
1316
- borderTopWidth: '`borderTopWidth` is not supported. Use `borderTop` instead.',
1317
- borderEndColor: '`borderEndColor` is not supported. Use `borderEnd` instead.',
1318
- borderEndStyle: '`borderEndStyle` is not supported. Use `borderEnd` instead.',
1319
- borderEndWidth: '`borderEndWidth` is not supported. Use `borderEnd` instead.',
1320
- borderBottomColor: '`borderBottomColor` is not supported. Use `borderBottom` instead.',
1321
- borderBottomStyle: '`borderBottomStyle` is not supported. Use `borderBottom` instead.',
1322
- borderBottomWidth: '`borderBottomWidth` is not supported. Use `borderBottom` instead.',
1323
- borderStartColor: '`borderStartColor` is not supported. Use `borderStart` instead.',
1324
- borderStartStyle: '`borderStartStyle` is not supported. Use `borderStart` instead.',
1325
- borderStartWidth: '`borderStartWidth` is not supported. Use `borderStart` instead.',
1326
- borderBlockStartColor: '`borderBlockStartColor` is not supported. Use `borderTop` instead.',
1327
- borderBlockStartStyle: '`borderBlockStartStyle` is not supported. Use `borderTop` instead.',
1328
- borderBlockStartWidth: '`borderBlockStartWidth` is not supported. Use `borderTop` instead.',
1329
- borderBlockEndColor: '`borderBlockEndColor` is not supported. Use `borderBottom` instead.',
1330
- borderBlockEndStyle: '`borderBlockEndStyle` is not supported. Use `borderBottom` instead.',
1331
- borderBlockEndWidth: '`borderBlockEndWidth` is not supported. Use `borderBottom` instead.',
1332
- borderInlineStartColor: '`borderInlineStartColor` is not supported. Use `borderStart` instead.',
1333
- borderInlineStartStyle: '`borderInlineStartStyle` is not supported. Use `borderStart` instead.',
1334
- borderInlineStartWidth: '`borderInlineStartWidth` is not supported. Use `borderStart` instead.',
1335
- borderInlineEndColor: '`borderInlineEndColor` is not supported. Use `borderEnd` instead.',
1336
- borderInlineEndStyle: '`borderInlineEndStyle` is not supported. Use `borderEnd` instead.',
1337
- borderInlineEndWidth: '`borderInlineEndWidth` is not supported. Use `borderEnd` instead.',
1338
- borderLeft: '`borderLeft` is not supported. Use `borderStart` instead.',
1339
- borderLeftColor: '`borderLeftColor` is not supported. Use `borderStart` instead.',
1340
- borderLeftStyle: '`borderLeftStyle` is not supported. Use `borderStart` instead.',
1341
- borderLeftWidth: '`borderLeftWidth` is not supported. Use `borderStart` instead.',
1342
- borderRight: '`borderRight` is not supported. Use `borderEnd` instead.',
1343
- borderRightColor: '`borderRightColor` is not supported. Use `borderEnd` instead.',
1344
- borderRightStyle: '`borderRightStyle` is not supported. Use `borderEnd` instead.',
1345
- borderRightWidth: '`borderRightWidth` is not supported. Use `borderEnd` instead.',
1346
- borderTopLeftRadius: '`borderTopLeftRadius` is not supported. Use `borderTopStartRadius` instead.',
1347
- borderTopRightRadius: '`borderTopRightRadius` is not supported. Use `borderTopEndRadius` instead.',
1348
- borderBottomLeftRadius: '`borderBottomLeftRadius` is not supported. Use `borderBottomStartRadius` instead.',
1349
- borderBottomRightRadius: '`borderBottomRightRadius` is not supported. Use `borderBottomEndRadius` instead.',
1350
- borderImageSource: '`borderImageSource` is not supported. Use `borderImage` instead.',
1351
- borderImageSlice: '`borderImageSlice` is not supported. Use `borderImage` instead.',
1352
- borderImageWidth: '`borderImageWidth` is not supported. Use `borderImage` instead.',
1353
- borderImageOutset: '`borderImageOutset` is not supported. Use `borderImage` instead.',
1354
- borderImageRepeat: '`borderImageRepeat` is not supported. Use `borderImage` instead.',
1355
- marginLeft: '`marginLeft` is not supported. Use `marginStart` instead.',
1356
- marginRight: '`marginRight` is not supported. Use `marginEnd` instead.',
1357
- paddingLeft: '`paddingLeft` is not supported. Use `paddingStart` instead.',
1358
- paddingRight: '`paddingRight` is not supported. Use `paddingEnd` instead.',
1359
- columnRuleWidth: '`columnRuleWidth` is not supported. Use `columnRule` instead.',
1360
- columnRuleStyle: '`columnRuleStyle` is not supported. Use `columnRule` instead.',
1361
- columnRuleColor: '`columnRuleColor` is not supported. Use `columnRule` instead.',
1362
- columns: '`columns` is not supported. Use `columnCount` and `columnWidth` instead.',
1363
- flex: '`flex` is not supported. Use `flexGrow`, `flexShrink`, and `flexBasis` instead.',
1364
- flexFlow: '`flexFlow` is not supported. Use `flexDirection` and `flexWrap` instead.',
1365
- font: '`font` is not supported. Use individual properties like `fontFamily`, `fontSize`, etc. instead.',
1366
- grid: '`grid` is not supported. Use individual properties like `gridTemplateColumns`, `gridTemplateRows`, etc. instead.',
1367
- gridColumn: '`gridColumn` is not supported. Use `gridColumnStart` and `gridColumnEnd` instead.',
1368
- gridRow: '`gridRow` is not supported. Use `gridRowStart` and `gridRowEnd` instead.',
1369
- gridArea: '`gridArea` is not supported. Use `gridRowStart`, `gridColumnStart`, `gridRowEnd`, and `gridColumnEnd` instead.',
1370
- gridTemplate: '`gridTemplate` is not supported. Use individual properties like `gridTemplateColumns`, `gridTemplateRows`, etc. instead.',
1371
- gridTemplateAreas: '`gridTemplateAreas` is not supported. Use `gridTemplateRows` and `gridTemplateColumns` instead.',
1372
- listStyleImage: '`listStyleImage` is not supported. Use `listStyle` instead.',
1373
- listStylePosition: '`listStylePosition` is not supported. Use `listStyle` instead.',
1374
- listStyleType: '`listStyleType` is not supported. Use `listStyle` instead.',
1375
- maskClip: '`maskClip` is not supported. Use `mask` instead.',
1376
- maskComposite: '`maskComposite` is not supported. Use `mask` instead.',
1377
- maskImage: '`maskImage` is not supported. Use `mask` instead.',
1378
- maskMode: '`maskMode` is not supported. Use `mask` instead.',
1379
- maskOrigin: '`maskOrigin` is not supported. Use `mask` instead.',
1380
- maskPosition: '`maskPosition` is not supported. Use `mask` instead.',
1381
- maskRepeat: '`maskRepeat` is not supported. Use `mask` instead.',
1382
- maskSize: '`maskSize` is not supported. Use `mask` instead.',
1383
- offsetAnchor: '`offsetAnchor` is not supported. Use `offset` instead.',
1384
- offsetDistance: '`offsetDistance` is not supported. Use `offset` instead.',
1385
- offsetPath: '`offsetPath` is not supported. Use `offset` instead.',
1386
- offsetPosition: '`offsetPosition` is not supported. Use `offset` instead.',
1387
- offsetRotate: '`offsetRotate` is not supported. Use `offset` instead.',
1388
- outlineColor: '`outlineColor` is not supported. Use `outline` instead.',
1389
- outlineStyle: '`outlineStyle` is not supported. Use `outline` instead.',
1390
- outlineWidth: '`outlineWidth` is not supported. Use `outline` instead.',
1391
- textDecorationColor: '`textDecorationColor` is not supported. Use `textDecoration` instead.',
1392
- textDecorationLine: '`textDecorationLine` is not supported. Use `textDecoration` instead.',
1393
- textDecorationStyle: '`textDecorationStyle` is not supported. Use `textDecoration` instead.',
1394
- textDecorationThickness: '`textDecorationThickness` is not supported. Use `textDecoration` instead.',
1395
- textEmphasisColor: '`textEmphasisColor` is not supported. Use `textEmphasis` instead.',
1396
- textEmphasisStyle: '`textEmphasisStyle` is not supported. Use `textEmphasis` instead.',
1397
- transition: '`transition` is not supported. Use individual properties like `transitionProperty`, `transitionDuration`, etc. instead.'
1346
+ const shorthands$1 = {
1347
+ all: _ => {
1348
+ throw new Error('all is not supported');
1349
+ },
1350
+ animation: value => [['animation', value], ['animationName', null], ['animationDuration', null], ['animationTimingFunction', null], ['animationDelay', null], ['animationIterationCount', null], ['animationDirection', null], ['animationFillMode', null], ['animationPlayState', null]],
1351
+ background: value => [['background', value], ['backgroundAttachment', null], ['backgroundClip', null], ['backgroundColor', null], ['backgroundImage', null], ['backgroundOrigin', null], ['backgroundPosition', null], ['backgroundRepeat', null], ['backgroundSize', null]],
1352
+ // These will be removed later, matching the properties with React Native.
1353
+ // For now, we're compiling them to the React Native properties.
1354
+ // @Deprecated
1355
+ border: rawValue => {
1356
+ if (typeof rawValue === 'number') {
1357
+ return shorthands$1.borderWidth(rawValue);
1358
+ }
1359
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1360
+ return [...shorthands$1.borderWidth(width), ...shorthands$1.borderStyle(style), ...shorthands$1.borderColor(color)];
1361
+ },
1362
+ // @Deprecated
1363
+ borderInline: rawValue => {
1364
+ if (typeof rawValue === 'number') {
1365
+ return [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]];
1366
+ }
1367
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1368
+ return [...shorthands$1.borderInlineWidth(width), ...shorthands$1.borderInlineStyle(style), ...shorthands$1.borderInlineColor(color)];
1369
+ },
1370
+ // @Deprecated
1371
+ borderBlock: rawValue => {
1372
+ if (typeof rawValue === 'number') {
1373
+ return [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]];
1374
+ }
1375
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1376
+ return [...shorthands$1.borderBlockWidth(width), ...shorthands$1.borderBlockStyle(style), ...shorthands$1.borderBlockColor(color)];
1377
+ },
1378
+ // @Deprecated
1379
+ borderTop: rawValue => {
1380
+ if (typeof rawValue === 'number') {
1381
+ return [['borderTopWidth', rawValue]];
1382
+ }
1383
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1384
+ return [['borderTopWidth', width], ['borderTopStyle', style], ['borderTopColor', color]];
1385
+ },
1386
+ // @Deprecated
1387
+ borderInlineEnd: rawValue => {
1388
+ if (typeof rawValue === 'number') {
1389
+ return [['borderInlineEndWidth', rawValue]];
1390
+ }
1391
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1392
+ return [['borderInlineEndWidth', width], ['borderInlineEndStyle', style], ['borderInlineEndColor', color]];
1393
+ },
1394
+ // @Deprecated
1395
+ borderRight: rawValue => {
1396
+ throw new Error(['`borderRight` is not supported.', 'You could use `borderRightWidth`, `borderRightStyle` and `borderRightColor`,', 'but it is preferable to use `borderInlineEndWidth`, `borderInlineEndStyle` and `borderInlineEndColor`.'].join(' '));
1397
+ },
1398
+ // @Deprecated
1399
+ borderBottom: rawValue => {
1400
+ if (typeof rawValue === 'number') {
1401
+ return [['borderBottomWidth', rawValue]];
1402
+ }
1403
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1404
+ return [['borderBottomWidth', width], ['borderBottomStyle', style], ['borderBottomColor', color]];
1405
+ },
1406
+ // @Deprecated
1407
+ borderInlineStart: rawValue => {
1408
+ if (typeof rawValue === 'number') {
1409
+ return [['borderInlineStartWidth', rawValue]];
1410
+ }
1411
+ const [width, style, color] = (0, _splitCssValue$2.default)(rawValue);
1412
+ return [['borderInlineStartWidth', width], ['borderInlineStartStyle', style], ['borderInlineStartColor', color]];
1413
+ },
1414
+ // @Deprecated
1415
+ borderLeft: rawValue => {
1416
+ throw new Error(['`borderLeft` is not supported.', 'You could use `borderLeftWidth`, `borderLeftStyle` and `borderLeftColor`,', 'but it is preferable to use `borderInlineStartWidth`, `borderInlineStartStyle` and `borderInlineStartColor`.'].join(' '));
1417
+ },
1418
+ borderInlineWidth: rawValue => [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderLeftWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null]],
1419
+ borderInlineStyle: rawValue => [['borderInlineStyle', rawValue], ['borderInlineStartStyle', null], ['borderLeftStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null]],
1420
+ borderInlineColor: rawValue => [['borderInlineColor', rawValue], ['borderInlineStartColor', null], ['borderLeftColor', null], ['borderInlineEndColor', null], ['borderRightColor', null]],
1421
+ borderBlockWidth: rawValue => [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]],
1422
+ borderBlockStyle: rawValue => [['borderBlockStyle', rawValue], ['borderTopStyle', null], ['borderBottomStyle', null]],
1423
+ borderBlockColor: rawValue => [['borderBlockColor', rawValue], ['borderTopColor', null], ['borderBottomColor', null]],
1424
+ borderColor: value => [['borderColor', value], ['borderTopColor', null], ['borderInlineEndColor', null], ['borderRightColor', null], ['borderBottomColor', null], ['borderInlineStartColor', null], ['borderLeftColor', null]],
1425
+ borderStyle: value => [['borderStyle', value], ['borderTopStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null], ['borderBottomStyle', null], ['borderInlineStartStyle', null], ['borderLeftStyle', null]],
1426
+ borderWidth: value => [['borderWidth', value], ['borderTopWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null], ['borderBottomWidth', null], ['borderInlineStartWidth', null], ['borderLeftWidth', null]],
1427
+ borderInlineStartColor: value => [['borderInlineStartColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
1428
+ borderInlineEndColor: value => [['borderInlineEndColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
1429
+ borderInlineStartStyle: value => [['borderInlineStartStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
1430
+ borderInlineEndStyle: value => [['borderInlineEndStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
1431
+ borderInlineStartWidth: value => [['borderInlineStartWidth', value], ['borderLeftWidth', null], ['borderRightWidth', null]],
1432
+ borderInlineEndWidth: value => [['borderInlineEndWidth', value], ['borderLeftWidth', null], ['borderRightWidth', null]],
1433
+ borderLeftColor: value => [['borderLeftColor', value], ['borderInlineStartColor', null], ['borderInlineEndColor', null]],
1434
+ borderRightColor: value => [['borderRightColor', value], ['borderInlineStartColor', null], ['borderInlineEndColor', null]],
1435
+ borderLeftStyle: value => [['borderLeftStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
1436
+ borderRightStyle: value => [['borderRightStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
1437
+ borderLeftWidth: value => [['borderLeftWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
1438
+ borderRightWidth: value => [['borderRightWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
1439
+ borderRadius: value => {
1440
+ const values = typeof value === 'number' ? [value] : (0, _splitCssValue$2.default)(value);
1441
+ if (values.length === 1) {
1442
+ return [['borderRadius', value],
1443
+ // // logical constituents
1444
+ ['borderStartStartRadius', null], ['borderStartEndRadius', null], ['borderEndStartRadius', null], ['borderEndEndRadius', null],
1445
+ // physical constituents
1446
+ ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]];
1447
+ }
1448
+
1449
+ // @Deprecated
1450
+ const [startStart, startEnd = startStart, endEnd = startStart, endStart = startEnd] = values;
1451
+ return [
1452
+ // split into logical consituents
1453
+ ['borderStartStartRadius', startStart], ['borderStartEndRadius', startEnd], ['borderEndEndRadius', endEnd], ['borderEndStartRadius', endStart],
1454
+ // unset physical consituents
1455
+ ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]];
1456
+ },
1457
+ borderStartStartRadius: value => [['borderStartStartRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
1458
+ borderStartEndRadius: value => [['borderStartEndRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
1459
+ borderEndStartRadius: value => [['borderEndStartRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
1460
+ borderEndEndRadius: value => [['borderEndEndRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
1461
+ borderTopLeftRadius: value => [['borderTopLeftRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
1462
+ borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
1463
+ borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
1464
+ borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
1465
+ columnRule: value => [['columnRule', value], ['columnRuleWidth', null], ['columnRuleStyle', null], ['columnRuleColor', null]],
1466
+ columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
1467
+ container: value => [['container', value], ['containerName', null], ['containerType', null]],
1468
+ flex: value => [['flex', value], ['flexGrow', null], ['flexShrink', null], ['flexBasis', null]],
1469
+ flexFlow: value => [['flexFlow', value], ['flexDirection', null], ['flexWrap', null]],
1470
+ // @Deprecated ?
1471
+ font: value => [['font', value], ['fontFamily', null], ['fontSize', null], ['fontStretch', null], ['fontStyle', null], ['fontVariant', null], ['fontWeight', null], ['lineHeight', null]],
1472
+ gap: value => [['gap', value], ['rowGap', null], ['columnGap', null]],
1473
+ grid: value => [['grid', value], ['gridTemplate', null], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null], ['gridAutoRows', null], ['gridAutoColumns', null], ['gridAutoFlow', null]],
1474
+ gridArea: value => [['gridArea', value], ['gridRow', null], ['gridRowStart', null], ['gridRowEnd', null], ['gridColumn', null], ['gridColumnStart', null], ['gridColumnEnd', null]],
1475
+ gridRow: value => [['gridRow', value], ['gridRowStart', null], ['gridRowEnd', null]],
1476
+ gridColumn: value => [['gridColumn', value], ['gridColumnStart', null], ['gridColumnEnd', null]],
1477
+ gridTemplate: value => [['gridTemplate', value], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null]],
1478
+ inset: value => [['inset', value], ['insetInline', null], ['insetBlock', null], ['insetInlineStart', null], ['insetInlineEnd', null], ['top', null], ['right', null], ['bottom', null], ['left', null]],
1479
+ insetInline: value => [['insetInline', value], ['insetInlineStart', null], ['insetInlineEnd', null], ['left', null], ['right', null]],
1480
+ insetBlock: value => [['insetBlock', value], ['top', null], ['bottom', null]],
1481
+ insetInlineStart: value => [['insetInlineStart', value], ['left', null], ['right', null]],
1482
+ insetInlineEnd: value => [['insetInlineEnd', value], ['left', null], ['right', null]],
1483
+ left: value => [['left', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
1484
+ right: value => [['right', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
1485
+ listStyle: value => [['listStyle', value], ['listStyleImage', null], ['listStylePosition', null], ['listStyleType', null]],
1486
+ margin: value => {
1487
+ const values = typeof value === 'number' ? [value] : (0, _splitCssValue$2.default)(value);
1488
+ if (values.length === 1) {
1489
+ return [['margin', values[0]], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null], ['marginTop', null], ['marginBottom', null]];
1490
+ }
1491
+ // @Deprecated
1492
+ const [top, right = top, bottom = top, left = right] = values;
1493
+ return [['marginTop', top], ['marginInlineEnd', right], ['marginBottom', bottom], ['marginInlineStart', left], ['marginLeft', null], ['marginRight', null]];
1494
+ },
1495
+ marginInline: value => [['marginInline', value], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null]],
1496
+ marginBlock: value => [['marginBlock', value], ['marginTop', null], ['marginBottom', null]],
1497
+ marginInlineStart: value => [['marginInlineStart', value], ['marginLeft', null], ['marginRight', null]],
1498
+ marginInlineEnd: value => [['marginInlineEnd', value], ['marginLeft', null], ['marginRight', null]],
1499
+ marginLeft: value => [['marginLeft', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
1500
+ marginRight: value => [['marginRight', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
1501
+ mask: value => [['mask', value], ['maskClip', null], ['maskComposite', null], ['maskImage', null], ['maskMode', null], ['maskOrigin', null], ['maskPosition', null], ['maskRepeat', null], ['maskSize', null]],
1502
+ offset: value => [['offset', value], ['offsetAnchor', null], ['offsetDistance', null], ['offsetPath', null], ['offsetPosition', null], ['offsetRotate', null]],
1503
+ outline: value => [['outline', value], ['outlineColor', null], ['outlineStyle', null], ['outlineWidth', null]],
1504
+ overflow: value => [['overflow', value], ['overflowX', null], ['overflowY', null]],
1505
+ padding: rawValue => {
1506
+ const values = typeof rawValue === 'number' ? [rawValue] : (0, _splitCssValue$2.default)(rawValue);
1507
+ if (values.length === 1) {
1508
+ return [['padding', values[0]], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null], ['paddingTop', null], ['paddingBottom', null]];
1509
+ }
1510
+ // @Deprecated
1511
+ const [top, right = top, bottom = top, left = right] = values;
1512
+ return [['paddingTop', top], ['paddingEnd', right], ['paddingBottom', bottom], ['paddingStart', left]];
1513
+ },
1514
+ paddingInline: rawValue => [['paddingInline', rawValue], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null]],
1515
+ paddingBlock: rawValue => [['paddingBlock', rawValue], ['paddingTop', null], ['paddingBottom', null]],
1516
+ paddingInlineStart: value => [['paddingInlineStart', value], ['paddingLeft', null], ['paddingRight', null]],
1517
+ paddingInlineEnd: value => [['paddingInlineEnd', value], ['paddingLeft', null], ['paddingRight', null]],
1518
+ paddingLeft: value => [['paddingLeft', value], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
1519
+ paddingRight: value => [['paddingRight', value], ['paddingInlineStart', null], ['paddingInlineEnd', null]],
1520
+ placeContent: value => [['placeContent', value], ['alignContent', null], ['justifyContent', null]],
1521
+ placeItems: value => [['placeItems', value], ['alignItems', null], ['justifyItems', null]],
1522
+ placeSelf: value => [['placeSelf', value], ['alignSelf', null], ['justifySelf', null]],
1523
+ scrollMargin: value => [['scrollMargin', value], ['scrollMarginBottom', null], ['scrollMarginLeft', null], ['scrollMarginStart', null], ['scrollMarginRight', null], ['scrollMarginEnd', null], ['scrollMarginTop', null]],
1524
+ scrollPadding: value => [['scrollPadding', value], ['scrollPaddingBottom', null], ['scrollPaddingLeft', null], ['scrollPaddingStart', null], ['scrollPaddingRight', null], ['scrollPaddingEnd', null], ['scrollPaddingTop', null]],
1525
+ scrollTimeline: value => [['scrollTimeline', value], ['scrollTimelineName', null], ['scrollTimelineAxis', null]],
1526
+ textDecoration: value => [['textDecoration', value], ['textDecorationColor', null], ['textDecorationLine', null], ['textDecorationStyle', null], ['textDecorationThickness', null]],
1527
+ textEmphasis: value => [['textEmphasis', value], ['textEmphasisColor', null], ['textEmphasisStyle', null]],
1528
+ transition: value => [['transition', value], ['transitionDelay', null], ['transitionDuration', null], ['transitionProperty', null], ['transitionTimingFunction', null]]
1398
1529
  };
1399
- expandShorthands.BANNED_PROPERTIES = BANNED_PROPERTIES;
1400
- const expansions = {
1530
+ const aliases$1 = {
1531
+ // @Deprecated
1532
+ borderHorizontal: shorthands$1.borderInline,
1533
+ // @Deprecated
1534
+ borderVertical: shorthands$1.borderBlock,
1535
+ // @Deprecated
1536
+ borderBlockStart: shorthands$1.borderTop,
1537
+ // @Deprecated
1538
+ borderEnd: shorthands$1.borderInlineEnd,
1539
+ // @Deprecated
1540
+ borderBlockEnd: shorthands$1.borderBottom,
1541
+ // @Deprecated
1542
+ borderStart: shorthands$1.borderInlineStart,
1543
+ borderHorizontalWidth: shorthands$1.borderInlineWidth,
1544
+ borderHorizontalStyle: shorthands$1.borderInlineStyle,
1545
+ borderHorizontalColor: shorthands$1.borderInlineColor,
1546
+ borderVerticalWidth: shorthands$1.borderBlockWidth,
1547
+ borderVerticalStyle: shorthands$1.borderBlockStyle,
1548
+ borderVerticalColor: shorthands$1.borderBlockColor,
1549
+ borderBlockStartColor: value => [['borderTopColor', value]],
1550
+ borderBlockEndColor: value => [['borderBottomColor', value]],
1551
+ borderBlockStartStyle: value => [['borderTopStyle', value]],
1552
+ borderBlockEndStyle: value => [['borderBottomStyle', value]],
1553
+ borderBlockStartWidth: value => [['borderTopWidth', value]],
1554
+ borderBlockEndWidth: value => [['borderBottomWidth', value]],
1555
+ borderStartColor: shorthands$1.borderInlineStartColor,
1556
+ borderEndColor: shorthands$1.borderInlineEndColor,
1557
+ borderStartStyle: shorthands$1.borderInlineStartStyle,
1558
+ borderEndStyle: shorthands$1.borderInlineEndStyle,
1559
+ borderStartWidth: shorthands$1.borderInlineStartWidth,
1560
+ borderEndWidth: shorthands$1.borderInlineEndWidth,
1561
+ borderTopStartRadius: value => [['borderStartStartRadius', value]],
1562
+ borderTopEndRadius: value => [['borderStartEndRadius', value]],
1563
+ borderBottomStartRadius: value => [['borderEndStartRadius', value]],
1564
+ borderBottomEndRadius: value => [['borderEndEndRadius', value]],
1565
+ marginBlockStart: value => [['marginTop', value]],
1566
+ marginBlockEnd: value => [['marginBottom', value]],
1567
+ marginStart: shorthands$1.marginInlineStart,
1568
+ marginEnd: shorthands$1.marginInlineEnd,
1569
+ marginHorizontal: shorthands$1.marginInline,
1570
+ marginVertical: shorthands$1.marginBlock,
1571
+ paddingBlockStart: rawValue => [['paddingTop', rawValue]],
1572
+ paddingBlockEnd: rawValue => [['paddingBottom', rawValue]],
1573
+ paddingStart: shorthands$1.paddingInlineStart,
1574
+ paddingEnd: shorthands$1.paddingInlineEnd,
1575
+ paddingHorizontal: shorthands$1.paddingInline,
1576
+ paddingVertical: shorthands$1.paddingBlock,
1577
+ insetBlockStart: value => [['top', value]],
1578
+ insetBlockEnd: value => [['bottom', value]],
1579
+ start: shorthands$1.insetInlineStart,
1580
+ end: shorthands$1.insetInlineEnd
1581
+ };
1582
+ const expansions$3 = {
1583
+ ...shorthands$1,
1584
+ ...aliases$1
1585
+ };
1586
+ var _default$3 = expansions$3;
1587
+ applicationOrder.default = _default$3;
1588
+
1589
+ var legacyExpandShorthands = {};
1590
+
1591
+ Object.defineProperty(legacyExpandShorthands, "__esModule", {
1592
+ value: true
1593
+ });
1594
+ legacyExpandShorthands.default = void 0;
1595
+ var _splitCssValue$1 = _interopRequireDefault$7(splitCssValue);
1596
+ function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1597
+ /**
1598
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1599
+ *
1600
+ * This source code is licensed under the MIT license found in the
1601
+ * LICENSE file in the root directory of this source tree.
1602
+ *
1603
+ *
1604
+ */
1605
+
1606
+ const borderWidthKeywords = new Set(['thin', 'medium', 'thick']);
1607
+ const borderStyleKeywords = new Set(['none', 'hidden', 'solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inside',
1608
+ // Non-standard
1609
+ 'inset', 'outset']);
1610
+ const globalKeywords = new Set(['initial', 'inherit', 'unset']);
1611
+ function borderDetector(borderParts) {
1612
+ const parts = borderParts.filter(Boolean).slice();
1613
+ let suffix = '';
1614
+ for (let i = 0; i < parts.length; i++) {
1615
+ const part = parts[i];
1616
+ if (typeof part === 'string' && part.endsWith('!important')) {
1617
+ parts[i] = part.replace('!important', '').trim();
1618
+ suffix = ' !important';
1619
+ }
1620
+ }
1621
+ if (parts.length === 1 && globalKeywords.has(parts[0])) {
1622
+ return [parts[0], parts[0], parts[0]];
1623
+ }
1624
+
1625
+ // Find the part that starts with a number
1626
+ // This is most likely to be the borderWidth
1627
+ let width = parts.find(part => typeof part === 'number' || part.match(/^\.?\d+/) || borderWidthKeywords.has(part));
1628
+ if (typeof width === 'number') {
1629
+ width = String(width) + 'px';
1630
+ }
1631
+ // console.log('width', width);
1632
+ if (width != null) {
1633
+ parts.splice(parts.indexOf(width), 1);
1634
+ }
1635
+ if (parts.length === 0) {
1636
+ return [String(width) + suffix, null, null];
1637
+ }
1638
+ const style = parts.find(part => typeof part === 'string' && borderStyleKeywords.has(part));
1639
+ if (style != null) {
1640
+ parts.splice(parts.indexOf(style), 1);
1641
+ }
1642
+ if (parts.length === 2 && width == null) {
1643
+ width = parts[0];
1644
+ parts.splice(0, 1);
1645
+ }
1646
+ if (width != null && parts.length > 1) {
1647
+ throw new Error('Invalid border shorthand value');
1648
+ }
1649
+ const color = parts[0];
1650
+ return [width, style, color].map(part => part != null ? part + suffix : null);
1651
+ }
1652
+ const expansions$2 = {
1401
1653
  border: rawValue => {
1402
- return [['borderTop', rawValue], ['borderEnd', rawValue], ['borderBottom', rawValue], ['borderStart', rawValue]];
1403
- },
1404
- // border: (rawValue: string) => {
1405
- // if (typeof rawValue === 'number') {
1406
- // return expansions.borderWidth(rawValue);
1407
- // }
1408
- // const [width, style, color, more] = splitValue(rawValue);
1409
- // if (more != null) {
1410
- // throw new Error(messages.MULTIPLE_DIRECTIONS_IN_SHORTHAND);
1411
- // }
1412
- // if (style == null || color == null) {
1413
- // throw new Error(
1414
- // 'Border shorthand requires at least 2 values - width, style and color.'
1415
- // );
1416
- // }
1417
- // return [
1418
- // ...expansions.borderWidth(width),
1419
- // ...expansions.borderStyle(style),
1420
- // ...expansions.borderColor(color),
1421
- // ];
1422
- // },
1423
- // borderTop: (rawValue: string) => {
1424
- // if (typeof rawValue === 'number') {
1425
- // return [['borderTopWidth', rawValue + 'px']];
1426
- // }
1427
- // const [width, style, color] = splitValue(rawValue);
1428
- // if (style == null || color == null) {
1429
- // throw new Error(
1430
- // 'BorderTop shorthand requires at least 2 values - width, style and color.'
1431
- // );
1432
- // }
1433
- // return [
1434
- // ['borderTopWidth', width],
1435
- // ['borderTopStyle', style],
1436
- // ['borderTopColor', color],
1437
- // ];
1438
- // },
1439
- // borderEnd: (rawValue: string) => {
1440
- // if (typeof rawValue === 'number') {
1441
- // return [['borderEndWidth', rawValue + 'px']];
1442
- // }
1443
- // const [width, style, color] = splitValue(rawValue);
1444
- // if (style == null || color == null) {
1445
- // throw new Error(
1446
- // 'BorderEnd shorthand requires at least 2 values - width, style and color.'
1447
- // );
1448
- // }
1449
- // return [
1450
- // ['borderEndWidth', width],
1451
- // ['borderEndStyle', style],
1452
- // ['borderEndColor', color],
1453
- // ];
1454
- // },
1455
- // borderBottom: (rawValue: string) => {
1456
- // if (typeof rawValue === 'number') {
1457
- // return [['borderBottomWidth', rawValue + 'px']];
1458
- // }
1459
- // const [width, style, color] = splitValue(rawValue);
1460
- // if (style == null || color == null) {
1461
- // throw new Error(
1462
- // 'BorderBottom shorthand requires at least 2 values - width, style and color.'
1463
- // );
1464
- // }
1465
- // return [
1466
- // ['borderBottomWidth', width],
1467
- // ['borderBottomStyle', style],
1468
- // ['borderBottomColor', color],
1469
- // ];
1470
- // },
1471
- // borderStart: (rawValue: string) => {
1472
- // if (typeof rawValue === 'number') {
1473
- // return [['borderStartWidth', rawValue + 'px']];
1474
- // }
1475
- // const [width, style, color] = splitValue(rawValue);
1476
- // if (style == null || color == null) {
1477
- // throw new Error(
1478
- // 'BorderStart shorthand requires at least 2 values - width, style and color.'
1479
- // );
1480
- // }
1481
- // return [
1482
- // ['borderStartWidth', width],
1483
- // ['borderStartStyle', style],
1484
- // ['borderStartColor', color],
1485
- // ];
1486
- // },
1654
+ if (typeof rawValue === 'number') {
1655
+ return expansions$2.borderWidth(rawValue);
1656
+ }
1657
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1658
+ const [width, style, color] = borderDetector(parts);
1659
+ return [...(width != null ? expansions$2.borderWidth(width) : []), ...(style != null ? expansions$2.borderStyle(style) : []), ...(color != null ? expansions$2.borderColor(color) : [])];
1660
+ },
1661
+ borderTop: rawValue => {
1662
+ if (typeof rawValue === 'number') {
1663
+ return [['borderTopWidth', rawValue]];
1664
+ }
1665
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1666
+ const [width, style, color] = borderDetector(parts);
1667
+ return [width != null ? ['borderTopWidth', width] : null, style != null ? ['borderTopStyle', style] : null, color != null ? ['borderTopColor', color] : null].filter(Boolean);
1668
+ },
1669
+ borderEnd: rawValue => {
1670
+ if (typeof rawValue === 'number') {
1671
+ return [['borderEndWidth', rawValue]];
1672
+ }
1673
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1674
+ const [width, style, color] = borderDetector(parts);
1675
+ return [width != null ? ['borderEndWidth', width] : null, style != null ? ['borderEndStyle', style] : null, color != null ? ['borderEndColor', color] : null].filter(Boolean);
1676
+ },
1677
+ borderRight: rawValue => {
1678
+ if (typeof rawValue === 'number') {
1679
+ return [['borderRightWidth', rawValue]];
1680
+ }
1681
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1682
+ const [width, style, color] = borderDetector(parts);
1683
+ return [width != null ? ['borderRightWidth', width] : null, style != null ? ['borderRightStyle', style] : null, color != null ? ['borderRightColor', color] : null].filter(Boolean);
1684
+ },
1685
+ borderBottom: rawValue => {
1686
+ if (typeof rawValue === 'number') {
1687
+ return [['borderBottomWidth', rawValue]];
1688
+ }
1689
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1690
+ const [width, style, color] = borderDetector(parts);
1691
+ return [width != null ? ['borderBottomWidth', width] : null, style != null ? ['borderBottomStyle', style] : null, color != null ? ['borderBottomColor', color] : null].filter(Boolean);
1692
+ },
1693
+ borderStart: rawValue => {
1694
+ if (typeof rawValue === 'number') {
1695
+ return [['borderStartWidth', rawValue]];
1696
+ }
1697
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1698
+ const [width, style, color] = borderDetector(parts);
1699
+ return [width != null ? ['borderStartWidth', width] : null, style != null ? ['borderStartStyle', style] : null, color != null ? ['borderStartColor', color] : null].filter(Boolean);
1700
+ },
1701
+ borderLeft: rawValue => {
1702
+ if (typeof rawValue === 'number') {
1703
+ return [['borderLeftWidth', rawValue]];
1704
+ }
1705
+ const parts = (0, _splitCssValue$1.default)(rawValue);
1706
+ const [width, style, color] = borderDetector(parts);
1707
+ return [width != null ? ['borderLeftWidth', width] : null, style != null ? ['borderLeftStyle', style] : null, color != null ? ['borderLeftColor', color] : null].filter(Boolean);
1708
+ },
1487
1709
  borderColor: rawValue => {
1488
- const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
1710
+ const [top, right = top, bottom = top, left = right] = (0, _splitCssValue$1.default)(rawValue);
1489
1711
  return [['borderTopColor', top], ['borderEndColor', right], ['borderBottomColor', bottom], ['borderStartColor', left]];
1490
1712
  },
1491
1713
  borderHorizontal: rawValue => {
1492
- return [['borderStart', rawValue], ['borderEnd', rawValue]];
1714
+ return [...expansions$2.borderStart(rawValue), ...expansions$2.borderEnd(rawValue)];
1493
1715
  },
1494
1716
  borderStyle: rawValue => {
1495
- const [top, right = top, bottom = top, left = right] = splitValue(rawValue);
1717
+ const [top, right = top, bottom = top, left = right] = (0, _splitCssValue$1.default)(rawValue);
1496
1718
  return [['borderTopStyle', top], ['borderEndStyle', right], ['borderBottomStyle', bottom], ['borderStartStyle', left]];
1497
1719
  },
1498
1720
  borderVertical: rawValue => {
1499
- return [['borderTop', rawValue], ['borderBottom', rawValue]];
1721
+ return [...expansions$2.borderTop(rawValue), ...expansions$2.borderBottom(rawValue)];
1500
1722
  },
1501
1723
  borderWidth: rawValue => {
1502
- const [top, right = top, bottom = top, left = right] = typeof rawValue === 'number' ? [rawValue] : splitValue(rawValue);
1724
+ const [top, right = top, bottom = top, left = right] = (0, _splitCssValue$1.default)(rawValue);
1503
1725
  return [['borderTopWidth', top], ['borderEndWidth', right], ['borderBottomWidth', bottom], ['borderStartWidth', left]];
1504
1726
  },
1505
1727
  borderRadius: rawValue => {
1506
- const [top, right = top, bottom = top, left = right] = typeof rawValue === 'string' ? splitValue(rawValue) : typeof rawValue === 'number' ? [rawValue] : rawValue; // remove
1507
-
1728
+ const [top, right = top, bottom = top, left = right] = (0, _splitCssValue$1.default)(rawValue);
1508
1729
  return [['borderTopStartRadius', top], ['borderTopEndRadius', right], ['borderBottomEndRadius', bottom], ['borderBottomStartRadius', left]];
1509
1730
  },
1510
1731
  margin: rawValue => {
1511
- const [top, right = top, bottom = top, left = right] = typeof rawValue === 'number' ? [rawValue] : splitValue(rawValue);
1732
+ const [top, right = top, bottom = top, left = right] = (0, _splitCssValue$1.default)(rawValue);
1512
1733
  return [['marginTop', top], ['marginEnd', right], ['marginBottom', bottom], ['marginStart', left]];
1513
1734
  },
1514
1735
  marginHorizontal: rawValue => {
@@ -1518,11 +1739,11 @@ const expansions = {
1518
1739
  return [['marginTop', rawValue], ['marginBottom', rawValue]];
1519
1740
  },
1520
1741
  overflow: rawValue => {
1521
- const [x, y = x] = splitValue(rawValue);
1742
+ const [x, y = x] = (0, _splitCssValue$1.default)(rawValue);
1522
1743
  return [['overflowX', x], ['overflowY', y]];
1523
1744
  },
1524
1745
  padding: rawValue => {
1525
- const [top, right = top, bottom = top, left = right] = typeof rawValue === 'number' ? [rawValue] : splitValue(rawValue);
1746
+ const [top, right = top, bottom = top, left = right] = (0, _splitCssValue$1.default)(rawValue);
1526
1747
  return [['paddingTop', top], ['paddingEnd', right], ['paddingBottom', bottom], ['paddingStart', left]];
1527
1748
  },
1528
1749
  paddingHorizontal: rawValue => {
@@ -1530,47 +1751,183 @@ const expansions = {
1530
1751
  },
1531
1752
  paddingVertical: rawValue => {
1532
1753
  return [['paddingTop', rawValue], ['paddingBottom', rawValue]];
1754
+ }
1755
+ };
1756
+ var _default$2 = expansions$2;
1757
+ legacyExpandShorthands.default = _default$2;
1758
+
1759
+ var propertySpecificity = {};
1760
+
1761
+ Object.defineProperty(propertySpecificity, "__esModule", {
1762
+ value: true
1763
+ });
1764
+ propertySpecificity.default = void 0;
1765
+ var _splitCssValue = _interopRequireDefault$6(splitCssValue);
1766
+ function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1767
+ /**
1768
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1769
+ *
1770
+ * This source code is licensed under the MIT license found in the
1771
+ * LICENSE file in the root directory of this source tree.
1772
+ *
1773
+ *
1774
+ */
1775
+
1776
+ const shorthands = {
1777
+ all: _ => {
1778
+ throw new Error('all is not supported');
1533
1779
  },
1534
- gap: rawValue => {
1535
- if (typeof rawValue === 'number') {
1536
- return [['rowGap', rawValue], ['columnGap', rawValue]];
1537
- }
1538
- const [row, column = row] = splitValue(rawValue);
1539
- return [['rowGap', row], ['columnGap', column]];
1780
+ animation: value => {
1781
+ throw new Error('animation is not supported');
1782
+ },
1783
+ background: value => {
1784
+ throw new Error('background is not supported. Use background-color, border-image etc. instead.');
1785
+ },
1786
+ border: rawValue => {
1787
+ throw new Error('border is not supported. Use border-width, border-style and border-color instead.');
1540
1788
  },
1541
- placeContent: rawValue => {
1542
- const [align, justify = align] = splitValue(rawValue);
1543
- return [['alignContent', align], ['justifyContent', justify]];
1789
+ borderInline: rawValue => {
1790
+ throw new Error('borderInline is not supported. Use borderInlineWidth, borderInlineStyle and borderInlineColor instead.');
1544
1791
  },
1545
- placeItems: rawValue => {
1546
- const [align, justify = align] = splitValue(rawValue);
1547
- return [['alignItems', align], ['justifyItems', justify]];
1792
+ // @Deprecated
1793
+ borderBlock: rawValue => {
1794
+ throw new Error('borderBlock is not supported. Use borderBlockWidth, borderBlockStyle and borderBlockColor instead.');
1548
1795
  },
1549
- placeSelf: rawValue => {
1550
- const [align, justify = align] = splitValue(rawValue);
1551
- return [['alignSelf', align], ['justifySelf', justify]];
1796
+ // @Deprecated
1797
+ borderTop: rawValue => {
1798
+ throw new Error('borderTop is not supported. Use borderTopWidth, borderTopStyle and borderTopColor instead.');
1552
1799
  },
1553
- scrollMargin: rawValue => {
1554
- const [top, right = top, bottom = top, left = right] = typeof rawValue === 'number' ? [rawValue] : splitValue(rawValue);
1555
- return [['scrollMarginTop', top], ['scrollMarginEnd', right], ['scrollMarginBottom', bottom], ['scrollMarginStart', left]];
1800
+ // @Deprecated
1801
+ borderInlineEnd: rawValue => {
1802
+ throw new Error('borderInlineEnd is not supported. Use borderInlineEndWidth, borderInlineEndStyle and borderInlineEndColor instead.');
1803
+ },
1804
+ // @Deprecated
1805
+ borderRight: rawValue => {
1806
+ throw new Error('borderRight is not supported. Use borderRightWidth, borderRightStyle and borderRightColor instead.');
1807
+ },
1808
+ // @Deprecated
1809
+ borderBottom: rawValue => {
1810
+ throw new Error('borderBottom is not supported. Use borderBottomWidth, borderBottomStyle and borderBottomColor instead.');
1811
+ },
1812
+ // @Deprecated
1813
+ borderInlineStart: rawValue => {
1814
+ throw new Error('borderInlineStart is not supported. Use borderInlineStartWidth, borderInlineStartStyle and borderInlineStartColor instead.');
1815
+ },
1816
+ // @Deprecated
1817
+ borderLeft: rawValue => {
1818
+ throw new Error(['`borderLeft` is not supported.', 'You could use `borderLeftWidth`, `borderLeftStyle` and `borderLeftColor`,', 'but it is preferable to use `borderInlineStartWidth`, `borderInlineStartStyle` and `borderInlineStartColor`.'].join(' '));
1819
+ },
1820
+ margin: value => {
1821
+ const values = (0, _splitCssValue.default)(value);
1822
+ if (values.length === 1) {
1823
+ return [['margin', values[0]]];
1824
+ } else {
1825
+ throw new Error('margin shorthand with multiple values is not supported. Use marginTop, marginInlineEnd, marginBottom and marginInlineStart instead.');
1826
+ }
1556
1827
  },
1557
- scrollPadding: rawValue => {
1558
- const [top, right = top, bottom = top, left = right] = typeof rawValue === 'number' ? [rawValue] : splitValue(rawValue);
1559
- return [['scrollPaddingTop', top], ['scrollPaddingEnd', right], ['scrollPaddingBottom', bottom], ['scrollPaddingStart', left]];
1828
+ padding: rawValue => {
1829
+ const values = (0, _splitCssValue.default)(rawValue);
1830
+ if (values.length === 1) {
1831
+ return [['padding', values[0]]];
1832
+ }
1833
+ throw new Error('padding shorthand with multiple values is not supported. Use paddingTop, paddingInlineEnd, paddingBottom and paddingInlineStart instead.');
1560
1834
  }
1561
1835
  };
1562
- const expandedKeys = [...Object.keys(expansions), ...Object.keys(BANNED_PROPERTIES)];
1563
- expandShorthands.expandedKeys = expandedKeys;
1564
- function flatMapExpandedShorthands(objEntry) {
1836
+ const aliases = {
1837
+ // @UNSUPPORTED
1838
+ borderHorizontal: shorthands.borderInline,
1839
+ // @UNSUPPORTED
1840
+ borderVertical: shorthands.borderBlock,
1841
+ // @UNSUPPORTED
1842
+ borderBlockStart: shorthands.borderTop,
1843
+ // @UNSUPPORTED
1844
+ borderEnd: shorthands.borderInlineEnd,
1845
+ // @UNSUPPORTED
1846
+ borderBlockEnd: shorthands.borderBottom,
1847
+ // @UNSUPPORTED
1848
+ borderStart: shorthands.borderInlineStart,
1849
+ borderHorizontalWidth: value => [['borderInlineWidth', value]],
1850
+ borderHorizontalStyle: value => [['borderInlineStyle', value]],
1851
+ borderHorizontalColor: value => [['borderInlineColor', value]],
1852
+ borderVerticalWidth: value => [['borderBlockWidth', value]],
1853
+ borderVerticalStyle: value => [['borderBlockStyle', value]],
1854
+ borderVerticalColor: value => [['borderBlockColor', value]],
1855
+ borderBlockStartColor: value => [['borderTopColor', value]],
1856
+ borderBlockEndColor: value => [['borderBottomColor', value]],
1857
+ borderBlockStartStyle: value => [['borderTopStyle', value]],
1858
+ borderBlockEndStyle: value => [['borderBottomStyle', value]],
1859
+ borderBlockStartWidth: value => [['borderTopWidth', value]],
1860
+ borderBlockEndWidth: value => [['borderBottomWidth', value]],
1861
+ borderStartColor: value => [['borderInlineStartColor', value]],
1862
+ borderEndColor: value => [['borderInlineEndColor', value]],
1863
+ borderStartStyle: value => [['borderInlineStartStyle', value]],
1864
+ borderEndStyle: value => [['borderInlineEndStyle', value]],
1865
+ borderStartWidth: value => [['borderInlineStartWidth', value]],
1866
+ borderEndWidth: value => [['borderInlineEndWidth', value]],
1867
+ borderTopStartRadius: value => [['borderStartStartRadius', value]],
1868
+ borderTopEndRadius: value => [['borderStartEndRadius', value]],
1869
+ borderBottomStartRadius: value => [['borderEndStartRadius', value]],
1870
+ borderBottomEndRadius: value => [['borderEndEndRadius', value]],
1871
+ marginBlockStart: value => [['marginTop', value]],
1872
+ marginBlockEnd: value => [['marginBottom', value]],
1873
+ marginStart: value => [['marginInlineStart', value]],
1874
+ marginEnd: value => [['marginInlineEnd', value]],
1875
+ marginHorizontal: value => [['marginInline', value]],
1876
+ marginVertical: value => [['marginBlock', value]],
1877
+ paddingBlockStart: rawValue => [['paddingTop', rawValue]],
1878
+ paddingBlockEnd: rawValue => [['paddingBottom', rawValue]],
1879
+ paddingStart: value => [['paddingInlineStart', value]],
1880
+ paddingEnd: value => [['paddingInlineEnd', value]],
1881
+ paddingHorizontal: value => [['paddingInline', value]],
1882
+ paddingVertical: value => [['paddingBlock', value]],
1883
+ insetBlockStart: value => [['top', value]],
1884
+ insetBlockEnd: value => [['bottom', value]],
1885
+ start: value => [['insetInlineStart', value]],
1886
+ end: value => [['insetInlineEnd', value]]
1887
+ };
1888
+ const expansions$1 = {
1889
+ ...shorthands,
1890
+ ...aliases
1891
+ };
1892
+ var _default$1 = expansions$1;
1893
+ propertySpecificity.default = _default$1;
1894
+
1895
+ Object.defineProperty(preprocessRules, "__esModule", {
1896
+ value: true
1897
+ });
1898
+ preprocessRules.default = flatMapExpandedShorthands;
1899
+ preprocessRules.getExpandedKeys = getExpandedKeys;
1900
+ var _applicationOrder = _interopRequireDefault$5(applicationOrder);
1901
+ var _legacyExpandShorthands = _interopRequireDefault$5(legacyExpandShorthands);
1902
+ var _propertySpecificity = _interopRequireDefault$5(propertySpecificity);
1903
+ function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1904
+ /**
1905
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
1906
+ *
1907
+ * This source code is licensed under the MIT license found in the
1908
+ * LICENSE file in the root directory of this source tree.
1909
+ *
1910
+ *
1911
+ */
1912
+
1913
+ const expansions = {
1914
+ 'application-order': _applicationOrder.default,
1915
+ 'property-specificity': _propertySpecificity.default,
1916
+ 'legacy-expand-shorthands': _legacyExpandShorthands.default
1917
+ };
1918
+ function getExpandedKeys(options) {
1919
+ return Object.keys(expansions[options.styleResolution ?? 'application-order']);
1920
+ }
1921
+ function flatMapExpandedShorthands(objEntry, options) {
1565
1922
  const [key, value] = objEntry;
1566
- const expansion = expansions[key];
1923
+ const expansion = expansions[options.styleResolution ?? 'application-order'][key];
1567
1924
  if (expansion) {
1568
1925
  if (Array.isArray(value)) {
1569
1926
  throw new Error('Cannot use fallbacks for shorthands. Use the expansion instead.');
1570
1927
  }
1571
1928
  return expansion(value);
1572
1929
  }
1573
- return [objEntry];
1930
+ return [[key, value]];
1574
1931
  }
1575
1932
 
1576
1933
  var objectUtils = {};
@@ -1712,7 +2069,7 @@ Object.defineProperty(stylexCreate$1, "__esModule", {
1712
2069
  });
1713
2070
  stylexCreate$1.default = styleXCreateSet;
1714
2071
  var _convertToClassName = _interopRequireDefault$4(convertToClassName$1);
1715
- var _expandShorthands$1 = _interopRequireWildcard$1(expandShorthands);
2072
+ var _index$1 = _interopRequireWildcard$1(preprocessRules);
1716
2073
  var _objectUtils$1 = objectUtils;
1717
2074
  var messages$1 = _interopRequireWildcard$1(messages$4);
1718
2075
  var _stylexInclude$1 = stylexInclude$1;
@@ -1747,6 +2104,9 @@ function styleXCreateSet(namespaces) {
1747
2104
  if (typeof namespace !== 'object' || Array.isArray(namespace)) {
1748
2105
  throw new Error(messages$1.ILLEGAL_NAMESPACE_VALUE);
1749
2106
  }
2107
+
2108
+ // namespace = preflatten(namespace);
2109
+
1750
2110
  const [resolvedNamespace, injected] = styleXCreateNamespace(namespace, options);
1751
2111
  const compiledNamespace = (0, _objectUtils$1.flattenObject)(resolvedNamespace);
1752
2112
  resolvedNamespaces[namespaceName] = {
@@ -1779,16 +2139,18 @@ function styleXCreateSet(namespaces) {
1779
2139
  function styleXCreateNamespace(style, options) {
1780
2140
  const namespaceEntries = (0, _objectUtils$1.objEntries)(style);
1781
2141
 
1782
- // First the shorthand properties are expanded.
1783
- // e.g. `margin` gets expanded to `marginTop`, `marginBottom`, `marginStart`, `marginEnd`.
1784
- // `entries` is an array of [key, value] pairs.
2142
+ // First handle shorthands. The strategy for this is based on the `styleResolution` option.
1785
2143
  const entries = namespaceEntries.flatMap(_ref => {
1786
2144
  let [key, value] = _ref;
2145
+ // Detect style ...spreads and leave them unmodified
1787
2146
  if (value instanceof _stylexInclude$1.IncludedStyles) {
1788
2147
  return [[key, value]];
1789
2148
  }
2149
+ // Detect nested style objects.
1790
2150
  if (value != null && typeof value === 'object' && !Array.isArray(value)) {
1791
- if (!key.startsWith(':') && !key.startsWith('@') && _expandShorthands$1.expandedKeys.includes(key)) {
2151
+ // Nested Objects are only allowed for legacy :pseudo, @media or long-hand properties for now.
2152
+ // In the future, we will try to support shorthands as well.
2153
+ if (!key.startsWith(':') && !key.startsWith('@') && (0, _index$1.getExpandedKeys)(options).includes(key)) {
1792
2154
  throw new Error(messages$1.INVALID_PSEUDO);
1793
2155
  }
1794
2156
  return [[key, (0, _objectUtils$1.objFromEntries)((0, _objectUtils$1.objEntries)(value).flatMap(_ref2 => {
@@ -1796,10 +2158,7 @@ function styleXCreateNamespace(style, options) {
1796
2158
  if (innerValue != null && typeof innerValue === 'object' && !Array.isArray(innerValue)) {
1797
2159
  throw new Error(messages$1.ILLEGAL_NESTED_PSEUDO);
1798
2160
  }
1799
- if (!options.allowUnsafeProperties && _expandShorthands$1.BANNED_PROPERTIES[key]) {
1800
- throw new Error(_expandShorthands$1.BANNED_PROPERTIES[key]);
1801
- }
1802
- return (0, _expandShorthands$1.default)([innerKey, innerValue]);
2161
+ return (0, _index$1.default)([innerKey, innerValue], options);
1803
2162
  }))]];
1804
2163
  } else {
1805
2164
  if (value !== null && typeof value !== 'string' && typeof value !== 'number' && !Array.isArray(value)) {
@@ -1808,10 +2167,7 @@ function styleXCreateNamespace(style, options) {
1808
2167
  if (Array.isArray(value) && value.some(val => typeof val === 'object')) {
1809
2168
  throw new Error(messages$1.ILLEGAL_PROP_ARRAY_VALUE);
1810
2169
  }
1811
- if (!options.allowUnsafeProperties && _expandShorthands$1.BANNED_PROPERTIES[key]) {
1812
- throw new Error(_expandShorthands$1.BANNED_PROPERTIES[key]);
1813
- }
1814
- return (0, _expandShorthands$1.default)([key, value]);
2170
+ return (0, _index$1.default)([key, value], options);
1815
2171
  }
1816
2172
  });
1817
2173
 
@@ -1832,6 +2188,8 @@ function styleXCreateNamespace(style, options) {
1832
2188
  for (const [innerKey, innerVal] of (0, _objectUtils$1.objEntries)(val)) {
1833
2189
  if (innerVal === null) {
1834
2190
  innerObj[innerKey] = null;
2191
+ } else if (typeof innerVal === 'object' && !Array.isArray(innerVal)) {
2192
+ throw new Error(messages$1.ILLEGAL_NESTED_PSEUDO);
1835
2193
  } else {
1836
2194
  const [updatedKey, className, cssRule] = (0, _convertToClassName.default)([innerKey, innerVal], pseudo, options);
1837
2195
  innerObj[updatedKey] = className;
@@ -1846,6 +2204,9 @@ function styleXCreateNamespace(style, options) {
1846
2204
  if (pseudo !== 'default' && !pseudo.startsWith(':') && !pseudo.startsWith('@')) {
1847
2205
  throw new Error(messages$1.INVALID_PSEUDO);
1848
2206
  }
2207
+ if (typeof innerVal === 'object' && !Array.isArray(innerVal)) {
2208
+ throw new Error(messages$1.ILLEGAL_NESTED_PSEUDO);
2209
+ }
1849
2210
  if (innerVal !== null) {
1850
2211
  const [updatedKey, className, cssRule] = (0, _convertToClassName.default)([propKey, innerVal], pseudo === 'default' ? undefined : pseudo, options);
1851
2212
  injectedStyles[updatedKey + pseudo] = [className, cssRule];
@@ -1875,7 +2236,7 @@ Object.defineProperty(stylexKeyframes, "__esModule", {
1875
2236
  });
1876
2237
  stylexKeyframes.default = styleXKeyframes;
1877
2238
  var _hash = _interopRequireDefault$3(hash$1);
1878
- var _expandShorthands = _interopRequireDefault$3(expandShorthands);
2239
+ var _index = _interopRequireDefault$3(preprocessRules);
1879
2240
  var _generateLtr = _interopRequireDefault$3(generateLtr);
1880
2241
  var _generateRtl = _interopRequireDefault$3(generateRtl);
1881
2242
  var _transformValue = _interopRequireDefault$3(transformValue$1);
@@ -1897,11 +2258,12 @@ function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : {
1897
2258
  // It also expands shorthand properties to maintain parity with
1898
2259
  // `stylex.create`.
1899
2260
  function styleXKeyframes(frames) {
1900
- let {
2261
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2262
+ const {
1901
2263
  stylexSheetName = '<>',
1902
2264
  classNamePrefix = 'x'
1903
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1904
- const expandedObject = (0, _objectUtils.objMap)(frames, frame => _objectUtils.Pipe.create(frame).pipe(expandFrameShorthands).pipe(x => (0, _objectUtils.objMapKeys)(x, _dashify.default)).pipe(x => (0, _objectUtils.objMap)(x, (value, key) => (0, _transformValue.default)(key, value))).done());
2265
+ } = options;
2266
+ const expandedObject = (0, _objectUtils.objMap)(frames, frame => _objectUtils.Pipe.create(frame).pipe(frame => expandFrameShorthands(frame, options)).pipe(x => (0, _objectUtils.objMapKeys)(x, _dashify.default)).pipe(x => (0, _objectUtils.objMap)(x, (value, key) => (0, _transformValue.default)(key, value))).done());
1905
2267
  const ltrStyles = (0, _objectUtils.objMap)(expandedObject, frame => (0, _objectUtils.objMapEntry)(frame, _generateLtr.default));
1906
2268
  const rtlStyles = (0, _objectUtils.objMap)(expandedObject, frame => (0, _objectUtils.objMapEntry)(frame, entry => (0, _generateRtl.default)(entry) ?? entry));
1907
2269
  const ltrString = constructKeyframesObj(ltrStyles);
@@ -1917,16 +2279,27 @@ function styleXKeyframes(frames) {
1917
2279
  priority: 1
1918
2280
  }];
1919
2281
  }
1920
- function expandFrameShorthands(frame) {
1921
- return (0, _objectUtils.objFromEntries)((0, _objectUtils.objEntries)(frame).flatMap(pair => (0, _expandShorthands.default)(pair)));
2282
+ function expandFrameShorthands(frame, options) {
2283
+ return (0, _objectUtils.objFromEntries)((0, _objectUtils.objEntries)(frame).flatMap(pair => (0, _index.default)(pair, options).map(_ref => {
2284
+ let [key, value] = _ref;
2285
+ if (typeof value === 'string' || typeof value === 'number') {
2286
+ return [key, value];
2287
+ }
2288
+ return null;
2289
+ }).filter(Boolean))
2290
+ // Keyframes are not combined. The nulls can be skipped
2291
+ .filter(_ref2 => {
2292
+ let [key, value] = _ref2;
2293
+ return value != null;
2294
+ }));
1922
2295
  }
1923
2296
 
1924
2297
  // Create t
1925
2298
  function constructKeyframesObj(frames) {
1926
- return (0, _objectUtils.objEntries)(frames).map(_ref => {
1927
- let [key, value] = _ref;
1928
- return `${key}{${(0, _objectUtils.objEntries)(value).map(_ref2 => {
1929
- let [k, v] = _ref2;
2299
+ return (0, _objectUtils.objEntries)(frames).map(_ref3 => {
2300
+ let [key, value] = _ref3;
2301
+ return `${key}{${(0, _objectUtils.objEntries)(value).map(_ref4 => {
2302
+ let [k, v] = _ref4;
1930
2303
  return `${k}:${v};`;
1931
2304
  }).join('')}}`;
1932
2305
  }).join('');
@@ -1981,18 +2354,18 @@ function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : {
1981
2354
 
1982
2355
  // These are the implementations of those functions.
1983
2356
 
1984
- const create = _stylexCreate.default;
1985
- var create_1 = lib.create = create;
1986
- const keyframes = _stylexKeyframes.default;
1987
- var keyframes_1 = lib.keyframes = keyframes;
1988
- const include = _stylexInclude.default;
1989
- var include_1 = lib.include = include;
2357
+ const create$1 = _stylexCreate.default;
2358
+ var create_1 = lib.create = create$1;
2359
+ const keyframes$1 = _stylexKeyframes.default;
2360
+ var keyframes_1 = lib.keyframes = keyframes$1;
2361
+ const include$1 = _stylexInclude.default;
2362
+ var include_1 = lib.include = include$1;
1990
2363
  const messages = m;
1991
2364
  messages_1 = lib.messages = messages;
1992
2365
  const IncludedStyles = _stylexInclude.IncludedStyles;
1993
2366
  var IncludedStyles_1 = lib.IncludedStyles = IncludedStyles;
1994
- const firstThatWorks = _stylexFirstThatWorks.default;
1995
- var firstThatWorks_1 = lib.firstThatWorks = firstThatWorks;
2367
+ const firstThatWorks$1 = _stylexFirstThatWorks.default;
2368
+ var firstThatWorks_1 = lib.firstThatWorks = firstThatWorks$1;
1996
2369
 
1997
2370
  /**
1998
2371
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -3059,7 +3432,7 @@ StyleXSheet$1.styleSheet = styleSheet;
3059
3432
  Object.defineProperty(stylexInject, "__esModule", {
3060
3433
  value: true
3061
3434
  });
3062
- stylexInject.default = inject;
3435
+ stylexInject.default = inject$1;
3063
3436
  var _StyleXSheet = StyleXSheet$1;
3064
3437
  /**
3065
3438
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -3070,7 +3443,7 @@ var _StyleXSheet = StyleXSheet$1;
3070
3443
  *
3071
3444
  */
3072
3445
 
3073
- function inject(ltrRule, priority) {
3446
+ function inject$1(ltrRule, priority) {
3074
3447
  let rtlRule = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
3075
3448
  _StyleXSheet.styleSheet.insert(ltrRule, priority, rtlRule);
3076
3449
  }
@@ -3087,101 +3460,63 @@ function inject(ltrRule, priority) {
3087
3460
  Object.defineProperty(stylex$1, "__esModule", {
3088
3461
  value: true
3089
3462
  });
3090
- var default_1 = stylex$1.default = void 0;
3463
+ stylex$1.UNSUPPORTED_PROPERTY = void 0;
3464
+ stylex$1.apply = apply;
3465
+ stylex$1.stylex = stylex$1.keyframes = stylex$1.inject = stylex$1.include = stylex$1.firstThatWorks = default_1 = stylex$1.default = stylex$1.create = void 0;
3091
3466
  var _stylexInject = _interopRequireDefault(stylexInject);
3467
+ var _styleq = require$$1;
3092
3468
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3093
- const cache = new WeakMap() ;
3094
- function stylex() {
3095
- // Keep a set of property commits to the className
3096
- const definedProperties = [];
3097
- let className = '';
3098
- let nextCache = cache;
3469
+ const stylex = function stylex() {
3099
3470
  for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
3100
3471
  styles[_key] = arguments[_key];
3101
3472
  }
3102
- while (styles.length) {
3103
- // Push nested styles back onto the stack to be processed
3104
- const possibleStyle = styles.pop();
3105
- if (Array.isArray(possibleStyle)) {
3106
- for (let i = 0; i < possibleStyle.length; i++) {
3107
- styles.push(possibleStyle[i]);
3108
- }
3109
- continue;
3110
- }
3111
-
3112
- // Process an individual style object
3113
- const styleObj = possibleStyle;
3114
- if (styleObj != null && typeof styleObj === 'object') {
3115
- // Build up the class names defined by this object
3116
- let classNameChunk = '';
3117
- if (nextCache != null && nextCache.has(styleObj)) {
3118
- // Cache: read
3119
- const cacheEntry = nextCache.get(styleObj);
3120
- if (cacheEntry != null) {
3121
- classNameChunk = cacheEntry.classNameChunk;
3122
- definedProperties.push(...cacheEntry.definedPropertiesChunk);
3123
- nextCache = cacheEntry.next;
3124
- }
3125
- } else {
3126
- // Record the properties this object defines (and that haven't already
3127
- // been defined by later objects.)
3128
- const definedPropertiesChunk = [];
3129
- for (const prop in styleObj) {
3130
- const value = styleObj[prop];
3131
- // Style declarations, e.g., opacity: 's3fkgpd'
3132
- if (typeof value === 'string' || value === null) {
3133
- // Skip adding to the chunks if property has already been seen
3134
- if (!definedProperties.includes(prop)) {
3135
- definedProperties.push(prop);
3136
- definedPropertiesChunk.push(prop);
3137
- if (typeof value === 'string') {
3138
- classNameChunk += classNameChunk ? ' ' + value : value;
3139
- }
3140
- }
3141
- }
3142
- }
3143
- // Cache: write
3144
- if (nextCache != null) {
3145
- const emptyCache = new WeakMap();
3146
- nextCache.set(styleObj, {
3147
- classNameChunk,
3148
- definedPropertiesChunk,
3149
- next: emptyCache
3150
- });
3151
- nextCache = emptyCache;
3152
- }
3153
- }
3154
-
3155
- // Order of classes in chunks matches property-iteration order of style
3156
- // object. Order of chunks matches passed order of styles from first to
3157
- // last (which we iterate over in reverse).
3158
- if (classNameChunk) {
3159
- className = className ? classNameChunk + ' ' + className : classNameChunk;
3160
- }
3161
- }
3162
- }
3473
+ const [className] = (0, _styleq.styleq)(styles);
3163
3474
  return className;
3475
+ };
3476
+ stylex$1.stylex = stylex;
3477
+ function apply() {
3478
+ for (var _len2 = arguments.length, styles = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3479
+ styles[_key2] = arguments[_key2];
3480
+ }
3481
+ const [className, style] = (0, _styleq.styleq)(styles);
3482
+ return {
3483
+ className,
3484
+ style
3485
+ };
3164
3486
  }
3487
+ stylex.apply = apply;
3165
3488
  function stylexCreate(_styles) {
3166
3489
  throw new Error('stylex.create should never be called. It should be compiled away.');
3167
3490
  }
3168
3491
  function stylexIncludes(_styles) {
3169
3492
  throw new Error('stylex.extends should never be called. It should be compiled away.');
3170
3493
  }
3171
- stylex.create = stylexCreate;
3172
- stylex.include = stylexIncludes;
3173
- stylex.keyframes = _keyframes => {
3494
+ const create = stylexCreate;
3495
+ stylex$1.create = create;
3496
+ stylex.create = create;
3497
+ const include = stylexIncludes;
3498
+ stylex$1.include = include;
3499
+ stylex.include = include;
3500
+ const keyframes = _keyframes => {
3174
3501
  throw new Error('stylex.keyframes should never be called');
3175
3502
  };
3176
- stylex.firstThatWorks = function () {
3503
+ stylex$1.keyframes = keyframes;
3504
+ stylex.keyframes = keyframes;
3505
+ const firstThatWorks = function () {
3177
3506
  throw new Error('stylex.firstThatWorks should never be called.');
3178
3507
  };
3179
- stylex.inject = _stylexInject.default;
3180
- stylex.UNSUPPORTED_PROPERTY = props => {
3508
+ stylex$1.firstThatWorks = firstThatWorks;
3509
+ stylex.firstThatWorks = firstThatWorks;
3510
+ const inject = _stylexInject.default;
3511
+ stylex$1.inject = inject;
3512
+ stylex.inject = inject;
3513
+ const UNSUPPORTED_PROPERTY = props => {
3181
3514
  throw new Error('stylex.UNSUPPORTED_PROPERTY should never be called. It should be compiled away.');
3182
3515
  };
3516
+ stylex$1.UNSUPPORTED_PROPERTY = UNSUPPORTED_PROPERTY;
3517
+ stylex.UNSUPPORTED_PROPERTY = UNSUPPORTED_PROPERTY;
3183
3518
  var _default = stylex;
3184
- default_1 = stylex$1.default = _default;
3519
+ var default_1 = stylex$1.default = _default;
3185
3520
 
3186
3521
  /**
3187
3522
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -3518,16 +3853,30 @@ function isExported(path) {
3518
3853
  *
3519
3854
  * End-users can choose to not use this function and use their own logic instead.
3520
3855
  */
3856
+
3521
3857
  const processStylexRules = function processStylexRules(rules) {
3522
3858
  if (rules.length === 0) {
3523
3859
  return '';
3524
3860
  }
3525
3861
  const sortedRules = rules.sort((_ref2, _ref3) => {
3526
- let [firstSelector,, firstPriority] = _ref2;
3527
- let [secondSelector,, secondPriority] = _ref3;
3862
+ let [_1, {
3863
+ ltr: rule1
3864
+ }, firstPriority] = _ref2;
3865
+ let [_2, {
3866
+ ltr: rule2
3867
+ }, secondPriority] = _ref3;
3528
3868
  const priorityComparison = firstPriority - secondPriority;
3529
3869
  if (priorityComparison !== 0) return priorityComparison;
3530
- return firstSelector < secondSelector ? -1 : 1;
3870
+ if (rule1.startsWith('@') && !rule2.startsWith('@')) {
3871
+ const query1 = rule1.slice(0, rule1.indexOf('{'));
3872
+ const query2 = rule2.slice(0, rule2.indexOf('{'));
3873
+ if (query1 !== query2) {
3874
+ return query1.localeCompare(query2);
3875
+ }
3876
+ }
3877
+ const property1 = rule1.slice(rule1.lastIndexOf('{'));
3878
+ const property2 = rule2.slice(rule2.lastIndexOf('{'));
3879
+ return property1.localeCompare(property2);
3531
3880
  });
3532
3881
  const collectedCSS = Array.from(new Map(sortedRules).values()).flatMap(_ref4 => {
3533
3882
  let {