@stylix/core 4.1.1 → 5.0.0

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/dist/module.mjs DELETED
@@ -1,866 +0,0 @@
1
- import $10ngl$react, {createContext as $10ngl$createContext, useContext as $10ngl$useContext, useRef as $10ngl$useRef, useState as $10ngl$useState, useLayoutEffect as $10ngl$useLayoutEffect} from "react";
2
-
3
- function $parcel$interopDefault(a) {
4
- return a && a.__esModule ? a.default : a;
5
- }
6
-
7
-
8
- function $3ff9dea9e2b78201$export$54b296e95917282f(props, knownProps) {
9
- const styles = {};
10
- const other = {};
11
- for(const prop in props)// If prop is not a valid JSX prop, it must be a CSS selector
12
- if (!$3ff9dea9e2b78201$export$4ee529ad08c1c79c(prop) || $3ff9dea9e2b78201$export$95b76554d0cd12d6(prop, knownProps) && $3ff9dea9e2b78201$export$bd35f4abe4dfe31c(props[prop])) styles[prop] = props[prop];
13
- else other[prop] = props[prop];
14
- return [
15
- styles,
16
- other
17
- ];
18
- }
19
- function $3ff9dea9e2b78201$export$34c29a98f3a9910(props) {
20
- const ctx = (0, $ce69b86a5144edcd$export$e3c6fdf4e371f028)();
21
- const [styles, other] = $3ff9dea9e2b78201$export$54b296e95917282f(props, ctx.styleProps);
22
- return [
23
- styles,
24
- other
25
- ];
26
- }
27
- function $3ff9dea9e2b78201$export$95b76554d0cd12d6(prop, knownProps) {
28
- return $3ff9dea9e2b78201$export$4ee529ad08c1c79c(prop) && $3ff9dea9e2b78201$export$2eda63d9f5a68c09(prop) in knownProps;
29
- }
30
- function $3ff9dea9e2b78201$export$4ee529ad08c1c79c(value) {
31
- // Not an exact check, but mostly rules out complex css selectors
32
- return /^[a-z$][a-z0-9_-]*$/i.test(value);
33
- }
34
- function $3ff9dea9e2b78201$export$2eda63d9f5a68c09(value) {
35
- return value.toLowerCase().replace(/[^a-z]/gi, "");
36
- }
37
- function $3ff9dea9e2b78201$export$bd35f4abe4dfe31c(value) {
38
- return typeof value === "function" || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "undefined" || Array.isArray(value) || value === null || // Check for plain objects, and make sure it doesn't have the $$typeof property (react elements are never valid as style values)
39
- typeof value === "object" && value.constructor === Object && !("$$typeof" in value);
40
- }
41
-
42
-
43
- var $a2745028d395a990$exports = {};
44
- $a2745028d395a990$exports = JSON.parse('["align-content","align-items","align-self","align-tracks","all","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","aspect-ratio","azimuth","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","block-overflow","block-size","border","border-block","border-block-color","border-block-style","border-block-width","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-end","border-inline-color","border-inline-style","border-inline-width","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","color","color-adjust","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","content","content-visibility","counter-increment","counter-reset","counter-set","cursor","direction","display","empty-cells","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-variation-settings","font-size","font-size-adjust","font-smooth","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","forced-color-adjust","gap","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","justify-tracks","left","letter-spacing","line-break","line-clamp","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-style","max-block-size","max-height","max-inline-size","max-lines","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-box","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page-break-after","page-break-before","page-break-inside","paint-order","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","quotes","resize","right","rotate","row-gap","ruby-align","ruby-merge","ruby-position","scale","scrollbar-color","scrollbar-gutter","scrollbar-width","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-start","scroll-margin-block-end","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-start","scroll-margin-inline-end","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-start","scroll-padding-block-end","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-start","scroll-padding-inline-end","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-coordinate","scroll-snap-destination","scroll-snap-points-x","scroll-snap-points-y","scroll-snap-stop","scroll-snap-type","scroll-snap-type-x","scroll-snap-type-y","shape-image-threshold","shape-margin","shape-outside","tab-size","table-layout","text-align","text-align-last","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-select","vertical-align","visibility","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","z-index","zoom"]');
45
-
46
-
47
- /**
48
- * Indicates that an object is most likely just an object literal.
49
- */ function $edf5ed4fba86638e$export$53b83ca8eaab0383(obj) {
50
- return typeof obj === "object" && obj?.constructor === Object;
51
- }
52
-
53
-
54
- function $0e5c015e7b007f3a$var$cleanObject(object) {
55
- for(const key in object){
56
- const value = object[key];
57
- if (value === null || value === undefined || value === "") delete object[key];
58
- else if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value) || Array.isArray(value)) {
59
- $0e5c015e7b007f3a$var$cleanObject(value);
60
- if (!Object.keys(value).length) delete object[key];
61
- }
62
- }
63
- return object;
64
- }
65
- const $0e5c015e7b007f3a$export$d01916932d7c8665 = {
66
- name: "cleanStyles",
67
- type: "processStyles",
68
- plugin (ctx, styles) {
69
- return $0e5c015e7b007f3a$var$cleanObject(styles);
70
- }
71
- };
72
-
73
-
74
-
75
- function $aaadd42d89c94302$export$72ae87c5302f282e(object, map, context = {}) {
76
- const clone = Array.isArray(object) ? [] : {};
77
- for (const k of Object.keys(object)){
78
- let key = k;
79
- const value = object[key];
80
- if (Array.isArray(object)) key = +key;
81
- const contextClone = {
82
- ...context
83
- };
84
- let result = map(key, value, object, contextClone);
85
- if (typeof result !== "undefined" && typeof result !== "object" && !Array.isArray(result)) throw new Error("mapObjectRecursive: return value of map function must be undefined, object, or array!");
86
- if (typeof result === "undefined") result = {
87
- [key]: value
88
- };
89
- for(const kk in result){
90
- let value = result[kk];
91
- if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value) || Array.isArray(value)) value = $aaadd42d89c94302$export$72ae87c5302f282e(value, map, contextClone);
92
- if (typeof value !== "undefined") clone[kk] = value;
93
- }
94
- }
95
- return clone;
96
- }
97
-
98
-
99
- const $d7a178c62e252f70$export$dada68e03f41f865 = [
100
- "columns",
101
- "column-count",
102
- "fill-opacity",
103
- "flex",
104
- "flex-grow",
105
- "flex-shrink",
106
- "font-weight",
107
- "line-height",
108
- "opacity",
109
- "orphans",
110
- "stroke-opacity",
111
- "widows",
112
- "z-index",
113
- "zoom",
114
- "order"
115
- ];
116
- const $d7a178c62e252f70$export$18583267fbb07c11 = (unit = "px", ignoreProps = $d7a178c62e252f70$export$dada68e03f41f865)=>{
117
- return {
118
- name: "defaultUnits",
119
- type: "processStyles",
120
- plugin (ctx, styles) {
121
- return (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $d7a178c62e252f70$var$defaultUnitsMap, {
122
- unit: unit,
123
- ignoreProps: ignoreProps
124
- });
125
- }
126
- };
127
- };
128
- const $d7a178c62e252f70$var$defaultUnitsMap = (key, value, object, ctx)=>{
129
- if (typeof value === "number" && !ctx.ignoreProps.includes(key)) return {
130
- [key]: String(value) + ctx.unit
131
- };
132
- };
133
- const $d7a178c62e252f70$export$30fd8e83e8b8d3e8 = $d7a178c62e252f70$export$18583267fbb07c11();
134
-
135
-
136
-
137
- function $cc50451802495710$var$flatten(styles, parent, selector, root, mediaRoot) {
138
- for(let key in styles){
139
- const value = styles[key];
140
- if (key.startsWith("@media")) {
141
- // Flatten media queries, but nest them under the root object
142
- root[key] = root[key] || {};
143
- $cc50451802495710$var$flatten(value, root[key], selector, root, root[key]);
144
- } else if (key.startsWith("@keyframes")) // Add keyframe rules as-is directly to mediaRoot object
145
- mediaRoot[key] = value;
146
- else if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(styles[key])) {
147
- // Concatenate or replace & in selectors and then continue flattening styles
148
- if (key.includes("&")) key = key.replace(/&/g, selector);
149
- else key = (selector + " " + key).trim();
150
- parent[key] = parent[key] || {};
151
- $cc50451802495710$var$flatten(value, parent, key, root, mediaRoot);
152
- } else {
153
- // Selector is just a css property
154
- parent[selector] = parent[selector] || {};
155
- parent[selector][key] = styles[key];
156
- }
157
- }
158
- }
159
- const $cc50451802495710$export$83990f03bc941cb5 = {
160
- name: "flattenNestedStyles",
161
- type: "processStyles",
162
- plugin (ctx, styles) {
163
- const flattened = {};
164
- $cc50451802495710$var$flatten(styles, flattened, "", flattened, flattened);
165
- return flattened;
166
- }
167
- };
168
-
169
-
170
-
171
-
172
- const $5f434cd9a2aebf44$export$7cc8703894decffe = {
173
- name: "mediaArrays",
174
- type: "processStyles",
175
- plugin (ctx, styles) {
176
- // Fill out ditto values
177
- styles = (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $5f434cd9a2aebf44$var$mapDittoValues);
178
- const mediaStyles = {};
179
- let nonMediaStyles = styles;
180
- for(const i in ctx.media){
181
- const mediaQuery = ctx.media[i];
182
- if (!mediaQuery) nonMediaStyles = (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $5f434cd9a2aebf44$var$mapNonMedia, {
183
- i: i
184
- });
185
- else mediaStyles[`@media ${mediaQuery}`] = (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $5f434cd9a2aebf44$var$mapMediaStyles, {
186
- i: i
187
- });
188
- }
189
- return {
190
- ...nonMediaStyles,
191
- ...mediaStyles
192
- };
193
- }
194
- };
195
- function $5f434cd9a2aebf44$var$mapDittoValues(key, value) {
196
- if (Array.isArray(value)) {
197
- for(const i in value){
198
- const v = value[i];
199
- if (v === "@") value[i] = value[+i - 1];
200
- }
201
- return {
202
- [key]: value
203
- };
204
- }
205
- }
206
- function $5f434cd9a2aebf44$var$mapNonMedia(key, value, object, context) {
207
- if (Array.isArray(value)) return {
208
- [key]: value[context.i]
209
- };
210
- }
211
- function $5f434cd9a2aebf44$var$mapMediaStyles(key, value, object, context) {
212
- if (typeof key === "number") return; // Not possible, but here for TS
213
- if (key.startsWith("@keyframes")) context.keyframes = true;
214
- if (Array.isArray(value)) return {
215
- [key]: value[context.i]
216
- };
217
- if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value) || context.keyframes) return;
218
- // delete key/value pair if primitive
219
- return {
220
- [key]: undefined
221
- };
222
- }
223
-
224
-
225
- /**
226
- * Flatten an array recursively.
227
- */ function $63603460f37659a2$export$bffa455ba8c619a6(array) {
228
- const result = [];
229
- $63603460f37659a2$var$_flatten(array, result);
230
- return result;
231
- }
232
- function $63603460f37659a2$var$_flatten(array, result) {
233
- for(let i = 0; i < array.length; i++){
234
- const value = array[i];
235
- Array.isArray(value) ? $63603460f37659a2$var$_flatten(value, result) : result.push(value);
236
- }
237
- }
238
-
239
-
240
-
241
- const $3eb676b5e9eeeb72$export$3fc9bcb7effc6280 = {
242
- name: "merge$css",
243
- type: "processStyles",
244
- plugin (ctx, styles) {
245
- const result = {};
246
- $3eb676b5e9eeeb72$export$f9e25e3471fd9b77(styles, result);
247
- return result;
248
- }
249
- };
250
- function $3eb676b5e9eeeb72$export$f9e25e3471fd9b77(obj, ctx) {
251
- if (!(0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(obj)) return;
252
- for(const key in obj)if (key === "$css") {
253
- const $css = obj[key];
254
- if (Array.isArray($css)) {
255
- const flat$css = (0, $63603460f37659a2$export$bffa455ba8c619a6)($css);
256
- for (const val of flat$css)$3eb676b5e9eeeb72$export$f9e25e3471fd9b77(val, ctx);
257
- } else $3eb676b5e9eeeb72$export$f9e25e3471fd9b77($css, ctx);
258
- } else {
259
- let value = obj[key];
260
- if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value)) {
261
- value = ctx[key] || {};
262
- $3eb676b5e9eeeb72$export$f9e25e3471fd9b77(obj[key], value);
263
- }
264
- ctx[key] = value;
265
- }
266
- }
267
-
268
-
269
-
270
-
271
- const $c4f1751057a2356d$export$d85214c343312efe = {
272
- name: "propCasing",
273
- type: "processStyles",
274
- plugin (ctx, styles) {
275
- return (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $c4f1751057a2356d$var$propCasingMap, {
276
- ctx: ctx
277
- });
278
- }
279
- };
280
- function $c4f1751057a2356d$var$propCasingMap(key, value, object, context) {
281
- if (typeof key !== "string") return;
282
- const simpleKey = (0, $3ff9dea9e2b78201$export$2eda63d9f5a68c09)(key);
283
- if (simpleKey in context.ctx.styleProps) return {
284
- [context.ctx.styleProps[simpleKey]]: value
285
- };
286
- }
287
-
288
-
289
-
290
- const $ae7f145112a15dd5$export$a5988781fa300750 = {
291
- name: "replace$$class",
292
- type: "processStyles",
293
- plugin (ctx, styles) {
294
- return (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $ae7f145112a15dd5$var$replace$$classMap, {
295
- ctx: ctx
296
- });
297
- }
298
- };
299
- function $ae7f145112a15dd5$var$replace$$classMap(key, value, object, context) {
300
- value = typeof value === "string" ? value.replace("$$class", context.ctx.hash) : value;
301
- key = typeof key === "string" ? key.replace("$$class", context.ctx.hash) : key;
302
- return {
303
- [key]: value
304
- };
305
- }
306
-
307
-
308
-
309
- const $ee5098dc94e032ed$export$d9c204138d106585 = {
310
- name: "themeFunctions",
311
- type: "preprocessStyles",
312
- plugin (ctx, styles) {
313
- return (0, $aaadd42d89c94302$export$72ae87c5302f282e)(styles, $ee5098dc94e032ed$var$themeFunctionsMap, {
314
- ctx: ctx
315
- });
316
- }
317
- };
318
- function $ee5098dc94e032ed$var$themeFunctionsMap(key, value, object, context) {
319
- if (typeof value === "function") return {
320
- [key]: value(context.ctx.theme, context.ctx)
321
- };
322
- }
323
-
324
-
325
-
326
-
327
-
328
- function $b605e3734a054da2$export$629a2bd3f5a49ecc(value) {
329
- if (!value || typeof value !== "object") return value;
330
- if (Array.isArray(value)) {
331
- const clone = [];
332
- for(let index = 0; index < value.length; ++index)clone.push($b605e3734a054da2$export$629a2bd3f5a49ecc(value[index]));
333
- return clone;
334
- }
335
- if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value)) {
336
- const clone = {};
337
- for(const key in value)clone[key] = $b605e3734a054da2$export$629a2bd3f5a49ecc(value[key]);
338
- return clone;
339
- }
340
- return value;
341
- }
342
-
343
-
344
-
345
- function $b14b1781b09bbb5d$export$a8d8e56b740dab80(object, cb, context) {
346
- const keys = Object.keys(object);
347
- for (const key of keys){
348
- const value = object[key];
349
- cb(key, value, object, context);
350
- if (Array.isArray(value) || (0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value)) {
351
- const contextClone = (0, $b605e3734a054da2$export$629a2bd3f5a49ecc)(context);
352
- $b14b1781b09bbb5d$export$a8d8e56b740dab80(value, cb, contextClone);
353
- }
354
- }
355
- return object;
356
- }
357
-
358
-
359
-
360
- const $61d992b103afb529$export$95cef81be5ddcfd4 = (customProps)=>{
361
- for(const key in customProps)customProps[(0, $3ff9dea9e2b78201$export$2eda63d9f5a68c09)(key)] = customProps[key];
362
- return [
363
- {
364
- name: "customPropsInit",
365
- type: "initialize",
366
- plugin (ctx) {
367
- for(const key in customProps)ctx.styleProps[(0, $3ff9dea9e2b78201$export$2eda63d9f5a68c09)(key)] = key;
368
- }
369
- },
370
- {
371
- name: "customPropsProcess",
372
- type: "processStyles",
373
- before: (0, $5f434cd9a2aebf44$export$7cc8703894decffe),
374
- plugin (ctx, styles) {
375
- return (0, $b14b1781b09bbb5d$export$a8d8e56b740dab80)(styles, (key, value, object)=>{
376
- if (!(0, $3ff9dea9e2b78201$export$4ee529ad08c1c79c)(key) || (0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value)) return;
377
- const simpleKey = (0, $3ff9dea9e2b78201$export$2eda63d9f5a68c09)(key);
378
- const propValue = customProps[simpleKey];
379
- if (!propValue) return;
380
- const objectClone = {
381
- ...object
382
- };
383
- const keys = Object.keys(object);
384
- const afterKeys = keys.slice(keys.indexOf(key) + 1);
385
- const newStyles = {};
386
- if (typeof propValue === "object") {
387
- if (value) Object.assign(newStyles, propValue);
388
- } else if (typeof propValue === "string") newStyles[propValue] = value;
389
- else if (typeof propValue === "function") Object.assign(newStyles, propValue(value));
390
- delete object[key];
391
- Object.assign(object, newStyles);
392
- for (const k of afterKeys){
393
- const val = objectClone[k];
394
- delete object[k];
395
- object[k] = val;
396
- }
397
- });
398
- }
399
- }
400
- ];
401
- };
402
-
403
-
404
- function $79720bf00c08b491$export$dd20d84ec8823bbf(type, styles, hash, context) {
405
- const pluginContext = {
406
- id: context.id,
407
- devMode: context.devMode,
408
- theme: context.theme,
409
- media: context.media,
410
- stylesheet: context.stylesheet,
411
- styleElement: context.styleElement,
412
- styleProps: context.styleProps,
413
- hash: hash
414
- };
415
- let processedStyles = styles;
416
- for(const i in context.plugins){
417
- const plugin = context.plugins[i];
418
- if (plugin.type === type) processedStyles = plugin.plugin(pluginContext, processedStyles);
419
- }
420
- return processedStyles;
421
- }
422
- const $79720bf00c08b491$export$b5ecb47695d6786e = {
423
- themeFunctions: $ee5098dc94e032ed$export$d9c204138d106585,
424
- merge$css: $3eb676b5e9eeeb72$export$3fc9bcb7effc6280,
425
- mediaArrays: $5f434cd9a2aebf44$export$7cc8703894decffe,
426
- propCasing: $c4f1751057a2356d$export$d85214c343312efe,
427
- flattenNestedStyles: $cc50451802495710$export$83990f03bc941cb5,
428
- replace$$class: $ae7f145112a15dd5$export$a5988781fa300750,
429
- defaultPixelUnits: $d7a178c62e252f70$export$30fd8e83e8b8d3e8,
430
- cleanStyles: $0e5c015e7b007f3a$export$d01916932d7c8665
431
- };
432
-
433
-
434
-
435
- const $98cf2ff196b5431f$export$9b609b8e22cde6fe = /*#__PURE__*/ (0, $10ngl$createContext)(null);
436
- function $98cf2ff196b5431f$export$d3207b3764661c07() {
437
- const styles = [];
438
- const collector = {
439
- collect: (element)=>/*#__PURE__*/ (0, $10ngl$react).createElement($98cf2ff196b5431f$export$9b609b8e22cde6fe.Provider, {
440
- value: styles
441
- }, element),
442
- render: (props)=>/*#__PURE__*/ (0, $10ngl$react).createElement("style", {
443
- type: "text/css",
444
- key: props.id || "stylix",
445
- ...props,
446
- dangerouslySetInnerHTML: {
447
- __html: collector.styles.join(" ")
448
- }
449
- }),
450
- styles: styles
451
- };
452
- collector.render.displayName = "StylixStyleCollectorRenderer";
453
- return collector;
454
- }
455
-
456
-
457
-
458
-
459
- function $45e5eedfea1753e9$export$4950aa0f605343fb(...items) {
460
- items = items.filter((item)=>typeof item !== "undefined" && item !== null);
461
- if (!items?.length) return undefined;
462
- if (items.length === 1) return items[0];
463
- // If items are not all objects/arrays, return the last object/array if possible, otherwise last non-undefined value
464
- if (!items.every((item)=>Array.isArray(item) || (0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(item))) {
465
- items.reverse();
466
- return items.find((item)=>Array.isArray(item) || (0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(item)) || items.find((item)=>typeof item !== "undefined");
467
- }
468
- const merged = Array.isArray(items[0]) ? [] : {};
469
- for (const item of items){
470
- if (!Array.isArray(item) && !(0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(item)) return merged;
471
- const keys = [
472
- ...Object.keys(item),
473
- ...Object.getOwnPropertySymbols(item)
474
- ];
475
- for (const key of keys){
476
- const result = $45e5eedfea1753e9$export$4950aa0f605343fb(merged[key], item[key]);
477
- if (typeof result !== "undefined") merged[key] = result;
478
- }
479
- }
480
- return merged;
481
- }
482
-
483
-
484
-
485
- const $bb477ec7853da8e9$var$useIsoLayoutEffect = typeof window !== "undefined" && "document" in window ? (fn, deps, _runOnSsr)=>(0, $10ngl$useLayoutEffect)(fn, deps) : (fn, _deps, runOnSsr)=>runOnSsr ? fn() : null;
486
- var $bb477ec7853da8e9$export$2e2bcd8739ae039 = $bb477ec7853da8e9$var$useIsoLayoutEffect;
487
-
488
-
489
- const $ce69b86a5144edcd$var$defaultStyleProps = {};
490
- for (const value of (0, (/*@__PURE__*/$parcel$interopDefault($a2745028d395a990$exports))))$ce69b86a5144edcd$var$defaultStyleProps[(0, $3ff9dea9e2b78201$export$2eda63d9f5a68c09)(value)] = value;
491
- function $ce69b86a5144edcd$var$createStylixContext(userValues = {}) {
492
- const ctx = {
493
- id: userValues.id || Math.round(Math.random() * 10000).toString(10),
494
- devMode: userValues.devMode,
495
- styleProps: $ce69b86a5144edcd$var$defaultStyleProps,
496
- theme: userValues.theme || null,
497
- media: userValues.media || null,
498
- styleElement: userValues.styleElement,
499
- plugins: (0, $63603460f37659a2$export$bffa455ba8c619a6)(Object.values((0, $79720bf00c08b491$export$b5ecb47695d6786e))),
500
- rules: {},
501
- cleanupRequest: undefined
502
- };
503
- if (!ctx.styleElement && typeof document !== "undefined") {
504
- if (!ctx.devMode && "adoptedStyleSheets" in document) {
505
- ctx.stylesheet = new CSSStyleSheet();
506
- document.adoptedStyleSheets.push(ctx.stylesheet);
507
- } else {
508
- // Legacy/devMode method
509
- // TS assumes window.document is 'never', so we need to explicitly cast it to Document
510
- const doc = document;
511
- ctx.styleElement = doc.createElement("style");
512
- ctx.styleElement.className = "stylix";
513
- if (ctx.id) ctx.styleElement.id = "stylix-" + ctx.id;
514
- doc.head.appendChild(ctx.styleElement);
515
- }
516
- }
517
- if (ctx.styleElement) ctx.stylesheet = ctx.styleElement.sheet;
518
- if (userValues.plugins?.length) {
519
- const flatPlugins = (0, $63603460f37659a2$export$bffa455ba8c619a6)(userValues.plugins);
520
- for(const i in flatPlugins){
521
- const plugin = flatPlugins[i];
522
- let pluginIndex = -1;
523
- if (plugin.before && ctx.plugins.includes(plugin.before)) pluginIndex = ctx.plugins.indexOf(plugin.before);
524
- if (plugin.after && ctx.plugins.includes(plugin.after)) pluginIndex = ctx.plugins.indexOf(plugin.after) + 1;
525
- if (plugin.atIndex !== undefined) pluginIndex = plugin.atIndex;
526
- if (pluginIndex === -1) ctx.plugins.push(plugin);
527
- else ctx.plugins.splice(pluginIndex, 0, plugin);
528
- }
529
- }
530
- (0, $79720bf00c08b491$export$dd20d84ec8823bbf)("initialize", null, null, ctx);
531
- return ctx;
532
- }
533
- // The React context object
534
- const $ce69b86a5144edcd$var$stylixContext = /*#__PURE__*/ (0, $10ngl$createContext)($ce69b86a5144edcd$var$createStylixContext());
535
- function $ce69b86a5144edcd$export$e3c6fdf4e371f028() {
536
- return (0, $10ngl$useContext)($ce69b86a5144edcd$var$stylixContext);
537
- }
538
- function $ce69b86a5144edcd$export$c01a354187f160ee() {
539
- return (0, $10ngl$useContext)($ce69b86a5144edcd$var$stylixContext).theme;
540
- }
541
- function $ce69b86a5144edcd$export$ae2c3ad5c234c4cc({ id: id , devMode: devMode , plugins: plugins , styleElement: styleElement , children: children , ...themeProps }) {
542
- const ctx = (0, $10ngl$useRef)();
543
- if (!ctx.current) ctx.current = $ce69b86a5144edcd$var$createStylixContext({
544
- id: id,
545
- devMode: devMode,
546
- plugins: plugins,
547
- styleElement: styleElement
548
- });
549
- ctx.current.styleCollector = (0, $10ngl$useContext)((0, $98cf2ff196b5431f$export$9b609b8e22cde6fe));
550
- return /*#__PURE__*/ (0, $10ngl$react).createElement($ce69b86a5144edcd$var$stylixContext.Provider, {
551
- value: ctx.current
552
- }, /*#__PURE__*/ (0, $10ngl$react).createElement($ce69b86a5144edcd$export$91c80431af53fbc7, themeProps, children));
553
- }
554
- function $ce69b86a5144edcd$var$mergeContexts(contextA, contextB) {
555
- const obj = {
556
- ...contextA
557
- };
558
- const themeB = contextB.theme;
559
- if (contextB) for(const key in contextB){
560
- const value = contextB[key];
561
- if (typeof value !== "undefined") obj[key] = value;
562
- }
563
- obj.theme = (0, $45e5eedfea1753e9$export$4950aa0f605343fb)(contextA.theme || {}, themeB);
564
- return obj;
565
- }
566
- function $ce69b86a5144edcd$export$91c80431af53fbc7({ children: children , media: media , theme: theme }) {
567
- const parentCtx = (0, $10ngl$useContext)($ce69b86a5144edcd$var$stylixContext);
568
- const [contextValue, setContextValue] = (0, $10ngl$useState)(()=>$ce69b86a5144edcd$var$mergeContexts(parentCtx, {
569
- media: media,
570
- theme: theme
571
- }));
572
- // contextValue should only update (and cause re-renders) when relevant properties change.
573
- // `media` is treated as special because providing an array of strings is easier to do inline,
574
- // but we don't want to cause descendent re-renders if the values don't change.
575
- (0, $bb477ec7853da8e9$export$2e2bcd8739ae039)(()=>{
576
- setContextValue($ce69b86a5144edcd$var$mergeContexts(parentCtx, {
577
- media: media,
578
- theme: theme
579
- }));
580
- }, [
581
- parentCtx,
582
- media?.join("|") || "",
583
- theme
584
- ], false);
585
- return /*#__PURE__*/ (0, $10ngl$react).createElement($ce69b86a5144edcd$var$stylixContext.Provider, {
586
- value: contextValue
587
- }, children);
588
- }
589
-
590
-
591
-
592
- function $f12bad835e77a044$export$2e2bcd8739ae039(ctx) {
593
- const flattenedRules = [];
594
- for(const key in ctx.rules){
595
- const val = ctx.rules[key];
596
- flattenedRules.push(...val.rules);
597
- }
598
- if (ctx.styleCollector) {
599
- ctx.styleCollector.length = 0;
600
- ctx.styleCollector.push(...flattenedRules);
601
- return;
602
- }
603
- if (ctx.devMode) ctx.styleElement.innerHTML = flattenedRules.join("\n");
604
- else {
605
- const stylesheet = ctx.stylesheet;
606
- if (stylesheet.cssRules) try {
607
- stylesheet.replaceSync(flattenedRules.join("\n"));
608
- } catch (e) {
609
- // Errors are ignored, this just means that a browser doesn't support a certain CSS feature.
610
- console.warn(e);
611
- }
612
- else {
613
- // Legacy method
614
- while(stylesheet.rules.length)stylesheet.deleteRule(0);
615
- for(const i in flattenedRules)try {
616
- stylesheet.insertRule(flattenedRules[i], +i);
617
- } catch (e) {
618
- // Errors are ignored, this just means that a browser doesn't support a certain CSS feature.
619
- console.warn(e);
620
- }
621
- }
622
- }
623
- }
624
-
625
-
626
-
627
- function $4df078ca2e797a9a$export$e2d100a3f83db87c() {
628
- return (0, $10ngl$react)["__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED"]?.ReactDebugCurrentFrame?.getStackAddendum?.()?.split("\n")?.map((line)=>{
629
- // Look for a component name like "Component$123", either at the start of the line (Firefox) or after "at " (Safari/Chrome)
630
- const m = line.match(/^([A-Z][A-Za-z0-9$]*)|^\s*at ([A-Z][A-Za-z0-9$]*)/);
631
- return m?.[1] || m?.[2];
632
- }).filter(Boolean).reverse().slice(-1)[0];
633
- }
634
-
635
-
636
-
637
-
638
-
639
- function $2ae4ecd42d011bb3$export$2e2bcd8739ae039(styles, hash, context) {
640
- try {
641
- const processedStyles = (0, $79720bf00c08b491$export$dd20d84ec8823bbf)("processStyles", styles, hash, context);
642
- // serialize to css rules array
643
- const serialize = function serialize(selector, styles) {
644
- const lines = [];
645
- for(const key in styles){
646
- const value = styles[key];
647
- if ((0, $edf5ed4fba86638e$export$53b83ca8eaab0383)(value)) lines.push(serialize(key, value));
648
- else lines.push(` ${key}: ${value};`);
649
- }
650
- return `${selector} {\n${lines.join("\n")} }`;
651
- };
652
- const result = [];
653
- for(const key in processedStyles){
654
- const value = processedStyles[key];
655
- result.push(serialize(key, value));
656
- }
657
- return result;
658
- } catch (e) {
659
- if (e.name && e.reason) console.error(`${e.name}: ${e.reason}\n`, e.source.replace("\n", " ").substr(Math.max(0, e.column - 20), 100) + "\n", " ".repeat(20) + "^");
660
- else console.error(e);
661
- return [];
662
- }
663
- }
664
-
665
-
666
-
667
- /**
668
- * Cheap string hashing, suitable for generating css class names
669
- */ function $7173dd470a409f87$export$9169be2e06c9c165(str) {
670
- let hash = 5381;
671
- let i = str.length;
672
- while(i)hash = hash * 33 ^ str.charCodeAt(--i);
673
- return "stylix-" + (hash >>> 0).toString(36);
674
- }
675
-
676
-
677
-
678
- function $785bd247a0dbd828$var$cleanup(ctx) {
679
- if (typeof ctx.cleanupRequest !== "undefined") return;
680
- ctx.cleanupRequest = setTimeout(()=>{
681
- let deleted = false;
682
- for(const i in ctx.rules){
683
- const rule = ctx.rules[i];
684
- if (!rule.refs) {
685
- delete ctx.rules[rule.hash];
686
- deleted = true;
687
- }
688
- }
689
- deleted && (0, $f12bad835e77a044$export$2e2bcd8739ae039)(ctx);
690
- delete ctx.cleanupRequest;
691
- }, 100);
692
- }
693
- function $785bd247a0dbd828$var$compare(a, b) {
694
- if (a === b) return true;
695
- if (typeof a !== typeof b) return false;
696
- if (typeof a === "object") {
697
- if (Array.isArray(a) && Array.isArray(b) && a.length !== b.length) return false;
698
- else if (Object.keys(a).length !== Object.keys(b).length) return false;
699
- for(const key in b){
700
- if (!$785bd247a0dbd828$var$compare(a[key], b[key])) return false;
701
- }
702
- }
703
- return a === b;
704
- }
705
- function $785bd247a0dbd828$export$28e6b9b82ee883c(styles, options = {
706
- global: false,
707
- disabled: false
708
- }) {
709
- const stylixCtx = (0, $ce69b86a5144edcd$export$e3c6fdf4e371f028)();
710
- const prevRef = (0, $10ngl$useRef)({
711
- styles: {},
712
- hash: ""
713
- });
714
- const changed = !$785bd247a0dbd828$var$compare(styles, prevRef.current.styles);
715
- options.debugLabel ||= !!stylixCtx.devMode && (0, $4df078ca2e797a9a$export$e2d100a3f83db87c)();
716
- prevRef.current.styles = styles;
717
- if (changed) {
718
- // Preprocess styles with plugins
719
- if (!options.disabled && styles) styles = (0, $79720bf00c08b491$export$dd20d84ec8823bbf)("preprocessStyles", styles, null, stylixCtx);
720
- // Serialize value and generate hash
721
- const json = !options.disabled && styles && JSON.stringify(styles);
722
- prevRef.current.hash = json && json !== "{}" && json !== "[]" ? (0, $7173dd470a409f87$export$9169be2e06c9c165)(JSON.stringify(stylixCtx.media || []) + json) + (options.debugLabel ? "-" + options.debugLabel : "") : "";
723
- }
724
- const { hash: hash } = prevRef.current;
725
- if (hash && changed && !stylixCtx.rules[hash]) {
726
- // If not global styles, wrap original styles with classname
727
- if (!options.global) styles = {
728
- ["." + hash]: styles
729
- };
730
- stylixCtx.rules[hash] = {
731
- hash: hash,
732
- rules: (0, $2ae4ecd42d011bb3$export$2e2bcd8739ae039)(styles, hash, stylixCtx),
733
- refs: 1
734
- };
735
- stylixCtx.requestApply = true;
736
- }
737
- // Apply styles if requested.
738
- // This runs on every render. We utilize useLayoutEffect so that it runs *after* all the other
739
- // renders have completed. stylixCtx.requestApply guards against multiple runs. This reduces the number of calls
740
- // to applyRules(), but prevents styles potentially being added to the DOM after other components force the
741
- // browser to compute styles.
742
- (0, $bb477ec7853da8e9$export$2e2bcd8739ae039)(()=>{
743
- if (!stylixCtx.requestApply) return;
744
- stylixCtx.requestApply = false;
745
- (0, $f12bad835e77a044$export$2e2bcd8739ae039)(stylixCtx);
746
- }, undefined, true);
747
- // When hash changes, add/remove ref count
748
- (0, $bb477ec7853da8e9$export$2e2bcd8739ae039)(()=>{
749
- if (!hash || !changed) return;
750
- if (stylixCtx.rules[hash]) stylixCtx.rules[hash].refs++;
751
- return ()=>{
752
- stylixCtx.rules[hash].refs--;
753
- $785bd247a0dbd828$var$cleanup(stylixCtx);
754
- };
755
- }, [
756
- hash
757
- ], false);
758
- return hash;
759
- }
760
- function $785bd247a0dbd828$export$f3922bb611b91373(keyframes, options = {
761
- disabled: false
762
- }) {
763
- return $785bd247a0dbd828$export$28e6b9b82ee883c({
764
- "@keyframes $$class": keyframes
765
- }, {
766
- global: true,
767
- ...options
768
- });
769
- }
770
- function $785bd247a0dbd828$export$abac79b9db5ae47b(styles, options = {
771
- disabled: false
772
- }) {
773
- return $785bd247a0dbd828$export$28e6b9b82ee883c(styles, {
774
- ...options,
775
- global: true
776
- });
777
- }
778
-
779
-
780
-
781
-
782
-
783
-
784
-
785
-
786
-
787
-
788
-
789
-
790
- function $f0f9a06cd0a8737d$export$7204462c24cfcb17(props, ref) {
791
- const { $el: $el , $css: $css , $disabled: $disabled , className: className , children: children , ...rest } = props;
792
- const ctx = (0, $ce69b86a5144edcd$export$e3c6fdf4e371f028)();
793
- const [styleProps, otherProps] = (0, $3ff9dea9e2b78201$export$54b296e95917282f)(rest, ctx.styleProps);
794
- if ($css) styleProps.$css = $css;
795
- const hash = (0, $785bd247a0dbd828$export$28e6b9b82ee883c)(styleProps, {
796
- disabled: $disabled
797
- });
798
- const allProps = {
799
- className: `${hash} ${className || ""}`.trim(),
800
- ref: ref,
801
- ...otherProps
802
- };
803
- if (/*#__PURE__*/ (0, $10ngl$react).isValidElement($el)) {
804
- const $elProps = {
805
- ...$el.props,
806
- /**
807
- * `allProps` must override `$el.props` because the latter may contain default prop values provided by defaultProps.
808
- * The expectation is that for <$ $el={<SomeComponent />} someComponentProp="my value" />,
809
- * the `someComponentProp` prop would override any default value specified by SomeComponent.defaultProps.
810
- */ ...allProps,
811
- className: (($el.props.className || "") + " " + allProps.className).trim()
812
- };
813
- return /*#__PURE__*/ (0, $10ngl$react).cloneElement($el, $elProps, ...(0, $10ngl$react).Children.toArray(children) || []);
814
- }
815
- return /*#__PURE__*/ (0, $10ngl$react).createElement($el, allProps, children);
816
- }
817
- const $f0f9a06cd0a8737d$var$Stylix = /*#__PURE__*/ (0, $10ngl$react).forwardRef($f0f9a06cd0a8737d$export$7204462c24cfcb17);
818
- $f0f9a06cd0a8737d$var$Stylix.displayName = "Stylix";
819
- $f0f9a06cd0a8737d$var$Stylix.__isStylix = true;
820
- var $f0f9a06cd0a8737d$export$2e2bcd8739ae039 = $f0f9a06cd0a8737d$var$Stylix;
821
-
822
-
823
- function $16478fb0e7f34cc6$export$3817b7a54a07cec7($el, addProps, conflictingPropMapping) {
824
- const Element = typeof $el === "string" ? $el : /*#__PURE__*/ (0, $10ngl$react).forwardRef($el);
825
- const r = /*#__PURE__*/ (0, $10ngl$react).forwardRef((props, ref)=>{
826
- if (conflictingPropMapping) for(const k in conflictingPropMapping){
827
- props[conflictingPropMapping[k]] = props[k];
828
- delete props[k];
829
- }
830
- return (0, $f0f9a06cd0a8737d$export$7204462c24cfcb17)({
831
- $el: Element,
832
- ...addProps,
833
- ...props,
834
- ...addProps?.$css || props?.$css ? {
835
- $css: [
836
- addProps?.$css,
837
- props?.$css
838
- ].filter(Boolean)
839
- } : {}
840
- }, ref);
841
- });
842
- r.displayName = `$.${$el.displayName || $el.name || $el.toString?.() || "Unnamed"}`;
843
- r.__isStylix = true;
844
- return r;
845
- }
846
-
847
-
848
- var $eb2e36190d5b65c2$exports = {};
849
- $eb2e36190d5b65c2$exports = JSON.parse('["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]');
850
-
851
-
852
-
853
-
854
- for(const i in 0, (/*@__PURE__*/$parcel$interopDefault($eb2e36190d5b65c2$exports))){
855
- // Types are specified in ./types.ts, so we don't care what they type of htmlTags[i] is.
856
- // JSX.IntrinsicElements is a union of all HTML tags, so it is too complex for TypeScript to infer.
857
- const tag = (0, (/*@__PURE__*/$parcel$interopDefault($eb2e36190d5b65c2$exports)))[i];
858
- (0, $f0f9a06cd0a8737d$export$2e2bcd8739ae039)[tag] = (0, $16478fb0e7f34cc6$export$3817b7a54a07cec7)(tag);
859
- }
860
-
861
-
862
-
863
-
864
-
865
- export {$ce69b86a5144edcd$export$e3c6fdf4e371f028 as useStylixContext, $ce69b86a5144edcd$export$c01a354187f160ee as useStylixTheme, $ce69b86a5144edcd$export$ae2c3ad5c234c4cc as StylixProvider, $ce69b86a5144edcd$export$91c80431af53fbc7 as StylixTheme, $785bd247a0dbd828$export$28e6b9b82ee883c as useStyles, $785bd247a0dbd828$export$f3922bb611b91373 as useKeyframes, $785bd247a0dbd828$export$abac79b9db5ae47b as useGlobalStyles, $79720bf00c08b491$export$b5ecb47695d6786e as defaultPlugins, $61d992b103afb529$export$95cef81be5ddcfd4 as customProps, $aaadd42d89c94302$export$72ae87c5302f282e as mapObjectRecursive, $b14b1781b09bbb5d$export$a8d8e56b740dab80 as walkRecursive, $98cf2ff196b5431f$export$d3207b3764661c07 as createStyleCollector, $98cf2ff196b5431f$export$9b609b8e22cde6fe as styleCollectorContext, $3ff9dea9e2b78201$export$54b296e95917282f as classifyProps, $3ff9dea9e2b78201$export$34c29a98f3a9910 as useClassifyProps, $16478fb0e7f34cc6$export$3817b7a54a07cec7 as styled, $f0f9a06cd0a8737d$export$2e2bcd8739ae039 as default};
866
- //# sourceMappingURL=module.mjs.map