react-native-unistyles 2.0.0-alpha.3 → 2.0.0-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/ios/UnistylesHelpers.h +4 -0
  2. package/ios/UnistylesHelpers.mm +20 -0
  3. package/ios/UnistylesModule.h +1 -3
  4. package/ios/UnistylesModule.mm +62 -67
  5. package/lib/commonjs/UnistyleRegistry.js +12 -1
  6. package/lib/commonjs/UnistyleRegistry.js.map +1 -1
  7. package/lib/commonjs/UnistylesRuntime.js +5 -2
  8. package/lib/commonjs/UnistylesRuntime.js.map +1 -1
  9. package/lib/commonjs/hooks/useDimensions.web.js +7 -5
  10. package/lib/commonjs/hooks/useDimensions.web.js.map +1 -1
  11. package/lib/commonjs/index.js +2 -1
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/types/cxx.js +5 -2
  14. package/lib/commonjs/types/cxx.js.map +1 -1
  15. package/lib/commonjs/useInitialTheme.js +1 -1
  16. package/lib/commonjs/useInitialTheme.js.map +1 -1
  17. package/lib/commonjs/useStyles.js.map +1 -1
  18. package/lib/commonjs/useUnistyles.js +9 -15
  19. package/lib/commonjs/useUnistyles.js.map +1 -1
  20. package/lib/commonjs/utils/breakpoints.js +12 -2
  21. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  22. package/lib/commonjs/utils/common.js +6 -1
  23. package/lib/commonjs/utils/common.js.map +1 -1
  24. package/lib/commonjs/utils/index.js +7 -0
  25. package/lib/commonjs/utils/index.js.map +1 -1
  26. package/lib/commonjs/utils/mediaQueries.js +9 -2
  27. package/lib/commonjs/utils/mediaQueries.js.map +1 -1
  28. package/lib/module/UnistyleRegistry.js +12 -1
  29. package/lib/module/UnistyleRegistry.js.map +1 -1
  30. package/lib/module/UnistylesRuntime.js +5 -2
  31. package/lib/module/UnistylesRuntime.js.map +1 -1
  32. package/lib/module/hooks/useDimensions.web.js +8 -6
  33. package/lib/module/hooks/useDimensions.web.js.map +1 -1
  34. package/lib/module/index.js +1 -0
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/types/cxx.js +5 -2
  37. package/lib/module/types/cxx.js.map +1 -1
  38. package/lib/module/useInitialTheme.js +2 -2
  39. package/lib/module/useInitialTheme.js.map +1 -1
  40. package/lib/module/useStyles.js.map +1 -1
  41. package/lib/module/useUnistyles.js +9 -15
  42. package/lib/module/useUnistyles.js.map +1 -1
  43. package/lib/module/utils/breakpoints.js +13 -3
  44. package/lib/module/utils/breakpoints.js.map +1 -1
  45. package/lib/module/utils/common.js +5 -0
  46. package/lib/module/utils/common.js.map +1 -1
  47. package/lib/module/utils/index.js +1 -1
  48. package/lib/module/utils/index.js.map +1 -1
  49. package/lib/module/utils/mediaQueries.js +9 -2
  50. package/lib/module/utils/mediaQueries.js.map +1 -1
  51. package/lib/typescript/src/UnistyleRegistry.d.ts +2 -0
  52. package/lib/typescript/src/UnistyleRegistry.d.ts.map +1 -1
  53. package/lib/typescript/src/UnistylesRuntime.d.ts +3 -39
  54. package/lib/typescript/src/UnistylesRuntime.d.ts.map +1 -1
  55. package/lib/typescript/src/global.d.ts +2 -0
  56. package/lib/typescript/src/global.d.ts.map +1 -1
  57. package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +1 -1
  58. package/lib/typescript/src/index.d.ts +1 -0
  59. package/lib/typescript/src/index.d.ts.map +1 -1
  60. package/lib/typescript/src/types/cxx.d.ts +15 -15
  61. package/lib/typescript/src/types/cxx.d.ts.map +1 -1
  62. package/lib/typescript/src/useStyles.d.ts +3 -39
  63. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  64. package/lib/typescript/src/useUnistyles.d.ts +4 -38
  65. package/lib/typescript/src/useUnistyles.d.ts.map +1 -1
  66. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  67. package/lib/typescript/src/utils/common.d.ts +5 -0
  68. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  69. package/lib/typescript/src/utils/index.d.ts +1 -1
  70. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  71. package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -1
  72. package/package.json +12 -13
  73. package/react-native-unistyles.podspec +2 -1
  74. package/src/UnistyleRegistry.ts +16 -1
  75. package/src/UnistylesRuntime.ts +6 -2
  76. package/src/global.ts +4 -1
  77. package/src/hooks/useDimensions.web.ts +9 -6
  78. package/src/index.ts +2 -0
  79. package/src/types/cxx.ts +18 -17
  80. package/src/useInitialTheme.ts +2 -2
  81. package/src/useStyles.ts +2 -2
  82. package/src/useUnistyles.ts +12 -24
  83. package/src/utils/breakpoints.ts +18 -4
  84. package/src/utils/common.ts +6 -0
  85. package/src/utils/index.ts +1 -1
  86. package/src/utils/mediaQueries.ts +18 -6
  87. package/ios/UnistylesRuntime.h +0 -48
  88. package/ios/UnistylesRuntime.mm +0 -228
  89. package/lib/typescript/examples/expo/src/App.d.ts +0 -3
  90. package/lib/typescript/examples/expo/src/App.d.ts.map +0 -1
  91. package/lib/typescript/examples/expo/src/examples/Cxx.d.ts +0 -3
  92. package/lib/typescript/examples/expo/src/examples/Cxx.d.ts.map +0 -1
  93. package/lib/typescript/examples/expo/src/examples/index.d.ts +0 -2
  94. package/lib/typescript/examples/expo/src/examples/index.d.ts.map +0 -1
  95. package/lib/typescript/examples/expo/src/index.d.ts +0 -2
  96. package/lib/typescript/examples/expo/src/index.d.ts.map +0 -1
  97. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts +0 -8
  98. package/lib/typescript/examples/expo/src/styles/breakpoints.d.ts.map +0 -1
  99. package/lib/typescript/examples/expo/src/styles/index.d.ts +0 -16
  100. package/lib/typescript/examples/expo/src/styles/index.d.ts.map +0 -1
  101. package/lib/typescript/examples/expo/src/styles/theme.d.ts +0 -40
  102. package/lib/typescript/examples/expo/src/styles/theme.d.ts.map +0 -1
@@ -20,8 +20,15 @@ exports.isWithinTheWidthAndHeight = exports.isWithinTheWidth = exports.isWithinT
20
20
  * extractValues("h[100,]") // returns [100]
21
21
  */
22
22
  const extractValues = codedValue => {
23
- const [lh, rh] = codedValue.replace(/[wh[\]]/g, '').split(',');
24
- return rh ? [Number(lh), Number(rh)] : [Number(lh)];
23
+ const cleanedValue = codedValue.replace(/[wh ]/g, '');
24
+ const [left, right] = cleanedValue.split(',');
25
+ if (!right) {
26
+ const lh = left.startsWith('[') ? Number(left.replace(/[[\]()]/g, '')) : Number(left.replace(/[[\]()]/g, '')) + 1;
27
+ return [lh];
28
+ }
29
+ const lh = left.startsWith('[') ? Number(left.replace('[', '')) : Number(left.replace('(', '')) + 1;
30
+ const rh = right.endsWith(']') ? Number(right.replace(']', '')) : Number(right.replace(')', '')) - 1;
31
+ return [lh, rh];
25
32
  };
26
33
 
27
34
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["extractValues","codedValue","lh","rh","replace","split","Number","exports","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAIC,UAAkB,IAAoB;EAChE,MAAM,CAACC,EAAE,EAAEC,EAAE,CAAC,GAAGF,UAAU,CACtBG,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CACvBC,KAAK,CAAC,GAAG,CAAC;EAEf,OAAOF,EAAE,GACH,CAACG,MAAM,CAACJ,EAAE,CAAC,EAAEI,MAAM,CAACH,EAAE,CAAC,CAAC,GACxB,CAACG,MAAM,CAACJ,EAAE,CAAC,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfAK,OAAA,CAAAP,aAAA,GAAAA,aAAA;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CAACC,GAAG,CAAC,GAAAD,IAAA;IACX,IAAIC,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,IAAIyB,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxC,OAAOH,kBAAkB,CAAC4B,GAAG,EAAE1B,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS;IAChE;IAEA,OAAOD,GAAG,CACL/B,KAAK,CAAC,GAAG,CAAC,CACVkB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAAChB,KAAK,IAAID,kBAAkB,CAACC,KAAK,EAAEC,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS,CAAC;EAC9E,CAAC,CAAC,CACDd,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC;AAAA1B,OAAA,CAAAwB,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["extractValues","codedValue","cleanedValue","replace","left","right","split","lh","startsWith","Number","rh","endsWith","exports","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAIC,UAAkB,IAAoB;EAChE,MAAMC,YAAY,GAAGD,UAAU,CAACE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;EACrD,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAGH,YAAY,CAACI,KAAK,CAAC,GAAG,CAAiC;EAE7E,IAAI,CAACD,KAAK,EAAE;IACR,MAAME,EAAE,GAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GACzB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AC,CAAC,CACDd,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC;AAAA1B,OAAA,CAAAwB,yBAAA,GAAAA,yBAAA"}
@@ -1,5 +1,6 @@
1
1
  export class UnistyleRegistry {
2
2
  config = {};
3
+ themeNames = [];
3
4
  themes = {};
4
5
  breakpoints = {};
5
6
  sortedBreakpointPairs = [];
@@ -8,7 +9,9 @@ export class UnistyleRegistry {
8
9
  }
9
10
  addThemes = themes => {
10
11
  this.themes = themes;
11
- this.unistylesBridge.themes = Object.keys(themes);
12
+ const keys = Object.keys(themes);
13
+ this.unistylesBridge.themes = keys;
14
+ this.themeNames = keys;
12
15
  return this;
13
16
  };
14
17
  addBreakpoints = breakpoints => {
@@ -23,5 +26,13 @@ export class UnistyleRegistry {
23
26
  }
24
27
  return this;
25
28
  };
29
+ dangerouslyUnregister = () => {
30
+ this.config = {};
31
+ this.themeNames = [];
32
+ this.themes = {};
33
+ this.breakpoints = {};
34
+ this.sortedBreakpointPairs = [];
35
+ this.unistylesBridge.unregister();
36
+ };
26
37
  }
27
38
  //# sourceMappingURL=UnistyleRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnistyleRegistry","config","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","Object","keys","addBreakpoints","useBreakpoints","addConfig","adaptiveThemes","useAdaptiveThemes"],"sourceRoot":"../../src","sources":["UnistyleRegistry.ts"],"mappings":"AAGA,OAAO,MAAMA,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,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;IACpB,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,MAAM,CAACC,IAAI,CAACP,MAAM,CAAiC;IAEjF,OAAO,IAAI;EACf,CAAC;EAEMQ,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACG,eAAe,CAACK,cAAc,CAACR,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO,IAAI;EACf,CAAC;EAEMQ,SAAS,GAAIX,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAIA,MAAM,CAACY,cAAc,EAAE;MACvB,IAAI,CAACP,eAAe,CAACQ,iBAAiB,CAACb,MAAM,CAACY,cAAc,CAAC;IACjE;IAEA,OAAO,IAAI;EACf,CAAC;AACL"}
1
+ {"version":3,"names":["UnistyleRegistry","config","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","useBreakpoints","addConfig","adaptiveThemes","useAdaptiveThemes","dangerouslyUnregister","unregister"],"sourceRoot":"../../src","sources":["UnistyleRegistry.ts"],"mappings":"AAGA,OAAO,MAAMA,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,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,IAAI;EACf,CAAC;EAEME,cAAc,GAAIP,WAAiC,IAAK;IAC3D,IAAI,CAACG,eAAe,CAACK,cAAc,CAACR,WAAW,CAAC;IAChD,IAAI,CAACC,qBAAqB,GAAG,IAAI,CAACE,eAAe,CAACF,qBAAqB;IAEvE,OAAO,IAAI;EACf,CAAC;EAEMQ,SAAS,GAAIZ,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,IAAIA,MAAM,CAACa,cAAc,EAAE;MACvB,IAAI,CAACP,eAAe,CAACQ,iBAAiB,CAACd,MAAM,CAACa,cAAc,CAAC;IACjE;IAEA,OAAO,IAAI;EACf,CAAC;EAEME,qBAAqB,GAAGA,CAAA,KAAM;IACjC,IAAI,CAACf,MAAM,GAAG,CAAC,CAAC;IAChB,IAAI,CAACC,UAAU,GAAG,EAAE;IACpB,IAAI,CAACC,MAAM,GAAG,CAAC,CAAoB;IACnC,IAAI,CAACC,WAAW,GAAG,CAAC,CAAyB;IAC7C,IAAI,CAACC,qBAAqB,GAAG,EAAE;IAE/B,IAAI,CAACE,eAAe,CAACU,UAAU,CAAC,CAAC;EACrC,CAAC;AACL"}
@@ -14,7 +14,7 @@ export class UnistylesRuntime {
14
14
  return this.registry.sortedBreakpointPairs;
15
15
  }
16
16
  get themeName() {
17
- return this.unistylesBridge.theme;
17
+ return this.unistylesBridge.themeName;
18
18
  }
19
19
  get breakpoint() {
20
20
  return this.unistylesBridge.breakpoint;
@@ -40,9 +40,12 @@ export class UnistylesRuntime {
40
40
  this.unistylesBridge.useTheme(name);
41
41
  return true;
42
42
  }
43
- return false;
43
+ throw new Error(UnistylesError.ThemeNotRegistered);
44
44
  };
45
45
  getTheme = forName => {
46
+ if (this.registry.themeNames.length === 0) {
47
+ return {};
48
+ }
46
49
  if (!this.hasTheme(forName)) {
47
50
  throw new Error(UnistylesError.ThemeNotFound);
48
51
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","hasAdaptiveThemes","sortedBreakpoints","sortedBreakpointPairs","themeName","theme","breakpoint","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","getTheme","forName","Error","ThemeNotFound","themes","setAdaptiveThemes","enable","useAdaptiveThemes"],"sourceRoot":"../../src","sources":["UnistylesRuntime.ts"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,SAAS;AAG3D,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,QAA0B,EAAE;IAAA,KAAtED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,QAA0B,GAA1BA,QAA0B;EAAG;EAE3F,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,QAAQ,CAACI,qBAAqB;EAC9C;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACN,eAAe,CAACO,KAAK;EACrC;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACR,eAAe,CAACQ,UAAU;EAC1C;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACV,eAAe,CAACW,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACZ,eAAe,CAACa;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,OAAOhB,iBAAiB,CAACmB,SAAS;IACtC;IAEA,OAAOnB,iBAAiB,CAACoB,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACZ,SAAS,IAAI,IAAI,CAACa,QAAQ,CAACD,IAAI,CAAC,EAAE;MAChD,IAAI,CAAClB,eAAe,CAACoB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,OAAO,KAAK;EAChB,CAAC;EAEMG,QAAQ,GAAIC,OAA8B,IAAK;IAClD,IAAI,CAAC,IAAI,CAACH,QAAQ,CAACG,OAAO,CAAC,EAAE;MACzB,MAAM,IAAIC,KAAK,CAAC1B,cAAc,CAAC2B,aAAa,CAAC;IACjD;IAEA,OAAO,IAAI,CAACvB,QAAQ,CAACwB,MAAM,CAACH,OAAO,CAAC;EACxC,CAAC;EAEMI,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAC3B,eAAe,CAAC4B,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEOR,QAAQ,GAAID,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAACjB,QAAQ,CAACwB,MAAM;AACpF"}
1
+ {"version":3,"names":["ScreenOrientation","UnistylesError","UnistylesRuntime","constructor","unistylesBridge","registry","colorScheme","hasAdaptiveThemes","sortedBreakpoints","sortedBreakpointPairs","themeName","breakpoint","screen","width","screenWidth","height","screenHeight","orientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","ThemeNotRegistered","getTheme","forName","themeNames","length","ThemeNotFound","themes","setAdaptiveThemes","enable","useAdaptiveThemes"],"sourceRoot":"../../src","sources":["UnistylesRuntime.ts"],"mappings":"AAEA,SAASA,iBAAiB,EAAEC,cAAc,QAAQ,SAAS;AAG3D,OAAO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,QAA0B,EAAE;IAAA,KAAtED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,QAA0B,GAA1BA,QAA0B;EAAG;EAE3F,IAAWC,WAAWA,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Q,CAACK,OAAO,CAAC,EAAE;MACzB,MAAM,IAAIH,KAAK,CAACvB,cAAc,CAAC6B,aAAa,CAAC;IACjD;IAEA,OAAO,IAAI,CAACzB,QAAQ,CAAC0B,MAAM,CAACJ,OAAO,CAAC;EACxC,CAAC;EAEMK,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAAC7B,eAAe,CAAC8B,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEOX,QAAQ,GAAID,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChB,QAAQ,CAAC0B,MAAM;AACpF"}
@@ -1,11 +1,13 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import { isServer } from '../utils';
1
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
3
2
  export const useDimensions = () => {
4
3
  const timerRef = useRef();
5
- const [screenSize, setScreenSize] = useState({
6
- width: isServer ? 0 : window.innerWidth,
7
- height: isServer ? 0 : window.innerHeight
8
- });
4
+ const [screenSize, setScreenSize] = useState({});
5
+ useLayoutEffect(() => {
6
+ setScreenSize({
7
+ width: window.innerWidth,
8
+ height: window.innerHeight
9
+ });
10
+ }, []);
9
11
  useEffect(() => {
10
12
  const handleResize = () => {
11
13
  clearTimeout(timerRef.current);
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","useState","isServer","useDimensions","timerRef","screenSize","setScreenSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,QAAQ,QAAQ,UAAU;AAEnC,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGJ,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACK,UAAU,EAAEC,aAAa,CAAC,GAAGL,QAAQ,CAAa;IACrDM,KAAK,EAAEL,QAAQ,GAAG,CAAC,GAAGM,MAAM,CAACC,UAAU;IACvCC,MAAM,EAAER,QAAQ,GAAG,CAAC,GAAGM,MAAM,CAACG;EAClC,CAAC,CAAC;EAEFZ,SAAS,CAAC,MAAM;IACZ,MAAMa,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;MAE9BV,QAAQ,CAACU,OAAO,GAAGC,UAAU,CAAC,MAAMT,aAAa,CAAC;QAC9CC,KAAK,EAAEC,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTJ,MAAM,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOT,UAAU;AACrB,CAAC"}
1
+ {"version":3,"names":["useEffect","useLayoutEffect","useRef","useState","useDimensions","timerRef","screenSize","setScreenSize","width","window","innerWidth","height","innerHeight","handleResize","clearTimeout","current","setTimeout","addEventListener","removeEventListener"],"sourceRoot":"../../../src","sources":["hooks/useDimensions.web.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGpE,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAkB;EAC3C,MAAMC,QAAQ,GAAGH,MAAM,CAAgC,CAAC;EACxD,MAAM,CAACI,UAAU,EAAEC,aAAa,CAAC,GAAGJ,QAAQ,CAAa,CAAC,CAAe,CAAC;EAE1EF,eAAe,CAAC,MAAM;IAClBM,aAAa,CAAC;MACVC,KAAK,EAAEC,MAAM,CAACC,UAAU;MACxBC,MAAM,EAAEF,MAAM,CAACG;IACnB,CAAC,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAENZ,SAAS,CAAC,MAAM;IACZ,MAAMa,YAAY,GAAGA,CAAA,KAAM;MACvBC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;MAE9BV,QAAQ,CAACU,OAAO,GAAGC,UAAU,CAAC,MAAMT,aAAa,CAAC;QAC9CC,KAAK,EAAEC,MAAM,CAACC,UAAU;QACxBC,MAAM,EAAEF,MAAM,CAACG;MACnB,CAAC,CAAC,EAAE,GAAG,CAAC;IACZ,CAAC;IAEDH,MAAM,CAACQ,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;IAE/C,OAAO,MAAM;MACTJ,MAAM,CAACS,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;MAClDC,YAAY,CAACT,QAAQ,CAACU,OAAO,CAAC;IAClC,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOT,UAAU;AACrB,CAAC"}
@@ -14,6 +14,7 @@ const UnistylesRegistry = {
14
14
  addBreakpoints,
15
15
  addConfig
16
16
  };
17
+ export const __dangerouslyUnregister = unistyles.registry.dangerouslyUnregister;
17
18
  export { UnistylesRuntime, UnistylesRegistry };
18
19
  export { ScreenOrientation };
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","ScreenOrientation","useInitialTheme","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGP,SAAS,CAACQ,QAAQ;AACpE,MAAMC,gBAAgB,GAAGT,SAAS,CAACU,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,SACIE,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIV,iBAAiB"}
1
+ {"version":3,"names":["unistyles","ScreenOrientation","useInitialTheme","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry","__dangerouslyUnregister","dangerouslyUnregister"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGP,SAAS,CAACQ,QAAQ;AACpE,MAAMC,gBAAgB,GAAGT,SAAS,CAACU,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,OAAO,MAAMK,uBAAuB,GAAGZ,SAAS,CAACQ,QAAQ,CAACK,qBAAqB;AAE/E,SACIJ,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIV,iBAAiB"}
@@ -5,13 +5,16 @@ export let ScreenOrientation = /*#__PURE__*/function (ScreenOrientation) {
5
5
  }({});
6
6
  export let CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
7
7
  CxxUnistylesEventTypes["Theme"] = "theme";
8
- CxxUnistylesEventTypes["Size"] = "size";
9
- CxxUnistylesEventTypes["Breakpoint"] = "breakpoint";
8
+ CxxUnistylesEventTypes["Layout"] = "layout";
10
9
  return CxxUnistylesEventTypes;
11
10
  }({});
12
11
  export let UnistylesError = /*#__PURE__*/function (UnistylesError) {
13
12
  UnistylesError["RuntimeUnavailable"] = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE";
14
13
  UnistylesError["ThemeNotFound"] = "UNISTYLES_ERROR_THEME_NOT_FOUND";
14
+ UnistylesError["ThemeNotRegistered"] = "UNISTYLES_ERROR_THEME_NOT_REGISTERED";
15
+ UnistylesError["ThemesCannotBeEmpty"] = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY";
16
+ UnistylesError["BreakpointsCannotBeEmpty"] = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY";
17
+ UnistylesError["BreakpointsMustStartFromZero"] = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO";
15
18
  return UnistylesError;
16
19
  }({});
17
20
  //# sourceMappingURL=cxx.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ScreenOrientation","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":"AASA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAsB7B,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AA8BlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
1
+ {"version":3,"names":["ScreenOrientation","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":"AAUA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAyB7B,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAuBlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
@@ -1,6 +1,6 @@
1
- import { useRef } from 'react';
1
+ import { useMemo } from 'react';
2
2
  import { unistyles } from './Unistyles';
3
3
  export const useInitialTheme = forName => {
4
- useRef(unistyles.runtime.setTheme(forName));
4
+ useMemo(() => unistyles.runtime.setTheme(forName), []);
5
5
  };
6
6
  //# sourceMappingURL=useInitialTheme.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","unistyles","useInitialTheme","forName","runtime","setTheme"],"sourceRoot":"../../src","sources":["useInitialTheme.ts"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,SAAS,QAAQ,aAAa;AAGvC,OAAO,MAAMC,eAAe,GAAIC,OAA8B,IAAK;EAC/DH,MAAM,CAACC,SAAS,CAACG,OAAO,CAACC,QAAQ,CAACF,OAAO,CAAC,CAAC;AAC/C,CAAC"}
1
+ {"version":3,"names":["useMemo","unistyles","useInitialTheme","forName","runtime","setTheme"],"sourceRoot":"../../src","sources":["useInitialTheme.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,SAAS,QAAQ,aAAa;AAGvC,OAAO,MAAMC,eAAe,GAAIC,OAA8B,IAAK;EAC/DH,OAAO,CAAC,MAAMC,SAAS,CAACG,OAAO,CAACC,QAAQ,CAACF,OAAO,CAAC,EAAE,EAAE,CAAC;AAC1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AA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{"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAErD,SAASC,YAAY,QAAQ,gBAAgB;;AAG7C;;AAGA,OAAO,MAAMC,SAAS,GAAsCC,UAA4C,IAAK;EACzG,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGL,YAAY,CAAC,CAAC;EAExD,IAAI,CAACE,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLC,UAAU;MACVE,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGX,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAM,CAAC,GAClBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMM,iBAAiB,GAAGZ,OAAO,CAAC,MAAMa,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGf,eAAe,CAACgB,KAAK,EAAEX,UAAU,EAAEC,UAAU;MACxD,CAAC;IACL;IAEA,OAAOR,UAAU,CAACoB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGhB,UAAU,CAAKkB,KAAK,EAAEZ,UAAU,EAAEC,UAAU;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACD,UAAU,EAAEC,UAAU,EAAEE,YAAY,CAAC,CAAC;EAEzD,OAAO;IACHJ,KAAK;IACLC,UAAU;IACVE,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
@@ -4,11 +4,12 @@ import { CxxUnistylesEventTypes } from './types';
4
4
  import { unistyles } from './Unistyles';
5
5
  const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles);
6
6
  export const useUnistyles = () => {
7
+ const [orientation, setOrientation] = useState(unistyles.runtime.orientation);
7
8
  const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName));
8
9
  const [breakpoint, setBreakpoint] = useState(unistyles.runtime.breakpoint);
9
10
  const [screenSize, setScreenSize] = useState({
10
- width: 0,
11
- height: 0
11
+ width: unistyles.runtime.screen.width,
12
+ height: unistyles.runtime.screen.height
12
13
  });
13
14
  useEffect(() => {
14
15
  const subscription = unistylesEvents.addListener('onChange', event => {
@@ -19,20 +20,12 @@ export const useUnistyles = () => {
19
20
  setTheme(unistyles.runtime.getTheme(themeEvent.payload.themeName));
20
21
  return;
21
22
  }
22
- // this event is not available on mobile
23
- case CxxUnistylesEventTypes.Size:
23
+ case CxxUnistylesEventTypes.Layout:
24
24
  {
25
- const sizeEvent = event;
26
- setScreenSize({
27
- width: sizeEvent.payload.width,
28
- height: sizeEvent.payload.height
29
- });
30
- return;
31
- }
32
- case CxxUnistylesEventTypes.Breakpoint:
33
- {
34
- const breakpointEvent = event;
35
- setBreakpoint(breakpointEvent.payload.breakpoint);
25
+ const layoutEvent = event;
26
+ setBreakpoint(layoutEvent.payload.breakpoint);
27
+ setOrientation(layoutEvent.payload.orientation);
28
+ setScreenSize(layoutEvent.payload.screen);
36
29
  return;
37
30
  }
38
31
  default:
@@ -43,6 +36,7 @@ export const useUnistyles = () => {
43
36
  }, []);
44
37
  return {
45
38
  theme,
39
+ orientation,
46
40
  breakpoint,
47
41
  screenSize
48
42
  };
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","CxxUnistylesEventTypes","unistyles","unistylesEvents","Unistyles","useUnistyles","theme","setTheme","runtime","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","height","subscription","addListener","event","type","Theme","themeEvent","payload","Size","sizeEvent","Breakpoint","breakpointEvent","remove"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAO3C,SAASC,sBAAsB,QAAQ,SAAS;AAChD,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGP,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACC,QAAQ,CAACP,SAAS,CAACM,OAAO,CAACE,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGZ,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACG,UAAU,CAAC;EAC1E,MAAM,CAACE,UAAU,EAAEC,aAAa,CAAC,GAAGd,QAAQ,CAAC;IACzCe,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC,CAAC;EAEFjB,SAAS,CAAC,MAAM;IACZ,MAAMkB,YAAY,GAAGd,eAAe,CAACe,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKnB,sBAAsB,CAACoB,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGH,KAA+B;YAElDZ,QAAQ,CAACL,SAAS,CAACM,OAAO,CAACC,QAAQ,CAACa,UAAU,CAACC,OAAO,CAACb,SAAS,CAAC,CAAC;YAElE;UACJ;QACA;QACA,KAAKT,sBAAsB,CAACuB,IAAI;UAAE;YAC9B,MAAMC,SAAS,GAAGN,KAA8B;YAEhDL,aAAa,CAAC;cACVC,KAAK,EAAEU,SAAS,CAACF,OAAO,CAACR,KAAK;cAC9BC,MAAM,EAAES,SAAS,CAACF,OAAO,CAACP;YAC9B,CAAC,CAAC;YAEF;UACJ;QACA,KAAKf,sBAAsB,CAACyB,UAAU;UAAE;YACpC,MAAMC,eAAe,GAAGR,KAAoC;YAE5DP,aAAa,CAACe,eAAe,CAACJ,OAAO,CAACZ,UAAU,CAAC;YAEjD;UACJ;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOM,YAAY,CAACW,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHtB,KAAK;IACLK,UAAU;IACVE;EACJ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","CxxUnistylesEventTypes","unistyles","unistylesEvents","Unistyles","useUnistyles","orientation","setOrientation","runtime","theme","setTheme","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","remove"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,sBAAsB,QAA2B,SAAS;AACnE,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGP,QAAQ,CAAoBE,SAAS,CAACM,OAAO,CAACF,WAAW,CAAC;EAChG,MA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{ unistyles } from '../Unistyles';
2
- import { throwError } from './common';
2
+ import { isMobile, Orientation, throwError } from './common';
3
+ import { ScreenOrientation } from '../types';
3
4
  import { getKeyForCustomMediaQuery, isMediaQuery } from './mediaQueries';
4
5
  /**
5
6
  * Sorts the breakpoints object based on its numeric values in ascending order and validates them.
@@ -101,7 +102,16 @@ export const getValueForBreakpoint = (value, breakpoint, screenSize) => {
101
102
  return value[customMediaQueryKey];
102
103
  }
103
104
 
104
- // if no custom media query, or didn't match, proceed with defined breakpoints
105
+ // at this point user didn't use custom media queries (:w, :h)
106
+ // check if user defined any breakpoints
107
+ const hasBreakpoints = unistyles.runtime.sortedBreakpoints.length > 0;
108
+
109
+ // if not then we can fallback to horizontal and portrait (mobile only)
110
+ if (!hasBreakpoints && isMobile && (Orientation.Landscape in value || Orientation.Portrait in value)) {
111
+ return value[unistyles.runtime.orientation === ScreenOrientation.Portrait ? Orientation.Portrait : Orientation.Landscape];
112
+ }
113
+
114
+ // if user defined breakpoints, then we look for the valid one
105
115
  const unifiedKey = breakpoint?.toLowerCase();
106
116
  const directBreakpoint = value[unifiedKey];
107
117
 
@@ -110,7 +120,7 @@ export const getValueForBreakpoint = (value, breakpoint, screenSize) => {
110
120
  return directBreakpoint;
111
121
  }
112
122
 
113
- // there is no direct hit for breakpoint nor media-query, so let's simulate CSS cascading
123
+ // there is no direct hit for breakpoint nor media-query, let's simulate CSS cascading
114
124
  const breakpointPairs = unistyles.runtime.sortedBreakpoints;
115
125
  const currentBreakpoint = breakpointPairs.findIndex(_ref3 => {
116
126
  let [key] = _ref3;
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","throwError","getKeyForCustomMediaQuery","isMediaQuery","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","customMediaQueryKey","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","runtime","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,UAAU,QAAQ,UAAU;AAErC,SAASC,yBAAyB,EAAEC,YAAY,QAAQ,gBAAgB;AAGxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAIC,WAAiC,IAA2B;EACnG,MAAMC,WAAW,GAAGC,MAAM,CACrBC,OAAO,CAACH,WAAW,CAAC,CACpBI,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;IAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;IAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;IAE9B,OAAQC,MAAM,GAAeC,MAAiB;EAClD,CAAC,CAAC;EAEN,MAAMC,iBAAiB,GAAIP,MAAM,CAACQ,MAAM,CAACR,MAAM,CAACS,WAAW,CAACV,WAAW,CAAC,CAAyB;EACjG,MAAMW,gBAAgB,GAAGV,MAAM,CAACW,MAAM,CAACJ,iBAAiB,CAAC;EACzD,MAAM,CAACK,eAAe,CAAC,GAAGF,gBAAgB;EAE1C,IAAIE,eAAe,KAAK,CAAC,EAAE;IACvBlB,UAAU,CAAC,oCAAoC,CAAC;EACpD;EAEA,IAAIgB,gBAAgB,CAACG,MAAM,KAAK,IAAIC,GAAG,CAACJ,gBAAgB,CAAC,CAACK,IAAI,EAAE;IAC5DrB,UAAU,CAAC,kCAAkC,CAAC;EAClD;EAEA,OAAOa,iBAAiB;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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BAAgB,IAAKF,UAAU,IAAIV,KAAM,EAAE;IAC3C,OAAOY,gBAAgB;EAC3B;;EAEA;EACA,MAAMC,eAAe,GAAG5C,SAAS,CAAC6C,OAAO,CAAC/B,iBAAiB;EAC3D,MAAMgC,iBAAiB,GAAGF,eAAe,CACpCG,SAAS,CAACC,KAAA;IAAA,IAAC,CAACtB,GAAG,CAAC,GAAAsB,KAAA;IAAA,OAAKtB,GAAG,KAAKe,UAAU;EAAA,EAAC;EAE7C,MAAMQ,oBAAoB,GAAGL,eAAe,CACvCN,MAAM,CAAC,CAAAY,KAAA,EAAQrB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAAwB,KAAA;IAAA,OAAYrB,KAAK,GAAGiB,iBAAiB,IAAIpB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EoB,GAAG,CAACC,KAAA;IAAA,IAAC,CAAC1B,GAAG,CAAC,GAAA0B,KAAA;IAAA,OAAK1B,GAAG;EAAA,EAAC;EAExB,OAAOkB,eAAe,CAACxB,MAAM,GAAG,CAAC,GAC3BW,KAAK,CAACkB,oBAAoB,CAACA,oBAAoB,CAAC7B,MAAM,GAAG,CAAC,CAAC,CAAwC,GACnGiC,SAAS;AACnB,CAAC"}
1
+ {"version":3,"names":["unistyles","isMobile","Orientation","throwError","ScreenOrientation","getKeyForCustomMediaQuery","isMediaQuery","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","customMediaQueryKey","hasBreakpoints","runtime","Landscape","Portrait","orientation","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"source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CAAC,EAAE;IACnG,OAAOA,KAAK,CACRlC,SAAS,CAAC6C,OAAO,CAACG,WAAW,KAAK5C,iBAAiB,CAAC2C,QAAQ,GACtD7C,WAAW,CAAC6C,QAAQ,GACpB7C,WAAW,CAAC4C,SAAS,CAC9B;EACL;;EAEA;EACA,MAAMG,UAAU,GAAGX,UAAU,EAAEY,WAAW,CAAC,CAAuB;EAClE,MAAMC,gBAAgB,GAAGjB,KAAK,CAACe,UAAU,CAAC;;EAE1C;EACA,IAAIE,gBAAgB,IAAKF,UAAU,IAAIf,KAAM,EAAE;IAC3C,OAAOiB,gBAAgB;EAC3B;;EAEA;EACA,MAAMC,eAAe,GAAGpD,SAAS,CAAC6C,OAAO,CAAC5B,iBAAiB;EAC3D,MAAMoC,iBAAiB,GAAGD,eAAe,CACpCE,SAAS,CAACC,KAAA;IAAA,IAAC,CAAC1B,GAAG,CAAC,GAAA0B,KAAA;IAAA,OAAK1B,GAAG,KAAKoB,UAAU;EAAA,EAAC;EAE7C,MAAMO,oBAAoB,GAAGJ,eAAe,CACvCX,MAAM,CAAC,CAAAgB,KAAA,EAAQzB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAA4B,KAAA;IAAA,OAAYzB,KAAK,GAAGqB,iBAAiB,IAAIxB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EwB,GAAG,CAACC,KAAA;IAAA,IAAC,CAAC9B,GAAG,CAAC,GAAA8B,KAAA;IAAA,OAAK9B,GAAG;EAAA,EAAC;EAExB,OAAOuB,eAAe,CAAC7B,MAAM,GAAG,CAAC,GAC3BW,KAAK,CAACsB,oBAAoB,CAACA,oBAAoB,CAACjC,MAAM,GAAG,CAAC,CAAC,CAAwC,GACnGqC,SAAS;AACnB,CAAC"}
@@ -5,6 +5,11 @@ export const throwError = message => {
5
5
  export const warn = message => {
6
6
  console.warn(`🦄 [react-native-unistyles]: ${message}`);
7
7
  };
8
+ export const isMobile = Platform.OS === 'android' || Platform.OS === 'ios';
8
9
  export const isWeb = Platform.OS === 'web';
9
10
  export const isServer = typeof window === 'undefined';
11
+ export const Orientation = {
12
+ Landscape: 'landscape',
13
+ Portrait: 'portrait'
14
+ };
10
15
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","throwError","message","Error","warn","console","isWeb","OS","isServer","window"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAED,OAAO,MAAME,IAAI,GAAIF,OAAe,IAAK;EACrCG,OAAO,CAACD,IAAI,CAAE,gCAA+BF,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAMI,KAAK,GAAGN,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMC,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW"}
1
+ {"version":3,"names":["Platform","throwError","message","Error","warn","console","isMobile","OS","isWeb","isServer","window","Orientation","Landscape","Portrait"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAED,OAAO,MAAME,IAAI,GAAIF,OAAe,IAAK;EACrCG,OAAO,CAACD,IAAI,CAAE,gCAA+BF,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAMI,QAAQ,GAAGN,QAAQ,CAACO,EAAE,KAAK,SAAS,IAAIP,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1E,OAAO,MAAMC,KAAK,GAAGR,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,WAAW,GAAG;EACvBC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU"}
@@ -2,6 +2,6 @@ export { normalizeStyles } from './normalizeStyles';
2
2
  export * from './normalizer';
3
3
  export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints, getValueForBreakpoint } from './breakpoints';
4
4
  export { proxifyFunction, parseStyle } from './styles';
5
- export { isServer } from './common';
5
+ export { isServer, Orientation } from './common';
6
6
  export { extractValues, getKeyForCustomMediaQuery, isMediaQuery, isWithinTheHeight, isWithinTheWidth, isWithinTheWidthAndHeight } from './mediaQueries';
7
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["normalizeStyles","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForBreakpoint","proxifyFunction","parseStyle","isServer","extractValues","getKeyForCustomMediaQuery","isMediaQuery","isWithinTheHeight","isWithinTheWidth","isWithinTheWidthAndHeight"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,cAAc,cAAc;AAC5B,SAASC,4BAA4B,EAAEC,0BAA0B,EAAEC,qBAAqB,QAAQ,eAAe;AAC/G,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SAASC,QAAQ,QAAQ,UAAU;AACnC,SACIC,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,yBAAyB,QACtB,gBAAgB"}
1
+ {"version":3,"names":["normalizeStyles","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","getValueForBreakpoint","proxifyFunction","parseStyle","isServer","Orientation","extractValues","getKeyForCustomMediaQuery","isMediaQuery","isWithinTheHeight","isWithinTheWidth","isWithinTheWidthAndHeight"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,cAAc,cAAc;AAC5B,SAASC,4BAA4B,EAAEC,0BAA0B,EAAEC,qBAAqB,QAAQ,eAAe;AAC/G,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU;AACtD,SAASC,QAAQ,EAAEC,WAAW,QAAQ,UAAU;AAChD,SACIC,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,yBAAyB,QACtB,gBAAgB"}
@@ -14,8 +14,15 @@
14
14
  * extractValues("h[100,]") // returns [100]
15
15
  */
16
16
  export const extractValues = codedValue => {
17
- const [lh, rh] = codedValue.replace(/[wh[\]]/g, '').split(',');
18
- return rh ? [Number(lh), Number(rh)] : [Number(lh)];
17
+ const cleanedValue = codedValue.replace(/[wh ]/g, '');
18
+ const [left, right] = cleanedValue.split(',');
19
+ if (!right) {
20
+ const lh = left.startsWith('[') ? Number(left.replace(/[[\]()]/g, '')) : Number(left.replace(/[[\]()]/g, '')) + 1;
21
+ return [lh];
22
+ }
23
+ const lh = left.startsWith('[') ? Number(left.replace('[', '')) : Number(left.replace('(', '')) + 1;
24
+ const rh = right.endsWith(']') ? Number(right.replace(']', '')) : Number(right.replace(')', '')) - 1;
25
+ return [lh, rh];
19
26
  };
20
27
 
21
28
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["extractValues","codedValue","lh","rh","replace","split","Number","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAIC,UAAkB,IAAoB;EAChE,MAAM,CAACC,EAA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sB,yBAAyB,GAAGA,CAACC,YAA0D,EAAEtB,UAAsB,KAAyB;EACjJ,MAAM,CAACuB,YAAY,CAAC,GAAGD,YAAY,CAC9BE,OAAO,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IACX,IAAIC,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,IAAIyB,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxC,OAAOH,kBAAkB,CAAC4B,GAAG,EAAE1B,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS;IAChE;IAEA,OAAOD,GAAG,CACL9B,KAAK,CAAC,GAAG,CAAC,CACViB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAAChB,KAAK,IAAID,kBAAkB,CAACC,KAAK,EAAEC,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS,CAAC;EAC9E,CAAC,CAAC,CACDd,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC"}
1
+ {"version":3,"names":["extractValues","codedValue","cleanedValue","replace","left","right","split","lh","startsWith","Number","rh","endsWith","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAIC,UAAkB,IAAoB;EAChE,MAAMC,YAAY,GAAGD,UAAU,CAACE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;EACrD,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAGH,YAAY,CAACI,KAAK,CAAC,GAAG,CAAiC;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CAAC,EAAEhB,UAAU,CAAC,CAAC,CAC3Ca,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOF,MAAM,CAACK,MAAM,KAAK,CAAC;AAC9B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAInB,KAAa,IAAc;EACpD,MAAMoB,KAAK,GAAG,qGAAqG;EAEnH,OAAOpB,KAAK,CAACkB,MAAM,GAAG,CAAC,IAAIE,KAAK,CAACC,IAAI,CAACrB,KAAK,CAAC;AAChD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMsB,yBAAyB,GAAGA,CAACC,YAA0D,EAAEtB,UAAsB,KAAyB;EACjJ,MAAM,CAACuB,YAAY,CAAC,GAAGD,YAAY,CAC9BE,OAAO,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IACX,IAAIC,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,IAAIyB,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxC,OAAOH,kBAAkB,CAAC4B,GAAG,EAAE1B,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS;IAChE;IAEA,OAAOD,GAAG,CACLlC,KAAK,CAAC,GAAG,CAAC,CACVqB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAAChB,KAAK,IAAID,kBAAkB,CAACC,KAAK,EAAEC,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS,CAAC;EAC9E,CAAC,CAAC,CACDd,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC"}
@@ -3,6 +3,7 @@ import type { UnistylesThemes, UnistylesBreakpoints } from './global';
3
3
  export declare class UnistyleRegistry {
4
4
  private unistylesBridge;
5
5
  config: UnistylesConfig;
6
+ themeNames: Array<keyof UnistylesThemes>;
6
7
  themes: UnistylesThemes;
7
8
  breakpoints: UnistylesBreakpoints;
8
9
  sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
@@ -10,5 +11,6 @@ export declare class UnistyleRegistry {
10
11
  addThemes: (themes: UnistylesThemes) => this;
11
12
  addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
12
13
  addConfig: (config: UnistylesConfig) => this;
14
+ dangerouslyUnregister: () => void;
13
15
  }
14
16
  //# sourceMappingURL=UnistyleRegistry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../src/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAErE,qBAAa,gBAAgB;IAMb,OAAO,CAAC,eAAe;IAL5B,MAAM,EAAE,eAAe,CAAK;IAC5B,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAK1C;IAEM,cAAc,gBAAiB,oBAAoB,UAKzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;CACJ"}
1
+ {"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../src/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAErE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,MAAM,EAAE,eAAe,CAAK;IAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAS1C;IAEM,cAAc,gBAAiB,oBAAoB,UAKzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;IAEM,qBAAqB,aAQ3B;CACJ"}
@@ -8,8 +8,8 @@ export declare class UnistylesRuntime {
8
8
  constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
9
9
  get colorScheme(): import("./types").ColorSchemeName;
10
10
  get hasAdaptiveThemes(): boolean;
11
- get sortedBreakpoints(): [keyof import("./global").UnistylesBreakpoints, number][];
12
- get themeName(): keyof UnistylesThemes;
11
+ get sortedBreakpoints(): [keyof import("./global").UnistylesBreakpoints, number | undefined][];
12
+ get themeName(): never;
13
13
  get breakpoint(): keyof import("./global").UnistylesBreakpoints;
14
14
  get screen(): {
15
15
  width: number;
@@ -17,43 +17,7 @@ export declare class UnistylesRuntime {
17
17
  };
18
18
  get orientation(): ScreenOrientation;
19
19
  setTheme: (name: keyof UnistylesThemes) => boolean;
20
- getTheme: (forName: keyof UnistylesThemes) => {
21
- colors: {
22
- backgroundColor: string;
23
- typography: string;
24
- accent: string;
25
- barbie: string;
26
- oak: string;
27
- sky: string;
28
- fog: string;
29
- aloes: string;
30
- blood: string;
31
- };
32
- } | {
33
- colors: {
34
- backgroundColor: string;
35
- typography: string;
36
- accent: string;
37
- barbie: string;
38
- oak: string;
39
- sky: string;
40
- fog: string;
41
- aloes: string;
42
- blood: string;
43
- };
44
- } | {
45
- colors: {
46
- backgroundColor: string;
47
- typography: string;
48
- accent: string;
49
- barbie: string;
50
- oak: string;
51
- sky: string;
52
- fog: string;
53
- aloes: string;
54
- blood: string;
55
- };
56
- };
20
+ getTheme: (forName: keyof UnistylesThemes) => never;
57
21
  setAdaptiveThemes: (enable: boolean) => void;
58
22
  private hasTheme;
59
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../src/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,sCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,8DAE3B;IAED,IAAW,SAAS,0BAEnB;IAED,IAAW,UAAU,kDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
1
+ {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../src/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,sCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,0EAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,kDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAUhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
@@ -1,5 +1,7 @@
1
1
  export interface UnistylesThemes {
2
2
  }
3
3
  export interface UnistylesBreakpoints {
4
+ landscape?: number;
5
+ portrait?: number;
4
6
  }
5
7
  //# sourceMappingURL=global.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;CAAG"}
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,eAAO,MAAM,aAAa,QAAO,UA0BhC,CAAA"}
1
+ {"version":3,"file":"useDimensions.web.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDimensions.web.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,eAAO,MAAM,aAAa,QAAO,UA8BhC,CAAA"}
@@ -9,6 +9,7 @@ declare const UnistylesRegistry: {
9
9
  addBreakpoints: (breakpoints: UnistylesBreakpoints) => import("./UnistyleRegistry").UnistyleRegistry;
10
10
  addConfig: (config: import("./types").UnistylesConfig) => import("./UnistyleRegistry").UnistyleRegistry;
11
11
  };
12
+ export declare const __dangerouslyUnregister: () => void;
12
13
  export { UnistylesRuntime, UnistylesRegistry };
13
14
  export { ScreenOrientation };
14
15
  export type { UnistylesThemes, UnistylesBreakpoints };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,QAAA,MAAM,gBAAgB,+CAAoB,CAAA;AAC1C,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACpB,CAAA;AAED,OAAO,EACH,iBAAiB,EACpB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,QAAA,MAAM,gBAAgB,+CAAoB,CAAA;AAC1C,QAAA,MAAM,iBAAiB;;;;CAItB,CAAA;AAED,eAAO,MAAM,uBAAuB,YAA2C,CAAA;AAE/E,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACpB,CAAA;AAED,OAAO,EACH,iBAAiB,EACpB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACvB,CAAA"}