react-native-unistyles 3.0.0-alpha.4 → 3.0.0-alpha.40

Sign up to get free protection for your applications and to get access to all the features.
Files changed (539) hide show
  1. package/README.md +7 -0
  2. package/Unistyles.podspec +1 -1
  3. package/android/CMakeLists.txt +19 -45
  4. package/android/build.gradle +6 -5
  5. package/android/src/main/cxx/NativeUnistylesModule.cpp +71 -0
  6. package/android/src/main/cxx/NativeUnistylesModule.h +42 -0
  7. package/android/src/main/cxx/cpp-adapter.cpp +8 -86
  8. package/android/src/main/java/com/unistyles/Equatable.kt +61 -0
  9. package/android/src/main/java/com/unistyles/NativePlatform+android.kt +285 -0
  10. package/android/src/main/java/com/unistyles/NativePlatform+insets.kt +152 -0
  11. package/android/src/main/java/com/unistyles/NativePlatform+listener.kt +59 -0
  12. package/android/src/main/java/com/unistyles/UnistylesModule.kt +51 -0
  13. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +16 -14
  14. package/cxx/NativePlatform.h +11 -0
  15. package/cxx/common/Constants.h +3 -0
  16. package/cxx/common/Helpers.h +140 -5
  17. package/cxx/core/HostStyle.cpp +10 -6
  18. package/cxx/core/HostStyle.h +4 -0
  19. package/cxx/core/StyleSheet.h +0 -2
  20. package/cxx/core/StyleSheetRegistry.cpp +9 -17
  21. package/cxx/core/StyleSheetRegistry.h +3 -4
  22. package/cxx/core/Unistyle.h +8 -11
  23. package/cxx/core/UnistyleData.h +23 -0
  24. package/cxx/core/UnistyleWrapper.h +108 -13
  25. package/cxx/core/UnistylesCommitHook.cpp +14 -15
  26. package/cxx/core/UnistylesCommitHook.h +6 -11
  27. package/cxx/core/UnistylesCommitShadowNode.h +13 -0
  28. package/cxx/core/UnistylesMountHook.cpp +28 -0
  29. package/cxx/core/UnistylesMountHook.h +27 -0
  30. package/cxx/core/UnistylesRegistry.cpp +119 -83
  31. package/cxx/core/UnistylesRegistry.h +16 -14
  32. package/cxx/core/UnistylesState.cpp +29 -8
  33. package/cxx/core/UnistylesState.h +5 -2
  34. package/cxx/hybridObjects/HybridNavigationBar.cpp +0 -4
  35. package/cxx/hybridObjects/HybridNavigationBar.h +3 -4
  36. package/cxx/hybridObjects/HybridShadowRegistry.cpp +16 -11
  37. package/cxx/hybridObjects/HybridStatusBar.cpp +0 -4
  38. package/cxx/hybridObjects/HybridStatusBar.h +3 -4
  39. package/cxx/hybridObjects/HybridStyleSheet.cpp +154 -23
  40. package/cxx/hybridObjects/HybridStyleSheet.h +27 -5
  41. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +96 -14
  42. package/cxx/hybridObjects/HybridUnistylesRuntime.h +19 -3
  43. package/cxx/parser/Parser.cpp +226 -175
  44. package/cxx/parser/Parser.h +11 -15
  45. package/cxx/shadowTree/ShadowLeafUpdate.h +2 -1
  46. package/cxx/shadowTree/ShadowTrafficController.h +71 -0
  47. package/cxx/shadowTree/ShadowTreeManager.cpp +23 -18
  48. package/cxx/shadowTree/ShadowTreeManager.h +3 -2
  49. package/ios/Equatable.swift +2 -1
  50. package/ios/NativePlatform+ios.swift +21 -7
  51. package/ios/NativePlatform+keyboard.swift +83 -0
  52. package/ios/NativePlatformListener+ios.swift +37 -24
  53. package/ios/Unistyles.h +1 -0
  54. package/ios/UnistylesModuleOnLoad.h +8 -2
  55. package/ios/UnistylesModuleOnLoad.mm +9 -1
  56. package/lib/commonjs/components/Display.js +18 -0
  57. package/lib/commonjs/components/Display.js.map +1 -0
  58. package/lib/commonjs/components/Hide.js +18 -0
  59. package/lib/commonjs/components/Hide.js.map +1 -0
  60. package/lib/commonjs/components/index.js +20 -0
  61. package/lib/commonjs/components/index.js.map +1 -0
  62. package/lib/commonjs/components/useMedia.js +59 -0
  63. package/lib/commonjs/components/useMedia.js.map +1 -0
  64. package/lib/commonjs/components/useMedia.web.js +43 -0
  65. package/lib/commonjs/components/useMedia.web.js.map +1 -0
  66. package/lib/commonjs/core/createUnistylesComponent.js +79 -0
  67. package/lib/commonjs/core/createUnistylesComponent.js.map +1 -0
  68. package/lib/commonjs/core/createUnistylesComponent.native.js +82 -0
  69. package/lib/commonjs/core/createUnistylesComponent.native.js.map +1 -0
  70. package/lib/commonjs/core/index.js +13 -0
  71. package/lib/commonjs/core/index.js.map +1 -0
  72. package/lib/commonjs/index.js +21 -11
  73. package/lib/commonjs/index.js.map +1 -1
  74. package/lib/commonjs/mq.js +25 -12
  75. package/lib/commonjs/mq.js.map +1 -1
  76. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js +1 -0
  77. package/lib/commonjs/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  78. package/lib/commonjs/specs/NavigtionBar/index.js +0 -15
  79. package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
  80. package/lib/commonjs/specs/ShadowRegistry/index.js +10 -6
  81. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  82. package/lib/commonjs/specs/StatusBar/index.js +0 -5
  83. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  84. package/lib/commonjs/specs/StyleSheet/index.js +1 -0
  85. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  86. package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -3
  87. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  88. package/lib/commonjs/specs/index.js +7 -0
  89. package/lib/commonjs/specs/index.js.map +1 -1
  90. package/lib/commonjs/specs/index.web.js +1 -1
  91. package/lib/commonjs/types/stylesheet.js.map +1 -1
  92. package/lib/commonjs/utils.js +26 -0
  93. package/lib/commonjs/utils.js.map +1 -0
  94. package/lib/commonjs/web/convert/index.js +79 -0
  95. package/lib/commonjs/web/convert/index.js.map +1 -0
  96. package/lib/commonjs/web/convert/module.d.js +2 -0
  97. package/lib/commonjs/web/convert/module.d.js.map +1 -0
  98. package/lib/commonjs/web/convert/object/boxShadow.js +59 -0
  99. package/lib/commonjs/web/convert/object/boxShadow.js.map +1 -0
  100. package/lib/commonjs/web/convert/object/filter.js +42 -0
  101. package/lib/commonjs/web/convert/object/filter.js.map +1 -0
  102. package/lib/commonjs/web/convert/object/index.js +39 -0
  103. package/lib/commonjs/web/convert/object/index.js.map +1 -0
  104. package/lib/commonjs/web/convert/object/objectStyle.js +56 -0
  105. package/lib/commonjs/web/convert/object/objectStyle.js.map +1 -0
  106. package/lib/commonjs/web/convert/object/transform.js +27 -0
  107. package/lib/commonjs/web/convert/object/transform.js.map +1 -0
  108. package/lib/commonjs/web/convert/pseudo.js +10 -0
  109. package/lib/commonjs/web/convert/pseudo.js.map +1 -0
  110. package/lib/commonjs/web/convert/shadow/boxShadow.js +62 -0
  111. package/lib/commonjs/web/convert/shadow/boxShadow.js.map +1 -0
  112. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js +38 -0
  113. package/lib/commonjs/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
  114. package/lib/commonjs/web/convert/shadow/index.js +28 -0
  115. package/lib/commonjs/web/convert/shadow/index.js.map +1 -0
  116. package/lib/commonjs/web/convert/shadow/textShadow.js +59 -0
  117. package/lib/commonjs/web/convert/shadow/textShadow.js.map +1 -0
  118. package/lib/commonjs/web/convert/style.js +93 -0
  119. package/lib/commonjs/web/convert/style.js.map +1 -0
  120. package/lib/commonjs/web/convert/types.js +9 -0
  121. package/lib/commonjs/web/convert/types.js.map +1 -0
  122. package/lib/commonjs/web/convert/utils.js +59 -0
  123. package/lib/commonjs/web/convert/utils.js.map +1 -0
  124. package/lib/commonjs/web/create.js +49 -0
  125. package/lib/commonjs/web/create.js.map +1 -0
  126. package/lib/commonjs/web/index.js +60 -0
  127. package/lib/commonjs/web/index.js.map +1 -0
  128. package/lib/commonjs/web/listener.js +61 -0
  129. package/lib/commonjs/web/listener.js.map +1 -0
  130. package/lib/commonjs/web/mock.js +27 -0
  131. package/lib/commonjs/web/mock.js.map +1 -0
  132. package/lib/commonjs/web/registry.js +172 -0
  133. package/lib/commonjs/web/registry.js.map +1 -0
  134. package/lib/commonjs/web/runtime.js +173 -0
  135. package/lib/commonjs/web/runtime.js.map +1 -0
  136. package/lib/commonjs/web/shadowRegistry.js +142 -0
  137. package/lib/commonjs/web/shadowRegistry.js.map +1 -0
  138. package/lib/commonjs/web/state.js +73 -0
  139. package/lib/commonjs/web/state.js.map +1 -0
  140. package/lib/commonjs/web/utils/common.js +39 -0
  141. package/lib/commonjs/web/utils/common.js.map +1 -0
  142. package/lib/commonjs/web/utils/index.js +28 -0
  143. package/lib/commonjs/web/utils/index.js.map +1 -0
  144. package/lib/commonjs/web/utils/unistyle.js +85 -0
  145. package/lib/commonjs/web/utils/unistyle.js.map +1 -0
  146. package/lib/commonjs/web/variants/getVariants.js +39 -0
  147. package/lib/commonjs/web/variants/getVariants.js.map +1 -0
  148. package/lib/commonjs/web/variants/index.js +28 -0
  149. package/lib/commonjs/web/variants/index.js.map +1 -0
  150. package/lib/commonjs/web/variants/useVariants.js +59 -0
  151. package/lib/commonjs/web/variants/useVariants.js.map +1 -0
  152. package/lib/module/components/Display.js +13 -0
  153. package/lib/module/components/Display.js.map +1 -0
  154. package/lib/module/components/Hide.js +13 -0
  155. package/lib/module/components/Hide.js.map +1 -0
  156. package/lib/module/components/index.js +5 -0
  157. package/lib/module/components/index.js.map +1 -0
  158. package/lib/module/components/useMedia.js +54 -0
  159. package/lib/module/components/useMedia.js.map +1 -0
  160. package/lib/module/components/useMedia.web.js +38 -0
  161. package/lib/module/components/useMedia.web.js.map +1 -0
  162. package/lib/module/core/createUnistylesComponent.js +72 -0
  163. package/lib/module/core/createUnistylesComponent.js.map +1 -0
  164. package/lib/module/core/createUnistylesComponent.native.js +75 -0
  165. package/lib/module/core/createUnistylesComponent.native.js.map +1 -0
  166. package/lib/module/core/index.js +4 -0
  167. package/lib/module/core/index.js.map +1 -0
  168. package/lib/module/index.js +2 -9
  169. package/lib/module/index.js.map +1 -1
  170. package/lib/module/mq.js +21 -11
  171. package/lib/module/mq.js.map +1 -1
  172. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js +1 -0
  173. package/lib/module/specs/NativePlatform/NativePlatform.nitro.js.map +1 -1
  174. package/lib/module/specs/NavigtionBar/index.js +0 -10
  175. package/lib/module/specs/NavigtionBar/index.js.map +1 -1
  176. package/lib/module/specs/ShadowRegistry/index.js +10 -6
  177. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  178. package/lib/module/specs/StatusBar/index.js +1 -6
  179. package/lib/module/specs/StatusBar/index.js.map +1 -1
  180. package/lib/module/specs/StyleSheet/index.js +1 -0
  181. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  182. package/lib/module/specs/UnistylesRuntime/index.js +1 -3
  183. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  184. package/lib/module/specs/index.js +2 -1
  185. package/lib/module/specs/index.js.map +1 -1
  186. package/lib/module/specs/index.web.js +1 -1
  187. package/lib/module/specs/index.web.js.map +1 -1
  188. package/lib/module/types/stylesheet.js.map +1 -1
  189. package/lib/module/utils.js +21 -0
  190. package/lib/module/utils.js.map +1 -0
  191. package/lib/module/web/convert/index.js +74 -0
  192. package/lib/module/web/convert/index.js.map +1 -0
  193. package/lib/module/web/convert/module.d.js +2 -0
  194. package/lib/module/web/convert/module.d.js.map +1 -0
  195. package/lib/module/web/convert/object/boxShadow.js +54 -0
  196. package/lib/module/web/convert/object/boxShadow.js.map +1 -0
  197. package/lib/module/web/convert/object/filter.js +37 -0
  198. package/lib/module/web/convert/object/filter.js.map +1 -0
  199. package/lib/module/web/convert/object/index.js +6 -0
  200. package/lib/module/web/convert/object/index.js.map +1 -0
  201. package/lib/module/web/convert/object/objectStyle.js +51 -0
  202. package/lib/module/web/convert/object/objectStyle.js.map +1 -0
  203. package/lib/module/web/convert/object/transform.js +22 -0
  204. package/lib/module/web/convert/object/transform.js.map +1 -0
  205. package/lib/module/web/convert/pseudo.js +5 -0
  206. package/lib/module/web/convert/pseudo.js.map +1 -0
  207. package/lib/module/web/convert/shadow/boxShadow.js +57 -0
  208. package/lib/module/web/convert/shadow/boxShadow.js.map +1 -0
  209. package/lib/module/web/convert/shadow/getShadowBreakpoints.js +33 -0
  210. package/lib/module/web/convert/shadow/getShadowBreakpoints.js.map +1 -0
  211. package/lib/module/web/convert/shadow/index.js +5 -0
  212. package/lib/module/web/convert/shadow/index.js.map +1 -0
  213. package/lib/module/web/convert/shadow/textShadow.js +54 -0
  214. package/lib/module/web/convert/shadow/textShadow.js.map +1 -0
  215. package/lib/module/web/convert/style.js +88 -0
  216. package/lib/module/web/convert/style.js.map +1 -0
  217. package/lib/module/web/convert/types.js +5 -0
  218. package/lib/module/web/convert/types.js.map +1 -0
  219. package/lib/module/web/convert/utils.js +45 -0
  220. package/lib/module/web/convert/utils.js.map +1 -0
  221. package/lib/module/web/create.js +44 -0
  222. package/lib/module/web/create.js.map +1 -0
  223. package/lib/module/web/index.js +26 -0
  224. package/lib/module/web/index.js.map +1 -0
  225. package/lib/module/web/listener.js +57 -0
  226. package/lib/module/web/listener.js.map +1 -0
  227. package/lib/module/web/mock.js +23 -0
  228. package/lib/module/web/mock.js.map +1 -0
  229. package/lib/module/web/registry.js +168 -0
  230. package/lib/module/web/registry.js.map +1 -0
  231. package/lib/module/web/runtime.js +169 -0
  232. package/lib/module/web/runtime.js.map +1 -0
  233. package/lib/module/web/shadowRegistry.js +138 -0
  234. package/lib/module/web/shadowRegistry.js.map +1 -0
  235. package/lib/module/web/state.js +69 -0
  236. package/lib/module/web/state.js.map +1 -0
  237. package/lib/module/web/utils/common.js +28 -0
  238. package/lib/module/web/utils/common.js.map +1 -0
  239. package/lib/module/web/utils/index.js +5 -0
  240. package/lib/module/web/utils/index.js.map +1 -0
  241. package/lib/module/web/utils/unistyle.js +72 -0
  242. package/lib/module/web/utils/unistyle.js.map +1 -0
  243. package/lib/module/web/variants/getVariants.js +34 -0
  244. package/lib/module/web/variants/getVariants.js.map +1 -0
  245. package/lib/module/web/variants/index.js +5 -0
  246. package/lib/module/web/variants/index.js.map +1 -0
  247. package/lib/module/web/variants/useVariants.js +54 -0
  248. package/lib/module/web/variants/useVariants.js.map +1 -0
  249. package/lib/typescript/src/components/Display.d.ts +7 -0
  250. package/lib/typescript/src/components/Display.d.ts.map +1 -0
  251. package/lib/typescript/src/components/Hide.d.ts +7 -0
  252. package/lib/typescript/src/components/Hide.d.ts.map +1 -0
  253. package/lib/typescript/src/components/index.d.ts +3 -0
  254. package/lib/typescript/src/components/index.d.ts.map +1 -0
  255. package/lib/typescript/src/components/useMedia.d.ts +6 -0
  256. package/lib/typescript/src/components/useMedia.d.ts.map +1 -0
  257. package/lib/typescript/src/components/useMedia.web.d.ts +6 -0
  258. package/lib/typescript/src/components/useMedia.web.d.ts.map +1 -0
  259. package/lib/typescript/src/core/createUnistylesComponent.d.ts +8 -0
  260. package/lib/typescript/src/core/createUnistylesComponent.d.ts.map +1 -0
  261. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts +8 -0
  262. package/lib/typescript/src/core/createUnistylesComponent.native.d.ts.map +1 -0
  263. package/lib/typescript/src/core/index.d.ts +2 -0
  264. package/lib/typescript/src/core/index.d.ts.map +1 -0
  265. package/lib/typescript/src/index.d.ts +3 -0
  266. package/lib/typescript/src/index.d.ts.map +1 -1
  267. package/lib/typescript/src/mq.d.ts +8 -0
  268. package/lib/typescript/src/mq.d.ts.map +1 -1
  269. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +7 -5
  270. package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
  271. package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts +0 -1
  272. package/lib/typescript/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.d.ts.map +1 -1
  273. package/lib/typescript/src/specs/NavigtionBar/index.d.ts +1 -10
  274. package/lib/typescript/src/specs/NavigtionBar/index.d.ts.map +1 -1
  275. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +4 -4
  276. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  277. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +3 -0
  278. package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
  279. package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts +0 -1
  280. package/lib/typescript/src/specs/StatusBar/UnistylesStatusBar.nitro.d.ts.map +1 -1
  281. package/lib/typescript/src/specs/StatusBar/index.d.ts +2 -4
  282. package/lib/typescript/src/specs/StatusBar/index.d.ts.map +1 -1
  283. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +3 -1
  284. package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
  285. package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -1
  286. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  287. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts +1 -1
  288. package/lib/typescript/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.d.ts.map +1 -1
  289. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +3 -1
  290. package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
  291. package/lib/typescript/src/specs/index.d.ts +4 -2
  292. package/lib/typescript/src/specs/index.d.ts.map +1 -1
  293. package/lib/typescript/src/specs/index.web.d.ts +1 -1
  294. package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
  295. package/lib/typescript/src/types/breakpoints.d.ts +11 -11
  296. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  297. package/lib/typescript/src/types/common.d.ts +1 -0
  298. package/lib/typescript/src/types/common.d.ts.map +1 -1
  299. package/lib/typescript/src/types/index.d.ts +1 -1
  300. package/lib/typescript/src/types/index.d.ts.map +1 -1
  301. package/lib/typescript/src/types/stylesheet.d.ts +6 -4
  302. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  303. package/lib/typescript/src/types/variants.d.ts +4 -1
  304. package/lib/typescript/src/types/variants.d.ts.map +1 -1
  305. package/lib/typescript/src/utils.d.ts +2 -0
  306. package/lib/typescript/src/utils.d.ts.map +1 -0
  307. package/lib/typescript/src/web/convert/index.d.ts +3 -0
  308. package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
  309. package/lib/typescript/src/web/convert/object/boxShadow.d.ts +9 -0
  310. package/lib/typescript/src/web/convert/object/boxShadow.d.ts.map +1 -0
  311. package/lib/typescript/src/web/convert/object/filter.d.ts +3 -0
  312. package/lib/typescript/src/web/convert/object/filter.d.ts.map +1 -0
  313. package/lib/typescript/src/web/convert/object/index.d.ts +4 -0
  314. package/lib/typescript/src/web/convert/object/index.d.ts.map +1 -0
  315. package/lib/typescript/src/web/convert/object/objectStyle.d.ts +5 -0
  316. package/lib/typescript/src/web/convert/object/objectStyle.d.ts.map +1 -0
  317. package/lib/typescript/src/web/convert/object/transform.d.ts +3 -0
  318. package/lib/typescript/src/web/convert/object/transform.d.ts.map +1 -0
  319. package/lib/typescript/src/web/convert/pseudo.d.ts +6 -0
  320. package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
  321. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts +8 -0
  322. package/lib/typescript/src/web/convert/shadow/boxShadow.d.ts.map +1 -0
  323. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts +2 -0
  324. package/lib/typescript/src/web/convert/shadow/getShadowBreakpoints.d.ts.map +1 -0
  325. package/lib/typescript/src/web/convert/shadow/index.d.ts +3 -0
  326. package/lib/typescript/src/web/convert/shadow/index.d.ts.map +1 -0
  327. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts +8 -0
  328. package/lib/typescript/src/web/convert/shadow/textShadow.d.ts.map +1 -0
  329. package/lib/typescript/src/web/convert/style.d.ts +2 -0
  330. package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
  331. package/lib/typescript/{web → src/web}/convert/types.d.ts +8 -2
  332. package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
  333. package/lib/typescript/src/web/convert/utils.d.ts +12 -0
  334. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
  335. package/lib/typescript/src/web/create.d.ts +1443 -0
  336. package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
  337. package/lib/typescript/src/web/index.d.ts +1459 -0
  338. package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
  339. package/lib/typescript/{web/listener → src/web}/listener.d.ts +5 -2
  340. package/lib/typescript/src/web/listener.d.ts.map +1 -0
  341. package/lib/typescript/src/web/mock.d.ts +5 -0
  342. package/lib/typescript/src/web/mock.d.ts.map +1 -0
  343. package/lib/typescript/src/web/registry.d.ts +24 -0
  344. package/lib/typescript/src/web/registry.d.ts.map +1 -0
  345. package/lib/typescript/{web → src/web}/runtime.d.ts +11 -10
  346. package/lib/typescript/src/web/runtime.d.ts.map +1 -0
  347. package/lib/typescript/src/web/shadowRegistry.d.ts +17 -0
  348. package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -0
  349. package/lib/typescript/src/web/state.d.ts +18 -0
  350. package/lib/typescript/src/web/state.d.ts.map +1 -0
  351. package/lib/typescript/src/web/utils/common.d.ts +8 -0
  352. package/lib/typescript/src/web/utils/common.d.ts.map +1 -0
  353. package/lib/typescript/src/web/utils/index.d.ts +3 -0
  354. package/lib/typescript/src/web/utils/index.d.ts.map +1 -0
  355. package/lib/typescript/src/web/utils/unistyle.d.ts +20 -0
  356. package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
  357. package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
  358. package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
  359. package/lib/typescript/src/web/variants/index.d.ts +3 -0
  360. package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
  361. package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
  362. package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
  363. package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
  364. package/nitrogen/generated/android/c++/JFunc_void_UnistylesNativeMiniRuntime.hpp +57 -0
  365. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.hpp +69 -0
  366. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +35 -34
  367. package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.hpp +15 -6
  368. package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
  369. package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +4 -1
  370. package/nitrogen/generated/android/c++/JUnistylesNativeMiniRuntime.hpp +9 -7
  371. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Dimensions.kt +1 -0
  372. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/{Func_void_std__vector_UnistyleDependency_.kt → Func_void_UnistylesNativeMiniRuntime.kt} +6 -5
  373. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Func_void_std__vector_UnistyleDependency__UnistylesNativeMiniRuntime.kt +46 -0
  374. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +25 -13
  375. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/Insets.kt +1 -0
  376. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistyleDependency.kt +2 -1
  377. package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/UnistylesNativeMiniRuntime.kt +3 -1
  378. package/nitrogen/generated/android/unistyles+autolinking.cmake +13 -1
  379. package/nitrogen/generated/android/unistyles+autolinking.gradle +2 -0
  380. package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +6 -4
  381. package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
  382. package/nitrogen/generated/ios/Unistyles+autolinking.rb +6 -4
  383. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
  384. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +73 -38
  385. package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -29
  386. package/nitrogen/generated/ios/c++/HybridNativePlatformSpecSwift.hpp +8 -8
  387. package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +4 -16
  388. package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +156 -115
  389. package/nitrogen/generated/ios/swift/UnistyleDependency.swift +4 -0
  390. package/nitrogen/generated/ios/swift/UnistylesNativeMiniRuntime.swift +16 -5
  391. package/nitrogen/generated/shared/c++/ColorScheme.hpp +2 -2
  392. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.cpp +2 -2
  393. package/nitrogen/generated/shared/c++/HybridNativePlatformSpec.hpp +6 -3
  394. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.cpp +0 -1
  395. package/nitrogen/generated/shared/c++/HybridUnistylesNavigationBarSpec.hpp +3 -1
  396. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.cpp +1 -0
  397. package/nitrogen/generated/shared/c++/HybridUnistylesRuntimeSpec.hpp +5 -0
  398. package/nitrogen/generated/shared/c++/HybridUnistylesShadowRegistrySpec.hpp +3 -0
  399. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.cpp +0 -1
  400. package/nitrogen/generated/shared/c++/HybridUnistylesStatusBarSpec.hpp +3 -1
  401. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +2 -1
  402. package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +10 -4
  403. package/nitrogen/generated/shared/c++/Orientation.hpp +2 -2
  404. package/nitrogen/generated/shared/c++/UnistyleDependency.hpp +2 -1
  405. package/nitrogen/generated/shared/c++/UnistylesCxxMiniRuntime.hpp +10 -9
  406. package/nitrogen/generated/shared/c++/UnistylesNativeMiniRuntime.hpp +9 -8
  407. package/package.json +20 -30
  408. package/plugin/common.js +31 -3
  409. package/plugin/index.js +107 -18
  410. package/plugin/ref.js +129 -13
  411. package/plugin/style.js +189 -22
  412. package/plugin/stylesheet.js +53 -3
  413. package/plugin/variants.js +33 -0
  414. package/src/components/Display.tsx +12 -0
  415. package/src/components/Hide.tsx +12 -0
  416. package/src/components/index.ts +2 -0
  417. package/src/components/useMedia.ts +64 -0
  418. package/src/components/useMedia.web.ts +47 -0
  419. package/src/core/createUnistylesComponent.native.tsx +83 -0
  420. package/src/core/createUnistylesComponent.tsx +84 -0
  421. package/src/core/index.ts +1 -0
  422. package/src/index.ts +3 -12
  423. package/src/mq.ts +27 -9
  424. package/src/specs/NativePlatform/NativePlatform.nitro.ts +7 -5
  425. package/src/specs/NavigtionBar/UnistylesNavigationBar.nitro.ts +0 -1
  426. package/src/specs/NavigtionBar/index.ts +1 -25
  427. package/src/specs/ShadowRegistry/index.ts +16 -10
  428. package/src/specs/ShadowRegistry/types.ts +4 -1
  429. package/src/specs/StatusBar/UnistylesStatusBar.nitro.ts +0 -1
  430. package/src/specs/StatusBar/index.ts +2 -12
  431. package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +4 -1
  432. package/src/specs/StyleSheet/index.ts +6 -1
  433. package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
  434. package/src/specs/UnistylesRuntime/index.ts +5 -4
  435. package/src/specs/index.ts +6 -2
  436. package/src/specs/index.web.ts +1 -1
  437. package/src/types/breakpoints.ts +25 -13
  438. package/src/types/common.ts +1 -0
  439. package/src/types/index.ts +1 -1
  440. package/src/types/stylesheet.ts +7 -5
  441. package/src/types/variants.ts +7 -1
  442. package/src/utils.ts +22 -0
  443. package/{web → src/web}/convert/index.ts +25 -25
  444. package/src/web/convert/object/boxShadow.ts +55 -0
  445. package/src/web/convert/object/filter.ts +39 -0
  446. package/src/web/convert/object/index.ts +3 -0
  447. package/src/web/convert/object/objectStyle.ts +69 -0
  448. package/src/web/convert/object/transform.ts +24 -0
  449. package/src/web/convert/pseudo.ts +137 -0
  450. package/src/web/convert/shadow/boxShadow.ts +50 -0
  451. package/src/web/convert/shadow/getShadowBreakpoints.ts +34 -0
  452. package/src/web/convert/shadow/index.ts +2 -0
  453. package/src/web/convert/shadow/textShadow.ts +48 -0
  454. package/{web → src/web}/convert/style.ts +61 -10
  455. package/{web → src/web}/convert/types.ts +9 -2
  456. package/{web → src/web}/convert/utils.ts +11 -5
  457. package/src/web/create.ts +48 -0
  458. package/{web → src/web}/index.ts +4 -3
  459. package/src/web/listener.ts +63 -0
  460. package/{web → src/web}/mock.ts +3 -14
  461. package/src/web/registry.ts +215 -0
  462. package/{web → src/web}/runtime.ts +32 -21
  463. package/src/web/shadowRegistry.ts +145 -0
  464. package/src/web/state.ts +94 -0
  465. package/src/web/utils/common.ts +45 -0
  466. package/src/web/utils/index.ts +2 -0
  467. package/src/web/utils/unistyle.ts +108 -0
  468. package/src/web/variants/getVariants.ts +42 -0
  469. package/src/web/variants/index.ts +2 -0
  470. package/src/web/variants/useVariants.ts +65 -0
  471. package/android/src/main/cxx/helpers.cpp +0 -105
  472. package/android/src/main/cxx/helpers.h +0 -16
  473. package/android/src/main/cxx/platform.cpp +0 -170
  474. package/android/src/main/cxx/platform.h +0 -20
  475. package/lib/typescript/example/App.d.ts +0 -4
  476. package/lib/typescript/example/App.d.ts.map +0 -1
  477. package/lib/typescript/example/unistyles.d.ts +0 -63
  478. package/lib/typescript/example/unistyles.d.ts.map +0 -1
  479. package/lib/typescript/expo-example/App.d.ts +0 -4
  480. package/lib/typescript/expo-example/App.d.ts.map +0 -1
  481. package/lib/typescript/expo-example/unistyles.d.ts +0 -63
  482. package/lib/typescript/expo-example/unistyles.d.ts.map +0 -1
  483. package/lib/typescript/web/convert/boxShadow.d.ts +0 -3
  484. package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
  485. package/lib/typescript/web/convert/breakpoint.d.ts +0 -3
  486. package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
  487. package/lib/typescript/web/convert/index.d.ts +0 -4
  488. package/lib/typescript/web/convert/index.d.ts.map +0 -1
  489. package/lib/typescript/web/convert/shadow.d.ts +0 -2
  490. package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
  491. package/lib/typescript/web/convert/style.d.ts +0 -3
  492. package/lib/typescript/web/convert/style.d.ts.map +0 -1
  493. package/lib/typescript/web/convert/textShadow.d.ts +0 -3
  494. package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
  495. package/lib/typescript/web/convert/transform.d.ts +0 -5
  496. package/lib/typescript/web/convert/transform.d.ts.map +0 -1
  497. package/lib/typescript/web/convert/types.d.ts.map +0 -1
  498. package/lib/typescript/web/convert/utils.d.ts +0 -8
  499. package/lib/typescript/web/convert/utils.d.ts.map +0 -1
  500. package/lib/typescript/web/create.d.ts +0 -2449
  501. package/lib/typescript/web/index.d.ts +0 -2464
  502. package/lib/typescript/web/listener/index.d.ts +0 -2
  503. package/lib/typescript/web/listener/index.d.ts.map +0 -1
  504. package/lib/typescript/web/listener/listener.d.ts.map +0 -1
  505. package/lib/typescript/web/mock.d.ts +0 -14
  506. package/lib/typescript/web/mock.d.ts.map +0 -1
  507. package/lib/typescript/web/mq.d.ts +0 -4
  508. package/lib/typescript/web/mq.d.ts.map +0 -1
  509. package/lib/typescript/web/pseudo.d.ts +0 -4
  510. package/lib/typescript/web/pseudo.d.ts.map +0 -1
  511. package/lib/typescript/web/registry.d.ts +0 -12
  512. package/lib/typescript/web/registry.d.ts.map +0 -1
  513. package/lib/typescript/web/runtime.d.ts.map +0 -1
  514. package/lib/typescript/web/state.d.ts +0 -24
  515. package/lib/typescript/web/state.d.ts.map +0 -1
  516. package/lib/typescript/web/useVariants.d.ts +0 -3
  517. package/lib/typescript/web/useVariants.d.ts.map +0 -1
  518. package/lib/typescript/web/utils.d.ts +0 -18
  519. package/lib/typescript/web/utils.d.ts.map +0 -1
  520. package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +0 -60
  521. package/plugin/__tests__/dependencies.spec.js +0 -360
  522. package/plugin/__tests__/ref.spec.js +0 -991
  523. package/plugin/__tests__/stylesheet.spec.js +0 -396
  524. package/web/convert/boxShadow.ts +0 -72
  525. package/web/convert/breakpoint.ts +0 -21
  526. package/web/convert/shadow.ts +0 -68
  527. package/web/convert/textShadow.ts +0 -69
  528. package/web/convert/transform.ts +0 -89
  529. package/web/create.ts +0 -102
  530. package/web/listener/index.ts +0 -1
  531. package/web/listener/listener.ts +0 -33
  532. package/web/mq.ts +0 -19
  533. package/web/pseudo.ts +0 -11
  534. package/web/registry.ts +0 -41
  535. package/web/state.ts +0 -148
  536. package/web/useVariants.ts +0 -99
  537. package/web/utils.ts +0 -95
  538. /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
  539. /package/{web → src/web}/convert/module.d.ts +0 -0
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTextShadowStyle = void 0;
7
+ var _utils = require("../../../utils");
8
+ var _types = require("../types");
9
+ var _utils2 = require("../utils");
10
+ var _getShadowBreakpoints = require("./getShadowBreakpoints");
11
+ const createTextShadowValue = style => {
12
+ const {
13
+ textShadowColor,
14
+ textShadowOffset,
15
+ textShadowRadius
16
+ } = style;
17
+ const offsetX = (0, _utils2.normalizeNumericValue)(textShadowOffset?.width ?? 0);
18
+ const offsetY = (0, _utils2.normalizeNumericValue)(textShadowOffset?.height ?? 0);
19
+ const radius = (0, _utils2.normalizeNumericValue)(textShadowRadius ?? 0);
20
+ const color = (0, _utils2.normalizeColor)(textShadowColor ?? '#000000');
21
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
22
+ };
23
+ const getTextShadowStyle = styles => {
24
+ const breakpoints = (0, _getShadowBreakpoints.getShadowBreakpoints)(_types.TEXT_SHADOW_STYLES, styles);
25
+
26
+ // If no breakpoints were used return styles without media queries
27
+ if (breakpoints.length === 0) {
28
+ return {
29
+ textShadow: createTextShadowValue(styles)
30
+ };
31
+ }
32
+
33
+ // Create textShadow for each breakpoint
34
+ const breakpointStyles = breakpoints.map(breakpoint => {
35
+ const color = (0, _utils2.extractShadowValue)('textShadowColor', breakpoint, styles);
36
+ const {
37
+ width,
38
+ height
39
+ } = (0, _utils2.extractShadowValue)('textShadowOffset', breakpoint, styles);
40
+ const radius = (0, _utils2.extractShadowValue)('textShadowRadius', breakpoint, styles);
41
+ return {
42
+ [breakpoint]: {
43
+ textShadow: createTextShadowValue({
44
+ textShadowColor: color,
45
+ textShadowOffset: {
46
+ width,
47
+ height
48
+ },
49
+ textShadowRadius: radius
50
+ })
51
+ }
52
+ };
53
+ });
54
+
55
+ // Merge all breakpoints styles into one
56
+ return (0, _utils.deepMergeObjects)(...breakpointStyles);
57
+ };
58
+ exports.getTextShadowStyle = getTextShadowStyle;
59
+ //# sourceMappingURL=textShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","_types","_utils2","_getShadowBreakpoints","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","normalizeNumericValue","width","offsetY","height","radius","color","normalizeColor","getTextShadowStyle","styles","breakpoints","getShadowBreakpoints","TEXT_SHADOW_STYLES","length","textShadow","breakpointStyles","map","breakpoint","extractShadowValue","deepMergeObjects","exports"],"sourceRoot":"../../../../../src","sources":["web/convert/shadow/textShadow.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,MAAMI,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAG,IAAAC,6BAAqB,EAACH,gBAAgB,EAAEI,KAAK,IAAI,CAAC,CAAC;EACnE,MAAMC,OAAO,GAAG,IAAAF,6BAAqB,EAACH,gBAAgB,EAAEM,MAAM,IAAI,CAAC,CAAC;EACpE,MAAMC,MAAM,GAAG,IAAAJ,6BAAqB,E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= void 0;
7
+ var _utils = require("../utils");
8
+ const SKIP_STYLES = ['borderCurve', 'elevation', 'textAlignVertical', 'includeFontPadding', 'overlayColor', 'tintColor'];
9
+ const CSS_NUMBER_KEYS = ['animationIterationCount', 'borderImageOutset', 'borderImageSlice', 'borderImageWidth', 'boxFlex', 'boxFlexGroup', 'boxOrdinalGroup', 'columnCount', 'columns', 'counterIncrement', 'counterReset', 'flex', 'flexGrow', 'flexPositive', 'flexShrink', 'flexNegative', 'flexOrder', 'fontWeight', 'gridArea', 'gridColumn', 'gridColumnEnd', 'gridColumnSpan', 'gridColumnStart', 'gridRow', 'gridRowEnd', 'gridRowSpan', 'gridRowStart', 'line-clamp', 'line-height', 'opacity', 'order', 'orphans', 'tabSize', 'widows', 'zIndex', 'zoom', 'fillOpacity', 'floodOpacity', 'stopOpacity', 'strokeDasharray', 'strokeDashoffset', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth'];
10
+ const convertMap = {
11
+ marginHorizontal: value => ({
12
+ marginInline: value
13
+ }),
14
+ marginVertical: value => ({
15
+ marginBlock: value
16
+ }),
17
+ paddingHorizontal: value => ({
18
+ paddingInline: value
19
+ }),
20
+ paddingVertical: value => ({
21
+ paddingBlock: value
22
+ }),
23
+ writingDirection: value => ({
24
+ direction: value
25
+ }),
26
+ borderBottomEndRadius: value => ({
27
+ borderBottomRightRadius: value
28
+ }),
29
+ borderBottomStartRadius: value => ({
30
+ borderBottomLeftRadius: value
31
+ }),
32
+ borderEndColor: value => ({
33
+ borderInlineEndColor: value
34
+ }),
35
+ borderStartColor: value => ({
36
+ borderInlineStartColor: value
37
+ }),
38
+ borderTopEndRadius: value => ({
39
+ borderTopRightRadius: value
40
+ }),
41
+ borderTopStartRadius: value => ({
42
+ borderTopLeftRadius: value
43
+ }),
44
+ borderEndWidth: value => ({
45
+ borderInlineEndWidth: value
46
+ }),
47
+ borderStartWidth: value => ({
48
+ borderInlineStartWidth: value
49
+ }),
50
+ end: value => ({
51
+ right: value
52
+ }),
53
+ start: value => ({
54
+ left: value
55
+ }),
56
+ marginEnd: value => ({
57
+ marginRight: value
58
+ }),
59
+ marginStart: value => ({
60
+ marginLeft: value
61
+ }),
62
+ paddingEnd: value => ({
63
+ paddingRight: value
64
+ }),
65
+ paddingStart: value => ({
66
+ paddingLeft: value
67
+ }),
68
+ transformMatrix: value => ({
69
+ transform: `matrix(${value.join(', ')})`
70
+ }),
71
+ resizeMode: value => ({
72
+ backgroundSize: value
73
+ })
74
+ };
75
+ const convertNumber = (key, value) => {
76
+ if (typeof value === 'number') {
77
+ return CSS_NUMBER_KEYS.includes(key, value) ? value : `${value}px`;
78
+ }
79
+ return value;
80
+ };
81
+ const getStyle = (key, value) => {
82
+ if (SKIP_STYLES.includes(key)) {
83
+ return {};
84
+ }
85
+ if ((0, _utils.keyInObject)(convertMap, key)) {
86
+ return convertMap[key]?.(convertNumber(key, value)) ?? {};
87
+ }
88
+ return {
89
+ [key]: convertNumber(key, value)
90
+ };
91
+ };
92
+ exports.getStyle = getStyle;
93
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","SKIP_STYLES","CSS_NUMBER_KEYS","convertMap","marginHorizontal","value","marginInline","marginVertical","marginBlock","paddingHorizontal","paddingInline","paddingVertical","paddingBlock","writingDirection","direction","borderBottomEndRadius","borderBottomRightRadius","borderBottomStartRadius","borderBottomLeftRadius","borderEndColor","borderInlineEndColor","borderStartColor","borderInlineStartColor","borderTopEndRadius","borderTopRightRadius","borderTopStartRadius","borderTopLeftRadius","borderEndWidth","borderInlineEndWidth","borderStartWidth","borderInlineStartWidth","end","right","start","left","marginEnd","marginRight","marginStart","marginLeft","paddingEnd","paddingRight","paddingStart","paddingLeft","transformMatrix","transform","join","resizeMode","backgroundSize","convertNumber","key","includes","getStyle","keyInObject","exports"],"sourceRoot":"../../../../src","sources":["web/convert/style.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,WAAW,G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,GAAGA,KAAK,GAAG,GAAGA,KAAK,IAAI;EACtE;EAEA,OAAOA,KAAK;AAChB,CAAC;AAEM,MAAM8C,QAAQ,GAAGA,CAACF,GAAW,EAAE5C,KAAU,KAAK;EACjD,IAAIJ,WAAW,CAACiD,QAAQ,CAACD,GAAG,CAAC,EAAE;IAC3B,OAAO,CAAC,CAAC;EACb;EAEA,IAAI,IAAAG,kBAAW,EAACjD,UAAU,EAAE8C,GAAG,CAAC,EAAE;IAC9B,OAAO9C,UAAU,CAAC8C,GAAG,CAAC,GAAGD,aAAa,CAACC,GAAG,EAAE5C,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;EAC7D;EAEA,OAAO;IACH,CAAC4C,GAAG,GAAGD,aAAa,CAACC,GAAG,EAAE5C,KAAK;EACnC,CAAC;AACL,CAAC;AAAAgD,OAAA,CAAAF,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TEXT_SHADOW_STYLES = exports.BOX_SHADOW_STYLES = void 0;
7
+ const TEXT_SHADOW_STYLES = exports.TEXT_SHADOW_STYLES = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
8
+ const BOX_SHADOW_STYLES = exports.BOX_SHADOW_STYLES = ['shadowColor', 'shadowRadius', 'shadowOpacity', 'shadowOffset'];
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TEXT_SHADOW_STYLES","exports","BOX_SHADOW_STYLES"],"sourceRoot":"../../../../src","sources":["web/convert/types.ts"],"mappings":";;;;;;AAKO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAU;AAI/F,MAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAU","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeNumericValue = exports.normalizeColor = exports.isTransform = exports.isTextShadow = exports.isShadow = exports.isFilter = exports.isBoxShadow = exports.extractShadowValue = void 0;
7
+ var _normalizeColors = _interopRequireDefault(require("@react-native/normalize-colors"));
8
+ var _types = require("./types");
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ // based on react-native-web normalizer
11
+ // https://github.com/necolas/react-native-web
12
+
13
+ const isTransform = (key, value) => key === 'transform' && Array.isArray(value);
14
+ exports.isTransform = isTransform;
15
+ const isTextShadow = key => _types.TEXT_SHADOW_STYLES.includes(key);
16
+ exports.isTextShadow = isTextShadow;
17
+ const isShadow = key => _types.BOX_SHADOW_STYLES.includes(key);
18
+ exports.isShadow = isShadow;
19
+ const isFilter = (key, value) => key === 'filter' && Array.isArray(value);
20
+ exports.isFilter = isFilter;
21
+ const isBoxShadow = (key, value) => key === 'boxShadow' && Array.isArray(value);
22
+ exports.isBoxShadow = isBoxShadow;
23
+ const normalizeNumericValue = value => value && typeof value === 'number' ? `${value}px` : value;
24
+ exports.normalizeNumericValue = normalizeNumericValue;
25
+ const normalizeColor = (color, opacity = 1) => {
26
+ // If the opacity is 1 there's no need to normalize the color
27
+ if (opacity === 1) {
28
+ return color;
29
+ }
30
+ const integer = (0, _normalizeColors.default)(color);
31
+
32
+ // If the color is an unknown format, the return value is null
33
+ if (integer === null) {
34
+ return color;
35
+ }
36
+ const hex = integer.toString(16).padStart(8, '0');
37
+ if (hex.length === 8) {
38
+ const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
39
+ return `rgba(${r},${g},${b},${a / 255 * opacity})`;
40
+ }
41
+ return color;
42
+ };
43
+ exports.normalizeColor = normalizeColor;
44
+ const extractShadowValue = (key, breakpoint, styles) => {
45
+ const value = styles[key];
46
+ if (key === 'textShadowOffset' || key === 'shadowOffset') {
47
+ const {
48
+ width,
49
+ height
50
+ } = value;
51
+ return {
52
+ width: typeof width === 'object' ? width[breakpoint] : width,
53
+ height: typeof height === 'object' ? height[breakpoint] : height
54
+ };
55
+ }
56
+ return typeof value === 'object' ? value[breakpoint] : value;
57
+ };
58
+ exports.extractShadowValue = extractShadowValue;
59
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeColors","_interopRequireDefault","require","_types","e","__esModule","default","isTransform","key","value","Array","isArray","exports","isTextShadow","TEXT_SHADOW_STYLES","includes","isShadow","BOX_SHADOW_STYLES","isFilter","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","normalizeColors","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAiH,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAHjH;AACA;;AAMO,MAAMG,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAsCD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAAAG,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAE7H,MAAMM,YAAY,GAAIL,GAAW,IAAKM,yBAAkB,CAACC,QAAQ,CAACP,GAAwC,CAAC;AAAAI,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAE3G,MAAMG,QAAQ,GAAIR,GAAW,IAAKS,wBAAiB,CAACF,QAAQ,CAACP,GAAuC,CAAC;AAAAI,OAAA,CAAAI,QAAA,GAAAA,QAAA;AAErG,M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CAAC,IAAIC,CAAC,IAAIC,CAAC,IAAKC,CAAC,GAAG,GAAG,GAAIV,OAAO,GAAG;EACxD;EAEA,OAAOD,KAAK;AAChB,CAAC;AAAAV,OAAA,CAAAS,cAAA,GAAAA,cAAA;AAEM,MAAMoB,kBAAkB,GAAGA,CAA6BjC,GAAS,EAAEkC,UAAkB,EAAEC,MAAW,KAAsB;EAC3H,MAAMlC,KAAK,GAAGkC,MAAM,CAACnC,GAAG,CAAC;EAEzB,IAAIA,GAAG,KAAK,kBAAkB,IAAIA,GAAG,KAAK,cAAc,EAAE;IACtD,MAAM;MAAEoC,KAAK;MAAEC;IAAO,CAAC,GAAGpC,KAAK;IAE/B,OAAO;MACHmC,KAAK,EAAE,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAACF,UAAU,CAAC,GAAGE,KAAK;MAC5DC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,CAACH,UAAU,CAAC,GAAGG;IAC9D,CAAC;EACL;EAEA,OAAO,OAAOpC,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAACiC,UAAU,CAAC,GAAGjC,KAAK;AAChE,CAAC;AAAAG,OAAA,CAAA6B,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.create = void 0;
7
+ var _utils = require("./utils");
8
+ var _utils2 = require("../utils");
9
+ var _runtime = require("./runtime");
10
+ var _variants = require("./variants");
11
+ const create = stylesheet => {
12
+ const computedStylesheet = typeof stylesheet === 'function' ? stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime) : stylesheet;
13
+ const selectedVariants = new Map();
14
+ const copyVariants = () => Object.fromEntries(selectedVariants.entries());
15
+ const addSecrets = (value, key, args) => (0, _utils.assignSecrets)(value, {
16
+ __uni__key: key,
17
+ __uni__refs: new Set(),
18
+ __uni__stylesheet: stylesheet,
19
+ __uni__args: args,
20
+ __uni__variants: copyVariants()
21
+ });
22
+ const styles = (0, _utils.reduceObject)(computedStylesheet, (value, _key) => {
23
+ const key = String(_key);
24
+ if (typeof value === 'function') {
25
+ const dynamicStyle = (...args) => {
26
+ const result = value(...args);
27
+ const variants = Object.fromEntries((0, _variants.getVariants)({
28
+ [key]: result
29
+ }, copyVariants()));
30
+ const resultWithVariants = (0, _utils2.deepMergeObjects)(result, variants[key] ?? {});
31
+
32
+ // Add secrets to result of dynamic styles function
33
+ return addSecrets((0, _utils.getStyles)(resultWithVariants), key, args);
34
+ };
35
+
36
+ // Add secrets to dynamic styles function
37
+ return addSecrets(dynamicStyle, key);
38
+ }
39
+
40
+ // Add secrets to static styles
41
+ return addSecrets((0, _utils.getStyles)(value), key);
42
+ });
43
+
44
+ // Inject useVariants hook to styles
45
+ (0, _variants.createUseVariants)(styles, newVariants => Object.entries(newVariants).forEach(([key, value]) => selectedVariants.set(key, value)));
46
+ return styles;
47
+ };
48
+ exports.create = create;
49
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","_utils2","_runtime","_variants","create","stylesheet","computedStylesheet","UnistylesRuntime","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","assignSecrets","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","reduceObject","_key","String","dynamicStyle","result","variants","getVariants","resultWithVariants","deepMergeObjects","getStyles","createUseVariants","newVariants","forEach","set","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEO,MAAMI,MAAM,GAAIC,UAAiD,IAAK;EACzE,MAAMC,kBAAkB,GAAG,OAAOD,UAAU,KAAK,UAAU,GACrDA,UA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e,YAAY,EAAEb,GAAG,CAAC;IACxC;;IAEA;IACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACpB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACA,IAAAoB,2BAAiB,EAACX,MAAM,EAAEY,WAAW,IAAI1B,MAAM,CAACE,OAAO,CAACwB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAACtB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAAC+B,GAAG,CAACvB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOU,MAAM;AACjB,CAAC;AAAAe,OAAA,CAAAtC,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ StyleSheet: true,
8
+ getSSRUnistyles: true,
9
+ UnistylesRuntime: true,
10
+ UnistylesShadowRegistry: true
11
+ };
12
+ exports.StyleSheet = void 0;
13
+ Object.defineProperty(exports, "UnistylesRuntime", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _runtime.UnistylesRuntime;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "UnistylesShadowRegistry", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _shadowRegistry.UnistylesShadowRegistry;
23
+ }
24
+ });
25
+ exports.getSSRUnistyles = void 0;
26
+ var _create = require("./create");
27
+ var _state = require("./state");
28
+ var _utils = require("../utils");
29
+ var _runtime = require("./runtime");
30
+ var _shadowRegistry = require("./shadowRegistry");
31
+ var _mock = require("./mock");
32
+ Object.keys(_mock).forEach(function (key) {
33
+ if (key === "default" || key === "__esModule") return;
34
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
35
+ if (key in exports && exports[key] === _mock[key]) return;
36
+ Object.defineProperty(exports, key, {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _mock[key];
40
+ }
41
+ });
42
+ });
43
+ const StyleSheet = exports.StyleSheet = {
44
+ configure: _state.UnistylesState.init,
45
+ create: _create.create,
46
+ absoluteFill: {
47
+ position: 'absolute',
48
+ left: 0,
49
+ top: 0,
50
+ right: 0,
51
+ bottom: 0
52
+ },
53
+ compose: (a, b) => (0, _utils.deepMergeObjects)(a, b),
54
+ flatten: (...styles) => (0, _utils.deepMergeObjects)(...styles),
55
+ hairlineWidth: 1
56
+ };
57
+ // TODO: Work on SSR
58
+ const getSSRUnistyles = () => [];
59
+ exports.getSSRUnistyles = getSSRUnistyles;
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_create","require","_state","_utils","_runtime","_shadowRegistry","_mock","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","StyleSheet","configure","UnistylesState","init","create","absoluteFill","position","left","top","right","bottom","compose","a","b","deepMergeObjects","flatten","styles","hairlineWidth","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAiBA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAjBO,MAAMS,UAAU,GAAAJ,OAAA,CAAAI,UAAA,GAAG;EACtBC,SAAS,EAAEC,qBAAc,CAACC,IAAI;EAC9BC,MAAM,EAANA,cAAM;EACNC,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,OAAO,EAAEA,CAACC,CAAS,EAAEC,CAAS,KAAK,IAAAC,uBAAgB,EAACF,CAAC,EAAEC,CAAC,CAAC;EACzDE,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAK,IAAAF,uBAAgB,EAAC,GAAGE,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC;AAMD;AACO,MAAMC,eAAe,GAAGA,CAAA,KAAM,EAAE;AAAAtB,OAAA,CAAAsB,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnistylesListener = void 0;
7
+ var _NativePlatform = require("../specs/NativePlatform");
8
+ var _runtime = require("./runtime");
9
+ class UnistylesListenerBuilder {
10
+ isInitialized = false;
11
+ listeners = Array.from({
12
+ length: Object.keys(_NativePlatform.UnistyleDependency).length / 2
13
+ }, () => new Set());
14
+ stylesheetListeners = Array.from({
15
+ length: Object.keys(_NativePlatform.UnistyleDependency).length / 2
16
+ }, () => new Set());
17
+ emitChange = dependency => {
18
+ this.stylesheetListeners[dependency]?.forEach(listener => listener());
19
+ this.listeners[dependency]?.forEach(listener => listener());
20
+ };
21
+ initListeners = () => {
22
+ if (this.isInitialized) {
23
+ return;
24
+ }
25
+ this.isInitialized = true;
26
+ _runtime.UnistylesRuntime.darkMedia?.addEventListener('change', event => {
27
+ if (!event.matches) {
28
+ return;
29
+ }
30
+ this.emitChange(_NativePlatform.UnistyleDependency.ColorScheme);
31
+ if (_runtime.UnistylesRuntime.hasAdaptiveThemes) {
32
+ this.emitChange(_NativePlatform.UnistyleDependency.Theme);
33
+ }
34
+ });
35
+ _runtime.UnistylesRuntime.lightMedia?.addEventListener('change', event => {
36
+ if (!event.matches) {
37
+ return;
38
+ }
39
+ this.emitChange(_NativePlatform.UnistyleDependency.ColorScheme);
40
+ if (_runtime.UnistylesRuntime.hasAdaptiveThemes) {
41
+ this.emitChange(_NativePlatform.UnistyleDependency.Theme);
42
+ }
43
+ });
44
+ window.addEventListener('orientationchange', () => this.emitChange(_NativePlatform.UnistyleDependency.Orientation));
45
+ window.addEventListener('resize', () => this.emitChange(_NativePlatform.UnistyleDependency.Dimensions));
46
+ };
47
+ addListeners = (dependencies, listener) => {
48
+ dependencies.forEach(dependency => this.listeners[dependency]?.add(listener));
49
+ return () => {
50
+ dependencies.forEach(dependency => this.listeners[dependency]?.delete(listener));
51
+ };
52
+ };
53
+ addStylesheetListeners = (dependencies, listener) => {
54
+ dependencies.forEach(dependency => this.stylesheetListeners[dependency]?.add(listener));
55
+ return () => {
56
+ dependencies.forEach(dependency => this.stylesheetListeners[dependency]?.delete(listener));
57
+ };
58
+ };
59
+ }
60
+ const UnistylesListener = exports.UnistylesListener = new UnistylesListenerBuilder();
61
+ //# sourceMappingURL=listener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_NativePlatform","require","_runtime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","UnistyleDependency","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","UnistylesRuntime","darkMedia","addEventListener","event","matches","ColorScheme","hasAdaptiveThemes","Theme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener","exports"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAA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use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StatusBar = exports.NavigationBar = void 0;
7
+ const StatusBar = exports.StatusBar = {
8
+ width: 0,
9
+ height: 0,
10
+ setStyle: () => {},
11
+ setHidden: () => {},
12
+ equals: () => true,
13
+ toString: () => 'StatusBar',
14
+ __type: 'web',
15
+ name: 'StatusBar'
16
+ };
17
+ const NavigationBar = exports.NavigationBar = {
18
+ width: 0,
19
+ height: 0,
20
+ setHidden: () => {},
21
+ equals: () => true,
22
+ dispose: () => {},
23
+ toString: () => 'NavigationBar',
24
+ __type: 'web',
25
+ name: 'NavigationBar'
26
+ };
27
+ //# sourceMappingURL=mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StatusBar","exports","width","height","setStyle","setHidden","equals","toString","__type","name","NavigationBar","dispose"],"sourceRoot":"../../../src","sources":["web/mock.ts"],"mappings":";;;;;;AAGO,MAAMA,SAAwB,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACpCE,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,WAAW;EAC3BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAEM,MAAMC,aAAgC,GAAAT,OAAA,CAAAS,aAAA,GAAG;EAC5CR,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTE,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBK,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBJ,QAAQ,EAAEA,CAAA,KAAM,eAAe;EAC/BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC","ignoreList":[]}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnistylesRegistry = void 0;
7
+ var _runtime = require("./runtime");
8
+ var _utils = require("./utils");
9
+ var _listener = require("./listener");
10
+ var _convert = require("./convert");
11
+ class UnistylesRegistryBuilder {
12
+ stylesheets = new Map();
13
+ stylesCounter = new Map();
14
+ #styleTag = null;
15
+ disposeListenersMap = new Map();
16
+ dependenciesMap = new Map();
17
+ get styleTag() {
18
+ const tag = this.#styleTag;
19
+ if (!tag) {
20
+ const newTag = document.createElement('style');
21
+ newTag.id = 'unistyles-web';
22
+ this.#styleTag = newTag;
23
+ document.head.appendChild(newTag);
24
+ return newTag;
25
+ }
26
+ return tag;
27
+ }
28
+ getComputedStylesheet = stylesheet => {
29
+ if (typeof stylesheet !== 'function') {
30
+ return stylesheet;
31
+ }
32
+ const computedStylesheet = this.stylesheets.get(stylesheet);
33
+ if (computedStylesheet) {
34
+ return computedStylesheet;
35
+ }
36
+ const createdStylesheet = stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime);
37
+ const dependencies = Object.values(createdStylesheet).flatMap(value => (0, _utils.extractUnistyleDependencies)(value));
38
+ this.addDependenciesToStylesheet(stylesheet, dependencies);
39
+ this.stylesheets.set(stylesheet, createdStylesheet);
40
+ return createdStylesheet;
41
+ };
42
+ addDependenciesToStylesheet = (stylesheet, dependencies) => {
43
+ this.disposeListenersMap.get(stylesheet)?.();
44
+ const dependenciesMap = this.dependenciesMap.get(stylesheet) ?? new Set(dependencies);
45
+ dependencies.forEach(dependency => dependenciesMap.add(dependency));
46
+ const dispose = _listener.UnistylesListener.addStylesheetListeners(Array.from(dependenciesMap), () => {
47
+ const newComputedStylesheet = stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime);
48
+ this.stylesheets.set(stylesheet, newComputedStylesheet);
49
+ });
50
+ this.dependenciesMap.set(stylesheet, dependenciesMap);
51
+ this.disposeListenersMap.set(stylesheet, dispose);
52
+ };
53
+ add = value => {
54
+ const hash = (0, _utils.generateHash)(value);
55
+ const existingCounter = this.stylesCounter.get(hash);
56
+ if (!existingCounter || existingCounter.size === 0) {
57
+ const counter = new Set();
58
+ counter.add(value);
59
+ this.stylesCounter.set(hash, counter);
60
+ this.applyStyles(hash, (0, _convert.convertUnistyles)(value));
61
+ return {
62
+ hash,
63
+ existingHash: false
64
+ };
65
+ }
66
+ existingCounter.add(value);
67
+ return {
68
+ hash,
69
+ existingHash: true
70
+ };
71
+ };
72
+ applyStyles = (hash, styles) => {
73
+ Object.entries(styles).forEach(([key, value]) => {
74
+ if (!this.styleTag.sheet) {
75
+ return;
76
+ }
77
+ if (typeof value === 'object' && !key.startsWith('_')) {
78
+ const mediaQuery = (0, _utils.getMediaQuery)(key);
79
+ const cssRules = Array.from(this.styleTag.sheet.cssRules);
80
+ let queryRule = cssRules.find(rule => {
81
+ if (!(rule instanceof CSSMediaRule)) {
82
+ return false;
83
+ }
84
+ return rule.media.item(0)?.includes(mediaQuery);
85
+ }) ?? null;
86
+ if (!queryRule) {
87
+ const mediaQueryValue = (0, _utils.extractMediaQueryValue)(mediaQuery);
88
+ const ruleIndex = mediaQueryValue ? cssRules.reduce((acc, rule, ruleIndex) => {
89
+ if (!(rule instanceof CSSMediaRule)) {
90
+ return acc;
91
+ }
92
+ const ruleMediaQueryValue = (0, _utils.extractMediaQueryValue)(rule.conditionText);
93
+ if (ruleMediaQueryValue === undefined) {
94
+ return;
95
+ }
96
+ return ruleMediaQueryValue > mediaQueryValue ? ruleIndex : acc;
97
+ }, cssRules.length) : undefined;
98
+ queryRule = this.styleTag.sheet.cssRules.item(this.styleTag.sheet.insertRule(`@media ${mediaQuery} {.${hash} {}}`, ruleIndex));
99
+ }
100
+ if (queryRule instanceof CSSMediaRule) {
101
+ Object.entries(value).forEach(([mqKey, mqValue]) => {
102
+ this.applyRule({
103
+ hash,
104
+ key: mqKey,
105
+ value: mqValue,
106
+ sheet: queryRule
107
+ });
108
+ });
109
+ }
110
+ return;
111
+ }
112
+
113
+ // Pseudo
114
+ if (typeof value === 'object') {
115
+ Object.entries(value).forEach(([pseudoKey, pseudoValue]) => {
116
+ this.applyRule({
117
+ hash: `${hash}${key.replace('_', ':')}`,
118
+ key: pseudoKey,
119
+ value: pseudoValue,
120
+ sheet: this.styleTag.sheet
121
+ });
122
+ });
123
+ return;
124
+ }
125
+ this.applyRule({
126
+ hash,
127
+ key,
128
+ value,
129
+ sheet: this.styleTag.sheet
130
+ });
131
+ });
132
+ };
133
+ applyRule = ({
134
+ hash,
135
+ key,
136
+ value,
137
+ sheet
138
+ }) => {
139
+ let rule = Array.from(sheet.cssRules).find(rule => {
140
+ if (!(rule instanceof CSSStyleRule)) {
141
+ return false;
142
+ }
143
+
144
+ // In unistyles pseudos are prefixed with ':' but in css some of them are prefixed with '::'
145
+ return rule.selectorText.replace('::', ':').includes(hash);
146
+ }) ?? null;
147
+ if (!rule) {
148
+ rule = sheet.cssRules.item(sheet.insertRule(`.${hash} {}`));
149
+ }
150
+ if (!(rule instanceof CSSStyleRule) || !(0, _utils.keyInObject)(rule.style, key)) {
151
+ return;
152
+ }
153
+ rule.style[key] = value;
154
+ };
155
+ remove = value => {
156
+ const hash = (0, _utils.generateHash)(value);
157
+ const existingStyles = this.stylesCounter.get(hash);
158
+ if (!existingStyles) {
159
+ return;
160
+ }
161
+ existingStyles.delete(value);
162
+ if (existingStyles.size === 0) {
163
+ const ruleIndex = Array.from(this.styleTag.sheet?.cssRules ?? []).findIndex(rule => rule.cssText.includes(`.${hash}`));
164
+ if (ruleIndex === -1) {
165
+ return;
166
+ }
167
+ this.styleTag.sheet?.deleteRule(ruleIndex);
168
+ }
169
+ };
170
+ }
171
+ const UnistylesRegistry = exports.UnistylesRegistry = new UnistylesRegistryBuilder();
172
+ //# sourceMappingURL=registry.js.map