@stylexjs/shared 0.2.0-beta.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. package/README.md +3 -3
  2. package/lib/common-types.d.ts +49 -0
  3. package/lib/common-types.js.flow +64 -0
  4. package/lib/convert-to-className.d.ts +16 -0
  5. package/lib/convert-to-className.js +17 -26
  6. package/lib/convert-to-className.js.flow +23 -0
  7. package/lib/generate-css-rule.d.ts +17 -0
  8. package/lib/generate-css-rule.js +6 -17
  9. package/lib/generate-css-rule.js.flow +17 -0
  10. package/lib/hash.d.ts +11 -0
  11. package/lib/hash.js +3 -27
  12. package/lib/hash.js.flow +10 -0
  13. package/lib/index.d.ts +42 -85
  14. package/lib/index.js +21 -29
  15. package/lib/index.js.flow +57 -3
  16. package/lib/messages.d.ts +41 -0
  17. package/lib/messages.js +33 -53
  18. package/lib/messages.js.flow +44 -0
  19. package/lib/physical-rtl/generate-ltr.d.ts +11 -0
  20. package/lib/physical-rtl/generate-ltr.js +18 -46
  21. package/lib/physical-rtl/generate-ltr.js.flow +12 -0
  22. package/lib/physical-rtl/generate-rtl.d.ts +13 -0
  23. package/lib/physical-rtl/generate-rtl.js +18 -50
  24. package/lib/physical-rtl/generate-rtl.js.flow +12 -0
  25. package/lib/preprocess-rules/PreRule.d.ts +52 -0
  26. package/lib/preprocess-rules/PreRule.js +87 -0
  27. package/lib/preprocess-rules/PreRule.js.flow +64 -0
  28. package/lib/preprocess-rules/application-order.d.ts +290 -0
  29. package/lib/preprocess-rules/application-order.js +60 -133
  30. package/lib/preprocess-rules/application-order.js.flow +241 -0
  31. package/lib/preprocess-rules/basic-validation.d.ts +13 -0
  32. package/lib/preprocess-rules/basic-validation.js +83 -0
  33. package/lib/preprocess-rules/basic-validation.js.flow +13 -0
  34. package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +25 -0
  35. package/lib/preprocess-rules/flatten-raw-style-obj.js +120 -0
  36. package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +27 -0
  37. package/lib/preprocess-rules/index.d.ts +18 -0
  38. package/lib/preprocess-rules/index.js +0 -9
  39. package/lib/preprocess-rules/index.js.flow +19 -0
  40. package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +200 -0
  41. package/lib/preprocess-rules/legacy-expand-shorthands.js +90 -123
  42. package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +179 -0
  43. package/lib/preprocess-rules/property-specificity.d.ts +89 -0
  44. package/lib/preprocess-rules/property-specificity.js +46 -74
  45. package/lib/preprocess-rules/property-specificity.js.flow +98 -0
  46. package/lib/properties/CSS Animations.json +445 -0
  47. package/lib/properties/CSS Backgrounds and Borders.json +1085 -0
  48. package/lib/properties/CSS Basic User Interface.json +365 -0
  49. package/lib/properties/CSS Box Alignment.json +245 -0
  50. package/lib/properties/CSS Box Model.json +501 -0
  51. package/lib/properties/CSS Color.json +100 -0
  52. package/lib/properties/CSS Columns.json +185 -0
  53. package/lib/properties/CSS Containment.json +203 -0
  54. package/lib/properties/CSS Counter Styles.json +56 -0
  55. package/lib/properties/CSS Display.json +20 -0
  56. package/lib/properties/CSS Flexible Box Layout.json +167 -0
  57. package/lib/properties/CSS Fonts.json +684 -0
  58. package/lib/properties/CSS Fragmentation.json +110 -0
  59. package/lib/properties/CSS Generated Content.json +38 -0
  60. package/lib/properties/CSS Grid Layout.json +500 -0
  61. package/lib/properties/CSS Images.json +91 -0
  62. package/lib/properties/CSS Inline.json +38 -0
  63. package/lib/properties/CSS Lists and Counters.json +86 -0
  64. package/lib/properties/CSS Logical Properties.json +1086 -0
  65. package/lib/properties/CSS Masking.json +399 -0
  66. package/lib/properties/CSS Miscellaneous.json +38 -0
  67. package/lib/properties/CSS Motion Path.json +132 -0
  68. package/lib/properties/CSS Overflow.json +216 -0
  69. package/lib/properties/CSS Pages.json +83 -0
  70. package/lib/properties/CSS Positioning.json +166 -0
  71. package/lib/properties/CSS Ruby.json +55 -0
  72. package/lib/properties/CSS Scroll Anchoring.json +19 -0
  73. package/lib/properties/CSS Scroll Snap.json +604 -0
  74. package/lib/properties/CSS Scrollbars.json +38 -0
  75. package/lib/properties/CSS Shapes.json +56 -0
  76. package/lib/properties/CSS Speech.json +20 -0
  77. package/lib/properties/CSS Table.json +115 -0
  78. package/lib/properties/CSS Text Decoration.json +312 -0
  79. package/lib/properties/CSS Text.json +415 -0
  80. package/lib/properties/CSS Transforms.json +188 -0
  81. package/lib/properties/CSS Transitions.json +122 -0
  82. package/lib/properties/CSS Variables.json +20 -0
  83. package/lib/properties/CSS View Transitions.json +20 -0
  84. package/lib/properties/CSS Will Change.json +20 -0
  85. package/lib/properties/CSS Writing Modes.json +92 -0
  86. package/lib/properties/Compositing and Blending.json +62 -0
  87. package/lib/properties/Filter Effects.json +38 -0
  88. package/lib/properties/MathML.json +56 -0
  89. package/lib/properties/Microsoft Extensions.json +885 -0
  90. package/lib/properties/Mozilla Extensions.json +607 -0
  91. package/lib/properties/Pointer Events.json +20 -0
  92. package/lib/properties/WebKit Extensions.json +707 -0
  93. package/lib/properties.json +10122 -0
  94. package/lib/stylex-create-theme.d.ts +26 -0
  95. package/lib/stylex-create-theme.js +67 -0
  96. package/lib/stylex-create-theme.js.flow +19 -0
  97. package/lib/stylex-create.d.ts +23 -0
  98. package/lib/stylex-create.js +30 -146
  99. package/lib/stylex-create.js.flow +30 -0
  100. package/lib/stylex-define-vars.d.ts +29 -0
  101. package/lib/stylex-define-vars.js +73 -0
  102. package/lib/stylex-define-vars.js.flow +26 -0
  103. package/lib/stylex-first-that-works.d.ts +13 -0
  104. package/lib/stylex-first-that-works.js +0 -10
  105. package/lib/stylex-first-that-works.js.flow +12 -0
  106. package/lib/stylex-include.d.ts +18 -0
  107. package/lib/stylex-include.js +2 -12
  108. package/lib/stylex-include.js.flow +20 -0
  109. package/lib/stylex-keyframes.d.ts +17 -0
  110. package/lib/stylex-keyframes.js +6 -26
  111. package/lib/stylex-keyframes.js.flow +20 -0
  112. package/lib/transform-value.d.ts +22 -0
  113. package/lib/transform-value.js +9 -23
  114. package/lib/transform-value.js.flow +25 -0
  115. package/lib/types/index.d.ts +205 -0
  116. package/lib/types/index.js +191 -0
  117. package/lib/types/index.js.flow +241 -0
  118. package/lib/utils/Rule.d.ts +58 -0
  119. package/lib/utils/Rule.js +0 -21
  120. package/lib/utils/Rule.js.flow +64 -0
  121. package/lib/utils/dashify.d.ts +11 -0
  122. package/lib/utils/dashify.js +0 -8
  123. package/lib/utils/dashify.js.flow +10 -0
  124. package/lib/utils/default-options.d.ts +11 -0
  125. package/lib/utils/default-options.js +13 -0
  126. package/lib/utils/default-options.js.flow +25 -0
  127. package/lib/utils/file-based-identifier.d.ts +15 -0
  128. package/lib/utils/file-based-identifier.js +14 -0
  129. package/lib/utils/file-based-identifier.js.flow +14 -0
  130. package/lib/utils/genCSSRule.d.ts +15 -0
  131. package/lib/utils/genCSSRule.js +9 -18
  132. package/lib/utils/genCSSRule.js.flow +15 -0
  133. package/lib/utils/normalize-value.d.ts +16 -0
  134. package/lib/utils/normalize-value.js +8 -15
  135. package/lib/utils/normalize-value.js.flow +16 -0
  136. package/lib/utils/normalizers/convert-camel-case-transition-props.d.ts +14 -0
  137. package/lib/utils/normalizers/convert-camel-case-transition-props.js +23 -0
  138. package/lib/utils/normalizers/convert-camel-case-transition-props.js.flow +13 -0
  139. package/lib/utils/normalizers/convert-camel-case-values.d.ts +14 -0
  140. package/lib/utils/normalizers/convert-camel-case-values.js +23 -0
  141. package/lib/utils/normalizers/convert-camel-case-values.js.flow +13 -0
  142. package/lib/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
  143. package/lib/utils/normalizers/detect-unclosed-fns.js +2 -14
  144. package/lib/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
  145. package/lib/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
  146. package/lib/utils/normalizers/font-size-px-to-rem.js +9 -19
  147. package/lib/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
  148. package/lib/utils/normalizers/leading-zero.d.ts +17 -0
  149. package/lib/utils/normalizers/leading-zero.js +0 -12
  150. package/lib/utils/normalizers/leading-zero.js.flow +16 -0
  151. package/lib/utils/normalizers/quotes.d.ts +18 -0
  152. package/lib/utils/normalizers/quotes.js +0 -13
  153. package/lib/utils/normalizers/quotes.js.flow +17 -0
  154. package/lib/utils/normalizers/timings.d.ts +18 -0
  155. package/lib/utils/normalizers/timings.js +0 -14
  156. package/lib/utils/normalizers/timings.js.flow +17 -0
  157. package/lib/utils/normalizers/whitespace.d.ts +19 -0
  158. package/lib/utils/normalizers/whitespace.js +0 -15
  159. package/lib/utils/normalizers/whitespace.js.flow +18 -0
  160. package/lib/utils/normalizers/zero-dimensions.d.ts +19 -0
  161. package/lib/utils/normalizers/zero-dimensions.js +0 -15
  162. package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
  163. package/lib/utils/object-utils.d.ts +66 -0
  164. package/lib/utils/object-utils.js +21 -13
  165. package/lib/utils/object-utils.js.flow +77 -0
  166. package/lib/utils/property-priorities.d.ts +11 -0
  167. package/lib/utils/property-priorities.js +516 -101
  168. package/lib/utils/property-priorities.js.flow +10 -0
  169. package/lib/utils/split-css-value.d.ts +14 -0
  170. package/lib/utils/split-css-value.js +0 -14
  171. package/lib/utils/split-css-value.js.flow +15 -0
  172. package/lib/validate.d.ts +12 -0
  173. package/lib/validate.js +1 -10
  174. package/lib/validate.js.flow +12 -0
  175. package/package.json +4 -5
  176. package/lib/expand-shorthands.d.ts +0 -5
  177. package/lib/expand-shorthands.js +0 -330
  178. package/lib/namespace-transforms/__tests__/preflatten.test.js +0 -120
  179. package/lib/namespace-transforms/preflatten.js +0 -89
  180. package/lib/preprocess-rules/expand-shorthands.js +0 -156
  181. package/lib/preprocess-rules/null-out-longhand.js +0 -310
  182. package/lib/preprocess-rules/react-native-web.js +0 -142
  183. package/lib/stylex-defaultValue.js +0 -397
@@ -4,98 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _splitCssValue = _interopRequireDefault(require("../utils/split-css-value"));
8
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
- /**
10
- * Copyright (c) Meta Platforms, Inc. and affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- *
15
- *
16
- */
17
-
18
7
  const shorthands = {
19
8
  all: _ => {
20
9
  throw new Error('all is not supported');
21
10
  },
22
- animation: value => [['animation', value], ['animationName', null], ['animationDuration', null], ['animationTimingFunction', null], ['animationDelay', null], ['animationIterationCount', null], ['animationDirection', null], ['animationFillMode', null], ['animationPlayState', null]],
23
- background: value => [['background', value], ['backgroundAttachment', null], ['backgroundClip', null], ['backgroundColor', null], ['backgroundImage', null], ['backgroundOrigin', null], ['backgroundPosition', null], ['backgroundRepeat', null], ['backgroundSize', null]],
24
- // These will be removed later, matching the properties with React Native.
25
- // For now, we're compiling them to the React Native properties.
26
- // @Deprecated
27
- border: rawValue => {
28
- if (typeof rawValue === 'number') {
29
- return shorthands.borderWidth(rawValue);
30
- }
31
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
32
- return [...shorthands.borderWidth(width), ...shorthands.borderStyle(style), ...shorthands.borderColor(color)];
33
- },
34
- // @Deprecated
35
- borderInline: rawValue => {
36
- if (typeof rawValue === 'number') {
37
- return [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]];
38
- }
39
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
40
- return [...shorthands.borderInlineWidth(width), ...shorthands.borderInlineStyle(style), ...shorthands.borderInlineColor(color)];
41
- },
42
- // @Deprecated
43
- borderBlock: rawValue => {
44
- if (typeof rawValue === 'number') {
45
- return [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]];
46
- }
47
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
48
- return [...shorthands.borderBlockWidth(width), ...shorthands.borderBlockStyle(style), ...shorthands.borderBlockColor(color)];
49
- },
50
- // @Deprecated
51
- borderTop: rawValue => {
52
- if (typeof rawValue === 'number') {
53
- return [['borderTopWidth', rawValue]];
54
- }
55
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
56
- return [['borderTopWidth', width], ['borderTopStyle', style], ['borderTopColor', color]];
57
- },
58
- // @Deprecated
59
- borderInlineEnd: rawValue => {
60
- if (typeof rawValue === 'number') {
61
- return [['borderInlineEndWidth', rawValue]];
62
- }
63
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
64
- return [['borderInlineEndWidth', width], ['borderInlineEndStyle', style], ['borderInlineEndColor', color]];
65
- },
66
- // @Deprecated
67
- borderRight: rawValue => {
68
- 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(' '));
69
- },
70
- // @Deprecated
71
- borderBottom: rawValue => {
72
- if (typeof rawValue === 'number') {
73
- return [['borderBottomWidth', rawValue]];
74
- }
75
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
76
- return [['borderBottomWidth', width], ['borderBottomStyle', style], ['borderBottomColor', color]];
77
- },
78
- // @Deprecated
79
- borderInlineStart: rawValue => {
80
- if (typeof rawValue === 'number') {
81
- return [['borderInlineStartWidth', rawValue]];
82
- }
83
- const [width, style, color] = (0, _splitCssValue.default)(rawValue);
84
- return [['borderInlineStartWidth', width], ['borderInlineStartStyle', style], ['borderInlineStartColor', color]];
85
- },
86
- // @Deprecated
87
- borderLeft: rawValue => {
88
- 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(' '));
89
- },
11
+ animation: value => [['animation', value], ['animationComposition', null], ['animationName', null], ['animationDuration', null], ['animationTimingFunction', null], ['animationDelay', null], ['animationIterationCount', null], ['animationDirection', null], ['animationFillMode', null], ['animationPlayState', null], ...shorthands.animationRange(null), ['animationTimeline', null]],
12
+ animationRange: value => [['animationRange', value], ['animationRangeEnd', null], ['animationRangeStart', null]],
13
+ background: value => [['background', value], ['backgroundAttachment', null], ['backgroundClip', null], ['backgroundColor', null], ['backgroundImage', null], ['backgroundOrigin', null], ...shorthands.backgroundPosition(null), ['backgroundRepeat', null], ['backgroundSize', null]],
14
+ backgroundPosition: value => [['backgroundPosition', value], ['backgroundPositionX', null], ['backgroundPositionY', null]],
15
+ border: rawValue => [['border', rawValue], ...shorthands.borderWidth(null), ...shorthands.borderStyle(null), ...shorthands.borderColor(null)],
16
+ borderInline: rawValue => [['borderInline', rawValue], ...shorthands.borderInlineWidth(null), ...shorthands.borderInlineStyle(null), ...shorthands.borderInlineColor(null)],
17
+ borderBlock: rawValue => [['borderBlock', rawValue], ...shorthands.borderBlockWidth(null), ...shorthands.borderBlockStyle(null), ...shorthands.borderBlockColor(null)],
18
+ borderTop: rawValue => [['borderTop', rawValue], ['borderTopWidth', null], ['borderTopStyle', null], ['borderTopColor', null]],
19
+ borderInlineEnd: rawValue => [['borderInlineEnd', rawValue], ...shorthands.borderInlineEndWidth(null), ...shorthands.borderInlineEndStyle(null), ...shorthands.borderInlineEndColor(null)],
20
+ borderRight: rawValue => [['borderRight', rawValue], ...shorthands.borderRightWidth(null), ...shorthands.borderRightStyle(null), ...shorthands.borderRightColor(null)],
21
+ borderBottom: rawValue => [['borderBottom', rawValue], ['borderBottomWidth', null], ['borderBottomStyle', null], ['borderBottomColor', null]],
22
+ borderInlineStart: rawValue => [['borderInlineStart', rawValue], ...shorthands.borderInlineStartWidth(null), ...shorthands.borderInlineStartStyle(null), ...shorthands.borderInlineStartColor(null)],
23
+ borderLeft: rawValue => [['borderLeft', rawValue], ...shorthands.borderLeftWidth(null), ...shorthands.borderLeftStyle(null), ...shorthands.borderLeftColor(null)],
90
24
  borderInlineWidth: rawValue => [['borderInlineWidth', rawValue], ['borderInlineStartWidth', null], ['borderLeftWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null]],
91
25
  borderInlineStyle: rawValue => [['borderInlineStyle', rawValue], ['borderInlineStartStyle', null], ['borderLeftStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null]],
92
26
  borderInlineColor: rawValue => [['borderInlineColor', rawValue], ['borderInlineStartColor', null], ['borderLeftColor', null], ['borderInlineEndColor', null], ['borderRightColor', null]],
93
27
  borderBlockWidth: rawValue => [['borderBlockWidth', rawValue], ['borderTopWidth', null], ['borderBottomWidth', null]],
94
28
  borderBlockStyle: rawValue => [['borderBlockStyle', rawValue], ['borderTopStyle', null], ['borderBottomStyle', null]],
95
29
  borderBlockColor: rawValue => [['borderBlockColor', rawValue], ['borderTopColor', null], ['borderBottomColor', null]],
96
- borderColor: value => [['borderColor', value], ['borderTopColor', null], ['borderInlineEndColor', null], ['borderRightColor', null], ['borderBottomColor', null], ['borderInlineStartColor', null], ['borderLeftColor', null]],
97
- borderStyle: value => [['borderStyle', value], ['borderTopStyle', null], ['borderInlineEndStyle', null], ['borderRightStyle', null], ['borderBottomStyle', null], ['borderInlineStartStyle', null], ['borderLeftStyle', null]],
98
- borderWidth: value => [['borderWidth', value], ['borderTopWidth', null], ['borderInlineEndWidth', null], ['borderRightWidth', null], ['borderBottomWidth', null], ['borderInlineStartWidth', null], ['borderLeftWidth', null]],
30
+ borderColor: value => [['borderColor', value], ...shorthands.borderInlineColor(null), ...shorthands.borderBlockColor(null)],
31
+ borderStyle: value => [['borderStyle', value], ...shorthands.borderInlineStyle(null), ...shorthands.borderBlockStyle(null)],
32
+ borderWidth: value => [['borderWidth', value], ...shorthands.borderInlineWidth(null), ...shorthands.borderBlockWidth(null)],
99
33
  borderInlineStartColor: value => [['borderInlineStartColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
100
34
  borderInlineEndColor: value => [['borderInlineEndColor', value], ['borderLeftColor', null], ['borderRightColor', null]],
101
35
  borderInlineStartStyle: value => [['borderInlineStartStyle', value], ['borderLeftStyle', null], ['borderRightStyle', null]],
@@ -108,24 +42,7 @@ const shorthands = {
108
42
  borderRightStyle: value => [['borderRightStyle', value], ['borderInlineStartStyle', null], ['borderInlineEndStyle', null]],
109
43
  borderLeftWidth: value => [['borderLeftWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
110
44
  borderRightWidth: value => [['borderRightWidth', value], ['borderInlineStartWidth', null], ['borderInlineEndWidth', null]],
111
- borderRadius: value => {
112
- const values = typeof value === 'number' ? [value] : (0, _splitCssValue.default)(value);
113
- if (values.length === 1) {
114
- return [['borderRadius', value],
115
- // // logical constituents
116
- ['borderStartStartRadius', null], ['borderStartEndRadius', null], ['borderEndStartRadius', null], ['borderEndEndRadius', null],
117
- // physical constituents
118
- ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]];
119
- }
120
-
121
- // @Deprecated
122
- const [startStart, startEnd = startStart, endEnd = startStart, endStart = startEnd] = values;
123
- return [
124
- // split into logical consituents
125
- ['borderStartStartRadius', startStart], ['borderStartEndRadius', startEnd], ['borderEndEndRadius', endEnd], ['borderEndStartRadius', endStart],
126
- // unset physical consituents
127
- ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]];
128
- },
45
+ borderRadius: value => [['borderRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null], ['borderEndStartRadius', null], ['borderEndEndRadius', null], ['borderTopLeftRadius', null], ['borderTopRightRadius', null], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
129
46
  borderStartStartRadius: value => [['borderStartStartRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
130
47
  borderStartEndRadius: value => [['borderStartEndRadius', value], ['borderTopLeftRadius', null], ['borderTopRightRadius', null]],
131
48
  borderEndStartRadius: value => [['borderEndStartRadius', value], ['borderBottomLeftRadius', null], ['borderBottomRightRadius', null]],
@@ -134,20 +51,22 @@ const shorthands = {
134
51
  borderTopRightRadius: value => [['borderTopRightRadius', value], ['borderStartStartRadius', null], ['borderStartEndRadius', null]],
135
52
  borderBottomLeftRadius: value => [['borderBottomLeftRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
136
53
  borderBottomRightRadius: value => [['borderBottomRightRadius', value], ['borderEndStartRadius', null], ['borderEndEndRadius', null]],
137
- columnRule: value => [['columnRule', value], ['columnRuleWidth', null], ['columnRuleStyle', null], ['columnRuleColor', null]],
54
+ borderImage: value => [['borderImage', value], ['borderImageOutset', null], ['borderImageRepeat', null], ['borderImageSlice', null], ['borderImageSource', null], ['borderImageWidth', null]],
55
+ columnRule: value => [['columnRule', value], ['columnRuleColor', null], ['columnRuleStyle', null], ['columnRuleWidth', null]],
138
56
  columns: value => [['columns', value], ['columnCount', null], ['columnWidth', null]],
139
57
  container: value => [['container', value], ['containerName', null], ['containerType', null]],
58
+ containIntrinsicSize: value => [['containIntrinsicSize', value], ['containIntrinsicWidth', null], ['containIntrinsicHeight', null]],
140
59
  flex: value => [['flex', value], ['flexGrow', null], ['flexShrink', null], ['flexBasis', null]],
141
60
  flexFlow: value => [['flexFlow', value], ['flexDirection', null], ['flexWrap', null]],
142
- // @Deprecated ?
143
- font: value => [['font', value], ['fontFamily', null], ['fontSize', null], ['fontStretch', null], ['fontStyle', null], ['fontVariant', null], ['fontWeight', null], ['lineHeight', null]],
61
+ font: value => [['font', value], ['fontFamily', null], ['fontSize', null], ['fontStretch', null], ['fontStyle', null], ...shorthands.fontVariant(null), ['fontWeight', null], ['lineHeight', null]],
62
+ fontVariant: value => [['fontVariant', value], ['fontVariantAlternates', null], ['fontVariantCaps', null], ['fontVariantEastAsian', null], ['fontVariantEmoji', null], ['fontVariantLigatures', null], ['fontVariantNumeric', null], ['fontVariantPosition', null]],
144
63
  gap: value => [['gap', value], ['rowGap', null], ['columnGap', null]],
145
- grid: value => [['grid', value], ['gridTemplate', null], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null], ['gridAutoRows', null], ['gridAutoColumns', null], ['gridAutoFlow', null]],
64
+ grid: value => [['grid', value], ...shorthands.gridTemplate(null), ['gridAutoRows', null], ['gridAutoColumns', null], ['gridAutoFlow', null]],
146
65
  gridArea: value => [['gridArea', value], ['gridRow', null], ['gridRowStart', null], ['gridRowEnd', null], ['gridColumn', null], ['gridColumnStart', null], ['gridColumnEnd', null]],
147
66
  gridRow: value => [['gridRow', value], ['gridRowStart', null], ['gridRowEnd', null]],
148
67
  gridColumn: value => [['gridColumn', value], ['gridColumnStart', null], ['gridColumnEnd', null]],
149
68
  gridTemplate: value => [['gridTemplate', value], ['gridTemplateAreas', null], ['gridTemplateColumns', null], ['gridTemplateRows', null]],
150
- inset: value => [['inset', value], ['insetInline', null], ['insetBlock', null], ['insetInlineStart', null], ['insetInlineEnd', null], ['top', null], ['right', null], ['bottom', null], ['left', null]],
69
+ inset: value => [['inset', value], ...shorthands.insetInline(null), ...shorthands.insetBlock(null)],
151
70
  insetInline: value => [['insetInline', value], ['insetInlineStart', null], ['insetInlineEnd', null], ['left', null], ['right', null]],
152
71
  insetBlock: value => [['insetBlock', value], ['top', null], ['bottom', null]],
153
72
  insetInlineStart: value => [['insetInlineStart', value], ['left', null], ['right', null]],
@@ -155,15 +74,7 @@ const shorthands = {
155
74
  left: value => [['left', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
156
75
  right: value => [['right', value], ['insetInlineStart', null], ['insetInlineEnd', null]],
157
76
  listStyle: value => [['listStyle', value], ['listStyleImage', null], ['listStylePosition', null], ['listStyleType', null]],
158
- margin: value => {
159
- const values = typeof value === 'number' ? [value] : (0, _splitCssValue.default)(value);
160
- if (values.length === 1) {
161
- return [['margin', values[0]], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null], ['marginTop', null], ['marginBottom', null]];
162
- }
163
- // @Deprecated
164
- const [top, right = top, bottom = top, left = right] = values;
165
- return [['marginTop', top], ['marginInlineEnd', right], ['marginBottom', bottom], ['marginInlineStart', left], ['marginLeft', null], ['marginRight', null]];
166
- },
77
+ margin: value => [['margin', value], ...shorthands.marginInline(null), ...shorthands.marginBlock(null)],
167
78
  marginInline: value => [['marginInline', value], ['marginInlineStart', null], ['marginLeft', null], ['marginInlineEnd', null], ['marginRight', null]],
168
79
  marginBlock: value => [['marginBlock', value], ['marginTop', null], ['marginBottom', null]],
169
80
  marginInlineStart: value => [['marginInlineStart', value], ['marginLeft', null], ['marginRight', null]],
@@ -171,17 +82,12 @@ const shorthands = {
171
82
  marginLeft: value => [['marginLeft', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
172
83
  marginRight: value => [['marginRight', value], ['marginInlineStart', null], ['marginInlineEnd', null]],
173
84
  mask: value => [['mask', value], ['maskClip', null], ['maskComposite', null], ['maskImage', null], ['maskMode', null], ['maskOrigin', null], ['maskPosition', null], ['maskRepeat', null], ['maskSize', null]],
85
+ maskBorder: value => [['maskBorder', value], ['maskBorderMode', null], ['maskBorderOutset', null], ['maskBorderRepeat', null], ['maskBorderSlice', null], ['maskBorderSource', null], ['maskBorderWidth', null]],
174
86
  offset: value => [['offset', value], ['offsetAnchor', null], ['offsetDistance', null], ['offsetPath', null], ['offsetPosition', null], ['offsetRotate', null]],
175
- outline: value => [['outline', value], ['outlineColor', null], ['outlineStyle', null], ['outlineWidth', null]],
87
+ outline: value => [['outline', value], ['outlineColor', null], ['outlineOffset', null], ['outlineStyle', null], ['outlineWidth', null]],
176
88
  overflow: value => [['overflow', value], ['overflowX', null], ['overflowY', null]],
177
89
  padding: rawValue => {
178
- const values = typeof rawValue === 'number' ? [rawValue] : (0, _splitCssValue.default)(rawValue);
179
- if (values.length === 1) {
180
- return [['padding', values[0]], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null], ['paddingTop', null], ['paddingBottom', null]];
181
- }
182
- // @Deprecated
183
- const [top, right = top, bottom = top, left = right] = values;
184
- return [['paddingTop', top], ['paddingEnd', right], ['paddingBottom', bottom], ['paddingStart', left]];
90
+ return [['padding', rawValue], ...shorthands.paddingInline(null), ...shorthands.paddingBlock(null)];
185
91
  },
186
92
  paddingInline: rawValue => [['paddingInline', rawValue], ['paddingStart', null], ['paddingLeft', null], ['paddingEnd', null], ['paddingRight', null]],
187
93
  paddingBlock: rawValue => [['paddingBlock', rawValue], ['paddingTop', null], ['paddingBottom', null]],
@@ -192,26 +98,39 @@ const shorthands = {
192
98
  placeContent: value => [['placeContent', value], ['alignContent', null], ['justifyContent', null]],
193
99
  placeItems: value => [['placeItems', value], ['alignItems', null], ['justifyItems', null]],
194
100
  placeSelf: value => [['placeSelf', value], ['alignSelf', null], ['justifySelf', null]],
195
- scrollMargin: value => [['scrollMargin', value], ['scrollMarginBottom', null], ['scrollMarginLeft', null], ['scrollMarginStart', null], ['scrollMarginRight', null], ['scrollMarginEnd', null], ['scrollMarginTop', null]],
196
- scrollPadding: value => [['scrollPadding', value], ['scrollPaddingBottom', null], ['scrollPaddingLeft', null], ['scrollPaddingStart', null], ['scrollPaddingRight', null], ['scrollPaddingEnd', null], ['scrollPaddingTop', null]],
101
+ scrollMargin: value => [['scrollMargin', value], ...shorthands.scrollMarginBlock(null), ...shorthands.scrollMarginInline(null)],
102
+ scrollMarginBlock: value => [['scrollMarginBlock', value], ['scrollMarginTop', null], ['scrollMarginBottom', null]],
103
+ scrollMarginInline: value => [['scrollMarginInline', value], ['scrollMarginInlineStart', null], ['scrollMarginInlineEnd', null], ['scrollMarginLeft', null], ['scrollMarginRight', null]],
104
+ scrollMarginInlineStart: value => [['scrollMarginInlineStart', value], ['scrollMarginLeft', null], ['scrollMarginRight', null]],
105
+ scrollMarginInlineEnd: value => [['scrollMarginInlineEnd', value], ['scrollMarginLeft', null], ['scrollMarginRight', null]],
106
+ scrollMarginLeft: value => [['scrollMarginLeft', value], ['scrollMarginInlineStart', null], ['scrollMarginInlineEnd', null]],
107
+ scrollMarginRight: value => [['scrollMarginRight', value], ['scrollMarginInlineStart', null], ['scrollMarginInlineEnd', null]],
108
+ scrollPadding: value => [['scrollPadding', value], ...shorthands.scrollPaddingBlock(null), ...shorthands.scrollPaddingInline(null)],
109
+ scrollPaddingBlock: value => [['scrollPaddingBlock', value], ['scrollPaddingTop', null], ['scrollPaddingBottom', null]],
110
+ scrollPaddingInline: value => [['scrollPaddingInline', value], ['scrollPaddingInlineStart', null], ['scrollPaddingInlineEnd', null], ['scrollPaddingLeft', null], ['scrollPaddingRight', null]],
111
+ scrollPaddingInlineStart: value => [['scrollPaddingInlineStart', value], ['scrollPaddingLeft', null], ['scrollPaddingRight', null]],
112
+ scrollPaddingInlineEnd: value => [['scrollPaddingInlineEnd', value], ['scrollPaddingLeft', null], ['scrollPaddingRight', null]],
113
+ scrollPaddingLeft: value => [['scrollPaddingLeft', value], ['scrollPaddingInlineStart', null], ['scrollPaddingInlineEnd', null]],
114
+ scrollPaddingRight: value => [['scrollPaddingRight', value], ['scrollPaddingInlineStart', null], ['scrollPaddingInlineEnd', null]],
115
+ scrollSnapType: value => [['scrollSnapType', value], ['scrollSnapTypeX', null], ['scrollSnapTypeY', null]],
197
116
  scrollTimeline: value => [['scrollTimeline', value], ['scrollTimelineName', null], ['scrollTimelineAxis', null]],
198
117
  textDecoration: value => [['textDecoration', value], ['textDecorationColor', null], ['textDecorationLine', null], ['textDecorationStyle', null], ['textDecorationThickness', null]],
199
118
  textEmphasis: value => [['textEmphasis', value], ['textEmphasisColor', null], ['textEmphasisStyle', null]],
200
- transition: value => [['transition', value], ['transitionDelay', null], ['transitionDuration', null], ['transitionProperty', null], ['transitionTimingFunction', null]]
119
+ transition: value => [['transition', value], ['transitionBehavior', null], ['transitionDelay', null], ['transitionDuration', null], ['transitionProperty', null], ['transitionTimingFunction', null]]
201
120
  };
202
121
  const aliases = {
203
- // @Deprecated
204
122
  borderHorizontal: shorthands.borderInline,
205
- // @Deprecated
206
123
  borderVertical: shorthands.borderBlock,
207
- // @Deprecated
208
124
  borderBlockStart: shorthands.borderTop,
209
- // @Deprecated
210
125
  borderEnd: shorthands.borderInlineEnd,
211
- // @Deprecated
212
126
  borderBlockEnd: shorthands.borderBottom,
213
- // @Deprecated
214
127
  borderStart: shorthands.borderInlineStart,
128
+ blockSize: val => [['height', val]],
129
+ inlineSize: val => [['width', val]],
130
+ minBlockSize: val => [['minHeight', val]],
131
+ minInlineSize: val => [['minWidth', val]],
132
+ maxBlockSize: val => [['maxHeight', val]],
133
+ maxInlineSize: val => [['maxWidth', val]],
215
134
  borderHorizontalWidth: shorthands.borderInlineWidth,
216
135
  borderHorizontalStyle: shorthands.borderInlineStyle,
217
136
  borderHorizontalColor: shorthands.borderInlineColor,
@@ -234,18 +153,27 @@ const aliases = {
234
153
  borderTopEndRadius: value => [['borderStartEndRadius', value]],
235
154
  borderBottomStartRadius: value => [['borderEndStartRadius', value]],
236
155
  borderBottomEndRadius: value => [['borderEndEndRadius', value]],
156
+ containIntrinsicBlockSize: value => [['containIntrinsicHeight', value]],
157
+ containIntrinsicInlineSize: value => [['containIntrinsicWidth', value]],
158
+ gridGap: shorthands.gap,
159
+ gridRowGap: value => [['rowGap', value]],
160
+ gridColumnGap: value => [['columnGap', value]],
237
161
  marginBlockStart: value => [['marginTop', value]],
238
162
  marginBlockEnd: value => [['marginBottom', value]],
239
163
  marginStart: shorthands.marginInlineStart,
240
164
  marginEnd: shorthands.marginInlineEnd,
241
165
  marginHorizontal: shorthands.marginInline,
242
166
  marginVertical: shorthands.marginBlock,
167
+ overflowBlock: value => [['overflowY', value]],
168
+ overflowInline: value => [['overflowX', value]],
243
169
  paddingBlockStart: rawValue => [['paddingTop', rawValue]],
244
170
  paddingBlockEnd: rawValue => [['paddingBottom', rawValue]],
245
171
  paddingStart: shorthands.paddingInlineStart,
246
172
  paddingEnd: shorthands.paddingInlineEnd,
247
173
  paddingHorizontal: shorthands.paddingInline,
248
174
  paddingVertical: shorthands.paddingBlock,
175
+ scrollMarginBlockStart: value => [['scrollMarginTop', value]],
176
+ scrollMarginBlockEnd: value => [['scrollMarginBottom', value]],
249
177
  insetBlockStart: value => [['top', value]],
250
178
  insetBlockEnd: value => [['bottom', value]],
251
179
  start: shorthands.insetInlineStart,
@@ -255,5 +183,4 @@ const expansions = {
255
183
  ...shorthands,
256
184
  ...aliases
257
185
  };
258
- var _default = expansions;
259
- exports.default = _default;
186
+ var _default = exports.default = expansions;
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type { TStyleValue } from '../common-types';
11
+
12
+ /**
13
+ * Shorthand properties:
14
+ * - [x] all - Should be banned
15
+ * - [x] animation
16
+ * - [x] background
17
+ * - [x] border
18
+ * - [x] border-block-end
19
+ * - [x] border-block-start
20
+ * - [x] border-bottom
21
+ * - [x] border-color
22
+ * - [x] border-image
23
+ * - [x] border-inline-end
24
+ * - [x] border-inline-start
25
+ * - [x] border-left
26
+ * - [x] border-radius
27
+ * - [x] border-right
28
+ * - [x] border-style
29
+ * - [x] border-top
30
+ * - [x] border-width
31
+ * - [x] column-rule
32
+ * - [x] columns
33
+ * - [x] container
34
+ * - [x] flex
35
+ * - [x] flex-flow
36
+ * - [x] font
37
+ * - [x] gap
38
+ * - [x] grid
39
+ * - [x] grid-area
40
+ * - [x] grid-column
41
+ * - [x] grid-row
42
+ * - [x] grid-template
43
+ * - [x] inset
44
+ * - [x] inset-block
45
+ * - [x] inset-inline
46
+ * - [x] list-style
47
+ * - [x] margin
48
+ * - [x] mask
49
+ * - [x] offset
50
+ * - [x] outline
51
+ * - [x] overflow
52
+ * - [x] padding
53
+ * - [x] place-content
54
+ * - [x] place-items
55
+ * - [x] place-self
56
+ * - [x] scroll-margin
57
+ * - [x] scroll-padding
58
+ * - [x] text-decoration
59
+ * - [x] text-emphasis
60
+ * - [x] transition
61
+ */
62
+
63
+ type TReturn = $ReadOnlyArray<[string, TStyleValue]>;
64
+
65
+ declare const shorthands: {
66
+ all: (_: TStyleValue) => TReturn,
67
+ animation: (value: TStyleValue) => Array<[string, TStyleValue]>,
68
+ animationRange: (value: TStyleValue) => TReturn,
69
+ background: (value: TStyleValue) => TReturn,
70
+ backgroundPosition: (value: TStyleValue) => TReturn,
71
+ border: (rawValue: TStyleValue) => TReturn,
72
+ borderInline: (rawValue: TStyleValue) => TReturn,
73
+ borderBlock: (rawValue: TStyleValue) => TReturn,
74
+ borderTop: (rawValue: TStyleValue) => TReturn,
75
+ borderInlineEnd: (rawValue: TStyleValue) => TReturn,
76
+ borderRight: (rawValue: TStyleValue) => TReturn,
77
+ borderBottom: (rawValue: TStyleValue) => TReturn,
78
+ borderInlineStart: (rawValue: TStyleValue) => TReturn,
79
+ borderLeft: (rawValue: TStyleValue) => TReturn,
80
+ borderInlineWidth: (rawValue: TStyleValue) => TReturn,
81
+ borderInlineStyle: (rawValue: TStyleValue) => TReturn,
82
+ borderInlineColor: (rawValue: TStyleValue) => TReturn,
83
+ borderBlockWidth: (rawValue: TStyleValue) => TReturn,
84
+ borderBlockStyle: (rawValue: TStyleValue) => TReturn,
85
+ borderBlockColor: (rawValue: TStyleValue) => TReturn,
86
+ borderColor: (value: TStyleValue) => TReturn,
87
+ borderStyle: (value: TStyleValue) => TReturn,
88
+ borderWidth: (value: TStyleValue) => TReturn,
89
+ borderInlineStartColor: (value: TStyleValue) => TReturn,
90
+ borderInlineEndColor: (value: TStyleValue) => TReturn,
91
+ borderInlineStartStyle: (value: TStyleValue) => TReturn,
92
+ borderInlineEndStyle: (value: TStyleValue) => TReturn,
93
+ borderInlineStartWidth: (value: TStyleValue) => TReturn,
94
+ borderInlineEndWidth: (value: TStyleValue) => TReturn,
95
+ borderLeftColor: (value: TStyleValue) => TReturn,
96
+ borderRightColor: (value: TStyleValue) => TReturn,
97
+ borderLeftStyle: (value: TStyleValue) => TReturn,
98
+ borderRightStyle: (value: TStyleValue) => TReturn,
99
+ borderLeftWidth: (value: TStyleValue) => TReturn,
100
+ borderRightWidth: (value: TStyleValue) => TReturn,
101
+ borderRadius: (value: TStyleValue) => TReturn,
102
+ borderStartStartRadius: (value: TStyleValue) => TReturn,
103
+ borderStartEndRadius: (value: TStyleValue) => TReturn,
104
+ borderEndStartRadius: (value: TStyleValue) => TReturn,
105
+ borderEndEndRadius: (value: TStyleValue) => TReturn,
106
+ borderTopLeftRadius: (value: TStyleValue) => TReturn,
107
+ borderTopRightRadius: (value: TStyleValue) => TReturn,
108
+ borderBottomLeftRadius: (value: TStyleValue) => TReturn,
109
+ borderBottomRightRadius: (value: TStyleValue) => TReturn,
110
+ borderImage: (value: TStyleValue) => TReturn,
111
+ columnRule: (value: TStyleValue) => TReturn,
112
+ columns: (value: TStyleValue) => TReturn,
113
+ container: (value: TStyleValue) => TReturn,
114
+ containIntrinsicSize: (value: TStyleValue) => TReturn,
115
+ flex: (value: TStyleValue) => TReturn,
116
+ flexFlow: (value: TStyleValue) => TReturn,
117
+ font: (value: TStyleValue) => TReturn,
118
+ fontVariant: (value: TStyleValue) => TReturn,
119
+ gap: (value: TStyleValue) => TReturn,
120
+ grid: (value: TStyleValue) => TReturn,
121
+ gridArea: (value: TStyleValue) => TReturn,
122
+ gridRow: (value: TStyleValue) => TReturn,
123
+ gridColumn: (value: TStyleValue) => TReturn,
124
+ gridTemplate: (value: TStyleValue) => TReturn,
125
+ inset: (value: TStyleValue) => TReturn,
126
+ insetInline: (value: TStyleValue) => TReturn,
127
+ insetBlock: (value: TStyleValue) => TReturn,
128
+ insetInlineStart: (value: TStyleValue) => TReturn,
129
+ insetInlineEnd: (value: TStyleValue) => TReturn,
130
+ left: (value: TStyleValue) => TReturn,
131
+ right: (value: TStyleValue) => TReturn,
132
+ listStyle: (value: TStyleValue) => TReturn,
133
+ margin: (value: TStyleValue) => TReturn,
134
+ marginInline: (value: TStyleValue) => TReturn,
135
+ marginBlock: (value: TStyleValue) => TReturn,
136
+ marginInlineStart: (value: TStyleValue) => TReturn,
137
+ marginInlineEnd: (value: TStyleValue) => TReturn,
138
+ marginLeft: (value: TStyleValue) => TReturn,
139
+ marginRight: (value: TStyleValue) => TReturn,
140
+ mask: (value: TStyleValue) => TReturn,
141
+ maskBorder: (value: TStyleValue) => TReturn,
142
+ offset: (value: TStyleValue) => TReturn,
143
+ outline: (value: TStyleValue) => TReturn,
144
+ overflow: (value: TStyleValue) => TReturn,
145
+ padding: (rawValue: TStyleValue) => TReturn,
146
+ paddingInline: (rawValue: TStyleValue) => TReturn,
147
+ paddingBlock: (rawValue: TStyleValue) => TReturn,
148
+ paddingInlineStart: (value: TStyleValue) => TReturn,
149
+ paddingInlineEnd: (value: TStyleValue) => TReturn,
150
+ paddingLeft: (value: TStyleValue) => TReturn,
151
+ paddingRight: (value: TStyleValue) => TReturn,
152
+ placeContent: (value: TStyleValue) => TReturn,
153
+ placeItems: (value: TStyleValue) => TReturn,
154
+ placeSelf: (value: TStyleValue) => TReturn,
155
+ scrollMargin: (value: TStyleValue) => TReturn,
156
+ scrollMarginBlock: (value: TStyleValue) => TReturn,
157
+ scrollMarginInline: (value: TStyleValue) => TReturn,
158
+ scrollMarginInlineStart: (value: TStyleValue) => TReturn,
159
+ scrollMarginInlineEnd: (value: TStyleValue) => TReturn,
160
+ scrollMarginLeft: (value: TStyleValue) => TReturn,
161
+ scrollMarginRight: (value: TStyleValue) => TReturn,
162
+ scrollPadding: (value: TStyleValue) => TReturn,
163
+ scrollPaddingBlock: (value: TStyleValue) => TReturn,
164
+ scrollPaddingInline: (value: TStyleValue) => TReturn,
165
+ scrollPaddingInlineStart: (value: TStyleValue) => TReturn,
166
+ scrollPaddingInlineEnd: (value: TStyleValue) => TReturn,
167
+ scrollPaddingLeft: (value: TStyleValue) => TReturn,
168
+ scrollPaddingRight: (value: TStyleValue) => TReturn,
169
+ scrollSnapType: (value: TStyleValue) => TReturn,
170
+ scrollTimeline: (value: TStyleValue) => TReturn,
171
+ textDecoration: (value: TStyleValue) => TReturn,
172
+ textEmphasis: (value: TStyleValue) => TReturn,
173
+ transition: (value: TStyleValue) => TReturn,
174
+ };
175
+
176
+ declare const aliases: {
177
+ borderHorizontal: $FlowFixMe,
178
+ borderVertical: $FlowFixMe,
179
+ borderBlockStart: $FlowFixMe,
180
+ borderEnd: $FlowFixMe,
181
+ borderBlockEnd: $FlowFixMe,
182
+ borderStart: $FlowFixMe,
183
+ blockSize: (val: TStyleValue) => TReturn,
184
+ inlineSize: (val: TStyleValue) => TReturn,
185
+ minBlockSize: (val: TStyleValue) => TReturn,
186
+ minInlineSize: (val: TStyleValue) => TReturn,
187
+ maxBlockSize: (val: TStyleValue) => TReturn,
188
+ maxInlineSize: (val: TStyleValue) => TReturn,
189
+ borderHorizontalWidth: $FlowFixMe,
190
+ borderHorizontalStyle: $FlowFixMe,
191
+ borderHorizontalColor: $FlowFixMe,
192
+ borderVerticalWidth: $FlowFixMe,
193
+ borderVerticalStyle: $FlowFixMe,
194
+ borderVerticalColor: $FlowFixMe,
195
+ borderBlockStartColor: (value: TStyleValue) => TReturn,
196
+ borderBlockEndColor: (value: TStyleValue) => TReturn,
197
+ borderBlockStartStyle: (value: TStyleValue) => TReturn,
198
+ borderBlockEndStyle: (value: TStyleValue) => TReturn,
199
+ borderBlockStartWidth: (value: TStyleValue) => TReturn,
200
+ borderBlockEndWidth: (value: TStyleValue) => TReturn,
201
+ borderStartColor: $FlowFixMe,
202
+ borderEndColor: $FlowFixMe,
203
+ borderStartStyle: $FlowFixMe,
204
+ borderEndStyle: $FlowFixMe,
205
+ borderStartWidth: $FlowFixMe,
206
+ borderEndWidth: $FlowFixMe,
207
+ borderTopStartRadius: (value: TStyleValue) => TReturn,
208
+ borderTopEndRadius: (value: TStyleValue) => TReturn,
209
+ borderBottomStartRadius: (value: TStyleValue) => TReturn,
210
+ borderBottomEndRadius: (value: TStyleValue) => TReturn,
211
+ containIntrinsicBlockSize: (value: TStyleValue) => TReturn,
212
+ containIntrinsicInlineSize: (value: TStyleValue) => TReturn,
213
+ gridGap: $FlowFixMe,
214
+ gridRowGap: (value: TStyleValue) => TReturn,
215
+ gridColumnGap: (value: TStyleValue) => TReturn,
216
+ marginBlockStart: (value: TStyleValue) => TReturn,
217
+ marginBlockEnd: (value: TStyleValue) => TReturn,
218
+ marginStart: $FlowFixMe,
219
+ marginEnd: $FlowFixMe,
220
+ marginHorizontal: $FlowFixMe,
221
+ marginVertical: $FlowFixMe,
222
+ overflowBlock: (value: TStyleValue) => TReturn,
223
+ overflowInline: (value: TStyleValue) => TReturn,
224
+ paddingBlockStart: (rawValue: TStyleValue) => TReturn,
225
+ paddingBlockEnd: (rawValue: TStyleValue) => TReturn,
226
+ paddingStart: $FlowFixMe,
227
+ paddingEnd: $FlowFixMe,
228
+ paddingHorizontal: $FlowFixMe,
229
+ paddingVertical: $FlowFixMe,
230
+ scrollMarginBlockStart: (value: TStyleValue) => TReturn,
231
+ scrollMarginBlockEnd: (value: TStyleValue) => TReturn,
232
+ insetBlockStart: (value: TStyleValue) => TReturn,
233
+ insetBlockEnd: (value: TStyleValue) => TReturn,
234
+ start: $FlowFixMe,
235
+ end: $FlowFixMe,
236
+ };
237
+
238
+ declare export default $ReadOnly<{
239
+ ...typeof shorthands,
240
+ ...typeof aliases,
241
+ }>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ export declare function validateNamespace(
11
+ namespace: unknown,
12
+ conditions: ReadonlyArray<string>,
13
+ ): void;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateNamespace = validateNamespace;
7
+ var _stylexInclude = require("../stylex-include");
8
+ var messages = _interopRequireWildcard(require("../messages"));
9
+ var _objectUtils = require("../utils/object-utils");
10
+ 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); }
11
+ 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; }
12
+ function validateNamespace(namespace) {
13
+ let conditions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14
+ if (!(0, _objectUtils.isPlainObject)(namespace)) {
15
+ throw new Error(messages.ILLEGAL_NAMESPACE_VALUE);
16
+ }
17
+ const ns = namespace;
18
+ for (const key in ns) {
19
+ const val = ns[key];
20
+ if (val === null || typeof val === 'string' || typeof val === 'number') {
21
+ continue;
22
+ }
23
+ if (Array.isArray(val)) {
24
+ for (const v of val) {
25
+ if (v === null || typeof v === 'string' || typeof v === 'number') {
26
+ continue;
27
+ }
28
+ throw new Error(messages.ILLEGAL_PROP_ARRAY_VALUE);
29
+ }
30
+ continue;
31
+ }
32
+ if (val instanceof _stylexInclude.IncludedStyles) {
33
+ if (conditions.length === 0) {
34
+ continue;
35
+ }
36
+ throw new Error(messages.ONLY_TOP_LEVEL_INCLUDES);
37
+ }
38
+ if ((0, _objectUtils.isPlainObject)(val)) {
39
+ if (key.startsWith('@') || key.startsWith(':')) {
40
+ if (conditions.includes(key)) {
41
+ throw new Error(messages.DUPLICATE_CONDITIONAL);
42
+ }
43
+ validateNamespace(val, [...conditions, key]);
44
+ } else {
45
+ validateConditionalStyles(val);
46
+ }
47
+ continue;
48
+ }
49
+ throw new Error(messages.ILLEGAL_PROP_VALUE);
50
+ }
51
+ }
52
+ function validateConditionalStyles(val) {
53
+ let conditions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
54
+ for (const key in val) {
55
+ const v = val[key];
56
+ if (!(key.startsWith('@') || key.startsWith(':') || key === 'default')) {
57
+ throw new Error(messages.INVALID_PSEUDO_OR_AT_RULE);
58
+ }
59
+ if (conditions.includes(key)) {
60
+ throw new Error(messages.DUPLICATE_CONDITIONAL);
61
+ }
62
+ if (v === null || typeof v === 'string' || typeof v === 'number') {
63
+ continue;
64
+ }
65
+ if (Array.isArray(v)) {
66
+ for (const vv of v) {
67
+ if (vv === null || typeof vv === 'string' || typeof vv === 'number') {
68
+ continue;
69
+ }
70
+ throw new Error(messages.ILLEGAL_PROP_VALUE);
71
+ }
72
+ continue;
73
+ }
74
+ if (v instanceof _stylexInclude.IncludedStyles) {
75
+ throw new Error(messages.ONLY_TOP_LEVEL_INCLUDES);
76
+ }
77
+ if ((0, _objectUtils.isPlainObject)(v)) {
78
+ validateConditionalStyles(v, [...conditions, key]);
79
+ continue;
80
+ }
81
+ throw new Error(messages.ILLEGAL_PROP_VALUE);
82
+ }
83
+ }