react-native-unistyles 2.0.0-alpha.15 → 2.0.0-alpha.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/lib/commonjs/utils/index.js +0 -30
  2. package/lib/commonjs/utils/index.js.map +1 -1
  3. package/lib/commonjs/utils/mq.js +37 -83
  4. package/lib/commonjs/utils/mq.js.map +1 -1
  5. package/lib/module/utils/index.js +1 -1
  6. package/lib/module/utils/index.js.map +1 -1
  7. package/lib/module/utils/mq.js +36 -82
  8. package/lib/module/utils/mq.js.map +1 -1
  9. package/lib/typescript/src/types/breakpoints.d.ts +10 -7
  10. package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
  11. package/lib/typescript/src/types/core.d.ts +2 -3
  12. package/lib/typescript/src/types/core.d.ts.map +1 -1
  13. package/lib/typescript/src/types/index.d.ts +0 -1
  14. package/lib/typescript/src/types/index.d.ts.map +1 -1
  15. package/lib/typescript/src/types/stylesheet.d.ts +3 -10
  16. package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
  17. package/lib/typescript/src/utils/index.d.ts +1 -1
  18. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  19. package/lib/typescript/src/utils/mq.d.ts +4 -9
  20. package/lib/typescript/src/utils/mq.d.ts.map +1 -1
  21. package/package.json +2 -2
  22. package/src/types/breakpoints.ts +17 -14
  23. package/src/types/core.ts +3 -4
  24. package/src/types/index.ts +0 -1
  25. package/src/types/stylesheet.ts +3 -10
  26. package/src/utils/index.ts +1 -1
  27. package/src/utils/mq.ts +20 -88
  28. package/lib/commonjs/types/mq.js +0 -6
  29. package/lib/commonjs/types/mq.js.map +0 -1
  30. package/lib/module/types/mq.js +0 -2
  31. package/lib/module/types/mq.js.map +0 -1
  32. package/lib/typescript/src/types/mq.d.ts +0 -3
  33. package/lib/typescript/src/types/mq.d.ts.map +0 -1
  34. package/src/types/mq.ts +0 -3
@@ -3,36 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "MQHeight", {
7
- enumerable: true,
8
- get: function () {
9
- return _mq.MQHeight;
10
- }
11
- });
12
- Object.defineProperty(exports, "MQHeightAndWidth", {
13
- enumerable: true,
14
- get: function () {
15
- return _mq.MQHeightAndWidth;
16
- }
17
- });
18
- Object.defineProperty(exports, "MQSymbol", {
19
- enumerable: true,
20
- get: function () {
21
- return _mq.MQSymbol;
22
- }
23
- });
24
- Object.defineProperty(exports, "MQWidth", {
25
- enumerable: true,
26
- get: function () {
27
- return _mq.MQWidth;
28
- }
29
- });
30
- Object.defineProperty(exports, "MQWidthAndHeight", {
31
- enumerable: true,
32
- get: function () {
33
- return _mq.MQWidthAndHeight;
34
- }
35
- });
36
6
  Object.defineProperty(exports, "getKeyForUnistylesMediaQuery", {
37
7
  enumerable: true,
38
8
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_mq","require","_mqParser","_breakpoints","_styles"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA"}
1
+ {"version":3,"names":["_mq","require","_mqParser","_breakpoints","_styles"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA"}
@@ -3,21 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.mq = exports.MQWidthAndHeight = exports.MQWidth = exports.MQSymbol = exports.MQHeightAndWidth = exports.MQHeight = void 0;
6
+ exports.mq = void 0;
7
7
  var _core = require("../core");
8
- const MQSymbol = exports.MQSymbol = Symbol('unistyles-mq');
9
- const MQWidth = exports.MQWidth = Symbol('unistyles-mq-width');
10
- const MQHeight = exports.MQHeight = Symbol('unistyles-mq-height');
11
- const MQWidthAndHeight = exports.MQWidthAndHeight = Symbol('unistyles-mq-width-and-height');
12
- const MQHeightAndWidth = exports.MQHeightAndWidth = Symbol('unistyles-mq-height-and-width');
13
- var MQProp = /*#__PURE__*/function (MQProp) {
14
- MQProp["toString"] = "toString";
15
- MQProp["width"] = "width";
16
- MQProp["height"] = "height";
17
- MQProp["only"] = "only";
18
- MQProp["and"] = "and";
19
- return MQProp;
20
- }(MQProp || {});
21
8
  const getMQValue = value => {
22
9
  if (typeof value === 'number') {
23
10
  return value;
@@ -27,77 +14,44 @@ const getMQValue = value => {
27
14
  }
28
15
  return _core.unistyles.registry.breakpoints[value] ?? 0;
29
16
  };
30
- const widthHandler = function () {
31
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
32
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
33
- return new Proxy({}, {
34
- get: (target, prop, receiver) => {
35
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
36
- return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
37
- }
38
- if (prop === MQProp.and) {
39
- return {
40
- width: function () {
41
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
42
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
43
- return new Proxy({}, {
44
- get: (target, prop, receiver) => {
45
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
46
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
47
- }
48
- return Reflect.get(target, prop, receiver);
49
- }
50
- });
51
- }
52
- };
53
- }
54
- return Reflect.get(target, prop, receiver);
17
+ const mq = exports.mq = {
18
+ only: {
19
+ width: function () {
20
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
21
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
22
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
23
+ },
24
+ height: function () {
25
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
26
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
27
+ return `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
55
28
  }
56
- });
57
- };
58
- const heightHandler = function () {
59
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
60
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
61
- return new Proxy({}, {
62
- get: (target, prop, receiver) => {
63
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
64
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
29
+ },
30
+ width: function () {
31
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
32
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
33
+ return {
34
+ and: {
35
+ height: function () {
36
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
37
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
38
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
39
+ }
65
40
  }
66
- if (prop === MQProp.and) {
67
- return {
68
- height: function () {
69
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
70
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
71
- return new Proxy({}, {
72
- get: (target, prop, receiver) => {
73
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
74
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
75
- }
76
- return Reflect.get(target, prop, receiver);
77
- }
78
- });
79
- }
80
- };
41
+ };
42
+ },
43
+ height: function () {
44
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
45
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
46
+ return {
47
+ and: {
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 `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
52
+ }
81
53
  }
82
- return Reflect.get(target, prop, receiver);
83
- }
84
- });
85
- };
86
- const mq = exports.mq = new Proxy({}, {
87
- get: (target, prop, receiver) => {
88
- if (prop === MQProp.only) {
89
- return {
90
- width: heightHandler,
91
- height: widthHandler
92
- };
93
- }
94
- if (prop === MQProp.height) {
95
- return widthHandler;
96
- }
97
- if (prop === MQProp.width) {
98
- return heightHandler;
99
- }
100
- return Reflect.get(target, prop, receiver);
54
+ };
101
55
  }
102
- });
56
+ };
103
57
  //# sourceMappingURL=mq.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_core","require","MQSymbol","exports","Symbol","MQWidth","MQHeight","MQWidthAndHeight","MQHeightAndWidth","MQProp","getMQValue","value","unistyles","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","and","width","wMin","wMax","Reflect","heightHandler","height","mq","only"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGE,MAAM,CAAC,cAAc,CAAC;AACvC,MAAMC,OAAO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AAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;IAC7B,IAAID,IAAI,KAAKhB,MAAM,CAAC4B,IAAI,EAAE;MACtB,OAAO;QACHP,KAAK,EAAEI,aAAa;QACpBC,MAAM,EAAEpB;MACZ,CAAC;IACL;IAEA,IAAIU,IAAI,KAAKhB,MAAM,CAAC0B,MAAM,EAAE;MACxB,OAAOpB,YAAY;IACvB;IAEA,IAAIU,IAAI,KAAKhB,MAAM,CAACqB,KAAK,EAAE;MACvB,OAAOI,aAAa;IACxB;IAEA,OAAOD,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;EAC9C;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["_core","require","getMQValue","value","unistyles","registry","breakpoints","mq","exports","only","width","wMin","arguments","length","undefined","wMax","Infinity","height","hMin","hMax","and"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAqBA,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,CAAC;EACZ;EAEA,OAAOC,eAAS,CAACC,QAAQ,CAACC,WAAW,CAACH,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;AAEM,MAAMI,EAAa,GAAAC,OAAA,CAAAD,EAAA,GAAG;EACzBE,IAAI,EAAE;IACFC,KAAK,EAAE,SAAAA,CAAA;MAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;MAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;MAAA,OAAO,MAAKd,UAAU,CAACS,IAAI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AAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;IAAA,OAAM;MAChEI,GAAG,EAAE;QACDV,KAAK,EAAE,SAAAA,CAAA;UAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;UAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;UAAA,OACvD,MAAKd,UAAU,CAACS,IAAI,CAAE,KAAIT,UAAU,CAACa,IAAI,CAAE,OAAMb,UAAU,CAACgB,IAAI,CAAE,KAAIhB,UAAU,CAACiB,IAAI,CAAE,GAAE;QAAA;MACnG;IACJ,CAAC;EAAA;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
- export { mq, MQSymbol, MQHeight, MQWidth, MQHeightAndWidth, MQWidthAndHeight } from './mq';
1
+ export { mq } from './mq';
2
2
  export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq } from './mqParser';
3
3
  export { getValueForBreakpoint } from './breakpoints';
4
4
  export { proxifyFunction, parseStyle } from './styles';
@@ -1 +1 @@
1
- {"version":3,"names":["mq","MQSymbol","MQHeight","MQWidth","MQHeightAndWidth","MQWidthAndHeight","getKeyForUnistylesMediaQuery","isWithinTheWidthAndHeight","isValidMq","parseMq","getValueForBreakpoint","proxifyFunction","parseStyle"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,EAAE,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,MAAM;AAC1F,SAASC,4BAA4B,EAAEC,yBAAyB,EAAEC,SAAS,EAAEC,OAAO,QAAQ,YAAY;AACxG,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU"}
1
+ {"version":3,"names":["mq","getKeyForUnistylesMediaQuery","isWithinTheWidthAndHeight","isValidMq","parseMq","getValueForBreakpoint","proxifyFunction","parseStyle"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,EAAE,QAAQ,MAAM;AACzB,SAASC,4BAA4B,EAAEC,yBAAyB,EAAEC,SAAS,EAAEC,OAAO,QAAQ,YAAY;AACxG,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,eAAe,EAAEC,UAAU,QAAQ,UAAU"}
@@ -1,17 +1,4 @@
1
1
  import { unistyles } from '../core';
2
- export const MQSymbol = Symbol('unistyles-mq');
3
- export const MQWidth = Symbol('unistyles-mq-width');
4
- export const MQHeight = Symbol('unistyles-mq-height');
5
- export const MQWidthAndHeight = Symbol('unistyles-mq-width-and-height');
6
- export const MQHeightAndWidth = Symbol('unistyles-mq-height-and-width');
7
- var MQProp = /*#__PURE__*/function (MQProp) {
8
- MQProp["toString"] = "toString";
9
- MQProp["width"] = "width";
10
- MQProp["height"] = "height";
11
- MQProp["only"] = "only";
12
- MQProp["and"] = "and";
13
- return MQProp;
14
- }(MQProp || {});
15
2
  const getMQValue = value => {
16
3
  if (typeof value === 'number') {
17
4
  return value;
@@ -21,77 +8,44 @@ const getMQValue = value => {
21
8
  }
22
9
  return unistyles.registry.breakpoints[value] ?? 0;
23
10
  };
24
- const widthHandler = function () {
25
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
26
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
27
- return new Proxy({}, {
28
- get: (target, prop, receiver) => {
29
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
30
- return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
31
- }
32
- if (prop === MQProp.and) {
33
- return {
34
- width: function () {
35
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
36
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
37
- return new Proxy({}, {
38
- get: (target, prop, receiver) => {
39
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
40
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
41
- }
42
- return Reflect.get(target, prop, receiver);
43
- }
44
- });
45
- }
46
- };
47
- }
48
- return Reflect.get(target, prop, receiver);
11
+ export const mq = {
12
+ only: {
13
+ width: function () {
14
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
15
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
16
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
17
+ },
18
+ height: function () {
19
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
20
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
21
+ return `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
49
22
  }
50
- });
51
- };
52
- const heightHandler = function () {
53
- let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
54
- let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
55
- return new Proxy({}, {
56
- get: (target, prop, receiver) => {
57
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
58
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
23
+ },
24
+ width: function () {
25
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
26
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
27
+ return {
28
+ and: {
29
+ height: function () {
30
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
31
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
32
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
33
+ }
59
34
  }
60
- if (prop === MQProp.and) {
61
- return {
62
- height: function () {
63
- let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
64
- let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
65
- return new Proxy({}, {
66
- get: (target, prop, receiver) => {
67
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
68
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
69
- }
70
- return Reflect.get(target, prop, receiver);
71
- }
72
- });
73
- }
74
- };
35
+ };
36
+ },
37
+ height: function () {
38
+ let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
39
+ let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
40
+ return {
41
+ and: {
42
+ width: function () {
43
+ let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
44
+ let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
45
+ return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
46
+ }
75
47
  }
76
- return Reflect.get(target, prop, receiver);
77
- }
78
- });
79
- };
80
- export const mq = new Proxy({}, {
81
- get: (target, prop, receiver) => {
82
- if (prop === MQProp.only) {
83
- return {
84
- width: heightHandler,
85
- height: widthHandler
86
- };
87
- }
88
- if (prop === MQProp.height) {
89
- return widthHandler;
90
- }
91
- if (prop === MQProp.width) {
92
- return heightHandler;
93
- }
94
- return Reflect.get(target, prop, receiver);
48
+ };
95
49
  }
96
- });
50
+ };
97
51
  //# sourceMappingURL=mq.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["unistyles","MQSymbol","Symbol","MQWidth","MQHeight","MQWidthAndHeight","MQHeightAndWidth","MQProp","getMQValue","value","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","and","width","w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MAAMU,EAAE,GAAG,IAAId,KAAK,CAAY,CAAC,CAAC,EAAe;EACpDC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;IAC7B,IAAID,IAAI,KAAKf,MAAM,CAAC2B,IAAI,EAAE;MACtB,OAAO;QACHP,KAAK,EAAEI,aAAa;QACpBC,MAAM,EAAEpB;MACZ,CAAC;IACL;IAEA,IAAIU,IAAI,KAAKf,MAAM,CAACyB,MAAM,EAAE;MACxB,OAAOpB,YAAY;IACvB;IAEA,IAAIU,IAAI,KAAKf,MAAM,CAACoB,KAAK,EAAE;MACvB,OAAOI,aAAa;IACxB;IAEA,OAAOD,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;EAC9C;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["unistyles","getMQValue","value","registry","breakpoints","mq","only","width","wMin","arguments","length","undefined","wMax","Infinity","height","hMin","hMax","and"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":"AAEA,SAASA,SAAS,QAAQ,SAAS;AAqBnC,MAAMC,UAAU,GAAIC,KAAwB,IAAK;EAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB;EAEA,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,CAAC;EACZ;EAEA,OAAOF,SAAS,CAACG,QAAQ,CAACC,WAAW,CAACF,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;AAED,OAAO,MAAMG,EAAa,GAAG;EACzBC,IAAI,EAAE;IACFC,KAAK,EAAE,SAAAA,CAAA;MAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;MAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;MAAA,OAAO,MA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,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;IAAA,OAAM;MAChEI,GAAG,EAAE;QACDV,KAAK,EAAE,SAAAA,CAAA;UAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;UAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;UAAA,OACvD,MAAKZ,UAAU,CAACO,IAAI,CAAE,KAAIP,UAAU,CAACW,IAAI,CAAE,OAAMX,UAAU,CAACc,IAAI,CAAE,KAAId,UAAU,CAACe,IAAI,CAAE,GAAE;QAAA;MACnG;IACJ,CAAC;EAAA;AACL,CAAC"}
@@ -1,15 +1,18 @@
1
1
  import type { ColorValue, OpaqueColorValue } from 'react-native';
2
2
  import type { UnistylesTheme } from '../types';
3
- import type { AllAvailableKeys, BreakpointsOrMediaQueries } from './stylesheet';
4
- type WithEmptyObject<V> = keyof V extends never ? {} : V;
5
- type ExtractBreakpoints<T> = T extends Partial<Record<BreakpointsOrMediaQueries, infer R>> ? WithEmptyObject<R> : {
6
- [K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
7
- };
8
- type ParseNestedObject<T> = T extends (...args: infer A) => infer R ? (...args: A) => ParseNestedObject<R> : keyof T extends AllAvailableKeys ? ExtractBreakpoints<T> : T extends {
3
+ import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet';
4
+ import type { TransformStyles } from './core';
5
+ type ExtractTransformArray<T> = T extends object ? {
6
+ [K in keyof T]: ExtractBreakpoints<T[K]>;
7
+ } : never;
8
+ type ExtractBreakpoints<T> = T extends object ? keyof T extends BreakpointsOrMediaQueries ? T[keyof T] : T extends Array<ToDeepUnistyles<TransformStyles>> ? Array<ExtractTransformArray<T[number]>> : {
9
+ [K in keyof T]: ExtractBreakpoints<T[K]>;
10
+ } : T;
11
+ type ParseNestedObject<T> = T extends (...args: infer A) => infer R ? (...args: A) => ParseNestedObject<R> : T extends object ? T extends {
9
12
  variants: infer R;
10
13
  } ? ParseVariants<FlattenVariants<R>> & ParseNestedObject<Omit<T, 'variants'>> : {
11
14
  [K in keyof T]: T[K] extends object ? T[K] extends OpaqueColorValue ? ColorValue : ExtractBreakpoints<T[K]> : T[K];
12
- };
15
+ } : T;
13
16
  type FlattenVariants<T> = T extends object ? {
14
17
  [K in keyof T]: T[K] extends object ? {
15
18
  [key in keyof T[K]]: T[K][key] extends object ? ParseNestedObject<T[K][key]> : never;
@@ -1 +1 @@
1
- {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../../src/types/breakpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAE/E,KAAK,eAAe,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,CAAC,CAAA;AAExD,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC,CAAC,GACpF,eAAe,CAAC,CAAC,CAAC,GAClB;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAC7B,CAAC,CAAC,CAAC,CAAC,SAAS,gBAAgB,GACzB,UAAU,GACV,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC5B,CAAC,CAAC,CAAC,CAAC;CACb,CAAA;AAEL,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,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,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC,GAC7E,cAAc,CAAC,CAAC,CAAC,GACjB,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1,7 +1,6 @@
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 { UnistylesBreakpoints, UnistylesThemes } from '../global';
4
- import type { MediaQuery } from './mq';
5
4
  export type ShadowOffset = {
6
5
  width: number;
7
6
  height: number;
@@ -13,8 +12,8 @@ export type ScreenSize = {
13
12
  };
14
13
  export type RNStyle = ViewStyle | TextStyle | ImageStyle;
15
14
  export type RNValue = number | string | undefined;
16
- export type NestedStyle = Record<keyof UnistylesBreakpoints | MediaQuery, RNValue>;
17
- export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | MediaQuery, RNValue]>;
15
+ export type NestedStyle = Record<keyof UnistylesBreakpoints | symbol, RNValue>;
16
+ export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | symbol, RNValue]>;
18
17
  export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes];
19
18
  export type CreateStylesFactory<ST> = (theme: UnistylesTheme) => ST;
20
19
  //# 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,KA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gB,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,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEtE,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,eAAe,GACrB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,cAAc,GACd,cAAc,GACd,eAAe,CAAA;AAErB,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;AACxD,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AACjD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,OAAO,CAAC,CAAA;AAC9E,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,MAAM,oBAAoB,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AACpF,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,eAAe,CAAC,CAAA;AACnE,MAAM,MAAM,mBAAmB,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,cAAc,KAAK,EAAE,CAAA"}
@@ -1,7 +1,6 @@
1
1
  export * from './normalizer';
2
2
  export * from './unistyles';
3
3
  export type { Optional, Nullable } from './common';
4
- export type { MediaQuery } from './mq';
5
4
  export type { NestedStylePairs, UnistylesTheme, CreateStylesFactory, ScreenSize, NestedStyle, RNValue, RNStyle } from './core';
6
5
  export type { StyleSheetWithSuperPowers, StyleSheet } from './stylesheet';
7
6
  export type { ReactNativeStyleSheet } from './breakpoints';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,YAAY,EACR,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EACR,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACV,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzE,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
2
2
  import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core';
3
3
  import type { UnistylesBreakpoints } from '../global';
4
- import type { MediaQuery } from './mq';
5
4
  type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset';
6
5
  type UnistyleView = Omit<ViewStyle, NestedTypes>;
7
6
  type UnistyleText = Omit<TextStyle, NestedTypes>;
@@ -14,24 +13,18 @@ type UnistyleNestedStyles = {
14
13
  type Variants = {
15
14
  variants?: {
16
15
  [variantName: string]: {
17
- [variant: string]: {
18
- [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
19
- [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName];
20
- } & {
21
- [propName in NestedTypes]?: UnistyleNestedStyles[propName];
22
- };
23
- };
16
+ [variant: string]: Omit<UnistylesValues, 'variants'>;
24
17
  };
25
18
  };
26
19
  };
27
- type ToDeepUnistyles<T> = {
20
+ export type ToDeepUnistyles<T> = {
28
21
  [K in keyof T]?: T[K] | {
29
22
  [key in BreakpointsOrMediaQueries]?: T[K];
30
23
  };
31
24
  };
32
25
  type AllAvailableStyles = UnistyleView & UnistyleText & UnistyleImage & UnistyleNestedStyles;
33
26
  export type AllAvailableKeys = keyof (UnistyleView & UnistyleText & UnistyleImage);
34
- export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | MediaQuery;
27
+ export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | symbol;
35
28
  export type UnistylesValues = {
36
29
  [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
37
30
  [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName];
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EA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Q,CAAC;KACpE;CACJ,GAAG,QAAQ,GAAG;KACV,QAAQ,IAAI,WAAW,CAAC,CAAC,EAAE,oBAAoB,CAAC,QAAQ,CAAC;CAC7D,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACrB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,eAAe,CAAC,CAAA;CAC7E,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,UAAU,CAAC,GAAG,UAAU,CAAA"}
@@ -1,4 +1,4 @@
1
- export { mq, MQSymbol, MQHeight, MQWidth, MQHeightAndWidth, MQWidthAndHeight } from './mq';
1
+ export { mq } from './mq';
2
2
  export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq } from './mqParser';
3
3
  export { getValueForBreakpoint } from './breakpoints';
4
4
  export { proxifyFunction, parseStyle } from './styles';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AACzB,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACxG,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA"}
@@ -1,24 +1,19 @@
1
1
  import type { Nullable } from '../types';
2
2
  import type { UnistylesBreakpoints } from '../global';
3
- export declare const MQSymbol: unique symbol;
4
- export declare const MQWidth: unique symbol;
5
- export declare const MQHeight: unique symbol;
6
- export declare const MQWidthAndHeight: unique symbol;
7
- export declare const MQHeightAndWidth: unique symbol;
8
3
  type MQValue = keyof UnistylesBreakpoints | number;
9
4
  type MQHandler = {
10
5
  only: {
11
- width(wMin?: Nullable<MQValue>, wMax?: MQValue): typeof MQWidth;
12
- height(hMin?: Nullable<MQValue>, hMax?: MQValue): typeof MQHeight;
6
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol;
7
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol;
13
8
  };
14
9
  width(wMin?: Nullable<MQValue>, wMax?: MQValue): {
15
10
  and: {
16
- height(hMin?: Nullable<MQValue>, hMax?: MQValue): typeof MQWidthAndHeight;
11
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol;
17
12
  };
18
13
  };
19
14
  height(hMin?: Nullable<MQValue>, hMax?: MQValue): {
20
15
  and: {
21
- width(wMin?: Nullable<MQValue>, wMax?: MQValue): typeof MQHeightAndWidth;
16
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol;
22
17
  };
23
18
  };
24
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/utils/mq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,eAAO,MAAM,QAAQ,eAAyB,CAAA;AAC9C,eAAO,MAAM,OAAO,eAA+B,CAAA;AACnD,eAAO,MAAM,QAAQ,eAAgC,C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CAAA;AAElD,KAAK,SAAS,GAAG;IACb,IAAI,EAAE;QACF,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KAC5D,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG;QAC7C,GAAG,EAAE;YACD,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;SAC3D,CAAA;KACJ,CAAC;IACF,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG;QAC9C,GAAG,EAAE;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;SAC1D,CAAA;KACJ,CAAA;CACJ,CAAA;AAcD,eAAO,MAAM,EAAE,EAAE,SAiBhB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unistyles",
3
- "version": "2.0.0-alpha.15",
3
+ "version": "2.0.0-alpha.16",
4
4
  "description": "Level up your React Native StyleSheet",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -82,7 +82,7 @@
82
82
  "react-native-web": "0.19.9",
83
83
  "react-test-renderer": "18.2.0",
84
84
  "release-it": "17.0.0",
85
- "typescript": "5.2.2"
85
+ "typescript": "5.3.2"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@react-native/normalize-colors": "*",
@@ -1,24 +1,26 @@
1
1
  import type { ColorValue, OpaqueColorValue } from 'react-native'
2
2
  import type { UnistylesTheme } from '../types'
3
- import type { AllAvailableKeys, BreakpointsOrMediaQueries } from './stylesheet'
3
+ import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
4
+ import type { TransformStyles } from './core'
4
5
 
5
- type WithEmptyObject<V> = keyof V extends never ? {} : V
6
+ type ExtractTransformArray<T> = T extends object
7
+ ? { [K in keyof T]: ExtractBreakpoints<T[K]> }
8
+ : never
6
9
 
7
- type ExtractBreakpoints<T> = T extends Partial<Record<BreakpointsOrMediaQueries, infer R>>
8
- ? WithEmptyObject<R>
9
- : {
10
- [K in keyof T]: T[K] extends object
11
- ? T[K] extends OpaqueColorValue
12
- ? ColorValue
13
- : ExtractBreakpoints<T[K]>
14
- : T[K]
15
- }
10
+ type ExtractBreakpoints<T> = T extends object
11
+ ? keyof T extends BreakpointsOrMediaQueries
12
+ ? T[keyof T]
13
+ : T extends Array<ToDeepUnistyles<TransformStyles>>
14
+ ? Array<ExtractTransformArray<T[number]>>
15
+ : {
16
+ [K in keyof T]: ExtractBreakpoints<T[K]>
17
+ }
18
+ : T
16
19
 
17
20
  type ParseNestedObject<T> = T extends (...args: infer A) => infer R
18
21
  ? (...args: A) => ParseNestedObject<R>
19
- : keyof T extends AllAvailableKeys
20
- ? ExtractBreakpoints<T>
21
- : T extends { variants: infer R }
22
+ : T extends object
23
+ ? T extends { variants: infer R }
22
24
  ? ParseVariants<FlattenVariants<R>> & ParseNestedObject<Omit<T, 'variants'>>
23
25
  : {
24
26
  [K in keyof T]: T[K] extends object
@@ -27,6 +29,7 @@ type ParseNestedObject<T> = T extends (...args: infer A) => infer R
27
29
  : ExtractBreakpoints<T[K]>
28
30
  : T[K]
29
31
  }
32
+ : T
30
33
 
31
34
  type FlattenVariants<T> = T extends object
32
35
  ? {
package/src/types/core.ts CHANGED
@@ -15,7 +15,6 @@ import type {
15
15
  } from 'react-native/Libraries/StyleSheet/StyleSheetTypes'
16
16
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
17
17
  import type { UnistylesBreakpoints, UnistylesThemes } from '../global'
18
- import type { MediaQuery } from './mq'
19
18
 
20
19
  export type ShadowOffset = {
21
20
  width: number,
@@ -44,7 +43,7 @@ export type ScreenSize = {
44
43
 
45
44
  export type RNStyle = ViewStyle | TextStyle | ImageStyle
46
45
  export type RNValue = number | string | undefined
47
- export type NestedStyle = Record<keyof UnistylesBreakpoints | MediaQuery, RNValue>
48
- export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | MediaQuery, RNValue]>
46
+ export type NestedStyle = Record<keyof UnistylesBreakpoints | symbol, RNValue>
47
+ export type NestedStylePairs = Array<[keyof UnistylesBreakpoints | symbol, RNValue]>
49
48
  export type UnistylesTheme = UnistylesThemes[keyof UnistylesThemes]
50
- export type CreateStylesFactory<ST> = (theme: UnistylesTheme) => ST
49
+ export type CreateStylesFactory<ST> = (theme: UnistylesTheme) => ST
@@ -1,7 +1,6 @@
1
1
  export * from './normalizer'
2
2
  export * from './unistyles'
3
3
  export type { Optional, Nullable } from './common'
4
- export type { MediaQuery } from './mq'
5
4
  export type {
6
5
  NestedStylePairs,
7
6
  UnistylesTheme,
@@ -1,7 +1,6 @@
1
1
  import type { ImageStyle, TextStyle, ViewStyle } from 'react-native'
2
2
  import type { ShadowOffset, TransformStyles, UnistylesTheme } from './core'
3
3
  import type { UnistylesBreakpoints } from '../global'
4
- import type { MediaQuery } from './mq'
5
4
 
6
5
  // these props are treated differently to nest breakpoints and media queries
7
6
  type NestedTypes = 'shadowOffset' | 'transform' | 'textShadowOffset'
@@ -19,18 +18,12 @@ type UnistyleNestedStyles = {
19
18
  type Variants = {
20
19
  variants?: {
21
20
  [variantName: string]: {
22
- [variant: string]: {
23
- [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
24
- [key in BreakpointsOrMediaQueries]?: AllAvailableStyles[propName]
25
- } & {
26
- [propName in NestedTypes]?: UnistyleNestedStyles[propName]
27
- }
28
- }
21
+ [variant: string]: Omit<UnistylesValues, 'variants'>
29
22
  }
30
23
  }
31
24
  }
32
25
 
33
- type ToDeepUnistyles<T> = {
26
+ export type ToDeepUnistyles<T> = {
34
27
  [K in keyof T]?: T[K] | {
35
28
  [key in BreakpointsOrMediaQueries]?: T[K]
36
29
  }
@@ -39,7 +32,7 @@ type ToDeepUnistyles<T> = {
39
32
  type AllAvailableStyles = UnistyleView & UnistyleText & UnistyleImage & UnistyleNestedStyles
40
33
 
41
34
  export type AllAvailableKeys = keyof (UnistyleView & UnistyleText & UnistyleImage)
42
- export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | MediaQuery
35
+ export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | symbol
43
36
 
44
37
  export type UnistylesValues = {
45
38
  [propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
@@ -1,4 +1,4 @@
1
- export { mq, MQSymbol, MQHeight, MQWidth, MQHeightAndWidth, MQWidthAndHeight } from './mq'
1
+ export { mq } from './mq'
2
2
  export { getKeyForUnistylesMediaQuery, isWithinTheWidthAndHeight, isValidMq, parseMq } from './mqParser'
3
3
  export { getValueForBreakpoint } from './breakpoints'
4
4
  export { proxifyFunction, parseStyle } from './styles'
package/src/utils/mq.ts CHANGED
@@ -2,43 +2,25 @@ import type { Nullable } from '../types'
2
2
  import type { UnistylesBreakpoints } from '../global'
3
3
  import { unistyles } from '../core'
4
4
 
5
- export const MQSymbol = Symbol('unistyles-mq')
6
- export const MQWidth = Symbol('unistyles-mq-width')
7
- export const MQHeight = Symbol('unistyles-mq-height')
8
- export const MQWidthAndHeight = Symbol('unistyles-mq-width-and-height')
9
- export const MQHeightAndWidth = Symbol('unistyles-mq-height-and-width')
10
-
11
5
  type MQValue = keyof UnistylesBreakpoints | number
12
6
 
13
7
  type MQHandler = {
14
8
  only: {
15
- width(wMin?: Nullable<MQValue>, wMax?: MQValue): typeof MQWidth,
16
- height(hMin?: Nullable<MQValue>, hMax?: MQValue): typeof MQHeight,
9
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol,
10
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol,
17
11
  },
18
12
  width(wMin?: Nullable<MQValue>, wMax?: MQValue): {
19
13
  and: {
20
- height(hMin?: Nullable<MQValue>, hMax?: MQValue): typeof MQWidthAndHeight
14
+ height(hMin?: Nullable<MQValue>, hMax?: MQValue): symbol
21
15
  }
22
16
  },
23
17
  height(hMin?: Nullable<MQValue>, hMax?: MQValue): {
24
18
  and: {
25
- width(wMin?: Nullable<MQValue>, wMax?: MQValue): typeof MQHeightAndWidth
19
+ width(wMin?: Nullable<MQValue>, wMax?: MQValue): symbol
26
20
  }
27
21
  }
28
22
  }
29
23
 
30
- type FinalHandler = {
31
- [MQSymbol]: true
32
- }
33
-
34
- enum MQProp {
35
- toString = 'toString',
36
- width = 'width',
37
- height = 'height',
38
- only = 'only',
39
- and = 'and'
40
- }
41
-
42
24
  const getMQValue = (value: Nullable<MQValue>) => {
43
25
  if (typeof value === 'number') {
44
26
  return value
@@ -51,71 +33,21 @@ const getMQValue = (value: Nullable<MQValue>) => {
51
33
  return unistyles.registry.breakpoints[value] ?? 0
52
34
  }
53
35
 
54
- const widthHandler = (hMin: Nullable<MQValue> = 0, hMax: MQValue = Infinity) => new Proxy({} as MQHandler, {
55
- get: (target, prop, receiver) => {
56
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
57
- return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
58
- }
59
-
60
- if (prop === MQProp.and) {
61
- return {
62
- width: (wMin: MQValue = 0, wMax: MQValue = Infinity) => new Proxy<FinalHandler>({} as FinalHandler, {
63
- get: (target, prop, receiver) => {
64
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
65
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
66
- }
67
-
68
- return Reflect.get(target, prop, receiver)
69
- }
70
- })
71
- }
72
- }
73
-
74
- return Reflect.get(target, prop, receiver)
75
- }
76
- })
77
-
78
- const heightHandler = (wMin: Nullable<MQValue> = 0, wMax: MQValue = Infinity) => new Proxy({} as MQHandler, {
79
- get: (target, prop, receiver) => {
80
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
81
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`
82
- }
83
-
84
- if (prop === MQProp.and) {
85
- return {
86
- height: (hMin: MQValue = 0, hMax: MQValue = Infinity) => new Proxy<FinalHandler>({} as FinalHandler, {
87
- get: (target, prop, receiver) => {
88
- if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
89
- return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`
90
- }
91
-
92
- return Reflect.get(target, prop, receiver)
93
- }
94
- })
95
- }
96
- }
97
-
98
- return Reflect.get(target, prop, receiver)
99
- }
100
- })
101
-
102
- export const mq = new Proxy<MQHandler>({} as MQHandler, {
103
- get: (target, prop, receiver) => {
104
- if (prop === MQProp.only) {
105
- return {
106
- width: heightHandler,
107
- height: widthHandler
108
- }
109
- }
110
-
111
- if (prop === MQProp.height) {
112
- return widthHandler
36
+ export const mq: MQHandler = {
37
+ only: {
38
+ width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Infinity) => (`:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]` as unknown as symbol),
39
+ height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Infinity) => (`:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol)
40
+ },
41
+ width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Infinity) => ({
42
+ and: {
43
+ height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Infinity) =>
44
+ (`:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol)
113
45
  }
114
-
115
- if (prop === MQProp.width) {
116
- return heightHandler
46
+ }),
47
+ height: (hMin: Nullable<MQValue> = 0, hMax: MQValue = Infinity) => ({
48
+ and: {
49
+ width: (wMin: Nullable<MQValue> = 0, wMax: MQValue = Infinity) =>
50
+ (`:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]` as unknown as symbol)
117
51
  }
118
-
119
- return Reflect.get(target, prop, receiver)
120
- }
121
- })
52
+ })
53
+ }
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- //# sourceMappingURL=mq.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mq.ts"],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mq.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mq.ts"],"mappings":""}
@@ -1,3 +0,0 @@
1
- import { MQSymbol, MQHeight, MQHeightAndWidth, MQWidth, MQWidthAndHeight } from '../utils';
2
- export type MediaQuery = typeof MQSymbol | typeof MQHeight | typeof MQWidth | typeof MQHeightAndWidth | typeof MQWidthAndHeight;
3
- //# sourceMappingURL=mq.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mq.d.ts","sourceRoot":"","sources":["../../../../src/types/mq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE1F,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,GAAG,OAAO,QAAQ,GAAG,OAAO,OAAO,GAAG,OAAO,gBAAgB,GAAG,OAAO,gBAAgB,CAAA"}
package/src/types/mq.ts DELETED
@@ -1,3 +0,0 @@
1
- import { MQSymbol, MQHeight, MQHeightAndWidth, MQWidth, MQWidthAndHeight } from '../utils'
2
-
3
- export type MediaQuery = typeof MQSymbol | typeof MQHeight | typeof MQWidth | typeof MQHeightAndWidth | typeof MQWidthAndHeight