@hanzogui/react-native-web-internals 2.0.0-rc.41-hanzoai.5

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 (420) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/StyleSheet/__tests__/compiler-createReactDOMStyle-test.cjs +265 -0
  3. package/dist/cjs/StyleSheet/__tests__/compiler-test.cjs +419 -0
  4. package/dist/cjs/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.cjs +160 -0
  5. package/dist/cjs/StyleSheet/__tests__/index-test.cjs +436 -0
  6. package/dist/cjs/StyleSheet/__tests__/preprocess-test.cjs +121 -0
  7. package/dist/cjs/StyleSheet/__tests__/validate-test.cjs +51 -0
  8. package/dist/cjs/StyleSheet/compiler/createReactDOMStyle.cjs +160 -0
  9. package/dist/cjs/StyleSheet/compiler/hash.cjs +28 -0
  10. package/dist/cjs/StyleSheet/compiler/hyphenateStyleName.cjs +40 -0
  11. package/dist/cjs/StyleSheet/compiler/index.cjs +379 -0
  12. package/dist/cjs/StyleSheet/compiler/normalizeColor.cjs +36 -0
  13. package/dist/cjs/StyleSheet/compiler/normalizeValueWithProperty.cjs +50 -0
  14. package/dist/cjs/StyleSheet/compiler/resolveShadowValue.cjs +52 -0
  15. package/dist/cjs/StyleSheet/dom/createCSSStyleSheet.cjs +52 -0
  16. package/dist/cjs/StyleSheet/dom/createOrderedCSSStyleSheet.cjs +135 -0
  17. package/dist/cjs/StyleSheet/dom/index.cjs +89 -0
  18. package/dist/cjs/StyleSheet/index.cjs +64 -0
  19. package/dist/cjs/StyleSheet/preprocess.cjs +114 -0
  20. package/dist/cjs/StyleSheet/validate.cjs +92 -0
  21. package/dist/cjs/TextAncestorContext.cjs +29 -0
  22. package/dist/cjs/colorProps.cjs +39 -0
  23. package/dist/cjs/index.cjs +105 -0
  24. package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.cjs +57 -0
  25. package/dist/cjs/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.cjs +46 -0
  26. package/dist/cjs/modules/AccessibilityUtil/index.cjs +35 -0
  27. package/dist/cjs/modules/AccessibilityUtil/isDisabled.cjs +28 -0
  28. package/dist/cjs/modules/AccessibilityUtil/propsToAccessibilityComponent.cjs +64 -0
  29. package/dist/cjs/modules/AccessibilityUtil/propsToAriaRole.cjs +51 -0
  30. package/dist/cjs/modules/AssetRegistry/index.cjs +35 -0
  31. package/dist/cjs/modules/ImageLoader/index.cjs +157 -0
  32. package/dist/cjs/modules/InteractionManager.cjs +240 -0
  33. package/dist/cjs/modules/Platform/__tests__/index-test.cjs +56 -0
  34. package/dist/cjs/modules/Platform/index.cjs +32 -0
  35. package/dist/cjs/modules/TextInputState/index.cjs +70 -0
  36. package/dist/cjs/modules/UIManager/__tests__/index-test.cjs +111 -0
  37. package/dist/cjs/modules/UIManager/index.cjs +65 -0
  38. package/dist/cjs/modules/canUseDOM.cjs +28 -0
  39. package/dist/cjs/modules/createDOMProps/__tests__/index-test.cjs +177 -0
  40. package/dist/cjs/modules/createDOMProps/index.cjs +387 -0
  41. package/dist/cjs/modules/createEventHandle/__tests__/index-test.cjs +422 -0
  42. package/dist/cjs/modules/createEventHandle/index.cjs +88 -0
  43. package/dist/cjs/modules/dismissKeyboard/index.cjs +31 -0
  44. package/dist/cjs/modules/forwardedProps/index.cjs +163 -0
  45. package/dist/cjs/modules/getBoundingClientRect/index.cjs +35 -0
  46. package/dist/cjs/modules/invariant.cjs +42 -0
  47. package/dist/cjs/modules/isSelectionValid/index.cjs +36 -0
  48. package/dist/cjs/modules/isWebColor/index.cjs +28 -0
  49. package/dist/cjs/modules/mergeRefs/__tests__/index-test.cjs +48 -0
  50. package/dist/cjs/modules/mergeRefs/index.cjs +45 -0
  51. package/dist/cjs/modules/modality/__tests__/index-test.cjs +59 -0
  52. package/dist/cjs/modules/modality/index.cjs +212 -0
  53. package/dist/cjs/modules/multiplyStyleLengthValue/__tests__/index-test.cjs +38 -0
  54. package/dist/cjs/modules/multiplyStyleLengthValue/index.cjs +41 -0
  55. package/dist/cjs/modules/normalizeColor/index.cjs +44 -0
  56. package/dist/cjs/modules/pick/index.cjs +38 -0
  57. package/dist/cjs/modules/processColor/__tests__/index-test.cjs +85 -0
  58. package/dist/cjs/modules/processColor/index.cjs +50 -0
  59. package/dist/cjs/modules/requestIdleCallback/index.cjs +46 -0
  60. package/dist/cjs/modules/setValueForStyles/dangerousStyleValue.cjs +55 -0
  61. package/dist/cjs/modules/setValueForStyles/index.cjs +46 -0
  62. package/dist/cjs/modules/unitlessNumbers/index.cjs +89 -0
  63. package/dist/cjs/modules/useElementLayout/index.cjs +44 -0
  64. package/dist/cjs/modules/useEvent/__tests__/index-test.cjs +490 -0
  65. package/dist/cjs/modules/useEvent/index.cjs +57 -0
  66. package/dist/cjs/modules/useHover/__tests__/index-test.cjs +382 -0
  67. package/dist/cjs/modules/useHover/index.cjs +140 -0
  68. package/dist/cjs/modules/useLayoutEffect/index.cjs +41 -0
  69. package/dist/cjs/modules/useLocale/index.cjs +69 -0
  70. package/dist/cjs/modules/useLocale/isLocaleRTL.cjs +88 -0
  71. package/dist/cjs/modules/useMergeRefs/__tests__/index-test.cjs +125 -0
  72. package/dist/cjs/modules/useMergeRefs/index.cjs +45 -0
  73. package/dist/cjs/modules/usePlatformMethods/index.cjs +42 -0
  74. package/dist/cjs/modules/useStable/__tests__/index-test.cjs +122 -0
  75. package/dist/cjs/modules/useStable/index.cjs +47 -0
  76. package/dist/cjs/styleTypes.cjs +18 -0
  77. package/dist/cjs/types.cjs +18 -0
  78. package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs +242 -0
  79. package/dist/esm/StyleSheet/__tests__/compiler-createReactDOMStyle-test.mjs.map +1 -0
  80. package/dist/esm/StyleSheet/__tests__/compiler-test.mjs +420 -0
  81. package/dist/esm/StyleSheet/__tests__/compiler-test.mjs.map +1 -0
  82. package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs +137 -0
  83. package/dist/esm/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.mjs.map +1 -0
  84. package/dist/esm/StyleSheet/__tests__/index-test.mjs +413 -0
  85. package/dist/esm/StyleSheet/__tests__/index-test.mjs.map +1 -0
  86. package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs +122 -0
  87. package/dist/esm/StyleSheet/__tests__/preprocess-test.mjs.map +1 -0
  88. package/dist/esm/StyleSheet/__tests__/validate-test.mjs +52 -0
  89. package/dist/esm/StyleSheet/__tests__/validate-test.mjs.map +1 -0
  90. package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs +134 -0
  91. package/dist/esm/StyleSheet/compiler/createReactDOMStyle.mjs.map +1 -0
  92. package/dist/esm/StyleSheet/compiler/hash.mjs +3 -0
  93. package/dist/esm/StyleSheet/compiler/hash.mjs.map +1 -0
  94. package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs +15 -0
  95. package/dist/esm/StyleSheet/compiler/hyphenateStyleName.mjs.map +1 -0
  96. package/dist/esm/StyleSheet/compiler/index.mjs +351 -0
  97. package/dist/esm/StyleSheet/compiler/index.mjs.map +1 -0
  98. package/dist/esm/StyleSheet/compiler/normalizeColor.mjs +11 -0
  99. package/dist/esm/StyleSheet/compiler/normalizeColor.mjs.map +1 -0
  100. package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs +25 -0
  101. package/dist/esm/StyleSheet/compiler/normalizeValueWithProperty.mjs.map +1 -0
  102. package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs +27 -0
  103. package/dist/esm/StyleSheet/compiler/resolveShadowValue.mjs.map +1 -0
  104. package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs +27 -0
  105. package/dist/esm/StyleSheet/dom/createCSSStyleSheet.mjs.map +1 -0
  106. package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs +110 -0
  107. package/dist/esm/StyleSheet/dom/createOrderedCSSStyleSheet.mjs.map +1 -0
  108. package/dist/esm/StyleSheet/dom/index.mjs +64 -0
  109. package/dist/esm/StyleSheet/dom/index.mjs.map +1 -0
  110. package/dist/esm/StyleSheet/index.mjs +38 -0
  111. package/dist/esm/StyleSheet/index.mjs.map +1 -0
  112. package/dist/esm/StyleSheet/preprocess.mjs +86 -0
  113. package/dist/esm/StyleSheet/preprocess.mjs.map +1 -0
  114. package/dist/esm/StyleSheet/validate.mjs +67 -0
  115. package/dist/esm/StyleSheet/validate.mjs.map +1 -0
  116. package/dist/esm/TextAncestorContext.mjs +4 -0
  117. package/dist/esm/TextAncestorContext.mjs.map +1 -0
  118. package/dist/esm/colorProps.mjs +14 -0
  119. package/dist/esm/colorProps.mjs.map +1 -0
  120. package/dist/esm/index.js +45 -0
  121. package/dist/esm/index.js.map +1 -0
  122. package/dist/esm/index.mjs +45 -0
  123. package/dist/esm/index.mjs.map +1 -0
  124. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs +34 -0
  125. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.mjs.map +1 -0
  126. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs +23 -0
  127. package/dist/esm/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.mjs.map +1 -0
  128. package/dist/esm/modules/AccessibilityUtil/index.mjs +10 -0
  129. package/dist/esm/modules/AccessibilityUtil/index.mjs.map +1 -0
  130. package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs +3 -0
  131. package/dist/esm/modules/AccessibilityUtil/isDisabled.mjs.map +1 -0
  132. package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs +39 -0
  133. package/dist/esm/modules/AccessibilityUtil/propsToAccessibilityComponent.mjs.map +1 -0
  134. package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs +26 -0
  135. package/dist/esm/modules/AccessibilityUtil/propsToAriaRole.mjs.map +1 -0
  136. package/dist/esm/modules/AssetRegistry/index.mjs +9 -0
  137. package/dist/esm/modules/AssetRegistry/index.mjs.map +1 -0
  138. package/dist/esm/modules/ImageLoader/index.mjs +131 -0
  139. package/dist/esm/modules/ImageLoader/index.mjs.map +1 -0
  140. package/dist/esm/modules/InteractionManager.mjs +215 -0
  141. package/dist/esm/modules/InteractionManager.mjs.map +1 -0
  142. package/dist/esm/modules/Platform/__tests__/index-test.mjs +33 -0
  143. package/dist/esm/modules/Platform/__tests__/index-test.mjs.map +1 -0
  144. package/dist/esm/modules/Platform/index.mjs +7 -0
  145. package/dist/esm/modules/Platform/index.mjs.map +1 -0
  146. package/dist/esm/modules/TextInputState/index.mjs +45 -0
  147. package/dist/esm/modules/TextInputState/index.mjs.map +1 -0
  148. package/dist/esm/modules/UIManager/__tests__/index-test.mjs +88 -0
  149. package/dist/esm/modules/UIManager/__tests__/index-test.mjs.map +1 -0
  150. package/dist/esm/modules/UIManager/index.mjs +40 -0
  151. package/dist/esm/modules/UIManager/index.mjs.map +1 -0
  152. package/dist/esm/modules/canUseDOM.mjs +3 -0
  153. package/dist/esm/modules/canUseDOM.mjs.map +1 -0
  154. package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs +154 -0
  155. package/dist/esm/modules/createDOMProps/__tests__/index-test.mjs.map +1 -0
  156. package/dist/esm/modules/createDOMProps/index.mjs +361 -0
  157. package/dist/esm/modules/createDOMProps/index.mjs.map +1 -0
  158. package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs +399 -0
  159. package/dist/esm/modules/createEventHandle/__tests__/index-test.mjs.map +1 -0
  160. package/dist/esm/modules/createEventHandle/index.mjs +61 -0
  161. package/dist/esm/modules/createEventHandle/index.mjs.map +1 -0
  162. package/dist/esm/modules/dismissKeyboard/index.mjs +6 -0
  163. package/dist/esm/modules/dismissKeyboard/index.mjs.map +1 -0
  164. package/dist/esm/modules/forwardedProps/index.mjs +128 -0
  165. package/dist/esm/modules/forwardedProps/index.mjs.map +1 -0
  166. package/dist/esm/modules/getBoundingClientRect/index.mjs +10 -0
  167. package/dist/esm/modules/getBoundingClientRect/index.mjs.map +1 -0
  168. package/dist/esm/modules/invariant.mjs +16 -0
  169. package/dist/esm/modules/invariant.mjs.map +1 -0
  170. package/dist/esm/modules/isSelectionValid/index.mjs +11 -0
  171. package/dist/esm/modules/isSelectionValid/index.mjs.map +1 -0
  172. package/dist/esm/modules/isWebColor/index.mjs +3 -0
  173. package/dist/esm/modules/isWebColor/index.mjs.map +1 -0
  174. package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs +25 -0
  175. package/dist/esm/modules/mergeRefs/__tests__/index-test.mjs.map +1 -0
  176. package/dist/esm/modules/mergeRefs/index.mjs +20 -0
  177. package/dist/esm/modules/mergeRefs/index.mjs.map +1 -0
  178. package/dist/esm/modules/modality/__tests__/index-test.mjs +60 -0
  179. package/dist/esm/modules/modality/__tests__/index-test.mjs.map +1 -0
  180. package/dist/esm/modules/modality/index.mjs +184 -0
  181. package/dist/esm/modules/modality/index.mjs.map +1 -0
  182. package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs +15 -0
  183. package/dist/esm/modules/multiplyStyleLengthValue/__tests__/index-test.mjs.map +1 -0
  184. package/dist/esm/modules/multiplyStyleLengthValue/index.mjs +16 -0
  185. package/dist/esm/modules/multiplyStyleLengthValue/index.mjs.map +1 -0
  186. package/dist/esm/modules/normalizeColor/index.mjs +19 -0
  187. package/dist/esm/modules/normalizeColor/index.mjs.map +1 -0
  188. package/dist/esm/modules/pick/index.mjs +13 -0
  189. package/dist/esm/modules/pick/index.mjs.map +1 -0
  190. package/dist/esm/modules/processColor/__tests__/index-test.mjs +62 -0
  191. package/dist/esm/modules/processColor/__tests__/index-test.mjs.map +1 -0
  192. package/dist/esm/modules/processColor/index.mjs +14 -0
  193. package/dist/esm/modules/processColor/index.mjs.map +1 -0
  194. package/dist/esm/modules/requestIdleCallback/index.mjs +20 -0
  195. package/dist/esm/modules/requestIdleCallback/index.mjs.map +1 -0
  196. package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs +30 -0
  197. package/dist/esm/modules/setValueForStyles/dangerousStyleValue.mjs.map +1 -0
  198. package/dist/esm/modules/setValueForStyles/index.mjs +21 -0
  199. package/dist/esm/modules/setValueForStyles/index.mjs.map +1 -0
  200. package/dist/esm/modules/unitlessNumbers/index.mjs +64 -0
  201. package/dist/esm/modules/unitlessNumbers/index.mjs.map +1 -0
  202. package/dist/esm/modules/useElementLayout/index.mjs +19 -0
  203. package/dist/esm/modules/useElementLayout/index.mjs.map +1 -0
  204. package/dist/esm/modules/useEvent/__tests__/index-test.mjs +467 -0
  205. package/dist/esm/modules/useEvent/__tests__/index-test.mjs.map +1 -0
  206. package/dist/esm/modules/useEvent/index.mjs +32 -0
  207. package/dist/esm/modules/useEvent/index.mjs.map +1 -0
  208. package/dist/esm/modules/useHover/__tests__/index-test.mjs +359 -0
  209. package/dist/esm/modules/useHover/__tests__/index-test.mjs.map +1 -0
  210. package/dist/esm/modules/useHover/index.mjs +115 -0
  211. package/dist/esm/modules/useHover/index.mjs.map +1 -0
  212. package/dist/esm/modules/useLayoutEffect/index.mjs +5 -0
  213. package/dist/esm/modules/useLayoutEffect/index.mjs.map +1 -0
  214. package/dist/esm/modules/useLocale/index.mjs +31 -0
  215. package/dist/esm/modules/useLocale/index.mjs.map +1 -0
  216. package/dist/esm/modules/useLocale/isLocaleRTL.mjs +63 -0
  217. package/dist/esm/modules/useLocale/isLocaleRTL.mjs.map +1 -0
  218. package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs +102 -0
  219. package/dist/esm/modules/useMergeRefs/__tests__/index-test.mjs.map +1 -0
  220. package/dist/esm/modules/useMergeRefs/index.mjs +9 -0
  221. package/dist/esm/modules/useMergeRefs/index.mjs.map +1 -0
  222. package/dist/esm/modules/usePlatformMethods/index.mjs +17 -0
  223. package/dist/esm/modules/usePlatformMethods/index.mjs.map +1 -0
  224. package/dist/esm/modules/useStable/__tests__/index-test.mjs +99 -0
  225. package/dist/esm/modules/useStable/__tests__/index-test.mjs.map +1 -0
  226. package/dist/esm/modules/useStable/index.mjs +11 -0
  227. package/dist/esm/modules/useStable/index.mjs.map +1 -0
  228. package/dist/esm/styleTypes.mjs +2 -0
  229. package/dist/esm/styleTypes.mjs.map +1 -0
  230. package/dist/esm/types.mjs +2 -0
  231. package/dist/esm/types.mjs.map +1 -0
  232. package/package.json +58 -0
  233. package/src/StyleSheet/__tests__/compiler-createReactDOMStyle-test.tsx +236 -0
  234. package/src/StyleSheet/__tests__/compiler-test.tsx +426 -0
  235. package/src/StyleSheet/__tests__/dom-createOrderedCSSStyleSheet-test.tsx +169 -0
  236. package/src/StyleSheet/__tests__/index-test.tsx +406 -0
  237. package/src/StyleSheet/__tests__/preprocess-test.tsx +107 -0
  238. package/src/StyleSheet/__tests__/validate-test.tsx +42 -0
  239. package/src/StyleSheet/compiler/createReactDOMStyle.tsx +215 -0
  240. package/src/StyleSheet/compiler/hash.tsx +1 -0
  241. package/src/StyleSheet/compiler/hyphenateStyleName.tsx +25 -0
  242. package/src/StyleSheet/compiler/index.tsx +478 -0
  243. package/src/StyleSheet/compiler/normalizeColor.tsx +35 -0
  244. package/src/StyleSheet/compiler/normalizeValueWithProperty.tsx +34 -0
  245. package/src/StyleSheet/compiler/resolveShadowValue.tsx +26 -0
  246. package/src/StyleSheet/dom/createCSSStyleSheet.tsx +42 -0
  247. package/src/StyleSheet/dom/createOrderedCSSStyleSheet.tsx +195 -0
  248. package/src/StyleSheet/dom/index.tsx +92 -0
  249. package/src/StyleSheet/index.tsx +99 -0
  250. package/src/StyleSheet/preprocess.tsx +119 -0
  251. package/src/StyleSheet/validate.tsx +90 -0
  252. package/src/TextAncestorContext.tsx +13 -0
  253. package/src/colorProps.tsx +12 -0
  254. package/src/index.tsx +58 -0
  255. package/src/modules/AccessibilityUtil/__tests__/propsToAccessibilityComponent-test.tsx +44 -0
  256. package/src/modules/AccessibilityUtil/__tests__/propsToAriaRole-test.tsx +25 -0
  257. package/src/modules/AccessibilityUtil/index.tsx +18 -0
  258. package/src/modules/AccessibilityUtil/isDisabled.tsx +13 -0
  259. package/src/modules/AccessibilityUtil/propsToAccessibilityComponent.tsx +54 -0
  260. package/src/modules/AccessibilityUtil/propsToAriaRole.tsx +37 -0
  261. package/src/modules/AssetRegistry/index.tsx +32 -0
  262. package/src/modules/ImageLoader/index.tsx +165 -0
  263. package/src/modules/InteractionManager.tsx +315 -0
  264. package/src/modules/Platform/__tests__/index-test.tsx +45 -0
  265. package/src/modules/Platform/index.tsx +15 -0
  266. package/src/modules/TextInputState/index.tsx +62 -0
  267. package/src/modules/UIManager/__tests__/index-test.tsx +87 -0
  268. package/src/modules/UIManager/index.tsx +68 -0
  269. package/src/modules/canUseDOM.tsx +14 -0
  270. package/src/modules/createDOMProps/__tests__/index-test.tsx +138 -0
  271. package/src/modules/createDOMProps/index.tsx +436 -0
  272. package/src/modules/createEventHandle/__tests__/index-test.tsx +459 -0
  273. package/src/modules/createEventHandle/index.tsx +100 -0
  274. package/src/modules/dismissKeyboard/index.tsx +14 -0
  275. package/src/modules/forwardedProps/index.tsx +145 -0
  276. package/src/modules/getBoundingClientRect/index.tsx +17 -0
  277. package/src/modules/invariant.ts +23 -0
  278. package/src/modules/isSelectionValid/index.tsx +20 -0
  279. package/src/modules/isWebColor/index.tsx +14 -0
  280. package/src/modules/mergeRefs/__tests__/index-test.tsx +32 -0
  281. package/src/modules/mergeRefs/index.tsx +36 -0
  282. package/src/modules/modality/__tests__/index-test.tsx +66 -0
  283. package/src/modules/modality/index.tsx +228 -0
  284. package/src/modules/multiplyStyleLengthValue/__tests__/index-test.tsx +23 -0
  285. package/src/modules/multiplyStyleLengthValue/index.tsx +26 -0
  286. package/src/modules/normalizeColor/index.tsx +32 -0
  287. package/src/modules/pick/index.tsx +25 -0
  288. package/src/modules/processColor/__tests__/index-test.tsx +78 -0
  289. package/src/modules/processColor/index.tsx +28 -0
  290. package/src/modules/requestIdleCallback/index.tsx +35 -0
  291. package/src/modules/setValueForStyles/dangerousStyleValue.tsx +74 -0
  292. package/src/modules/setValueForStyles/index.tsx +39 -0
  293. package/src/modules/unitlessNumbers/index.tsx +77 -0
  294. package/src/modules/useElementLayout/index.tsx +28 -0
  295. package/src/modules/useEvent/__tests__/index-test.tsx +511 -0
  296. package/src/modules/useEvent/index.tsx +64 -0
  297. package/src/modules/useHover/__tests__/index-test.tsx +342 -0
  298. package/src/modules/useHover/index.tsx +181 -0
  299. package/src/modules/useLayoutEffect/index.ts +15 -0
  300. package/src/modules/useLocale/index.tsx +57 -0
  301. package/src/modules/useLocale/isLocaleRTL.tsx +74 -0
  302. package/src/modules/useMergeRefs/__tests__/index-test.tsx +91 -0
  303. package/src/modules/useMergeRefs/index.tsx +22 -0
  304. package/src/modules/usePlatformMethods/index.tsx +40 -0
  305. package/src/modules/useStable/__tests__/index-test.tsx +101 -0
  306. package/src/modules/useStable/index.tsx +24 -0
  307. package/src/styleTypes.ts +321 -0
  308. package/src/types.ts +77 -0
  309. package/types/StyleSheet/compiler/createReactDOMStyle.d.ts +18 -0
  310. package/types/StyleSheet/compiler/createReactDOMStyle.d.ts.map +1 -0
  311. package/types/StyleSheet/compiler/hash.d.ts +2 -0
  312. package/types/StyleSheet/compiler/hash.d.ts.map +1 -0
  313. package/types/StyleSheet/compiler/hyphenateStyleName.d.ts +10 -0
  314. package/types/StyleSheet/compiler/hyphenateStyleName.d.ts.map +1 -0
  315. package/types/StyleSheet/compiler/index.d.ts +39 -0
  316. package/types/StyleSheet/compiler/index.d.ts.map +1 -0
  317. package/types/StyleSheet/compiler/normalizeColor.d.ts +10 -0
  318. package/types/StyleSheet/compiler/normalizeColor.d.ts.map +1 -0
  319. package/types/StyleSheet/compiler/normalizeValueWithProperty.d.ts +10 -0
  320. package/types/StyleSheet/compiler/normalizeValueWithProperty.d.ts.map +1 -0
  321. package/types/StyleSheet/compiler/resolveShadowValue.d.ts +10 -0
  322. package/types/StyleSheet/compiler/resolveShadowValue.d.ts.map +1 -0
  323. package/types/StyleSheet/dom/createCSSStyleSheet.d.ts +10 -0
  324. package/types/StyleSheet/dom/createCSSStyleSheet.d.ts.map +1 -0
  325. package/types/StyleSheet/dom/createOrderedCSSStyleSheet.d.ts +29 -0
  326. package/types/StyleSheet/dom/createOrderedCSSStyleSheet.d.ts.map +1 -0
  327. package/types/StyleSheet/dom/index.d.ts +15 -0
  328. package/types/StyleSheet/dom/index.d.ts.map +1 -0
  329. package/types/StyleSheet/index.d.ts +69 -0
  330. package/types/StyleSheet/index.d.ts.map +1 -0
  331. package/types/StyleSheet/preprocess.d.ts +16 -0
  332. package/types/StyleSheet/preprocess.d.ts.map +1 -0
  333. package/types/StyleSheet/validate.d.ts +10 -0
  334. package/types/StyleSheet/validate.d.ts.map +1 -0
  335. package/types/TextAncestorContext.d.ts +11 -0
  336. package/types/TextAncestorContext.d.ts.map +1 -0
  337. package/types/colorProps.d.ts +13 -0
  338. package/types/colorProps.d.ts.map +1 -0
  339. package/types/index.d.ts +45 -0
  340. package/types/index.d.ts.map +1 -0
  341. package/types/modules/AccessibilityUtil/index.d.ts +16 -0
  342. package/types/modules/AccessibilityUtil/index.d.ts.map +1 -0
  343. package/types/modules/AccessibilityUtil/isDisabled.d.ts +10 -0
  344. package/types/modules/AccessibilityUtil/isDisabled.d.ts.map +1 -0
  345. package/types/modules/AccessibilityUtil/propsToAccessibilityComponent.d.ts +10 -0
  346. package/types/modules/AccessibilityUtil/propsToAccessibilityComponent.d.ts.map +1 -0
  347. package/types/modules/AccessibilityUtil/propsToAriaRole.d.ts +12 -0
  348. package/types/modules/AccessibilityUtil/propsToAriaRole.d.ts.map +1 -0
  349. package/types/modules/AssetRegistry/index.d.ts +22 -0
  350. package/types/modules/AssetRegistry/index.d.ts.map +1 -0
  351. package/types/modules/ImageLoader/index.d.ts +27 -0
  352. package/types/modules/ImageLoader/index.d.ts.map +1 -0
  353. package/types/modules/InteractionManager.d.ts +48 -0
  354. package/types/modules/InteractionManager.d.ts.map +1 -0
  355. package/types/modules/Platform/index.d.ts +15 -0
  356. package/types/modules/Platform/index.d.ts.map +1 -0
  357. package/types/modules/TextInputState/index.d.ts +38 -0
  358. package/types/modules/TextInputState/index.d.ts.map +1 -0
  359. package/types/modules/UIManager/index.d.ts +23 -0
  360. package/types/modules/UIManager/index.d.ts.map +1 -0
  361. package/types/modules/canUseDOM.d.ts +10 -0
  362. package/types/modules/canUseDOM.d.ts.map +1 -0
  363. package/types/modules/createDOMProps/index.d.ts +12 -0
  364. package/types/modules/createDOMProps/index.d.ts.map +1 -0
  365. package/types/modules/createEventHandle/index.d.ts +20 -0
  366. package/types/modules/createEventHandle/index.d.ts.map +1 -0
  367. package/types/modules/dismissKeyboard/index.d.ts +10 -0
  368. package/types/modules/dismissKeyboard/index.d.ts.map +1 -0
  369. package/types/modules/forwardedProps/index.d.ts +383 -0
  370. package/types/modules/forwardedProps/index.d.ts.map +1 -0
  371. package/types/modules/getBoundingClientRect/index.d.ts +10 -0
  372. package/types/modules/getBoundingClientRect/index.d.ts.map +1 -0
  373. package/types/modules/invariant.d.ts +3 -0
  374. package/types/modules/invariant.d.ts.map +1 -0
  375. package/types/modules/isSelectionValid/index.d.ts +10 -0
  376. package/types/modules/isSelectionValid/index.d.ts.map +1 -0
  377. package/types/modules/isWebColor/index.d.ts +10 -0
  378. package/types/modules/isWebColor/index.d.ts.map +1 -0
  379. package/types/modules/mergeRefs/index.d.ts +11 -0
  380. package/types/modules/mergeRefs/index.d.ts.map +1 -0
  381. package/types/modules/modality/index.d.ts +17 -0
  382. package/types/modules/modality/index.d.ts.map +1 -0
  383. package/types/modules/multiplyStyleLengthValue/index.d.ts +10 -0
  384. package/types/modules/multiplyStyleLengthValue/index.d.ts.map +1 -0
  385. package/types/modules/normalizeColor/index.d.ts +10 -0
  386. package/types/modules/normalizeColor/index.d.ts.map +1 -0
  387. package/types/modules/pick/index.d.ts +12 -0
  388. package/types/modules/pick/index.d.ts.map +1 -0
  389. package/types/modules/processColor/index.d.ts +11 -0
  390. package/types/modules/processColor/index.d.ts.map +1 -0
  391. package/types/modules/requestIdleCallback/index.d.ts +3 -0
  392. package/types/modules/requestIdleCallback/index.d.ts.map +1 -0
  393. package/types/modules/setValueForStyles/dangerousStyleValue.d.ts +11 -0
  394. package/types/modules/setValueForStyles/dangerousStyleValue.d.ts.map +1 -0
  395. package/types/modules/setValueForStyles/index.d.ts +9 -0
  396. package/types/modules/setValueForStyles/index.d.ts.map +1 -0
  397. package/types/modules/unitlessNumbers/index.d.ts +60 -0
  398. package/types/modules/unitlessNumbers/index.d.ts.map +1 -0
  399. package/types/modules/useElementLayout/index.d.ts +4 -0
  400. package/types/modules/useElementLayout/index.d.ts.map +1 -0
  401. package/types/modules/useEvent/index.d.ts +24 -0
  402. package/types/modules/useEvent/index.d.ts.map +1 -0
  403. package/types/modules/useHover/index.d.ts +21 -0
  404. package/types/modules/useHover/index.d.ts.map +1 -0
  405. package/types/modules/useLayoutEffect/index.d.ts +13 -0
  406. package/types/modules/useLayoutEffect/index.d.ts.map +1 -0
  407. package/types/modules/useLocale/index.d.ts +14 -0
  408. package/types/modules/useLocale/index.d.ts.map +1 -0
  409. package/types/modules/useLocale/isLocaleRTL.d.ts +13 -0
  410. package/types/modules/useLocale/isLocaleRTL.d.ts.map +1 -0
  411. package/types/modules/useMergeRefs/index.d.ts +11 -0
  412. package/types/modules/useMergeRefs/index.d.ts.map +1 -0
  413. package/types/modules/usePlatformMethods/index.d.ts +18 -0
  414. package/types/modules/usePlatformMethods/index.d.ts.map +1 -0
  415. package/types/modules/useStable/index.d.ts +10 -0
  416. package/types/modules/useStable/index.d.ts.map +1 -0
  417. package/types/styleTypes.d.ts +211 -0
  418. package/types/styleTypes.d.ts.map +1 -0
  419. package/types/types.d.ts +46 -0
  420. package/types/types.d.ts.map +1 -0
@@ -0,0 +1,88 @@
1
+ import UIManager from "../index.mjs";
2
+ const createStyledNode = (name = "div", style = {}) => {
3
+ const root = document.createElement(name);
4
+ Object.keys(style).forEach(prop => {
5
+ root.style[prop] = style[prop];
6
+ });
7
+ return root;
8
+ };
9
+ const componentStub = {
10
+ _reactInternalInstance: {
11
+ _currentElement: {
12
+ _owner: {}
13
+ },
14
+ _debugID: 1
15
+ }
16
+ };
17
+ describe("apis/UIManager", () => {
18
+ describe("focus", () => {
19
+ test('sets tabIndex="-1" on elements not programmatically focusable by default', () => {
20
+ const node = createStyledNode();
21
+ UIManager.focus(node);
22
+ expect(node.getAttribute("tabIndex")).toEqual("-1");
23
+ });
24
+ test(`doesn't set tabIndex="-1" on elements with an existing tabIndex`, () => {
25
+ const node = createStyledNode();
26
+ node.tabIndex = 0;
27
+ UIManager.focus(node);
28
+ expect(node.getAttribute("tabIndex")).toEqual("0");
29
+ });
30
+ test(`doesn't set tabIndex="-1" on elements focusable by default`, () => {
31
+ ;
32
+ ["a", "input", "select", "textarea"].forEach(name => {
33
+ const node = createStyledNode(name);
34
+ UIManager.focus(node);
35
+ expect(node.getAttribute("tabIndex")).toBeNull();
36
+ });
37
+ });
38
+ });
39
+ describe("updateView", () => {
40
+ test("supports className alias for class", () => {
41
+ const node = createStyledNode();
42
+ const props = {
43
+ className: "extra"
44
+ };
45
+ UIManager.updateView(node, props, componentStub);
46
+ expect(node.getAttribute("class")).toEqual("extra");
47
+ });
48
+ test("adds correct DOM styles to existing style", () => {
49
+ const node = createStyledNode("div", {
50
+ color: "red"
51
+ });
52
+ const props = {
53
+ style: {
54
+ marginTop: 0,
55
+ marginBottom: 0,
56
+ opacity: 0
57
+ }
58
+ };
59
+ UIManager.updateView(node, props, componentStub);
60
+ expect(node.getAttribute("style")).toEqual("color: red; margin-top: 0px; margin-bottom: 0px; opacity: 0;");
61
+ });
62
+ test("replaces input and textarea text", () => {
63
+ const node = createStyledNode("textarea");
64
+ node.value = "initial";
65
+ const textProp = {
66
+ text: "expected-text"
67
+ };
68
+ const valueProp = {
69
+ value: "expected-value"
70
+ };
71
+ UIManager.updateView(node, textProp);
72
+ expect(node.value).toEqual("expected-text");
73
+ UIManager.updateView(node, valueProp);
74
+ expect(node.value).toEqual("expected-value");
75
+ });
76
+ test("sets other attribute values", () => {
77
+ const node = createStyledNode();
78
+ const props = {
79
+ "aria-level": "4",
80
+ "data-of-type": "string"
81
+ };
82
+ UIManager.updateView(node, props);
83
+ expect(node.getAttribute("aria-level")).toEqual("4");
84
+ expect(node.getAttribute("data-of-type")).toEqual("string");
85
+ });
86
+ });
87
+ });
88
+ //# sourceMappingURL=index-test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UIManager","createStyledNode","name","style","root","document","createElement","Object","keys","forEach","prop","componentStub","_reactInternalInstance","_currentElement","_owner","_debugID","describe","test","node","focus","expect","getAttribute","toEqual","tabIndex","toBeNull","props","className","updateView","color","marginTop","marginBottom","opacity","value","textProp","text","valueProp"],"sources":["../../../../../src/modules/UIManager/__tests__/index-test.tsx"],"sourcesContent":[null],"mappings":"AAOA,OAAOA,SAAA,MAAe;AAEtB,MAAMC,gBAAA,GAAmBA,CAACC,IAAA,GAAO,OAAOC,KAAA,GAAQ,CAAC,MAAM;EACrD,MAAMC,IAAA,GAAOC,QAAA,CAASC,aAAA,CAAcJ,IAAI;EACxCK,MAAA,CAAOC,IAAA,CAAKL,KAAK,EAAEM,OAAA,CAASC,IAAA,IAAS;IACnCN,IAAA,CAAKD,KAAA,CAAMO,IAAI,IAAIP,KAAA,CAAMO,IAAI;EAC/B,CAAC;EACD,OAAON,IAAA;AACT;AAEA,MAAMO,aAAA,GAAgB;EACpBC,sBAAA,EAAwB;IACtBC,eAAA,EAAiB;MAAEC,MAAA,EAAQ,CAAC;IAAE;IAC9BC,QAAA,EAAU;EACZ;AACF;AAEAC,QAAA,CAAS,kBAAkB,MAAM;EAC/BA,QAAA,CAAS,SAAS,MAAM;IACtBC,IAAA,CAAK,4EAA4E,MAAM;MACrF,MAAMC,IAAA,GAAOjB,gBAAA,CAAiB;MAC9BD,SAAA,CAAUmB,KAAA,CAAMD,IAAI;MACpBE,MAAA,CAAOF,IAAA,CAAKG,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,KAAA,EAAOd,aAAa;MAC/CS,MAAA,CAAOF,IAAA,CAAKG,YAAA,CAAa,OAAO,CAAC,EAAEC,OAAA,CACjC,8DACF;IACF,CAAC;IAEDL,IAAA,CAAK,oCAAoC,MAAM;MAC7C,MAAMC,IAAA,GAAOjB,gBAAA,CAAiB,UAAU;MACxCiB,IAAA,CAAKc,KAAA,GAAQ;MACb,MAAMC,QAAA,GAAW;QAAEC,IAAA,EAAM;MAAgB;MACzC,MAAMC,SAAA,GAAY;QAAEH,KAAA,EAAO;MAAiB;MAE5ChC,SAAA,CAAU2B,UAAA,CAAWT,IAAA,EAAMe,QAAQ;MACnCb,MAAA,CAAOF,IAAA,CAAKc,KAAK,EAAEV,OAAA,CAAQ,eAAe;MAE1CtB,SAAA,CAAU2B,UAAA,CAAWT,IAAA,EAAMiB,SAAS;MACpCf,MAAA,CAAOF,IAAA,CAAKc,KAAK,EAAEV,OAAA,CAAQ,gBAAgB;IAC7C,CAAC;IAEDL,IAAA,CAAK,+BAA+B,MAAM;MACxC,MAAMC,IAAA,GAAOjB,gBAAA,CAAiB;MAC9B,MAAMwB,KAAA,GAAQ;QAAE,cAAc;QAAK,gBAAgB;MAAS;MAC5DzB,SAAA,CAAU2B,UAAA,CAAWT,IAAA,EAAMO,KAAK;MAChCL,MAAA,CAAOF,IAAA,CAAKG,YAAA,CAAa,YAAY,CAAC,EAAEC,OAAA,CAAQ,GAAG;MACnDF,MAAA,CAAOF,IAAA,CAAKG,YAAA,CAAa,cAAc,CAAC,EAAEC,OAAA,CAAQ,QAAQ;IAC5D,CAAC;EACH,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ import { measure, measureInWindow } from "@hanzogui/use-element-layout";
2
+ const focusableElements = {
3
+ A: true,
4
+ INPUT: true,
5
+ SELECT: true,
6
+ TEXTAREA: true
7
+ };
8
+ const UIManager = {
9
+ blur(node) {
10
+ try {
11
+ node.blur();
12
+ } catch (err) {}
13
+ },
14
+ focus(node) {
15
+ try {
16
+ const name = node.nodeName;
17
+ if (node.getAttribute("tabIndex") == null && focusableElements[name] == null) {
18
+ node.setAttribute("tabIndex", "-1");
19
+ }
20
+ node.focus();
21
+ } catch (err) {}
22
+ },
23
+ measure(node, callback) {
24
+ return measure(node, callback);
25
+ },
26
+ measureInWindow(node, callback) {
27
+ return measureInWindow(node, callback);
28
+ },
29
+ // note its flipped fail and success on purpose lol
30
+ async measureLayout(node, relativeToNativeNode, onFail, onSuccess) {
31
+ return measureLayout(node, relativeToNativeNode, onSuccess);
32
+ },
33
+ configureNextLayoutAnimation(config, onAnimationDidEnd) {
34
+ onAnimationDidEnd();
35
+ },
36
+ // mocks
37
+ setLayoutAnimationEnabledExperimental() {}
38
+ };
39
+ export { UIManager };
40
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["measure","measureInWindow","focusableElements","A","INPUT","SELECT","TEXTAREA","UIManager","blur","node","err","focus","name","nodeName","getAttribute","setAttribute","callback","measureLayout","relativeToNativeNode","onFail","onSuccess","configureNextLayoutAnimation","config","onAnimationDidEnd","setLayoutAnimationEnabledExperimental"],"sources":["../../../../src/modules/UIManager/index.tsx"],"sourcesContent":[null],"mappings":"AAUA,SAASA,OAAA,EAASC,eAAA,QAAuB;AAEzC,MAAMC,iBAAA,GAAoB;EACxBC,CAAA,EAAG;EACHC,KAAA,EAAO;EACPC,MAAA,EAAQ;EACRC,QAAA,EAAU;AACZ;AAEO,MAAMC,SAAA,GAAY;EACvBC,KAAKC,IAAA,EAAM;IACT,IAAI;MACFA,IAAA,CAAKD,IAAA,CAAK;IACZ,SAASE,GAAA,EAAK,CAEd;EACF;EAEAC,MAAMF,IAAA,EAAM;IACV,IAAI;MACF,MAAMG,IAAA,GAAOH,IAAA,CAAKI,QAAA;MAIlB,IAAIJ,IAAA,CAAKK,YAAA,CAAa,UAAU,KAAK,QAAQZ,iBAAA,CAAkBU,IAAI,KAAK,MAAM;QAC5EH,IAAA,CAAKM,YAAA,CAAa,YAAY,IAAI;MACpC;MACAN,IAAA,CAAKE,KAAA,CAAM;IACb,SAASD,GAAA,EAAK,CAEd;EACF;EAEAV,QAAQS,IAAA,EAAMO,QAAA,EAAU;IACtB,OAAOhB,OAAA,CAAQS,IAAA,EAAMO,QAAQ;EAC/B;EAEAf,gBAAgBQ,IAAA,EAAMO,QAAA,EAAU;IAC9B,OAAOf,eAAA,CAAgBQ,IAAA,EAAMO,QAAQ;EACvC;EAAA;EAGA,MAAMC,cACJR,IAAA,EACAS,oBAAA,EACAC,MAAA,EACAC,SAAA,EACA;IACA,OAAOH,aAAA,CAAcR,IAAA,EAAMS,oBAAA,EAAsBE,SAAS;EAC5D;EAEAC,6BAA6BC,MAAA,EAAQC,iBAAA,EAAmB;IACtDA,iBAAA,CAAkB;EACpB;EAAA;EAGAC,sCAAA,EAAwC,CAAC;AAC3C","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ const canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
2
+ export { canUseDOM };
3
+ //# sourceMappingURL=canUseDOM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["canUseDOM","window","document","createElement"],"sources":["../../../src/modules/canUseDOM.tsx"],"sourcesContent":[null],"mappings":"AASO,MAAMA,SAAA,GAAY,CAAC,EACxB,OAAOC,MAAA,KAAW,eAClBA,MAAA,CAAOC,QAAA,IACPD,MAAA,CAAOC,QAAA,CAASC,aAAA","ignoreList":[]}
@@ -0,0 +1,154 @@
1
+ import createDOMProps from "../index.mjs";
2
+ const createProps = props => createDOMProps(null, props);
3
+ describe("modules/createDOMProps", () => {
4
+ describe("focus-related accessibility attributes", () => {
5
+ test("with no accessibility props", () => {
6
+ expect(createProps({})).toEqual({});
7
+ });
8
+ describe('"accessibilityRole" of "link"', () => {
9
+ const accessibilityRole = "link";
10
+ test("default case", () => {
11
+ expect(createProps({
12
+ accessibilityRole
13
+ })).toEqual(expect.not.objectContaining({
14
+ tabIndex: "-1"
15
+ }));
16
+ });
17
+ test('when "focusable" is true', () => {
18
+ expect(createProps({
19
+ accessibilityRole,
20
+ focusable: true
21
+ })).toEqual(expect.not.objectContaining({
22
+ tabIndex: "-1"
23
+ }));
24
+ });
25
+ test('when "focusable" is false', () => {
26
+ expect(createProps({
27
+ accessibilityRole,
28
+ focusable: false
29
+ })).toEqual(expect.objectContaining({
30
+ tabIndex: "-1"
31
+ }));
32
+ });
33
+ test('when "accessibilityDisabled" is true', () => {
34
+ expect(createProps({
35
+ accessibilityRole,
36
+ accessibilityDisabled: true
37
+ })).toEqual(expect.objectContaining({
38
+ "aria-disabled": true
39
+ }));
40
+ });
41
+ test('when "disabled" is false', () => {
42
+ expect(createProps({
43
+ accessibilityRole,
44
+ accessibilityDisabled: false
45
+ })).toEqual(expect.not.objectContaining({
46
+ tabIndex: "-1"
47
+ }));
48
+ });
49
+ });
50
+ const testFocusableRole = accessibilityRole => {
51
+ test("default case", () => {
52
+ expect(createProps({
53
+ accessibilityRole
54
+ })).toEqual(expect.objectContaining({
55
+ tabIndex: "0"
56
+ }));
57
+ });
58
+ test('when "focusable" is true', () => {
59
+ expect(createProps({
60
+ accessibilityRole,
61
+ focusable: true
62
+ })).toEqual(expect.objectContaining({
63
+ tabIndex: "0"
64
+ }));
65
+ });
66
+ test('when "focusable" is false', () => {
67
+ expect(createProps({
68
+ accessibilityRole,
69
+ focusable: false
70
+ })).toEqual(expect.objectContaining({
71
+ tabIndex: "-1"
72
+ }));
73
+ });
74
+ test('when "accessibilityDisabled" is true', () => {
75
+ expect(createProps({
76
+ accessibilityRole,
77
+ accessibilityDisabled: true
78
+ })).toEqual(expect.objectContaining({
79
+ "aria-disabled": true
80
+ }));
81
+ });
82
+ test('when "accessibilityDisabled" is false', () => {
83
+ expect(createProps({
84
+ accessibilityRole,
85
+ accessibilityDisabled: false
86
+ })).toEqual(expect.objectContaining({
87
+ tabIndex: "0"
88
+ }));
89
+ });
90
+ };
91
+ describe('"accessibilityRole" of "button"', () => {
92
+ testFocusableRole("button");
93
+ });
94
+ describe("with unfocusable accessibilityRole", () => {
95
+ test('when "focusable" is true', () => {
96
+ expect(createProps({
97
+ focusable: true
98
+ })).toEqual(expect.objectContaining({
99
+ tabIndex: "0"
100
+ }));
101
+ });
102
+ test('when "focusable" is false', () => {
103
+ expect(createProps({
104
+ focusable: false
105
+ })).toEqual(expect.objectContaining({
106
+ tabIndex: "-1"
107
+ }));
108
+ });
109
+ });
110
+ });
111
+ test('prop "accessibilityLabel" becomes "aria-label"', () => {
112
+ const accessibilityLabel = "accessibilityLabel";
113
+ const props = createProps({
114
+ accessibilityLabel
115
+ });
116
+ expect(props["aria-label"]).toEqual(accessibilityLabel);
117
+ });
118
+ test('prop "accessibilityLiveRegion" becomes "aria-live"', () => {
119
+ const accessibilityLiveRegion = "none";
120
+ const props = createProps({
121
+ accessibilityLiveRegion
122
+ });
123
+ expect(props["aria-live"]).toEqual("off");
124
+ });
125
+ test('prop "accessibilityRole" becomes "role"', () => {
126
+ const accessibilityRole = "button";
127
+ const props = createProps({
128
+ accessibilityRole
129
+ });
130
+ expect(props.role).toEqual("button");
131
+ });
132
+ test('prop "className" is preserved', () => {
133
+ const className = "external-class-name";
134
+ const props = createProps({
135
+ className
136
+ });
137
+ expect(props.className).toEqual(className);
138
+ });
139
+ test('prop "nativeID" becomes "id"', () => {
140
+ const nativeID = "Example.nativeID";
141
+ const props = createProps({
142
+ nativeID
143
+ });
144
+ expect(props.id).toEqual(nativeID);
145
+ });
146
+ test('prop "testID" becomes "data-testid"', () => {
147
+ const testID = "Example.testID";
148
+ const props = createProps({
149
+ testID
150
+ });
151
+ expect(props["data-testid"]).toEqual(testID);
152
+ });
153
+ });
154
+ //# sourceMappingURL=index-test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createDOMProps","createProps","props","describe","test","expect","toEqual","accessibilityRole","not","objectContaining","tabIndex","focusable","accessibilityDisabled","testFocusableRole","accessibilityLabel","accessibilityLiveRegion","role","className","nativeID","id","testID"],"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,CAAC;IAC/CF,MAAA,CAAOH,KAAA,CAAMc,IAAI,EAAEV,OAAA,CAAQ,QAAQ;EACrC,CAAC;EAEDF,IAAA,CAAK,iCAAiC,MAAM;IAC1C,MAAMa,SAAA,GAAY;IAClB,MAAMf,KAAA,GAAQD,WAAA,CAAY;MAAEgB;IAAU,CAAC;IACvCZ,MAAA,CAAOH,KAAA,CAAMe,SAAS,EAAEX,OAAA,CAAQW,SAAS;EAC3C,CAAC;EAEDb,IAAA,CAAK,gCAAgC,MAAM;IACzC,MAAMc,QAAA,GAAW;IACjB,MAAMhB,KAAA,GAAQD,WAAA,CAAY;MAAEiB;IAAS,CAAC;IACtCb,MAAA,CAAOH,KAAA,CAAMiB,EAAE,EAAEb,OAAA,CAAQY,QAAQ;EACnC,CAAC;EAEDd,IAAA,CAAK,uCAAuC,MAAM;IAChD,MAAMgB,MAAA,GAAS;IACf,MAAMlB,KAAA,GAAQD,WAAA,CAAY;MAAEmB;IAAO,CAAC;IACpCf,MAAA,CAAOH,KAAA,CAAM,aAAa,CAAC,EAAEI,OAAA,CAAQc,MAAM;EAC7C,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,361 @@
1
+ import { getCSSStylesAtomic } from "@hanzogui/web";
2
+ import { AccessibilityUtil } from "../AccessibilityUtil/index.mjs";
3
+ const emptyObject = {};
4
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
5
+ const isArray = Array.isArray;
6
+ const reactNativeOnlyProps = {
7
+ collapsable: true,
8
+ contentContainerStyle: true,
9
+ contentOffset: true,
10
+ decelerationRate: true,
11
+ maintainVisibleContentPosition: true,
12
+ onLayout: true,
13
+ onMomentumScrollBegin: true,
14
+ onMomentumScrollEnd: true,
15
+ onMoveShouldSetResponder: true,
16
+ onMoveShouldSetResponderCapture: true,
17
+ onResponderEnd: true,
18
+ onResponderGrant: true,
19
+ onResponderMove: true,
20
+ onResponderReject: true,
21
+ onResponderRelease: true,
22
+ onResponderStart: true,
23
+ onResponderTerminate: true,
24
+ onResponderTerminationRequest: true,
25
+ onScrollBeginDrag: true,
26
+ onScrollEndDrag: true,
27
+ onScrollShouldSetResponder: true,
28
+ onScrollShouldSetResponderCapture: true,
29
+ onSelectionChangeShouldSetResponder: true,
30
+ onSelectionChangeShouldSetResponderCapture: true,
31
+ onStartShouldSetResponder: true,
32
+ onStartShouldSetResponderCapture: true,
33
+ refreshControl: true,
34
+ removeClippedSubviews: true,
35
+ scrollEnabled: true,
36
+ scrollEventThrottle: true,
37
+ scrollIndicatorInsets: true,
38
+ showsHorizontalScrollIndicator: true,
39
+ showsVerticalScrollIndicator: true,
40
+ snapToAlignment: true,
41
+ snapToEnd: true,
42
+ snapToInterval: true,
43
+ snapToOffsets: true,
44
+ snapToStart: true,
45
+ stickyHeaderIndices: true,
46
+ ScrollComponent: true
47
+ };
48
+ const uppercasePattern = /[A-Z]/g;
49
+ function toHyphenLower(match) {
50
+ return "-" + match.toLowerCase();
51
+ }
52
+ function hyphenateString(str) {
53
+ return str.replace(uppercasePattern, toHyphenLower);
54
+ }
55
+ function processIDRefList(idRefList) {
56
+ return isArray(idRefList) ? idRefList.join(" ") : idRefList;
57
+ }
58
+ function flattenStyle(style) {
59
+ if (style === null || typeof style !== "object") {
60
+ return void 0;
61
+ }
62
+ if (!isArray(style)) {
63
+ return style;
64
+ }
65
+ const result = {};
66
+ for (let i = 0, styleLength = style.length; i < styleLength; ++i) {
67
+ const computedStyle = flattenStyle(style[i]);
68
+ if (computedStyle) {
69
+ for (const key in computedStyle) {
70
+ if (hasOwnProperty.call(computedStyle, key)) {
71
+ result[key] = computedStyle[key];
72
+ }
73
+ }
74
+ }
75
+ }
76
+ return result;
77
+ }
78
+ const stylesFromProps = /* @__PURE__ */new WeakMap();
79
+ const createDOMProps = (elementType, props, options) => {
80
+ if (!props) {
81
+ props = emptyObject;
82
+ }
83
+ const {
84
+ accessibilityActiveDescendant,
85
+ accessibilityAtomic,
86
+ accessibilityAutoComplete,
87
+ accessibilityBusy,
88
+ accessibilityChecked,
89
+ accessibilityColumnCount,
90
+ accessibilityColumnIndex,
91
+ accessibilityColumnSpan,
92
+ accessibilityControls,
93
+ accessibilityCurrent,
94
+ accessibilityDescribedBy,
95
+ accessibilityDetails,
96
+ accessibilityDisabled,
97
+ accessibilityErrorMessage,
98
+ accessibilityExpanded,
99
+ accessibilityFlowTo,
100
+ accessibilityHasPopup,
101
+ accessibilityHidden,
102
+ accessibilityInvalid,
103
+ accessibilityKeyShortcuts,
104
+ accessibilityLabel,
105
+ accessibilityLabelledBy,
106
+ accessibilityLevel,
107
+ accessibilityLiveRegion,
108
+ accessibilityModal,
109
+ accessibilityMultiline,
110
+ accessibilityMultiSelectable,
111
+ accessibilityOrientation,
112
+ accessibilityOwns,
113
+ accessibilityPlaceholder,
114
+ accessibilityPosInSet,
115
+ accessibilityPressed,
116
+ accessibilityReadOnly,
117
+ accessibilityRequired,
118
+ /* eslint-disable */
119
+ accessibilityRole,
120
+ /* eslint-enable */
121
+ accessibilityRoleDescription,
122
+ accessibilityRowCount,
123
+ accessibilityRowIndex,
124
+ accessibilityRowSpan,
125
+ accessibilitySelected,
126
+ accessibilitySetSize,
127
+ accessibilitySort,
128
+ accessibilityValueMax,
129
+ accessibilityValueMin,
130
+ accessibilityValueNow,
131
+ accessibilityValueText,
132
+ dataSet,
133
+ focusable,
134
+ nativeID,
135
+ pointerEvents,
136
+ style,
137
+ testID,
138
+ id,
139
+ // Rest
140
+ ...domProps
141
+ } = props;
142
+ for (const key in domProps) {
143
+ if (reactNativeOnlyProps[key]) {
144
+ delete domProps[key];
145
+ }
146
+ }
147
+ const disabled = accessibilityDisabled;
148
+ const role = AccessibilityUtil.propsToAriaRole(props);
149
+ if (accessibilityActiveDescendant != null) {
150
+ domProps["aria-activedescendant"] = accessibilityActiveDescendant;
151
+ }
152
+ if (accessibilityAtomic != null) {
153
+ domProps["aria-atomic"] = accessibilityAtomic;
154
+ }
155
+ if (accessibilityAutoComplete != null) {
156
+ domProps["aria-autocomplete"] = accessibilityAutoComplete;
157
+ }
158
+ if (accessibilityBusy != null) {
159
+ domProps["aria-busy"] = accessibilityBusy;
160
+ }
161
+ if (accessibilityChecked != null) {
162
+ domProps["aria-checked"] = accessibilityChecked;
163
+ }
164
+ if (accessibilityColumnCount != null) {
165
+ domProps["aria-colcount"] = accessibilityColumnCount;
166
+ }
167
+ if (accessibilityColumnIndex != null) {
168
+ domProps["aria-colindex"] = accessibilityColumnIndex;
169
+ }
170
+ if (accessibilityColumnSpan != null) {
171
+ domProps["aria-colspan"] = accessibilityColumnSpan;
172
+ }
173
+ if (accessibilityControls != null) {
174
+ domProps["aria-controls"] = processIDRefList(accessibilityControls);
175
+ }
176
+ if (accessibilityCurrent != null) {
177
+ domProps["aria-current"] = accessibilityCurrent;
178
+ }
179
+ if (accessibilityDescribedBy != null) {
180
+ domProps["aria-describedby"] = processIDRefList(accessibilityDescribedBy);
181
+ }
182
+ if (accessibilityDetails != null) {
183
+ domProps["aria-details"] = accessibilityDetails;
184
+ }
185
+ if (disabled === true) {
186
+ domProps["aria-disabled"] = true;
187
+ if (elementType === "button" || elementType === "form" || elementType === "input" || elementType === "select" || elementType === "textarea") {
188
+ domProps.disabled = true;
189
+ }
190
+ }
191
+ if (accessibilityErrorMessage != null) {
192
+ domProps["aria-errormessage"] = accessibilityErrorMessage;
193
+ }
194
+ if (accessibilityExpanded != null) {
195
+ domProps["aria-expanded"] = accessibilityExpanded;
196
+ }
197
+ if (accessibilityFlowTo != null) {
198
+ domProps["aria-flowto"] = processIDRefList(accessibilityFlowTo);
199
+ }
200
+ if (accessibilityHasPopup != null) {
201
+ domProps["aria-haspopup"] = accessibilityHasPopup;
202
+ }
203
+ if (accessibilityHidden === true) {
204
+ domProps["aria-hidden"] = accessibilityHidden;
205
+ }
206
+ if (accessibilityInvalid != null) {
207
+ domProps["aria-invalid"] = accessibilityInvalid;
208
+ }
209
+ if (accessibilityKeyShortcuts != null && Array.isArray(accessibilityKeyShortcuts)) {
210
+ domProps["aria-keyshortcuts"] = accessibilityKeyShortcuts.join(" ");
211
+ }
212
+ if (accessibilityLabel != null) {
213
+ domProps["aria-label"] = accessibilityLabel;
214
+ }
215
+ if (accessibilityLabelledBy != null) {
216
+ domProps["aria-labelledby"] = processIDRefList(accessibilityLabelledBy);
217
+ }
218
+ if (accessibilityLevel != null) {
219
+ domProps["aria-level"] = accessibilityLevel;
220
+ }
221
+ if (accessibilityLiveRegion != null) {
222
+ domProps["aria-live"] = accessibilityLiveRegion === "none" ? "off" : accessibilityLiveRegion;
223
+ }
224
+ if (accessibilityModal != null) {
225
+ domProps["aria-modal"] = accessibilityModal;
226
+ }
227
+ if (accessibilityMultiline != null) {
228
+ domProps["aria-multiline"] = accessibilityMultiline;
229
+ }
230
+ if (accessibilityMultiSelectable != null) {
231
+ domProps["aria-multiselectable"] = accessibilityMultiSelectable;
232
+ }
233
+ if (accessibilityOrientation != null) {
234
+ domProps["aria-orientation"] = accessibilityOrientation;
235
+ }
236
+ if (accessibilityOwns != null) {
237
+ domProps["aria-owns"] = processIDRefList(accessibilityOwns);
238
+ }
239
+ if (accessibilityPlaceholder != null) {
240
+ domProps["aria-placeholder"] = accessibilityPlaceholder;
241
+ }
242
+ if (accessibilityPosInSet != null) {
243
+ domProps["aria-posinset"] = accessibilityPosInSet;
244
+ }
245
+ if (accessibilityPressed != null) {
246
+ domProps["aria-pressed"] = accessibilityPressed;
247
+ }
248
+ if (accessibilityReadOnly != null) {
249
+ domProps["aria-readonly"] = accessibilityReadOnly;
250
+ if (elementType === "input" || elementType === "select" || elementType === "textarea") {
251
+ domProps.readOnly = true;
252
+ }
253
+ }
254
+ if (accessibilityRequired != null) {
255
+ domProps["aria-required"] = accessibilityRequired;
256
+ if (elementType === "input" || elementType === "select" || elementType === "textarea") {
257
+ domProps.required = true;
258
+ }
259
+ }
260
+ if (role != null) {
261
+ domProps["role"] = role === "none" ? "presentation" : role;
262
+ }
263
+ if (accessibilityRoleDescription != null) {
264
+ domProps["aria-roledescription"] = accessibilityRoleDescription;
265
+ }
266
+ if (accessibilityRowCount != null) {
267
+ domProps["aria-rowcount"] = accessibilityRowCount;
268
+ }
269
+ if (accessibilityRowIndex != null) {
270
+ domProps["aria-rowindex"] = accessibilityRowIndex;
271
+ }
272
+ if (accessibilityRowSpan != null) {
273
+ domProps["aria-rowspan"] = accessibilityRowSpan;
274
+ }
275
+ if (accessibilitySelected != null) {
276
+ domProps["aria-selected"] = accessibilitySelected;
277
+ }
278
+ if (accessibilitySetSize != null) {
279
+ domProps["aria-setsize"] = accessibilitySetSize;
280
+ }
281
+ if (accessibilitySort != null) {
282
+ domProps["aria-sort"] = accessibilitySort;
283
+ }
284
+ if (accessibilityValueMax != null) {
285
+ domProps["aria-valuemax"] = accessibilityValueMax;
286
+ }
287
+ if (accessibilityValueMin != null) {
288
+ domProps["aria-valuemin"] = accessibilityValueMin;
289
+ }
290
+ if (accessibilityValueNow != null) {
291
+ domProps["aria-valuenow"] = accessibilityValueNow;
292
+ }
293
+ if (accessibilityValueText != null) {
294
+ domProps["aria-valuetext"] = accessibilityValueText;
295
+ }
296
+ const tmgCN = dataSet ? dataSet.className : void 0;
297
+ const tmgID = dataSet ? dataSet.id : void 0;
298
+ if (dataSet != null) {
299
+ for (const dataProp in dataSet) {
300
+ if (dataProp === "className" || dataProp === "id") continue;
301
+ if (hasOwnProperty.call(dataSet, dataProp)) {
302
+ const dataName = hyphenateString(dataProp);
303
+ const dataValue = dataSet[dataProp];
304
+ if (dataValue != null) {
305
+ domProps[`data-${dataName}`] = dataValue;
306
+ }
307
+ }
308
+ }
309
+ }
310
+ if (focusable === false) {
311
+ domProps.tabIndex = "-1";
312
+ }
313
+ if (
314
+ // These native elements are keyboard focusable by default
315
+ elementType === "a" || elementType === "button" || elementType === "input" || elementType === "select" || elementType === "textarea") {
316
+ if (focusable === false || accessibilityDisabled === true) {
317
+ domProps.tabIndex = "-1";
318
+ }
319
+ } else if (
320
+ // These roles are made keyboard focusable by default
321
+ role === "button" || role === "checkbox" || role === "link" || role === "radio" || role === "textbox" || role === "switch") {
322
+ if (focusable !== false) {
323
+ domProps.tabIndex = "0";
324
+ }
325
+ } else {
326
+ if (focusable === true) {
327
+ domProps.tabIndex = "0";
328
+ }
329
+ }
330
+ const flat = flattenStyle(style);
331
+ let className = tmgCN || "";
332
+ if (props.className) {
333
+ className += ` ${props.className}`;
334
+ }
335
+ const stylesAtomic = flat ? getCSSStylesAtomic(flat) : [];
336
+ stylesFromProps.set(domProps, stylesAtomic);
337
+ domProps.style = stylesAtomic.reduce((acc, [key, value]) => {
338
+ if (key[0] === "_" || key.startsWith("is_") || key.startsWith("font_")) {
339
+ className += ` ${key}`;
340
+ return acc;
341
+ }
342
+ if (key === "$$css" || key === "") {
343
+ return acc;
344
+ }
345
+ acc[key] = value;
346
+ return acc;
347
+ }, {});
348
+ if (className) {
349
+ domProps.className = className;
350
+ }
351
+ const _id = tmgID || id || nativeID;
352
+ if (_id) {
353
+ domProps.id = _id;
354
+ }
355
+ if (testID != null) {
356
+ domProps["data-testid"] = testID;
357
+ }
358
+ return domProps;
359
+ };
360
+ export { createDOMProps, stylesFromProps };
361
+ //# sourceMappingURL=index.mjs.map