react-native-unistyles 2.0.0-alpha.9 → 2.0.0-beta.2
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 +16 -6
- 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/Unistyles.js +1 -1
- package/lib/commonjs/core/Unistyles.js.map +1 -1
- package/lib/commonjs/core/UnistylesModule.web.js +187 -0
- package/lib/commonjs/core/UnistylesModule.web.js.map +1 -0
- 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 +12 -9
- 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/Unistyles.js +2 -2
- package/lib/module/core/Unistyles.js.map +1 -1
- package/lib/module/core/UnistylesModule.web.js +180 -0
- package/lib/module/core/UnistylesModule.web.js.map +1 -0
- 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 +13 -10
- 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/UnistylesModule.web.d.ts +19 -0
- package/lib/typescript/src/core/UnistylesModule.web.d.ts.map +1 -0
- 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/Unistyles.ts +2 -2
- package/src/core/UnistylesModule.web.ts +214 -0
- 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 +12 -10
- 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
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.UnistyleRegistry = void 0;
|
7
|
+
var _common = require("../common");
|
8
|
+
var _plugins = require("../plugins");
|
7
9
|
class UnistyleRegistry {
|
8
10
|
config = {};
|
11
|
+
plugins = _common.isWeb ? [_plugins.normalizeWebStylesPlugin] : [];
|
9
12
|
themeNames = [];
|
10
13
|
themes = {};
|
11
14
|
breakpoints = {};
|
@@ -18,21 +21,80 @@ class UnistyleRegistry {
|
|
18
21
|
const keys = Object.keys(themes);
|
19
22
|
this.unistylesBridge.themes = keys;
|
20
23
|
this.themeNames = keys;
|
21
|
-
return
|
24
|
+
return {
|
25
|
+
addBreakpoints: this.addBreakpoints,
|
26
|
+
addConfig: this.addConfig
|
27
|
+
};
|
22
28
|
};
|
23
29
|
addBreakpoints = breakpoints => {
|
24
30
|
this.breakpoints = breakpoints;
|
25
31
|
this.unistylesBridge.useBreakpoints(breakpoints);
|
26
32
|
this.sortedBreakpointPairs = this.unistylesBridge.sortedBreakpointPairs;
|
27
|
-
return
|
33
|
+
return {
|
34
|
+
addThemes: this.addThemes,
|
35
|
+
addConfig: this.addConfig
|
36
|
+
};
|
28
37
|
};
|
29
38
|
addConfig = config => {
|
30
39
|
this.config = config;
|
31
40
|
if (config.adaptiveThemes) {
|
32
41
|
this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes);
|
33
42
|
}
|
34
|
-
|
43
|
+
if (config.experimentalPlugins) {
|
44
|
+
config.experimentalPlugins.forEach(plugin => this.addPlugin(plugin, false));
|
45
|
+
}
|
46
|
+
if (config.initialTheme) {
|
47
|
+
this.unistylesBridge.useTheme(config.initialTheme);
|
48
|
+
}
|
49
|
+
return {
|
50
|
+
addBreakpoints: this.addBreakpoints,
|
51
|
+
addThemes: this.addThemes
|
52
|
+
};
|
53
|
+
};
|
54
|
+
getTheme = forName => {
|
55
|
+
if (this.themeNames.length === 0) {
|
56
|
+
return {};
|
57
|
+
}
|
58
|
+
if (this.hasTheme(forName)) {
|
59
|
+
return this.themes[forName];
|
60
|
+
}
|
61
|
+
if (this.unistylesBridge.themeName) {
|
62
|
+
throw new Error(_common.UnistylesError.ThemeNotFound);
|
63
|
+
}
|
64
|
+
throw new Error(_common.UnistylesError.ThemeNotSelected);
|
65
|
+
};
|
66
|
+
addPlugin = (() => {
|
67
|
+
var _this = this;
|
68
|
+
return function (plugin) {
|
69
|
+
let notify = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
70
|
+
if (plugin.name.startsWith('__unistyles')) {
|
71
|
+
throw new Error(_common.UnistylesError.InvalidPluginName);
|
72
|
+
}
|
73
|
+
if (_this.plugins.some(_ref => {
|
74
|
+
let {
|
75
|
+
name
|
76
|
+
} = _ref;
|
77
|
+
return name === plugin.name;
|
78
|
+
})) {
|
79
|
+
throw new Error(_common.UnistylesError.DuplicatePluginName);
|
80
|
+
}
|
81
|
+
_this.plugins = [plugin].concat(_this.plugins);
|
82
|
+
_this.unistylesBridge.addPlugin(plugin.name, notify);
|
83
|
+
};
|
84
|
+
})();
|
85
|
+
removePlugin = plugin => {
|
86
|
+
if (plugin.name.startsWith('__unistyles')) {
|
87
|
+
throw new Error(_common.UnistylesError.CantRemoveInternalPlugin);
|
88
|
+
}
|
89
|
+
this.plugins = this.plugins.filter(_ref2 => {
|
90
|
+
let {
|
91
|
+
name
|
92
|
+
} = _ref2;
|
93
|
+
return name !== plugin.name;
|
94
|
+
});
|
95
|
+
this.unistylesBridge.removePlugin(plugin.name);
|
35
96
|
};
|
97
|
+
hasTheme = name => name in this.themes;
|
36
98
|
}
|
37
99
|
exports.UnistyleRegistry = UnistyleRegistry;
|
38
100
|
//# sourceMappingURL=UnistyleRegistry.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistyleRegistry","config","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","
|
1
|
+
{"version":3,"names":["_common","require","_plugins","UnistyleRegistry","config","plugins","isWeb","normalizeWebStylesPlugin","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","experimentalPlugins","forEach","plugin","addPlugin","initialTheme","useTheme","getTheme","forName","length","hasTheme","themeName","Error","UnistylesError","ThemeNotFound","ThemeNotSelected","_this","notify","arguments","undefined","name","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","concat","removePlugin","CantRemoveInternalPlugin","filter","_ref2","exports"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BC,aAAK,GACxC,CAACC,iCAAwB,CAAC,GAC1B,EAAE;EACDC,UAAU,GAAiC,EAAE;EAC7CC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,WAAW,GAAyB,CAAC,CAAC;EACtCC,qBAAqB,GAA0F,EAAE;EAExHC,WAAWA,CAASC,eAAgC,EAAE;IAAA,KAAlCA,eAAgC,GAAhCA,eAAgC;EAAG;EAEhDC,SAAS,GAAIL,MAAuB,IAAK;IAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;IAEpB,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACN,MAAM,CAAiC;IAEhE,IAAI,CAACI,eAAe,CAACJ,MAAM,GAAGM,IAAI;IAClC,IAAI,CAACP,U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jB,MAAM,CAACiB,IAAI;IAAA,EAAC;IACtE,IAAI,CAAC5B,eAAe,CAACmC,YAAY,CAACxB,MAAM,CAACiB,IAAI,CAAC;EAClD,CAAC;EAEMV,QAAQ,GAAIU,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAAChC,MAAM;AAC1E;AAAC2C,OAAA,CAAAjD,gBAAA,GAAAA,gBAAA"}
|
@@ -16,7 +16,7 @@ class Unistyles {
|
|
16
16
|
}
|
17
17
|
|
18
18
|
// @ts-ignore
|
19
|
-
this._bridge = global.__UNISTYLES__;
|
19
|
+
this._bridge = (_common.isWeb ? window : global).__UNISTYLES__;
|
20
20
|
this._registry = new _UnistyleRegistry.UnistyleRegistry(this._bridge);
|
21
21
|
this._runtime = new _UnistylesRuntime.UnistylesRuntime(this._bridge, this._registry);
|
22
22
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","UnistyleRegistry","_runtime","UnistylesRuntime","registry","runtime","unistyles","exports"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGC,gCAAe,EAAEC,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACF,WAAW,EAAE;MACd,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,
|
1
|
+
{"version":3,"names":["_UnistylesModule","require","_UnistylesRuntime","_UnistyleRegistry","_common","Unistyles","constructor","isInstalled","UnistylesModule","install","Error","UnistylesError","RuntimeUnavailable","_bridge","isWeb","window","global","__UNISTYLES__","_registry","UnistyleRegistry","_runtime","UnistylesRuntime","registry","runtime","unistyles","exports"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGC,gCAAe,EAAEC,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACF,WAAW,EAAE;MACd,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAG,CAACC,aAAK,GAAGC,MAAM,GAAGC,MAAM,EAAEC,aAAgC;IACzE,IAAI,CAACC,SAAS,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACN,OAAO,CAAC;IACnD,IAAI,CAACO,QAAQ,GAAG,IAAIC,kCAAgB,CAAC,IAAI,CAACR,OAAO,EAAE,IAAI,CAACK,SAAS,CAAC;EACtE;EAEA,IAAWI,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACJ,SAAS;EACzB;EAEA,IAAWK,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACH,QAAQ;EACxB;AACJ;AAEO,MAAMI,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,IAAInB,SAAS,CAAC,CAAC"}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.UnistylesModule = exports.UnistylesBridgeWeb = void 0;
|
7
|
+
var _reactNative = require("react-native");
|
8
|
+
var _plugins = require("../plugins");
|
9
|
+
class UnistylesBridgeWeb {
|
10
|
+
#timerRef = undefined;
|
11
|
+
#hasAdaptiveThemes = false;
|
12
|
+
#supportsAutomaticColorScheme = false;
|
13
|
+
#screenWidth = window.innerWidth;
|
14
|
+
#screenHeight = window.innerHeight;
|
15
|
+
#themes = [];
|
16
|
+
#colorScheme = this.getPreferredColorScheme();
|
17
|
+
#themeName = '';
|
18
|
+
#enabledPlugins = [_plugins.normalizeWebStylesPlugin.name];
|
19
|
+
#unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
|
20
|
+
#sortedBreakpointPairs = [];
|
21
|
+
#breakpoint = '';
|
22
|
+
constructor() {
|
23
|
+
this.setupListeners();
|
24
|
+
}
|
25
|
+
install() {
|
26
|
+
// @ts-ignore
|
27
|
+
window.__UNISTYLES__ = new Proxy({}, {
|
28
|
+
get: (_target, prop) => {
|
29
|
+
switch (prop) {
|
30
|
+
case 'themeName':
|
31
|
+
return this.getTheme();
|
32
|
+
case 'screenWidth':
|
33
|
+
return this.#screenWidth;
|
34
|
+
case 'screenHeight':
|
35
|
+
return this.#screenHeight;
|
36
|
+
case 'breakpoint':
|
37
|
+
return this.#breakpoint || undefined;
|
38
|
+
case 'hasAdaptiveThemes':
|
39
|
+
return this.#hasAdaptiveThemes;
|
40
|
+
case 'sortedBreakpointPairs':
|
41
|
+
return this.#sortedBreakpointPairs;
|
42
|
+
case 'enabledPlugins':
|
43
|
+
return this.#enabledPlugins;
|
44
|
+
case 'colorScheme':
|
45
|
+
return this.#colorScheme;
|
46
|
+
case 'useTheme':
|
47
|
+
return themeName => this.useTheme(themeName);
|
48
|
+
case 'useBreakpoints':
|
49
|
+
return breakpoints => this.useBreakpoints(breakpoints);
|
50
|
+
case 'useAdaptiveThemes':
|
51
|
+
return enable => this.useAdaptiveThemes(enable);
|
52
|
+
case 'addPlugin':
|
53
|
+
return (pluginName, notify) => this.addPlugin(pluginName, notify);
|
54
|
+
case 'removePlugin':
|
55
|
+
return pluginName => this.removePlugin(pluginName);
|
56
|
+
default:
|
57
|
+
return Reflect.get(this, prop);
|
58
|
+
}
|
59
|
+
},
|
60
|
+
set: (target, prop, newValue, receiver) => {
|
61
|
+
switch (prop) {
|
62
|
+
case 'themes':
|
63
|
+
{
|
64
|
+
this.#themes = newValue;
|
65
|
+
this.#supportsAutomaticColorScheme = newValue.includes('light') && newValue.includes('dark');
|
66
|
+
return true;
|
67
|
+
}
|
68
|
+
case 'themeName':
|
69
|
+
{
|
70
|
+
this.#themeName = newValue;
|
71
|
+
this.emitThemeChange();
|
72
|
+
return true;
|
73
|
+
}
|
74
|
+
default:
|
75
|
+
return Reflect.set(target, prop, newValue, receiver);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
});
|
79
|
+
return true;
|
80
|
+
}
|
81
|
+
useTheme(themeName) {
|
82
|
+
this.#themeName = themeName;
|
83
|
+
this.emitThemeChange();
|
84
|
+
}
|
85
|
+
useBreakpoints(breakpoints) {
|
86
|
+
this.#sortedBreakpointPairs = Object.entries(breakpoints).sort((_ref, _ref2) => {
|
87
|
+
let [, a] = _ref;
|
88
|
+
let [, b] = _ref2;
|
89
|
+
return (a ?? 0) - (b ?? 0);
|
90
|
+
});
|
91
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
92
|
+
}
|
93
|
+
useAdaptiveThemes(enable) {
|
94
|
+
this.#hasAdaptiveThemes = enable;
|
95
|
+
if (!this.#hasAdaptiveThemes || !this.#supportsAutomaticColorScheme) {
|
96
|
+
return;
|
97
|
+
}
|
98
|
+
if (this.#themeName !== this.#colorScheme) {
|
99
|
+
this.#themeName = this.#colorScheme;
|
100
|
+
this.emitThemeChange();
|
101
|
+
}
|
102
|
+
}
|
103
|
+
addPlugin(pluginName, notify) {
|
104
|
+
this.#enabledPlugins = [pluginName].concat(this.#enabledPlugins);
|
105
|
+
if (notify) {
|
106
|
+
this.emitPluginChange();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
removePlugin(pluginName) {
|
110
|
+
this.#enabledPlugins = this.#enabledPlugins.filter(name => name !== pluginName);
|
111
|
+
this.emitPluginChange();
|
112
|
+
}
|
113
|
+
getTheme() {
|
114
|
+
if (this.#themes.length === 1) {
|
115
|
+
return this.#themes.at(0);
|
116
|
+
}
|
117
|
+
return this.#themeName;
|
118
|
+
}
|
119
|
+
setupListeners() {
|
120
|
+
window.addEventListener('resize', () => {
|
121
|
+
clearTimeout(this.#timerRef);
|
122
|
+
this.#timerRef = setTimeout(() => {
|
123
|
+
this.#screenWidth = window.innerWidth;
|
124
|
+
this.#screenHeight = window.innerHeight;
|
125
|
+
this.#breakpoint = this.getBreakpointFromScreenWidth(this.#screenWidth);
|
126
|
+
this.emitLayoutChange();
|
127
|
+
}, 100);
|
128
|
+
});
|
129
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
130
|
+
this.#colorScheme = event.matches ? 'dark' : 'light';
|
131
|
+
if (!this.#supportsAutomaticColorScheme || !this.#hasAdaptiveThemes) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
if (this.#colorScheme !== this.#themeName) {
|
135
|
+
this.#themeName = this.#colorScheme;
|
136
|
+
this.emitThemeChange();
|
137
|
+
}
|
138
|
+
});
|
139
|
+
}
|
140
|
+
getBreakpointFromScreenWidth(width) {
|
141
|
+
const breakpoint = this.#sortedBreakpointPairs.find((_ref3, index, otherBreakpoints) => {
|
142
|
+
let [, value] = _ref3;
|
143
|
+
const minVal = value;
|
144
|
+
const maxVal = otherBreakpoints[index + 1]?.[1];
|
145
|
+
if (!maxVal) {
|
146
|
+
return true;
|
147
|
+
}
|
148
|
+
return width >= minVal && width < maxVal;
|
149
|
+
});
|
150
|
+
return breakpoint?.at(0);
|
151
|
+
}
|
152
|
+
getPreferredColorScheme() {
|
153
|
+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
154
|
+
return 'dark';
|
155
|
+
}
|
156
|
+
return 'light';
|
157
|
+
}
|
158
|
+
emitPluginChange() {
|
159
|
+
this.#unistylesEvents.emit('__unistylesOnChange', {
|
160
|
+
type: 'plugin'
|
161
|
+
});
|
162
|
+
}
|
163
|
+
emitThemeChange() {
|
164
|
+
this.#unistylesEvents.emit('__unistylesOnChange', {
|
165
|
+
type: 'theme',
|
166
|
+
payload: {
|
167
|
+
themeName: this.#themeName
|
168
|
+
}
|
169
|
+
});
|
170
|
+
}
|
171
|
+
emitLayoutChange() {
|
172
|
+
this.#unistylesEvents.emit('__unistylesOnChange', {
|
173
|
+
type: 'layout',
|
174
|
+
payload: {
|
175
|
+
breakpoint: this.#breakpoint,
|
176
|
+
orientation: this.#screenWidth > this.#screenHeight ? 'landscape' : 'portrait',
|
177
|
+
screen: {
|
178
|
+
width: this.#screenWidth,
|
179
|
+
height: this.#screenHeight
|
180
|
+
}
|
181
|
+
}
|
182
|
+
});
|
183
|
+
}
|
184
|
+
}
|
185
|
+
exports.UnistylesBridgeWeb = UnistylesBridgeWeb;
|
186
|
+
const UnistylesModule = exports.UnistylesModule = new UnistylesBridgeWeb();
|
187
|
+
//# sourceMappingURL=UnistylesModule.web.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_plugins","UnistylesBridgeWeb","timerRef","undefined","hasAdaptiveThemes","supportsAutomaticColorScheme","screenWidth","window","innerWidth","screenHeight","innerHeight","themes","colorScheme","getPreferredColorScheme","themeName","enabledPlugins","normalizeWebStylesPlugin","name","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","sortedBreakpointPairs","breakpoint","constructor","setupListeners","install","__UNISTYLES__","Proxy","get","_target","prop","getTheme","useTheme","breakpoints","useBreakpoints","enable","useAdaptiveThemes","pluginName","notify","addPlugin","removePlugin","Reflect","set","target","newValue","receiver","includes","emitThemeChange","Object","entries","sort","_ref","_ref2","a","b","getBreakpointFromScreenWidth","concat","emitPluginChange","filter","length","at","addEventListener","clearTimeout","setTimeout","emitLayoutChange","matchMedia","event","matches","width","find","_ref3","index","otherBreakpoints","value","minVal","maxVal","emit","type","payload","orientation","screen","height","exports","UnistylesModule"],"sourceRoot":"../../../src","sources":["core/UnistylesModule.web.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,kBAAkB,CAAC;EAC5B,CAACC,QAAQ,GAAmCC,SAAS;EACrD,CAACC,iBAAiB,GAAY,KAAK;EACnC,CAACC,4BAA4B,GAAG,KAAK;EACrC,CAACC,WAAW,GAAWC,MAAM,CAACC,UAAU;EACxC,CAACC,YAAY,GAAWF,MAAM,CAACG,WAAW;EAC1C,CAACC,MAAM,GAAiC,EAAE;EAC1C,CAACC,WAAW,GAAoB,IAAI,CAACC,uBAAuB,CAAC,CAAC;EAC9D,CAACC,SAAS,GAA0B,EAAE;EACtC,CAACC,cAAc,GAAkB,CAACC,iCAAwB,CAACC,IAAI,CAAC;EAChE,CAACC,eAAe,GAAG,IAAIC,+BAAkB,CAACC,0BAAa,CAACC,SAAS,CAAC;EAClE,CAACC,qBAAqB,GAAgD,EAAE;EACxE,CAACC,UAAU,GAA+B,EAAE;EAE5CC,WAAWA,CAAA,EAAG;IACV,IAAI,CAACC,cAAc,CAAC,CAAC;EACzB;EAEOC,OAAOA,CAAA,EAAG;IACb;IACAnB,MAAM,CAACoB,aAAa,GAAG,IAAIC,KAAK,CAAC,CAAC,CAAC,EAAE;MACjCC,GAAG,EAAEA,CAACC,OAAO,EAAEC,IAAI,KAAK;QACpB,QAAQA,IAAI;UACR,KAAK,WAAW;YACZ,OAAO,IAAI,CAACC,QAAQ,CAAC,CAAC;UAC1B,KAAK,aAAa;YACd,OAAO,IAAI,CAAC,CAAC1B,WAAW;UAC5B,KAAK,cAAc;YACf,OAAO,IAAI,CAAC,CAACG,YAAY;UAC7B,KAAK,YAAY;YACb,OAAO,IAAI,CAAC,CAACc,UAAU,IAAIpB,SAAS;UACxC,KAAK,mBAAmB;YACp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,CAAC,CAAC;EACN;EAEQmD,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC,CAAC/C,eAAe,CAAC2D,IAAI,CAAC,qBAAqB,EAAE;MAC9CC,IAAI,EAAE,QAAQ;MACdC,OAAO,EAAE;QACLxD,UAAU,EAAE,IAAI,CAAC,CAACA,UAAU;QAC5ByD,WAAW,EAAE,IAAI,CAAC,CAAC1E,WAAW,GAAG,IAAI,CAAC,CAACG,YAAY,GAC7C,WAAW,GACX,UAAU;QAChBwE,MAAM,EAAE;UACJZ,KAAK,EAAE,IAAI,CAAC,CAAC/D,WAAW;UACxB4E,MAAM,EAAE,IAAI,CAAC,CAACzE;QAClB;MACJ;IACJ,CAAC,CAAC;EACN;AACJ;AAAC0E,OAAA,CAAAlF,kBAAA,GAAAA,kBAAA;AAEM,MAAMmF,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,IAAInF,kBAAkB,CAAC,CAAC"}
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.UnistylesRuntime = void 0;
|
7
7
|
var _common = require("../common");
|
8
8
|
class UnistylesRuntime {
|
9
|
-
constructor(unistylesBridge,
|
9
|
+
constructor(unistylesBridge, unistylesRegistry) {
|
10
10
|
this.unistylesBridge = unistylesBridge;
|
11
|
-
this.
|
11
|
+
this.unistylesRegistry = unistylesRegistry;
|
12
12
|
}
|
13
13
|
get colorScheme() {
|
14
14
|
return this.unistylesBridge.colorScheme;
|
@@ -16,15 +16,15 @@ class UnistylesRuntime {
|
|
16
16
|
get hasAdaptiveThemes() {
|
17
17
|
return this.unistylesBridge.hasAdaptiveThemes;
|
18
18
|
}
|
19
|
-
get sortedBreakpoints() {
|
20
|
-
return this.registry.sortedBreakpointPairs;
|
21
|
-
}
|
22
19
|
get themeName() {
|
23
20
|
return this.unistylesBridge.themeName;
|
24
21
|
}
|
25
22
|
get breakpoint() {
|
26
23
|
return this.unistylesBridge.breakpoint;
|
27
24
|
}
|
25
|
+
get enabledPlugins() {
|
26
|
+
return this.unistylesBridge.enabledPlugins;
|
27
|
+
}
|
28
28
|
get screen() {
|
29
29
|
return {
|
30
30
|
width: this.unistylesBridge.screenWidth,
|
@@ -42,25 +42,24 @@ class UnistylesRuntime {
|
|
42
42
|
return _common.ScreenOrientation.Portrait;
|
43
43
|
}
|
44
44
|
setTheme = name => {
|
45
|
-
if (this.
|
45
|
+
if (name === this.themeName) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
if (this.unistylesRegistry.hasTheme(name)) {
|
46
49
|
this.unistylesBridge.useTheme(name);
|
47
50
|
return true;
|
48
51
|
}
|
49
52
|
throw new Error(_common.UnistylesError.ThemeNotRegistered);
|
50
53
|
};
|
51
|
-
getTheme = forName => {
|
52
|
-
if (this.registry.themeNames.length === 0) {
|
53
|
-
return {};
|
54
|
-
}
|
55
|
-
if (!this.hasTheme(forName)) {
|
56
|
-
throw new Error(_common.UnistylesError.ThemeNotFound);
|
57
|
-
}
|
58
|
-
return this.registry.themes[forName];
|
59
|
-
};
|
60
54
|
setAdaptiveThemes = enable => {
|
61
55
|
this.unistylesBridge.useAdaptiveThemes(enable);
|
62
56
|
};
|
63
|
-
|
57
|
+
addPlugin = plugin => {
|
58
|
+
this.unistylesRegistry.addPlugin(plugin);
|
59
|
+
};
|
60
|
+
removePlugin = plugin => {
|
61
|
+
this.unistylesRegistry.removePlugin(plugin);
|
62
|
+
};
|
64
63
|
}
|
65
64
|
exports.UnistylesRuntime = UnistylesRuntime;
|
66
65
|
//# sourceMappingURL=UnistylesRuntime.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","
|
1
|
+
{"version":3,"names":["_common","require","UnistylesRuntime","constructor","unistylesBridge","unistylesRegistry","colorScheme","hasAdaptiveThemes","themeName","breakpoint","enabledPlugins","screen","width","screenWidth","height","screenHeight","orientation","ScreenOrientation","Landscape","Portrait","setTheme","name","hasTheme","useTheme","Error","UnistylesError","ThemeNotRegistered","setAdaptiveThemes","enable","useAdaptiveThemes","addPlugin","plugin","removePlugin","exports"],"sourceRoot":"../../../src","sources":["core/UnistylesRuntime.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKO,MAAMC,gBAAgB,CAAC;EAC1BC,WAAWA,CAASC,eAAgC,EAAUC,iBAAmC,EAAE;IAAA,KAA/ED,eAAgC,GAAhCA,eAAgC;IAAA,KAAUC,iBAAmC,GAAnCA,iBAAmC;EAAG;EAEpG,IAAWC,WAAWA,CAAA,EAAG;IACrB,OAAO,IAAI,CAACF,eAAe,CAACE,WAAW;EAC3C;EAEA,IAAWC,iBAAiBA,CAAA,EAAG;IAC3B,OAAO,IAAI,CAACH,eAAe,CAACG,iBAAiB;EACjD;EAEA,IAAWC,SAASA,CAAA,EAAG;IACnB,OAAO,IAAI,CAACJ,eAAe,CAACI,SAAS;EACzC;EAEA,IAAWC,UAAUA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACL,eAAe,CAACK,UAAU;EAC1C;EAEA,IAAWC,cAAcA,CAAA,EAAG;IACxB,OAAO,IAAI,CAACN,eAAe,CAACM,cAAc;EAC9C;EAEA,IAAWC,MAAMA,CAAA,EAAG;IAChB,OAAO;MACHC,KAAK,EAAE,IAAI,CAACR,eAAe,CAACS,WAAW;MACvCC,MAAM,EAAE,IAAI,CAACV,eAAe,CAACW;IACjC,CAAC;EACL;EAEA,IAAWC,WAAWA,CAAA,EAAG;IACrB,MAAM;MAAEJ,KAAK;MAAEE;IAAO,CAAC,GAAG,IAAI,CAACH,MAAM;IAErC,IAAIC,KAAK,GAAGE,MAAM,EAAE;MAChB,OAAOG,yBAAiB,CAACC,SAAS;IACtC;IAEA,OAAOD,yBAAiB,CAACE,QAAQ;EACrC;EAEOC,QAAQ,GAAIC,IAA2B,IAAK;IAC/C,IAAIA,IAAI,KAAK,IAAI,CAACb,SAAS,EAAE;MACzB;IACJ;IAEA,IAAI,IAAI,CAACH,iBAAiB,CAACiB,QAAQ,CAACD,IAAI,CAAC,EAAE;MACvC,IAAI,CAACjB,eAAe,CAACmB,QAAQ,CAACF,IAAI,CAAC;MAEnC,OAAO,IAAI;IACf;IAEA,MAAM,IAAIG,KAAK,CAACC,sBAAc,CAACC,kBAAkB,CAAC;EACtD,CAAC;EAEMC,iBAAiB,GAAIC,MAAe,IAAK;IAC5C,IAAI,CAACxB,eAAe,CAACyB,iBAAiB,CAACD,MAAM,CAAC;EAClD,CAAC;EAEME,SAAS,GAAIC,MAAuB,IAAK;IAC5C,IAAI,CAAC1B,iBAAiB,CAACyB,SAAS,CAACC,MAAM,CAAC;EAC5C,CAAC;EAEMC,YAAY,GAAID,MAAuB,IAAK;IAC/C,IAAI,CAAC1B,iBAAiB,CAAC2B,YAAY,CAACD,MAAM,CAAC;EAC/C,CAAC;AACL;AAACE,OAAA,CAAA/B,gBAAA,GAAAA,gBAAA"}
|
@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createStyleSheet = void 0;
|
7
|
-
const createStyleSheet =
|
8
|
-
if (typeof styles === 'function') {
|
9
|
-
return styles;
|
10
|
-
}
|
11
|
-
return styles;
|
12
|
-
};
|
7
|
+
const createStyleSheet = stylesheet => stylesheet;
|
13
8
|
exports.createStyleSheet = createStyleSheet;
|
14
9
|
//# sourceMappingURL=createStyleSheet.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createStyleSheet","
|
1
|
+
{"version":3,"names":["createStyleSheet","stylesheet","exports"],"sourceRoot":"../../src","sources":["createStyleSheet.ts"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAyCC,UAAa,IAAQA,UAAU;AAAAC,OAAA,CAAAF,gBAAA,GAAAA,gBAAA"}
|
@@ -15,6 +15,13 @@ Object.defineProperty(exports, "useUnistyles", {
|
|
15
15
|
return _useUnistyles.useUnistyles;
|
16
16
|
}
|
17
17
|
});
|
18
|
+
Object.defineProperty(exports, "useVariants", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () {
|
21
|
+
return _useVariants.useVariants;
|
22
|
+
}
|
23
|
+
});
|
18
24
|
var _useInitialTheme = require("./useInitialTheme");
|
19
25
|
var _useUnistyles = require("./useUnistyles");
|
26
|
+
var _useVariants = require("./useVariants");
|
20
27
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_useInitialTheme","require","_useUnistyles"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_useInitialTheme","require","_useUnistyles","_useVariants"],"sourceRoot":"../../../src","sources":["hooks/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA"}
|
@@ -10,7 +10,8 @@ var _core = require("../core");
|
|
10
10
|
var _common = require("../common");
|
11
11
|
const unistylesEvents = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.Unistyles);
|
12
12
|
const useUnistyles = () => {
|
13
|
-
const [
|
13
|
+
const [plugins, setPlugins] = (0, _react.useState)(_core.unistyles.runtime.enabledPlugins);
|
14
|
+
const [theme, setTheme] = (0, _react.useState)(_core.unistyles.registry.getTheme(_core.unistyles.runtime.themeName));
|
14
15
|
const [layout, setLayout] = (0, _react.useState)({
|
15
16
|
breakpoint: _core.unistyles.runtime.breakpoint,
|
16
17
|
orientation: _core.unistyles.runtime.orientation,
|
@@ -20,25 +21,26 @@ const useUnistyles = () => {
|
|
20
21
|
}
|
21
22
|
});
|
22
23
|
(0, _react.useEffect)(() => {
|
23
|
-
const subscription = unistylesEvents.addListener('
|
24
|
+
const subscription = unistylesEvents.addListener('__unistylesOnChange', event => {
|
24
25
|
switch (event.type) {
|
25
|
-
case _common.
|
26
|
+
case _common.UnistylesEventType.Theme:
|
26
27
|
{
|
27
28
|
const themeEvent = event;
|
28
|
-
return setTheme(_core.unistyles.
|
29
|
+
return setTheme(_core.unistyles.registry.getTheme(themeEvent.payload.themeName));
|
29
30
|
}
|
30
|
-
case _common.
|
31
|
+
case _common.UnistylesEventType.Layout:
|
31
32
|
{
|
32
33
|
const layoutEvent = event;
|
33
34
|
return setLayout({
|
34
35
|
breakpoint: layoutEvent.payload.breakpoint,
|
35
36
|
orientation: layoutEvent.payload.orientation,
|
36
|
-
screenSize:
|
37
|
-
width: layoutEvent.payload.screen.width,
|
38
|
-
height: layoutEvent.payload.screen.height
|
39
|
-
}
|
37
|
+
screenSize: layoutEvent.payload.screen
|
40
38
|
});
|
41
39
|
}
|
40
|
+
case _common.UnistylesEventType.Plugin:
|
41
|
+
{
|
42
|
+
return setPlugins(_core.unistyles.runtime.enabledPlugins);
|
43
|
+
}
|
42
44
|
default:
|
43
45
|
return;
|
44
46
|
}
|
@@ -46,6 +48,7 @@ const useUnistyles = () => {
|
|
46
48
|
return subscription.remove;
|
47
49
|
}, []);
|
48
50
|
return {
|
51
|
+
plugins,
|
49
52
|
theme,
|
50
53
|
layout
|
51
54
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","
|
1
|
+
{"version":3,"names":["_reactNative","require","_react","_core","_common","unistylesEvents","NativeEventEmitter","NativeModules","Unistyles","useUnistyles","plugins","setPlugins","useState","unistyles","runtime","enabledPlugins","theme","setTheme","registry","getTheme","themeName","layout","setLayout","breakpoint","orientation","screenSize","width","screen","height","useEffect","subscription","addListener","event","type","UnistylesEventType","Theme","themeEvent","payload","Layout","layoutEvent","Plugin","remove","exports"],"sourceRoot":"../../../src","sources":["hooks/useUnistyles.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAA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W,CAACF,OAAO,CAACb,WAAW;cAC5CC,UAAU,EAAEc,WAAW,CAACF,OAAO,CAACV;YACpC,CAAC,CAAC;UACN;QACA,KAAKO,0BAAkB,CAACM,MAAM;UAAE;YAC5B,OAAO7B,UAAU,CAACE,eAAS,CAACC,OAAO,CAACC,cAAc,CAAC;UACvD;QACA;UACI;MACR;IACJ,CACJ,CAAC;IAED,OAAOe,YAAY,CAACW,MAAM;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IACH/B,OAAO;IACPM,KAAK;IACLK;EACJ,CAAC;AACL,CAAC;AAAAqB,OAAA,CAAAjC,YAAA,GAAAA,YAAA"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useVariants = void 0;
|
7
|
+
var _react = require("react");
|
8
|
+
const useVariants = variantsMap => {
|
9
|
+
const variantsRef = (0, _react.useRef)(variantsMap);
|
10
|
+
variantsRef.current = variantsMap;
|
11
|
+
return variantsRef.current;
|
12
|
+
};
|
13
|
+
exports.useVariants = useVariants;
|
14
|
+
//# sourceMappingURL=useVariants.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_react","require","useVariants","variantsMap","variantsRef","useRef","current","exports"],"sourceRoot":"../../../src","sources":["hooks/useVariants.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,WAAW,GAAIC,WAA8C,IAAK;EAC3E,MAAMC,WAAW,GAAG,IAAAC,aAAM,EAA6CF,WAAW,CAAC;EAEnFC,WAAW,CAACE,OAAO,GAAGH,WAAW;EAEjC,OAAOC,WAAW,CAACE,OAAO;AAC9B,CAAC;AAAAC,OAAA,CAAAL,WAAA,GAAAA,WAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_core","require","_utils","_hooks","_common","_useStyles","_createStyleSheet","UnistylesRegistry","exports","addThemes","unistyles","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;
|
1
|
+
{"version":3,"names":["_core","require","_utils","_hooks","_common","_useStyles","_createStyleSheet","UnistylesRegistry","exports","addThemes","unistyles","registry","addBreakpoints","addConfig","UnistylesRuntime","runtime"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAEA,MAAMM,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EACtBE,SAAS,EAAEC,eAAS,CAACC,QAAQ,CAACF,SAAS;EACvCG,cAAc,EAAEF,eAAS,CAACC,QAAQ,CAACC,cAAc;EACjDC,SAAS,EAAEH,eAAS,CAACC,QAAQ,CAACE;AAClC,CAAC;AAED,MAAMC,gBAAgB,GAAAN,OAAA,CAAAM,gBAAA,GAAGJ,eAAS,CAACK,OAAO"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "normalizeColor", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _normalizer.normalizeColor;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "normalizeNumericValue", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _normalizer.normalizeNumericValue;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "normalizeStyle", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () {
|
21
|
+
return _normalizer.normalizeStyle;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "normalizeWebStylesPlugin", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function () {
|
27
|
+
return _normalizeWebStylesPlugin.normalizeWebStylesPlugin;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
Object.defineProperty(exports, "preprocessor", {
|
31
|
+
enumerable: true,
|
32
|
+
get: function () {
|
33
|
+
return _normalizer.preprocessor;
|
34
|
+
}
|
35
|
+
});
|
36
|
+
var _normalizeWebStylesPlugin = require("./normalizeWebStylesPlugin");
|
37
|
+
var _normalizer = require("./normalizer");
|
38
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_normalizeWebStylesPlugin","require","_normalizer"],"sourceRoot":"../../../src","sources":["plugins/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.normalizeWebStylesPlugin = void 0;
|
7
|
+
var _normalizer = require("./normalizer");
|
8
|
+
const normalizeWebStylesPlugin = exports.normalizeWebStylesPlugin = {
|
9
|
+
name: '__unistylesNormalizeWebStyles',
|
10
|
+
onParsedStyle: (_key, styles) => (0, _normalizer.normalizeStyle)(styles)
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=normalizeWebStylesPlugin.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_normalizer","require","normalizeWebStylesPlugin","exports","name","onParsedStyle","_key","styles","normalizeStyle"],"sourceRoot":"../../../src","sources":["plugins/normalizeWebStylesPlugin.ts"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,wBAAyC,GAAAC,OAAA,CAAAD,wBAAA,GAAG;EACrDE,IAAI,EAAE,+BAA+B;EACrCC,aAAa,EAAEA,CAACC,IAAI,EAAEC,MAAM,KAAK,IAAAC,0BAAc,EAACD,MAAM;AAC1D,CAAC"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "normalizeColor", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _normalizer.normalizeColor;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "normalizeNumericValue", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _normalizer.normalizeNumericValue;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "normalizeStyle", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () {
|
21
|
+
return _normalizeStyle.normalizeStyle;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "preprocessor", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function () {
|
27
|
+
return _normalizer.preprocessor;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
var _normalizeStyle = require("./normalizeStyle");
|
31
|
+
var _normalizer = require("./normalizer");
|
32
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_normalizeStyle","require","_normalizer"],"sourceRoot":"../../../../src","sources":["plugins/normalizer/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA"}
|