react-native-unistyles 2.0.0-beta.2 → 2.0.0-beta.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. package/lib/commonjs/core/UnistyleRegistry.js +6 -2
  2. package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
  3. package/lib/commonjs/core/Unistyles.js +2 -1
  4. package/lib/commonjs/core/Unistyles.js.map +1 -1
  5. package/lib/commonjs/core/UnistylesModule.web.js +18 -6
  6. package/lib/commonjs/core/UnistylesModule.web.js.map +1 -1
  7. package/lib/commonjs/core/UnistylesRuntime.js +3 -0
  8. package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
  9. package/lib/commonjs/hooks/index.js +7 -0
  10. package/lib/commonjs/hooks/index.js.map +1 -1
  11. package/lib/commonjs/hooks/useCSS.js +9 -0
  12. package/lib/commonjs/hooks/useCSS.js.map +1 -0
  13. package/lib/commonjs/hooks/useCSS.web.js +46 -0
  14. package/lib/commonjs/hooks/useCSS.web.js.map +1 -0
  15. package/lib/commonjs/normalizer/index.js.map +1 -0
  16. package/lib/commonjs/normalizer/module.d.js.map +1 -0
  17. package/lib/commonjs/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
  18. package/lib/commonjs/normalizer/normalizeStyle.js.map +1 -0
  19. package/lib/commonjs/normalizer/normalizer.js.map +1 -0
  20. package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +14 -0
  21. package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +1 -0
  22. package/lib/commonjs/plugins/index.js +3 -21
  23. package/lib/commonjs/plugins/index.js.map +1 -1
  24. package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +1 -1
  25. package/lib/commonjs/useStyles.js +4 -1
  26. package/lib/commonjs/useStyles.js.map +1 -1
  27. package/lib/commonjs/utils/cssMediaQuery.js +250 -0
  28. package/lib/commonjs/utils/cssMediaQuery.js.map +1 -0
  29. package/lib/commonjs/utils/generateId.js +15 -0
  30. package/lib/commonjs/utils/generateId.js.map +1 -0
  31. package/lib/commonjs/utils/hash32.js +43 -0
  32. package/lib/commonjs/utils/hash32.js.map +1 -0
  33. package/lib/commonjs/utils/index.js +13 -0
  34. package/lib/commonjs/utils/index.js.map +1 -1
  35. package/lib/commonjs/utils/mqParser.js +2 -1
  36. package/lib/commonjs/utils/mqParser.js.map +1 -1
  37. package/lib/commonjs/utils/styles.js +11 -1
  38. package/lib/commonjs/utils/styles.js.map +1 -1
  39. package/lib/module/core/UnistyleRegistry.js +7 -3
  40. package/lib/module/core/UnistyleRegistry.js.map +1 -1
  41. package/lib/module/core/Unistyles.js +2 -1
  42. package/lib/module/core/Unistyles.js.map +1 -1
  43. package/lib/module/core/UnistylesModule.web.js +18 -6
  44. package/lib/module/core/UnistylesModule.web.js.map +1 -1
  45. package/lib/module/core/UnistylesRuntime.js +3 -0
  46. package/lib/module/core/UnistylesRuntime.js.map +1 -1
  47. package/lib/module/hooks/index.js +1 -0
  48. package/lib/module/hooks/index.js.map +1 -1
  49. package/lib/module/hooks/useCSS.js +2 -0
  50. package/lib/module/hooks/useCSS.js.map +1 -0
  51. package/lib/module/hooks/useCSS.web.js +39 -0
  52. package/lib/module/hooks/useCSS.web.js.map +1 -0
  53. package/lib/module/normalizer/index.js.map +1 -0
  54. package/lib/module/normalizer/module.d.js.map +1 -0
  55. package/lib/module/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
  56. package/lib/module/normalizer/normalizeStyle.js.map +1 -0
  57. package/lib/module/normalizer/normalizer.js.map +1 -0
  58. package/lib/module/plugins/cssMediaQueriesPlugin.js +7 -0
  59. package/lib/module/plugins/cssMediaQueriesPlugin.js.map +1 -0
  60. package/lib/module/plugins/index.js +1 -1
  61. package/lib/module/plugins/index.js.map +1 -1
  62. package/lib/module/plugins/normalizeWebStylesPlugin.js +1 -1
  63. package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -1
  64. package/lib/module/useStyles.js +5 -2
  65. package/lib/module/useStyles.js.map +1 -1
  66. package/lib/module/utils/cssMediaQuery.js +243 -0
  67. package/lib/module/utils/cssMediaQuery.js.map +1 -0
  68. package/lib/module/utils/generateId.js +7 -0
  69. package/lib/module/utils/generateId.js.map +1 -0
  70. package/lib/module/utils/hash32.js +36 -0
  71. package/lib/module/utils/hash32.js.map +1 -0
  72. package/lib/module/utils/index.js +2 -1
  73. package/lib/module/utils/index.js.map +1 -1
  74. package/lib/module/utils/mqParser.js +1 -1
  75. package/lib/module/utils/mqParser.js.map +1 -1
  76. package/lib/module/utils/styles.js +11 -1
  77. package/lib/module/utils/styles.js.map +1 -1
  78. package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
  79. package/lib/typescript/src/core/Unistyles.d.ts.map +1 -1
  80. package/lib/typescript/src/core/UnistylesModule.web.d.ts.map +1 -1
  81. package/lib/typescript/src/core/UnistylesRuntime.d.ts +1 -0
  82. package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
  83. package/lib/typescript/src/hooks/index.d.ts +1 -0
  84. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  85. package/lib/typescript/src/hooks/useCSS.d.ts +3 -0
  86. package/lib/typescript/src/hooks/useCSS.d.ts.map +1 -0
  87. package/lib/typescript/src/hooks/useCSS.web.d.ts +3 -0
  88. package/lib/typescript/src/hooks/useCSS.web.d.ts.map +1 -0
  89. package/lib/typescript/src/normalizer/index.d.ts.map +1 -0
  90. package/lib/typescript/src/normalizer/normalizeStyle.d.ts +3 -0
  91. package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +1 -0
  92. package/lib/typescript/src/{plugins/normalizer → normalizer}/normalizer.d.ts +1 -1
  93. package/lib/typescript/src/normalizer/normalizer.d.ts.map +1 -0
  94. package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +3 -0
  95. package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +1 -0
  96. package/lib/typescript/src/plugins/index.d.ts +1 -1
  97. package/lib/typescript/src/plugins/index.d.ts.map +1 -1
  98. package/lib/typescript/src/types/unistyles.d.ts +2 -1
  99. package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
  100. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  101. package/lib/typescript/src/utils/cssMediaQuery.d.ts +4 -0
  102. package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +1 -0
  103. package/lib/typescript/src/utils/generateId.d.ts +2 -0
  104. package/lib/typescript/src/utils/generateId.d.ts.map +1 -0
  105. package/lib/typescript/src/utils/hash32.d.ts +2 -0
  106. package/lib/typescript/src/utils/hash32.d.ts.map +1 -0
  107. package/lib/typescript/src/utils/index.d.ts +3 -1
  108. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  109. package/lib/typescript/src/utils/mqParser.d.ts +2 -1
  110. package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
  111. package/lib/typescript/src/utils/styles.d.ts +1 -1
  112. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  113. package/package.json +3 -2
  114. package/src/core/UnistyleRegistry.ts +8 -3
  115. package/src/core/Unistyles.ts +2 -1
  116. package/src/core/UnistylesModule.web.ts +20 -7
  117. package/src/core/UnistylesRuntime.ts +4 -0
  118. package/src/hooks/index.ts +1 -0
  119. package/src/hooks/useCSS.ts +3 -0
  120. package/src/hooks/useCSS.web.ts +51 -0
  121. package/src/{plugins/normalizer → normalizer}/normalizeStyle.ts +2 -2
  122. package/src/{plugins/normalizer → normalizer}/normalizer.ts +2 -1
  123. package/src/plugins/cssMediaQueriesPlugin.ts +8 -0
  124. package/src/plugins/index.ts +1 -1
  125. package/src/plugins/normalizeWebStylesPlugin.ts +1 -1
  126. package/src/types/unistyles.ts +3 -2
  127. package/src/useStyles.ts +10 -2
  128. package/src/utils/cssMediaQuery.ts +268 -0
  129. package/src/utils/generateId.ts +10 -0
  130. package/src/utils/hash32.ts +53 -0
  131. package/src/utils/index.ts +3 -1
  132. package/src/utils/mqParser.ts +2 -2
  133. package/src/utils/styles.ts +12 -2
  134. package/lib/commonjs/plugins/normalizer/index.js.map +0 -1
  135. package/lib/commonjs/plugins/normalizer/module.d.js.map +0 -1
  136. package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +0 -1
  137. package/lib/commonjs/plugins/normalizer/normalizer.js.map +0 -1
  138. package/lib/module/plugins/normalizer/index.js.map +0 -1
  139. package/lib/module/plugins/normalizer/module.d.js.map +0 -1
  140. package/lib/module/plugins/normalizer/normalizeStyle.js.map +0 -1
  141. package/lib/module/plugins/normalizer/normalizer.js.map +0 -1
  142. package/lib/typescript/src/plugins/normalizer/index.d.ts.map +0 -1
  143. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +0 -3
  144. package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +0 -1
  145. package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +0 -1
  146. /package/lib/commonjs/{plugins/normalizer → normalizer}/index.js +0 -0
  147. /package/lib/commonjs/{plugins/normalizer → normalizer}/module.d.js +0 -0
  148. /package/lib/commonjs/{plugins/normalizer → normalizer}/normalizer.js +0 -0
  149. /package/lib/module/{plugins/normalizer → normalizer}/index.js +0 -0
  150. /package/lib/module/{plugins/normalizer → normalizer}/module.d.js +0 -0
  151. /package/lib/module/{plugins/normalizer → normalizer}/normalizer.js +0 -0
  152. /package/lib/typescript/src/{plugins/normalizer → normalizer}/index.d.ts +0 -0
  153. /package/src/{plugins/normalizer → normalizer}/index.ts +0 -0
  154. /package/src/{plugins/normalizer → normalizer}/module.d.ts +0 -0
@@ -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,I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iB,IAAI;IAAA,EAAC;IACtE,IAAI,CAAC5B,eAAe,CAACmC,YAAY,CAACxB,MAAM,CAACiB,IAAI,CAAC;EAClD,CAAC;EAEMV,QAAQ,GAAIU,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChC,MAAM;AAC1E;AAAC2C,OAAA,CAAAjD,gBAAA,GAAAA,gBAAA"}
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","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,eAA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,MAAM,CAACO,IAAI,CAACc,UAAU,CAAC,aAAa,CAAC,EAAE;MACvC,MAAM,IAAIR,KAAK,CAACC,sBAAc,CAACa,wBAAwB,CAAC;IAC5D;IAEA,IAAI,CAAC7C,OAAO,GAAG,IAAI,CAACA,OAAO,CAAC8C,MAAM,CAACC,KAAA;MAAA,IAAC;QAAEtB;MAAK,CAAC,GAAAsB,KAAA;MAAA,OAAKtB,IAAI,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,8 @@ class Unistyles {
16
16
  }
17
17
 
18
18
  // @ts-ignore
19
- this._bridge = (_common.isWeb ? window : global).__UNISTYLES__;
19
+ // eslint-disable-next-line no-undef
20
+ this._bridge = (_common.isWeb ? globalThis : global).__UNISTYLES__;
20
21
  this._registry = new _UnistyleRegistry.UnistyleRegistry(this._bridge);
21
22
  this._runtime = new _UnistylesRuntime.UnistylesRuntime(this._bridge, this._registry);
22
23
  }
@@ -1 +1 @@
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"}
1
+ {"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","isWeb","globalThis","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;IACA,IAAI,CAACC,OAAO,GAAG,CAACC,aAAK,GAAGC,UAAU,GAAGC,MAAM,EAAEC,aAAgC;IAC7E,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"}
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.UnistylesModule = exports.UnistylesBridgeWeb = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _plugins = require("../plugins");
9
+ var _common = require("../common");
9
10
  class UnistylesBridgeWeb {
10
11
  #timerRef = undefined;
11
12
  #hasAdaptiveThemes = false;
12
13
  #supportsAutomaticColorScheme = false;
13
- #screenWidth = window.innerWidth;
14
- #screenHeight = window.innerHeight;
14
+ #screenWidth = _common.isServer ? undefined : window.innerWidth;
15
+ #screenHeight = _common.isServer ? undefined : window.innerHeight;
15
16
  #themes = [];
17
+ #breakpoints = {};
16
18
  #colorScheme = this.getPreferredColorScheme();
17
19
  #themeName = '';
18
20
  #enabledPlugins = [_plugins.normalizeWebStylesPlugin.name];
@@ -20,11 +22,16 @@ class UnistylesBridgeWeb {
20
22
  #sortedBreakpointPairs = [];
21
23
  #breakpoint = '';
22
24
  constructor() {
23
- this.setupListeners();
25
+ if (!_common.isServer) {
26
+ this.setupListeners();
27
+ this.#screenWidth = window.innerWidth;
28
+ this.#screenHeight = window.innerHeight;
29
+ }
24
30
  }
25
31
  install() {
26
32
  // @ts-ignore
27
- window.__UNISTYLES__ = new Proxy({}, {
33
+ // eslint-disable-next-line no-undef
34
+ globalThis.__UNISTYLES__ = new Proxy({}, {
28
35
  get: (_target, prop) => {
29
36
  switch (prop) {
30
37
  case 'themeName':
@@ -35,6 +42,8 @@ class UnistylesBridgeWeb {
35
42
  return this.#screenHeight;
36
43
  case 'breakpoint':
37
44
  return this.#breakpoint || undefined;
45
+ case 'breakpoints':
46
+ return this.#breakpoints;
38
47
  case 'hasAdaptiveThemes':
39
48
  return this.#hasAdaptiveThemes;
40
49
  case 'sortedBreakpointPairs':
@@ -83,12 +92,15 @@ class UnistylesBridgeWeb {
83
92
  this.emitThemeChange();
84
93
  }
85
94
  useBreakpoints(breakpoints) {
95
+ this.#breakpoints = breakpoints;
86
96
  this.#sortedBreakpointPairs = Object.entries(breakpoints).sort((_ref, _ref2) => {
87
97
  let [, a] = _ref;
88
98
  let [, b] = _ref2;
89
99
  return (a ?? 0) - (b ?? 0);
90
100
  });
91
- this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
101
+ if (!_common.isServer) {
102
+ this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
103
+ }
92
104
  }
93
105
  useAdaptiveThemes(enable) {
94
106
  this.#hasAdaptiveThemes = enable;
@@ -150,7 +162,7 @@ class UnistylesBridgeWeb {
150
162
  return breakpoint?.at(0);
151
163
  }
152
164
  getPreferredColorScheme() {
153
- if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
165
+ if (!_common.isServer && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
154
166
  return 'dark';
155
167
  }
156
168
  return 'light';
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_plugins","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","constructor","setupListeners","install","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","breakpoints","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,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAACC,iCAAwB,CAACC,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAE5CC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,cAAc,CAAC,CAAC;EACzB;EAEOC,OAAOA,CAAA,EAAG;IACb;IACAnB,MAAM,CAACoB,aAAa,GAAG,IAAIC,KAAK,CAAC,CAAC,CAAC,EAAE;MACjCC,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;EAEQV,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAACxC,eAAe,CAAC2D,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE;IACV,CAAC,CAAC;EACN;EAEQ9B,eAAeA,CAAA,EAAG;IACtB,IAAI,CAAC,CAAC9B,eAAe,CAAC2D,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,OAAO;MACbC,OAAO,EAAE;QACLjE,SAAS,EAAE,IAAI,CAAC,CAACA;MACrB;IACJ,CAAC,CAAC;EACN;EAEQmD,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAAC/C,eAAe,CAAC2D,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACLxD,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5ByD,WAAW,EAAE,IAAI,CAAC,CAAC1E,WAAW,GAAG,IAAI,CAAC,CAACG,YAAY,GAC7C,WAAW,GACX,UAAU;QAChBwE,MAAM,EAAE;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"}
1
+ {"version":3,"names":["_reactNative","require","_plugins","_common","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","isServer","window","innerWidth","screenHeight","innerHeight","themes","breakpoints","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","constructor","setupListeners","install","globalThis","__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;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAGC,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACC,UAAU;EACvD,CAACC,YAAY,GAAGH,gBAAQ,GAAGJ,SAAS,GAAGK,MAAM,CAACG,WAAW;EACzD,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,CAACC,iCAAwB,CAACC,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAE5CC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACnB,gBAAQ,EAAE;MACX,IAAI,CAACoB,cAAc,CAAC,CAAC;MACrB,IAAI,CAAC,CAACrB,WAAW,GAAGE,MAAM,CAACC,UAAU;MACrC,IAAI,CAAC,CAACC,YAAY,GAAGF,MAAM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esRuntime {
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,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,OAAOG,yBAAiB,CAACC,SAAS;IACtC;IAEA,OAAOD,yBAAiB,CAACE,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACb,SAAS,EAAE;MACzB;IACJ;IAEA,IAAI,IAAI,CAACH,iBAAiB,CAACiB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACjB,eAAe,CAACmB,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,CAACxB,eAAe,CAACyB,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEME,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAC1B,iBAAiB,CAACyB,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;EAEMC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC1B,iBAAiB,CAAC2B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAA/B,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_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.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,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"}
@@ -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,4BAA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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","sources":["normalizer/normalizer.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4D,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAF5D;AACA;;AAUO,MAAMG,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,GAAG,IAAAC,wBAAe,EAACN,KAAK,CAAqB;;EAE1D;EACA,IAAIK,OAAO,KAAK,IAAI,EAAE;IAClB,OAAOL,KAAK;EAChB;EAEA,MAAMO,GAAG,GAAGF,OAAO,CAACG,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAEjD,IAAIF,GAAG,CAACJ,MAAM,KAAK,CAAC,EAAE;IAClB,MAAM,CAACO,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,CAAC,IAAIC,QAAQ,CAACD,CAAC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AEC;EAAa,CAAC,GAAGb,KAAK;EACxE,MAAMI,OAAO,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,MAAMzC,KAAK,GAAGD,cAAc,CAACuC,WAAW,EAAYE,aAAuB,CAAC;EAE5E,OAAQ,GAAER,OAAQ,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,E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