react-native-unistyles 1.0.0-beta.4 → 1.0.0-beta.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/lib/commonjs/createUnistyles.js +10 -12
  2. package/lib/commonjs/createUnistyles.js.map +1 -1
  3. package/lib/commonjs/mediaQueries.js +2 -0
  4. package/lib/commonjs/mediaQueries.js.map +1 -0
  5. package/lib/commonjs/utils/breakpoints.js +12 -16
  6. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  7. package/lib/commonjs/utils/breakpoints.spec.js +20 -15
  8. package/lib/commonjs/utils/breakpoints.spec.js.map +1 -1
  9. package/lib/commonjs/utils/common.js +8 -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.spec.js +1 -1
  14. package/lib/commonjs/utils/mediaQueries.spec.js.map +1 -1
  15. package/lib/commonjs/utils/normalizeStyles.js +10 -0
  16. package/lib/commonjs/utils/normalizeStyles.js.map +1 -0
  17. package/lib/commonjs/utils/normalizeStyles.web.js +59 -0
  18. package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -0
  19. package/lib/commonjs/utils/styles.js +14 -11
  20. package/lib/commonjs/utils/styles.js.map +1 -1
  21. package/lib/commonjs/utils/styles.spec.js +17 -7
  22. package/lib/commonjs/utils/styles.spec.js.map +1 -1
  23. package/lib/module/createUnistyles.js +10 -12
  24. package/lib/module/createUnistyles.js.map +1 -1
  25. package/lib/module/mediaQueries.js +2 -0
  26. package/lib/module/mediaQueries.js.map +1 -0
  27. package/lib/module/utils/breakpoints.js +12 -16
  28. package/lib/module/utils/breakpoints.js.map +1 -1
  29. package/lib/module/utils/breakpoints.spec.js +20 -15
  30. package/lib/module/utils/breakpoints.spec.js.map +1 -1
  31. package/lib/module/utils/common.js +5 -0
  32. package/lib/module/utils/common.js.map +1 -1
  33. package/lib/module/utils/index.js +1 -0
  34. package/lib/module/utils/index.js.map +1 -1
  35. package/lib/module/utils/mediaQueries.spec.js +1 -1
  36. package/lib/module/utils/mediaQueries.spec.js.map +1 -1
  37. package/lib/module/utils/normalizeStyles.js +3 -0
  38. package/lib/module/utils/normalizeStyles.js.map +1 -0
  39. package/lib/module/utils/normalizeStyles.web.js +52 -0
  40. package/lib/module/utils/normalizeStyles.web.js.map +1 -0
  41. package/lib/module/utils/styles.js +14 -11
  42. package/lib/module/utils/styles.js.map +1 -1
  43. package/lib/module/utils/styles.spec.js +17 -7
  44. package/lib/module/utils/styles.spec.js.map +1 -1
  45. package/lib/typescript/src/createUnistyles.d.ts +2 -2
  46. package/lib/typescript/src/createUnistyles.d.ts.map +1 -1
  47. package/lib/typescript/src/mediaQueries.d.ts +2 -0
  48. package/lib/typescript/src/mediaQueries.d.ts.map +1 -0
  49. package/lib/typescript/src/types.d.ts +35 -13
  50. package/lib/typescript/src/types.d.ts.map +1 -1
  51. package/lib/typescript/src/utils/breakpoints.d.ts +6 -6
  52. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  53. package/lib/typescript/src/utils/common.d.ts +2 -0
  54. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  55. package/lib/typescript/src/utils/index.d.ts +1 -0
  56. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  57. package/lib/typescript/src/utils/normalizeStyles.d.ts +2 -0
  58. package/lib/typescript/src/utils/normalizeStyles.d.ts.map +1 -0
  59. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +2 -0
  60. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -0
  61. package/lib/typescript/src/utils/styles.d.ts +5 -5
  62. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  63. package/package.json +9 -2
  64. package/src/createUnistyles.ts +20 -14
  65. package/src/mediaQueries.ts +33 -0
  66. package/src/types.ts +42 -15
  67. package/src/utils/breakpoints.ts +15 -15
  68. package/src/utils/common.ts +8 -0
  69. package/src/utils/index.ts +1 -0
  70. package/src/utils/normalizeStyles.ts +2 -0
  71. package/src/utils/normalizeStyles.web.ts +103 -0
  72. package/src/utils/styles.ts +20 -14
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createUnistyles = void 0;
7
7
  var _react = require("react");
8
+ var _reactNative = require("react-native");
8
9
  var _UnistylesTheme = require("./UnistylesTheme");
9
- var _utils = require("./utils");
10
10
  var _hooks = require("./hooks");
11
+ var _utils = require("./utils");
11
12
  const createUnistyles = breakpoints => {
12
13
  const sortedBreakpoints = (0, _utils.sortAndValidateBreakpoints)(breakpoints);
14
+ const sortedBreakpointEntries = Object.entries(sortedBreakpoints);
13
15
  return {
14
16
  /**
15
17
  * @deprecated The method should not be used, proposed version by the community is createStyleSheet, will be removed in RC
@@ -28,12 +30,7 @@ const createUnistyles = breakpoints => {
28
30
  },
29
31
  useStyles: stylesheet => {
30
32
  const theme = (0, _react.useContext)(_UnistylesTheme.UnistylesContext);
31
- const dimensions = (0, _hooks.useDimensions)();
32
- const breakpoint = (0, _utils.getBreakpointFromScreenWidth)(dimensions.width, sortedBreakpoints);
33
- const screenSize = {
34
- width: dimensions.width,
35
- height: dimensions.height
36
- };
33
+ const screenSize = (0, _hooks.useDimensions)();
37
34
  if (!stylesheet) {
38
35
  return {
39
36
  theme,
@@ -41,19 +38,20 @@ const createUnistyles = breakpoints => {
41
38
  };
42
39
  }
43
40
  const parsedStyles = typeof stylesheet === 'function' ? stylesheet(theme) : stylesheet;
41
+ const breakpoint = (0, _utils.getBreakpointFromScreenWidth)(screenSize.width, sortedBreakpointEntries);
44
42
  const dynamicStyleSheet = Object.entries(parsedStyles).reduce((acc, _ref) => {
45
43
  let [key, value] = _ref;
46
- const x = value;
44
+ const style = value;
47
45
  if (typeof value === 'function') {
48
46
  return {
49
47
  ...acc,
50
- [key]: (0, _utils.proxifyFunction)(value, breakpoint, screenSize, sortedBreakpoints)
48
+ [key]: (0, _utils.proxifyFunction)(value, breakpoint, screenSize, sortedBreakpointEntries)
51
49
  };
52
50
  }
53
- return {
51
+ return _reactNative.StyleSheet.create({
54
52
  ...acc,
55
- [key]: (0, _utils.parseStyle)(x, breakpoint, screenSize, sortedBreakpoints)
56
- };
53
+ [key]: (0, _utils.parseStyle)(style, breakpoint, screenSize, sortedBreakpointEntries)
54
+ });
57
55
  }, {});
58
56
  return {
59
57
  theme,
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_UnistylesTheme","_utils","_hooks","createUnistyles","breakpoints","sortedBreakpoints","sortAndValidateBreakpoints","createStyles","styles","createStyleSheet","useStyles","stylesheet","theme","useContext","UnistylesContext","dimensions","useDimensions","breakpoint","getBreakpointFromScreenWidth","width","screenSize","height","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","x","proxifyFunction","parseStyle","exports"],"sourceRoot":"../../src","sources":["createUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,MAAMI,eAAe,GAA8CC,WAAc,IAAK;EACzF,MAAMC,iBAAiB,GAAG,IAAAC,iCAA0B,EAACF,WAAW,CAAC;EAEjE,OAAO;IACH;AACR;AACA;IACQG,YAAY,EAAyCC,MAAqF,IAAY;MAClJ,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;QAC9B,OAAOA,MAAM;MACjB;MAEA,OAAOA,MAAM;IACjB,CAAC;IACDC,gBAAgB,EAAyCD,MAAqF,IAAY;MACtJ,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;QAC9B,OAAOA,MAAM;MACjB;MAEA,OAAOA,MAAM;IACjB,CAAC;IACDE,SAAS,EAAwCC,UAA4C,IAAK;MAC9F,MAAMC,KAAK,GAAG,IAAAC,iBAAU,EAACC,gCAAgB,CAAM;MAC/C,MAAMC,UAAU,GAAG,IAAAC,oBAAa,EAAC,CAAC;MAClC,MAAMC,UAAU,GAAG,IAAAC,mCAA4B,EAAIH,UAAU,CAACI,KAAK,EAAEd,iBAAiB,CAAC;MACvF,MAAMe,UAAsB,GAAG;QAC3BD,KAAK,EAAEJ,UAAU,CAACI,KAAK;QACvBE,MAAM,EAAEN,UAAU,CAACM;MACvB,CAAC;MAED,IAAI,CAACV,UAAU,EAAE;QACb,OAAO;UACHC,KAAK;UACLJ,MAAM,EAAE,CAAC;QACb,CAAC;MACL;MAEA,MAAMc,YAAY,GAAG,OAAOX,UAAU,KAAK,UAAU,GAC/CA,UAAU,CAACC,KAAK,CAAC,GACjBD,UAAU;MAEhB,MAAMY,iBAAiB,GAAGC,MAAM,CAC3BC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;QAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;QACtB,MAAMG,CAAC,GAAGD,KAAiC;QAE3C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;UAC7B,OAAO;YACH,GAAGH,GAAG;YACN,CAACE,GAAG,GAAG,IAAAG,sBAAe,EAAIF,KAAK,EAAEb,UAAU,EAAEG,UAAU,EAAEf,iBAAiB;UAC9E,CAAC;QACL;QAEA,OAAO;UACH,GAAGsB,GAAG;UACN,CAACE,GAAG,GAAG,IAAAI,iBAAU,EAAQF,CAAC,EAAEd,UAAU,EAAEG,UAAU,EAAEf,iBAAiB;QACzE,CAAC;MACL,CAAC,EAAE,CAAC,CAAO,CAAC;MAEhB,OAAO;QACHO,KAAK;QACLJ,MAAM,EAAEe;MACZ,CAAC;IACL;EACJ,CAAC;AACL,CAAC;AAAAW,OAAA,CAAA/B,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_react","require","_reactNative","_UnistylesTheme","_hooks","_utils","createUnistyles","breakpoints","sortedBreakpoints","sortAndValidateBreakpoints","sortedBreakpointEntries","Object","entries","createStyles","styles","createStyleSheet","useStyles","stylesheet","theme","useContext","UnistylesContext","screenSize","useDimensions","parsedStyles","breakpoint","getBreakpointFromScreenWidth","width","dynamicStyleSheet","reduce","acc","_ref","key","value","style","proxifyFunction","StyleSheet","create","parseStyle","exports"],"sourceRoot":"../../src","sources":["createUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,MAAMK,eAAe,GAAmCC,WAAc,IAAK;EAC9E,MAAMC,iBAAiB,GAAG,IAAAC,iCAA0B,EAACF,WAAW,CAAC;EACjE,MAAMG,uBAAuB,GAAGC,MAAM,CACjCC,OAAO,CAACJ,iBAAiB,CAA+B;EAE7D,OAAO;IACH;AACR;AACA;IACQK,YAAY,EAAyCC,MAAqF,IAAY;MAClJ,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;QAC9B,OAAOA,MAAM;MACjB;MAEA,OAAOA,MAAM;IACjB,CAAC;IACDC,gBAAgB,EAAyCD,MAAqF,IAAY;MACtJ,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;QAC9B,OAAOA,MAAM;MACjB;MAEA,OAAOA,MAAM;IACjB,CAAC;IACDE,SAAS,EAAwCC,UAA4C,IAAK;MAC9F,MAAMC,KAAK,GAAG,IAAAC,iBAAU,EAACC,gCAAgB,CAAM;MAC/C,MAAMC,UAAU,GAAG,IAAAC,oBAAa,EAAC,CAAC;MAElC,IAAI,CAACL,UAAU,EAAE;QACb,OAAO;UACHC,KAAK;UACLJ,MAAM,EAAE,CAAC;QACb,CAAC;MACL;MAEA,MAAMS,YAAY,GAAG,OAAON,UAAU,KAAK,UAAU,GAC/CA,UAAU,CAACC,KAAK,CAAC,GACjBD,UAAU;MAChB,MAAMO,UAAU,GAAG,IAAAC,mCAA4B,EAAIJ,UAAU,CAACK,KAAK,EAAEhB,uBAAuB,CAAC;MAE7F,MAAMiB,iBAAiB,GAAGhB,MAAM,CAC3BC,OAAO,CAACW,YAAY,CAAC,CACrBK,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;QAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;QACtB,MAAMG,KAAK,GAAGD,KAAiC;QAE/C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;UAC7B,OAAO;YACH,GAAGH,GAAG;YACN,CAACE,GAAG,GAAG,IAAAG,sBAAe,EAAIF,KAAK,EAAER,UAAU,EAAEH,UAAU,EAAEX,uBAAuB;UACpF,CAAC;QACL;QAEA,OAAOyB,uBAAU,CAACC,MAAM,CAAC;UACrB,GAAGP,GAAG;UACN,CAACE,GAAG,GAAG,IAAAM,iBAAU,EAAQJ,KAAK,EAAET,UAAU,EAAEH,UAAU,EAAEX,uBAAuB;QACnF,CAAC,CAAC;MACN,CAAC,EAAE,CAAC,CAAO,CAAC;MAEhB,OAAO;QACHQ,KAAK;QACLJ,MAAM,EAAEa;MACZ,CAAC;IACL;EACJ,CAAC;AACL,CAAC;AAAAW,OAAA,CAAAhC,eAAA,GAAAA,eAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=mediaQueries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["mediaQueries.ts"],"mappings":""}
@@ -51,7 +51,7 @@ const sortAndValidateBreakpoints = breakpoints => {
51
51
  *
52
52
  * @template B - An object type where keys are strings and values are numbers representing screen widths.
53
53
  * @param {number} width - The screen width to determine the breakpoint for.
54
- * @param {B} breakpoints - The breakpoints object to use for determination.
54
+ * @param breakpointEntries - sorted pairs of breakpoints
55
55
  * @returns {keyof B & string} The key of the breakpoint that the screen width falls into.
56
56
  *
57
57
  * @example
@@ -59,8 +59,8 @@ const sortAndValidateBreakpoints = breakpoints => {
59
59
  * getBreakpointFromScreenWidth(800, breakpoints) // returns 'md'
60
60
  */
61
61
  exports.sortAndValidateBreakpoints = sortAndValidateBreakpoints;
62
- const getBreakpointFromScreenWidth = (width, breakpoints) => {
63
- const [key] = Object.entries(breakpoints).find((_ref, index, otherBreakpoints) => {
62
+ const getBreakpointFromScreenWidth = (width, breakpointEntries) => {
63
+ const [key] = breakpointEntries.find((_ref, index, otherBreakpoints) => {
64
64
  let [, value] = _ref;
65
65
  const minVal = value;
66
66
  const maxVal = otherBreakpoints[index + 1]?.[1];
@@ -84,7 +84,7 @@ const getBreakpointFromScreenWidth = (width, breakpoints) => {
84
84
  * @param {Record<keyof B & string, string | number>} value - An object containing values associated with breakpoints or custom media queries.
85
85
  * @param {keyof B & string} breakpoint - The breakpoint name to check against.
86
86
  * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
87
- * @param {B} breakpoints - An object representing the defined breakpoints.
87
+ * @param breakpointPairs - sorted pairs of breakpoints
88
88
  *
89
89
  * @returns {string | number | undefined} Returns the value associated with the matching breakpoint or custom media query, or `undefined` if no match is found.
90
90
  *
@@ -97,7 +97,7 @@ const getBreakpointFromScreenWidth = (width, breakpoints) => {
97
97
  * getValueForBreakpoint(values, 'sm', screenSize, breakpoints); // 'value1'
98
98
  */
99
99
  exports.getBreakpointFromScreenWidth = getBreakpointFromScreenWidth;
100
- const getValueForBreakpoint = (value, breakpoint, screenSize, breakpoints) => {
100
+ const getValueForBreakpoint = (value, breakpoint, screenSize, breakpointPairs) => {
101
101
  // the highest priority is for custom media queries
102
102
  const customMediaQueries = Object.entries(value).filter(_ref2 => {
103
103
  let [key] = _ref2;
@@ -118,22 +118,18 @@ const getValueForBreakpoint = (value, breakpoint, screenSize, breakpoints) => {
118
118
  }
119
119
 
120
120
  // there is no direct hit for breakpoint nor media-query, so let's simulate CSS cascading
121
- const allBreakpoints = Object.entries(breakpoints).map(_ref3 => {
122
- let [key, bpValue] = _ref3;
123
- return [key.toLowerCase(), bpValue];
124
- });
125
- const currentBreakpoint = allBreakpoints.findIndex(_ref4 => {
126
- let [key] = _ref4;
121
+ const currentBreakpoint = breakpointPairs.findIndex(_ref3 => {
122
+ let [key] = _ref3;
127
123
  return key === unifiedKey;
128
124
  });
129
- const availableBreakpoints = allBreakpoints.filter((_ref5, index) => {
130
- let [key] = _ref5;
125
+ const availableBreakpoints = breakpointPairs.filter((_ref4, index) => {
126
+ let [key] = _ref4;
131
127
  return index < currentBreakpoint && key && key in value;
132
- }).map(_ref6 => {
133
- let [key] = _ref6;
128
+ }).map(_ref5 => {
129
+ let [key] = _ref5;
134
130
  return key;
135
131
  });
136
- return allBreakpoints.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;
132
+ return breakpointPairs.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;
137
133
  };
138
134
  exports.getValueForBreakpoint = getValueForBreakpoint;
139
135
  //# sourceMappingURL=breakpoints.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_common","require","_mediaQueries","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","throwError","length","Set","size","exports","getBreakpointFromScreenWidth","width","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","isMediaQuery","customMediaQueryKey","getKeyForCustomMediaQuery","unifiedKey","toLowerCase","directBreakpoint","allBreakpoints","map","_ref3","bpValue","currentBreakpoint","findIndex","_ref4","availableBreakpoints","_ref5","_ref6","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,0BAA0B,GAAsCC,WAAc,IAAQ;EAC/F,MAAMC,WAA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,GAAGJ,cAAc,CACnCK,SAAS,CAACC,KAAA;IAAA,IAAC,CAAC1B,GAAG,CAAC,GAAA0B,KAAA;IAAA,OAAK1B,GAAG,KAAKiB,UAAU;EAAA,EAAC;EAE7C,MAAMU,oBAAoB,GAAGP,cAAc,CACtCR,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,CAC1EgB,GAAG,CAACQ,KAAA;IAAA,IAAC,CAAC7B,GAAG,CAAC,GAAA6B,KAAA;IAAA,OAAK7B,GAAG;EAAA,EAAC;EAExB,OAAOoB,cAAc,CAAC1B,MAAM,GAAG,CAAC,GAC1BW,KAAK,CAACsB,oBAAoB,CAACA,oBAAoB,CAACjC,MAAM,GAAG,CAAC,CAAC,CAAqB,GAChFoC,SAAS;AACnB,CAAC;AAAAjC,OAAA,CAAAW,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_common","require","_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","breakpointPairs","customMediaQueries","filter","_ref2","isMediaQuery","customMediaQueryKey","getKeyForCustomMediaQuery","unifiedKey","toLowerCase","directBreakpoint","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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GAAGb,eAAe,CACvCE,MAAM,CAAC,CAAAY,KAAA,EAAQtB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAAyB,KAAA;IAAA,OAAYtB,KAAK,GAAGkB,iBAAiB,IAAIrB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EqB,GAAG,CAACC,KAAA;IAAA,IAAC,CAAC3B,GAAG,CAAC,GAAA2B,KAAA;IAAA,OAAK3B,GAAG;EAAA,EAAC;EAExB,OAAOW,eAAe,CAAClB,MAAM,GAAG,CAAC,GAC3BY,KAAK,CAACmB,oBAAoB,CAACA,oBAAoB,CAAC/B,MAAM,GAAG,CAAC,CAAC,CAAqB,GAChFmC,SAAS;AACnB,CAAC;AAAAhC,OAAA,CAAAY,qBAAA,GAAAA,qBAAA"}
@@ -54,17 +54,18 @@ describe('breakpoints', () => {
54
54
  md: 500,
55
55
  xl: 1200
56
56
  };
57
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(0, breakpoints)).toEqual('xs');
58
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(20, breakpoints)).toEqual('xs');
59
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(100, breakpoints)).toEqual('xs');
60
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(101, breakpoints)).toEqual('xs');
61
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(250, breakpoints)).toEqual('xs');
62
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(300, breakpoints)).toEqual('sm');
63
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(499, breakpoints)).toEqual('sm');
64
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(500, breakpoints)).toEqual('md');
65
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(799, breakpoints)).toEqual('md');
66
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(1200, breakpoints)).toEqual('xl');
67
- expect((0, _breakpoints.getBreakpointFromScreenWidth)(2000, breakpoints)).toEqual('xl');
57
+ const breakpointPairs = Object.entries(breakpoints);
58
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(0, breakpointPairs)).toEqual('xs');
59
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(20, breakpointPairs)).toEqual('xs');
60
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(100, breakpointPairs)).toEqual('xs');
61
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(101, breakpointPairs)).toEqual('xs');
62
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(250, breakpointPairs)).toEqual('xs');
63
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(300, breakpointPairs)).toEqual('sm');
64
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(499, breakpointPairs)).toEqual('sm');
65
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(500, breakpointPairs)).toEqual('md');
66
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(799, breakpointPairs)).toEqual('md');
67
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(1200, breakpointPairs)).toEqual('xl');
68
+ expect((0, _breakpoints.getBreakpointFromScreenWidth)(2000, breakpointPairs)).toEqual('xl');
68
69
  });
69
70
  });
70
71
  describe('getValueForBreakpoint', () => {
@@ -75,6 +76,7 @@ describe('breakpoints', () => {
75
76
  sm: 200,
76
77
  md: 500
77
78
  };
79
+ const breakpointPairs = Object.entries(breakpoints);
78
80
  const style = {
79
81
  ':w[, 200]': 'green',
80
82
  ':w[201]': 'orange',
@@ -84,7 +86,7 @@ describe('breakpoints', () => {
84
86
  width: 200,
85
87
  height: 800
86
88
  };
87
- expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpoints)).toEqual('green');
89
+ expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpointPairs)).toEqual('green');
88
90
  });
89
91
  });
90
92
  it('should match breakpoint if media query doesnt exist', () => {
@@ -94,6 +96,7 @@ describe('breakpoints', () => {
94
96
  sm: 200,
95
97
  md: 500
96
98
  };
99
+ const breakpointPairs = Object.entries(breakpoints);
97
100
  const style = {
98
101
  ':w[, 200]': 'green',
99
102
  ':w[201, 499]': 'orange',
@@ -104,7 +107,7 @@ describe('breakpoints', () => {
104
107
  width: 500,
105
108
  height: 1200
106
109
  };
107
- expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpoints)).toEqual('red');
110
+ expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpointPairs)).toEqual('red');
108
111
  });
109
112
  it('should match breakpoint even if value is undefined', () => {
110
113
  const breakpoint = 'md';
@@ -113,6 +116,7 @@ describe('breakpoints', () => {
113
116
  sm: 200,
114
117
  md: 500
115
118
  };
119
+ const breakpointPairs = Object.entries(breakpoints);
116
120
  const style = {
117
121
  ':w[, 200]': 'green',
118
122
  ':w[201, 499]': 'orange',
@@ -123,7 +127,7 @@ describe('breakpoints', () => {
123
127
  width: 500,
124
128
  height: 1200
125
129
  };
126
- expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpoints)).toEqual(undefined);
130
+ expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpointPairs)).toEqual(undefined);
127
131
  });
128
132
  it('should match lower breakpoint to match css cascading', () => {
129
133
  const breakpoint = 'xl';
@@ -133,6 +137,7 @@ describe('breakpoints', () => {
133
137
  md: 500,
134
138
  xl: 600
135
139
  };
140
+ const breakpointPairs = Object.entries(breakpoints);
136
141
  const style = {
137
142
  ':w[, 200]': 'green',
138
143
  ':w[201, 499]': 'orange',
@@ -143,7 +148,7 @@ describe('breakpoints', () => {
143
148
  width: 500,
144
149
  height: 1200
145
150
  };
146
- expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpoints)).toEqual('red');
151
+ expect((0, _breakpoints.getValueForBreakpoint)(style, breakpoint, screenSize, breakpointPairs)).toEqual('red');
147
152
  });
148
153
  });
149
154
  //# sourceMappingURL=breakpoints.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_breakpoints","require","describe","it","breakpoints","expect","sortAndValidateBreakpoints","toThrow","sm","md","lg","xl","toEqual","xs","getBreakpointFromScreenWidth","breakpoint","style","screenSize","width","height","getValueForBreakpoint","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.spec.ts"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGAC,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC1BA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IACzCC,EAAE,CAAC,0CAA0C,EAAE,MAAM;MACjD,MAAMC,WAAW,GAAG,CAAC,CAAC;MAEtBC,MAAM,CAAC,MAAM,IAAAC,uCAA0B,EAACF,WAAW,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;IAEFJ,EAAE,CAAC,6DAA6D,EAAE,MAAM;MACpE,MAAMC,WAAW,GAAG;QAChBI,EAAE,EAAE,CAAC;MACT,CAAC;MAEDH,MAAM,CAAC,MAAM,IAAAC,uCAA0B,EAACF,WAAW,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;IAEFJ,EAAE,CAAC,8CAA8C,EAAE,MAAM;MACrD,MAAMC,WAAW,GAAG;QAChBI,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MAEDN,MAAM,CAAC,IAAAC,uCAA0B,EAACF,WAAW,CAAC,CAAC,CAACQ,OAAO,CAACR,WAAW,CAAC;IACxE,CAAC,CAAC;IAEFD,EAAE,CAAC,sCAAsC,EAAE,MAAM;MAC7C,MAAMC,WAAW,GAAG;QAChBK,EAAE,EAAE,GAAG;QACPD,EAAE,EAAE,CAAC;QACLE,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MAEDN,MAAM,CAAC,IAAAC,uCAA0B,EAACF,WAAW,CAAC,CAAC,CAACQ,OAAO,CAAC;QACpDJ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AAc,EAAE,QAAQ;MACxBR,EAAE,EAAE,MAAM;MACVC,EAAE,EAAE;IACR,CAAC;IACD,MAAMQ,UAAsB,GAAG;MAC3BC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;IAEDd,MAAM,CAAC,IAAAe,kCAAqB,EAACJ,KAAK,EAAED,UAAU,EAAEE,UAAU,EAAEb,WAAW,CAAC,CAAC,CAACQ,OAAO,CAAC,KAAK,CAAC;EAC5F,CAAC,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"names":["_breakpoints","require","describe","it","breakpoints","expect","sortAndValidateBreakpoints","toThrow","sm","md","lg","xl","toEqual","xs","breakpointPairs","Object","entries","getBreakpointFromScreenWidth","breakpoint","style","screenSize","width","height","getValueForBreakpoint","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.spec.ts"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGAC,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC1BA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IACzCC,EAAE,CAAC,0CAA0C,EAAE,MAAM;MACjD,MAAMC,WAAW,GAAG,CAAC,CAAC;MAEtBC,MAAM,CAAC,MAAM,IAAAC,uCAA0B,EAACF,WAAW,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;IAEFJ,EAAE,CAAC,6DAA6D,EAAE,MAAM;MACpE,MAAMC,WAAW,GAAG;QAChBI,EAAE,EAAE,CAAC;MACT,CAAC;MAEDH,MAAM,CAAC,MAAM,IAAAC,uCAA0B,EAACF,WAAW,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;IAEFJ,EAAE,CAAC,8CAA8C,EAAE,MAAM;MACrD,MAAMC,WAAW,GAAG;QAChBI,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MAEDN,MAAM,CAAC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C9C,WAAW,EAAE,OAAO;MACpB,cAAc,EAAE,QAAQ;MACxBX,EAAE,EAAE,MAAM;MACVC,EAAE,EAAEe;IACR,CAAC;IACD,MAAMJ,UAAsB,GAAG;MAC3BC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;IAEDjB,MAAM,CAAC,IAAAkB,kCAAqB,EAACJ,KAAK,EAAED,UAAU,EAAEE,UAAU,EAAEN,eAAe,CAAC,CAAC,CAACF,OAAO,CAACY,SAAS,CAAC;EACpG,CAAC,CAAC;EAEFrB,EAAE,CAAC,sDAAsD,EAAE,MAAM;IAC7D,MAAMe,UAAU,GAAG,IAAI;IACvB,MAAMd,WAAW,GAAG;MAChBS,EAAE,EAAE,CAAC;MACLL,EAAE,EAAE,GAAG;MACPC,EAAE,EAAE,GAAG;MACPE,EAAE,EAAE;IACR,CAAC;IACD,MAAMG,eAAe,GAAGC,MAAM,CACzBC,OAAO,CAACZ,WAAW,CAAgD;IACxE,MAAMe,KAAyC,GAAG;MAC9C,WAAW,EAAE,OAAO;MACpB,cAAc,EAAE,QAAQ;MACxBX,EAAE,EAAE,MAAM;MACVC,EAAE,EAAE;IACR,CAAC;IACD,MAAMW,UAAsB,GAAG;MAC3BC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;IAEDjB,MAAM,CAAC,IAAAkB,kCAAqB,EAACJ,KAAK,EAAED,UAAU,EAAEE,UAAU,EAAEN,eAAe,CAAC,CAAC,CAACF,OAAO,CAAC,KAAK,CAAC;EAChG,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -3,9 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.throwError = void 0;
6
+ exports.warn = exports.throwError = exports.isWeb = void 0;
7
+ var _reactNative = require("react-native");
7
8
  const throwError = message => {
8
9
  throw new Error(`🦄 [react-native-unistyles]: ${message}`);
9
10
  };
10
11
  exports.throwError = throwError;
12
+ const warn = message => {
13
+ console.warn(`🦄 [react-native-unistyles]: ${message}`);
14
+ };
15
+ exports.warn = warn;
16
+ const isWeb = () => _reactNative.Platform.OS === 'web';
17
+ exports.isWeb = isWeb;
11
18
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["throwError","message","Error","exports"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":";;;;;;AAAO,MAAMA,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAAAE,OAAA,CAAAH,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_reactNative","require","throwError","message","Error","exports","warn","console","isWeb","Platform","OS"],"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,GAAGA,CAAA,KAAMC,qBAAQ,CAACC,EAAE,KAAK,KAAK;AAAAL,OAAA,CAAAG,KAAA,GAAAA,KAAA"}
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "getBreakpointFromScreenWidth", {
9
9
  return _breakpoints.getBreakpointFromScreenWidth;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "normalizeStyles", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _normalizeStyles.normalizeStyles;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "parseStyle", {
13
19
  enumerable: true,
14
20
  get: function () {
@@ -27,6 +33,7 @@ Object.defineProperty(exports, "sortAndValidateBreakpoints", {
27
33
  return _breakpoints.sortAndValidateBreakpoints;
28
34
  }
29
35
  });
36
+ var _normalizeStyles = require("./normalizeStyles");
30
37
  var _breakpoints = require("./breakpoints");
31
38
  var _styles = require("./styles");
32
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_breakpoints","require","_styles"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA"}
1
+ {"version":3,"names":["_normalizeStyles","require","_breakpoints","_styles"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA"}
@@ -176,7 +176,7 @@ describe('utils', () => {
176
176
  });
177
177
  });
178
178
  it('should detect incorrect media queries', () => {
179
- const incorrectMediaQueries = [':w100]', ':w[100, 200', ':p[, 300]', ':&[200]', ':h[0 500]', ':h[p, 750]', ':w[0]:l[200]', ':[100]:w[200]', ':h(100, 200):w[400]', ':w[2OO]:h[200, 400]', '', 'x', '>300', ']]w200[['];
179
+ const incorrectMediaQueries = [':w100]', ':w[100, 200', ':p[, 300]', ':&[200]', ':h[0 500]', ':h[p, 750]', ':w[0]:l[200]', ':[100]:w[200]', ':h(100, 200):w[400]', ':w[2OO]:h[200, 400]', '', 'x', '>300', ']]w200[[', ':w[ 100]', ':w[ , 300]', ':w[ , 200]:h[ 200 , 400]'];
180
180
  incorrectMediaQueries.forEach(query => {
181
181
  expect((0, _mediaQueries.isMediaQuery)(query)).toEqual(false);
182
182
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_mediaQueries","require","describe","it","mediaQuery","expect","extractValues","toEqual","pairs","width","query","forEach","_ref","isWithinTheWidth","_ref2","height","_ref3","isWithinTheHeight","_ref4","screenSize","_ref5","isWithinTheWidthAndHeight","_ref6","correctMediaQueries","isMediaQuery","incorrectMediaQueries","mediaQueries","getKeyForCustomMediaQuery","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.spec.ts"],"mappings":";;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAUAC,QAAQ,CAAC,OAAO,EAAE,MAAM;EACpBA,QAAQ,CAAC,eAAe,EAAE,MAAM;IAC5BC,EAAE,CAAC,mDAAmD,EAAE,MAAM;MAC1D,MAAMC,UAAU,GAAG,aAAa;MAEhCC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC,CAAC;IAEFJ,EAAE,CAAC,8DAA8D,EAAE,MAAM;MACrE,MAAMC,UAAU,GAAG,WAAW;MAE9BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC;IAEFJ,EAAE,CAAC,qDAAqD,EAAE,MAAM;MAC5D,MAAMC,UAAU,GAAG,QAAQ;MAE3BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;IAEFJ,EAAE,CAAC,+DAA+D,EAAE,MAAM;MACtE,MAAMC,UAAU,GAAG,OAAO;MAE1BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEFJ,EAAE,CAAC,sDAAsD,EAAE,MAAM;MAC7D,MAAMC,UAAU,GAAG,SAAS;MAE5BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,C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CAAC,SAAS,EAAE,GAAG,CAAC,EAChB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAMP,UAAsB,GAAG;QAC3BV,KAAK,EAAE,GAAG;QACVM,MAAM,EAAE;MACZ,CAAC;MAEDV,MAAM,CAAC,IAAAsB,uCAAyB,EAACD,YAAY,EAAEP,UAAU,CAAC,CAAC,CAACZ,OAAO,CAAC,QAAQ,CAAC;IACjF,CAAC,CAAC;IAEFJ,EAAE,CAAC,sCAAsC,EAAE,MAAM;MAC7C,MAAMuB,YAAY,GAAG,CACjB,CAAC,SAAS,EAAE,OAAO,CAAC,EACpB,CAAC,aAAa,EAAE,OAAO,CAAC,EACxB,CAAC,SAAS,EAAE,KAAK,CAAC,CACe;MACrC,MAAMP,UAAsB,GAAG;QAC3BV,KAAK,EAAE,GAAG;QACVM,MAAM,EAAE;MACZ,CAAC;MAEDV,MAAM,CAAC,IAAAsB,uCAAyB,EAACD,YAAY,EAAEP,UAAU,CAAC,CAAC,CAACZ,OAAO,CAACqB,SAAS,CAAC;IAClF,CAAC,CAAC;IAEFzB,EAAE,CAAC,+CAA+C,EAAE,MAAM;MACtD,MAAMuB,YAAY,GAAG,CACjB,CAAC,oBAAoB,EAAE,GAAG,CAAC,EAC3B,CAAC,eAAe,EAAE,GAAG,CAAC,EACtB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAMP,UAAsB,GAAG;QAC3BV,KAAK,EAAE,GAAG;QACVM,MAAM,EAAE;MACZ,CAAC;MAEDV,MAAM,CAAC,IAAAsB,uCAAyB,EAACD,YAAY,EAAEP,UAAU,CAAC,CAAC,CAACZ,OAAO,CAAC,oBAAoB,CAAC;IAC7F,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"names":["_mediaQueries","require","describe","it","mediaQuery","expect","extractValues","toEqual","pairs","width","query","forEach","_ref","isWithinTheWidth","_ref2","height","_ref3","isWithinTheHeight","_ref4","screenSize","_ref5","isWithinTheWidthAndHeight","_ref6","correctMediaQueries","isMediaQuery","incorrectMediaQueries","mediaQueries","getKeyForCustomMediaQuery","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.spec.ts"],"mappings":";;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAUAC,QAAQ,CAAC,OAAO,EAAE,MAAM;EACpBA,QAAQ,CAAC,eAAe,EAAE,MAAM;IAC5BC,EAAE,CAAC,mDAAmD,EAAE,MAAM;MAC1D,MAAMC,UAAU,GAAG,aAAa;MAEhCC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC,CAAC;IAEFJ,EAAE,CAAC,8DAA8D,EAAE,MAAM;MACrE,MAAMC,UAAU,GAAG,WAAW;MAE9BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC;IAEFJ,EAAE,CAAC,qDAAqD,EAAE,MAAM;MAC5D,MAAMC,UAAU,GAAG,QAAQ;MAE3BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;IAEFJ,EAAE,CAAC,+DAA+D,EAAE,MAAM;MACtE,MAAMC,UAAU,GAAG,OAAO;MAE1BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEFJ,EAAE,CAAC,sDAAsD,EAAE,MAAM;MAC7D,MAAMC,UAAU,GAAG,SAAS;MAE5BC,MAAM,CAAC,IAAAC,2BAAa,EAACF,UAAU,CAAC,CAAC,CAACG,OAAO,CAAC,CAAC,CAAC,EAAC,GAAG,CAAC,CAAC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AG,CAAC,EAChB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAMP,UAAsB,GAAG;QAC3BV,KAAK,EAAE,GAAG;QACVM,MAAM,EAAE;MACZ,CAAC;MAEDV,MAAM,CAAC,IAAAsB,uCAAyB,EAACD,YAAY,EAAEP,UAAU,CAAC,CAAC,CAACZ,OAAO,CAAC,QAAQ,CAAC;IACjF,CAAC,CAAC;IAEFJ,EAAE,CAAC,sCAAsC,EAAE,MAAM;MAC7C,MAAMuB,YAAY,GAAG,CACjB,CAAC,SAAS,EAAE,OAAO,CAAC,EACpB,CAAC,aAAa,EAAE,OAAO,CAAC,EACxB,CAAC,SAAS,EAAE,KAAK,CAAC,CACe;MACrC,MAAMP,UAAsB,GAAG;QAC3BV,KAAK,EAAE,GAAG;QACVM,MAAM,EAAE;MACZ,CAAC;MAEDV,MAAM,CAAC,IAAAsB,uCAAyB,EAACD,YAAY,EAAEP,UAAU,CAAC,CAAC,CAACZ,OAAO,CAACqB,SAAS,CAAC;IAClF,CAAC,CAAC;IAEFzB,EAAE,CAAC,+CAA+C,EAAE,MAAM;MACtD,MAAMuB,YAAY,GAAG,CACjB,CAAC,oBAAoB,EAAE,GAAG,CAAC,EAC3B,CAAC,eAAe,EAAE,GAAG,CAAC,EACtB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAMP,UAAsB,GAAG;QAC3BV,KAAK,EAAE,GAAG;QACVM,MAAM,EAAE;MACZ,CAAC;MAEDV,MAAM,CAAC,IAAAsB,uCAAyB,EAACD,YAAY,EAAEP,UAAU,CAAC,CAAC,CAACZ,OAAO,CAAC,oBAAoB,CAAC;IAC7F,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeStyles = void 0;
7
+ // nothing to do here
8
+ const normalizeStyles = styles => styles;
9
+ exports.normalizeStyles = normalizeStyles;
10
+ //# sourceMappingURL=normalizeStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeStyles","styles","exports"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.ts"],"mappings":";;;;;;AAAA;AACO,MAAMA,eAAe,GAAOC,MAAS,IAAKA,MAAW;AAAAC,OAAA,CAAAF,eAAA,GAAAA,eAAA"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeStyles = void 0;
7
+ var _common = require("./common");
8
+ const preprocessor = require('react-native-web/src/exports/StyleSheet/preprocess.js');
9
+ const normalizeBoxShadow = styles => {
10
+ const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
11
+ if (!requiredBoxShadowProperties.every(prop => prop in styles)) {
12
+ (0, _common.warn)(`can't apply box shadow as you miss at least one of these properties: ${requiredBoxShadowProperties.join(', ')}`);
13
+ return {
14
+ shadowColor: undefined,
15
+ shadowOffset: undefined,
16
+ shadowOpacity: undefined,
17
+ shadowRadius: undefined
18
+ };
19
+ }
20
+ return {
21
+ boxShadow: preprocessor.createBoxShadowValue(styles),
22
+ shadowColor: undefined,
23
+ shadowOffset: undefined,
24
+ shadowOpacity: undefined,
25
+ shadowRadius: undefined
26
+ };
27
+ };
28
+ const normalizeTextShadow = styles => {
29
+ const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
30
+ if (!requiredTextShadowProperties.every(prop => prop in styles)) {
31
+ (0, _common.warn)(`can't apply text shadow as you miss at least one of these properties: ${requiredTextShadowProperties.join(', ')}`);
32
+ return {
33
+ textShadowColor: undefined,
34
+ textShadowOffset: undefined,
35
+ textShadowRadius: undefined
36
+ };
37
+ }
38
+ return {
39
+ textShadow: preprocessor.createTextShadowValue(styles),
40
+ textShadowColor: undefined,
41
+ textShadowOffset: undefined,
42
+ textShadowRadius: undefined
43
+ };
44
+ };
45
+ const normalizeStyles = styles => {
46
+ const normalizedTransform = 'transform' in styles && Array.isArray(styles.transform) ? {
47
+ transform: preprocessor.createTransformValue(styles.transform)
48
+ } : {};
49
+ const normalizedBoxShadow = 'shadowColor' in styles || 'shadowOffset' in styles || 'shadowOpacity' in styles || 'shadowRadius' in styles ? normalizeBoxShadow(styles) : {};
50
+ const normalizedTextShadow = 'textShadowColor' in styles || 'textShadowOffset' in styles || 'textShadowRadius' in styles ? normalizeTextShadow(styles) : {};
51
+ return {
52
+ ...styles,
53
+ ...normalizedTransform,
54
+ ...normalizedBoxShadow,
55
+ ...normalizedTextShadow
56
+ };
57
+ };
58
+ exports.normalizeStyles = normalizeStyles;
59
+ //# sourceMappingURL=normalizeStyles.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_common","require","preprocessor","normalizeBoxShadow","styles","requiredBoxShadowProperties","every","prop","warn","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow","exports"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,MAAMC,YAA0B,GAAGD,OAAO,CAAC,uDAAuD,CAAC;AAuBnG,MAAME,kBAAkB,GAAkBC,MAAS,IAA0B;EACzE,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,MAAM,CAAC,EAAE;IAC5D,IAAAI,YAAI,EAAE,wEAAuEH,2BAA2B,CAACI,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW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B,cAAc,IAAIA,MAAM,GACxBD,kBAAkB,CAACC,MAAM,CAAC,GAAG,CAAC,CAAC;EAEnC,MAAM2B,oBAAoB,GACtB,iBAAiB,IAAI3B,MAAM,IAC3B,kBAAkB,IAAIA,MAAM,IAC5B,kBAAkB,IAAIA,MAAM,GAC5Ba,mBAAmB,CAACb,MAAM,CAAC,GAAG,CAAC,CAAC;EAEpC,OAAO;IACH,GAAGA,MAAM;IACT,GAAGqB,mBAAmB;IACtB,GAAGK,mBAAmB;IACtB,GAAGC;EACP,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAR,eAAA,GAAAA,eAAA"}
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.proxifyFunction = exports.parseStyle = void 0;
7
7
  var _breakpoints = require("./breakpoints");
8
+ var _normalizeStyles = require("./normalizeStyles");
9
+ var _common = require("./common");
8
10
  /**
9
11
  * Proxies a function to parse its return value for custom media queries or breakpoints.
10
12
  *
@@ -13,7 +15,7 @@ var _breakpoints = require("./breakpoints");
13
15
  * @param {Function} fn - The function to be proxified.
14
16
  * @param {keyof B & string} breakpoint - The breakpoint name to check against.
15
17
  * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
16
- * @param {B} breakpoints - An object representing the defined breakpoints.
18
+ * @param breakpointPairs - sorted pairs of breakpoints
17
19
  *
18
20
  * @returns {Function} Returns the proxified function
19
21
  *
@@ -26,8 +28,8 @@ var _breakpoints = require("./breakpoints");
26
28
  * const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
27
29
  * proxifiedFunction() // parsed style based on screenSize and breakpoints
28
30
  */
29
- const proxifyFunction = (fn, breakpoint, screenSize, breakpoints) => new Proxy(fn, {
30
- apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpoints)
31
+ const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) => new Proxy(fn, {
32
+ apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpointPairs)
31
33
  });
32
34
 
33
35
  /**
@@ -42,7 +44,7 @@ const proxifyFunction = (fn, breakpoint, screenSize, breakpoints) => new Proxy(f
42
44
  * @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
43
45
  * @param {keyof B & string} breakpoint - The breakpoint name to check against.
44
46
  * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
45
- * @param {B} breakpoints - An object representing the defined breakpoints.
47
+ * @param breakpointPairs - sorted pairs of breakpoints
46
48
  *
47
49
  * @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
48
50
  *
@@ -56,25 +58,26 @@ const proxifyFunction = (fn, breakpoint, screenSize, breakpoints) => new Proxy(f
56
58
  * // { fontSize: '12px' }
57
59
  */
58
60
  exports.proxifyFunction = proxifyFunction;
59
- const parseStyle = (style, breakpoint, screenSize, breakpoints) => {
61
+ const parseStyle = (style, breakpoint, screenSize, breakpointPairs) => {
60
62
  const entries = Object.entries(style);
61
- return Object.fromEntries(entries.map(_ref => {
63
+ const parsedStyles = Object.fromEntries(entries.map(_ref => {
62
64
  let [key, value] = _ref;
63
- const isNestedStyle = key === 'shadowOffset';
64
- if (isNestedStyle) {
65
- return [key, parseStyle(value, breakpoint, screenSize, breakpoints)];
65
+ const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
66
+ if (hasNestedProperties) {
67
+ return [key, parseStyle(value, breakpoint, screenSize, breakpointPairs)];
66
68
  }
67
69
  const isTransform = key === 'transform';
68
70
  if (isTransform && Array.isArray(value)) {
69
- return [key, value.map(value => parseStyle(value, breakpoint, screenSize, breakpoints))];
71
+ return [key, value.map(value => parseStyle(value, breakpoint, screenSize, breakpointPairs))];
70
72
  }
71
73
  const isDynamicFunction = typeof value === 'function';
72
74
  const isValidStyle = typeof value !== 'object';
73
75
  if (isDynamicFunction || isValidStyle) {
74
76
  return [key, value];
75
77
  }
76
- return [key, (0, _breakpoints.getValueForBreakpoint)(value, breakpoint, screenSize, breakpoints)];
78
+ return [key, (0, _breakpoints.getValueForBreakpoint)(value, breakpoint, screenSize, breakpointPairs)];
77
79
  }));
80
+ return (0, _common.isWeb)() ? (0, _normalizeStyles.normalizeStyles)(parsedStyles) : parsedStyles;
78
81
  };
79
82
  exports.parseStyle = parseStyle;
80
83
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_breakpoints","require","proxifyFunction","fn","breakpoint","screenSize","breakpoints","Proxy","apply","target","thisArg","argumentsList","parseStyle","exports","style","entries","Object","fromEntries","map","_ref","key","value","isNestedStyle","isTransform","Array","isArray","isDynamicFunction","isValidStyle","getValueForBreakpoint"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA4B,EAC1CC,UAAsB,EACtBC,WAAc,KACH,IAAIC,KAAK,CAACJ,EAAE,EAAE;EACzBK,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEP,UAAU,EAAEC,UAAU,EAAEC,WAAW;AAC5F,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAxBAO,OAAA,CAAAX,eAAA,GAAAA,eAAA;AAyBO,MAAMU,UAAU,GAAGA,CACtBE,KAA8B,EAC9BV,UAA4B,EAC5BC,UAAsB,EACtBC,WAAc,KACV;EACJ,MAAMS,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,CAGnC;EAED,OAAOE,MAAM,CACRC,WAAW,CAACF,OAAO,CACfG,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACd,MAAMG,aAAa,GAAGF,GAAG,KAAK,cAAc;IAE5C,IAAIE,aAAa,EAAE;MACf,OAAO,CACHF,GAAG,EACHR,UAAU,CAACS,KAAK,EAA6BjB,UAAU,EAAEC,UAAU,EAAEC,WAAW,CAAC,CACpF;IACL;IAEA,MAAMiB,WAAW,GAAGH,GAAG,KAAK,WAAW;IAEvC,IAAIG,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;MACrC,OAAO,CACHD,GAAG,EACHC,KAAK,CAACH,GAAG,CAACG,KAAK,IAAIT,UAAU,CAACS,KAAK,EAAEjB,UAAU,EAAEC,UAAU,EAAEC,WAAW,CAAC,CAAC,CAC7E;IACL;IAEA,MAAMoB,iBAAiB,GAAG,OAAOL,KAAK,KAAK,UAAU;IACrD,MAAMM,YAAY,GAAG,OAAON,KAAK,KAAK,QAAQ;IAE9C,IAAIK,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACP,GAAG,EAAEC,KAAK,CAAC;IACvB;IAEA,OAAO,CACHD,GAAG,EACH,IAAAQ,kCAAqB,EACjBP,KAAK,EACLjB,UAAU,EACVC,UAAU,EACVC,WACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;AACT,CAAC;AAAAO,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","breakpointPairs","Proxy","apply","target","thisArg","argumentsList","parseStyle","exports","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","value","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle","getValueForBreakpoint","isWeb","normalizeStyles"],"sourceRoot":"../../../src","sources":["utils/styles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