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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) 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/types/cxx.js.map +1 -1
  9. package/lib/commonjs/useStyles.js +0 -2
  10. package/lib/commonjs/useStyles.js.map +1 -1
  11. package/lib/commonjs/utils/breakpoints.js +11 -68
  12. package/lib/commonjs/utils/breakpoints.js.map +1 -1
  13. package/lib/commonjs/utils/common.js +3 -1
  14. package/lib/commonjs/utils/common.js.map +1 -1
  15. package/lib/commonjs/utils/mediaQueries.js +57 -155
  16. package/lib/commonjs/utils/mediaQueries.js.map +1 -1
  17. package/lib/commonjs/utils/styles.js +11 -51
  18. package/lib/commonjs/utils/styles.js.map +1 -1
  19. package/lib/module/Unistyles.js +2 -2
  20. package/lib/module/Unistyles.js.map +1 -1
  21. package/lib/module/UnistylesEngine.js +7 -3
  22. package/lib/module/UnistylesEngine.js.map +1 -1
  23. package/lib/module/createStyleSheet.js.map +1 -1
  24. package/lib/module/types/cxx.js.map +1 -1
  25. package/lib/module/useStyles.js +0 -3
  26. package/lib/module/useStyles.js.map +1 -1
  27. package/lib/module/utils/breakpoints.js +11 -68
  28. package/lib/module/utils/breakpoints.js.map +1 -1
  29. package/lib/module/utils/common.js +2 -0
  30. package/lib/module/utils/common.js.map +1 -1
  31. package/lib/module/utils/mediaQueries.js +57 -155
  32. package/lib/module/utils/mediaQueries.js.map +1 -1
  33. package/lib/module/utils/styles.js +10 -51
  34. package/lib/module/utils/styles.js.map +1 -1
  35. package/lib/typescript/src/Unistyles.d.ts +2 -2
  36. package/lib/typescript/src/Unistyles.d.ts.map +1 -1
  37. package/lib/typescript/src/UnistylesEngine.d.ts +4 -1
  38. package/lib/typescript/src/UnistylesEngine.d.ts.map +1 -1
  39. package/lib/typescript/src/createStyleSheet.d.ts +2 -5
  40. package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
  41. package/lib/typescript/src/types/breakpoints.d.ts +2 -1
  42. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  43. package/lib/typescript/src/types/core.d.ts +18 -16
  44. package/lib/typescript/src/types/core.d.ts.map +1 -1
  45. package/lib/typescript/src/types/cxx.d.ts +7 -1
  46. package/lib/typescript/src/types/cxx.d.ts.map +1 -1
  47. package/lib/typescript/src/types/index.d.ts +1 -1
  48. package/lib/typescript/src/types/index.d.ts.map +1 -1
  49. package/lib/typescript/src/types/mediaQueries.d.ts +5 -3
  50. package/lib/typescript/src/types/mediaQueries.d.ts.map +1 -1
  51. package/lib/typescript/src/useStyles.d.ts +1 -3
  52. package/lib/typescript/src/useStyles.d.ts.map +1 -1
  53. package/lib/typescript/src/utils/breakpoints.d.ts +2 -60
  54. package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
  55. package/lib/typescript/src/utils/common.d.ts +2 -0
  56. package/lib/typescript/src/utils/common.d.ts.map +1 -1
  57. package/lib/typescript/src/utils/mediaQueries.d.ts +8 -127
  58. package/lib/typescript/src/utils/mediaQueries.d.ts.map +1 -1
  59. package/lib/typescript/src/utils/styles.d.ts +1 -46
  60. package/lib/typescript/src/utils/styles.d.ts.map +1 -1
  61. package/package.json +10 -1
  62. package/src/Unistyles.ts +3 -3
  63. package/src/UnistylesEngine.ts +12 -3
  64. package/src/createStyleSheet.ts +2 -5
  65. package/src/types/breakpoints.ts +6 -3
  66. package/src/types/core.ts +25 -22
  67. package/src/types/cxx.ts +8 -1
  68. package/src/types/index.ts +1 -1
  69. package/src/types/mediaQueries.ts +9 -4
  70. package/src/useStyles.ts +3 -6
  71. package/src/utils/breakpoints.ts +14 -71
  72. package/src/utils/common.ts +2 -0
  73. package/src/utils/mediaQueries.ts +102 -163
  74. package/src/utils/styles.ts +13 -55
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","throwError","message","Error","warn","console","isMobile","OS","isWeb","isServer","window","Orientation","Landscape","Portrait"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAED,OAAO,MAAME,IAAI,GAAIF,OAAe,IAAK;EACrCG,OAAO,CAACD,IAAI,CAAE,gCAA+BF,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAMI,QAAQ,GAAGN,QAAQ,CAACO,EAAE,KAAK,SAAS,IAAIP,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1E,OAAO,MAAMC,KAAK,GAAGR,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,WAAW,GAAG;EACvBC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU"}
1
+ {"version":3,"names":["Platform","throwError","message","Error","warn","console","isMobile","OS","isWeb","isIOS","isAndroid","isServer","window","Orientation","Landscape","Portrait"],"sourceRoot":"../../../src","sources":["utils/common.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,MAAMC,UAAU,GAAIC,OAAe,IAAK;EAC3C,MAAM,IAAIC,KAAK,CAAE,gCAA+BD,OAAQ,EAAC,CAAC;AAC9D,CAAC;AAED,OAAO,MAAME,IAAI,GAAIF,OAAe,IAAK;EACrCG,OAAO,CAACD,IAAI,CAAE,gCAA+BF,OAAQ,EAAC,CAAC;AAC3D,CAAC;AAED,OAAO,MAAMI,QAAQ,GAAGN,QAAQ,CAACO,EAAE,KAAK,SAAS,IAAIP,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1E,OAAO,MAAMC,KAAK,GAAGR,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAME,KAAK,GAAGT,QAAQ,CAACO,EAAE,KAAK,KAAK;AAC1C,OAAO,MAAMG,SAAS,GAAGV,QAAQ,CAACO,EAAE,KAAK,SAAS;AAClD,OAAO,MAAMI,QAAQ,GAAG,OAAOC,MAAM,KAAK,WAAW;AAErD,OAAO,MAAMC,WAAW,GAAG;EACvBC,SAAS,EAAE,WAAW;EACtBC,QAAQ,EAAE;AACd,CAAU"}
@@ -1,182 +1,84 @@
1
- /**
2
- * Extracts numeric values from a coded string.
3
- *
4
- * The function is designed to process strings that have a format like "w[100,200]" or "h[300]".
5
- * It removes characters 'w', 'h', '[', and ']' from the input string and then extracts the numbers.
6
- *
7
- * @param {string} codedValue - The input string to extract values from.
8
- * @returns {Array<number>} An array of extracted numbers. Can contain one or two numbers based on the input format.
9
- *
10
- * @example
11
- * extractValues("w[100,200]") // returns [100, 200]
12
- * extractValues("h[300]") // returns [300]
13
- * extractValues("h[,300]") // returns [0,300]
14
- * extractValues("h[100,]") // returns [100]
15
- */
16
- export const extractValues = codedValue => {
17
- const cleanedValue = codedValue.replace(/[wh ]/g, '');
18
- const [left, right] = cleanedValue.split(',');
19
- if (!right) {
20
- const lh = left.startsWith('[') ? Number(left.replace(/[[\]()]/g, '')) : Number(left.replace(/[[\]()]/g, '')) + 1;
21
- return [lh];
1
+ const parseLhs = (lhs, breakpoints, hasRhs) => {
2
+ const matches = lhs.match(/([([])|([^[\]()]+)|([\])])/g);
3
+ if (!hasRhs) {
4
+ const [openBracket, value, closeBracket] = matches;
5
+ const spacelessValue = value?.trim();
6
+ const parsedNumber = Number(spacelessValue);
7
+ const parsedValue = isNaN(parsedNumber) ? breakpoints[spacelessValue] : parsedNumber;
8
+ return [Number(openBracket === '('), closeBracket === ')' ? parsedValue - 1 : parsedValue];
22
9
  }
23
- const lh = left.startsWith('[') ? Number(left.replace('[', '')) : Number(left.replace('(', '')) + 1;
24
- const rh = right.endsWith(']') ? Number(right.replace(']', '')) : Number(right.replace(')', '')) - 1;
25
- return [lh, rh];
10
+ const [openBracket, value] = matches;
11
+ if (!value) {
12
+ return [Number(openBracket === '(')];
13
+ }
14
+ const spacelessValue = value?.trim();
15
+ const parsedNumber = Number(spacelessValue);
16
+ const parsedValue = isNaN(parsedNumber) ? breakpoints[spacelessValue] : parsedNumber;
17
+ return openBracket === '(' ? [parsedValue - 1] : [parsedValue];
18
+ };
19
+ const parseRhs = (rhs, breakpoints) => {
20
+ const matches = rhs.match(/([([])|([^[\]()]+)|([\])])/g);
21
+ const [value, closeBrackets] = matches;
22
+ const spacelessValue = value.trim();
23
+ const parsedNumber = Number(spacelessValue);
24
+ const parsedValue = isNaN(parsedNumber) ? breakpoints[spacelessValue] : parsedNumber;
25
+ return [closeBrackets === ')' ? parsedValue - 1 : parsedValue];
26
+ };
27
+ export const extractValues = (pattern, breakpoints) => {
28
+ const [lhs, rhs] = pattern.replace(/(:w|:h)/g, '').split(',');
29
+ if (!rhs) {
30
+ return parseLhs(lhs, breakpoints, false);
31
+ }
32
+ const [parsedLhs] = parseLhs(lhs, breakpoints, true);
33
+ if (parsedLhs === undefined || isNaN(parsedLhs)) {
34
+ return [];
35
+ }
36
+ const [parsedRhs] = parseRhs(rhs, breakpoints);
37
+ if (parsedRhs === undefined || isNaN(parsedRhs)) {
38
+ return [];
39
+ }
40
+ return [parsedLhs, parsedRhs];
26
41
  };
27
-
28
- /**
29
- * Determines if the given screen size matches the specified breakpoint query.
30
- *
31
- * The function checks if the screen size (width and/or height) falls within the range
32
- * specified by the breakpoint query. The query can specify width (using 'w'), height (using 'h'),
33
- * or both.
34
- *
35
- * @param {string} query - The breakpoint query string. Examples: 'w[100,200]', 'h[300]', 'w[100,200]h[300,400]'.
36
- * @param {ScreenSize} screenSize - The screen size to check against the breakpoint query.
37
- * @returns {boolean} True if the screen size matches the breakpoint query, false otherwise.
38
- *
39
- * @example
40
- * const screenSize = { width: 150, height: 350 }
41
- * isWithinBreakpoint('w[100,200]', screenSize) // returns true
42
- * isWithinBreakpoint('h[400]', screenSize) // returns false
43
- */
44
- export const isWithinBreakpoint = (query, screenSize) => {
45
- if (query.includes('w') && query.includes('h')) {
46
- return isWithinTheWidthAndHeight(query, screenSize);
42
+ export const isWithinBreakpoint = (query, screenSize, breakpoints) => {
43
+ const hasWidthBreakpoint = query.includes(':w');
44
+ const hasHeightBreakpoint = query.includes(':h');
45
+ if (hasWidthBreakpoint && hasHeightBreakpoint) {
46
+ return isWithinTheWidthAndHeight(query, screenSize, breakpoints);
47
47
  }
48
- if (query.charAt(0) === 'w') {
49
- return isWithinTheWidth(query, screenSize.width);
48
+ if (hasWidthBreakpoint) {
49
+ return isWithinTheWidth(query, screenSize.width, breakpoints);
50
50
  }
51
- if (query.charAt(0) === 'h') {
52
- return isWithinTheHeight(query, screenSize.height);
51
+ if (hasHeightBreakpoint) {
52
+ return isWithinTheHeight(query, screenSize.height, breakpoints);
53
53
  }
54
54
  return false;
55
55
  };
56
-
57
- /**
58
- * Determines if the given width matches the specified width range in the query.
59
- *
60
- * The function checks if the provided width falls within the range specified by the query.
61
- * The query specifies a width range using a format like 'w[100,200]'. If only one value is provided,
62
- * it's treated as a minimum width.
63
- *
64
- * @param {string} query - The width query string. Examples: 'w[100,200]' or 'w[100]'.
65
- * @param {number} width - The width to check against the query.
66
- * @returns {boolean} True if the width matches the query range, false otherwise.
67
- *
68
- * @example
69
- * isWithinTheWidth('w[100,200]', 150) // returns true
70
- * isWithinTheWidth('w[100]', 50) // returns false
71
- * isWithinTheWidth('w[100]', 150) // returns true
72
- */
73
- export const isWithinTheWidth = (query, width) => {
74
- const [minWidth, maxWidth] = extractValues(query);
56
+ export const isWithinTheWidth = (query, width, breakpoints) => {
57
+ const [minWidth, maxWidth] = extractValues(query, breakpoints);
75
58
  if (maxWidth && width >= minWidth && width <= maxWidth) {
76
59
  return true;
77
60
  }
78
61
  return !maxWidth && width >= minWidth;
79
62
  };
80
-
81
- /**
82
- * Determines if the given height matches the specified height range in the query.
83
- *
84
- * The function checks if the provided height falls within the range specified by the query.
85
- * The query specifies a height range using a format like 'h[100,200]'. If only one value is provided,
86
- * it's treated as a minimum height.
87
- *
88
- * @param {string} query - The height query string. Examples: 'h[100,200]' or 'h[100]'.
89
- * @param {number} height - The height to check against the query.
90
- * @returns {boolean} True if the height matches the query range, false otherwise.
91
- *
92
- * @example
93
- * isWithinTheHeight('h[100,200]', 150) // returns true
94
- * isWithinTheHeight('h[100]', 50) // returns false
95
- * isWithinTheHeight('h[100]', 150) // returns true
96
- */
97
- export const isWithinTheHeight = (query, height) => {
98
- const [minHeight, maxHeight] = extractValues(query);
63
+ export const isWithinTheHeight = (query, height, breakpoints) => {
64
+ const [minHeight, maxHeight] = extractValues(query, breakpoints);
99
65
  if (maxHeight && height >= minHeight && height <= maxHeight) {
100
66
  return true;
101
67
  }
102
68
  return !maxHeight && height >= minHeight;
103
69
  };
104
-
105
- /**
106
- * Determines if the given screen size matches both the specified width and height ranges in the query.
107
- *
108
- * The function checks if the provided screen size (both width and height) falls within the ranges
109
- * specified by the query. The query can specify both width and height using a format like 'w[100,200]:h[300,400]'.
110
- *
111
- * @param {string} query - The combined width and height query string. Example: 'w[100,200]:h[300,400]'.
112
- * @param {ScreenSize} screenSize - The screen size to check against the query.
113
- * @returns {boolean} True if the screen size matches both the width and height ranges in the query, false otherwise.
114
- *
115
- * @example
116
- * const screenSize = { width: 150, height: 350 }
117
- * isWithinTheWidthAndHeight('w[100,200]:h[300,400]', screenSize) // returns true
118
- * isWithinTheWidthAndHeight('w[100,200]:h[400,500]', screenSize) // returns false
119
- */
120
- export const isWithinTheWidthAndHeight = (query, screenSize) => {
121
- const result = query.split(':').filter(Boolean).map(q => isWithinBreakpoint(q, screenSize)).filter(Boolean);
70
+ export const isWithinTheWidthAndHeight = (query, screenSize, breakpoints) => {
71
+ const result = query.split(':').filter(Boolean).map(q => isWithinBreakpoint(`:${q}`, screenSize, breakpoints)).filter(Boolean);
122
72
  return result.length === 2;
123
73
  };
124
-
125
- /**
126
- * Checks if the given query string is a valid custom media query.
127
- *
128
- * The valid custom media query formats include:
129
- * - :w[200]
130
- * - :w[0, 200]
131
- * - :w[, 300]
132
- * - :h[200]
133
- * - :h[0, 500]
134
- * - :h[,200]
135
- * - :w[100, 300]:h[200,500]
136
- * - :h[200,500]:w[100, 300]
137
- *
138
- * @param {string} query - The query string to be checked.
139
- * @returns {boolean} Returns `true` if the query is a valid custom media query, otherwise `false`.
140
- * @example
141
- *
142
- * isMediaQuery(':w[200]') // true
143
- * isMediaQuery(':w100]') // false
144
- */
145
74
  export const isMediaQuery = query => {
146
- const regex = /^(?:(:w\[\d*(?:,\s?\d+)?])?(:h\[\d*(?:,\s?\d+)?])?|(:h\[\d*(?:,\s?\d+)?])?(:w\[\d*(?:,\s?\d+)?])?)$/;
75
+ const regex = /(:w|:h)/;
147
76
  return query.length > 0 && regex.test(query);
148
77
  };
149
-
150
- /**
151
- * Retrieves the first matching custom media query key based on the provided screen size.
152
- *
153
- * The function processes an array of media queries and returns the first query that matches
154
- * the given screen size. The media queries can be in formats like:
155
- * - w[200]
156
- * - w[0, 200]
157
- * - w[, 300]
158
- * - h[200]
159
- * - h[0, 500]
160
- * - h[,200]
161
- * - w[100, 300]:h[200,500]
162
- * - h[200,500]:w[100, 300]
163
- *
164
- * @param {Array<[string, string | number]>} mediaQueries - An array of tuples containing media query keys and associated values.
165
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
166
- * @returns {string | undefined} Returns the first matching media query key or `undefined` if no match is found.
167
- * @example
168
- *
169
- * const queries = [[':w[200]', 'value1'], [':h[300,500]', 'value2']]
170
- * const size = { width: 250, height: 400 }
171
- * getKeyForCustomMediaQuery(queries, size) // ':w[200]
172
- */
173
- export const getKeyForCustomMediaQuery = (mediaQueries, screenSize) => {
78
+ export const getKeyForCustomMediaQuery = (mediaQueries, screenSize, breakpoints) => {
174
79
  const [matchedQuery] = mediaQueries.flatMap(_ref => {
175
80
  let [key] = _ref;
176
- if (key.includes('w') && key.includes('h')) {
177
- return isWithinBreakpoint(key, screenSize) ? key : undefined;
178
- }
179
- return key.split(':').filter(Boolean).map(query => isWithinBreakpoint(query, screenSize) ? key : undefined);
81
+ return isWithinBreakpoint(key, screenSize, breakpoints) ? key : undefined;
180
82
  }).filter(Boolean);
181
83
  return matchedQuery;
182
84
  };
@@ -1 +1 @@
1
- {"version":3,"names":["extractValues","codedValue","cleanedValue","replace","left","right","split","lh","startsWith","Number","rh","endsWith","isWithinBreakpoint","query","screenSize","includes","isWithinTheWidthAndHeight","charAt","isWithinTheWidth","width","isWithinTheHeight","height","minWidth","maxWidth","minHeight","maxHeight","result","filter","Boolean","map","q","length","isMediaQuery","regex","test","getKeyForCustomMediaQuery","mediaQueries","matchedQuery","flatMap","_ref","key","undefined"],"sourceRoot":"../../../src","sources":["utils/mediaQueries.ts"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAIC,UAAkB,IAAoB;EAChE,MAAMC,YAAY,GAAGD,UAAU,CAACE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;EACrD,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAGH,YAAY,CAACI,KAAK,CAAC,GAAG,CAAiC;EAE7E,IAAI,CAACD,KAAK,EAAE;IACR,MAAME,EAAE,GAAGH,IAAI,CAACI,UAAU,CAAC,GAAG,CAAC,GACzBC,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GACpCM,MAAM,CAACL,IAAI,CAACD,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC;IAE9C,OAAO,CAACI,EAAE,CAAC;EACf;EAEA,MAAMA,EAAE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H,OAAOpB,KAAK,CAACkB,MAAM,GAAG,CAAC,IAAIE,KAAK,CAACC,IAAI,CAACrB,KAAK,CAAC;AAChD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMsB,yBAAyB,GAAGA,CAACC,YAA0D,EAAEtB,UAAsB,KAAyB;EACjJ,MAAM,CAACuB,YAAY,CAAC,GAAGD,YAAY,CAC9BE,OAAO,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IACX,IAAIC,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,IAAIyB,GAAG,CAACzB,QAAQ,CAAC,GAAG,CAAC,EAAE;MACxC,OAAOH,kBAAkB,CAAC4B,GAAG,EAAE1B,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS;IAChE;IAEA,OAAOD,GAAG,CACLlC,KAAK,CAAC,GAAG,CAAC,CACVqB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAAChB,KAAK,IAAID,kBAAkB,CAACC,KAAK,EAAEC,UAAU,CAAC,GAAG0B,GAAG,GAAGC,SAAS,CAAC;EAC9E,CAAC,CAAC,CACDd,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC"}
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","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","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AAC,GAAG,CAAC,CACVoB,MAAM,CAACC,OAAO,CAAC,CACfC,GAAG,CAACC,CAAC,IAAInB,kBAAkB,CAAE,IAAGmB,CAAE,EAAC,EAAEjB,UAAU,EAAEzB,WAAW,CAAC,CAAC,CAC9DuC,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOF,MAAM,CAACK,MAAM,KAAK,CAAC;AAC9B,CAAC;AAED,OAAO,MAAMC,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;AAED,OAAO,MAAMuB,yBAAyB,GAAGA,CACrCC,YAA6F,EAC7FvB,UAAsB,EACtBzB,WAAiC,KACZ;EACrB,MAAM,CAACiD,YAAY,CAAC,GAAGD,YAAY,CAC9BE,OAAO,CAACC,IAAA;IAAA,IAAC,CAACC,GAAG,CAAC,GAAAD,IAAA;IAAA,OAAK5B,kBAAkB,CAAC6B,GAAG,EAAE3B,UAAU,EAAEzB,WAAW,CAAC,GAAGoD,GAAG,GAAG/B,SAAS;EAAA,EAAC,CACtFkB,MAAM,CAACC,OAAO,CAAC;EAEpB,OAAOS,YAAY;AACvB,CAAC"}
@@ -1,58 +1,17 @@
1
1
  import { getValueForBreakpoint } from './breakpoints';
2
2
  import { normalizeStyles } from './normalizeStyles';
3
- import { isWeb } from './common';
4
- /**
5
- * Proxies a function to parse its return value for custom media queries or breakpoints.
6
- *
7
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
8
- *
9
- * @param {Function} fn - The function to be proxified.
10
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
11
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
12
- * @param breakpointPairs - sorted pairs of breakpoints
13
- *
14
- * @returns {Function} Returns the proxified function
15
- *
16
- * @example
17
- *
18
- * const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
19
- * const screenSize = { width: 250, height: 400 }
20
- * const breakpoints = { sm: 300, md: 600 }
21
- *
22
- * const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
23
- * proxifiedFunction() // parsed style based on screenSize and breakpoints
24
- */
3
+ import { isAndroid, isIOS, isWeb } from './common';
25
4
  export const proxifyFunction = (fn, breakpoint, screenSize) => new Proxy(fn, {
26
5
  apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize)
27
6
  });
28
-
29
- /**
30
- * Parses a style object to resolve custom media queries or breakpoints based on the provided screen size and breakpoints.
31
- *
32
- * 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),
33
- * it is returned as-is. Otherwise, the function attempts to resolve the value based on the provided breakpoint, screen size, and defined breakpoints.
34
- *
35
- * @template T - The type of the style object.
36
- * @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
37
- *
38
- * @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
39
- * @param {keyof B & string} breakpoint - The breakpoint name to check against.
40
- * @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
41
- * @param breakpointPairs - sorted pairs of breakpoints
42
- *
43
- * @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
44
- *
45
- * @example
46
- *
47
- * const style = { fontSize: { sm: '12px', md: '16px' } }
48
- * const screenSize = { width: 300, height: 400 }
49
- * const breakpoints = { xs: 0, sm: 300, md: 600 }
50
- *
51
- * const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
52
- * // { fontSize: '12px' }
53
- */
7
+ export const isPlatformColor = value => {
8
+ if (isIOS) {
9
+ return 'semantic' in value && typeof value.semantic === 'object';
10
+ }
11
+ return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
12
+ };
54
13
  export const parseStyle = (style, breakpoint, screenSize) => {
55
- const entries = Object.entries(style);
14
+ const entries = Object.entries(style || {});
56
15
  const parsedStyles = Object.fromEntries(entries.map(_ref => {
57
16
  let [key, value] = _ref;
58
17
  const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
@@ -64,11 +23,11 @@ export const parseStyle = (style, breakpoint, screenSize) => {
64
23
  return [key, value.map(value => parseStyle(value, breakpoint, screenSize))];
65
24
  }
66
25
  const isDynamicFunction = typeof value === 'function';
67
- const isValidStyle = typeof value !== 'object';
26
+ const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
68
27
  if (isDynamicFunction || isValidStyle) {
69
28
  return [key, value];
70
29
  }
71
- return [key, getValueForBreakpoint(value, breakpoint, screenSize)];
30
+ return [key, getValueForBreakpoint(value)];
72
31
  }));
73
32
  return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
74
33
  };
@@ -1 +1 @@
1
- {"version":3,"names":["getValueForBreakpoint","normalizeStyles","isWeb","proxifyFunction","fn","breakpoint","screenSize","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;AAGhC;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,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;AAC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":3,"names":["getValueForBreakpoint","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,UAAU;AAElD,OAAO,MAAMC,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,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIb,KAAK,EAAE;IACP,OAAO,UAAU,IAAIa,KAAK,IAAI,OAAOA,KAAK,CAACC,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOf,SAAS,IAAI,gBAAgB,IAAIc,KAAK,IAAI,OAAOA,KAAK,CAACE,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAED,OAAO,MAAMJ,UAAU,GAAGA,CACtBK,KAA2B,EAC3BZ,UAA+C,EAC/CC,UAAsB,KAClB;EACJ,MAAMY,OAAO,GAAGC,MAAM,CAACD,OAAO,CAACD,KAAK,IAAI,CAAC,CAAC,CAGzC;EAED,MAAMG,YAAY,GAAGD,MAAM,CACtBE,WAAW,CAACH,OAAO,CACfI,GAAG,CAACC,IAAA,IAAkB;IAAA,IAAjB,CAACC,GAAG,EAAEV,KAAK,CAAC,GAAAS,IAAA;IACd,MAAME,mBAAmB,GAAGD,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAK,kBAAkB;IAEhF,IAAIC,mBAAmB,EAAE;MACrB,OAAO,CACHD,GAAG,EACHZ,UAAU,CAACE,KAAK,EAA0BT,UAAU,EAAEC,UAAU,CAAC,CACpE;IACL;IAEA,MAAMoB,WAAW,GAAGF,GAAG,KAAK,WAAW;IAEvC,IAAIE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC,EAAE;MACrC,OAAO,CACHU,GAAG,EACHV,KAAK,CAACQ,GAAG,CAACR,KAAK,IAAIF,UAAU,CAACE,KAAK,EAAET,UAAU,EAAEC,UAAU,CAAC,CAAC,CAChE;IACL;IAEA,MAAMuB,iBAAiB,GAAG,OAAOf,KAAK,KAAK,UAAU;IACrD,MAAMgB,YAAY,GAAG,OAAOhB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIe,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEV,KAAK,CAAC;IACvB;IAEA,OAAO,CACHU,GAAG,EACH1B,qBAAqB,CAACgB,KAAuF,CAAC,CACjH;EACL,CAAC,CACL,CAAC;EAEL,OAAOZ,KAAK,GACNH,eAAe,CAACqB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { UnistylesRuntime } from './UnistylesRuntime';
2
- import { UnistylesEngine } from './UnistylesEngine';
2
+ import { UnistylesBuiltInEngine } from './UnistylesEngine';
3
3
  import { UnistyleRegistry } from './UnistyleRegistry';
4
4
  declare class Unistyles {
5
5
  private _runtime;
@@ -9,7 +9,7 @@ declare class Unistyles {
9
9
  constructor();
10
10
  get registry(): UnistyleRegistry;
11
11
  get runtime(): UnistylesRuntime;
12
- get engine(): UnistylesEngine;
12
+ get engine(): UnistylesBuiltInEngine;
13
13
  }
14
14
  export declare const unistyles: Unistyles;
15
15
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../src/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAgBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;IAED,IAAW,MAAM,oBAEhB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
1
+ {"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../src/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAgBhC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;IAED,IAAW,MAAM,2BAEhB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
@@ -1,8 +1,11 @@
1
1
  import type { UnistyleRegistry } from './UnistyleRegistry';
2
2
  import type { UnistylesRuntime } from './UnistylesRuntime';
3
- export declare class UnistylesEngine {
3
+ import type { UnistylesEngine, NestedKeys } from './types';
4
+ export declare class UnistylesBuiltInEngine implements UnistylesEngine {
4
5
  private registry;
5
6
  private runtime;
6
7
  constructor(registry: UnistyleRegistry, runtime: UnistylesRuntime);
8
+ isMediaQuery: (key: string) => boolean;
9
+ didMatchMediaQuery: (keys: NestedKeys) => string | undefined;
7
10
  }
8
11
  //# sourceMappingURL=UnistylesEngine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnistylesEngine.d.ts","sourceRoot":"","sources":["../../../src/UnistylesEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D,qBAAa,eAAe;IAEZ,OAAO,CAAC,QAAQ;IAAoB,OAAO,CAAC,OAAO;gBAA3C,QAAQ,EAAE,gBAAgB,EAAU,OAAO,EAAE,gBAAgB;CAQpF"}
1
+ {"version":3,"file":"UnistylesEngine.d.ts","sourceRoot":"","sources":["../../../src/UnistylesEngine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE1D,qBAAa,sBAAuB,YAAW,eAAe;IAC9C,OAAO,CAAC,QAAQ;IAAoB,OAAO,CAAC,OAAO;gBAA3C,QAAQ,EAAE,gBAAgB,EAAU,OAAO,EAAE,gBAAgB;IAK1E,YAAY,QAAS,MAAM,aAIjC;IAEM,kBAAkB,2CAC0D;CAKtF"}
@@ -1,6 +1,3 @@
1
- import type { CustomNamedStyles } from './types';
2
- import type { UnistylesThemes } from './global';
3
- type T = UnistylesThemes[keyof UnistylesThemes];
4
- export declare const createStyleSheet: <S extends CustomNamedStyles<S>, X>(styles: S | X | CustomNamedStyles<S> | ((theme: T) => X | CustomNamedStyles<X>)) => S | X;
5
- export {};
1
+ import type { CustomNamedStyles, UnistylesTheme } from './types';
2
+ export declare const createStyleSheet: <S, X>(styles: S | X | CustomNamedStyles<S> | ((theme: UnistylesTheme) => X | CustomNamedStyles<X>)) => S | X;
6
3
  //# sourceMappingURL=createStyleSheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,CAAC,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AAE/C,eAAO,MAAM,gBAAgB,sFAAuF,CAAC,wCAMpH,CAAA"}
1
+ {"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,gBAAgB,yDAA0D,cAAc,wCAMpG,CAAA"}
@@ -1,3 +1,4 @@
1
+ import type { OpaqueColorValue } from 'react-native';
1
2
  import type { UnistylesBreakpoints } from '../global';
2
3
  import type { MediaQueries } from './mediaQueries';
3
4
  export type ScreenSize = {
@@ -9,7 +10,7 @@ type WithEmptyObject<V> = keyof V extends never ? {} : V;
9
10
  export type ExtractBreakpoints<T> = T extends Partial<Record<keyof UnistylesBreakpoints & string, infer V>> ? WithEmptyObject<V> : T extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : {
10
11
  [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => ExtractBreakpoints<R> : T[K] extends object ? ExtractBreakpoints<T[K]> : T[K];
11
12
  };
12
- export type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends Record<string, infer _V> ? {
13
+ export type RemoveKeysWithPrefix<T> = T extends (...args: Array<any>) => infer R ? (...args: Parameters<T>) => RemoveKeysWithPrefix<R> : T extends object ? T extends OpaqueColorValue ? string : T extends Record<string, infer _V> ? {
13
14
  [K in keyof T as K extends MediaQueries ? keyof UnistylesBreakpoints & string : K]: RemoveKeysWithPrefix<T[K]>;
14
15
  } : {
15
16
  [K in keyof T]: RemoveKeysWithPrefix<T[K]>;
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,KAAK,EAAE,CAAA;AAEjE,KAAK,eAAe,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;AAExD,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GACrG,eAAe,CAAC,CAAC,CAAC,GAClB,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACnC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,kBAAkB,CAAC,CAAC,CAAC,GACrC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,GACpD,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,kBAAkB,C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AAC,CAAC;CAAE,GACtD,CAAC,CAAA"}
@@ -1,32 +1,34 @@
1
1
  import type { MatrixTransform, PerpectiveTransform, RotateTransform, RotateXTransform, RotateYTransform, RotateZTransform, ScaleTransform, ScaleXTransform, ScaleYTransform, SkewXTransform, SkewYTransform, TranslateXTransform, TranslateYTransform } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
2
2
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
3
3
  import type { MediaQueries } from './mediaQueries';
4
- import type { UnistylesBreakpoints } from '../global';
4
+ import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
5
5
  type ShadowOffset = {
6
6
  width: number;
7
7
  height: number;
8
8
  };
9
9
  type TransformStyles = PerpectiveTransform & RotateTransform & RotateXTransform & RotateYTransform & RotateZTransform & ScaleTransform & ScaleXTransform & ScaleYTransform & TranslateXTransform & TranslateYTransform & SkewXTransform & SkewYTransform & MatrixTransform;
10
- type UnistyleNested<B> = {
11
- shadowOffset?: DeepUniStyle<ShadowOffset, B>;
12
- textShadowOffset?: DeepUniStyle<ShadowOffset, B>;
13
- transform?: Array<DeepUniStyle<TransformStyles, B>>;
10
+ type UnistyleNested = {
11
+ shadowOffset?: DeepUniStyle<ShadowOffset>;
12
+ textShadowOffset?: DeepUniStyle<ShadowOffset>;
13
+ transform?: Array<DeepUniStyle<TransformStyles>>;
14
14
  };
15
- type UniStyle<V, B> = {
16
- [innerKey in keyof B]?: V;
15
+ type UniStyle<V> = {
16
+ [innerKey in keyof UnistylesBreakpoints]: V;
17
17
  } | {
18
- [innerKey in MediaQueries]?: V;
19
- } | V;
20
- type DeepUniStyle<T, B> = {
21
- [K in keyof T]?: UniStyle<T[K], B>;
18
+ [innerKey in MediaQueries]: V;
19
+ };
20
+ type DeepUniStyle<T> = {
21
+ [K in keyof T]?: UniStyle<T[K]> | T[K];
22
22
  };
23
23
  type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
24
- type UnistyleView<B> = DeepUniStyle<Omit<ViewStyle, NestedTypes>, B>;
25
- type UnistyleText<B> = DeepUniStyle<Omit<TextStyle, NestedTypes>, B>;
26
- type UnistyleImage<B> = DeepUniStyle<Omit<ImageStyle, NestedTypes>, B>;
27
- export type StaticStyles<B> = UnistyleView<B> | UnistyleText<B> | UnistyleImage<B> & UnistyleNested<B>;
24
+ type UnistyleView = DeepUniStyle<Omit<ViewStyle, NestedTypes>>;
25
+ type UnistyleText = DeepUniStyle<Omit<TextStyle, NestedTypes>>;
26
+ type UnistyleImage = DeepUniStyle<Omit<ImageStyle, NestedTypes>>;
27
+ export type StaticStyles = UnistyleView | UnistyleText | UnistyleImage & UnistyleNested;
28
28
  export type CustomNamedStyles<T> = {
29
- [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles<UnistylesBreakpoints> ? (...args: A) => StaticStyles<UnistylesBreakpoints> : StaticStyles<UnistylesBreakpoints>;
29
+ [K in keyof T]: T[K] extends (...args: infer A) => StaticStyles ? (...args: A) => StaticStyles : StaticStyles;
30
30
  };
31
+ export type NestedKeys = Array<[keyof UnistylesBreakpoints | MediaQueries, string | number | undefined]>;
32
+ export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
31
33
  export {};
32
34
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,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AAA;AAED,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,oBAAoB,GAAG,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;AACxG,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import type { UnistylesThemes, UnistylesBreakpoints } from '../global';
2
2
  import type { ScreenSize } from './breakpoints';
3
+ import type { NestedKeys } from './core';
4
+ export type Optional<T> = T | undefined;
3
5
  export type Nullable<T> = T | null;
4
- export type ColorSchemeName = 'light' | 'dark' | undefined;
6
+ export type ColorSchemeName = Optional<'light' | 'dark'>;
5
7
  export type UnistylesConfig = {
6
8
  adaptiveThemes?: boolean;
7
9
  };
@@ -50,4 +52,8 @@ export declare enum UnistylesError {
50
52
  BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
51
53
  BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
52
54
  }
55
+ export interface UnistylesEngine {
56
+ isMediaQuery(key: string): boolean;
57
+ didMatchMediaQuery(keys: NestedKeys): Optional<string>;
58
+ }
53
59
  //# sourceMappingURL=cxx.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cxx.d.ts","sourceRoot":"","sources":["../../../../src/types/cxx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAClC,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;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C5C,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAGzC,UAAU,IAAI,IAAI,CAAA;CACrB,CAAA;AAED,oBAAY,sBAAsB;IAC9B,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC;IACnC,OAAO,EAAE;QACL,SAAS,EAAE,MAAM,eAAe,CAAA;KACnC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE;QACL,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,MAAM,oBAAoB,CAAC;QACvC,WAAW,EAAE,iBAAiB,CAAA;KACjC,CAAA;CACJ,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,0BAA0B,CAAA;AAE9E,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF;AAED,MAAM,WAAW,eAAe;IAC5B,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC1D"}
@@ -1,6 +1,6 @@
1
1
  export * from './normalizer';
2
2
  export * from './cxx';
3
- export type { CustomNamedStyles } from './core';
3
+ export type { CustomNamedStyles, NestedKeys, UnistylesTheme } from './core';
4
4
  export type { MediaQueries } from './mediaQueries';
5
5
  export type { ScreenSize, CreateStylesFactory, ExtractBreakpoints, RemoveKeysWithPrefix } from './breakpoints';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,YAAY,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC/C,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,OAAO,CAAA;AACrB,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACvB,MAAM,eAAe,CAAA"}
@@ -1,8 +1,10 @@
1
1
  type Optional<TOptional extends string> = TOptional | '';
2
2
  type Separator = ',' | ', ';
3
- type MediaQuery = `[${Separator}${bigint}]` | `[${bigint}${Optional<`${Separator}${bigint}`>}]`;
4
- type WidthMediaQuery = `:w${MediaQuery}`;
5
- type HeightMediaQuery = `:h${MediaQuery}`;
3
+ type OpeningBracket = '(' | '[';
4
+ type ClosingBracket = ')' | ']';
5
+ type NumericMediaQuery = `${OpeningBracket}${Separator}${bigint}${ClosingBracket}` | `${OpeningBracket}${bigint}${Optional<`${Separator}${bigint}`>}${ClosingBracket}`;
6
+ type WidthMediaQuery = `:w${NumericMediaQuery}`;
7
+ type HeightMediaQuery = `:h${NumericMediaQuery}`;
6
8
  export type MediaQueries = `${WidthMediaQuery}${Optional<HeightMediaQuery>}` | `${HeightMediaQuery}${Optional<WidthMediaQuery>}`;
7
9
  export {};
8
10
  //# sourceMappingURL=mediaQueries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/types/mediaQueries.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,SAAS,SAAS,MAAM,IAAI,SAAS,GAAG,EAAE,CAAA;AACxD,KAAK,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAE3B,KAAK,UAAU,GAAG,IAAI,SAAS,GAAG,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,CAAA;AAC/F,KAAK,eAAe,GAAG,KAAK,UAAU,EAAE,CAAA;AACxC,KAAK,gBAAgB,GAAG,KAAK,UAAU,EAAE,CAAA;AAEzC,MAAM,MAAM,YAAY,GAClB,GAAG,eAAe,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,GACjD,GAAG,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA"}
1
+ {"version":3,"file":"mediaQueries.d.ts","sourceRoot":"","sources":["../../../../src/types/mediaQueries.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,SAAS,SAAS,MAAM,IAAI,SAAS,GAAG,EAAE,CAAA;AACxD,KAAK,SAAS,GAAG,GAAG,GAAG,IAAI,CAAA;AAC3B,KAAK,cAAc,GAAG,GAAG,GAAG,GAAG,CAAA;AAC/B,KAAK,cAAc,GAAG,GAAG,GAAG,GAAG,CAAA;AAE/B,KAAK,iBAAiB,GAChB,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,cAAc,EAAE,GACzD,GAAG,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC,GAAG,SAAS,GAAG,MAAM,EAAE,CAAC,GAAG,cAAc,EAAE,CAAA;AAEvF,KAAK,eAAe,GAAG,KAAK,iBAAiB,EAAE,CAAA;AAC/C,KAAK,gBAAgB,GAAG,KAAK,iBAAiB,EAAE,CAAA;AAEhD,MAAM,MAAM,YAAY,GAClB,GAAG,eAAe,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,GACjD,GAAG,gBAAgB,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAA"}
@@ -1,10 +1,8 @@
1
1
  import type { CreateStylesFactory, CustomNamedStyles, ExtractBreakpoints, RemoveKeysWithPrefix } from './types';
2
- import type { UnistylesThemes } from './global';
3
- type T = UnistylesThemes[keyof UnistylesThemes];
2
+ import type { UnistylesTheme } from './types';
4
3
  export declare const useStyles: <ST extends CustomNamedStyles<ST>>(stylesheet?: ST | CreateStylesFactory<ST, never> | undefined) => {
5
4
  theme: never;
6
5
  breakpoint: "landscape" | "portrait";
7
6
  styles: ExtractBreakpoints<RemoveKeysWithPrefix<ST>>;
8
7
  };
9
- export {};
10
8
  //# sourceMappingURL=useStyles.d.ts.map