@tamagui/react-native-web-internals 2.7.7 → 3.0.0-beta.637.1

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 (286) hide show
  1. package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.cjs +151 -136
  2. package/dist/cjs/StyleSheet/compiler/hash.cjs +15 -18
  3. package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +21 -24
  4. package/dist/cjs/StyleSheet/compiler/index.cjs +295 -321
  5. package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +20 -23
  6. package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.cjs +32 -35
  7. package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +27 -38
  8. package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +37 -40
  9. package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.cjs +108 -111
  10. package/dist/cjs/StyleSheet/dom/index.cjs +70 -72
  11. package/dist/cjs/StyleSheet/index.cjs +33 -34
  12. package/dist/cjs/StyleSheet/preprocess.cjs +74 -94
  13. package/dist/cjs/StyleSheet/validate.cjs +72 -75
  14. package/dist/cjs/TextAncestorContext.cjs +15 -18
  15. package/dist/cjs/colorProps.cjs +25 -28
  16. package/dist/cjs/index.cjs +49 -50
  17. package/dist/cjs/modules/AccessibilityUtil/index.cjs +18 -21
  18. package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +15 -18
  19. package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +46 -49
  20. package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +34 -39
  21. package/dist/cjs/modules/AssetRegistry/index.cjs +18 -19
  22. package/dist/cjs/modules/ImageLoader/index.cjs +135 -141
  23. package/dist/cjs/modules/InteractionManager.cjs +212 -219
  24. package/dist/cjs/modules/Platform/index.cjs +18 -21
  25. package/dist/cjs/modules/TextInputState/index.cjs +55 -58
  26. package/dist/cjs/modules/UIManager/index.cjs +46 -51
  27. package/dist/cjs/modules/canUseDOM.cjs +15 -18
  28. package/dist/cjs/modules/createDOMProps/index.cjs +289 -358
  29. package/dist/cjs/modules/createEventHandle/index.cjs +57 -62
  30. package/dist/cjs/modules/dismissKeyboard/index.cjs +16 -19
  31. package/dist/cjs/modules/forwardedProps/index.cjs +128 -130
  32. package/dist/cjs/modules/getBoundingClientRect/index.cjs +22 -25
  33. package/dist/cjs/modules/invariant.cjs +26 -27
  34. package/dist/cjs/modules/isSelectionValid/index.cjs +22 -25
  35. package/dist/cjs/modules/isWebColor/index.cjs +15 -18
  36. package/dist/cjs/modules/mergeRefs/index.cjs +31 -34
  37. package/dist/cjs/modules/modality/index.cjs +131 -134
  38. package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +25 -28
  39. package/dist/cjs/modules/normalizeColor/index.cjs +28 -31
  40. package/dist/cjs/modules/pick/index.cjs +24 -27
  41. package/dist/cjs/modules/processColor/index.cjs +28 -36
  42. package/dist/cjs/modules/requestIdleCallback/index.cjs +28 -29
  43. package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.cjs +39 -42
  44. package/dist/cjs/modules/setValueForStyles/index.cjs +31 -34
  45. package/dist/cjs/modules/unitlessNumbers/index.cjs +74 -75
  46. package/dist/cjs/modules/useElementLayout/index.cjs +24 -31
  47. package/dist/cjs/modules/useEvent/index.cjs +40 -43
  48. package/dist/cjs/modules/useHover/index.cjs +113 -118
  49. package/dist/cjs/modules/useLayoutEffect/index.cjs +18 -26
  50. package/dist/cjs/modules/useLocale/index.cjs +33 -43
  51. package/dist/cjs/modules/useLocale/isLocaleRTL.cjs +66 -76
  52. package/dist/cjs/modules/useMergeRefs/index.cjs +19 -29
  53. package/dist/cjs/modules/usePlatformMethods/index.cjs +24 -30
  54. package/dist/cjs/modules/useStable/index.cjs +24 -32
  55. package/dist/cjs/styleTypes.cjs +10 -11
  56. package/dist/cjs/types.cjs +10 -11
  57. package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs +137 -119
  58. package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs.map +1 -1
  59. package/dist/esm/StyleSheet/compiler/hash.mjs +2 -2
  60. package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs +7 -6
  61. package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs.map +1 -1
  62. package/dist/esm/StyleSheet/compiler/index.mjs +279 -302
  63. package/dist/esm/StyleSheet/compiler/index.mjs.map +1 -1
  64. package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +7 -5
  65. package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -1
  66. package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs +19 -17
  67. package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs.map +1 -1
  68. package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs +14 -20
  69. package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs.map +1 -1
  70. package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs +24 -22
  71. package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs.map +1 -1
  72. package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs +94 -93
  73. package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs.map +1 -1
  74. package/dist/esm/StyleSheet/dom/index.mjs +57 -54
  75. package/dist/esm/StyleSheet/dom/index.mjs.map +1 -1
  76. package/dist/esm/StyleSheet/index.mjs +18 -17
  77. package/dist/esm/StyleSheet/index.mjs.map +1 -1
  78. package/dist/esm/StyleSheet/preprocess.mjs +58 -75
  79. package/dist/esm/StyleSheet/preprocess.mjs.map +1 -1
  80. package/dist/esm/StyleSheet/validate.mjs +58 -57
  81. package/dist/esm/StyleSheet/validate.mjs.map +1 -1
  82. package/dist/esm/TextAncestorContext.mjs +2 -0
  83. package/dist/esm/TextAncestorContext.mjs.map +1 -1
  84. package/dist/esm/colorProps.mjs +11 -10
  85. package/dist/esm/colorProps.mjs.map +1 -1
  86. package/dist/esm/index.js +22 -15
  87. package/dist/esm/index.mjs +22 -15
  88. package/dist/esm/modules/AccessibilityUtil/index.mjs +5 -3
  89. package/dist/esm/modules/AccessibilityUtil/index.mjs.map +1 -1
  90. package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs +2 -1
  91. package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs.map +1 -1
  92. package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs +33 -31
  93. package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs.map +1 -1
  94. package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs +20 -21
  95. package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs.map +1 -1
  96. package/dist/esm/modules/AssetRegistry/index.mjs +3 -2
  97. package/dist/esm/modules/AssetRegistry/index.mjs.map +1 -1
  98. package/dist/esm/modules/ImageLoader/index.mjs +120 -124
  99. package/dist/esm/modules/ImageLoader/index.mjs.map +1 -1
  100. package/dist/esm/modules/InteractionManager.mjs +199 -201
  101. package/dist/esm/modules/InteractionManager.mjs.map +1 -1
  102. package/dist/esm/modules/Platform/index.mjs +4 -3
  103. package/dist/esm/modules/Platform/index.mjs.map +1 -1
  104. package/dist/esm/modules/TextInputState/index.mjs +42 -40
  105. package/dist/esm/modules/TextInputState/index.mjs.map +1 -1
  106. package/dist/esm/modules/UIManager/index.mjs +33 -33
  107. package/dist/esm/modules/UIManager/index.mjs.map +1 -1
  108. package/dist/esm/modules/canUseDOM.mjs +1 -0
  109. package/dist/esm/modules/canUseDOM.mjs.map +1 -1
  110. package/dist/esm/modules/createDOMProps/index.mjs +275 -341
  111. package/dist/esm/modules/createDOMProps/index.mjs.map +1 -1
  112. package/dist/esm/modules/createEventHandle/index.mjs +44 -44
  113. package/dist/esm/modules/createEventHandle/index.mjs.map +1 -1
  114. package/dist/esm/modules/dismissKeyboard/index.mjs +3 -1
  115. package/dist/esm/modules/dismissKeyboard/index.mjs.map +1 -1
  116. package/dist/esm/modules/forwardedProps/index.mjs +104 -104
  117. package/dist/esm/modules/forwardedProps/index.mjs.map +1 -1
  118. package/dist/esm/modules/getBoundingClientRect/index.mjs +8 -7
  119. package/dist/esm/modules/getBoundingClientRect/index.mjs.map +1 -1
  120. package/dist/esm/modules/invariant.mjs +11 -10
  121. package/dist/esm/modules/invariant.mjs.map +1 -1
  122. package/dist/esm/modules/isSelectionValid/index.mjs +8 -7
  123. package/dist/esm/modules/isSelectionValid/index.mjs.map +1 -1
  124. package/dist/esm/modules/isWebColor/index.mjs +2 -1
  125. package/dist/esm/modules/isWebColor/index.mjs.map +1 -1
  126. package/dist/esm/modules/mergeRefs/index.mjs +17 -16
  127. package/dist/esm/modules/mergeRefs/index.mjs.map +1 -1
  128. package/dist/esm/modules/modality/index.mjs +115 -115
  129. package/dist/esm/modules/modality/index.mjs.map +1 -1
  130. package/dist/esm/modules/multiplyStyleLengthValue/index.mjs +11 -10
  131. package/dist/esm/modules/multiplyStyleLengthValue/index.mjs.map +1 -1
  132. package/dist/esm/modules/normalizeColor/index.mjs +15 -13
  133. package/dist/esm/modules/normalizeColor/index.mjs.map +1 -1
  134. package/dist/esm/modules/pick/index.mjs +10 -9
  135. package/dist/esm/modules/pick/index.mjs.map +1 -1
  136. package/dist/esm/modules/processColor/index.mjs +12 -10
  137. package/dist/esm/modules/processColor/index.mjs.map +1 -1
  138. package/dist/esm/modules/requestIdleCallback/index.mjs +14 -12
  139. package/dist/esm/modules/requestIdleCallback/index.mjs.map +1 -1
  140. package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs +27 -25
  141. package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs.map +1 -1
  142. package/dist/esm/modules/setValueForStyles/index.mjs +18 -16
  143. package/dist/esm/modules/setValueForStyles/index.mjs.map +1 -1
  144. package/dist/esm/modules/unitlessNumbers/index.mjs +60 -57
  145. package/dist/esm/modules/unitlessNumbers/index.mjs.map +1 -1
  146. package/dist/esm/modules/useElementLayout/index.mjs +12 -14
  147. package/dist/esm/modules/useElementLayout/index.mjs.map +1 -1
  148. package/dist/esm/modules/useEvent/index.mjs +28 -26
  149. package/dist/esm/modules/useEvent/index.mjs.map +1 -1
  150. package/dist/esm/modules/useHover/index.mjs +101 -101
  151. package/dist/esm/modules/useHover/index.mjs.map +1 -1
  152. package/dist/esm/modules/useLayoutEffect/index.mjs +2 -0
  153. package/dist/esm/modules/useLayoutEffect/index.mjs.map +1 -1
  154. package/dist/esm/modules/useLocale/index.mjs +15 -17
  155. package/dist/esm/modules/useLocale/index.mjs.map +1 -1
  156. package/dist/esm/modules/useLocale/isLocaleRTL.mjs +52 -58
  157. package/dist/esm/modules/useLocale/isLocaleRTL.mjs.map +1 -1
  158. package/dist/esm/modules/useMergeRefs/index.mjs +3 -3
  159. package/dist/esm/modules/useMergeRefs/index.mjs.map +1 -1
  160. package/dist/esm/modules/usePlatformMethods/index.mjs +11 -12
  161. package/dist/esm/modules/usePlatformMethods/index.mjs.map +1 -1
  162. package/dist/esm/modules/useStable/index.mjs +8 -6
  163. package/dist/esm/modules/useStable/index.mjs.map +1 -1
  164. package/dist/esm/styleTypes.mjs +0 -2
  165. package/dist/esm/types.mjs +0 -2
  166. package/package.json +8 -8
  167. package/src/modules/createDOMProps/index.tsx +3 -12
  168. package/src/modules/forwardedProps/index.tsx +0 -1
  169. package/src/modules/mergeRefs/index.tsx +1 -1
  170. package/types/StyleSheet/compiler/createReactDOMStyle.d.ts.map +1 -1
  171. package/types/StyleSheet/compiler/normalizeColor.d.ts.map +1 -1
  172. package/types/StyleSheet/compiler/resolveShadowValue.d.ts.map +1 -1
  173. package/types/StyleSheet/index.d.ts +15 -16
  174. package/types/StyleSheet/index.d.ts.map +1 -1
  175. package/types/StyleSheet/preprocess.d.ts +1 -1
  176. package/types/StyleSheet/preprocess.d.ts.map +1 -1
  177. package/types/colorProps.d.ts.map +1 -1
  178. package/types/modules/AccessibilityUtil/index.d.ts +6 -5
  179. package/types/modules/AccessibilityUtil/index.d.ts.map +1 -1
  180. package/types/modules/AccessibilityUtil/isDisabled.d.ts.map +1 -1
  181. package/types/modules/AccessibilityUtil/propsToAccessibilityComponent.d.ts.map +1 -1
  182. package/types/modules/AccessibilityUtil/propsToAriaRole.d.ts.map +1 -1
  183. package/types/modules/ImageLoader/index.d.ts +1 -1
  184. package/types/modules/ImageLoader/index.d.ts.map +1 -1
  185. package/types/modules/InteractionManager.d.ts +3 -3
  186. package/types/modules/InteractionManager.d.ts.map +1 -1
  187. package/types/modules/Platform/index.d.ts.map +1 -1
  188. package/types/modules/TextInputState/index.d.ts.map +1 -1
  189. package/types/modules/createDOMProps/index.d.ts.map +1 -1
  190. package/types/modules/forwardedProps/index.d.ts +70 -74
  191. package/types/modules/forwardedProps/index.d.ts.map +1 -1
  192. package/types/modules/getBoundingClientRect/index.d.ts.map +1 -1
  193. package/types/modules/isWebColor/index.d.ts.map +1 -1
  194. package/types/modules/multiplyStyleLengthValue/index.d.ts.map +1 -1
  195. package/types/modules/normalizeColor/index.d.ts.map +1 -1
  196. package/types/modules/processColor/index.d.ts.map +1 -1
  197. package/types/modules/requestIdleCallback/index.d.ts +3 -1
  198. package/types/modules/requestIdleCallback/index.d.ts.map +1 -1
  199. package/types/modules/unitlessNumbers/index.d.ts.map +1 -1
  200. package/types/modules/useLayoutEffect/index.d.ts +1 -1
  201. package/types/modules/useLayoutEffect/index.d.ts.map +1 -1
  202. package/dist/cjs/StyleSheet/__tests__/compiler-createReactDOMStyle-test.cjs +0 -265
  203. package/dist/cjs/StyleSheet/__tests__/compiler-test.cjs +0 -419
  204. package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.cjs +0 -160
  205. package/dist/cjs/StyleSheet/__tests__/index-test.cjs +0 -436
  206. package/dist/cjs/StyleSheet/__tests__/preprocess-test.cjs +0 -121
  207. package/dist/cjs/StyleSheet/__tests__/validate-test.cjs +0 -51
  208. package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.cjs +0 -57
  209. package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.cjs +0 -46
  210. package/dist/cjs/modules/Platform/__tests__/index-test.cjs +0 -56
  211. package/dist/cjs/modules/UIManager/__tests__/index-test.cjs +0 -111
  212. package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +0 -177
  213. package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +0 -422
  214. package/dist/cjs/modules/mergeRefs/__tests__/index-test.cjs +0 -48
  215. package/dist/cjs/modules/modality/__tests__/index-test.cjs +0 -59
  216. package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.cjs +0 -38
  217. package/dist/cjs/modules/processColor/__tests__/index-test.cjs +0 -85
  218. package/dist/cjs/modules/useEvent/__tests__/index-test.cjs +0 -490
  219. package/dist/cjs/modules/useHover/__tests__/index-test.cjs +0 -382
  220. package/dist/cjs/modules/useMergeRefs/__tests__/index-test.cjs +0 -125
  221. package/dist/cjs/modules/useStable/__tests__/index-test.cjs +0 -122
  222. package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs +0 -242
  223. package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs.map +0 -1
  224. package/dist/esm/StyleSheet/__tests__/compiler-test.mjs +0 -420
  225. package/dist/esm/StyleSheet/__tests__/compiler-test.mjs.map +0 -1
  226. package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs +0 -137
  227. package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs.map +0 -1
  228. package/dist/esm/StyleSheet/__tests__/index-test.mjs +0 -413
  229. package/dist/esm/StyleSheet/__tests__/index-test.mjs.map +0 -1
  230. package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs +0 -122
  231. package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs.map +0 -1
  232. package/dist/esm/StyleSheet/__tests__/validate-test.mjs +0 -52
  233. package/dist/esm/StyleSheet/__tests__/validate-test.mjs.map +0 -1
  234. package/dist/esm/StyleSheet/compiler/hash.mjs.map +0 -1
  235. package/dist/esm/index.js.map +0 -1
  236. package/dist/esm/index.mjs.map +0 -1
  237. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs +0 -34
  238. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs.map +0 -1
  239. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs +0 -23
  240. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs.map +0 -1
  241. package/dist/esm/modules/Platform/__tests__/index-test.mjs +0 -33
  242. package/dist/esm/modules/Platform/__tests__/index-test.mjs.map +0 -1
  243. package/dist/esm/modules/UIManager/__tests__/index-test.mjs +0 -88
  244. package/dist/esm/modules/UIManager/__tests__/index-test.mjs.map +0 -1
  245. package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs +0 -154
  246. package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs.map +0 -1
  247. package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs +0 -399
  248. package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs.map +0 -1
  249. package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs +0 -25
  250. package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs.map +0 -1
  251. package/dist/esm/modules/modality/__tests__/index-test.mjs +0 -60
  252. package/dist/esm/modules/modality/__tests__/index-test.mjs.map +0 -1
  253. package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs +0 -15
  254. package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs.map +0 -1
  255. package/dist/esm/modules/processColor/__tests__/index-test.mjs +0 -62
  256. package/dist/esm/modules/processColor/__tests__/index-test.mjs.map +0 -1
  257. package/dist/esm/modules/useEvent/__tests__/index-test.mjs +0 -467
  258. package/dist/esm/modules/useEvent/__tests__/index-test.mjs.map +0 -1
  259. package/dist/esm/modules/useHover/__tests__/index-test.mjs +0 -359
  260. package/dist/esm/modules/useHover/__tests__/index-test.mjs.map +0 -1
  261. package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs +0 -102
  262. package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs.map +0 -1
  263. package/dist/esm/modules/useStable/__tests__/index-test.mjs +0 -99
  264. package/dist/esm/modules/useStable/__tests__/index-test.mjs.map +0 -1
  265. package/dist/esm/styleTypes.mjs.map +0 -1
  266. package/dist/esm/types.mjs.map +0 -1
  267. package/src/StyleSheet/__tests__/compiler-createReactDOMStyle-test.tsx +0 -236
  268. package/src/StyleSheet/__tests__/compiler-test.tsx +0 -426
  269. package/src/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.tsx +0 -169
  270. package/src/StyleSheet/__tests__/index-test.tsx +0 -406
  271. package/src/StyleSheet/__tests__/preprocess-test.tsx +0 -107
  272. package/src/StyleSheet/__tests__/validate-test.tsx +0 -42
  273. package/src/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.tsx +0 -44
  274. package/src/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.tsx +0 -25
  275. package/src/modules/Platform/__tests__/index-test.tsx +0 -45
  276. package/src/modules/UIManager/__tests__/index-test.tsx +0 -87
  277. package/src/modules/createDOMProps/__tests__/index-test.tsx +0 -138
  278. package/src/modules/createEventHandle/__tests__/index-test.tsx +0 -459
  279. package/src/modules/mergeRefs/__tests__/index-test.tsx +0 -32
  280. package/src/modules/modality/__tests__/index-test.tsx +0 -66
  281. package/src/modules/multiplyStyleLengthValue/__tests__/index-test.tsx +0 -23
  282. package/src/modules/processColor/__tests__/index-test.tsx +0 -78
  283. package/src/modules/useEvent/__tests__/index-test.tsx +0 -511
  284. package/src/modules/useHover/__tests__/index-test.tsx +0 -342
  285. package/src/modules/useMergeRefs/__tests__/index-test.tsx +0 -91
  286. package/src/modules/useStable/__tests__/index-test.tsx +0 -101
@@ -1,419 +0,0 @@
1
- var import_compiler = require("../compiler/index.cjs");
2
- describe("StyleSheet/compile", () => {
3
- describe("atomic", () => {
4
- test("converts style to atomic CSS", () => {
5
- const result = (0, import_compiler.atomic)({
6
- animationDirection: ["alternate", "alternate-reverse"],
7
- animationKeyframes: [{
8
- "0%": {
9
- top: 0
10
- },
11
- "50%": {
12
- top: 5
13
- },
14
- "100%": {
15
- top: 10
16
- }
17
- }, {
18
- from: {
19
- left: 0
20
- },
21
- to: {
22
- left: 10
23
- }
24
- }],
25
- fontFamily: "System",
26
- marginHorizontal: 10,
27
- marginStart: 1,
28
- marginEnd: 2,
29
- placeholderTextColor: "gray",
30
- scrollbarWidth: "none",
31
- pointerEvents: "box-only",
32
- start: "12.34%",
33
- textAlign: "start",
34
- transform: [{
35
- translateX: 50,
36
- scale: -1
37
- }]
38
- });
39
- expect(result).toMatchInlineSnapshot(`
40
- [
41
- {
42
- "$$css": true,
43
- "$$css$localize": true,
44
- "animationDirection": "r-animationDirection-1kmv48j",
45
- "animationKeyframes": "r-animationKeyframes-zacbmr",
46
- "fontFamily": "r-fontFamily-1qd0xha",
47
- "marginEnd": [
48
- "r-marginRight-a5pmau",
49
- "r-marginLeft-9cviqr",
50
- ],
51
- "marginHorizontal": "r-marginHorizontal-vlx1xi",
52
- "marginStart": [
53
- "r-marginLeft-13kc5u0",
54
- "r-marginRight-1knfw1x",
55
- ],
56
- "placeholderTextColor": "r-placeholderTextColor-1418aci",
57
- "pointerEvents": "r-pointerEvents-ah5dr5",
58
- "scrollbarWidth": "r-scrollbarWidth-2eszeu",
59
- "start": [
60
- "r-left-2s0hu9",
61
- "r-right-1bnbe1j",
62
- ],
63
- "textAlign": [
64
- "r-textAlign-fdjqy7",
65
- "r-textAlign-1ff274t",
66
- ],
67
- "transform": "r-transform-1ehiua4",
68
- },
69
- [
70
- [
71
- [
72
- ".r-animationDirection-1kmv48j{animation-direction:alternate,alternate-reverse;}",
73
- ],
74
- 2.2,
75
- ],
76
- [
77
- [
78
- ".r-animationKeyframes-zacbmr{animation-name:r-animation-8jhqzh,r-animation-5azpl5;}",
79
- "@-webkit-keyframes r-animation-8jhqzh{0%{top:0px;}50%{top:5px;}100%{top:10px;}}",
80
- "@keyframes r-animation-8jhqzh{0%{top:0px;}50%{top:5px;}100%{top:10px;}}",
81
- "@-webkit-keyframes r-animation-5azpl5{from{left:0px;}to{left:10px;}}",
82
- "@keyframes r-animation-5azpl5{from{left:0px;}to{left:10px;}}",
83
- ],
84
- 2.2,
85
- ],
86
- [
87
- [
88
- ".r-fontFamily-1qd0xha{font-family:-apple-system,BlinkMacSystemFont,\\"Segoe UI\\",Roboto,Helvetica,Arial,sans-serif;}",
89
- ],
90
- 2.2,
91
- ],
92
- [
93
- [
94
- ".r-marginRight-a5pmau{margin-right:2px;}",
95
- ],
96
- 2.2,
97
- ],
98
- [
99
- [
100
- ".r-marginLeft-9cviqr{margin-left:2px;}",
101
- ],
102
- 2.2,
103
- ],
104
- [
105
- [
106
- ".r-marginHorizontal-vlx1xi{margin-left:10px;margin-right:10px;}",
107
- ],
108
- 2.1,
109
- ],
110
- [
111
- [
112
- ".r-marginLeft-13kc5u0{margin-left:1px;}",
113
- ],
114
- 2.2,
115
- ],
116
- [
117
- [
118
- ".r-marginRight-1knfw1x{margin-right:1px;}",
119
- ],
120
- 2.2,
121
- ],
122
- [
123
- [
124
- ".r-placeholderTextColor-1418aci::-webkit-input-placeholder{color:rgba(128,128,128,1.00);opacity:1;}",
125
- ".r-placeholderTextColor-1418aci::-moz-placeholder{color:rgba(128,128,128,1.00);opacity:1;}",
126
- ".r-placeholderTextColor-1418aci:-ms-input-placeholder{color:rgba(128,128,128,1.00);opacity:1;}",
127
- ".r-placeholderTextColor-1418aci::placeholder{color:rgba(128,128,128,1.00);opacity:1;}",
128
- ],
129
- 2.2,
130
- ],
131
- [
132
- [
133
- ".r-pointerEvents-ah5dr5>*{pointer-events:none;}",
134
- ".r-pointerEvents-ah5dr5{pointer-events:auto!important;}",
135
- ],
136
- 2.2,
137
- ],
138
- [
139
- [
140
- ".r-scrollbarWidth-2eszeu::-webkit-scrollbar{display:none}",
141
- ".r-scrollbarWidth-2eszeu{scrollbar-width:none;}",
142
- ],
143
- 2.2,
144
- ],
145
- [
146
- [
147
- ".r-left-2s0hu9{left:12.34%;}",
148
- ],
149
- 2.2,
150
- ],
151
- [
152
- [
153
- ".r-right-1bnbe1j{right:12.34%;}",
154
- ],
155
- 2.2,
156
- ],
157
- [
158
- [
159
- ".r-textAlign-fdjqy7{text-align:left;}",
160
- ],
161
- 2.2,
162
- ],
163
- [
164
- [
165
- ".r-textAlign-1ff274t{text-align:right;}",
166
- ],
167
- 2.2,
168
- ],
169
- [
170
- [
171
- ".r-transform-1ehiua4{transform:translateX(50px);}",
172
- ],
173
- 2.2,
174
- ],
175
- ],
176
- ]
177
- `);
178
- });
179
- });
180
- describe("classic", () => {
181
- test("converts style to classic CSS", () => {
182
- const result = (0, import_compiler.classic)({
183
- animationDirection: ["alternate", "alternate-reverse"],
184
- animationKeyframes: [{
185
- "0%": {
186
- top: 0
187
- },
188
- "50%": {
189
- top: 5
190
- },
191
- "100%": {
192
- top: 10
193
- }
194
- }, {
195
- from: {
196
- left: 0
197
- },
198
- to: {
199
- left: 10
200
- }
201
- }],
202
- marginHorizontal: 10,
203
- font: "14px System",
204
- transform: [{
205
- translateX: 50,
206
- scale: -1
207
- }]
208
- }, "text");
209
- expect(result).toMatchInlineSnapshot(`
210
- [
211
- {
212
- "$$css": true,
213
- "css-text-1jr0ypv": "css-text-1jr0ypv",
214
- },
215
- [
216
- [
217
- [
218
- "@-webkit-keyframes r-animation-8jhqzh{0%{top:0px;}50%{top:5px;}100%{top:10px;}}",
219
- "@keyframes r-animation-8jhqzh{0%{top:0px;}50%{top:5px;}100%{top:10px;}}",
220
- "@-webkit-keyframes r-animation-5azpl5{from{left:0px;}to{left:10px;}}",
221
- "@keyframes r-animation-5azpl5{from{left:0px;}to{left:10px;}}",
222
- ".css-text-1jr0ypv{animation-direction:alternate,alternate-reverse;animation-name:r-animation-8jhqzh,r-animation-5azpl5;font:14px -apple-system,BlinkMacSystemFont,\\"Segoe UI\\",Roboto,Helvetica,Arial,sans-serif;margin-left:10px;margin-right:10px;transform:translateX(50px);}",
223
- ],
224
- 1,
225
- ],
226
- ],
227
- ]
228
- `);
229
- });
230
- });
231
- describe("inline", () => {
232
- test("converts style to inline styles", () => {
233
- const result = (0, import_compiler.inline)({
234
- marginHorizontal: 10,
235
- display: "flex",
236
- flexShrink: 1
237
- });
238
- expect(result).toMatchInlineSnapshot(`
239
- {
240
- "display": "flex",
241
- "flexShrink": 1,
242
- "marginLeft": "10px",
243
- "marginRight": "10px",
244
- }
245
- `);
246
- });
247
- describe("logical style polyfill", () => {
248
- ;
249
- [false, true].forEach(isRTL => {
250
- const dir = isRTL ? "rtl" : "ltr";
251
- test(`ignores "left" properties for ${dir}`, () => {
252
- const initial = {
253
- borderLeftColor: "rgba(255,0,0,1.00)",
254
- borderLeftStyle: "solid",
255
- borderLeftWidth: "1px",
256
- left: "1px",
257
- marginLeft: "5px",
258
- paddingLeft: "10px"
259
- };
260
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(initial);
261
- });
262
- test(`ignores "right" properties for ${dir}`, () => {
263
- const initial = {
264
- borderRightColor: "rgba(255,0,0,1.00)",
265
- borderRightStyle: "solid",
266
- borderRightWidth: "1px",
267
- right: "1px",
268
- marginRight: "5px",
269
- paddingRight: "10px"
270
- };
271
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(initial);
272
- });
273
- test(`ignores "left" values for ${dir}`, () => {
274
- const initial = {
275
- clear: "left",
276
- float: "left",
277
- textAlign: "left",
278
- transitionProperty: "left"
279
- };
280
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(initial);
281
- });
282
- test(`ignores "right" values for ${dir}`, () => {
283
- const initial = {
284
- clear: "right",
285
- float: "right",
286
- textAlign: "right",
287
- transitionProperty: "right"
288
- };
289
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(initial);
290
- });
291
- test(`converts "start" properties for ${dir}`, () => {
292
- const initial = {
293
- borderStartColor: "red",
294
- borderStartStyle: "solid",
295
- borderStartWidth: 1,
296
- start: 1,
297
- marginStart: 5,
298
- paddingStart: 10
299
- };
300
- const expectedLTR = {
301
- borderLeftColor: "rgba(255,0,0,1.00)",
302
- borderLeftStyle: "solid",
303
- borderLeftWidth: "1px",
304
- left: "1px",
305
- marginLeft: "5px",
306
- paddingLeft: "10px"
307
- };
308
- const expectedRTL = {
309
- borderRightColor: "rgba(255,0,0,1.00)",
310
- borderRightStyle: "solid",
311
- borderRightWidth: "1px",
312
- right: "1px",
313
- marginRight: "5px",
314
- paddingRight: "10px"
315
- };
316
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(isRTL ? expectedRTL : expectedLTR);
317
- });
318
- test(`converts "end" properties for ${dir}`, () => {
319
- const initial = {
320
- borderEndColor: "red",
321
- borderEndStyle: "solid",
322
- borderEndWidth: 1,
323
- end: 1,
324
- marginEnd: 5,
325
- paddingEnd: 10
326
- };
327
- const expectedLTR = {
328
- borderRightColor: "rgba(255,0,0,1.00)",
329
- borderRightStyle: "solid",
330
- borderRightWidth: "1px",
331
- right: "1px",
332
- marginRight: "5px",
333
- paddingRight: "10px"
334
- };
335
- const expectedRTL = {
336
- borderLeftColor: "rgba(255,0,0,1.00)",
337
- borderLeftStyle: "solid",
338
- borderLeftWidth: "1px",
339
- left: "1px",
340
- marginLeft: "5px",
341
- paddingLeft: "10px"
342
- };
343
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(isRTL ? expectedRTL : expectedLTR);
344
- });
345
- test(`converts "start" values for ${dir}`, () => {
346
- const initial = {
347
- clear: "start",
348
- float: "start",
349
- textAlign: "start",
350
- transitionProperty: "start"
351
- };
352
- const expectedLTR = {
353
- clear: "left",
354
- float: "left",
355
- textAlign: "left",
356
- transitionProperty: "left"
357
- };
358
- const expectedRTL = {
359
- clear: "right",
360
- float: "right",
361
- textAlign: "right",
362
- transitionProperty: "right"
363
- };
364
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(isRTL ? expectedRTL : expectedLTR);
365
- });
366
- test(`converts "end" values for ${dir}`, () => {
367
- const initial = {
368
- clear: "end",
369
- float: "end",
370
- textAlign: "end",
371
- transitionProperty: "end"
372
- };
373
- const expectedLTR = {
374
- clear: "right",
375
- float: "right",
376
- textAlign: "right",
377
- transitionProperty: "right"
378
- };
379
- const expectedRTL = {
380
- clear: "left",
381
- float: "left",
382
- textAlign: "left",
383
- transitionProperty: "left"
384
- };
385
- expect((0, import_compiler.inline)(initial, isRTL)).toEqual(isRTL ? expectedRTL : expectedLTR);
386
- });
387
- test("end/start properties take precedence over left/right", () => {
388
- const initialLTR = {
389
- borderStartWidth: 10,
390
- borderLeftWidth: 0,
391
- end: 10,
392
- right: 0,
393
- marginStart: 10,
394
- marginLeft: 0
395
- };
396
- const expectedLTR = {
397
- borderLeftWidth: "10px",
398
- marginLeft: "10px",
399
- right: "10px"
400
- };
401
- const initialRTL = {
402
- borderStartWidth: 10,
403
- borderRightWidth: 0,
404
- end: 10,
405
- left: 0,
406
- marginStart: 10,
407
- marginRight: 0
408
- };
409
- const expectedRTL = {
410
- borderRightWidth: "10px",
411
- marginRight: "10px",
412
- left: "10px"
413
- };
414
- expect((0, import_compiler.inline)(isRTL ? initialRTL : initialLTR, isRTL)).toEqual(isRTL ? expectedRTL : expectedLTR);
415
- });
416
- });
417
- });
418
- });
419
- });
@@ -1,160 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __copyProps = (to, from, except, desc) => {
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
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
- value: mod,
23
- enumerable: true
24
- }) : target, mod));
25
- var import_createOrderedCSSStyleSheet = __toESM(require("../dom/createOrderedCSSStyleSheet.cjs"), 1);
26
- const insertStyleElement = () => {
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
- };
35
- describe("createOrderedCSSStyleSheet", () => {
36
- describe("#insert", () => {
37
- test("insertion order for same group", () => {
38
- const sheet = (0, import_createOrderedCSSStyleSheet.default)();
39
- expect(sheet.getTextContent()).toMatchInlineSnapshot('""');
40
- sheet.insert(".a {}", 0);
41
- expect(sheet.getTextContent()).toMatchInlineSnapshot(`
42
- "[stylesheet-group=\\"0\\"]{}
43
- .a {}"
44
- `);
45
- sheet.insert(".b {}", 0);
46
- expect(sheet.getTextContent()).toMatchInlineSnapshot(`
47
- "[stylesheet-group=\\"0\\"]{}
48
- .a {}
49
- .b {}"
50
- `);
51
- sheet.insert(".c {}", 0);
52
- expect(sheet.getTextContent()).toMatchInlineSnapshot(`
53
- "[stylesheet-group=\\"0\\"]{}
54
- .a {}
55
- .b {}
56
- .c {}"
57
- `);
58
- });
59
- test("deduplication for same group", () => {
60
- const sheet = (0, import_createOrderedCSSStyleSheet.default)();
61
- sheet.insert(".a {}", 0);
62
- sheet.insert(".a {}", 0);
63
- sheet.insert(".a {}", 0);
64
- expect(sheet.getTextContent()).toMatchInlineSnapshot(`
65
- "[stylesheet-group=\\"0\\"]{}
66
- .a {}"
67
- `);
68
- });
69
- test("order for same group", () => {
70
- const sheet = (0, import_createOrderedCSSStyleSheet.default)();
71
- sheet.insert(".c {}", 0);
72
- sheet.insert(".b {}", 0);
73
- sheet.insert(".a {}", 0);
74
- expect(sheet.getTextContent()).toMatchInlineSnapshot(`
75
- "[stylesheet-group=\\"0\\"]{}
76
- .a {}
77
- .b {}
78
- .c {}"
79
- `);
80
- });
81
- test("insertion order for different groups", () => {
82
- const sheet = (0, import_createOrderedCSSStyleSheet.default)();
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(`
94
- "[stylesheet-group=\\"1\\"]{}
95
- .one {}
96
- [stylesheet-group=\\"2.2\\"]{}
97
- .two {}
98
- [stylesheet-group=\\"3\\"]{}
99
- .three {}
100
- [stylesheet-group=\\"4\\"]{}
101
- .four-1 {}
102
- .four-2 {}
103
- [stylesheet-group=\\"9.9\\"]{}
104
- .nine-1 {}
105
- .nine-2 {}
106
- [stylesheet-group=\\"10\\"]{}
107
- .ten {}
108
- [stylesheet-group=\\"20\\"]{}
109
- .twenty {}
110
- [stylesheet-group=\\"20.2\\"]{}
111
- .twenty-point2 {}"
112
- `);
113
- });
114
- });
115
- describe("client-side hydration", () => {
116
- let element;
117
- beforeEach(() => {
118
- if (element != null) {
119
- removeStyleElement(element);
120
- }
121
- element = insertStyleElement();
122
- });
123
- test("from SSR CSS", () => {
124
- const serverSheet = (0, import_createOrderedCSSStyleSheet.default)();
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);
129
- const textContent = serverSheet.getTextContent();
130
- element.appendChild(document.createTextNode(textContent));
131
- const clientSheet = (0, import_createOrderedCSSStyleSheet.default)(element.sheet);
132
- expect(clientSheet.getTextContent()).toMatchInlineSnapshot(`
133
- "[stylesheet-group=\\"1\\"] {}
134
- .one {width: 10px;}
135
- [stylesheet-group=\\"2\\"] {}
136
- .two-1 {height: 20px;}
137
- .two-2 {color: red;}
138
- @keyframes anim {
139
- 0% {opacity: 1;}
140
- }"
141
- `);
142
- });
143
- test("works when the group marker is in single quotes", () => {
144
- const serverSheet = (0, import_createOrderedCSSStyleSheet.default)();
145
- serverSheet.insert(".a { color: red }", 0);
146
- serverSheet.insert(".b { color: red }", 1);
147
- const textContent = serverSheet.getTextContent().replace(/"/g, "'");
148
- element.appendChild(document.createTextNode(textContent));
149
- const clientSheet = (0, import_createOrderedCSSStyleSheet.default)(element.sheet);
150
- clientSheet.insert(".c { color: red }", 0);
151
- expect(clientSheet.getTextContent()).toMatchInlineSnapshot(`
152
- "[stylesheet-group='0'] {}
153
- .a {color: red;}
154
- .c { color: red }
155
- [stylesheet-group='1'] {}
156
- .b {color: red;}"
157
- `);
158
- });
159
- });
160
- });