react-native-unistyles 2.0.0-alpha.9 → 2.0.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +28 -0
- package/android/build.gradle +40 -0
- package/android/src/main/cxx/cpp-adapter.cpp +108 -0
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +159 -0
- package/android/src/main/java/com/unistyles/UnistylesPackage.kt +18 -0
- package/cxx/UnistylesRuntime.cpp +55 -2
- package/cxx/UnistylesRuntime.h +15 -9
- package/ios/UnistylesModule.mm +12 -2
- package/lib/commonjs/common.js +30 -16
- package/lib/commonjs/common.js.map +1 -1
- package/lib/commonjs/core/UnistyleRegistry.js +65 -3
- package/lib/commonjs/core/UnistyleRegistry.js.map +1 -1
- package/lib/commonjs/core/UnistylesRuntime.js +15 -16
- package/lib/commonjs/core/UnistylesRuntime.js.map +1 -1
- package/lib/commonjs/createStyleSheet.js +1 -6
- package/lib/commonjs/createStyleSheet.js.map +1 -1
- package/lib/commonjs/hooks/index.js +7 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useUnistyles.js +11 -8
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
- package/lib/commonjs/hooks/useVariants.js +14 -0
- package/lib/commonjs/hooks/useVariants.js.map +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugins/index.js +38 -0
- package/lib/commonjs/plugins/index.js.map +1 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +12 -0
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/commonjs/plugins/normalizer/index.js +32 -0
- package/lib/commonjs/plugins/normalizer/index.js.map +1 -0
- package/lib/commonjs/plugins/normalizer/module.d.js.map +1 -0
- package/lib/commonjs/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +5 -5
- package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +1 -0
- package/lib/commonjs/{utils → plugins/normalizer}/normalizer.js +1 -1
- package/lib/commonjs/plugins/normalizer/normalizer.js.map +1 -0
- package/lib/commonjs/types/{mq.js → plugin.js} +1 -1
- package/lib/commonjs/types/{mq.js.map → plugin.js.map} +1 -1
- package/lib/commonjs/types/stylesheet.js +6 -0
- package/lib/commonjs/types/stylesheet.js.map +1 -0
- package/lib/commonjs/types/variants.js +2 -0
- package/lib/commonjs/{utils/module.d.js.map → types/variants.js.map} +1 -1
- package/lib/commonjs/useStyles.js +10 -20
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/commonjs/utils/breakpoints.js +13 -59
- package/lib/commonjs/utils/breakpoints.js.map +1 -1
- package/lib/commonjs/utils/index.js +13 -51
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mq.js +36 -68
- package/lib/commonjs/utils/mq.js.map +1 -1
- package/lib/commonjs/utils/mqParser.js +4 -1
- package/lib/commonjs/utils/mqParser.js.map +1 -1
- package/lib/commonjs/utils/styles.js +35 -20
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/withPlugins.js +15 -0
- package/lib/commonjs/utils/withPlugins.js.map +1 -0
- package/lib/module/common.js +28 -17
- package/lib/module/common.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +65 -3
- package/lib/module/core/UnistyleRegistry.js.map +1 -1
- package/lib/module/core/UnistylesRuntime.js +15 -16
- package/lib/module/core/UnistylesRuntime.js.map +1 -1
- package/lib/module/createStyleSheet.js +1 -6
- package/lib/module/createStyleSheet.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useUnistyles.js +12 -9
- package/lib/module/hooks/useUnistyles.js.map +1 -1
- package/lib/module/hooks/useVariants.js +7 -0
- package/lib/module/hooks/useVariants.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugins/index.js +3 -0
- package/lib/module/plugins/index.js.map +1 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js +6 -0
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -0
- package/lib/module/plugins/normalizer/index.js +3 -0
- package/lib/module/plugins/normalizer/index.js.map +1 -0
- package/lib/module/plugins/normalizer/module.d.js.map +1 -0
- package/lib/module/{utils/normalizeStyles.web.js → plugins/normalizer/normalizeStyle.js} +3 -3
- package/lib/module/plugins/normalizer/normalizeStyle.js.map +1 -0
- package/lib/module/{utils → plugins/normalizer}/normalizer.js +1 -1
- package/lib/module/plugins/normalizer/normalizer.js.map +1 -0
- package/lib/module/types/plugin.js +2 -0
- package/lib/module/types/{mq.js.map → plugin.js.map} +1 -1
- package/lib/module/types/stylesheet.js +2 -0
- package/lib/module/types/stylesheet.js.map +1 -0
- package/lib/module/types/variants.js +2 -0
- package/lib/module/{utils/module.d.js.map → types/variants.js.map} +1 -1
- package/lib/module/useStyles.js +12 -22
- package/lib/module/useStyles.js.map +1 -1
- package/lib/module/utils/breakpoints.js +12 -56
- package/lib/module/utils/breakpoints.js.map +1 -1
- package/lib/module/utils/index.js +4 -6
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mq.js +35 -67
- package/lib/module/utils/mq.js.map +1 -1
- package/lib/module/utils/mqParser.js +3 -3
- package/lib/module/utils/mqParser.js.map +1 -1
- package/lib/module/utils/styles.js +35 -20
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/withPlugins.js +8 -0
- package/lib/module/utils/withPlugins.js.map +1 -0
- package/lib/typescript/src/common.d.ts +23 -12
- package/lib/typescript/src/common.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistyleRegistry.d.ts +45 -4
- package/lib/typescript/src/core/UnistyleRegistry.d.ts.map +1 -1
- package/lib/typescript/src/core/UnistylesRuntime.d.ts +8 -9
- package/lib/typescript/src/core/UnistylesRuntime.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +1 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/createStyleSheet.d.ts +2 -2
- package/lib/typescript/src/createStyleSheet.d.ts.map +1 -1
- package/lib/typescript/src/global.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts +2 -1
- package/lib/typescript/src/hooks/useUnistyles.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useVariants.d.ts +3 -0
- package/lib/typescript/src/hooks/useVariants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +51 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/plugins/index.d.ts +3 -0
- package/lib/typescript/src/plugins/index.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizeWebStylesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizer/index.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizer/index.d.ts.map +1 -0
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +3 -0
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +1 -0
- package/lib/typescript/src/{utils → plugins/normalizer}/normalizer.d.ts +1 -1
- package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/types/breakpoints.d.ts +25 -12
- package/lib/typescript/src/types/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/types/core.d.ts +6 -27
- package/lib/typescript/src/types/core.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +4 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/plugin.d.ts +7 -0
- package/lib/typescript/src/types/plugin.d.ts.map +1 -0
- package/lib/typescript/src/types/stylesheet.d.ts +40 -0
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -0
- package/lib/typescript/src/types/unistyles.d.ts +16 -11
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/lib/typescript/src/types/variants.d.ts +14 -0
- package/lib/typescript/src/types/variants.d.ts.map +1 -0
- package/lib/typescript/src/useStyles.d.ts +3 -3
- package/lib/typescript/src/useStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/breakpoints.d.ts +2 -5
- package/lib/typescript/src/utils/breakpoints.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +4 -6
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mq.d.ts +15 -14
- package/lib/typescript/src/utils/mq.d.ts.map +1 -1
- package/lib/typescript/src/utils/mqParser.d.ts +14 -2
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
- package/lib/typescript/src/utils/styles.d.ts +3 -4
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/lib/typescript/src/utils/withPlugins.d.ts +3 -0
- package/lib/typescript/src/utils/withPlugins.d.ts.map +1 -0
- package/package.json +19 -16
- package/src/__tests__/mocks.ts +24 -0
- package/src/common.ts +30 -14
- package/src/core/UnistyleRegistry.ts +66 -4
- package/src/core/UnistylesRuntime.ts +18 -20
- package/src/core/index.ts +1 -0
- package/src/createStyleSheet.ts +2 -8
- package/src/global.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useUnistyles.ts +11 -9
- package/src/hooks/useVariants.ts +10 -0
- package/src/index.ts +3 -1
- package/src/plugins/index.ts +2 -0
- package/src/plugins/normalizeWebStylesPlugin.ts +7 -0
- package/src/plugins/normalizer/index.ts +2 -0
- package/src/{utils/normalizeStyles.web.ts → plugins/normalizer/normalizeStyle.ts} +3 -3
- package/src/{utils → plugins/normalizer}/normalizer.ts +3 -3
- package/src/types/breakpoints.ts +57 -25
- package/src/types/core.ts +9 -43
- package/src/types/index.ts +11 -2
- package/src/types/plugin.ts +7 -0
- package/src/types/stylesheet.ts +49 -0
- package/src/types/unistyles.ts +18 -13
- package/src/types/variants.ts +19 -0
- package/src/useStyles.ts +18 -25
- package/src/utils/breakpoints.ts +11 -67
- package/src/utils/index.ts +4 -6
- package/src/utils/mq.ts +31 -84
- package/src/utils/mqParser.ts +5 -5
- package/src/utils/styles.ts +44 -50
- package/src/utils/withPlugins.ts +13 -0
- package/lib/commonjs/utils/common.js +0 -25
- package/lib/commonjs/utils/common.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.js +0 -10
- package/lib/commonjs/utils/normalizeStyles.js.map +0 -1
- package/lib/commonjs/utils/normalizeStyles.web.js.map +0 -1
- package/lib/commonjs/utils/normalizer.js.map +0 -1
- package/lib/module/types/mq.js +0 -2
- package/lib/module/utils/common.js +0 -17
- package/lib/module/utils/common.js.map +0 -1
- package/lib/module/utils/normalizeStyles.js +0 -3
- package/lib/module/utils/normalizeStyles.js.map +0 -1
- package/lib/module/utils/normalizeStyles.web.js.map +0 -1
- package/lib/module/utils/normalizer.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/lib/typescript/src/utils/common.d.ts +0 -12
- package/lib/typescript/src/utils/common.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.d.ts +0 -2
- package/lib/typescript/src/utils/normalizeStyles.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts +0 -5
- package/lib/typescript/src/utils/normalizeStyles.web.d.ts.map +0 -1
- package/lib/typescript/src/utils/normalizer.d.ts.map +0 -1
- package/src/types/mq.ts +0 -3
- package/src/utils/common.ts +0 -20
- package/src/utils/normalizeStyles.ts +0 -2
- /package/lib/commonjs/{utils → plugins/normalizer}/module.d.js +0 -0
- /package/lib/module/{utils → plugins/normalizer}/module.d.js +0 -0
- /package/src/{utils → plugins/normalizer}/module.d.ts +0 -0
package/lib/module/utils/mq.js
CHANGED
@@ -1,13 +1,4 @@
|
|
1
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
2
|
const getMQValue = value => {
|
12
3
|
if (typeof value === 'number') {
|
13
4
|
return value;
|
@@ -17,67 +8,44 @@ const getMQValue = value => {
|
|
17
8
|
}
|
18
9
|
return unistyles.registry.breakpoints[value] ?? 0;
|
19
10
|
};
|
20
|
-
const
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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);
|
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)}]`;
|
43
22
|
}
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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 () {
|
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 () {
|
56
30
|
let hMin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
57
31
|
let hMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
|
58
|
-
return
|
59
|
-
|
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
|
-
};
|
32
|
+
return `:w[${getMQValue(wMin)}, ${getMQValue(wMax)}]:h[${getMQValue(hMin)}, ${getMQValue(hMax)}]`;
|
33
|
+
}
|
67
34
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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
|
+
}
|
47
|
+
}
|
48
|
+
};
|
81
49
|
}
|
82
|
-
}
|
50
|
+
};
|
83
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,CAAC;IAAA,IAAEG,IAAa,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGI,QAAQ;IAAA,OAAM;MAC/DI,GAAG,EAAE;QACDH,MAAM,EAAE,SAAAA,CAAA;UAAA,IAACC,IAAuB,GAAAN,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;UAAA,IAAEO,IAAa,GAAAP,SAAA,CAAAC,MAAA,QAAAD,SAAA,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,7 +1,7 @@
|
|
1
1
|
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
2
2
|
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
3
3
|
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
4
|
-
const parseMq = mq => {
|
4
|
+
export const parseMq = mq => {
|
5
5
|
const [, width, fromW, toW] = UNISTYLES_WIDTH_REGEX.exec(mq) || [];
|
6
6
|
const [, height, fromH, toH] = UNISTYLES_HEIGHT_REGEX.exec(mq) || [];
|
7
7
|
return {
|
@@ -16,7 +16,7 @@ const parseMq = mq => {
|
|
16
16
|
};
|
17
17
|
};
|
18
18
|
const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
19
|
-
const isValidMq = parsedMq => {
|
19
|
+
export const isValidMq = parsedMq => {
|
20
20
|
const {
|
21
21
|
width,
|
22
22
|
height
|
@@ -32,7 +32,7 @@ const isValidMq = parsedMq => {
|
|
32
32
|
}
|
33
33
|
return false;
|
34
34
|
};
|
35
|
-
const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
|
35
|
+
export const isWithinTheWidthAndHeight = (parsedMq, screenSize) => {
|
36
36
|
const {
|
37
37
|
width,
|
38
38
|
height
|
@@ -1 +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;
|
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":"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"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { getValueForBreakpoint } from './breakpoints';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
export const proxifyFunction = (
|
5
|
-
apply: (target, thisArg, argumentsList) => parseStyle(target.apply(thisArg, argumentsList),
|
2
|
+
import { isAndroid, isIOS } from '../common';
|
3
|
+
import { withPlugins } from './withPlugins';
|
4
|
+
export const proxifyFunction = (key, fn, variant) => new Proxy(fn, {
|
5
|
+
apply: (target, thisArg, argumentsList) => withPlugins(key, parseStyle(target.apply(thisArg, argumentsList), variant))
|
6
6
|
});
|
7
7
|
export const isPlatformColor = value => {
|
8
8
|
if (isIOS) {
|
@@ -10,25 +10,40 @@ export const isPlatformColor = value => {
|
|
10
10
|
}
|
11
11
|
return isAndroid && 'resource_paths' in value && typeof value.resource_paths === 'object';
|
12
12
|
};
|
13
|
-
export const parseStyle = (style
|
14
|
-
|
15
|
-
|
13
|
+
export const parseStyle = function (style) {
|
14
|
+
let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
15
|
+
return Object.entries(style || {}).reduce((acc, _ref) => {
|
16
16
|
let [key, value] = _ref;
|
17
|
-
|
18
|
-
if (
|
19
|
-
|
17
|
+
// nested objects
|
18
|
+
if (key === 'shadowOffset' || key === 'textShadowOffset') {
|
19
|
+
acc[key] = parseStyle(value, variant);
|
20
|
+
return acc;
|
20
21
|
}
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
// transforms
|
24
|
+
if (key === 'transform' && Array.isArray(value)) {
|
25
|
+
acc[key] = value.map(value => parseStyle(value, variant));
|
26
|
+
return acc;
|
24
27
|
}
|
25
|
-
|
26
|
-
|
27
|
-
if (
|
28
|
-
|
28
|
+
|
29
|
+
// values or platform colors
|
30
|
+
if (typeof value !== 'object' || isPlatformColor(value)) {
|
31
|
+
acc[key] = value;
|
32
|
+
return acc;
|
29
33
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
if (key === 'variants') {
|
35
|
+
return {
|
36
|
+
...acc,
|
37
|
+
...Object.keys(value).reduce((acc, key) => ({
|
38
|
+
...acc,
|
39
|
+
...parseStyle(value[key][variant[key] || 'default'] ?? {})
|
40
|
+
}), {})
|
41
|
+
};
|
42
|
+
}
|
43
|
+
return {
|
44
|
+
...acc,
|
45
|
+
[key]: getValueForBreakpoint(value)
|
46
|
+
};
|
47
|
+
}, {});
|
33
48
|
};
|
34
49
|
//# sourceMappingURL=styles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getValueForBreakpoint","
|
1
|
+
{"version":3,"names":["getValueForBreakpoint","isAndroid","isIOS","withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","parseStyle","isPlatformColor","value","semantic","resource_paths","style","arguments","length","undefined","Object","entries","reduce","acc","_ref","Array","isArray","map","keys"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":"AACA,SAASA,qBAAqB,QAAQ,eAAe;AACrD,SAASC,SAAS,EAAEC,KAAK,QAAQ,WAAW;AAC5C,SAASC,WAAW,QAAQ,eAAe;AAE3C,OAAO,MAAMC,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC,OAA0C,KAC/B,IAAIC,KAAK,CAACF,EAAE,EAAE;EACzBG,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAAKT,WAAW,CAACE,GAAG,EAAEQ,UAAU,CAACH,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEL,OAAO,CAAC;AACzH,CAAC,CAAC;AAEF,OAAO,MAAMO,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIb,KAAK,EAAE;IACP,OAAO,UAAU,IAAIa,KAAK,IAAI,OAAOA,KAAK,CAACC,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOf,SAAS,IAAI,gBAAgB,IAAIc,KAAK,IAAI,OAAOA,KAAK,CAACE,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAED,OAAO,MAAMJ,UAAU,GAAG,SAAAA,CACtBK,KAAQ;EAAA,IACRX,OAAyC,GAAAY,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,OAC1CG,MAAM,CACTC,OAAO,CAACL,KAAK,IAAI,CAAC,CAAC,CAAC,CACpBM,MAAM,CAAC,CAACC,GAAG,EAAAC,IAAA,KAAmB;IAAA,IAAjB,CAACrB,GAAG,EAAEU,KAAK,CAAC,GAAAW,IAAA;IACtB;IACA,IAAIrB,GAAG,KAAK,cAAc,IAAIA,GAAG,KAAM,kBAAkB,EAAE;MACvDoB,GAAG,CAACpB,GAAG,CAAC,GAAGQ,UAAU,CAACE,KAAK,EAAER,OAAO,CAAC;MAErC,OAAOkB,GAAG;IACd;;IAEA;IACA,IAAIpB,GAAG,KAAK,WAAW,IAAIsB,KAAK,CAACC,OAAO,CAACb,KAAK,CAAC,EAAE;MAC7CU,GAAG,CAACpB,GAAG,CAAC,GAAGU,KAAK,CAACc,GAAG,CAACd,KAAK,IAAIF,UAAU,CAACE,KAAK,EAAER,OAAO,CAAC,CAAC;MAEzD,OAAOkB,GAAG;IACd;;IAEA;IACA,IAAI,OAAOV,KAAK,KAAK,QAAQ,IAAID,eAAe,CAACC,KAAK,CAAC,EAAE;MACrDU,GAAG,CAACpB,GAAG,CAAY,GAAGU,KAAK;MAE3B,OAAOU,GAAG;IACd;IAEA,IAAIpB,GAAG,KAAK,UAAU,EAAE;MACpB,OAAO;QACH,GAAGoB,GAAG;QACN,GAAIH,MAAM,CACLQ,IAAI,CAACf,KAAK,CAAC,CACXS,MAAM,CAAC,CAACC,GAAG,EAAEpB,GAAG,MAAM;UACnB,GAAGoB,GAAG;UACN,GAAGZ,UAAU,CAAEE,KAAK,CAAEV,GAAG,CAAC,CAACE,OAAO,CAACF,GAAG,CAAyB,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;QACvF,CAAC,CAAC,EAAE,CAAC,CAAC;MACd,CAAC;IACL;IAEA,OAAO;MACH,GAAGoB,GAAG;MACN,CAACpB,GAAG,GAAGL,qBAAqB,CAACe,KAAgC;IACjE,CAAC;EACL,CAAC,EAAE,CAAC,CAAM,CAAC;AAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { unistyles } from '../core';
|
2
|
+
export const withPlugins = (key, style) => unistyles.registry.plugins.reduce((acc, plugin) => {
|
3
|
+
if (plugin.onParsedStyle) {
|
4
|
+
return plugin.onParsedStyle(key, style, unistyles.runtime);
|
5
|
+
}
|
6
|
+
return acc;
|
7
|
+
}, style);
|
8
|
+
//# sourceMappingURL=withPlugins.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["unistyles","withPlugins","key","style","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":"AACA,SAASA,SAAS,QAAQ,SAAS;AAEnC,OAAO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbH,SAAS,CAACI,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACP,GAAG,EAAEC,KAAK,EAAEH,SAAS,CAACU,OAAO,CAAC;EAC9D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEJ,KAAK,CAAC"}
|
@@ -1,17 +1,28 @@
|
|
1
|
-
export declare
|
1
|
+
export declare const warn: (message: string) => void;
|
2
|
+
export declare const isWeb: boolean;
|
3
|
+
export declare const isIOS: boolean;
|
4
|
+
export declare const isAndroid: boolean;
|
5
|
+
export declare const isMobile: boolean;
|
6
|
+
export declare const isServer: boolean;
|
7
|
+
export declare const ScreenOrientation: {
|
8
|
+
readonly Landscape: "landscape";
|
9
|
+
readonly Portrait: "portrait";
|
10
|
+
};
|
11
|
+
export declare enum UnistylesEventType {
|
2
12
|
Theme = "theme",
|
3
|
-
Layout = "layout"
|
13
|
+
Layout = "layout",
|
14
|
+
Plugin = "plugin"
|
4
15
|
}
|
5
16
|
export declare enum UnistylesError {
|
6
|
-
RuntimeUnavailable = "
|
7
|
-
ThemeNotFound = "
|
8
|
-
ThemeNotRegistered = "
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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"
|
16
27
|
}
|
17
28
|
//# sourceMappingURL=common.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/common.ts"],"names":[],"mappings":"
|
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,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,KAAK,SAAwB,CAAA;AAC1C,eAAO,MAAM,SAAS,SAA4B,CAAA;AAClD,eAAO,MAAM,QAAQ,SAAqB,CAAA;AAC1C,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"}
|
@@ -1,15 +1,56 @@
|
|
1
|
-
import type { UnistylesBridge, UnistylesConfig } from '../types';
|
1
|
+
import type { UnistylesBridge, UnistylesConfig, UnistylesPlugin } from '../types';
|
2
2
|
import type { UnistylesBreakpoints, UnistylesThemes } from '../global';
|
3
3
|
export declare class UnistyleRegistry {
|
4
4
|
private unistylesBridge;
|
5
5
|
config: UnistylesConfig;
|
6
|
+
plugins: Array<UnistylesPlugin>;
|
6
7
|
themeNames: Array<keyof UnistylesThemes>;
|
7
8
|
themes: UnistylesThemes;
|
8
9
|
breakpoints: UnistylesBreakpoints;
|
9
10
|
sortedBreakpointPairs: Array<[keyof UnistylesBreakpoints, UnistylesBreakpoints[keyof UnistylesBreakpoints]]>;
|
10
11
|
constructor(unistylesBridge: UnistylesBridge);
|
11
|
-
addThemes: (themes: UnistylesThemes) =>
|
12
|
-
|
13
|
-
|
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
|
+
};
|
51
|
+
getTheme: (forName: keyof UnistylesThemes) => never;
|
52
|
+
addPlugin: (plugin: UnistylesPlugin, notify?: boolean) => void;
|
53
|
+
removePlugin: (plugin: UnistylesPlugin) => void;
|
54
|
+
hasTheme: (name: keyof UnistylesThemes) => boolean;
|
14
55
|
}
|
15
56
|
//# sourceMappingURL=UnistyleRegistry.d.ts.map
|
@@ -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,MAAM,UAAU,CAAA;
|
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,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;sCAcL,oBAAoB;;gCAW9B,eAAe;;;;;4BAAf,eAAe;;;;MAb1C;IAEM,cAAc,gBAAiB,oBAAoB;4BAd9B,eAAe;;gCAyBf,eAAe;;;;;4BAAf,eAAe;;;;MAF1C;IAEM,SAAS,WAAY,eAAe;sCAXL,oBAAoB;gCAd9B,eAAe;;;;;;4BAAf,eAAe;;;;MA4C1C;IAEM,QAAQ,YAAa,MAAM,eAAe,WAchD;IAEM,SAAS,WAAY,eAAe,WAAU,OAAO,UAW3D;IAEM,YAAY,WAAY,eAAe,UAO7C;IAEM,QAAQ,SAAU,MAAM,eAAe,aAAwB;CACzE"}
|
@@ -1,24 +1,23 @@
|
|
1
|
-
import {
|
2
|
-
import type { UnistylesBridge } from '../types';
|
1
|
+
import type { UnistylesBridge, UnistylesPlugin } from '../types';
|
3
2
|
import type { UnistylesThemes } from '../global';
|
4
3
|
import type { UnistyleRegistry } from './UnistyleRegistry';
|
5
4
|
export declare class UnistylesRuntime {
|
6
5
|
private unistylesBridge;
|
7
|
-
private
|
8
|
-
constructor(unistylesBridge: UnistylesBridge,
|
6
|
+
private unistylesRegistry;
|
7
|
+
constructor(unistylesBridge: UnistylesBridge, unistylesRegistry: UnistyleRegistry);
|
9
8
|
get colorScheme(): import("../types").ColorSchemeName;
|
10
9
|
get hasAdaptiveThemes(): boolean;
|
11
|
-
get sortedBreakpoints(): [keyof import("../global").UnistylesBreakpoints, number | undefined][];
|
12
10
|
get themeName(): never;
|
13
11
|
get breakpoint(): keyof import("../global").UnistylesBreakpoints;
|
12
|
+
get enabledPlugins(): string[];
|
14
13
|
get screen(): {
|
15
14
|
width: number;
|
16
15
|
height: number;
|
17
16
|
};
|
18
|
-
get orientation():
|
19
|
-
setTheme: (name: keyof UnistylesThemes) =>
|
20
|
-
getTheme: (forName: keyof UnistylesThemes) => never;
|
17
|
+
get orientation(): "landscape" | "portrait";
|
18
|
+
setTheme: (name: keyof UnistylesThemes) => true | undefined;
|
21
19
|
setAdaptiveThemes: (enable: boolean) => void;
|
22
|
-
|
20
|
+
addPlugin: (plugin: UnistylesPlugin) => void;
|
21
|
+
removePlugin: (plugin: UnistylesPlugin) => void;
|
23
22
|
}
|
24
23
|
//# sourceMappingURL=UnistylesRuntime.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"UnistylesRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/UnistylesRuntime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAChE,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,iBAAiB;gBAA3D,eAAe,EAAE,eAAe,EAAU,iBAAiB,EAAE,gBAAgB;IAEjG,IAAW,WAAW,uCAErB;IAED,IAAW,iBAAiB,YAE3B;IAED,IAAW,SAAS,UAEnB;IAED,IAAW,UAAU,mDAEpB;IAED,IAAW,cAAc,aAExB;IAED,IAAW,MAAM;;;MAKhB;IAED,IAAW,WAAW,6BAQrB;IAEM,QAAQ,SAAU,MAAM,eAAe,sBAY7C;IAEM,iBAAiB,WAAY,OAAO,UAE1C;IAEM,SAAS,WAAY,eAAe,UAE1C;IAEM,YAAY,WAAY,eAAe,UAE7C;CACJ"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA"}
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
export declare const createStyleSheet: <S
|
1
|
+
import type { StyleSheetWithSuperPowers } from './types';
|
2
|
+
export declare const createStyleSheet: <S extends StyleSheetWithSuperPowers>(stylesheet: S) => S;
|
3
3
|
//# sourceMappingURL=createStyleSheet.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"createStyleSheet.d.ts","sourceRoot":"","sources":["../../../src/createStyleSheet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,eAAO,MAAM,gBAAgB,2DAAwE,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/global.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;CAAG;AACnC,MAAM,WAAW,oBAAoB;IAEjC,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,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
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;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
export declare const useUnistyles: () => {
|
2
|
+
plugins: string[];
|
2
3
|
theme: never;
|
3
4
|
layout: {
|
4
5
|
breakpoint: keyof import("..").UnistylesBreakpoints;
|
5
|
-
orientation:
|
6
|
+
orientation: "landscape" | "portrait";
|
6
7
|
screenSize: {
|
7
8
|
width: number;
|
8
9
|
height: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY
|
1
|
+
{"version":3,"file":"useUnistyles.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useUnistyles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,YAAY;;;;;;;;;;;CAgDxB,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useVariants.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useVariants.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,eAAO,MAAM,WAAW,iBAAkB,OAAO,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,+CAMzE,CAAA"}
|
@@ -1,15 +1,61 @@
|
|
1
1
|
import { mq } from './utils';
|
2
2
|
import { useInitialTheme } from './hooks';
|
3
|
+
import type { UnistylesPlugin } from './types';
|
3
4
|
import type { UnistylesThemes, UnistylesBreakpoints } from './global';
|
4
5
|
import { ScreenOrientation } from './common';
|
5
6
|
import { useStyles } from './useStyles';
|
6
7
|
import { createStyleSheet } from './createStyleSheet';
|
7
8
|
declare const UnistylesRegistry: {
|
8
|
-
addThemes: (themes: UnistylesThemes) =>
|
9
|
-
|
10
|
-
|
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
|
+
};
|
11
57
|
};
|
12
|
-
declare const UnistylesRuntime: import("./core
|
58
|
+
declare const UnistylesRuntime: import("./core").UnistylesRuntime;
|
13
59
|
export { mq, useStyles, useInitialTheme, createStyleSheet, ScreenOrientation, UnistylesRegistry, UnistylesRuntime };
|
14
|
-
export type { UnistylesThemes, UnistylesBreakpoints };
|
60
|
+
export type { UnistylesThemes, UnistylesBreakpoints, UnistylesPlugin };
|
15
61
|
//# sourceMappingURL=index.d.ts.map
|
@@ -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,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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalizeWebStylesPlugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/normalizeWebStylesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG/C,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAA"}
|