react-native-unistyles 2.0.0-alpha.15 → 2.0.0-alpha.17
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/common.js +10 -9
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/core/UnistyleRegistry.js +17 -4
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/useStyles.js +1 -8
- package/lib/commonjs/useStyles.js.map +1 -1
- 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/common.js +10 -9
- package/lib/module/common.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +17 -4
- package/lib/module/core/UnistyleRegistry.js.map +1 -1
- package/lib/module/useStyles.js +1 -8
- package/lib/module/useStyles.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/common.d.ts +10 -9
- package/lib/typescript/src/common.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +39 -3
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +48 -3
- package/lib/typescript/src/index.d.ts.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/useStyles.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/common.ts +10 -9
- package/src/core/UnistyleRegistry.ts +19 -4
- 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/useStyles.ts +4 -14
- 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
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;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,MAAKZ,UAAU,CAACO,IAAI,CAAE,KAAIP,UAAU,CAACW,IAAI,CAAE,GAAE;IAAA,CAAsB;IACvIE,MAAM,EAAE,SAAAA,CAAA;MAAA,IAACC,IAAuB,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;MAAA,IAAEO,IAAa,GAAAP,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;MAAA,OAAO,MAAKZ,UAAU,CAACc,IAAI,CAAE,KAAId,UAAU,CAACe,IAAI,CAAE,GAAE;IAAA;EACtH,CAAC;EACDT,KAAK,EAAE,SAAAA,CAAA;IAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAA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,15 @@ export declare enum UnistylesEventType {
|
|
14
14
|
Plugin = "plugin"
|
15
15
|
}
|
16
16
|
export declare enum UnistylesError {
|
17
|
-
RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions
|
18
|
-
ThemeNotFound = "You are trying to get a theme that is not registered
|
19
|
-
ThemeNotRegistered = "You are trying to set a theme that
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
17
|
+
RuntimeUnavailable = "Unistyles runtime is not available. Make sure you followed the installation instructions",
|
18
|
+
ThemeNotFound = "You are trying to get a theme that is not registered with UnistylesRegistry",
|
19
|
+
ThemeNotRegistered = "You are trying to set a theme that was not registered with UnistylesRegistry",
|
20
|
+
ThemeNotSelected = "Your themes are registered, but you didn't select the initial theme",
|
21
|
+
ThemesCannotBeEmpty = "You are trying to register empty themes object",
|
22
|
+
BreakpointsCannotBeEmpty = "You are trying to register empty breakpoints object",
|
23
|
+
BreakpointsMustStartFromZero = "You are trying to register breakpoints that don't start from 0",
|
24
|
+
InvalidPluginName = "Plugin name can't start from reserved prefix __unistyles",
|
25
|
+
DuplicatePluginName = "You are trying to register a plugin with a name that is already registered",
|
26
|
+
CantRemoveInternalPlugin = "You are trying to remove an internal unistyles plugin"
|
26
27
|
}
|
27
28
|
//# sourceMappingURL=common.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,QAAQ,SAAqD,CAAA;AAC1E,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAa,MAAM,SAEnC,CAAA;AAED,eAAO,MAAM,QAAQ,SAAqD,CAAA;AAC1E,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAgC,CAAA;AAErD,eAAO,MAAM,iBAAiB;;;CAGpB,CAAA;AAEV,oBAAY,kBAAkB;IAC1B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,6FAA6F;IAC/G,aAAa,gFAAgF;IAC7F,kBAAkB,iFAAiF;IACnG,gBAAgB,wEAAyE;IACzF,mBAAmB,mDAAmD;IACtE,wBAAwB,wDAAwD;IAChF,4BAA4B,mEAAoE;IAChG,iBAAiB,6DAA8D;IAC/E,mBAAmB,+EAA+E;IAClG,wBAAwB,0DAA0D;CACrF"}
|
@@ -9,9 +9,45 @@ export declare class UnistyleRegistry {
|
|
9
9
|
breakpoints: UnistylesBreakpoints;
|
10
10
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
11
11
|
constructor(unistylesBridge: UnistylesBridge);
|
12
|
-
addThemes: (themes: UnistylesThemes) =>
|
13
|
-
|
14
|
-
|
12
|
+
addThemes: (themes: UnistylesThemes) => {
|
13
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
14
|
+
addThemes: any;
|
15
|
+
addConfig: (config: UnistylesConfig) => {
|
16
|
+
addBreakpoints: any;
|
17
|
+
addThemes: any;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
addConfig: (config: UnistylesConfig) => {
|
21
|
+
addBreakpoints: any;
|
22
|
+
addThemes: any;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
26
|
+
addThemes: (themes: UnistylesThemes) => {
|
27
|
+
addBreakpoints: any;
|
28
|
+
addConfig: (config: UnistylesConfig) => {
|
29
|
+
addBreakpoints: any;
|
30
|
+
addThemes: any;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
addConfig: (config: UnistylesConfig) => {
|
34
|
+
addBreakpoints: any;
|
35
|
+
addThemes: any;
|
36
|
+
};
|
37
|
+
};
|
38
|
+
addConfig: (config: UnistylesConfig) => {
|
39
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
40
|
+
addThemes: (themes: UnistylesThemes) => {
|
41
|
+
addBreakpoints: any;
|
42
|
+
addConfig: any;
|
43
|
+
};
|
44
|
+
addConfig: any;
|
45
|
+
};
|
46
|
+
addThemes: (themes: UnistylesThemes) => {
|
47
|
+
addBreakpoints: any;
|
48
|
+
addConfig: any;
|
49
|
+
};
|
50
|
+
};
|
15
51
|
getTheme: (forName: keyof UnistylesThemes) => never;
|
16
52
|
addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
|
17
53
|
removePlugin: (plugin: UnistylesPlugin) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAItE,qBAAa,gBAAgB;IAUb,OAAO,CAAC,eAAe;IAT5B,MAAM,EAAE,eAAe,CAAK;IAC5B,OAAO,EAAE,KAAK,CAAC,eAAe,CAAC,CAE9B;IACD,UAAU,EAAE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UAW3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
|
@@ -6,9 +6,54 @@ import { ScreenOrientation } from './common';
|
|
6
6
|
import { useStyles } from './useStyles';
|
7
7
|
import { createStyleSheet } from './createStyleSheet';
|
8
8
|
declare const UnistylesRegistry: {
|
9
|
-
addThemes: (themes: UnistylesThemes) =>
|
10
|
-
|
11
|
-
|
9
|
+
addThemes: (themes: UnistylesThemes) => {
|
10
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
11
|
+
addThemes: any;
|
12
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
13
|
+
addBreakpoints: any;
|
14
|
+
addThemes: any;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
18
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
19
|
+
addThemes: any;
|
20
|
+
addConfig: any;
|
21
|
+
};
|
22
|
+
addThemes: any;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
26
|
+
addThemes: (themes: UnistylesThemes) => {
|
27
|
+
addBreakpoints: any;
|
28
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
29
|
+
addBreakpoints: any;
|
30
|
+
addThemes: any;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
34
|
+
addBreakpoints: any;
|
35
|
+
addThemes: (themes: UnistylesThemes) => {
|
36
|
+
addBreakpoints: any;
|
37
|
+
addConfig: any;
|
38
|
+
};
|
39
|
+
};
|
40
|
+
};
|
41
|
+
addConfig: (config: import("./types").UnistylesConfig) => {
|
42
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
43
|
+
addThemes: (themes: UnistylesThemes) => {
|
44
|
+
addBreakpoints: any;
|
45
|
+
addConfig: any;
|
46
|
+
};
|
47
|
+
addConfig: any;
|
48
|
+
};
|
49
|
+
addThemes: (themes: UnistylesThemes) => {
|
50
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => {
|
51
|
+
addThemes: any;
|
52
|
+
addConfig: any;
|
53
|
+
};
|
54
|
+
addConfig: any;
|
55
|
+
};
|
56
|
+
};
|
12
57
|
};
|
13
58
|
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
14
59
|
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAErD,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAItB,CAAA;AAED,QAAA,MAAM,gBAAgB,mCAAoB,CAAA;AAE1C,OAAO,EACH,EAAE,EACF,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACnB,CAAA;AAED,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,eAAe,EAClB,CAAA"}
|
@@ -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,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAC5C,KAAK,CAAA;AAEX,KAAK,kBAAkB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACvC,MAAM,CAAC,SAAS,yBAAyB,GACrC,CAAC,CAAC,MAAM,CAAC,CAAC,GACV,CAAC,SAAS,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,GAC7C,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GACvC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3C,GACP,CAAC,CAAA;AAEP,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,S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AAC,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,EAAE,MAAM,QAAQ,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGrD,KAAK,WAAW,GAAG,cAAc,GAAG,WAAW,GAAG,kBAAkB,CAAA;AAEpE,KAAK,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAChD,KAAK,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAChD,KAAK,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAA;AAElD,KAAK,oBAAoB,GAAG;IACxB,YAAY,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IACjD,SAAS,CAAC,EAAE,KAAK,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAA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3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EACR,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACjB,MAAM,SAAS,CAAA;AAEhB,KAAK,gBAAgB,CAAC,EAAE,SAAS,yBAAyB,IAAI;IAC1D,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,
|
1
|
+
{"version":3,"file":"useStyles.d.ts","sourceRoot":"","sources":["../../../src/useStyles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEpD,OAAO,KAAK,EACR,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACjB,MAAM,SAAS,CAAA;AAEhB,KAAK,gBAAgB,CAAC,EAAE,SAAS,yBAAyB,IAAI;IAC1D,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,oBAAoB,CAAC;IACvC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,gJAsCrB,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.17",
|
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/common.ts
CHANGED
@@ -22,13 +22,14 @@ export enum UnistylesEventType {
|
|
22
22
|
}
|
23
23
|
|
24
24
|
export enum UnistylesError {
|
25
|
-
RuntimeUnavailable = 'Unistyles runtime is not available. Make sure you followed the installation instructions
|
26
|
-
ThemeNotFound = 'You are trying to get a theme that is not registered
|
27
|
-
ThemeNotRegistered = 'You are trying to set a theme that
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
RuntimeUnavailable = 'Unistyles runtime is not available. Make sure you followed the installation instructions',
|
26
|
+
ThemeNotFound = 'You are trying to get a theme that is not registered with UnistylesRegistry',
|
27
|
+
ThemeNotRegistered = 'You are trying to set a theme that was not registered with UnistylesRegistry',
|
28
|
+
ThemeNotSelected = 'Your themes are registered, but you didn\'t select the initial theme',
|
29
|
+
ThemesCannotBeEmpty = 'You are trying to register empty themes object',
|
30
|
+
BreakpointsCannotBeEmpty = 'You are trying to register empty breakpoints object',
|
31
|
+
BreakpointsMustStartFromZero = 'You are trying to register breakpoints that don\'t start from 0',
|
32
|
+
InvalidPluginName = 'Plugin name can\'t start from reserved prefix __unistyles',
|
33
|
+
DuplicatePluginName = 'You are trying to register a plugin with a name that is already registered',
|
34
|
+
CantRemoveInternalPlugin = 'You are trying to remove an internal unistyles plugin'
|
34
35
|
}
|
@@ -23,7 +23,10 @@ export class UnistyleRegistry {
|
|
23
23
|
this.unistylesBridge.themes = keys
|
24
24
|
this.themeNames = keys
|
25
25
|
|
26
|
-
return
|
26
|
+
return {
|
27
|
+
addBreakpoints: this.addBreakpoints,
|
28
|
+
addConfig: this.addConfig
|
29
|
+
}
|
27
30
|
}
|
28
31
|
|
29
32
|
public addBreakpoints = (breakpoints: UnistylesBreakpoints) => {
|
@@ -31,7 +34,10 @@ export class UnistyleRegistry {
|
|
31
34
|
this.unistylesBridge.useBreakpoints(breakpoints)
|
32
35
|
this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs
|
33
36
|
|
34
|
-
return
|
37
|
+
return {
|
38
|
+
addThemes: this.addThemes,
|
39
|
+
addConfig: this.addConfig
|
40
|
+
}
|
35
41
|
}
|
36
42
|
|
37
43
|
public addConfig = (config: UnistylesConfig) => {
|
@@ -48,6 +54,11 @@ export class UnistyleRegistry {
|
|
48
54
|
if (config.initialTheme) {
|
49
55
|
this.unistylesBridge.useTheme(config.initialTheme)
|
50
56
|
}
|
57
|
+
|
58
|
+
return {
|
59
|
+
addBreakpoints: this.addBreakpoints,
|
60
|
+
addThemes: this.addThemes
|
61
|
+
}
|
51
62
|
}
|
52
63
|
|
53
64
|
public getTheme = (forName: keyof UnistylesThemes) => {
|
@@ -55,11 +66,15 @@ export class UnistyleRegistry {
|
|
55
66
|
return {} as UnistylesThemes[keyof UnistylesThemes]
|
56
67
|
}
|
57
68
|
|
58
|
-
if (
|
69
|
+
if (this.hasTheme(forName)) {
|
70
|
+
return this.themes[forName]
|
71
|
+
}
|
72
|
+
|
73
|
+
if (this.unistylesBridge.themeName) {
|
59
74
|
throw new Error(UnistylesError.ThemeNotFound)
|
60
75
|
}
|
61
76
|
|
62
|
-
|
77
|
+
throw new Error(UnistylesError.ThemeNotSelected)
|
63
78
|
}
|
64
79
|
|
65
80
|
public addPlugin = (plugin: UnistylesPlugin, notify: boolean = true) => {
|