@stylexjs/shared 0.2.0-beta.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. package/README.md +81 -0
  2. package/lib/common-types.d.ts +50 -0
  3. package/lib/common-types.js.flow +65 -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 +8 -47
  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 +19 -27
  15. package/lib/index.js.flow +59 -0
  16. package/lib/messages.d.ts +36 -0
  17. package/lib/messages.js +28 -55
  18. package/lib/messages.js.flow +39 -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 +193 -0
  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 +30 -0
  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 +136 -0
  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 +107 -0
  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 +62 -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 -142
  99. package/lib/stylex-create.js.flow +30 -0
  100. package/lib/stylex-define-vars.d.ts +36 -0
  101. package/lib/stylex-define-vars.js +72 -0
  102. package/lib/stylex-define-vars.js.flow +28 -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 +0 -10
  108. package/lib/stylex-include.js.flow +20 -0
  109. package/lib/stylex-keyframes.d.ts +17 -0
  110. package/lib/stylex-keyframes.js +22 -30
  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 +50 -0
  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 +14 -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 +11 -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 +0 -12
  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 +531 -0
  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 +33 -0
  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 -387
  178. package/lib/stylex-defaultValue.js +0 -397
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Pipe = void 0;
6
+ exports.arraySort = exports.arrayEquals = exports.Pipe = void 0;
7
7
  exports.flattenObject = flattenObject;
8
+ exports.isPlainObject = isPlainObject;
8
9
  exports.objEntries = objEntries;
9
10
  exports.objFromEntries = objFromEntries;
10
11
  exports.objMap = objMap;
@@ -12,17 +13,9 @@ exports.objMapEntry = objMapEntry;
12
13
  exports.objMapKeys = objMapKeys;
13
14
  exports.objValues = objValues;
14
15
  var _stylexInclude = require("../stylex-include");
15
- /**
16
- * Copyright (c) Meta Platforms, Inc. and affiliates.
17
- *
18
- * This source code is licensed under the MIT license found in the
19
- * LICENSE file in the root directory of this source tree.
20
- *
21
- *
22
- */
23
-
24
- // A bunch of object utils with better Flow types
25
-
16
+ function isPlainObject(obj) {
17
+ return typeof obj === 'object' && obj != null && !Array.isArray(obj) && obj?.constructor === Object;
18
+ }
26
19
  function flattenObject(obj) {
27
20
  const result = {};
28
21
  for (const [key, value] of objEntries(obj)) {
@@ -91,4 +84,19 @@ class Pipe {
91
84
  return new Pipe(val);
92
85
  }
93
86
  }
94
- exports.Pipe = Pipe;
87
+ exports.Pipe = Pipe;
88
+ const arraySort = (arr, fn) => [...arr].sort(fn);
89
+ exports.arraySort = arraySort;
90
+ const arrayEquals = function (arr1, arr2) {
91
+ let equals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (a, b) => a === b;
92
+ if (arr1.length !== arr2.length) {
93
+ return false;
94
+ }
95
+ for (let i = 0; i < arr1.length; i++) {
96
+ if (!equals(arr1[i], arr2[i])) {
97
+ return false;
98
+ }
99
+ }
100
+ return true;
101
+ };
102
+ exports.arrayEquals = arrayEquals;
@@ -0,0 +1,77 @@
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
+ // A bunch of object utils with better Flow types
11
+
12
+ import type { CompiledStyles } from '../common-types';
13
+
14
+ import { IncludedStyles } from '../stylex-include';
15
+
16
+ declare export function isPlainObject(obj: mixed): void;
17
+
18
+ declare export function flattenObject(obj: CompiledStyles): {
19
+ +[string]: null | string | IncludedStyles,
20
+ };
21
+
22
+ type _ObjectEntries<Obj: { +[string]: mixed }> = {
23
+ [Key in keyof Obj]: [Key, Obj[Key]],
24
+ };
25
+ type ObjectEntries<Obj: { +[string]: mixed }> = $Values<_ObjectEntries<Obj>>;
26
+
27
+ declare export function objEntries<Obj: { +[string]: mixed }>(
28
+ obj: Obj,
29
+ ): $ReadOnlyArray<ObjectEntries<Obj>>;
30
+
31
+ declare export function objValues<Obj: { +[string]: mixed }>(
32
+ obj: Obj,
33
+ ): $ReadOnlyArray<Obj[$Keys<Obj>]>;
34
+
35
+ declare export function objFromEntries<K: string | number, V>(
36
+ entries: $ReadOnlyArray<$ReadOnly<[K, V]>>,
37
+ ): { [K]: V };
38
+
39
+ declare export function objMapKeys<V, K1: string = string, K2: string = string>(
40
+ obj: { +[K1]: V },
41
+ mapper: (K1) => K2,
42
+ ): { +[K2]: V };
43
+
44
+ declare export function objMapEntry<
45
+ V,
46
+ V2,
47
+ K1: string = string,
48
+ K2: string = string,
49
+ >(
50
+ obj: { +[K1]: V },
51
+ mapper: ([K1, V]) => [K2, V2],
52
+ ): { +[K2]: V2 };
53
+
54
+ declare export function objMap<V, V2, K: string = string>(
55
+ obj: { +[K]: V },
56
+ mapper: (V, K) => V2,
57
+ ): { +[K]: V2 };
58
+
59
+ declare export class Pipe<T> {
60
+ value: T;
61
+ constructor(val: T): void;
62
+ pipe<T2>(mapper: (T) => T2): Pipe<T2>;
63
+ done(): T;
64
+ static create(val: T): Pipe<T>;
65
+ }
66
+
67
+ // Function that sorts an array without mutating it and returns a new array
68
+ declare export const arraySort: <T>(
69
+ arr: $ReadOnlyArray<T>,
70
+ fn?: (T, T) => number,
71
+ ) => $ReadOnlyArray<T>;
72
+
73
+ declare export const arrayEquals: <T>(
74
+ arr1: $ReadOnlyArray<T>,
75
+ arr2: $ReadOnlyArray<T>,
76
+ equals: (T, T) => boolean,
77
+ ) => boolean;
@@ -0,0 +1,11 @@
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
+ declare function getPriority(key: string): number;
11
+ export default getPriority;
@@ -0,0 +1,531 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getPriority;
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');
443
+ const PRIORITIES = {
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
497
+ };
498
+ function getPriority(key) {
499
+ if (key.startsWith('--')) {
500
+ return 1;
501
+ }
502
+ if (key.startsWith('@supports')) {
503
+ return 30;
504
+ }
505
+ if (key.startsWith('@media')) {
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;
526
+ }
527
+ if (shorthandsOfShorthands.has(key)) {
528
+ return 1000;
529
+ }
530
+ return 3000;
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;