@hanzogui/react-native-web-internals 3.0.6 → 4.4.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 (205) hide show
  1. package/dist/cjs/StyleSheet/__tests__/compiler-createReactDOMStyle-test.cjs +62 -37
  2. package/dist/cjs/StyleSheet/__tests__/compiler-test.cjs +129 -117
  3. package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.cjs +69 -30
  4. package/dist/cjs/StyleSheet/__tests__/index-test.cjs +127 -95
  5. package/dist/cjs/StyleSheet/__tests__/preprocess-test.cjs +26 -13
  6. package/dist/cjs/StyleSheet/__tests__/validate-test.cjs +30 -15
  7. package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.cjs +141 -68
  8. package/dist/cjs/StyleSheet/compiler/hash.cjs +12 -10
  9. package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +18 -14
  10. package/dist/cjs/StyleSheet/compiler/index.cjs +234 -173
  11. package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +27 -18
  12. package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.cjs +30 -23
  13. package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +36 -32
  14. package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +30 -15
  15. package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.cjs +62 -37
  16. package/dist/cjs/StyleSheet/dom/index.cjs +56 -34
  17. package/dist/cjs/StyleSheet/index.cjs +25 -18
  18. package/dist/cjs/StyleSheet/preprocess.cjs +94 -81
  19. package/dist/cjs/StyleSheet/validate.cjs +67 -44
  20. package/dist/cjs/TextAncestorContext.cjs +13 -11
  21. package/dist/cjs/colorProps.cjs +22 -20
  22. package/dist/cjs/index.cjs +47 -45
  23. package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.cjs +19 -12
  24. package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.cjs +17 -11
  25. package/dist/cjs/modules/AccessibilityUtil/index.cjs +15 -13
  26. package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +12 -10
  27. package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +45 -38
  28. package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +34 -30
  29. package/dist/cjs/modules/AssetRegistry/index.cjs +12 -10
  30. package/dist/cjs/modules/ImageLoader/index.cjs +117 -71
  31. package/dist/cjs/modules/InteractionManager.cjs +155 -99
  32. package/dist/cjs/modules/Platform/__tests__/index-test.cjs +21 -13
  33. package/dist/cjs/modules/Platform/index.cjs +12 -10
  34. package/dist/cjs/modules/TextInputState/index.cjs +28 -13
  35. package/dist/cjs/modules/UIManager/__tests__/index-test.cjs +77 -56
  36. package/dist/cjs/modules/UIManager/index.cjs +47 -42
  37. package/dist/cjs/modules/canUseDOM.cjs +13 -11
  38. package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +75 -54
  39. package/dist/cjs/modules/createDOMProps/index.cjs +353 -145
  40. package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +238 -160
  41. package/dist/cjs/modules/createEventHandle/index.cjs +46 -25
  42. package/dist/cjs/modules/dismissKeyboard/index.cjs +12 -10
  43. package/dist/cjs/modules/forwardedProps/index.cjs +137 -135
  44. package/dist/cjs/modules/getBoundingClientRect/index.cjs +18 -11
  45. package/dist/cjs/modules/invariant.cjs +21 -15
  46. package/dist/cjs/modules/isSelectionValid/index.cjs +18 -17
  47. package/dist/cjs/modules/isWebColor/index.cjs +12 -10
  48. package/dist/cjs/modules/mergeRefs/__tests__/index-test.cjs +21 -15
  49. package/dist/cjs/modules/mergeRefs/index.cjs +24 -21
  50. package/dist/cjs/modules/modality/__tests__/index-test.cjs +44 -17
  51. package/dist/cjs/modules/modality/index.cjs +148 -71
  52. package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.cjs +18 -10
  53. package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +26 -20
  54. package/dist/cjs/modules/normalizeColor/index.cjs +22 -17
  55. package/dist/cjs/modules/pick/index.cjs +19 -11
  56. package/dist/cjs/modules/processColor/__tests__/index-test.cjs +43 -24
  57. package/dist/cjs/modules/processColor/index.cjs +32 -24
  58. package/dist/cjs/modules/requestIdleCallback/index.cjs +28 -26
  59. package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.cjs +38 -18
  60. package/dist/cjs/modules/setValueForStyles/index.cjs +25 -14
  61. package/dist/cjs/modules/unitlessNumbers/index.cjs +68 -64
  62. package/dist/cjs/modules/useElementLayout/index.cjs +25 -20
  63. package/dist/cjs/modules/useEvent/__tests__/index-test.cjs +255 -173
  64. package/dist/cjs/modules/useEvent/index.cjs +40 -28
  65. package/dist/cjs/modules/useHover/__tests__/index-test.cjs +233 -124
  66. package/dist/cjs/modules/useHover/index.cjs +105 -62
  67. package/dist/cjs/modules/useLayoutEffect/index.cjs +26 -24
  68. package/dist/cjs/modules/useLocale/index.cjs +33 -30
  69. package/dist/cjs/modules/useLocale/isLocaleRTL.cjs +63 -58
  70. package/dist/cjs/modules/useMergeRefs/__tests__/index-test.cjs +54 -31
  71. package/dist/cjs/modules/useMergeRefs/index.cjs +26 -24
  72. package/dist/cjs/modules/usePlatformMethods/index.cjs +21 -14
  73. package/dist/cjs/modules/useStable/__tests__/index-test.cjs +60 -30
  74. package/dist/cjs/modules/useStable/index.cjs +29 -24
  75. package/dist/cjs/styleTypes.cjs +7 -5
  76. package/dist/cjs/types.cjs +7 -5
  77. package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs +53 -30
  78. package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs.map +1 -1
  79. package/dist/esm/StyleSheet/__tests__/compiler-test.mjs +129 -117
  80. package/dist/esm/StyleSheet/__tests__/compiler-test.mjs.map +1 -1
  81. package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs +60 -23
  82. package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs.map +1 -1
  83. package/dist/esm/StyleSheet/__tests__/index-test.mjs +118 -88
  84. package/dist/esm/StyleSheet/__tests__/index-test.mjs.map +1 -1
  85. package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs +26 -13
  86. package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs.map +1 -1
  87. package/dist/esm/StyleSheet/__tests__/validate-test.mjs +30 -15
  88. package/dist/esm/StyleSheet/__tests__/validate-test.mjs.map +1 -1
  89. package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs +127 -56
  90. package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs.map +1 -1
  91. package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs +6 -4
  92. package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs.map +1 -1
  93. package/dist/esm/StyleSheet/compiler/index.mjs +218 -159
  94. package/dist/esm/StyleSheet/compiler/index.mjs.map +1 -1
  95. package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +13 -6
  96. package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -1
  97. package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs +16 -11
  98. package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs.map +1 -1
  99. package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs +22 -20
  100. package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs.map +1 -1
  101. package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs +18 -5
  102. package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs.map +1 -1
  103. package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs +50 -27
  104. package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs.map +1 -1
  105. package/dist/esm/StyleSheet/dom/index.mjs +41 -21
  106. package/dist/esm/StyleSheet/dom/index.mjs.map +1 -1
  107. package/dist/esm/StyleSheet/index.mjs +13 -8
  108. package/dist/esm/StyleSheet/index.mjs.map +1 -1
  109. package/dist/esm/StyleSheet/preprocess.mjs +80 -69
  110. package/dist/esm/StyleSheet/preprocess.mjs.map +1 -1
  111. package/dist/esm/StyleSheet/validate.mjs +55 -34
  112. package/dist/esm/StyleSheet/validate.mjs.map +1 -1
  113. package/dist/esm/TextAncestorContext.mjs +1 -1
  114. package/dist/esm/TextAncestorContext.mjs.map +1 -1
  115. package/dist/esm/colorProps.mjs +10 -10
  116. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs +10 -5
  117. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs.map +1 -1
  118. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs +8 -4
  119. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs.map +1 -1
  120. package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs +33 -28
  121. package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs.map +1 -1
  122. package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs +22 -20
  123. package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs.map +1 -1
  124. package/dist/esm/modules/ImageLoader/index.mjs +105 -61
  125. package/dist/esm/modules/ImageLoader/index.mjs.map +1 -1
  126. package/dist/esm/modules/InteractionManager.mjs +141 -87
  127. package/dist/esm/modules/InteractionManager.mjs.map +1 -1
  128. package/dist/esm/modules/Platform/__tests__/index-test.mjs +12 -6
  129. package/dist/esm/modules/Platform/__tests__/index-test.mjs.map +1 -1
  130. package/dist/esm/modules/TextInputState/index.mjs +16 -3
  131. package/dist/esm/modules/TextInputState/index.mjs.map +1 -1
  132. package/dist/esm/modules/UIManager/__tests__/index-test.mjs +68 -49
  133. package/dist/esm/modules/UIManager/__tests__/index-test.mjs.map +1 -1
  134. package/dist/esm/modules/UIManager/index.mjs +35 -32
  135. package/dist/esm/modules/UIManager/index.mjs.map +1 -1
  136. package/dist/esm/modules/canUseDOM.mjs +1 -1
  137. package/dist/esm/modules/canUseDOM.mjs.map +1 -1
  138. package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs +66 -47
  139. package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs.map +1 -1
  140. package/dist/esm/modules/createDOMProps/index.mjs +339 -133
  141. package/dist/esm/modules/createDOMProps/index.mjs.map +1 -1
  142. package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs +222 -146
  143. package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs.map +1 -1
  144. package/dist/esm/modules/createEventHandle/index.mjs +34 -15
  145. package/dist/esm/modules/createEventHandle/index.mjs.map +1 -1
  146. package/dist/esm/modules/forwardedProps/index.mjs +125 -125
  147. package/dist/esm/modules/forwardedProps/index.mjs.map +1 -1
  148. package/dist/esm/modules/getBoundingClientRect/index.mjs +6 -1
  149. package/dist/esm/modules/getBoundingClientRect/index.mjs.map +1 -1
  150. package/dist/esm/modules/invariant.mjs +9 -5
  151. package/dist/esm/modules/invariant.mjs.map +1 -1
  152. package/dist/esm/modules/isSelectionValid/index.mjs +6 -7
  153. package/dist/esm/modules/isSelectionValid/index.mjs.map +1 -1
  154. package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs +8 -4
  155. package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs.map +1 -1
  156. package/dist/esm/modules/mergeRefs/index.mjs +12 -11
  157. package/dist/esm/modules/mergeRefs/index.mjs.map +1 -1
  158. package/dist/esm/modules/modality/__tests__/index-test.mjs +42 -15
  159. package/dist/esm/modules/modality/__tests__/index-test.mjs.map +1 -1
  160. package/dist/esm/modules/modality/index.mjs +134 -59
  161. package/dist/esm/modules/modality/index.mjs.map +1 -1
  162. package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs +9 -3
  163. package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs.map +1 -1
  164. package/dist/esm/modules/multiplyStyleLengthValue/index.mjs +14 -10
  165. package/dist/esm/modules/multiplyStyleLengthValue/index.mjs.map +1 -1
  166. package/dist/esm/modules/normalizeColor/index.mjs +8 -5
  167. package/dist/esm/modules/normalizeColor/index.mjs.map +1 -1
  168. package/dist/esm/modules/pick/index.mjs +7 -1
  169. package/dist/esm/modules/pick/index.mjs.map +1 -1
  170. package/dist/esm/modules/processColor/__tests__/index-test.mjs +34 -17
  171. package/dist/esm/modules/processColor/__tests__/index-test.mjs.map +1 -1
  172. package/dist/esm/modules/processColor/index.mjs +8 -2
  173. package/dist/esm/modules/processColor/index.mjs.map +1 -1
  174. package/dist/esm/modules/requestIdleCallback/index.mjs +16 -16
  175. package/dist/esm/modules/requestIdleCallback/index.mjs.map +1 -1
  176. package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs +24 -6
  177. package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs.map +1 -1
  178. package/dist/esm/modules/setValueForStyles/index.mjs +13 -4
  179. package/dist/esm/modules/setValueForStyles/index.mjs.map +1 -1
  180. package/dist/esm/modules/unitlessNumbers/index.mjs +56 -54
  181. package/dist/esm/modules/unitlessNumbers/index.mjs.map +1 -1
  182. package/dist/esm/modules/useElementLayout/index.mjs +11 -8
  183. package/dist/esm/modules/useElementLayout/index.mjs.map +1 -1
  184. package/dist/esm/modules/useEvent/__tests__/index-test.mjs +240 -160
  185. package/dist/esm/modules/useEvent/__tests__/index-test.mjs.map +1 -1
  186. package/dist/esm/modules/useEvent/index.mjs +25 -15
  187. package/dist/esm/modules/useEvent/index.mjs.map +1 -1
  188. package/dist/esm/modules/useHover/__tests__/index-test.mjs +217 -110
  189. package/dist/esm/modules/useHover/__tests__/index-test.mjs.map +1 -1
  190. package/dist/esm/modules/useHover/index.mjs +90 -49
  191. package/dist/esm/modules/useHover/index.mjs.map +1 -1
  192. package/dist/esm/modules/useLocale/index.mjs +6 -5
  193. package/dist/esm/modules/useLocale/index.mjs.map +1 -1
  194. package/dist/esm/modules/useLocale/isLocaleRTL.mjs +51 -48
  195. package/dist/esm/modules/useLocale/isLocaleRTL.mjs.map +1 -1
  196. package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs +40 -19
  197. package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs.map +1 -1
  198. package/dist/esm/modules/usePlatformMethods/index.mjs +7 -2
  199. package/dist/esm/modules/usePlatformMethods/index.mjs.map +1 -1
  200. package/dist/esm/modules/useStable/__tests__/index-test.mjs +47 -19
  201. package/dist/esm/modules/useStable/__tests__/index-test.mjs.map +1 -1
  202. package/dist/esm/modules/useStable/index.mjs +5 -2
  203. package/dist/esm/modules/useStable/index.mjs.map +1 -1
  204. package/package.json +8 -8
  205. package/src/StyleSheet/compiler/normalizeColor.tsx +1 -1
@@ -2,13 +2,15 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
12
14
  return to;
13
15
  };
14
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
@@ -18,51 +20,77 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
18
20
  // "default" to the CommonJS "module.exports" for node compatibility.
19
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
22
  value: mod,
21
- enumerable: !0
23
+ enumerable: true
22
24
  }) : target, mod));
23
25
  var import_createOrderedCSSStyleSheet = __toESM(require("../dom/createOrderedCSSStyleSheet.cjs"), 1);
24
26
  const insertStyleElement = () => {
25
- const element = document.createElement("style"),
26
- head = document.head;
27
- return head.insertBefore(element, head.firstChild), element;
28
- },
29
- removeStyleElement = element => {
30
- document.head.removeChild(element);
31
- };
27
+ const element = document.createElement("style");
28
+ const head = document.head;
29
+ head.insertBefore(element, head.firstChild);
30
+ return element;
31
+ };
32
+ const removeStyleElement = element => {
33
+ document.head.removeChild(element);
34
+ };
32
35
  describe("createOrderedCSSStyleSheet", () => {
33
36
  describe("#insert", () => {
34
37
  test("insertion order for same group", () => {
35
38
  const sheet = (0, import_createOrderedCSSStyleSheet.default)();
36
- expect(sheet.getTextContent()).toMatchInlineSnapshot('""'), sheet.insert(".a {}", 0), expect(sheet.getTextContent()).toMatchInlineSnapshot(`
39
+ expect(sheet.getTextContent()).toMatchInlineSnapshot('""');
40
+ sheet.insert(".a {}", 0);
41
+ expect(sheet.getTextContent()).toMatchInlineSnapshot(`
37
42
  "[stylesheet-group=\\"0\\"]{}
38
43
  .a {}"
39
- `), sheet.insert(".b {}", 0), expect(sheet.getTextContent()).toMatchInlineSnapshot(`
44
+ `);
45
+ sheet.insert(".b {}", 0);
46
+ expect(sheet.getTextContent()).toMatchInlineSnapshot(`
40
47
  "[stylesheet-group=\\"0\\"]{}
41
48
  .a {}
42
49
  .b {}"
43
- `), sheet.insert(".c {}", 0), expect(sheet.getTextContent()).toMatchInlineSnapshot(`
50
+ `);
51
+ sheet.insert(".c {}", 0);
52
+ expect(sheet.getTextContent()).toMatchInlineSnapshot(`
44
53
  "[stylesheet-group=\\"0\\"]{}
45
54
  .a {}
46
55
  .b {}
47
56
  .c {}"
48
57
  `);
49
- }), test("deduplication for same group", () => {
58
+ });
59
+ test("deduplication for same group", () => {
50
60
  const sheet = (0, import_createOrderedCSSStyleSheet.default)();
51
- sheet.insert(".a {}", 0), sheet.insert(".a {}", 0), sheet.insert(".a {}", 0), expect(sheet.getTextContent()).toMatchInlineSnapshot(`
61
+ sheet.insert(".a {}", 0);
62
+ sheet.insert(".a {}", 0);
63
+ sheet.insert(".a {}", 0);
64
+ expect(sheet.getTextContent()).toMatchInlineSnapshot(`
52
65
  "[stylesheet-group=\\"0\\"]{}
53
66
  .a {}"
54
67
  `);
55
- }), test("order for same group", () => {
68
+ });
69
+ test("order for same group", () => {
56
70
  const sheet = (0, import_createOrderedCSSStyleSheet.default)();
57
- sheet.insert(".c {}", 0), sheet.insert(".b {}", 0), sheet.insert(".a {}", 0), expect(sheet.getTextContent()).toMatchInlineSnapshot(`
71
+ sheet.insert(".c {}", 0);
72
+ sheet.insert(".b {}", 0);
73
+ sheet.insert(".a {}", 0);
74
+ expect(sheet.getTextContent()).toMatchInlineSnapshot(`
58
75
  "[stylesheet-group=\\"0\\"]{}
59
76
  .a {}
60
77
  .b {}
61
78
  .c {}"
62
79
  `);
63
- }), test("insertion order for different groups", () => {
80
+ });
81
+ test("insertion order for different groups", () => {
64
82
  const sheet = (0, import_createOrderedCSSStyleSheet.default)();
65
- sheet.insert(".nine-1 {}", 9.9), sheet.insert(".nine-2 {}", 9.9), sheet.insert(".three {}", 3), sheet.insert(".one {}", 1), sheet.insert(".two {}", 2.2), sheet.insert(".four-1 {}", 4), sheet.insert(".four-2 {}", 4), sheet.insert(".twenty {}", 20), sheet.insert(".ten {}", 10), sheet.insert(".twenty-point2 {}", 20.2), expect(sheet.getTextContent()).toMatchInlineSnapshot(`
83
+ sheet.insert(".nine-1 {}", 9.9);
84
+ sheet.insert(".nine-2 {}", 9.9);
85
+ sheet.insert(".three {}", 3);
86
+ sheet.insert(".one {}", 1);
87
+ sheet.insert(".two {}", 2.2);
88
+ sheet.insert(".four-1 {}", 4);
89
+ sheet.insert(".four-2 {}", 4);
90
+ sheet.insert(".twenty {}", 20);
91
+ sheet.insert(".ten {}", 10);
92
+ sheet.insert(".twenty-point2 {}", 20.2);
93
+ expect(sheet.getTextContent()).toMatchInlineSnapshot(`
66
94
  "[stylesheet-group=\\"1\\"]{}
67
95
  .one {}
68
96
  [stylesheet-group=\\"2.2\\"]{}
@@ -83,13 +111,21 @@ describe("createOrderedCSSStyleSheet", () => {
83
111
  .twenty-point2 {}"
84
112
  `);
85
113
  });
86
- }), describe("client-side hydration", () => {
114
+ });
115
+ describe("client-side hydration", () => {
87
116
  let element;
88
117
  beforeEach(() => {
89
- element != null && removeStyleElement(element), element = insertStyleElement();
90
- }), test("from SSR CSS", () => {
118
+ if (element != null) {
119
+ removeStyleElement(element);
120
+ }
121
+ element = insertStyleElement();
122
+ });
123
+ test("from SSR CSS", () => {
91
124
  const serverSheet = (0, import_createOrderedCSSStyleSheet.default)();
92
- serverSheet.insert(".one { width: 10px; }", 1), serverSheet.insert(".two-1 { height: 20px; }", 2), serverSheet.insert(".two-2 { color: red; }", 2), serverSheet.insert("@keyframes anim { 0% { opacity: 1; } }", 2);
125
+ serverSheet.insert(".one { width: 10px; }", 1);
126
+ serverSheet.insert(".two-1 { height: 20px; }", 2);
127
+ serverSheet.insert(".two-2 { color: red; }", 2);
128
+ serverSheet.insert("@keyframes anim { 0% { opacity: 1; } }", 2);
93
129
  const textContent = serverSheet.getTextContent();
94
130
  element.appendChild(document.createTextNode(textContent));
95
131
  const clientSheet = (0, import_createOrderedCSSStyleSheet.default)(element.sheet);
@@ -103,13 +139,16 @@ describe("createOrderedCSSStyleSheet", () => {
103
139
  0% {opacity: 1;}
104
140
  }"
105
141
  `);
106
- }), test("works when the group marker is in single quotes", () => {
142
+ });
143
+ test("works when the group marker is in single quotes", () => {
107
144
  const serverSheet = (0, import_createOrderedCSSStyleSheet.default)();
108
- serverSheet.insert(".a { color: red }", 0), serverSheet.insert(".b { color: red }", 1);
145
+ serverSheet.insert(".a { color: red }", 0);
146
+ serverSheet.insert(".b { color: red }", 1);
109
147
  const textContent = serverSheet.getTextContent().replace(/"/g, "'");
110
148
  element.appendChild(document.createTextNode(textContent));
111
149
  const clientSheet = (0, import_createOrderedCSSStyleSheet.default)(element.sheet);
112
- clientSheet.insert(".c { color: red }", 0), expect(clientSheet.getTextContent()).toMatchInlineSnapshot(`
150
+ clientSheet.insert(".c { color: red }", 0);
151
+ expect(clientSheet.getTextContent()).toMatchInlineSnapshot(`
113
152
  "[stylesheet-group='0'] {}
114
153
  .a {color: red;}
115
154
  .c { color: red }
@@ -2,13 +2,15 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __copyProps = (to, from, except, desc) => {
8
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
9
- get: () => from[key],
10
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
11
- });
8
+ if (from && typeof from === "object" || typeof from === "function") {
9
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
10
+ get: () => from[key],
11
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
12
+ });
13
+ }
12
14
  return to;
13
15
  };
14
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
@@ -18,7 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
18
20
  // "default" to the CommonJS "module.exports" for node compatibility.
19
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
22
  value: mod,
21
- enumerable: !0
23
+ enumerable: true
22
24
  }) : target, mod));
23
25
  var import__ = __toESM(require("../index.cjs"), 1);
24
26
  describe("StyleSheet", () => {
@@ -39,7 +41,8 @@ describe("StyleSheet", () => {
39
41
  .r-top-ipm5af{top:0px;}",
40
42
  }
41
43
  `);
42
- }), test("absoluteFill", () => {
44
+ });
45
+ test("absoluteFill", () => {
43
46
  expect(import__.default.absoluteFill).toMatchInlineSnapshot(`
44
47
  {
45
48
  "bottom": 0,
@@ -49,7 +52,8 @@ describe("StyleSheet", () => {
49
52
  "top": 0,
50
53
  }
51
54
  `);
52
- }), test("absoluteFillObject", () => {
55
+ });
56
+ test("absoluteFillObject", () => {
53
57
  expect(import__.default.absoluteFillObject).toMatchInlineSnapshot(`
54
58
  {
55
59
  "bottom": 0,
@@ -59,9 +63,13 @@ describe("StyleSheet", () => {
59
63
  "top": 0,
60
64
  }
61
65
  `);
62
- }), test("compose", () => {
63
- expect(import__.default.compose(1, 2)).toEqual([1, 2]), expect(import__.default.compose(1, null)).toBe(1), expect(import__.default.compose(null, 2)).toBe(2);
64
- }), describe("create", () => {
66
+ });
67
+ test("compose", () => {
68
+ expect(import__.default.compose(1, 2)).toEqual([1, 2]);
69
+ expect(import__.default.compose(1, null)).toBe(1);
70
+ expect(import__.default.compose(null, 2)).toBe(2);
71
+ });
72
+ describe("create", () => {
65
73
  test("returns original style objects", () => {
66
74
  const style = import__.default.create({
67
75
  root: {
@@ -73,7 +81,8 @@ describe("StyleSheet", () => {
73
81
  "position": "absolute",
74
82
  }
75
83
  `);
76
- }), test("e2e resolves to classname", () => {
84
+ });
85
+ test("e2e resolves to classname", () => {
77
86
  const style = import__.default.create({
78
87
  root: {
79
88
  position: "absolute"
@@ -85,7 +94,8 @@ describe("StyleSheet", () => {
85
94
  null,
86
95
  ]
87
96
  `);
88
- }), test("e2e flattens shadow style properties", () => {
97
+ });
98
+ test("e2e flattens shadow style properties", () => {
89
99
  const style = import__.default.create({
90
100
  root: {
91
101
  shadowColor: "rgba(50,60,70,0.5)",
@@ -110,7 +120,8 @@ describe("StyleSheet", () => {
110
120
  ]
111
121
  `);
112
122
  });
113
- }), describe("flatten", () => {
123
+ });
124
+ describe("flatten", () => {
114
125
  test("should merge style objects", () => {
115
126
  const style = import__.default.flatten([{
116
127
  opacity: 1
@@ -123,7 +134,8 @@ describe("StyleSheet", () => {
123
134
  "order": 2,
124
135
  }
125
136
  `);
126
- }), test("should override style properties", () => {
137
+ });
138
+ test("should override style properties", () => {
127
139
  const style = import__.default.flatten([{
128
140
  backgroundColor: "#000",
129
141
  order: 1
@@ -137,7 +149,8 @@ describe("StyleSheet", () => {
137
149
  "order": null,
138
150
  }
139
151
  `);
140
- }), test("should overwrite properties with `undefined`", () => {
152
+ });
153
+ test("should overwrite properties with `undefined`", () => {
141
154
  const style = import__.default.flatten([{
142
155
  backgroundColor: "#000"
143
156
  }, {
@@ -148,9 +161,11 @@ describe("StyleSheet", () => {
148
161
  "backgroundColor": undefined,
149
162
  }
150
163
  `);
151
- }), test("should not fail on falsy values", () => {
152
- expect(() => import__.default.flatten([null, !1, void 0])).not.toThrow();
153
- }), test("should recursively flatten arrays", () => {
164
+ });
165
+ test("should not fail on falsy values", () => {
166
+ expect(() => import__.default.flatten([null, false, void 0])).not.toThrow();
167
+ });
168
+ test("should recursively flatten arrays", () => {
154
169
  const style = import__.default.flatten([null, [], [{
155
170
  order: 2
156
171
  }, {
@@ -165,29 +180,34 @@ describe("StyleSheet", () => {
165
180
  }
166
181
  `);
167
182
  });
168
- }), test("hairlineWidth", () => {
169
- expect(Number.isInteger(import__.default.hairlineWidth) === !0).toBeTruthy();
170
- }), describe("resolve", () => {
183
+ });
184
+ test("hairlineWidth", () => {
185
+ expect(Number.isInteger(import__.default.hairlineWidth) === true).toBeTruthy();
186
+ });
187
+ describe("resolve", () => {
171
188
  test("empty", () => {
172
189
  expect((0, import__.default)()).toMatchInlineSnapshot(`
173
190
  [
174
191
  "",
175
192
  null,
176
193
  ]
177
- `), expect((0, import__.default)({})).toMatchInlineSnapshot(`
194
+ `);
195
+ expect((0, import__.default)({})).toMatchInlineSnapshot(`
178
196
  [
179
197
  "",
180
198
  null,
181
199
  ]
182
- `), expect((0, import__.default)([])).toMatchInlineSnapshot(`
200
+ `);
201
+ expect((0, import__.default)([])).toMatchInlineSnapshot(`
183
202
  [
184
203
  "",
185
204
  null,
186
205
  ]
187
206
  `);
188
- }), test("transforms compiled object to className", () => {
207
+ });
208
+ test("transforms compiled object to className", () => {
189
209
  expect((0, import__.default)([{
190
- $$css: !0,
210
+ $$css: true,
191
211
  position: "position-absolute",
192
212
  opacity: "opacity-05",
193
213
  width: "width-200"
@@ -197,19 +217,20 @@ describe("StyleSheet", () => {
197
217
  null,
198
218
  ]
199
219
  `);
200
- }), test("transforms array of compiled objects to className", () => {
220
+ });
221
+ test("transforms array of compiled objects to className", () => {
201
222
  expect((0, import__.default)([{
202
- $$css: !0,
223
+ $$css: true,
203
224
  borderWidth: "borderWidth-0",
204
225
  borderColor: "borderColor-red",
205
226
  display: "display-flex",
206
227
  width: "width-100"
207
228
  }, {
208
- $$css: !0,
229
+ $$css: true,
209
230
  position: "position-absolute",
210
231
  opacity: "opacity-05"
211
232
  }, [{
212
- $$css: !0,
233
+ $$css: true,
213
234
  width: "width-200"
214
235
  }]])).toMatchInlineSnapshot(`
215
236
  [
@@ -217,37 +238,41 @@ describe("StyleSheet", () => {
217
238
  null,
218
239
  ]
219
240
  `);
220
- }), test("dedupes class names and inline styles", () => {
241
+ });
242
+ test("dedupes class names and inline styles", () => {
221
243
  const styleACompiled = {
222
- $$css: !0,
223
- backgroundColor: "backgroundColor-red",
224
- display: "display-block"
225
- },
226
- styleBCompiled = {
227
- $$css: !0,
228
- backgroundColor: "backgroundColor-green",
229
- color: "color-green"
230
- },
231
- styleBInline = {
232
- backgroundColor: "rgba(0,0,255,1.00)",
233
- color: null
234
- },
235
- [className1, inlineStyle1] = (0, import__.default)([styleACompiled, styleBCompiled, styleBInline]);
236
- expect(className1).toBe("display-block"), expect(inlineStyle1).toEqual({
244
+ $$css: true,
245
+ backgroundColor: "backgroundColor-red",
246
+ display: "display-block"
247
+ };
248
+ const styleBCompiled = {
249
+ $$css: true,
250
+ backgroundColor: "backgroundColor-green",
251
+ color: "color-green"
252
+ };
253
+ const styleBInline = {
254
+ backgroundColor: "rgba(0,0,255,1.00)",
255
+ color: null
256
+ };
257
+ const [className1, inlineStyle1] = (0, import__.default)([styleACompiled, styleBCompiled, styleBInline]);
258
+ expect(className1).toBe("display-block");
259
+ expect(inlineStyle1).toEqual({
237
260
  backgroundColor: "rgba(0,0,255,1.00)"
238
261
  });
239
262
  const [className2, inlineStyle2] = (0, import__.default)([styleACompiled, styleBInline, styleBCompiled]);
240
- expect(className2).toBe("display-block backgroundColor-green color-green"), expect(inlineStyle2).toEqual(null);
241
- }), test("long form inline style properties take precedence over static shorthand properties", () => {
263
+ expect(className2).toBe("display-block backgroundColor-green color-green");
264
+ expect(inlineStyle2).toEqual(null);
265
+ });
266
+ test("long form inline style properties take precedence over static shorthand properties", () => {
242
267
  const styles1 = import__.default.create({
243
- test: {
244
- paddingHorizontal: "40px"
245
- }
246
- }),
247
- inlineStyle1 = {
248
- padding: "8px",
268
+ test: {
249
269
  paddingHorizontal: "40px"
250
- };
270
+ }
271
+ });
272
+ const inlineStyle1 = {
273
+ padding: "8px",
274
+ paddingHorizontal: "40px"
275
+ };
251
276
  expect((0, import__.default)([styles1.test, inlineStyle1])).toMatchInlineSnapshot(`
252
277
  [
253
278
  "",
@@ -260,14 +285,14 @@ describe("StyleSheet", () => {
260
285
  ]
261
286
  `);
262
287
  const styles2 = import__.default.create({
263
- test: {
264
- marginVertical: "40px"
265
- }
266
- }),
267
- inlineStyle2 = {
268
- margin: "8px",
288
+ test: {
269
289
  marginVertical: "40px"
270
- };
290
+ }
291
+ });
292
+ const inlineStyle2 = {
293
+ margin: "8px",
294
+ marginVertical: "40px"
295
+ };
271
296
  expect((0, import__.default)([styles2.test, inlineStyle2])).toMatchInlineSnapshot(`
272
297
  [
273
298
  "",
@@ -279,33 +304,34 @@ describe("StyleSheet", () => {
279
304
  },
280
305
  ]
281
306
  `);
282
- }), test("polyfills logical styles", () => {
307
+ });
308
+ test("polyfills logical styles", () => {
283
309
  const inlineA = {
284
- start: "12.34%"
285
- },
286
- inlineB = {
287
- textAlign: "start"
288
- },
289
- inlineC = {
290
- marginEnd: 10
291
- },
292
- a = import__.default.create({
293
- x: {
294
- ...inlineA
295
- }
296
- }).x,
297
- b = import__.default.create({
298
- x: {
299
- ...inlineB
300
- }
301
- }).x,
302
- c = import__.default.create({
303
- x: {
304
- ...inlineC
305
- }
306
- }).x,
307
- writingDirection = "rtl",
308
- inlineStyle = [inlineA, inlineB, inlineC];
310
+ start: "12.34%"
311
+ };
312
+ const inlineB = {
313
+ textAlign: "start"
314
+ };
315
+ const inlineC = {
316
+ marginEnd: 10
317
+ };
318
+ const a = import__.default.create({
319
+ x: {
320
+ ...inlineA
321
+ }
322
+ }).x;
323
+ const b = import__.default.create({
324
+ x: {
325
+ ...inlineB
326
+ }
327
+ }).x;
328
+ const c = import__.default.create({
329
+ x: {
330
+ ...inlineC
331
+ }
332
+ }).x;
333
+ const writingDirection = "rtl";
334
+ const inlineStyle = [inlineA, inlineB, inlineC];
309
335
  expect((0, import__.default)(inlineStyle)).toMatchInlineSnapshot(`
310
336
  [
311
337
  "",
@@ -315,7 +341,8 @@ describe("StyleSheet", () => {
315
341
  "textAlign": "left",
316
342
  },
317
343
  ]
318
- `), expect((0, import__.default)(inlineStyle, {
344
+ `);
345
+ expect((0, import__.default)(inlineStyle, {
319
346
  writingDirection
320
347
  })).toMatchInlineSnapshot(`
321
348
  [
@@ -326,7 +353,8 @@ describe("StyleSheet", () => {
326
353
  "textAlign": "right",
327
354
  },
328
355
  ]
329
- `), expect((0, import__.default)([inlineStyle, {
356
+ `);
357
+ expect((0, import__.default)([inlineStyle, {
330
358
  marginLeft: 1,
331
359
  marginEnd: 0,
332
360
  marginStart: 0,
@@ -343,7 +371,8 @@ describe("StyleSheet", () => {
343
371
  "textAlign": "right",
344
372
  },
345
373
  ]
346
- `), expect((0, import__.default)([inlineStyle, {
374
+ `);
375
+ expect((0, import__.default)([inlineStyle, {
347
376
  marginEnd: null,
348
377
  marginLeft: 11
349
378
  }], {
@@ -364,14 +393,16 @@ describe("StyleSheet", () => {
364
393
  "r-left-2s0hu9 r-textAlign-fdjqy7 r-marginRight-zso239",
365
394
  null,
366
395
  ]
367
- `), expect((0, import__.default)(staticStyle, {
396
+ `);
397
+ expect((0, import__.default)(staticStyle, {
368
398
  writingDirection
369
399
  })).toMatchInlineSnapshot(`
370
400
  [
371
401
  "r-right-1bnbe1j r-textAlign-1ff274t r-marginLeft-1n0xq6e",
372
402
  null,
373
403
  ]
374
- `), expect((0, import__.default)([staticStyle, {
404
+ `);
405
+ expect((0, import__.default)([staticStyle, {
375
406
  marginLeft: 1,
376
407
  marginEnd: 0,
377
408
  marginStart: 0,
@@ -386,7 +417,8 @@ describe("StyleSheet", () => {
386
417
  "marginRight": "0px",
387
418
  },
388
419
  ]
389
- `), expect((0, import__.default)([staticStyle, {
420
+ `);
421
+ expect((0, import__.default)([staticStyle, {
390
422
  marginEnd: null,
391
423
  marginLeft: 11
392
424
  }], {
@@ -7,14 +7,16 @@ describe("StyleSheet/preprocess", () => {
7
7
  })).toEqual({
8
8
  boxShadow: "0px 0px 0px rgba(255,0,0,1.00)"
9
9
  });
10
- }), test("shadowColor and shadowOpacity only", () => {
10
+ });
11
+ test("shadowColor and shadowOpacity only", () => {
11
12
  expect((0, import_preprocess.preprocess)({
12
13
  shadowColor: "red",
13
14
  shadowOpacity: 0.5
14
15
  })).toEqual({
15
16
  boxShadow: "0px 0px 0px rgba(255,0,0,0.50)"
16
17
  });
17
- }), test("shadowOffset only", () => {
18
+ });
19
+ test("shadowOffset only", () => {
18
20
  expect((0, import_preprocess.preprocess)({
19
21
  shadowOffset: {
20
22
  width: 1,
@@ -23,13 +25,15 @@ describe("StyleSheet/preprocess", () => {
23
25
  })).toEqual({
24
26
  boxShadow: "1px 2px 0px rgba(0,0,0,1.00)"
25
27
  });
26
- }), test("shadowRadius only", () => {
28
+ });
29
+ test("shadowRadius only", () => {
27
30
  expect((0, import_preprocess.preprocess)({
28
31
  shadowRadius: 5
29
32
  })).toEqual({
30
33
  boxShadow: "0px 0px 5px rgba(0,0,0,1.00)"
31
34
  });
32
- }), test("shadowOffset, shadowRadius, shadowColor", () => {
35
+ });
36
+ test("shadowOffset, shadowRadius, shadowColor", () => {
33
37
  expect((0, import_preprocess.preprocess)({
34
38
  shadowColor: "rgba(50,60,70,0.5)",
35
39
  shadowOffset: {
@@ -42,30 +46,35 @@ describe("StyleSheet/preprocess", () => {
42
46
  boxShadow: "1px 2px 3px rgba(50,60,70,0.25)"
43
47
  });
44
48
  });
45
- }), describe("preprocesses multiple textShadow styles into a single declaration", () => {
49
+ });
50
+ describe("preprocesses multiple textShadow styles into a single declaration", () => {
46
51
  test("textShadowColor only", () => {
47
52
  expect((0, import_preprocess.preprocess)({
48
53
  textShadowColor: "red"
49
54
  })).toEqual({});
50
- }), test("textShadowOffset only", () => {
55
+ });
56
+ test("textShadowOffset only", () => {
51
57
  expect((0, import_preprocess.preprocess)({
52
58
  textShadowOffset: {
53
59
  width: 1,
54
60
  height: 2
55
61
  }
56
62
  })).toEqual({});
57
- }), test("textShadowRadius only", () => {
63
+ });
64
+ test("textShadowRadius only", () => {
58
65
  expect((0, import_preprocess.preprocess)({
59
66
  textShadowRadius: 5
60
67
  })).toEqual({});
61
- }), test("textShadowColor and textShadowOffset only", () => {
68
+ });
69
+ test("textShadowColor and textShadowOffset only", () => {
62
70
  expect((0, import_preprocess.preprocess)({
63
71
  textShadowColor: "red",
64
72
  textShadowOffset: {
65
73
  width: 0,
66
74
  height: 0
67
75
  }
68
- })).toEqual({}), expect((0, import_preprocess.preprocess)({
76
+ })).toEqual({});
77
+ expect((0, import_preprocess.preprocess)({
69
78
  textShadowColor: "red",
70
79
  textShadowOffset: {
71
80
  width: -1,
@@ -73,7 +82,8 @@ describe("StyleSheet/preprocess", () => {
73
82
  }
74
83
  })).toEqual({
75
84
  textShadow: "-1px 0px 0px rgba(255,0,0,1.00)"
76
- }), expect((0, import_preprocess.preprocess)({
85
+ });
86
+ expect((0, import_preprocess.preprocess)({
77
87
  textShadowColor: "red",
78
88
  textShadowOffset: {
79
89
  width: 1,
@@ -82,17 +92,20 @@ describe("StyleSheet/preprocess", () => {
82
92
  })).toEqual({
83
93
  textShadow: "1px 2px 0px rgba(255,0,0,1.00)"
84
94
  });
85
- }), test("textShadowColor and textShadowRadius only", () => {
95
+ });
96
+ test("textShadowColor and textShadowRadius only", () => {
86
97
  expect((0, import_preprocess.preprocess)({
87
98
  textShadowColor: "red",
88
99
  textShadowRadius: 0
89
- })).toEqual({}), expect((0, import_preprocess.preprocess)({
100
+ })).toEqual({});
101
+ expect((0, import_preprocess.preprocess)({
90
102
  textShadowColor: "red",
91
103
  textShadowRadius: 5
92
104
  })).toEqual({
93
105
  textShadow: "0px 0px 5px rgba(255,0,0,1.00)"
94
106
  });
95
- }), test("textShadowColor, textShadowOffset, textShadowRadius", () => {
107
+ });
108
+ test("textShadowColor, textShadowOffset, textShadowRadius", () => {
96
109
  expect((0, import_preprocess.preprocess)({
97
110
  textShadowColor: "rgba(50,60,70,0.50)",
98
111
  textShadowOffset: {