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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/ios/UnistylesModule.mm +8 -3
  2. package/lib/commonjs/types/cxx.js +1 -2
  3. package/lib/commonjs/types/cxx.js.map +1 -1
  4. package/lib/commonjs/useStyles.js.map +1 -1
  5. package/lib/commonjs/useUnistyles.js +9 -15
  6. package/lib/commonjs/useUnistyles.js.map +1 -1
  7. package/lib/commonjs/utils/breakpoints.js +12 -2
  8. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  9. package/lib/commonjs/utils/common.js +6 -1
  10. package/lib/commonjs/utils/common.js.map +1 -1
  11. package/lib/commonjs/utils/index.js +7 -0
  12. package/lib/commonjs/utils/index.js.map +1 -1
  13. package/lib/commonjs/utils/mediaQueries.js +9 -2
  14. package/lib/commonjs/utils/mediaQueries.js.map +1 -1
  15. package/lib/module/types/cxx.js +1 -2
  16. package/lib/module/types/cxx.js.map +1 -1
  17. package/lib/module/useStyles.js.map +1 -1
  18. package/lib/module/useUnistyles.js +9 -15
  19. package/lib/module/useUnistyles.js.map +1 -1
  20. package/lib/module/utils/breakpoints.js +13 -3
  21. package/lib/module/utils/breakpoints.js.map +1 -1
  22. package/lib/module/utils/common.js +5 -0
  23. package/lib/module/utils/common.js.map +1 -1
  24. package/lib/module/utils/index.js +1 -1
  25. package/lib/module/utils/index.js.map +1 -1
  26. package/lib/module/utils/mediaQueries.js +9 -2
  27. package/lib/module/utils/mediaQueries.js.map +1 -1
  28. package/lib/typescript/src/UnistylesRuntime.d.ts +2 -2
  29. package/lib/typescript/src/UnistylesRuntime.d.ts.map +1 -1
  30. package/lib/typescript/src/global.d.ts +2 -1
  31. package/lib/typescript/src/global.d.ts.map +1 -1
  32. package/lib/typescript/src/types/cxx.d.ts +8 -13
  33. package/lib/typescript/src/types/cxx.d.ts.map +1 -1
  34. package/lib/typescript/src/useStyles.d.ts +1 -1
  35. package/lib/typescript/src/useUnistyles.d.ts +3 -1
  36. package/lib/typescript/src/useUnistyles.d.ts.map +1 -1
  37. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  38. package/lib/typescript/src/utils/common.d.ts +5 -0
  39. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  40. package/lib/typescript/src/utils/index.d.ts +1 -1
  41. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  42. package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/src/global.ts +2 -1
  45. package/src/types/cxx.ts +9 -15
  46. package/src/useStyles.ts +2 -2
  47. package/src/useUnistyles.ts +12 -24
  48. package/src/utils/breakpoints.ts +17 -3
  49. package/src/utils/common.ts +6 -0
  50. package/src/utils/index.ts +1 -1
  51. package/src/utils/mediaQueries.ts +18 -6
@@ -122,11 +122,16 @@ void registerUnistylesHostObject(jsi::Runtime &runtime, UnistylesModule* weakSel
122
122
 
123
123
  [weakSelf emitEvent:@"onChange" withBody:body];
124
124
  };
125
- UnistylesBreakpointChangeEvent onBreakpointChange = ^(std::string breakpoint) {
125
+ UnistylesBreakpointChangeEvent onBreakpointChange = ^(std::string breakpoint, int orientation, int width, int height) {
126
126
  NSDictionary *body = @{
127
- @"type": @"breakpoint",
127
+ @"type": @"layout",
128
128
  @"payload": @{
129
- @"breakpoint": cxxStringToNSString(breakpoint)
129
+ @"breakpoint": cxxStringToNSString(breakpoint),
130
+ @"orientation": @(orientation),
131
+ @"screen": @{
132
+ @"width": @(width),
133
+ @"height": @(height)
134
+ }
130
135
  }
131
136
  };
132
137
 
@@ -11,8 +11,7 @@ let ScreenOrientation = exports.ScreenOrientation = /*#__PURE__*/function (Scree
11
11
  }({});
12
12
  let CxxUnistylesEventTypes = exports.CxxUnistylesEventTypes = /*#__PURE__*/function (CxxUnistylesEventTypes) {
13
13
  CxxUnistylesEventTypes["Theme"] = "theme";
14
- CxxUnistylesEventTypes["Size"] = "size";
15
- CxxUnistylesEventTypes["Breakpoint"] = "breakpoint";
14
+ CxxUnistylesEventTypes["Layout"] = "layout";
16
15
  return CxxUnistylesEventTypes;
17
16
  }({});
18
17
  let UnistylesError = exports.UnistylesError = /*#__PURE__*/function (UnistylesError) {
@@ -1 +1 @@
1
- {"version":3,"names":["ScreenOrientation","exports","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":";;;;;;IASYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAAA,IAyBjBE,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IA8BtBC,cAAc,GAAAF,OAAA,CAAAE,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
1
+ {"version":3,"names":["ScreenOrientation","exports","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":";;;;;;IAUYA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAAA,IAyBjBE,sBAAsB,GAAAD,OAAA,CAAAC,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IAuBtBC,cAAc,GAAAF,OAAA,CAAAE,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_utils","_useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","useUnistyles","styles","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","proxifyFunction","StyleSheet","create","parseStyle","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAGA;;AAGO,MAAMI,SAAS,GAAsCC,UAA4C,IAAK;EACzG,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAG,IAAAC,0BAAY,EAAC,CAAC;EAExD,IAAI,CAACJ,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLC,UAAU;MACVG,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOP,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAM,CAAC,GAClBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMQ,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,CAAC,CACrBK,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,GAAG,IAAAG,sBAAe,EAACF,KAAK,EAAEb,UAAU,EAAGC,UAAU;MACzD,CAAC;IACL;IAEA,OAAOe,uBAAU,CAACC,MAAM,CAAC;MACrB,GAAGP,GAAG;MACN,CAACE,GAAG,GAAG,IAAAM,iBAAU,EAAKJ,KAAK,EAAEd,UAAU,EAAGC,UAAU;IACxD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACD,UAAU,EAAEC,UAAU,EAAEG,YAAY,CAAC,CAAC;EAEzD,OAAO;IACHL,KAAK;IACLC,UAAU;IACVG,MAAM,EAAEG;EACZ,CAAC;AACL,CAAC;AAAAa,OAAA,CAAAtB,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_react","require","_reactNative","_utils","_useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","useUnistyles","styles","parsedStyles","useMemo","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","proxifyFunction","StyleSheet","create","parseStyle","exports"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAH,OAAA;AAGA;;AAGO,MAAMI,SAAS,GAAsCC,UAA4C,IAAK;EACzG,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAG,IAAAC,0BAAY,EAAC,CAAC;EAExD,IAAI,CAACJ,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLC,UAAU;MACVG,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAG,IAAAC,cAAO,EAAC,MAAM,OAAOP,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAM,CAAC,GAClBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMQ,iBAAiB,GAAG,IAAAD,cAAO,EAAC,MAAME,MAAM,CACzCC,OAAO,CAACJ,YAAY,CAAC,CACrBK,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,GAAG,IAAAG,sBAAe,EAACF,KAAK,EAAEb,UAAU,EAAEC,UAAU;MACxD,CAAC;IACL;IAEA,OAAOe,uBAAU,CAACC,MAAM,CAAC;MACrB,GAAGP,GAAG;MACN,CAACE,GAAG,GAAG,IAAAM,iBAAU,EAAKJ,KAAK,EAAEd,UAAU,EAAEC,UAAU;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACD,UAAU,EAAEC,UAAU,EAAEG,YAAY,CAAC,CAAC;EAEzD,OAAO;IACHL,KAAK;IACLC,UAAU;IACVG,MAAM,EAAEG;EACZ,CAAC;AACL,CAAC;AAAAa,OAAA,CAAAtB,SAAA,GAAAA,SAAA"}
@@ -10,11 +10,12 @@ var _types = require("./types");
10
10
  var _Unistyles = require("./Unistyles");
11
11
  const unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
12
12
  const useUnistyles = () => {
13
+ const [orientation, setOrientation] = (0, _react.useState)(_Unistyles.unistyles.runtime.orientation);
13
14
  const [theme, setTheme] = (0, _react.useState)(_Unistyles.unistyles.runtime.getTheme(_Unistyles.unistyles.runtime.themeName));
14
15
  const [breakpoint, setBreakpoint] = (0, _react.useState)(_Unistyles.unistyles.runtime.breakpoint);
15
16
  const [screenSize, setScreenSize] = (0, _react.useState)({
16
- width: 0,
17
- height: 0
17
+ width: _Unistyles.unistyles.runtime.screen.width,
18
+ height: _Unistyles.unistyles.runtime.screen.height
18
19
  });
19
20
  (0, _react.useEffect)(() => {
20
21
  const subscription = unistylesEvents.addListener('onChange', event => {
@@ -25,20 +26,12 @@ const useUnistyles = () => {
25
26
  setTheme(_Unistyles.unistyles.runtime.getTheme(themeEvent.payload.themeName));
26
27
  return;
27
28
  }
28
- // this event is not available on mobile
29
- case _types.CxxUnistylesEventTypes.Size:
29
+ case _types.CxxUnistylesEventTypes.Layout:
30
30
  {
31
- const sizeEvent = event;
32
- setScreenSize({
33
- width: sizeEvent.payload.width,
34
- height: sizeEvent.payload.height
35
- });
36
- return;
37
- }
38
- case _types.CxxUnistylesEventTypes.Breakpoint:
39
- {
40
- const breakpointEvent = event;
41
- setBreakpoint(breakpointEvent.payload.breakpoint);
31
+ const layoutEvent = event;
32
+ setBreakpoint(layoutEvent.payload.breakpoint);
33
+ setOrientation(layoutEvent.payload.orientation);
34
+ setScreenSize(layoutEvent.payload.screen);
42
35
  return;
43
36
  }
44
37
  default:
@@ -49,6 +42,7 @@ const useUnistyles = () => {
49
42
  }, []);
50
43
  return {
51
44
  theme,
45
+ orientation,
52
46
  breakpoint,
53
47
  screenSize
54
48
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_react","_types","_Unistyles","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","theme","setTheme","useState","unistyles","runtime","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","height","useEffect","subscription","addListener","event","type","CxxUnistylesEventTypes","Theme","themeEvent","payload","Size","sizeEvent","Breakpoint","breakpointEvent","remove","exports"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACC,oBAAS,CAACC,OAAO,CAACC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","_types","_Unistyles","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","orientation","setOrientation","useState","unistyles","runtime","theme","setTheme","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","screen","height","useEffect","subscription","addListener","event","type","CxxUnistylesEventTypes","Theme","themeEvent","payload","Layout","layoutEvent","remove","exports"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,MAAMI,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;AAEhE,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAC,eAAQ,EAAoBC,oBAAS,CAACC,OAAO,CAACJ,WAAW,CAAC;EAChG,MAAM,CAACK,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAJ,eAAQ,EAACC,oBAAS,CAACC,OAAO,CAACG,QAAQ,CAACJ,oBAAS,CAACC,OAAO,CAACI,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAR,eAAQ,EAACC,oBAAS,CAACC,OAAO,CAACK,UAAU,CAAC;EAC1E,MAAM,CAACE,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAV,eAAQ,EAAC;IACzCW,KAAK,EAAEV,oBAAS,CAACC,OAAO,CAACU,MAAM,CAACD,KAAK;IACrCE,MAAM,EAAEZ,oBAAS,CAACC,OAAO,CAACU,MAAM,CAACC;EACrC,CAAC,CAAC;EAEF,IAAAC,gBAAS,EAAC,MAAM;IACZ,MAAMC,YAAY,GAAGtB,eAAe,CAACuB,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKC,6BAAsB,CAACC,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGJ,KAA4B;YAE/Cb,QAAQ,CAACH,oBAAS,CAACC,OAAO,CAACG,QAAQ,CAACgB,UAAU,CAACC,OAAO,CAAChB,SAAS,CAAC,CAAC;YAElE;UACJ;QACA,KAAKa,6BAAsB,CAACI,MAAM;UAAE;YAChC,MAAMC,WAAW,GAAGP,KAAmC;YAEvDT,aAAa,CAACgB,WAAW,CAACF,OAAO,CAACf,UAAU,CAAC;YAC7CR,cAAc,CAACyB,WAAW,CAACF,OAAO,CAACxB,WAAW,CAAC;YAC/CY,aAAa,CAACc,WAAW,CAACF,OAAO,CAACV,MAAM,CAAC;YAEzC;UACJ;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOG,YAAY,CAACU,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHtB,KAAK;IACLL,WAAW;IACXS,UAAU;IACVE;EACJ,CAAC;AACL,CAAC;AAAAiB,OAAA,CAAA7B,YAAA,GAAAA,YAAA"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.sortAndValidateBreakpoints = exports.getValueForBreakpoint = exports.getBreakpointFromScreenWidth = void 0;
7
7
  var _Unistyles = require("../Unistyles");
8
8
  var _common = require("./common");
9
+ var _types = require("../types");
9
10
  var _mediaQueries = require("./mediaQueries");
10
11
  /**
11
12
  * Sorts the breakpoints object based on its numeric values in ascending order and validates them.
@@ -109,7 +110,16 @@ const getValueForBreakpoint = (value, breakpoint, screenSize) => {
109
110
  return value[customMediaQueryKey];
110
111
  }
111
112
 
112
- // if no custom media query, or didn't match, proceed with defined breakpoints
113
+ // at this point user didn't use custom media queries (:w, :h)
114
+ // check if user defined any breakpoints
115
+ const hasBreakpoints = _Unistyles.unistyles.runtime.sortedBreakpoints.length > 0;
116
+
117
+ // if not then we can fallback to horizontal and portrait (mobile only)
118
+ if (!hasBreakpoints && _common.isMobile && (_common.Orientation.Landscape in value || _common.Orientation.Portrait in value)) {
119
+ return value[_Unistyles.unistyles.runtime.orientation === _types.ScreenOrientation.Portrait ? _common.Orientation.Portrait : _common.Orientation.Landscape];
120
+ }
121
+
122
+ // if user defined breakpoints, then we look for the valid one
113
123
  const unifiedKey = breakpoint?.toLowerCase();
114
124
  const directBreakpoint = value[unifiedKey];
115
125
 
@@ -118,7 +128,7 @@ const getValueForBreakpoint = (value, breakpoint, screenSize) => {
118
128
  return directBreakpoint;
119
129
  }
120
130
 
121
- // there is no direct hit for breakpoint nor media-query, so let's simulate CSS cascading
131
+ // there is no direct hit for breakpoint nor media-query, let's simulate CSS cascading
122
132
  const breakpointPairs = _Unistyles.unistyles.runtime.sortedBreakpoints;
123
133
  const currentBreakpoint = breakpointPairs.findIndex(_ref3 => {
124
134
  let [key] = _ref3;
@@ -1 +1 @@
1
- {"version":3,"names":["_Unistyles","require","_common","_mediaQueries","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","throwError","length","Set","size","exports","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","isMediaQuery","customMediaQueryKey","getKeyForCustomMediaQuery","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","unistyles","runtime","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,aAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,0BAA0B,GAAIC,WA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AAC,CAAAe,KAAA,EAAQxB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAA2B,KAAA;IAAA,OAAYxB,KAAK,GAAGoB,iBAAiB,IAAIvB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EuB,GAAG,CAACC,KAAA;IAAA,IAAC,CAAC7B,GAAG,CAAC,GAAA6B,KAAA;IAAA,OAAK7B,GAAG;EAAA,EAAC;EAExB,OAAOoB,eAAe,CAAC3B,MAAM,GAAG,CAAC,GAC3BY,KAAK,CAACqB,oBAAoB,CAACA,oBAAoB,CAACjC,MAAM,GAAG,CAAC,CAAC,CAAwC,GACnGqC,SAAS;AACnB,CAAC;AAAAlC,OAAA,CAAAY,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_Unistyles","require","_common","_types","_mediaQueries","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","throwError","length","Set","size","exports","getBreakpointFromScreenWidth","width","breakpointEntries","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","isMediaQuery","customMediaQueryKey","getKeyForCustomMediaQuery","hasBreakpoints","unistyles","runtime","isMobile","Orientation","Landscape","Portrait","orientation","ScreenOrientation","unifiedKey","toLowerCase","directBreakpoint","breakpointPairs","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,M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EAClE,MAAMC,gBAAgB,GAAGvB,KAAK,CAACqB,UAAU,CAAC;;EAE1C;EACA,IAAIE,gBAAgB,IAAKF,UAAU,IAAIrB,KAAM,EAAE;IAC3C,OAAOuB,gBAAgB;EAC3B;;EAEA;EACA,MAAMC,eAAe,GAAGX,oBAAS,CAACC,OAAO,CAACjC,iBAAiB;EAC3D,MAAM4C,iBAAiB,GAAGD,eAAe,CACpCE,SAAS,CAACC,KAAA;IAAA,IAAC,CAAChC,GAAG,CAAC,GAAAgC,KAAA;IAAA,OAAKhC,GAAG,KAAK0B,UAAU;EAAA,EAAC;EAE7C,MAAMO,oBAAoB,GAAGJ,eAAe,CACvCjB,MAAM,CAAC,CAAAsB,KAAA,EAAQ/B,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAAkC,KAAA;IAAA,OAAY/B,KAAK,GAAG2B,iBAAiB,IAAI9B,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1E8B,GAAG,CAACC,KAAA;IAAA,IAAC,CAACpC,GAAG,CAAC,GAAAoC,KAAA;IAAA,OAAKpC,GAAG;EAAA,EAAC;EAExB,OAAO6B,eAAe,CAACpC,MAAM,GAAG,CAAC,GAC3BY,KAAK,CAAC4B,oBAAoB,CAACA,oBAAoB,CAACxC,MAAM,GAAG,CAAC,CAAC,CAAwC,GACnG4C,SAAS;AACnB,CAAC;AAAAzC,OAAA,CAAAY,qBAAA,GAAAA,qBAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.warn = exports.throwError = exports.isWeb = exports.isServer = void 0;
6
+ exports.warn = exports.throwError = exports.isWeb = exports.isServer = exports.isMobile = exports.Orientation = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  const throwError = message => {
9
9
  throw new Error(`🦄 [react-native-unistyles]: ${message}`);
@@ -13,6 +13,11 @@ const warn = message => {
13
13
  console.warn(`🦄 [react-native-unistyles]: ${message}`);
14
14
  };
15
15
  exports.warn = warn;
16
+ const isMobile = exports.isMobile = _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios';
16
17
  const isWeb = exports.isWeb = _reactNative.Platform.OS === 'web';
17
18
  const isServer = exports.isServer = typeof window === 'undefined';
19
+ const Orientation = exports.Orientation = {
20
+ Landscape: 'landscape',
21
+ Portrait: 'portrait'
22
+ };
18
23
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","throwError","message","Error","exports","warn","console","isWeb","Platform","OS","isServer","window"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAAAE,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEM,MAAMI,IAAI,GAAIH,OAAe,IAAK;EACrCI,OAAO,CAACD,IAAI,CAAE,gCAA+BH,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAC,IAAA,GAAAA,IAAA;AAEM,MAAME,KAAK,GAAAH,OAAA,CAAAG,KAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAMC,QAAQ,GAAAN,OAAA,CAAAM,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW"}
1
+ {"version":3,"names":["_reactNative","require","throwError","message","Error","exports","warn","console","isMobile","Platform","OS","isWeb","isServer","window","Orientation","Landscape","Portrait"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAAAE,OAAA,CAAAH,UAAA,GAAAA,UAAA;AAEM,MAAMI,IAAI,GAAIH,OAAe,IAAK;EACrCI,OAAO,CAACD,IAAI,CAAE,gCAA+BH,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAAAE,OAAA,CAAAC,IAAA,GAAAA,IAAA;AAEM,MAAME,QAAQ,GAAAH,OAAA,CAAAG,QAAA,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAID,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnE,MAAMC,KAAK,GAAAN,OAAA,CAAAM,KAAA,GAAGF,qBAAQ,CAACC,EAAE,KAAK,KAAK;AACnC,MAAME,QAAQ,GAAAP,OAAA,CAAAO,QAAA,GAAG,OAAOC,MAAM,KAAK,WAAW;AAE9C,MAAMC,WAAW,GAAAT,OAAA,CAAAS,WAAA,GAAG;EACvBC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU"}
@@ -11,6 +11,7 @@ var _exportNames = {
11
11
  proxifyFunction: true,
12
12
  parseStyle: true,
13
13
  isServer: true,
14
+ Orientation: true,
14
15
  extractValues: true,
15
16
  getKeyForCustomMediaQuery: true,
16
17
  isMediaQuery: true,
@@ -18,6 +19,12 @@ var _exportNames = {
18
19
  isWithinTheWidth: true,
19
20
  isWithinTheWidthAndHeight: true
20
21
  };
22
+ Object.defineProperty(exports, "Orientation", {
23
+ enumerable: true,
24
+ get: function () {
25
+ return _common.Orientation;
26
+ }
27
+ });
21
28
  Object.defineProperty(exports, "extractValues", {
22
29
  enumerable: true,
23
30
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_normalizeStyles","require","_normalizer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_breakpoints","_styles","_common","_mediaQueries"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,YAAA,GAAAd,OAAA;AACA,IAAAe,OAAA,GAAAf,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA"}
1
+ {"version":3,"names":["_normalizeStyles","require","_normalizer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_breakpoints","_styles","_common","_mediaQueries"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,YAAA,GAAAd,OAAA;AACA,IAAAe,OAAA,GAAAf,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA"}
@@ -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,GAAI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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;AAtBAF,OAAA,CAAAqB,YAAA,GAAAA,YAAA;AAuBO,MAAMG,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,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":"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AAG,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,CACLnC,KAAK,CAAC,GAAG,CAAC,CACVsB,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"}
@@ -5,8 +5,7 @@ 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) {
@@ -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;AAyB7B,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AA8BlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,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 +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;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,EAAGC,UAAU;MACzD,CAAC;IACL;IAEA,OAAOR,UAAU,CAACoB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGhB,UAAU,CAAKkB,KAAK,EAAEZ,UAAU,EAAGC,UAAU;IACxD,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"}
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;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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AACe,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,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAGV,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACG,QAAQ,CAACT,SAAS,CAACM,OAAO,CAACI,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGd,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACK,UAAU,CAAC;EAC1E,MAAM,CAACE,UAAU,EAAEC,aAAa,CAAC,GAAGhB,QAAQ,CAAC;IACzCiB,KAAK,EAAEf,SAAS,CAACM,OAAO,CAACU,MAAM,CAACD,KAAK;IACrCE,MAAM,EAAEjB,SAAS,CAACM,OAAO,CAACU,MAAM,CAACC;EACrC,CAAC,CAAC;EAEFpB,SAAS,CAAC,MAAM;IACZ,MAAMqB,YAAY,GAAGjB,eAAe,CAACkB,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKtB,sBAAsB,CAACuB,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGH,KAA4B;YAE/CZ,QAAQ,CAACR,SAAS,CAACM,OAAO,CAACG,QAAQ,CAACc,UAAU,CAACC,OAAO,CAACd,SAAS,CAAC,CAAC;YAElE;UACJ;QACA,KAAKX,sBAAsB,CAAC0B,MAAM;UAAE;YAChC,MAAMC,WAAW,GAAGN,KAAmC;YAEvDR,aAAa,CAACc,WAAW,CAACF,OAAO,CAACb,UAAU,CAAC;YAC7CN,cAAc,CAACqB,WAAW,CAACF,OAAO,CAACpB,WAAW,CAAC;YAC/CU,aAAa,CAACY,WAAW,CAACF,OAAO,CAACR,MAAM,CAAC;YAEzC;UACJ;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOE,YAAY,CAACS,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHpB,KAAK;IACLH,WAAW;IACXO,UAAU;IACVE;EACJ,CAAC;AACL,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { 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;A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,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"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ,UAAU;AAE5D,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,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,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AAOiB,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,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;AACA,OAAO,MAAMK,kBAAkB,G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;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;EAE7E,IAAI,CAACD,KAAK,EAAE;IACR,MAAME,EAAE,GAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GACzBC,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GACpCM,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IAE9C,OAAO,CAACI,EAAE,CAAC;EACf;EAEA,MAAMA,EAAE,GAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GACzBC,MAAM,C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C,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"}
@@ -8,9 +8,9 @@ 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(): ["default", 0 | undefined][];
11
+ get sortedBreakpoints(): [keyof import("./global").UnistylesBreakpoints, number | undefined][];
12
12
  get themeName(): never;
13
- get breakpoint(): "default";
13
+ get breakpoint(): keyof import("./global").UnistylesBreakpoints;
14
14
  get screen(): {
15
15
  width: number;
16
16
  height: number;
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../src/Unist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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,6 +1,7 @@
1
1
  export interface UnistylesThemes {
2
2
  }
3
3
  export interface UnistylesBreakpoints {
4
- default?: 0;
4
+ landscape?: number;
5
+ portrait?: number;
5
6
  }
6
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;IACjC,OAAO,CAAC,EAAE,CAAC,CAAA;CACd"}
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,4 +1,5 @@
1
1
  import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
2
+ import type { ScreenSize } from './breakpoints';
2
3
  export type Nullable<T> = T | null;
3
4
  export type ColorSchemeName = 'light' | 'dark' | undefined;
4
5
  export type UnistylesConfig = {
@@ -24,29 +25,23 @@ export type UnistylesBridge = {
24
25
  };
25
26
  export declare enum CxxUnistylesEventTypes {
26
27
  Theme = "theme",
27
- Size = "size",
28
- Breakpoint = "breakpoint"
28
+ Layout = "layout"
29
29
  }
30
- export type CxxUnistylesThemeEvent = {
30
+ export type UnistylesThemeEvent = {
31
31
  type: CxxUnistylesEventTypes.Theme;
32
32
  payload: {
33
33
  themeName: keyof UnistylesThemes;
34
34
  };
35
35
  };
36
- export type CxxUnistylesSizeEvent = {
37
- type: CxxUnistylesEventTypes.Size;
38
- payload: {
39
- width: number;
40
- height: number;
41
- };
42
- };
43
- export type CxxUnistylesBreakpointEvent = {
44
- type: CxxUnistylesEventTypes.Breakpoint;
36
+ export type UnistylesMobileLayoutEvent = {
37
+ type: CxxUnistylesEventTypes.Layout;
45
38
  payload: {
39
+ screen: ScreenSize;
46
40
  breakpoint: keyof UnistylesBreakpoints;
41
+ orientation: ScreenOrientation;
47
42
  };
48
43
  };
49
- export type UnistylesEvents = CxxUnistylesThemeEvent | CxxUnistylesSizeEvent | CxxUnistylesBreakpointEvent;
44
+ export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent;
50
45
  export declare enum UnistylesError {
51
46
  RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
52
47
  ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
@@ -1 +1 @@
1
- {"version":3,"file":"cxx.d.ts","sourceRoot":"","sources":["../../../../src/types/cxx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEtE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAClC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,oBAAY,iBAAiB;IACzB,QAAQ,IAAI;IACZ,SAAS,IAAI;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAE1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,WAAW,E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,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,iBAAiB,CAAA;KACjC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,CAAA;AAE9E,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF"}
@@ -3,7 +3,7 @@ import type { UnistylesThemes } from './global';
3
3
  type T = UnistylesThemes[keyof UnistylesThemes];
4
4
  export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined) => {
5
5
  theme: never;
6
- breakpoint: "default";
6
+ breakpoint: "landscape" | "portrait";
7
7
  styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST>>;
8
8
  };
9
9
  export {};
@@ -1,6 +1,8 @@
1
+ import { ScreenOrientation } from './types';
1
2
  export declare const useUnistyles: () => {
2
3
  theme: never;
3
- breakpoint: "default";
4
+ orientation: ScreenOrientation;
5
+ breakpoint: "landscape" | "portrait";
4
6
  screenSize: {
5
7
  width: number;
6
8
  height: number;
@@ -1 +1 @@
1
- {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../src/useUnistyles.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY;;;;;;;CAoDxB,CAAA"}
1
+ {"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../src/useUnistyles.ts"],"names":[],"mappings":"AAGA,OAAO,EAA0B,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAKnE,eAAO,MAAM,YAAY;;;;;;;;CA6CxB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,gBAAiB,oBAAoB,KAAG,oBAuB9E,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,4BAA4B,UAAW,MAAM,qBAAqB,MAAM,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,KAAG,MAAM,oBAAoB,GAAG,MAcnM,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qBAAqB,UACvB,OAAO,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,cACzE,MAAM,oBAAoB,cAC1B,UAAU,KACvB,MAAM,GAAG,MAAM,GAAG,SAgCpB,CAAA"}
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/utils/breakpoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,gBAAiB,oBAAoB,KAAG,oBAuB9E,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,4BAA4B,UAAW,MAAM,qBAAqB,MAAM,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,KAAG,MAAM,oBAAoB,GAAG,MAcnM,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qBAAqB,UACvB,OAAO,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,cACzE,MAAM,oBAAoB,cAC1B,UAAU,KACvB,MAAM,GAAG,MAAM,GAAG,SA6CpB,CAAA"}
@@ -1,5 +1,10 @@
1
1
  export declare const throwError: (message: string) => never;
2
2
  export declare const warn: (message: string) => void;
3
+ export declare const isMobile: boolean;
3
4
  export declare const isWeb: boolean;
4
5
  export declare const isServer: boolean;
6
+ export declare const Orientation: {
7
+ readonly Landscape: "landscape";
8
+ readonly Portrait: "portrait";
9
+ };
5
10
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/utils/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAAa,MAAM,UAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,QAAQ,SAAqD,CAAA;AAC1E,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,WAAW;;;CAGd,CAAA"}
@@ -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.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC/G,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EACH,aAAa,EACb,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/utils/mediaQueries.ts"],"names":[],"mappings":"A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A;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,UAAU,MAAM,KAAG,OAQjE,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,UAAW,MAAM,cAAc,UAAU,KAAG,OAQjF,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,OAI5C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,iBAAkB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,cAAc,UAAU,KAAG,MAAM,GAAG,SAevI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.5",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
package/src/global.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export interface UnistylesThemes {}
2
2
  export interface UnistylesBreakpoints {
3
- default?: 0
3
+ landscape?: number,
4
+ portrait?: number,
4
5
  }
package/src/types/cxx.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { UnistylesThemes, UnistylesBreakpoints } from '../global'
2
+ import type { ScreenSize } from './breakpoints'
2
3
 
3
4
  export type Nullable<T> = T | null
4
5
  export type ColorSchemeName = 'light' | 'dark' | undefined
@@ -34,33 +35,26 @@ export type UnistylesBridge = {
34
35
 
35
36
  export enum CxxUnistylesEventTypes {
36
37
  Theme = 'theme',
37
- Size = 'size',
38
- Breakpoint = 'breakpoint'
38
+ Layout = 'layout'
39
39
  }
40
40
 
41
- export type CxxUnistylesThemeEvent = {
41
+ export type UnistylesThemeEvent = {
42
42
  type: CxxUnistylesEventTypes.Theme,
43
43
  payload: {
44
44
  themeName: keyof UnistylesThemes
45
45
  }
46
46
  }
47
47
 
48
- export type CxxUnistylesSizeEvent = {
49
- type: CxxUnistylesEventTypes.Size,
48
+ export type UnistylesMobileLayoutEvent = {
49
+ type: CxxUnistylesEventTypes.Layout,
50
50
  payload: {
51
- width: number,
52
- height: number
51
+ screen: ScreenSize,
52
+ breakpoint: keyof UnistylesBreakpoints,
53
+ orientation: ScreenOrientation
53
54
  }
54
55
  }
55
56
 
56
- export type CxxUnistylesBreakpointEvent = {
57
- type: CxxUnistylesEventTypes.Breakpoint,
58
- payload: {
59
- breakpoint: keyof UnistylesBreakpoints
60
- }
61
- }
62
-
63
- export type UnistylesEvents = CxxUnistylesThemeEvent | CxxUnistylesSizeEvent | CxxUnistylesBreakpointEvent
57
+ export type UnistylesEvents = UnistylesThemeEvent | UnistylesMobileLayoutEvent
64
58
 
65
59
  export enum UnistylesError {
66
60
  RuntimeUnavailable = 'UNISTYLES_ERROR_RUNTIME_UNAVAILABLE',
package/src/useStyles.ts CHANGED
@@ -31,13 +31,13 @@ export const useStyles = <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | Cr
31
31
  if (typeof value === 'function') {
32
32
  return {
33
33
  ...acc,
34
- [key]: proxifyFunction(value, breakpoint!, screenSize)
34
+ [key]: proxifyFunction(value, breakpoint, screenSize)
35
35
  }
36
36
  }
37
37
 
38
38
  return StyleSheet.create({
39
39
  ...acc,
40
- [key]: parseStyle<ST>(style, breakpoint!, screenSize)
40
+ [key]: parseStyle<ST>(style, breakpoint, screenSize)
41
41
  })
42
42
  }, {} as ST), [breakpoint, screenSize, parsedStyles])
43
43
 
@@ -1,22 +1,18 @@
1
1
  import { NativeEventEmitter, NativeModules } from 'react-native'
2
2
  import { useEffect, useState } from 'react'
3
- import type {
4
- CxxUnistylesBreakpointEvent,
5
- CxxUnistylesSizeEvent,
6
- CxxUnistylesThemeEvent,
7
- UnistylesEvents
8
- } from './types'
9
- import { CxxUnistylesEventTypes } from './types'
3
+ import type { UnistylesThemeEvent, UnistylesMobileLayoutEvent, UnistylesEvents } from './types'
4
+ import { CxxUnistylesEventTypes, ScreenOrientation } from './types'
10
5
  import { unistyles } from './Unistyles'
11
6
 
12
7
  const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles)
13
8
 
14
9
  export const useUnistyles = () => {
10
+ const [orientation, setOrientation] = useState<ScreenOrientation>(unistyles.runtime.orientation)
15
11
  const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName))
16
12
  const [breakpoint, setBreakpoint] = useState(unistyles.runtime.breakpoint)
17
13
  const [screenSize, setScreenSize] = useState({
18
- width: 0,
19
- height: 0
14
+ width: unistyles.runtime.screen.width,
15
+ height: unistyles.runtime.screen.height
20
16
  })
21
17
 
22
18
  useEffect(() => {
@@ -25,27 +21,18 @@ export const useUnistyles = () => {
25
21
  (event: UnistylesEvents) => {
26
22
  switch (event.type) {
27
23
  case CxxUnistylesEventTypes.Theme: {
28
- const themeEvent = event as CxxUnistylesThemeEvent
24
+ const themeEvent = event as UnistylesThemeEvent
29
25
 
30
26
  setTheme(unistyles.runtime.getTheme(themeEvent.payload.themeName))
31
27
 
32
28
  return
33
29
  }
34
- // this event is not available on mobile
35
- case CxxUnistylesEventTypes.Size: {
36
- const sizeEvent = event as CxxUnistylesSizeEvent
30
+ case CxxUnistylesEventTypes.Layout: {
31
+ const layoutEvent = event as UnistylesMobileLayoutEvent
37
32
 
38
- setScreenSize({
39
- width: sizeEvent.payload.width,
40
- height: sizeEvent.payload.height
41
- })
42
-
43
- return
44
- }
45
- case CxxUnistylesEventTypes.Breakpoint: {
46
- const breakpointEvent = event as CxxUnistylesBreakpointEvent
47
-
48
- setBreakpoint(breakpointEvent.payload.breakpoint)
33
+ setBreakpoint(layoutEvent.payload.breakpoint)
34
+ setOrientation(layoutEvent.payload.orientation)
35
+ setScreenSize(layoutEvent.payload.screen)
49
36
 
50
37
  return
51
38
  }
@@ -60,6 +47,7 @@ export const useUnistyles = () => {
60
47
 
61
48
  return {
62
49
  theme,
50
+ orientation,
63
51
  breakpoint,
64
52
  screenSize
65
53
  }
@@ -1,6 +1,7 @@
1
1
  import { unistyles } from '../Unistyles'
2
- import { throwError } from './common'
2
+ import { isMobile, Orientation, throwError } from './common'
3
3
  import type { ScreenSize, MediaQueries } from '../types'
4
+ import { ScreenOrientation } from '../types'
4
5
  import { getKeyForCustomMediaQuery, isMediaQuery } from './mediaQueries'
5
6
  import type { UnistylesBreakpoints } from '../global'
6
7
 
@@ -118,7 +119,20 @@ export const getValueForBreakpoint = (
118
119
  return value[customMediaQueryKey]
119
120
  }
120
121
 
121
- // if no custom media query, or didn't match, proceed with defined breakpoints
122
+ // at this point user didn't use custom media queries (:w, :h)
123
+ // check if user defined any breakpoints
124
+ const hasBreakpoints = unistyles.runtime.sortedBreakpoints.length > 0
125
+
126
+ // if not then we can fallback to horizontal and portrait (mobile only)
127
+ if (!hasBreakpoints && isMobile && (Orientation.Landscape in value || Orientation.Portrait in value)) {
128
+ return value[
129
+ unistyles.runtime.orientation === ScreenOrientation.Portrait
130
+ ? Orientation.Portrait
131
+ : Orientation.Landscape
132
+ ]
133
+ }
134
+
135
+ // if user defined breakpoints, then we look for the valid one
122
136
  const unifiedKey = breakpoint?.toLowerCase() as keyof typeof value
123
137
  const directBreakpoint = value[unifiedKey]
124
138
 
@@ -127,7 +141,7 @@ export const getValueForBreakpoint = (
127
141
  return directBreakpoint
128
142
  }
129
143
 
130
- // there is no direct hit for breakpoint nor media-query, so let's simulate CSS cascading
144
+ // there is no direct hit for breakpoint nor media-query, let's simulate CSS cascading
131
145
  const breakpointPairs = unistyles.runtime.sortedBreakpoints
132
146
  const currentBreakpoint = breakpointPairs
133
147
  .findIndex(([key]) => key === unifiedKey)
@@ -8,5 +8,11 @@ export const warn = (message: string) => {
8
8
  console.warn(`🦄 [react-native-unistyles]: ${message}`)
9
9
  }
10
10
 
11
+ export const isMobile = Platform.OS === 'android' || Platform.OS === 'ios'
11
12
  export const isWeb = Platform.OS === 'web'
12
13
  export const isServer = typeof window === 'undefined'
14
+
15
+ export const Orientation = {
16
+ Landscape: 'landscape',
17
+ Portrait: 'portrait'
18
+ } as const
@@ -2,7 +2,7 @@ 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 {
7
7
  extractValues,
8
8
  getKeyForCustomMediaQuery,
@@ -16,13 +16,25 @@ import type { ScreenSize } from '../types'
16
16
  * extractValues("h[100,]") // returns [100]
17
17
  */
18
18
  export const extractValues = (codedValue: string): Array<number> => {
19
- const [lh, rh] = codedValue
20
- .replace(/[wh[\]]/g, '')
21
- .split(',')
19
+ const cleanedValue = codedValue.replace(/[wh ]/g, '')
20
+ const [left, right] = cleanedValue.split(',') as [string, string | undefined]
22
21
 
23
- return rh
24
- ? [Number(lh), Number(rh)]
25
- : [Number(lh)]
22
+ if (!right) {
23
+ const lh = left.startsWith('[')
24
+ ? Number(left.replace(/[[\]()]/g, ''))
25
+ : Number(left.replace(/[[\]()]/g, '')) + 1
26
+
27
+ return [lh]
28
+ }
29
+
30
+ const lh = left.startsWith('[')
31
+ ? Number(left.replace('[', ''))
32
+ : Number(left.replace('(', '')) + 1
33
+ const rh = right.endsWith(']')
34
+ ? Number(right.replace(']', ''))
35
+ : Number(right.replace(')', '')) - 1
36
+
37
+ return [lh, rh]
26
38
  }
27
39
 
28
40
  /**