react-native-unistyles 3.0.0-alpha.41 → 3.0.0-alpha.42
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +7 -1
- package/cxx/common/Constants.h +0 -1
- package/cxx/core/UnistylesRegistry.cpp +10 -4
- package/cxx/core/UnistylesRegistry.h +1 -1
- package/cxx/hybridObjects/HybridShadowRegistry.cpp +2 -2
- package/cxx/parser/Parser.cpp +7 -22
- package/cxx/parser/Parser.h +0 -1
- package/lib/commonjs/components/Display.js +2 -2
- package/lib/commonjs/components/Display.js.map +1 -1
- package/lib/commonjs/components/Hide.js +2 -2
- package/lib/commonjs/components/Hide.js.map +1 -1
- package/lib/commonjs/components/Pressable.js +64 -0
- package/lib/commonjs/components/Pressable.js.map +1 -0
- package/lib/commonjs/components/Pressable.web.js +97 -0
- package/lib/commonjs/components/Pressable.web.js.map +1 -0
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/core/getBoundArgs.js +18 -0
- package/lib/commonjs/core/getBoundArgs.js.map +1 -0
- package/lib/commonjs/core/getId.js +9 -0
- package/lib/commonjs/core/getId.js.map +1 -0
- package/lib/commonjs/core/index.js +14 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/commonjs/hooks/index.js +13 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useMedia.js.map +1 -0
- package/lib/commonjs/hooks/useMedia.web.js.map +1 -0
- package/lib/commonjs/index.js +8 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mq.js +6 -6
- package/lib/commonjs/mq.js.map +1 -1
- package/lib/commonjs/specs/ShadowRegistry/index.js +3 -4
- package/lib/commonjs/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/commonjs/specs/StyleSheet/index.js.map +1 -1
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
- package/lib/commonjs/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/commonjs/specs/index.web.js +0 -7
- package/lib/commonjs/specs/index.web.js.map +1 -1
- package/lib/commonjs/utils.js +1 -1
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/commonjs/web/convert/types.js.map +1 -1
- package/lib/commonjs/web/convert/utils.js +1 -1
- package/lib/commonjs/web/convert/utils.js.map +1 -1
- package/lib/commonjs/web/create.js +4 -1
- package/lib/commonjs/web/create.js.map +1 -1
- package/lib/commonjs/web/index.js +7 -5
- package/lib/commonjs/web/index.js.map +1 -1
- package/lib/commonjs/web/listener.js.map +1 -1
- package/lib/commonjs/web/runtime.js +7 -7
- package/lib/commonjs/web/runtime.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +23 -16
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/utils/common.js +3 -3
- package/lib/commonjs/web/utils/common.js.map +1 -1
- package/lib/commonjs/web/utils/unistyle.js +2 -4
- package/lib/commonjs/web/utils/unistyle.js.map +1 -1
- package/lib/commonjs/web/variants/getVariants.js +1 -1
- package/lib/commonjs/web/variants/getVariants.js.map +1 -1
- package/lib/commonjs/web/variants/useVariants.js +1 -1
- package/lib/module/components/Display.js +1 -1
- package/lib/module/components/Display.js.map +1 -1
- package/lib/module/components/Hide.js +1 -1
- package/lib/module/components/Hide.js.map +1 -1
- package/lib/module/components/Pressable.js +58 -0
- package/lib/module/components/Pressable.js.map +1 -0
- package/lib/module/components/Pressable.web.js +91 -0
- package/lib/module/components/Pressable.web.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/core/getBoundArgs.js +13 -0
- package/lib/module/core/getBoundArgs.js.map +1 -0
- package/lib/module/core/getId.js +4 -0
- package/lib/module/core/getId.js.map +1 -0
- package/lib/module/core/index.js +2 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/hooks/index.js +4 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useMedia.js.map +1 -0
- package/lib/module/hooks/useMedia.web.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mq.js +6 -6
- package/lib/module/mq.js.map +1 -1
- package/lib/module/specs/ShadowRegistry/index.js +3 -4
- package/lib/module/specs/ShadowRegistry/index.js.map +1 -1
- package/lib/module/specs/StyleSheet/index.js.map +1 -1
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js +1 -2
- package/lib/module/specs/TurboUnistyles/NativeTurboUnistyles.js.map +1 -1
- package/lib/module/specs/index.web.js +0 -1
- package/lib/module/specs/index.web.js.map +1 -1
- package/lib/module/utils.js +1 -1
- package/lib/module/utils.js.map +1 -1
- package/lib/module/web/convert/types.js.map +1 -1
- package/lib/module/web/convert/utils.js +1 -1
- package/lib/module/web/convert/utils.js.map +1 -1
- package/lib/module/web/create.js +5 -2
- package/lib/module/web/create.js.map +1 -1
- package/lib/module/web/index.js +7 -3
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/listener.js.map +1 -1
- package/lib/module/web/runtime.js +8 -8
- package/lib/module/web/runtime.js.map +1 -1
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +24 -17
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/utils/common.js +1 -1
- package/lib/module/web/utils/common.js.map +1 -1
- package/lib/module/web/utils/unistyle.js +1 -2
- package/lib/module/web/utils/unistyle.js.map +1 -1
- package/lib/module/web/variants/getVariants.js +1 -1
- package/lib/module/web/variants/getVariants.js.map +1 -1
- package/lib/module/web/variants/useVariants.js +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +7 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Pressable.web.d.ts +13 -0
- package/lib/typescript/src/components/Pressable.web.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/core/getBoundArgs.d.ts +2 -0
- package/lib/typescript/src/core/getBoundArgs.d.ts.map +1 -0
- package/lib/typescript/src/core/getId.d.ts +2 -0
- package/lib/typescript/src/core/getId.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 -1
- package/lib/typescript/src/hooks/index.d.ts +2 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMedia.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMedia.web.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/NativePlatform/NativePlatform.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts +2 -2
- package/lib/typescript/src/specs/ShadowRegistry/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts +1 -0
- package/lib/typescript/src/specs/ShadowRegistry/types.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts +1 -1
- package/lib/typescript/src/specs/StyleSheet/UnistylesStyleSheet.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/StyleSheet/index.d.ts +3 -2
- package/lib/typescript/src/specs/StyleSheet/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts +1 -1
- package/lib/typescript/src/specs/UnistylesRuntime/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/index.web.d.ts +0 -2
- package/lib/typescript/src/specs/index.web.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +1 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/types.d.ts +1 -1
- package/lib/typescript/src/web/convert/types.d.ts.map +1 -1
- package/lib/typescript/src/web/create.d.ts +1 -1
- package/lib/typescript/src/web/create.d.ts.map +1 -1
- package/lib/typescript/src/web/index.d.ts +8 -2
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -1
- package/lib/typescript/src/web/runtime.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/common.d.ts +1 -1
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts +0 -1
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -1
- package/package.json +12 -16
- package/plugin/common.js +1 -4
- package/plugin/import.js +29 -3
- package/plugin/index.js +18 -8
- package/plugin/ref.js +14 -74
- package/plugin/style.js +117 -63
- package/src/components/Display.tsx +1 -1
- package/src/components/Hide.tsx +1 -1
- package/src/components/Pressable.tsx +72 -0
- package/src/components/Pressable.web.tsx +103 -0
- package/src/components/index.ts +1 -0
- package/src/core/getBoundArgs.ts +15 -0
- package/src/core/getId.ts +1 -0
- package/src/core/index.ts +2 -0
- package/src/hooks/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/mq.ts +6 -6
- package/src/specs/NativePlatform/NativePlatform.nitro.ts +1 -1
- package/src/specs/ShadowRegistry/index.ts +5 -6
- package/src/specs/ShadowRegistry/types.ts +2 -1
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
- package/src/specs/StyleSheet/index.ts +3 -2
- package/src/specs/TurboUnistyles/NativeTurboUnistyles.ts +1 -2
- package/src/specs/UnistylesRuntime/UnistylesRuntime.nitro.ts +1 -1
- package/src/specs/UnistylesRuntime/index.ts +1 -1
- package/src/specs/index.web.ts +0 -4
- package/src/types/common.ts +1 -0
- package/src/types/index.ts +1 -1
- package/src/utils.ts +1 -1
- package/src/web/convert/types.ts +1 -1
- package/src/web/convert/utils.ts +2 -2
- package/src/web/create.ts +6 -2
- package/src/web/index.ts +7 -3
- package/src/web/listener.ts +2 -0
- package/src/web/registry.ts +1 -1
- package/src/web/runtime.ts +9 -9
- package/src/web/shadowRegistry.ts +2 -2
- package/src/web/state.ts +36 -17
- package/src/web/utils/common.ts +1 -1
- package/src/web/utils/unistyle.ts +3 -9
- package/src/web/variants/getVariants.ts +1 -1
- package/src/web/variants/useVariants.ts +1 -1
- package/lib/commonjs/components/useMedia.js.map +0 -1
- package/lib/commonjs/components/useMedia.web.js.map +0 -1
- package/lib/module/components/useMedia.js.map +0 -1
- package/lib/module/components/useMedia.web.js.map +0 -1
- package/lib/typescript/src/components/useMedia.d.ts.map +0 -1
- package/lib/typescript/src/components/useMedia.web.d.ts.map +0 -1
- /package/lib/commonjs/{components → hooks}/useMedia.js +0 -0
- /package/lib/commonjs/{components → hooks}/useMedia.web.js +0 -0
- /package/lib/module/{components → hooks}/useMedia.js +0 -0
- /package/lib/module/{components → hooks}/useMedia.web.js +0 -0
- /package/lib/typescript/src/{components → hooks}/useMedia.d.ts +0 -0
- /package/lib/typescript/src/{components → hooks}/useMedia.web.d.ts +0 -0
- /package/src/{components → hooks}/useMedia.ts +0 -0
- /package/src/{components → hooks}/useMedia.web.ts +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNativeNitroModules","require","_reactNative","HybridUnistylesStyleSheet","NitroModules","createHybridObject","absoluteFillObject","NativeStyleSheet","absoluteFill","flatten","compose","jsMethods","processColor","init","StyleSheet","exports"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_reactNative","HybridUnistylesStyleSheet","NitroModules","createHybridObject","absoluteFillObject","NativeStyleSheet","absoluteFill","flatten","compose","jsMethods","processColor","init","StyleSheet","exports"],"sourceRoot":"../../../../src","sources":["specs/StyleSheet/index.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAiCA,MAAME,yBAAyB,GAAGC,qCAAY,CACzCC,kBAAkB,CAAsB,qBAAqB,CAAC;AAEnEF,yBAAyB,CAACG,kBAAkB,GAAGC,uBAAgB,CAACD,kBAAkB;AAClFH,yBAAyB,CAACK,YAAY,GAAGD,uBAAgB,CAACC,YAAY;AACtEL,yBAAyB,CAACM,OAAO,GAAGF,uBAAgB,CAACE,OAAO;AAC5DN,yBAAyB,CAACO,OAAO,GAAGH,uBAAgB,CAACG,OAAO;AAC5DP,yBAAyB,CAACQ,SAAS,GAAG;EAClCC,YAAY,EAAZA;AACJ,CAAC;AAEDT,yBAAyB,CAACU,IAAI,CAAC,CAAC;AAIzB,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAGX,yBAAsE","ignoreList":[]}
|
@@ -1,8 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _reactNative = require("react-native");
|
4
|
-
// this is empty spec for TurboModule that is required to hook
|
5
|
-
// Unistyles to Fabric
|
4
|
+
// this is empty spec for TurboModule that is required to hook Unistyles to Fabric
|
6
5
|
|
7
6
|
_reactNative.TurboModuleRegistry.get('Unistyles');
|
8
7
|
//# sourceMappingURL=NativeTurboUnistyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","TurboModuleRegistry","get"],"sourceRoot":"../../../../src","sources":["specs/TurboUnistyles/NativeTurboUnistyles.ts"],"mappings":";;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA
|
1
|
+
{"version":3,"names":["_reactNative","require","TurboModuleRegistry","get"],"sourceRoot":"../../../../src","sources":["specs/TurboUnistyles/NativeTurboUnistyles.ts"],"mappings":";;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA;;AAGAC,gCAAmB,CAACC,GAAG,CAAO,WAAW,CAAC","ignoreList":[]}
|
@@ -3,14 +3,9 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
var _exportNames = {
|
7
|
-
getSSRUnistyles: true
|
8
|
-
};
|
9
|
-
exports.getSSRUnistyles = void 0;
|
10
6
|
var _web = require("../web");
|
11
7
|
Object.keys(_web).forEach(function (key) {
|
12
8
|
if (key === "default" || key === "__esModule") return;
|
13
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
14
9
|
if (key in exports && exports[key] === _web[key]) return;
|
15
10
|
Object.defineProperty(exports, key, {
|
16
11
|
enumerable: true,
|
@@ -19,6 +14,4 @@ Object.keys(_web).forEach(function (key) {
|
|
19
14
|
}
|
20
15
|
});
|
21
16
|
});
|
22
|
-
const getSSRUnistyles = () => [];
|
23
|
-
exports.getSSRUnistyles = getSSRUnistyles;
|
24
17
|
//# sourceMappingURL=index.web.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_web","require","Object","keys","forEach","key","
|
1
|
+
{"version":3,"names":["_web","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../src","sources":["specs/index.web.ts"],"mappings":";;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,IAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,IAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,IAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/lib/commonjs/utils.js
CHANGED
@@ -10,7 +10,7 @@ const deepMergeObjects = (...sources) => {
|
|
10
10
|
Object.keys(source).forEach(key => {
|
11
11
|
const sourceValue = source[key];
|
12
12
|
const targetValue = target[key];
|
13
|
-
if (Object(sourceValue)
|
13
|
+
if (Object(sourceValue) === sourceValue && Object(targetValue) === targetValue) {
|
14
14
|
// @ts-expect-error - can't assign to generic
|
15
15
|
target[key] = deepMergeObjects(targetValue, sourceValue);
|
16
16
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deepMergeObjects","sources","target","forEach","source","Object","keys","key","sourceValue","targetValue","exports"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CAACE,OAAO,CAACC,MAAM,IAAI;IACtBC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACD,OAAO,CAACI,GAAG,IAAI;MAC/B,MAAMC,WAAW,GAAGJ,MAAM,CAACG,GAAG,CAAC;MAC/B,MAAME,WAAW,GAAGP,MAAM,CAACK,GAAG,CAAC;MAE/B,IAAIF,MAAM,CAACG,WAAW,CAAC,
|
1
|
+
{"version":3,"names":["deepMergeObjects","sources","target","forEach","source","Object","keys","key","sourceValue","targetValue","exports"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CAACE,OAAO,CAACC,MAAM,IAAI;IACtBC,MAAM,CAACC,IAAI,CAACF,MAAM,CAAC,CAACD,OAAO,CAACI,GAAG,IAAI;MAC/B,MAAMC,WAAW,GAAGJ,MAAM,CAACG,GAAG,CAAC;MAC/B,MAAME,WAAW,GAAGP,MAAM,CAACK,GAAG,CAAC;MAE/B,IAAIF,MAAM,CAACG,WAAW,CAAC,KAAKA,WAAW,IAAIH,MAAM,CAACI,WAAW,CAAC,KAAKA,WAAW,EAAE;QAC5E;QACAP,MAAM,CAACK,GAAG,CAAC,GAAGP,gBAAgB,CAACS,WAAW,EAAED,WAAW,CAAC;QAExD;MACJ;;MAEA;MACAN,MAAM,CAACK,GAAG,CAAC,GAAGC,WAAW;IAC7B,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAON,MAAM;AACjB,CAAC;AAAAQ,OAAA,CAAAV,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["TEXT_SHADOW_STYLES","exports","BOX_SHADOW_STYLES"],"sourceRoot":"../../../../src","sources":["web/convert/types.ts"],"mappings":";;;;;;
|
1
|
+
{"version":3,"names":["TEXT_SHADOW_STYLES","exports","BOX_SHADOW_STYLES"],"sourceRoot":"../../../../src","sources":["web/convert/types.ts"],"mappings":";;;;;;AAMO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,CAAU;AAI/F,MAAME,iBAAiB,GAAAD,OAAA,CAAAC,iBAAA,GAAG,CAAC,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,CAAU","ignoreList":[]}
|
@@ -35,7 +35,7 @@ const normalizeColor = (color, opacity = 1) => {
|
|
35
35
|
}
|
36
36
|
const hex = integer.toString(16).padStart(8, '0');
|
37
37
|
if (hex.length === 8) {
|
38
|
-
const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num));
|
38
|
+
const [r = 0, g = 0, b = 0, a = 1] = hex.split(/(?=(?:..)*$)/).map(x => Number.parseInt(x, 16)).filter(num => !Number.isNaN(num));
|
39
39
|
return `rgba(${r},${g},${b},${a / 255 * opacity})`;
|
40
40
|
}
|
41
41
|
return color;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","_types","e","__esModule","default","isTransform","key","value","Array","isArray","exports","isTextShadow","TEXT_SHADOW_STYLES","includes","isShadow","BOX_SHADOW_STYLES","isFilter","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","normalizeColors","hex","toString","padStart","length","r","g","b","a","split","map","x","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAiH,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAHjH;AACA;;AAMO,MAAMG,WAAW,GAAGA,CAACC,GAAW,EAAEC,KAAU,KAAsCD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAAAG,OAAA,CAAAL,WAAA,GAAAA,WAAA;AAE7H,MAAMM,YAAY,GAAIL,GAAW,IAAKM,yBAAkB,CAACC,QAAQ,CAACP,GAAwC,CAAC;AAAAI,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAE3G,MAAMG,QAAQ,GAAIR,GAAW,IAAKS,wBAAiB,CAACF,QAAQ,CAACP,GAAuC,CAAC;AAAAI,OAAA,CAAAI,QAAA,GAAAA,QAAA;AAErG,MAAME,QAAQ,GAAGA,CAACV,GAAW,EAAEC,KAAU,KAA8BD,GAAG,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAAAG,OAAA,CAAAM,QAAA,GAAAA,QAAA;AAE/G,MAAMC,WAAW,GAAGA,CAACX,GAAW,EAAEC,KAAU,KAAqCD,GAAG,KAAK,WAAW,IAAIE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAAAG,OAAA,CAAAO,WAAA,GAAAA,WAAA;AAE5H,MAAMC,qBAAqB,GAAIX,KAAsB,IAAKA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAAG,GAAGA,KAAK,IAAI,GAAGA,KAAK;AAAAG,OAAA,CAAAQ,qBAAA,GAAAA,qBAAA;AAEnH,MAAMC,cAAc,GAAGA,CAACC,KAAa,EAAEC,OAAO,GAAG,CAAC,KAAK;EAC1D;EACA,IAAIA,OAAO,KAAK,CAAC,EAAE;IACf,OAAOD,KAAK;EAChB;EAEA,MAAME,OAAO,GAAG,IAAAC,wBAAe,EAACH,KAAK,CAAC;;EAEtC;EACA,IAAIE,OAAO,KAAK,IAAI,EAAE;IAClB,OAAOF,KAAK;EAChB;EAEA,MAAMI,GAAG,GAAGF,OAAO,CAACG,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;EAEjD,IAAIF,GAAG,CAACG,MAAM,KAAK,CAAC,EAAE;IAClB,MAAM,CAACC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAG,CAAC,CAAC,GAAGP,GAAG,CACnCQ,KAAK,CAAC,cAAc,CAAC,CACrBC,GAAG,CAACC,CAAC,IAAIC,QAAQ,
|
1
|
+
{"version":3,"names":["_normalizeColors","_interopRequireDefault","require","_types","e","__esModule","default","isTransform","key","value","Array","isArray","exports","isTextShadow","TEXT_SHADOW_STYLES","includes","isShadow","BOX_SHADOW_STYLES","isFilter","isBoxShadow","normalizeNumericValue","normalizeColor","color","opacity","integer","normalizeColors","hex","toString","padStart","length","r","g","b","a","split","map","x","Number","parseInt","filter","num","isNaN","extractShadowValue","breakpoint","styles","width","height"],"sourceRoot":"../../../../src","sources":["web/convert/utils.ts"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAiH,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAHjH;AACA;;AAMO,MAAMG,WAAW,GAAGA,C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
|
var _utils2 = require("../utils");
|
9
9
|
var _runtime = require("./runtime");
|
10
10
|
var _variants = require("./variants");
|
11
|
-
const create = stylesheet => {
|
11
|
+
const create = (stylesheet, id) => {
|
12
|
+
if (!id) {
|
13
|
+
throw (0, _utils.error)('Unistyles is not initialized correctly. Please add babel plugin to your babel config.');
|
14
|
+
}
|
12
15
|
const computedStylesheet = typeof stylesheet === 'function' ? stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime) : stylesheet;
|
13
16
|
const selectedVariants = new Map();
|
14
17
|
const copyVariants = () => Object.fromEntries(selectedVariants.entries());
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","_utils2","_runtime","_variants","create","stylesheet","computedStylesheet","UnistylesRuntime","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","assignSecrets","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","reduceObject","_key","String","dynamicStyle","result","variants","getVariants","resultWithVariants","deepMergeObjects","getStyles","createUseVariants","newVariants","forEach","set","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEO,MAAMI,MAAM,
|
1
|
+
{"version":3,"names":["_utils","require","_utils2","_runtime","_variants","create","stylesheet","id","error","computedStylesheet","UnistylesRuntime","theme","miniRuntime","selectedVariants","Map","copyVariants","Object","fromEntries","entries","addSecrets","value","key","args","assignSecrets","__uni__key","__uni__refs","Set","__uni__stylesheet","__uni__args","__uni__variants","styles","reduceObject","_key","String","dynamicStyle","result","variants","getVariants","resultWithVariants","deepMergeObjects","getStyles","createUseVariants","newVariants","forEach","set","exports"],"sourceRoot":"../../../src","sources":["web/create.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,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AAO,CAAC,EAAuCpB,YAAY,CAAC,CAAC,CAAC,CAAC;QACxH,MAAMuB,kBAAkB,GAAG,IAAAC,wBAAgB,EAACJ,MAAM,EAAEC,QAAQ,CAACf,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;;QAExE;QACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACF,kBAAkB,CAAC,EAAEjB,GAAG,EAAEC,IAAI,CAAC;MAC/D,CAAC;;MAED;MACA,OAAOH,UAAU,CAACe,YAAY,EAAEb,GAAG,CAAC;IACxC;;IAEA;IACA,OAAOF,UAAU,CAAC,IAAAqB,gBAAS,EAACpB,KAAK,CAAC,EAAEC,GAAG,CAAC;EAC5C,CAAC,CAAsC;;EAEvC;EACA,IAAAoB,2BAAiB,EAACX,MAAM,EAAEY,WAAW,IAAI1B,MAAM,CAACE,OAAO,CAACwB,WAAW,CAAC,CAACC,OAAO,CAAC,CAAC,CAACtB,GAAG,EAAED,KAAK,CAAC,KAAKP,gBAAgB,CAAC+B,GAAG,CAACvB,GAAG,EAAED,KAAK,CAAC,CAAC,CAAC;EAEjI,OAAOU,MAAM;AACjB,CAAC;AAAAe,OAAA,CAAAxC,MAAA,GAAAA,MAAA","ignoreList":[]}
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
var _exportNames = {
|
7
7
|
StyleSheet: true,
|
8
|
-
getSSRUnistyles: true,
|
9
8
|
UnistylesRuntime: true,
|
10
9
|
UnistylesShadowRegistry: true
|
11
10
|
};
|
@@ -22,7 +21,6 @@ Object.defineProperty(exports, "UnistylesShadowRegistry", {
|
|
22
21
|
return _shadowRegistry.UnistylesShadowRegistry;
|
23
22
|
}
|
24
23
|
});
|
25
|
-
exports.getSSRUnistyles = void 0;
|
26
24
|
var _create = require("./create");
|
27
25
|
var _state = require("./state");
|
28
26
|
var _utils = require("../utils");
|
@@ -50,11 +48,15 @@ const StyleSheet = exports.StyleSheet = {
|
|
50
48
|
right: 0,
|
51
49
|
bottom: 0
|
52
50
|
},
|
51
|
+
absoluteFillObject: {
|
52
|
+
position: 'absolute',
|
53
|
+
left: 0,
|
54
|
+
top: 0,
|
55
|
+
right: 0,
|
56
|
+
bottom: 0
|
57
|
+
},
|
53
58
|
compose: (a, b) => (0, _utils.deepMergeObjects)(a, b),
|
54
59
|
flatten: (...styles) => (0, _utils.deepMergeObjects)(...styles),
|
55
60
|
hairlineWidth: 1
|
56
61
|
};
|
57
|
-
// TODO: Work on SSR
|
58
|
-
const getSSRUnistyles = () => [];
|
59
|
-
exports.getSSRUnistyles = getSSRUnistyles;
|
60
62
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_create","require","_state","_utils","_runtime","_shadowRegistry","_mock","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","StyleSheet","configure","UnistylesState","init","create","absoluteFill","position","left","top","right","bottom","compose","a","b","deepMergeObjects","flatten","styles","hairlineWidth"
|
1
|
+
{"version":3,"names":["_create","require","_state","_utils","_runtime","_shadowRegistry","_mock","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","StyleSheet","configure","UnistylesState","init","create","absoluteFill","position","left","top","right","bottom","absoluteFillObject","compose","a","b","deepMergeObjects","flatten","styles","hairlineWidth"],"sourceRoot":"../../../src","sources":["web/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAwBA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAxBO,MAAMS,UAAU,GAAAJ,OAAA,CAAAI,UAAA,GAAG;EACtBC,SAAS,EAAEC,qBAAc,CAACC,IAAI;EAC9BC,MAAM,EAANA,cAAM;EACNC,YAAY,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDC,kBAAkB,EAAE;IAChBL,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,GAAG,EAAE,CAAC;IACNC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE;EACZ,CAAC;EACDE,OAAO,EAAEA,CAACC,CAAS,EAAEC,CAAS,KAAK,IAAAC,uBAAgB,EAACF,CAAC,EAAEC,CAAC,CAAC;EACzDE,OAAO,EAAEA,CAAC,GAAGC,MAAqB,KAAK,IAAAF,uBAAgB,EAAC,GAAGE,MAAM,CAAC;EAClEC,aAAa,EAAE;AACnB,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_NativePlatform","require","_runtime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","UnistyleDependency","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","UnistylesRuntime","darkMedia","addEventListener","event","matches","ColorScheme","hasAdaptiveThemes","Theme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener","exports"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,MAAME,wBAAwB,CAAC;EACnBC,aAAa,GAAG,KAAK;EACrBC,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,kCAAkB,CAAC,CAACH,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAII,GAAG,CAAe,CAAC,CAAC;EAC7GC,mBAAmB,GAAGP,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAEC,MAAM,CAACC,IAAI,CAACC,kCAAkB,CAAC,CAACH,MAAM,GAAG;EAAE,CAAC,EAAE,MAAM,IAAII,GAAG,CAAe,CAAC,CAAC;EAE/HE,UAAU,GAAIC,UAA8B,IAAK;IAC7C,IAAI,CAACF,mBAAmB,CAACE,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;IACrE,IAAI,CAACZ,SAAS,CAACU,UAAU,CAAC,EAAEC,OAAO,CAACC,QAAQ,IAAIA,QAAQ,CAAC,CAAC,CAAC;EAC/D,CAAC;EAEDC,aAAa,GAAGA,CAAA,KAAM;IAClB,IAAI,IAAI,CAACd,aAAa,EAAE;MACpB;IACJ;IAEA,IAAI,CAACA,aAAa,GAAG,IAAI;
|
1
|
+
{"version":3,"names":["_NativePlatform","require","_runtime","UnistylesListenerBuilder","isInitialized","listeners","Array","from","length","Object","keys","UnistyleDependency","Set","stylesheetListeners","emitChange","dependency","forEach","listener","initListeners","UnistylesRuntime","darkMedia","addEventListener","event","matches","ColorScheme","hasAdaptiveThemes","Theme","lightMedia","window","Orientation","Dimensions","addListeners","dependencies","add","delete","addStylesheetListeners","UnistylesListener","exports"],"sourceRoot":"../../../src","sources":["web/listener.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,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@ class UnistylesRuntimeBuilder {
|
|
130
130
|
};
|
131
131
|
}
|
132
132
|
setTheme = themeName => {
|
133
|
+
if (this.hasAdaptiveThemes) {
|
134
|
+
throw (0, _utils.error)(`You're trying to set theme to: '${themeName}', but adaptiveThemes are enabled.`);
|
135
|
+
}
|
133
136
|
if (themeName === UnistylesRuntime.themeName) {
|
134
137
|
return;
|
135
138
|
}
|
@@ -154,17 +157,14 @@ class UnistylesRuntimeBuilder {
|
|
154
157
|
updateTheme = (themeName, updater) => {
|
155
158
|
const oldTheme = _state.UnistylesState.themes.get(themeName);
|
156
159
|
if (!oldTheme) {
|
157
|
-
throw
|
160
|
+
throw (0, _utils.error)(`Unistyles: You're trying to update theme "${themeName}" but it wasn't registered.`);
|
158
161
|
}
|
159
162
|
_state.UnistylesState.themes.set(themeName, updater(oldTheme));
|
160
163
|
};
|
161
164
|
getTheme = (themeName = this.themeName) => {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
const theme = _state.UnistylesState.themes.get(themeName);
|
166
|
-
if (!theme) {
|
167
|
-
throw new Error(`🦄 Theme "${this.themeName}" is not registered!`);
|
165
|
+
const theme = _state.UnistylesState.themes.get(themeName ?? '');
|
166
|
+
if (!themeName || !theme) {
|
167
|
+
throw (0, _utils.error)(`You're trying to get theme "${themeName}" but it wasn't registered.`);
|
168
168
|
}
|
169
169
|
return theme;
|
170
170
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_NativePlatform","require","_types","_types2","_listener","_mock","_state","_utils","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","isServer","window","matchMedia","colorScheme","matches","ColorScheme","Light","Dark","Unspecified","themeName","UnistylesState","hasAdaptiveThemes","schemeToTheme","contentSizeCategory","WebContentSizeCategory","breakpoints","breakpoint","orientation","Orientation","Portrait","screen","type","includes","Landscape","theme","getTheme","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","StatusBar","rtl","document","documentElement","dir","navigationBar","NavigationBar","miniRuntime","isLandscape","isPortrait","setTheme","UnistylesRuntime","UnistylesListener","emitChange","UnistyleDependency","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","color","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","themes","get","
|
1
|
+
{"version":3,"names":["_NativePlatform","require","_types","_types2","_listener","_mock","_state","_utils","UnistylesRuntimeBuilder","lightMedia","getLightMedia","darkMedia","getDarkMedia","isServer","window","matchMedia","colorScheme","matches","ColorScheme","Light","Dark","Unspecified","themeName","UnistylesState","hasAdaptiveThemes","schemeToTheme","contentSizeCategory","WebContentSizeCategory","breakpoints","breakpoint","orientation","Orientation","Portrait","screen","type","includes","Landscape","theme","getTheme","pixelRatio","devicePixelRatio","width","height","innerWidth","innerHeight","fontScale","insets","top","bottom","left","right","ime","statusBar","StatusBar","rtl","document","documentElement","dir","navigationBar","NavigationBar","miniRuntime","isLandscape","isPortrait","setTheme","error","UnistylesRuntime","UnistylesListener","emitChange","UnistyleDependency","Theme","ThemeName","setAdaptiveThemes","isEnabled","setRootViewBackgroundColor","color","style","backgroundColor","setImmersiveMode","updateTheme","updater","oldTheme","themes","get","set","exports"],"sourceRoot":"../../../src","sources":["web/runtime.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,MAAMO,uBAAuB,CAAC;EAC1BC,UAAU,GAAG,IAAI,CAACC,aAAa,CAAC,CAAC;EACjCC,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;EAEvBF,aAAaA,CAAA,EAA0B;IAC3C,IAAI,IAAAG,eAAQ,EAAC,CAAC,EAAE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RegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","add","ref","_style","_variants","_args","secrets","extractSecrets","forEach","__uni__refs","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","styles","filter","style","Object","keys","some","key","startsWith","length","parsedStyles","flatMap","styleIndex","map","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","variants","args","result","variantsResult","fromEntries","getVariants","resultWithVariants","deepMergeObjects","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesListener","addListeners","hash","newComputedStyleSheet","newValue","applyStyles","convertUnistyles","combinedStyles","oldStyles","equal","oldClassNames","className","classList","set","existingHash","injectedClassNames","_web","_classNames","newClassNames","Array","isArray","concat","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAIA,MAAMM,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1CC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;;EAEQC,UAAU,GAAG,IAAIC,GAAG,CAA+B,CAAC;EACpDC,OAAO,GAAG,IAAID,GAAG,CAAsB,CAAC;EACxCE,aAAa,GAAG,IAAIF,GAAG,CAA6B,CAAC;EAE7DG,GAAG,GAAGA,CAACC,GAAQ,EAAEC,MAAoB,EAAEC,SAA0C,EAAEC,KAAwB,KAAK;IAC5G;IACA,IAAI,CAACF,MAAM,EAAE;MACT;IACJ;;IAEA;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AAiB,CAAC;MACxF,MAAMb,KAAK,GAAGgB,qBAAqB,CAACJ,UAAU,
|
1
|
+
{"version":3,"names":["_convert","require","_listener","_registry","_utils","_utils2","_variants2","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","Map","hashMap","classNamesMap","add","ref","_style","_variants","_args","secrets","extractSecrets","forEach","__uni__refs","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","styles","filter","style","Object","keys","some","key","startsWith","length","parsedStyles","flatMap","styleIndex","map","secret","__uni__key","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","variants","args","result","variantsResult","fromEntries","getVariants","resultWithVariants","deepMergeObjects","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesListener","addListeners","hash","newComputedStyleSheet","newValue","applyStyles","convertUnistyles","combinedStyles","oldStyles","equal","oldClassNames","className","classList","set","existingHash","injectedClassNames","_web","_classNames","newClassNames","Array","isArray","concat","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAIA,MAAMM,8BAA8B,CAAC;EACjC;EACAC,IAAI,GAAG,yBAAyB;EAChCC,MAAM,GAAG,KAAK;EACdC,MAAM,GAAGA,CAAA,KAAM,IAAI;EACnBC,QAAQ,GAAGA,CAAA,KAAM,yBAAyB;EAC1CC,OAAO,GAAGA,CAAA,KAAM,CAAC,CAAC;EAClB;;EAEQC,UAAU,GAAG,IAAIC,GAAG,CAA+B,CAAC;EACpDC,OAAO,GAAG,IAAID,GAAG,CAAsB,CAAC;EACxCE,aAAa,GAAG,IAAIF,GAAG,CAA6B,CAAC;EAE7DG,GA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ExC,MAAM;MAAEL,IAAI;MAAEY;IAAa,CAAC,GAAGhD,2BAAiB,CAACb,GAAG,CAACsD,cAAc,CAAC;IACpE,MAAMQ,kBAAkB,GAAGR,cAAc,EAAES,IAAI,EAAEC,WAAW,IAAI,EAAE;IAClE,MAAMC,aAAa,GAAG,CAACC,KAAK,CAACC,OAAO,CAACL,kBAAkB,CAAC,GAAGA,kBAAkB,GAAG,CAACA,kBAAkB,CAAC,EAAEM,MAAM,CAACnB,IAAI,CAAC;IAElH,IAAI,CAAClD,aAAa,CAAC6D,GAAG,CAAC3D,GAAG,EAAEgE,aAAa,CAAC;IAC1C;IACAhE,GAAG,CAAC0D,SAAS,CAAC3D,GAAG,CAAC,GAAGiE,aAAa,CAAC;;IAEnC;IACA,IAAI,CAACJ,YAAY,EAAE;MACf,IAAI,CAAC/D,OAAO,CAAC8D,GAAG,CAAC3D,GAAG,EAAEgD,IAAI,CAAC;IAC/B;IAEA,OAAOgB,aAAa;EACxB,CAAC;EAEDnD,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEO,MAAMuD,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAI/E,8BAA8B,CAAC,CAAC","ignoreList":[]}
|
@@ -19,7 +19,9 @@ class UnistylesStateBuilder {
|
|
19
19
|
init = config => {
|
20
20
|
this.initThemes(config.themes);
|
21
21
|
this.initBreakpoints(config.breakpoints);
|
22
|
-
|
22
|
+
if (config.settings) {
|
23
|
+
this.initSettings(config.settings);
|
24
|
+
}
|
23
25
|
if ((0, _utils.isServer)()) {
|
24
26
|
return;
|
25
27
|
}
|
@@ -32,31 +34,36 @@ class UnistylesStateBuilder {
|
|
32
34
|
};
|
33
35
|
initSettings = settings => {
|
34
36
|
this.hasAdaptiveThemes = settings?.adaptiveThemes ?? false;
|
35
|
-
|
36
|
-
|
37
|
-
// Single theme + no settings
|
38
|
-
if (!settings?.adaptiveThemes && !settings?.initialTheme && themeNames.length === 1) {
|
39
|
-
this.themeName = themeNames[0];
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
|
43
|
-
// No settings
|
44
|
-
if (!settings?.adaptiveThemes && !settings?.initialTheme) {
|
45
|
-
throw new Error('🦄 You need to specify either "initialTheme" or "adaptiveThemes" in your config');
|
37
|
+
if (settings.initialTheme && settings.adaptiveThemes) {
|
38
|
+
throw (0, _utils.error)('You\'re trying to set initial theme and enable adaptiveThemes, but these options are mutually exclusive.');
|
46
39
|
}
|
47
40
|
|
48
41
|
// Adaptive themes
|
49
42
|
if (settings.adaptiveThemes) {
|
43
|
+
if (!this.themes.get('light') || !this.themes.get('dark')) {
|
44
|
+
throw (0, _utils.error)(`You're trying to enable adaptiveThemes, but you didn't register both 'light' and 'dark' themes.`);
|
45
|
+
}
|
50
46
|
this.themeName = (0, _utils.schemeToTheme)(_runtime.UnistylesRuntime.colorScheme);
|
51
47
|
return;
|
52
48
|
}
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
if (settings.initialTheme) {
|
50
|
+
const initialTheme = typeof settings.initialTheme === 'function' ? settings.initialTheme() : settings.initialTheme;
|
51
|
+
if (!this.themes.get(initialTheme)) {
|
52
|
+
throw (0, _utils.error)(`You're trying to select theme "${initialTheme}" but it wasn't registered.`);
|
53
|
+
}
|
54
|
+
this.themeName = initialTheme;
|
55
|
+
}
|
56
56
|
};
|
57
57
|
initBreakpoints = (breakpoints = {}) => {
|
58
58
|
this.breakpoints = breakpoints;
|
59
|
-
Object.entries(breakpoints)
|
59
|
+
const breakpointsEntries = Object.entries(breakpoints);
|
60
|
+
if (breakpointsEntries.length === 0) {
|
61
|
+
throw (0, _utils.error)('StyleSheet.configure\'s breakpoints can\'t be empty.');
|
62
|
+
}
|
63
|
+
if (breakpointsEntries?.[0]?.[1] !== 0) {
|
64
|
+
throw (0, _utils.error)('StyleSheet.configure\'s first breakpoint must start from 0.');
|
65
|
+
}
|
66
|
+
breakpointsEntries.sort(([, a], [, b]) => a - b).forEach(([breakpoint, value]) => {
|
60
67
|
if ((0, _utils.isServer)()) {
|
61
68
|
return;
|
62
69
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_runtime","require","_utils","_listener","_NativePlatform","UnistylesStateBuilder","themes","Map","matchingBreakpoints","breakpoint","currentBreakpoint","Array","from","reverse","find","_key","value","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","
|
1
|
+
{"version":3,"names":["_runtime","require","_utils","_listener","_NativePlatform","UnistylesStateBuilder","themes","Map","matchingBreakpoints","breakpoint","currentBreakpoint","Array","from","reverse","find","_key","value","hasAdaptiveThemes","init","config","initThemes","initBreakpoints","breakpoints","settings","initSettings","isServer","UnistylesListener","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","initialTheme","error","get","schemeToTheme","UnistylesRuntime","colorScheme","breakpointsEntries","length","sort","a","b","mediaQuery","window","matchMedia","matches","addEventListener","event","emitChange","UnistyleDependency","Breakpoints","UnistylesState","exports"],"sourceRoot":"../../../src","sources":["web/state.ts"],"mappings":";;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAKA,MAAMI,qBAAqB,CAAC;EACxBC,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAGlCC,mBAAmB,GAAG,IAAID,GAAG,CAAkB,CAAC;EAExD,IAAIE,UAAUA,CAAA,EAAG;IACb,MAAM,CAACC,iBAAiB,CAAC,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACJ,mBAAmB,CAAC,CAC3DK,OAAO,CAAC,CAAC,CACTC,IAAI,CAAC,CAAC,CAACC,IAAI,EAAEC,KAAK,CAAC,KAAKA,KAAK,CAAC,IAAI,EAAE;IAEzC,OAAON,iBAAiB;EAC5B;EAIAO,iBAAiB,GAAG,KAAK;EAEzBC,IAAI,GAAIC,MAAuB,IAAK;IAChC,IAAI,CAACC,UA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0B,UAAU,CAACC,kCAAkB,CAACC,WAAW,CAAC;MAChE,CAAC,CAAC;IACN,CAAC,CAAC;EACV,CAAC;AACL;AAEO,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,IAAIlD,qBAAqB,CAAC,CAAC","ignoreList":[]}
|
@@ -3,15 +3,15 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.reduceObject = exports.keyInObject = exports.isServer = exports.hyphenate = exports.generateHash = exports.error = exports.equal = void 0;
|
7
7
|
const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
|
8
8
|
exports.reduceObject = reduceObject;
|
9
9
|
const keyInObject = (obj, key) => key in obj;
|
10
10
|
exports.keyInObject = keyInObject;
|
11
11
|
const isServer = () => typeof window === 'undefined';
|
12
12
|
exports.isServer = isServer;
|
13
|
-
const
|
14
|
-
exports.
|
13
|
+
const error = message => new Error(`Unistyles: ${message}`);
|
14
|
+
exports.error = error;
|
15
15
|
const equal = (a, b) => {
|
16
16
|
if (Object.is(a, b)) {
|
17
17
|
return true;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","exports","keyInObject","isServer","window","
|
1
|
+
{"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","exports","keyInObject","isServer","window","error","message","Error","equal","a","b","is","keysA","keys","length","every","prototype","hasOwnProperty","call","generateHash","str","JSON","stringify","hasher","charCodeAt","toString","hyphenate","propertyName","replace","m","toLowerCase"],"sourceRoot":"../../../../src","sources":["web/utils/common.ts"],"mappings":";;;;;;AAAO,MAAMA,YAAY,GAAGA,CACxBC,GAAS,EACTC,OAA+D,KAC9DC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACJ,GAAG,CAAC,CAACK,GAAG,CAAC,CAAC,CAACC,GAA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AAA,CAAAO,KAAA,GAAAA,KAAA;AAEM,MAAMW,YAAY,GAAInB,KAAU,IAAK;EACxC,MAAMoB,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACtB,KAAK,CAAC;EACjC,IAAIuB,MAAM,GAAG,IAAI;EACjB,IAAIT,MAAM,GAAGM,GAAG,CAACN,MAAM;EAEvB,OAAOA,MAAM,EAAE,EAAES,MAAM,GAAIA,MAAM,GAAG,EAAE,GAAIH,GAAG,CAACI,UAAU,CAACV,MAAM,CAAC;EAEhE,OAAO,aAAa,CAACS,MAAM,KAAK,CAAC,EAAEE,QAAQ,CAAC,EAAE,CAAC,EAAE;AACrD,CAAC;AAAAxB,OAAA,CAAAkB,YAAA,GAAAA,YAAA;AAEM,MAAMO,SAAS,GAAIC,YAAoB,IAAKA,YAAY,CAACC,OAAO,CAAC,QAAQ,EAAGC,CAAS,IAAK,IAAIA,CAAC,CAACC,WAAW,CAAC,CAAC,EAAE,CAAC;AAAA7B,OAAA,CAAAyB,SAAA,GAAAA,SAAA","ignoreList":[]}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.schemeToTheme = exports.isInDocument = exports.
|
6
|
+
exports.schemeToTheme = exports.isInDocument = exports.getStyles = exports.getMediaQuery = exports.extractUnistyleDependencies = exports.extractSecrets = exports.extractMediaQueryValue = exports.assignSecrets = void 0;
|
7
7
|
var _types = require("../../specs/types");
|
8
8
|
var _mq = require("../../mq");
|
9
9
|
var _state = require("../state");
|
@@ -18,8 +18,6 @@ const schemeToTheme = scheme => {
|
|
18
18
|
}
|
19
19
|
};
|
20
20
|
exports.schemeToTheme = schemeToTheme;
|
21
|
-
const hexToRGBA = (hex, opacity) => hex.replace('#', '').split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num)).reduce((acc, color) => `${acc}${color},`, 'rgba(').concat(`${opacity})`);
|
22
|
-
exports.hexToRGBA = hexToRGBA;
|
23
21
|
const assignSecrets = (object, secrets) => {
|
24
22
|
// @ts-expect-error - assign secrets to object
|
25
23
|
object[`__uni__secrets__${Math.random().toString(16).slice(2)}`] = secrets;
|
@@ -54,7 +52,7 @@ const extractMediaQueryValue = query => {
|
|
54
52
|
return undefined;
|
55
53
|
}
|
56
54
|
const value = Number(px);
|
57
|
-
return isNaN(value) ? undefined : value;
|
55
|
+
return Number.isNaN(value) ? undefined : value;
|
58
56
|
};
|
59
57
|
exports.extractMediaQueryValue = extractMediaQueryValue;
|
60
58
|
const getMediaQuery = query => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_types","require","_mq","_state","_common","schemeToTheme","scheme","ColorScheme","Dark","Light","exports","
|
1
|
+
{"version":3,"names":["_types","require","_mq","_state","_common","schemeToTheme","scheme","ColorScheme","Dark","Light","exports","assignSecrets","object","secrets","Math","random","toString","slice","extractSecrets","Object","entries","reduce","acc","key","value","startsWith","push","getStyles","values","returnValue","defineProperties","reduceObject","enumerable","configurable","isInDocument","element","document","body","contains","extractMediaQueryValue","query","_","px","match","undefined","Number","isNaN","getMediaQuery","Orientation","includes","isUnistylesMq","minWidth","maxWidth","minHeight","maxHeight","parseMq","filter","Boolean","join","UnistylesState","breakpoints","keyInObject","extractUnistyleDependencies","dependencies","uni__dependencies","Array","isArray"],"sourceRoot":"../../../../src","sources":["web/utils/unistyle.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEO,MAAMI,aAAa,GAAIC,MAAmB,IAAK;EAClD,QAAQA,MAAM;IACV,KAAKC,kBAAW,CAACC,IAAI;MACjB,OAAO,MAAM;IACjB,KAAKD,kBAAW,CAACE,KAAK;IACtB;MACI,OAAO,OAAO;EACtB;AACJ,CAAC;AAAAC,OAAA,CAAAL,aAAA,GAAAA,aAAA;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2BAA2B,GAAItC,KAAU,IAAK;EACvD,IAAI,CAACA,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EAEA,MAAMuC,YAAuC,GAAG,IAAAF,mBAAW,EAACrC,KAAK,EAAE,mBAAmB,CAAC,GAAGA,KAAK,CAACwC,iBAAiB,GAAG,EAAE;EAEtH,OAAOC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,GAAGA,YAAY,GAAG,EAAE;AAC1D,CAAC;AAAArD,OAAA,CAAAoD,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
@@ -15,7 +15,7 @@ const getVariants = (styles, selectedVariants) => {
|
|
15
15
|
}]) => {
|
16
16
|
const variantStyles = Object.entries(variants).flatMap(([variant, styles]) => {
|
17
17
|
const selectedVariant = selectedVariants[variant];
|
18
|
-
const selectedVariantStyles = styles[selectedVariant] ?? styles
|
18
|
+
const selectedVariantStyles = styles[selectedVariant] ?? styles.default;
|
19
19
|
if (!selectedVariantStyles) {
|
20
20
|
return [];
|
21
21
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/variants/getVariants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,MAAMC,WAAW,GAAsBC,KAAkB,IAAgD,UAAU,IAAIA,KAAK,CAAC,CAAC,CAAC;AAExH,MAAMC,WAAW,GAAGA,CAACC,MAAyC,EAAEC,gBAAqC,KAAK;EAC7G,OAAOC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CACxBI,MAAM,CAACP,WAAW,CAAC,CACnBO,MAAM,CAAC,CAAC,CAACC,IAAI,EAAE;IAAEC;EAAS,CAAC,CAAC,KAAKJ,MAAM,CAACK,IAAI,CAACD,QAAQ,CAAC,CAACE,IAAI,CAACC,OAAO,IAAIA,OAAO,IAAIH,QAAQ,CAAC,CAAC,CAC5FI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAE;IAAEL,QAAQ;IAAEM,gBAAgB,GAAG;EAAG,CAAC,CAAC,KAAK;IACjD,MAAMC,aAAa,GAAGX,MAAM,CAACC,OAAO,CAACG,QAAQ,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACL,OAAO,EAAET,MAAM,CAAC,KAAK;MAC1E,MAAMe,eAAe,GAAGd,gBAAgB,CAACQ,OAAO,CAAC;MACjD,MAAMO,qBAAqB,GAAGhB,MAAM,CAACe,eAAe,CAAC,IAAIf,MAAM,
|
1
|
+
{"version":3,"names":["_utils","require","hasVariants","value","getVariants","styles","selectedVariants","Object","entries","filter","_key","variants","keys","some","variant","map","key","compoundVariants","variantStyles","flatMap","selectedVariant","selectedVariantStyles","default","compoundVariantStyles","compoundVariant","conditions","String","mergedVariantStyles","deepMergeObjects","exports"],"sourceRoot":"../../../../src","sources":["web/variants/getVariants.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAQA,MAAMC,WAAW,GAAsBC,KAAkB,IAAgD,UAAU,IAAIA,KAAK,CAAC,CAAC,CAAC;AAExH,MAAMC,WAAW,GAAGA,CAACC,MAAyC,EAAEC,gBAAqC,KAAK;EAC7G,OAAOC,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CACxBI,MAAM,CAACP,WAAW,CAAC,CACnBO,MAAM,CAAC,CAAC,CAACC,IAAI,EAAE;IAAEC;EAAS,CAAC,CAAC,KAAKJ,MAAM,CAACK,IAAI,CAACD,QAAQ,CAAC,CAACE,IAAI,CAACC,OAAO,IAAIA,OAAO,IAAIH,QAAQ,CAAC,CAAC,CAC5FI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAE;IAAEL,QAAQ;IAAEM,gBAAgB,GAAG;EAAG,CAAC,CAAC,KAAK;IACjD,MAAMC,aAAa,GAAGX,MAAM,CAACC,OAAO,CAACG,QAAQ,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACL,OAAO,EAAET,MAAM,CAAC,KAAK;MAC1E,MAAMe,eAAe,GAAGd,gBAAgB,CAACQ,OAAO,CAAC;MACjD,MAAMO,qBAAqB,GAAGhB,MAAM,CAACe,eAAe,CAAC,IAAIf,MAAM,CAACiB,OAAO;MAEvE,IAAI,CAACD,qBAAqB,EAAE;QACxB,OAAO,EAAE;MACb;MAEA,OAAOA,qBAAqB;IAChC,CAAC,CAAC;IAEF,MAAME,qBAAqB,GAAGN,gBAAgB,CAACE,OAAO,CAACK,eAAe,IAAI;MACtE,MAAM;QAAEnB,MAAM;QAAE,GAAGoB;MAAW,CAAC,GAAGD,eAAe;MAEjD,IAAIjB,MAAM,CAACC,OAAO,CAACiB,UAAU,CAAC,CAACZ,IAAI,CAAC,CAAC,CAACC,OAAO,EAAEX,KAAK,CAAC,KAAKuB,MAAM,CAACpB,gBAAgB,CAACQ,OAAO,CAAC,CAAC,KAAKY,MAAM,CAACvB,KAAK,CAAC,CAAC,EAAE;QAC5G,OAAO,EAAE;MACb;MAEA,OAAOE,MAAM;IACjB,CAAC,CAAC;IAEF,MAAMsB,mBAAmB,GAAG,IAAAC,uBAAgB,EAAC,GAAGV,aAAa,EAAE,GAAGK,qBAAqB,CAAC;IAExF,OAAO,CAACP,GAAG,EAAEW,mBAAmB,CAAC;EACrC,CAAC,CAAC;AACV,CAAC;AAAAE,OAAA,CAAAzB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
@@ -11,7 +11,7 @@ const createUseVariants = (styles, setSelectedVariants) => {
|
|
11
11
|
const useVariants = selectedVariants => {
|
12
12
|
const [selectedVariantStylesMap] = (0, _react.useState)(() => new Map());
|
13
13
|
const lastSelectedVariantsRef = (0, _react.useRef)();
|
14
|
-
// Variable that determines if variants have changed and we need to recalculate styles
|
14
|
+
// Variable that determines if variants have changed, and we need to recalculate styles
|
15
15
|
const variantsChanged = !(0, _utils.equal)(lastSelectedVariantsRef.current, selectedVariants);
|
16
16
|
if (variantsChanged) {
|
17
17
|
lastSelectedVariantsRef.current = selectedVariants;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMedia","Display","children","props","isVisible"],"sourceRoot":"../../../src","sources":["components/Display.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,
|
1
|
+
{"version":3,"names":["useMedia","Display","children","props","isVisible"],"sourceRoot":"../../../src","sources":["components/Display.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,UAAU;AAInC,OAAO,MAAMC,OAA8C,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EACtF,MAAM;IAAEC;EAAU,CAAC,GAAGJ,QAAQ,CAACG,KAAK,CAAC;EAErC,OAAOC,SAAS,GACVF,QAAQ,GACR,IAAI;AACd,CAAC","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["useMedia","Hide","children","props","isVisible"],"sourceRoot":"../../../src","sources":["components/Hide.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,
|
1
|
+
{"version":3,"names":["useMedia","Hide","children","props","isVisible"],"sourceRoot":"../../../src","sources":["components/Hide.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,UAAU;AAInC,OAAO,MAAMC,IAAwC,GAAGA,CAAC;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,KAAK;EAChF,MAAM;IAAEC;EAAU,CAAC,GAAGJ,QAAQ,CAACG,KAAK,CAAC;EAErC,OAAO,CAACC,SAAS,GACXF,QAAQ,GACR,IAAI;AACd,CAAC","ignoreList":[]}
|