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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/cxx/UnistylesRuntime.cpp +262 -0
  2. package/cxx/UnistylesRuntime.h +61 -0
  3. package/lib/commonjs/Unistyles.js +1 -1
  4. package/lib/commonjs/Unistyles.js.map +1 -1
  5. package/lib/commonjs/UnistylesEngine.js +9 -5
  6. package/lib/commonjs/UnistylesEngine.js.map +1 -1
  7. package/lib/commonjs/createStyleSheet.js.map +1 -1
  8. package/lib/commonjs/index.js +7 -0
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/types/cxx.js.map +1 -1
  11. package/lib/commonjs/useStyles.js +0 -2
  12. package/lib/commonjs/useStyles.js.map +1 -1
  13. package/lib/commonjs/useUnistyles.js.map +1 -1
  14. package/lib/commonjs/utils/breakpoints.js +11 -68
  15. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  16. package/lib/commonjs/utils/common.js +3 -1
  17. package/lib/commonjs/utils/common.js.map +1 -1
  18. package/lib/commonjs/utils/index.js +8 -0
  19. package/lib/commonjs/utils/index.js.map +1 -1
  20. package/lib/commonjs/utils/mediaQueries.js +57 -155
  21. package/lib/commonjs/utils/mediaQueries.js.map +1 -1
  22. package/lib/commonjs/utils/mq.js +75 -0
  23. package/lib/commonjs/utils/mq.js.map +1 -0
  24. package/lib/commonjs/utils/styles.js +11 -51
  25. package/lib/commonjs/utils/styles.js.map +1 -1
  26. package/lib/module/Unistyles.js +2 -2
  27. package/lib/module/Unistyles.js.map +1 -1
  28. package/lib/module/UnistylesEngine.js +7 -3
  29. package/lib/module/UnistylesEngine.js.map +1 -1
  30. package/lib/module/createStyleSheet.js.map +1 -1
  31. package/lib/module/index.js +1 -0
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/module/types/cxx.js.map +1 -1
  34. package/lib/module/useStyles.js +0 -3
  35. package/lib/module/useStyles.js.map +1 -1
  36. package/lib/module/useUnistyles.js.map +1 -1
  37. package/lib/module/utils/breakpoints.js +11 -68
  38. package/lib/module/utils/breakpoints.js.map +1 -1
  39. package/lib/module/utils/common.js +2 -0
  40. package/lib/module/utils/common.js.map +1 -1
  41. package/lib/module/utils/index.js +1 -0
  42. package/lib/module/utils/index.js.map +1 -1
  43. package/lib/module/utils/mediaQueries.js +57 -155
  44. package/lib/module/utils/mediaQueries.js.map +1 -1
  45. package/lib/module/utils/mq.js +69 -0
  46. package/lib/module/utils/mq.js.map +1 -0
  47. package/lib/module/utils/styles.js +10 -51
  48. package/lib/module/utils/styles.js.map +1 -1
  49. package/lib/typescript/src/Unistyles.d.ts +2 -2
  50. package/lib/typescript/src/Unistyles.d.ts.map +1 -1
  51. package/lib/typescript/src/UnistylesEngine.d.ts +4 -1
  52. package/lib/typescript/src/UnistylesEngine.d.ts.map +1 -1
  53. package/lib/typescript/src/createStyleSheet.d.ts +2 -5
  54. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
  55. package/lib/typescript/src/index.d.ts +1 -0
  56. package/lib/typescript/src/index.d.ts.map +1 -1
  57. package/lib/typescript/src/types/breakpoints.d.ts +2 -1
  58. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  59. package/lib/typescript/src/types/core.d.ts +18 -16
  60. package/lib/typescript/src/types/core.d.ts.map +1 -1
  61. package/lib/typescript/src/types/cxx.d.ts +7 -1
  62. package/lib/typescript/src/types/cxx.d.ts.map +1 -1
  63. package/lib/typescript/src/types/index.d.ts +1 -1
  64. package/lib/typescript/src/types/index.d.ts.map +1 -1
  65. package/lib/typescript/src/types/mediaQueries.d.ts +5 -3
  66. package/lib/typescript/src/types/mediaQueries.d.ts.map +1 -1
  67. package/lib/typescript/src/useStyles.d.ts +2 -4
  68. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  69. package/lib/typescript/src/useUnistyles.d.ts +4 -5
  70. package/lib/typescript/src/useUnistyles.d.ts.map +1 -1
  71. package/lib/typescript/src/utils/breakpoints.d.ts +2 -60
  72. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  73. package/lib/typescript/src/utils/common.d.ts +2 -0
  74. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  75. package/lib/typescript/src/utils/index.d.ts +1 -0
  76. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  77. package/lib/typescript/src/utils/mediaQueries.d.ts +8 -127
  78. package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -1
  79. package/lib/typescript/src/utils/mq.d.ts +15 -0
  80. package/lib/typescript/src/utils/mq.d.ts.map +1 -0
  81. package/lib/typescript/src/utils/styles.d.ts +1 -46
  82. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  83. package/package.json +10 -1
  84. package/src/Unistyles.ts +3 -3
  85. package/src/UnistylesEngine.ts +12 -3
  86. package/src/createStyleSheet.ts +2 -5
  87. package/src/index.ts +1 -0
  88. package/src/types/breakpoints.ts +6 -3
  89. package/src/types/core.ts +25 -22
  90. package/src/types/cxx.ts +8 -1
  91. package/src/types/index.ts +1 -1
  92. package/src/types/mediaQueries.ts +9 -4
  93. package/src/useStyles.ts +3 -6
  94. package/src/useUnistyles.ts +11 -4
  95. package/src/utils/breakpoints.ts +14 -71
  96. package/src/utils/common.ts +2 -0
  97. package/src/utils/index.ts +1 -0
  98. package/src/utils/mediaQueries.ts +102 -163
  99. package/src/utils/mq.ts +77 -0
  100. package/src/utils/styles.ts +13 -55
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  var _exportNames = {
7
7
  normalizeStyles: true,
8
+ mq: true,
8
9
  getBreakpointFromScreenWidth: true,
9
10
  sortAndValidateBreakpoints: true,
10
11
  getValueForBreakpoint: true,
@@ -79,6 +80,12 @@ Object.defineProperty(exports, "isWithinTheWidthAndHeight", {
79
80
  return _mediaQueries.isWithinTheWidthAndHeight;
80
81
  }
81
82
  });
83
+ Object.defineProperty(exports, "mq", {
84
+ enumerable: true,
85
+ get: function () {
86
+ return _mq.mq;
87
+ }
88
+ });
82
89
  Object.defineProperty(exports, "normalizeStyles", {
83
90
  enumerable: true,
84
91
  get: function () {
@@ -116,6 +123,7 @@ Object.keys(_normalizer).forEach(function (key) {
116
123
  }
117
124
  });
118
125
  });
126
+ var _mq = require("./mq");
119
127
  var _breakpoints = require("./breakpoints");
120
128
  var _styles = require("./styles");
121
129
  var _common = require("./common");
@@ -1 +1 @@
1
- {"version":3,"names":["_normalizeStyles","require","_normalizer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_breakpoints","_styles","_common","_mediaQueries"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,YAAA,GAAAd,OAAA;AACA,IAAAe,OAAA,GAAAf,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA"}
1
+ {"version":3,"names":["_normalizeStyles","require","_normalizer","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_mq","_breakpoints","_styles","_common","_mediaQueries"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,WAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,WAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,WAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,GAAA,GAAAd,OAAA;AACA,IAAAe,YAAA,GAAAf,OAAA;AACA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,OAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA"}
@@ -4,191 +4,93 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isWithinTheWidthAndHeight = exports.isWithinTheWidth = exports.isWithinTheHeight = exports.isWithinBreakpoint = exports.isMediaQuery = exports.getKeyForCustomMediaQuery = exports.extractValues = void 0;
7
- /**
8
- * Extracts numeric values from a coded string.
9
- *
10
- * The function is designed to process strings that have a format like "w[100,200]" or "h[300]".
11
- * It removes characters 'w', 'h', '[', and ']' from the input string and then extracts the numbers.
12
- *
13
- * @param {string} codedValue - The input string to extract values from.
14
- * @returns {Array<number>} An array of extracted numbers. Can contain one or two numbers based on the input format.
15
- *
16
- * @example
17
- * extractValues("w[100,200]") // returns [100, 200]
18
- * extractValues("h[300]") // returns [300]
19
- * extractValues("h[,300]") // returns [0,300]
20
- * extractValues("h[100,]") // returns [100]
21
- */
22
- const extractValues = codedValue => {
23
- const cleanedValue = codedValue.replace(/[wh ]/g, '');
24
- const [left, right] = cleanedValue.split(',');
25
- if (!right) {
26
- const lh = left.startsWith('[') ? Number(left.replace(/[[\]()]/g, '')) : Number(left.replace(/[[\]()]/g, '')) + 1;
27
- return [lh];
7
+ const parseLhs = (lhs, breakpoints, hasRhs) => {
8
+ const matches = lhs.match(/([([])|([^[\]()]+)|([\])])/g);
9
+ if (!hasRhs) {
10
+ const [openBracket, value, closeBracket] = matches;
11
+ const spacelessValue = value?.trim();
12
+ const parsedNumber = Number(spacelessValue);
13
+ const parsedValue = isNaN(parsedNumber) ? breakpoints[spacelessValue] : parsedNumber;
14
+ return [Number(openBracket === '('), closeBracket === ')' ? parsedValue - 1 : parsedValue];
28
15
  }
29
- const lh = left.startsWith('[') ? Number(left.replace('[', '')) : Number(left.replace('(', '')) + 1;
30
- const rh = right.endsWith(']') ? Number(right.replace(']', '')) : Number(right.replace(')', '')) - 1;
31
- return [lh, rh];
16
+ const [openBracket, value] = matches;
17
+ if (!value) {
18
+ return [Number(openBracket === '(')];
19
+ }
20
+ const spacelessValue = value?.trim();
21
+ const parsedNumber = Number(spacelessValue);
22
+ const parsedValue = isNaN(parsedNumber) ? breakpoints[spacelessValue] : parsedNumber;
23
+ return openBracket === '(' ? [parsedValue - 1] : [parsedValue];
24
+ };
25
+ const parseRhs = (rhs, breakpoints) => {
26
+ const matches = rhs.match(/([([])|([^[\]()]+)|([\])])/g);
27
+ const [value, closeBrackets] = matches;
28
+ const spacelessValue = value.trim();
29
+ const parsedNumber = Number(spacelessValue);
30
+ const parsedValue = isNaN(parsedNumber) ? breakpoints[spacelessValue] : parsedNumber;
31
+ return [closeBrackets === ')' ? parsedValue - 1 : parsedValue];
32
+ };
33
+ const extractValues = (pattern, breakpoints) => {
34
+ const [lhs, rhs] = pattern.replace(/(:w|:h)/g, '').split(',');
35
+ if (!rhs) {
36
+ return parseLhs(lhs, breakpoints, false);
37
+ }
38
+ const [parsedLhs] = parseLhs(lhs, breakpoints, true);
39
+ if (parsedLhs === undefined || isNaN(parsedLhs)) {
40
+ return [];
41
+ }
42
+ const [parsedRhs] = parseRhs(rhs, breakpoints);
43
+ if (parsedRhs === undefined || isNaN(parsedRhs)) {
44
+ return [];
45
+ }
46
+ return [parsedLhs, parsedRhs];
32
47
  };
33
-
34
- /**
35
- * Determines if the given screen size matches the specified breakpoint query.
36
- *
37
- * The function checks if the screen size (width and/or height) falls within the range
38
- * specified by the breakpoint query. The query can specify width (using 'w'), height (using 'h'),
39
- * or both.
40
- *
41
- * @param {string} query - The breakpoint query string. Examples: 'w[100,200]', 'h[300]', 'w[100,200]h[300,400]'.
42
- * @param {ScreenSize} screenSize - The screen size to check against the breakpoint query.
43
- * @returns {boolean} True if the screen size matches the breakpoint query, false otherwise.
44
- *
45
- * @example
46
- * const screenSize = { width: 150, height: 350 }
47
- * isWithinBreakpoint('w[100,200]', screenSize) // returns true
48
- * isWithinBreakpoint('h[400]', screenSize) // returns false
49
- */
50
48
  exports.extractValues = extractValues;
51
- const isWithinBreakpoint = (query, screenSize) => {
52
- if (query.includes('w') && query.includes('h')) {
53
- return isWithinTheWidthAndHeight(query, screenSize);
49
+ const isWithinBreakpoint = (query, screenSize, breakpoints) => {
50
+ const hasWidthBreakpoint = query.includes(':w');
51
+ const hasHeightBreakpoint = query.includes(':h');
52
+ if (hasWidthBreakpoint && hasHeightBreakpoint) {
53
+ return isWithinTheWidthAndHeight(query, screenSize, breakpoints);
54
54
  }
55
- if (query.charAt(0) === 'w') {
56
- return isWithinTheWidth(query, screenSize.width);
55
+ if (hasWidthBreakpoint) {
56
+ return isWithinTheWidth(query, screenSize.width, breakpoints);
57
57
  }
58
- if (query.charAt(0) === 'h') {
59
- return isWithinTheHeight(query, screenSize.height);
58
+ if (hasHeightBreakpoint) {
59
+ return isWithinTheHeight(query, screenSize.height, breakpoints);
60
60
  }
61
61
  return false;
62
62
  };
63
-
64
- /**
65
- * Determines if the given width matches the specified width range in the query.
66
- *
67
- * The function checks if the provided width falls within the range specified by the query.
68
- * The query specifies a width range using a format like 'w[100,200]'. If only one value is provided,
69
- * it's treated as a minimum width.
70
- *
71
- * @param {string} query - The width query string. Examples: 'w[100,200]' or 'w[100]'.
72
- * @param {number} width - The width to check against the query.
73
- * @returns {boolean} True if the width matches the query range, false otherwise.
74
- *
75
- * @example
76
- * isWithinTheWidth('w[100,200]', 150) // returns true
77
- * isWithinTheWidth('w[100]', 50) // returns false
78
- * isWithinTheWidth('w[100]', 150) // returns true
79
- */
80
63
  exports.isWithinBreakpoint = isWithinBreakpoint;
81
- const isWithinTheWidth = (query, width) => {
82
- const [minWidth, maxWidth] = extractValues(query);
64
+ const isWithinTheWidth = (query, width, breakpoints) => {
65
+ const [minWidth, maxWidth] = extractValues(query, breakpoints);
83
66
  if (maxWidth && width >= minWidth && width <= maxWidth) {
84
67
  return true;
85
68
  }
86
69
  return !maxWidth && width >= minWidth;
87
70
  };
88
-
89
- /**
90
- * Determines if the given height matches the specified height range in the query.
91
- *
92
- * The function checks if the provided height falls within the range specified by the query.
93
- * The query specifies a height range using a format like 'h[100,200]'. If only one value is provided,
94
- * it's treated as a minimum height.
95
- *
96
- * @param {string} query - The height query string. Examples: 'h[100,200]' or 'h[100]'.
97
- * @param {number} height - The height to check against the query.
98
- * @returns {boolean} True if the height matches the query range, false otherwise.
99
- *
100
- * @example
101
- * isWithinTheHeight('h[100,200]', 150) // returns true
102
- * isWithinTheHeight('h[100]', 50) // returns false
103
- * isWithinTheHeight('h[100]', 150) // returns true
104
- */
105
71
  exports.isWithinTheWidth = isWithinTheWidth;
106
- const isWithinTheHeight = (query, height) => {
107
- const [minHeight, maxHeight] = extractValues(query);
72
+ const isWithinTheHeight = (query, height, breakpoints) => {
73
+ const [minHeight, maxHeight] = extractValues(query, breakpoints);
108
74
  if (maxHeight && height >= minHeight && height <= maxHeight) {
109
75
  return true;
110
76
  }
111
77
  return !maxHeight && height >= minHeight;
112
78
  };
113
-
114
- /**
115
- * Determines if the given screen size matches both the specified width and height ranges in the query.
116
- *
117
- * The function checks if the provided screen size (both width and height) falls within the ranges
118
- * specified by the query. The query can specify both width and height using a format like 'w[100,200]:h[300,400]'.
119
- *
120
- * @param {string} query - The combined width and height query string. Example: 'w[100,200]:h[300,400]'.
121
- * @param {ScreenSize} screenSize - The screen size to check against the query.
122
- * @returns {boolean} True if the screen size matches both the width and height ranges in the query, false otherwise.
123
- *
124
- * @example
125
- * const screenSize = { width: 150, height: 350 }
126
- * isWithinTheWidthAndHeight('w[100,200]:h[300,400]', screenSize) // returns true
127
- * isWithinTheWidthAndHeight('w[100,200]:h[400,500]', screenSize) // returns false
128
- */
129
79
  exports.isWithinTheHeight = isWithinTheHeight;
130
- const isWithinTheWidthAndHeight = (query, screenSize) => {
131
- const result = query.split(':').filter(Boolean).map(q => isWithinBreakpoint(q, screenSize)).filter(Boolean);
80
+ const isWithinTheWidthAndHeight = (query, screenSize, breakpoints) => {
81
+ const result = query.split(':').filter(Boolean).map(q => isWithinBreakpoint(`:${q}`, screenSize, breakpoints)).filter(Boolean);
132
82
  return result.length === 2;
133
83
  };
134
-
135
- /**
136
- * Checks if the given query string is a valid custom media query.
137
- *
138
- * The valid custom media query formats include:
139
- * - :w[200]
140
- * - :w[0, 200]
141
- * - :w[, 300]
142
- * - :h[200]
143
- * - :h[0, 500]
144
- * - :h[,200]
145
- * - :w[100, 300]:h[200,500]
146
- * - :h[200,500]:w[100, 300]
147
- *
148
- * @param {string} query - The query string to be checked.
149
- * @returns {boolean} Returns `true` if the query is a valid custom media query, otherwise `false`.
150
- * @example
151
- *
152
- * isMediaQuery(':w[200]') // true
153
- * isMediaQuery(':w100]') // false
154
- */
155
84
  exports.isWithinTheWidthAndHeight = isWithinTheWidthAndHeight;
156
85
  const isMediaQuery = query => {
157
- const regex = /^(?:(:w\[\d*(?:,\s?\d+)?])?(:h\[\d*(?:,\s?\d+)?])?|(:h\[\d*(?:,\s?\d+)?])?(:w\[\d*(?:,\s?\d+)?])?)$/;
86
+ const regex = /(:w|:h)/;
158
87
  return query.length > 0 && regex.test(query);
159
88
  };
160
-
161
- /**
162
- * Retrieves the first matching custom media query key based on the provided screen size.
163
- *
164
- * The function processes an array of media queries and returns the first query that matches
165
- * the given screen size. The media queries can be in formats like:
166
- * - w[200]
167
- * - w[0, 200]
168
- * - w[, 300]
169
- * - h[200]
170
- * - h[0, 500]
171
- * - h[,200]
172
- * - w[100, 300]:h[200,500]
173
- * - h[200,500]:w[100, 300]
174
- *
175
- * @param {Array<[string, string | number]>} mediaQueries - An array of tuples containing media query keys and associated values.
176
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
177
- * @returns {string | undefined} Returns the first matching media query key or `undefined` if no match is found.
178
- * @example
179
- *
180
- * const queries = [[':w[200]', 'value1'], [':h[300,500]', 'value2']]
181
- * const size = { width: 250, height: 400 }
182
- * getKeyForCustomMediaQuery(queries, size) // ':w[200]
183
- */
184
89
  exports.isMediaQuery = isMediaQuery;
185
- const getKeyForCustomMediaQuery = (mediaQueries, screenSize) => {
90
+ const getKeyForCustomMediaQuery = (mediaQueries, screenSize, breakpoints) => {
186
91
  const [matchedQuery] = mediaQueries.flatMap(_ref => {
187
92
  let [key] = _ref;
188
- if (key.includes('w') && key.includes('h')) {
189
- return isWithinBreakpoint(key, screenSize) ? key : undefined;
190
- }
191
- return key.split(':').filter(Boolean).map(query => isWithinBreakpoint(query, screenSize) ? key : undefined);
93
+ return isWithinBreakpoint(key, screenSize, breakpoints) ? key : undefined;
192
94
  }).filter(Boolean);
193
95
  return matchedQuery;
194
96
  };
@@ -1 +1 @@
1
- {"version":3,"names":["extractValues","codedValue","cleanedValue","replace","left","right","split","lh","startsWith","Number","rh","endsWith","exports","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,aAAa,GAAIC,UAAkB,IAAoB;EAChE,MAAMC,YAAY,GAAGD,UAAU,CAACE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;EACrD,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAGH,YAAY,CAACI,KAAK,CAAC,GAAG,CAAiC;EAE7E,IAAI,CAACD,KAAK,EAAE;IACR,MAAME,EAAE,GAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GACzBC,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GACpCM,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IAE9C,OAAO,CAACI,EAAE,CAAC;EACf;EAEA,MAAMA,EAAE,GAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GACzBC,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAC7BM,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;EACvC,MAAMO,EAAE,GAAGL,KAAK,CAACM,QAAQ,CAAC,GAAG,CAAC,GACxBF,MAAM,CAACJ,KAAK,CAACF,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAC9BM,MAAM,CAACJ,KAAK,CAACF,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,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OAAA,CAAAqB,YAAA,GAAAA,YAAA;AAuBO,MAAMG,yBAAyB,GAAGA,CAACC,YAA0D,EAAEtB,UAAsB,KAAyB;EACjJ,MAAM,CAACuB,YAAY,CAAC,GAAGD,YAAY,CAC9BE,OAAO,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IACX,IAAIC,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,IAAIyB,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxC,OAAOH,kBAAkB,CAAC4B,GAAG,EAAE1B,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS;IAChE;IAEA,OAAOD,GAAG,CACLnC,KAAK,CAAC,GAAG,CAAC,CACVsB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAAChB,KAAK,IAAID,kBAAkB,CAACC,KAAK,EAAEC,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS,CAAC;EAC9E,CAAC,CAAC,CACDd,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC;AAAA1B,OAAA,CAAAwB,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["parseLhs","lhs","breakpoints","hasRhs","matches","match","openBracket","value","closeBracket","spacelessValue","trim","parsedNumber","Number","parsedValue","isNaN","parseRhs","rhs","closeBrackets","extractValues","pattern","replace","split","parsedLhs","undefined","parsedRhs","exports","isWithinBreakpoint","query","screenSize","hasWidthBreakpoint","includes","hasHeightBreakpoint","isWithinTheWidthAndHeight","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":";;;;;;AAIA,MAAMA,QAAQ,GAAGA,CAACC,GAAW,EAAEC,WAAiC,EAAEC,MAAe,KAAK;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K,CACfN,KAAK,CAAC,GAAG,CAAC,CACVqB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAACC,CAAC,IAAInB,kBAAkB,CAAE,IAAGmB,CAAE,EAAC,EAAEjB,UAAU,EAAE1B,WAAW,CAAC,CAAC,CAC9DwC,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOF,MAAM,CAACK,MAAM,KAAK,CAAC;AAC9B,CAAC;AAAArB,OAAA,CAAAO,yBAAA,GAAAA,yBAAA;AAEM,MAAMe,YAAY,GAAIpB,KAAa,IAAc;EACpD,MAAMqB,KAAK,GAAG,SAAS;EAEvB,OAAOrB,KAAK,CAACmB,MAAM,GAAG,CAAC,IAAIE,KAAK,CAACC,IAAI,CAACtB,KAAK,CAAC;AAChD,CAAC;AAAAF,OAAA,CAAAsB,YAAA,GAAAA,YAAA;AAEM,MAAMG,yBAAyB,GAAGA,CACrCC,YAA6F,EAC7FvB,UAAsB,EACtB1B,WAAiC,KACZ;EACrB,MAAM,CAACkD,YAAY,CAAC,GAAGD,YAAY,CAC9BE,OAAO,CAACC,IAAA;IAAA,IAAC,CAACC,GAAG,CAAC,GAAAD,IAAA;IAAA,OAAK5B,kBAAkB,CAAC6B,GAAG,EAAE3B,UAAU,EAAE1B,WAAW,CAAC,GAAGqD,GAAG,GAAGhC,SAAS;EAAA,EAAC,CACtFmB,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC;AAAA3B,OAAA,CAAAyB,yBAAA,GAAAA,yBAAA"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mq = void 0;
7
+ var _Unistyles = require("../Unistyles");
8
+ const MQSymbol = Symbol('unistyles-mq');
9
+ var MQProp = /*#__PURE__*/function (MQProp) {
10
+ MQProp["toString"] = "toString";
11
+ MQProp["width"] = "width";
12
+ MQProp["height"] = "height";
13
+ return MQProp;
14
+ }(MQProp || {});
15
+ const getMQValue = value => {
16
+ if (typeof value === 'number') {
17
+ return value;
18
+ }
19
+ return _Unistyles.unistyles.registry.breakpoints[value] ?? 0;
20
+ };
21
+ const mq = exports.mq = {
22
+ height: function () {
23
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
24
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
25
+ return new Proxy({}, {
26
+ get: (target, prop, receiver) => {
27
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
28
+ return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
29
+ }
30
+ if (prop === MQProp.width) {
31
+ return function () {
32
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
33
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
34
+ return new Proxy({}, {
35
+ get: (target, prop, receiver) => {
36
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
37
+ return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
38
+ }
39
+ return Reflect.get(target, prop, receiver);
40
+ }
41
+ });
42
+ };
43
+ }
44
+ return Reflect.get(target, prop, receiver);
45
+ }
46
+ });
47
+ },
48
+ width: function () {
49
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
50
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
51
+ return new Proxy({}, {
52
+ get: (target, prop, receiver) => {
53
+ if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
54
+ return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
55
+ }
56
+ if (prop === MQProp.height) {
57
+ return function () {
58
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
59
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
60
+ return new Proxy({}, {
61
+ get: (target, prop, receiver) => {
62
+ if (prop === Symbol.toPrimitive || MQProp.toString) {
63
+ return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
64
+ }
65
+ return Reflect.get(target, prop, receiver);
66
+ }
67
+ });
68
+ };
69
+ }
70
+ return Reflect.get(target, prop, receiver);
71
+ }
72
+ });
73
+ }
74
+ };
75
+ //# sourceMappingURL=mq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_Unistyles","require","MQSymbol","Symbol","MQProp","getMQValue","value","unistyles","registry","breakpoints","mq","exports","height","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","wMin","wMax","Reflect"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":";;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,QAAQ,GAAGC,MAAM,CAAC,cAAc,CAAC;AAAA,IAgBlCC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,EAANA,MAAM;AAMX,MAAMC,UAAU,GAAIC,KAAc,IAAK;EACnC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,OAAOC,oBAAS,CAACC,QAAQ,CAACC,WAAW,CAACH,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;AAEM,MAAMI,EAAE,GAAAC,OAAA,CAAAD,EAAA,GAAG;EACdE,MAAM,EAAE,SAAAA,CAAA;IAAA,IAACC,IAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;IAAA,OAAK,IAAIC,KAAK,CAAgB,CAAC,CAAC,EAAmB;MACnGC,GAAG,EAAEA,CAAC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AC,CAAC;EAAA;AACN,CAAC"}
@@ -3,63 +3,23 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.proxifyFunction = exports.parseStyle = void 0;
6
+ exports.proxifyFunction = exports.parseStyle = exports.isPlatformColor = void 0;
7
7
  var _breakpoints = require("./breakpoints");
8
8
  var _normalizeStyles = require("./normalizeStyles");
9
9
  var _common = require("./common");
10
- /**
11
- * Proxies a function to parse its return value for custom media queries or breakpoints.
12
- *
13
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
14
- *
15
- * @param {Function} fn - The function to be proxified.
16
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
17
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
18
- * @param breakpointPairs - sorted pairs of breakpoints
19
- *
20
- * @returns {Function} Returns the proxified function
21
- *
22
- * @example
23
- *
24
- * const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
25
- * const screenSize = { width: 250, height: 400 }
26
- * const breakpoints = { sm: 300, md: 600 }
27
- *
28
- * const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
29
- * proxifiedFunction() // parsed style based on screenSize and breakpoints
30
- */
31
10
  const proxifyFunction = (fn, breakpoint, screenSize) => new Proxy(fn, {
32
11
  apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize)
33
12
  });
34
-
35
- /**
36
- * Parses a style object to resolve custom media queries or breakpoints based on the provided screen size and breakpoints.
37
- *
38
- * The function processes each key-value pair in the style object. If the value is a function or a valid style (not an object or a 'transform' key),
39
- * it is returned as-is. Otherwise, the function attempts to resolve the value based on the provided breakpoint, screen size, and defined breakpoints.
40
- *
41
- * @template T - The type of the style object.
42
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
43
- *
44
- * @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
45
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
46
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
47
- * @param breakpointPairs - sorted pairs of breakpoints
48
- *
49
- * @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
50
- *
51
- * @example
52
- *
53
- * const style = { fontSize: { sm: '12px', md: '16px' } }
54
- * const screenSize = { width: 300, height: 400 }
55
- * const breakpoints = { xs: 0, sm: 300, md: 600 }
56
- *
57
- * const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
58
- * // { fontSize: '12px' }
59
- */
60
13
  exports.proxifyFunction = proxifyFunction;
14
+ const isPlatformColor = value => {
15
+ if (_common.isIOS) {
16
+ return 'semantic' in value && typeof value.semantic === 'object';
17
+ }
18
+ return _common.isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
19
+ };
20
+ exports.isPlatformColor = isPlatformColor;
61
21
  const parseStyle = (style, breakpoint, screenSize) => {
62
- const entries = Object.entries(style);
22
+ const entries = Object.entries(style || {});
63
23
  const parsedStyles = Object.fromEntries(entries.map(_ref => {
64
24
  let [key, value] = _ref;
65
25
  const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
@@ -71,11 +31,11 @@ const parseStyle = (style, breakpoint, screenSize) => {
71
31
  return [key, value.map(value => parseStyle(value, breakpoint, screenSize))];
72
32
  }
73
33
  const isDynamicFunction = typeof value === 'function';
74
- const isValidStyle = typeof value !== 'object';
34
+ const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
75
35
  if (isDynamicFunction || isValidStyle) {
76
36
  return [key, value];
77
37
  }
78
- return [key, (0, _breakpoints.getValueForBreakpoint)(value, breakpoint, screenSize)];
38
+ return [key, (0, _breakpoints.getValueForBreakpoint)(value)];
79
39
  }));
80
40
  return _common.isWeb ? (0, _normalizeStyles.normalizeStyles)(parsedStyles) : parsedStyles;
81
41
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","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.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,KACX,IAAIC,KAAK,CAACH,EAAE,EAAE;EACzBI,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAClCC,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEN,UAAU,EAAEC,UAAU;AAC/E,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,CAAAV,eAAA,GAAAA,eAAA;AAyBO,MAAMS,UAAU,GAAGA,CACtBE,KAA2B,EAC3BT,UAA+C,EAC/CC,UAAsB,KAClB;EACJ,MAAMS,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,CAGnC;EAED,MAAMG,YAAY,GAAGD,MAAM,CACtBE,WAAW,CAACH,OAAO,CACfI,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACd,MAAMG,mBAAmB,GAAGF,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB;IAEhF,IAAIE,mBAAmB,EAAE;MACrB,OAAO,CACHF,GAAG,EACHT,UAAU,CAACU,KAAK,EAA0BjB,UAAU,EAAEC,UAAU,CAAC,CACpE;IACL;IAEA,MAAMkB,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,IAAIV,UAAU,CAACU,KAAK,EAAEjB,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAMqB,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,UACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOwB,aAAK,GACN,IAAAC,gCAAe,EAACd,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC;AAAAJ,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
1
+ {"version":3,"names":["_breakpoints","require","_normalizeStyles","_common","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","exports","isPlatformColor","value","isIOS","semantic","isAndroid","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle","getValueForBreakpoint","isWeb","normalizeStyles"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAEO,MAAMG,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,KACX,I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ACG,KAAK,EAAEV,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAM0B,iBAAiB,GAAG,OAAOjB,KAAK,KAAK,UAAU;IACrD,MAAMkB,YAAY,GAAG,OAAOlB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIiB,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEZ,KAAK,CAAC;IACvB;IAEA,OAAO,CACHY,GAAG,EACH,IAAAO,kCAAqB,EAACnB,KAAuF,CAAC,CACjH;EACL,CAAC,CACL,CAAC;EAEL,OAAOoB,aAAK,GACN,IAAAC,gCAAe,EAACb,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC;AAAAV,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
@@ -1,6 +1,6 @@
1
1
  import { UnistylesModule } from './UnistylesModule';
2
2
  import { UnistylesRuntime } from './UnistylesRuntime';
3
- import { UnistylesEngine } from './UnistylesEngine';
3
+ import { UnistylesBuiltInEngine } from './UnistylesEngine';
4
4
  import { UnistyleRegistry } from './UnistyleRegistry';
5
5
  import { UnistylesError } from './types';
6
6
  class Unistyles {
@@ -14,7 +14,7 @@ class Unistyles {
14
14
  this._bridge = global.__UNISTYLES__;
15
15
  this._registry = new UnistyleRegistry(this._bridge);
16
16
  this._runtime = new UnistylesRuntime(this._bridge, this._registry);
17
- this._engine = new UnistylesEngine(this._registry, this._runtime);
17
+ this._engine = new UnistylesBuiltInEngine(this._registry, this._runtime);
18
18
  }
19
19
  get registry() {
20
20
  return this._registry;
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesModule","UnistylesRuntime","UnistylesEngine","UnistyleRegistry","UnistylesError","Unistyles","constructor","isInstalled","install","Error","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","_runtime","_engine","registry","runtime","engine","unistyles"],"sourceRoot":"../../src","sources":["Unistyles.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,SAAS,CAAC;EAMZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGP,eAAe,EAAEQ,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACD,WAAW,EAAE;MACd,MAAM,IAAIE,KAAK,CAACL,cAAc,CAACM,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,aAAgC;IACtD,IAAI,CAACC,SAAS,GAAG,IAAIX,gBAAgB,CAAC,IAAI,CAACQ,OAAO,CAAC;IACnD,IAAI,CAACI,QAAQ,GAAG,IAAId,gBAAgB,CAAC,IAAI,CAACU,OAAO,EAAE,IAAI,CAACG,SAAS,CAAC;IAClE,IAAI,CAACE,OAAO,GAAG,IAAId,eAAe,CAAC,IAAI,CAACY,SAAS,EAAE,IAAI,CAACC,QAAQ,CAAC;EACrE;EAEA,IAAWE,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACH,SAAS;EACzB;EAEA,IAAWI,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;EAEA,IAAWI,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACH,OAAO;EACvB;AACJ;AAEA,OAAO,MAAMI,SAAS,GAAG,IAAIf,SAAS,CAAC,CAAC"}
1
+ {"version":3,"names":["UnistylesModule","UnistylesRuntime","UnistylesBuiltInEngine","UnistyleRegistry","UnistylesError","Unistyles","constructor","isInstalled","install","Error","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","_runtime","_engine","registry","runtime","engine","unistyles"],"sourceRoot":"../../src","sources":["Unistyles.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,SAAS,CAAC;EAMZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGP,eAAe,EAAEQ,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACD,WAAW,EAAE;MACd,MAAM,IAAIE,KAAK,CAACL,cAAc,CAACM,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,aAAgC;IACtD,IAAI,CAACC,SAAS,GAAG,IAAIX,gBAAgB,CAAC,IAAI,CAACQ,OAAO,CAAC;IACnD,IAAI,CAACI,QAAQ,GAAG,IAAId,gBAAgB,CAAC,IAAI,CAACU,OAAO,EAAE,IAAI,CAACG,SAAS,CAAC;IAClE,IAAI,CAACE,OAAO,GAAG,IAAId,sBAAsB,CAAC,IAAI,CAACY,SAAS,EAAE,IAAI,CAACC,QAAQ,CAAC;EAC5E;EAEA,IAAWE,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACH,SAAS;EACzB;EAEA,IAAWI,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;EAEA,IAAWI,MAAMA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACH,OAAO;EACvB;AACJ;AAEA,OAAO,MAAMI,SAAS,GAAG,IAAIf,SAAS,CAAC,CAAC"}
@@ -1,12 +1,16 @@
1
- // todo implement engine
2
- export class UnistylesEngine {
3
- // @ts-ignore
1
+ import { getKeyForCustomMediaQuery } from './utils';
2
+ export class UnistylesBuiltInEngine {
4
3
  constructor(registry, runtime) {
5
4
  this.registry = registry;
6
5
  this.runtime = runtime;
7
6
  this.registry = registry;
8
7
  this.runtime = runtime;
9
8
  }
9
+ isMediaQuery = key => {
10
+ const regex = /(:w|:h)/;
11
+ return key.length > 0 && regex.test(key);
12
+ };
13
+ didMatchMediaQuery = keys => getKeyForCustomMediaQuery(keys, this.runtime.screen, this.registry.breakpoints);
10
14
 
11
15
  // UnistylesEngine.parseStyleSheet
12
16
  // UnistylesEngine.parseStyle
@@ -1 +1 @@
1
- {"version":3,"names":["UnistylesEngine","constructor","registry","runtime"],"sourceRoot":"../../src","sources":["UnistylesEngine.ts"],"mappings":"AAGA;AACA,OAAO,MAAMA,eAAe,CAAC;EACzB;EACAC,WAAWA,CAASC,QAA0B,EAAUC,OAAyB,EAAE;IAAA,KAA/DD,QAA0B,GAA1BA,QAA0B;IAAA,KAAUC,OAAyB,GAAzBA,OAAyB;IAC7E,IAAI,CAACD,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;;EAEA;EACA;EACA;AACJ"}
1
+ {"version":3,"names":["getKeyForCustomMediaQuery","UnistylesBuiltInEngine","constructor","registry","runtime","isMediaQuery","key","regex","length","test","didMatchMediaQuery","keys","screen","breakpoints"],"sourceRoot":"../../src","sources":["UnistylesEngine.ts"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,SAAS;AAGnD,OAAO,MAAMC,sBAAsB,CAA4B;EAC3DC,WAAWA,CAASC,QAA0B,EAAUC,OAAyB,EAAE;IAAA,KAA/DD,QAA0B,GAA1BA,QAA0B;IAAA,KAAUC,OAAyB,GAAzBA,OAAyB;IAC7E,IAAI,CAACD,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEOC,YAAY,GAAIC,GAAW,IAAK;IACnC,MAAMC,KAAK,GAAG,SAAS;IAEvB,OAAOD,GAAG,CAACE,MAAM,GAAG,CAAC,IAAID,KAAK,CAACE,IAAI,CAACH,GAAG,CAAC;EAC5C,CAAC;EAEMI,kBAAkB,GAAIC,IAAgB,IACzCX,yBAAyB,CAACW,IAAI,EAAE,IAAI,CAACP,OAAO,CAACQ,MAAM,EAAE,IAAI,CAACT,QAAQ,CAACU,WAAW,CAAC;;EAEnF;EACA;EACA;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"names":["createStyleSheet","styles"],"sourceRoot":"../../src","sources":["createStyleSheet.ts"],"mappings":"AAKA,OAAO,MAAMA,gBAAgB,GAAuCC,MAA+E,IAAY;EAC3J,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAC9B,OAAOA,MAAM;EACjB;EAEA,OAAOA,MAAM;AACjB,CAAC"}
1
+ {"version":3,"names":["createStyleSheet","styles"],"sourceRoot":"../../src","sources":["createStyleSheet.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAUC,MAA4F,IAAY;EAC3I,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAC9B,OAAOA,MAAM;EACjB;EAEA,OAAOA,MAAM;AACjB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { unistyles } from './Unistyles';
2
2
  import { ScreenOrientation } from './types';
3
+ export { mq } from './utils';
3
4
  export { useInitialTheme } from './useInitialTheme';
4
5
  export { useStyles } from './useStyles';
5
6
  export { createStyleSheet } from './createStyleSheet';
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","ScreenOrientation","useInitialTheme","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry","__dangerouslyUnregister","dangerouslyUnregister"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGP,SAAS,CAACQ,QAAQ;AACpE,MAAMC,gBAAgB,GAAGT,SAAS,CAACU,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,OAAO,MAAMK,uBAAuB,GAAGZ,SAAS,CAACQ,QAAQ,CAACK,qBAAqB;AAE/E,SACIJ,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIV,iBAAiB"}
1
+ {"version":3,"names":["unistyles","ScreenOrientation","mq","useInitialTheme","useStyles","createStyleSheet","addThemes","addBreakpoints","addConfig","registry","UnistylesRuntime","runtime","UnistylesRegistry","__dangerouslyUnregister","dangerouslyUnregister"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,SAASC,EAAE,QAAQ,SAAS;AAC5B,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,MAAM;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAW,CAAC,GAAGR,SAAS,CAACS,QAAQ;AACpE,MAAMC,gBAAgB,GAAGV,SAAS,CAACW,OAAO;AAC1C,MAAMC,iBAAiB,GAAG;EACtBN,SAAS;EACTC,cAAc;EACdC;AACJ,CAAC;AAED,OAAO,MAAMK,uBAAuB,GAAGb,SAAS,CAACS,QAAQ,CAACK,qBAAqB;AAE/E,SACIJ,gBAAgB,EAChBE,iBAAiB;AAGrB,SACIX,iBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"names":["ScreenOrientation","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":"AAUA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAyB7B,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAuBlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
1
+ {"version":3,"names":["ScreenOrientation","CxxUnistylesEventTypes","UnistylesError"],"sourceRoot":"../../../src","sources":["types/cxx.ts"],"mappings":"AAYA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;AAyB7B,WAAYC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAuBlC,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA"}
@@ -2,9 +2,6 @@ import { useMemo } from 'react';
2
2
  import { StyleSheet } from 'react-native';
3
3
  import { parseStyle, proxifyFunction } from './utils';
4
4
  import { useUnistyles } from './useUnistyles';
5
-
6
- // todo types
7
-
8
5
  export const useStyles = stylesheet => {
9
6
  const {
10
7
  theme,
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,eAAe,QAAQ,SAAS;AAErD,SAASC,YAAY,QAAQ,gBAAgB;;AAG7C;;AAGA,OAAO,MAAMC,SAAS,GAAsCC,UAA4C,IAAK;EACzG,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGL,YAAY,CAAC,CAAC;EAExD,IAAI,CAACE,UAAU,EAAE;IACb,OAAO;MACHC,KAAK;MACLC,UAAU;MACVE,MAAM,EAAE,CAAC;IACb,CAAC;EACL;EAEA,MAAMC,YAAY,GAAGX,OAAO,CAAC,MAAM,OAAOM,UAAU,KAAK,UAAU,GAC7DA,UAAU,CAACC,KAAM,CAAC,GAClBD,UAAU,EAAE,CAACC,KAAK,EAAED,UAAU,CAAC,CAAC;EAEtC,MAAMM,iBAAiB,GAAGZ,OAAO,CAAC,MAAMa,MAAM,CACzCC,OAAO,CAACH,YAAY,CAAC,CACrBI,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;IACtB,MAAMG,KAAK,GAAGD,KAA8B;IAE5C,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAC7B,OAAO;QACH,GAAGH,GAAG;QACN,CAACE,GAAG,GAAGf,eAAe,CAACgB,KAAK,EAAEX,UAAU,EAAEC,UAAU;MACxD,CAAC;IACL;IAEA,OAAOR,UAAU,CAACoB,MAAM,CAAC;MACrB,GAAGL,GAAG;MACN,CAACE,GAAG,GAAGhB,UAAU,CAAKkB,KAAK,EAAEZ,UAAU,EAAEC,UAAU;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAAC,CAAO,CAAC,EAAE,CAACD,UAAU,EAAEC,UAAU,EAAEE,YAAY,CAAC,CAAC;EAEzD,OAAO;IACHJ,KAAK;IACLC,UAAU;IACVE,MAAM,EAAEE;EACZ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["useMemo","StyleSheet","parseStyle","proxifyFunction","useUnistyles","useStyles","stylesheet","theme","breakpoint","screenSize","styles","parsedStyles","dynamicStyleSheet","Object","entries","reduce","acc","_ref","key","value","style","create"],"sourceRoot":"../../src","sources":["useStyles.ts"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO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 @@
1
- {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","CxxUnistylesEventTypes","unistyles","unistylesEvents","Unistyles","useUnistyles","orientation","setOrientation","runtime","theme","setTheme","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","remove"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,sBAAsB,QAA2B,SAAS;AACnE,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGP,QAAQ,CAAoBE,SAAS,CAACM,OAAO,CAACF,WAAW,CAAC;EAChG,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAGV,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACG,QAAQ,CAACT,SAAS,CAACM,OAAO,CAACI,SAAS,CAAC,CAAC;EAC3F,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGd,QAAQ,CAACE,SAAS,CAACM,OAAO,CAACK,UAAU,CAAC;EAC1E,MAAM,CAACE,UAAU,EAAEC,aAAa,CAAC,GAAGhB,QAAQ,CAAC;IACzCiB,KAAK,EAAEf,SAAS,CAACM,OAAO,CAACU,MAAM,CAACD,KAAK;IACrCE,MAAM,EAAEjB,SAAS,CAACM,OAAO,CAACU,MAAM,CAACC;EACrC,CAAC,CAAC;EAEFpB,SAAS,CAAC,MAAM;IACZ,MAAMqB,YAAY,GAAGjB,eAAe,CAACkB,WAAW,CAC5C,UAAU,EACTC,KAAsB,IAAK;MACxB,QAAQA,KAAK,CAACC,IAAI;QACd,KAAKtB,sBAAsB,CAACuB,KAAK;UAAE;YAC/B,MAAMC,UAAU,GAAGH,KAA4B;YAE/CZ,QAAQ,CAACR,SAAS,CAACM,OAAO,CAACG,QAAQ,CAACc,UAAU,CAACC,OAAO,CAACd,SAAS,CAAC,CAAC;YAElE;UACJ;QACA,KAAKX,sBAAsB,CAAC0B,MAAM;UAAE;YAChC,MAAMC,WAAW,GAAGN,KAAmC;YAEvDR,aAAa,CAACc,WAAW,CAACF,OAAO,CAACb,UAAU,CAAC;YAC7CN,cAAc,CAACqB,WAAW,CAACF,OAAO,CAACpB,WAAW,CAAC;YAC/CU,aAAa,CAACY,WAAW,CAACF,OAAO,CAACR,MAAM,CAAC;YAEzC;UACJ;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOE,YAAY,CAACS,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACHpB,KAAK;IACLH,WAAW;IACXO,UAAU;IACVE;EACJ,CAAC;AACL,CAAC"}
1
+ {"version":3,"names":["NativeEventEmitter","NativeModules","useEffect","useState","CxxUnistylesEventTypes","unistyles","unistylesEvents","Unistyles","useUnistyles","orientation","setOrientation","runtime","theme","setTheme","getTheme","themeName","breakpoint","setBreakpoint","screenSize","setScreenSize","width","screen","height","subscription","addListener","event","type","Theme","themeEvent","payload","Layout","layoutEvent","remove"],"sourceRoot":"../../src","sources":["useUnistyles.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAQ3C,SAASC,sBAAsB,QAA2B,SAAS;AACnE,SAASC,SAAS,QAAQ,aAAa;AAGvC,MAAMC,eAAe,GAAG,IAAIN,kBAAkB,CAACC,aAAa,CAACM,SAAS,CAAC;AAEvE,OAAO,MAAMC,YAAY,GAAGA,CAAA,KAAM;EAC9B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGP,QAAQ,CAAoBE,S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