react-native-unistyles 3.0.0-alpha.20 → 3.0.0-alpha.22
Sign up to get free protection for your applications and to get access to all the features.
- package/cxx/common/Constants.h +1 -0
- package/cxx/core/UnistyleWrapper.h +21 -41
- package/cxx/hybridObjects/HybridStyleSheet.cpp +1 -1
- package/cxx/hybridObjects/HybridStyleSheet.h +1 -1
- package/lib/commonjs/web/convert/boxShadow.js +13 -13
- package/lib/commonjs/web/convert/boxShadow.js.map +1 -1
- package/lib/commonjs/web/convert/index.js +9 -11
- package/lib/commonjs/web/convert/index.js.map +1 -1
- package/lib/commonjs/web/convert/pseudo.js.map +1 -0
- package/lib/commonjs/web/convert/style.js +11 -7
- package/lib/commonjs/web/convert/style.js.map +1 -1
- package/lib/commonjs/web/convert/textShadow.js +12 -12
- package/lib/commonjs/web/convert/textShadow.js.map +1 -1
- package/lib/commonjs/web/convert/transform.js +5 -5
- package/lib/commonjs/web/convert/transform.js.map +1 -1
- package/lib/commonjs/web/{listener/listener.js → listener.js} +2 -2
- package/lib/commonjs/web/listener.js.map +1 -0
- package/lib/commonjs/web/mq.js.map +1 -1
- package/lib/commonjs/web/registry.js +159 -21
- package/lib/commonjs/web/registry.js.map +1 -1
- package/lib/commonjs/web/shadowRegistry.js +50 -48
- package/lib/commonjs/web/shadowRegistry.js.map +1 -1
- package/lib/commonjs/web/state.js +8 -16
- package/lib/commonjs/web/state.js.map +1 -1
- package/lib/commonjs/web/{utils.js → utils/common.js} +9 -47
- package/lib/commonjs/web/utils/common.js.map +1 -0
- package/lib/commonjs/web/utils/index.js +28 -0
- package/lib/commonjs/web/utils/index.js.map +1 -0
- package/lib/commonjs/web/utils/unistyle.js +82 -0
- package/lib/commonjs/web/utils/unistyle.js.map +1 -0
- package/lib/module/web/convert/boxShadow.js +13 -13
- package/lib/module/web/convert/boxShadow.js.map +1 -1
- package/lib/module/web/convert/index.js +7 -9
- package/lib/module/web/convert/index.js.map +1 -1
- package/lib/module/web/convert/pseudo.js.map +1 -0
- package/lib/module/web/convert/style.js +11 -7
- package/lib/module/web/convert/style.js.map +1 -1
- package/lib/module/web/convert/textShadow.js +12 -12
- package/lib/module/web/convert/textShadow.js.map +1 -1
- package/lib/module/web/convert/transform.js +5 -5
- package/lib/module/web/convert/transform.js.map +1 -1
- package/lib/module/web/{listener/listener.js → listener.js} +2 -2
- package/lib/module/web/listener.js.map +1 -0
- package/lib/module/web/mq.js.map +1 -1
- package/lib/module/web/registry.js +160 -22
- package/lib/module/web/registry.js.map +1 -1
- package/lib/module/web/shadowRegistry.js +51 -49
- package/lib/module/web/shadowRegistry.js.map +1 -1
- package/lib/module/web/state.js +8 -16
- package/lib/module/web/state.js.map +1 -1
- package/lib/module/web/{utils.js → utils/common.js} +7 -39
- package/lib/module/web/utils/common.js.map +1 -0
- package/lib/module/web/utils/index.js +5 -0
- package/lib/module/web/utils/index.js.map +1 -0
- package/lib/module/web/utils/unistyle.js +69 -0
- package/lib/module/web/utils/unistyle.js.map +1 -0
- package/lib/typescript/expo-example/app/(tabs)/_layout.d.ts +3 -0
- package/lib/typescript/expo-example/app/(tabs)/_layout.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/(tabs)/explore.d.ts +3 -0
- package/lib/typescript/expo-example/app/(tabs)/explore.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/(tabs)/index.d.ts +3 -0
- package/lib/typescript/expo-example/app/(tabs)/index.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/+html.d.ts +4 -0
- package/lib/typescript/expo-example/app/+html.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/+not-found.d.ts +3 -0
- package/lib/typescript/expo-example/app/+not-found.d.ts.map +1 -0
- package/lib/typescript/expo-example/app/_layout.d.ts +3 -0
- package/lib/typescript/expo-example/app/_layout.d.ts.map +1 -0
- 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/types/stylesheet.d.ts +1 -1
- package/lib/typescript/src/types/stylesheet.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/boxShadow.d.ts +7 -2
- package/lib/typescript/src/web/convert/boxShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/index.d.ts +1 -2
- package/lib/typescript/src/web/convert/index.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/pseudo.d.ts.map +1 -0
- package/lib/typescript/src/web/convert/style.d.ts +1 -2
- package/lib/typescript/src/web/convert/style.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/textShadow.d.ts +7 -2
- package/lib/typescript/src/web/convert/textShadow.d.ts.map +1 -1
- package/lib/typescript/src/web/convert/transform.d.ts +1 -2
- package/lib/typescript/src/web/convert/transform.d.ts.map +1 -1
- package/lib/typescript/src/web/{listener/listener.d.ts → listener.d.ts} +1 -1
- package/lib/typescript/src/web/listener.d.ts.map +1 -0
- package/lib/typescript/src/web/mq.d.ts +6 -2
- package/lib/typescript/src/web/mq.d.ts.map +1 -1
- package/lib/typescript/src/web/registry.d.ts +21 -8
- package/lib/typescript/src/web/registry.d.ts.map +1 -1
- package/lib/typescript/src/web/shadowRegistry.d.ts +3 -4
- package/lib/typescript/src/web/shadowRegistry.d.ts.map +1 -1
- package/lib/typescript/src/web/state.d.ts +2 -2
- package/lib/typescript/src/web/state.d.ts.map +1 -1
- package/lib/typescript/src/web/{utils.d.ts → utils/common.d.ts} +2 -20
- package/lib/typescript/src/web/utils/common.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/index.d.ts +3 -0
- package/lib/typescript/src/web/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts +20 -0
- package/lib/typescript/src/web/utils/unistyle.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JColorScheme.hpp +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_UnistyleDependency_.hpp +8 -8
- package/nitrogen/generated/android/c++/JHybridNativePlatformSpec.cpp +22 -22
- package/nitrogen/generated/android/c++/JOrientation.hpp +1 -1
- package/nitrogen/generated/android/c++/JUnistyleDependency.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/unistyles/HybridNativePlatformSpec.kt +2 -2
- package/nitrogen/generated/android/{UnistylesOnLoad.cpp → unistylesOnLoad.cpp} +2 -2
- package/nitrogen/generated/android/{UnistylesOnLoad.hpp → unistylesOnLoad.hpp} +1 -1
- package/nitrogen/generated/ios/Unistyles+autolinking.rb +5 -3
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.cpp +25 -0
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Bridge.hpp +32 -32
- package/nitrogen/generated/ios/Unistyles-Swift-Cxx-Umbrella.hpp +0 -29
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpec.swift +0 -12
- package/nitrogen/generated/ios/swift/HybridNativePlatformSpecCxx.swift +134 -110
- package/nitrogen/generated/shared/c++/ColorScheme.hpp +2 -2
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridUnistylesStyleSheetSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/Orientation.hpp +2 -2
- package/package.json +4 -15
- package/src/specs/StyleSheet/UnistylesStyleSheet.nitro.ts +1 -1
- package/src/types/stylesheet.ts +1 -1
- package/src/web/convert/boxShadow.ts +14 -15
- package/src/web/convert/index.ts +6 -13
- package/src/web/convert/style.ts +61 -10
- package/src/web/convert/textShadow.ts +13 -14
- package/src/web/convert/transform.ts +7 -8
- package/src/web/{listener/listener.ts → listener.ts} +2 -2
- package/src/web/mq.ts +1 -3
- package/src/web/registry.ts +202 -23
- package/src/web/shadowRegistry.ts +49 -49
- package/src/web/state.ts +13 -23
- package/src/web/{utils.ts → utils/common.ts} +6 -68
- package/src/web/utils/index.ts +2 -0
- package/src/web/utils/unistyle.ts +104 -0
- package/lib/commonjs/web/convert/breakpoint.js +0 -25
- package/lib/commonjs/web/convert/breakpoint.js.map +0 -1
- package/lib/commonjs/web/createUnistylesComponent.js +0 -61
- package/lib/commonjs/web/createUnistylesComponent.js.map +0 -1
- package/lib/commonjs/web/listener/index.js +0 -20
- package/lib/commonjs/web/listener/index.js.map +0 -1
- package/lib/commonjs/web/listener/listenToDependencies.js +0 -38
- package/lib/commonjs/web/listener/listenToDependencies.js.map +0 -1
- package/lib/commonjs/web/listener/listener.js.map +0 -1
- package/lib/commonjs/web/pseudo.js.map +0 -1
- package/lib/commonjs/web/utils.js.map +0 -1
- package/lib/module/web/convert/breakpoint.js +0 -20
- package/lib/module/web/convert/breakpoint.js.map +0 -1
- package/lib/module/web/createUnistylesComponent.js +0 -54
- package/lib/module/web/createUnistylesComponent.js.map +0 -1
- package/lib/module/web/listener/index.js +0 -5
- package/lib/module/web/listener/index.js.map +0 -1
- package/lib/module/web/listener/listenToDependencies.js +0 -33
- package/lib/module/web/listener/listenToDependencies.js.map +0 -1
- package/lib/module/web/listener/listener.js.map +0 -1
- package/lib/module/web/pseudo.js.map +0 -1
- package/lib/module/web/utils.js.map +0 -1
- package/lib/typescript/src/web/convert/breakpoint.d.ts +0 -3
- package/lib/typescript/src/web/convert/breakpoint.d.ts.map +0 -1
- package/lib/typescript/src/web/createUnistylesComponent.d.ts +0 -3
- package/lib/typescript/src/web/createUnistylesComponent.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/index.d.ts +0 -3
- package/lib/typescript/src/web/listener/index.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/listenToDependencies.d.ts +0 -12
- package/lib/typescript/src/web/listener/listenToDependencies.d.ts.map +0 -1
- package/lib/typescript/src/web/listener/listener.d.ts.map +0 -1
- package/lib/typescript/src/web/pseudo.d.ts.map +0 -1
- package/lib/typescript/src/web/utils.d.ts.map +0 -1
- package/src/web/convert/breakpoint.ts +0 -21
- package/src/web/createUnistylesComponent.tsx +0 -54
- package/src/web/listener/index.ts +0 -2
- package/src/web/listener/listenToDependencies.ts +0 -45
- /package/lib/commonjs/web/{pseudo.js → convert/pseudo.js} +0 -0
- /package/lib/module/web/{pseudo.js → convert/pseudo.js} +0 -0
- /package/lib/typescript/src/web/{pseudo.d.ts → convert/pseudo.d.ts} +0 -0
- /package/nitrogen/generated/android/{UnistylesOnLoad.kt → unistylesOnLoad.kt} +0 -0
- /package/src/web/{pseudo.ts → convert/pseudo.ts} +0 -0
@@ -4,13 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.UnistylesRegistry = void 0;
|
7
|
-
var _typestyle = require("typestyle");
|
8
|
-
var _convert = require("./convert");
|
9
7
|
var _runtime = require("./runtime");
|
10
8
|
var _utils = require("./utils");
|
11
9
|
var _listener = require("./listener");
|
10
|
+
var _convert = require("./convert");
|
11
|
+
var _variants = require("./variants");
|
12
12
|
class UnistylesRegistryBuilder {
|
13
13
|
stylesheets = new Map();
|
14
|
+
stylesCounter = new Map();
|
15
|
+
#styleTag = null;
|
16
|
+
disposeListenersMap = new Map();
|
17
|
+
dependenciesMap = new Map();
|
18
|
+
get styleTag() {
|
19
|
+
const tag = this.#styleTag;
|
20
|
+
if (!tag) {
|
21
|
+
const newTag = document.createElement('style');
|
22
|
+
newTag.id = 'unistyles-web';
|
23
|
+
this.#styleTag = newTag;
|
24
|
+
document.head.appendChild(newTag);
|
25
|
+
return newTag;
|
26
|
+
}
|
27
|
+
return tag;
|
28
|
+
}
|
14
29
|
getComputedStylesheet = stylesheet => {
|
15
30
|
if (typeof stylesheet !== 'function') {
|
16
31
|
return stylesheet;
|
@@ -20,30 +35,153 @@ class UnistylesRegistryBuilder {
|
|
20
35
|
return computedStylesheet;
|
21
36
|
}
|
22
37
|
const createdStylesheet = stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime);
|
23
|
-
|
24
|
-
|
25
|
-
|
38
|
+
const dependencies = Object.values(createdStylesheet).flatMap(value => (0, _utils.extractUnistyleDependencies)(value));
|
39
|
+
this.addDependenciesToStylesheet(stylesheet, dependencies);
|
40
|
+
this.stylesheets.set(stylesheet, createdStylesheet);
|
41
|
+
return createdStylesheet;
|
42
|
+
};
|
43
|
+
addDependenciesToStylesheet = (stylesheet, dependencies) => {
|
44
|
+
this.disposeListenersMap.get(stylesheet)?.();
|
45
|
+
const dependenciesMap = this.dependenciesMap.get(stylesheet) ?? new Set(dependencies);
|
46
|
+
dependencies.forEach(dependency => dependenciesMap.add(dependency));
|
47
|
+
const dispose = _listener.UnistylesListener.addListeners(Array.from(dependenciesMap), () => {
|
26
48
|
const newComputedStylesheet = stylesheet(_runtime.UnistylesRuntime.theme, _runtime.UnistylesRuntime.miniRuntime);
|
27
49
|
this.stylesheets.set(stylesheet, newComputedStylesheet);
|
28
50
|
});
|
29
|
-
this.
|
30
|
-
|
51
|
+
this.dependenciesMap.set(stylesheet, dependenciesMap);
|
52
|
+
this.disposeListenersMap.set(stylesheet, dispose);
|
53
|
+
};
|
54
|
+
add = ({
|
55
|
+
key,
|
56
|
+
value,
|
57
|
+
stylesheet,
|
58
|
+
args,
|
59
|
+
variants
|
60
|
+
}) => {
|
61
|
+
const hash = (0, _utils.generateHash)(value);
|
62
|
+
const existingCounter = this.stylesCounter.get(hash);
|
63
|
+
if (!existingCounter || existingCounter.size === 0) {
|
64
|
+
const counter = new Set();
|
65
|
+
const dependencies = (0, _utils.extractUnistyleDependencies)(value);
|
66
|
+
counter.add(value);
|
67
|
+
this.stylesCounter.set(hash, counter);
|
68
|
+
this.applyStyles(hash, (0, _convert.convertUnistyles)(value));
|
69
|
+
_listener.UnistylesListener.addListeners(dependencies, async () => {
|
70
|
+
// Move this callback to the end of the event loop
|
71
|
+
await Promise.resolve();
|
72
|
+
const newComputedStyleSheet = this.getComputedStylesheet(stylesheet);
|
73
|
+
const newValue = newComputedStyleSheet[key];
|
74
|
+
const result = typeof newValue === 'function' ? newValue(...args) : newValue;
|
75
|
+
const {
|
76
|
+
variantsResult
|
77
|
+
} = Object.fromEntries((0, _variants.getVariants)({
|
78
|
+
variantsResult: result
|
79
|
+
}, variants));
|
80
|
+
const resultWithVariants = {
|
81
|
+
...result,
|
82
|
+
...variantsResult
|
83
|
+
};
|
84
|
+
this.applyStyles(hash, (0, _convert.convertUnistyles)(resultWithVariants));
|
85
|
+
});
|
86
|
+
return hash;
|
87
|
+
}
|
88
|
+
existingCounter.add(value);
|
89
|
+
return hash;
|
31
90
|
};
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
91
|
+
applyStyles = (hash, styles) => {
|
92
|
+
Object.entries(styles).forEach(([key, value]) => {
|
93
|
+
if (!this.styleTag.sheet) {
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
if (typeof value === 'object' && !key.startsWith('_')) {
|
97
|
+
const mediaQuery = (0, _utils.getMediaQuery)(key);
|
98
|
+
const cssRules = Array.from(this.styleTag.sheet.cssRules);
|
99
|
+
let queryRule = cssRules.find(rule => {
|
100
|
+
if (!(rule instanceof CSSMediaRule)) {
|
101
|
+
return false;
|
102
|
+
}
|
103
|
+
return rule.media.item(0)?.includes(mediaQuery);
|
104
|
+
}) ?? null;
|
105
|
+
if (!queryRule) {
|
106
|
+
const mediaQueryValue = (0, _utils.extractMediaQueryValue)(mediaQuery);
|
107
|
+
const ruleIndex = mediaQueryValue ? cssRules.reduce((acc, rule, ruleIndex) => {
|
108
|
+
if (!(rule instanceof CSSMediaRule)) {
|
109
|
+
return acc;
|
110
|
+
}
|
111
|
+
const ruleMediaQueryValue = (0, _utils.extractMediaQueryValue)(rule.conditionText);
|
112
|
+
if (ruleMediaQueryValue === undefined) {
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
return ruleMediaQueryValue > mediaQueryValue ? ruleIndex : acc;
|
116
|
+
}, cssRules.length) : undefined;
|
117
|
+
queryRule = this.styleTag.sheet.cssRules.item(this.styleTag.sheet.insertRule(`@media ${mediaQuery} {.${hash} {}}`, ruleIndex));
|
118
|
+
}
|
119
|
+
if (queryRule instanceof CSSMediaRule) {
|
120
|
+
Object.entries(value).forEach(([mqKey, mqValue]) => {
|
121
|
+
this.applyRule({
|
122
|
+
hash,
|
123
|
+
key: mqKey,
|
124
|
+
value: mqValue,
|
125
|
+
sheet: queryRule
|
126
|
+
});
|
127
|
+
});
|
128
|
+
}
|
129
|
+
return;
|
130
|
+
}
|
131
|
+
|
132
|
+
// Pseudo
|
133
|
+
if (typeof value === 'object') {
|
134
|
+
Object.entries(value).forEach(([pseudoKey, pseudoValue]) => {
|
135
|
+
this.applyRule({
|
136
|
+
hash: `${hash}${key.replace('_', ':')}`,
|
137
|
+
key: pseudoKey,
|
138
|
+
value: pseudoValue,
|
139
|
+
sheet: this.styleTag.sheet
|
140
|
+
});
|
141
|
+
});
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
this.applyRule({
|
145
|
+
hash,
|
146
|
+
key,
|
147
|
+
value,
|
148
|
+
sheet: this.styleTag.sheet
|
149
|
+
});
|
150
|
+
});
|
42
151
|
};
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
152
|
+
applyRule = ({
|
153
|
+
hash,
|
154
|
+
key,
|
155
|
+
value,
|
156
|
+
sheet
|
157
|
+
}) => {
|
158
|
+
let rule = Array.from(sheet.cssRules).find(rule => {
|
159
|
+
if (!(rule instanceof CSSStyleRule)) {
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
|
163
|
+
// In unistyles pseudos are prefixed with ':' but in css some of them are prefixed with '::'
|
164
|
+
return rule.selectorText.replace('::', ':').includes(hash);
|
165
|
+
}) ?? null;
|
166
|
+
if (!rule) {
|
167
|
+
rule = sheet.cssRules.item(sheet.insertRule(`.${hash} {}`));
|
168
|
+
}
|
169
|
+
if (!(rule instanceof CSSStyleRule) || !(0, _utils.keyInObject)(rule.style, key)) {
|
170
|
+
return;
|
171
|
+
}
|
172
|
+
rule.style[key] = value;
|
173
|
+
};
|
174
|
+
remove = value => {
|
175
|
+
const hash = (0, _utils.generateHash)(value);
|
176
|
+
const existingStyles = this.stylesCounter.get(hash);
|
177
|
+
if (!existingStyles) {
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
existingStyles.delete(value);
|
181
|
+
if (existingStyles.size === 0) {
|
182
|
+
const ruleIndex = Array.from(this.styleTag.sheet?.cssRules ?? []).findIndex(rule => rule.cssText.includes(`.${hash}`));
|
183
|
+
this.styleTag.sheet?.deleteRule(ruleIndex);
|
184
|
+
}
|
47
185
|
};
|
48
186
|
}
|
49
187
|
const UnistylesRegistry = exports.UnistylesRegistry = new UnistylesRegistryBuilder();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_runtime","require","_utils","_listener","_convert","_variants","UnistylesRegistryBuilder","stylesheets","Map","stylesCounter","styleTag","disposeListenersMap","dependenciesMap","tag","newTag","document","createElement","id","head","appendChild","getComputedStylesheet","stylesheet","computedStylesheet","get","createdStylesheet","UnistylesRuntime","theme","miniRuntime","dependencies","Object","values","flatMap","value","extractUnistyleDependencies","addDependenciesToStylesheet","set","Set","forEach","dependency","add","dispose","UnistylesListener","addListeners","Array","from","newComputedStylesheet","key","args","variants","hash","generateHash","existingCounter","size","counter","applyStyles","convertUnistyles","Promise","resolve","newComputedStyleSheet","newValue","result","variantsResult","fromEntries","getVariants","resultWithVariants","styles","entries","sheet","startsWith","mediaQuery","getMediaQuery","cssRules","queryRule","find","rule","CSSMediaRule","media","item","includes","mediaQueryValue","extractMediaQueryValue","ruleIndex","reduce","acc","ruleMediaQueryValue","conditionText","undefined","length","insertRule","mqKey","mqValue","applyRule","pseudoKey","pseudoValue","replace","CSSStyleRule","selectorText","keyInObject","style","remove","existingStyles","delete","findIndex","cssText","deleteRule","UnistylesRegistry","exports"],"sourceRoot":"../../../src","sources":["web/registry.ts"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IA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CAAC","ignoreList":[]}
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.UnistylesShadowRegistry = void 0;
|
7
|
-
var _listener = require("./listener");
|
8
7
|
var _registry = require("./registry");
|
9
8
|
var _utils = require("./utils");
|
10
9
|
var _variants2 = require("./variants");
|
@@ -17,9 +16,8 @@ class UnistylesShadowRegistryBuilder {
|
|
17
16
|
dispose = () => {};
|
18
17
|
// END MOCKS
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
stylesMap = (0, _utils.createDoubleMap)();
|
19
|
+
resultsMap = (0, _utils.createDoubleMap)();
|
20
|
+
classNamesMap = (0, _utils.createDoubleMap)();
|
23
21
|
add = (ref, _style, _variants, _args) => {
|
24
22
|
// Style is not provided
|
25
23
|
if (!_style) {
|
@@ -41,13 +39,19 @@ class UnistylesShadowRegistryBuilder {
|
|
41
39
|
if (ref === null) {
|
42
40
|
const secrets = (0, _utils.extractSecrets)(_style);
|
43
41
|
secrets.forEach(({
|
44
|
-
__uni__refs
|
42
|
+
__uni__refs,
|
43
|
+
__uni__key
|
45
44
|
}) => {
|
46
45
|
__uni__refs.forEach(ref => {
|
47
46
|
if ((0, _utils.isInDocument)(ref)) {
|
48
47
|
return;
|
49
48
|
}
|
50
|
-
this.
|
49
|
+
const oldResult = this.resultsMap.get(ref, __uni__key);
|
50
|
+
this.resultsMap.delete(ref, __uni__key);
|
51
|
+
this.classNamesMap.delete(ref, __uni__key);
|
52
|
+
if (oldResult) {
|
53
|
+
_registry.UnistylesRegistry.remove(oldResult);
|
54
|
+
}
|
51
55
|
});
|
52
56
|
});
|
53
57
|
return;
|
@@ -61,63 +65,61 @@ class UnistylesShadowRegistryBuilder {
|
|
61
65
|
const {
|
62
66
|
__uni__key,
|
63
67
|
__uni__stylesheet,
|
64
|
-
__uni__refs,
|
65
68
|
__uni__variants,
|
66
|
-
__uni__args = []
|
69
|
+
__uni__args = [],
|
70
|
+
__uni__refs
|
67
71
|
} = secret;
|
68
72
|
const newComputedStylesheet = _registry.UnistylesRegistry.getComputedStylesheet(__uni__stylesheet);
|
69
73
|
const style = newComputedStylesheet[__uni__key];
|
70
74
|
const args = _args ?? __uni__args;
|
71
|
-
const
|
72
|
-
const result =
|
75
|
+
const variants = _variants && Object.keys(_variants).length > 0 ? _variants : __uni__variants;
|
76
|
+
const result = typeof style === 'function' ? style(...args) : style;
|
73
77
|
const {
|
74
|
-
|
78
|
+
variantsResult
|
75
79
|
} = Object.fromEntries((0, _variants2.getVariants)({
|
76
|
-
|
77
|
-
},
|
80
|
+
variantsResult: result
|
81
|
+
}, variants));
|
78
82
|
const resultWithVariants = {
|
79
83
|
...result,
|
80
|
-
...
|
84
|
+
...variantsResult
|
81
85
|
};
|
82
|
-
const
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
86
|
+
const oldResult = this.resultsMap.get(ref, __uni__key);
|
87
|
+
|
88
|
+
// If results are the same do nothing
|
89
|
+
if ((0, _utils.equal)(oldResult, resultWithVariants)) {
|
90
|
+
return;
|
91
|
+
}
|
92
|
+
const oldClassNames = this.classNamesMap.get(ref, __uni__key);
|
93
|
+
|
94
|
+
// Remove old styles
|
95
|
+
if (oldResult) {
|
96
|
+
_registry.UnistylesRegistry.remove(oldResult);
|
97
|
+
}
|
98
|
+
|
99
|
+
// Remove old classnames from the ref
|
100
|
+
oldClassNames?.forEach(className => ref.classList.remove(className));
|
101
|
+
this.resultsMap.set(ref, __uni__key, resultWithVariants);
|
102
|
+
const className = _registry.UnistylesRegistry.add({
|
87
103
|
key: __uni__key,
|
88
|
-
stylesheet: __uni__stylesheet,
|
89
104
|
args,
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
webUnistyle.unistyles.setStylesTarget(styleTag);
|
101
|
-
document.head.appendChild(styleTag);
|
102
|
-
__uni__refs.add(ref);
|
103
|
-
this.stylesMap.set(ref, __uni__key, styleTag);
|
104
|
-
}
|
105
|
-
if (storedWebUnistyle) {
|
106
|
-
_registry.UnistylesRegistry.updateStyles(webUnistyle.unistyles, resultWithVariants, webUnistyle.className);
|
105
|
+
stylesheet: __uni__stylesheet,
|
106
|
+
value: resultWithVariants,
|
107
|
+
variants
|
108
|
+
});
|
109
|
+
const injectedClassNames = resultWithVariants?._web?._classNames ?? [];
|
110
|
+
const newClassNames = injectedClassNames.concat(className);
|
111
|
+
const dependencies = (0, _utils.extractUnistyleDependencies)(resultWithVariants);
|
112
|
+
if (typeof __uni__stylesheet === 'function') {
|
113
|
+
// Add dependencies from dynamic styles to stylesheet
|
114
|
+
_registry.UnistylesRegistry.addDependenciesToStylesheet(__uni__stylesheet, dependencies);
|
107
115
|
}
|
116
|
+
__uni__refs.add(ref);
|
117
|
+
this.classNamesMap.set(ref, __uni__key, newClassNames);
|
118
|
+
// Add new classnames to the ref
|
119
|
+
ref.classList.add(...newClassNames);
|
108
120
|
});
|
109
121
|
};
|
110
|
-
remove = (
|
111
|
-
(0, _utils.extractSecrets)(style).forEach(({
|
112
|
-
__uni__key
|
113
|
-
}) => {
|
114
|
-
this.webUnistylesMap.delete(ref, __uni__key);
|
115
|
-
this.disposeMap.get(ref, __uni__key)?.();
|
116
|
-
this.disposeMap.delete(ref, __uni__key);
|
117
|
-
this.stylesMap.get(ref, __uni__key)?.remove();
|
118
|
-
this.stylesMap.delete(ref, __uni__key);
|
119
|
-
});
|
120
|
-
};
|
122
|
+
remove = () => {};
|
121
123
|
}
|
122
124
|
const UnistylesShadowRegistry = exports.UnistylesShadowRegistry = new UnistylesShadowRegistryBuilder();
|
123
125
|
//# sourceMappingURL=shadowRegistry.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_registry","require","_utils","_variants2","UnistylesShadowRegistryBuilder","name","__type","equals","toString","dispose","resultsMap","createDoubleMap","classNamesMap","add","ref","_style","_variants","_args","Array","isArray","forEach","style","Object","keys","some","key","startsWith","secrets","extractSecrets","__uni__refs","__uni__key","isInDocument","oldResult","get","delete","UnistylesRegistry","remove","HTMLElement","secret","__uni__stylesheet","__uni__variants","__uni__args","newComputedStylesheet","getComputedStylesheet","args","variants","length","result","variantsResult","fromEntries","getVariants","resultWithVariants","equal","oldClassNames","className","classList","set","stylesheet","value","injectedClassNames","_web","_classNames","newClassNames","concat","dependencies","extractUnistyleDependencies","addDependenciesToStylesheet","UnistylesShadowRegistry","exports"],"sourceRoot":"../../../src","sources":["web/shadowRegistry.ts"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAIA,MAAMG,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,IAAAC,sBAAe,EAAuC,CAAC;EACpEC,aAAa,GAAG,IAAAD,sBAAe,EAAqC,CAAC;EAE7EE,GAAG,GAAGA,CAACC,GAAQ,EAAEC,MAA6B,EAAEC,SAA+B,EAAEC,KAAkB,KAAK;IACpG;IACA,IAAI,CAACF,MAAM,EAAE;MACT;IACJ;;IAEA;IACA,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,EAAE;MACvBA,MAAM,CAACK,OAAO,CAACC,KAAK,IAAI,IAAI,CAACR,GAAG,CAACC,GAAG,EAAEO,KAAK,EAAEL,SAAS,EAAEC,KAAK,CAAC,CAAC;MAE/D;IACJ;;IAEA;IACA,IAAI,CAACK,MAAM,CAACC,IAAI,CAACR,MAAM,CAAC,CAACS,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,UAAU,CAAC,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AAY,GAAG,IAAAC,kCAA2B,EAACd,kBAAkB,CAAC;MAEpE,IAAI,OAAOZ,iBAAiB,KAAK,UAAU,EAAE;QACzC;QACAJ,2BAAiB,CAAC+B,2BAA2B,CAAC3B,iBAAiB,EAAEyB,YAAY,CAAC;MAClF;MAEAnC,WAAW,CAAChB,GAAG,CAACC,GAAG,CAAC;MACpB,IAAI,CAACF,aAAa,CAAC4C,GAAG,CAAC1C,GAAG,EAAEgB,UAAU,EAAEgC,aAAa,CAAC;MACtD;MACAhD,GAAG,CAACyC,SAAS,CAAC1C,GAAG,CAAC,GAAGiD,aAAa,CAAC;IACvC,CAAC,CAAC;EACN,CAAC;EAED1B,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB;AAEO,MAAM+B,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,IAAI/D,8BAA8B,CAAC,CAAC","ignoreList":[]}
|
@@ -9,14 +9,18 @@ var _utils = require("./utils");
|
|
9
9
|
var _listener = require("./listener");
|
10
10
|
var _NativePlatform = require("../specs/NativePlatform");
|
11
11
|
class UnistylesStateBuilder {
|
12
|
-
isSSR = (0, _utils.isServer)();
|
13
12
|
themes = new Map();
|
13
|
+
matchingBreakpoints = new Map();
|
14
|
+
get breakpoint() {
|
15
|
+
const [currentBreakpoint] = Array.from(this.matchingBreakpoints).reverse().find(([_key, value]) => value) ?? [];
|
16
|
+
return currentBreakpoint;
|
17
|
+
}
|
14
18
|
hasAdaptiveThemes = false;
|
15
19
|
init = config => {
|
16
20
|
this.initThemes(config.themes);
|
17
21
|
this.initBreakpoints(config.breakpoints);
|
18
22
|
this.initSettings(config.settings);
|
19
|
-
if (
|
23
|
+
if ((0, _utils.isServer)()) {
|
20
24
|
return;
|
21
25
|
}
|
22
26
|
_listener.UnistylesListener.initListeners();
|
@@ -51,27 +55,15 @@ class UnistylesStateBuilder {
|
|
51
55
|
this.themeName = typeof settings.initialTheme === 'function' ? settings.initialTheme() : settings.initialTheme;
|
52
56
|
};
|
53
57
|
initBreakpoints = (breakpoints = {}) => {
|
54
|
-
const breakpointsMap = new Map();
|
55
58
|
this.breakpoints = breakpoints;
|
56
59
|
Object.entries(breakpoints).sort(([, a], [, b]) => a - b).forEach(([breakpoint, value]) => {
|
57
60
|
if ((0, _utils.isServer)()) {
|
58
61
|
return;
|
59
62
|
}
|
60
63
|
const mediaQuery = window.matchMedia(`(min-width: ${value}px)`);
|
61
|
-
|
62
|
-
if (mediaQuery.matches) {
|
63
|
-
this.breakpoint = breakpoint;
|
64
|
-
}
|
64
|
+
this.matchingBreakpoints.set(breakpoint, mediaQuery.matches);
|
65
65
|
mediaQuery.addEventListener('change', event => {
|
66
|
-
|
67
|
-
const [currentBreakpoint] = Array.from(breakpointsMap).find(([, mq]) => mq.matches) ?? [];
|
68
|
-
if (currentBreakpoint) {
|
69
|
-
this.breakpoint = currentBreakpoint;
|
70
|
-
_listener.UnistylesListener.emitChange(_NativePlatform.UnistyleDependency.Breakpoints);
|
71
|
-
}
|
72
|
-
return;
|
73
|
-
}
|
74
|
-
this.breakpoint = breakpoint;
|
66
|
+
this.matchingBreakpoints.set(breakpoint, event.matches);
|
75
67
|
_listener.UnistylesListener.emitChange(_NativePlatform.UnistyleDependency.Breakpoints);
|
76
68
|
});
|
77
69
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_runtime","require","_utils","_listener","_NativePlatform","UnistylesStateBuilder","
|
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","initSettings","settings","isServer","UnistylesListener","initListeners","Object","entries","forEach","themeName","theme","set","adaptiveThemes","themeNames","keys","initialTheme","length","Error","schemeToTheme","UnistylesRuntime","colorScheme","sort","a","b","mediaQuery","window","matchMedia","matches","addEventListener","event","emitChange","UnistyleDependency","Breakpoints","UnistylesState","ex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AG,CAACxB,UAAU,EAAEqC,UAAU,CAACG,OAAO,CAAC;MAE5DH,UAAU,CAACI,gBAAgB,CAAC,QAAQ,EAAEC,KAAK,IAAI;QAC3C,IAAI,CAAC3C,mBAAmB,CAACyB,GAAG,CAACxB,UAAU,EAAE0C,KAAK,CAACF,OAAO,CAAC;QACvDvB,2BAAiB,CAAC0B,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,24 +3,11 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.warn = exports.
|
7
|
-
var _types = require("../specs/types");
|
6
|
+
exports.warn = exports.reduceObject = exports.keyInObject = exports.isServer = exports.generateHash = exports.equal = exports.deepMergeObjects = exports.createDoubleMap = void 0;
|
8
7
|
const reduceObject = (obj, reducer) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, reducer(value, key)]));
|
9
8
|
exports.reduceObject = reduceObject;
|
10
9
|
const keyInObject = (obj, key) => key in obj;
|
11
10
|
exports.keyInObject = keyInObject;
|
12
|
-
const schemeToTheme = scheme => {
|
13
|
-
switch (scheme) {
|
14
|
-
case _types.ColorScheme.Dark:
|
15
|
-
return 'dark';
|
16
|
-
case _types.ColorScheme.Light:
|
17
|
-
default:
|
18
|
-
return 'light';
|
19
|
-
}
|
20
|
-
};
|
21
|
-
exports.schemeToTheme = schemeToTheme;
|
22
|
-
const hexToRGBA = (hex, opacity) => hex.replace('#', '').split(/(?=(?:..)*$)/).map(x => parseInt(x, 16)).filter(num => !isNaN(num)).reduce((acc, color) => `${acc}${color},`, 'rgba(').concat(`${opacity})`);
|
23
|
-
exports.hexToRGBA = hexToRGBA;
|
24
11
|
const isServer = () => typeof window === 'undefined';
|
25
12
|
|
26
13
|
/**
|
@@ -62,32 +49,14 @@ const equal = (a, b) => {
|
|
62
49
|
return keysA.every(key => Object.is(a[key], b[key]) && Object.prototype.hasOwnProperty.call(b, key));
|
63
50
|
};
|
64
51
|
exports.equal = equal;
|
65
|
-
const
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
const extractSecrets = object => {
|
72
|
-
const secrets = Object.entries(object).reduce((acc, [key, value]) => {
|
73
|
-
if (key.startsWith('__uni__secrets__')) {
|
74
|
-
acc.push(value);
|
75
|
-
}
|
76
|
-
return acc;
|
77
|
-
}, []);
|
78
|
-
return secrets;
|
79
|
-
};
|
80
|
-
exports.extractSecrets = extractSecrets;
|
81
|
-
const getStyles = values => {
|
82
|
-
const returnValue = {};
|
83
|
-
Object.defineProperties(returnValue, reduceObject(values, value => ({
|
84
|
-
value,
|
85
|
-
enumerable: false,
|
86
|
-
configurable: true
|
87
|
-
})));
|
88
|
-
return returnValue;
|
52
|
+
const generateHash = value => {
|
53
|
+
const str = JSON.stringify(value);
|
54
|
+
let hasher = 5381;
|
55
|
+
let length = str.length;
|
56
|
+
while (length--) hasher = hasher * 33 ^ str.charCodeAt(length);
|
57
|
+
return `unistyles-${(hasher >>> 0).toString(36)}`;
|
89
58
|
};
|
90
|
-
exports.
|
59
|
+
exports.generateHash = generateHash;
|
91
60
|
const createDoubleMap = () => {
|
92
61
|
const map = new Map();
|
93
62
|
return {
|
@@ -120,11 +89,4 @@ const createDoubleMap = () => {
|
|
120
89
|
};
|
121
90
|
};
|
122
91
|
exports.createDoubleMap = createDoubleMap;
|
123
|
-
|
124
|
-
const hiddenProperties = Object.getOwnPropertyNames(object);
|
125
|
-
return Object.fromEntries(hiddenProperties.filter(key => !key.startsWith('__uni__')).map(key => [key, object[key]]));
|
126
|
-
};
|
127
|
-
exports.extractHiddenProperties = extractHiddenProperties;
|
128
|
-
const isInDocument = element => document.body.contains(element);
|
129
|
-
exports.isInDocument = isInDocument;
|
130
|
-
//# sourceMappingURL=utils.js.map
|
92
|
+
//# sourceMappingURL=common.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["reduceObject","obj","reducer","Object","fromEntries","entries","map","key","value","exports","keyInObject","isServer","window","deepMergeObjects","sources","target","forEach","source","keys","sourceValue","targetValue","warn","message","console","equal","a","b","is","keysA","length","every","prototype","hasOwnProperty","call","generateHash","str","JSON","stringify","hasher","charCodeAt","toString","createDoubleMap","Map","get","secondKey","mapForKey","undefined","set","delete","callback"],"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,GAAG,EAAEC,KAAK,CAAC,KAAK,CAACD,GAAG,EAAEL,OAAO,CAACM,KAAK,EAAsBD,GAAG,CAAC,CAAC,CAAC,CAAoC;AAAAE,OAAA,CAAAT,YAAA,GAAAA,YAAA;AAE9I,MAAMU,WAAW,GAAGA,CAAgCT,GAAM,EAAEM,GAAgB,KAAqBA,GAAG,IAAIN,GAAG;AAAAQ,OAAA,CAAAC,WAAA,GAAAA,WAAA;AAE3G,MAAMC,QAAQ,GAAGA,CAAA,KAAM,OAAOC,MAAM,KAAK,WAAW;;AAE3D;AACA;AACA;AAFAH,OAAA,CAAAE,QAAA,GAAAA,QAAA;AAGO,MAAME,gBAAgB,GAAGA,CAAqC,GAAGC,OAAiB,KAAK;EAC1F,MAAMC,MAAM,GAAG,CAAC,CAAM;EAEtBD,OAAO,CAACE,OAAO,CAACC,MAAM,IAAI;IACtBd,MAAM,CAACe,IAAI,CAACD,MAAM,CAAC,CAACD,OAAO,CAACT,GAAG,IAAI;MAC/B,MAAMY,WAAW,GAAGF,MAAM,CAACV,GAAG,CAAC;MAC/B,MAAMa,WAAW,GAAGL,MAAM,CAACR,GAAG,CA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AC;MAE9B,IAAI,CAACsC,SAAS,EAAE;QACZ;MACJ;MAEAA,SAAS,CAACG,MAAM,CAACJ,SAAS,CAAC;IAC/B,CAAC;IACD5B,OAAO,EAAGiC,QAAmE,IAAK;MAC9E3C,GAAG,CAACU,OAAO,CAAC,CAAC6B,SAAS,EAAEtC,GAAG,KAAK;QAC5BsC,SAAS,CAAC7B,OAAO,CAAC,CAACR,KAAK,EAAEoC,SAAS,KAAK;UACpCK,QAAQ,CAAC1C,GAAG,EAAEqC,SAAS,EAAEpC,KAAK,CAAC;QACnC,CAAC,CAAC;MACN,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAgC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _common = require("./common");
|
7
|
+
Object.keys(_common).forEach(function (key) {
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
9
|
+
if (key in exports && exports[key] === _common[key]) return;
|
10
|
+
Object.defineProperty(exports, key, {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return _common[key];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
});
|
17
|
+
var _unistyle = require("./unistyle");
|
18
|
+
Object.keys(_unistyle).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (key in exports && exports[key] === _unistyle[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function () {
|
24
|
+
return _unistyle[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_common","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_unistyle"],"sourceRoot":"../../../../src","sources":["web/utils/index.ts"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,SAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,SAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,SAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|