@stylexjs/shared 0.7.4 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/lib/convert-to-className.js +2 -2
  2. package/lib/generate-css-rule.js +1 -1
  3. package/lib/index.js +2 -2
  4. package/lib/physical-rtl/generate-ltr.d.ts +3 -1
  5. package/lib/physical-rtl/generate-ltr.js +8 -12
  6. package/lib/physical-rtl/generate-ltr.js.flow +2 -2
  7. package/lib/physical-rtl/generate-rtl.d.ts +2 -2
  8. package/lib/physical-rtl/generate-rtl.js +57 -64
  9. package/lib/physical-rtl/generate-rtl.js.flow +2 -2
  10. package/lib/preprocess-rules/application-order.d.ts +4 -111
  11. package/lib/preprocess-rules/application-order.js.flow +3 -110
  12. package/lib/preprocess-rules/basic-validation.js +1 -1
  13. package/lib/preprocess-rules/flatten-raw-style-obj.js +1 -1
  14. package/lib/preprocess-rules/index.js +1 -1
  15. package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +3 -38
  16. package/lib/preprocess-rules/legacy-expand-shorthands.js +1 -1
  17. package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +3 -38
  18. package/lib/preprocess-rules/property-specificity.d.ts +4 -15
  19. package/lib/preprocess-rules/property-specificity.js.flow +3 -14
  20. package/lib/stylex-create-theme.js +2 -2
  21. package/lib/stylex-define-vars.d.ts +8 -5
  22. package/lib/stylex-define-vars.js +2 -2
  23. package/lib/stylex-define-vars.js.flow +5 -1
  24. package/lib/stylex-first-that-works.d.ts +3 -3
  25. package/lib/stylex-first-that-works.js +15 -1
  26. package/lib/stylex-first-that-works.js.flow +3 -3
  27. package/lib/stylex-include.js +1 -1
  28. package/lib/stylex-keyframes.js +1 -1
  29. package/lib/transform-value.js +7 -4
  30. package/lib/types/index.js.flow +1 -1
  31. package/lib/utils/normalize-value.js +1 -1
  32. package/lib/utils/normalizers/convert-camel-case-values.js +1 -1
  33. package/lib/utils/normalizers/detect-unclosed-fns.js +1 -1
  34. package/lib/utils/normalizers/font-size-px-to-rem.js +1 -1
  35. package/lib/utils/normalizers/leading-zero.js +1 -1
  36. package/lib/utils/normalizers/timings.js +1 -1
  37. package/lib/utils/normalizers/zero-dimensions.js +1 -1
  38. package/lib/utils/object-utils.d.ts +3 -2
  39. package/lib/utils/object-utils.js.flow +5 -2
  40. package/lib/utils/property-priorities.d.ts +3 -56
  41. package/lib/utils/property-priorities.js +3 -3
  42. package/lib/utils/property-priorities.js.flow +56 -56
  43. package/lib/utils/split-css-value.js +1 -1
  44. package/package.json +2 -2
@@ -81,44 +81,9 @@ import type { TStyleValue } from '../common-types';
81
81
 
82
82
  type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
83
83
 
84
- declare const shorthands: {
85
- border: (rawValue: TStyleValue) => TReturn,
86
- borderColor: (rawValue: TStyleValue) => TReturn,
87
- borderHorizontal: (rawValue: TStyleValue) => TReturn,
88
- borderStyle: (rawValue: TStyleValue) => TReturn,
89
- borderVertical: (rawValue: TStyleValue) => TReturn,
90
- borderWidth: (rawValue: TStyleValue) => TReturn,
91
- borderHorizontalColor: (rawValue: TStyleValue) => TReturn,
92
- borderHorizontalStyle: (rawValue: TStyleValue) => TReturn,
93
- borderHorizontalWidth: (rawValue: TStyleValue) => TReturn,
94
- borderVerticalColor: (rawValue: TStyleValue) => TReturn,
95
- borderVerticalStyle: (rawValue: TStyleValue) => TReturn,
96
- borderVerticalWidth: (rawValue: TStyleValue) => TReturn,
97
- borderRadius: (rawValue: TStyleValue) => TReturn,
98
- inset: (rawValue: TStyleValue) => TReturn,
99
- insetInline: (rawValue: TStyleValue) => TReturn,
100
- insetBlock: (rawValue: TStyleValue) => TReturn,
101
- start: (rawValue: TStyleValue) => TReturn,
102
- end: (rawValue: TStyleValue) => TReturn,
103
- left: (rawValue: TStyleValue) => TReturn,
104
- right: (rawValue: TStyleValue) => TReturn,
105
- gap: (rawValue: TStyleValue) => TReturn,
106
- margin: (rawValue: TStyleValue) => TReturn,
107
- marginHorizontal: (rawValue: TStyleValue) => TReturn,
108
- marginStart: (rawValue: TStyleValue) => TReturn,
109
- marginEnd: (rawValue: TStyleValue) => TReturn,
110
- marginLeft: (rawValue: TStyleValue) => TReturn,
111
- marginRight: (rawValue: TStyleValue) => TReturn,
112
- marginVertical: (rawValue: TStyleValue) => TReturn,
113
- overflow: (rawValue: TStyleValue) => TReturn,
114
- padding: (rawValue: TStyleValue) => TReturn,
115
- paddingHorizontal: (val: TStyleValue) => TReturn,
116
- paddingStart: (val: TStyleValue) => TReturn,
117
- paddingEnd: (val: TStyleValue) => TReturn,
118
- paddingLeft: (val: TStyleValue) => TReturn,
119
- paddingRight: (val: TStyleValue) => TReturn,
120
- paddingVertical: (val: TStyleValue) => TReturn,
121
- };
84
+ declare const shorthands: $ReadOnly<{
85
+ [key: string]: (TStyleValue) => TReturn,
86
+ }>;
122
87
 
123
88
  declare const aliases: {
124
89
  insetBlockStart: (val: TStyleValue) => TReturn,
@@ -9,20 +9,9 @@
9
9
 
10
10
  import type { TStyleValue } from '../common-types';
11
11
  type TReturn = ReadonlyArray<[string, TStyleValue]>;
12
- declare const shorthands: {
13
- all: (_: TStyleValue) => TReturn;
14
- animation: (_value: TStyleValue) => TReturn;
15
- background: (_value: TStyleValue) => TReturn;
16
- border: (_rawValue: TStyleValue) => TReturn;
17
- borderInline: (_rawValue: TStyleValue) => TReturn;
18
- borderBlock: (_rawValue: TStyleValue) => TReturn;
19
- borderTop: (_rawValue: TStyleValue) => TReturn;
20
- borderInlineEnd: (_rawValue: TStyleValue) => TReturn;
21
- borderRight: (_rawValue: TStyleValue) => TReturn;
22
- borderBottom: (_rawValue: TStyleValue) => TReturn;
23
- borderInlineStart: (_rawValue: TStyleValue) => TReturn;
24
- borderLeft: (_rawValue: TStyleValue) => TReturn;
25
- };
12
+ declare const shorthands: Readonly<{
13
+ [key: string]: ($$PARAM_0$$: TStyleValue) => TReturn;
14
+ }>;
26
15
  declare const aliases: {
27
16
  borderHorizontal: any;
28
17
  borderVertical: any;
@@ -82,7 +71,7 @@ declare const aliases: {
82
71
  end: (val: TStyleValue) => TReturn;
83
72
  };
84
73
  declare const $$EXPORT_DEFAULT_DECLARATION$$: Readonly</**
85
- * > 96 | ...typeof shorthands,
74
+ * > 85 | ...typeof shorthands,
86
75
  * | ^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
87
76
  **/
88
77
  any>;
@@ -18,20 +18,9 @@ import type { TStyleValue } from '../common-types';
18
18
 
19
19
  type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
20
20
 
21
- declare const shorthands: {
22
- all: (_: TStyleValue) => TReturn,
23
- animation: (_value: TStyleValue) => TReturn,
24
- background: (_value: TStyleValue) => TReturn,
25
- border: (_rawValue: TStyleValue) => TReturn,
26
- borderInline: (_rawValue: TStyleValue) => TReturn,
27
- borderBlock: (_rawValue: TStyleValue) => TReturn,
28
- borderTop: (_rawValue: TStyleValue) => TReturn,
29
- borderInlineEnd: (_rawValue: TStyleValue) => TReturn,
30
- borderRight: (_rawValue: TStyleValue) => TReturn,
31
- borderBottom: (_rawValue: TStyleValue) => TReturn,
32
- borderInlineStart: (_rawValue: TStyleValue) => TReturn,
33
- borderLeft: (_rawValue: TStyleValue) => TReturn,
34
- };
21
+ declare const shorthands: $ReadOnly<{
22
+ [key: string]: (TStyleValue) => TReturn,
23
+ }>;
35
24
 
36
25
  declare const aliases: {
37
26
  borderHorizontal: $FlowFixMe,
@@ -8,7 +8,7 @@ var _hash = _interopRequireDefault(require("./hash"));
8
8
  var _stylexVarsUtils = require("./stylex-vars-utils");
9
9
  var _types = require("./types");
10
10
  var _defaultOptions = require("./utils/default-options");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function styleXCreateTheme(themeVars, variables, options) {
13
13
  if (typeof themeVars.__themeName__ !== 'string') {
14
14
  throw new Error('Can only override variables theme created with stylex.defineVars().');
@@ -35,7 +35,7 @@ function styleXCreateTheme(themeVars, variables, options) {
35
35
  const stylesToInject = {};
36
36
  for (const atRule of sortedAtRules) {
37
37
  const decls = rulesByAtRule[atRule].join('');
38
- const rule = `.${overrideClassName}{${decls}}`;
38
+ const rule = `.${overrideClassName}, .${overrideClassName}:root{${decls}}`;
39
39
  if (atRule === 'default') {
40
40
  stylesToInject[overrideClassName] = {
41
41
  ltr: rule,
@@ -9,11 +9,14 @@
9
9
 
10
10
  import type { InjectableStyle, StyleXOptions } from './common-types';
11
11
  import type { VarsConfig } from './stylex-vars-utils';
12
- type VarsObject<Vars extends VarsConfig> = Readonly</**
13
- * > 14 | ...$ObjMapConst<Vars, string>,
14
- * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Unsupported feature: Translating "object types with complex spreads" is currently not supported.
15
- **/
16
- any>;
12
+ type VarsKeysWithStringValues<Vars extends VarsConfig> = Readonly<{
13
+ [$$Key$$: keyof Vars]: string;
14
+ }>;
15
+ type VarsObject<Vars extends VarsConfig> = Readonly<
16
+ Omit<VarsKeysWithStringValues<Vars>, keyof ({ __themeName__: string })> & {
17
+ __themeName__: string;
18
+ }
19
+ >;
17
20
  declare function styleXDefineVars<Vars extends VarsConfig>(
18
21
  variables: Vars,
19
22
  options: Readonly<
@@ -9,7 +9,7 @@ var _objectUtils = require("./utils/object-utils");
9
9
  var _defaultOptions = require("./utils/default-options");
10
10
  var _stylexVarsUtils = require("./stylex-vars-utils");
11
11
  var _types = require("./types");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  function styleXDefineVars(variables, options) {
14
14
  const {
15
15
  classNamePrefix,
@@ -35,7 +35,7 @@ function styleXDefineVars(variables, options) {
35
35
  }
36
36
  return {
37
37
  nameHash,
38
- value
38
+ value: value
39
39
  };
40
40
  });
41
41
  const themeVariablesObject = (0, _objectUtils.objMap)(variablesMap, _ref => {
@@ -10,8 +10,12 @@
10
10
  import type { InjectableStyle, StyleXOptions } from './common-types';
11
11
  import type { VarsConfig } from './stylex-vars-utils';
12
12
 
13
+ type VarsKeysWithStringValues<Vars: VarsConfig> = $ReadOnly<{
14
+ [$Keys<Vars>]: string,
15
+ }>;
16
+
13
17
  type VarsObject<Vars: VarsConfig> = $ReadOnly<{
14
- ...$ObjMapConst<Vars, string>,
18
+ ...VarsKeysWithStringValues<Vars>,
15
19
  __themeName__: string,
16
20
  }>;
17
21
 
@@ -7,7 +7,7 @@
7
7
  *
8
8
  */
9
9
 
10
- declare function stylexFirstThatWorks<T extends string>(
11
- ...args: ReadonlyArray<T>
12
- ): ReadonlyArray<T>;
10
+ declare function stylexFirstThatWorks(
11
+ ...args: ReadonlyArray<string>
12
+ ): ReadonlyArray<string> | string;
13
13
  export default stylexFirstThatWorks;
@@ -4,9 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = stylexFirstThatWorks;
7
+ const isVar = arg => typeof arg === 'string' && arg.match(/^var\(--[a-zA-Z0-9-_]+\)$/);
7
8
  function stylexFirstThatWorks() {
8
9
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9
10
  args[_key] = arguments[_key];
10
11
  }
11
- return [...args].reverse();
12
+ const firstVar = args.findIndex(isVar);
13
+ if (firstVar === -1) {
14
+ return [...args].reverse();
15
+ }
16
+ const priorities = args.slice(0, firstVar).reverse();
17
+ const rest = args.slice(firstVar);
18
+ const firstNonVar = rest.findIndex(arg => !isVar(arg));
19
+ const varParts = rest.slice(0, firstNonVar === -1 ? rest.length : firstNonVar + 1).reverse();
20
+ const vars = varParts.map(arg => isVar(arg) ? arg.slice(4, -1) : arg);
21
+ const returnValue = [vars.reduce((soFar, varName) => soFar ? `var(${varName}, ${String(soFar)})` : varName.startsWith('--') ? `var(${varName})` : varName, ''), ...priorities];
22
+ if (returnValue.length === 1) {
23
+ return returnValue[0];
24
+ }
25
+ return returnValue;
12
26
  }
@@ -7,6 +7,6 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function stylexFirstThatWorks<T: string>(
11
- ...args: $ReadOnlyArray<T>
12
- ): $ReadOnlyArray<T>;
10
+ declare export default function stylexFirstThatWorks(
11
+ ...args: $ReadOnlyArray<string>
12
+ ): $ReadOnlyArray<string> | string;
@@ -7,7 +7,7 @@ exports.IncludedStyles = void 0;
7
7
  exports.default = stylexInclude;
8
8
  var messages = _interopRequireWildcard(require("./messages"));
9
9
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
11
  let number = 0;
12
12
  function uuid() {
13
13
  return `__included_${++number}__`;
@@ -12,7 +12,7 @@ var _transformValue = _interopRequireDefault(require("./transform-value"));
12
12
  var _dashify = _interopRequireDefault(require("./utils/dashify"));
13
13
  var _objectUtils = require("./utils/object-utils");
14
14
  var _defaultOptions = require("./utils/default-options");
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
16
  function styleXKeyframes(frames) {
17
17
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _defaultOptions.defaultOptions;
18
18
  const {
@@ -7,7 +7,7 @@ exports.default = transformValue;
7
7
  exports.getNumberSuffix = getNumberSuffix;
8
8
  exports.timeUnits = exports.lengthUnits = void 0;
9
9
  var _normalizeValue = _interopRequireDefault(require("./utils/normalize-value"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  function transformValue(key, rawValue, options) {
12
12
  const value = typeof rawValue === 'number' ? String(Math.round(rawValue * 10000) / 10000) + getNumberSuffix(key) : rawValue;
13
13
  if ((key === 'content' || key === 'hyphenateCharacter' || key === 'hyphenate-character') && typeof value === 'string') {
@@ -22,9 +22,12 @@ function transformValue(key, rawValue, options) {
22
22
  return (0, _normalizeValue.default)(value, key, options);
23
23
  }
24
24
  function getNumberSuffix(key) {
25
- if (unitlessNumberProperties.has(key)) {
25
+ if (unitlessNumberProperties.has(key) || key.startsWith('--')) {
26
26
  return '';
27
27
  }
28
+ if (!(key in numberPropertySuffixes)) {
29
+ return 'px';
30
+ }
28
31
  const suffix = numberPropertySuffixes[key];
29
32
  if (suffix == null) {
30
33
  return 'px';
@@ -32,7 +35,7 @@ function getNumberSuffix(key) {
32
35
  return suffix;
33
36
  }
34
37
  }
35
- const unitlessNumberProperties = new Set(['WebkitLineClamp', 'animationIterationCount', 'aspectRatio', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'counterSet', 'columnCount', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexOrder', 'gridRow', 'gridColumn', 'fontWeight', 'hyphenateLimitChars', 'lineClamp', 'lineHeight', 'maskBorderOutset', 'maskBorderSlice', 'maskBorderWidth', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'fillOpacity', 'floodOpacity', 'rotate', 'scale', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'scale', 'mathDepth']);
38
+ const unitlessNumberProperties = new Set(['WebkitLineClamp', 'animationIterationCount', 'aspectRatio', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'counterSet', 'counterReset', 'columnCount', 'flex', 'flexGrow', 'flexShrink', 'flexOrder', 'gridRow', 'gridRowStart', 'gridRowEnd', 'gridColumn', 'gridColumnStart', 'gridColumnEnd', 'gridArea', 'fontWeight', 'hyphenateLimitChars', 'lineClamp', 'lineHeight', 'maskBorderOutset', 'maskBorderSlice', 'maskBorderWidth', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'fillOpacity', 'floodOpacity', 'rotate', 'scale', 'shapeImageThreshold', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'scale', 'mathDepth']);
36
39
  const numberPropertySuffixes = {
37
40
  animationDelay: 'ms',
38
41
  animationDuration: 'ms',
@@ -41,4 +44,4 @@ const numberPropertySuffixes = {
41
44
  voiceDuration: 'ms'
42
45
  };
43
46
  const timeUnits = exports.timeUnits = new Set(Object.keys(numberPropertySuffixes));
44
- const lengthUnits = exports.lengthUnits = new Set(['backgroundPositionX', 'backgroundPositionY', 'blockSize', 'borderBlockEndWidth', 'borderBlockStartWidth', 'borderBlockWidth', 'borderVerticalWidth', 'borderVerticalWidth', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', 'borderImageWidth', 'borderInlineEndWidth', 'borderEndWidth', 'borderInlineStartWidth', 'borderStartWidth', 'borderInlineWidth', 'borderHorizontalWidth', 'borderLeftWidth', 'borderRightWidth', 'borderSpacing', 'borderStartEndRadius', 'borderStartStartRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopWidth', 'bottom', 'columnGap', 'columnRuleWidth', 'columnWidth', 'containIntrinsicBlockSize', 'containIntrinsicHeight', 'containIntrinsicInlineSize', 'containIntrinsicWidth', 'flexBasis', 'fontSize', 'fontSmooth', 'height', 'inlineSize', 'insetBlockEnd', 'insetBlockStart', 'insetInlineEnd', 'insetInlineStart', 'left', 'letterSpacing', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInlineEnd', 'marginEnd', 'marginInlineStart', 'marginStart', 'marginLeft', 'marginRight', 'marginTop', 'maskBorderOutset', 'maskBorderWidth', 'maxBlockSize', 'maxHeight', 'maxInlineSize', 'maxWidth', 'minBlockSize', 'minHeight', 'minInlineSize', 'minWidth', 'offsetDistance', 'outlineOffset', 'outlineWidth', 'overflowClipMargin', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInlineEnd', 'paddingEnd', 'paddingInlineStart', 'paddingStart', 'paddingLeft', 'paddingRight', 'paddingTop', 'perspective', 'right', 'rowGap', 'scrollMarginBlockEnd', 'scrollMarginBlockStart', 'scrollMarginBottom', 'scrollMarginInlineEnd', 'scrollMarginInlineStart', 'scrollMarginLeft', 'scrollMarginRight', 'scrollMarginTop', 'scrollPaddingBlockEnd', 'scrollPaddingBlockStart', 'scrollPaddingBottom', 'scrollPaddingInlineEnd', 'scrollPaddingInlineStart', 'scrollPaddingLeft', 'scrollPaddingRight', 'scrollPaddingTop', 'scrollSnapMarginBottom', 'scrollSnapMarginLeft', 'scrollSnapMarginRight', 'scrollSnapMarginTop', 'shapeMargin', 'tabSize', 'textDecorationThickness', 'textIndent', 'textUnderlineOffset', 'top', 'transformOrigin', 'translate', 'verticalAlign', 'width', 'wordSpacing', 'border', 'borderBlock', 'borderBlockEnd', 'borderBlockStart', 'borderBottom', 'borderLeft', 'borderRadius', 'borderRight', 'borderTop', 'borderWidth', 'columnRule', 'containIntrinsicSize', 'gap', 'inset', 'insetBlock', 'insetInline', 'margin', 'marginBlock', 'marginVertical', 'marginInline', 'marginHorizontal', 'offset', 'outline', 'padding', 'paddingBlock', 'paddingVertical', 'paddingInline', 'paddingHorizontal', 'scrollMargin', 'scrollMarginBlock', 'scrollMarginInline', 'scrollPadding', 'scrollPaddingBlock', 'scrollPaddingInline', 'scrollSnapMargin']);
47
+ const lengthUnits = exports.lengthUnits = new Set(['backgroundPositionX', 'backgroundPositionY', 'blockSize', 'borderBlockEndWidth', 'borderBlockStartWidth', 'borderBlockWidth', 'borderVerticalWidth', 'borderVerticalWidth', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', 'borderInlineEndWidth', 'borderEndWidth', 'borderInlineStartWidth', 'borderStartWidth', 'borderInlineWidth', 'borderHorizontalWidth', 'borderLeftWidth', 'borderRightWidth', 'borderSpacing', 'borderStartEndRadius', 'borderStartStartRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopWidth', 'bottom', 'columnGap', 'columnRuleWidth', 'columnWidth', 'containIntrinsicBlockSize', 'containIntrinsicHeight', 'containIntrinsicInlineSize', 'containIntrinsicWidth', 'flexBasis', 'fontSize', 'fontSmooth', 'height', 'inlineSize', 'insetBlockEnd', 'insetBlockStart', 'insetInlineEnd', 'insetInlineStart', 'left', 'letterSpacing', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInlineEnd', 'marginEnd', 'marginInlineStart', 'marginStart', 'marginLeft', 'marginRight', 'marginTop', 'maskBorderOutset', 'maskBorderWidth', 'maxBlockSize', 'maxHeight', 'maxInlineSize', 'maxWidth', 'minBlockSize', 'minHeight', 'minInlineSize', 'minWidth', 'offsetDistance', 'outlineOffset', 'outlineWidth', 'overflowClipMargin', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInlineEnd', 'paddingEnd', 'paddingInlineStart', 'paddingStart', 'paddingLeft', 'paddingRight', 'paddingTop', 'perspective', 'right', 'rowGap', 'scrollMarginBlockEnd', 'scrollMarginBlockStart', 'scrollMarginBottom', 'scrollMarginInlineEnd', 'scrollMarginInlineStart', 'scrollMarginLeft', 'scrollMarginRight', 'scrollMarginTop', 'scrollPaddingBlockEnd', 'scrollPaddingBlockStart', 'scrollPaddingBottom', 'scrollPaddingInlineEnd', 'scrollPaddingInlineStart', 'scrollPaddingLeft', 'scrollPaddingRight', 'scrollPaddingTop', 'scrollSnapMarginBottom', 'scrollSnapMarginLeft', 'scrollSnapMarginRight', 'scrollSnapMarginTop', 'shapeMargin', 'tabSize', 'textDecorationThickness', 'textIndent', 'textUnderlineOffset', 'top', 'transformOrigin', 'translate', 'verticalAlign', 'width', 'wordSpacing', 'border', 'borderBlock', 'borderBlockEnd', 'borderBlockStart', 'borderBottom', 'borderLeft', 'borderRadius', 'borderRight', 'borderTop', 'borderWidth', 'columnRule', 'containIntrinsicSize', 'gap', 'inset', 'insetBlock', 'insetInline', 'margin', 'marginBlock', 'marginVertical', 'marginInline', 'marginHorizontal', 'offset', 'outline', 'padding', 'paddingBlock', 'paddingVertical', 'paddingInline', 'paddingHorizontal', 'scrollMargin', 'scrollMarginBlock', 'scrollMarginInline', 'scrollPadding', 'scrollPaddingBlock', 'scrollPaddingInline', 'scrollSnapMargin']);
@@ -65,7 +65,7 @@ export interface CSSType<+_T: string | number = string | number> {
65
65
 
66
66
  declare export const isCSSType: (
67
67
  value: mixed,
68
- ) => value is CSSType<string | number>;
68
+ ) => implies value is CSSType<string | number>;
69
69
 
70
70
  type AngleValue = string;
71
71
  declare export class Angle<+T: AngleValue>
@@ -13,7 +13,7 @@ var _zeroDimensions = _interopRequireDefault(require("./normalizers/zero-dimensi
13
13
  var _detectUnclosedFns = _interopRequireDefault(require("./normalizers/detect-unclosed-fns"));
14
14
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
15
15
  var _convertCamelCaseValues = _interopRequireDefault(require("./normalizers/convert-camel-case-values"));
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
17
  const normalizers = [_detectUnclosedFns.default, _whitespace.default, _timings.default, _zeroDimensions.default, _leadingZero.default, _quotes.default, _convertCamelCaseValues.default];
18
18
  function normalizeValue(value, key, _ref) {
19
19
  let {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = convertCamelCasedValues;
7
7
  var _dashify = _interopRequireDefault(require("../dashify"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  function convertCamelCasedValues(ast, key) {
10
10
  if (key !== 'transitionProperty' && key !== 'willChange') {
11
11
  return ast;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = detectUnclosedFns;
7
7
  var messages = _interopRequireWildcard(require("../../messages"));
8
8
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
10
  function detectUnclosedFns(ast, _) {
11
11
  ast.walk(node => {
12
12
  if (node.type === 'function' && node.unclosed) {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = convertFontSizeToRem;
7
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const ROOT_FONT_SIZE = 16;
10
10
  function convertFontSizeToRem(ast, key) {
11
11
  if (key !== 'fontSize') {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = normalizeLeadingZero;
7
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  function normalizeLeadingZero(ast, _) {
10
10
  ast.walk(node => {
11
11
  if (node.type !== 'word') {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = normalizeTimings;
7
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  function normalizeTimings(ast, _) {
10
10
  ast.walk(node => {
11
11
  if (node.type !== 'word') {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = normalizeZeroDimensions;
7
7
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const angles = ['deg', 'grad', 'turn', 'rad'];
10
10
  const timings = ['ms', 's'];
11
11
  const fraction = 'fr';
@@ -9,7 +9,8 @@
9
9
 
10
10
  import type { CompiledStyles } from '../common-types';
11
11
  import { IncludedStyles } from '../stylex-include';
12
- export declare function isPlainObject(obj: unknown): void;
12
+ type AnyObject = { readonly [$$Key$$: string]: unknown };
13
+ export declare function isPlainObject(obj: unknown): obj is AnyObject;
13
14
  export declare function flattenObject(obj: CompiledStyles): {
14
15
  readonly [$$Key$$: string]: null | string | IncludedStyles;
15
16
  };
@@ -42,7 +43,7 @@ export declare function objMapEntry<
42
43
  K2 extends string = string,
43
44
  >(
44
45
  obj: { readonly [$$Key$$: K1]: V },
45
- mapper: ($$PARAM_0$$: [K1, V]) => [K2, V2],
46
+ mapper: ($$PARAM_0$$: Readonly<[K1, V]>) => Readonly<[K2, V2]>,
46
47
  ): { readonly [$$Key$$: K2]: V2 };
47
48
  export declare function objMap<V, V2, K extends string = string>(
48
49
  obj: { readonly [$$Key$$: K]: V },
@@ -13,7 +13,10 @@ import type { CompiledStyles } from '../common-types';
13
13
 
14
14
  import { IncludedStyles } from '../stylex-include';
15
15
 
16
- declare export function isPlainObject(obj: mixed): void;
16
+ // eslint-disable-next-line no-unused-vars
17
+ type AnyObject = { +[string]: mixed };
18
+
19
+ declare export function isPlainObject(obj: mixed): implies obj is AnyObject;
17
20
 
18
21
  declare export function flattenObject(obj: CompiledStyles): {
19
22
  +[string]: null | string | IncludedStyles,
@@ -48,7 +51,7 @@ declare export function objMapEntry<
48
51
  K2: string = string,
49
52
  >(
50
53
  obj: { +[K1]: V },
51
- mapper: ([K1, V]) => [K2, V2],
54
+ mapper: ($ReadOnly<[K1, V]>) => $ReadOnly<[K2, V2]>,
52
55
  ): { +[K2]: V2 };
53
56
 
54
57
  declare export function objMap<V, V2, K: string = string>(
@@ -7,62 +7,9 @@
7
7
  *
8
8
  */
9
9
 
10
- type PseudoClassPriorities = {
11
- ':is': 40;
12
- ':where': 40;
13
- ':not': 40;
14
- ':has': 45;
15
- ':dir': 50;
16
- ':lang': 51;
17
- ':first-child': 52;
18
- ':first-of-type': 53;
19
- ':last-child': 54;
20
- ':last-of-type': 55;
21
- ':only-child': 56;
22
- ':only-of-type': 57;
23
- ':nth-child': 60;
24
- ':nth-last-child': 61;
25
- ':nth-of-type': 62;
26
- ':nth-last-of-type': 63;
27
- ':empty': 70;
28
- ':link': 80;
29
- ':any-link': 81;
30
- ':local-link': 82;
31
- ':target-within': 83;
32
- ':target': 84;
33
- ':visited': 85;
34
- ':enabled': 91;
35
- ':disabled': 92;
36
- ':required': 93;
37
- ':optional': 94;
38
- ':read-only': 95;
39
- ':read-write': 96;
40
- ':placeholder-shown': 97;
41
- ':in-range': 98;
42
- ':out-of-range': 99;
43
- ':default': 100;
44
- ':checked': 101;
45
- ':indeterminate': 101;
46
- ':blank': 102;
47
- ':valid': 103;
48
- ':invalid': 104;
49
- ':user-invalid': 105;
50
- ':autofill': 110;
51
- ':picture-in-picture': 120;
52
- ':modal': 121;
53
- ':fullscreen': 122;
54
- ':paused': 123;
55
- ':playing': 124;
56
- ':current': 125;
57
- ':past': 126;
58
- ':future': 127;
59
- ':hover': 130;
60
- ':focusWithin': 140;
61
- ':focus': 150;
62
- ':focusVisible': 160;
63
- ':active': 170;
64
- };
65
- export declare const PSEUDO_CLASS_PRIORITIES: Readonly<PseudoClassPriorities>;
10
+ export declare const PSEUDO_CLASS_PRIORITIES: Readonly<{
11
+ [$$Key$$: string]: number;
12
+ }>;
66
13
  type AtRulePriorities = { '@supports': 30; '@media': 200; '@container': 300 };
67
14
  export declare const AT_RULE_PRIORITIES: Readonly<AtRulePriorities>;
68
15
  export declare const PSEUDO_ELEMENT_PRIORITY: number;
@@ -56,11 +56,11 @@ longHandLogical.add('border-block-width');
56
56
  shorthandsOfLonghands.add('border-block-start');
57
57
  shorthandsOfLonghands.add('border-top');
58
58
  longHandLogical.add('border-block-start-color');
59
- longHandLogical.add('border-top-color');
59
+ longHandPhysical.add('border-top-color');
60
60
  longHandLogical.add('border-block-start-style');
61
- longHandLogical.add('border-top-style');
61
+ longHandPhysical.add('border-top-style');
62
62
  longHandLogical.add('border-block-start-width');
63
- longHandLogical.add('border-top-width');
63
+ longHandPhysical.add('border-top-width');
64
64
  shorthandsOfLonghands.add('border-block-end');
65
65
  shorthandsOfLonghands.add('border-bottom');
66
66
  longHandLogical.add('border-block-end-color');
@@ -7,63 +7,63 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- type PseudoClassPriorities = {
11
- ':is': 40,
12
- ':where': 40,
13
- ':not': 40,
14
- ':has': 45,
15
- ':dir': 50,
16
- ':lang': 51,
17
- ':first-child': 52,
18
- ':first-of-type': 53,
19
- ':last-child': 54,
20
- ':last-of-type': 55,
21
- ':only-child': 56,
22
- ':only-of-type': 57,
23
- ':nth-child': 60,
24
- ':nth-last-child': 61,
25
- ':nth-of-type': 62,
26
- ':nth-last-of-type': 63, // 'nth-last-of-type' is the same priority as 'nth-of-type
27
- ':empty': 70,
28
- ':link': 80,
29
- ':any-link': 81,
30
- ':local-link': 82,
31
- ':target-within': 83,
32
- ':target': 84,
33
- ':visited': 85,
34
- ':enabled': 91,
35
- ':disabled': 92,
36
- ':required': 93,
37
- ':optional': 94,
38
- ':read-only': 95,
39
- ':read-write': 96,
40
- ':placeholder-shown': 97,
41
- ':in-range': 98,
42
- ':out-of-range': 99,
43
- ':default': 100,
44
- ':checked': 101,
45
- ':indeterminate': 101,
46
- ':blank': 102,
47
- ':valid': 103,
48
- ':invalid': 104,
49
- ':user-invalid': 105,
50
- ':autofill': 110,
51
- ':picture-in-picture': 120,
52
- ':modal': 121,
53
- ':fullscreen': 122,
54
- ':paused': 123,
55
- ':playing': 124,
56
- ':current': 125,
57
- ':past': 126,
58
- ':future': 127,
59
- ':hover': 130,
60
- ':focusWithin': 140,
61
- ':focus': 150,
62
- ':focusVisible': 160,
63
- ':active': 170,
64
- };
10
+ // type PseudoClassPriorities = {
11
+ // ':is': 40,
12
+ // ':where': 40,
13
+ // ':not': 40,
14
+ // ':has': 45,
15
+ // ':dir': 50,
16
+ // ':lang': 51,
17
+ // ':first-child': 52,
18
+ // ':first-of-type': 53,
19
+ // ':last-child': 54,
20
+ // ':last-of-type': 55,
21
+ // ':only-child': 56,
22
+ // ':only-of-type': 57,
23
+ // ':nth-child': 60,
24
+ // ':nth-last-child': 61,
25
+ // ':nth-of-type': 62,
26
+ // ':nth-last-of-type': 63, // 'nth-last-of-type' is the same priority as 'nth-of-type
27
+ // ':empty': 70,
28
+ // ':link': 80,
29
+ // ':any-link': 81,
30
+ // ':local-link': 82,
31
+ // ':target-within': 83,
32
+ // ':target': 84,
33
+ // ':visited': 85,
34
+ // ':enabled': 91,
35
+ // ':disabled': 92,
36
+ // ':required': 93,
37
+ // ':optional': 94,
38
+ // ':read-only': 95,
39
+ // ':read-write': 96,
40
+ // ':placeholder-shown': 97,
41
+ // ':in-range': 98,
42
+ // ':out-of-range': 99,
43
+ // ':default': 100,
44
+ // ':checked': 101,
45
+ // ':indeterminate': 101,
46
+ // ':blank': 102,
47
+ // ':valid': 103,
48
+ // ':invalid': 104,
49
+ // ':user-invalid': 105,
50
+ // ':autofill': 110,
51
+ // ':picture-in-picture': 120,
52
+ // ':modal': 121,
53
+ // ':fullscreen': 122,
54
+ // ':paused': 123,
55
+ // ':playing': 124,
56
+ // ':current': 125,
57
+ // ':past': 126,
58
+ // ':future': 127,
59
+ // ':hover': 130,
60
+ // ':focusWithin': 140,
61
+ // ':focus': 150,
62
+ // ':focusVisible': 160,
63
+ // ':active': 170,
64
+ // };
65
65
 
66
- declare export const PSEUDO_CLASS_PRIORITIES: $ReadOnly<PseudoClassPriorities>;
66
+ declare export const PSEUDO_CLASS_PRIORITIES: $ReadOnly<{ [string]: number }>;
67
67
 
68
68
  type AtRulePriorities = {
69
69
  '@supports': 30,