react-native-unistyles 2.0.0-beta.1 → 2.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/android/src/main/java/com/unistyles/UnistylesModule.kt +3 -3
  2. package/ios/UnistylesModule.mm +5 -5
  3. package/lib/commonjs/core/UnistyleRegistry.js +6 -2
  4. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  5. package/lib/commonjs/core/Unistyles.js +1 -1
  6. package/lib/commonjs/core/Unistyles.js.map +1 -1
  7. package/lib/commonjs/core/UnistylesModule.web.js +191 -0
  8. package/lib/commonjs/core/UnistylesModule.web.js.map +1 -0
  9. package/lib/commonjs/core/UnistylesRuntime.js +3 -0
  10. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  11. package/lib/commonjs/hooks/index.js +7 -0
  12. package/lib/commonjs/hooks/index.js.map +1 -1
  13. package/lib/commonjs/hooks/useCSS.js +9 -0
  14. package/lib/commonjs/hooks/useCSS.js.map +1 -0
  15. package/lib/commonjs/hooks/useCSS.web.js +46 -0
  16. package/lib/commonjs/hooks/useCSS.web.js.map +1 -0
  17. package/lib/commonjs/hooks/useUnistyles.js +1 -1
  18. package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
  19. package/lib/commonjs/normalizer/index.js.map +1 -0
  20. package/lib/commonjs/normalizer/module.d.js.map +1 -0
  21. package/lib/commonjs/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
  22. package/lib/commonjs/normalizer/normalizeStyle.js.map +1 -0
  23. package/lib/commonjs/normalizer/normalizer.js.map +1 -0
  24. package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +14 -0
  25. package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +1 -0
  26. package/lib/commonjs/plugins/index.js +3 -21
  27. package/lib/commonjs/plugins/index.js.map +1 -1
  28. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +1 -1
  29. package/lib/commonjs/useStyles.js +4 -1
  30. package/lib/commonjs/useStyles.js.map +1 -1
  31. package/lib/commonjs/utils/cssMediaQuery.js +250 -0
  32. package/lib/commonjs/utils/cssMediaQuery.js.map +1 -0
  33. package/lib/commonjs/utils/generateId.js +15 -0
  34. package/lib/commonjs/utils/generateId.js.map +1 -0
  35. package/lib/commonjs/utils/hash32.js +43 -0
  36. package/lib/commonjs/utils/hash32.js.map +1 -0
  37. package/lib/commonjs/utils/index.js +13 -0
  38. package/lib/commonjs/utils/index.js.map +1 -1
  39. package/lib/commonjs/utils/mqParser.js +2 -1
  40. package/lib/commonjs/utils/mqParser.js.map +1 -1
  41. package/lib/commonjs/utils/styles.js +9 -0
  42. package/lib/commonjs/utils/styles.js.map +1 -1
  43. package/lib/commonjs/utils/withPlugins.js +1 -1
  44. package/lib/commonjs/utils/withPlugins.js.map +1 -1
  45. package/lib/module/core/UnistyleRegistry.js +7 -3
  46. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  47. package/lib/module/core/Unistyles.js +2 -2
  48. package/lib/module/core/Unistyles.js.map +1 -1
  49. package/lib/module/core/UnistylesModule.web.js +184 -0
  50. package/lib/module/core/UnistylesModule.web.js.map +1 -0
  51. package/lib/module/core/UnistylesRuntime.js +3 -0
  52. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  53. package/lib/module/hooks/index.js +1 -0
  54. package/lib/module/hooks/index.js.map +1 -1
  55. package/lib/module/hooks/useCSS.js +2 -0
  56. package/lib/module/hooks/useCSS.js.map +1 -0
  57. package/lib/module/hooks/useCSS.web.js +39 -0
  58. package/lib/module/hooks/useCSS.web.js.map +1 -0
  59. package/lib/module/hooks/useUnistyles.js +1 -1
  60. package/lib/module/hooks/useUnistyles.js.map +1 -1
  61. package/lib/module/normalizer/index.js.map +1 -0
  62. package/lib/module/normalizer/module.d.js.map +1 -0
  63. package/lib/module/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
  64. package/lib/module/normalizer/normalizeStyle.js.map +1 -0
  65. package/lib/module/normalizer/normalizer.js.map +1 -0
  66. package/lib/module/plugins/cssMediaQueriesPlugin.js +7 -0
  67. package/lib/module/plugins/cssMediaQueriesPlugin.js.map +1 -0
  68. package/lib/module/plugins/index.js +1 -1
  69. package/lib/module/plugins/index.js.map +1 -1
  70. package/lib/module/plugins/normalizeWebStylesPlugin.js +1 -1
  71. package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -1
  72. package/lib/module/useStyles.js +5 -2
  73. package/lib/module/useStyles.js.map +1 -1
  74. package/lib/module/utils/cssMediaQuery.js +243 -0
  75. package/lib/module/utils/cssMediaQuery.js.map +1 -0
  76. package/lib/module/utils/generateId.js +7 -0
  77. package/lib/module/utils/generateId.js.map +1 -0
  78. package/lib/module/utils/hash32.js +36 -0
  79. package/lib/module/utils/hash32.js.map +1 -0
  80. package/lib/module/utils/index.js +2 -1
  81. package/lib/module/utils/index.js.map +1 -1
  82. package/lib/module/utils/mqParser.js +1 -1
  83. package/lib/module/utils/mqParser.js.map +1 -1
  84. package/lib/module/utils/styles.js +9 -0
  85. package/lib/module/utils/styles.js.map +1 -1
  86. package/lib/module/utils/withPlugins.js +1 -1
  87. package/lib/module/utils/withPlugins.js.map +1 -1
  88. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  89. package/lib/typescript/src/core/UnistylesModule.web.d.ts +19 -0
  90. package/lib/typescript/src/core/UnistylesModule.web.d.ts.map +1 -0
  91. package/lib/typescript/src/core/UnistylesRuntime.d.ts +1 -0
  92. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  93. package/lib/typescript/src/hooks/index.d.ts +1 -0
  94. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  95. package/lib/typescript/src/hooks/useCSS.d.ts +3 -0
  96. package/lib/typescript/src/hooks/useCSS.d.ts.map +1 -0
  97. package/lib/typescript/src/hooks/useCSS.web.d.ts +3 -0
  98. package/lib/typescript/src/hooks/useCSS.web.d.ts.map +1 -0
  99. package/lib/typescript/src/normalizer/index.d.ts.map +1 -0
  100. package/lib/typescript/src/normalizer/normalizeStyle.d.ts +3 -0
  101. package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +1 -0
  102. package/lib/typescript/src/{plugins/normalizer → normalizer}/normalizer.d.ts +1 -1
  103. package/lib/typescript/src/normalizer/normalizer.d.ts.map +1 -0
  104. package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +3 -0
  105. package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +1 -0
  106. package/lib/typescript/src/plugins/index.d.ts +1 -1
  107. package/lib/typescript/src/plugins/index.d.ts.map +1 -1
  108. package/lib/typescript/src/types/unistyles.d.ts +2 -1
  109. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  110. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  111. package/lib/typescript/src/utils/cssMediaQuery.d.ts +4 -0
  112. package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +1 -0
  113. package/lib/typescript/src/utils/generateId.d.ts +2 -0
  114. package/lib/typescript/src/utils/generateId.d.ts.map +1 -0
  115. package/lib/typescript/src/utils/hash32.d.ts +2 -0
  116. package/lib/typescript/src/utils/hash32.d.ts.map +1 -0
  117. package/lib/typescript/src/utils/index.d.ts +3 -1
  118. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  119. package/lib/typescript/src/utils/mqParser.d.ts +2 -1
  120. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
  121. package/lib/typescript/src/utils/styles.d.ts +1 -1
  122. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  123. package/package.json +3 -2
  124. package/src/core/UnistyleRegistry.ts +8 -3
  125. package/src/core/Unistyles.ts +2 -2
  126. package/src/core/UnistylesModule.web.ts +218 -0
  127. package/src/core/UnistylesRuntime.ts +4 -0
  128. package/src/hooks/index.ts +1 -0
  129. package/src/hooks/useCSS.ts +3 -0
  130. package/src/hooks/useCSS.web.ts +51 -0
  131. package/src/hooks/useUnistyles.ts +1 -1
  132. package/src/{plugins/normalizer → normalizer}/normalizeStyle.ts +2 -2
  133. package/src/{plugins/normalizer → normalizer}/normalizer.ts +2 -1
  134. package/src/plugins/cssMediaQueriesPlugin.ts +8 -0
  135. package/src/plugins/index.ts +1 -1
  136. package/src/plugins/normalizeWebStylesPlugin.ts +1 -1
  137. package/src/types/unistyles.ts +3 -2
  138. package/src/useStyles.ts +10 -2
  139. package/src/utils/cssMediaQuery.ts +268 -0
  140. package/src/utils/generateId.ts +10 -0
  141. package/src/utils/hash32.ts +53 -0
  142. package/src/utils/index.ts +3 -1
  143. package/src/utils/mqParser.ts +2 -2
  144. package/src/utils/styles.ts +10 -1
  145. package/src/utils/withPlugins.ts +1 -1
  146. package/lib/commonjs/plugins/normalizer/index.js.map +0 -1
  147. package/lib/commonjs/plugins/normalizer/module.d.js.map +0 -1
  148. package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +0 -1
  149. package/lib/commonjs/plugins/normalizer/normalizer.js.map +0 -1
  150. package/lib/module/plugins/normalizer/index.js.map +0 -1
  151. package/lib/module/plugins/normalizer/module.d.js.map +0 -1
  152. package/lib/module/plugins/normalizer/normalizeStyle.js.map +0 -1
  153. package/lib/module/plugins/normalizer/normalizer.js.map +0 -1
  154. package/lib/typescript/src/plugins/normalizer/index.d.ts.map +0 -1
  155. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +0 -3
  156. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +0 -1
  157. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +0 -1
  158. /package/lib/commonjs/{plugins/normalizer → normalizer}/index.js +0 -0
  159. /package/lib/commonjs/{plugins/normalizer → normalizer}/module.d.js +0 -0
  160. /package/lib/commonjs/{plugins/normalizer → normalizer}/normalizer.js +0 -0
  161. /package/lib/module/{plugins/normalizer → normalizer}/index.js +0 -0
  162. /package/lib/module/{plugins/normalizer → normalizer}/module.d.js +0 -0
  163. /package/lib/module/{plugins/normalizer → normalizer}/normalizer.js +0 -0
  164. /package/lib/typescript/src/{plugins/normalizer → normalizer}/index.d.ts +0 -0
  165. /package/src/{plugins/normalizer → normalizer}/index.ts +0 -0
  166. /package/src/{plugins/normalizer → normalizer}/module.d.ts +0 -0
@@ -0,0 +1,184 @@
1
+ import { NativeEventEmitter, NativeModules } from 'react-native';
2
+ import { normalizeWebStylesPlugin } from '../plugins';
3
+ export class UnistylesBridgeWeb {
4
+ #timerRef = undefined;
5
+ #hasAdaptiveThemes = false;
6
+ #supportsAutomaticColorScheme = false;
7
+ #screenWidth = window.innerWidth;
8
+ #screenHeight = window.innerHeight;
9
+ #themes = [];
10
+ #breakpoints = {};
11
+ #colorScheme = this.getPreferredColorScheme();
12
+ #themeName = '';
13
+ #enabledPlugins = [normalizeWebStylesPlugin.name];
14
+ #unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
15
+ #sortedBreakpointPairs = [];
16
+ #breakpoint = '';
17
+ constructor() {
18
+ this.setupListeners();
19
+ }
20
+ install() {
21
+ // @ts-ignore
22
+ window.__UNISTYLES__ = new Proxy({}, {
23
+ get: (_target, prop) => {
24
+ switch (prop) {
25
+ case 'themeName':
26
+ return this.getTheme();
27
+ case 'screenWidth':
28
+ return this.#screenWidth;
29
+ case 'screenHeight':
30
+ return this.#screenHeight;
31
+ case 'breakpoint':
32
+ return this.#breakpoint || undefined;
33
+ case 'breakpoints':
34
+ return this.#breakpoints;
35
+ case 'hasAdaptiveThemes':
36
+ return this.#hasAdaptiveThemes;
37
+ case 'sortedBreakpointPairs':
38
+ return this.#sortedBreakpointPairs;
39
+ case 'enabledPlugins':
40
+ return this.#enabledPlugins;
41
+ case 'colorScheme':
42
+ return this.#colorScheme;
43
+ case 'useTheme':
44
+ return themeName => this.useTheme(themeName);
45
+ case 'useBreakpoints':
46
+ return breakpoints => this.useBreakpoints(breakpoints);
47
+ case 'useAdaptiveThemes':
48
+ return enable => this.useAdaptiveThemes(enable);
49
+ case 'addPlugin':
50
+ return (pluginName, notify) => this.addPlugin(pluginName, notify);
51
+ case 'removePlugin':
52
+ return pluginName => this.removePlugin(pluginName);
53
+ default:
54
+ return Reflect.get(this, prop);
55
+ }
56
+ },
57
+ set: (target, prop, newValue, receiver) => {
58
+ switch (prop) {
59
+ case 'themes':
60
+ {
61
+ this.#themes = newValue;
62
+ this.#supportsAutomaticColorScheme = newValue.includes('light') && newValue.includes('dark');
63
+ return true;
64
+ }
65
+ case 'themeName':
66
+ {
67
+ this.#themeName = newValue;
68
+ this.emitThemeChange();
69
+ return true;
70
+ }
71
+ default:
72
+ return Reflect.set(target, prop, newValue, receiver);
73
+ }
74
+ }
75
+ });
76
+ return true;
77
+ }
78
+ useTheme(themeName) {
79
+ this.#themeName = themeName;
80
+ this.emitThemeChange();
81
+ }
82
+ useBreakpoints(breakpoints) {
83
+ this.#breakpoints = breakpoints;
84
+ this.#sortedBreakpointPairs = Object.entries(breakpoints).sort((_ref, _ref2) => {
85
+ let [, a] = _ref;
86
+ let [, b] = _ref2;
87
+ return (a ?? 0) - (b ?? 0);
88
+ });
89
+ this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
90
+ }
91
+ useAdaptiveThemes(enable) {
92
+ this.#hasAdaptiveThemes = enable;
93
+ if (!this.#hasAdaptiveThemes || !this.#supportsAutomaticColorScheme) {
94
+ return;
95
+ }
96
+ if (this.#themeName !== this.#colorScheme) {
97
+ this.#themeName = this.#colorScheme;
98
+ this.emitThemeChange();
99
+ }
100
+ }
101
+ addPlugin(pluginName, notify) {
102
+ this.#enabledPlugins = [pluginName].concat(this.#enabledPlugins);
103
+ if (notify) {
104
+ this.emitPluginChange();
105
+ }
106
+ }
107
+ removePlugin(pluginName) {
108
+ this.#enabledPlugins = this.#enabledPlugins.filter(name => name !== pluginName);
109
+ this.emitPluginChange();
110
+ }
111
+ getTheme() {
112
+ if (this.#themes.length === 1) {
113
+ return this.#themes.at(0);
114
+ }
115
+ return this.#themeName;
116
+ }
117
+ setupListeners() {
118
+ window.addEventListener('resize', () => {
119
+ clearTimeout(this.#timerRef);
120
+ this.#timerRef = setTimeout(() => {
121
+ this.#screenWidth = window.innerWidth;
122
+ this.#screenHeight = window.innerHeight;
123
+ this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
124
+ this.emitLayoutChange();
125
+ }, 100);
126
+ });
127
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
128
+ this.#colorScheme = event.matches ? 'dark' : 'light';
129
+ if (!this.#supportsAutomaticColorScheme || !this.#hasAdaptiveThemes) {
130
+ return;
131
+ }
132
+ if (this.#colorScheme !== this.#themeName) {
133
+ this.#themeName = this.#colorScheme;
134
+ this.emitThemeChange();
135
+ }
136
+ });
137
+ }
138
+ getBreakpointFromScreenWidth(width) {
139
+ const breakpoint = this.#sortedBreakpointPairs.find((_ref3, index, otherBreakpoints) => {
140
+ let [, value] = _ref3;
141
+ const minVal = value;
142
+ const maxVal = otherBreakpoints[index + 1]?.[1];
143
+ if (!maxVal) {
144
+ return true;
145
+ }
146
+ return width >= minVal && width < maxVal;
147
+ });
148
+ return breakpoint?.at(0);
149
+ }
150
+ getPreferredColorScheme() {
151
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
152
+ return 'dark';
153
+ }
154
+ return 'light';
155
+ }
156
+ emitPluginChange() {
157
+ this.#unistylesEvents.emit('__unistylesOnChange', {
158
+ type: 'plugin'
159
+ });
160
+ }
161
+ emitThemeChange() {
162
+ this.#unistylesEvents.emit('__unistylesOnChange', {
163
+ type: 'theme',
164
+ payload: {
165
+ themeName: this.#themeName
166
+ }
167
+ });
168
+ }
169
+ emitLayoutChange() {
170
+ this.#unistylesEvents.emit('__unistylesOnChange', {
171
+ type: 'layout',
172
+ payload: {
173
+ breakpoint: this.#breakpoint,
174
+ orientation: this.#screenWidth > this.#screenHeight ? 'landscape' : 'portrait',
175
+ screen: {
176
+ width: this.#screenWidth,
177
+ height: this.#screenHeight
178
+ }
179
+ }
180
+ });
181
+ }
182
+ }
183
+ export const UnistylesModule = new UnistylesBridgeWeb();
184
+ //# sourceMappingURL=UnistylesModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","normalizeWebStylesPlugin","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","name","unistylesEvents","Unistyles","sortedBreakpointPairs","breakpoint","constructor","setupListeners","install","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","_ref","_ref2","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","width","find","_ref3","index","otherBreakpoints","value","minVal","maxVal","emit","type","payload","orientation","screen","height","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.web.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAGhE,SAASC,wBAAwB,QAAQ,YAAY;AAErD,OAAO,MAAMC,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAWC,MAAM,CAACC,UAAU;EACxC,CAACC,YAAY,GAAWF,MAAM,CAACG,WAAW;EAC1C,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAyB,CAAC,CAAC;EACvC,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAAChB,wBAAwB,CAACiB,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIpB,kBAAkB,CAACC,aAAa,CAACoB,SAAS,CAAC;EACl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point() {
17
17
  return this.unistylesBridge.breakpoint;
18
18
  }
19
+ get breakpoints() {
20
+ return this.unistylesRegistry.breakpoints;
21
+ }
19
22
  get enabledPlugins() {
20
23
  return this.unistylesBridge.enabledPlugins;
21
24
  }
@@ -1 +1 @@
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,IAAIA,IAAI,KAAK,IAAI,CAACZ,SAAS,EAAE;MACzB;IACJ;IAEA,IAAI,IAAI,CAACH,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"}
1
+ {"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","breakpoints","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;AA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e,CAACmB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACvB,cAAc,CAACwB,kBAAkB,CAAC;EACtD,CAAC;EAEMC,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAACvB,eAAe,CAACwB,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEME,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAACzB,iBAAiB,CAACwB,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;EAEMC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAACzB,iBAAiB,CAAC0B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL"}
@@ -1,4 +1,5 @@
1
1
  export { useInitialTheme } from './useInitialTheme';
2
2
  export { useUnistyles } from './useUnistyles';
3
3
  export { useVariants } from './useVariants';
4
+ export { useCSS } from './useCSS';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useInitialTheme","useUnistyles","useVariants"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,eAAe"}
1
+ {"version":3,"names":["useInitialTheme","useUnistyles","useVariants","useCSS"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,MAAM,QAAQ,UAAU"}
@@ -0,0 +1,2 @@
1
+ export const useCSS = _stylesheet => {};
2
+ //# sourceMappingURL=useCSS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCSS","_stylesheet"],"sourceRoot":"../../../src","sources":["hooks/useCSS.ts"],"mappings":"AAEA,OAAO,MAAMA,MAAM,GAAOC,WAAqC,IAAW,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { useInsertionEffect, useRef } from 'react';
2
+ import { unistyles } from '../core';
3
+ import { generateReactNativeWebId } from '../utils';
4
+ export const useCSS = stylesheet => {
5
+ const insertedIds = useRef([]);
6
+ useInsertionEffect(() => {
7
+ if (!unistyles.registry.config.experimentalCSSMediaQueries) {
8
+ return;
9
+ }
10
+ Object.entries(stylesheet).forEach(_ref => {
11
+ let [_key, value] = _ref;
12
+ Object.entries(value).forEach(_ref2 => {
13
+ let [prop, val] = _ref2;
14
+ if (!val.toString().includes('@media')) {
15
+ return;
16
+ }
17
+ const id = generateReactNativeWebId(prop, '""');
18
+ if (insertedIds.current.includes(id)) {
19
+ return;
20
+ }
21
+ const style = document.createElement('style');
22
+ style.id = id;
23
+ style.innerHTML = val;
24
+ document.head.appendChild(style);
25
+ insertedIds.current = [...insertedIds.current, id];
26
+ });
27
+ });
28
+ return () => {
29
+ insertedIds.current.forEach(id => {
30
+ const style = document.getElementById(id);
31
+ if (style) {
32
+ style.remove();
33
+ }
34
+ });
35
+ insertedIds.current = [];
36
+ };
37
+ }, [stylesheet]);
38
+ };
39
+ //# sourceMappingURL=useCSS.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useInsertionEffect","useRef","unistyles","generateReactNativeWebId","useCSS","stylesheet","insertedIds","registry","config","experimentalCSSMediaQueries","Object","entries","forEach","_ref","_key","value","_ref2","prop","val","toString","includes","id","current","style","document","createElement","innerHTML","head","appendChild","getElementById","remove"],"sourceRoot":"../../../src","sources":["hooks/useCSS.web.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,SAAS,QAAQ,SAAS;AAEnC,SAASC,wBAAwB,QAAQ,UAAU;AAEnD,OAAO,MAAMC,MAAM,GAAOC,UAAoC,IAAK;EAC/D,MAAMC,WAAW,GAAGL,MAAM,CAAgB,EAAE,CAAC;EAE7CD,kBAAkB,CAAC,M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CAAC;AACpB,CAAC"}
@@ -15,7 +15,7 @@ export const useUnistyles = () => {
15
15
  }
16
16
  });
17
17
  useEffect(() => {
18
- const subscription = unistylesEvents.addListener('onChange', event => {
18
+ const subscription = unistylesEvents.addListener('__unistylesOnChange', event => {
19
19
  switch (event.type) {
20
20
  case UnistylesEventType.Theme:
21
21
  {
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","UnistylesEventType","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","Layout","layoutEvent","Plugin","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,kBAAkB,QAAQ,WAAW;AAG9C,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGP,QAAQ,CAACC,SAAS,CAACO,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGX,QAAQ,CAACC,SAAS,CAACW,QAAQ,CAACC,QAAQ,CAACZ,SAAS,CAACO,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGhB,QAAQ,CAAC;IACjCiB,UAAU,EAAEhB,SAAS,CAACO,OAAO,CAACS,UAAU;IACxCC,WAAW,EAAEjB,SAAS,CAACO,OAAO,CAACU,WAAW;IAC1CC,UAAU,EAAE;MACRC,KAAK,EAAEnB,SAAS,CAACO,OAAO,CAACa,MAAM,CAACD,KAAK;MACrCE,MAAM,EAAErB,SAAS,CAACO,OAAO,CAACa,MAAM,CAACC;IACrC;EACJ,CAAC,CAAC;EAEFvB,SAAS,CAAC,MAAM;IACZ,MAAMwB,YAAY,GAAGpB,eAAe,CAACqB,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKxB,kBAAkB,CAACyB,KAAK;UAAE;YAC3B,MAAMC,UAAU,GAAGH,KAA4B;YAE/C,OAAOd,QAAQ,CAACV,SAAS,CAACW,QAAQ,CAACC,QAAQ,CAACe,UAAU,CAACC,OAAO,CAACf,SAAS,CAAC,CAAC;UAC9E;QACA,KAAKZ,kBAAkB,CAAC4B,MAAM;UAAE;YAC5B,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,EAAEY,WAAW,CAACF,OAAO,CAACR;YACpC,CAAC,CAAC;UACN;QACA,KAAKnB,kBAAkB,CAAC8B,MAAM;UAAE;YAC5B,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
+ {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","unistyles","UnistylesEventType","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","Layout","layoutEvent","Plugin","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AAC;UAC9E;QACA,KAAKZ,kBAAkB,CAAC4B,MAAM;UAAE;YAC5B,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,EAAEY,WAAW,CAACF,OAAO,CAACR;YACpC,CAAC,CAAC;UACN;QACA,KAAKnB,kBAAkB,CAAC8B,MAAM;UAAE;YAC5B,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"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeStyle","preprocessor","normalizeNumericValue","normalizeColor"],"sourceRoot":"../../../src","sources":["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":["normalizer/module.d.ts"],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { preprocessor } from './normalizer';
2
- import { warn } from '../../common';
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)) {
@@ -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":["normalizer/normalizeStyle.ts"],"mappings":"AAAA,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,IAAI,QAAQ,WAAW;AAGhC,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,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMM,mBAAmB,GAA0BZ,KAAQ,IAA2B;EAClF,MAAMa,4BAA4B,GAAG,CACjC,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,CACrB;EAED,IAAI,CAACA,4BAA4B,CAACX,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC5DF,IAAI,CAAE,yEAAwEe,4BAA4B,CAACT,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAExH,OAAO;MACHU,eAAe,EAAER,SAAS;MAC1BS,gBAAgB,EAAET,SAAS;MAC3BU,gBAAgB,EAAEV;IACtB,CAAC;EACL;EAEA,OAAO;IACHW,UAAU,EAAEpB,YAAY,CAACqB,qBAAqB,CAAClB,KAAK,CAAC;IACrDc,eAAe,EAAER,SAAS;IAC1BS,gBAAgB,EAAET,SAAS;IAC3BU,gBAAgB,EAAEV;EACtB,CAAC;AACL,CAAC;AAED,OAAO,MAAMa,cAAc,GAAuBnB,KAAQ,IAAQ;EAC9D,MAAMoB,mBAAmB,GAAI,WAAW,IAAIpB,KAAK,IAAIqB,KAAK,CAACC,OAAO,CAACtB,KAAK,CAACuB,SAAS,CAAC,GAC7E;IAAEA,SAAS,EAAE1B,YAAY,CAAC2B,oBAAoB,CAACxB,KAAK,CAACuB,SAAS;EAAE,CAAC,GACjE,CAAC,CAAC;EAER,MAAME,mBAAmB,GACrB,aAAa,IAAIzB,KAAK,IACtB,cAAc,IAAIA,KAAK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM0B,oBAAoB,GACtB,iBAAiB,IAAI1B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3BY,mBAAmB,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":["normalizer/normalizer.ts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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,7 @@
1
+ // prevent recursive import
2
+ import { createMediaQueryForStyles } from '../utils/cssMediaQuery';
3
+ export const cssMediaQueriesPlugin = {
4
+ name: '__unistylesCSSMediaQueries',
5
+ onParsedStyle: (_key, styles, runtime) => createMediaQueryForStyles(styles, runtime)
6
+ };
7
+ //# sourceMappingURL=cssMediaQueriesPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createMediaQueryForStyles","cssMediaQueriesPlugin","name","onParsedStyle","_key","styles","runtime"],"sourceRoot":"../../../src","sources":["plugins/cssMediaQueriesPlugin.ts"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,wBAAwB;AAGlE,OAAO,MAAMC,qBAAsC,GAAG;EAClDC,IAAI,EAAE,4BAA4B;EAClCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,EAAEC,OAAO,KAAKN,yBAAyB,CAACK,MAAM,EAAEC,OAAO;AACvF,CAAC"}
@@ -1,3 +1,3 @@
1
1
  export { normalizeWebStylesPlugin } from './normalizeWebStylesPlugin';
2
- export { preprocessor, normalizeNumericValue, normalizeColor, normalizeStyle } from './normalizer';
2
+ export { cssMediaQueriesPlugin } from './cssMediaQueriesPlugin';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeWebStylesPlugin","preprocessor","normalizeNumericValue","normalizeColor","normalizeStyle"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,YAAY,EAAEC,qBAAqB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,cAAc"}
1
+ {"version":3,"names":["normalizeWebStylesPlugin","cssMediaQueriesPlugin"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,qBAAqB,QAAQ,yBAAyB"}
@@ -1,4 +1,4 @@
1
- import { normalizeStyle } from './normalizer';
1
+ import { normalizeStyle } from '../normalizer';
2
2
  export const normalizeWebStylesPlugin = {
3
3
  name: '__unistylesNormalizeWebStyles',
4
4
  onParsedStyle: (_key, styles) => normalizeStyle(styles)
@@ -1 +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"}
1
+ {"version":3,"names":["normalizeStyle","normalizeWebStylesPlugin","name","onParsedStyle","_key","styles"],"sourceRoot":"../../../src","sources":["plugins/normalizeWebStylesPlugin.ts"],"mappings":"AACA,SAASA,cAAc,QAAQ,eAAe;AAE9C,OAAO,MAAMC,wBAAyC,GAAG;EACrDC,IAAI,EAAE,+BAA+B;EACrCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,KAAKL,cAAc,CAACK,MAAM;AAC1D,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { useMemo } from 'react';
2
2
  import { StyleSheet } from 'react-native';
3
3
  import { parseStyle, proxifyFunction, withPlugins } from './utils';
4
- import { useUnistyles, useVariants } from './hooks';
4
+ import { useCSS, useUnistyles, useVariants } from './hooks';
5
+ import { unistyles } from './core';
6
+ import { isWeb } from './common';
5
7
  export const useStyles = (stylesheet, variantsMap) => {
6
8
  const {
7
9
  theme,
@@ -20,9 +22,10 @@ export const useStyles = (stylesheet, variantsMap) => {
20
22
  }
21
23
  return StyleSheet.create({
22
24
  ...acc,
23
- [key]: withPlugins(key, parseStyle(value, variants))
25
+ [key]: withPlugins(key, parseStyle(value, variants, !isWeb || !unistyles.registry.config.experimentalCSSMediaQueries))
24
26
  });
25
27
  }, {}), [parsedStyles, variants, plugins]);
28
+ useCSS(dynamicStyleSheet);
26
29
  return {
27
30
  theme,
28
31
  breakpoint: layout.breakpoint,
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useUnistyles","useVariants","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","create","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,YAAY,EAAEC,WAAW,QAAQ,SAAS;AAUnD,OAAO,MAAMC,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGP,YAAY,CAAC,CAAC;EACjD,MAAMQ,QAAQ,GAAGP,WAAW,CAACG,WAAW,CAAC;EACzC,MAAMK,YAAY,GAAGd,OAAO,CAAC,MAAM,OAAOQ,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMI,iBAAiB,GAAGf,OAAO,CAAC,MAAMgB,MAAM,CACzCC,OAAO,CAACH,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,IAAI,OAAOE,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGlB,eAAe,CAACkB,GAAG,EAAEC,KAAK;MACrC,CAAC;IACL;IAEA,OAAOrB,UAAU,CAACsB,MAAM,CAAC;MACrB,GAAGJ,GAAG;MACN,CAACE,GAAG,GAAGjB,WAAW,CAACiB,GAAG,EAAEnB,UAAU,CAACoB,KAAK,EAAET,QAAQ,CAAC;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACC,YAAY,EAAED,QAAQ,EAAED,OAAO,CAC5C,CAAC;EAED,OAAO;IACHF,KAAK;IACLc,UAAU,EAAEb,MAAM,CAACa,UAAU;IAC7BC,MAAM,EAAEV;EACZ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","withPlugins","useCSS","useUnistyles","useVariants","unistyles","isWeb","useStyles","stylesheet","variantsMap","theme","layout","plugins","variants","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","create","registry","config","experimentalCSSMediaQueries","breakpoint","styles"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,EAAEC,WAAW,QAAQ,SAAS;AAClE,SAASC,MAAM,EAAEC,YA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