react-native-unistyles 2.0.0-beta.1 → 2.0.0-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/unistyles/UnistylesModule.kt +3 -3
- package/ios/UnistylesModule.mm +5 -5
- package/lib/commonjs/core/UnistyleRegistry.js +6 -2
- 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 +191 -0
- package/lib/commonjs/core/UnistylesModule.web.js.map +1 -0
- package/lib/commonjs/core/UnistylesRuntime.js +3 -0
- package/lib/commonjs/core/UnistylesRuntime.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/useCSS.js +9 -0
- package/lib/commonjs/hooks/useCSS.js.map +1 -0
- package/lib/commonjs/hooks/useCSS.web.js +46 -0
- package/lib/commonjs/hooks/useCSS.web.js.map +1 -0
- package/lib/commonjs/hooks/useUnistyles.js +1 -1
- package/lib/commonjs/hooks/useUnistyles.js.map +1 -1
- package/lib/commonjs/normalizer/index.js.map +1 -0
- package/lib/commonjs/normalizer/module.d.js.map +1 -0
- package/lib/commonjs/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
- package/lib/commonjs/normalizer/normalizeStyle.js.map +1 -0
- package/lib/commonjs/normalizer/normalizer.js.map +1 -0
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js +14 -0
- package/lib/commonjs/plugins/cssMediaQueriesPlugin.js.map +1 -0
- package/lib/commonjs/plugins/index.js +3 -21
- package/lib/commonjs/plugins/index.js.map +1 -1
- package/lib/commonjs/plugins/normalizeWebStylesPlugin.js +1 -1
- package/lib/commonjs/useStyles.js +4 -1
- package/lib/commonjs/useStyles.js.map +1 -1
- package/lib/commonjs/utils/cssMediaQuery.js +250 -0
- package/lib/commonjs/utils/cssMediaQuery.js.map +1 -0
- package/lib/commonjs/utils/generateId.js +15 -0
- package/lib/commonjs/utils/generateId.js.map +1 -0
- package/lib/commonjs/utils/hash32.js +43 -0
- package/lib/commonjs/utils/hash32.js.map +1 -0
- package/lib/commonjs/utils/index.js +13 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/utils/mqParser.js +2 -1
- package/lib/commonjs/utils/mqParser.js.map +1 -1
- package/lib/commonjs/utils/styles.js +9 -0
- package/lib/commonjs/utils/styles.js.map +1 -1
- package/lib/commonjs/utils/withPlugins.js +1 -1
- package/lib/commonjs/utils/withPlugins.js.map +1 -1
- package/lib/module/core/UnistyleRegistry.js +7 -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 +184 -0
- package/lib/module/core/UnistylesModule.web.js.map +1 -0
- package/lib/module/core/UnistylesRuntime.js +3 -0
- package/lib/module/core/UnistylesRuntime.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/useCSS.js +2 -0
- package/lib/module/hooks/useCSS.js.map +1 -0
- package/lib/module/hooks/useCSS.web.js +39 -0
- package/lib/module/hooks/useCSS.web.js.map +1 -0
- package/lib/module/hooks/useUnistyles.js +1 -1
- package/lib/module/hooks/useUnistyles.js.map +1 -1
- package/lib/module/normalizer/index.js.map +1 -0
- package/lib/module/normalizer/module.d.js.map +1 -0
- package/lib/module/{plugins/normalizer → normalizer}/normalizeStyle.js +1 -1
- package/lib/module/normalizer/normalizeStyle.js.map +1 -0
- package/lib/module/normalizer/normalizer.js.map +1 -0
- package/lib/module/plugins/cssMediaQueriesPlugin.js +7 -0
- package/lib/module/plugins/cssMediaQueriesPlugin.js.map +1 -0
- package/lib/module/plugins/index.js +1 -1
- package/lib/module/plugins/index.js.map +1 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js +1 -1
- package/lib/module/plugins/normalizeWebStylesPlugin.js.map +1 -1
- package/lib/module/useStyles.js +5 -2
- package/lib/module/useStyles.js.map +1 -1
- package/lib/module/utils/cssMediaQuery.js +243 -0
- package/lib/module/utils/cssMediaQuery.js.map +1 -0
- package/lib/module/utils/generateId.js +7 -0
- package/lib/module/utils/generateId.js.map +1 -0
- package/lib/module/utils/hash32.js +36 -0
- package/lib/module/utils/hash32.js.map +1 -0
- package/lib/module/utils/index.js +2 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/mqParser.js +1 -1
- package/lib/module/utils/mqParser.js.map +1 -1
- package/lib/module/utils/styles.js +9 -0
- package/lib/module/utils/styles.js.map +1 -1
- package/lib/module/utils/withPlugins.js +1 -1
- package/lib/module/utils/withPlugins.js.map +1 -1
- 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 +1 -0
- package/lib/typescript/src/core/UnistylesRuntime.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/useCSS.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCSS.web.d.ts +3 -0
- package/lib/typescript/src/hooks/useCSS.web.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/index.d.ts.map +1 -0
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts +3 -0
- package/lib/typescript/src/normalizer/normalizeStyle.d.ts.map +1 -0
- package/lib/typescript/src/{plugins/normalizer → normalizer}/normalizer.d.ts +1 -1
- package/lib/typescript/src/normalizer/normalizer.d.ts.map +1 -0
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts +3 -0
- package/lib/typescript/src/plugins/cssMediaQueriesPlugin.d.ts.map +1 -0
- package/lib/typescript/src/plugins/index.d.ts +1 -1
- package/lib/typescript/src/plugins/index.d.ts.map +1 -1
- package/lib/typescript/src/types/unistyles.d.ts +2 -1
- package/lib/typescript/src/types/unistyles.d.ts.map +1 -1
- package/lib/typescript/src/useStyles.d.ts.map +1 -1
- package/lib/typescript/src/utils/cssMediaQuery.d.ts +4 -0
- package/lib/typescript/src/utils/cssMediaQuery.d.ts.map +1 -0
- package/lib/typescript/src/utils/generateId.d.ts +2 -0
- package/lib/typescript/src/utils/generateId.d.ts.map +1 -0
- package/lib/typescript/src/utils/hash32.d.ts +2 -0
- package/lib/typescript/src/utils/hash32.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +3 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/mqParser.d.ts +2 -1
- package/lib/typescript/src/utils/mqParser.d.ts.map +1 -1
- package/lib/typescript/src/utils/styles.d.ts +1 -1
- package/lib/typescript/src/utils/styles.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/core/UnistyleRegistry.ts +8 -3
- package/src/core/Unistyles.ts +2 -2
- package/src/core/UnistylesModule.web.ts +218 -0
- package/src/core/UnistylesRuntime.ts +4 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useCSS.ts +3 -0
- package/src/hooks/useCSS.web.ts +51 -0
- package/src/hooks/useUnistyles.ts +1 -1
- package/src/{plugins/normalizer → normalizer}/normalizeStyle.ts +2 -2
- package/src/{plugins/normalizer → normalizer}/normalizer.ts +2 -1
- package/src/plugins/cssMediaQueriesPlugin.ts +8 -0
- package/src/plugins/index.ts +1 -1
- package/src/plugins/normalizeWebStylesPlugin.ts +1 -1
- package/src/types/unistyles.ts +3 -2
- package/src/useStyles.ts +10 -2
- package/src/utils/cssMediaQuery.ts +268 -0
- package/src/utils/generateId.ts +10 -0
- package/src/utils/hash32.ts +53 -0
- package/src/utils/index.ts +3 -1
- package/src/utils/mqParser.ts +2 -2
- package/src/utils/styles.ts +10 -1
- package/src/utils/withPlugins.ts +1 -1
- package/lib/commonjs/plugins/normalizer/index.js.map +0 -1
- package/lib/commonjs/plugins/normalizer/module.d.js.map +0 -1
- package/lib/commonjs/plugins/normalizer/normalizeStyle.js.map +0 -1
- package/lib/commonjs/plugins/normalizer/normalizer.js.map +0 -1
- package/lib/module/plugins/normalizer/index.js.map +0 -1
- package/lib/module/plugins/normalizer/module.d.js.map +0 -1
- package/lib/module/plugins/normalizer/normalizeStyle.js.map +0 -1
- package/lib/module/plugins/normalizer/normalizer.js.map +0 -1
- package/lib/typescript/src/plugins/normalizer/index.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts +0 -3
- package/lib/typescript/src/plugins/normalizer/normalizeStyle.d.ts.map +0 -1
- package/lib/typescript/src/plugins/normalizer/normalizer.d.ts.map +0 -1
- /package/lib/commonjs/{plugins/normalizer → normalizer}/index.js +0 -0
- /package/lib/commonjs/{plugins/normalizer → normalizer}/module.d.js +0 -0
- /package/lib/commonjs/{plugins/normalizer → normalizer}/normalizer.js +0 -0
- /package/lib/module/{plugins/normalizer → normalizer}/index.js +0 -0
- /package/lib/module/{plugins/normalizer → normalizer}/module.d.js +0 -0
- /package/lib/module/{plugins/normalizer → normalizer}/normalizer.js +0 -0
- /package/lib/typescript/src/{plugins/normalizer → normalizer}/index.d.ts +0 -0
- /package/src/{plugins/normalizer → normalizer}/index.ts +0 -0
- /package/src/{plugins/normalizer → normalizer}/module.d.ts +0 -0
@@ -0,0 +1,250 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createMediaQueryForStyles = void 0;
|
7
|
+
var _normalizer = require("../normalizer");
|
8
|
+
var _mqParser = require("./mqParser");
|
9
|
+
var _generateId = require("./generateId");
|
10
|
+
const createMediaQueryForStyles = (styles, runtime) => {
|
11
|
+
const withMediaQueries = Object.entries(styles).filter(_ref => {
|
12
|
+
let [, value] = _ref;
|
13
|
+
return typeof value === 'object';
|
14
|
+
}).reduce((acc, _ref2) => {
|
15
|
+
let [prop, value] = _ref2;
|
16
|
+
const objectKeys = Object.keys(value);
|
17
|
+
const mediaQueries = objectKeys.filter(key => (0, _mqParser.isUnistylesMq)(key));
|
18
|
+
const breakpoints = objectKeys.filter(key => runtime.breakpoints[key]);
|
19
|
+
if (mediaQueries.length === 0 && breakpoints.length === 0) {
|
20
|
+
return acc;
|
21
|
+
}
|
22
|
+
const className = (0, _generateId.generateReactNativeWebId)(prop, '""');
|
23
|
+
const breakpointsStyles = getBreakpointsStyles(prop, value, runtime, className);
|
24
|
+
const mediaQueriesStyles = getMediaQueriesFromMQ(prop, value, className);
|
25
|
+
return {
|
26
|
+
...acc,
|
27
|
+
[prop]: `
|
28
|
+
${breakpointsStyles}
|
29
|
+
${mediaQueriesStyles}
|
30
|
+
`.trim()
|
31
|
+
};
|
32
|
+
}, {});
|
33
|
+
return {
|
34
|
+
...styles,
|
35
|
+
...withMediaQueries
|
36
|
+
};
|
37
|
+
};
|
38
|
+
exports.createMediaQueryForStyles = createMediaQueryForStyles;
|
39
|
+
const getMaxWidthMediaQuery = width => {
|
40
|
+
if (!width) {
|
41
|
+
return '';
|
42
|
+
}
|
43
|
+
if (width.to === Infinity) {
|
44
|
+
return '';
|
45
|
+
}
|
46
|
+
return `and (max-width: ${width.to}px)`;
|
47
|
+
};
|
48
|
+
const getMaxHeightMediaQuery = height => {
|
49
|
+
if (!height) {
|
50
|
+
return '';
|
51
|
+
}
|
52
|
+
if (height.to === Infinity) {
|
53
|
+
return '';
|
54
|
+
}
|
55
|
+
return `and (max-height: ${height.to}px)`;
|
56
|
+
};
|
57
|
+
const getMediaQueriesFromMQ = (prop, value, className) => Object.entries(value).reduce((acc, _ref3) => {
|
58
|
+
let [key, value] = _ref3;
|
59
|
+
const result = (0, _mqParser.parseMq)(key);
|
60
|
+
if (!(0, _mqParser.isValidMq)(result)) {
|
61
|
+
return acc;
|
62
|
+
}
|
63
|
+
if (result.width && result.height) {
|
64
|
+
return `${acc}
|
65
|
+
|
66
|
+
@media screen and (min-width: ${result.width.from}px) and (min-height: ${result.height.from}px) ${getMaxWidthMediaQuery(result.width)} ${getMaxHeightMediaQuery(result.height)} {
|
67
|
+
.${className} {
|
68
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
69
|
+
}
|
70
|
+
}
|
71
|
+
`;
|
72
|
+
}
|
73
|
+
if (result.width) {
|
74
|
+
return `${acc}
|
75
|
+
|
76
|
+
@media screen and (min-width: ${result.width.from}px) ${getMaxWidthMediaQuery(result.width)} {
|
77
|
+
.${className} {
|
78
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
79
|
+
}
|
80
|
+
}
|
81
|
+
`;
|
82
|
+
}
|
83
|
+
if (result.height) {
|
84
|
+
return `${acc}
|
85
|
+
|
86
|
+
@media screen and (min-height: ${result.height.from}px) ${getMaxHeightMediaQuery(result.height)} {
|
87
|
+
.${className} {
|
88
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
89
|
+
}
|
90
|
+
}
|
91
|
+
`;
|
92
|
+
}
|
93
|
+
return acc;
|
94
|
+
}, '');
|
95
|
+
const getBreakpointsStyles = (prop, value, runtime, className) => Object.entries(value).reduce((acc, _ref4) => {
|
96
|
+
let [key, value] = _ref4;
|
97
|
+
const breakpoint = runtime.breakpoints[key];
|
98
|
+
if (breakpoint === undefined) {
|
99
|
+
return acc;
|
100
|
+
}
|
101
|
+
return `${acc}
|
102
|
+
|
103
|
+
@media screen and (min-width: ${breakpoint}px) {
|
104
|
+
.${className} {
|
105
|
+
${normalizePropName(prop)}: ${normalizeWebValue(prop, value)};
|
106
|
+
}
|
107
|
+
}
|
108
|
+
`;
|
109
|
+
}, '');
|
110
|
+
const normalizePropName = prop => prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
111
|
+
const normalizeWebValue = (prop, value) => {
|
112
|
+
if (value === undefined) {
|
113
|
+
return 'unset';
|
114
|
+
}
|
115
|
+
switch (prop) {
|
116
|
+
// colors
|
117
|
+
case 'color':
|
118
|
+
case 'backgroundColor':
|
119
|
+
case 'borderColor':
|
120
|
+
case 'borderBottomColor':
|
121
|
+
case 'borderLeftColor':
|
122
|
+
case 'borderRightColor':
|
123
|
+
case 'borderTopColor':
|
124
|
+
case 'borderBlockColor':
|
125
|
+
case 'borderBlockEndColor':
|
126
|
+
case 'borderBlockStartColor':
|
127
|
+
case 'textDecorationColor':
|
128
|
+
return (0, _normalizer.normalizeColor)(value);
|
129
|
+
|
130
|
+
// dimensions
|
131
|
+
case 'width':
|
132
|
+
case 'height':
|
133
|
+
case 'minWidth':
|
134
|
+
case 'minHeight':
|
135
|
+
case 'maxWidth':
|
136
|
+
case 'maxHeight':
|
137
|
+
case 'borderRadius':
|
138
|
+
case 'borderWidth':
|
139
|
+
case 'borderBottomLeftRadius':
|
140
|
+
case 'borderBottomRightRadius':
|
141
|
+
case 'borderEndEndRadius':
|
142
|
+
case 'borderEndStartRadius':
|
143
|
+
case 'borderStartEndRadius':
|
144
|
+
case 'borderStartStartRadius':
|
145
|
+
case 'borderTopLeftRadius':
|
146
|
+
case 'borderTopRightRadius':
|
147
|
+
case 'borderBottomWidth':
|
148
|
+
case 'borderLeftWidth':
|
149
|
+
case 'borderRightWidth':
|
150
|
+
case 'borderTopWidth':
|
151
|
+
case 'bottom':
|
152
|
+
case 'left':
|
153
|
+
case 'right':
|
154
|
+
case 'top':
|
155
|
+
case 'marginTop':
|
156
|
+
case 'marginBottom':
|
157
|
+
case 'marginLeft':
|
158
|
+
case 'marginRight':
|
159
|
+
case 'paddingTop':
|
160
|
+
case 'paddingBottom':
|
161
|
+
case 'paddingLeft':
|
162
|
+
case 'paddingRight':
|
163
|
+
case 'flexBasis':
|
164
|
+
case 'rowGap':
|
165
|
+
case 'columnGap':
|
166
|
+
case 'gap':
|
167
|
+
case 'margin':
|
168
|
+
case 'padding':
|
169
|
+
case 'fontSize':
|
170
|
+
case 'letterSpacing':
|
171
|
+
return `${value}px`;
|
172
|
+
|
173
|
+
// without unit
|
174
|
+
case 'borderStyle':
|
175
|
+
case 'pointerEvents':
|
176
|
+
case 'backfaceVisibility':
|
177
|
+
case 'alignContent':
|
178
|
+
case 'alignItems':
|
179
|
+
case 'alignSelf':
|
180
|
+
case 'flexDirection':
|
181
|
+
case 'flexWrap':
|
182
|
+
case 'flex':
|
183
|
+
case 'aspectRatio':
|
184
|
+
case 'opacity':
|
185
|
+
case 'direction':
|
186
|
+
case 'zIndex':
|
187
|
+
case 'justifyContent':
|
188
|
+
case 'overflow':
|
189
|
+
case 'display':
|
190
|
+
case 'position':
|
191
|
+
case 'flexGrow':
|
192
|
+
case 'flexShrink':
|
193
|
+
case 'fontFamily':
|
194
|
+
case 'fontStyle':
|
195
|
+
case 'textDecorationLine':
|
196
|
+
case 'textAlign':
|
197
|
+
case 'textDecorationStyle':
|
198
|
+
case 'lineHeight':
|
199
|
+
case 'textTransform':
|
200
|
+
case 'fontVariant':
|
201
|
+
case 'verticalAlign':
|
202
|
+
case 'objectFit':
|
203
|
+
return value;
|
204
|
+
|
205
|
+
// to be transformed for now
|
206
|
+
// not supported
|
207
|
+
case 'marginHorizontal':
|
208
|
+
case 'paddingHorizontal':
|
209
|
+
case 'marginVertical':
|
210
|
+
case 'paddingVertical':
|
211
|
+
case 'shadowColor':
|
212
|
+
case 'shadowOffset':
|
213
|
+
case 'shadowOpacity':
|
214
|
+
case 'shadowRadius':
|
215
|
+
case 'transform':
|
216
|
+
case 'transformMatrix':
|
217
|
+
case 'fontWeight':
|
218
|
+
case 'textShadowOffset':
|
219
|
+
case 'textShadowRadius':
|
220
|
+
case 'textShadowColor':
|
221
|
+
return '';
|
222
|
+
|
223
|
+
// unsupported
|
224
|
+
case 'borderStartColor':
|
225
|
+
case 'borderEndColor':
|
226
|
+
case 'borderEndWidth':
|
227
|
+
case 'borderBottomEndRadius':
|
228
|
+
case 'borderBottomStartRadius':
|
229
|
+
case 'borderCurve':
|
230
|
+
case 'elevation':
|
231
|
+
case 'borderTopEndRadius':
|
232
|
+
case 'borderTopStartRadius':
|
233
|
+
case 'borderStartWidth':
|
234
|
+
case 'start':
|
235
|
+
case 'end':
|
236
|
+
case 'margin-end':
|
237
|
+
case 'margin-start':
|
238
|
+
case 'padding-end':
|
239
|
+
case 'padding-start':
|
240
|
+
case 'writingDirection':
|
241
|
+
case 'textAlignVertical':
|
242
|
+
case 'includeFontPadding':
|
243
|
+
case 'resizeMode':
|
244
|
+
case 'overlayColor':
|
245
|
+
case 'tintColor':
|
246
|
+
default:
|
247
|
+
return '';
|
248
|
+
}
|
249
|
+
};
|
250
|
+
//# sourceMappingURL=cssMediaQuery.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_normalizer","require","_mqParser","_generateId","createMediaQueryForStyles","styles","runtime","withMediaQueries","Object","entries","filter","_ref","value","reduce","acc","_ref2","prop","objectKeys","keys","mediaQueries","key","isUnistylesMq","breakpoints","length","className","generateReactNativeWebId","breakpointsStyles","getBreakpointsStyles","mediaQueriesStyles","getMediaQueriesFromMQ","trim","exports","getMaxWidthMediaQuery","width","to","Infinity","getMaxHeightMediaQuery","height","_ref3","result","parseMq","isValidMq","from","normalizePropName","normalizeWebValue","_ref4","breakpoint","undefined","replace","toLowerCase","normalizeColor"],"sourceRoot":"../../../src","sources":["utils/cssMediaQuery.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAGO,MAAMG,yBAAyB,GAAGA,CAACC,MAAe,EAAEC,OAAyB,KAAc;EAC9F,MAAMC,gBAAgB,GAAGC,MAAM,CAC1BC,OAAO,CAACJ,MAAM,CAAC,CACfK,MAAM,CAACC,IAAA;IAAA,IAAC,GAAGC,KAAK,CAAC,GAAAD,IAAA;IAAA,OAAK,OAAOC,KAAK,KAAK,QAAQ;EAAA,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nB,KAAK,WAAW;IAChB;MACI,OAAO,EAAE;EACjB;AACJ,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.generateReactNativeWebId = void 0;
|
7
|
+
var _hash = require("./hash32");
|
8
|
+
// eslint-disable-next-line camelcase
|
9
|
+
|
10
|
+
const generateReactNativeWebId = (key, value) => {
|
11
|
+
const hashedString = (0, _hash.murmurhash2_32_gc)(key + value, 1).toString(36);
|
12
|
+
return process.env.NODE_ENV !== 'production' ? `r-${key}-${hashedString}` : `r-${hashedString}`;
|
13
|
+
};
|
14
|
+
exports.generateReactNativeWebId = generateReactNativeWebId;
|
15
|
+
//# sourceMappingURL=generateId.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_hash","require","generateReactNativeWebId","key","value","hashedString","murmurhash2_32_gc","toString","process","env","NODE_ENV","exports"],"sourceRoot":"../../../src","sources":["utils/generateId.ts"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA;;AAGO,MAAMC,wBAAwB,GAAGA,CAACC,GAAW,EAAEC,KAAa,KAAa;EAC5E,MAAMC,YAAY,GAAG,IAAAC,uBAAiB,EAACH,GAAG,GAAGC,KAAK,EAAE,CAAC,CAAC,CAACG,QAAQ,CAAC,EAAE,CAAC;EAEnE,OAAOC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,GACrC,KAAIP,GAAI,IAAGE,YAAa,EAAC,GACzB,KAAIA,YAAa,EAAC;AAC7B,CAAC;AAAAM,OAAA,CAAAT,wBAAA,GAAAA,wBAAA"}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.murmurhash2_32_gc = void 0;
|
7
|
+
/*
|
8
|
+
Authors: Gary Court and Austin Appleby
|
9
|
+
Compatible with React Native Web
|
10
|
+
https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/StyleSheet/compiler/hash.js#L65
|
11
|
+
*/
|
12
|
+
const murmurhash2_32_gc = (str, seed) => {
|
13
|
+
let l = str.length;
|
14
|
+
let h = seed ^ l;
|
15
|
+
let i = 0;
|
16
|
+
let k;
|
17
|
+
while (l >= 4) {
|
18
|
+
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
19
|
+
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
20
|
+
k ^= k >>> 24;
|
21
|
+
k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
22
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
|
23
|
+
l -= 4;
|
24
|
+
++i;
|
25
|
+
}
|
26
|
+
switch (l) {
|
27
|
+
// @ts-ignore
|
28
|
+
case 3:
|
29
|
+
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
30
|
+
// @ts-ignore
|
31
|
+
case 2:
|
32
|
+
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
33
|
+
case 1:
|
34
|
+
h ^= str.charCodeAt(i) & 0xff;
|
35
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
36
|
+
}
|
37
|
+
h ^= h >>> 13;
|
38
|
+
h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
39
|
+
h ^= h >>> 15;
|
40
|
+
return h >>> 0;
|
41
|
+
};
|
42
|
+
exports.murmurhash2_32_gc = murmurhash2_32_gc;
|
43
|
+
//# sourceMappingURL=hash32.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["murmurhash2_32_gc","str","seed","l","length","h","i","k","charCodeAt","exports"],"sourceRoot":"../../../src","sources":["utils/hash32.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAGA,CAACC,GAAW,EAAEC,IAAY,KAAK;EAC5D,IAAIC,CAAC,GAAGF,GAAG,CAACG,MAAM;EAClB,IAAIC,CAAC,GAAGH,IAAI,GAAGC,CAAC;EAChB,IAAIG,CAAC,GAAG,CAAC;EACT,IAAIC,CAAC;EAEL,OAAOJ,CAAC,IAAI,CAAC,EAAE;IACXI,CAAC,GACAN,GAAG,CAACO,UAAU,CAACF,CAAC,CAAC,GAAG,IAAI,GACxB,CAACL,GAAG,CAACO,UAAU,CAAC,EAAEF,CAAC,CAAC,GAAG,IAAI,KAAK,CAAE,GAClC,CAACL,GAAG,CAACO,UAAU,CAAC,EAAEF,CAAC,CAAC,GAAG,IAAI,KAAK,EAAG,GACnC,CAACL,GAAG,CAACO,UAAU,CAAC,EAAEF,CAAC,CAAC,GAAG,IAAI,KAAK,EAAG;IAEpCC,CAAC,GACD,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IAAI,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC;IACxEA,CAAC,IAAIA,CAAC,KAAK,EAAE;IACbA,CAAC,GACD,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IAAI,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC;IAExEF,CAAC,GACA,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IACvB,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC,GAC9CE,CAAC;IAEDJ,CAAC,IAAI,CAAC;IACN,EAAEG,CAAC;EACP;EAEA,QAAQH,CAAC;IACL;IACA,KAAK,CAAC;MACFE,CAAC,IAAI,CAACJ,GAAG,CAACO,UAAU,CAACF,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,KAAK,EAAE;IAC7C;IACA,KAAK,CAAC;MACFD,CAAC,IAAI,CAACJ,GAAG,CAACO,UAAU,CAACF,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC;IAC5C,KAAK,CAAC;MACFD,CAAC,IAAIJ,GAAG,CAACO,UAAU,CAACF,CAAC,CAAC,GAAG,IAAI;MAC7BD,CAAC,GACH,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IACxB,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC;EAClD;EAEAA,CAAC,IAAIA,CAAC,KAAK,EAAE;EACbA,CAAC,GAAG,CAACA,CAAC,GAAG,MAAM,IAAI,UAAU,IAAI,CAAE,CAACA,CAAC,KAAK,EAAE,IAAI,UAAU,GAAI,MAAM,KAAK,EAAE,CAAC;EAC5EA,CAAC,IAAIA,CAAC,KAAK,EAAE;EAEb,OAAOA,CAAC,KAAK,CAAC;AAClB,CAAC;AAAAI,OAAA,CAAAT,iBAAA,GAAAA,iBAAA"}
|
@@ -3,6 +3,12 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
Object.defineProperty(exports, "generateReactNativeWebId", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _generateId.generateReactNativeWebId;
|
10
|
+
}
|
11
|
+
});
|
6
12
|
Object.defineProperty(exports, "getKeyForUnistylesMediaQuery", {
|
7
13
|
enumerable: true,
|
8
14
|
get: function () {
|
@@ -15,6 +21,12 @@ Object.defineProperty(exports, "getValueForBreakpoint", {
|
|
15
21
|
return _breakpoints.getValueForBreakpoint;
|
16
22
|
}
|
17
23
|
});
|
24
|
+
Object.defineProperty(exports, "isUnistylesMq", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function () {
|
27
|
+
return _mqParser.isUnistylesMq;
|
28
|
+
}
|
29
|
+
});
|
18
30
|
Object.defineProperty(exports, "isValidMq", {
|
19
31
|
enumerable: true,
|
20
32
|
get: function () {
|
@@ -62,4 +74,5 @@ var _mqParser = require("./mqParser");
|
|
62
74
|
var _breakpoints = require("./breakpoints");
|
63
75
|
var _styles = require("./styles");
|
64
76
|
var _withPlugins = require("./withPlugins");
|
77
|
+
var _generateId = require("./generateId");
|
65
78
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_mq","require","_mqParser","_breakpoints","_styles","_withPlugins"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_mq","require","_mqParser","_breakpoints","_styles","_withPlugins","_generateId"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.parseMq = exports.isWithinTheWidthAndHeight = exports.isValidMq = exports.getKeyForUnistylesMediaQuery = void 0;
|
6
|
+
exports.parseMq = exports.isWithinTheWidthAndHeight = exports.isValidMq = exports.isUnistylesMq = exports.getKeyForUnistylesMediaQuery = void 0;
|
7
7
|
const IS_UNISTYLES_REGEX = /:([hw])\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
8
8
|
const UNISTYLES_WIDTH_REGEX = /:(w)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
9
9
|
const UNISTYLES_HEIGHT_REGEX = /:(h)\[(\d+)(?:,\s*(\d+|Infinity))?]/;
|
@@ -23,6 +23,7 @@ const parseMq = mq => {
|
|
23
23
|
};
|
24
24
|
exports.parseMq = parseMq;
|
25
25
|
const isUnistylesMq = mq => IS_UNISTYLES_REGEX.test(mq);
|
26
|
+
exports.isUnistylesMq = isUnistylesMq;
|
26
27
|
const isValidMq = parsedMq => {
|
27
28
|
const {
|
28
29
|
width,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","exports","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":";;;;;;AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAY7D,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EACtD,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CAACP,KAAK,CAAC;MACnBQ,EAAE,EAAED,MAAM,CAACN,GAAG;IAClB,CAAC,GAAGQ,SAAS;IACbN,MAAM,EAAEA,MAAM,GAAG;MACbG,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;MACnBI,EAAE,EAAED,MAAM,CAACF,GAAG;IAClB,CAAC,GAAGI;EACR,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAb,OAAA,GAAAA,OAAA;
|
1
|
+
{"version":3,"names":["IS_UNISTYLES_REGEX","UNISTYLES_WIDTH_REGEX","UNISTYLES_HEIGHT_REGEX","parseMq","mq","width","fromW","toW","exec","height","fromH","toH","from","Number","to","undefined","exports","isUnistylesMq","test","isValidMq","parsedMq","isWithinTheWidthAndHeight","screenSize","isWithinTheWidth","isWithinTheHeight","screenWidth","screenHeight","getKeyForUnistylesMediaQuery","mediaQueries","find","_ref","key","at"],"sourceRoot":"../../../src","sources":["utils/mqParser.ts"],"mappings":";;;;;;AAEA,MAAMA,kBAAkB,GAAG,wCAAwC;AACnE,MAAMC,qBAAqB,GAAG,qCAAqC;AACnE,MAAMC,sBAAsB,GAAG,qCAAqC;AAY7D,MAAMC,OAAO,GAAIC,EAAU,IAAwB;EACtD,MAAM,GAAGC,KAAK,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGN,qBAAqB,CAACO,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAClE,MAAM,GAAGK,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,GAAGT,sBAAsB,CAACM,IAAI,CAACJ,EAAE,CAAC,IAAI,EAAE;EAEpE,OAAO;IACHC,KAAK,EAAEA,KAAK,GAAG;MACXO,IAAI,EAAEC,MAAM,CAACP,KAAK,CAAC;MACnBQ,EAAE,EAAED,MAAM,CAACN,GAAG;IAClB,CAAC,GAAGQ,SAAS;IACbN,MAAM,EAAEA,MAAM,GAAG;MACbG,IAAI,EAAEC,MAAM,CAACH,KAAK,CAAC;MACnBI,EAAE,EAAED,MAAM,CAACF,GAAG;IAClB,CAAC,GAAGI;EACR,CAAC;AACL,CAAC;AAAAC,OAAA,CAAAb,OAAA,GAAAA,OAAA;AAEM,MAAMc,aAAa,GAAIb,EAAU,IAAKJ,kB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,CAAC,GAAGT,KAA0B;EAE/C,OAAOoB,WAAW,IAAIb,IAAI,IAAIa,WAAW,IAAIX,EAAE;AACnD,CAAC;AAED,MAAMU,iBAAiB,GAAGA,CAACf,MAAmC,EAAEiB,YAAoB,KAAc;EAC9F,MAAM;IAAEd,IAAI;IAAEE;EAAG,CAAC,GAAGL,MAA2B;EAEhD,OAAOiB,YAAY,IAAId,IAAI,IAAIc,YAAY,IAAIZ,EAAE;AACrD,CAAC;AAEM,MAAMa,4BAA4B,GAAGA,CAACC,YAAsC,EAAEN,UAAsB,KAAuB;EAC9H,MAAMlB,EAAE,GAAGwB,YAAY,CAACC,IAAI,CAACC,IAAA,IAAW;IAAA,IAAV,CAACC,GAAG,CAAC,GAAAD,IAAA;IAC/B,IAAI,CAACb,aAAa,CAACc,GAAa,CAAC,EAAE;MAC/B,OAAO,KAAK;IAChB;IAEA,MAAMX,QAAQ,GAAGjB,OAAO,CAAC4B,GAAa,CAAC;IAEvC,IAAI,CAACZ,SAAS,CAACC,QAAQ,CAAC,EAAE;MACtB,OAAO,KAAK;IAChB;IAEA,OAAOC,yBAAyB,CAACD,QAAQ,EAAEE,UAAU,CAAC;EAC1D,CAAC,CAAC;EAEF,OAAOlB,EAAE,EAAE4B,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC;AAAAhB,OAAA,CAAAW,4BAAA,GAAAA,4BAAA"}
|
@@ -20,6 +20,7 @@ const isPlatformColor = value => {
|
|
20
20
|
exports.isPlatformColor = isPlatformColor;
|
21
21
|
const parseStyle = function (style) {
|
22
22
|
let variant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
23
|
+
let parseMediaQueries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
23
24
|
return Object.entries(style || {}).reduce((acc, _ref) => {
|
24
25
|
let [key, value] = _ref;
|
25
26
|
// nested objects
|
@@ -48,6 +49,14 @@ const parseStyle = function (style) {
|
|
48
49
|
}), {})
|
49
50
|
};
|
50
51
|
}
|
52
|
+
|
53
|
+
// don't parse media queries and breakpoints
|
54
|
+
if (!parseMediaQueries) {
|
55
|
+
return {
|
56
|
+
...acc,
|
57
|
+
[key]: value
|
58
|
+
};
|
59
|
+
}
|
51
60
|
return {
|
52
61
|
...acc,
|
53
62
|
[key]: (0, _breakpoints.getValueForBreakpoint)(value)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_breakpoints","require","_common","_withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","withPlugins","parseStyle","exports","isPlatformColor","value","isIOS","semantic","isAndroid","resource_paths","style","arguments","length","undefined","Object","entries","reduce","acc","_ref","Array","isArray","map","keys","getValueForBreakpoint"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEO,MAAMG,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC,OAA0C,KAC/B,IAAIC,KAAK,CAACF,EAAE,EAAE;EACzBG,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAAK,IAAAC,wBAAW,EAACR,GAAG,EAAES,UAAU,CAACJ,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEL,OAAO,CAAC;AACzH,CAAC,CAAC;AAAAQ,OAAA,CAAAX,eAAA,GAAAA,eAAA;AAEK,MAAMY,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIC,aAAK,EAAE;IACP,OAAO,UAAU,IAAID,KAAK,IAAI,OAAOA,KAAK,CAACE,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOC,iBAAS,IAAI,gBAAgB,IAAIH,KAAK,IAAI,OAAOA,KAAK,CAACI,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAAAN,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAEM,MAAMF,UAAU,GAAG,SAAAA,CACtBQ,KAAQ;EAAA,IACRf,OAAyC,GAAAgB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,
|
1
|
+
{"version":3,"names":["_breakpoints","require","_common","_withPlugins","proxifyFunction","key","fn","variant","Proxy","apply","target","thisArg","argumentsList","withPlugins","parseStyle","exports","isPlatformColor","value","isIOS","semantic","isAndroid","resource_paths","style","arguments","length","undefined","parseMediaQueries","Object","entries","reduce","acc","_ref","Array","isArray","map","keys","getValueForBreakpoint"],"sourceRoot":"../../../src","sources":["utils/styles.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAEO,MAAMG,eAAe,GAAGA,CAC3BC,GAAW,EACXC,EAAY,EACZC,OAA0C,KAC/B,IAAIC,KAAK,CAACF,EAAE,EAAE;EACzBG,KAAK,EAAEA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,KAAK,IAAAC,wBAAW,EAACR,GAAG,EAAES,UAAU,CAACJ,MAAM,CAACD,KAAK,CAACE,OAAO,EAAEC,aAAa,CAAC,EAAEL,OAAO,CAAC;AACzH,CAAC,CAAC;AAAAQ,OAAA,CAAAX,eAAA,GAAAA,eAAA;AAEK,MAAMY,eAAe,GAAkBC,KAAQ,IAAc;EAChE,IAAIC,aAAK,EAAE;IACP,OAAO,UAAU,IAAID,KAAK,IAAI,OAAOA,KAAK,CAACE,QAAQ,KAAK,QAAQ;EACpE;EAEA,OAAOC,iBAAS,IAAI,gBAAgB,IAAIH,KAAK,IAAI,OAAOA,KAAK,CAACI,cAAc,KAAK,QAAQ;AAC7F,CAAC;AAAAN,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAEM,MAAMF,UAAU,GAAG,SAAAA,CACtBQ,KAAQ;EAAA,IACRf,OAAyC,GAAAgB,SAAA,CAAAC,MAAA,QAAAD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AE,CAAC,CAAC;MACd,CAAC;IACL;;IAEA;IACA,IAAI,CAACqB,iBAAiB,EAAE;MACpB,OAAO;QACH,GAAGI,GAAG;QACN,CAACzB,GAAG,GAAGY;MACX,CAAC;IACL;IAEA,OAAO;MACH,GAAGa,GAAG;MACN,CAACzB,GAAG,GAAG,IAAA+B,kCAAqB,EAACnB,KAAgC;IACjE,CAAC;EACL,CAAC,EAAE,CAAC,CAAM,CAAC;AAAA;AAAAF,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
|
@@ -7,7 +7,7 @@ exports.withPlugins = void 0;
|
|
7
7
|
var _core = require("../core");
|
8
8
|
const withPlugins = (key, style) => _core.unistyles.registry.plugins.reduce((acc, plugin) => {
|
9
9
|
if (plugin.onParsedStyle) {
|
10
|
-
return plugin.onParsedStyle(key,
|
10
|
+
return plugin.onParsedStyle(key, acc, _core.unistyles.runtime);
|
11
11
|
}
|
12
12
|
return acc;
|
13
13
|
}, style);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_core","require","withPlugins","key","style","unistyles","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime","exports"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbC,eAAS,CAACC,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACR,GAAG,
|
1
|
+
{"version":3,"names":["_core","require","withPlugins","key","style","unistyles","registry","plugins","reduce","acc","plugin","onParsedStyle","runtime","exports"],"sourceRoot":"../../../src","sources":["utils/withPlugins.ts"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAEO,MAAMC,WAAW,GAAGA,CACvBC,GAAW,EACXC,KAAc,KACbC,eAAS,CAACC,QAAQ,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,MAAM,KAAK;EACpD,IAAIA,MAAM,CAACC,aAAa,EAAE;IACtB,OAAOD,MAAM,CAACC,aAAa,CAACR,GAAG,EAAEM,GAAG,EAAEJ,eAAS,CAACO,OAAO,CAAC;EAC5D;EAEA,OAAOH,GAAG;AACd,CAAC,EAAEL,KAAK,CAAC;AAAAS,OAAA,CAAAX,WAAA,GAAAA,WAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { isWeb, UnistylesError } from '../common';
|
2
|
-
import { normalizeWebStylesPlugin } from '../plugins';
|
2
|
+
import { cssMediaQueriesPlugin, normalizeWebStylesPlugin } from '../plugins';
|
3
3
|
export class UnistyleRegistry {
|
4
4
|
config = {};
|
5
5
|
plugins = isWeb ? [normalizeWebStylesPlugin] : [];
|
@@ -34,12 +34,16 @@ export class UnistyleRegistry {
|
|
34
34
|
if (config.adaptiveThemes) {
|
35
35
|
this.unistylesBridge.useAdaptiveThemes(config.adaptiveThemes);
|
36
36
|
}
|
37
|
-
if (config.
|
38
|
-
config.
|
37
|
+
if (config.plugins) {
|
38
|
+
config.plugins.forEach(plugin => this.addPlugin(plugin, false));
|
39
39
|
}
|
40
40
|
if (config.initialTheme) {
|
41
41
|
this.unistylesBridge.useTheme(config.initialTheme);
|
42
42
|
}
|
43
|
+
if (config.experimentalCSSMediaQueries) {
|
44
|
+
this.plugins = [cssMediaQueriesPlugin].concat(this.plugins);
|
45
|
+
this.unistylesBridge.addPlugin(cssMediaQueriesPlugin.name, false);
|
46
|
+
}
|
43
47
|
return {
|
44
48
|
addBreakpoints: this.addBreakpoints,
|
45
49
|
addThemes: this.addThemes
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isWeb","UnistylesError","normalizeWebStylesPlugin","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","
|
1
|
+
{"version":3,"names":["isWeb","UnistylesError","cssMediaQueriesPlugin","normalizeWebStylesPlugin","UnistyleRegistry","config","plugins","themeNames","themes","breakpoints","sortedBreakpointPairs","constructor","unistylesBridge","addThemes","keys","Object","addBreakpoints","addConfig","useBreakpoints","adaptiveThemes","useAdaptiveThemes","forEach","plugin","addPlugin","initialTheme","useTheme","experimentalCSSMediaQueries","concat","name","getTheme","forName","length","hasTheme","themeName","Error","ThemeNotFound","ThemeNotSelected","_this","notify","arguments","undefined","startsWith","InvalidPluginName","some","_ref","DuplicatePluginName","removePlugin","CantRemoveInternalPlugin","filter","_ref2"],"sourceRoot":"../../../src","sources":["core/UnistyleRegistry.ts"],"mappings":"AAEA,SAASA,KAAK,EAAEC,cAAc,QAAQ,WAAW;AACjD,SAASC,qBAAqB,EAAEC,wBAAwB,QAAQ,YAAY;AAE5E,OAAO,MAAMC,gBAAgB,CAAC;EACnBC,MAAM,GAAoB,CAAC,CAAC;EAC5BC,OAAO,GAA2BN,KAAK,GACxC,CAACG,wBAAwB,CAAC,GAC1B,EAAE;EACDI,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,UAAU,GAAGO,IAAI;IAEtB,OAAO;MACHE,cAAc,EAAE,IAAI,CAACA,cAAc;MACnCC,SAAS,EAAE,IAAI,CAACA;IACpB,CAAC;EACL,CAAC;EAEM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AAO,CAAC0C,MAAM,CAACC,KAAA;MAAA,IAAC;QAAErB;MAAK,CAAC,GAAAqB,KAAA;MAAA,OAAKrB,IAAI,KAAKN,MAAM,CAACM,IAAI;IAAA,EAAC;IACtE,IAAI,CAAChB,eAAe,CAACkC,YAAY,CAACxB,MAAM,CAACM,IAAI,CAAC;EAClD,CAAC;EAEMI,QAAQ,GAAIJ,IAA2B,IAAKA,IAAI,IAAI,IAAI,CAACpB,MAAM;AAC1E"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { UnistylesModule } from './UnistylesModule';
|
2
2
|
import { UnistylesRuntime } from './UnistylesRuntime';
|
3
3
|
import { UnistyleRegistry } from './UnistyleRegistry';
|
4
|
-
import { UnistylesError } from '../common';
|
4
|
+
import { UnistylesError, isWeb } from '../common';
|
5
5
|
class Unistyles {
|
6
6
|
constructor() {
|
7
7
|
const isInstalled = UnistylesModule?.install() ?? false;
|
@@ -10,7 +10,7 @@ class Unistyles {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
// @ts-ignore
|
13
|
-
this._bridge = global.__UNISTYLES__;
|
13
|
+
this._bridge = (isWeb ? window : global).__UNISTYLES__;
|
14
14
|
this._registry = new UnistyleRegistry(this._bridge);
|
15
15
|
this._runtime = new UnistylesRuntime(this._bridge, this._registry);
|
16
16
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["UnistylesModule","UnistylesRuntime","UnistyleRegistry","UnistylesError","Unistyles","constructor","isInstalled","install","Error","RuntimeUnavailable","_bridge","global","__UNISTYLES__","_registry","_runtime","registry","runtime","unistyles"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,QAAQ,WAAW;
|
1
|
+
{"version":3,"names":["UnistylesModule","UnistylesRuntime","UnistyleRegistry","UnistylesError","isWeb","Unistyles","constructor","isInstalled","install","Error","RuntimeUnavailable","_bridge","window","global","__UNISTYLES__","_registry","_runtime","registry","runtime","unistyles"],"sourceRoot":"../../../src","sources":["core/Unistyles.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mBAAmB;AACnD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,SAASC,cAAc,EAAEC,KAAK,QAAQ,WAAW;AAEjD,MAAMC,SAAS,CAAC;EAKZC,WAAWA,CAAA,EAAG;IACV,MAAMC,WAAW,GAAGP,eAAe,EAAEQ,OAAO,CAAC,CAAC,IAAI,KAAK;IAEvD,IAAI,CAACD,WAAW,EAAE;MACd,MAAM,IAAIE,KAAK,CAACN,cAAc,CAACO,kBAAkB,CAAC;IACtD;;IAEA;IACA,IAAI,CAACC,OAAO,GAAG,CAACP,KAAK,GAAGQ,MAAM,GAAGC,MAAM,EAAEC,aAAgC;IACzE,IAAI,CAACC,SAAS,GAAG,IAAIb,gBAAgB,CAAC,IAAI,CAACS,OAAO,CAAC;IACnD,IAAI,CAACK,QAAQ,GAAG,IAAIf,gBAAgB,CAAC,IAAI,CAACU,OAAO,EAAE,IAAI,CAACI,SAAS,CAAC;EACtE;EAEA,IAAWE,QAAQA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACF,SAAS;EACzB;EAEA,IAAWG,OAAOA,CAAA,EAAG;IACjB,OAAO,IAAI,CAACF,QAAQ;EACxB;AACJ;AAEA,OAAO,MAAMG,SAAS,GAAG,IAAId,SAAS,CAAC,CAAC"}
|