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 @@
1
+ {"version":3,"names":["_react","require","_runtime","_utils","_listener","_NativePlatform","UnistylesStateBuilder","isSSR","isServer","tags","themes","Map","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","initSettings","settings","UnistylesListener","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","themeNames","Array","from","keys","initialTheme","length","Error","schemeToTheme","UnistylesRuntime","colorScheme","breakpointsMap","sort","a","b","breakpoint","value","mediaQuery","window","matchMedia","matches","addEventListener","event","currentBreakpoint","find","mq","emitChange","UnistyleDependency","Breakpoints","createTag","tag","document","createElement","head","appendChild","tagRef","Proxy","createRef","target","prop","textContent","Reflect","tagElement","ref","key","current","push","UnistylesState","exports"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH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I,KAAK,aAAa,EAAE;UACxB,OAAO,KAAK;QAChB;;QAEA;QACAD,MAAM,CAACE,WAAW,GAAGxB,KAAK;QAE1B,IAAImB,MAAM,CAACU,OAAO,EAAE;UAChBV,MAAM,CAACU,OAAO,CAACL,WAAW,GAAGxB,KAAK;QACtC;QAEA,OAAO,IAAI;MACf;IACJ,CAAC,CAAC;IAEF,IAAI,CAACnC,IAAI,CAACiE,IAAI,CAACJ,UAAU,CAAC;IAE1B,OAAOZ,GAAG;EACd;AACJ;AAEO,MAAMiB,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAIrE,qBAAqB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.warn = exports.toReactNativeClassName = exports.schemeToTheme = exports.reduceObject = exports.keyInObject = exports.isServer = exports.hexToRGBA = exports.equal = exports.deepMergeObjects = void 0;
7
+ var _types = require("../specs/types");
8
+ const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
9
+ exports.reduceObject = reduceObject;
10
+ const toReactNativeClassName = (className, values) => {
11
+ const returnValue = className ? {
12
+ $$css: true,
13
+ [className]: className
14
+ } : {};
15
+ Object.defineProperties(returnValue, reduceObject(values, value => ({
16
+ value,
17
+ enumerable: false,
18
+ configurable: true
19
+ })));
20
+ return returnValue;
21
+ };
22
+ exports.toReactNativeClassName = toReactNativeClassName;
23
+ const keyInObject = (obj, key) => key in obj;
24
+ exports.keyInObject = keyInObject;
25
+ const schemeToTheme = scheme => {
26
+ switch (scheme) {
27
+ case _types.ColorScheme.Dark:
28
+ return 'dark';
29
+ case _types.ColorScheme.Light:
30
+ default:
31
+ return 'light';
32
+ }
33
+ };
34
+ exports.schemeToTheme = schemeToTheme;
35
+ const hexToRGBA = (hex, opacity) => hex.replace('#', '').split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num)).reduce((acc, color) => `${acc}${color},`, 'rgba(').concat(`${opacity})`);
36
+ exports.hexToRGBA = hexToRGBA;
37
+ const isServer = () => typeof window === 'undefined';
38
+
39
+ /**
40
+ * Deeply merges properties of passed object
41
+ */
42
+ exports.isServer = isServer;
43
+ const deepMergeObjects = (...sources) => {
44
+ const target = {};
45
+ sources.forEach(source => {
46
+ Object.keys(source).forEach(key => {
47
+ const sourceValue = source[key];
48
+ const targetValue = target[key];
49
+ if (Object(sourceValue) == sourceValue && Object(targetValue) === targetValue) {
50
+ // @ts-expect-error - can't assign to generic
51
+ target[key] = deepMergeObjects(targetValue, sourceValue);
52
+ return;
53
+ }
54
+
55
+ // @ts-expect-error - can't assign to generic
56
+ target[key] = sourceValue;
57
+ });
58
+ });
59
+ return target;
60
+ };
61
+ exports.deepMergeObjects = deepMergeObjects;
62
+ const warn = message => console.warn(`🦄 [react-native-unistyles] ${message}`);
63
+ exports.warn = warn;
64
+ const equal = (a, b) => {
65
+ if (Object.is(a, b)) {
66
+ return true;
67
+ }
68
+ if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) {
69
+ return false;
70
+ }
71
+ const keysA = Object.keys(a);
72
+ if (keysA.length !== Object.keys(b).length) {
73
+ return false;
74
+ }
75
+ return keysA.every(key => Object.is(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
76
+ };
77
+ exports.equal = equal;
78
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_types","require","reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","exports","toReactNativeClassName","className","values","returnValue","$$css","defineProperties","enumerable","configurable","keyInObject","schemeToTheme","scheme","ColorScheme","Dark","Light","hexToRGBA","hex","opacity","replace","split","x","parseInt","filter","num","isNaN","reduce","acc","color","concat","isServer","window","deepMergeObjects","sources","target","forEach","source","keys","sourceValue","targetValue","warn","message","console","equal","a","b","is","keysA","length","every","prototype","hasOwnProperty","call"],"sourceRoot":"../../../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,GAAIC,OAAe,IAAKC,OAAO,CAACF,IAAI,CAAC,+BAA+BC,OAAO,EAAE,CAAC;AAAAxC,OAAA,CAAAuC,IAAA,GAAAA,IAAA;AAExF,MAAMG,KAAK,GAAGA,CAAIC,CAAI,EAAEC,CAAI,KAAK;EACpC,IAAIlD,MAAM,CAACmD,EAAE,CAACF,CAAC,EAAEC,CAAC,CAAC,EAAE;IACjB,OAAO,IAAI;EACf;EAEA,IACI,OAAOD,CAAC,KAAK,QAAQ,IAClBA,CAAC,KAAK,IAAI,IACV,OAAOC,CAAC,KAAK,QAAQ,IACrBA,CAAC,KAAK,IAAI,EACf;IACE,OAAO,KAAK;EAChB;EAEA,MAAME,KAAK,GAAGpD,MAAM,CAAC0C,IAAI,CAACO,CAAC,CAAmB;EAE9C,IAAIG,KAAK,CAACC,MAAM,KAAKrD,MAAM,CAAC0C,IAAI,CAACQ,CAAC,CAAC,CAACG,MAAM,EAAE;IACxC,OAAO,KAAK;EAChB;EAEA,OAAOD,KAAK,CAACE,KAAK,CAAClD,GAAG,IAAIJ,MAAM,CAACmD,EAAE,CAACF,CAAC,CAAC7C,GAAG,CAAC,EAAE8C,CAAC,CAAC9C,GAAG,CAAC,CAAC,IAAIJ,MAAM,CAACuD,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAE9C,GAAG,CAAC,CAAC;AACxG,CAAC;AAAAE,OAAA,CAAA0C,KAAA,GAAAA,KAAA","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getVariants = void 0;
7
+ var _utils = require("../utils");
8
+ const hasVariants = value => 'variants' in value[1];
9
+ const getVariants = (styles, selectedVariants) => {
10
+ return Object.entries(styles).filter(hasVariants).filter(([_key, {
11
+ variants
12
+ }]) => Object.keys(variants).some(variant => variant in variants)).map(([key, {
13
+ variants,
14
+ compoundVariants = []
15
+ }]) => {
16
+ const variantStyles = Object.entries(variants).flatMap(([variant, styles]) => {
17
+ const selectedVariant = selectedVariants[variant];
18
+ const selectedVariantStyles = styles[selectedVariant] ?? styles['default'];
19
+ if (!selectedVariantStyles) {
20
+ return [];
21
+ }
22
+ return selectedVariantStyles;
23
+ });
24
+ const compoundVariantStyles = compoundVariants.flatMap(compoundVariant => {
25
+ const {
26
+ styles,
27
+ ...conditions
28
+ } = compoundVariant;
29
+ if (Object.entries(conditions).some(([variant, value]) => String(selectedVariants[variant]) !== String(value))) {
30
+ return [];
31
+ }
32
+ return styles;
33
+ });
34
+ const mergedVariantStyles = (0, _utils.deepMergeObjects)(...variantStyles, ...compoundVariantStyles);
35
+ return [key, mergedVariantStyles];
36
+ });
37
+ };
38
+ exports.getVariants = getVariants;
39
+ //# sourceMappingURL=getVariants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/variants/getVariants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,MAAMC,WAAW,GAAsBC,KAAkB,IAAgD,UAAU,IAAIA,KAAK,CAAC,CAAC,CAAC;AAExH,MAAMC,WAAW,GAAGA,CAACC,MAAyC,EAAEC,gBAAqC,KAAK;EAC7G,OAAOC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CACxBI,MAAM,CAACP,WAAW,CAAC,CACnBO,MAAM,CAAC,CAAC,CAACC,IAAI,EAAE;IAAEC;EAAS,CAAC,CAAC,KAAKJ,MAAM,CAACK,IAAI,CAACD,QAAQ,CAAC,CAACE,IAAI,CAACC,OAAO,IAAIA,OAAO,IAAIH,QAAQ,CAAC,CAAC,CAC5FI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAE;IAAEL,QAAQ;IAAEM,gBAAgB,GAAG;EAAG,CAAC,CAAC,KAAK;IACjD,MAAMC,aAAa,GAAGX,MAAM,CAACC,OAAO,CAACG,QAAQ,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACL,OAAO,EAAET,MAAM,CAAC,KAAK;MAC1E,MAAMe,eAAe,GAAGd,gBAAgB,CAACQ,OAAO,CAAC;MACjD,MAAMO,qBAAqB,GAAGhB,MAAM,CAACe,eAAe,CAAC,IAAIf,MAAM,CAAC,SAAS,CAAC;MAE1E,IAAI,CAACgB,qBAAqB,EAAE;QACxB,OAAO,EAAE;MACb;MAEA,OAAOA,qBAAqB;IAChC,CAAC,CAAC;IAEF,MAAMC,qBAAqB,GAAGL,gBAAgB,CAACE,OAAO,CAACI,eAAe,IAAI;MACtE,MAAM;QAAElB,MAAM;QAAE,GAAGmB;MAAW,CAAC,GAAGD,eAAe;MAEjD,IAAIhB,MAAM,CAACC,OAAO,CAACgB,UAAU,CAAC,CAACX,IAAI,CAAC,CAAC,CAACC,OAAO,EAAEX,KAAK,CAAC,KAAKsB,MAAM,CAACnB,gBAAgB,CAACQ,OAAO,CAAC,CAAC,KAAKW,MAAM,CAACtB,KAAK,CAAC,CAAC,EAAE;QAC5G,OAAO,EAAE;MACb;MAEA,OAAOE,MAAM;IACjB,CAAC,CAAC;IAEF,MAAMqB,mBAAmB,GAAG,IAAAC,uBAAgB,EAAC,GAAGT,aAAa,EAAE,GAAGI,qBAAqB,CAAC;IAExF,OAAO,CAACN,GAAG,EAAEU,mBAAmB,CAAC;EACrC,CAAC,CAAC;AACV,CAAC;AAAAE,OAAA,CAAAxB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useVariants = require("./useVariants");
7
+ Object.keys(_useVariants).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useVariants[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useVariants[key];
14
+ }
15
+ });
16
+ });
17
+ var _getVariants = require("./getVariants");
18
+ Object.keys(_getVariants).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _getVariants[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _getVariants[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useVariants","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getVariants"],"sourceRoot":"../../../../src","sources":["web/variants/index.ts"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createUseVariants = void 0;
7
+ var _react = require("react");
8
+ var _utils = require("../utils");
9
+ var _registry = require("../registry");
10
+ var _getVariants = require("./getVariants");
11
+ const createUseVariants = (styles, setSelectedVariants) => {
12
+ const useVariants = selectedVariants => {
13
+ const [unistylesMap] = (0, _react.useState)(() => new Map());
14
+ const [classNameMap] = (0, _react.useState)(() => new Map());
15
+ const [selectedVariantStylesMap] = (0, _react.useState)(() => new Map());
16
+ const lastSelectedVariantsRef = (0, _react.useRef)();
17
+ // Variable that determines if variants have changed and we need to recalculate styles
18
+ const variantsChanged = !(0, _utils.equal)(lastSelectedVariantsRef.current, selectedVariants);
19
+ if (variantsChanged) {
20
+ lastSelectedVariantsRef.current = selectedVariants;
21
+ setSelectedVariants(selectedVariants);
22
+ }
23
+ const combinedVariantStyles = (0, _react.useMemo)(() => {
24
+ const result = (0, _getVariants.getVariants)(styles, selectedVariants);
25
+ result.forEach(([key, value]) => {
26
+ selectedVariantStylesMap.set(key, value);
27
+ });
28
+ return result;
29
+ }, [lastSelectedVariantsRef.current]);
30
+ if (unistylesMap.size === 0 && combinedVariantStyles.length > 0) {
31
+ combinedVariantStyles.forEach(([key, value]) => {
32
+ const {
33
+ className,
34
+ unistyles
35
+ } = _registry.UnistylesRegistry.createStyles(value, `variant-${key}`);
36
+ unistylesMap.set(key, unistyles);
37
+ classNameMap.set(key, className);
38
+ });
39
+ }
40
+ combinedVariantStyles.forEach(([key, value]) => {
41
+ const styleEntry = styles[key];
42
+ const unistyles = unistylesMap.get(key);
43
+ const className = classNameMap.get(key);
44
+ const selectedVariantStyles = selectedVariantStylesMap.get(key);
45
+ if (!unistyles || !className) {
46
+ return;
47
+ }
48
+ if (variantsChanged) {
49
+ _registry.UnistylesRegistry.updateStyles(unistyles, value, className);
50
+ }
51
+ Object.defineProperties(styleEntry, (0, _utils.reduceObject)(selectedVariantStyles ?? {}, value => ({
52
+ value,
53
+ enumerable: false,
54
+ configurable: true
55
+ })));
56
+ if (styleEntry) {
57
+ Object.keys(styleEntry ?? {}).forEach(key => {
58
+ if (!key.startsWith('variant-')) {
59
+ return;
60
+ }
61
+
62
+ // @ts-expect-error - remove old variants
63
+ delete styleEntry[key];
64
+ });
65
+ // @ts-expect-error - apply variant className
66
+ styleEntry[className] = className;
67
+ }
68
+ });
69
+ };
70
+ Object.defineProperty(styles, 'useVariants', {
71
+ value: useVariants
72
+ });
73
+ };
74
+ exports.createUseVariants = createUseVariants;
75
+ //# sourceMappingURL=useVariants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_utils","_registry","_getVariants","createUseVariants","styles","setSelectedVariants","useVariants","selectedVariants","unistylesMap","useState","Map","classNameMap","selectedVariantStylesMap","lastSelectedVariantsRef","useRef","variantsChanged","equal","current","combinedVariantStyles","useMemo","result","getVariants","forEach","key","value","set","size","length","className","unistyles","UnistylesRegistry","createStyles","styleEntry","get","selectedVariantStyles","updateStyles","Object","defineProperties","reduceObject","enumerable","configurable","keys","startsWith","defineProperty","exports"],"sourceRoot":"../../../../src","sources":["web/variants/useVariants.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEO,MAAMI,iBAAiB,GAAGA,CAACC,MAAyC,EAAEC,mBAA4D,KAAK;EAC1I,MAAMC,WAAW,GAAIC,gBAAqC,IAAK;IAC3D,MAAM,CAACC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAC,MAAM,IAAIC,GAAG,CAAoB,CAAC,CAAC;IACnE,MAAM,CAACC,YAAY,CAAC,GAAG,IAAAF,eAAQ,EAAC,MAAM,IAAIC,GAAG,CAAiB,CAAC,CAAC;IAChE,MAAM,CAACE,wBAAwB,CAAC,GAAG,IAAAH,eAAQ,EAAC,MAAM,IAAIC,GAAG,CAA8B,CAAC,CAA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CAACV,GAAG,CAAC;MACvC,MAAMK,SAAS,GAAGjB,YAAY,CAACsB,GAAG,CAACV,GAAG,CAAC;MACvC,MAAMW,qBAAqB,GAAGtB,wBAAwB,CAACqB,GAAG,CAACV,GAAG,CAAC;MAE/D,IAAI,CAACM,SAAS,IAAI,CAACD,SAAS,EAAE;QAC1B;MACJ;MAEA,IAAIb,eAAe,EAAE;QACjBe,2BAAiB,CAACK,YAAY,CAACN,SAAS,EAAEL,KAAK,EAAEI,SAAS,CAAC;MAC/D;MAEAQ,MAAM,CAACC,gBAAgB,CAACL,UAAU,EAAE,IAAAM,mBAAY,EAACJ,qBAAqB,IAAI,CAAC,CAAC,EAAEV,KAAK,KAAK;QACpFA,KAAK;QACLe,UAAU,EAAE,KAAK;QACjBC,YAAY,EAAE;MAClB,CAAC,CAAC,CAAC,CAAC;MAEJ,IAAIR,UAAU,EAAE;QACZI,MAAM,CAACK,IAAI,CAACT,UAAU,IAAI,CAAC,CAAC,CAAC,CAACV,OAAO,CAACC,GAAG,IAAI;UACzC,IAAI,CAACA,GAAG,CAACmB,UAAU,CAAC,UAAU,CAAC,EAAE;YAC7B;UACJ;;UAEA;UACA,OAAOV,UAAU,CAACT,GAAG,CAAC;QAC1B,CAAC,CAAC;QACF;QACAS,UAAU,CAACJ,SAAS,CAAC,GAAGA,SAAS;MACrC;IACJ,CAAC,CAAC;EACN,CAAC;EAEDQ,MAAM,CAACO,cAAc,CAACvC,MAAM,EAAE,aAAa,EAAE;IACzCoB,KAAK,EAAElB;EACX,CAAC,CAAC;AACN,CAAC;AAAAsC,OAAA,CAAAzC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -5,7 +5,7 @@ export const attachNavigationBarJSMethods = hybridObject => {
5
5
  const privateHybrid = hybridObject;
6
6
  privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
7
7
  hybridObject.setBackgroundColor = color => {
8
- const parsedColor = processColor(color);
8
+ const parsedColor = processColor(color) ?? 0;
9
9
  privateHybrid._setBackgroundColor(parsedColor);
10
10
  };
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"names":["processColor","attachNavigationBarJSMethods","hybridObject","privateHybrid","_setBackgroundColor","setBackgroundColor","color","parsedColor"],"sourceRoot":"../../../../src","sources":["specs/NavigtionBar/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,cAAc;AAS3C,OAAO,MAAMC,4BAA4B,GAAIC,YAAoC,IAAK;EAClF,MAAMC,aAAa,GAAGD,YAA6C;EAEnEC,aAAa,CAACC,mBAAmB,GAAGF,YAAY,CAACG,kBAAkB;EACnEH,YAAY,CAACG,kBAAkB,GAAIC,KAAc,IAAK;IAClD,MAAMC,WAAW,GAAGP,YAAY,CAACM,KAAK,CAAC;IAEvCH,aAAa,CAACC,mBAAmB,CAACG,WAAqB,CAAC;EAC5D,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["processColor","attachNavigationBarJSMethods","hybridObject","privateHybrid","_setBackgroundColor","setBackgroundColor","color","parsedColor"],"sourceRoot":"../../../../src","sources":["specs/NavigtionBar/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,cAAc;AAS3C,OAAO,MAAMC,4BAA4B,GAAIC,YAAoC,IAAK;EAClF,MAAMC,aAAa,GAAGD,YAA6C;EAEnEC,aAAa,CAACC,mBAAmB,GAAGF,YAAY,CAACG,kBAAkB;EACnEH,YAAY,CAACG,kBAAkB,GAAIC,KAAc,IAAK;IAClD,MAAMC,WAAW,GAAGP,YAAY,CAACM,KAAK,CAAC,IAAI,CAAC;IAE5CH,aAAa,CAACC,mBAAmB,CAACG,WAAqB,CAAC;EAC5D,CAAC;AACL,CAAC","ignoreList":[]}
@@ -10,11 +10,11 @@ const findShadowNodeForHandle = handle => {
10
10
  }
11
11
  return node;
12
12
  };
13
- HybridShadowRegistry.add = (handle, style) => {
13
+ HybridShadowRegistry.add = (handle, style, variants, args) => {
14
14
  if (!handle || !style?.__unid) {
15
15
  return;
16
16
  }
17
- HybridShadowRegistry.link(findShadowNodeForHandle(handle), style);
17
+ HybridShadowRegistry.link(findShadowNodeForHandle(handle), style, variants ?? {}, args ?? []);
18
18
  };
19
19
  HybridShadowRegistry.remove = (handle, style) => {
20
20
  if (!handle || !style?.__unid) {
@@ -1 +1 @@
1
- {"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","style","__unid","link","remove","unlink","UnistylesShadowRegistry"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAazD,MAAMC,oBAAoB,GAAGD,YAAY,CAACE,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEhF,IAAI,CAACA,IAAI,EAAE;IACP;IACA,MAAM,IAAIK,KAAK,CAAC,uDAAuD,CAAC;EAC5E;EAEA,OAAOL,IAAI;AACf,CAAC;AAEDJ,oBAAoB,CAACU,GAAG,GAAG,CAACP,MAAM,EAAEQ,KAAK,KAAK;EAC1C,IAAI,CAACR,MAAM,IAAI,CAACQ,KAAK,EAAEC,MAAM,EAAE;IAC3B;EACJ;EAEAZ,oBAAoB,CAACa,IAAI,CAACX,uBAAuB,CAACC,MAAM,CAAC,EAAEQ,KAAK,CAAC;AACrE,CAAC;AAEDX,oBAAoB,CAACc,MAAM,GAAG,CAACX,MAAM,EAAEQ,KAAK,KAAK;EAC7C,IAAI,CAACR,MAAM,IAAI,CAACQ,KAAK,EAAEC,MAAM,EAAE;IAC3B;EACJ;EAEAZ,oBAAoB,CAACe,MAAM,CAACb,uBAAuB,CAACC,MAAM,CAAC,EAAEQ,KAAK,CAAC;AACvE,CAAC;AAQD,OAAO,MAAMK,uBAAuB,GAAGhB,oBAA4D","ignoreList":[]}
1
+ {"version":3,"names":["NitroModules","HybridShadowRegistry","createHybridObject","findShadowNodeForHandle","handle","node","__internalInstanceHandle","stateNode","getScrollResponder","getNativeScrollRef","Error","add","style","variants","args","__unid","link","remove","unlink","UnistylesShadowRegistry"],"sourceRoot":"../../../../src","sources":["specs/ShadowRegistry/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAazD,MAAMC,oBAAoB,GAAGD,YAAY,CAACE,kBAAkB,CAAiB,yBAAyB,CAAC;AAEvG,MAAMC,uBAAuB,GAAIC,MAAkB,IAAK;EACpD,MAAMC,IAAI,GAAGD,MAAM,EAAEE,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACvDD,MAAM,EAAEI,kBAAkB,GAAG,CAAC,EAAEC,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI,IACjGD,MAAM,EAAEK,kBAAkB,GAAG,CAAC,EAAEH,wBAAwB,EAAEC,SAAS,EAAEF,IAAI;EAEhF,IAAI,CAACA,IAAI,EAAE;IACP;IACA,MAAM,IAAIK,KAAK,CAAC,uDAAuD,CAAC;EAC5E;EAEA,OAAOL,IAAI;AACf,CAAC;AAEDJ,oBAAoB,CAACU,GAAG,GAAG,CAACP,MAAM,EAAEQ,KAAK,EAAEC,QAAQ,EAAEC,IAAI,KAAK;EAC1D,IAAI,CAACV,MAAM,IAAI,CAACQ,KAAK,EAAEG,MAAM,EAAE;IAC3B;EACJ;EAEAd,oBAAoB,CAACe,IAAI,CAACb,uBAAuB,CAACC,MAAM,CAAC,EAAEQ,KAAK,EAAEC,QAAQ,IAAI,CAAC,CAAC,EAAEC,IAAI,IAAI,EAAE,CAAC;AACjG,CAAC;AAEDb,oBAAoB,CAACgB,MAAM,GAAG,CAACb,MAAM,EAAEQ,KAAK,KAAK;EAC7C,IAAI,CAACR,MAAM,IAAI,CAACQ,KAAK,EAAEG,MAAM,EAAE;IAC3B;EACJ;EAEAd,oBAAoB,CAACiB,MAAM,CAACf,uBAAuB,CAACC,MAAM,CAAC,EAAEQ,KAAK,CAAC;AACvE,CAAC;AAQD,OAAO,MAAMO,uBAAuB,GAAGlB,oBAA4D","ignoreList":[]}
@@ -21,7 +21,7 @@ export const attachStatusBarJSMethods = hybridObject => {
21
21
  };
22
22
  privateHybrid._setBackgroundColor = hybridObject.setBackgroundColor;
23
23
  hybridObject.setBackgroundColor = color => {
24
- const parsedColor = processColor(color);
24
+ const parsedColor = processColor(color) ?? 0;
25
25
  privateHybrid._setBackgroundColor(parsedColor);
26
26
  };
27
27
  };
@@ -1 +1 @@
1
- {"version":3,"names":["processColor","StatusBar","NativeStatusBar","StatusBarStyle","attachStatusBarJSMethods","hybridObject","setStyle","style","animated","Light","setBarStyle","Dark","Default","privateHybrid","_setHidden","setHidden","isHidden","animation","_setBackgroundColor","setBackgroundColor","color","parsedColor"],"sourceRoot":"../../../../src","sources":["specs/StatusBar/index.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,SAAS,IAAIC,eAAe,QAAQ,cAAc;AAEzE,SAAqBC,cAAc,QAAQ,UAAU;AAYrD,OAAO,MAAMC,wBAAwB,GAAIC,YAAgC,IAAK;EAC1EA,YAAY,CAACC,QAAQ,GAAG,CAACC,KAAqB,EAAEC,QAAkB,KAAK;IACnE,QAAQD,KAAK;MACT,KAAKJ,cAAc,CAACM,KAAK;QACrB,OAAOP,eAAe,CAACQ,WAAW,CAAC,eAAe,EAAEF,QAAQ,CAAC;MACjE,KAAKL,cAAc,CAACQ,IAAI;QACpB,OAAOT,eAAe,CAACQ,WAAW,CAAC,cAAc,EAAEF,QAAQ,CAAC;MAChE,KAAKL,cAAc,CAACS,OAAO;QACvB,OAAOV,eAAe,CAACQ,WAAW,CAAC,SAAS,EAAEF,QAAQ,CAAC;IAC/D;EACJ,CAAC;EAED,MAAMK,aAAa,GAAGR,YAAyC;EAE/DQ,aAAa,CAACC,UAAU,GAAGT,YAAY,CAACU,SAAS;EACjDV,YAAY,CAACU,SAAS,GAAG,CAACC,QAAiB,EAAEC,SAAoC,KAAK;IAClFf,eAAe,CAACa,SAAS,CAACC,QAAQ,EAAEC,SAAS,CAAC;IAC9CJ,aAAa,CAACC,UAAU,CAACE,QAAQ,CAAC;EACtC,CAAC;EAEDH,aAAa,CAACK,mBAAmB,GAAGb,YAAY,CAACc,kBAAkB;EACnEd,YAAY,CAACc,kBAAkB,GAAIC,KAAc,IAAK;IAClD,MAAMC,WAAW,GAAGrB,YAAY,CAACoB,KAAK,CAAC;IAEvCP,aAAa,CAACK,mBAAmB,CAACG,WAAqB,CAAC;EAC5D,CAAC;AACL,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["processColor","StatusBar","NativeStatusBar","StatusBarStyle","attachStatusBarJSMethods","hybridObject","setStyle","style","animated","Light","setBarStyle","Dark","Default","privateHybrid","_setHidden","setHidden","isHidden","animation","_setBackgroundColor","setBackgroundColor","color","parsedColor"],"sourceRoot":"../../../../src","sources":["specs/StatusBar/index.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,SAAS,IAAIC,eAAe,QAAQ,cAAc;AAEzE,SAAqBC,cAAc,QAAQ,UAAU;AAYrD,OAAO,MAAMC,wBAAwB,GAAIC,YAAgC,IAAK;EAC1EA,YAAY,CAACC,QAAQ,GAAG,CAACC,KAAqB,EAAEC,QAAkB,KAAK;IACnE,QAAQD,KAAK;MACT,KAAKJ,cAAc,CAACM,KAAK;QACrB,OAAOP,eAAe,CAACQ,WAAW,CAAC,eAAe,EAAEF,QAAQ,CAAC;MACjE,KAAKL,cAAc,CAACQ,IAAI;QACpB,OAAOT,eAAe,CAACQ,WAAW,CAAC,cAAc,EAAEF,QAAQ,CAAC;MAChE,KAAKL,cAAc,CAACS,OAAO;QACvB,OAAOV,eAAe,CAACQ,WAAW,CAAC,SAAS,EAAEF,QAAQ,CAAC;IAC/D;EACJ,CAAC;EAED,MAAMK,aAAa,GAAGR,YAAyC;EAE/DQ,aAAa,CAACC,UAAU,GAAGT,YAAY,CAACU,SAAS;EACjDV,YAAY,CAACU,SAAS,GAAG,CAACC,QAAiB,EAAEC,SAAoC,KAAK;IAClFf,eAAe,CAACa,SAAS,CAACC,QAAQ,EAAEC,SAAS,CAAC;IAC9CJ,aAAa,CAACC,UAAU,CAACE,QAAQ,CAAC;EACtC,CAAC;EAEDH,aAAa,CAACK,mBAAmB,GAAGb,YAAY,CAACc,kBAAkB;EACnEd,YAAY,CAACc,kBAAkB,GAAIC,KAAc,IAAK;IAClD,MAAMC,WAAW,GAAGrB,YAAY,CAACoB,KAAK,CAAC,IAAI,CAAC;IAE5CP,aAAa,CAACK,mBAAmB,CAACG,WAAqB,CAAC;EAC5D,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["NitroModules","processColor","StyleSheet","NativeStyleSheet","HybridUnistylesStyleSheet","createHybridObject","absoluteFillObject","absoluteFill","flatten","compose","jsMethods"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,YAAY,EAAEC,UAAU,IAAIC,gBAAgB,QAAQ,cAAc;AA+B3E,MAAMC,yBAAyB,GAAGJ,YAAY,CACzCK,kBAAkB,CAAsB,qBAAqB,CAAC;AAEnED,yBAAyB,CAACE,kBAAkB,GAAGH,gBAAgB,CAACG,kBAAkB;AAClFF,yBAAyB,CAACG,YAAY,GAAGJ,gBAAgB,CAACI,YAAY;AACtEH,yBAAyB,CAACI,OAAO,GAAGL,gBAAgB,CAACK,OAAO;AAC5DJ,yBAAyB,CAACK,OAAO,GAAGN,gBAAgB,CAACM,OAAO;AAC5DL,yBAAyB,CAACM,SAAS,GAAG;EAClCT;AACJ,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGE,yBAAmE","ignoreList":[]}
1
+ {"version":3,"names":["NitroModules","processColor","StyleSheet","NativeStyleSheet","HybridUnistylesStyleSheet","createHybridObject","absoluteFillObject","absoluteFill","flatten","compose","jsMethods"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AACzD,SAASC,YAAY,EAAEC,UAAU,IAAIC,gBAAgB,QAAQ,cAAc;AA+B3E,MAAMC,yBAAyB,GAAGJ,YAAY,CACzCK,kBAAkB,CAAsB,qBAAqB,CAAC;AAEnED,yBAAyB,CAACE,kBAAkB,GAAGH,gBAAgB,CAACG,kBAAkB;AAClFF,yBAAyB,CAACG,YAAY,GAAGJ,gBAAgB,CAACI,YAAY;AACtEH,yBAAyB,CAACI,OAAO,GAAGL,gBAAgB,CAACK,OAAO;AAC5DJ,yBAAyB,CAACK,OAAO,GAAGN,gBAAgB,CAACM,OAAO;AAC5DL,yBAAyB,CAACM,SAAS,GAAG;EAClCT;AACJ,CAAC;AAID,OAAO,MAAMC,UAAU,GAAGE,yBAAsE","ignoreList":[]}
@@ -10,7 +10,7 @@ HybridUnistylesRuntime.statusBar = HybridUnistylesRuntime.createHybridStatusBar(
10
10
  HybridUnistylesRuntime.navigationBar = HybridUnistylesRuntime.createHybridNavigationBar();
11
11
  HybridUnistylesRuntime._setRootViewBackgroundColor = HybridUnistylesRuntime.setRootViewBackgroundColor;
12
12
  HybridUnistylesRuntime.setRootViewBackgroundColor = color => {
13
- const parsedColor = processColor(color);
13
+ const parsedColor = processColor(color) ?? 0;
14
14
  HybridUnistylesRuntime._setRootViewBackgroundColor(parsedColor);
15
15
  };
16
16
  if (isIOS) {
@@ -1 +1 @@
1
- {"version":3,"names":["processColor","NitroModules","attachStatusBarJSMethods","attachNavigationBarJSMethods","isIOS","HybridUnistylesRuntime","createHybridObject","statusBar","createHybridStatusBar","navigationBar","createHybridNavigationBar","_setRootViewBackgroundColor","setRootViewBackgroundColor","color","parsedColor","setImmersiveMode","isEnabled","setHidden","Runtime"],"sourceRoot":"../../../../src","sources":["specs/UnistylesRuntime/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,YAAY,QAAQ,4BAA4B;AAGzD,SAASC,wBAAwB,QAAiC,cAAc;AAChF,SAASC,4BAA4B,QAAqC,iBAAiB;AAE3F,SAASC,KAAK,QAAQ,cAAc;AAgCpC,MAAMC,sBAAsB,GAAGJ,YAAY,CACtCK,kBAAkB,CAA0B,kBAAkB,CAAC;AAEpED,sBAAsB,CAACE,SAAS,GAAGF,sBAAsB,CAACG,qBAAqB,CAAC,CAAC;AACjFH,sBAAsB,CAACI,aAAa,GAAGJ,sBAAsB,CAACK,yBAAyB,CAAC,CAAC;AACzFL,sBAAsB,CAACM,2BAA2B,GAAGN,sBAAsB,CAACO,0BAA0B;AAEtGP,sBAAsB,CAACO,0BAA0B,GAAIC,KAAc,IAAK;EACpE,MAAMC,WAAW,GAAGd,YAAY,CAACa,KAAK,CAAC;EAEvCR,sBAAsB,CAACM,2BAA2B,CAACG,WAAqB,CAAC;AAC7E,CAAC;AAED,IAAIV,KAAK,EAAE;EACPC,sBAAsB,CAACU,gBAAgB,GAAIC,SAAkB,IAAKX,sBAAsB,CAACE,SAAS,CAACU,SAAS,CAACD,SAAS,EAAE,MAAM,CAAC;AACnI;AAEAd,wBAAwB,CAACG,sBAAsB,CAACE,SAAS,CAAC;AAC1DJ,4BAA4B,CAACE,sBAAsB,CAACI,aAAa,CAAC;AAElE,OAAO,MAAMS,OAAO,GAAGb,sBAA0C","ignoreList":[]}
1
+ {"version":3,"names":["processColor","NitroModules","attachStatusBarJSMethods","attachNavigationBarJSMethods","isIOS","HybridUnistylesRuntime","createHybridObject","statusBar","createHybridStatusBar","navigationBar","createHybridNavigationBar","_setRootViewBackgroundColor","setRootViewBackgroundColor","color","parsedColor","setImmersiveMode","isEnabled","setHidden","Runtime"],"sourceRoot":"../../../../src","sources":["specs/UnistylesRuntime/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,YAAY,QAAQ,4BAA4B;AAGzD,SAASC,wBAAwB,QAAiC,cAAc;AAChF,SAASC,4BAA4B,QAAqC,iBAAiB;AAE3F,SAASC,KAAK,QAAQ,cAAc;AAgCpC,MAAMC,sBAAsB,GAAGJ,YAAY,CACtCK,kBAAkB,CAA0B,kBAAkB,CAAC;AAEpED,sBAAsB,CAACE,SAAS,GAAGF,sBAAsB,CAACG,qBAAqB,CAAC,CAAC;AACjFH,sBAAsB,CAACI,aAAa,GAAGJ,sBAAsB,CAACK,yBAAyB,CAAC,CAAC;AACzFL,sBAAsB,CAACM,2BAA2B,GAAGN,sBAAsB,CAACO,0BAA0B;AAEtGP,sBAAsB,CAACO,0BAA0B,GAAIC,KAAc,IAAK;EACpE,MAAMC,WAAW,GAAGd,YAAY,CAACa,KAAK,CAAC,IAAI,CAAC;EAE5CR,sBAAsB,CAACM,2BAA2B,CAACG,WAAqB,CAAC;AAC7E,CAAC;AAED,IAAIV,KAAK,EAAE;EACPC,sBAAsB,CAACU,gBAAgB,GAAIC,SAAkB,IAAKX,sBAAsB,CAACE,SAAS,CAACU,SAAS,CAACD,SAAS,EAAE,MAAM,CAAC;AACnI;AAEAd,wBAAwB,CAACG,sBAAsB,CAACE,SAAS,CAAC;AAC1DJ,4BAA4B,CAACE,sBAAsB,CAACI,aAAa,CAAC;AAElE,OAAO,MAAMS,OAAO,GAAGb,sBAA0C","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
 
3
3
  export const getSSRUnistyles = () => [];
4
- export * from '../../web';
4
+ export * from '../web';
5
5
  //# sourceMappingURL=index.web.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getSSRUnistyles"],"sourceRoot":"../../../src","sources":["specs/index.web.ts"],"mappings":";;AAEA,OAAO,MAAMA,eAAe,GAAGA,CAAA,KAAM,EAAyB;AAE9D,cAAc,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["getSSRUnistyles"],"sourceRoot":"../../../src","sources":["specs/index.web.ts"],"mappings":";;AAEA,OAAO,MAAMA,eAAe,GAAGA,CAAA,KAAM,EAAyB;AAE9D,cAAc,QAAQ","ignoreList":[]}
@@ -0,0 +1,72 @@
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 { BOX_SHADOW_STYLES } from './types';
8
+ import { extractShadowValue, normalizeColor, normalizeNumericValue } from './utils';
9
+ const createBoxShadowValue = style => {
10
+ // at this point every prop is present
11
+ const {
12
+ shadowColor,
13
+ shadowOffset,
14
+ shadowOpacity,
15
+ shadowRadius
16
+ } = style;
17
+ const offsetX = normalizeNumericValue(shadowOffset.width);
18
+ const offsetY = normalizeNumericValue(shadowOffset.height);
19
+ const radius = normalizeNumericValue(shadowRadius);
20
+ const color = normalizeColor(shadowColor, shadowOpacity);
21
+ return `${offsetX} ${offsetY} ${radius} ${color}`;
22
+ };
23
+ export const getBoxShadowStyle = styles => {
24
+ const missingStyles = BOX_SHADOW_STYLES.filter(key => !(key in styles));
25
+ if (missingStyles.length) {
26
+ warn(`can't apply box shadow as you miss these properties: ${missingStyles.join(', ')}`);
27
+ return {};
28
+ }
29
+ const breakpointsSet = new Set();
30
+ try {
31
+ validateShadow(BOX_SHADOW_STYLES, styles, breakpointsSet);
32
+ } catch (error) {
33
+ if (typeof error === 'string') {
34
+ warn(error);
35
+ }
36
+ return {};
37
+ }
38
+ const breakpoints = Array.from(breakpointsSet);
39
+
40
+ // If no breakpoints were used return styles without media queries
41
+ if (breakpoints.length === 0) {
42
+ return {
43
+ boxShadow: createBoxShadowValue(styles)
44
+ };
45
+ }
46
+
47
+ // Create boxShadow for each breakpoint
48
+ const breakpointStyles = breakpoints.map(breakpoint => {
49
+ const color = extractShadowValue('shadowColor', breakpoint, styles);
50
+ const {
51
+ width,
52
+ height
53
+ } = extractShadowValue('shadowOffset', breakpoint, styles);
54
+ const radius = extractShadowValue('shadowRadius', breakpoint, styles);
55
+ const opacity = extractShadowValue('shadowOpacity', breakpoint, styles);
56
+ return media(convertBreakpoint(breakpoint), {
57
+ boxShadow: createBoxShadowValue({
58
+ shadowColor: color,
59
+ shadowOffset: {
60
+ width,
61
+ height
62
+ },
63
+ shadowRadius: radius,
64
+ shadowOpacity: opacity
65
+ })
66
+ });
67
+ });
68
+
69
+ // Merge all breakpoints styles into one
70
+ return deepMergeObjects(...breakpointStyles);
71
+ };
72
+ //# sourceMappingURL=boxShadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["media","deepMergeObjects","warn","validateShadow","convertBreakpoint","BOX_SHADOW_STYLES","extractShadowValue","normalizeColor","normalizeNumericValue","createBoxShadowValue","style","shadowColor","shadowOffset","shadowOpacity","shadowRadius","offsetX","width","offsetY","height","radius","color","getBoxShadowStyle","styles","missingStyles","filter","key","length","join","breakpointsSet","Set","error","breakpoints","Array","from","boxShadow","breakpointStyles","map","breakpoint","opacity"],"sourceRoot":"../../../../src","sources":["web/convert/boxShadow.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,iBAAiB,QAAwB,SAAS;AAC3D,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,SAAS;AAEnF,MAAMC,oBAAoB,GAAIC,KAAgB,IAAK;EAC/C;EACA,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAa,CAAC,GAAGJ,KAAK;EACxE,MAAMK,OAAO,GAAGP,qBAAqB,CAACI,YAAY,CAACI,KAAK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IAAO,CAAC,GAAGZ,kBAAkB,CAAC,cAAc,EAAE+B,UAAU,EAAEf,MAAM,CAAC;IAChF,MAAMH,MAAM,GAAGb,kBAAkB,CAAC,cAAc,EAAE+B,UAAU,EAAEf,MAAM,CAAC;IACrE,MAAMgB,OAAO,GAAGhC,kBAAkB,CAAC,eAAe,EAAE+B,UAAU,EAAEf,MAAM,CAAC;IAEvE,OAAOtB,KAAK,CAACI,iBAAiB,CAACiC,UAAU,CAAC,EAAE;MACxCH,SAAS,EAAEzB,oBAAoB,CAAC;QAC5BE,WAAW,EAAES,KAAK;QAClBR,YAAY,EAAE;UACVI,KAAK;UACLE;QACJ,CAAC;QACDJ,YAAY,EAAEK,MAAM;QACpBN,aAAa,EAAEyB;MACnB,CAAC;IACL,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;EACA,OAAOrC,gBAAgB,CAAC,GAAGkC,gBAAgB,CAAC;AAChD,CAAC","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import { UnistylesState } from '../state';
4
+ import { keyInObject } from '../utils';
5
+ import { isUnistylesMq, parseMq } from '../mq';
6
+ import { Orientation } from '../../specs/types';
7
+ export const convertBreakpoint = breakpoint => {
8
+ if (Object.values(Orientation).includes(breakpoint)) {
9
+ return {
10
+ orientation: breakpoint
11
+ };
12
+ }
13
+ if (isUnistylesMq(breakpoint)) {
14
+ return parseMq(breakpoint);
15
+ }
16
+ return {
17
+ minWidth: UnistylesState.breakpoints && keyInObject(UnistylesState.breakpoints, breakpoint) ? UnistylesState.breakpoints[breakpoint] : undefined
18
+ };
19
+ };
20
+ //# sourceMappingURL=breakpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UnistylesState","keyInObject","isUnistylesMq","parseMq","Orientation","convertBreakpoint","breakpoint","Object","values","includes","orientation","minWidth","breakpoints","undefined"],"sourceRoot":"../../../../src","sources":["web/convert/breakpoint.ts"],"mappings":";;AACA,SAASA,cAAc,QAAQ,UAAU;AACzC,SAASC,WAAW,QAAQ,UAAU;AACtC,SAASC,aAAa,EAAEC,OAAO,QAAQ,OAAO;AAC9C,SAASC,WAAW,QAAQ,mBAAmB;AAE/C,OAAO,MAAMC,iBAAiB,GAAIC,UAAkB,IAAiB;EACjE,IAAIC,MAAM,CAACC,MAAM,CAACJ,WAAW,CAAC,CAACK,QAAQ,CAACH,UAAyB,CAAC,EAAE;IAChE,OAAO;MACHI,WAAW,EAAEJ;IACjB,CAAC;EACL;EAEA,IAAIJ,aAAa,CAACI,UAAU,CAAC,EAAE;IAC3B,OAAOH,OAAO,CAACG,UAAU,CAAC;EAC9B;EAEA,OAAO;IACHK,QAAQ,EAAEX,cAAc,CAACY,WAAW,IAAIX,WAAW,CAACD,cAAc,CAACY,WAAW,EAAEN,UAAU,CAAC,GAAGN,cAAc,CAACY,WAAW,CAACN,UAAU,CAAC,GAAGO;EAC3I,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ import { media } from 'typestyle';
4
+ import { isPseudo } from '../pseudo';
5
+ import { convertBreakpoint } from './breakpoint';
6
+ import { getStyle } from './style';
7
+ import { deepMergeObjects } from '../utils';
8
+ import { getTransformStyle } from './transform';
9
+ import { isBoxShadow, isTextShadow, isTransform } from './utils';
10
+ import { getTextShadowStyle } from './textShadow';
11
+ import { getBoxShadowStyle } from './boxShadow';
12
+ export const convertToTypeStyle = value => {
13
+ // Flag to mark if textShadow is already created
14
+ let hasTextShadow = false;
15
+ // Flag to mark if boxShadow is already created
16
+ let hasBoxShadow = false;
17
+ const stylesArray = Object.entries({
18
+ ...value,
19
+ ...value._web
20
+ }).flatMap(([unistylesKey, unistylesValue]) => {
21
+ // Keys to omit
22
+ if (['_css', '_web', 'variants', 'compoundVariants', 'uni__dependencies'].includes(unistylesKey)) {
23
+ return [];
24
+ }
25
+
26
+ // Pseudo classes :hover, :before etc.
27
+ if (isPseudo(unistylesKey)) {
28
+ const typestyleValues = convertToTypeStyle(unistylesValue);
29
+ return {
30
+ $nest: {
31
+ [unistylesKey.replace('_', '&:')]: typestyleValues
32
+ }
33
+ };
34
+ }
35
+
36
+ // Text shadow
37
+ if (isTextShadow(unistylesKey)) {
38
+ if (hasTextShadow) {
39
+ return [];
40
+ }
41
+ hasTextShadow = true;
42
+ return getTextShadowStyle(value);
43
+ }
44
+
45
+ // Box shadow
46
+ if (isBoxShadow(unistylesKey)) {
47
+ if (hasBoxShadow) {
48
+ return [];
49
+ }
50
+ hasBoxShadow = true;
51
+ return getBoxShadowStyle(value);
52
+ }
53
+
54
+ // Transforms
55
+ if (isTransform(unistylesKey, unistylesValue)) {
56
+ return getTransformStyle(unistylesValue);
57
+ }
58
+
59
+ // Breakpoints
60
+ if (typeof unistylesValue === 'object' && unistylesValue !== null) {
61
+ return Object.entries(unistylesValue).map(([breakpointKey, breakpointValue]) => {
62
+ return media(convertBreakpoint(breakpointKey), getStyle(unistylesKey, breakpointValue));
63
+ });
64
+ }
65
+
66
+ // Regular styles
67
+ return getStyle(unistylesKey, unistylesValue);
68
+ });
69
+ return deepMergeObjects(...stylesArray);
70
+ };
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["media","isPseudo","convertBreakpoint","getStyle","deepMergeObjects","getTransformStyle","isBoxShadow","isTextShadow","isTransform","getTextShadowStyle","getBoxShadowStyle","convertToTypeStyle","value","hasTextShadow","hasBoxShadow","stylesArray","Object","entries","_web","flatMap","unistylesKey","unistylesValue","includes","typestyleValues","$nest","replace","map","breakpointKey","breakpointValue"],"sourceRoot":"../../../../src","sources":["web/convert/index.ts"],"mappings":";;AAEA,SAASA,KAAK,QAAQ,WAAW;AACjC,SAASC,QAAQ,QAAQ,WAAW;AACpC,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,QAAQ,QAAQ,SAAS;AAClC,SAASC,gBAAgB,QAAQ,UAAU;AAC3C,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,WAAW,EAAE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C;;IAEA;IACA,IAAI,OAAOA,cAAc,KAAK,QAAQ,IAAIA,cAAc,KAAK,IAAI,EAAE;MAC/D,OAAOL,MAAM,CAACC,OAAO,CAACI,cAAc,CAAC,CAACK,GAAG,CAAC,CAAC,CAACC,aAAa,EAAEC,eAAe,CAAC,KAAK;QAC5E,OAAO5B,KAAK,CAACE,iBAAiB,CAACyB,aAAa,CAAC,EAAExB,QAAQ,CAACiB,YAAY,EAAEQ,eAAe,CAAC,CAAC;MAC3F,CAAC,CAAC;IACN;;IAEA;IACA,OAAOzB,QAAQ,CAACiB,YAAY,EAAEC,cAAc,CAAC;EACjD,CAAC,CAA+B;EAEhC,OAAOjB,gBAAgB,CAAC,GAAGW,WAAW,CAAC;AAC3C,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=module.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["web/convert/module.d.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ export const validateShadow = (shadowProperties, styles, breakpoints) => {
4
+ // Collect breakpoints
5
+ shadowProperties.forEach(key => {
6
+ const value = styles[key];
7
+ if (typeof value !== 'object') {
8
+ return;
9
+ }
10
+ if (key === 'shadowOffset' || key === 'textShadowOffset') {
11
+ const {
12
+ width,
13
+ height
14
+ } = value;
15
+
16
+ // If shadowOffset.width has breakpoints
17
+ if (typeof width === 'object') {
18
+ Object.keys(width).forEach(breakpoint => breakpoints.add(breakpoint));
19
+ }
20
+
21
+ // If shadowOffset.height has breakpoints
22
+ if (typeof height === 'object') {
23
+ Object.keys(height).forEach(breakpoint => breakpoints.add(breakpoint));
24
+ }
25
+ return;
26
+ }
27
+
28
+ // Collect regular breakpoints
29
+ Object.keys(value).forEach(breakpoint => breakpoints.add(breakpoint));
30
+ });
31
+
32
+ // Validate if all breakpoints are present
33
+ shadowProperties.forEach(key => {
34
+ const value = styles[key];
35
+ if (typeof value !== 'object') {
36
+ return;
37
+ }
38
+ if (key === 'shadowOffset' || key === 'textShadowOffset') {
39
+ const {
40
+ width,
41
+ height
42
+ } = value;
43
+ if (typeof width === 'object') {
44
+ const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in width));
45
+ if (missingBreakpoints.length) {
46
+ throw `missing breakpoints in ${key}.width: ${missingBreakpoints.join(', ')}`;
47
+ }
48
+ }
49
+ if (typeof height === 'object') {
50
+ const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in height));
51
+ if (missingBreakpoints.length) {
52
+ throw `missing breakpoints in ${key}.height: ${missingBreakpoints.join(', ')}`;
53
+ }
54
+ }
55
+ return;
56
+ }
57
+ const missingBreakpoints = Array.from(breakpoints).filter(breakpoint => !(breakpoint in value));
58
+ if (missingBreakpoints.length) {
59
+ throw `missing breakpoints in ${key}: ${missingBreakpoints.join(', ')}`;
60
+ }
61
+ });
62
+ };
63
+ //# sourceMappingURL=shadow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["validateShadow","shadowProperties","styles","breakpoints","forEach","key","value","width","height","Object","keys","breakpoint","add","missingBreakpoints","Array","from","filter","length","join"],"sourceRoot":"../../../../src","sources":["web/convert/shadow.ts"],"mappings":";;AAEA,OAAO,MAAMA,cAAc,GAAGA,CAACC,gBAAuC,EAAEC,MAA2B,EAAEC,WAAwB,KAAK;EAC9H;EACAF,gBAAgB,CAACG,OAAO,CAACC,GAAG,IAAI;IAC5B,MAAMC,KAAK,GAAGJ,MAAM,CAACG,GAAG,CAAC;IAEzB,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;MAC3B;IACJ;IAEA,IAAID,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB,EAAE;MACtD,MAAM;QAAEE,KAAK;QAAEC;MAAO,CAAC,GAAGF,KAAqB;;MAE/C;MACA,IAAI,OAAOC,KAAK,KAAK,QAAQ,EAAE;QAC3BE,MAAM,CAACC,I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