@react-spectrum/s2 3.0.0-nightly-74cac946a-250317 → 3.0.0-nightly-27e5ef1b7-250319
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +18 -18
- package/style/dist/main.cjs +18 -18
- package/style/dist/module.mjs +9 -9
- package/style/dist/spectrum-theme.cjs +191 -191
- package/style/dist/spectrum-theme.mjs +183 -183
- package/style/dist/style-macro.cjs +74 -74
- package/style/dist/style-macro.mjs +68 -68
|
@@ -3,13 +3,13 @@ function $parcel$export(e, n, v, s) {
|
|
|
3
3
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
$parcel$export(module.exports, "createArbitraryProperty", () => $
|
|
7
|
-
$parcel$export(module.exports, "createMappedProperty", () => $
|
|
8
|
-
$parcel$export(module.exports, "parseArbitraryValue", () => $
|
|
9
|
-
$parcel$export(module.exports, "createRenamedProperty", () => $
|
|
10
|
-
$parcel$export(module.exports, "createSizingProperty", () => $
|
|
11
|
-
$parcel$export(module.exports, "createColorProperty", () => $
|
|
12
|
-
$parcel$export(module.exports, "createTheme", () => $
|
|
6
|
+
$parcel$export(module.exports, "createArbitraryProperty", () => $346a586d9b655682$export$e33e260cb0fb20f7);
|
|
7
|
+
$parcel$export(module.exports, "createMappedProperty", () => $346a586d9b655682$export$40f4ff17b27355ab);
|
|
8
|
+
$parcel$export(module.exports, "parseArbitraryValue", () => $346a586d9b655682$export$22a8270399010c94);
|
|
9
|
+
$parcel$export(module.exports, "createRenamedProperty", () => $346a586d9b655682$export$7fdf8c7af26ba416);
|
|
10
|
+
$parcel$export(module.exports, "createSizingProperty", () => $346a586d9b655682$export$fa08b74e8bc1d2a7);
|
|
11
|
+
$parcel$export(module.exports, "createColorProperty", () => $346a586d9b655682$export$852145629bb0d58b);
|
|
12
|
+
$parcel$export(module.exports, "createTheme", () => $346a586d9b655682$export$25d302a5b900a763);
|
|
13
13
|
/*
|
|
14
14
|
* Copyright 2024 Adobe. All rights reserved.
|
|
15
15
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -20,12 +20,12 @@ $parcel$export(module.exports, "createTheme", () => $b3643cb9d2948e30$export$25d
|
|
|
20
20
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
21
21
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
22
22
|
* governing permissions and limitations under the License.
|
|
23
|
-
*/ let $
|
|
23
|
+
*/ let $346a586d9b655682$var$defaultArbitraryProperty = (value, property)=>({
|
|
24
24
|
[property]: value
|
|
25
25
|
});
|
|
26
|
-
function $
|
|
26
|
+
function $346a586d9b655682$export$e33e260cb0fb20f7(fn = $346a586d9b655682$var$defaultArbitraryProperty) {
|
|
27
27
|
return (value, property)=>{
|
|
28
|
-
let selector = Array.isArray(value) ? $
|
|
28
|
+
let selector = Array.isArray(value) ? $346a586d9b655682$var$generateArbitraryValueSelector(value.map((v)=>JSON.stringify(v)).join('')) : $346a586d9b655682$var$generateArbitraryValueSelector(JSON.stringify(value));
|
|
29
29
|
return {
|
|
30
30
|
default: [
|
|
31
31
|
fn(value, property),
|
|
@@ -34,15 +34,15 @@ function $b3643cb9d2948e30$export$e33e260cb0fb20f7(fn = $b3643cb9d2948e30$var$de
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function $
|
|
38
|
-
return Object.values(obj).flatMap((v)=>typeof v === 'object' ? $
|
|
37
|
+
function $346a586d9b655682$var$recursiveValues(obj) {
|
|
38
|
+
return Object.values(obj).flatMap((v)=>typeof v === 'object' ? $346a586d9b655682$var$recursiveValues(v) : [
|
|
39
39
|
v
|
|
40
40
|
]);
|
|
41
41
|
}
|
|
42
|
-
function $
|
|
43
|
-
let valueMap = $
|
|
42
|
+
function $346a586d9b655682$export$40f4ff17b27355ab(fn, values) {
|
|
43
|
+
let valueMap = $346a586d9b655682$var$createValueLookup(Array.isArray(values) ? values : $346a586d9b655682$var$recursiveValues(values));
|
|
44
44
|
return (value, property)=>{
|
|
45
|
-
let v = $
|
|
45
|
+
let v = $346a586d9b655682$export$22a8270399010c94(value);
|
|
46
46
|
if (v) return {
|
|
47
47
|
default: [
|
|
48
48
|
fn(v[0], property),
|
|
@@ -50,7 +50,7 @@ function $b3643cb9d2948e30$export$40f4ff17b27355ab(fn, values) {
|
|
|
50
50
|
]
|
|
51
51
|
};
|
|
52
52
|
let val = Array.isArray(values) ? value : values[String(value)];
|
|
53
|
-
return $
|
|
53
|
+
return $346a586d9b655682$var$mapConditionalValue(val, (value)=>{
|
|
54
54
|
return [
|
|
55
55
|
fn(value, property),
|
|
56
56
|
valueMap.get(value)
|
|
@@ -58,15 +58,15 @@ function $b3643cb9d2948e30$export$40f4ff17b27355ab(fn, values) {
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
function $
|
|
62
|
-
return $
|
|
61
|
+
function $346a586d9b655682$export$7fdf8c7af26ba416(name, values) {
|
|
62
|
+
return $346a586d9b655682$export$40f4ff17b27355ab((value, property)=>({
|
|
63
63
|
[property.startsWith('--') ? property : name]: value
|
|
64
64
|
}), values);
|
|
65
65
|
}
|
|
66
|
-
function $
|
|
67
|
-
let valueMap = $
|
|
66
|
+
function $346a586d9b655682$export$fa08b74e8bc1d2a7(values, fn) {
|
|
67
|
+
let valueMap = $346a586d9b655682$var$createValueLookup(Array.isArray(values) ? values : $346a586d9b655682$var$recursiveValues(values));
|
|
68
68
|
return (value, property)=>{
|
|
69
|
-
let v = $
|
|
69
|
+
let v = $346a586d9b655682$export$22a8270399010c94(value);
|
|
70
70
|
if (v) return {
|
|
71
71
|
default: [
|
|
72
72
|
{
|
|
@@ -76,7 +76,7 @@ function $b3643cb9d2948e30$export$fa08b74e8bc1d2a7(values, fn) {
|
|
|
76
76
|
]
|
|
77
77
|
};
|
|
78
78
|
let val = values[String(value)];
|
|
79
|
-
if (val != null) return $
|
|
79
|
+
if (val != null) return $346a586d9b655682$var$mapConditionalValue(val, (value)=>{
|
|
80
80
|
return [
|
|
81
81
|
{
|
|
82
82
|
[property]: value
|
|
@@ -91,19 +91,19 @@ function $b3643cb9d2948e30$export$fa08b74e8bc1d2a7(values, fn) {
|
|
|
91
91
|
{
|
|
92
92
|
[property]: cssValue
|
|
93
93
|
},
|
|
94
|
-
$
|
|
94
|
+
$346a586d9b655682$var$generateName(value + valueMap.size)
|
|
95
95
|
]
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
throw new Error('Invalid sizing value: ' + value);
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
function $
|
|
102
|
-
let valueMap = $
|
|
101
|
+
function $346a586d9b655682$export$852145629bb0d58b(colors, property) {
|
|
102
|
+
let valueMap = $346a586d9b655682$var$createValueLookup(Object.values(colors).flatMap((v)=>typeof v === 'object' ? Object.values(v) : [
|
|
103
103
|
v
|
|
104
104
|
]));
|
|
105
105
|
return (value, key)=>{
|
|
106
|
-
let v = $
|
|
106
|
+
let v = $346a586d9b655682$export$22a8270399010c94(value);
|
|
107
107
|
if (v) return {
|
|
108
108
|
default: [
|
|
109
109
|
{
|
|
@@ -114,7 +114,7 @@ function $b3643cb9d2948e30$export$852145629bb0d58b(colors, property) {
|
|
|
114
114
|
};
|
|
115
115
|
let [color, opacity] = value.split('/');
|
|
116
116
|
let c = colors[color];
|
|
117
|
-
return $
|
|
117
|
+
return $346a586d9b655682$var$mapConditionalValue(c, (value)=>{
|
|
118
118
|
let css = opacity ? `rgb(from ${value} r g b / ${opacity}%)` : value;
|
|
119
119
|
let selector = valueMap.get(value) + (opacity ? opacity.replace('.', '-') : '');
|
|
120
120
|
return [
|
|
@@ -126,18 +126,18 @@ function $b3643cb9d2948e30$export$852145629bb0d58b(colors, property) {
|
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
function $
|
|
129
|
+
function $346a586d9b655682$var$mapConditionalValue(value, fn) {
|
|
130
130
|
if (typeof value === 'object') {
|
|
131
131
|
let res = {};
|
|
132
|
-
for(let condition in value)res[condition] = $
|
|
132
|
+
for(let condition in value)res[condition] = $346a586d9b655682$var$mapConditionalValue(value[condition], fn);
|
|
133
133
|
return res;
|
|
134
134
|
} else return fn(value);
|
|
135
135
|
}
|
|
136
|
-
function $
|
|
136
|
+
function $346a586d9b655682$var$mapConditionalShorthand(value, fn) {
|
|
137
137
|
if (typeof value === 'object') {
|
|
138
138
|
let res = {};
|
|
139
139
|
for(let condition in value){
|
|
140
|
-
let properties = $
|
|
140
|
+
let properties = $346a586d9b655682$var$mapConditionalShorthand(value[condition], fn);
|
|
141
141
|
for(let property in properties){
|
|
142
142
|
res[property] ??= {};
|
|
143
143
|
res[property][condition] = properties[property];
|
|
@@ -146,27 +146,27 @@ function $b3643cb9d2948e30$var$mapConditionalShorthand(value, fn) {
|
|
|
146
146
|
return res;
|
|
147
147
|
} else return fn(value);
|
|
148
148
|
}
|
|
149
|
-
function $
|
|
149
|
+
function $346a586d9b655682$var$createValueLookup(values, atStart = false) {
|
|
150
150
|
let map = new Map();
|
|
151
|
-
for (let value of values)if (!map.has(value)) map.set(value, $
|
|
151
|
+
for (let value of values)if (!map.has(value)) map.set(value, $346a586d9b655682$var$generateName(map.size, atStart));
|
|
152
152
|
return map;
|
|
153
153
|
}
|
|
154
|
-
function $
|
|
154
|
+
function $346a586d9b655682$export$22a8270399010c94(value) {
|
|
155
155
|
if (typeof value === 'string' && value.startsWith('--')) return [
|
|
156
156
|
`var(${value})`,
|
|
157
|
-
$
|
|
157
|
+
$346a586d9b655682$var$generateArbitraryValueSelector(value)
|
|
158
158
|
];
|
|
159
159
|
else if (typeof value === 'string' && value[0] === '[' && value[value.length - 1] === ']') {
|
|
160
|
-
let s = $
|
|
160
|
+
let s = $346a586d9b655682$var$generateArbitraryValueSelector(value.slice(1, -1));
|
|
161
161
|
return [
|
|
162
162
|
value.slice(1, -1),
|
|
163
163
|
s
|
|
164
164
|
];
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function $
|
|
168
|
-
let themePropertyMap = $
|
|
169
|
-
let themeConditionMap = $
|
|
167
|
+
function $346a586d9b655682$export$25d302a5b900a763(theme) {
|
|
168
|
+
let themePropertyMap = $346a586d9b655682$var$createValueLookup(Object.keys(theme.properties), true);
|
|
169
|
+
let themeConditionMap = $346a586d9b655682$var$createValueLookup(Object.keys(theme.conditions), true);
|
|
170
170
|
let propertyFunctions = new Map(Object.entries(theme.properties).map(([k, v])=>{
|
|
171
171
|
if (typeof v === 'function') return [
|
|
172
172
|
k,
|
|
@@ -174,7 +174,7 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
174
174
|
];
|
|
175
175
|
return [
|
|
176
176
|
k,
|
|
177
|
-
$
|
|
177
|
+
$346a586d9b655682$export$40f4ff17b27355ab((value, p)=>({
|
|
178
178
|
[p]: value
|
|
179
179
|
}), v)
|
|
180
180
|
];
|
|
@@ -211,7 +211,7 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
211
211
|
if (theme.shorthands[key]) {
|
|
212
212
|
let shorthand = theme.shorthands[key];
|
|
213
213
|
if (typeof shorthand === 'function') {
|
|
214
|
-
let expanded = $
|
|
214
|
+
let expanded = $346a586d9b655682$var$mapConditionalShorthand(value, shorthand);
|
|
215
215
|
for(let k in expanded){
|
|
216
216
|
let v = expanded[k];
|
|
217
217
|
values.set(k, v);
|
|
@@ -247,7 +247,7 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
247
247
|
for(let i = 0; i <= usedPriorities; i++){
|
|
248
248
|
if (first) first = false;
|
|
249
249
|
else css += ', ';
|
|
250
|
-
css += $
|
|
250
|
+
css += $346a586d9b655682$var$layerName($346a586d9b655682$var$generateName(i, true));
|
|
251
251
|
}
|
|
252
252
|
css += ';\n\n';
|
|
253
253
|
// If allowed overrides are provided, generate code to match the input override string and include only allowed classes.
|
|
@@ -280,19 +280,19 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
280
280
|
let className = '';
|
|
281
281
|
let rulesByLayer = new Map();
|
|
282
282
|
for (let [property, propertyRules] of rules){
|
|
283
|
-
if (isStatic) className += $
|
|
283
|
+
if (isStatic) className += $346a586d9b655682$var$getStaticClassName(propertyRules);
|
|
284
284
|
else {
|
|
285
285
|
let themeProperty = themePropertyMap.get(property);
|
|
286
286
|
let allowsOverrides = themeProperty && allowedOverridesSet.has(themeProperty);
|
|
287
287
|
if (allowsOverrides) // Omit the value if an override was passed in.
|
|
288
288
|
js += `if (!$${themeProperty}) {\n`;
|
|
289
|
-
js += $
|
|
289
|
+
js += $346a586d9b655682$var$printJS(propertyRules) + '\n';
|
|
290
290
|
if (allowsOverrides) js += '}\n';
|
|
291
291
|
}
|
|
292
|
-
for (let rule of propertyRules)$
|
|
292
|
+
for (let rule of propertyRules)$346a586d9b655682$var$printRule(rule, rulesByLayer);
|
|
293
293
|
}
|
|
294
294
|
for (let [layer, rules] of rulesByLayer){
|
|
295
|
-
css += `@layer ${$
|
|
295
|
+
css += `@layer ${$346a586d9b655682$var$layerName(layer)} {\n`;
|
|
296
296
|
css += rules.join('\n\n');
|
|
297
297
|
css += '}\n\n';
|
|
298
298
|
}
|
|
@@ -382,8 +382,8 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
382
382
|
if (prelude.startsWith(':')) return [
|
|
383
383
|
{
|
|
384
384
|
prelude: '',
|
|
385
|
-
layer: $
|
|
386
|
-
body: rules.map((rule)=>$
|
|
385
|
+
layer: $346a586d9b655682$var$generateName(priority, true),
|
|
386
|
+
body: rules.map((rule)=>$346a586d9b655682$var$nestRule(rule, prelude)),
|
|
387
387
|
condition: ''
|
|
388
388
|
}
|
|
389
389
|
];
|
|
@@ -392,7 +392,7 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
392
392
|
{
|
|
393
393
|
// Top level layer is based on the priority of the rule, not the condition.
|
|
394
394
|
// Also group in a sub-layer based on the condition so that lightningcss can more effectively deduplicate rules.
|
|
395
|
-
layer: `${$
|
|
395
|
+
layer: `${$346a586d9b655682$var$generateName(priority, true)}.${themeConditionMap.get(condition) || $346a586d9b655682$var$generateArbitraryValueSelector(condition, true)}`,
|
|
396
396
|
prelude: prelude,
|
|
397
397
|
body: rules,
|
|
398
398
|
condition: ''
|
|
@@ -416,7 +416,7 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
416
416
|
// 3. Value. The index in the theme, or a hash for arbitrary values.
|
|
417
417
|
let prelude = '.';
|
|
418
418
|
if (property.startsWith('--')) // Include both custom property name and theme property in case the same var is reused between multiple theme properties.
|
|
419
|
-
prelude += $
|
|
419
|
+
prelude += $346a586d9b655682$var$generateArbitraryValueSelector(property, true) + '_' + themePropertyMap.get(themeProperty) + '-';
|
|
420
420
|
else prelude += themePropertyMap.get(themeProperty);
|
|
421
421
|
let propertyFunction = propertyFunctions.get(themeProperty);
|
|
422
422
|
if (propertyFunction) {
|
|
@@ -434,10 +434,10 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
434
434
|
dependencies.add(v);
|
|
435
435
|
return `var(--${themePropertyMap.get(v)}`;
|
|
436
436
|
});
|
|
437
|
-
body += `${$
|
|
437
|
+
body += `${$346a586d9b655682$var$kebab(key)}: ${value};`;
|
|
438
438
|
}
|
|
439
439
|
let selector = prelude;
|
|
440
|
-
if (conditions.size > 0) for (let condition of conditions)selector += themeConditionMap.get(condition) || $
|
|
440
|
+
if (conditions.size > 0) for (let condition of conditions)selector += themeConditionMap.get(condition) || $346a586d9b655682$var$generateArbitraryValueSelector(condition);
|
|
441
441
|
let rules = [
|
|
442
442
|
{
|
|
443
443
|
condition: '',
|
|
@@ -454,11 +454,11 @@ function $b3643cb9d2948e30$export$25d302a5b900a763(theme) {
|
|
|
454
454
|
} else throw new Error('Unknown property ' + themeProperty);
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
|
-
function $
|
|
457
|
+
function $346a586d9b655682$var$nestRule(rule, prelude) {
|
|
458
458
|
if (Array.isArray(rule.body)) return {
|
|
459
459
|
prelude: rule.prelude,
|
|
460
460
|
layer: rule.layer,
|
|
461
|
-
body: rule.body.map((r)=>$
|
|
461
|
+
body: rule.body.map((r)=>$346a586d9b655682$var$nestRule(r, prelude)),
|
|
462
462
|
condition: rule.condition
|
|
463
463
|
};
|
|
464
464
|
else return {
|
|
@@ -473,7 +473,7 @@ function $b3643cb9d2948e30$var$nestRule(rule, prelude) {
|
|
|
473
473
|
condition: ''
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
-
function $
|
|
476
|
+
function $346a586d9b655682$var$kebab(property) {
|
|
477
477
|
if (property.startsWith('--')) return property;
|
|
478
478
|
return property.replace(/([a-z])([A-Z])/g, (_, a, b)=>`${a}-${b.toLowerCase()}`);
|
|
479
479
|
}
|
|
@@ -481,34 +481,34 @@ function $b3643cb9d2948e30$var$kebab(property) {
|
|
|
481
481
|
// This maps to an alphabet containing lower case letters, upper case letters, and numbers.
|
|
482
482
|
// For numbers larger than 62, an underscore is prepended.
|
|
483
483
|
// This encoding allows easy parsing to enable runtime merging by property.
|
|
484
|
-
function $
|
|
484
|
+
function $346a586d9b655682$var$generateName(index, atStart = false) {
|
|
485
485
|
if (index < 26) // lower case letters
|
|
486
486
|
return String.fromCharCode(index + 97);
|
|
487
487
|
if (index < 52) // upper case letters
|
|
488
488
|
return String.fromCharCode(index - 26 + 65);
|
|
489
489
|
if (index < 62 && !atStart) // numbers
|
|
490
490
|
return String.fromCharCode(index - 52 + 48);
|
|
491
|
-
return '_' + $
|
|
491
|
+
return '_' + $346a586d9b655682$var$generateName(index - (atStart ? 52 : 62));
|
|
492
492
|
}
|
|
493
493
|
// For arbitrary values, we use a hash of the string to generate the class name.
|
|
494
|
-
function $
|
|
495
|
-
let c = $
|
|
494
|
+
function $346a586d9b655682$var$generateArbitraryValueSelector(v, atStart = false) {
|
|
495
|
+
let c = $346a586d9b655682$var$hash(v).toString(36);
|
|
496
496
|
if (atStart && /^[0-9]/.test(c)) c = `_${c}`;
|
|
497
497
|
return `-${c}`;
|
|
498
498
|
}
|
|
499
499
|
// djb2 hash function.
|
|
500
500
|
// http://www.cse.yorku.ca/~oz/hash.html
|
|
501
|
-
function $
|
|
501
|
+
function $346a586d9b655682$var$hash(v) {
|
|
502
502
|
let hash = 5381;
|
|
503
503
|
for(let i = 0; i < v.length; i++)hash = (hash << 5) + hash + v.charCodeAt(i) >>> 0;
|
|
504
504
|
return hash;
|
|
505
505
|
}
|
|
506
|
-
function $
|
|
506
|
+
function $346a586d9b655682$var$layerName(name) {
|
|
507
507
|
// All of our layers should be sub-layers of a single parent layer, so that
|
|
508
508
|
// the unsafe overrides layer always comes after.
|
|
509
509
|
return `_.${name}`;
|
|
510
510
|
}
|
|
511
|
-
function $
|
|
511
|
+
function $346a586d9b655682$var$printRule(rule, rulesByLayer, preludes = [], layer = 'a') {
|
|
512
512
|
if (rule.prelude) preludes.push(rule.prelude);
|
|
513
513
|
if (typeof rule.body === 'string') {
|
|
514
514
|
// Nest rule in our stack of preludes (e.g. media queries/selectors).
|
|
@@ -527,36 +527,36 @@ function $b3643cb9d2948e30$var$printRule(rule, rulesByLayer, preludes = [], laye
|
|
|
527
527
|
rulesByLayer.set(rule.layer || layer, rules);
|
|
528
528
|
}
|
|
529
529
|
rules.push(content);
|
|
530
|
-
} else for (let b of rule.body)$
|
|
530
|
+
} else for (let b of rule.body)$346a586d9b655682$var$printRule(b, rulesByLayer, preludes, rule.layer || layer);
|
|
531
531
|
if (rule.prelude) preludes.pop();
|
|
532
532
|
}
|
|
533
|
-
function $
|
|
533
|
+
function $346a586d9b655682$var$printJS(rules, indent = '') {
|
|
534
534
|
rules = rules.slice().reverse();
|
|
535
535
|
let conditional = rules.filter((rule)=>rule.condition).map((rule, i)=>{
|
|
536
|
-
return `${i > 0 ? ' else ' : ''}if (props.${rule.condition}) {\n${indent} ${$
|
|
536
|
+
return `${i > 0 ? ' else ' : ''}if (props.${rule.condition}) {\n${indent} ${$346a586d9b655682$var$printRuleChildren(rule, indent + ' ')}\n${indent}}`;
|
|
537
537
|
});
|
|
538
|
-
let elseCases = rules.filter((rule)=>!rule.condition).map((rule)=>$
|
|
538
|
+
let elseCases = rules.filter((rule)=>!rule.condition).map((rule)=>$346a586d9b655682$var$printRuleChildren(rule, indent + ' '));
|
|
539
539
|
if (conditional.length && elseCases.length) return `${conditional.join('')} else {\n${indent} ${elseCases.join('\n' + indent + ' ')}\n${indent}}`;
|
|
540
540
|
if (conditional.length) return conditional.join('');
|
|
541
541
|
return elseCases.join('\n' + indent);
|
|
542
542
|
}
|
|
543
|
-
function $
|
|
543
|
+
function $346a586d9b655682$var$printRuleChildren(rule, indent = '') {
|
|
544
544
|
let res = '';
|
|
545
545
|
if (rule.prelude.startsWith('.')) res += `rules += ' ${rule.prelude.slice(1)}';`;
|
|
546
|
-
if (Array.isArray(rule.body)) res += $
|
|
546
|
+
if (Array.isArray(rule.body)) res += $346a586d9b655682$var$printJS(rule.body, indent);
|
|
547
547
|
return res;
|
|
548
548
|
}
|
|
549
|
-
function $
|
|
550
|
-
return rules.map((rule)=>(rule.prelude.startsWith('.') ? ' ' + rule.prelude.slice(1) : '') + (Array.isArray(rule.body) ? $
|
|
549
|
+
function $346a586d9b655682$var$getStaticClassName(rules) {
|
|
550
|
+
return rules.map((rule)=>(rule.prelude.startsWith('.') ? ' ' + rule.prelude.slice(1) : '') + (Array.isArray(rule.body) ? $346a586d9b655682$var$getStaticClassName(rule.body) : '')).join('');
|
|
551
551
|
}
|
|
552
|
-
function $
|
|
552
|
+
function $346a586d9b655682$export$1776c186c69df29e(css, layer = '_.a') {
|
|
553
553
|
// Check if `this` is undefined, which means style was not called as a macro but as a normal function.
|
|
554
554
|
// We also check if this is globalThis, which happens in non-strict mode bundles.
|
|
555
555
|
// Also allow style to be called as a normal function in tests.
|
|
556
556
|
// @ts-ignore
|
|
557
557
|
// eslint-disable-next-line
|
|
558
558
|
if ((this == null || this === globalThis) && process.env.NODE_ENV !== 'test') throw new Error('The raw macro must be imported with {type: "macro"}.');
|
|
559
|
-
let className = $
|
|
559
|
+
let className = $346a586d9b655682$var$generateArbitraryValueSelector(css, true);
|
|
560
560
|
css = `@layer ${layer} {
|
|
561
561
|
.${className} {
|
|
562
562
|
${css}
|
|
@@ -570,14 +570,14 @@ function $b3643cb9d2948e30$export$1776c186c69df29e(css, layer = '_.a') {
|
|
|
570
570
|
});
|
|
571
571
|
return className;
|
|
572
572
|
}
|
|
573
|
-
function $
|
|
573
|
+
function $346a586d9b655682$export$d25ddfdf17c3ad3e(css) {
|
|
574
574
|
// Check if `this` is undefined, which means style was not called as a macro but as a normal function.
|
|
575
575
|
// We also check if this is globalThis, which happens in non-strict mode bundles.
|
|
576
576
|
// Also allow style to be called as a normal function in tests.
|
|
577
577
|
// @ts-ignore
|
|
578
578
|
// eslint-disable-next-line
|
|
579
579
|
if ((this == null || this === globalThis) && process.env.NODE_ENV !== 'test') throw new Error('The keyframes macro must be imported with {type: "macro"}.');
|
|
580
|
-
let name = $
|
|
580
|
+
let name = $346a586d9b655682$var$generateArbitraryValueSelector(css, true);
|
|
581
581
|
css = `@keyframes ${name} {
|
|
582
582
|
${css}
|
|
583
583
|
}`;
|