react-native-unistyles 2.0.0-alpha.1 → 2.0.0-alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -4
- package/cxx/UnistylesRuntime.cpp +255 -0
- package/cxx/UnistylesRuntime.h +60 -0
- package/ios/UnistylesHelpers.h +4 -0
- package/ios/UnistylesHelpers.mm +20 -0
- package/ios/UnistylesModule.h +10 -0
- package/ios/UnistylesModule.mm +158 -0
- package/lib/commonjs/common.js +26 -0
- package/lib/commonjs/common.js.map +1 -0
- package/lib/commonjs/core/UnistyleRegistry.js +38 -0
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -0
- package/lib/commonjs/core/Unistyles.js +31 -0
- package/lib/commonjs/core/Unistyles.js.map +1 -0
- package/lib/commonjs/core/UnistylesModule.js +9 -0
- package/lib/commonjs/core/UnistylesModule.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +66 -0
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -0
- package/lib/commonjs/core/index.js +13 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/createStyleSheet.js +14 -0
- package/lib/commonjs/createStyleSheet.js.map +1 -0
- package/lib/commonjs/global.js +2 -0
- package/lib/commonjs/global.js.map +1 -0
- package/lib/commonjs/hooks/index.js +10 -3
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useInitialTheme.js +17 -0
- package/lib/commonjs/hooks/useInitialTheme.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +54 -0
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -0
- package/lib/commonjs/index.js +35 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types/common.js +2 -0
- package/lib/commonjs/types/{mediaQueries.js.map → common.js.map} +1 -1
- package/lib/commonjs/types/index.js +26 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/mq.js +6 -0
- package/lib/{module/types/mediaQueries.js.map → commonjs/types/mq.js.map} +1 -1
- package/lib/commonjs/types/normalizer.js +6 -0
- package/lib/commonjs/types/normalizer.js.map +1 -0
- package/lib/commonjs/types/unistyles.js +6 -0
- package/lib/commonjs/types/unistyles.js.map +1 -0
- package/lib/commonjs/useStyles.js +49 -0
- package/lib/commonjs/useStyles.js.map +1 -0
- package/lib/commonjs/utils/breakpoints.js +44 -82
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/common.js +10 -3
- package/lib/commonjs/utils/common.js.map +1 -1
- package/lib/commonjs/utils/index.js +46 -17
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/module.d.js +2 -0
- package/lib/commonjs/utils/module.d.js.map +1 -0
- package/lib/commonjs/utils/mq.js +89 -0
- package/lib/commonjs/utils/mq.js.map +1 -0
- package/lib/commonjs/utils/mqParser.js +86 -0
- package/lib/commonjs/utils/mqParser.js.map +1 -0
- package/lib/commonjs/utils/normalizeStyles.web.js +13 -13
- package/lib/commonjs/utils/normalizeStyles.web.js.map +1 -1
- package/lib/commonjs/utils/normalizer.js +89 -0
- package/lib/commonjs/utils/normalizer.js.map +1 -0
- package/lib/commonjs/utils/styles.js +17 -57
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/variants.js +20 -0
- package/lib/commonjs/utils/variants.js.map +1 -0
- package/lib/module/common.js +22 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/core/UnistyleRegistry.js +31 -0
- package/lib/module/core/UnistyleRegistry.js.map +1 -0
- package/lib/module/core/Unistyles.js +25 -0
- package/lib/module/core/Unistyles.js.map +1 -0
- package/lib/module/core/UnistylesModule.js +3 -0
- package/lib/module/core/UnistylesModule.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +59 -0
- package/lib/module/core/UnistylesRuntime.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/createStyleSheet.js +7 -0
- package/lib/module/createStyleSheet.js.map +1 -0
- package/lib/module/global.js +2 -0
- package/lib/module/global.js.map +1 -0
- package/lib/module/hooks/index.js +2 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useInitialTheme.js +10 -0
- package/lib/module/hooks/useInitialTheme.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +47 -0
- package/lib/module/hooks/useUnistyles.js.map +1 -0
- package/lib/module/index.js +13 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/common.js.map +1 -0
- package/lib/module/types/index.js +2 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/mq.js +2 -0
- package/lib/module/types/mq.js.map +1 -0
- package/lib/module/types/normalizer.js +2 -0
- package/lib/module/types/normalizer.js.map +1 -0
- package/lib/module/types/unistyles.js +2 -0
- package/lib/module/types/unistyles.js.map +1 -0
- package/lib/module/useStyles.js +42 -0
- package/lib/module/useStyles.js.map +1 -0
- package/lib/module/utils/breakpoints.js +43 -82
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/common.js +9 -1
- package/lib/module/utils/common.js.map +1 -1
- package/lib/module/utils/index.js +6 -2
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/module.d.js +2 -0
- package/lib/module/utils/module.d.js.map +1 -0
- package/lib/module/utils/mq.js +83 -0
- package/lib/module/utils/mq.js.map +1 -0
- package/lib/module/utils/mqParser.js +79 -0
- package/lib/module/utils/mqParser.js.map +1 -0
- package/lib/module/utils/normalizeStyles.web.js +13 -13
- package/lib/module/utils/normalizeStyles.web.js.map +1 -1
- package/lib/module/utils/normalizer.js +79 -0
- package/lib/module/utils/normalizer.js.map +1 -0
- package/lib/module/utils/styles.js +17 -59
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/variants.js +13 -0
- package/lib/module/utils/variants.js.map +1 -0
- package/lib/typescript/src/common.d.ts +17 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +15 -0
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -0
- package/lib/typescript/src/core/Unistyles.d.ts +13 -0
- package/lib/typescript/src/core/Unistyles.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts +6 -0
- package/lib/typescript/src/core/UnistylesModule.d.ts.map +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +24 -0
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +2 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/createStyleSheet.d.ts +3 -0
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -0
- package/lib/typescript/src/global.d.ts +7 -0
- package/lib/typescript/src/global.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +2 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useInitialTheme.d.ts +3 -0
- package/lib/typescript/src/hooks/useInitialTheme.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts +12 -0
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/breakpoints.d.ts +13 -13
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +3 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/lib/typescript/src/types/core.d.ts +34 -18
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +6 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/mq.d.ts +3 -0
- package/lib/typescript/src/types/mq.d.ts.map +1 -0
- package/lib/typescript/src/types/normalizer.d.ts +20 -0
- package/lib/typescript/src/types/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +37 -0
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +10 -0
- package/lib/typescript/src/useStyles.d.ts.map +1 -0
- package/lib/typescript/src/utils/breakpoints.d.ts +5 -62
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/common.d.ts +9 -1
- package/lib/typescript/src/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +6 -2
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +21 -0
- package/lib/typescript/src/utils/mq.d.ts.map +1 -0
- package/lib/typescript/src/utils/mqParser.d.ts +3 -0
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -0
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +4 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +1 -1
- package/lib/typescript/src/utils/normalizer.d.ts +11 -0
- package/lib/typescript/src/utils/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/styles.d.ts +5 -49
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/variants.d.ts +3 -0
- package/lib/typescript/src/utils/variants.d.ts.map +1 -0
- package/package.json +33 -15
- package/react-native-unistyles.podspec +22 -0
- package/src/common.ts +19 -0
- package/src/core/UnistyleRegistry.ts +41 -0
- package/src/core/Unistyles.ts +34 -0
- package/src/core/UnistylesModule.ts +7 -0
- package/src/core/UnistylesRuntime.ts +73 -0
- package/src/core/index.ts +1 -0
- package/src/createStyleSheet.ts +9 -0
- package/src/global.ts +5 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useInitialTheme.ts +11 -0
- package/src/hooks/useUnistyles.ts +55 -0
- package/src/index.ts +30 -2
- package/src/types/breakpoints.ts +20 -20
- package/src/types/common.ts +2 -0
- package/src/types/core.ts +42 -24
- package/src/types/index.ts +6 -9
- package/src/types/mq.ts +3 -0
- package/src/types/normalizer.ts +29 -0
- package/src/types/unistyles.ts +45 -0
- package/src/useStyles.ts +56 -0
- package/src/utils/breakpoints.ts +57 -88
- package/src/utils/common.ts +10 -1
- package/src/utils/index.ts +6 -9
- package/src/utils/module.d.ts +3 -0
- package/src/utils/mq.ts +106 -0
- package/src/utils/mqParser.ts +99 -0
- package/src/utils/normalizeStyles.web.ts +21 -42
- package/src/utils/normalizer.ts +99 -0
- package/src/utils/styles.ts +29 -68
- package/src/utils/variants.ts +17 -0
- package/lib/commonjs/UnistylesTheme.js +0 -21
- package/lib/commonjs/UnistylesTheme.js.map +0 -1
- package/lib/commonjs/createUnistyles.js +0 -57
- package/lib/commonjs/createUnistyles.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.js +0 -10
- package/lib/commonjs/hooks/useDimensions.js.map +0 -1
- package/lib/commonjs/hooks/useDimensions.web.js +0 -31
- package/lib/commonjs/hooks/useDimensions.web.js.map +0 -1
- package/lib/commonjs/types/mediaQueries.js +0 -2
- package/lib/commonjs/utils/mediaQueries.js +0 -189
- package/lib/commonjs/utils/mediaQueries.js.map +0 -1
- package/lib/module/UnistylesTheme.js +0 -12
- package/lib/module/UnistylesTheme.js.map +0 -1
- package/lib/module/createUnistyles.js +0 -50
- package/lib/module/createUnistyles.js.map +0 -1
- package/lib/module/hooks/useDimensions.js +0 -3
- package/lib/module/hooks/useDimensions.js.map +0 -1
- package/lib/module/hooks/useDimensions.web.js +0 -24
- package/lib/module/hooks/useDimensions.web.js.map +0 -1
- package/lib/module/types/mediaQueries.js +0 -2
- package/lib/module/utils/mediaQueries.js +0 -176
- package/lib/module/utils/mediaQueries.js.map +0 -1
- package/lib/typescript/src/UnistylesTheme.d.ts +0 -9
- package/lib/typescript/src/UnistylesTheme.d.ts.map +0 -1
- package/lib/typescript/src/createUnistyles.d.ts +0 -10
- package/lib/typescript/src/createUnistyles.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useDimensions.web.d.ts +0 -3
- package/lib/typescript/src/hooks/useDimensions.web.d.ts.map +0 -1
- package/lib/typescript/src/types/mediaQueries.d.ts +0 -8
- package/lib/typescript/src/types/mediaQueries.d.ts.map +0 -1
- package/lib/typescript/src/utils/mediaQueries.d.ts +0 -130
- package/lib/typescript/src/utils/mediaQueries.d.ts.map +0 -1
- package/src/UnistylesTheme.tsx +0 -17
- package/src/__tests__/createUnistyles.spec.tsx +0 -192
- package/src/createUnistyles.ts +0 -70
- package/src/hooks/useDimensions.ts +0 -4
- package/src/hooks/useDimensions.web.ts +0 -30
- package/src/types/mediaQueries.ts +0 -10
- package/src/utils/mediaQueries.ts +0 -201
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/module.d.ts"],"mappings":""}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { unistyles } from '../core';
|
2
|
+
export const MQSymbol = Symbol('unistyles-mq');
|
3
|
+
var MQProp = /*#__PURE__*/function (MQProp) {
|
4
|
+
MQProp["toString"] = "toString";
|
5
|
+
MQProp["width"] = "width";
|
6
|
+
MQProp["height"] = "height";
|
7
|
+
MQProp["shortW"] = "w";
|
8
|
+
MQProp["shortH"] = "h";
|
9
|
+
return MQProp;
|
10
|
+
}(MQProp || {});
|
11
|
+
const getMQValue = value => {
|
12
|
+
if (typeof value === 'number') {
|
13
|
+
return value;
|
14
|
+
}
|
15
|
+
if (value === null) {
|
16
|
+
return 0;
|
17
|
+
}
|
18
|
+
return unistyles.registry.breakpoints[value] ?? 0;
|
19
|
+
};
|
20
|
+
const widthHandler = function () {
|
21
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
22
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
23
|
+
return new Proxy({}, {
|
24
|
+
get: (target, prop, receiver) => {
|
25
|
+
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
26
|
+
return () => `:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
27
|
+
}
|
28
|
+
if (prop === MQProp.width || prop === MQProp.shortW) {
|
29
|
+
return function () {
|
30
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
31
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
32
|
+
return new Proxy({}, {
|
33
|
+
get: (target, prop, receiver) => {
|
34
|
+
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
35
|
+
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
36
|
+
}
|
37
|
+
return Reflect.get(target, prop, receiver);
|
38
|
+
}
|
39
|
+
});
|
40
|
+
};
|
41
|
+
}
|
42
|
+
return Reflect.get(target, prop, receiver);
|
43
|
+
}
|
44
|
+
});
|
45
|
+
};
|
46
|
+
const heightHandler = function () {
|
47
|
+
let wMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
48
|
+
let wMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
49
|
+
return new Proxy({}, {
|
50
|
+
get: (target, prop, receiver) => {
|
51
|
+
if (prop === Symbol.toPrimitive || prop === MQProp.toString) {
|
52
|
+
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]`;
|
53
|
+
}
|
54
|
+
if (prop === MQProp.height || prop === MQProp.shortH) {
|
55
|
+
return function () {
|
56
|
+
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
57
|
+
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
58
|
+
return new Proxy({}, {
|
59
|
+
get: (target, prop, receiver) => {
|
60
|
+
if (prop === Symbol.toPrimitive || MQProp.toString) {
|
61
|
+
return () => `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
62
|
+
}
|
63
|
+
return Reflect.get(target, prop, receiver);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
};
|
67
|
+
}
|
68
|
+
return Reflect.get(target, prop, receiver);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
};
|
72
|
+
export const mq = new Proxy({}, {
|
73
|
+
get: (target, prop, receiver) => {
|
74
|
+
if (prop === MQProp.shortW || prop === MQProp.width) {
|
75
|
+
return heightHandler;
|
76
|
+
}
|
77
|
+
if (prop === MQProp.shortH || prop === MQProp.height) {
|
78
|
+
return widthHandler;
|
79
|
+
}
|
80
|
+
return Reflect.get(target, prop, receiver);
|
81
|
+
}
|
82
|
+
});
|
83
|
+
//# sourceMappingURL=mq.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["unistyles","MQSymbol","Symbol","MQProp","getMQValue","value","registry","breakpoints","widthHandler","hMin","arguments","length","undefined","hMax","Infinity","Proxy","get","target","prop","receiver","toPrimitive","toString","width","shortW","wMin","wMax","Reflect","heightHandler","height","shortH","mq"],"sourceRoot":"../../../src","sources":["utils/mq.ts"],"mappings":"AAEA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,QAAQ,GAAGC,MAAM,CAAC,cAAc,CAAC;AAAA,IAyBzCC,MAAM,0BAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAANA,MAAM;EAAA,OAANA,MAAM;AAAA,EAANA,MAAM;AAQX,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,OAAOL,SAAS,CAACM,QAAQ,CAACC,WAAW,CAACF,KAAK,CAAC,IAAI,CAAC;AACrD,CAAC;AAED,MAAMG,YAAY,GAAG,SAAAA,CAAA;EAAA,IAACC,IAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAA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U,CAACqB,IAAI,CAAE,OAAMrB,UAAU,CAACK,IAAI,CAAE,KAAIL,UAAU,CAACS,IAAI,CAAE,GAAE;cAC3G;cAEA,OAAOa,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;YAC9C;UACJ,CAAC,CAAC;QAAA;MACN;MAEA,OAAOO,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;IAC9C;EACJ,CAAC,CAAC;AAAA;AAEF,OAAO,MAAMW,EAAE,GAAG,IAAIf,KAAK,CAAC,CAAC,CAAC,EAAe;EACzCC,GAAG,EAAEA,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,KAAK;IAC7B,IAAID,IAAI,KAAKf,MAAM,CAACoB,MAAM,IAAIL,IAAI,KAAKf,MAAM,CAACmB,KAAK,EAAE;MACjD,OAAOK,aAAa;IACxB;IAEA,IAAIT,IAAI,KAAKf,MAAM,CAAC0B,MAAM,IAAIX,IAAI,KAAKf,MAAM,CAACyB,MAAM,EAAE;MAClD,OAAOpB,YAAY;IACvB;IAEA,OAAOkB,OAAO,CAACV,GAAG,CAACC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,CAAC;EAC9C;AACJ,CAAC,CAAC"}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
2
|
+
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
3
|
+
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
4
|
+
const parseMq = mq => {
|
5
|
+
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
6
|
+
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
7
|
+
return {
|
8
|
+
width: width ? {
|
9
|
+
from: Number(fromW),
|
10
|
+
to: Number(toW)
|
11
|
+
} : undefined,
|
12
|
+
height: height ? {
|
13
|
+
from: Number(fromH),
|
14
|
+
to: Number(toH)
|
15
|
+
} : undefined
|
16
|
+
};
|
17
|
+
};
|
18
|
+
const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
19
|
+
const isValidMq = parsedMq => {
|
20
|
+
const {
|
21
|
+
width,
|
22
|
+
height
|
23
|
+
} = parsedMq;
|
24
|
+
if (width && height) {
|
25
|
+
return width.from <= width.to && height.from <= height.to;
|
26
|
+
}
|
27
|
+
if (width) {
|
28
|
+
return width.from <= width.to;
|
29
|
+
}
|
30
|
+
if (height) {
|
31
|
+
return height.from <= height.to;
|
32
|
+
}
|
33
|
+
return false;
|
34
|
+
};
|
35
|
+
const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
|
36
|
+
const {
|
37
|
+
width,
|
38
|
+
height
|
39
|
+
} = parsedMq;
|
40
|
+
if (width && height) {
|
41
|
+
return isWithinTheWidth(width, screenSize.width) && isWithinTheHeight(height, screenSize.height);
|
42
|
+
}
|
43
|
+
if (width) {
|
44
|
+
return isWithinTheWidth(width, screenSize.width);
|
45
|
+
}
|
46
|
+
if (height) {
|
47
|
+
return isWithinTheHeight(height, screenSize.height);
|
48
|
+
}
|
49
|
+
return false;
|
50
|
+
};
|
51
|
+
const isWithinTheWidth = (width, screenWidth) => {
|
52
|
+
const {
|
53
|
+
from,
|
54
|
+
to
|
55
|
+
} = width;
|
56
|
+
return screenWidth >= from && screenWidth <= to;
|
57
|
+
};
|
58
|
+
const isWithinTheHeight = (height, screenHeight) => {
|
59
|
+
const {
|
60
|
+
from,
|
61
|
+
to
|
62
|
+
} = height;
|
63
|
+
return screenHeight >= from && screenHeight <= to;
|
64
|
+
};
|
65
|
+
export const getKeyForUnistylesMediaQuery = (mediaQueries, screenSize) => {
|
66
|
+
const mq = mediaQueries.find(_ref => {
|
67
|
+
let [key] = _ref;
|
68
|
+
if (!isUnistylesMq(key)) {
|
69
|
+
return false;
|
70
|
+
}
|
71
|
+
const parsedMq = parseMq(key);
|
72
|
+
if (!isValidMq(parsedMq)) {
|
73
|
+
return false;
|
74
|
+
}
|
75
|
+
return isWithinTheWidthAndHeight(parsedMq, screenSize);
|
76
|
+
});
|
77
|
+
return mq?.at(0);
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=mqParser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":"AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAYpE,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EAC/C,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CAACP,KAAK,CAAC;MACnBQ,EAAE,EAAED,MAAM,CAACN,GAAG;IAClB,CAAC,GAAGQ,SAAS;IACbN,MAAM,EAAEA,MAAM,GAAG;MACbG,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;MACnBI,EAAE,EAAED,MAAM,CAACF,GAAG;IAClB,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WAAW,IAAIZ,IAAI,IAAIY,WAAW,IAAIV,EAAE;AACnD,CAAC;AAED,MAAMS,iBAAiB,GAAGA,CAACd,MAAmC,EAAEgB,YAAoB,KAAc;EAC9F,MAAM;IAAEb,IAAI;IAAEE;EAAG,CAAC,GAAGL,MAA2B;EAEhD,OAAOgB,YAAY,IAAIb,IAAI,IAAIa,YAAY,IAAIX,EAAE;AACrD,CAAC;AAED,OAAO,MAAMY,4BAA4B,GAAGA,CAACC,YAA8B,EAAEN,UAAsB,KAAK;EACpG,MAAMjB,EAAE,GAAGuB,YAAY,CAACC,IAAI,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IAC/B,IAAI,CAACb,aAAa,CAACc,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMX,QAAQ,GAAGhB,OAAO,CAAC2B,GAAa,CAAC;IAEvC,IAAI,CAACZ,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOjB,EAAE,EAAE2B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { warn } from './common';
|
2
|
-
|
3
|
-
const normalizeBoxShadow =
|
2
|
+
import { preprocessor } from './normalizer';
|
3
|
+
const normalizeBoxShadow = style => {
|
4
4
|
const requiredBoxShadowProperties = ['shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius'];
|
5
|
-
if (!requiredBoxShadowProperties.every(prop => prop in
|
5
|
+
if (!requiredBoxShadowProperties.every(prop => prop in style)) {
|
6
6
|
warn(`can't apply box shadow as you miss at least one of these properties: ${requiredBoxShadowProperties.join(', ')}`);
|
7
7
|
return {
|
8
8
|
shadowColor: undefined,
|
@@ -12,16 +12,16 @@ const normalizeBoxShadow = styles => {
|
|
12
12
|
};
|
13
13
|
}
|
14
14
|
return {
|
15
|
-
boxShadow: preprocessor.createBoxShadowValue(
|
15
|
+
boxShadow: preprocessor.createBoxShadowValue(style),
|
16
16
|
shadowColor: undefined,
|
17
17
|
shadowOffset: undefined,
|
18
18
|
shadowOpacity: undefined,
|
19
19
|
shadowRadius: undefined
|
20
20
|
};
|
21
21
|
};
|
22
|
-
const normalizeTextShadow =
|
22
|
+
const normalizeTextShadow = style => {
|
23
23
|
const requiredTextShadowProperties = ['textShadowColor', 'textShadowOffset', 'textShadowRadius'];
|
24
|
-
if (!requiredTextShadowProperties.every(prop => prop in
|
24
|
+
if (!requiredTextShadowProperties.every(prop => prop in style)) {
|
25
25
|
warn(`can't apply text shadow as you miss at least one of these properties: ${requiredTextShadowProperties.join(', ')}`);
|
26
26
|
return {
|
27
27
|
textShadowColor: undefined,
|
@@ -30,20 +30,20 @@ const normalizeTextShadow = styles => {
|
|
30
30
|
};
|
31
31
|
}
|
32
32
|
return {
|
33
|
-
textShadow: preprocessor.createTextShadowValue(
|
33
|
+
textShadow: preprocessor.createTextShadowValue(style),
|
34
34
|
textShadowColor: undefined,
|
35
35
|
textShadowOffset: undefined,
|
36
36
|
textShadowRadius: undefined
|
37
37
|
};
|
38
38
|
};
|
39
|
-
export const normalizeStyles =
|
40
|
-
const normalizedTransform = 'transform' in
|
41
|
-
transform: preprocessor.createTransformValue(
|
39
|
+
export const normalizeStyles = style => {
|
40
|
+
const normalizedTransform = 'transform' in style && Array.isArray(style.transform) ? {
|
41
|
+
transform: preprocessor.createTransformValue(style.transform)
|
42
42
|
} : {};
|
43
|
-
const normalizedBoxShadow = 'shadowColor' in
|
44
|
-
const normalizedTextShadow = 'textShadowColor' in
|
43
|
+
const normalizedBoxShadow = 'shadowColor' in style || 'shadowOffset' in style || 'shadowOpacity' in style || 'shadowRadius' in style ? normalizeBoxShadow(style) : {};
|
44
|
+
const normalizedTextShadow = 'textShadowColor' in style || 'textShadowOffset' in style || 'textShadowRadius' in style ? normalizeTextShadow(style) : {};
|
45
45
|
return {
|
46
|
-
...
|
46
|
+
...style,
|
47
47
|
...normalizedTransform,
|
48
48
|
...normalizedBoxShadow,
|
49
49
|
...normalizedTextShadow
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["warn","preprocessor","
|
1
|
+
{"version":3,"names":["warn","preprocessor","normalizeBoxShadow","style","requiredBoxShadowProperties","every","prop","join","shadowColor","undefined","shadowOffset","shadowOpacity","shadowRadius","boxShadow","createBoxShadowValue","normalizeTextShadow","requiredTextShadowProperties","textShadowColor","textShadowOffset","textShadowRadius","textShadow","createTextShadowValue","normalizeStyles","normalizedTransform","Array","isArray","transform","createTransformValue","normalizedBoxShadow","normalizedTextShadow"],"sourceRoot":"../../../src","sources":["utils/normalizeStyles.web.ts"],"mappings":"AAAA,SAASA,IAAI,QAAQ,UAAU;AAC/B,SAASC,YAAY,QAAQ,cAAc;AAG3C,MAAMC,kBAAkB,GAAyBC,KAAQ,IAA0B;EAC/E,MAAMC,2BAA2B,GAAG,CAChC,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,CACjB;EAED,IAAI,CAACA,2BAA2B,CAACC,KAAK,CAACC,IAAI,IAAIA,IAAI,IAAIH,KAAK,CAAC,EAAE;IAC3DH,IAAI,CAAE,wEAAuEI,2BAA2B,CAACG,IAAI,CAAC,IAAI,CAAE,EAAC,CAAC;IAEtH,OAAO;MACHC,WAAW,EAAEC,SAAS;MACtBC,YAAY,EAAED,SAAS;MACvBE,aAAa,EAAEF,SAAS;MACxBG,YAAY,EAAEH;IAClB,CAAC;EACL;EAEA,OAAO;IACHI,SAAS,EAAEZ,YAAY,CAACa,oBAAoB,CAACX,KAAK,CAAC;IACnDK,WAAW,EAAEC,SAAS;IACtBC,YAAY,EAAED,SAAS;IACvBE,aAAa,EAAEF,SAAS;IACxBG,YAAY,EAAEH;EAClB,CAAC;AACL,CAAC;AAED,MAAMM,mBAAmB,GAA0BZ,KAAQ,IAA2B;EAClF,MAAMa,4BAA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 -0,0 +1,79 @@
|
|
1
|
+
// based on react-native-web normalizer
|
2
|
+
// https://github.com/necolas/react-native-web
|
3
|
+
import normalizeColors from '@react-native/normalize-colors';
|
4
|
+
export const normalizeColor = function (color) {
|
5
|
+
let opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
6
|
+
// If the opacity is 1 there's no need to normalize the color
|
7
|
+
if (opacity === 1) {
|
8
|
+
return color;
|
9
|
+
}
|
10
|
+
const integer = normalizeColors(color);
|
11
|
+
|
12
|
+
// If the colour is an unknown format, the return value is null
|
13
|
+
if (integer === null) {
|
14
|
+
return color;
|
15
|
+
}
|
16
|
+
const hex = integer.toString(16).padStart(8, '0');
|
17
|
+
if (hex.length === 8) {
|
18
|
+
const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
|
19
|
+
return `rgba(${r},${g},${b},${a / 255 * opacity})`;
|
20
|
+
}
|
21
|
+
return color;
|
22
|
+
};
|
23
|
+
export const normalizeNumericValue = value => value ? `${value}px` : value;
|
24
|
+
const normalizeTransform = (key, value) => {
|
25
|
+
if (key.includes('scale')) {
|
26
|
+
return value;
|
27
|
+
}
|
28
|
+
if (typeof value === 'number') {
|
29
|
+
return normalizeNumericValue(value);
|
30
|
+
}
|
31
|
+
return value;
|
32
|
+
};
|
33
|
+
const createTextShadowValue = style => {
|
34
|
+
// at this point every prop is present
|
35
|
+
const {
|
36
|
+
textShadowColor,
|
37
|
+
textShadowOffset,
|
38
|
+
textShadowRadius
|
39
|
+
} = style;
|
40
|
+
const offsetX = normalizeNumericValue(textShadowOffset.width);
|
41
|
+
const offsetY = normalizeNumericValue(textShadowOffset.height);
|
42
|
+
const radius = normalizeNumericValue(textShadowRadius);
|
43
|
+
const color = normalizeColor(textShadowColor);
|
44
|
+
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
45
|
+
};
|
46
|
+
const createBoxShadowValue = style => {
|
47
|
+
// at this point every prop is present
|
48
|
+
const {
|
49
|
+
shadowColor,
|
50
|
+
shadowOffset,
|
51
|
+
shadowOpacity,
|
52
|
+
shadowRadius
|
53
|
+
} = style;
|
54
|
+
const offsetX = normalizeNumericValue(shadowOffset.width);
|
55
|
+
const offsetY = normalizeNumericValue(shadowOffset.height);
|
56
|
+
const radius = normalizeNumericValue(shadowRadius);
|
57
|
+
const color = normalizeColor(shadowColor, shadowOpacity);
|
58
|
+
return `${offsetX} ${offsetY} ${radius} ${color}`;
|
59
|
+
};
|
60
|
+
const createTransformValue = transforms => transforms.map(transform => {
|
61
|
+
const [key] = Object.keys(transform);
|
62
|
+
if (!key) {
|
63
|
+
return undefined;
|
64
|
+
}
|
65
|
+
const value = transform[key];
|
66
|
+
switch (key) {
|
67
|
+
case 'matrix':
|
68
|
+
case 'matrix3d':
|
69
|
+
return `${key}(${value.join(',')})`;
|
70
|
+
default:
|
71
|
+
return `${key}(${normalizeTransform(key, value)})`;
|
72
|
+
}
|
73
|
+
}).filter(Boolean).join(' ');
|
74
|
+
export const preprocessor = {
|
75
|
+
createTextShadowValue,
|
76
|
+
createBoxShadowValue,
|
77
|
+
createTransformValue
|
78
|
+
};
|
79
|
+
//# sourceMappingURL=normalizer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["normalizeColors","normalizeColor","color","opacity","arguments","length","undefined","integer","hex","toString","padStart","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","normalizeNumericValue","value","normalizeTransform","key","includes","createTextShadowValue","style","textShadowColor","textShadowOffset","textShadowRadius","offsetX","width","offsetY","height","radius","createBoxShadowValue","shadowColor","shadowOffset","shadowOpacity","shadowRadius","createTransformValue","transforms","transform","Object","keys","join","Boolean","preprocessor"],"sourceRoot":"../../../src","sources":["utils/normalizer.ts"],"mappings":"AAAA;AACA;AACA,OAAOA,eAAe,MAAM,gCAAgC;AAS5D,OAAO,MAAMC,cAAc,GAAG,SAAAA,CAACC,KAAa,EAA0B;EAAA,IAAxBC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IACN,KAAK,QAAQ;IACb,KAAK,UAAU;MACX,OAAQ,GAAEA,GAAI,IAAIF,KAAK,CAAmBwB,IAAI,CAAC,GAAG,CAAE,GAAE;IAC1D;MACI,OAAQ,GAAEtB,GAAI,IAAGD,kBAAkB,CAACC,GAAG,EAAEF,KAAK,CAAE,GAAE;EAC1D;AACJ,CAAC,CAAC,CACDJ,MAAM,CAAC6B,OAAO,CAAC,CACfD,IAAI,CAAC,GAAG,CAAC;AAEd,OAAO,MAAME,YAA0B,GAAG;EACtCtB,qBAAqB;EACrBU,oBAAoB;EACpBK;AACJ,CAAC"}
|
@@ -1,76 +1,34 @@
|
|
1
|
-
import {
|
1
|
+
import { getValueForNestedStyle } from './breakpoints';
|
2
2
|
import { normalizeStyles } from './normalizeStyles';
|
3
|
-
import { isWeb } from './common';
|
4
|
-
|
5
|
-
|
6
|
-
* Proxies a function to parse its return value for custom media queries or breakpoints.
|
7
|
-
*
|
8
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
9
|
-
*
|
10
|
-
* @param {Function} fn - The function to be proxified.
|
11
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
12
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
13
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
14
|
-
*
|
15
|
-
* @returns {Function} Returns the proxified function
|
16
|
-
*
|
17
|
-
* @example
|
18
|
-
*
|
19
|
-
* const myFunction = () => ({ ':w[200]': 'value1', sm: 'value2' })
|
20
|
-
* const screenSize = { width: 250, height: 400 }
|
21
|
-
* const breakpoints = { sm: 300, md: 600 }
|
22
|
-
*
|
23
|
-
* const proxifiedFunction = proxifyFunction(myFunction, 'sm', screenSize, breakpoints)
|
24
|
-
* proxifiedFunction() // parsed style based on screenSize and breakpoints
|
25
|
-
*/
|
26
|
-
export const proxifyFunction = (fn, breakpoint, screenSize, breakpointPairs) => new Proxy(fn, {
|
27
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, breakpointPairs)
|
3
|
+
import { isAndroid, isIOS, isWeb } from './common';
|
4
|
+
export const proxifyFunction = (fn, breakpoint, screenSize, variant) => new Proxy(fn, {
|
5
|
+
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList), breakpoint, screenSize, variant)
|
28
6
|
});
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
* @template B - An object type where keys represent breakpoint names and values represent breakpoint values.
|
38
|
-
*
|
39
|
-
* @param {CustomNamedStyles<T, B>} style - The style object to be parsed.
|
40
|
-
* @param {keyof B & string} breakpoint - The breakpoint name to check against.
|
41
|
-
* @param {ScreenSize} screenSize - An object representing the screen size to be checked against the media queries.
|
42
|
-
* @param breakpointPairs - sorted pairs of breakpoints
|
43
|
-
*
|
44
|
-
* @returns {Record<string, string | number | Function>} Returns the parsed style object with resolved custom media queries or breakpoints.
|
45
|
-
*
|
46
|
-
* @example
|
47
|
-
*
|
48
|
-
* const style = { fontSize: { sm: '12px', md: '16px' } }
|
49
|
-
* const screenSize = { width: 300, height: 400 }
|
50
|
-
* const breakpoints = { xs: 0, sm: 300, md: 600 }
|
51
|
-
*
|
52
|
-
* const parsedStyle = parseStyle(style, 'sm', screenSize, breakpoints)
|
53
|
-
* // { fontSize: '12px' }
|
54
|
-
*/
|
55
|
-
export const parseStyle = (style, breakpoint, screenSize, breakpointPairs) => {
|
56
|
-
const entries = Object.entries(style);
|
7
|
+
export const isPlatformColor = value => {
|
8
|
+
if (isIOS) {
|
9
|
+
return 'semantic' in value && typeof value.semantic === 'object';
|
10
|
+
}
|
11
|
+
return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
|
12
|
+
};
|
13
|
+
export const parseStyle = (style, breakpoint, screenSize, variant) => {
|
14
|
+
const entries = Object.entries(style || {});
|
57
15
|
const parsedStyles = Object.fromEntries(entries.map(_ref => {
|
58
16
|
let [key, value] = _ref;
|
59
17
|
const hasNestedProperties = key === 'shadowOffset' || key === 'textShadowOffset';
|
60
18
|
if (hasNestedProperties) {
|
61
|
-
return [key, parseStyle(value, breakpoint, screenSize,
|
19
|
+
return [key, parseStyle(value, breakpoint, screenSize, variant)];
|
62
20
|
}
|
63
21
|
const isTransform = key === 'transform';
|
64
22
|
if (isTransform && Array.isArray(value)) {
|
65
|
-
return [key, value.map(value => parseStyle(value, breakpoint, screenSize,
|
23
|
+
return [key, value.map(value => parseStyle(value, breakpoint, screenSize, variant))];
|
66
24
|
}
|
67
25
|
const isDynamicFunction = typeof value === 'function';
|
68
|
-
const isValidStyle = typeof value !== 'object';
|
26
|
+
const isValidStyle = typeof value !== 'object' || isPlatformColor(value);
|
69
27
|
if (isDynamicFunction || isValidStyle) {
|
70
28
|
return [key, value];
|
71
29
|
}
|
72
|
-
return [key,
|
30
|
+
return [key, getValueForNestedStyle(value, variant)];
|
73
31
|
}));
|
74
|
-
return isWeb
|
32
|
+
return isWeb ? normalizeStyles(parsedStyles) : parsedStyles;
|
75
33
|
};
|
76
34
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["getValueForNestedStyle","normalizeStyles","isAndroid","isIOS","isWeb","proxifyFunction","fn","breakpoint","screenSize","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","entries","Object","parsedStyles","fromEntries","map","_ref","key","hasNestedProperties","isTransform","Array","isArray","isDynamicFunction","isValidStyle"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,eAAe;AACtD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,SAASC,SAAS,EAAEC,KAAK,EAAEC,KAAK,QAAQ,UAAU;AAElD,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,EAAY,EAAEC,UAA+C,EAC7DC,UAAsB,EACtBC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EV,UAAU,EAAEC,UAAU,EAAEC,OAAO,CAAC,CAAC,CACzE;IACL;IAEA,MAAMuB,iBAAiB,GAAG,OAAOf,KAAK,KAAK,UAAU;IACrD,MAAMgB,YAAY,GAAG,OAAOhB,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC;IAExE,IAAIe,iBAAiB,IAAIC,YAAY,EAAE;MACnC,OAAO,CAACN,GAAG,EAAEV,KAAK,CAAC;IACvB;IAEA,OAAO,CACHU,GAAG,EACH3B,sBAAsB,CAClBiB,KAAK,EACLR,OACJ,CAAC,CACJ;EACL,CAAC,CACL,CAAC;EAEL,OAAOL,KAAK,GACNH,eAAe,CAACsB,YAAY,CAAC,GAC7BA,YAAY;AACtB,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export const getKeyForVariant = (value, variant) => {
|
2
|
+
if (!value.variants) {
|
3
|
+
return undefined;
|
4
|
+
}
|
5
|
+
if (variant && variant in value.variants) {
|
6
|
+
return variant;
|
7
|
+
}
|
8
|
+
if ('default' in value.variants) {
|
9
|
+
return 'default';
|
10
|
+
}
|
11
|
+
return undefined;
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=variants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["getKeyForVariant","value","variant","variants","undefined"],"sourceRoot":"../../../src","sources":["utils/variants.ts"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAGA,CAACC,KAAkB,EAAEC,OAAgB,KAAmC;EACpG,IAAI,CAACD,KAAK,CAACE,QAAQ,EAAE;IACjB,OAAOC,SAAS;EACpB;EAEA,IAAIF,OAAO,IAAIA,OAAO,IAAID,KAAK,CAACE,QAAQ,EAAE;IACtC,OAAOD,OAAO;EAClB;EAEA,IAAI,SAAS,IAAID,KAAK,CAACE,QAAQ,EAAE;IAC7B,OAAO,SAAS;EACpB;EAEA,OAAOC,SAAS;AACpB,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare enum CxxUnistylesEventTypes {
|
2
|
+
Theme = "theme",
|
3
|
+
Layout = "layout"
|
4
|
+
}
|
5
|
+
export declare enum UnistylesError {
|
6
|
+
RuntimeUnavailable = "UNISTYLES_ERROR_RUNTIME_UNAVAILABLE",
|
7
|
+
ThemeNotFound = "UNISTYLES_ERROR_THEME_NOT_FOUND",
|
8
|
+
ThemeNotRegistered = "UNISTYLES_ERROR_THEME_NOT_REGISTERED",
|
9
|
+
ThemesCannotBeEmpty = "UNISTYLES_ERROR_THEMES_CANNOT_BE_EMPTY",
|
10
|
+
BreakpointsCannotBeEmpty = "UNISTYLES_ERROR_BREAKPOINTS_CANNOT_BE_EMPTY",
|
11
|
+
BreakpointsMustStartFromZero = "UNISTYLES_ERROR_BREAKPOINTS_MUST_START_FROM_ZERO"
|
12
|
+
}
|
13
|
+
export declare enum ScreenOrientation {
|
14
|
+
Portrait = 1,
|
15
|
+
Landscape = 2
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=common.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"AAAA,oBAAY,sBAAsB;IAC9B,KAAK,UAAU;IACf,MAAM,WAAW;CACpB;AAED,oBAAY,cAAc;IACtB,kBAAkB,wCAAwC;IAC1D,aAAa,oCAAoC;IACjD,kBAAkB,yCAAyC;IAC3D,mBAAmB,2CAA2C;IAC9D,wBAAwB,gDAAgD;IACxE,4BAA4B,qDAAqD;CACpF;AAGD,oBAAY,iBAAiB;IACzB,QAAQ,IAAI;IACZ,SAAS,IAAI;CAChB"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { UnistylesBridge, UnistylesConfig } from '../types';
|
2
|
+
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
3
|
+
export declare class UnistyleRegistry {
|
4
|
+
private unistylesBridge;
|
5
|
+
config: UnistylesConfig;
|
6
|
+
themeNames: Array<keyof UnistylesThemes>;
|
7
|
+
themes: UnistylesThemes;
|
8
|
+
breakpoints: UnistylesBreakpoints;
|
9
|
+
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
10
|
+
constructor(unistylesBridge: UnistylesBridge);
|
11
|
+
addThemes: (themes: UnistylesThemes) => this;
|
12
|
+
addBreakpoints: (breakpoints: UnistylesBreakpoints) => this;
|
13
|
+
addConfig: (config: UnistylesConfig) => this;
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistyleRegistry.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistyleRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEtE,qBAAa,gBAAgB;IAOb,OAAO,CAAC,eAAe;IAN5B,MAAM,EAAE,eAAe,CAAK;IAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,eAAe,CAAC,CAAK;IAC7C,MAAM,EAAE,eAAe,CAAwB;IAC/C,WAAW,EAAE,oBAAoB,CAA6B;IAC9D,qBAAqB,EAAE,KAAK,CAAC,CAAC,MAAM,oBAAoB,EAAE,oBAAoB,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAK;gBAEpG,eAAe,EAAE,eAAe;IAE7C,SAAS,WAAY,eAAe,UAS1C;IAEM,cAAc,gBAAiB,oBAAoB,UAMzD;IAEM,SAAS,WAAY,eAAe,UAQ1C;CACJ"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { UnistylesRuntime } from './UnistylesRuntime';
|
2
|
+
import { UnistyleRegistry } from './UnistyleRegistry';
|
3
|
+
declare class Unistyles {
|
4
|
+
private _runtime;
|
5
|
+
private _registry;
|
6
|
+
private _bridge;
|
7
|
+
constructor();
|
8
|
+
get registry(): UnistyleRegistry;
|
9
|
+
get runtime(): UnistylesRuntime;
|
10
|
+
}
|
11
|
+
export declare const unistyles: Unistyles;
|
12
|
+
export {};
|
13
|
+
//# sourceMappingURL=Unistyles.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Unistyles.d.ts","sourceRoot":"","sources":["../../../../src/core/Unistyles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAIrD,cAAM,SAAS;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAiB;;IAehC,IAAW,QAAQ,qBAElB;IAED,IAAW,OAAO,qBAEjB;CACJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesModule.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesModule.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG;IACzB,OAAO,IAAI,OAAO,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,uBAAoD,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { ScreenOrientation } from '../common';
|
2
|
+
import type { UnistylesBridge } from '../types';
|
3
|
+
import type { UnistylesThemes } from '../global';
|
4
|
+
import type { UnistyleRegistry } from './UnistyleRegistry';
|
5
|
+
export declare class UnistylesRuntime {
|
6
|
+
private unistylesBridge;
|
7
|
+
private registry;
|
8
|
+
constructor(unistylesBridge: UnistylesBridge, registry: UnistyleRegistry);
|
9
|
+
get colorScheme(): import("../types").ColorSchemeName;
|
10
|
+
get hasAdaptiveThemes(): boolean;
|
11
|
+
get sortedBreakpoints(): [keyof import("../global").UnistylesBreakpoints, number | undefined][];
|
12
|
+
get themeName(): never;
|
13
|
+
get breakpoint(): keyof import("../global").UnistylesBreakpoints;
|
14
|
+
get screen(): {
|
15
|
+
width: number;
|
16
|
+
height: number;
|
17
|
+
};
|
18
|
+
get orientation(): ScreenOrientation;
|
19
|
+
setTheme: (name: keyof UnistylesThemes) => boolean;
|
20
|
+
getTheme: (forName: keyof UnistylesThemes) => never;
|
21
|
+
setAdaptiveThemes: (enable: boolean) => void;
|
22
|
+
private hasTheme;
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,WAAW,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,qBAAa,gBAAgB;IACb,OAAO,CAAC,eAAe;IAAmB,OAAO,CAAC,QAAQ;gBAAlD,eAAe,EAAE,eAAe,EAAU,QAAQ,EAAE,gBAAgB;IAExF,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,iBAAiB,2EAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,sBAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,aAQ7C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAUhD;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAED,OAAO,CAAC,QAAQ,CAAgE;CACnF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,gBAAgB,yDAA0D,cAAc,wCAMpG,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|