@stylexjs/shared 0.2.0-beta.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. package/lib/common-types.d.ts +50 -0
  2. package/lib/common-types.js.flow +65 -0
  3. package/lib/convert-to-className.d.ts +16 -0
  4. package/lib/convert-to-className.js +17 -26
  5. package/lib/convert-to-className.js.flow +23 -0
  6. package/lib/generate-css-rule.d.ts +17 -0
  7. package/lib/generate-css-rule.js +6 -17
  8. package/lib/generate-css-rule.js.flow +17 -0
  9. package/lib/hash.d.ts +11 -0
  10. package/lib/hash.js +3 -27
  11. package/lib/hash.js.flow +10 -0
  12. package/lib/index.d.ts +42 -85
  13. package/lib/index.js +19 -27
  14. package/lib/index.js.flow +57 -3
  15. package/lib/messages.d.ts +36 -0
  16. package/lib/messages.js +28 -53
  17. package/lib/messages.js.flow +39 -0
  18. package/lib/physical-rtl/generate-ltr.d.ts +11 -0
  19. package/lib/physical-rtl/generate-ltr.js +18 -46
  20. package/lib/physical-rtl/generate-ltr.js.flow +12 -0
  21. package/lib/physical-rtl/generate-rtl.d.ts +13 -0
  22. package/lib/physical-rtl/generate-rtl.js +18 -50
  23. package/lib/physical-rtl/generate-rtl.js.flow +12 -0
  24. package/lib/preprocess-rules/PreRule.d.ts +52 -0
  25. package/lib/preprocess-rules/PreRule.js +87 -0
  26. package/lib/preprocess-rules/PreRule.js.flow +64 -0
  27. package/lib/preprocess-rules/application-order.d.ts +290 -0
  28. package/lib/preprocess-rules/application-order.js +59 -125
  29. package/lib/preprocess-rules/application-order.js.flow +241 -0
  30. package/lib/preprocess-rules/basic-validation.d.ts +13 -0
  31. package/lib/preprocess-rules/basic-validation.js +83 -0
  32. package/lib/preprocess-rules/basic-validation.js.flow +13 -0
  33. package/lib/preprocess-rules/flatten-raw-style-obj.d.ts +25 -0
  34. package/lib/preprocess-rules/flatten-raw-style-obj.js +120 -0
  35. package/lib/preprocess-rules/flatten-raw-style-obj.js.flow +27 -0
  36. package/lib/preprocess-rules/index.d.ts +18 -0
  37. package/lib/preprocess-rules/index.js +0 -9
  38. package/lib/preprocess-rules/index.js.flow +19 -0
  39. package/lib/preprocess-rules/legacy-expand-shorthands.d.ts +200 -0
  40. package/lib/preprocess-rules/legacy-expand-shorthands.js +90 -123
  41. package/lib/preprocess-rules/legacy-expand-shorthands.js.flow +179 -0
  42. package/lib/preprocess-rules/property-specificity.d.ts +89 -0
  43. package/lib/preprocess-rules/property-specificity.js +46 -74
  44. package/lib/preprocess-rules/property-specificity.js.flow +98 -0
  45. package/lib/properties/CSS Animations.json +445 -0
  46. package/lib/properties/CSS Backgrounds and Borders.json +1085 -0
  47. package/lib/properties/CSS Basic User Interface.json +365 -0
  48. package/lib/properties/CSS Box Alignment.json +245 -0
  49. package/lib/properties/CSS Box Model.json +501 -0
  50. package/lib/properties/CSS Color.json +100 -0
  51. package/lib/properties/CSS Columns.json +185 -0
  52. package/lib/properties/CSS Containment.json +203 -0
  53. package/lib/properties/CSS Counter Styles.json +56 -0
  54. package/lib/properties/CSS Display.json +20 -0
  55. package/lib/properties/CSS Flexible Box Layout.json +167 -0
  56. package/lib/properties/CSS Fonts.json +684 -0
  57. package/lib/properties/CSS Fragmentation.json +110 -0
  58. package/lib/properties/CSS Generated Content.json +38 -0
  59. package/lib/properties/CSS Grid Layout.json +500 -0
  60. package/lib/properties/CSS Images.json +91 -0
  61. package/lib/properties/CSS Inline.json +38 -0
  62. package/lib/properties/CSS Lists and Counters.json +86 -0
  63. package/lib/properties/CSS Logical Properties.json +1086 -0
  64. package/lib/properties/CSS Masking.json +399 -0
  65. package/lib/properties/CSS Miscellaneous.json +38 -0
  66. package/lib/properties/CSS Motion Path.json +132 -0
  67. package/lib/properties/CSS Overflow.json +216 -0
  68. package/lib/properties/CSS Pages.json +83 -0
  69. package/lib/properties/CSS Positioning.json +166 -0
  70. package/lib/properties/CSS Ruby.json +55 -0
  71. package/lib/properties/CSS Scroll Anchoring.json +19 -0
  72. package/lib/properties/CSS Scroll Snap.json +604 -0
  73. package/lib/properties/CSS Scrollbars.json +38 -0
  74. package/lib/properties/CSS Shapes.json +56 -0
  75. package/lib/properties/CSS Speech.json +20 -0
  76. package/lib/properties/CSS Table.json +115 -0
  77. package/lib/properties/CSS Text Decoration.json +312 -0
  78. package/lib/properties/CSS Text.json +415 -0
  79. package/lib/properties/CSS Transforms.json +188 -0
  80. package/lib/properties/CSS Transitions.json +122 -0
  81. package/lib/properties/CSS Variables.json +20 -0
  82. package/lib/properties/CSS View Transitions.json +20 -0
  83. package/lib/properties/CSS Will Change.json +20 -0
  84. package/lib/properties/CSS Writing Modes.json +92 -0
  85. package/lib/properties/Compositing and Blending.json +62 -0
  86. package/lib/properties/Filter Effects.json +38 -0
  87. package/lib/properties/MathML.json +56 -0
  88. package/lib/properties/Microsoft Extensions.json +885 -0
  89. package/lib/properties/Mozilla Extensions.json +607 -0
  90. package/lib/properties/Pointer Events.json +20 -0
  91. package/lib/properties/WebKit Extensions.json +707 -0
  92. package/lib/properties.json +10122 -0
  93. package/lib/stylex-create-theme.d.ts +26 -0
  94. package/lib/stylex-create-theme.js +62 -0
  95. package/lib/stylex-create-theme.js.flow +19 -0
  96. package/lib/stylex-create.d.ts +23 -0
  97. package/lib/stylex-create.js +30 -146
  98. package/lib/stylex-create.js.flow +30 -0
  99. package/lib/stylex-define-vars.d.ts +36 -0
  100. package/lib/stylex-define-vars.js +72 -0
  101. package/lib/stylex-define-vars.js.flow +28 -0
  102. package/lib/stylex-first-that-works.d.ts +13 -0
  103. package/lib/stylex-first-that-works.js +0 -10
  104. package/lib/stylex-first-that-works.js.flow +12 -0
  105. package/lib/stylex-include.d.ts +18 -0
  106. package/lib/stylex-include.js +0 -10
  107. package/lib/stylex-include.js.flow +20 -0
  108. package/lib/stylex-keyframes.d.ts +17 -0
  109. package/lib/stylex-keyframes.js +6 -26
  110. package/lib/stylex-keyframes.js.flow +20 -0
  111. package/lib/transform-value.d.ts +22 -0
  112. package/lib/transform-value.js +9 -23
  113. package/lib/transform-value.js.flow +25 -0
  114. package/lib/types/index.d.ts +205 -0
  115. package/lib/types/index.js +191 -0
  116. package/lib/types/index.js.flow +241 -0
  117. package/lib/utils/Rule.d.ts +58 -0
  118. package/lib/utils/Rule.js +0 -21
  119. package/lib/utils/Rule.js.flow +64 -0
  120. package/lib/utils/dashify.d.ts +11 -0
  121. package/lib/utils/dashify.js +0 -8
  122. package/lib/utils/dashify.js.flow +10 -0
  123. package/lib/utils/default-options.d.ts +11 -0
  124. package/lib/utils/default-options.js +14 -0
  125. package/lib/utils/default-options.js.flow +25 -0
  126. package/lib/utils/file-based-identifier.d.ts +15 -0
  127. package/lib/utils/file-based-identifier.js +14 -0
  128. package/lib/utils/file-based-identifier.js.flow +14 -0
  129. package/lib/utils/genCSSRule.d.ts +15 -0
  130. package/lib/utils/genCSSRule.js +9 -18
  131. package/lib/utils/genCSSRule.js.flow +15 -0
  132. package/lib/utils/normalize-value.d.ts +16 -0
  133. package/lib/utils/normalize-value.js +8 -15
  134. package/lib/utils/normalize-value.js.flow +16 -0
  135. package/lib/utils/normalizers/convert-camel-case-transition-props.d.ts +14 -0
  136. package/lib/utils/normalizers/convert-camel-case-transition-props.js +23 -0
  137. package/lib/utils/normalizers/convert-camel-case-transition-props.js.flow +13 -0
  138. package/lib/utils/normalizers/convert-camel-case-values.d.ts +14 -0
  139. package/lib/utils/normalizers/convert-camel-case-values.js +23 -0
  140. package/lib/utils/normalizers/convert-camel-case-values.js.flow +13 -0
  141. package/lib/utils/normalizers/detect-unclosed-fns.d.ts +17 -0
  142. package/lib/utils/normalizers/detect-unclosed-fns.js +0 -12
  143. package/lib/utils/normalizers/detect-unclosed-fns.js.flow +16 -0
  144. package/lib/utils/normalizers/font-size-px-to-rem.d.ts +19 -0
  145. package/lib/utils/normalizers/font-size-px-to-rem.js +9 -19
  146. package/lib/utils/normalizers/font-size-px-to-rem.js.flow +18 -0
  147. package/lib/utils/normalizers/leading-zero.d.ts +17 -0
  148. package/lib/utils/normalizers/leading-zero.js +0 -12
  149. package/lib/utils/normalizers/leading-zero.js.flow +16 -0
  150. package/lib/utils/normalizers/quotes.d.ts +18 -0
  151. package/lib/utils/normalizers/quotes.js +0 -13
  152. package/lib/utils/normalizers/quotes.js.flow +17 -0
  153. package/lib/utils/normalizers/timings.d.ts +18 -0
  154. package/lib/utils/normalizers/timings.js +0 -14
  155. package/lib/utils/normalizers/timings.js.flow +17 -0
  156. package/lib/utils/normalizers/whitespace.d.ts +19 -0
  157. package/lib/utils/normalizers/whitespace.js +0 -15
  158. package/lib/utils/normalizers/whitespace.js.flow +18 -0
  159. package/lib/utils/normalizers/zero-dimensions.d.ts +19 -0
  160. package/lib/utils/normalizers/zero-dimensions.js +0 -15
  161. package/lib/utils/normalizers/zero-dimensions.js.flow +18 -0
  162. package/lib/utils/object-utils.d.ts +66 -0
  163. package/lib/utils/object-utils.js +21 -13
  164. package/lib/utils/object-utils.js.flow +77 -0
  165. package/lib/utils/property-priorities.d.ts +11 -0
  166. package/lib/utils/property-priorities.js +516 -101
  167. package/lib/utils/property-priorities.js.flow +10 -0
  168. package/lib/utils/split-css-value.d.ts +14 -0
  169. package/lib/utils/split-css-value.js +0 -14
  170. package/lib/utils/split-css-value.js.flow +15 -0
  171. package/lib/validate.d.ts +12 -0
  172. package/lib/validate.js +1 -10
  173. package/lib/validate.js.flow +12 -0
  174. package/package.json +4 -5
  175. package/lib/expand-shorthands.d.ts +0 -5
  176. package/lib/expand-shorthands.js +0 -330
  177. package/lib/namespace-transforms/__tests__/preflatten.test.js +0 -120
  178. package/lib/namespace-transforms/preflatten.js +0 -89
  179. package/lib/preprocess-rules/expand-shorthands.js +0 -156
  180. package/lib/preprocess-rules/null-out-longhand.js +0 -310
  181. package/lib/preprocess-rules/react-native-web.js +0 -142
  182. package/lib/stylex-defaultValue.js +0 -397
@@ -4,113 +4,528 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = getPriority;
7
- /**
8
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- *
13
- *
14
- */
15
-
7
+ const longHandPhysical = new Set();
8
+ const longHandLogical = new Set();
9
+ const shorthandsOfLonghands = new Set();
10
+ const shorthandsOfShorthands = new Set();
11
+ longHandLogical.add('background-blend-mode');
12
+ longHandLogical.add('isolation');
13
+ longHandLogical.add('mix-blend-mode');
14
+ shorthandsOfShorthands.add('animation');
15
+ longHandLogical.add('animation-composition');
16
+ longHandLogical.add('animation-delay');
17
+ longHandLogical.add('animation-direction');
18
+ longHandLogical.add('animation-duration');
19
+ longHandLogical.add('animation-fill-mode');
20
+ longHandLogical.add('animation-iteration-count');
21
+ longHandLogical.add('animation-name');
22
+ longHandLogical.add('animation-play-state');
23
+ shorthandsOfLonghands.add('animation-range');
24
+ longHandLogical.add('animation-range-end');
25
+ longHandLogical.add('animation-range-start');
26
+ longHandLogical.add('animation-timing-function');
27
+ longHandLogical.add('animation-timeline');
28
+ shorthandsOfLonghands.add('scroll-timeline');
29
+ longHandLogical.add('scroll-timeline-axis');
30
+ longHandLogical.add('scroll-timeline-name');
31
+ longHandLogical.add('timeline-scope');
32
+ shorthandsOfLonghands.add('view-timeline');
33
+ longHandLogical.add('view-timeline-axis');
34
+ longHandLogical.add('view-timeline-inset');
35
+ longHandLogical.add('view-timeline-name');
36
+ shorthandsOfShorthands.add('background');
37
+ longHandLogical.add('background-attachment');
38
+ longHandLogical.add('background-clip');
39
+ longHandLogical.add('background-color');
40
+ longHandLogical.add('background-image');
41
+ longHandLogical.add('background-origin');
42
+ longHandLogical.add('background-repeat');
43
+ longHandLogical.add('background-size');
44
+ shorthandsOfLonghands.add('background-position');
45
+ longHandLogical.add('background-position-x');
46
+ longHandLogical.add('background-position-y');
47
+ shorthandsOfShorthands.add('border');
48
+ shorthandsOfLonghands.add('border-color');
49
+ shorthandsOfLonghands.add('border-style');
50
+ shorthandsOfLonghands.add('border-width');
51
+ shorthandsOfShorthands.add('border-block');
52
+ longHandLogical.add('border-block-color');
53
+ longHandLogical.add('border-block-stylex');
54
+ longHandLogical.add('border-block-width');
55
+ shorthandsOfLonghands.add('border-block-start');
56
+ shorthandsOfLonghands.add('border-top');
57
+ longHandLogical.add('border-block-start-color');
58
+ longHandLogical.add('border-top-color');
59
+ longHandLogical.add('border-block-start-style');
60
+ longHandLogical.add('border-top-style');
61
+ longHandLogical.add('border-block-start-width');
62
+ longHandLogical.add('border-top-width');
63
+ shorthandsOfLonghands.add('border-block-end');
64
+ shorthandsOfLonghands.add('border-bottom');
65
+ longHandLogical.add('border-block-end-color');
66
+ longHandPhysical.add('border-bottom-color');
67
+ longHandLogical.add('border-block-end-style');
68
+ longHandPhysical.add('border-bottom-style');
69
+ longHandLogical.add('border-block-end-width');
70
+ longHandPhysical.add('border-bottom-width');
71
+ shorthandsOfShorthands.add('border-inline');
72
+ shorthandsOfLonghands.add('border-inline-color');
73
+ shorthandsOfLonghands.add('border-inline-style');
74
+ shorthandsOfLonghands.add('border-inline-width');
75
+ shorthandsOfLonghands.add('border-inline-start');
76
+ shorthandsOfLonghands.add('border-left');
77
+ longHandLogical.add('border-inline-start-color');
78
+ longHandPhysical.add('border-left-color');
79
+ longHandLogical.add('border-inline-start-style');
80
+ longHandPhysical.add('border-left-style');
81
+ longHandLogical.add('border-inline-start-width');
82
+ longHandPhysical.add('border-left-width');
83
+ shorthandsOfLonghands.add('border-inline-end');
84
+ shorthandsOfLonghands.add('border-right');
85
+ longHandLogical.add('border-inline-end-color');
86
+ longHandPhysical.add('border-right-color');
87
+ longHandLogical.add('border-inline-end-style');
88
+ longHandPhysical.add('border-right-style');
89
+ longHandLogical.add('border-inline-end-width');
90
+ longHandPhysical.add('border-right-width');
91
+ shorthandsOfLonghands.add('border-image');
92
+ longHandLogical.add('border-image-outset');
93
+ longHandLogical.add('border-image-repeat');
94
+ longHandLogical.add('border-image-slice');
95
+ longHandLogical.add('border-image-source');
96
+ longHandLogical.add('border-image-width');
97
+ shorthandsOfLonghands.add('border-radius');
98
+ longHandLogical.add('border-start-end-radius');
99
+ longHandLogical.add('border-start-start-radius');
100
+ longHandLogical.add('border-end-end-radius');
101
+ longHandLogical.add('border-end-start-radius');
102
+ longHandPhysical.add('border-top-left-radius');
103
+ longHandPhysical.add('border-top-right-radius');
104
+ longHandPhysical.add('border-bottom-left-radius');
105
+ longHandPhysical.add('border-bottom-right-radius');
106
+ longHandLogical.add('box-shadow');
107
+ longHandLogical.add('accent-color');
108
+ longHandLogical.add('appearance');
109
+ longHandLogical.add('aspect-ratio');
110
+ shorthandsOfLonghands.add('caret');
111
+ longHandLogical.add('caret-color');
112
+ longHandLogical.add('caret-shape');
113
+ longHandLogical.add('cursor');
114
+ longHandLogical.add('ime-mode');
115
+ longHandLogical.add('input-security');
116
+ shorthandsOfLonghands.add('outline');
117
+ longHandLogical.add('outline-color');
118
+ longHandLogical.add('outline-offset');
119
+ longHandLogical.add('outline-style');
120
+ longHandLogical.add('outline-width');
121
+ longHandLogical.add('pointer-events');
122
+ longHandLogical.add('resize');
123
+ longHandLogical.add('text-overflow');
124
+ longHandLogical.add('user-select');
125
+ shorthandsOfLonghands.add('grid-gap');
126
+ shorthandsOfLonghands.add('gap');
127
+ longHandLogical.add('grid-row-gap');
128
+ longHandLogical.add('row-gap');
129
+ longHandLogical.add('grid-column-gap');
130
+ longHandLogical.add('column-gap');
131
+ shorthandsOfLonghands.add('place-content');
132
+ longHandLogical.add('align-content');
133
+ longHandLogical.add('justify-content');
134
+ shorthandsOfLonghands.add('place-items');
135
+ longHandLogical.add('align-items');
136
+ longHandLogical.add('justify-items');
137
+ shorthandsOfLonghands.add('place-self');
138
+ longHandLogical.add('align-self');
139
+ longHandLogical.add('justify-self');
140
+ longHandLogical.add('box-sizing');
141
+ longHandLogical.add('block-size');
142
+ longHandPhysical.add('height');
143
+ longHandLogical.add('inline-size');
144
+ longHandPhysical.add('width');
145
+ longHandLogical.add('max-block-size');
146
+ longHandPhysical.add('max-height');
147
+ longHandLogical.add('max-inline-size');
148
+ longHandPhysical.add('max-width');
149
+ longHandLogical.add('min-block-size');
150
+ longHandPhysical.add('min-height');
151
+ longHandLogical.add('min-inline-size');
152
+ longHandPhysical.add('min-width');
153
+ shorthandsOfShorthands.add('margin');
154
+ shorthandsOfLonghands.add('margin-block');
155
+ longHandLogical.add('margin-block-start');
156
+ longHandPhysical.add('margin-top');
157
+ longHandLogical.add('margin-block-end');
158
+ longHandPhysical.add('margin-bottom');
159
+ shorthandsOfLonghands.add('margin-inline');
160
+ longHandLogical.add('margin-inline-start');
161
+ longHandPhysical.add('margin-left');
162
+ longHandLogical.add('margin-inline-end');
163
+ longHandPhysical.add('margin-right');
164
+ longHandLogical.add('margin-trim');
165
+ shorthandsOfLonghands.add('overscroll-behavior');
166
+ longHandLogical.add('overscroll-behavior-block');
167
+ longHandPhysical.add('overscroll-behavior-y');
168
+ longHandLogical.add('overscroll-behavior-inline');
169
+ longHandPhysical.add('overscroll-behavior-x');
170
+ shorthandsOfShorthands.add('padding');
171
+ shorthandsOfLonghands.add('padding-block');
172
+ longHandLogical.add('padding-block-start');
173
+ longHandPhysical.add('padding-top');
174
+ longHandLogical.add('padding-block-end');
175
+ longHandPhysical.add('padding-bottom');
176
+ shorthandsOfLonghands.add('padding-inline');
177
+ longHandLogical.add('padding-inline-start');
178
+ longHandPhysical.add('padding-left');
179
+ longHandLogical.add('padding-inline-end');
180
+ longHandPhysical.add('padding-right');
181
+ longHandLogical.add('visibility');
182
+ longHandLogical.add('color');
183
+ longHandLogical.add('color-scheme');
184
+ longHandLogical.add('forced-color-adjust');
185
+ longHandLogical.add('opacity');
186
+ longHandLogical.add('print-color-adjust');
187
+ shorthandsOfLonghands.add('columns');
188
+ longHandLogical.add('column-count');
189
+ longHandLogical.add('column-width');
190
+ longHandLogical.add('column-fill');
191
+ longHandLogical.add('column-span');
192
+ shorthandsOfLonghands.add('column-rule');
193
+ longHandLogical.add('column-rule-color');
194
+ longHandLogical.add('column-rule-style');
195
+ longHandLogical.add('column-rule-width');
196
+ longHandLogical.add('contain');
197
+ shorthandsOfLonghands.add('contain-intrinsic-size');
198
+ longHandLogical.add('contain-intrinsic-block-size');
199
+ longHandLogical.add('contain-intrinsic-width');
200
+ longHandLogical.add('contain-intrinsic-height');
201
+ longHandLogical.add('contain-intrinsic-inline-size');
202
+ shorthandsOfLonghands.add('container');
203
+ longHandLogical.add('container-name');
204
+ longHandLogical.add('container-type');
205
+ longHandLogical.add('content-visibility');
206
+ longHandLogical.add('counter-increment');
207
+ longHandLogical.add('counter-reset');
208
+ longHandLogical.add('counter-set');
209
+ longHandLogical.add('display');
210
+ shorthandsOfLonghands.add('flex');
211
+ longHandLogical.add('flex-basis');
212
+ longHandLogical.add('flex-grow');
213
+ longHandLogical.add('flex-shrink');
214
+ shorthandsOfLonghands.add('flex-flow');
215
+ longHandLogical.add('flex-direction');
216
+ longHandLogical.add('flex-wrap');
217
+ longHandLogical.add('order');
218
+ shorthandsOfShorthands.add('font');
219
+ longHandLogical.add('font-family');
220
+ longHandLogical.add('font-size');
221
+ longHandLogical.add('font-stretch');
222
+ longHandLogical.add('font-style');
223
+ longHandLogical.add('font-weight');
224
+ longHandLogical.add('line-height');
225
+ shorthandsOfLonghands.add('font-variant');
226
+ longHandLogical.add('font-variant-alternates');
227
+ longHandLogical.add('font-variant-caps');
228
+ longHandLogical.add('font-variant-east-asian');
229
+ longHandLogical.add('font-variant-emoji');
230
+ longHandLogical.add('font-variant-ligatures');
231
+ longHandLogical.add('font-variant-numeric');
232
+ longHandLogical.add('font-variant-position');
233
+ longHandLogical.add('font-feature-settings');
234
+ longHandLogical.add('font-kerning');
235
+ longHandLogical.add('font-language-override');
236
+ longHandLogical.add('font-optical-sizing');
237
+ longHandLogical.add('font-palette');
238
+ longHandLogical.add('font-variation-settings');
239
+ longHandLogical.add('font-size-adjust');
240
+ longHandLogical.add('font-smooth');
241
+ longHandLogical.add('font-synthesis-position');
242
+ longHandLogical.add('font-synthesis-small-caps');
243
+ longHandLogical.add('font-synthesis-style');
244
+ longHandLogical.add('font-synthesis-weight');
245
+ longHandLogical.add('line-height-step');
246
+ longHandLogical.add('box-decoration-break');
247
+ longHandLogical.add('break-after');
248
+ longHandLogical.add('break-before');
249
+ longHandLogical.add('break-inside');
250
+ longHandLogical.add('orphans');
251
+ longHandLogical.add('widows');
252
+ longHandLogical.add('content');
253
+ longHandLogical.add('quotes');
254
+ shorthandsOfShorthands.add('grid');
255
+ longHandLogical.add('grid-auto-flow');
256
+ longHandLogical.add('grid-auto-rows');
257
+ longHandLogical.add('grid-auto-columns');
258
+ shorthandsOfShorthands.add('grid-template');
259
+ shorthandsOfLonghands.add('grid-template-areas');
260
+ longHandLogical.add('grid-template-columns');
261
+ longHandLogical.add('grid-template-rows');
262
+ shorthandsOfShorthands.add('grid-area');
263
+ shorthandsOfLonghands.add('grid-row');
264
+ longHandLogical.add('grid-row-start');
265
+ longHandLogical.add('grid-row-end');
266
+ shorthandsOfLonghands.add('grid-column');
267
+ longHandLogical.add('grid-column-start');
268
+ longHandLogical.add('grid-column-end');
269
+ longHandLogical.add('align-tracks');
270
+ longHandLogical.add('justify-tracks');
271
+ longHandLogical.add('masonry-auto-flow');
272
+ longHandLogical.add('image-orientation');
273
+ longHandLogical.add('image-rendering');
274
+ longHandLogical.add('image-resolution');
275
+ longHandLogical.add('object-fit');
276
+ longHandLogical.add('object-position');
277
+ longHandLogical.add('initial-letter');
278
+ longHandLogical.add('initial-letter-align');
279
+ shorthandsOfLonghands.add('list-style');
280
+ longHandLogical.add('list-style-image');
281
+ longHandLogical.add('list-style-position');
282
+ longHandLogical.add('list-style-type');
283
+ longHandLogical.add('clip');
284
+ longHandLogical.add('clip-path');
285
+ shorthandsOfLonghands.add('mask');
286
+ longHandLogical.add('mask-clip');
287
+ longHandLogical.add('mask-composite');
288
+ longHandLogical.add('mask-image');
289
+ longHandLogical.add('mask-mode');
290
+ longHandLogical.add('mask-origin');
291
+ longHandLogical.add('mask-position');
292
+ longHandLogical.add('mask-repeat');
293
+ longHandLogical.add('mask-size');
294
+ longHandLogical.add('mask-type');
295
+ shorthandsOfLonghands.add('mask-border');
296
+ longHandLogical.add('mask-border-mode');
297
+ longHandLogical.add('mask-border-outset');
298
+ longHandLogical.add('mask-border-repeat');
299
+ longHandLogical.add('mask-border-slice');
300
+ longHandLogical.add('mask-border-source');
301
+ longHandLogical.add('mask-border-width');
302
+ shorthandsOfShorthands.add('all');
303
+ longHandLogical.add('text-rendering');
304
+ shorthandsOfLonghands.add('offset');
305
+ longHandLogical.add('offset-anchor');
306
+ longHandLogical.add('offset-distance');
307
+ longHandLogical.add('offset-path');
308
+ longHandLogical.add('offset-position');
309
+ longHandLogical.add('offset-rotate');
310
+ longHandLogical.add('-webkit-box-orient');
311
+ longHandLogical.add('-webkit-line-clamp');
312
+ shorthandsOfLonghands.add('overflow');
313
+ longHandLogical.add('overflow-block');
314
+ longHandPhysical.add('overflow-y');
315
+ longHandLogical.add('overflow-inline');
316
+ longHandPhysical.add('overflow-x');
317
+ longHandLogical.add('overflow-clip-margin');
318
+ longHandLogical.add('scroll-gutter');
319
+ longHandLogical.add('scroll-behavior');
320
+ longHandLogical.add('page');
321
+ longHandLogical.add('page-break-after');
322
+ longHandLogical.add('page-break-before');
323
+ longHandLogical.add('page-break-inside');
324
+ shorthandsOfShorthands.add('inset');
325
+ shorthandsOfLonghands.add('inset-block');
326
+ longHandLogical.add('inset-block-start');
327
+ longHandPhysical.add('top');
328
+ longHandLogical.add('inset-block-end');
329
+ longHandPhysical.add('bottom');
330
+ shorthandsOfLonghands.add('inset-inline');
331
+ longHandLogical.add('inset-inline-start');
332
+ longHandPhysical.add('left');
333
+ longHandLogical.add('inset-inline-end');
334
+ longHandPhysical.add('right');
335
+ longHandLogical.add('clear');
336
+ longHandLogical.add('float');
337
+ longHandLogical.add('position');
338
+ longHandLogical.add('z-index');
339
+ longHandLogical.add('ruby-align');
340
+ longHandLogical.add('ruby-merge');
341
+ longHandLogical.add('ruby-position');
342
+ longHandLogical.add('overflow-anchor');
343
+ shorthandsOfShorthands.add('scroll-margin');
344
+ shorthandsOfLonghands.add('scroll-margin-block');
345
+ longHandLogical.add('scroll-margin-block-start');
346
+ longHandPhysical.add('scroll-margin-top');
347
+ longHandLogical.add('scroll-margin-block-end');
348
+ longHandPhysical.add('scroll-margin-bottom');
349
+ shorthandsOfLonghands.add('scroll-margin-inline');
350
+ longHandLogical.add('scroll-margin-inline-start');
351
+ longHandPhysical.add('scroll-margin-left');
352
+ longHandLogical.add('scroll-margin-inline-end');
353
+ longHandPhysical.add('scroll-margin-right');
354
+ shorthandsOfShorthands.add('scroll-padding');
355
+ shorthandsOfLonghands.add('scroll-padding-block');
356
+ longHandLogical.add('scroll-padding-block-start');
357
+ longHandPhysical.add('scroll-padding-top');
358
+ longHandLogical.add('scroll-padding-block-end');
359
+ longHandPhysical.add('scroll-padding-bottom');
360
+ shorthandsOfLonghands.add('scroll-padding-inline');
361
+ longHandLogical.add('scroll-padding-inline-start');
362
+ longHandPhysical.add('scroll-padding-left');
363
+ longHandLogical.add('scroll-padding-inline-end');
364
+ longHandPhysical.add('scroll-padding-right');
365
+ longHandLogical.add('scroll-snap-align');
366
+ longHandLogical.add('scroll-snap-stop');
367
+ shorthandsOfLonghands.add('scroll-snap-type');
368
+ longHandLogical.add('scrollbar-color');
369
+ longHandLogical.add('scrollbar-width');
370
+ longHandLogical.add('shape-image-threshold');
371
+ longHandLogical.add('shape-margin');
372
+ longHandLogical.add('shape-outside');
373
+ longHandLogical.add('azimuth');
374
+ longHandLogical.add('border-collapse');
375
+ longHandLogical.add('border-spacing');
376
+ longHandLogical.add('caption-side');
377
+ longHandLogical.add('empty-cells');
378
+ longHandLogical.add('table-layout');
379
+ longHandLogical.add('vertical-align');
380
+ shorthandsOfLonghands.add('text-decoration');
381
+ longHandLogical.add('text-decoration-color');
382
+ longHandLogical.add('text-decoration-line');
383
+ longHandLogical.add('text-decoration-skip');
384
+ longHandLogical.add('text-decoration-skip-ink');
385
+ longHandLogical.add('text-decoration-style');
386
+ longHandLogical.add('text-decoration-thickness');
387
+ shorthandsOfLonghands.add('text-emphasis');
388
+ longHandLogical.add('text-emphasis-color');
389
+ longHandLogical.add('text-emphasis-position');
390
+ longHandLogical.add('text-emphasis-style');
391
+ longHandLogical.add('text-shadow');
392
+ longHandLogical.add('text-underline-offset');
393
+ longHandLogical.add('text-underline-position');
394
+ longHandLogical.add('hanging-punctuation');
395
+ longHandLogical.add('hyphenate-character');
396
+ longHandLogical.add('hyphenate-limit-chars');
397
+ longHandLogical.add('hyphens');
398
+ longHandLogical.add('letter-spacing');
399
+ longHandLogical.add('line-break');
400
+ longHandLogical.add('overflow-wrap');
401
+ longHandLogical.add('paint-order');
402
+ longHandLogical.add('tab-size');
403
+ longHandLogical.add('text-align');
404
+ longHandLogical.add('text-align-last');
405
+ longHandLogical.add('text-indent');
406
+ longHandLogical.add('text-justify');
407
+ longHandLogical.add('text-size-adjust');
408
+ longHandLogical.add('text-transform');
409
+ longHandLogical.add('text-wrap');
410
+ longHandLogical.add('white-space');
411
+ longHandLogical.add('white-space-collapse');
412
+ longHandLogical.add('word-break');
413
+ longHandLogical.add('word-spacing');
414
+ longHandLogical.add('word-wrap');
415
+ longHandLogical.add('backface-visibility');
416
+ longHandLogical.add('perspective');
417
+ longHandLogical.add('perspective-origin');
418
+ longHandLogical.add('rotate');
419
+ longHandLogical.add('scale');
420
+ longHandLogical.add('transform');
421
+ longHandLogical.add('transform-box');
422
+ longHandLogical.add('transform-origin');
423
+ longHandLogical.add('transform-style');
424
+ longHandLogical.add('translate');
425
+ shorthandsOfLonghands.add('transition');
426
+ longHandLogical.add('transition-delay');
427
+ longHandLogical.add('transition-duration');
428
+ longHandLogical.add('transition-property');
429
+ longHandLogical.add('transition-timing-function');
430
+ longHandLogical.add('view-transition-name');
431
+ longHandLogical.add('will-change');
432
+ longHandLogical.add('direction');
433
+ longHandLogical.add('text-combine-upright');
434
+ longHandLogical.add('text-orientation');
435
+ longHandLogical.add('unicode-bidi');
436
+ longHandLogical.add('writing-mode');
437
+ longHandLogical.add('backdrop-filter');
438
+ longHandLogical.add('filter');
439
+ longHandLogical.add('math-depth');
440
+ longHandLogical.add('math-shift');
441
+ longHandLogical.add('math-style');
442
+ longHandLogical.add('touch-action');
16
443
  const PRIORITIES = {
17
- // These should never exist at runtime:
18
- border: 1,
19
- 'border-block-end': 2,
20
- 'border-block-start': 2,
21
- 'border-top': 2.1,
22
- 'border-bottom': 2.1,
23
- 'border-inline-end': 2,
24
- 'border-inline-start': 2,
25
- 'border-left': 2,
26
- 'border-right': 2,
27
- // End of never-exist-at-runtime properties.
28
-
29
- // These are shorthands of shorthands:
30
- grid: 2,
31
- 'grid-area': 2,
32
- // These are shorthands of final properties:
33
- 'border-color': 3,
34
- 'border-style': 3,
35
- 'border-width': 3,
36
- 'border-image': 3,
37
- 'border-radius': 3,
38
- animation: 3,
39
- background: 3,
40
- 'column-rule': 3,
41
- columns: 3,
42
- flex: 3,
43
- 'flex-flow': 3,
44
- font: 3,
45
- gap: 3,
46
- 'grid-column': 3,
47
- 'grid-row': 3,
48
- 'grid-template': 3,
49
- 'list-style': 3,
50
- margin: 3,
51
- mask: 3,
52
- offset: 3,
53
- outline: 3,
54
- overflow: 3,
55
- padding: 3,
56
- 'place-content': 3,
57
- 'place-items': 3,
58
- 'place-self': 3,
59
- 'scroll-margin': 3,
60
- 'scroll-padding': 3,
61
- 'text-decoration': 3,
62
- 'text-emphasis': 3,
63
- transition: 3,
64
- ':has': 4.5,
65
- ':dir': 5,
66
- ':lang': 5.1,
67
- ':first-child': 5.2,
68
- ':last-child': 5.3,
69
- ':only-child': 5.4,
70
- ':nth-child': 6,
71
- ':nth-of-type': 6.1,
72
- ':only-of-type': 6.2,
73
- ':empty': 7,
74
- ':link': 8,
75
- ':any-link': 8.1,
76
- ':target': 8.2,
77
- ':visited': 8.3,
78
- ':enabled': 9.1,
79
- ':disabled': 9.2,
80
- ':required': 9.3,
81
- ':optional': 9.4,
82
- ':read-only': 9.5,
83
- ':read-write': 9.6,
84
- ':placeholder-shown': 9.7,
85
- ':default': 10,
86
- ':checked': 10.1,
87
- ':indeterminate': 10.1,
88
- ':blank': 10.2,
89
- ':valid': 10.3,
90
- ':invalid': 10.4,
91
- ':autofill': 11,
92
- ':picture-in-picture': 12,
93
- ':fullscreen': 12.1,
94
- ':paused': 12.2,
95
- ':playing': 12.3,
96
- ':hover': 13,
97
- ':focusWithin': 14,
98
- ':focusVisible': 15,
99
- ':focus': 16,
100
- ':active': 17
444
+ ':is': 40,
445
+ ':where': 40,
446
+ ':not': 40,
447
+ ':has': 45,
448
+ ':dir': 50,
449
+ ':lang': 51,
450
+ ':first-child': 52,
451
+ ':first-of-type': 53,
452
+ ':last-child': 54,
453
+ ':last-of-type': 55,
454
+ ':only-child': 56,
455
+ ':only-of-type': 57,
456
+ ':nth-child': 60,
457
+ ':nth-last-child': 61,
458
+ ':nth-of-type': 62,
459
+ ':nth-last-of-type': 63,
460
+ ':empty': 70,
461
+ ':link': 80,
462
+ ':any-link': 81,
463
+ ':local-link': 82,
464
+ ':target-within': 83,
465
+ ':target': 84,
466
+ ':visited': 85,
467
+ ':enabled': 91,
468
+ ':disabled': 92,
469
+ ':required': 93,
470
+ ':optional': 94,
471
+ ':read-only': 95,
472
+ ':read-write': 96,
473
+ ':placeholder-shown': 97,
474
+ ':in-range': 98,
475
+ ':out-of-range': 99,
476
+ ':default': 100,
477
+ ':checked': 101,
478
+ ':indeterminate': 101,
479
+ ':blank': 102,
480
+ ':valid': 103,
481
+ ':invalid': 104,
482
+ ':user-invalid': 105,
483
+ ':autofill': 110,
484
+ ':picture-in-picture': 120,
485
+ ':modal': 121,
486
+ ':fullscreen': 122,
487
+ ':paused': 123,
488
+ ':playing': 124,
489
+ ':current': 125,
490
+ ':past': 126,
491
+ ':future': 127,
492
+ ':hover': 130,
493
+ ':focusWithin': 140,
494
+ ':focus': 150,
495
+ ':focusVisible': 160,
496
+ ':active': 170
101
497
  };
102
498
  function getPriority(key) {
499
+ if (key.startsWith('--')) {
500
+ return 1;
501
+ }
103
502
  if (key.startsWith('@supports')) {
104
- return 20;
503
+ return 30;
105
504
  }
106
505
  if (key.startsWith('@media')) {
107
- return 21;
506
+ return 200;
507
+ }
508
+ if (key.startsWith('@container')) {
509
+ return 300;
510
+ }
511
+ if (key.startsWith('::')) {
512
+ return 5000;
513
+ }
514
+ if (key.startsWith(':')) {
515
+ const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
516
+ return PRIORITIES[prop] ?? 40;
517
+ }
518
+ if (longHandPhysical.has(key)) {
519
+ return 4000;
520
+ }
521
+ if (longHandLogical.has(key)) {
522
+ return 3000;
523
+ }
524
+ if (shorthandsOfLonghands.has(key)) {
525
+ return 2000;
108
526
  }
109
- const prop = key.startsWith(':') && key.includes('(') ? key.slice(0, key.indexOf('(')) : key;
110
- let priority = PRIORITIES[prop] ?? 4;
111
- if (key.toLowerCase().includes('left') || key.toLowerCase().includes('right')) {
112
- // Bump priority for physical left/right values.
113
- priority += 0.1;
527
+ if (shorthandsOfShorthands.has(key)) {
528
+ return 1000;
114
529
  }
115
- return priority;
530
+ return 3000;
116
531
  }
@@ -0,0 +1,10 @@
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
+ declare export default function getPriority(key: string): number;
@@ -0,0 +1,14 @@
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
+ import type { TStyleValue } from '../common-types';
11
+ declare function splitValue(
12
+ str: TStyleValue,
13
+ ): ReadonlyArray<number | string | null>;
14
+ export default splitValue;