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
@@ -117,7 +117,7 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
117
117
 
118
118
  reactApplicationContext
119
119
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
120
- .emit("onChange", body)
120
+ .emit("__unistylesOnChange", body)
121
121
  }
122
122
 
123
123
  private fun onThemeChange(themeName: String) {
@@ -130,7 +130,7 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
130
130
 
131
131
  reactApplicationContext
132
132
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
133
- .emit("onChange", body)
133
+ .emit("__unistylesOnChange", body)
134
134
  }
135
135
 
136
136
  private fun onPluginChange() {
@@ -140,7 +140,7 @@ class UnistylesModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
140
140
 
141
141
  reactApplicationContext
142
142
  .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
143
- .emit("onChange", body)
143
+ .emit("__unistylesOnChange", body)
144
144
  }
145
145
 
146
146
  @ReactMethod
@@ -65,7 +65,7 @@ RCT_EXPORT_MODULE(Unistyles)
65
65
 
66
66
  #pragma mark - Event emitter
67
67
  - (NSArray<NSString *> *)supportedEvents {
68
- return @[@"onChange"];
68
+ return @[@"__unistylesOnChange"];
69
69
  }
70
70
 
71
71
  - (void)startObserving {
@@ -78,7 +78,7 @@ RCT_EXPORT_MODULE(Unistyles)
78
78
 
79
79
  - (void)emitEvent:(NSString *)eventName withBody:(NSDictionary *)body {
80
80
  if (self.hasListeners) {
81
- [self sendEventWithName:@"onChange" body:body];
81
+ [self sendEventWithName:@"__unistylesOnChange" body:body];
82
82
  }
83
83
  }
84
84
 
@@ -127,7 +127,7 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
127
127
  }
128
128
  };
129
129
 
130
- [weakSelf emitEvent:@"onChange" withBody:body];
130
+ [weakSelf emitEvent:@"__unistylesOnChange" withBody:body];
131
131
  });
132
132
 
133
133
  unistylesRuntime.get()->onLayoutChange([=](std::string breakpoint, std::string orientation, int width, int height) {
@@ -143,7 +143,7 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
143
143
  }
144
144
  };
145
145
 
146
- [weakSelf emitEvent:@"onChange" withBody:body];
146
+ [weakSelf emitEvent:@"__unistylesOnChange" withBody:body];
147
147
  });
148
148
 
149
149
  unistylesRuntime.get()->onPluginChange([=]() {
@@ -152,7 +152,7 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
152
152
  };
153
153
 
154
154
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
155
- [weakSelf emitEvent:@"onChange" withBody:body];
155
+ [weakSelf emitEvent:@"__unistylesOnChange" withBody:body];
156
156
  });
157
157
  });
158
158
 
@@ -40,12 +40,16 @@ class UnistyleRegistry {
40
40
  if (config.adaptiveThemes) {
41
41
  this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes);
42
42
  }
43
- if (config.experimentalPlugins) {
44
- config.experimentalPlugins.forEach(plugin => this.addPlugin(plugin, false));
43
+ if (config.plugins) {
44
+ config.plugins.forEach(plugin => this.addPlugin(plugin, false));
45
45
  }
46
46
  if (config.initialTheme) {
47
47
  this.unistylesBridge.useTheme(config.initialTheme);
48
48
  }
49
+ if (config.experimentalCSSMediaQueries) {
50
+ this.plugins = [_plugins.cssMediaQueriesPlugin].concat(this.plugins);
51
+ this.unistylesBridge.addPlugin(_plugins.cssMediaQueriesPlugin.name, false);
52
+ }
49
53
  return {
50
54
  addBreakpoints: this.addBreakpoints,
51
55
  addThemes: this.addThemes
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","experimentalPlugins","forEach","plugin","addPlugin","initialTheme","useTheme","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","_this","notify","arguments","undefined","name","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","concat","removePlugin","CantRemoveInternalPlugin","filter","_ref2","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe,CAACM,cAAc,CAACT,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAA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ry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","cssMediaQueriesPlugin","concat","name","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","_this","notify","arguments","undefined","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","_ref2","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEMD,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACA,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,eAAe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KAAKP,MAAM,CAACO,IAAI;IAAA,EAAC;IACtE,IAAI,CAACjB,eAAe,CAACoC,YAAY,CAAC1B,MAAM,CAACO,IAAI,CAAC;EAClD,CAAC;EAEMI,QAAQ,GAAIJ,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAACrB,MAAM;AAC1E;AAAC4C,OAAA,CAAAlD,gBAAA,GAAAA,gBAAA"}
@@ -16,7 +16,7 @@ class Unistyles {
16
16
  }
17
17
 
18
18
  // @ts-ignore
19
- this._bridge = global.__UNISTYLES__;
19
+ this._bridge = (_common.isWeb ? window : global).__UNISTYLES__;
20
20
  this._registry = new _UnistyleRegistry.UnistyleRegistry(this._bridge);
21
21
  this._runtime = new _UnistylesRuntime.UnistylesRuntime(this._bridge, this._registry);
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","UnistyleRegistry","_runtime","UnistylesRuntime","registry","runtime","unistyles","exports"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGC,gCAAe,EAAEC,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACF,WAAW,EAAE;MACd,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,aAAgC;IACtD,IAAI,CAACC,SAAS,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACJ,OAAO,CAAC;IACnD,IAAI,CAACK,QAAQ,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACN,OAAO,EAAE,IAAI,CAACG,SAAS,CAAC;EACtE;EAEA,IAAWI,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,SAAS;EACzB;EAEA,IAAWK,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;AACJ;AAEO,MAAMI,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAIjB,SAAS,CAAC,CAAC"}
1
+ {"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","isWeb","window","global","__UNISTYLES__","_registry","UnistyleRegistry","_runtime","UnistylesRuntime","registry","runtime","unistyles","exports"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGC,gCAAe,EAAEC,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACF,WAAW,EAAE;MACd,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAG,CAACC,aAAK,GAAGC,MAAM,GAAGC,MAAM,EAAEC,aAAgC;IACzE,IAAI,CAACC,SAAS,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACN,OAAO,CAAC;IACnD,IAAI,CAACO,QAAQ,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACR,OAAO,EAAE,IAAI,CAACK,SAAS,CAAC;EACtE;EAEA,IAAWI,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,SAAS;EACzB;EAEA,IAAWK,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;AACJ;AAEO,MAAMI,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAInB,SAAS,CAAC,CAAC"}
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.UnistylesModule = exports.UnistylesBridgeWeb = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _plugins = require("../plugins");
9
+ class UnistylesBridgeWeb {
10
+ #timerRef = undefined;
11
+ #hasAdaptiveThemes = false;
12
+ #supportsAutomaticColorScheme = false;
13
+ #screenWidth = window.innerWidth;
14
+ #screenHeight = window.innerHeight;
15
+ #themes = [];
16
+ #breakpoints = {};
17
+ #colorScheme = this.getPreferredColorScheme();
18
+ #themeName = '';
19
+ #enabledPlugins = [_plugins.normalizeWebStylesPlugin.name];
20
+ #unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
21
+ #sortedBreakpointPairs = [];
22
+ #breakpoint = '';
23
+ constructor() {
24
+ this.setupListeners();
25
+ }
26
+ install() {
27
+ // @ts-ignore
28
+ window.__UNISTYLES__ = new Proxy({}, {
29
+ get: (_target, prop) => {
30
+ switch (prop) {
31
+ case 'themeName':
32
+ return this.getTheme();
33
+ case 'screenWidth':
34
+ return this.#screenWidth;
35
+ case 'screenHeight':
36
+ return this.#screenHeight;
37
+ case 'breakpoint':
38
+ return this.#breakpoint || undefined;
39
+ case 'breakpoints':
40
+ return this.#breakpoints;
41
+ case 'hasAdaptiveThemes':
42
+ return this.#hasAdaptiveThemes;
43
+ case 'sortedBreakpointPairs':
44
+ return this.#sortedBreakpointPairs;
45
+ case 'enabledPlugins':
46
+ return this.#enabledPlugins;
47
+ case 'colorScheme':
48
+ return this.#colorScheme;
49
+ case 'useTheme':
50
+ return themeName => this.useTheme(themeName);
51
+ case 'useBreakpoints':
52
+ return breakpoints => this.useBreakpoints(breakpoints);
53
+ case 'useAdaptiveThemes':
54
+ return enable => this.useAdaptiveThemes(enable);
55
+ case 'addPlugin':
56
+ return (pluginName, notify) => this.addPlugin(pluginName, notify);
57
+ case 'removePlugin':
58
+ return pluginName => this.removePlugin(pluginName);
59
+ default:
60
+ return Reflect.get(this, prop);
61
+ }
62
+ },
63
+ set: (target, prop, newValue, receiver) => {
64
+ switch (prop) {
65
+ case 'themes':
66
+ {
67
+ this.#themes = newValue;
68
+ this.#supportsAutomaticColorScheme = newValue.includes('light') && newValue.includes('dark');
69
+ return true;
70
+ }
71
+ case 'themeName':
72
+ {
73
+ this.#themeName = newValue;
74
+ this.emitThemeChange();
75
+ return true;
76
+ }
77
+ default:
78
+ return Reflect.set(target, prop, newValue, receiver);
79
+ }
80
+ }
81
+ });
82
+ return true;
83
+ }
84
+ useTheme(themeName) {
85
+ this.#themeName = themeName;
86
+ this.emitThemeChange();
87
+ }
88
+ useBreakpoints(breakpoints) {
89
+ this.#breakpoints = breakpoints;
90
+ this.#sortedBreakpointPairs = Object.entries(breakpoints).sort((_ref, _ref2) => {
91
+ let [, a] = _ref;
92
+ let [, b] = _ref2;
93
+ return (a ?? 0) - (b ?? 0);
94
+ });
95
+ this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
96
+ }
97
+ useAdaptiveThemes(enable) {
98
+ this.#hasAdaptiveThemes = enable;
99
+ if (!this.#hasAdaptiveThemes || !this.#supportsAutomaticColorScheme) {
100
+ return;
101
+ }
102
+ if (this.#themeName !== this.#colorScheme) {
103
+ this.#themeName = this.#colorScheme;
104
+ this.emitThemeChange();
105
+ }
106
+ }
107
+ addPlugin(pluginName, notify) {
108
+ this.#enabledPlugins = [pluginName].concat(this.#enabledPlugins);
109
+ if (notify) {
110
+ this.emitPluginChange();
111
+ }
112
+ }
113
+ removePlugin(pluginName) {
114
+ this.#enabledPlugins = this.#enabledPlugins.filter(name => name !== pluginName);
115
+ this.emitPluginChange();
116
+ }
117
+ getTheme() {
118
+ if (this.#themes.length === 1) {
119
+ return this.#themes.at(0);
120
+ }
121
+ return this.#themeName;
122
+ }
123
+ setupListeners() {
124
+ window.addEventListener('resize', () => {
125
+ clearTimeout(this.#timerRef);
126
+ this.#timerRef = setTimeout(() => {
127
+ this.#screenWidth = window.innerWidth;
128
+ this.#screenHeight = window.innerHeight;
129
+ this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
130
+ this.emitLayoutChange();
131
+ }, 100);
132
+ });
133
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
134
+ this.#colorScheme = event.matches ? 'dark' : 'light';
135
+ if (!this.#supportsAutomaticColorScheme || !this.#hasAdaptiveThemes) {
136
+ return;
137
+ }
138
+ if (this.#colorScheme !== this.#themeName) {
139
+ this.#themeName = this.#colorScheme;
140
+ this.emitThemeChange();
141
+ }
142
+ });
143
+ }
144
+ getBreakpointFromScreenWidth(width) {
145
+ const breakpoint = this.#sortedBreakpointPairs.find((_ref3, index, otherBreakpoints) => {
146
+ let [, value] = _ref3;
147
+ const minVal = value;
148
+ const maxVal = otherBreakpoints[index + 1]?.[1];
149
+ if (!maxVal) {
150
+ return true;
151
+ }
152
+ return width >= minVal && width < maxVal;
153
+ });
154
+ return breakpoint?.at(0);
155
+ }
156
+ getPreferredColorScheme() {
157
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
158
+ return 'dark';
159
+ }
160
+ return 'light';
161
+ }
162
+ emitPluginChange() {
163
+ this.#unistylesEvents.emit('__unistylesOnChange', {
164
+ type: 'plugin'
165
+ });
166
+ }
167
+ emitThemeChange() {
168
+ this.#unistylesEvents.emit('__unistylesOnChange', {
169
+ type: 'theme',
170
+ payload: {
171
+ themeName: this.#themeName
172
+ }
173
+ });
174
+ }
175
+ emitLayoutChange() {
176
+ this.#unistylesEvents.emit('__unistylesOnChange', {
177
+ type: 'layout',
178
+ payload: {
179
+ breakpoint: this.#breakpoint,
180
+ orientation: this.#screenWidth > this.#screenHeight ? 'landscape' : 'portrait',
181
+ screen: {
182
+ width: this.#screenWidth,
183
+ height: this.#screenHeight
184
+ }
185
+ }
186
+ });
187
+ }
188
+ }
189
+ exports.UnistylesBridgeWeb = UnistylesBridgeWeb;
190
+ const UnistylesModule = exports.UnistylesModule = new UnistylesBridgeWeb();
191
+ //# sourceMappingURL=UnistylesModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_plugins","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","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","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.web.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,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,GAA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;UACJZ,KAAK,EAAE,IAAI,CAAC,CAAC/D,WAAW;UACxB4E,MAAM,EAAE,IAAI,CAAC,CAACzE;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAAC0E,OAAA,CAAAlF,kBAAA,GAAAA,kBAAA;AAEM,MAAMmF,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,IAAInF,kBAAkB,CAAC,CAAC"}
@@ -22,6 +22,9 @@ class UnistylesRuntime {
22
22
  get breakpoint() {
23
23
  return this.unistylesBridge.breakpoint;
24
24
  }
25
+ get breakpoints() {
26
+ return this.unistylesRegistry.breakpoints;
27
+ }
25
28
  get enabledPlugins() {
26
29
  return this.unistylesBridge.enabledPlugins;
27
30
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKO,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,UAA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common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","breakpoints","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKO,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,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACL,iBAAiB,CAACK,WAAW;EAC7C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACP,eAAe,CAACO,cAAc;EAC9C;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACT,eAAe,CAACU,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACX,eAAe,CAACY;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,OAAOG,yBAAiB,CAACC,SAAS;IACtC;IAEA,OAAOD,yBAAiB,CAACE,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACd,SAAS,EAAE;MACzB;IACJ;IAEA,IAAI,IAAI,CAACH,iBAAiB,CAACkB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAAClB,eAAe,CAACoB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;EACtD,CAAC;EAEMC,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAACzB,eAAe,CAAC0B,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEME,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAC3B,iBAAiB,CAAC0B,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;EAEMC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC3B,iBAAiB,CAAC4B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAAhC,gBAAA,GAAAA,gBAAA"}
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "useCSS", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useCSS.useCSS;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "useInitialTheme", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -24,4 +30,5 @@ Object.defineProperty(exports, "useVariants", {
24
30
  var _useInitialTheme = require("./useInitialTheme");
25
31
  var _useUnistyles = require("./useUnistyles");
26
32
  var _useVariants = require("./useVariants");
33
+ var _useCSS = require("./useCSS");
27
34
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_useInitialTheme","require","_useUnistyles","_useVariants"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA"}
1
+ {"version":3,"names":["_useInitialTheme","require","_useUnistyles","_useVariants","_useCSS"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCSS = void 0;
7
+ const useCSS = _stylesheet => {};
8
+ exports.useCSS = useCSS;
9
+ //# sourceMappingURL=useCSS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCSS","_stylesheet","exports"],"sourceRoot":"../../../src","sources":["hooks/useCSS.ts"],"mappings":";;;;;;AAEO,MAAMA,MAAM,GAAOC,WAAqC,IAAW,CAAC,CAAC;AAAAC,OAAA,CAAAF,MAAA,GAAAA,MAAA"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCSS = void 0;
7
+ var _react = require("react");
8
+ var _core = require("../core");
9
+ var _utils = require("../utils");
10
+ const useCSS = stylesheet => {
11
+ const insertedIds = (0, _react.useRef)([]);
12
+ (0, _react.useInsertionEffect)(() => {
13
+ if (!_core.unistyles.registry.config.experimentalCSSMediaQueries) {
14
+ return;
15
+ }
16
+ Object.entries(stylesheet).forEach(_ref => {
17
+ let [_key, value] = _ref;
18
+ Object.entries(value).forEach(_ref2 => {
19
+ let [prop, val] = _ref2;
20
+ if (!val.toString().includes('@media')) {
21
+ return;
22
+ }
23
+ const id = (0, _utils.generateReactNativeWebId)(prop, '""');
24
+ if (insertedIds.current.includes(id)) {
25
+ return;
26
+ }
27
+ const style = document.createElement('style');
28
+ style.id = id;
29
+ style.innerHTML = val;
30
+ document.head.appendChild(style);
31
+ insertedIds.current = [...insertedIds.current, id];
32
+ });
33
+ });
34
+ return () => {
35
+ insertedIds.current.forEach(id => {
36
+ const style = document.getElementById(id);
37
+ if (style) {
38
+ style.remove();
39
+ }
40
+ });
41
+ insertedIds.current = [];
42
+ };
43
+ }, [stylesheet]);
44
+ };
45
+ exports.useCSS = useCSS;
46
+ //# sourceMappingURL=useCSS.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_core","_utils","useCSS","stylesheet","insertedIds","useRef","useInsertionEffect","unistyles","registry","config","experimentalCSSMediaQueries","Object","entries","forEach","_ref","_key","value","_ref2","prop","val","toString","includes","id","generateReactNativeWebId","current","style","document","createElement","innerHTML","head","appendChild","getElementById","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useCSS.web.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,MAAM,GAAOC,UAAoC,IAAK;EAC/D,MAAMC,WAAW,GAAG,IAAAC,aAAM,EAAgB,EAAE,CAAC;EAE7C,IAAAC,yBAAkB,EAAC,MAAM;IACrB,IAAI,CAACC,eAAS,CAACC,QAAQ,CAACC,MAAM,CAACC,2BAA2B,EAAE;MACxD;IACJ;IAEAC,MAAM,CACDC,OAAO,CAACT,UAAU,CAAC,CACnBU,OAAO,CAACC,IAAA,IAAmB;MAAA,IAAlB,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAAF,IAAA;MACnBH,MAAM,CAACC,OAAO,CAACI,KAAM,CAAC,CACjBH,OAAO,CAACI,KAAA,IAAiB;QAAA,IAAhB,CAACC,IAAI,EAAEC,GAAG,CAAC,GAAAF,KAAA;QACjB,IAAI,CAACE,GAAG,CAACC,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;UACpC;QACJ;QAEA,MAAMC,EAAE,GAAG,IAAAC,+BAAwB,EAACL,IAAI,EAAE,IAAI,CAAC;QAE/C,IAAId,WAAW,CAACoB,OAAO,CAACH,QAAQ,CAACC,EAAE,CAAC,EAAE;UAClC;QACJ;QAEA,MAAMG,KAAK,GAAGC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC;QAE7CF,KAAK,CAACH,EAAE,GAAGA,EAAE;QACbG,KAAK,CAACG,SAAS,GAAGT,GAAG;QAErBO,QAAQ,CAACG,IAAI,CAACC,WAAW,CAACL,KAAK,CAAC;QAChCrB,WAAW,CAACoB,OAAO,GAAG,CAAC,GAAGpB,WAAW,CAACoB,OAAO,EAAEF,EAAE,CAAC;MACtD,CAAC,CAAC;IACV,CAAC,CAAC;IAEN,OAAO,MAAM;MACTlB,WAAW,CAACoB,OAAO,CAACX,OAAO,CAACS,EAAE,IAAI;QAC9B,MAAMG,KAAK,GAAGC,QAAQ,CAACK,cAAc,CAACT,EAAE,CAAC;QAEzC,IAAIG,KAAK,EAAE;UACPA,KAAK,CAACO,MAAM,CAAC,CAAC;QAClB;MACJ,CAAC,CAAC;MAEF5B,WAAW,CAACoB,OAAO,GAAG,EAAE;IAC5B,CAAC;EACL,CAAC,EAAE,CAACrB,UAAU,CAAC,CAAC;AACpB,CAAC;AAAA8B,OAAA,CAAA/B,MAAA,GAAAA,MAAA"}
@@ -21,7 +21,7 @@ const useUnistyles = () => {
21
21
  }
22
22
  });
23
23
  (0, _react.useEffect)(() => {
24
- const subscription = unistylesEvents.addListener('onChange', event => {
24
+ const subscription = unistylesEvents.addListener('__unistylesOnChange', event => {
25
25
  switch (event.type) {
26
26
  case _common.UnistylesEventType.Theme:
27
27
  {
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","UnistylesEventType","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAGA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAACC,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;EACxE,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAL,eAAQ,EAACC,eAAS,CAACK,QAAQ,CAACC,QAAQ,CAACN,eAAS,CAACC,OAAO,CAACM,SAAS,CAAC,CAAC;EAC5F,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAV,eAAQ,EAAC;IACjCW,UAAU,EAAEV,eAAS,CAACC,OAAO,CAACS,UAAU;IACxCC,WAAW,EAAEX,eAAS,CAACC,OAAO,CAACU,WAAW;IAC1CC,UAAU,EAAE;MACRC,KAAK,EAAEb,eAAS,CAACC,OAAO,CAACa,MAAM,CAACD,KAAK;MACrCE,MAAM,EAAEf,eAAS,CAACC,OAAO,CAACa,MAAM,CAACC;IACrC;EACJ,CAAC,CAAC;EAEF,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGzB,eAAe,CAAC0B,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKC,0BAAkB,CAACC,KAAK;UAAE;YAC3B,MAAMC,UAAU,GAAGJ,KAA4B;YAE/C,OAAOf,QAAQ,CAACJ,eAAS,CAACK,QAAQ,CAACC,QAAQ,CAACiB,UAAU,CAACC,OAAO,CAACjB,SAAS,CAAC,CAAC;UAC9E;QACA,KAAKc,0BAAkB,CAACI,MAAM;UAAE;YAC5B,MAAMC,WAAW,GAAGP,KAAmC;YAEvD,OAAOV,SAAS,CAAC;cACbC,UAAU,EAAEgB,WAAW,CAACF,OAAO,CAACd,UAAU;cAC1CC,WAAW,EAAEe,WAAW,CAACF,OAAO,CAACb,WAAW;cAC5CC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACV;YACpC,CAAC,CAAC;UACN;QACA,KAAKO,0BAAkB,CAACM,MAAM;UAAE;YAC5B,OAAO7B,UAAU,CAACE,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;UACvD;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOe,YAAY,CAACW,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH/B,OAAO;IACPM,KAAK;IACLK;EACJ,CAAC;AACL,CAAC;AAAAqB,OAAA,CAAAjC,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","UnistylesEventType","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;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1CC,WAAW,EAAEe,WAAW,CAACF,OAAO,CAACb,WAAW;cAC5CC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACV;YACpC,CAAC,CAAC;UACN;QACA,KAAKO,0BAAkB,CAACM,MAAM;UAAE;YAC5B,OAAO7B,UAAU,CAACE,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;UACvD;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOe,YAAY,CAACW,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH/B,OAAO;IACPM,KAAK;IACLK;EACJ,CAAC;AACL,CAAC;AAAAqB,OAAA,CAAAjC,YAAA,GAAAA,YAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeStyle","require","_normalizer"],"sourceRoot":"../../../src","sources":["normalizer/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["normalizer/module.d.ts"],"mappings":""}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.normalizeStyle = void 0;
7
7
  var _normalizer = require("./normalizer");
8
- var _common = require("../../common");
8
+ var _common = require("../common");
9
9
  const normalizeBoxShadow = style => {
10
10
  const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
11
11
  if (!requiredBoxShadowProperties.every(prop => prop in style)) {
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizer","require","_common","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","preprocessor","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyle","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow","exports"],"sourceRoot":"../../../src","sources":["normalizer/normalizeStyle.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAGA,MAAME,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;IAC3D,IAAAI,YAAI,EAAE,wEAAuEH,2BAA2B,CAACI,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,EAAEC,wBAAY,CAACC,oBAAoB,CAACb,KAAK,CAAC;IACnDM,WAAW,EAAEC,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMO,mBAAmB,GAA0Bd,KAAQ,IAA2B;EAClF,MAAMe,4BAA4B,GAAG,CACjC,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,CACrB;EAED,IAAI,CAACA,4BAA4B,CAACb,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC5D,IAAAI,YAAI,EAAE,yEAAwEW,4BAA4B,CAACV,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAExH,OAAO;MACHW,eAAe,EAAET,SAAS;MAC1BU,gBAAgB,EAAEV,SAAS;MAC3BW,gBAAgB,EAAEX;IACtB,CAAC;EACL;EAEA,OAAO;IACHY,UAAU,EAAEP,wBAAY,CAACQ,qBAAqB,CAACpB,KAAK,CAAC;IACrDgB,eAAe,EAAET,SAAS;IAC1BU,gBAAgB,EAAEV,SAAS;IAC3BW,gBAAgB,EAAEX;EACtB,CAAC;AACL,CAAC;AAEM,MAAMc,cAAc,GAAuBrB,KAAQ,IAAQ;EAC9D,MAAMsB,mBAAmB,GAAI,WAAW,IAAItB,KAAK,IAAIuB,KAAK,CAACC,OAAO,CAACxB,KAAK,CAACyB,SAAS,CAAC,GAC7E;IAAEA,SAAS,EAAEb,wBAAY,CAACc,oBAAoB,CAAC1B,KAAK,CAACyB,SAAS;EAAE,CAAC,GACjE,CAAC,CAAC;EAER,MAAME,mBAAmB,GACrB,aAAa,IAAI3B,KAAK,IACtB,cAAc,IAAIA,KAAK,IACvB,eAAe,IAAIA,KAAK,IACxB,cAAc,IAAIA,KAAK,GACvBD,kBAAkB,CAACC,KAAkB,CAAC,GAAG,CAAC,CAAC;EAE/C,MAAM4B,oBAAoB,GACtB,iBAAiB,IAAI5B,KAAK,IAC1B,kBAAkB,IAAIA,KAAK,IAC3B,kBAAkB,IAAIA,KAAK,GAC3Bc,mBAAmB,CAACd,KAAmB,CAAC,GAAG,CAAC,CAAC;EAEjD,OAAO;IACH,GAAGA,KAAK;IACR,GAAGsB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,cAAA,GAAAA,cAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_normalizeColors","_interopRequireDefault","require","obj","__esModule","default","normalizeColor","color","opacity","arguments","length","undefined","integer","normalizeColors","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","exports","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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AAQ,IAAGE,OAAQ,IAAGE,MAAO,IAAGpC,KAAM,EAAC;AACrD,CAAC;AAED,MAAM0C,oBAAoB,GAAIC,UAAsB,IAAKA,UAAU,CAC9D5B,GAAG,CAAC6B,SAAS,IAAI;EACd,MAAM,CAACnB,GAAG,CAAC,GAAGoB,MAAM,CAACC,IAAI,CAACF,SAAS,CAAC;EAEpC,IAAI,CAACnB,GAAG,EAAE;IACN,OAAOrB,SAAS;EACpB;EAEA,MAAMmB,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,CACDL,MAAM,CAAC8B,OAAO,CAAC,CACfD,IAAI,CAAC,GAAG,CAAC;AAEP,MAAME,YAA0B,GAAA5B,OAAA,CAAA4B,YAAA,GAAG;EACtCtB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cssMediaQueriesPlugin = void 0;
7
+ var _cssMediaQuery = require("../utils/cssMediaQuery");
8
+ // prevent recursive import
9
+
10
+ const cssMediaQueriesPlugin = exports.cssMediaQueriesPlugin = {
11
+ name: '__unistylesCSSMediaQueries',
12
+ onParsedStyle: (_key, styles, runtime) => (0, _cssMediaQuery.createMediaQueryForStyles)(styles, runtime)
13
+ };
14
+ //# sourceMappingURL=cssMediaQueriesPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_cssMediaQuery","require","cssMediaQueriesPlugin","exports","name","onParsedStyle","_key","styles","runtime","createMediaQueryForStyles"],"sourceRoot":"../../../src","sources":["plugins/cssMediaQueriesPlugin.ts"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AADA;;AAIO,MAAMC,qBAAsC,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EAClDE,IAAI,EAAE,4BAA4B;EAClCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,EAAEC,OAAO,KAAK,IAAAC,wCAAyB,EAACF,MAAM,EAAEC,OAAO;AACvF,CAAC"}
@@ -3,22 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "normalizeColor", {
6
+ Object.defineProperty(exports, "cssMediaQueriesPlugin", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _normalizer.normalizeColor;
10
- }
11
- });
12
- Object.defineProperty(exports, "normalizeNumericValue", {
13
- enumerable: true,
14
- get: function () {
15
- return _normalizer.normalizeNumericValue;
16
- }
17
- });
18
- Object.defineProperty(exports, "normalizeStyle", {
19
- enumerable: true,
20
- get: function () {
21
- return _normalizer.normalizeStyle;
9
+ return _cssMediaQueriesPlugin.cssMediaQueriesPlugin;
22
10
  }
23
11
  });
24
12
  Object.defineProperty(exports, "normalizeWebStylesPlugin", {
@@ -27,12 +15,6 @@ Object.defineProperty(exports, "normalizeWebStylesPlugin", {
27
15
  return _normalizeWebStylesPlugin.normalizeWebStylesPlugin;
28
16
  }
29
17
  });
30
- Object.defineProperty(exports, "preprocessor", {
31
- enumerable: true,
32
- get: function () {
33
- return _normalizer.preprocessor;
34
- }
35
- });
36
18
  var _normalizeWebStylesPlugin = require("./normalizeWebStylesPlugin");
37
- var _normalizer = require("./normalizer");
19
+ var _cssMediaQueriesPlugin = require("./cssMediaQueriesPlugin");
38
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_normalizeWebStylesPlugin","require","_normalizer"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
1
+ {"version":3,"names":["_normalizeWebStylesPlugin","require","_cssMediaQueriesPlugin"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.normalizeWebStylesPlugin = void 0;
7
- var _normalizer = require("./normalizer");
7
+ var _normalizer = require("../normalizer");
8
8
  const normalizeWebStylesPlugin = exports.normalizeWebStylesPlugin = {
9
9
  name: '__unistylesNormalizeWebStyles',
10
10
  onParsedStyle: (_key, styles) => (0, _normalizer.normalizeStyle)(styles)
@@ -8,6 +8,8 @@ var _react = require("react");
8
8
  var _reactNative = require("react-native");
9
9
  var _utils = require("./utils");
10
10
  var _hooks = require("./hooks");
11
+ var _core = require("./core");
12
+ var _common = require("./common");
11
13
  const useStyles = (stylesheet, variantsMap) => {
12
14
  const {
13
15
  theme,
@@ -26,9 +28,10 @@ const useStyles = (stylesheet, variantsMap) => {
26
28
  }
27
29
  return _reactNative.StyleSheet.create({
28
30
  ...acc,
29
- [key]: (0, _utils.withPlugins)(key, (0, _utils.parseStyle)(value, variants))
31
+ [key]: (0, _utils.withPlugins)(key, (0, _utils.parseStyle)(value, variants, !_common.isWeb || !_core.unistyles.registry.config.experimentalCSSMediaQueries))
30
32
  });
31
33
  }, {}), [parsedStyles, variants, plugins]);
34
+ (0, _hooks.useCSS)(dynamicStyleSheet);
32
35
  return {
33
36
  theme,
34
37
  breakpoint: layout.breakpoint,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_utils","_hooks","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","variants","useVariants","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","proxifyFunction","StyleSheet","create","withPlugins","parseStyle","breakpoint","styles","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAUO,MAAMI,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACN,WAAW,CAAC;EACzC,MAAMO,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOT,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMO,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,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,GAAG,IAAAE,sBAAe,EAACF,GAAG,EAAEC,KAAK;MACrC,CAAC;IACL;IAEA,OAAOE,uBAAU,CAACC,MAAM,CAAC;MACrB,GAAGN,GAAG;MACN,CAACE,GAAG,GAAG,IAAAK,kBAAW,EAACL,GAAG,EAAE,IAAAM,iBAAU,EAACL,KAAK,EAAEX,QAAQ,CAAC;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAACE,YAAY,EAAEF,QAAQ,EAAEF,OAAO,CAC5C,CAAC;EAED,OAAO;IACHF,KAAK;IACLqB,UAAU,EAAEpB,MAAM,CAACoB,UAAU;IAC7BC,MAAM,EAAEd;EACZ,CAAC;AACL,CAAC;AAAAe,OAAA,CAAA1B,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_react","require","_reactNative","_utils","_hooks","_core","_common","useStyles","stylesheet","variantsMap","theme","layout","plugins","useUnistyles","variants","useVariants","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","proxifyFunction","StyleSheet","create","withPlugins","parseStyle","isWeb","unistyles","registry","config","experimentalCSSMediaQueries","useCSS","breakpoint","styles","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAGA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAQO,MAAMM,SAAS,GAAGA,CACrBC,UAAe,EACfC,WAAoD,KAC7B;EACvB,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,mBAAY,EAAC,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAACN,WAAW,CAAC;EACzC,MAAMO,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOT,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACE,KAAK,CAAC,GACjBF,UAAU,EAAE,CAACE,KAAK,EAAEF,UAAU,EAAEG,MAAM,CAAC,CAAC;EAE9C,MAAMO,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,IAAI,CAAC,CAAC,CAAC,CAC3BK,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,I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