@stylexjs/shared 0.2.0-beta.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -1,142 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
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
- /// # Handle CSS shorthands in a React Native compatible way.
19
- ///
20
- /// This means:
21
- /// - disallowing certain properties altogether by throwing errors
22
- /// - disallowing multiple values within many shorthands
23
- /// - Treating certain non-standard properties as aliases for real CSS properties
24
-
25
- const shorthands = {
26
- all: _ => {
27
- throw new Error('all is not supported');
28
- },
29
- animation: value => {
30
- throw new Error('animation is not supported');
31
- },
32
- background: value => {
33
- throw new Error('background is not supported. Use background-color, border-image etc. instead.');
34
- },
35
- border: rawValue => {
36
- throw new Error('border is not supported. Use border-width, border-style and border-color instead.');
37
- },
38
- borderInline: rawValue => {
39
- throw new Error('borderInline is not supported. Use borderInlineWidth, borderInlineStyle and borderInlineColor instead.');
40
- },
41
- // @Deprecated
42
- borderBlock: rawValue => {
43
- throw new Error('borderBlock is not supported. Use borderBlockWidth, borderBlockStyle and borderBlockColor instead.');
44
- },
45
- // @Deprecated
46
- borderTop: rawValue => {
47
- throw new Error('borderTop is not supported. Use borderTopWidth, borderTopStyle and borderTopColor instead.');
48
- },
49
- // @Deprecated
50
- borderInlineEnd: rawValue => {
51
- throw new Error('borderInlineEnd is not supported. Use borderInlineEndWidth, borderInlineEndStyle and borderInlineEndColor instead.');
52
- },
53
- // @Deprecated
54
- borderRight: rawValue => {
55
- throw new Error('borderRight is not supported. Use borderRightWidth, borderRightStyle and borderRightColor instead.');
56
- },
57
- // @Deprecated
58
- borderBottom: rawValue => {
59
- throw new Error('borderBottom is not supported. Use borderBottomWidth, borderBottomStyle and borderBottomColor instead.');
60
- },
61
- // @Deprecated
62
- borderInlineStart: rawValue => {
63
- throw new Error('borderInlineStart is not supported. Use borderInlineStartWidth, borderInlineStartStyle and borderInlineStartColor instead.');
64
- },
65
- // @Deprecated
66
- borderLeft: rawValue => {
67
- 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(' '));
68
- },
69
- margin: value => {
70
- const values = typeof value === 'number' ? [value] : (0, _splitCssValue.default)(value);
71
- if (values.length === 1) {
72
- return [['margin', values[0]]];
73
- } else {
74
- throw new Error('margin shorthand with multiple values is not supported. Use marginTop, marginInlineEnd, marginBottom and marginInlineStart instead.');
75
- }
76
- },
77
- padding: rawValue => {
78
- const values = typeof rawValue === 'number' ? [rawValue] : (0, _splitCssValue.default)(rawValue);
79
- if (values.length === 1) {
80
- return [['padding', values[0]]];
81
- }
82
- throw new Error('padding shorthand with multiple values is not supported. Use paddingTop, paddingInlineEnd, paddingBottom and paddingInlineStart instead.');
83
- }
84
- };
85
- const aliases = {
86
- // @UNSUPPORTED
87
- borderHorizontal: shorthands.borderInline,
88
- // @UNSUPPORTED
89
- borderVertical: shorthands.borderBlock,
90
- // @UNSUPPORTED
91
- borderBlockStart: shorthands.borderTop,
92
- // @UNSUPPORTED
93
- borderEnd: shorthands.borderInlineEnd,
94
- // @UNSUPPORTED
95
- borderBlockEnd: shorthands.borderBottom,
96
- // @UNSUPPORTED
97
- borderStart: shorthands.borderInlineStart,
98
- borderHorizontalWidth: value => [['borderInlineWidth', value]],
99
- borderHorizontalStyle: value => [['borderInlineStyle', value]],
100
- borderHorizontalColor: value => [['borderInlineColor', value]],
101
- borderVerticalWidth: value => [['borderBlockWidth', value]],
102
- borderVerticalStyle: value => [['borderBlockStyle', value]],
103
- borderVerticalColor: value => [['borderBlockColor', value]],
104
- borderBlockStartColor: value => [['borderTopColor', value]],
105
- borderBlockEndColor: value => [['borderBottomColor', value]],
106
- borderBlockStartStyle: value => [['borderTopStyle', value]],
107
- borderBlockEndStyle: value => [['borderBottomStyle', value]],
108
- borderBlockStartWidth: value => [['borderTopWidth', value]],
109
- borderBlockEndWidth: value => [['borderBottomWidth', value]],
110
- borderStartColor: value => [['borderInlineStartColor', value]],
111
- borderEndColor: value => [['borderInlineEndColor', value]],
112
- borderStartStyle: value => [['borderInlineStartStyle', value]],
113
- borderEndStyle: value => [['borderInlineEndStyle', value]],
114
- borderStartWidth: value => [['borderInlineStartWidth', value]],
115
- borderEndWidth: value => [['borderInlineEndWidth', value]],
116
- borderTopStartRadius: value => [['borderStartStartRadius', value]],
117
- borderTopEndRadius: value => [['borderStartEndRadius', value]],
118
- borderBottomStartRadius: value => [['borderEndStartRadius', value]],
119
- borderBottomEndRadius: value => [['borderEndEndRadius', value]],
120
- marginBlockStart: value => [['marginTop', value]],
121
- marginBlockEnd: value => [['marginBottom', value]],
122
- marginStart: value => [['marginInlineStart', value]],
123
- marginEnd: value => [['marginInlineEnd', value]],
124
- marginHorizontal: value => [['marginInline', value]],
125
- marginVertical: value => [['marginBlock', value]],
126
- paddingBlockStart: rawValue => [['paddingTop', rawValue]],
127
- paddingBlockEnd: rawValue => [['paddingBottom', rawValue]],
128
- paddingStart: value => [['paddingInlineStart', value]],
129
- paddingEnd: value => [['paddingInlineEnd', value]],
130
- paddingHorizontal: value => [['paddingInline', value]],
131
- paddingVertical: value => [['paddingBlock', value]],
132
- insetBlockStart: value => [['top', value]],
133
- insetBlockEnd: value => [['bottom', value]],
134
- start: value => [['insetInlineStart', value]],
135
- end: value => [['insetInlineEnd', value]]
136
- };
137
- const expansions = {
138
- ...shorthands,
139
- ...aliases
140
- };
141
- var _default = expansions;
142
- exports.default = _default;
@@ -1,397 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StylexValueBuilder = void 0;
7
- exports.default = stylexDefaultValue;
8
- var messages = _interopRequireWildcard(require("./messages"));
9
- var _dashify = _interopRequireDefault(require("./utils/dashify"));
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
14
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
15
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
16
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
17
- function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
18
- function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
19
- function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
20
- var _set = /*#__PURE__*/new WeakSet();
21
- var _mediaWidths = /*#__PURE__*/new WeakMap();
22
- var _mediaHeights = /*#__PURE__*/new WeakMap();
23
- class StylexValueBuilder {
24
- constructor(defaultValue) {
25
- _classPrivateMethodInitSpec(this, _set);
26
- _classPrivateFieldInitSpec(this, _mediaWidths, {
27
- writable: true,
28
- value: []
29
- });
30
- _classPrivateFieldInitSpec(this, _mediaHeights, {
31
- writable: true,
32
- value: []
33
- });
34
- this.default = defaultValue;
35
- }
36
- mediaWidth(_ref, value) {
37
- let [min, max] = _ref;
38
- if (_classPrivateFieldGet(this, _mediaWidths).some(_ref2 => {
39
- let [m, M] = _ref2;
40
- return m <= min && min < M || m < max && max <= M || min <= m && max >= M;
41
- })) {
42
- throw new Error(messages.OVERLAPPING_MEDIA_WIDTHS);
43
- }
44
- _classPrivateFieldGet(this, _mediaWidths).push([min, max]);
45
- if (min > 0 && max < Infinity) {
46
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media (min-width: ${min}px and max-width: ${max}px)`, value);
47
- } else if (min === 0) {
48
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media (max-width: ${max}px)`, value);
49
- } else if (max === Infinity) {
50
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media (min-width: ${min}px)`, value);
51
- }
52
- throw new Error(messages.INVALID_MEDIA_QUERY);
53
- }
54
- mediaHeight(_ref3, value) {
55
- let [min, max] = _ref3;
56
- if (_classPrivateFieldGet(this, _mediaHeights).some(_ref4 => {
57
- let [m, M] = _ref4;
58
- return m <= min && min < M || m < max && max <= M || min <= m && max >= M;
59
- })) {
60
- throw new Error(messages.OVERLAPPING_MEDIA_HEIGHTS);
61
- }
62
- _classPrivateFieldGet(this, _mediaHeights).push([min, max]);
63
- if (min > 0 && max < Infinity) {
64
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media (min-height: ${min}px and max-height: ${max}px)`, value);
65
- } else if (min === 0) {
66
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media (max-height: ${max}px)`, value);
67
- } else if (max === Infinity) {
68
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media (min-height: ${min}px)`, value);
69
- }
70
- throw new Error(messages.INVALID_MEDIA_QUERY);
71
- }
72
-
73
- // mediaAspectRatio<TAddedValue>(
74
- // [min, max]: [number, number],
75
- // value: TAddedValue
76
- // ): StylexValueBuilder<TValue | TAddedValue> {
77
- // if (min > 0 && max < Infinity) {
78
- // return this.#set(
79
- // `@media (min-aspect-ratio: ${min} and max-aspect-ratio: $, })`,
80
- // value
81
- // );
82
- // } else if (min === 0) {
83
- // return this.#set(`@media (max-aspect-ratio: ${max})`, value);
84
- // } else if (max === Infinity) {
85
- // return this.#set(`@media (min-aspect-ratio: ${min})`, value);
86
- // }
87
- // throw new Error(messages.INVALID_MEDIA_QUERY);
88
- // }
89
-
90
- // mediaPortrait<TAddedValue>(
91
- // value: TAddedValue
92
- // ): StylexValueBuilder<TValue | TAddedValue> {
93
- // return this.#set('@media (orientation: portrait)', value);
94
- // }
95
-
96
- // mediaLandscape<TAddedValue>(
97
- // value: TAddedValue
98
- // ): StylexValueBuilder<TValue | TAddedValue> {
99
- // return this.#set('@media (orientation: landscape)', value);
100
- // }
101
-
102
- // mediaSRGBDisplay<TAddedValue>(
103
- // value: TAddedValue
104
- // ): StylexValueBuilder<TValue | TAddedValue> {
105
- // return this.#set('@media (color-gamut: srgb)', value);
106
- // }
107
-
108
- // mediaP3Display<TAddedValue>(
109
- // value: TAddedValue
110
- // ): StylexValueBuilder<TValue | TAddedValue> {
111
- // return this.#set('@media (color-gamut: p3)', value);
112
- // }
113
-
114
- // mediaRec2020Display<TAddedValue>(
115
- // value: TAddedValue
116
- // ): StylexValueBuilder<TValue | TAddedValue> {
117
- // return this.#set('@media (color-gamut: rec2020)', value);
118
- // }
119
-
120
- // mediaIsFullscreen<TAddedValue>(
121
- // value: TAddedValue
122
- // ): StylexValueBuilder<TValue | TAddedValue> {
123
- // return this.#set('@media (display-mode: fullscreen)', value);
124
- // }
125
-
126
- // These are confusing, so skipping them for now
127
- // mediaIsStandalone
128
- // mediaIsMinimalUI
129
-
130
- // mediaSDRDisplay<TAddedValue>(
131
- // value: TAddedValue
132
- // ): StylexValueBuilder<TValue | TAddedValue> {
133
- // return this.#set('@media (dynamic-range: standard)', value);
134
- // }
135
-
136
- // mediaHDRDisplay<TAddedValue>(
137
- // value: TAddedValue
138
- // ): StylexValueBuilder<TValue | TAddedValue> {
139
- // return this.#set('@media (dynamic-range: high)', value);
140
- // }
141
-
142
- // mediaSupportsHDRVideo<TAddedValue>(
143
- // value: TAddedValue
144
- // ): StylexValueBuilder<TValue | TAddedValue> {
145
- // return this.#set('@media (video-dynamic-range: high)', value);
146
- // }
147
-
148
- //<TAddedValue> mediaHasColor(value: TAddedValue): StylexValueBuilder<TValue | TAddedValue> {
149
- // return this.#set('@media (color)', value);
150
- // }
151
-
152
- // primaryInputCanHover<TAddedValue>(
153
- // value: TAddedValue
154
- // ): StylexValueBuilder<TValue | TAddedValue> {
155
- // return this.#set('@media (hover: hover)', value);
156
- // }
157
- // primaryInputCanNotHover<TAddedValue>(
158
- // value: TAddedValue
159
- // ): StylexValueBuilder<TValue | TAddedValue> {
160
- // return this.#set('@media (hover: none)', value);
161
- // }
162
-
163
- // someInputCanHover<TAddedValue>(
164
- // value: TAddedValue
165
- // ): StylexValueBuilder<TValue | TAddedValue> {
166
- // return this.#set('@media (any-hover: hover)', value);
167
- // }
168
-
169
- // noInputCanHover<TAddedValue>(
170
- // value: TAddedValue
171
- // ): StylexValueBuilder<TValue | TAddedValue> {
172
- // return this.#set('@media (any-hover: none)', value);
173
- // }
174
-
175
- // somePointerIsFine<TAddedValue>(
176
- // value: TAddedValue
177
- // ): StylexValueBuilder<TValue | TAddedValue> {
178
- // return this.#set('@media (any-pointer: fine)', value);
179
- // }
180
-
181
- // somePointerIsCoarse<TAddedValue>(
182
- // value: TAddedValue
183
- // ): StylexValueBuilder<TValue | TAddedValue> {
184
- // return this.#set('@media (any-pointer: coarse)', value);
185
- // }
186
-
187
- // primaryPointerIsFine<TAddedValue>(
188
- // value: TAddedValue
189
- // ): StylexValueBuilder<TValue | TAddedValue> {
190
- // return this.#set('@media (pointer: fine)', value);
191
- // }
192
-
193
- // primaryPointerIsCoarse<TAddedValue>(
194
- // value: TAddedValue
195
- // ): StylexValueBuilder<TValue | TAddedValue> {
196
- // return this.#set('@media (pointer: coarse)', value);
197
- // }
198
-
199
- // lightMode<TAddedValue>(
200
- // value: TAddedValue
201
- // ): StylexValueBuilder<TValue | TAddedValue> {
202
- // return this.#set('@media (prefers-color-scheme: light)', value);
203
- // }
204
-
205
- // darkMode<TAddedValue>(
206
- // value: TAddedValue
207
- // ): StylexValueBuilder<TValue | TAddedValue> {
208
- // return this.#set('@media (prefers-color-scheme: dark)', value);
209
- // }
210
-
211
- // userPrefersMoreContrast<TAddedValue>(
212
- // value: TAddedValue
213
- // ): StylexValueBuilder<TValue | TAddedValue> {
214
- // return this.#set('@media (prefers-contrast: more)', value);
215
- // }
216
-
217
- // userPrefersLessContrast<TAddedValue>(
218
- // value: TAddedValue
219
- // ): StylexValueBuilder<TValue | TAddedValue> {
220
- // return this.#set('@media (prefers-contrast: less)', value);
221
- // }
222
-
223
- // userPrefersReducedMotion<TAddedValue>(
224
- // value: TAddedValue
225
- // ): StylexValueBuilder<TValue | TAddedValue> {
226
- // return this.#set('@media (prefers-reduced-motion)', value);
227
- // }
228
-
229
- // noScript<TAddedValue>(
230
- // value: TAddedValue
231
- // ): StylexValueBuilder<TValue | TAddedValue> {
232
- // return this.#set('@media (scripting: none)', value);
233
- // }
234
-
235
- // Choosing a catch-all for now for familiarity
236
- matchMedia(query, value) {
237
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@media ${query}`, value);
238
- }
239
- supports(selector, value) {
240
- const toSelector = _ref5 => {
241
- let [k, v] = _ref5;
242
- return `(${(0, _dashify.default)(k)}: ${String(v)})`;
243
- };
244
- const query = Object.entries(selector).map(toSelector).join(' and ');
245
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@supports ${query}`, value);
246
- }
247
- supportsNot(selector, value) {
248
- const toSelector = _ref6 => {
249
- let [k, v] = _ref6;
250
- return `(not (${(0, _dashify.default)(k)}: ${String(v)}))`;
251
- };
252
- const query = Object.entries(selector).map(toSelector).join(' and ');
253
- return _classPrivateMethodGet(this, _set, _set2).call(this, `@supports ${query}`, value);
254
- }
255
-
256
- // Pseudo Classes
257
-
258
- hover(value) {
259
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':hover', value);
260
- }
261
- focus(value) {
262
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':focus', value);
263
- }
264
- focusVisible(value) {
265
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':focus-visible', value);
266
- }
267
- focusWithin(value) {
268
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':focus-within', value);
269
- }
270
- active(value) {
271
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':active', value);
272
- }
273
- anyLink(value) {
274
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':any-link', value);
275
- }
276
- autofill(value) {
277
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':autofill', value);
278
- }
279
- checked(value) {
280
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':checked', value);
281
- }
282
- defaultSelection(value) {
283
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':default', value);
284
- }
285
- disabled(value) {
286
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':disabled', value);
287
- }
288
- empty(value) {
289
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':empty', value);
290
- }
291
- enabled(value) {
292
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':enabled', value);
293
- }
294
- fullscreen(value) {
295
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':fullscreen', value);
296
- }
297
- indeterminate(value) {
298
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':indeterminate', value);
299
- }
300
- invalid(value) {
301
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':invalid', value);
302
- }
303
- lang(value) {
304
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':lang', value);
305
- }
306
- dirRTLUNSFAE(value) {
307
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':dir(rtl)', value);
308
- }
309
- link(value) {
310
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':link', value);
311
- }
312
- optional(value) {
313
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':optional', value);
314
- }
315
- pictureInPicture(value) {
316
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':picture-in-picture', value);
317
- }
318
- placeholderShown(value) {
319
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':placeholder-shown', value);
320
- }
321
- paused(value) {
322
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':paused', value);
323
- }
324
- playing(value) {
325
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':playing', value);
326
- }
327
- readOnly(value) {
328
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':read-only', value);
329
- }
330
- readWrite(value) {
331
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':read-write', value);
332
- }
333
- required(value) {
334
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':required', value);
335
- }
336
- target(value) {
337
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':target', value);
338
- }
339
- valid(value) {
340
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':valid', value);
341
- }
342
- visited(value) {
343
- return _classPrivateMethodGet(this, _set, _set2).call(this, ':visited', value);
344
- }
345
- get not() {
346
- return {
347
- hover: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:hover)', value),
348
- focus: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:focus)', value),
349
- focusVisible: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:focus-visible)', value),
350
- focusWithin: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:focus-within)', value),
351
- active: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:active)', value),
352
- anyLink: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:any-link)', value),
353
- autofill: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:autofill)', value),
354
- checked: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:checked)', value),
355
- defaultSelection: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:default)', value),
356
- disabled: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:disabled)', value),
357
- empty: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:empty)', value),
358
- enabled: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:enabled)', value),
359
- fullscreen: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:fullscreen)', value),
360
- indeterminate: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:indeterminate)', value),
361
- invalid: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:invalid)', value),
362
- lang: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:lang)', value),
363
- dirRTLUNSFAE: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:dir-rtlunsfae)', value),
364
- link: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:link)', value),
365
- optional: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:optional)', value),
366
- pictureInPicture: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:picture-in-picture)', value),
367
- placeholderShown: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:placeholder-shown)', value),
368
- paused: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:paused)', value),
369
- playing: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:playing)', value),
370
- readOnly: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:read-only)', value),
371
- readWrite: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:read-write)', value),
372
- required: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:required)', value),
373
- target: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:target)', value),
374
- valid: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:valid)', value),
375
- visited: value => _classPrivateMethodGet(this, _set, _set2).call(this, ':not(:visited)', value)
376
- };
377
- }
378
- pseudoUNSAFE(selector, value) {
379
- return _classPrivateMethodGet(this, _set, _set2).call(this, `:${selector}`, value);
380
- }
381
- // These can be used to write arbitrary CSS selectors
382
- // Which is UNSAFE!
383
- _isUNSAFE(selector, value) {
384
- return _classPrivateMethodGet(this, _set, _set2).call(this, `:is(${selector})`, value);
385
- }
386
- _notUNSAFE(selector, value) {
387
- return _classPrivateMethodGet(this, _set, _set2).call(this, `:not(${selector})`, value);
388
- }
389
- }
390
- exports.StylexValueBuilder = StylexValueBuilder;
391
- function _set2(key, value) {
392
- this[key] = value;
393
- return this;
394
- }
395
- function stylexDefaultValue(value) {
396
- return new StylexValueBuilder(value);
397
- }