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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/README.md +342 -35
  2. package/lib/commonjs/createUnistyles.js +25 -13
  3. package/lib/commonjs/createUnistyles.js.map +1 -1
  4. package/lib/commonjs/mediaQueries.js +2 -0
  5. package/lib/commonjs/mediaQueries.js.map +1 -0
  6. package/lib/commonjs/utils/breakpoints.js +12 -16
  7. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  8. package/lib/commonjs/utils/breakpoints.spec.js +20 -15
  9. package/lib/commonjs/utils/breakpoints.spec.js.map +1 -1
  10. package/lib/commonjs/utils/common.js +8 -1
  11. package/lib/commonjs/utils/common.js.map +1 -1
  12. package/lib/commonjs/utils/index.js +7 -0
  13. package/lib/commonjs/utils/index.js.map +1 -1
  14. package/lib/commonjs/utils/mediaQueries.spec.js +1 -1
  15. package/lib/commonjs/utils/mediaQueries.spec.js.map +1 -1
  16. package/lib/commonjs/utils/normalizeStyles.js +10 -0
  17. package/lib/commonjs/utils/normalizeStyles.js.map +1 -0
  18. package/lib/commonjs/utils/normalizeStyles.web.js +59 -0
  19. package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -0
  20. package/lib/commonjs/utils/styles.js +14 -12
  21. package/lib/commonjs/utils/styles.js.map +1 -1
  22. package/lib/commonjs/utils/styles.spec.js +17 -7
  23. package/lib/commonjs/utils/styles.spec.js.map +1 -1
  24. package/lib/module/createUnistyles.js +25 -13
  25. package/lib/module/createUnistyles.js.map +1 -1
  26. package/lib/module/mediaQueries.js +2 -0
  27. package/lib/module/mediaQueries.js.map +1 -0
  28. package/lib/module/utils/breakpoints.js +12 -16
  29. package/lib/module/utils/breakpoints.js.map +1 -1
  30. package/lib/module/utils/breakpoints.spec.js +20 -15
  31. package/lib/module/utils/breakpoints.spec.js.map +1 -1
  32. package/lib/module/utils/common.js +5 -0
  33. package/lib/module/utils/common.js.map +1 -1
  34. package/lib/module/utils/index.js +1 -0
  35. package/lib/module/utils/index.js.map +1 -1
  36. package/lib/module/utils/mediaQueries.spec.js +1 -1
  37. package/lib/module/utils/mediaQueries.spec.js.map +1 -1
  38. package/lib/module/utils/normalizeStyles.js +3 -0
  39. package/lib/module/utils/normalizeStyles.js.map +1 -0
  40. package/lib/module/utils/normalizeStyles.web.js +52 -0
  41. package/lib/module/utils/normalizeStyles.web.js.map +1 -0
  42. package/lib/module/utils/styles.js +14 -12
  43. package/lib/module/utils/styles.js.map +1 -1
  44. package/lib/module/utils/styles.spec.js +17 -7
  45. package/lib/module/utils/styles.spec.js.map +1 -1
  46. package/lib/typescript/src/createUnistyles.d.ts +7 -3
  47. package/lib/typescript/src/createUnistyles.d.ts.map +1 -1
  48. package/lib/typescript/src/mediaQueries.d.ts +2 -0
  49. package/lib/typescript/src/mediaQueries.d.ts.map +1 -0
  50. package/lib/typescript/src/types.d.ts +53 -13
  51. package/lib/typescript/src/types.d.ts.map +1 -1
  52. package/lib/typescript/src/utils/breakpoints.d.ts +6 -6
  53. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  54. package/lib/typescript/src/utils/common.d.ts +2 -0
  55. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  56. package/lib/typescript/src/utils/index.d.ts +1 -0
  57. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  58. package/lib/typescript/src/utils/normalizeStyles.d.ts +2 -0
  59. package/lib/typescript/src/utils/normalizeStyles.d.ts.map +1 -0
  60. package/lib/typescript/src/utils/normalizeStyles.web.d.ts +2 -0
  61. package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -0
  62. package/lib/typescript/src/utils/styles.d.ts +5 -5
  63. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  64. package/package.json +9 -2
  65. package/src/createUnistyles.ts +38 -16
  66. package/src/mediaQueries.ts +33 -0
  67. package/src/types.ts +96 -25
  68. package/src/utils/breakpoints.ts +15 -15
  69. package/src/utils/common.ts +8 -0
  70. package/src/utils/index.ts +1 -0
  71. package/src/utils/normalizeStyles.ts +2 -0
  72. package/src/utils/normalizeStyles.web.ts +103 -0
  73. package/src/utils/styles.ts +32 -17
@@ -46,15 +46,15 @@ export const sortAndValidateBreakpoints = breakpoints => {
46
46
  *
47
47
  * @template B - An object type where keys are strings and values are numbers representing screen widths.
48
48
  * @param {number} width - The screen width to determine the breakpoint for.
49
- * @param {B} breakpoints - The breakpoints object to use for determination.
49
+ * @param breakpointEntries - sorted pairs of breakpoints
50
50
  * @returns {keyof B & string} The key of the breakpoint that the screen width falls into.
51
51
  *
52
52
  * @example
53
53
  * const breakpoints = { sm: 0, md: 768, lg: 1024 }
54
54
  * getBreakpointFromScreenWidth(800, breakpoints) // returns 'md'
55
55
  */
56
- export const getBreakpointFromScreenWidth = (width, breakpoints) => {
57
- const [key] = Object.entries(breakpoints).find((_ref, index, otherBreakpoints) => {
56
+ export const getBreakpointFromScreenWidth = (width, breakpointEntries) => {
57
+ const [key] = breakpointEntries.find((_ref, index, otherBreakpoints) => {
58
58
  let [, value] = _ref;
59
59
  const minVal = value;
60
60
  const maxVal = otherBreakpoints[index + 1]?.[1];
@@ -78,7 +78,7 @@ export const getBreakpointFromScreenWidth = (width, breakpoints) => {
78
78
  * @param {Record<keyof B & string, string | number>} value - An object containing values associated with breakpoints or custom media queries.
79
79
  * @param {keyof B & string} breakpoint - The breakpoint name to check against.
80
80
  * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
81
- * @param {B} breakpoints - An object representing the defined breakpoints.
81
+ * @param breakpointPairs - sorted pairs of breakpoints
82
82
  *
83
83
  * @returns {string | number | undefined} Returns the value associated with the matching breakpoint or custom media query, or `undefined` if no match is found.
84
84
  *
@@ -90,7 +90,7 @@ export const getBreakpointFromScreenWidth = (width, breakpoints) => {
90
90
  *
91
91
  * getValueForBreakpoint(values, 'sm', screenSize, breakpoints); // 'value1'
92
92
  */
93
- export const getValueForBreakpoint = (value, breakpoint, screenSize, breakpoints) => {
93
+ export const getValueForBreakpoint = (value, breakpoint, screenSize, breakpointPairs) => {
94
94
  // the highest priority is for custom media queries
95
95
  const customMediaQueries = Object.entries(value).filter(_ref2 => {
96
96
  let [key] = _ref2;
@@ -111,21 +111,17 @@ export const getValueForBreakpoint = (value, breakpoint, screenSize, breakpoints
111
111
  }
112
112
 
113
113
  // there is no direct hit for breakpoint nor media-query, so let's simulate CSS cascading
114
- const allBreakpoints = Object.entries(breakpoints).map(_ref3 => {
115
- let [key, bpValue] = _ref3;
116
- return [key.toLowerCase(), bpValue];
117
- });
118
- const currentBreakpoint = allBreakpoints.findIndex(_ref4 => {
119
- let [key] = _ref4;
114
+ const currentBreakpoint = breakpointPairs.findIndex(_ref3 => {
115
+ let [key] = _ref3;
120
116
  return key === unifiedKey;
121
117
  });
122
- const availableBreakpoints = allBreakpoints.filter((_ref5, index) => {
123
- let [key] = _ref5;
118
+ const availableBreakpoints = breakpointPairs.filter((_ref4, index) => {
119
+ let [key] = _ref4;
124
120
  return index < currentBreakpoint && key && key in value;
125
- }).map(_ref6 => {
126
- let [key] = _ref6;
121
+ }).map(_ref5 => {
122
+ let [key] = _ref5;
127
123
  return key;
128
124
  });
129
- return allBreakpoints.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;
125
+ return breakpointPairs.length > 0 ? value[availableBreakpoints[availableBreakpoints.length - 1]] : undefined;
130
126
  };
131
127
  //# sourceMappingURL=breakpoints.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["throwError","getKeyForCustomMediaQuery","isMediaQuery","sortAndValidateBreakpoints","breakpoints","sortedPairs","Object","entries","sort","breakpoint1","breakpoint2","value1","value2","sortedBreakpoints","freeze","fromEntries","breakpointValues","values","firstBreakpoint","length","Set","size","getBreakpointFromScreenWidth","width","key","find","_ref","index","otherBreakpoints","value","minVal","maxVal","getValueForBreakpoint","breakpoint","screenSize","customMediaQueries","filter","_ref2","customMediaQueryKey","unifiedKey","toLowerCase","directBreakpoint","allBreakpoints","map","_ref3","bpValue","currentBreakpoint","findIndex","_ref4","availableBreakpoints","_ref5","_ref6","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,UAAU;AAErC,SAASC,yBAAyB,EAAEC,YAAY,QAAQ,gBAAgB;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAsCC,WAAc,IAAQ;EAC/F,MAAMC,WAAW,GAAGC,MAAM,CACrBC,OAAO,CAACH,WAAW,CAAC,CACpBI,IAAI,CAAC,CAACC,WAAW,EAAEC,WAAW,KAAK;IAChC,MAAM,GAAGC,MAAM,CAAC,GAAGF,WAAW;IAC9B,MAAM,GAAGG,MAAM,CAAC,GAAGF,WAAW;IAE9B,OAAOC,MAAM,GAAGC,MAAM;EAC1B,CAAC,CAAC;EAEN,MAAMC,iBAAiB,GAAIP,MAAM,CAACQ,MAAM,CAACR,MAAM,CAACS,WAAW,CAACV,WAAW,CAAC,CAAM;EAC9E,MAAMW,gBAAgB,GAAGV,MAAM,CAACW,MAAM,CAACJ,iBAAiB,CAAC;EACzD,MAAM,CAACK,eAAe,CAAC,GAAGF,gBAAgB;EAE1C,IAAIE,eAAe,KAAK,CAAC,EAAE;IACvBlB,UAAU,CAAC,oCAAoC,CAAC;EACpD;EAEA,IAAIgB,gBAAgB,CAACG,MAAM,KAAK,IAAIC,GAAG,CAACJ,gBAAgB,CAAC,CAACK,IAAI,EAAE;IAC5DrB,UAAU,CAAC,kCAAkC,CAAC;EAClD;EAEA,OAAOa,iBAAiB;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,4BAA4B,GAAGA,CAAmCC,KAAa,EAAEnB,WAAc,KAAuB;EAC/H,MAAM,CAACoB,GAAG,CAAC,GAAGlB,MAAM,CACfC,OAAO,CAAC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GpC,MAAM,CACxBC,OAAO,CAACH,WAAW,CAAC,CACpBuC,GAAG,CAACC,KAAA;IAAA,IAAC,CAACpB,GAAG,EAAEqB,OAAO,CAAC,GAAAD,KAAA;IAAA,OAAK,CAACpB,GAAG,CAACgB,WAAW,CAAC,CAAC,EAAEK,OAAO,CAAC;EAAA,EAAC;EAE1D,MAAMC,iBAAiB,GAAGJ,cAAc,CACnCK,SAAS,CAACC,KAAA;IAAA,IAAC,CAACxB,GAAG,CAAC,GAAAwB,KAAA;IAAA,OAAKxB,GAAG,KAAKe,UAAU;EAAA,EAAC;EAE7C,MAAMU,oBAAoB,GAAGP,cAAc,CACtCN,MAAM,CAAC,CAAAc,KAAA,EAAQvB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAA0B,KAAA;IAAA,OAAYvB,KAAK,GAAGmB,iBAAiB,IAAItB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1Ec,GAAG,CAACQ,KAAA;IAAA,IAAC,CAAC3B,GAAG,CAAC,GAAA2B,KAAA;IAAA,OAAK3B,GAAG;EAAA,EAAC;EAExB,OAAOkB,cAAc,CAACvB,MAAM,GAAG,CAAC,GAC1BU,KAAK,CAACoB,oBAAoB,CAACA,oBAAoB,CAAC9B,MAAM,GAAG,CAAC,CAAC,CAAqB,GAChFiC,SAAS;AACnB,CAAC"}
1
+ {"version":3,"names":["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","breakpointPairs","customMediaQueries","filter","_ref2","customMediaQueryKey","unifiedKey","toLowerCase","directBreakpoint","currentBreakpoint","findIndex","_ref3","availableBreakpoints","_ref4","map","_ref5","undefined"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AC,GAAAqB,KAAA;IAAA,OAAKrB,GAAG,KAAKgB,UAAU;EAAA,EAAC;EAE7C,MAAMM,oBAAoB,GAAGX,eAAe,CACvCE,MAAM,CAAC,CAAAU,KAAA,EAAQpB,KAAK;IAAA,IAAZ,CAACH,GAAG,CAAC,GAAAuB,KAAA;IAAA,OAAYpB,KAAK,GAAGgB,iBAAiB,IAAInB,GAAG,IAAIA,GAAG,IAAIK,KAAK;EAAA,EAAC,CAC1EmB,GAAG,CAACC,KAAA;IAAA,IAAC,CAACzB,GAAG,CAAC,GAAAyB,KAAA;IAAA,OAAKzB,GAAG;EAAA,EAAC;EAExB,OAAOW,eAAe,CAACjB,MAAM,GAAG,CAAC,GAC3BW,KAAK,CAACiB,oBAAoB,CAACA,oBAAoB,CAAC5B,MAAM,GAAG,CAAC,CAAC,CAAqB,GAChFgC,SAAS;AACnB,CAAC"}
@@ -52,17 +52,18 @@ describe('breakpoints', () => {
52
52
  md: 500,
53
53
  xl: 1200
54
54
  };
55
- expect(getBreakpointFromScreenWidth(0, breakpoints)).toEqual('xs');
56
- expect(getBreakpointFromScreenWidth(20, breakpoints)).toEqual('xs');
57
- expect(getBreakpointFromScreenWidth(100, breakpoints)).toEqual('xs');
58
- expect(getBreakpointFromScreenWidth(101, breakpoints)).toEqual('xs');
59
- expect(getBreakpointFromScreenWidth(250, breakpoints)).toEqual('xs');
60
- expect(getBreakpointFromScreenWidth(300, breakpoints)).toEqual('sm');
61
- expect(getBreakpointFromScreenWidth(499, breakpoints)).toEqual('sm');
62
- expect(getBreakpointFromScreenWidth(500, breakpoints)).toEqual('md');
63
- expect(getBreakpointFromScreenWidth(799, breakpoints)).toEqual('md');
64
- expect(getBreakpointFromScreenWidth(1200, breakpoints)).toEqual('xl');
65
- expect(getBreakpointFromScreenWidth(2000, breakpoints)).toEqual('xl');
55
+ const breakpointPairs = Object.entries(breakpoints);
56
+ expect(getBreakpointFromScreenWidth(0, breakpointPairs)).toEqual('xs');
57
+ expect(getBreakpointFromScreenWidth(20, breakpointPairs)).toEqual('xs');
58
+ expect(getBreakpointFromScreenWidth(100, breakpointPairs)).toEqual('xs');
59
+ expect(getBreakpointFromScreenWidth(101, breakpointPairs)).toEqual('xs');
60
+ expect(getBreakpointFromScreenWidth(250, breakpointPairs)).toEqual('xs');
61
+ expect(getBreakpointFromScreenWidth(300, breakpointPairs)).toEqual('sm');
62
+ expect(getBreakpointFromScreenWidth(499, breakpointPairs)).toEqual('sm');
63
+ expect(getBreakpointFromScreenWidth(500, breakpointPairs)).toEqual('md');
64
+ expect(getBreakpointFromScreenWidth(799, breakpointPairs)).toEqual('md');
65
+ expect(getBreakpointFromScreenWidth(1200, breakpointPairs)).toEqual('xl');
66
+ expect(getBreakpointFromScreenWidth(2000, breakpointPairs)).toEqual('xl');
66
67
  });
67
68
  });
68
69
  describe('getValueForBreakpoint', () => {
@@ -73,6 +74,7 @@ describe('breakpoints', () => {
73
74
  sm: 200,
74
75
  md: 500
75
76
  };
77
+ const breakpointPairs = Object.entries(breakpoints);
76
78
  const style = {
77
79
  ':w[, 200]': 'green',
78
80
  ':w[201]': 'orange',
@@ -82,7 +84,7 @@ describe('breakpoints', () => {
82
84
  width: 200,
83
85
  height: 800
84
86
  };
85
- expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpoints)).toEqual('green');
87
+ expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpointPairs)).toEqual('green');
86
88
  });
87
89
  });
88
90
  it('should match breakpoint if media query doesnt exist', () => {
@@ -92,6 +94,7 @@ describe('breakpoints', () => {
92
94
  sm: 200,
93
95
  md: 500
94
96
  };
97
+ const breakpointPairs = Object.entries(breakpoints);
95
98
  const style = {
96
99
  ':w[, 200]': 'green',
97
100
  ':w[201, 499]': 'orange',
@@ -102,7 +105,7 @@ describe('breakpoints', () => {
102
105
  width: 500,
103
106
  height: 1200
104
107
  };
105
- expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpoints)).toEqual('red');
108
+ expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpointPairs)).toEqual('red');
106
109
  });
107
110
  it('should match breakpoint even if value is undefined', () => {
108
111
  const breakpoint = 'md';
@@ -111,6 +114,7 @@ describe('breakpoints', () => {
111
114
  sm: 200,
112
115
  md: 500
113
116
  };
117
+ const breakpointPairs = Object.entries(breakpoints);
114
118
  const style = {
115
119
  ':w[, 200]': 'green',
116
120
  ':w[201, 499]': 'orange',
@@ -121,7 +125,7 @@ describe('breakpoints', () => {
121
125
  width: 500,
122
126
  height: 1200
123
127
  };
124
- expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpoints)).toEqual(undefined);
128
+ expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpointPairs)).toEqual(undefined);
125
129
  });
126
130
  it('should match lower breakpoint to match css cascading', () => {
127
131
  const breakpoint = 'xl';
@@ -131,6 +135,7 @@ describe('breakpoints', () => {
131
135
  md: 500,
132
136
  xl: 600
133
137
  };
138
+ const breakpointPairs = Object.entries(breakpoints);
134
139
  const style = {
135
140
  ':w[, 200]': 'green',
136
141
  ':w[201, 499]': 'orange',
@@ -141,7 +146,7 @@ describe('breakpoints', () => {
141
146
  width: 500,
142
147
  height: 1200
143
148
  };
144
- expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpoints)).toEqual('red');
149
+ expect(getValueForBreakpoint(style, breakpoint, screenSize, breakpointPairs)).toEqual('red');
145
150
  });
146
151
  });
147
152
  //# sourceMappingURL=breakpoints.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getBreakpointFromScreenWidth","getValueForBreakpoint","sortAndValidateBreakpoints","describe","it","breakpoints","expect","toThrow","sm","md","lg","xl","toEqual","xs","breakpoint","style","screenSize","width","height","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.spec.ts"],"mappings":"AAAA,SAASA,4BAA4B,EAAEC,qBAAqB,EAAEC,0BAA0B,QAAQ,eAAe;AAG/GC,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC1BA,QAAQ,CAAC,4BAA4B,E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C;EAEFR,EAAE,CAAC,oDAAoD,EAAE,MAAM;IAC3D,MAAMU,UAAU,GAAG,IAAI;IACvB,MAAMT,WAAW,GAAG;MAChBQ,EAAE,EAAE,CAAC;MACLL,EAAE,EAAE,GAAG;MACPC,EAAE,EAAE;IACR,CAAC;IACD,MAAMM,KAAyC,GAAG;MAC9C,WAAW,EAAE,OAAO;MACpB,cAAc,EAAE,QAAQ;MACxBP,EAAE,EAAE,MAAM;MACVC,EAAE,EAAEU;IACR,CAAC;IACD,MAAMH,UAAsB,GAAG;MAC3BC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;IAEDZ,MAAM,CAACL,qBAAqB,CAACc,KAAK,EAAED,UAAU,EAAEE,UAAU,EAAEX,WAAW,CAAC,CAAC,CAACO,OAAO,CAACO,SAAS,CAAC;EAChG,CAAC,CAAC;EAEFf,EAAE,CAAC,sDAAsD,EAAE,MAAM;IAC7D,MAAMU,UAAU,GAAG,IAAI;IACvB,MAAMT,WAAW,GAAG;MAChBQ,EAAE,EAAE,CAAC;MACLL,EAAE,EAAE,GAAG;MACPC,EAAE,EAAE,GAAG;MACPE,EAAE,EAAE;IACR,CAAC;IACD,MAAMI,KAAyC,GAAG;MAC9C,WAAW,EAAE,OAAO;MACpB,cAAc,EAAE,QAAQ;MACxBP,EAAE,EAAE,MAAM;MACVC,EAAE,EAAE;IACR,CAAC;IACD,MAAMO,UAAsB,GAAG;MAC3BC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;IAEDZ,MAAM,CAACL,qBAAqB,CAACc,KAAK,EAAED,UAAU,EAAEE,UAAU,EAAEX,WAAW,CAAC,CAAC,CAACO,OAAO,CAAC,KAAK,CAAC;EAC5F,CAAC,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"names":["getBreakpointFromScreenWidth","getValueForBreakpoint","sortAndValidateBreakpoints","describe","it","breakpoints","expect","toThrow","sm","md","lg","xl","toEqual","xs","breakpointPairs","Object","entries","breakpoint","style","screenSize","width","height","undefined"],"sourceRoot":"../../../src","sources":["utils/breakpoints.spec.ts"],"mappings":"AAAA,SAASA,4BAA4B,EAAEC,qBAAqB,EAAEC,0BAA0B,QAAQ,eAAe;AAG/GC,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,MAAMJ,0BAA0B,CAACG,WAAW,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;IAEFH,EAAE,CAAC,6DAA6D,EAAE,MAAM;MACpE,MAAMC,WAAW,GAAG;QAChBG,EAAE,EAAE,CAAC;MACT,CAAC;MAEDF,MAAM,CAAC,MAAMJ,0BAA0B,CAACG,WAAW,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC;IAEFH,EAAE,CAAC,8CAA8C,EAAE,MAAM;MACrD,MAAMC,WAAW,GAAG;QAChBG,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MAEDL,MAAM,CAACJ,0BAA0B,CAACG,WAAW,CAAC,CAAC,CAACO,OAAO,CAACP,WAAW,CAAC;IACxE,CAAC,CAAC;IAEFD,EAAE,CAAC,sCAAsC,EAAE,MAAM;MAC7C,MAAMC,WAAW,GAAG;QAChBI,EAAE,EAAE,GAAG;QACPD,EAAE,EAAE,CAAC;QACLE,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MAEDL,MAAM,CAACJ,0BAA0B,CAACG,WAAW,CAAC,CAAC,CAACO,OAAO,CAAC;QACpDJ,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC,CAAC;IACN,CAAC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AAM,CACzBC,OAAO,CAACX,WAAW,CAAgD;IACxE,MAAMa,KAAyC,GAAG;MAC9C,WAAW,EAAE,OAAO;MACpB,cAAc,EAAE,QAAQ;MACxBV,EAAE,EAAE,MAAM;MACVC,EAAE,EAAE;IACR,CAAC;IACD,MAAMU,UAAsB,GAAG;MAC3BC,KAAK,EAAE,GAAG;MACVC,MAAM,EAAE;IACZ,CAAC;IAEDf,MAAM,CAACL,qBAAqB,CAACiB,KAAK,EAAED,UAAU,EAAEE,UAAU,EAAEL,eAAe,CAAC,CAAC,CAACF,OAAO,CAAC,KAAK,CAAC;EAChG,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -1,4 +1,9 @@
1
+ import { Platform } from 'react-native';
1
2
  export const throwError = message => {
2
3
  throw new Error(`🦄 [react-native-unistyles]: ${message}`);
3
4
  };
5
+ export const warn = message => {
6
+ console.warn(`🦄 [react-native-unistyles]: ${message}`);
7
+ };
8
+ export const isWeb = () => Platform.OS === 'web';
4
9
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["throwError","message","Error"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC"}
1
+ {"version":3,"names":["Platform","throwError","message","Error","warn","console","isWeb","OS"],"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,GAAGA,CAAA,KAAMN,QAAQ,CAACO,EAAE,KAAK,KAAK"}
@@ -1,3 +1,4 @@
1
+ export { normalizeStyles } from './normalizeStyles';
1
2
  export { getBreakpointFromScreenWidth, sortAndValidateBreakpoints } from './breakpoints';
2
3
  export { proxifyFunction, parseStyle } from './styles';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getBreakpointFromScreenWidth","sortAndValidateBreakpoints","proxifyFunction","parseStyle"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,4BAA4B,EAAEC,0BAA0B,QAAQ,eAAe;AACxF,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU"}
1
+ {"version":3,"names":["normalizeStyles","getBreakpointFromScreenWidth","sortAndValidateBreakpoints","proxifyFunction","parseStyle"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,4BAA4B,EAAEC,0BAA0B,QAAQ,eAAe;AACxF,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU"}
@@ -174,7 +174,7 @@ describe('utils', () => {
174
174
  });
175
175
  });
176
176
  it('should detect incorrect media queries', () => {
177
- 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[['];
177
+ 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]'];
178
178
  incorrectMediaQueries.forEach(query => {
179
179
  expect(isMediaQuery(query)).toEqual(false);
180
180
  });
@@ -1 +1 @@
1
- {"version":3,"names":["extractValues","getKeyForCustomMediaQuery","isMediaQuery","isWithinTheHeight","isWithinTheWidth","isWithinTheWidthAndHeight","describe","it","mediaQuery","expect","toEqual","pairs","width","query","forEach","_ref","_ref2","height","_ref3","_ref4","screenSize","_ref5","_ref6","correctMediaQueries","incorrectMediaQueries","mediaQueries","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.spec.ts"],"mappings":"AAAA,SACIA,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,yBAAyB,QACtB,gBAAgB;AAGvBC,QAAQ,CAAC,OAAO,EAAE,MAAM;EACpBA,QAAQ,CAAC,eAAe,EAAE,MAAM;IAC5BC,EAAE,CAAC,mDAAmD,EAAE,MAAM;MAC1D,MAAMC,UAAU,GAAG,aAAa;MAEhCC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC,CAAC;IAEFH,EAAE,CAAC,8DAA8D,EAAE,MAAM;MACrE,MAAMC,UAAU,GAAG,WAAW;MAE9BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC;IAEFH,EAAE,CAAC,qDAAqD,EAAE,MAAM;MAC5D,MAAMC,UAAU,GAAG,QAAQ;MAE3BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;IAEFH,EAAE,CAAC,+DAA+D,EAAE,MAAM;MACtE,MAAMC,UAAU,GAAG,OAAO;MAE1BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEFH,EAAE,CAAC,sDAAsD,EAAE,MAAM;MAC7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,YAAY,GAAG,CACjB,CAAC,SAAS,EAAE,GAAG,CAAC,EAChB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAML,UAAsB,GAAG;QAC3BR,KAAK,EAAE,GAAG;QACVK,MAAM,EAAE;MACZ,CAAC;MAEDR,MAAM,CAACR,yBAAyB,CAACwB,YAAY,EAAEL,UAAU,CAAC,CAAC,CAACV,OAAO,CAAC,QAAQ,CAAC;IACjF,CAAC,CAAC;IAEFH,EAAE,CAAC,sCAAsC,EAAE,MAAM;MAC7C,MAAMkB,YAAY,GAAG,CACjB,CAAC,SAAS,EAAE,OAAO,CAAC,EACpB,CAAC,aAAa,EAAE,OAAO,CAAC,EACxB,CAAC,SAAS,EAAE,KAAK,CAAC,CACe;MACrC,MAAML,UAAsB,GAAG;QAC3BR,KAAK,EAAE,GAAG;QACVK,MAAM,EAAE;MACZ,CAAC;MAEDR,MAAM,CAACR,yBAAyB,CAACwB,YAAY,EAAEL,UAAU,CAAC,CAAC,CAACV,OAAO,CAACgB,SAAS,CAAC;IAClF,CAAC,CAAC;IAEFnB,EAAE,CAAC,+CAA+C,EAAE,MAAM;MACtD,MAAMkB,YAAY,GAAG,CACjB,CAAC,oBAAoB,EAAE,GAAG,CAAC,EAC3B,CAAC,eAAe,EAAE,GAAG,CAAC,EACtB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAML,UAAsB,GAAG;QAC3BR,KAAK,EAAE,GAAG;QACVK,MAAM,EAAE;MACZ,CAAC;MAEDR,MAAM,CAACR,yBAAyB,CAACwB,YAAY,EAAEL,UAAU,CAAC,CAAC,CAACV,OAAO,CAAC,oBAAoB,CAAC;IAC7F,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"names":["extractValues","getKeyForCustomMediaQuery","isMediaQuery","isWithinTheHeight","isWithinTheWidth","isWithinTheWidthAndHeight","describe","it","mediaQuery","expect","toEqual","pairs","width","query","forEach","_ref","_ref2","height","_ref3","_ref4","screenSize","_ref5","_ref6","correctMediaQueries","incorrectMediaQueries","mediaQueries","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.spec.ts"],"mappings":"AAAA,SACIA,aAAa,EACbC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,gBAAgB,EAChBC,yBAAyB,QACtB,gBAAgB;AAGvBC,QAAQ,CAAC,OAAO,EAAE,MAAM;EACpBA,QAAQ,CAAC,eAAe,EAAE,MAAM;IAC5BC,EAAE,CAAC,mDAAmD,EAAE,MAAM;MAC1D,MAAMC,UAAU,GAAG,aAAa;MAEhCC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC,CAAC;IAEFH,EAAE,CAAC,8DAA8D,EAAE,MAAM;MACrE,MAAMC,UAAU,GAAG,WAAW;MAE9BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC;IAEFH,EAAE,CAAC,qDAAqD,EAAE,MAAM;MAC5D,MAAMC,UAAU,GAAG,QAAQ;MAE3BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CAAC;IAEFH,EAAE,CAAC,+DAA+D,EAAE,MAAM;MACtE,MAAMC,UAAU,GAAG,OAAO;MAE1BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEFH,EAAE,CAAC,sDAAsD,EAAE,MAAM;MAC7D,MAAMC,UAAU,GAAG,SAAS;MAE5BC,MAAM,CAACT,aAAa,CAACQ,UAAU,CAAC,CAAC,CAACE,OAAO,CAAC,CAAC,CAAC,EAAC,GAAG,C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,CACkB;MACrC,MAAML,UAAsB,GAAG;QAC3BR,KAAK,EAAE,GAAG;QACVK,MAAM,EAAE;MACZ,CAAC;MAEDR,MAAM,CAACR,yBAAyB,CAACwB,YAAY,EAAEL,UAAU,CAAC,CAAC,CAACV,OAAO,CAAC,QAAQ,CAAC;IACjF,CAAC,CAAC;IAEFH,EAAE,CAAC,sCAAsC,EAAE,MAAM;MAC7C,MAAMkB,YAAY,GAAG,CACjB,CAAC,SAAS,EAAE,OAAO,CAAC,EACpB,CAAC,aAAa,EAAE,OAAO,CAAC,EACxB,CAAC,SAAS,EAAE,KAAK,CAAC,CACe;MACrC,MAAML,UAAsB,GAAG;QAC3BR,KAAK,EAAE,GAAG;QACVK,MAAM,EAAE;MACZ,CAAC;MAEDR,MAAM,CAACR,yBAAyB,CAACwB,YAAY,EAAEL,UAAU,CAAC,CAAC,CAACV,OAAO,CAACgB,SAAS,CAAC;IAClF,CAAC,CAAC;IAEFnB,EAAE,CAAC,+CAA+C,EAAE,MAAM;MACtD,MAAMkB,YAAY,GAAG,CACjB,CAAC,oBAAoB,EAAE,GAAG,CAAC,EAC3B,CAAC,eAAe,EAAE,GAAG,CAAC,EACtB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACkB;MACrC,MAAML,UAAsB,GAAG;QAC3BR,KAAK,EAAE,GAAG;QACVK,MAAM,EAAE;MACZ,CAAC;MAEDR,MAAM,CAACR,yBAAyB,CAACwB,YAAY,EAAEL,UAAU,CAAC,CAAC,CAACV,OAAO,CAAC,oBAAoB,CAAC;IAC7F,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ // nothing to do here
2
+ export const normalizeStyles = styles => styles;
3
+ //# sourceMappingURL=normalizeStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["normalizeStyles","styles"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.ts"],"mappings":"AAAA;AACA,OAAO,MAAMA,eAAe,GAAOC,MAAS,IAAKA,MAAW"}
@@ -0,0 +1,52 @@
1
+ import { warn } from './common';
2
+ const preprocessor = require('react-native-web/src/exports/StyleSheet/preprocess.js');
3
+ const normalizeBoxShadow = styles => {
4
+ const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
5
+ if (!requiredBoxShadowProperties.every(prop => prop in styles)) {
6
+ warn(`can't apply box shadow as you miss at least one of these properties: ${requiredBoxShadowProperties.join(', ')}`);
7
+ return {
8
+ shadowColor: undefined,
9
+ shadowOffset: undefined,
10
+ shadowOpacity: undefined,
11
+ shadowRadius: undefined
12
+ };
13
+ }
14
+ return {
15
+ boxShadow: preprocessor.createBoxShadowValue(styles),
16
+ shadowColor: undefined,
17
+ shadowOffset: undefined,
18
+ shadowOpacity: undefined,
19
+ shadowRadius: undefined
20
+ };
21
+ };
22
+ const normalizeTextShadow = styles => {
23
+ const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
24
+ if (!requiredTextShadowProperties.every(prop => prop in styles)) {
25
+ warn(`can't apply text shadow as you miss at least one of these properties: ${requiredTextShadowProperties.join(', ')}`);
26
+ return {
27
+ textShadowColor: undefined,
28
+ textShadowOffset: undefined,
29
+ textShadowRadius: undefined
30
+ };
31
+ }
32
+ return {
33
+ textShadow: preprocessor.createTextShadowValue(styles),
34
+ textShadowColor: undefined,
35
+ textShadowOffset: undefined,
36
+ textShadowRadius: undefined
37
+ };
38
+ };
39
+ export const normalizeStyles = styles => {
40
+ const normalizedTransform = 'transform' in styles && Array.isArray(styles.transform) ? {
41
+ transform: preprocessor.createTransformValue(styles.transform)
42
+ } : {};
43
+ const normalizedBoxShadow = 'shadowColor' in styles || 'shadowOffset' in styles || 'shadowOpacity' in styles || 'shadowRadius' in styles ? normalizeBoxShadow(styles) : {};
44
+ const normalizedTextShadow = 'textShadowColor' in styles || 'textShadowOffset' in styles || 'textShadowRadius' in styles ? normalizeTextShadow(styles) : {};
45
+ return {
46
+ ...styles,
47
+ ...normalizedTransform,
48
+ ...normalizedBoxShadow,
49
+ ...normalizedTextShadow
50
+ };
51
+ };
52
+ //# sourceMappingURL=normalizeStyles.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["warn","preprocessor","require","normalizeBoxShadow","styles","requiredBoxShadowProperties","every","prop","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAE/B,MAAMC,YAA0B,GAAGC,OAAO,CAAC,uDAAuD,CAAC;AAuBnG,MAAMC,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;IAC5DJ,IAAI,CAAE,wEAAuEK,2BAA2B,CAACG,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW,EAAEC,SAAS;MACtBC,YAAY,EAAED,SAAS;MACvBE,aAAa,EAAEF,SAAS;MACxBG,YAAY,EAAEH;IAClB,CAAC;EACL;EAEA,OAAO;IACHI,SAAS,EAAEb,YAAY,CAACc,oBAAoB,CAACX,MAAM,CAAC;IACpDK,WAAW,EAAEC,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMM,mBAAmB,GAAkBZ,MAAS,IAA2B;EAC3E,MAAMa,4BAA4B,GAAG,CACjC,iBAAiB,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ForBreakpoint } from './breakpoints';
2
+ import { normalizeStyles } from './normalizeStyles';
3
+ import { isWeb } from './common';
2
4
 
3
5
  /**
4
6
  * Proxies a function to parse its return value for custom media queries or breakpoints.
@@ -8,7 +10,7 @@ import { getValueForBreakpoint } from './breakpoints';
8
10
  * @param {Function} fn - The function to be proxified.
9
11
  * @param {keyof B & string} breakpoint - The breakpoint name to check against.
10
12
  * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
11
- * @param {B} breakpoints - An object representing the defined breakpoints.
13
+ * @param breakpointPairs - sorted pairs of breakpoints
12
14
  *
13
15
  * @returns {Function} Returns the proxified function
14
16
  *
@@ -21,8 +23,8 @@ import { getValueForBreakpoint } from './breakpoints';
21
23
  * const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
22
24
  * proxifiedFunction() // parsed style based on screenSize and breakpoints
23
25
  */
24
- export const proxifyFunction = (fn, breakpoint, screenSize, breakpoints) => new Proxy(fn, {
25
- apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpoints)
26
+ export const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) => new Proxy(fn, {
27
+ apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpointPairs)
26
28
  });
27
29
 
28
30
  /**
@@ -37,7 +39,7 @@ export const proxifyFunction = (fn, breakpoint, screenSize, breakpoints) => new
37
39
  * @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
38
40
  * @param {keyof B & string} breakpoint - The breakpoint name to check against.
39
41
  * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
40
- * @param {B} breakpoints - An object representing the defined breakpoints.
42
+ * @param breakpointPairs - sorted pairs of breakpoints
41
43
  *
42
44
  * @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
43
45
  *
@@ -50,25 +52,25 @@ export const proxifyFunction = (fn, breakpoint, screenSize, breakpoints) => new
50
52
  * const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
51
53
  * // { fontSize: '12px' }
52
54
  */
53
- export const parseStyle = (style, breakpoint, screenSize, breakpoints) => {
55
+ export const parseStyle = (style, breakpoint, screenSize, breakpointPairs) => {
54
56
  const entries = Object.entries(style);
55
- return Object.fromEntries(entries.map(_ref => {
57
+ const parsedStyles = Object.fromEntries(entries.map(_ref => {
56
58
  let [key, value] = _ref;
57
- const isNestedStyle = key === 'shadowOffset';
58
- if (isNestedStyle) {
59
- return [key, parseStyle(value, breakpoint, screenSize, breakpoints)];
59
+ const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
60
+ if (hasNestedProperties) {
61
+ return [key, parseStyle(value, breakpoint, screenSize, breakpointPairs)];
60
62
  }
61
63
  const isTransform = key === 'transform';
62
64
  if (isTransform && Array.isArray(value)) {
63
- return [key, value.map(value => parseStyle(value, breakpoint, screenSize, breakpoints))];
65
+ return [key, value.map(value => parseStyle(value, breakpoint, screenSize, breakpointPairs))];
64
66
  }
65
67
  const isDynamicFunction = typeof value === 'function';
66
68
  const isValidStyle = typeof value !== 'object';
67
69
  if (isDynamicFunction || isValidStyle) {
68
70
  return [key, value];
69
71
  }
70
- const valueWithBreakpoint = value;
71
- return [key, getValueForBreakpoint(valueWithBreakpoint, breakpoint, screenSize, breakpoints)];
72
+ return [key, getValueForBreakpoint(value, breakpoint, screenSize, breakpointPairs)];
72
73
  }));
74
+ return isWeb() ? normalizeStyles(parsedStyles) : parsedStyles;
73
75
  };
74
76
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getValueForBreakpoint","proxifyFunction","fn","breakpoint","screenSize","breakpoints","Proxy","apply","target","thisArg","argumentsList","parseStyle","style","entries","Object","fromEntries","map","_ref","key","value","isNestedStyle","isTransform","Array","isArray","isDynamicFunction","isValidStyle","valueWithBreakpoint"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB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B,UAAU,EAAEC,UAAU,EAAEC,WAAW,CAAC,CAAC,CAC7E;IACL;IAEA,MAAMmB,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,MAAMO,mBAAmB,GAAGP,KAAkD;IAE9E,OAAO,CAACD,GAAG,EAAElB,qBAAqB,CAAI0B,mBAAmB,EAAEvB,UAAU,EAAEC,UAAU,EAAEC,WAAW,CAAC,CAAC;EACpG,CAAC,CACL,CAAC;AACT,CAAC"}
1
+ {"version":3,"names":["getValueForBreakpoint","normalizeStyles","isWeb","proxifyFunction","fn","breakpoint","screenSize","breakpointPairs","Proxy","apply","target","thisArg","argumentsList","parseStyle","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","value","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,KAAK,QAAQ,UAAU;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA4B,EAC1CC,UAAsB,EACtBC,eAA2C,KAChC,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,eAAe;AAChG,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AACgB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
@@ -12,13 +12,14 @@ describe('styles', () => {
12
12
  sm: 400,
13
13
  md: 800
14
14
  };
15
+ const breakpointPairs = Object.entries(breakpoints);
15
16
  const dynamicFunction = isEven => ({
16
17
  backgroundColor: {
17
18
  sm: isEven ? 'green' : 'red',
18
19
  md: isEven ? 'orange' : 'pink'
19
20
  }
20
21
  });
21
- expect(proxifyFunction(dynamicFunction, breakpoint, screenSize, breakpoints)(true)).toEqual({
22
+ expect(proxifyFunction(dynamicFunction, breakpoint, screenSize, breakpointPairs)(true)).toEqual({
22
23
  backgroundColor: 'green'
23
24
  });
24
25
  });
@@ -33,13 +34,14 @@ describe('styles', () => {
33
34
  sm: 400,
34
35
  md: 800
35
36
  };
37
+ const breakpointPairs = Object.entries(breakpoints);
36
38
  const dynamicFunction = isEven => ({
37
39
  backgroundColor: {
38
40
  ':w[,399]': isEven ? 'green' : 'red',
39
41
  ':w[400]': isEven ? 'orange' : 'pink'
40
42
  }
41
43
  });
42
- expect(proxifyFunction(dynamicFunction, breakpoint, screenSize, breakpoints)(false)).toEqual({
44
+ expect(proxifyFunction(dynamicFunction, breakpoint, screenSize, breakpointPairs)(false)).toEqual({
43
45
  backgroundColor: 'pink'
44
46
  });
45
47
  });
@@ -54,10 +56,11 @@ describe('styles', () => {
54
56
  sm: 400,
55
57
  md: 800
56
58
  };
59
+ const breakpointPairs = Object.entries(breakpoints);
57
60
  const dynamicFunction = isEven => ({
58
61
  backgroundColor: isEven ? 'pink' : 'purple'
59
62
  });
60
- expect(proxifyFunction(dynamicFunction, breakpoint, screenSize, breakpoints)(false)).toEqual({
63
+ expect(proxifyFunction(dynamicFunction, breakpoint, screenSize, breakpointPairs)(false)).toEqual({
61
64
  backgroundColor: 'purple'
62
65
  });
63
66
  });
@@ -74,6 +77,7 @@ describe('styles', () => {
74
77
  sm: 400,
75
78
  md: 800
76
79
  };
80
+ const breakpointPairs = Object.entries(breakpoints);
77
81
  const style = {
78
82
  fontSize: {
79
83
  sm: 12,
@@ -85,7 +89,8 @@ describe('styles', () => {
85
89
  },
86
90
  fontWeight: 'bold'
87
91
  };
88
- expect(parseStyle(style, breakpoint, screenSize, breakpoints)).toEqual({
92
+ const parsedStyles = parseStyle(style, breakpoint, screenSize, breakpointPairs);
93
+ expect(parsedStyles).toEqual({
89
94
  fontSize: 12,
90
95
  backgroundColor: 'pink',
91
96
  fontWeight: 'bold'
@@ -102,6 +107,7 @@ describe('styles', () => {
102
107
  sm: 400,
103
108
  md: 800
104
109
  };
110
+ const breakpointPairs = Object.entries(breakpoints);
105
111
  const style = {
106
112
  transform: [{
107
113
  translateX: {
@@ -111,7 +117,8 @@ describe('styles', () => {
111
117
  translateY: 200
112
118
  }]
113
119
  };
114
- expect(parseStyle(style, breakpoint, screenSize, breakpoints)).toEqual({
120
+ const parsedStyles = parseStyle(style, breakpoint, screenSize, breakpointPairs);
121
+ expect(parsedStyles).toEqual({
115
122
  transform: [{
116
123
  translateX: 120,
117
124
  translateY: 200
@@ -129,6 +136,7 @@ describe('styles', () => {
129
136
  sm: 400,
130
137
  md: 800
131
138
  };
139
+ const breakpointPairs = Object.entries(breakpoints);
132
140
  const style = {
133
141
  shadowOffset: {
134
142
  width: 0,
@@ -144,13 +152,15 @@ describe('styles', () => {
144
152
  }
145
153
  }
146
154
  };
147
- expect(parseStyle(style, breakpoint, screenSize, breakpoints)).toEqual({
155
+ const parsedStyles = parseStyle(style, breakpoint, screenSize, breakpointPairs);
156
+ const parsedStylesWithBreakpoints = parseStyle(styleWithBreakpoints, breakpoint, screenSize, breakpointPairs);
157
+ expect(parsedStyles).toEqual({
148
158
  shadowOffset: {
149
159
  width: 0,
150
160
  height: 4
151
161
  }
152
162
  });
153
- expect(parseStyle(styleWithBreakpoints, breakpoint, screenSize, breakpoints)).toEqual({
163
+ expect(parsedStylesWithBreakpoints).toEqual({
154
164
  shadowOffset: {
155
165
  width: 0,
156
166
  height: 10
@@ -1 +1 @@
1
- {"version":3,"names":["parseStyle","proxifyFunction","describe","it","screenSize","width","height","breakpoint","breakpoints","xs","sm","md","dynamicFunction","isEven","backgroundColor","expect","toEqual","style","fontSize","fontWeight","transform","translateX","translateY","shadowOffset","styleWithBreakpoints"],"sourceRoot":"../../../src","sources":["utils/styles.spec.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,eAAe,QAAQ,UAAU;AAGtDC,QAAQ,CAAC,QAAQ,EAAE,MAAM;EACrBA,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAC9BC,EAAE,CAAC,yCAAyC,EAAE,MAAM;MAChD,MAAMC,UAAsB,GAAG;QAC3BC,KAAK,EAAE,GAAG;QACVC,MAAM,EAAE;MACZ,CAAC;MACD,MAAMC,UAAU,GAAG,IAAI;MACvB,MAAMC,WAAW,GAAG;QAChBC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MACD,MAAMC,eAAe,GAAIC,MAAe,KAAM;QAC1CC,eAAe,EAAE;UACbJ,EAAE,EAAEG,MAAM,GACJ,OAAO,GACP,KAAK;UACXF,EAAE,EAAEE,MAAM,GACJ,QAAQ,GACR;QACV;MACJ,CAAC,CAAC;MAEFE,MAAM,CAACd,eAAe,CAACW,eAAe,EAAEL,UAAU,EAAEH,UAAU,EAAEI,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAACQ,OAAO,CAAC;QACxFF,eAAe,EAAE;MACrB,CAAC,CAAC;IACN,CAAC,CAAC;IAEFX,EAAE,CAAC,yDAAyD,EAAE,MAAM;MAChE,MAAMC,UAAsB,GAAG;QAC3BC,KAAK,EAAE,GAAG;QACVC,MAAM,EAAE;MACZ,CAAC;MACD,MAAMC,UAAU,GAAG,IAAI;MACvB,MAAMC,WAAW,GAAG;QAChBC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,GAAG;QACPC,EAAE,EAAE;MACR,CAAC;MACD,MAAMC,eAAe,GAAIC,MAAe,KAAM;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R,CAAC;MACD,MAAMM,KAAK,GAAG;QACVM,YAAY,EAAE;UACVlB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;QACZ;MACJ,CAAC;MACD,MAAMkB,oBAAoB,GAAG;QACzBD,YAAY,EAAE;UACVlB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;YACJI,EAAE,EAAE,EAAE;YACNC,EAAE,EAAE;UACR;QACJ;MACJ,CAAC;MAEDI,MAAM,CAACf,UAAU,CAACiB,KAAK,EAAyDV,UAAU,EAAEH,UAAU,EAAEI,WAAW,CAAC,CAAC,CAACQ,OAAO,CAAC;QAC1HO,YAAY,EAAE;UACVlB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;QACZ;MACJ,CAAC,CAAC;MACFS,MAAM,CAACf,UAAU,CAACwB,oBAAoB,EAAyDjB,UAAU,EAAEH,UAAU,EAAEI,WAAW,CAAC,CAAC,CAACQ,OAAO,CAAC;QACzIO,YAAY,EAAE;UACVlB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;QACZ;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"names":["parseStyle","proxifyFunction","describe","it","screenSize","width","height","breakpoint","breakpoints","xs","sm","md","breakpointPairs","Object","entries","dynamicFunction","isEven","backgroundColor","expect","toEqual","style","fontSize","fontWeight","parsedStyles","transform","translateX","translateY","shadowOffset","styleWithBreakpoints","parsedStylesWithBreakpoints"],"sourceRoot":"../../../src","sources":["utils/styles.spec.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,eAAe,QAAQ,UAAU;AAItDC,QAAQ,CAAC,QAAQ,EAAE,MAAM;EACrBA,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAC9BC,EAAE,CAAC,yCAAyC,EAAE,MAAM;MAChD,MAAMC,UAAsB,GAAG;QAC3BC,KAAK,EAAE,GAAG;QACVC,MAAM,EAAE;MACZ,CAAC;MACD,MAAMC,UAAU,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KAAK,GAAG;QACVO,YAAY,EAAE;UACVtB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;QACZ;MACJ,CAAC;MACD,MAAMsB,oBAAoB,GAAG;QACzBD,YAAY,EAAE;UACVtB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;YACJI,EAAE,EAAE,EAAE;YACNC,EAAE,EAAE;UACR;QACJ;MACJ,CAAC;MAED,MAAMY,YAAY,GAAGvB,UAAU,CAC3BoB,KAAK,EACLb,UAAU,EACVH,UAAU,EACVQ,eACJ,CAAC;MACD,MAAMiB,2BAA2B,GAAG7B,UAAU,CAC1C4B,oBAAoB,EACpBrB,UAAU,EACVH,UAAU,EACVQ,eACJ,CAAC;MAEDM,MAAM,CAACK,YAAY,CAAC,CAACJ,OAAO,CAAC;QACzBQ,YAAY,EAAE;UACVtB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;QACZ;MACJ,CAAC,CAAC;MACFY,MAAM,CAACW,2BAA2B,CAAC,CAACV,OAAO,CAAC;QACxCQ,YAAY,EAAE;UACVtB,KAAK,EAAE,CAAC;UACRC,MAAM,EAAE;QACZ;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC"}
@@ -1,6 +1,10 @@
1
- import type { CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
2
- export declare const createUnistyles: <B extends Record<string, number>, T = {}>(breakpoints: B) => {
3
- createStyles: <S extends CustomNamedStyles<S, B>>(styles: S | CreateStylesFactory<S, T>) => S;
1
+ import type { Breakpoints, CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
2
+ export declare const createUnistyles: <B extends Breakpoints, T = {}>(breakpoints: B) => {
3
+ /**
4
+ * @deprecated The method should not be used, proposed version by the community is createStyleSheet, will be removed in RC
5
+ */
6
+ createStyles: <S extends CustomNamedStyles<S, B>, X>(styles: S | X | CustomNamedStyles<S, B> | ((theme: T) => X | CustomNamedStyles<X, B>)) => S | X;
7
+ createStyleSheet: <S_1 extends CustomNamedStyles<S_1, B>, X_1>(styles: S_1 | X_1 | CustomNamedStyles<S_1, B> | ((theme: T) => X_1 | CustomNamedStyles<X_1, B>)) => S_1 | X_1;
4
8
  useStyles: <ST extends CustomNamedStyles<ST, B>>(stylesheet?: ST | CreateStylesFactory<ST, T> | undefined) => {
5
9
  theme: T;
6
10
  styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST, B>, B>;
@@ -1 +1 @@
1
- {"version":3,"file":"createUnistyles.d.ts","sourceRoot":"","sources":["../../../src/createUnistyles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAc,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAK3H,eAAO,MAAM,eAAe;;;;;;CAiD3B,CAAA"}
1
+ {"version":3,"file":"createUnistyles.d.ts","sourceRoot":"","sources":["../../../src/createUnistyles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAEvB,MAAM,SAAS,CAAA;AAKhB,eAAO,MAAM,eAAe;IAMpB;;OAEG;;;;;;;CAuDV,CAAA"}
@@ -0,0 +1,2 @@
1
+ export type MediaQueries = `:w[${bigint}]` | `:w[,${bigint}]` | `:w[${bigint},${bigint}]` | `:h[${bigint}]` | `:h[,${bigint}]` | `:h[${bigint},${bigint}]` | `:w[${bigint}]:h[${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint}]` | `:w[${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint},${bigint}]:h[${bigint},${bigint}]` | `:w[,${bigint}]:h[,${bigint}]` | `:w[,${bigint}]:h[${bigint}]` | `:w[${bigint}]:h[,${bigint}]` | `:w[,${bigint}]:h[${bigint},${bigint}]` | `:w[${bigint},${bigint}]:h[,${bigint}]` | `:h[${bigint}]:w[${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint}]` | `:h[${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint},${bigint}]:w[${bigint},${bigint}]` | `:h[,${bigint}]:w[,${bigint}]` | `:h[,${bigint}]:w[${bigint}]` | `:h[${bigint}]:w[,${bigint}]` | `:h[,${bigint}]:w[${bigint},${bigint}]` | `:h[${bigint},${bigint}]:w[,${bigint}]`;
2
+ //# sourceMappingURL=mediaQueries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../src/mediaQueries.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,YAAY,GAExB,MAAM,MAAM,GAAG,GACf,OAAO,MAAM,GAAG,GAChB,MAAM,MAAM,IAAI,MAAM,GAAG,GAGzB,MAAM,MAAM,GAAG,GACf,OAAO,MAAM,GAAG,GAChB,MAAM,MAAM,IAAI,MAAM,GAAG,GAGzB,MAAM,MAAM,OAAO,MAAM,GAAG,GAC5B,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,GACtC,MAAM,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACtC,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GAChD,OAAO,MAAM,QAAQ,MAAM,GAAG,GAC9B,OAAO,MAAM,OAAO,MAAM,GAAG,GAC7B,MAAM,MAAM,QAAQ,MAAM,GAAG,GAC7B,OAAO,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACvC,MAAM,MAAM,IAAI,MAAM,QAAQ,MAAM,GAAG,GAGvC,MAAM,MAAM,OAAO,MAAM,GAAG,GAC5B,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,GAAG,GACtC,MAAM,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACtC,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GAChD,OAAO,MAAM,QAAQ,MAAM,GAAG,GAC9B,OAAO,MAAM,OAAO,MAAM,GAAG,GAC7B,MAAM,MAAM,QAAQ,MAAM,GAAG,GAC7B,OAAO,MAAM,OAAO,MAAM,IAAI,MAAM,GAAG,GACvC,MAAM,MAAM,IAAI,MAAM,QAAQ,MAAM,GAAG,CAAA"}