react-native-unistyles 3.0.0-alpha.1 → 3.0.0-alpha.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. package/Unistyles.podspec +33 -0
  2. package/cxx/common/Constants.h +1 -0
  3. package/cxx/common/Helpers.h +92 -0
  4. package/cxx/core/HostStyle.cpp +18 -12
  5. package/cxx/core/HostStyle.h +3 -0
  6. package/cxx/core/StyleSheet.h +0 -1
  7. package/cxx/core/StyleSheetRegistry.cpp +10 -13
  8. package/cxx/core/StyleSheetRegistry.h +4 -4
  9. package/cxx/core/Unistyle.h +0 -6
  10. package/cxx/core/UnistyleData.h +23 -0
  11. package/cxx/core/UnistyleWrapper.h +6 -6
  12. package/cxx/core/UnistylesCommitHook.cpp +8 -7
  13. package/cxx/core/UnistylesCommitHook.h +6 -1
  14. package/cxx/core/UnistylesCommitShadowNode.h +13 -0
  15. package/cxx/core/UnistylesMountHook.cpp +40 -0
  16. package/cxx/core/UnistylesMountHook.h +30 -0
  17. package/cxx/core/UnistylesRegistry.cpp +42 -56
  18. package/cxx/core/UnistylesRegistry.h +10 -8
  19. package/cxx/core/UnistylesState.cpp +4 -4
  20. package/cxx/hybridObjects/HybridShadowRegistry.cpp +8 -1
  21. package/cxx/hybridObjects/HybridStyleSheet.cpp +35 -39
  22. package/cxx/hybridObjects/HybridStyleSheet.h +9 -6
  23. package/cxx/hybridObjects/HybridUnistylesRuntime.cpp +34 -15
  24. package/cxx/hybridObjects/HybridUnistylesRuntime.h +2 -0
  25. package/cxx/parser/Parser.cpp +65 -137
  26. package/cxx/parser/Parser.h +8 -14
  27. package/ios/UnistylesModuleOnLoad.h +2 -0
  28. package/ios/UnistylesModuleOnLoad.mm +8 -1
  29. package/lib/commonjs/specs/NavigtionBar/index.js +1 -1
  30. package/lib/commonjs/specs/NavigtionBar/index.js.map +1 -1
  31. package/lib/commonjs/specs/ShadowRegistry/index.js +2 -2
  32. package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
  33. package/lib/commonjs/specs/StatusBar/index.js +1 -1
  34. package/lib/commonjs/specs/StatusBar/index.js.map +1 -1
  35. package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
  36. package/lib/commonjs/specs/UnistylesRuntime/index.js +1 -1
  37. package/lib/commonjs/specs/UnistylesRuntime/index.js.map +1 -1
  38. package/lib/commonjs/specs/index.web.js +1 -1
  39. package/lib/commonjs/web/convert/boxShadow.js +77 -0
  40. package/lib/commonjs/web/convert/boxShadow.js.map +1 -0
  41. package/lib/commonjs/web/convert/breakpoint.js +25 -0
  42. package/lib/commonjs/web/convert/breakpoint.js.map +1 -0
  43. package/lib/commonjs/web/convert/index.js +76 -0
  44. package/lib/commonjs/web/convert/index.js.map +1 -0
  45. package/lib/commonjs/web/convert/module.d.js +2 -0
  46. package/lib/commonjs/web/convert/module.d.js.map +1 -0
  47. package/lib/commonjs/web/convert/shadow.js +68 -0
  48. package/lib/commonjs/web/convert/shadow.js.map +1 -0
  49. package/lib/commonjs/web/convert/style.js +89 -0
  50. package/lib/commonjs/web/convert/style.js.map +1 -0
  51. package/lib/commonjs/web/convert/textShadow.js +73 -0
  52. package/lib/commonjs/web/convert/textShadow.js.map +1 -0
  53. package/lib/commonjs/web/convert/transform.js +72 -0
  54. package/lib/commonjs/web/convert/transform.js.map +1 -0
  55. package/lib/commonjs/web/convert/types.js +9 -0
  56. package/lib/commonjs/web/convert/types.js.map +1 -0
  57. package/lib/commonjs/web/convert/utils.js +55 -0
  58. package/lib/commonjs/web/convert/utils.js.map +1 -0
  59. package/lib/commonjs/web/create.js +89 -0
  60. package/lib/commonjs/web/create.js.map +1 -0
  61. package/lib/commonjs/web/index.js +51 -0
  62. package/lib/commonjs/web/index.js.map +1 -0
  63. package/lib/commonjs/web/listener/index.js +13 -0
  64. package/lib/commonjs/web/listener/index.js.map +1 -0
  65. package/lib/commonjs/web/listener/listener.js +36 -0
  66. package/lib/commonjs/web/listener/listener.js.map +1 -0
  67. package/lib/commonjs/web/mock.js +37 -0
  68. package/lib/commonjs/web/mock.js.map +1 -0
  69. package/lib/commonjs/web/mq.js +23 -0
  70. package/lib/commonjs/web/mq.js.map +1 -0
  71. package/lib/commonjs/web/pseudo.js +11 -0
  72. package/lib/commonjs/web/pseudo.js.map +1 -0
  73. package/lib/commonjs/web/registry.js +37 -0
  74. package/lib/commonjs/web/registry.js.map +1 -0
  75. package/lib/commonjs/web/runtime.js +164 -0
  76. package/lib/commonjs/web/runtime.js.map +1 -0
  77. package/lib/commonjs/web/state.js +121 -0
  78. package/lib/commonjs/web/state.js.map +1 -0
  79. package/lib/commonjs/web/utils.js +78 -0
  80. package/lib/commonjs/web/utils.js.map +1 -0
  81. package/lib/commonjs/web/variants/getVariants.js +39 -0
  82. package/lib/commonjs/web/variants/getVariants.js.map +1 -0
  83. package/lib/commonjs/web/variants/index.js +28 -0
  84. package/lib/commonjs/web/variants/index.js.map +1 -0
  85. package/lib/commonjs/web/variants/useVariants.js +75 -0
  86. package/lib/commonjs/web/variants/useVariants.js.map +1 -0
  87. package/lib/module/specs/NavigtionBar/index.js +1 -1
  88. package/lib/module/specs/NavigtionBar/index.js.map +1 -1
  89. package/lib/module/specs/ShadowRegistry/index.js +2 -2
  90. package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
  91. package/lib/module/specs/StatusBar/index.js +1 -1
  92. package/lib/module/specs/StatusBar/index.js.map +1 -1
  93. package/lib/module/specs/StyleSheet/index.js.map +1 -1
  94. package/lib/module/specs/UnistylesRuntime/index.js +1 -1
  95. package/lib/module/specs/UnistylesRuntime/index.js.map +1 -1
  96. package/lib/module/specs/index.web.js +1 -1
  97. package/lib/module/specs/index.web.js.map +1 -1
  98. package/lib/module/web/convert/boxShadow.js +72 -0
  99. package/lib/module/web/convert/boxShadow.js.map +1 -0
  100. package/lib/module/web/convert/breakpoint.js +20 -0
  101. package/lib/module/web/convert/breakpoint.js.map +1 -0
  102. package/lib/module/web/convert/index.js +71 -0
  103. package/lib/module/web/convert/index.js.map +1 -0
  104. package/lib/module/web/convert/module.d.js +2 -0
  105. package/lib/module/web/convert/module.d.js.map +1 -0
  106. package/lib/module/web/convert/shadow.js +63 -0
  107. package/lib/module/web/convert/shadow.js.map +1 -0
  108. package/lib/module/web/convert/style.js +84 -0
  109. package/lib/module/web/convert/style.js.map +1 -0
  110. package/lib/module/web/convert/textShadow.js +68 -0
  111. package/lib/module/web/convert/textShadow.js.map +1 -0
  112. package/lib/module/web/convert/transform.js +67 -0
  113. package/lib/module/web/convert/transform.js.map +1 -0
  114. package/lib/module/web/convert/types.js +5 -0
  115. package/lib/module/web/convert/types.js.map +1 -0
  116. package/lib/module/web/convert/utils.js +43 -0
  117. package/lib/module/web/convert/utils.js.map +1 -0
  118. package/lib/module/web/create.js +84 -0
  119. package/lib/module/web/create.js.map +1 -0
  120. package/lib/module/web/index.js +24 -0
  121. package/lib/module/web/index.js.map +1 -0
  122. package/lib/module/web/listener/index.js +4 -0
  123. package/lib/module/web/listener/index.js.map +1 -0
  124. package/lib/module/web/listener/listener.js +31 -0
  125. package/lib/module/web/listener/listener.js.map +1 -0
  126. package/lib/module/web/mock.js +33 -0
  127. package/lib/module/web/mock.js.map +1 -0
  128. package/lib/module/web/mq.js +17 -0
  129. package/lib/module/web/mq.js.map +1 -0
  130. package/lib/module/web/pseudo.js +6 -0
  131. package/lib/module/web/pseudo.js.map +1 -0
  132. package/lib/module/web/registry.js +33 -0
  133. package/lib/module/web/registry.js.map +1 -0
  134. package/lib/module/web/runtime.js +160 -0
  135. package/lib/module/web/runtime.js.map +1 -0
  136. package/lib/module/web/state.js +117 -0
  137. package/lib/module/web/state.js.map +1 -0
  138. package/lib/module/web/utils.js +65 -0
  139. package/lib/module/web/utils.js.map +1 -0
  140. package/lib/module/web/variants/getVariants.js +34 -0
  141. package/lib/module/web/variants/getVariants.js.map +1 -0
  142. package/lib/module/web/variants/index.js +5 -0
  143. package/lib/module/web/variants/index.js.map +1 -0
  144. package/lib/module/web/variants/useVariants.js +70 -0
  145. package/lib/module/web/variants/useVariants.js.map +1 -0
  146. package/lib/typescript/example/App.d.ts.map +1 -1
  147. package/lib/typescript/example/Typography.d.ts +12 -0
  148. package/lib/typescript/example/Typography.d.ts.map +1 -0
  149. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
  150. package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
  151. package/lib/typescript/src/specs/StyleSheet/index.d.ts +2 -1
  152. package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
  153. package/lib/typescript/src/specs/index.web.d.ts +1 -1
  154. package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
  155. package/lib/typescript/src/types/stylesheet.d.ts +1 -1
  156. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  157. package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -0
  158. package/lib/typescript/src/web/convert/breakpoint.d.ts.map +1 -0
  159. package/lib/typescript/{web → src/web}/convert/index.d.ts +1 -1
  160. package/lib/typescript/src/web/convert/index.d.ts.map +1 -0
  161. package/lib/typescript/src/web/convert/shadow.d.ts.map +1 -0
  162. package/lib/typescript/src/web/convert/style.d.ts.map +1 -0
  163. package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -0
  164. package/lib/typescript/src/web/convert/transform.d.ts.map +1 -0
  165. package/lib/typescript/{web → src/web}/convert/types.d.ts +1 -1
  166. package/lib/typescript/src/web/convert/types.d.ts.map +1 -0
  167. package/lib/typescript/src/web/convert/utils.d.ts.map +1 -0
  168. package/lib/typescript/{web → src/web}/create.d.ts +11 -11
  169. package/lib/typescript/{web → src/web}/create.d.ts.map +1 -1
  170. package/lib/typescript/{web → src/web}/index.d.ts +12 -12
  171. package/lib/typescript/{web → src/web}/index.d.ts.map +1 -1
  172. package/lib/typescript/src/web/listener/index.d.ts.map +1 -0
  173. package/lib/typescript/{web → src/web}/listener/listener.d.ts +1 -1
  174. package/lib/typescript/src/web/listener/listener.d.ts.map +1 -0
  175. package/lib/typescript/{web → src/web}/mock.d.ts +2 -2
  176. package/lib/typescript/src/web/mock.d.ts.map +1 -0
  177. package/lib/typescript/src/web/mq.d.ts.map +1 -0
  178. package/lib/typescript/src/web/pseudo.d.ts.map +1 -0
  179. package/lib/typescript/{web → src/web}/registry.d.ts +1 -1
  180. package/lib/typescript/src/web/registry.d.ts.map +1 -0
  181. package/lib/typescript/{web → src/web}/runtime.d.ts +6 -6
  182. package/lib/typescript/src/web/runtime.d.ts.map +1 -0
  183. package/lib/typescript/{web → src/web}/state.d.ts +4 -4
  184. package/lib/typescript/src/web/state.d.ts.map +1 -0
  185. package/lib/typescript/{web → src/web}/utils.d.ts +5 -3
  186. package/lib/typescript/src/web/utils.d.ts.map +1 -0
  187. package/lib/typescript/src/web/variants/getVariants.d.ts +3 -0
  188. package/lib/typescript/src/web/variants/getVariants.d.ts.map +1 -0
  189. package/lib/typescript/src/web/variants/index.d.ts +3 -0
  190. package/lib/typescript/src/web/variants/index.d.ts.map +1 -0
  191. package/lib/typescript/src/web/variants/useVariants.d.ts +3 -0
  192. package/lib/typescript/src/web/variants/useVariants.d.ts.map +1 -0
  193. package/package.json +2 -2
  194. package/plugin/__tests__/dependencies.spec.js +181 -103
  195. package/plugin/__tests__/ref.spec.js +335 -156
  196. package/plugin/__tests__/stylesheet.spec.js +148 -55
  197. package/plugin/index.js +31 -21
  198. package/plugin/ref.js +43 -11
  199. package/plugin/style.js +13 -24
  200. package/plugin/stylesheet.js +44 -1
  201. package/plugin/variants.js +33 -0
  202. package/src/specs/NavigtionBar/index.ts +1 -1
  203. package/src/specs/ShadowRegistry/index.ts +4 -4
  204. package/src/specs/StatusBar/index.ts +1 -1
  205. package/src/specs/StyleSheet/index.ts +3 -1
  206. package/src/specs/UnistylesRuntime/index.ts +1 -1
  207. package/src/specs/index.web.ts +1 -1
  208. package/src/types/stylesheet.ts +1 -1
  209. package/{web → src/web}/convert/breakpoint.ts +1 -1
  210. package/{web → src/web}/convert/index.ts +1 -1
  211. package/{web → src/web}/convert/types.ts +1 -1
  212. package/{web → src/web}/create.ts +36 -33
  213. package/{web → src/web}/listener/listener.ts +1 -1
  214. package/{web → src/web}/mock.ts +2 -2
  215. package/{web → src/web}/registry.ts +1 -1
  216. package/{web → src/web}/runtime.ts +4 -4
  217. package/{web → src/web}/state.ts +5 -5
  218. package/{web → src/web}/utils.ts +5 -5
  219. package/src/web/variants/getVariants.ts +42 -0
  220. package/src/web/variants/index.ts +2 -0
  221. package/{web → src/web/variants}/useVariants.ts +24 -44
  222. package/lib/typescript/web/convert/boxShadow.d.ts.map +0 -1
  223. package/lib/typescript/web/convert/breakpoint.d.ts.map +0 -1
  224. package/lib/typescript/web/convert/index.d.ts.map +0 -1
  225. package/lib/typescript/web/convert/shadow.d.ts.map +0 -1
  226. package/lib/typescript/web/convert/style.d.ts.map +0 -1
  227. package/lib/typescript/web/convert/textShadow.d.ts.map +0 -1
  228. package/lib/typescript/web/convert/transform.d.ts.map +0 -1
  229. package/lib/typescript/web/convert/types.d.ts.map +0 -1
  230. package/lib/typescript/web/convert/utils.d.ts.map +0 -1
  231. package/lib/typescript/web/listener/index.d.ts.map +0 -1
  232. package/lib/typescript/web/listener/listener.d.ts.map +0 -1
  233. package/lib/typescript/web/mock.d.ts.map +0 -1
  234. package/lib/typescript/web/mq.d.ts.map +0 -1
  235. package/lib/typescript/web/pseudo.d.ts.map +0 -1
  236. package/lib/typescript/web/registry.d.ts.map +0 -1
  237. package/lib/typescript/web/runtime.d.ts.map +0 -1
  238. package/lib/typescript/web/state.d.ts.map +0 -1
  239. package/lib/typescript/web/useVariants.d.ts +0 -3
  240. package/lib/typescript/web/useVariants.d.ts.map +0 -1
  241. package/lib/typescript/web/utils.d.ts.map +0 -1
  242. /package/lib/typescript/{web → src/web}/convert/boxShadow.d.ts +0 -0
  243. /package/lib/typescript/{web → src/web}/convert/breakpoint.d.ts +0 -0
  244. /package/lib/typescript/{web → src/web}/convert/shadow.d.ts +0 -0
  245. /package/lib/typescript/{web → src/web}/convert/style.d.ts +0 -0
  246. /package/lib/typescript/{web → src/web}/convert/textShadow.d.ts +0 -0
  247. /package/lib/typescript/{web → src/web}/convert/transform.d.ts +0 -0
  248. /package/lib/typescript/{web → src/web}/convert/utils.d.ts +0 -0
  249. /package/lib/typescript/{web → src/web}/listener/index.d.ts +0 -0
  250. /package/lib/typescript/{web → src/web}/mq.d.ts +0 -0
  251. /package/lib/typescript/{web → src/web}/pseudo.d.ts +0 -0
  252. /package/{web → src/web}/convert/boxShadow.ts +0 -0
  253. /package/{web → src/web}/convert/module.d.ts +0 -0
  254. /package/{web → src/web}/convert/shadow.ts +0 -0
  255. /package/{web → src/web}/convert/style.ts +0 -0
  256. /package/{web → src/web}/convert/textShadow.ts +0 -0
  257. /package/{web → src/web}/convert/transform.ts +0 -0
  258. /package/{web → src/web}/convert/utils.ts +0 -0
  259. /package/{web → src/web}/index.ts +0 -0
  260. /package/{web → src/web}/listener/index.ts +0 -0
  261. /package/{web → src/web}/mq.ts +0 -0
  262. /package/{web → src/web}/pseudo.ts +0 -0
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ import { keyInObject } from '../utils';
4
+ const stylesToSkip = ['borderCurve', 'elevation', 'textAlignVertical', 'includeFontPadding', 'overlayColor', 'tintColor'];
5
+ const convertMap = {
6
+ marginHorizontal: value => ({
7
+ marginInline: value
8
+ }),
9
+ marginVertical: value => ({
10
+ marginBlock: value
11
+ }),
12
+ paddingHorizontal: value => ({
13
+ paddingInline: value
14
+ }),
15
+ paddingVertical: value => ({
16
+ paddingBlock: value
17
+ }),
18
+ writingDirection: value => ({
19
+ direction: value
20
+ }),
21
+ borderBottomEndRadius: value => ({
22
+ borderBottomRightRadius: value
23
+ }),
24
+ borderBottomStartRadius: value => ({
25
+ borderBottomLeftRadius: value
26
+ }),
27
+ borderEndColor: value => ({
28
+ borderInlineEndColor: value
29
+ }),
30
+ borderStartColor: value => ({
31
+ borderInlineStartColor: value
32
+ }),
33
+ borderTopEndRadius: value => ({
34
+ borderTopRightRadius: value
35
+ }),
36
+ borderTopStartRadius: value => ({
37
+ borderTopLeftRadius: value
38
+ }),
39
+ borderEndWidth: value => ({
40
+ borderInlineEndWidth: value
41
+ }),
42
+ borderStartWidth: value => ({
43
+ borderInlineStartWidth: value
44
+ }),
45
+ end: value => ({
46
+ right: value
47
+ }),
48
+ start: value => ({
49
+ left: value
50
+ }),
51
+ marginEnd: value => ({
52
+ marginRight: value
53
+ }),
54
+ marginStart: value => ({
55
+ marginLeft: value
56
+ }),
57
+ paddingEnd: value => ({
58
+ paddingRight: value
59
+ }),
60
+ paddingStart: value => ({
61
+ paddingLeft: value
62
+ }),
63
+ transformMatrix: value => ({
64
+ transform: `matrix(${value.join(', ')})`
65
+ }),
66
+ resizeMode: value => ({
67
+ backgroundSize: value
68
+ }),
69
+ lineHeight: value => ({
70
+ lineHeight: `${value}px`
71
+ })
72
+ };
73
+ export const getStyle = (key, value) => {
74
+ if (stylesToSkip.includes(key)) {
75
+ return {};
76
+ }
77
+ if (keyInObject(convertMap, key)) {
78
+ return convertMap[key]?.(value) ?? {};
79
+ }
80
+ return {
81
+ [key]: value
82
+ };
83
+ };
84
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["keyInObject","stylesToSkip","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","lineHeight","getStyle","key","includes"],"sourceRoot":"../../../../src","sources":["web/convert/style.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,UAAU;AA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7B;EACV,CAAC,CAAC;EACF8B,SAAS,EAAG9B,KAAa,KAAM;IAC3B+B,WAAW,EAAE/B;EACjB,CAAC,CAAC;EACFgC,WAAW,EAAGhC,KAAa,KAAM;IAC7BiC,UAAU,EAAEjC;EAChB,CAAC,CAAC;EACFkC,UAAU,EAAGlC,KAAa,KAAM;IAC5BmC,YAAY,EAAEnC;EAClB,CAAC,CAAC;EACFoC,YAAY,EAAGpC,KAAa,KAAM;IAC9BqC,WAAW,EAAErC;EACjB,CAAC,CAAC;EACFsC,eAAe,EAAGtC,KAAoB,KAAM;IACxCuC,SAAS,EAAE,UAAUvC,KAAK,CAACwC,IAAI,CAAC,IAAI,CAAC;EACzC,CAAC,CAAC;EACFC,UAAU,EAAGzC,KAAa,KAAM;IAC5B0C,cAAc,EAAE1C;EACpB,CAAC,CAAC;EACF2C,UAAU,EAAG3C,KAAa,KAAM;IAC5B2C,UAAU,EAAE,GAAG3C,KAAK;EACxB,CAAC;AACL,CAA6D;AAE7D,OAAO,MAAM4C,QAAQ,GAAGA,CAACC,GAAW,EAAE7C,KAAU,KAAK;EACjD,IAAIH,YAAY,CAACiD,QAAQ,CAACD,GAAG,CAAC,EAAE;IAC5B,OAAO,CAAC,CAAC;EACb;EAEA,IAAIjD,WAAW,CAACE,UAAU,EAAE+C,GAAG,CAAC,EAAE;IAC9B,OAAO/C,UAAU,CAAC+C,GAAG,CAAC,GAAG7C,KAAK,CAAC,IAAI,CAAC,CAAC;EACzC;EAEA,OAAO;IACH,CAAC6C,GAAG,GAAG7C;EACX,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ import { media } from 'typestyle';
4
+ import { deepMergeObjects, warn } from '../utils';
5
+ import { validateShadow } from './shadow';
6
+ import { convertBreakpoint } from './breakpoint';
7
+ import { TEXT_SHADOW_STYLES } from './types';
8
+ import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
9
+ const createTextShadowValue = style => {
10
+ const {
11
+ textShadowColor,
12
+ textShadowOffset,
13
+ textShadowRadius
14
+ } = style;
15
+ const offsetX = normalizeNumericValue(textShadowOffset.width);
16
+ const offsetY = normalizeNumericValue(textShadowOffset.height);
17
+ const radius = normalizeNumericValue(textShadowRadius);
18
+ const color = normalizeColor(textShadowColor);
19
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
20
+ };
21
+ export const getTextShadowStyle = styles => {
22
+ const missingStyles = TEXT_SHADOW_STYLES.filter(key => !(key in styles));
23
+ if (missingStyles.length) {
24
+ warn(`can't apply text shadow as you miss these properties: ${missingStyles.join(', ')}`);
25
+ return {};
26
+ }
27
+ const breakpointsSet = new Set();
28
+ try {
29
+ validateShadow(TEXT_SHADOW_STYLES, styles, breakpointsSet);
30
+ } catch (error) {
31
+ if (typeof error === 'string') {
32
+ warn(error);
33
+ }
34
+ return {};
35
+ }
36
+ const breakpoints = Array.from(breakpointsSet);
37
+
38
+ // If no breakpoints were used return styles without media queries
39
+ if (breakpoints.length === 0) {
40
+ return {
41
+ textShadow: createTextShadowValue(styles)
42
+ };
43
+ }
44
+
45
+ // Create textShadow for each breakpoint
46
+ const breakpointStyles = breakpoints.map(breakpoint => {
47
+ const color = extractShadowValue('textShadowColor', breakpoint, styles);
48
+ const {
49
+ width,
50
+ height
51
+ } = extractShadowValue('textShadowOffset', breakpoint, styles);
52
+ const radius = extractShadowValue('textShadowRadius', breakpoint, styles);
53
+ return media(convertBreakpoint(breakpoint), {
54
+ textShadow: createTextShadowValue({
55
+ textShadowColor: color,
56
+ textShadowOffset: {
57
+ width,
58
+ height
59
+ },
60
+ textShadowRadius: radius
61
+ })
62
+ });
63
+ });
64
+
65
+ // Merge all breakpoints styles into one
66
+ return deepMergeObjects(...breakpointStyles);
67
+ };
68
+ //# sourceMappingURL=textShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["media","deepMergeObjects","warn","validateShadow","convertBreakpoint","TEXT_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","color","getTextShadowStyle","styles","missingStyles","filter","key","length","join","breakpointsSet","Set","error","breakpoints","Array","from","textShadow","breakpointStyles","map","breakpoint"],"sourceRoot":"../../../../src","sources":["web/convert/textShadow.ts"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,WAAW;AAEjC,SAASC,gBAAgB,EAAEC,IAAI,QAAQ,UAAU;AACjD,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,kBAAkB,QAAyB,SAAS;AAC7D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,SAAS;AAEnF,MAAMC,qBAAqB,GAAIC,KAAiB,IAAK;EACjD,MAAM;IAAEC,eAAe;IAAEC,gBAAgB;IAAEC;EAAiB,CAAC,GAAGH,KAAK;EACrE,MAAMI,OAAO,GAAGN,qBAAqB,CAACI,gBAAgB,CAACG,KAAK,CAAC;EAC7D,MAAMC,OAAO,GAAGR,qBAAqB,CAACI,gBAAgB,CAACK,MAAM,CAAC;EAC9D,MAAMC,MAAM,GAAGV,qBAAqB,CAACK,gBAAgB,CAAC;EACtD,MAAMM,KAAK,GAAGZ,cAAc,CAACI,eAAyB,CAAC;EAEvD,OAAO,GAAGG,OAAO,IAAIE,OAAO,IAAIE,MAAM,IAAIC,KAAK,EAAE;AACrD,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAIC,MAA2B,IAA0B;EACpF,MAAMC,aAAa,GAAGjB,kBAAkB,CAACkB,MAAM,CAACC,GAAG,IAAI,EAAEA,GAAG,IAAIH,MAAM,CAAC,CAAC;EAExE,IAAIC,aAAa,CAACG,MAAM,EAAE;IACtBvB,IAAI,CAAC,yDAAyDoB,aAAa,CAACI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAEzF,OAAO,CAAC,CAAC;EACb;EAEA,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAAS,CAAC;EAExC,IAAI;IACAzB,cAAc,CAACE,kBAAkB,EAAEgB,MAAM,EAAEM,cAAc,CAAC;EAC9D,CAAC,CAAC,OAAOE,KAAK,EAAE;IACZ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC3B3B,IAAI,CAAC2B,KAAK,CAAC;IACf;IAEA,OAAO,CAAC,CAAC;EACb;EAEA,MAAMC,WAAW,GAAGC,KAAK,CAACC,IAAI,CAACL,cAAc,CAAC;;EAE9C;EACA,IAAIG,WAAW,CAACL,MAAM,KAAK,CAAC,EAAE;IAC1B,OAAO;MACHQ,UAAU,EAAExB,qBAAqB,CAACY,MAAoB;IAC1D,CAAC;EACL;;EAEA;EACA,MAAMa,gBAAgB,GAAGJ,WAAW,CAACK,GAAG,CAACC,UAAU,IAAI;IACnD,MAAMjB,KAAK,GAAGb,kBAAkB,CAAC,iBAAiB,EAAE8B,UAAU,EAAEf,MAAM,CAAC;IACvE,MAAM;MAAEN,KAAK;MAAEE;IAAO,CAAC,GAAGX,kBAAkB,CAAC,kBAAkB,EAAE8B,UAAU,EAAEf,MAAM,CAAC;IACpF,MAAMH,MAAM,GAAGZ,kBAAkB,CAAC,kBAAkB,EAAE8B,UAAU,EAAEf,MAAM,CAAC;IAEzE,OAAOrB,KAAK,CAACI,iBAAiB,CAACgC,UAAU,CAAC,EAAE;MACxCH,UAAU,EAAExB,qBAAqB,CAAC;QAC9BE,eAAe,EAAEQ,KAAK;QACtBP,gBAAgB,EAAE;UACdG,KAAK;UACLE;QACJ,CAAC;QACDJ,gBAAgB,EAAEK;MACtB,CAAC;IACL,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;EACA,OAAOjB,gBAAgB,CAAC,GAAGiC,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ import { media } from 'typestyle';
4
+ import { deepMergeObjects, keyInObject } from '../utils';
5
+ import { normalizeNumericValue } from './utils';
6
+ import { convertBreakpoint } from './breakpoint';
7
+ const normalizeTransform = (key, value) => {
8
+ if (key.includes('scale')) {
9
+ return value;
10
+ }
11
+ if (typeof value === 'number') {
12
+ return normalizeNumericValue(value);
13
+ }
14
+ return value;
15
+ };
16
+ const createTransformValue = transforms => transforms.map(transform => {
17
+ const [key] = Object.keys(transform);
18
+ if (!key) {
19
+ return undefined;
20
+ }
21
+ const value = transform[key];
22
+ switch (key) {
23
+ case 'matrix':
24
+ case 'matrix3d':
25
+ return `${key}(${value.join(',')})`;
26
+ default:
27
+ return `${key}(${normalizeTransform(key, value)})`;
28
+ }
29
+ }).filter(Boolean).join(' ');
30
+ export const getTransformStyle = transforms => {
31
+ const breakpoints = new Set();
32
+ const normalTransforms = [];
33
+ transforms.forEach(transform => {
34
+ const [property] = Object.keys(transform);
35
+ if (!property) {
36
+ return;
37
+ }
38
+ const value = transform[property];
39
+ if (typeof value === 'object' && !Array.isArray(value)) {
40
+ Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
41
+ return;
42
+ }
43
+ normalTransforms.push(transform);
44
+ });
45
+ const breakpointTransforms = Array.from(breakpoints).flatMap(breakpoint => {
46
+ const transformsPerBreakpoint = transforms.flatMap(transform => {
47
+ const [property] = Object.keys(transform);
48
+ if (!property) {
49
+ return [];
50
+ }
51
+ const value = transform[property];
52
+ if (typeof value === 'object' && !Array.isArray(value)) {
53
+ return keyInObject(value, breakpoint) ? [{
54
+ [property]: value[breakpoint]
55
+ }] : [];
56
+ }
57
+ return [];
58
+ });
59
+ return media(convertBreakpoint(breakpoint), {
60
+ transform: createTransformValue(transformsPerBreakpoint)
61
+ });
62
+ });
63
+ return deepMergeObjects({
64
+ transform: createTransformValue(normalTransforms)
65
+ }, ...breakpointTransforms);
66
+ };
67
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["media","deepMergeObjects","keyInObject","normalizeNumericValue","convertBreakpoint","normalizeTransform","key","value","includes","createTransformValue","transforms","map","transform","Object","keys","undefined","join","filter","Boolean","getTransformStyle","breakpoints","Set","normalTransforms","forEach","property","Array","isArray","breakpoint","add","push","breakpointTransforms","from","flatMap","transformsPerBreakpoint"],"sourceRoot":"../../../../src","sources":["web/convert/transform.ts"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,WAAW;AAEjC,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,UAAU;AACxD,SAASC,qBAAqB,QAAQ,SAAS;AAC/C,SAASC,iBAAiB,QAAQ,cAAc;AAIhD,MAAMC,kBAAkB,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAK;EACpD,IAAID,GAAG,CAACE,QAAQ,CAAC,OAAO,CAAC,EAAE;IACvB,OAAOD,KAAK;EAChB;EAEA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOJ,qBAAqB,CAACI,KAAK,CAAC;EACvC;EAEA,OAAOA,KAAK;AAChB,CAAC;AAED,MAAME,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,CAC9DC,GAAG,CAACC,SAAS,IAAI;EACd,MAAM,CAACN,GAAG,CAAC,GAAGO,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACN,GAAG,EAAE;IACN,OAAOS,SAAS;EACpB;EAEA,MAAMR,KAAK,GAAGK,SAAS,CAACN,GAAG,CAAC;EAE5B,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAO,GAAGA,GAAG,IAAKC,KAAK,CAAmBS,IAAI,CAAC,GAAG,CAAC,GAAG;IAC1D;MACI,OAAO,GAAGV,GAAG,IAAID,kBAAkB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAG;EAC1D;AACJ,CAAC,CAAC,CACDU,MAAM,CAACC,OAAO,CAAC,CACfF,IAAI,CAAC,GAAG,CAAC;AAEd,OAAO,MAAMG,iBAAiB,GAAIT,UAAsB,IAA0B;EAC9E,MAAMU,WAAW,GAAG,IAAIC,GAAG,CAAS,CAAC;EAC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xCf,SAAS,EAAEH,oBAAoB,CAACwB,uBAAuB;IAC3D,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAOhC,gBAAgB,CAAC;IACpBW,SAAS,EAAEH,oBAAoB,CAACa,gBAAgB;EACpD,CAAC,EAAE,GAAGQ,oBAAoB,CAAC;AAC/B,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export const TEXT_SHADOW_STYLES = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
4
+ export const BOX_SHADOW_STYLES = ['shadowColor', 'shadowRadius', 'shadowOpacity', 'shadowOffset'];
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TEXT_SHADOW_STYLES","BOX_SHADOW_STYLES"],"sourceRoot":"../../../../src","sources":["web/convert/types.ts"],"mappings":";;AAKA,OAAO,MAAMA,kBAAkB,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAU;AAItG,OAAO,MAAMC,iBAAiB,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAU","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ // based on react-native-web normalizer
4
+ // https://github.com/necolas/react-native-web
5
+ import normalizeColors from '@react-native/normalize-colors';
6
+ import { BOX_SHADOW_STYLES, TEXT_SHADOW_STYLES } from './types';
7
+ export const isTransform = (key, value) => key === 'transform' && Array.isArray(value);
8
+ export const isTextShadow = key => TEXT_SHADOW_STYLES.includes(key);
9
+ export const isBoxShadow = key => BOX_SHADOW_STYLES.includes(key);
10
+ export const normalizeNumericValue = value => value ? `${value}px` : value;
11
+ export const normalizeColor = (color, opacity = 1) => {
12
+ // If the opacity is 1 there's no need to normalize the color
13
+ if (opacity === 1) {
14
+ return color;
15
+ }
16
+ const integer = normalizeColors(color);
17
+
18
+ // If the color is an unknown format, the return value is null
19
+ if (integer === null) {
20
+ return color;
21
+ }
22
+ const hex = integer.toString(16).padStart(8, '0');
23
+ if (hex.length === 8) {
24
+ const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
25
+ return `rgba(${r},${g},${b},${a / 255 * opacity})`;
26
+ }
27
+ return color;
28
+ };
29
+ export const extractShadowValue = (key, breakpoint, styles) => {
30
+ const value = styles[key];
31
+ if (key === 'textShadowOffset' || key === 'shadowOffset') {
32
+ const {
33
+ width,
34
+ height
35
+ } = value;
36
+ return {
37
+ width: typeof width === 'object' ? width[breakpoint] : width,
38
+ height: typeof height === 'object' ? height[breakpoint] : height
39
+ };
40
+ }
41
+ return typeof value === 'object' ? value[breakpoint] : value;
42
+ };
43
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeColors","BOX_SHADOW_STYLES","TEXT_SHADOW_STYLES","isTransform","key","value","Array","isArray","isTextShadow","includes","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","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":";;AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAC5D,SAASC,iBAAiB,EAAEC,kBAAkB,QAA4C,SAAS;AAEnG,OAAO,MAAMC,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAA0CD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAExI,OAAO,MAAMG,YAAY,GAAIJ,GAAW,IAAKF,kBAAkB,CAACO,QAAQ,CAACL,GAAwC,CAAC;AAElH,OAAO,MAAMM,WAAW,GAAIN,GAAW,IAAKH,iBAAiB,CAACQ,QAAQ,CAACL,GAAuC,CAAC;AAE/G,OAAO,MAAMO,qBAAqB,GAAIN,KAAa,IAAKA,KAAK,GAAG,GAAGA,KAAK,IAAI,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C,GAAGE,KAAK;MAC5DC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGA,MAAM,CAACH,UAAU,CAAC,GAAGG;IAC9D,CAAC;EACL;EAEA,OAAO,OAAO9B,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAAC2B,UAAU,CAAC,GAAG3B,KAAK;AAChE,CAAC","ignoreList":[]}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ import { UnistylesRegistry } from './registry';
4
+ import { keyInObject, reduceObject, toReactNativeClassName } from './utils';
5
+ import { UnistylesRuntime } from './runtime';
6
+ import { createUseVariants, getVariants } from './variants';
7
+ import { UnistylesListener } from './listener';
8
+ export const create = stylesheet => {
9
+ const computedStylesheet = typeof stylesheet === 'function' ? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : stylesheet;
10
+ let lastlySelectedVariants = {};
11
+ const listenToDependencies = ({
12
+ key,
13
+ className,
14
+ unistyles,
15
+ value,
16
+ args = []
17
+ }) => {
18
+ const dependencies = 'uni__dependencies' in value ? value['uni__dependencies'] : [];
19
+ if (dependencies.length === 0) {
20
+ return;
21
+ }
22
+ return UnistylesListener.addListeners(dependencies, () => {
23
+ const newComputedStylesheet = typeof stylesheet === 'function' ? stylesheet(UnistylesRuntime.theme, UnistylesRuntime.miniRuntime) : stylesheet;
24
+ if (!keyInObject(newComputedStylesheet, key)) {
25
+ return;
26
+ }
27
+ const value = newComputedStylesheet[key];
28
+ const result = typeof value === 'function' ? value(...args) : value;
29
+ UnistylesRegistry.updateStyles(unistyles, result, className);
30
+ });
31
+ };
32
+ const styles = reduceObject(computedStylesheet, (value, key) => {
33
+ if (typeof value === 'function') {
34
+ const webUnistyleByRef = new Map();
35
+ const disposeByRef = new Map();
36
+ return (...args) => {
37
+ const [ref] = args.slice(-1);
38
+ const result = value(...args);
39
+ const variants = Object.fromEntries(getVariants({
40
+ [key]: result
41
+ }, lastlySelectedVariants));
42
+ const resultWithVariants = {
43
+ ...result,
44
+ ...variants[key]
45
+ };
46
+ if (ref instanceof HTMLElement) {
47
+ const storedWebUnistyle = webUnistyleByRef.get(ref);
48
+ const webUnistyle = storedWebUnistyle ?? UnistylesRegistry.createStyles(resultWithVariants, key);
49
+ webUnistyleByRef.set(ref, webUnistyle);
50
+ disposeByRef.get(ref)?.();
51
+ disposeByRef.set(ref, listenToDependencies({
52
+ key,
53
+ value,
54
+ unistyles: webUnistyle.unistyles,
55
+ className: webUnistyle.className,
56
+ args
57
+ }));
58
+ ref.classList.add(webUnistyle.className);
59
+ if (storedWebUnistyle) {
60
+ UnistylesRegistry.updateStyles(webUnistyle.unistyles, resultWithVariants, webUnistyle.className);
61
+ }
62
+ return;
63
+ }
64
+ return toReactNativeClassName(null, resultWithVariants);
65
+ };
66
+ }
67
+ const {
68
+ className,
69
+ unistyles
70
+ } = UnistylesRegistry.createStyles(value, key);
71
+ listenToDependencies({
72
+ key,
73
+ value,
74
+ unistyles,
75
+ className
76
+ });
77
+ return toReactNativeClassName(className, value);
78
+ });
79
+ createUseVariants(styles, newVariants => {
80
+ lastlySelectedVariants = newVariants;
81
+ });
82
+ return styles;
83
+ };
84
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesRegistry","keyInObject","reduceObject","toReactNativeClassName","UnistylesRuntime","createUseVariants","getVariants","UnistylesListener","create","stylesheet","computedStylesheet","theme","miniRuntime","lastlySelectedVariants","listenToDependencies","key","className","unistyles","value","args","dependencies","length","addListeners","newComputedStylesheet","result","updateStyles","styles","webUnistyleByRef","Map","disposeByRef","ref","slice","variants","Object","fromEntries","resultWithVariants","HTMLElement","storedWebUnistyle","get","webUnistyle","createStyles","set","classList","add","newVariants"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;AAGA,SAASA,iBAAiB,QAAQ,YAAY;AAC9C,SAASC,WAAW,EAAEC,YAAY,EAAEC,sBAAsB,QAAQ,SAAS;AAC3E,SAASC,gBAAgB,QAAQ,WAAW;AAC5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,CAACvB,SAAS,CAAC;UACpG;UAGA;QACJ;QAEA,OAAOb,sBAAsB,CAAC,IAAI,EAAEgC,kBAAkB,CAAC;MAC3D,CAAC;IACL;IAEA,MAAM;MAAEnB,SAAS;MAAEC;IAAU,CAAC,GAAGjB,iBAAiB,CAACwC,YAAY,CAACtB,KAAK,EAAEH,GAAG,CAAC;IAE3ED,oBAAoB,CAAC;MAAEC,GAAG;MAAEG,KAAK;MAAED,SAAS;MAAED;IAAU,CAAC,CAAC;IAE1D,OAAOb,sBAAsB,CAACa,SAAS,EAAEE,KAAK,CAAC;EACnD,CAAC,CAAsC;EAEvCb,iBAAiB,CAACqB,MAAM,EAAEkB,WAAW,IAAI;IACrC/B,sBAAsB,GAAG+B,WAAW;EACxC,CAAC,CAAC;EAEF,OAAOlB,MAAM;AACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import { create } from './create';
4
+ import { UnistylesRuntime } from './runtime';
5
+ import { UnistylesState } from './state';
6
+ import { deepMergeObjects } from './utils';
7
+ export const StyleSheet = {
8
+ configure: UnistylesState.init,
9
+ create,
10
+ absoluteFill: {
11
+ position: 'absolute',
12
+ left: 0,
13
+ top: 0,
14
+ right: 0,
15
+ bottom: 0
16
+ },
17
+ compose: (a, b) => deepMergeObjects(a, b),
18
+ flatten: (...styles) => deepMergeObjects(...styles),
19
+ hairlineWidth: 1
20
+ };
21
+ export { UnistylesRuntime } from './runtime';
22
+ export * from './mock';
23
+ export const getSSRUnistyles = () => UnistylesRuntime.getSSRUnistyles();
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["create","UnistylesRuntime","UnistylesState","deepMergeObjects","StyleSheet","configure","init","absoluteFill","position","left","top","right","bottom","compose","a","b","flatten","styles","hairlineWidth","getSSRUnistyles"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,gBAAgB,QAAQ,WAAW;AAC5C,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,gBAAgB,QAAQ,SAAS;AAE1C,OAAO,MAAMC,UAAU,GAAG;EACtBC,SAAS,EAAEH,cAAc,CAACI,IAAI;EAC9BN,MAAM;EACNO,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,KAAKZ,gBAAgB,CAACW,CAAC,EAAEC,CAAC,CAAC;EACzDC,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAKd,gBAAgB,CAAC,GAAGc,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC;AAED,SAASjB,gBAAgB,QAAQ,WAAW;AAC5C,cAAc,QAAQ;AAEtB,OAAO,MAAMkB,eAAe,GAAGA,CAAA,KAAMlB,gBAAgB,CAACkB,eAAe,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { UnistylesListener } from './listener';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesListener"],"sourceRoot":"../../../../src","sources":["web/listener/index.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,YAAY","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ import { UnistyleDependency } from '../../specs/NativePlatform';
4
+ import { UnistylesRuntime } from '../runtime';
5
+ export class UnistylesListenerBuilder {
6
+ isInitialized = false;
7
+ listeners = Array.from({
8
+ length: Object.keys(UnistyleDependency).length / 2
9
+ }, () => new Set());
10
+ emitChange = dependency => {
11
+ this.listeners[dependency]?.forEach(listener => listener());
12
+ };
13
+ initListeners = () => {
14
+ if (this.isInitialized) {
15
+ return;
16
+ }
17
+ this.isInitialized = true;
18
+ UnistylesRuntime.darkMedia?.addEventListener('change', () => this.emitChange(UnistyleDependency.ColorScheme));
19
+ UnistylesRuntime.lightMedia?.addEventListener('change', () => this.emitChange(UnistyleDependency.ColorScheme));
20
+ window.addEventListener('orientationchange', () => this.emitChange(UnistyleDependency.Orientation));
21
+ window.addEventListener('resize', () => this.emitChange(UnistyleDependency.Dimensions));
22
+ };
23
+ addListeners = (dependencies, listener) => {
24
+ dependencies.forEach(dependency => this.listeners[dependency]?.add(listener));
25
+ return () => {
26
+ dependencies.forEach(dependency => this.listeners[dependency]?.delete(listener));
27
+ };
28
+ };
29
+ }
30
+ export const UnistylesListener = new UnistylesListenerBuilder();
31
+ //# sourceMappingURL=listener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistyleDependency","UnistylesRuntime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","Set","emitChange","dependency","forEach","listener","initListeners","darkMedia","addEventListener","ColorScheme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","UnistylesListener"],"sourceRoot":"../../../../src","sources":["web/listener/listener.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAO,MAAMC,wBAAwB,CAAC;EAC1BC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACO,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAIG,GAAG,CAAe,CAAC,CAAC;EAErHC,UAAU,GAAIC,UAA8B,IAAK;IAC7C,IAAI,CAACR,SAAS,CAACQ,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;EAC/D,CAAC;EAEDC,aAAa,GAAGA,CAAA,KAAM;IAClB,IAAI,IAAI,CAACZ,aAAa,EAAE;MACpB;IACJ;IAEA,IAAI,CAACA,aAAa,GAAG,IAAI;IACzBF,gBAAgB,CAACe,SAAS,EAAEC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACkB,WAAW,CAAC,CAAC;IAC7GjB,gBAAgB,CAACkB,UAAU,EAAEF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACkB,WAAW,CAAC,CAAC;IAC9GE,MAAM,CAACH,gBAAgB,CAAC,mBAAmB,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACqB,WAAW,CAAC,CAAC;IACnGD,MAAM,CAACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,IAAI,CAACN,UAAU,CAACX,kBAAkB,CAACsB,UAAU,CAAC,CAAC;EAC3F,CAAC;EAEDC,YAAY,GAAGA,CAACC,YAAuC,EAAEV,QAAsB,KAAK;IAChFU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACR,SAAS,CAACQ,UAAU,CAAC,EAAEa,GAAG,CAACX,QAAQ,CAAC,CAAC;IAE7E,OAAO,MAAM;MACTU,YAAY,CAACX,OAAO,CAACD,UAAU,IAAI,IAAI,CAACR,SAAS,CAACQ,UAAU,CAAC,EAAEc,MAAM,CAACZ,QAAQ,CAAC,CAAC;IACpF,CAAC;EACL,CAAC;AACL;AAEA,OAAO,MAAMa,iBAAiB,GAAG,IAAIzB,wBAAwB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ export const StatusBar = {
4
+ width: 0,
5
+ height: 0,
6
+ setStyle: () => {},
7
+ setHidden: () => {},
8
+ setBackgroundColor: () => {},
9
+ equals: () => true,
10
+ toString: () => 'StatusBar',
11
+ __type: 'web',
12
+ name: 'StatusBar'
13
+ };
14
+ export const NavigationBar = {
15
+ width: 0,
16
+ height: 0,
17
+ setHidden: () => {},
18
+ setBackgroundColor: () => {},
19
+ equals: () => true,
20
+ toString: () => 'NavigationBar',
21
+ __type: 'web',
22
+ name: 'NavigationBar'
23
+ };
24
+ export const UnistylesShadowRegistry = {
25
+ name: 'UnistylesShadowRegistry',
26
+ __type: 'web',
27
+ equals: () => true,
28
+ toString: () => 'UnistylesShadowRegistry',
29
+ dispose: () => {},
30
+ add: () => {},
31
+ remove: () => {}
32
+ };
33
+ //# sourceMappingURL=mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StatusBar","width","height","setStyle","setHidden","setBackgroundColor","equals","toString","__type","name","NavigationBar","UnistylesShadowRegistry","dispose","add","remove"],"sourceRoot":"../../../src","sources":["web/mock.ts"],"mappings":";;AAGA,OAAO,MAAMA,SAAwB,GAAG;EACpCC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,WAAW;EAC3BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAED,OAAO,MAAMC,aAAgC,GAAG;EAC5CT,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTE,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,eAAe;EAC/BC,MAAM,EAAE,KAAK;EACbC,IAAI,EAAE;AACV,CAAC;AAED,OAAO,MAAME,uBAAuB,GAAG;EACnCF,IAAI,EAAE,yBAAyB;EAC/BD,MAAM,EAAE,KAAK;EACbF,MAAM,EAAEA,CAAA,KAAM,IAAI;EAClBC,QAAQ,EAAEA,CAAA,KAAM,yBAAyB;EACzCK,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,GAAG,EAAEA,CAAA,KAAM,CAAC,CAAC;EACbC,MAAM,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
4
+ const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
5
+ const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
6
+ export const parseMq = mq => {
7
+ const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
8
+ const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
9
+ return {
10
+ minWidth: !width || fromW === 'Infinity' ? undefined : Number(fromW),
11
+ maxWidth: !width || toW === 'Infinity' ? undefined : Number(toW),
12
+ minHeight: !height || fromH === 'Infinity' ? undefined : Number(fromH),
13
+ maxHeight: !height || toH === 'Infinity' ? undefined : Number(toH)
14
+ };
15
+ };
16
+ export const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
17
+ //# sourceMappingURL=mq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","minWidth","undefined","Number","maxWidth","minHeight","maxHeight","isUnistylesMq","test"],"sourceRoot":"../../../src","sources":["web/mq.ts"],"mappings":";;AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAEpE,OAAO,MAAMC,OAAO,GAAIC,EAAU,IAAiB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHQ,QAAQ,EAAE,CAACP,KAAK,IAAIC,KAAK,KAAK,UAAU,GAAGO,SAAS,GAAGC,MAAM,CAACR,KAAK,CAAC;IACpES,QAAQ,EAAE,CAACV,KAAK,IAAIE,GAAG,KAAK,UAAU,GAAGM,SAAS,GAAGC,MAAM,CAACP,GAAG,CAAC;IAChES,SAAS,EAAE,CAACP,MAAM,IAAIC,KAAK,KAAK,UAAU,GAAGG,SAAS,GAAGC,MAAM,CAACJ,KAAK,CAAC;IACtEO,SAAS,EAAE,CAACR,MAAM,IAAIE,GAAG,KAAK,UAAU,GAAGE,SAAS,GAAGC,MAAM,CAACH,GAAG;EACrE,CAAC;AACL,CAAC;AAED,OAAO,MAAMO,aAAa,GAAId,EAAU,IAAKJ,kBAAkB,CAACmB,IAAI,CAACf,EAAE,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ // TODO: Add complete list of pseudo selectors
4
+ export const pseudos = ['_hover', '_css', '_before', '_after'];
5
+ export const isPseudo = selector => pseudos.includes(selector);
6
+ //# sourceMappingURL=pseudo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["pseudos","isPseudo","selector","includes"],"sourceRoot":"../../../src","sources":["web/pseudo.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,CACnB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,CACF;AAEV,OAAO,MAAMC,QAAQ,GAAIC,QAAgB,IAAKF,OAAO,CAACG,QAAQ,CAACD,QAAkB,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import { createTypeStyle } from 'typestyle';
4
+ import { convertToTypeStyle } from './convert';
5
+ import { UnistylesState } from './state';
6
+ class UnistylesRegistryBuilder {
7
+ createStyles = (stylesheet, key) => {
8
+ const stylesTag = UnistylesState.createTag();
9
+ const unistyles = createTypeStyle(stylesTag);
10
+ const typestyleStylesheet = convertToTypeStyle(stylesheet);
11
+ const className = unistyles.style({
12
+ $debugName: String(key)
13
+ }, typestyleStylesheet);
14
+ if (stylesheet._web?._css) {
15
+ const customClassName = Array.isArray(stylesheet._web._css) ? stylesheet._web._css.join(' ') : stylesheet._web._css;
16
+ return {
17
+ className: `${className} ${customClassName}`,
18
+ unistyles
19
+ };
20
+ }
21
+ return {
22
+ className,
23
+ unistyles
24
+ };
25
+ };
26
+ updateStyles = (unistyles, stylesheet, className) => {
27
+ const typestyleStylesheet = convertToTypeStyle(stylesheet);
28
+ unistyles.reinit();
29
+ unistyles.cssRule(`.${className}`, typestyleStylesheet);
30
+ };
31
+ }
32
+ export const UnistylesRegistry = new UnistylesRegistryBuilder();
33
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTypeStyle","convertToTypeStyle","UnistylesState","UnistylesRegistryBuilder","createStyles","stylesheet","key","stylesTag","createTag","unistyles","typestyleStylesheet","className","style","$debugName","String","_web","_css","customClassName","Array","isArray","join","updateStyles","reinit","cssRule","UnistylesRegistry"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAmB,WAAW;AAEtD,SAASC,kBAAkB,QAAQ,WAAW;AAC9C,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,wBAAwB,CAAC;EAC3BC,YAAY,GAAGA,CAACC,UAA2B,EAAEC,GAAoB,KAAK;IAClE,MAAMC,SAAS,GAAGL,cAAc,CAACM,SAAS,CAAC,CAAC;IAC5C,MAAMC,SAAS,GAAGT,eAAe,CAACO,SAAS,CAAC;IAC5C,MAAMG,mBAAmB,GAAGT,kBAAkB,CAACI,UAAU,CAAC;IAE1D,MAAMM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