react-native-unistyles 2.0.0-alpha.15 → 2.0.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/utils/index.js +0 -30
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +37 -83
- package/lib/commonjs/utils/mq.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +36 -82
- package/lib/module/utils/mq.js.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +10 -7
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +2 -3
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +0 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts +3 -10
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +4 -9
- package/lib/typescript/src/utils/mq.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/types/breakpoints.ts +17 -14
- package/src/types/core.ts +3 -4
- package/src/types/index.ts +0 -1
- package/src/types/stylesheet.ts +3 -10
- package/src/utils/index.ts +1 -1
- package/src/utils/mq.ts +20 -88
- package/lib/commonjs/types/mq.js +0 -6
- package/lib/commonjs/types/mq.js.map +0 -1
- package/lib/module/types/mq.js +0 -2
- package/lib/module/types/mq.js.map +0 -1
- package/lib/typescript/src/types/mq.d.ts +0 -3
- package/lib/typescript/src/types/mq.d.ts.map +0 -1
- 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":"
|
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"}
|
package/lib/commonjs/utils/mq.js
CHANGED
@@ -3,21 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.mq =
|
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
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
-
|
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","
|
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,GAA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I,CAAE,OAAMb,UAAU,CAACgB,IAAI,CAAE,KAAIhB,UAAU,CAACiB,IAAI,CAAE,GAAE;QAAA;MACnG;IACJ,CAAC;EAAA,CAAC;EACFF,MAAM,EAAE,SAAAA,CAAA;IAAA,IAACC,IAAuB,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEO,IAAa,GAAAP,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,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
|
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","
|
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"}
|
package/lib/module/utils/mq.js
CHANGED
@@ -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
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
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","
|
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;EAE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,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;UAAA,OACxD,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,CAAC;EACFF,MAAM,EAAE,SAAAA,CAAA;IAAA,IAACC,IAAuB,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IAAEO,IAAa,GAAAP,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 {
|
4
|
-
type
|
5
|
-
type
|
6
|
-
[K in keyof T]:
|
7
|
-
};
|
8
|
-
type
|
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,
|
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,yBAAyB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAE7C,KAAK,qBAAqB,CA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,CAAC,SAAS,MAAM,GAC7B;SACG,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,GACvC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAC5B,KAAK;KACd,GACC,KAAK;CACd,GACC,KAAK,CAAA;AAEX,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAClC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,MAAM,GACrB,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACzB,CAAC,GACL,CAAC,CAAA;AAEP,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACnC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC3C,KAAK,CAAA;AAEX,MAAM,MAAM,qBAAqB,CAAC,CAAC,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 |
|
17
|
-
export type NestedStylePairs = Array<[keyof UnistylesBreakpoints |
|
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,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;
|
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,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,
|
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 |
|
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,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;
|
1
|
+
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../src/types/stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc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AAG;KACzB,QAAQ,IAAI,gBAAgB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG;SAC3D,GAAG,IAAI,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,CAAC,QAAQ,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
|
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,
|
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):
|
12
|
-
height(hMin?: Nullable<MQValue>, hMax?: MQValue):
|
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):
|
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):
|
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,
|
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,KAAK,OAAO,GAAG,MAAM,oBAAoB,GAAG,MAAM,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.
|
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.
|
85
|
+
"typescript": "5.3.2"
|
86
86
|
},
|
87
87
|
"peerDependencies": {
|
88
88
|
"@react-native/normalize-colors": "*",
|
package/src/types/breakpoints.ts
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
import type { ColorValue, OpaqueColorValue } from 'react-native'
|
2
2
|
import type { UnistylesTheme } from '../types'
|
3
|
-
import type {
|
3
|
+
import type { BreakpointsOrMediaQueries, ToDeepUnistyles } from './stylesheet'
|
4
|
+
import type { TransformStyles } from './core'
|
4
5
|
|
5
|
-
type
|
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
|
8
|
-
?
|
9
|
-
|
10
|
-
|
11
|
-
? T[
|
12
|
-
|
13
|
-
: ExtractBreakpoints<T[K]>
|
14
|
-
|
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
|
-
:
|
20
|
-
?
|
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 |
|
48
|
-
export type NestedStylePairs = Array<[keyof UnistylesBreakpoints |
|
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
|
package/src/types/index.ts
CHANGED
package/src/types/stylesheet.ts
CHANGED
@@ -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 |
|
35
|
+
export type BreakpointsOrMediaQueries = keyof UnistylesBreakpoints | symbol
|
43
36
|
|
44
37
|
export type UnistylesValues = {
|
45
38
|
[propName in AllAvailableKeys]?: AllAvailableStyles[propName] | {
|
package/src/utils/index.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { 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):
|
16
|
-
height(hMin?: Nullable<MQValue>, hMax?: MQValue):
|
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):
|
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):
|
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
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
116
|
-
|
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
|
-
|
120
|
-
}
|
121
|
-
})
|
52
|
+
})
|
53
|
+
}
|
package/lib/commonjs/types/mq.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mq.ts"],"mappings":""}
|
package/lib/module/types/mq.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/mq.ts"],"mappings":""}
|
@@ -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