react-native-unistyles 2.0.0-alpha.9 → 2.0.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. package/android/CMakeLists.txt +28 -0
  2. package/android/build.gradle +40 -0
  3. package/android/src/main/cxx/cpp-adapter.cpp +108 -0
  4. package/android/src/main/java/com/unistyles/UnistylesModule.kt +159 -0
  5. package/android/src/main/java/com/unistyles/UnistylesPackage.kt +18 -0
  6. package/cxx/UnistylesRuntime.cpp +55 -2
  7. package/cxx/UnistylesRuntime.h +15 -9
  8. package/ios/UnistylesModule.mm +16 -6
  9. package/lib/commonjs/common.js +30 -16
  10. package/lib/commonjs/common.js.map +1 -1
  11. package/lib/commonjs/core/UnistyleRegistry.js +65 -3
  12. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  13. package/lib/commonjs/core/Unistyles.js +1 -1
  14. package/lib/commonjs/core/Unistyles.js.map +1 -1
  15. package/lib/commonjs/core/UnistylesModule.web.js +187 -0
  16. package/lib/commonjs/core/UnistylesModule.web.js.map +1 -0
  17. package/lib/commonjs/core/UnistylesRuntime.js +15 -16
  18. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  19. package/lib/commonjs/createStyleSheet.js +1 -6
  20. package/lib/commonjs/createStyleSheet.js.map +1 -1
  21. package/lib/commonjs/hooks/index.js +7 -0
  22. package/lib/commonjs/hooks/index.js.map +1 -1
  23. package/lib/commonjs/hooks/useUnistyles.js +12 -9
  24. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  25. package/lib/commonjs/hooks/useVariants.js +14 -0
  26. package/lib/commonjs/hooks/useVariants.js.map +1 -0
  27. package/lib/commonjs/index.js.map +1 -1
  28. package/lib/commonjs/plugins/index.js +38 -0
  29. package/lib/commonjs/plugins/index.js.map +1 -0
  30. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
  31. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
  32. package/lib/commonjs/plugins/normalizer/index.js +32 -0
  33. package/lib/commonjs/plugins/normalizer/index.js.map +1 -0
  34. package/lib/commonjs/plugins/normalizer/module.d.js.map +1 -0
  35. package/lib/commonjs/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +5 -5
  36. package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +1 -0
  37. package/lib/commonjs/{utils → plugins/normalizer}/normalizer.js +1 -1
  38. package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -0
  39. package/lib/commonjs/types/{mq.js → plugin.js} +1 -1
  40. package/lib/commonjs/types/{mq.js.map → plugin.js.map} +1 -1
  41. package/lib/commonjs/types/stylesheet.js +6 -0
  42. package/lib/commonjs/types/stylesheet.js.map +1 -0
  43. package/lib/commonjs/types/variants.js +2 -0
  44. package/lib/commonjs/{utils/module.d.js.map → types/variants.js.map} +1 -1
  45. package/lib/commonjs/useStyles.js +10 -20
  46. package/lib/commonjs/useStyles.js.map +1 -1
  47. package/lib/commonjs/utils/breakpoints.js +13 -59
  48. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  49. package/lib/commonjs/utils/index.js +13 -51
  50. package/lib/commonjs/utils/index.js.map +1 -1
  51. package/lib/commonjs/utils/mq.js +36 -68
  52. package/lib/commonjs/utils/mq.js.map +1 -1
  53. package/lib/commonjs/utils/mqParser.js +4 -1
  54. package/lib/commonjs/utils/mqParser.js.map +1 -1
  55. package/lib/commonjs/utils/styles.js +35 -20
  56. package/lib/commonjs/utils/styles.js.map +1 -1
  57. package/lib/commonjs/utils/withPlugins.js +15 -0
  58. package/lib/commonjs/utils/withPlugins.js.map +1 -0
  59. package/lib/module/common.js +28 -17
  60. package/lib/module/common.js.map +1 -1
  61. package/lib/module/core/UnistyleRegistry.js +65 -3
  62. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  63. package/lib/module/core/Unistyles.js +2 -2
  64. package/lib/module/core/Unistyles.js.map +1 -1
  65. package/lib/module/core/UnistylesModule.web.js +180 -0
  66. package/lib/module/core/UnistylesModule.web.js.map +1 -0
  67. package/lib/module/core/UnistylesRuntime.js +15 -16
  68. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  69. package/lib/module/createStyleSheet.js +1 -6
  70. package/lib/module/createStyleSheet.js.map +1 -1
  71. package/lib/module/hooks/index.js +1 -0
  72. package/lib/module/hooks/index.js.map +1 -1
  73. package/lib/module/hooks/useUnistyles.js +13 -10
  74. package/lib/module/hooks/useUnistyles.js.map +1 -1
  75. package/lib/module/hooks/useVariants.js +7 -0
  76. package/lib/module/hooks/useVariants.js.map +1 -0
  77. package/lib/module/index.js.map +1 -1
  78. package/lib/module/plugins/index.js +3 -0
  79. package/lib/module/plugins/index.js.map +1 -0
  80. package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
  81. package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
  82. package/lib/module/plugins/normalizer/index.js +3 -0
  83. package/lib/module/plugins/normalizer/index.js.map +1 -0
  84. package/lib/module/plugins/normalizer/module.d.js.map +1 -0
  85. package/lib/module/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +3 -3
  86. package/lib/module/plugins/normalizer/normalizeStyle.js.map +1 -0
  87. package/lib/module/{utils → plugins/normalizer}/normalizer.js +1 -1
  88. package/lib/module/plugins/normalizer/normalizer.js.map +1 -0
  89. package/lib/module/types/plugin.js +2 -0
  90. package/lib/module/types/{mq.js.map → plugin.js.map} +1 -1
  91. package/lib/module/types/stylesheet.js +2 -0
  92. package/lib/module/types/stylesheet.js.map +1 -0
  93. package/lib/module/types/variants.js +2 -0
  94. package/lib/module/{utils/module.d.js.map → types/variants.js.map} +1 -1
  95. package/lib/module/useStyles.js +12 -22
  96. package/lib/module/useStyles.js.map +1 -1
  97. package/lib/module/utils/breakpoints.js +12 -56
  98. package/lib/module/utils/breakpoints.js.map +1 -1
  99. package/lib/module/utils/index.js +4 -6
  100. package/lib/module/utils/index.js.map +1 -1
  101. package/lib/module/utils/mq.js +35 -67
  102. package/lib/module/utils/mq.js.map +1 -1
  103. package/lib/module/utils/mqParser.js +3 -3
  104. package/lib/module/utils/mqParser.js.map +1 -1
  105. package/lib/module/utils/styles.js +35 -20
  106. package/lib/module/utils/styles.js.map +1 -1
  107. package/lib/module/utils/withPlugins.js +8 -0
  108. package/lib/module/utils/withPlugins.js.map +1 -0
  109. package/lib/typescript/src/common.d.ts +23 -12
  110. package/lib/typescript/src/common.d.ts.map +1 -1
  111. package/lib/typescript/src/core/UnistyleRegistry.d.ts +45 -4
  112. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  113. package/lib/typescript/src/core/UnistylesModule.web.d.ts +19 -0
  114. package/lib/typescript/src/core/UnistylesModule.web.d.ts.map +1 -0
  115. package/lib/typescript/src/core/UnistylesRuntime.d.ts +8 -9
  116. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  117. package/lib/typescript/src/core/index.d.ts +1 -0
  118. package/lib/typescript/src/core/index.d.ts.map +1 -1
  119. package/lib/typescript/src/createStyleSheet.d.ts +2 -2
  120. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
  121. package/lib/typescript/src/global.d.ts.map +1 -1
  122. package/lib/typescript/src/hooks/index.d.ts +1 -0
  123. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  124. package/lib/typescript/src/hooks/useUnistyles.d.ts +2 -1
  125. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
  126. package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
  127. package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
  128. package/lib/typescript/src/index.d.ts +51 -5
  129. package/lib/typescript/src/index.d.ts.map +1 -1
  130. package/lib/typescript/src/plugins/index.d.ts +3 -0
  131. package/lib/typescript/src/plugins/index.d.ts.map +1 -0
  132. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
  133. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
  134. package/lib/typescript/src/plugins/normalizer/index.d.ts +3 -0
  135. package/lib/typescript/src/plugins/normalizer/index.d.ts.map +1 -0
  136. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +3 -0
  137. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +1 -0
  138. package/lib/typescript/src/{utils → plugins/normalizer}/normalizer.d.ts +1 -1
  139. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -0
  140. package/lib/typescript/src/types/breakpoints.d.ts +25 -12
  141. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  142. package/lib/typescript/src/types/core.d.ts +6 -27
  143. package/lib/typescript/src/types/core.d.ts.map +1 -1
  144. package/lib/typescript/src/types/index.d.ts +4 -2
  145. package/lib/typescript/src/types/index.d.ts.map +1 -1
  146. package/lib/typescript/src/types/plugin.d.ts +7 -0
  147. package/lib/typescript/src/types/plugin.d.ts.map +1 -0
  148. package/lib/typescript/src/types/stylesheet.d.ts +40 -0
  149. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
  150. package/lib/typescript/src/types/unistyles.d.ts +16 -11
  151. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  152. package/lib/typescript/src/types/variants.d.ts +14 -0
  153. package/lib/typescript/src/types/variants.d.ts.map +1 -0
  154. package/lib/typescript/src/useStyles.d.ts +3 -3
  155. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  156. package/lib/typescript/src/utils/breakpoints.d.ts +2 -5
  157. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  158. package/lib/typescript/src/utils/index.d.ts +4 -6
  159. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  160. package/lib/typescript/src/utils/mq.d.ts +15 -14
  161. package/lib/typescript/src/utils/mq.d.ts.map +1 -1
  162. package/lib/typescript/src/utils/mqParser.d.ts +14 -2
  163. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
  164. package/lib/typescript/src/utils/styles.d.ts +3 -4
  165. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  166. package/lib/typescript/src/utils/withPlugins.d.ts +3 -0
  167. package/lib/typescript/src/utils/withPlugins.d.ts.map +1 -0
  168. package/package.json +19 -16
  169. package/src/__tests__/mocks.ts +24 -0
  170. package/src/common.ts +30 -14
  171. package/src/core/UnistyleRegistry.ts +66 -4
  172. package/src/core/Unistyles.ts +2 -2
  173. package/src/core/UnistylesModule.web.ts +214 -0
  174. package/src/core/UnistylesRuntime.ts +18 -20
  175. package/src/core/index.ts +1 -0
  176. package/src/createStyleSheet.ts +2 -8
  177. package/src/global.ts +1 -0
  178. package/src/hooks/index.ts +1 -0
  179. package/src/hooks/useUnistyles.ts +12 -10
  180. package/src/hooks/useVariants.ts +10 -0
  181. package/src/index.ts +3 -1
  182. package/src/plugins/index.ts +2 -0
  183. package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
  184. package/src/plugins/normalizer/index.ts +2 -0
  185. package/src/{utils/normalizeStyles.web.ts → plugins/normalizer/normalizeStyle.ts} +3 -3
  186. package/src/{utils → plugins/normalizer}/normalizer.ts +3 -3
  187. package/src/types/breakpoints.ts +57 -25
  188. package/src/types/core.ts +9 -43
  189. package/src/types/index.ts +11 -2
  190. package/src/types/plugin.ts +7 -0
  191. package/src/types/stylesheet.ts +49 -0
  192. package/src/types/unistyles.ts +18 -13
  193. package/src/types/variants.ts +19 -0
  194. package/src/useStyles.ts +18 -25
  195. package/src/utils/breakpoints.ts +11 -67
  196. package/src/utils/index.ts +4 -6
  197. package/src/utils/mq.ts +31 -84
  198. package/src/utils/mqParser.ts +5 -5
  199. package/src/utils/styles.ts +44 -50
  200. package/src/utils/withPlugins.ts +13 -0
  201. package/lib/commonjs/utils/common.js +0 -25
  202. package/lib/commonjs/utils/common.js.map +0 -1
  203. package/lib/commonjs/utils/normalizeStyles.js +0 -10
  204. package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
  205. package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
  206. package/lib/commonjs/utils/normalizer.js.map +0 -1
  207. package/lib/module/types/mq.js +0 -2
  208. package/lib/module/utils/common.js +0 -17
  209. package/lib/module/utils/common.js.map +0 -1
  210. package/lib/module/utils/normalizeStyles.js +0 -3
  211. package/lib/module/utils/normalizeStyles.js.map +0 -1
  212. package/lib/module/utils/normalizeStyles.web.js.map +0 -1
  213. package/lib/module/utils/normalizer.js.map +0 -1
  214. package/lib/typescript/src/types/mq.d.ts +0 -3
  215. package/lib/typescript/src/types/mq.d.ts.map +0 -1
  216. package/lib/typescript/src/utils/common.d.ts +0 -12
  217. package/lib/typescript/src/utils/common.d.ts.map +0 -1
  218. package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
  219. package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
  220. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
  221. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
  222. package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
  223. package/src/types/mq.ts +0 -3
  224. package/src/utils/common.ts +0 -20
  225. package/src/utils/normalizeStyles.ts +0 -2
  226. /package/lib/commonjs/{utils → plugins/normalizer}/module.d.js +0 -0
  227. /package/lib/module/{utils → plugins/normalizer}/module.d.js +0 -0
  228. /package/src/{utils → plugins/normalizer}/module.d.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  import { getValueForBreakpoint } from './breakpoints';
2
- import { normalizeStyles } from './normalizeStyles';
3
- import { isAndroid, isIOS, isWeb } from './common';
4
- export const proxifyFunction = (fn, breakpoint, screenSize) => new Proxy(fn, {
5
- apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize)
2
+ import { isAndroid, isIOS } from '../common';
3
+ import { withPlugins } from './withPlugins';
4
+ export const proxifyFunction = (key, fn, variant) => new Proxy(fn, {
5
+ apply: (target, thisArg, argumentsList) => withPlugins(key, parseStyle(target.apply(thisArg, argumentsList), variant))
6
6
  });
7
7
  export const isPlatformColor = value => {
8
8
  if (isIOS) {
@@ -10,25 +10,40 @@ export const isPlatformColor = value => {
10
10
  }
11
11
  return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
12
12
  };
13
- export const parseStyle = (style, breakpoint, screenSize) => {
14
- const entries = Object.entries(style || {});
15
- const parsedStyles = Object.fromEntries(entries.map(_ref => {
13
+ export const parseStyle = function (style) {
14
+ let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
15
+ return Object.entries(style || {}).reduce((acc, _ref) => {
16
16
  let [key, value] = _ref;
17
- const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
18
- if (hasNestedProperties) {
19
- return [key, parseStyle(value, breakpoint, screenSize)];
17
+ // nested objects
18
+ if (key === 'shadowOffset' || key === 'textShadowOffset') {
19
+ acc[key] = parseStyle(value, variant);
20
+ return acc;
20
21
  }
21
- const isTransform = key === 'transform';
22
- if (isTransform && Array.isArray(value)) {
23
- return [key, value.map(value => parseStyle(value, breakpoint, screenSize))];
22
+
23
+ // transforms
24
+ if (key === 'transform' && Array.isArray(value)) {
25
+ acc[key] = value.map(value => parseStyle(value, variant));
26
+ return acc;
24
27
  }
25
- const isDynamicFunction = typeof value === 'function';
26
- const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
27
- if (isDynamicFunction || isValidStyle) {
28
- return [key, value];
28
+
29
+ // values or platform colors
30
+ if (typeof value !== 'object' || isPlatformColor(value)) {
31
+ acc[key] = value;
32
+ return acc;
29
33
  }
30
- return [key, getValueForBreakpoint(value)];
31
- }));
32
- return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
34
+ if (key === 'variants') {
35
+ return {
36
+ ...acc,
37
+ ...Object.keys(value).reduce((acc, key) => ({
38
+ ...acc,
39
+ ...parseStyle(value[key][variant[key] || 'default'] ?? {})
40
+ }), {})
41
+ };
42
+ }
43
+ return {
44
+ ...acc,
45
+ [key]: getValueForBreakpoint(value)
46
+ };
47
+ }, {});
33
48
  };
34
49
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getValueForBreakpoint","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,UAAU;AAElD,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,KACX,IAAIC,KAAK,CAACH,EAAE,EAAE;EACzBI,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEN,UAAU,EAAEC,UAAU;AAC/E,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIb,KAAK,EAAE;IACP,OAAO,UAAU,IAAIa,KAAK,IAAI,OAAOA,KAAK,CAACC,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOf,SAAS,IAAI,gBAAgB,IAAIc,KAAK,IAAI,OAAOA,KAAK,CAACE,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAED,OAAO,MAAMJ,UAAU,GAAGA,CACtBK,KAA2B,EAC3BZ,UAA+C,EAC/CC,UAAsB,KAClB;EACJ,MAAMY,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,IAAI,CAAC,CAAC,CAGzC;EAED,MAAMG,YAAY,GAAGD,MAAM,CACtBE,WAAW,CAACH,OAAO,CACfI,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEV,KAAK,CAAC,GAAAS,IAAA;IACd,MAAME,mBAAmB,GAAGD,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB;IAEhF,IAAIC,mBAAmB,EAAE;MACrB,OAAO,CACHD,GAAG,EACHZ,UAAU,CAACE,KAAK,EAA0BT,UAAU,EAAEC,UAAU,CAAC,CACpE;IACL;IAEA,MAAMoB,WAAW,GAAGF,GAAG,KAAK,WAAW;IAEvC,IAAIE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC,EAAE;MACrC,OAAO,CACHU,GAAG,EACHV,KAAK,CAACQ,GAAG,CAACR,KAAK,IAAIF,UAAU,CAACE,KAAK,EAAET,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAMuB,iBAAiB,GAAG,OAAOf,KAAK,KAAK,UAAU;IACrD,MAAMgB,YAAY,GAAG,OAAOhB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIe,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEV,KAAK,CAAC;IACvB;IAEA,OAAO,CACHU,GAAG,EACH1B,qBAAqB,CAACgB,KAAqF,CAAC,CAC/G;EACL,CAAC,CACL,CAAC;EAEL,OAAOZ,KAAK,GACNH,eAAe,CAACqB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
1
+ {"version":3,"names":["getValueForBreakpoint","isAndroid","isIOS","withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","arguments","length","undefined","Object","entries","reduce","acc","_ref","Array","isArray","map","keys"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC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GAAG;IACd;;IAEA;IACA,IAAI,OAAOV,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC,EAAE;MACrDU,GAAG,CAACpB,GAAG,CAAY,GAAGU,KAAK;MAE3B,OAAOU,GAAG;IACd;IAEA,IAAIpB,GAAG,KAAK,UAAU,EAAE;MACpB,OAAO;QACH,GAAGoB,GAAG;QACN,GAAIH,MAAM,CACLQ,IAAI,CAACf,KAAK,CAAC,CACXS,MAAM,CAAC,CAACC,GAAG,EAAEpB,GAAG,MAAM;UACnB,GAAGoB,GAAG;UACN,GAAGZ,UAAU,CAAEE,KAAK,CAAEV,GAAG,CAAC,CAACE,OAAO,CAACF,GAAG,CAAyB,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QACvF,CAAC,CAAC,EAAE,CAAC,CAAC;MACd,CAAC;IACL;IAEA,OAAO;MACH,GAAGoB,GAAG;MACN,CAACpB,GAAG,GAAGL,qBAAqB,CAACe,KAAgC;IACjE,CAAC;EACL,CAAC,EAAE,CAAC,CAAM,CAAC;AAAA"}
@@ -0,0 +1,8 @@
1
+ import { unistyles } from '../core';
2
+ export const withPlugins = (key, style) => unistyles.registry.plugins.reduce((acc, plugin) => {
3
+ if (plugin.onParsedStyle) {
4
+ return plugin.onParsedStyle(key, acc, unistyles.runtime);
5
+ }
6
+ return acc;
7
+ }, style);
8
+ //# sourceMappingURL=withPlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["unistyles","withPlugins","key","style","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbH,SAAS,CAACI,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACP,GAAG,EAAEK,GAAG,EAAEP,SAAS,CAACU,OAAO,CAAC;EAC5D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEJ,KAAK,CAAC"}
@@ -1,17 +1,28 @@
1
- export declare enum CxxUnistylesEventTypes {
1
+ export declare const warn: (message: string) => void;
2
+ export declare const isWeb: boolean;
3
+ export declare const isIOS: boolean;
4
+ export declare const isAndroid: boolean;
5
+ export declare const isMobile: boolean;
6
+ export declare const isServer: boolean;
7
+ export declare const ScreenOrientation: {
8
+ readonly Landscape: "landscape";
9
+ readonly Portrait: "portrait";
10
+ };
11
+ export declare enum UnistylesEventType {
2
12
  Theme = "theme",
3
- Layout = "layout"
13
+ Layout = "layout",
14
+ Plugin = "plugin"
4
15
  }
5
16
  export declare enum UnistylesError {
6
- RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
7
- ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
8
- ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
9
- ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
10
- BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
11
- BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
12
- }
13
- export declare enum ScreenOrientation {
14
- Portrait = 1,
15
- Landscape = 2
17
+ RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions",
18
+ ThemeNotFound = "You are trying to get a theme that is not registered with UnistylesRegistry",
19
+ ThemeNotRegistered = "You are trying to set a theme that was not registered with UnistylesRegistry",
20
+ ThemeNotSelected = "Your themes are registered, but you didn't select the initial theme",
21
+ ThemesCannotBeEmpty = "You are trying to register empty themes object",
22
+ BreakpointsCannotBeEmpty = "You are trying to register empty breakpoints object",
23
+ BreakpointsMustStartFromZero = "You are trying to register breakpoints that don't start from 0",
24
+ InvalidPluginName = "Plugin name can't start from reserved prefix __unistyles",
25
+ DuplicatePluginName = "You are trying to register a plugin with a name that is already registered",
26
+ CantRemoveInternalPlugin = "You are trying to remove an internal unistyles plugin"
16
27
  }
17
28
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF;AAGD,oBAAY,iBAAiB;IACzB,QAAQ,IAAI;IACZ,SAAS,IAAI;CAChB"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,6FAA6F;IAC/G,aAAa,gFAAgF;IAC7F,kBAAkB,iFAAiF;IACnG,gBAAgB,wEAAyE;IACzF,mBAAmB,mDAAmD;IACtE,wBAAwB,wDAAwD;IAChF,4BAA4B,mEAAoE;IAChG,iBAAiB,6DAA8D;IAC/E,mBAAmB,+EAA+E;IAClG,wBAAwB,0DAA0D;CACrF"}
@@ -1,15 +1,56 @@
1
- import type { UnistylesBridge, UnistylesConfig } from '../types';
1
+ import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types';
2
2
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
3
3
  export declare class UnistyleRegistry {
4
4
  private unistylesBridge;
5
5
  config: UnistylesConfig;
6
+ plugins: Array<UnistylesPlugin>;
6
7
  themeNames: Array<keyof UnistylesThemes>;
7
8
  themes: UnistylesThemes;
8
9
  breakpoints: UnistylesBreakpoints;
9
10
  sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
10
11
  constructor(unistylesBridge: UnistylesBridge);
11
- addThemes: (themes: UnistylesThemes) => this;
12
- addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
13
- addConfig: (config: UnistylesConfig) => this;
12
+ addThemes: (themes: UnistylesThemes) => {
13
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
14
+ addThemes: any;
15
+ addConfig: (config: UnistylesConfig) => {
16
+ addBreakpoints: any;
17
+ addThemes: any;
18
+ };
19
+ };
20
+ addConfig: (config: UnistylesConfig) => {
21
+ addBreakpoints: any;
22
+ addThemes: any;
23
+ };
24
+ };
25
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
26
+ addThemes: (themes: UnistylesThemes) => {
27
+ addBreakpoints: any;
28
+ addConfig: (config: UnistylesConfig) => {
29
+ addBreakpoints: any;
30
+ addThemes: any;
31
+ };
32
+ };
33
+ addConfig: (config: UnistylesConfig) => {
34
+ addBreakpoints: any;
35
+ addThemes: any;
36
+ };
37
+ };
38
+ addConfig: (config: UnistylesConfig) => {
39
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
40
+ addThemes: (themes: UnistylesThemes) => {
41
+ addBreakpoints: any;
42
+ addConfig: any;
43
+ };
44
+ addConfig: any;
45
+ };
46
+ addThemes: (themes: UnistylesThemes) => {
47
+ addBreakpoints: any;
48
+ addConfig: any;
49
+ };
50
+ };
51
+ getTheme: (forName: keyof UnistylesThemes) => never;
52
+ addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
53
+ removePlugin: (plugin: UnistylesPlugin) => void;
54
+ hasTheme: (name: keyof UnistylesThemes) => boolean;
14
55
  }
15
56
  //# sourceMappingURL=UnistyleRegistry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEtE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,MAAM,EAAE,eAAe,CAAK;IAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAS1C;IAEM,cAAc,gBAAiB,oBAAoB,UAMzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;CACJ"}
1
+ {"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAItE,qBAAa,gBAAgB;IAUb,OAAO,CAAC,eAAe;IAT5B,MAAM,EAAE,eAAe,CAAK;IAC5B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAE9B;IACD,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;MA4C1C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAchD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAW3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
@@ -0,0 +1,19 @@
1
+ export declare class UnistylesBridgeWeb {
2
+ #private;
3
+ constructor();
4
+ install(): boolean;
5
+ private useTheme;
6
+ private useBreakpoints;
7
+ private useAdaptiveThemes;
8
+ private addPlugin;
9
+ private removePlugin;
10
+ private getTheme;
11
+ private setupListeners;
12
+ private getBreakpointFromScreenWidth;
13
+ private getPreferredColorScheme;
14
+ private emitPluginChange;
15
+ private emitThemeChange;
16
+ private emitLayoutChange;
17
+ }
18
+ export declare const UnistylesModule: UnistylesBridgeWeb;
19
+ //# sourceMappingURL=UnistylesModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnistylesModule.web.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.web.ts"],"names":[],"mappings":"AAKA,qBAAa,kBAAkB;;;IAkBpB,OAAO;IA0Dd,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,4BAA4B;IAgBpC,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAe3B;AAED,eAAO,MAAM,eAAe,oBAA2B,CAAA"}
@@ -1,24 +1,23 @@
1
- import { ScreenOrientation } from '../common';
2
- import type { UnistylesBridge } from '../types';
1
+ import type { UnistylesBridge, UnistylesPlugin } from '../types';
3
2
  import type { UnistylesThemes } from '../global';
4
3
  import type { UnistyleRegistry } from './UnistyleRegistry';
5
4
  export declare class UnistylesRuntime {
6
5
  private unistylesBridge;
7
- private registry;
8
- constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
6
+ private unistylesRegistry;
7
+ constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
9
8
  get colorScheme(): import("../types").ColorSchemeName;
10
9
  get hasAdaptiveThemes(): boolean;
11
- get sortedBreakpoints(): [keyof import("../global").UnistylesBreakpoints, number | undefined][];
12
10
  get themeName(): never;
13
11
  get breakpoint(): keyof import("../global").UnistylesBreakpoints;
12
+ get enabledPlugins(): string[];
14
13
  get screen(): {
15
14
  width: number;
16
15
  height: number;
17
16
  };
18
- get orientation(): ScreenOrientation;
19
- setTheme: (name: keyof UnistylesThemes) => boolean;
20
- getTheme: (forName: keyof UnistylesThemes) => never;
17
+ get orientation(): "landscape" | "portrait";
18
+ setTheme: (name: keyof UnistylesThemes) => true | undefined;
21
19
  setAdaptiveThemes: (enable: boolean) => void;
22
- private hasTheme;
20
+ addPlugin: (plugin: UnistylesPlugin) => void;
21
+ removePlugin: (plugin: UnistylesPlugin) => void;
23
22
  }
24
23
  //# sourceMappingURL=UnistylesRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,2EAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAUhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
1
+ {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,cAAc,aAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,6BAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAEM,SAAS,WAAY,eAAe,UAE1C;IAEM,YAAY,WAAY,eAAe,UAE7C;CACJ"}
@@ -1,2 +1,3 @@
1
1
  export { unistyles } from './Unistyles';
2
+ export type { UnistylesRuntime } from './UnistylesRuntime';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,3 +1,3 @@
1
- import type { CustomNamedStyles, UnistylesTheme } from './types';
2
- export declare const createStyleSheet: <S, X>(styles: S | X | CustomNamedStyles<S> | ((theme: UnistylesTheme) => X | CustomNamedStyles<X>)) => S | X;
1
+ import type { StyleSheetWithSuperPowers } from './types';
2
+ export declare const createStyleSheet: <S extends StyleSheetWithSuperPowers>(stylesheet: S) => S;
3
3
  //# sourceMappingURL=createStyleSheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,gBAAgB,yDAA0D,cAAc,wCAMpG,CAAA"}
1
+ {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,gBAAgB,2DAAwE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IAEjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1,3 +1,4 @@
1
1
  export { useInitialTheme } from './useInitialTheme';
2
2
  export { useUnistyles } from './useUnistyles';
3
+ export { useVariants } from './useVariants';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
@@ -1,8 +1,9 @@
1
1
  export declare const useUnistyles: () => {
2
+ plugins: string[];
2
3
  theme: never;
3
4
  layout: {
4
5
  breakpoint: keyof import("..").UnistylesBreakpoints;
5
- orientation: import("../common").ScreenOrientation;
6
+ orientation: "landscape" | "portrait";
6
7
  screenSize: {
7
8
  width: number;
8
9
  height: number;
@@ -1 +1 @@
1
- {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;CA8CxB,CAAA"}
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;CAgDxB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Optional } from '../types';
2
+ export declare const useVariants: (variantsMap?: Record<string, Optional<string>>) => Optional<Record<string, Optional<string>>>;
3
+ //# sourceMappingURL=useVariants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,WAAW,iBAAkB,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,+CAMzE,CAAA"}
@@ -1,15 +1,61 @@
1
1
  import { mq } from './utils';
2
2
  import { useInitialTheme } from './hooks';
3
+ import type { UnistylesPlugin } from './types';
3
4
  import type { UnistylesThemes, UnistylesBreakpoints } from './global';
4
5
  import { ScreenOrientation } from './common';
5
6
  import { useStyles } from './useStyles';
6
7
  import { createStyleSheet } from './createStyleSheet';
7
8
  declare const UnistylesRegistry: {
8
- addThemes: (themes: UnistylesThemes) => import("./core/UnistyleRegistry").UnistyleRegistry;
9
- addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./core/UnistyleRegistry").UnistyleRegistry;
10
- addConfig: (config: import("./types").UnistylesConfig) => import("./core/UnistyleRegistry").UnistyleRegistry;
9
+ addThemes: (themes: UnistylesThemes) => {
10
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
11
+ addThemes: any;
12
+ addConfig: (config: import("./types").UnistylesConfig) => {
13
+ addBreakpoints: any;
14
+ addThemes: any;
15
+ };
16
+ };
17
+ addConfig: (config: import("./types").UnistylesConfig) => {
18
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
19
+ addThemes: any;
20
+ addConfig: any;
21
+ };
22
+ addThemes: any;
23
+ };
24
+ };
25
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
26
+ addThemes: (themes: UnistylesThemes) => {
27
+ addBreakpoints: any;
28
+ addConfig: (config: import("./types").UnistylesConfig) => {
29
+ addBreakpoints: any;
30
+ addThemes: any;
31
+ };
32
+ };
33
+ addConfig: (config: import("./types").UnistylesConfig) => {
34
+ addBreakpoints: any;
35
+ addThemes: (themes: UnistylesThemes) => {
36
+ addBreakpoints: any;
37
+ addConfig: any;
38
+ };
39
+ };
40
+ };
41
+ addConfig: (config: import("./types").UnistylesConfig) => {
42
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
43
+ addThemes: (themes: UnistylesThemes) => {
44
+ addBreakpoints: any;
45
+ addConfig: any;
46
+ };
47
+ addConfig: any;
48
+ };
49
+ addThemes: (themes: UnistylesThemes) => {
50
+ addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
51
+ addThemes: any;
52
+ addConfig: any;
53
+ };
54
+ addConfig: any;
55
+ };
56
+ };
11
57
  };
12
- declare const UnistylesRuntime: import("./core/UnistylesRuntime").UnistylesRuntime;
58
+ declare const UnistylesRuntime: import("./core").UnistylesRuntime;
13
59
  export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
14
- export type { UnistylesThemes, UnistylesBreakpoints };
60
+ export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin };
15
61
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,oDAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,mCAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,eAAe,EAClB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { normalizeWebStylesPlugin } from './normalizeWebStylesPlugin';
2
+ export { preprocessor, normalizeNumericValue, normalizeColor, normalizeStyle } from './normalizer';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { UnistylesPlugin } from '../types';
2
+ export declare const normalizeWebStylesPlugin: UnistylesPlugin;
3
+ //# sourceMappingURL=normalizeWebStylesPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeWebStylesPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/normalizeWebStylesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { normalizeStyle } from './normalizeStyle';
2
+ export { preprocessor, normalizeNumericValue, normalizeColor } from './normalizer';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { RNStyle } from '../../types';
2
+ export declare const normalizeStyle: <T extends RNStyle>(style: T) => T;
3
+ //# sourceMappingURL=normalizeStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeStyle.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/normalizeStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoE,OAAO,EAAE,MAAM,aAAa,CAAA;AAuD5G,eAAO,MAAM,cAAc,oCAwB1B,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { TextShadow, Transforms, BoxShadow } from '../types';
1
+ import type { TextShadow, Transforms, BoxShadow } from '../../types';
2
2
  type Preprocessor = {
3
3
  createTextShadowValue(style: TextShadow): string;
4
4
  createBoxShadowValue(style: Required<BoxShadow>): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/normalizer/normalizer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAY,MAAM,aAAa,CAAA;AAE9E,KAAK,YAAY,GAAG;IAChB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC;IACjD,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;IACzD,oBAAoB,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;CAClE,CAAA;AAED,eAAO,MAAM,cAAc,UAAW,MAAM,YAAW,MAAM,WAyB5D,CAAA;AAED,eAAO,MAAM,qBAAqB,UAAW,MAAM,oBAAiC,CAAA;AAwDpF,eAAO,MAAM,YAAY,EAAE,YAI1B,CAAA"}
@@ -1,15 +1,28 @@
1
- import type { OpaqueColorValue } from 'react-native';
2
- import type { UnistylesBreakpoints } from '../global';
3
- import type { MediaQuery } from './mq';
4
- type WithEmptyObject<V> = keyof V extends never ? {} : V;
5
- type ExtractBreakpoints<T> = T extends Partial<Record<keyof UnistylesBreakpoints & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : {
6
- [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : T[K] extends object ? ExtractBreakpoints<T[K]> : T[K];
7
- };
8
- type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends OpaqueColorValue ? string : T extends Record<string, infer _V> ? {
9
- [K in keyof T as K extends MediaQuery ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
10
- } : {
11
- [K in keyof T]: RemoveKeysWithPrefix<T[K]>;
1
+ import type { ColorValue, OpaqueColorValue } from 'react-native';
2
+ import type { UnistylesTheme } from '../types';
3
+ import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet';
4
+ import type { TransformStyles } from './core';
5
+ type ExtractTransformArray<T> = T extends object ? {
6
+ [K in keyof T]: ExtractBreakpoints<T[K]>;
7
+ } : never;
8
+ type ExtractBreakpoints<T> = T extends object ? keyof T extends BreakpointsOrMediaQueries ? T[keyof T] : T extends Array<ToDeepUnistyles<TransformStyles>> ? Array<ExtractTransformArray<T[number]>> : {
9
+ [K in keyof T]: ExtractBreakpoints<T[K]>;
12
10
  } : T;
13
- export type ReactNativeStyleSheet<T> = ExtractBreakpoints<RemoveKeysWithPrefix<T>>;
11
+ type ParseNestedObject<T> = T extends (...args: infer A) => infer R ? (...args: A) => ParseNestedObject<R> : T extends object ? T extends {
12
+ variants: infer R;
13
+ } ? ParseVariants<FlattenVariants<R>> & ParseNestedObject<Omit<T, 'variants'>> : {
14
+ [K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
15
+ } : T;
16
+ type FlattenVariants<T> = T extends object ? {
17
+ [K in keyof T]: T[K] extends object ? {
18
+ [key in keyof T[K]]: T[K][key] extends object ? ParseNestedObject<T[K][key]> : never;
19
+ } : never;
20
+ } : never;
21
+ type ParseVariants<T> = T extends object ? T[keyof T] extends object ? UnionToIntersection<ParseVariants<T[keyof T]>> : T : T;
22
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
23
+ type ParseStyleKeys<T> = T extends object ? {
24
+ [K in keyof T]: ParseNestedObject<T[K]>;
25
+ } : never;
26
+ export type ReactNativeStyleSheet<T> = T extends (theme: UnistylesTheme) => infer R ? ParseStyleKeys<R> : ParseStyleKeys<T>;
14
27
  export {};
15
28
  //# sourceMappingURL=breakpoints.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,KAAK,eAAe,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;AAExD,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAC9F,eAAe,CAAC,CAAC,CAAC,GAClB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACnC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,GACrC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACpD,CAAC,GAAG,IAAI,EA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,SAAS,MAAM,GAC7B;SACG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,GACvC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAC5B,KAAK;KACd,GACC,KAAK;CACd,GACC,KAAK,CAAA;AAEX,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAClC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,GACrB,mBAAmB,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAC9C,CAAC,GACL,CAAC,CAAA;AAEP,KAAK,mBAAmB,CAAC,CAAC,IACtB,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEvF,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACnC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC3C,KAAK,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC,GAC7E,cAAc,CAAC,CAAC,CAAC,GACjB,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1,39 +1,18 @@
1
1
  import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
2
2
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
3
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
4
- import type { MediaQuery } from './mq';
5
- type ShadowOffset = {
4
+ export type ShadowOffset = {
6
5
  width: number;
7
6
  height: number;
8
7
  };
8
+ export type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
9
9
  export type ScreenSize = {
10
10
  width: number;
11
11
  height: number;
12
12
  };
13
- type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
14
- type UnistyleNested = {
15
- shadowOffset?: DeepUniStyle<ShadowOffset>;
16
- textShadowOffset?: DeepUniStyle<ShadowOffset>;
17
- transform?: Array<DeepUniStyle<TransformStyles>>;
18
- };
19
- type UniStyle<V> = {
20
- [innerKey in keyof UnistylesBreakpoints]?: V;
21
- } | {
22
- [innerKey in MediaQuery]: V;
23
- };
24
- type DeepUniStyle<T> = {
25
- [K in keyof T]?: UniStyle<T[K]> | T[K];
26
- };
27
- type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
28
- type UnistyleView = DeepUniStyle<Omit<ViewStyle, NestedTypes>>;
29
- type UnistyleText = DeepUniStyle<Omit<TextStyle, NestedTypes>>;
30
- type UnistyleImage = DeepUniStyle<Omit<ImageStyle, NestedTypes>>;
31
- export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & UnistyleNested;
32
- export type CustomNamedStyles<T> = {
33
- [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
34
- };
35
- export type NestedKeys = Array<[keyof UnistylesBreakpoints | MediaQuery, string | number | undefined]>;
13
+ export type RNStyle = ViewStyle & TextStyle & ImageStyle;
14
+ export type RNValue = ViewStyle[keyof ViewStyle] | TextStyle[keyof TextStyle] | ImageStyle[keyof ImageStyle];
15
+ export type NestedStyle = Record<keyof UnistylesBreakpoints | symbol, RNValue>;
16
+ export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | symbol, RNValue]>;
36
17
  export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
37
- export type CreateStylesFactory<ST, Theme> = (theme: Theme) => ST;
38
- export {};
39
18
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAEtC,KAAK,YAAY,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,eAAe,GACd,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,cAAc,GACd,cAAc,GACd,eAAe,CAAA;AAErB,KAAK,cAAc,GAAG;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC,YAA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