@stylexjs/shared 0.2.0-beta.21 → 0.2.0-beta.23

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 (106) hide show
  1. package/lib/convert-to-className.js +6 -6
  2. package/lib/generate-css-rule.js +3 -3
  3. package/lib/hash.js +10 -11
  4. package/lib/index.d.ts +4 -4
  5. package/lib/index.js +12 -21
  6. package/lib/index.js.flow +4 -4
  7. package/lib/messages.d.ts +2 -1
  8. package/lib/messages.js +29 -54
  9. package/lib/messages.js.flow +2 -1
  10. package/lib/physical-rtl/generate-ltr.js +39 -39
  11. package/lib/physical-rtl/generate-rtl.js +57 -57
  12. package/lib/preprocess-rules/PreRule.js +2 -2
  13. package/lib/preprocess-rules/application-order.d.ts +36 -8
  14. package/lib/preprocess-rules/application-order.js +149 -164
  15. package/lib/preprocess-rules/application-order.js.flow +35 -7
  16. package/lib/preprocess-rules/basic-validation.js +6 -6
  17. package/lib/preprocess-rules/flatten-raw-style-obj.js +10 -10
  18. package/lib/preprocess-rules/index.js +6 -6
  19. package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +22 -2
  20. package/lib/preprocess-rules/legacy-expand-shorthands.js +81 -65
  21. package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +22 -2
  22. package/lib/preprocess-rules/property-specificity.d.ts +29 -25
  23. package/lib/preprocess-rules/property-specificity.js +63 -75
  24. package/lib/preprocess-rules/property-specificity.js.flow +28 -24
  25. package/lib/properties/CSS Animations.json +445 -0
  26. package/lib/properties/CSS Backgrounds and Borders.json +1085 -0
  27. package/lib/properties/CSS Basic User Interface.json +365 -0
  28. package/lib/properties/CSS Box Alignment.json +245 -0
  29. package/lib/properties/CSS Box Model.json +501 -0
  30. package/lib/properties/CSS Color.json +100 -0
  31. package/lib/properties/CSS Columns.json +185 -0
  32. package/lib/properties/CSS Containment.json +203 -0
  33. package/lib/properties/CSS Counter Styles.json +56 -0
  34. package/lib/properties/CSS Display.json +20 -0
  35. package/lib/properties/CSS Flexible Box Layout.json +167 -0
  36. package/lib/properties/CSS Fonts.json +684 -0
  37. package/lib/properties/CSS Fragmentation.json +110 -0
  38. package/lib/properties/CSS Generated Content.json +38 -0
  39. package/lib/properties/CSS Grid Layout.json +500 -0
  40. package/lib/properties/CSS Images.json +91 -0
  41. package/lib/properties/CSS Inline.json +38 -0
  42. package/lib/properties/CSS Lists and Counters.json +86 -0
  43. package/lib/properties/CSS Logical Properties.json +1086 -0
  44. package/lib/properties/CSS Masking.json +399 -0
  45. package/lib/properties/CSS Miscellaneous.json +38 -0
  46. package/lib/properties/CSS Motion Path.json +132 -0
  47. package/lib/properties/CSS Overflow.json +216 -0
  48. package/lib/properties/CSS Pages.json +83 -0
  49. package/lib/properties/CSS Positioning.json +166 -0
  50. package/lib/properties/CSS Ruby.json +55 -0
  51. package/lib/properties/CSS Scroll Anchoring.json +19 -0
  52. package/lib/properties/CSS Scroll Snap.json +604 -0
  53. package/lib/properties/CSS Scrollbars.json +38 -0
  54. package/lib/properties/CSS Shapes.json +56 -0
  55. package/lib/properties/CSS Speech.json +20 -0
  56. package/lib/properties/CSS Table.json +115 -0
  57. package/lib/properties/CSS Text Decoration.json +312 -0
  58. package/lib/properties/CSS Text.json +415 -0
  59. package/lib/properties/CSS Transforms.json +188 -0
  60. package/lib/properties/CSS Transitions.json +122 -0
  61. package/lib/properties/CSS Variables.json +20 -0
  62. package/lib/properties/CSS View Transitions.json +20 -0
  63. package/lib/properties/CSS Will Change.json +20 -0
  64. package/lib/properties/CSS Writing Modes.json +92 -0
  65. package/lib/properties/Compositing and Blending.json +62 -0
  66. package/lib/properties/Filter Effects.json +38 -0
  67. package/lib/properties/MathML.json +56 -0
  68. package/lib/properties/Microsoft Extensions.json +885 -0
  69. package/lib/properties/Mozilla Extensions.json +607 -0
  70. package/lib/properties/Pointer Events.json +20 -0
  71. package/lib/properties/WebKit Extensions.json +707 -0
  72. package/lib/properties.json +10122 -0
  73. package/lib/{stylex-override-vars.d.ts → stylex-create-theme.d.ts} +2 -2
  74. package/lib/{stylex-override-vars.js → stylex-create-theme.js} +13 -13
  75. package/lib/{stylex-override-vars.js.flow → stylex-create-theme.js.flow} +1 -1
  76. package/lib/stylex-create.js +1 -1
  77. package/lib/{stylex-create-vars.d.ts → stylex-define-vars.d.ts} +2 -2
  78. package/lib/{stylex-create-vars.js → stylex-define-vars.js} +9 -9
  79. package/lib/{stylex-create-vars.js.flow → stylex-define-vars.js.flow} +1 -1
  80. package/lib/stylex-keyframes.js +6 -6
  81. package/lib/transform-value.js +13 -15
  82. package/lib/types/index.js +33 -46
  83. package/lib/utils/dashify.js +1 -1
  84. package/lib/utils/default-options.js +4 -5
  85. package/lib/utils/file-based-identifier.js +1 -1
  86. package/lib/utils/genCSSRule.js +6 -6
  87. package/lib/utils/normalize-value.js +3 -2
  88. package/lib/utils/normalizers/convert-camel-case-transition-props.d.ts +14 -0
  89. package/lib/utils/normalizers/convert-camel-case-transition-props.js +23 -0
  90. package/lib/utils/normalizers/convert-camel-case-transition-props.js.flow +13 -0
  91. package/lib/utils/normalizers/convert-camel-case-values.d.ts +14 -0
  92. package/lib/utils/normalizers/convert-camel-case-values.js +23 -0
  93. package/lib/utils/normalizers/convert-camel-case-values.js.flow +13 -0
  94. package/lib/utils/normalizers/detect-unclosed-fns.js +2 -2
  95. package/lib/utils/normalizers/font-size-px-to-rem.js +4 -4
  96. package/lib/utils/normalizers/leading-zero.js +3 -3
  97. package/lib/utils/normalizers/quotes.js +4 -4
  98. package/lib/utils/normalizers/timings.js +4 -4
  99. package/lib/utils/normalizers/whitespace.js +12 -12
  100. package/lib/utils/normalizers/zero-dimensions.js +8 -8
  101. package/lib/utils/object-utils.d.ts +3 -6
  102. package/lib/utils/object-utils.js +2 -2
  103. package/lib/utils/property-priorities.js +527 -88
  104. package/lib/utils/split-css-value.js +8 -8
  105. package/lib/validate.js +2 -2
  106. package/package.json +2 -2
@@ -13,18 +13,18 @@ var _objectUtils = require("./utils/object-utils");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function convertStyleToClassName(objEntry, pseudos, atRules) {
15
15
  let {
16
- stylexSheetName = "<>",
17
- classNamePrefix = "x"
16
+ stylexSheetName = '<>',
17
+ classNamePrefix = 'x'
18
18
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : _defaultOptions.defaultOptions;
19
19
  const [key, rawValue] = objEntry;
20
20
  const dashedKey = (0, _dashify.default)(key);
21
21
  const value = Array.isArray(rawValue) ? rawValue.map(eachValue => (0, _transformValue.default)(key, eachValue)) : (0, _transformValue.default)(key, rawValue);
22
22
  const sortedPseudos = (0, _objectUtils.arraySort)(pseudos ?? []);
23
23
  const sortedAtRules = (0, _objectUtils.arraySort)(atRules ?? []);
24
- const atRuleHashString = sortedPseudos.join("");
25
- const pseudoHashString = sortedAtRules.join("");
26
- const modifierHashString = atRuleHashString + pseudoHashString || "null";
27
- const stringToHash = Array.isArray(value) ? dashedKey + value.join(", ") + modifierHashString : dashedKey + value + modifierHashString;
24
+ const atRuleHashString = sortedPseudos.join('');
25
+ const pseudoHashString = sortedAtRules.join('');
26
+ const modifierHashString = atRuleHashString + pseudoHashString || 'null';
27
+ const stringToHash = Array.isArray(value) ? dashedKey + value.join(', ') + modifierHashString : dashedKey + value + modifierHashString;
28
28
  const className = classNamePrefix + (0, _hash.default)(stylexSheetName + stringToHash);
29
29
  const cssRules = (0, _generateCssRule.generateRule)(className, dashedKey, value, pseudos, atRules);
30
30
  return [key, className, cssRules];
@@ -12,11 +12,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  function generateRule(className, key, value, pseudos, atRules) {
13
13
  const pairs = Array.isArray(value) ? value.map(eachValue => [key, eachValue]) : [[key, value]];
14
14
  const ltrPairs = pairs.map(_generateLtr.default);
15
- const ltrDecls = ltrPairs.map(pair => pair.join(":")).join(";");
16
- const rtlDecls = pairs.map(_generateRtl.default).filter(Boolean).map(pair => pair.join(":")).join(";");
15
+ const ltrDecls = ltrPairs.map(pair => pair.join(':')).join(';');
16
+ const rtlDecls = pairs.map(_generateRtl.default).filter(Boolean).map(pair => pair.join(':')).join(';');
17
17
  const ltrRule = (0, _genCSSRule.genCSSRule)(className, ltrDecls, pseudos, atRules);
18
18
  const rtlRule = !rtlDecls ? null : (0, _genCSSRule.genCSSRule)(className, rtlDecls, pseudos, atRules);
19
- const priority = (0, _propertyPriorities.default)(key) + Math.max(...pseudos.map(_propertyPriorities.default), ...atRules.map(_propertyPriorities.default), 0);
19
+ const priority = (0, _propertyPriorities.default)(key) + pseudos.map(_propertyPriorities.default).reduce((a, b) => a + b, 0) + atRules.map(_propertyPriorities.default).reduce((a, b) => a + b, 0);
20
20
  return {
21
21
  priority,
22
22
  ltr: ltrRule,
package/lib/hash.js CHANGED
@@ -11,28 +11,27 @@ function murmurhash2_32_gc(str) {
11
11
  i = 0,
12
12
  k;
13
13
  while (l >= 4) {
14
- k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
15
- k = (k & 65535) * 1540483477 + (((k >>> 16) * 1540483477 & 65535) << 16);
14
+ k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
15
+ k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
16
16
  k ^= k >>> 24;
17
- k = (k & 65535) * 1540483477 + (((k >>> 16) * 1540483477 & 65535) << 16);
18
- h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16) ^ k;
17
+ k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
18
+ h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
19
19
  l -= 4;
20
20
  ++i;
21
21
  }
22
22
  switch (l) {
23
23
  case 3:
24
- h ^= (str.charCodeAt(i + 2) & 255) << 16;
24
+ h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
25
25
  case 2:
26
- h ^= (str.charCodeAt(i + 1) & 255) << 8;
26
+ h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
27
27
  case 1:
28
- h ^= str.charCodeAt(i) & 255;
29
- h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16);
28
+ h ^= str.charCodeAt(i) & 0xff;
29
+ h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
30
30
  }
31
31
  h ^= h >>> 13;
32
- h = (h & 65535) * 1540483477 + (((h >>> 16) * 1540483477 & 65535) << 16);
32
+ h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
33
33
  h ^= h >>> 15;
34
34
  return h >>> 0;
35
35
  }
36
36
  const hash = str => murmurhash2_32_gc(str, 1).toString(36);
37
- var _default = hash;
38
- exports.default = _default;
37
+ var _default = exports.default = hash;
package/lib/index.d.ts CHANGED
@@ -15,8 +15,8 @@ export type {
15
15
  TStyleValue,
16
16
  } from './common-types';
17
17
  import styleXCreateSet from './stylex-create';
18
- import styleXCreateVars from './stylex-create-vars';
19
- import styleXOverrideVars from './stylex-override-vars';
18
+ import styleXDefineVars from './stylex-define-vars';
19
+ import styleXCreateTheme from './stylex-create-theme';
20
20
  import stylexKeyframes from './stylex-keyframes';
21
21
  import stylexInclude, {
22
22
  IncludedStyles as _IncludedStyles,
@@ -33,8 +33,8 @@ import type {
33
33
  StyleXOptions as _StyleXOptions,
34
34
  } from './common-types';
35
35
  export declare const create: typeof styleXCreateSet;
36
- export declare const createVars: typeof styleXCreateVars;
37
- export declare const overrideVars: typeof styleXOverrideVars;
36
+ export declare const defineVars: typeof styleXDefineVars;
37
+ export declare const createTheme: typeof styleXCreateTheme;
38
38
  export declare const keyframes: typeof stylexKeyframes;
39
39
  export declare const include: typeof stylexInclude;
40
40
  export declare const utils: {
package/lib/index.js CHANGED
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.utils = exports.types = exports.overrideVars = exports.messages = exports.keyframes = exports.include = exports.firstThatWorks = exports.createVars = exports.create = exports.IncludedStyles = void 0;
6
+ exports.utils = exports.types = exports.messages = exports.keyframes = exports.include = exports.firstThatWorks = exports.defineVars = exports.createTheme = exports.create = exports.IncludedStyles = void 0;
7
7
  var _stylexCreate = _interopRequireDefault(require("./stylex-create"));
8
- var _stylexCreateVars = _interopRequireDefault(require("./stylex-create-vars"));
9
- var _stylexOverrideVars = _interopRequireDefault(require("./stylex-override-vars"));
8
+ var _stylexDefineVars = _interopRequireDefault(require("./stylex-define-vars"));
9
+ var _stylexCreateTheme = _interopRequireDefault(require("./stylex-create-theme"));
10
10
  var _stylexKeyframes = _interopRequireDefault(require("./stylex-keyframes"));
11
11
  var _stylexInclude = _interopRequireWildcard(require("./stylex-include"));
12
12
  var _stylexFirstThatWorks = _interopRequireDefault(require("./stylex-first-that-works"));
@@ -18,24 +18,15 @@ exports.types = _types;
18
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(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; }
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
- const create = _stylexCreate.default;
22
- exports.create = create;
23
- const createVars = _stylexCreateVars.default;
24
- exports.createVars = createVars;
25
- const overrideVars = _stylexOverrideVars.default;
26
- exports.overrideVars = overrideVars;
27
- const keyframes = _stylexKeyframes.default;
28
- exports.keyframes = keyframes;
29
- const include = _stylexInclude.default;
30
- exports.include = include;
31
- const utils = {
21
+ const create = exports.create = _stylexCreate.default;
22
+ const defineVars = exports.defineVars = _stylexDefineVars.default;
23
+ const createTheme = exports.createTheme = _stylexCreateTheme.default;
24
+ const keyframes = exports.keyframes = _stylexKeyframes.default;
25
+ const include = exports.include = _stylexInclude.default;
26
+ const utils = exports.utils = {
32
27
  hash: _hash.default,
33
28
  genFileBasedIdentifier: _fileBasedIdentifier.default
34
29
  };
35
- exports.utils = utils;
36
- const messages = m;
37
- exports.messages = messages;
38
- const IncludedStyles = _stylexInclude.IncludedStyles;
39
- exports.IncludedStyles = IncludedStyles;
40
- const firstThatWorks = _stylexFirstThatWorks.default;
41
- exports.firstThatWorks = firstThatWorks;
30
+ const messages = exports.messages = m;
31
+ const IncludedStyles = exports.IncludedStyles = _stylexInclude.IncludedStyles;
32
+ const firstThatWorks = exports.firstThatWorks = _stylexFirstThatWorks.default;
package/lib/index.js.flow CHANGED
@@ -21,8 +21,8 @@ export type {
21
21
  // These are the implementations of those functions.
22
22
 
23
23
  import styleXCreateSet from './stylex-create';
24
- import styleXCreateVars from './stylex-create-vars';
25
- import styleXOverrideVars from './stylex-override-vars';
24
+ import styleXDefineVars from './stylex-define-vars';
25
+ import styleXCreateTheme from './stylex-create-theme';
26
26
  import stylexKeyframes from './stylex-keyframes';
27
27
  import stylexInclude, {
28
28
  IncludedStyles as _IncludedStyles,
@@ -41,8 +41,8 @@ import type {
41
41
  } from './common-types';
42
42
 
43
43
  declare export const create: typeof styleXCreateSet;
44
- declare export const createVars: typeof styleXCreateVars;
45
- declare export const overrideVars: typeof styleXOverrideVars;
44
+ declare export const defineVars: typeof styleXDefineVars;
45
+ declare export const createTheme: typeof styleXCreateTheme;
46
46
  declare export const keyframes: typeof stylexKeyframes;
47
47
  declare export const include: typeof stylexInclude;
48
48
  declare export const utils: {
package/lib/messages.d.ts CHANGED
@@ -31,4 +31,5 @@ export declare const NO_PARENT_PATH: 'Unexpected AST node without a parent path.
31
31
  export declare const ONLY_TOP_LEVEL_INLCUDES: 'stylex.include() is only at the top level of a style definition object.';
32
32
  export declare const DUPLICATE_CONDITIONAL: 'The same pseudo selector or at-rule cannot be used more than once.';
33
33
  export declare const NO_PROJECT_ROOT_DIRECTORY: 'The project root directory `rootDir` is not configured.';
34
- export declare const NON_EXPORT_NAMED_DECLARATION: 'The return value of stylex.createVars() must be bound to a named export.';
34
+ export declare const NON_EXPORT_NAMED_DECLARATION: 'The return value of stylex.defineVars() must be bound to a named export.';
35
+ export declare const ANONYMOUS_THEME: 'stylex.createTheme() must be bound to a named constant.';
package/lib/messages.js CHANGED
@@ -1,58 +1,33 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.UNKNOWN_PROP_KEY = exports.UNKNOWN_NAMESPACE = exports.UNEXPECTED_ARGUMENT = exports.UNBOUND_STYLEX_CALL_VALUE = exports.ONLY_TOP_LEVEL_INLCUDES = exports.ONLY_TOP_LEVEL = exports.NO_PROJECT_ROOT_DIRECTORY = exports.NO_PARENT_PATH = exports.NO_CONDITIONAL_SHORTHAND = exports.NON_STATIC_VALUE = exports.NON_OBJECT_FOR_STYLEX_CALL = exports.NON_EXPORT_NAMED_DECLARATION = exports.LOCAL_ONLY = exports.LINT_UNCLOSED_FUNCTION = exports.INVALID_SPREAD = exports.INVALID_PSEUDO_OR_AT_RULE = exports.INVALID_PSEUDO = exports.ILLEGAL_PROP_VALUE = exports.ILLEGAL_PROP_ARRAY_VALUE = exports.ILLEGAL_NESTED_PSEUDO = exports.ILLEGAL_NAMESPACE_VALUE = exports.ILLEGAL_NAMESPACE_TYPE = exports.ILLEGAL_ARGUMENT_LENGTH = exports.EXPECTED_FUNCTION_CALL = exports.ESCAPED_STYLEX_VALUE = exports.DUPLICATE_CONDITIONAL = void 0;
7
- const ILLEGAL_ARGUMENT_LENGTH = "stylex() should have 1 argument.";
8
- exports.ILLEGAL_ARGUMENT_LENGTH = ILLEGAL_ARGUMENT_LENGTH;
9
- const NON_STATIC_VALUE = "Only static values are allowed inside of a stylex.create() call.";
10
- exports.NON_STATIC_VALUE = NON_STATIC_VALUE;
11
- const ESCAPED_STYLEX_VALUE = "Escaping a stylex.create() value is not allowed.";
12
- exports.ESCAPED_STYLEX_VALUE = ESCAPED_STYLEX_VALUE;
13
- const UNBOUND_STYLEX_CALL_VALUE = "stylex.create calls must be bound to a bare variable.";
14
- exports.UNBOUND_STYLEX_CALL_VALUE = UNBOUND_STYLEX_CALL_VALUE;
15
- const ONLY_TOP_LEVEL = "stylex.create() is only allowed at the root of a program.";
16
- exports.ONLY_TOP_LEVEL = ONLY_TOP_LEVEL;
17
- const NON_OBJECT_FOR_STYLEX_CALL = "stylex.create() can only accept a style object.";
18
- exports.NON_OBJECT_FOR_STYLEX_CALL = NON_OBJECT_FOR_STYLEX_CALL;
19
- const UNKNOWN_PROP_KEY = "Unknown property key";
20
- exports.UNKNOWN_PROP_KEY = UNKNOWN_PROP_KEY;
21
- const INVALID_PSEUDO = "Invalid pseudo selector, not on the whitelist.";
22
- exports.INVALID_PSEUDO = INVALID_PSEUDO;
23
- const INVALID_PSEUDO_OR_AT_RULE = "Invalid pseudo or at-rule.";
24
- exports.INVALID_PSEUDO_OR_AT_RULE = INVALID_PSEUDO_OR_AT_RULE;
25
- const NO_CONDITIONAL_SHORTHAND = "You cannot use conditional style values for a shorthand property.";
26
- exports.NO_CONDITIONAL_SHORTHAND = NO_CONDITIONAL_SHORTHAND;
27
- const ILLEGAL_NAMESPACE_TYPE = "Only a string literal namespace is allowed here.";
28
- exports.ILLEGAL_NAMESPACE_TYPE = ILLEGAL_NAMESPACE_TYPE;
29
- const UNKNOWN_NAMESPACE = "Unknown namespace";
30
- exports.UNKNOWN_NAMESPACE = UNKNOWN_NAMESPACE;
31
- const ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
32
- exports.ILLEGAL_NESTED_PSEUDO = ILLEGAL_NESTED_PSEUDO;
33
- const ILLEGAL_PROP_VALUE = "A style value can only contain an array, string or number.";
34
- exports.ILLEGAL_PROP_VALUE = ILLEGAL_PROP_VALUE;
35
- const ILLEGAL_PROP_ARRAY_VALUE = "A style array value can only contain strings or numbers.";
36
- exports.ILLEGAL_PROP_ARRAY_VALUE = ILLEGAL_PROP_ARRAY_VALUE;
37
- const ILLEGAL_NAMESPACE_VALUE = "A stylex namespace must be an object.";
38
- exports.ILLEGAL_NAMESPACE_VALUE = ILLEGAL_NAMESPACE_VALUE;
39
- const INVALID_SPREAD = "Imported styles spread with a stylex.create call must be type cast as `XStyle<>` to verify their type.";
40
- exports.INVALID_SPREAD = INVALID_SPREAD;
41
- const LINT_UNCLOSED_FUNCTION = "Rule contains an unclosed function";
42
- exports.LINT_UNCLOSED_FUNCTION = LINT_UNCLOSED_FUNCTION;
43
- const LOCAL_ONLY = "The return value of stylex.create() should not be exported.";
44
- exports.LOCAL_ONLY = LOCAL_ONLY;
45
- const UNEXPECTED_ARGUMENT = "Unexpected argument passed to the stylex() function.";
46
- exports.UNEXPECTED_ARGUMENT = UNEXPECTED_ARGUMENT;
47
- const EXPECTED_FUNCTION_CALL = "Expected a simple function call but found something else.";
48
- exports.EXPECTED_FUNCTION_CALL = EXPECTED_FUNCTION_CALL;
49
- const NO_PARENT_PATH = "Unexpected AST node without a parent path.";
50
- exports.NO_PARENT_PATH = NO_PARENT_PATH;
51
- const ONLY_TOP_LEVEL_INLCUDES = "stylex.include() is only at the top level of a style definition object.";
52
- exports.ONLY_TOP_LEVEL_INLCUDES = ONLY_TOP_LEVEL_INLCUDES;
53
- const DUPLICATE_CONDITIONAL = "The same pseudo selector or at-rule cannot be used more than once.";
54
- exports.DUPLICATE_CONDITIONAL = DUPLICATE_CONDITIONAL;
55
- const NO_PROJECT_ROOT_DIRECTORY = "The project root directory `rootDir` is not configured.";
56
- exports.NO_PROJECT_ROOT_DIRECTORY = NO_PROJECT_ROOT_DIRECTORY;
57
- const NON_EXPORT_NAMED_DECLARATION = "The return value of stylex.createVars() must be bound to a named export.";
58
- exports.NON_EXPORT_NAMED_DECLARATION = NON_EXPORT_NAMED_DECLARATION;
6
+ exports.UNKNOWN_PROP_KEY = exports.UNKNOWN_NAMESPACE = exports.UNEXPECTED_ARGUMENT = exports.UNBOUND_STYLEX_CALL_VALUE = exports.ONLY_TOP_LEVEL_INLCUDES = exports.ONLY_TOP_LEVEL = exports.NO_PROJECT_ROOT_DIRECTORY = exports.NO_PARENT_PATH = exports.NO_CONDITIONAL_SHORTHAND = exports.NON_STATIC_VALUE = exports.NON_OBJECT_FOR_STYLEX_CALL = exports.NON_EXPORT_NAMED_DECLARATION = exports.LOCAL_ONLY = exports.LINT_UNCLOSED_FUNCTION = exports.INVALID_SPREAD = exports.INVALID_PSEUDO_OR_AT_RULE = exports.INVALID_PSEUDO = exports.ILLEGAL_PROP_VALUE = exports.ILLEGAL_PROP_ARRAY_VALUE = exports.ILLEGAL_NESTED_PSEUDO = exports.ILLEGAL_NAMESPACE_VALUE = exports.ILLEGAL_NAMESPACE_TYPE = exports.ILLEGAL_ARGUMENT_LENGTH = exports.EXPECTED_FUNCTION_CALL = exports.ESCAPED_STYLEX_VALUE = exports.DUPLICATE_CONDITIONAL = exports.ANONYMOUS_THEME = void 0;
7
+ const ILLEGAL_ARGUMENT_LENGTH = exports.ILLEGAL_ARGUMENT_LENGTH = 'stylex() should have 1 argument.';
8
+ const NON_STATIC_VALUE = exports.NON_STATIC_VALUE = 'Only static values are allowed inside of a stylex.create() call.';
9
+ const ESCAPED_STYLEX_VALUE = exports.ESCAPED_STYLEX_VALUE = 'Escaping a stylex.create() value is not allowed.';
10
+ const UNBOUND_STYLEX_CALL_VALUE = exports.UNBOUND_STYLEX_CALL_VALUE = 'stylex.create calls must be bound to a bare variable.';
11
+ const ONLY_TOP_LEVEL = exports.ONLY_TOP_LEVEL = 'stylex.create() is only allowed at the root of a program.';
12
+ const NON_OBJECT_FOR_STYLEX_CALL = exports.NON_OBJECT_FOR_STYLEX_CALL = 'stylex.create() can only accept a style object.';
13
+ const UNKNOWN_PROP_KEY = exports.UNKNOWN_PROP_KEY = 'Unknown property key';
14
+ const INVALID_PSEUDO = exports.INVALID_PSEUDO = 'Invalid pseudo selector, not on the whitelist.';
15
+ const INVALID_PSEUDO_OR_AT_RULE = exports.INVALID_PSEUDO_OR_AT_RULE = 'Invalid pseudo or at-rule.';
16
+ const NO_CONDITIONAL_SHORTHAND = exports.NO_CONDITIONAL_SHORTHAND = 'You cannot use conditional style values for a shorthand property.';
17
+ const ILLEGAL_NAMESPACE_TYPE = exports.ILLEGAL_NAMESPACE_TYPE = 'Only a string literal namespace is allowed here.';
18
+ const UNKNOWN_NAMESPACE = exports.UNKNOWN_NAMESPACE = 'Unknown namespace';
19
+ const ILLEGAL_NESTED_PSEUDO = exports.ILLEGAL_NESTED_PSEUDO = "Pseudo objects can't be nested more than one level deep.";
20
+ const ILLEGAL_PROP_VALUE = exports.ILLEGAL_PROP_VALUE = 'A style value can only contain an array, string or number.';
21
+ const ILLEGAL_PROP_ARRAY_VALUE = exports.ILLEGAL_PROP_ARRAY_VALUE = 'A style array value can only contain strings or numbers.';
22
+ const ILLEGAL_NAMESPACE_VALUE = exports.ILLEGAL_NAMESPACE_VALUE = 'A stylex namespace must be an object.';
23
+ const INVALID_SPREAD = exports.INVALID_SPREAD = 'Imported styles spread with a stylex.create call must be type cast as `XStyle<>` to verify their type.';
24
+ const LINT_UNCLOSED_FUNCTION = exports.LINT_UNCLOSED_FUNCTION = 'Rule contains an unclosed function';
25
+ const LOCAL_ONLY = exports.LOCAL_ONLY = 'The return value of stylex.create() should not be exported.';
26
+ const UNEXPECTED_ARGUMENT = exports.UNEXPECTED_ARGUMENT = 'Unexpected argument passed to the stylex() function.';
27
+ const EXPECTED_FUNCTION_CALL = exports.EXPECTED_FUNCTION_CALL = 'Expected a simple function call but found something else.';
28
+ const NO_PARENT_PATH = exports.NO_PARENT_PATH = 'Unexpected AST node without a parent path.';
29
+ const ONLY_TOP_LEVEL_INLCUDES = exports.ONLY_TOP_LEVEL_INLCUDES = 'stylex.include() is only at the top level of a style definition object.';
30
+ const DUPLICATE_CONDITIONAL = exports.DUPLICATE_CONDITIONAL = 'The same pseudo selector or at-rule cannot be used more than once.';
31
+ const NO_PROJECT_ROOT_DIRECTORY = exports.NO_PROJECT_ROOT_DIRECTORY = 'The project root directory `rootDir` is not configured.';
32
+ const NON_EXPORT_NAMED_DECLARATION = exports.NON_EXPORT_NAMED_DECLARATION = 'The return value of stylex.defineVars() must be bound to a named export.';
33
+ const ANONYMOUS_THEME = exports.ANONYMOUS_THEME = 'stylex.createTheme() must be bound to a named constant.';
@@ -34,4 +34,5 @@ declare export const NO_PARENT_PATH: 'Unexpected AST node without a parent path.
34
34
  declare export const ONLY_TOP_LEVEL_INLCUDES: 'stylex.include() is only at the top level of a style definition object.';
35
35
  declare export const DUPLICATE_CONDITIONAL: 'The same pseudo selector or at-rule cannot be used more than once.';
36
36
  declare export const NO_PROJECT_ROOT_DIRECTORY: 'The project root directory `rootDir` is not configured.';
37
- declare export const NON_EXPORT_NAMED_DECLARATION: 'The return value of stylex.createVars() must be bound to a named export.';
37
+ declare export const NON_EXPORT_NAMED_DECLARATION: 'The return value of stylex.defineVars() must be bound to a named export.';
38
+ declare export const ANONYMOUS_THEME: 'stylex.createTheme() must be bound to a named constant.';
@@ -5,75 +5,75 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = generateLTR;
7
7
  const logicalToPhysical = {
8
- start: "left",
9
- end: "right"
8
+ start: 'left',
9
+ end: 'right'
10
10
  };
11
11
  const propertyToLTR = {
12
- "margin-start": _ref => {
12
+ 'margin-start': _ref => {
13
13
  let [_key, val] = _ref;
14
- return ["margin-left", val];
14
+ return ['margin-left', val];
15
15
  },
16
- "margin-end": _ref2 => {
16
+ 'margin-end': _ref2 => {
17
17
  let [_key, val] = _ref2;
18
- return ["margin-right", val];
18
+ return ['margin-right', val];
19
19
  },
20
- "padding-start": _ref3 => {
20
+ 'padding-start': _ref3 => {
21
21
  let [_key, val] = _ref3;
22
- return ["padding-left", val];
22
+ return ['padding-left', val];
23
23
  },
24
- "padding-end": _ref4 => {
24
+ 'padding-end': _ref4 => {
25
25
  let [_key, val] = _ref4;
26
- return ["padding-right", val];
26
+ return ['padding-right', val];
27
27
  },
28
- "border-start": _ref5 => {
28
+ 'border-start': _ref5 => {
29
29
  let [_key, val] = _ref5;
30
- return ["border-left", val];
30
+ return ['border-left', val];
31
31
  },
32
- "border-end": _ref6 => {
32
+ 'border-end': _ref6 => {
33
33
  let [_key, val] = _ref6;
34
- return ["border-right", val];
34
+ return ['border-right', val];
35
35
  },
36
- "border-start-width": _ref7 => {
36
+ 'border-start-width': _ref7 => {
37
37
  let [_key, val] = _ref7;
38
- return ["border-left-width", val];
38
+ return ['border-left-width', val];
39
39
  },
40
- "border-end-width": _ref8 => {
40
+ 'border-end-width': _ref8 => {
41
41
  let [_key, val] = _ref8;
42
- return ["border-right-width", val];
42
+ return ['border-right-width', val];
43
43
  },
44
- "border-start-color": _ref9 => {
44
+ 'border-start-color': _ref9 => {
45
45
  let [_key, val] = _ref9;
46
- return ["border-left-color", val];
46
+ return ['border-left-color', val];
47
47
  },
48
- "border-end-color": _ref10 => {
48
+ 'border-end-color': _ref10 => {
49
49
  let [_key, val] = _ref10;
50
- return ["border-right-color", val];
50
+ return ['border-right-color', val];
51
51
  },
52
- "border-start-style": _ref11 => {
52
+ 'border-start-style': _ref11 => {
53
53
  let [_key, val] = _ref11;
54
- return ["border-left-style", val];
54
+ return ['border-left-style', val];
55
55
  },
56
- "border-end-style": _ref12 => {
56
+ 'border-end-style': _ref12 => {
57
57
  let [_key, val] = _ref12;
58
- return ["border-right-style", val];
58
+ return ['border-right-style', val];
59
59
  },
60
- "border-top-start-radius": _ref13 => {
60
+ 'border-top-start-radius': _ref13 => {
61
61
  let [_key, val] = _ref13;
62
- return ["border-top-left-radius", val];
62
+ return ['border-top-left-radius', val];
63
63
  },
64
- "border-bottom-start-radius": _ref14 => {
64
+ 'border-bottom-start-radius': _ref14 => {
65
65
  let [_key, val] = _ref14;
66
- return ["border-bottom-left-radius", val];
66
+ return ['border-bottom-left-radius', val];
67
67
  },
68
- "border-top-end-radius": _ref15 => {
68
+ 'border-top-end-radius': _ref15 => {
69
69
  let [_key, val] = _ref15;
70
- return ["border-top-right-radius", val];
70
+ return ['border-top-right-radius', val];
71
71
  },
72
- "border-bottom-end-radius": _ref16 => {
72
+ 'border-bottom-end-radius': _ref16 => {
73
73
  let [_key, val] = _ref16;
74
- return ["border-bottom-right-radius", val];
74
+ return ['border-bottom-right-radius', val];
75
75
  },
76
- "text-align": _ref17 => {
76
+ 'text-align': _ref17 => {
77
77
  let [key, val] = _ref17;
78
78
  return [key, logicalToPhysical[val] ?? val];
79
79
  },
@@ -87,15 +87,15 @@ const propertyToLTR = {
87
87
  },
88
88
  start: _ref20 => {
89
89
  let [_key, val] = _ref20;
90
- return ["left", val];
90
+ return ['left', val];
91
91
  },
92
92
  end: _ref21 => {
93
93
  let [_key, val] = _ref21;
94
- return ["right", val];
94
+ return ['right', val];
95
95
  },
96
- "background-position": _ref22 => {
96
+ 'background-position': _ref22 => {
97
97
  let [key, val] = _ref22;
98
- return [key, val.split(" ").map(word => word === "start" ? "left" : word === "end" ? "right" : word).join(" ")];
98
+ return [key, val.split(' ').map(word => word === 'start' ? 'left' : word === 'end' ? 'right' : word).join(' ')];
99
99
  }
100
100
  };
101
101
  function generateLTR(pair) {