react-native-unistyles 2.0.0-alpha.10 → 2.0.0-alpha.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. package/cxx/UnistylesRuntime.cpp +55 -1
  2. package/cxx/UnistylesRuntime.h +10 -4
  3. package/ios/UnistylesModule.mm +12 -2
  4. package/lib/commonjs/common.js +19 -6
  5. package/lib/commonjs/common.js.map +1 -1
  6. package/lib/commonjs/core/UnistyleRegistry.js +49 -1
  7. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  8. package/lib/commonjs/core/UnistylesRuntime.js +12 -16
  9. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  10. package/lib/commonjs/hooks/useUnistyles.js +8 -2
  11. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/plugins/index.js +45 -0
  14. package/lib/commonjs/plugins/index.js.map +1 -0
  15. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
  16. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
  17. package/lib/commonjs/plugins/normalizer/index.js +32 -0
  18. package/lib/commonjs/plugins/normalizer/index.js.map +1 -0
  19. package/lib/commonjs/plugins/normalizer/module.d.js.map +1 -0
  20. package/lib/commonjs/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +5 -5
  21. package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +1 -0
  22. package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -0
  23. package/lib/commonjs/plugins/withPlugins.js +18 -0
  24. package/lib/commonjs/plugins/withPlugins.js.map +1 -0
  25. package/lib/commonjs/types/plugin.js +6 -0
  26. package/lib/{module/utils/module.d.js.map → commonjs/types/plugin.js.map} +1 -1
  27. package/lib/commonjs/types/variants.js +2 -0
  28. package/lib/commonjs/{utils/module.d.js.map → types/variants.js.map} +1 -1
  29. package/lib/commonjs/useStyles.js +5 -4
  30. package/lib/commonjs/useStyles.js.map +1 -1
  31. package/lib/commonjs/utils/breakpoints.js +15 -70
  32. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  33. package/lib/commonjs/utils/index.js +12 -52
  34. package/lib/commonjs/utils/index.js.map +1 -1
  35. package/lib/commonjs/utils/mq.js +1 -1
  36. package/lib/commonjs/utils/mq.js.map +1 -1
  37. package/lib/commonjs/utils/mqParser.js +4 -1
  38. package/lib/commonjs/utils/mqParser.js.map +1 -1
  39. package/lib/commonjs/utils/styles.js +22 -11
  40. package/lib/commonjs/utils/styles.js.map +1 -1
  41. package/lib/commonjs/utils/variants.js +2 -5
  42. package/lib/commonjs/utils/variants.js.map +1 -1
  43. package/lib/module/common.js +17 -7
  44. package/lib/module/common.js.map +1 -1
  45. package/lib/module/core/UnistyleRegistry.js +49 -1
  46. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  47. package/lib/module/core/UnistylesRuntime.js +12 -16
  48. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  49. package/lib/module/hooks/useUnistyles.js +8 -2
  50. package/lib/module/hooks/useUnistyles.js.map +1 -1
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/plugins/index.js +4 -0
  53. package/lib/module/plugins/index.js.map +1 -0
  54. package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
  55. package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
  56. package/lib/module/plugins/normalizer/index.js +3 -0
  57. package/lib/module/plugins/normalizer/index.js.map +1 -0
  58. package/lib/module/plugins/normalizer/module.d.js.map +1 -0
  59. package/lib/module/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +3 -3
  60. package/lib/module/plugins/normalizer/normalizeStyle.js.map +1 -0
  61. package/lib/module/plugins/normalizer/normalizer.js.map +1 -0
  62. package/lib/module/plugins/withPlugins.js +11 -0
  63. package/lib/module/plugins/withPlugins.js.map +1 -0
  64. package/lib/module/types/plugin.js +2 -0
  65. package/lib/module/types/plugin.js.map +1 -0
  66. package/lib/module/types/variants.js +2 -0
  67. package/lib/module/types/variants.js.map +1 -0
  68. package/lib/module/useStyles.js +5 -4
  69. package/lib/module/useStyles.js.map +1 -1
  70. package/lib/module/utils/breakpoints.js +13 -66
  71. package/lib/module/utils/breakpoints.js.map +1 -1
  72. package/lib/module/utils/index.js +2 -5
  73. package/lib/module/utils/index.js.map +1 -1
  74. package/lib/module/utils/mq.js +1 -1
  75. package/lib/module/utils/mq.js.map +1 -1
  76. package/lib/module/utils/mqParser.js +3 -3
  77. package/lib/module/utils/mqParser.js.map +1 -1
  78. package/lib/module/utils/styles.js +23 -12
  79. package/lib/module/utils/styles.js.map +1 -1
  80. package/lib/module/utils/variants.js +2 -5
  81. package/lib/module/utils/variants.js.map +1 -1
  82. package/lib/typescript/src/common.d.ts +16 -6
  83. package/lib/typescript/src/common.d.ts.map +1 -1
  84. package/lib/typescript/src/core/UnistyleRegistry.d.ts +7 -2
  85. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  86. package/lib/typescript/src/core/UnistylesRuntime.d.ts +7 -8
  87. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  88. package/lib/typescript/src/core/index.d.ts +1 -0
  89. package/lib/typescript/src/core/index.d.ts.map +1 -1
  90. package/lib/typescript/src/hooks/useUnistyles.d.ts +2 -1
  91. package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
  92. package/lib/typescript/src/index.d.ts +4 -3
  93. package/lib/typescript/src/index.d.ts.map +1 -1
  94. package/lib/typescript/src/plugins/index.d.ts +4 -0
  95. package/lib/typescript/src/plugins/index.d.ts.map +1 -0
  96. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
  97. package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
  98. package/lib/typescript/src/plugins/normalizer/index.d.ts +3 -0
  99. package/lib/typescript/src/plugins/normalizer/index.d.ts.map +1 -0
  100. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +3 -0
  101. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +1 -0
  102. package/lib/typescript/src/{utils → plugins/normalizer}/normalizer.d.ts +1 -1
  103. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -0
  104. package/lib/typescript/src/plugins/withPlugins.d.ts +3 -0
  105. package/lib/typescript/src/plugins/withPlugins.d.ts.map +1 -0
  106. package/lib/typescript/src/types/breakpoints.d.ts +3 -4
  107. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  108. package/lib/typescript/src/types/core.d.ts +4 -9
  109. package/lib/typescript/src/types/core.d.ts.map +1 -1
  110. package/lib/typescript/src/types/index.d.ts +3 -1
  111. package/lib/typescript/src/types/index.d.ts.map +1 -1
  112. package/lib/typescript/src/types/plugin.d.ts +7 -0
  113. package/lib/typescript/src/types/plugin.d.ts.map +1 -0
  114. package/lib/typescript/src/types/unistyles.d.ts +11 -2
  115. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  116. package/lib/typescript/src/types/variants.d.ts +8 -0
  117. package/lib/typescript/src/types/variants.d.ts.map +1 -0
  118. package/lib/typescript/src/useStyles.d.ts +2 -2
  119. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  120. package/lib/typescript/src/utils/breakpoints.d.ts +2 -5
  121. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  122. package/lib/typescript/src/utils/index.d.ts +2 -5
  123. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  124. package/lib/typescript/src/utils/mqParser.d.ts +12 -0
  125. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
  126. package/lib/typescript/src/utils/styles.d.ts +3 -3
  127. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  128. package/lib/typescript/src/utils/variants.d.ts +1 -1
  129. package/lib/typescript/src/utils/variants.d.ts.map +1 -1
  130. package/package.json +4 -1
  131. package/src/__tests__/mocks.ts +24 -0
  132. package/src/common.ts +22 -7
  133. package/src/core/UnistyleRegistry.ts +46 -2
  134. package/src/core/UnistylesRuntime.ts +14 -20
  135. package/src/core/index.ts +1 -0
  136. package/src/hooks/useUnistyles.ts +7 -2
  137. package/src/index.ts +3 -1
  138. package/src/plugins/index.ts +3 -0
  139. package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
  140. package/src/plugins/normalizer/index.ts +2 -0
  141. package/src/{utils/normalizeStyles.web.ts → plugins/normalizer/normalizeStyle.ts} +3 -3
  142. package/src/{utils → plugins/normalizer}/normalizer.ts +1 -1
  143. package/src/plugins/withPlugins.ts +17 -0
  144. package/src/types/breakpoints.ts +5 -4
  145. package/src/types/core.ts +5 -10
  146. package/src/types/index.ts +12 -1
  147. package/src/types/plugin.ts +7 -0
  148. package/src/types/unistyles.ts +14 -4
  149. package/src/types/variants.ts +11 -0
  150. package/src/useStyles.ts +12 -6
  151. package/src/utils/breakpoints.ts +10 -75
  152. package/src/utils/index.ts +2 -5
  153. package/src/utils/mq.ts +1 -1
  154. package/src/utils/mqParser.ts +4 -4
  155. package/src/utils/styles.ts +35 -20
  156. package/src/utils/variants.ts +5 -9
  157. package/lib/commonjs/utils/common.js +0 -25
  158. package/lib/commonjs/utils/common.js.map +0 -1
  159. package/lib/commonjs/utils/normalizeStyles.js +0 -10
  160. package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
  161. package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
  162. package/lib/commonjs/utils/normalizer.js.map +0 -1
  163. package/lib/module/utils/common.js +0 -17
  164. package/lib/module/utils/common.js.map +0 -1
  165. package/lib/module/utils/normalizeStyles.js +0 -3
  166. package/lib/module/utils/normalizeStyles.js.map +0 -1
  167. package/lib/module/utils/normalizeStyles.web.js.map +0 -1
  168. package/lib/module/utils/normalizer.js.map +0 -1
  169. package/lib/typescript/src/utils/common.d.ts +0 -12
  170. package/lib/typescript/src/utils/common.d.ts.map +0 -1
  171. package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
  172. package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
  173. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
  174. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
  175. package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
  176. package/src/utils/common.ts +0 -20
  177. package/src/utils/normalizeStyles.ts +0 -2
  178. /package/lib/commonjs/{utils → plugins/normalizer}/module.d.js +0 -0
  179. /package/lib/commonjs/{utils → plugins/normalizer}/normalizer.js +0 -0
  180. /package/lib/module/{utils → plugins/normalizer}/module.d.js +0 -0
  181. /package/lib/module/{utils → plugins/normalizer}/normalizer.js +0 -0
  182. /package/src/{utils → plugins/normalizer}/module.d.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  import { ScreenOrientation, UnistylesError } from '../common';
2
2
  export class UnistylesRuntime {
3
- constructor(unistylesBridge, registry) {
3
+ constructor(unistylesBridge, unistylesRegistry) {
4
4
  this.unistylesBridge = unistylesBridge;
5
- this.registry = registry;
5
+ this.unistylesRegistry = unistylesRegistry;
6
6
  }
7
7
  get colorScheme() {
8
8
  return this.unistylesBridge.colorScheme;
@@ -10,15 +10,15 @@ export class UnistylesRuntime {
10
10
  get hasAdaptiveThemes() {
11
11
  return this.unistylesBridge.hasAdaptiveThemes;
12
12
  }
13
- get sortedBreakpoints() {
14
- return this.registry.sortedBreakpointPairs;
15
- }
16
13
  get themeName() {
17
14
  return this.unistylesBridge.themeName;
18
15
  }
19
16
  get breakpoint() {
20
17
  return this.unistylesBridge.breakpoint;
21
18
  }
19
+ get enabledPlugins() {
20
+ return this.unistylesBridge.enabledPlugins;
21
+ }
22
22
  get screen() {
23
23
  return {
24
24
  width: this.unistylesBridge.screenWidth,
@@ -36,24 +36,20 @@ export class UnistylesRuntime {
36
36
  return ScreenOrientation.Portrait;
37
37
  }
38
38
  setTheme = name => {
39
- if (this.hasTheme(name)) {
39
+ if (this.unistylesRegistry.hasTheme(name)) {
40
40
  this.unistylesBridge.useTheme(name);
41
41
  return true;
42
42
  }
43
43
  throw new Error(UnistylesError.ThemeNotRegistered);
44
44
  };
45
- getTheme = forName => {
46
- if (this.registry.themeNames.length === 0) {
47
- return {};
48
- }
49
- if (!this.hasTheme(forName)) {
50
- throw new Error(UnistylesError.ThemeNotFound);
51
- }
52
- return this.registry.themes[forName];
53
- };
54
45
  setAdaptiveThemes = enable => {
55
46
  this.unistylesBridge.useAdaptiveThemes(enable);
56
47
  };
57
- hasTheme = name => name in this.registry.themes;
48
+ addPlugin = plugin => {
49
+ this.unistylesRegistry.addPlugin(plugin);
50
+ };
51
+ removePlugin = plugin => {
52
+ this.unistylesRegistry.removePlugin(plugin);
53
+ };
58
54
  }
59
55
  //# sourceMappingURL=UnistylesRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","hasAdaptiveThemes","sortedBreakpoints","sortedBreakpointPairs","themeName","breakpoint","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","getTheme","forName","themeNames","length","ThemeNotFound","themes","setAdaptiveThemes","enable","useAdaptiveThemes"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAK7D,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,QAA0B,EAAE;IAAA,KAAtED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,QAA0B,GAA1BA,QAA0B;EAAG;EAE3F,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,QAAQ,CAACI,qBAAqB;EAC9C;EAEA,IAAWC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,QAAQ,GAAID,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChB,QAAQ,CAAC0B,MAAM;AACpF"}
1
+ {"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":"AAAA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,WAAW;AAK7D,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;EAEpG,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACL,eAAe,CAACK,UAAU;EAC1C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACN,eAAe,CAACM,cAAc;EAC9C;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACR,eAAe,CAACS,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACV,eAAe,CAACW;IACjC,CAAC;EACL;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,MAAM;MAAEJ,KAAK;MAAEE;IAAO,CAAC,GAAG,IAAI,CAACH,MAAM;IAErC,IAAIC,KAAK,GAAGE,MAAM,EAAE;MAChB,OAAOd,iBAAiB,CAACiB,SAAS;IACtC;IAEA,OAAOjB,iBAAiB,CAACkB,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAI,IAAI,CAACf,iBAAiB,CAACgB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAAChB,eAAe,CAACkB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACtB,cAAc,CAACuB,kBAAkB,CAAC;EACtD,CAAC;EAEMC,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAACtB,eAAe,CAACuB,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEME,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAACxB,iBAAiB,CAACuB,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;EAEMC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAACxB,iBAAiB,CAACyB,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL"}
@@ -4,7 +4,8 @@ import { unistyles } from '../core';
4
4
  import { CxxUnistylesEventTypes } from '../common';
5
5
  const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
6
6
  export const useUnistyles = () => {
7
- const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName));
7
+ const [plugins, setPlugins] = useState(unistyles.runtime.enabledPlugins);
8
+ const [theme, setTheme] = useState(unistyles.registry.getTheme(unistyles.runtime.themeName));
8
9
  const [layout, setLayout] = useState({
9
10
  breakpoint: unistyles.runtime.breakpoint,
10
11
  orientation: unistyles.runtime.orientation,
@@ -19,7 +20,7 @@ export const useUnistyles = () => {
19
20
  case CxxUnistylesEventTypes.Theme:
20
21
  {
21
22
  const themeEvent = event;
22
- return setTheme(unistyles.runtime.getTheme(themeEvent.payload.themeName));
23
+ return setTheme(unistyles.registry.getTheme(themeEvent.payload.themeName));
23
24
  }
24
25
  case CxxUnistylesEventTypes.Layout:
25
26
  {
@@ -33,6 +34,10 @@ export const useUnistyles = () => {
33
34
  }
34
35
  });
35
36
  }
37
+ case CxxUnistylesEventTypes.Plugin:
38
+ {
39
+ return setPlugins(unistyles.runtime.enabledPlugins);
40
+ }
36
41
  default:
37
42
  return;
38
43
  }
@@ -40,6 +45,7 @@ export const useUnistyles = () => {
40
45
  return subscription.remove;
41
46
  }, []);
42
47
  return {
48
+ plugins,
43
49
  theme,
44
50
  layout
45
51
  };
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","CxxUnistylesEventTypes","unistylesEvents","Unistyles","useUnistyles","theme","setTheme","runtime","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","remove"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,sBAAsB,QAAQ,WAAW;AAGlD,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAACC,SAAS,CAACO,OAAO,CAACC,QAAQ,CAACR,SAAS,CAACO,OAAO,CAACE,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGZ,QAAQ,CAAC;IACjCa,UAAU,EAAEZ,SAAS,CAACO,OAAO,CAACK,UAAU;IACxCC,WAAW,EAAEb,SAAS,CAACO,OAAO,CAACM,WAAW;IAC1CC,UAAU,EAAE;MACRC,KAAK,EAAEf,SAAS,CAACO,OAAO,CAACS,MAAM,CAACD,KAAK;MACrCE,MAAM,EAAEjB,SAAS,CAACO,OAAO,CAACS,MAAM,CAACC;IACrC;EACJ,CAAC,CAAC;EAEFnB,SAAS,CAAC,MAAM;IACZ,MAAMoB,YAAY,GAAGhB,eAAe,CAACiB,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKpB,sBAAsB,CAACqB,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGH,KAA4B;YAE/C,OAAOd,QAAQ,CAACN,SAAS,CAACO,OAAO,CAACC,QAAQ,CAACe,UAAU,CAACC,OAAO,CAACf,SAAS,CAAC,CAAC;UAC7E;QACA,KAAKR,sBAAsB,CAACwB,MAAM;UAAE;YAChC,MAAMC,WAAW,GAAGN,KAAmC;YAEvD,OAAOT,SAAS,CAAC;cACbC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACZ,UAAU;cAC1CC,WAAW,EAAEa,WAAW,CAACF,OAAO,CAACX,WAAW;cAC5CC,UAAU,EAAE;gBACRC,KAAK,EAAEW,WAAW,CAACF,OAAO,CAACR,MAAM,CAACD,KAAK;gBACvCE,MAAM,EAAES,WAAW,CAACF,OAAO,CAACR,MAAM,CAACC;cACvC;YACJ,CAAC,CAAC;UACN;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOC,YAAY,CAACS,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHtB,KAAK;IACLK;EACJ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","CxxUnistylesEventTypes","unistylesEvents","Unistyles","useUnistyles","plugins","setPlugins","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload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ACf,SAAS,CAAC,CAAC;UAC9E;QACA,KAAKZ,sBAAsB,CAAC4B,MAAM;UAAE;YAChC,MAAMC,WAAW,GAAGN,KAAmC;YAEvD,OAAOT,SAAS,CAAC;cACbC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACZ,UAAU;cAC1CC,WAAW,EAAEa,WAAW,CAACF,OAAO,CAACX,WAAW;cAC5CC,UAAU,EAAE;gBACRC,KAAK,EAAEW,WAAW,CAACF,OAAO,CAACR,MAAM,CAACD,KAAK;gBACvCE,MAAM,EAAES,WAAW,CAACF,OAAO,CAACR,MAAM,CAACC;cACvC;YACJ,CAAC,CAAC;UACN;QACA,KAAKpB,sBAAsB,CAAC8B,MAAM;UAAE;YAChC,OAAOzB,UAAU,CAACN,SAAS,CAACO,OAAO,CAACC,cAAc,CAAC;UACvD;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOc,YAAY,CAACU,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH3B,OAAO;IACPI,KAAK;IACLK;EACJ,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","mq","useInitialTheme","ScreenOrientation","useStyles","createStyleSheet","UnistylesRegistry","addThemes","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,SAAS;AAEzC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,iBAAiB,GAAG;EACtBC,SAAS,EAAEP,SAAS,CAACQ,QAAQ,CAACD,SAAS;EACvCE,cAAc,EAAET,SAAS,CAACQ,QAAQ,CAACC,cAAc;EACjDC,SAAS,EAAEV,SAAS,CAACQ,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAGX,SAAS,CAACY,OAAO;AAE1C,SACIX,EAAE,EACFG,SAAS,EACTF,eAAe,EACfG,gBAAgB,EAChBF,iBAAiB,EACjBG,iBAAiB,EACjBK,gBAAgB"}
1
+ {"version":3,"names":["unistyles","mq","useInitialTheme","ScreenOrientation","useStyles","createStyleSheet","UnistylesRegistry","addThemes","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,SAAS;AAGzC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAMC,iBAAiB,GAAG;EACtBC,SAAS,EAAEP,SAAS,CAACQ,QAAQ,CAACD,SAAS;EACvCE,cAAc,EAAET,SAAS,CAACQ,QAAQ,CAACC,cAAc;EACjDC,SAAS,EAAEV,SAAS,CAACQ,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAGX,SAAS,CAACY,OAAO;AAE1C,SACIX,EAAE,EACFG,SAAS,EACTF,eAAe,EACfG,gBAAgB,EAChBF,iBAAiB,EACjBG,iBAAiB,EACjBK,gBAAgB"}
@@ -0,0 +1,4 @@
1
+ export { normalizeWebStylesPlugin } from './normalizeWebStylesPlugin';
2
+ export { preprocessor, normalizeNumericValue, normalizeColor, normalizeStyle } from './normalizer';
3
+ export { withPlugins } from './withPlugins';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeWebStylesPlugin","preprocessor","normalizeNumericValue","normalizeColor","normalizeStyle","withPlugins"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,YAAY,EAAEC,qBAAqB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,cAAc;AAClG,SAASC,WAAW,QAAQ,eAAe"}
@@ -0,0 +1,6 @@
1
+ import { normalizeStyle } from './normalizer';
2
+ export const normalizeWebStylesPlugin = {
3
+ name: '__unistylesNormalizeWebStyles',
4
+ onParsedStyle: (_key, styles) => normalizeStyle(styles)
5
+ };
6
+ //# sourceMappingURL=normalizeWebStylesPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeStyle","normalizeWebStylesPlugin","name","onParsedStyle","_key","styles"],"sourceRoot":"../../../src","sources":["plugins/normalizeWebStylesPlugin.ts"],"mappings":"AACA,SAASA,cAAc,QAAQ,cAAc;AAE7C,OAAO,MAAMC,wBAAyC,GAAG;EACrDC,IAAI,EAAE,+BAA+B;EACrCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,KAAKL,cAAc,CAACK,MAAM;AAC1D,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { normalizeStyle } from './normalizeStyle';
2
+ export { preprocessor, normalizeNumericValue, normalizeColor } from './normalizer';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeStyle","preprocessor","normalizeNumericValue","normalizeColor"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/index.ts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,kBAAkB;AACjD,SAASC,YAAY,EAAEC,qBAAqB,EAAEC,cAAc,QAAQ,cAAc"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["plugins/normalizer/module.d.ts"],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { warn } from './common';
2
1
  import { preprocessor } from './normalizer';
2
+ import { warn } from '../../common';
3
3
  const normalizeBoxShadow = style => {
4
4
  const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
5
5
  if (!requiredBoxShadowProperties.every(prop => prop in style)) {
@@ -36,7 +36,7 @@ const normalizeTextShadow = style => {
36
36
  textShadowRadius: undefined
37
37
  };
38
38
  };
39
- export const normalizeStyles = style => {
39
+ export const normalizeStyle = style => {
40
40
  const normalizedTransform = 'transform' in style && Array.isArray(style.transform) ? {
41
41
  transform: preprocessor.createTransformValue(style.transform)
42
42
  } : {};
@@ -49,4 +49,4 @@ export const normalizeStyles = style => {
49
49
  ...normalizedTextShadow
50
50
  };
51
51
  };
52
- //# sourceMappingURL=normalizeStyles.web.js.map
52
+ //# sourceMappingURL=normalizeStyle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["preprocessor","warn","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyle","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/normalizeStyle.ts"],"mappings":"AAAA,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,IAAI,QAAQ,cAAc;AAGnC,MAAMC,kBAAkB,GAAyBC,KAAQ,IAA0B;EAC/E,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC3DF,IAAI,CAAE,wEAAuEG,2BAA2B,CAACG,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW,EAAEC,SAAS;MACtBC,YAAY,EAAED,SAAS;MACvBE,aAAa,EAAEF,SAAS;MACxBG,YAAY,EAAEH;IAClB,CAAC;EACL;EAEA,OAAO;IACHI,SAAS,EAAEb,YAAY,CAACc,oBAAoB,CAACX,KAAK,CAAC;IACnDK,WAAW,EAAEC,SA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AmB,CAACZ,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGoB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeColors","normalizeColor","color","opacity","arguments","length","undefined","integer","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","normalizeNumericValue","value","normalizeTransform","key","includes","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","createBoxShadowValue","shadowColor","shadowOffset","shadowOpacity","shadowRadius","createTransformValue","transforms","transform","Object","keys","join","Boolean","preprocessor"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/normalizer.ts"],"mappings":"AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAS5D,OAAO,MAAMC,cAAc,GAAG,SAAAA,CAACC,KAAa,EAA0B;EAAA,IAAxBC,OAAe,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC7D;EACA,IAAID,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EAEA,MAAMK,OAAO,GAAGP,eAAe,CAACE,KAAK,CAAkB;;EAEvD;EACA,IAAIK,OAAO,KAAK,IAAI,EAAE;IAClB,OAAOL,KAAK;EAChB;EAEA,MAAMM,GAAG,GAAGD,OAAO,CAACE,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAEjD,IAAIF,GAAG,CAACH,MAAM,KAAK,CAAC,EAAE;IAClB,MAAM,CAACM,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,CAAC,GAAGN,GAAG,CACnCO,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC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,GAAGV,qBAAqB,CAACiB,YAAY,CAACN,KAAK,CAAC;EACzD,MAAMC,OAAO,GAAGZ,qBAAqB,CAACiB,YAAY,CAACJ,MAAM,CAAC;EAC1D,MAAMC,MAAM,GAAGd,qBAAqB,CAACmB,YAAY,CAAC;EAClD,MAAMvC,KAAK,GAAGD,cAAc,CAACqC,WAAW,EAAYE,aAAuB,CAAC;EAE5E,OAAQ,GAAER,OAAQ,IAAGE,OAAQ,IAAGE,MAAO,IAAGlC,KAAM,EAAC;AACrD,CAAC;AAED,MAAMwC,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,CAC9D3B,GAAG,CAAC4B,SAAS,IAAI;EACd,MAAM,CAACnB,GAAG,CAAC,GAAGoB,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACnB,GAAG,EAAE;IACN,OAAOnB,SAAS;EACpB;EAEA,MAAMiB,KAAK,GAAGqB,SAAS,CAACnB,GAAG,CAA2B;EAEtD,QAAOA,GAAG;IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAQ,GAAEA,GAAI,IAAIF,KAAK,CAAmBwB,IAAI,CAAC,GAAG,CAAE,GAAE;IAC1D;MACI,OAAQ,GAAEtB,GAAI,IAAGD,kBAAkB,CAACC,GAAG,EAAEF,KAAK,CAAE,GAAE;EAC1D;AACJ,CAAC,CAAC,CACDJ,MAAM,CAAC6B,OAAO,CAAC,CACfD,IAAI,CAAC,GAAG,CAAC;AAEd,OAAO,MAAME,YAA0B,GAAG;EACtCtB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { normalizeWebStylesPlugin } from './normalizeWebStylesPlugin';
2
+ import { isWeb } from '../common';
3
+ import { unistyles } from '../core';
4
+ const UNISTYLES_PLUGINS = isWeb ? [normalizeWebStylesPlugin] : [];
5
+ export const withPlugins = (key, style) => unistyles.registry.plugins.concat(UNISTYLES_PLUGINS).reduce((acc, plugin) => {
6
+ if (plugin.onParsedStyle) {
7
+ return plugin.onParsedStyle(key, acc, unistyles.runtime);
8
+ }
9
+ return acc;
10
+ }, style);
11
+ //# sourceMappingURL=withPlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeWebStylesPlugin","isWeb","unistyles","UNISTYLES_PLUGINS","withPlugins","key","style","registry","plugins","concat","reduce","acc","plugin","onParsedStyle","runtime"],"sourceRoot":"../../../src","sources":["plugins/withPlugins.ts"],"mappings":"AACA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,KAAK,QAAQ,WAAW;AACjC,SAASC,SAAS,QAAQ,SAAS;AAEnC,MAAMC,iBAAiB,GAAGF,KAAK,GACzB,CAACD,wBAAwB,CAAC,GAC1B,EAAE;AAER,OAAO,MAAMI,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAc,KAAKJ,SAAS,CAACK,QAAQ,CAACC,OAAO,CAACC,MAAM,CAACN,iBAAiB,CAAC,CAC3GO,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACrB,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACR,GAAG,EAAEM,GAAG,EAAET,SAAS,CAACY,OAAO,CAAC;EAC5D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEL,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/plugin.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=variants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/variants.ts"],"mappings":""}
@@ -5,7 +5,8 @@ import { useUnistyles } from './hooks';
5
5
  export const useStyles = (stylesheet, variant) => {
6
6
  const {
7
7
  theme,
8
- layout
8
+ layout,
9
+ plugins
9
10
  } = useUnistyles();
10
11
  const {
11
12
  screenSize,
@@ -25,14 +26,14 @@ export const useStyles = (stylesheet, variant) => {
25
26
  if (typeof value === 'function') {
26
27
  return {
27
28
  ...acc,
28
- [key]: proxifyFunction(value, breakpoint, screenSize, variant)
29
+ [key]: proxifyFunction(key, value, breakpoint, screenSize, variant)
29
30
  };
30
31
  }
31
32
  return StyleSheet.create({
32
33
  ...acc,
33
- [key]: parseStyle(style, breakpoint, screenSize, variant)
34
+ [key]: parseStyle(key, style, breakpoint, screenSize, variant)
34
35
  });
35
- }, {}), [breakpoint, screenSize, parsedStyles, variant]);
36
+ }, {}), [breakpoint, screenSize, parsedStyles, variant, plugins]);
36
37
  return {
37
38
  theme,
38
39
  breakpoint,
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","variant","theme","layout","screenSize","breakpoint","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAErD,SAASC,YAAY,QAAQ,SAAS;AAStC,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAyD,EACzDC,OAAgB,KACO;EACvB,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGL,YAAY,CAAC,CAAC;EACxC,MAAM;IAAEM,UAAU;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAEzC,IAAI,CAACH,UAAU,EAAE;IACb,OAAO;MACHE,KAAK;MACLG,UAAU;MACVC,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGb,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,CAAC,CAAC;EAEtC,MAAMQ,iBAAiB,GAAGd,OAAO,CAAC,MAAMe,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGjB,eAAe,CAACkB,KAAK,EAAEV,UAAU,EAAED,UAAU,EAAEH,OAAO;MACjE,CAAC;IACL;IAEA,OAAON,UAAU,CAACsB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGlB,UAAU,CAAKoB,KAAK,EAAEX,UAAU,EAAED,UAAU,EAAEH,OAAO;IAChE,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACI,UAAU,EAAED,UAAU,EAAEG,YAAY,EAAEN,OAAO,CAAC,CAA8B;EAE/F,OAAO;IACHC,KAAK;IACLG,UAAU;IACVC,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","variant","theme","layout","plugins","screenSize","breakpoint","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAQrD,SAASC,YAAY,QAAQ,SAAS;AAStC,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAyD,EACzDC,OAAyD,KAClC;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGN,YAAY,CAAC,CAAC;EACjD,MAAM;IAAEO,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAEzC,IAAI,CAACH,UAAU,EAAE;IACb,OAAO;MACHE,KAAK;MACLI,UAAU;MACVC,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGd,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,CAAC,CAAC;EAEtC,MAAMS,iBAAiB,GAAGf,OAAO,CAAC,MAAMgB,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGlB,eAAe,CAACkB,GAAG,EAAEC,KAAK,EAAEV,UAAU,EAAED,UAAU,EAAEJ,OAAO;MACtE,CAAC;IACL;IAEA,OAAON,UAAU,CAACuB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGnB,UAAU,CAAKmB,GAAG,EAAEE,KAAK,EAAEX,UAAU,EAAED,UAAU,EAAEJ,OAAO;IACrE,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACK,UAAU,EAAED,UAAU,EAAEG,YAAY,EAAEP,OAAO,EAAEG,OAAO,CAAC,CAA8B;EAExG,OAAO;IACHF,KAAK;IACLI,UAAU;IACVC,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
@@ -1,88 +1,35 @@
1
1
  import { unistyles } from '../core';
2
- import { isMobile, Orientation, throwError } from './common';
3
- import { ScreenOrientation } from '../common';
2
+ import { ScreenOrientation, isMobile } from '../common';
4
3
  import { getKeyForUnistylesMediaQuery } from './mqParser';
5
- import { getKeyForVariant } from './variants';
6
- export const sortAndValidateBreakpoints = breakpoints => {
7
- const sortedPairs = Object.entries(breakpoints).sort((breakpoint1, breakpoint2) => {
8
- const [, value1] = breakpoint1;
9
- const [, value2] = breakpoint2;
10
- return value1 - value2;
11
- });
12
- const sortedBreakpoints = Object.freeze(Object.fromEntries(sortedPairs));
13
- const breakpointValues = Object.values(sortedBreakpoints);
14
- const [firstBreakpoint] = breakpointValues;
15
- if (firstBreakpoint !== 0) {
16
- throwError('first breakpoint must start with 0');
17
- }
18
- if (breakpointValues.length !== new Set(breakpointValues).size) {
19
- throwError('breakpoint values are duplicated');
20
- }
21
- return sortedBreakpoints;
22
- };
23
- export const getBreakpointFromScreenWidth = (width, breakpointEntries) => {
24
- const [key] = breakpointEntries.find((_ref, index, otherBreakpoints) => {
25
- let [, value] = _ref;
26
- const minVal = value;
27
- const maxVal = otherBreakpoints[index + 1]?.[1];
28
- if (!maxVal) {
29
- return true;
30
- }
31
- return width >= minVal && width < maxVal;
32
- });
33
- return key;
34
- };
35
-
36
- // todo move it to different file
37
- export const getValueForNestedStyle = (value, variant) => {
38
- // the highest priority is for variants
39
- const variantKey = getKeyForVariant(value, variant);
40
- if (variantKey) {
41
- return value.variants[variantKey];
42
- }
43
-
44
- // then custom media queries
4
+ export const getValueForBreakpoint = value => {
45
5
  const customMediaQueryKey = getKeyForUnistylesMediaQuery(Object.entries(value), unistyles.runtime.screen);
46
6
  if (customMediaQueryKey) {
47
7
  return value[customMediaQueryKey];
48
8
  }
49
-
50
- // at this point user didn't use custom media queries (:w, :h)
51
- // check if user defined any breakpoints
52
- const hasBreakpoints = unistyles.runtime.sortedBreakpoints.length > 0;
53
-
54
- // if not then we can fall back to horizontal and portrait (mobile only)
55
- if (!hasBreakpoints && isMobile && (Orientation.Landscape in value || Orientation.Portrait in value)) {
56
- return value[unistyles.runtime.orientation === ScreenOrientation.Portrait ? Orientation.Portrait : Orientation.Landscape];
9
+ const hasBreakpoints = unistyles.registry.sortedBreakpointPairs.length > 0;
10
+ if (!hasBreakpoints && isMobile && (ScreenOrientation.Landscape in value || ScreenOrientation.Portrait in value)) {
11
+ return value[unistyles.runtime.orientation];
57
12
  }
58
-
59
- // let's get the current breakpoint
60
13
  const breakpoint = unistyles.runtime.breakpoint;
61
14
  if (!breakpoint) {
62
15
  return undefined;
63
16
  }
64
-
65
- // if user defined breakpoints, then we look for the valid one
66
17
  const directBreakpoint = value[breakpoint];
67
-
68
- // if there is a direct key like 'sm' or 'md', or value for this key exists but its undefined
69
18
  if (directBreakpoint || breakpoint in value) {
70
19
  return directBreakpoint;
71
20
  }
72
-
73
- // there is no direct hit for breakpoint nor media-query, let's simulate CSS cascading
74
- const breakpointPairs = unistyles.runtime.sortedBreakpoints;
75
- const currentBreakpoint = breakpointPairs.findIndex(_ref2 => {
76
- let [key] = _ref2;
21
+ const breakpointPairs = unistyles.registry.sortedBreakpointPairs;
22
+ const currentBreakpointIndex = breakpointPairs.findIndex(_ref => {
23
+ let [key] = _ref;
77
24
  return key === breakpoint;
78
25
  });
79
- const availableBreakpoints = breakpointPairs.filter((_ref3, index) => {
26
+ const availableBreakpoints = breakpointPairs.filter((_ref2, index) => {
27
+ let [key] = _ref2;
28
+ return index < currentBreakpointIndex && key in value;
29
+ }).map(_ref3 => {
80
30
  let [key] = _ref3;
81
- return index < currentBreakpoint && key && key in value;
82
- }).map(_ref4 => {
83
- let [key] = _ref4;
84
31
  return key;
85
32
  });
86
- return breakpointPairs.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;
33
+ return value[availableBreakpoints[availableBreakpoints.length - 1]];
87
34
  };
88
35
  //# sourceMappingURL=breakpoints.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","isMobile","Orientation","throwError","ScreenOrientation","getKeyForUnistylesMediaQuery","getKeyForVariant","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForNestedStyle","variant","variantKey","variants","customMediaQueryKey","runtime","screen","hasBreakpoints","Landscape","Portrait","orientation","breakpoint","undefined","directBreakpoint","breakpointPairs","currentBreakpoint","findIndex","_ref2","availableBreakpoints","filter","_ref3","map","_ref4"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,SAAS;AACnC,SAASC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ,UAAU;AAG5D,SAASC,iBAAiB,QAAQ,WAAW;AAC7C,SAASC,4BAA4B,QAAQ,YAAY;AACzD,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAO,MAAMC,0BAA0B,GAAIC,WAAiC,IAA2B;EACnG,MAAMC,WAAW,GAAGC,MAAM,CACrBC,OAAO,CAACH,WAAW,CAAC,CACpBI,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;IAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;IAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;IAE9B,OAAQC,MAAM,GAAeC,MAAiB;EAClD,CAAC,CAAC;EAEN,MAAMC,iBAAiB,GAAIP,MAAM,CAACQ,MAAM,CAACR,MAAM,CAACS,WAAW,CAACV,WAAW,CAAC,CAAyB;EACjG,MAAMW,gBAAgB,GAAGV,MAAM,CAACW,MAAM,CAACJ,iBAAiB,CAAC;EACzD,MAAM,CAACK,eAAe,CAAC,GAAGF,gBAAgB;EAE1C,IAAIE,eAAe,KAAK,CAAC,EAAE;IACvBnB,UAAU,CAAC,oCAAoC,CAAC;EACpD;EAEA,IAAIiB,gBAAgB,CAACG,MAAM,KAAK,IAAIC,GAAG,CAACJ,gBAAgB,CAAC,CAACK,IA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isMobile","getKeyForUnistylesMediaQuery","getValueForBreakpoint","value","customMediaQueryKey","Object","entries","runtime","screen","hasBreakpoints","registry","sortedBreakpointPairs","length","Landscape","Portrait","orientation","breakpoint","undefined","directBreakpoint","breakpointPairs","currentBreakpointIndex","findIndex","_ref","key","availableBreakpoints","filter","_ref2","index","map","_ref3"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,SAAS;AAGnC,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,WAAW;AACvD,SAASC,4BAA4B,QAAQ,YAAY;AAEzD,OAAO,MAAMC,qBAAqB,GAAIC,KAAkB,IAAwB;EAC5E,MAAMC,mBAAmB,GAAGH,4BAA4B,CACpDI,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC,EACrBL,SAAS,CAACS,OAAO,CAACC,MACtB,CAAuB;EAEvB,IAAIJ,mBAAmB,EAAE;IACrB,OAAOD,KAAK,CAACC,mBAAmB,CAAC;EACrC;EAEA,MAAMK,cAAc,GAAGX,SAAS,CAACY,QAAQ,CAACC,qBAAqB,CAACC,MAAM,GAAG,CAAC;EAE1E,IAAI,CAACH,cAAc,IAAIT,QAAQ,KAAKD,iBAAiB,CAACc,SAAS,IAAIV,KAAK,IAAIJ,iBAAiB,CAACe,QAAQ,IAAIX,KAAK,CAAC,EAAE;IAC9G,OAAOA,KAAK,CAACL,SAAS,CAACS,OAAO,CAACQ,WAAW,CAAC;EAC/C;EAEA,MAAMC,UAAU,GAAGlB,SAAS,CAACS,OAAO,CAACS,UAAU;EAE/C,IAAI,CAACA,UAAU,EAAE;IACb,OAAOC,SAAS;EACpB;EAEA,MAAMC,gBAAgB,GAAGf,KAAK,CAACa,UAAU,CAAC;EAE1C,IAAIE,gBAAgB,IAAKF,UAAU,IAAIb,KAAM,EAAE;IAC3C,OAAOe,gBAAgB;EAC3B;EAEA,MAAMC,eAAe,GAAGrB,SAAS,CAACY,QAAQ,CAACC,qBAAqB;EAChE,MAAMS,sBAAsB,GAAGD,eAAe,CACzCE,SAAS,CAACC,IAAA;IAAA,IAAC,CAACC,GAAG,CAAC,GAAAD,IAAA;IAAA,OAAKC,GAAG,KAAKP,UAAU;EAAA,EAAC;EAE7C,MAAMQ,oBAAoB,GAAGL,eAAe,CACvCM,MAAM,CAAC,CAAAC,KAAA,EAAQC,KAAK;IAAA,IAAZ,CAACJ,GAAG,CAAC,GAAAG,KAAA;IAAA,OAAYC,KAAK,GAAGP,sBAAsB,IAAIG,GAAG,IAAIpB,KAAK;EAAA,EAAC,CACxEyB,GAAG,CAACC,KAAA;IAAA,IAAC,CAACN,GAAG,CAAC,GAAAM,KAAA;IAAA,OAAKN,GAAG;EAAA,EAAC;EAExB,OAAOpB,KAAK,CAACqB,oBAAoB,CAACA,oBAAoB,CAACZ,MAAM,GAAG,CAAC,CAAC,CAAwC;AAC9G,CAAC"}
@@ -1,9 +1,6 @@
1
- export { normalizeStyles } from './normalizeStyles';
2
- export * from './normalizer';
3
1
  export { mq, MQSymbol } from './mq';
4
2
  export { getKeyForVariant } from './variants';
5
- export { getKeyForUnistylesMediaQuery } from './mqParser';
6
- export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForNestedStyle } from './breakpoints';
3
+ export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq } from './mqParser';
4
+ export { getValueForBreakpoint } from './breakpoints';
7
5
  export { proxifyFunction, parseStyle } from './styles';
8
- export { isServer, Orientation } from './common';
9
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeStyles","mq","MQSymbol","getKeyForVariant","getKeyForUnistylesMediaQuery","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForNestedStyle","proxifyFunction","parseStyle","isServer","Orientation"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,cAAc,cAAc;AAC5B,SAASC,EAAE,EAAEC,QAAQ,QAAQ,MAAM;AACnC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,4BAA4B,QAAQ,YAAY;AACzD,SAASC,4BAA4B,EAAEC,0BAA0B,EAAEC,sBAAsB,QAAQ,eAAe;AAChH,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SAASC,QAAQ,EAAEC,WAAW,QAAQ,UAAU"}
1
+ {"version":3,"names":["mq","MQSymbol","getKeyForVariant","getKeyForUnistylesMediaQuery","isWithinTheWidthAndHeight","isValidMq","parseMq","getValueForBreakpoint","proxifyFunction","parseStyle"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,EAAE,EAAEC,QAAQ,QAAQ,MAAM;AACnC,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,4BAA4B,EAAEC,yBAAyB,EAAEC,SAAS,EAAEC,OAAO,QAAQ,YAAY;AACxG,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU"}
@@ -57,7 +57,7 @@ const heightHandler = function () {
57
57
  let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
58
58
  return new Proxy({}, {
59
59
  get: (target, prop, receiver) => {
60
- if (prop === Symbol.toPrimitive || MQProp.toString) {
60
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
61
61
  return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
62
62
  }
63
63
  return Reflect.get(target, prop, receiver);
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","MQSymbol","Symbol","MQProp","getMQValue","value","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","shortW","wMin","wMax","Reflect","heightHandler","height","shortH","mq"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":"AAEA,SAASA,SAAS,QAAQ,SAAS;AA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OAAOkB,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;EAC9C;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["unistyles","MQSymbol","Symbol","MQProp","getMQValue","value","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","shortW","wMin","wMax","Reflect","heightHandler","height","shortH","mq"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":"AAEA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,QAAQ,GAAGC,MAAM,CAAC,cAAc,CAAC;AAAA,IAyBzCC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,EAANA,MAAM;AAQX,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,CAAC;EACZ;EAEA,OAAOL,SAAS,CAACM,QAAQ,CAACC,WAAW,CAACF,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;AAED,MAAMG,YAAY,GAAG,SAAAA,CAAA;EAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;EAAA,OAAK,IAAIC,KAAK,CAAgB,CAAC,CAAC,EAAmB;IAC1HC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;MAC7B,IAAID,IAAI,KAAKhB,MAAM,CAACkB,WAAW,IAAIF,IAAI,KAAKf,MAAM,CAACkB,QAA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,EAAE,GAAG,IAAIf,KAAK,CAAC,CAAC,CAAC,EAAe;EACzCC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;IAC7B,IAAID,IAAI,KAAKf,MAAM,CAACoB,MAAM,IAAIL,IAAI,KAAKf,MAAM,CAACmB,KAAK,EAAE;MACjD,OAAOK,aAAa;IACxB;IAEA,IAAIT,IAAI,KAAKf,MAAM,CAAC0B,MAAM,IAAIX,IAAI,KAAKf,MAAM,CAACyB,MAAM,EAAE;MAClD,OAAOpB,YAAY;IACvB;IAEA,OAAOkB,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;EAC9C;AACJ,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
2
2
  const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
3
3
  const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
4
- const parseMq = mq => {
4
+ export const parseMq = mq => {
5
5
  const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
6
6
  const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
7
7
  return {
@@ -16,7 +16,7 @@ const parseMq = mq => {
16
16
  };
17
17
  };
18
18
  const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
19
- const isValidMq = parsedMq => {
19
+ export const isValidMq = parsedMq => {
20
20
  const {
21
21
  width,
22
22
  height
@@ -32,7 +32,7 @@ const isValidMq = parsedMq => {
32
32
  }
33
33
  return false;
34
34
  };
35
- const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
35
+ export const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
36
36
  const {
37
37
  width,
38
38
  height
@@ -1 +1 @@
1
- {"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CAACP,KAAK,CAAC;MACnBQ,EAAE,EAAED,MAAM,CAACN,GAAG;IAClB,CAAC,GAAGQ,SAAS;IACbN,MAAM,EAAEA,MAAM,GAAG;MACbG,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;MACnBI,EAAE,EAAED,MAAM,CAACF,GAAG;IAClB,CAAC,GAAGI;EACR,CAAC;AACL,CAAC;AAED,MAAMC,aAAa,GAAIZ,EAAU,IAAKJ,kBAAkB,CAACiB,IAAI,CAACb,EAAE,CAAC;AAEjE,MAAMc,SAAS,GAAIC,QAA2B,IAAK;EAC/C,MAAM;IAAEd,KAAK;IAAEI;EAAO,CAAC,GAAGU,QAAQ;EAElC,IAAId,KAAK,IAAII,MAAM,EAAE;IACjB,OAAOJ,KAAK,CAACO,IAAI,IAAIP,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C,YAA8B,EAAEN,UAAsB,KAAK;EACpG,MAAMjB,EAAE,GAAGuB,YAAY,CAACC,IAAI,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IAC/B,IAAI,CAACb,aAAa,CAACc,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMX,QAAQ,GAAGhB,OAAO,CAAC2B,GAAa,CAAC;IAEvC,IAAI,CAACZ,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOjB,EAAE,EAAE2B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
1
+ {"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,OAAO,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EACtD,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,I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iBAAiB,CAACd,MAAM,EAAEY,UAAU,CAACZ,MAAM,CAAC;EACvD;EAEA,OAAO,KAAK;AAChB,CAAC;AAED,MAAMa,gBAAgB,GAAGA,CAACjB,KAAiC,EAAEmB,WAAmB,KAAc;EAC1F,MAAM;IAAEZ,IAAI;IAAEE;EAAG,CAAC,GAAGT,KAA0B;EAE/C,OAAOmB,WAAW,IAAIZ,IAAI,IAAIY,WAAW,IAAIV,EAAE;AACnD,CAAC;AAED,MAAMS,iBAAiB,GAAGA,CAACd,MAAmC,EAAEgB,YAAoB,KAAc;EAC9F,MAAM;IAAEb,IAAI;IAAEE;EAAG,CAAC,GAAGL,MAA2B;EAEhD,OAAOgB,YAAY,IAAIb,IAAI,IAAIa,YAAY,IAAIX,EAAE;AACrD,CAAC;AAED,OAAO,MAAMY,4BAA4B,GAAGA,CAACC,YAA8B,EAAEN,UAAsB,KAAuB;EACtH,MAAMjB,EAAE,GAAGuB,YAAY,CAACC,IAAI,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IAC/B,IAAI,CAACb,aAAa,CAACc,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMX,QAAQ,GAAGhB,OAAO,CAAC2B,GAAa,CAAC;IAEvC,IAAI,CAACZ,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOjB,EAAE,EAAE2B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
@@ -1,8 +1,9 @@
1
- import { getValueForNestedStyle } from './breakpoints';
2
- import { normalizeStyles } from './normalizeStyles';
3
- import { isAndroid, isIOS, isWeb } from './common';
4
- export const proxifyFunction = (fn, breakpoint, screenSize, variant) => new Proxy(fn, {
5
- apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, variant)
1
+ import { getValueForBreakpoint } from './breakpoints';
2
+ import { isAndroid, isIOS } from '../common';
3
+ import { getKeyForVariant } from './variants';
4
+ import { withPlugins } from '../plugins';
5
+ export const proxifyFunction = (key, fn, breakpoint, screenSize, variant) => new Proxy(fn, {
6
+ apply: (target, thisArg, argumentsList) => parseStyle(key, target.apply(thisArg, argumentsList), breakpoint, screenSize, variant)
6
7
  });
7
8
  export const isPlatformColor = value => {
8
9
  if (isIOS) {
@@ -10,25 +11,35 @@ export const isPlatformColor = value => {
10
11
  }
11
12
  return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
12
13
  };
13
- export const parseStyle = (style, breakpoint, screenSize, variant) => {
14
- const entries = Object.entries(style || {});
15
- const parsedStyles = Object.fromEntries(entries.map(_ref => {
14
+ export const parseStyle = (key, style, breakpoint, screenSize, variant) => {
15
+ const entries = Object.entries(style || {}).map(_ref => {
16
16
  let [key, value] = _ref;
17
+ if (key !== 'variants') {
18
+ return [key, value];
19
+ }
20
+ const variantKey = getKeyForVariant(value, variant);
21
+ if (!variantKey) {
22
+ return undefined;
23
+ }
24
+ return Object.entries(value[variantKey]).flat();
25
+ }).filter(Boolean);
26
+ const parsedStyles = Object.fromEntries(entries.map(_ref2 => {
27
+ let [key, value] = _ref2;
17
28
  const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
18
29
  if (hasNestedProperties) {
19
- return [key, parseStyle(value, breakpoint, screenSize, variant)];
30
+ return [key, parseStyle(key, value, breakpoint, screenSize, variant)];
20
31
  }
21
32
  const isTransform = key === 'transform';
22
33
  if (isTransform && Array.isArray(value)) {
23
- return [key, value.map(value => parseStyle(value, breakpoint, screenSize, variant))];
34
+ return [key, value.map(value => parseStyle(key, value, breakpoint, screenSize, variant))];
24
35
  }
25
36
  const isDynamicFunction = typeof value === 'function';
26
37
  const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
27
38
  if (isDynamicFunction || isValidStyle) {
28
39
  return [key, value];
29
40
  }
30
- return [key, getValueForNestedStyle(value, variant)];
41
+ return [key, getValueForBreakpoint(value)];
31
42
  }));
32
- return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
43
+ return withPlugins(key, parsedStyles);
33
44
  };
34
45
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getValueForNestedStyle","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","variant","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,sBAAsB,QAAQ,eAAe;AACtD,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,EACtBC,OAAgB,KACL,IAAIC,KAAK,CAACJ,EAAE,EAAE;EACzBK,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEP,UAAU,EAAEC,UAAU,EAAEC,OAAO;AACxF,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAId,KAAK,EAAE;IACP,OAAO,UAAU,IAAIc,KAAK,IAAI,OAAOA,KAAK,CAACC,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOhB,SAAS,IAAI,gBAAgB,IAAIe,KAAK,IAAI,OAAOA,KAAK,CAACE,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAED,OAAO,MAAMJ,UAAU,GAAGA,CACtBK,KAA2B,EAC3Bb,UAA+C,EAC/CC,UAAsB,EACtBC,OAAgB,KACZ;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,EAA0BV,UAAU,EAAEC,UAAU,EAAEC,OAAO,CAAC,CAC7E;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,EAAEV,UAAU,EAAEC,UAAU,EAAEC,OAAO,CAAC,CAAC,CACzE;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,EACH3B,sBAAsB,CAClBiB,KAAK,EACLR,OACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOL,KAAK,GACNH,eAAe,CAACsB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
1
+ {"version":3,"names":["getValueForBreakpoint","isAndroid","isIOS","getKeyForVariant","withPlugins","proxifyFunction","key","fn","breakpoint","screenSize","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","map","_ref","variantKey","undefined","flat","filter","Boolean","parsedStyles","fromEntries","_ref2","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AAErD,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,WAAW,QAAQ,YAAY;AAExC,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,EACtBC,OAAgB,KACL,IAAIC,KAAK,CAACJ,EAAE,EAAE;EACzBK,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACV,GAAG,EAAEO,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEP,UAAU,EAAEC,UAAU,EAAEC,OAAO;AAC7F,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIhB,KAAK,EAAE;IACP,OAAO,UAAU,IAAIgB,KAAK,IAAI,OAAOA,KAAK,CAACC,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOlB,SAAS,IAAI,gBAAgB,IAAIiB,KAAK,IAAI,OAAOA,KAAK,CAACE,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAED,OAAO,MAAMJ,UAAU,GAAGA,CACtBV,GAAW,EACXe,KAA2B,EAC3Bb,UAA+C,EAC/CC,UAAsB,EACtBC,OAAgB,KACZ;EACJ,MAAMY,OAAO,GAAIC,MAAM,CAClBD,OAAO,CAACD,KAAK,IAAI,CAAC,CAAC,CAAC,CACpBG,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACnB,GAAG,EAAEY,KAAK,CAAC,GAAAO,IAAA;IACd,IAA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IACvB;IAEA,OAAO,CACHZ,GAAG,EACHN,qBAAqB,CAACkB,KAAoB,CAAC,CAC9C;EACL,CAAC,CACL,CAAM;EAEV,OAAOd,WAAW,CAACE,GAAG,EAAEyB,YAAY,CAAC;AACzC,CAAC"}
@@ -1,11 +1,8 @@
1
1
  export const getKeyForVariant = (value, variant) => {
2
- if (!value.variants) {
3
- return undefined;
4
- }
5
- if (variant && variant in value.variants) {
2
+ if (variant && variant in value) {
6
3
  return variant;
7
4
  }
8
- if ('default' in value.variants) {
5
+ if ('default' in value) {
9
6
  return 'default';
10
7
  }
11
8
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"names":["getKeyForVariant","value","variant","variants","undefined"],"sourceRoot":"../../../src","sources":["utils/variants.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAGA,CAACC,KAAkB,EAAEC,OAAgB,KAAmC;EACpG,IAAI,CAACD,KAAK,CAACE,QAAQ,EAAE;IACjB,OAAOC,SAAS;EACpB;EAEA,IAAIF,OAAO,IAAIA,OAAO,IAAID,KAAK,CAACE,QAAQ,EAAE;IACtC,OAAOD,OAAO;EAClB;EAEA,IAAI,SAAS,IAAID,KAAK,CAACE,QAAQ,EAAE;IAC7B,OAAO,SAAS;EACpB;EAEA,OAAOC,SAAS;AACpB,CAAC"}
1
+ {"version":3,"names":["getKeyForVariant","value","variant","undefined"],"sourceRoot":"../../../src","sources":["utils/variants.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAGA,CAACC,KAAkB,EAAEC,OAAgB,KAAuB;EACxF,IAAIA,OAAO,IAAIA,OAAO,IAAID,KAAK,EAAE;IAC7B,OAAOC,OAAO;EAClB;EAEA,IAAI,SAAS,IAAID,KAAK,EAAE;IACpB,OAAO,SAAS;EACpB;EAEA,OAAOE,SAAS;AACpB,CAAC"}