css-in-props 3.2.3 → 3.2.8

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.
@@ -0,0 +1,1042 @@
1
+ "use strict";
2
+ var CssInProps = (() => {
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __export = (target, all) => {
14
+ for (var name in all)
15
+ __defProp(target, name, { get: all[name], enumerable: true });
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
26
+
27
+ // src/index.js
28
+ var index_exports = {};
29
+ __export(index_exports, {
30
+ ANIMATION_PROPS: () => ANIMATION_PROPS,
31
+ BLOCK_PROPS: () => BLOCK_PROPS,
32
+ CSS_PROPS_REGISTRY: () => CSS_PROPS_REGISTRY,
33
+ DEFAULT_CSS_PROPERTIES_LIST: () => DEFAULT_CSS_PROPERTIES_LIST,
34
+ FLEX_PROPS: () => FLEX_PROPS,
35
+ FONT_PROPS: () => FONT_PROPS,
36
+ GRID_PROPS: () => GRID_PROPS,
37
+ MISC_PROPS: () => MISC_PROPS,
38
+ POSITION_PROPS: () => POSITION_PROPS,
39
+ THEME_PROPS: () => THEME_PROPS,
40
+ TIMING_PROPS: () => TIMING_PROPS,
41
+ exetuteClassPerComponent: () => exetuteClassPerComponent,
42
+ getSystemGlobalTheme: () => getSystemGlobalTheme,
43
+ transformEmotion: () => transformEmotion,
44
+ useCssInProps: () => useCssInProps,
45
+ usePropsAsCSS: () => usePropsAsCSS,
46
+ useSelectorsAsCSS: () => useSelectorsAsCSS
47
+ });
48
+
49
+ // src/transform/executors.js
50
+ var import_utils5 = __require("@domql/utils");
51
+
52
+ // src/props/animation.js
53
+ var import_utils = __require("@domql/utils");
54
+ var import_emotion = __require("@symbo.ls/emotion");
55
+ var import_scratch = __require("@symbo.ls/scratch");
56
+ var TIMING_FUNCTIONS = ["ease", "linear", "ease-in", "ease-out", "ease-in-out", "step-start", "step-end"];
57
+ var FILL_MODES = ["none", "forwards", "backwards", "both"];
58
+ var DIRECTIONS = ["normal", "reverse", "alternate", "alternate-reverse"];
59
+ var PLAY_STATES = ["running", "paused"];
60
+ var isDuration = (v) => /^[\d.]+m?s$/.test(v);
61
+ var applyAnimationProps = (animation, element) => {
62
+ const { emotion: ctxEmotion } = element.context;
63
+ const { keyframes } = ctxEmotion || import_emotion.emotion;
64
+ if ((0, import_utils.isObject)(animation)) return { animationName: keyframes(animation) };
65
+ const { ANIMATION } = element.context && element.context.designSystem;
66
+ const record = ANIMATION[animation];
67
+ return keyframes(record);
68
+ };
69
+ var parseAnimationShorthand = (val, el) => {
70
+ const { ANIMATION } = el.context && el.context.designSystem || {};
71
+ const tokens = val.split(/\s+/);
72
+ let name = null;
73
+ const durations = [];
74
+ let timingFunction = null;
75
+ let iterationCount = null;
76
+ let direction = null;
77
+ let fillMode = null;
78
+ let playState = null;
79
+ for (const token of tokens) {
80
+ if (ANIMATION && ANIMATION[token]) {
81
+ name = token;
82
+ } else if (isDuration(token)) {
83
+ durations.push(token);
84
+ } else if (TIMING_FUNCTIONS.includes(token) || token.startsWith("cubic-bezier") || token.startsWith("steps(")) {
85
+ timingFunction = token;
86
+ } else if (token === "infinite" || /^\d+$/.test(token)) {
87
+ iterationCount = token === "infinite" ? token : Number(token);
88
+ } else if (DIRECTIONS.includes(token)) {
89
+ direction = token;
90
+ } else if (FILL_MODES.includes(token)) {
91
+ fillMode = token;
92
+ } else if (PLAY_STATES.includes(token)) {
93
+ playState = token;
94
+ } else if (!name) {
95
+ name = token;
96
+ }
97
+ }
98
+ return { name, durations, timingFunction, iterationCount, direction, fillMode, playState };
99
+ };
100
+ var ANIMATION_PROPS = {
101
+ animation: (val, el) => {
102
+ if ((0, import_utils.isString)(val) && val.includes(" ")) {
103
+ const parsed = parseAnimationShorthand(val, el);
104
+ return {
105
+ animationName: applyAnimationProps(parsed.name || val, el),
106
+ animationDuration: parsed.durations[0] || (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
107
+ animationDelay: parsed.durations[1] || (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
108
+ animationTimingFunction: parsed.timingFunction || (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
109
+ animationFillMode: parsed.fillMode || el.props.animationFillMode || "both",
110
+ animationIterationCount: parsed.iterationCount != null ? parsed.iterationCount : el.props.animationIterationCount || 1,
111
+ animationPlayState: parsed.playState || el.props.animationPlayState,
112
+ animationDirection: parsed.direction || el.props.animationDirection
113
+ };
114
+ }
115
+ return {
116
+ animationName: applyAnimationProps(val, el),
117
+ animationDuration: (0, import_scratch.getTimingByKey)(el.props.animationDuration || "A").timing,
118
+ animationDelay: (0, import_scratch.getTimingByKey)(el.props.animationDelay || "0s").timing,
119
+ animationTimingFunction: (0, import_scratch.getTimingFunction)(el.props.animationTimingFunction || "ease"),
120
+ animationFillMode: el.props.animationFillMode || "both",
121
+ animationIterationCount: el.props.animationIterationCount || 1,
122
+ animationPlayState: el.props.animationPlayState,
123
+ animationDirection: el.props.animationDirection
124
+ };
125
+ },
126
+ animationName: (val, el) => ({
127
+ animationName: applyAnimationProps(val, el)
128
+ }),
129
+ animationDuration: (val) => ({
130
+ animationDuration: (0, import_scratch.getTimingByKey)(val).timing
131
+ }),
132
+ animationDelay: (val) => ({
133
+ animationDelay: (0, import_scratch.getTimingByKey)(val).timing
134
+ }),
135
+ animationTimingFunction: (val) => ({
136
+ animationTimingFunction: (0, import_scratch.getTimingFunction)(val)
137
+ }),
138
+ animationIterationCount: (val) => ({
139
+ animationIterationCount: val
140
+ }),
141
+ animationFillMode: (val) => ({
142
+ animationFillMode: val
143
+ }),
144
+ animationPlayState: (val) => ({
145
+ animationPlayState: val
146
+ }),
147
+ animationDirection: (val) => ({
148
+ animationDirection: val
149
+ })
150
+ };
151
+
152
+ // src/props/block.js
153
+ var import_utils2 = __require("@domql/utils");
154
+ var import_scratch2 = __require("@symbo.ls/scratch");
155
+ var BLOCK_PROPS = {
156
+ show: (val, el, s, ctx) => !!(ctx.utils.exec(val, el, s) === false) && {
157
+ display: "none !important"
158
+ },
159
+ hide: (val, el, s, ctx) => !!ctx.utils.exec(val, el, s) && {
160
+ display: "none !important"
161
+ },
162
+ height: (val, { props }) => (0, import_scratch2.transformSizeRatio)("height", val, props),
163
+ width: (val, { props }) => (0, import_scratch2.transformSizeRatio)("width", val, props),
164
+ boxSizing: (val) => !(0, import_utils2.isUndefined)(val) ? { boxSizing: val } : { boxSizing: "border-box" },
165
+ boxSize: (val) => {
166
+ if (!(0, import_utils2.isString)(val)) return;
167
+ const [height, width] = val.split(" ");
168
+ return {
169
+ ...(0, import_scratch2.transformSize)("height", height),
170
+ ...(0, import_scratch2.transformSize)("width", width || height)
171
+ };
172
+ },
173
+ inlineSize: (val, { props }) => (0, import_scratch2.transformSizeRatio)("inlineSize", val, props),
174
+ blockSize: (val, { props }) => (0, import_scratch2.transformSizeRatio)("blockSize", val, props),
175
+ minWidth: (val, { props }) => (0, import_scratch2.transformSizeRatio)("minWidth", val, props),
176
+ maxWidth: (val, { props }) => (0, import_scratch2.transformSizeRatio)("maxWidth", val, props),
177
+ widthRange: (val) => {
178
+ if (!(0, import_utils2.isString)(val)) return;
179
+ const [minWidth, maxWidth] = val.split(" ");
180
+ return {
181
+ ...(0, import_scratch2.transformSize)("minWidth", minWidth),
182
+ ...(0, import_scratch2.transformSize)("maxWidth", maxWidth || minWidth)
183
+ };
184
+ },
185
+ minHeight: (val, { props }) => (0, import_scratch2.transformSizeRatio)("minHeight", val, props),
186
+ maxHeight: (val, { props }) => (0, import_scratch2.transformSizeRatio)("maxHeight", val, props),
187
+ heightRange: (val) => {
188
+ if (!(0, import_utils2.isString)(val)) return;
189
+ const [minHeight, maxHeight] = val.split(" ");
190
+ return {
191
+ ...(0, import_scratch2.transformSize)("minHeight", minHeight),
192
+ ...(0, import_scratch2.transformSize)("maxHeight", maxHeight || minHeight)
193
+ };
194
+ },
195
+ size: (val) => {
196
+ if (!(0, import_utils2.isString)(val)) return;
197
+ const [inlineSize, blockSize] = val.split(" ");
198
+ return {
199
+ ...(0, import_scratch2.transformSizeRatio)("inlineSize", inlineSize),
200
+ ...(0, import_scratch2.transformSizeRatio)("blockSize", blockSize || inlineSize)
201
+ };
202
+ },
203
+ minBlockSize: (val, { props }) => (0, import_scratch2.transformSizeRatio)("minBlockSize", val, props),
204
+ minInlineSize: (val, { props }) => (0, import_scratch2.transformSizeRatio)("minInlineSize", val, props),
205
+ maxBlockSize: (val, { props }) => (0, import_scratch2.transformSizeRatio)("maxBlockSize", val, props),
206
+ maxInlineSize: (val, { props }) => (0, import_scratch2.transformSizeRatio)("maxInlineSize", val, props),
207
+ minSize: (val) => {
208
+ if (!(0, import_utils2.isString)(val)) return;
209
+ const [minInlineSize, minBlockSize] = val.split(" ");
210
+ return {
211
+ ...(0, import_scratch2.transformSize)("minInlineSize", minInlineSize),
212
+ ...(0, import_scratch2.transformSize)("minBlockSize", minBlockSize || minInlineSize)
213
+ };
214
+ },
215
+ maxSize: (val) => {
216
+ if (!(0, import_utils2.isString)(val)) return;
217
+ const [maxInlineSize, maxBlockSize] = val.split(" ");
218
+ return {
219
+ ...(0, import_scratch2.transformSize)("maxInlineSize", maxInlineSize),
220
+ ...(0, import_scratch2.transformSize)("maxBlockSize", maxBlockSize || maxInlineSize)
221
+ };
222
+ },
223
+ borderWidth: (val, { props }) => (0, import_scratch2.transformSizeRatio)("borderWidth", val, props),
224
+ padding: (val, { props }) => (0, import_scratch2.transformSizeRatio)("padding", val, props),
225
+ scrollPadding: (val, { props }) => (0, import_scratch2.transformSizeRatio)("scrollPadding", val, props),
226
+ paddingInline: (val) => {
227
+ if (!(0, import_utils2.isString)(val)) return;
228
+ const [paddingInlineStart, paddingInlineEnd] = val.split(" ");
229
+ return {
230
+ ...(0, import_scratch2.transformSize)("paddingInlineStart", paddingInlineStart),
231
+ ...(0, import_scratch2.transformSize)("paddingInlineEnd", paddingInlineEnd || paddingInlineStart)
232
+ };
233
+ },
234
+ paddingBlock: (val) => {
235
+ if (!(0, import_utils2.isString)(val)) return;
236
+ const [paddingBlockStart, paddingBlockEnd] = val.split(" ");
237
+ return {
238
+ ...(0, import_scratch2.transformSize)("paddingBlockStart", paddingBlockStart),
239
+ ...(0, import_scratch2.transformSize)("paddingBlockEnd", paddingBlockEnd || paddingBlockStart)
240
+ };
241
+ },
242
+ // Traditional directional padding
243
+ paddingTop: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingBlockStart", val, props),
244
+ paddingBottom: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingBlockEnd", val, props),
245
+ paddingLeft: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingInlineStart", val, props),
246
+ paddingRight: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingInlineEnd", val, props),
247
+ // Logical properties (for reference)
248
+ paddingBlockStart: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingBlockStart", val, props),
249
+ // maps to top
250
+ paddingBlockEnd: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingBlockEnd", val, props),
251
+ // maps to bottom
252
+ paddingInlineStart: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingInlineStart", val, props),
253
+ // maps to left
254
+ paddingInlineEnd: (val, { props }) => (0, import_scratch2.transformSizeRatio)("paddingInlineEnd", val, props),
255
+ // maps to right
256
+ margin: (val, { props }) => (0, import_scratch2.transformSizeRatio)("margin", val, props),
257
+ marginInline: (val) => {
258
+ if (!(0, import_utils2.isString)(val)) return;
259
+ const [marginInlineStart, marginInlineEnd] = val.split(" ");
260
+ return {
261
+ ...(0, import_scratch2.transformSize)("marginInlineStart", marginInlineStart),
262
+ ...(0, import_scratch2.transformSize)("marginInlineEnd", marginInlineEnd || marginInlineStart)
263
+ };
264
+ },
265
+ marginBlock: (val, { props }) => {
266
+ if (!(0, import_utils2.isString)(props.marginBlock)) return;
267
+ const [marginBlockStart, marginBlockEnd] = props.marginBlock.split(" ");
268
+ return {
269
+ ...(0, import_scratch2.transformSize)("marginBlockStart", marginBlockStart),
270
+ ...(0, import_scratch2.transformSize)("marginBlockEnd", marginBlockEnd || marginBlockStart)
271
+ };
272
+ },
273
+ marginInlineStart: (val, { props }) => (0, import_scratch2.transformSizeRatio)("marginInlineStart", val, props),
274
+ marginInlineEnd: (val, { props }) => (0, import_scratch2.transformSizeRatio)("marginInlineEnd", val, props),
275
+ marginBlockStart: (val, { props }) => (0, import_scratch2.transformSizeRatio)("marginBlockStart", val, props),
276
+ marginBlockEnd: (val, { props }) => (0, import_scratch2.transformSizeRatio)("marginBlockEnd", val, props),
277
+ gap: (val) => ({
278
+ gap: (0, import_scratch2.transfromGap)(val)
279
+ }),
280
+ columnGap: (val, { props }) => (0, import_scratch2.getSpacingBasedOnRatio)(props, "columnGap", val),
281
+ rowGap: (val, { props }) => (0, import_scratch2.getSpacingBasedOnRatio)(props, "rowGap", val),
282
+ flexWrap: (val, { props }) => ({
283
+ display: "flex",
284
+ flexFlow: (val || "row").split(" ")[0] + " " + props.flexWrap
285
+ }),
286
+ flexFlow: (val, { props }) => {
287
+ const { reverse } = props;
288
+ if (!(0, import_utils2.isString)(val)) return;
289
+ let [direction, wrap] = (val || "row").split(" ");
290
+ if (val.startsWith("x") || val === "row") direction = "row";
291
+ if (val.startsWith("y") || val === "column") direction = "column";
292
+ return {
293
+ display: "flex",
294
+ flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
295
+ };
296
+ },
297
+ flexAlign: (val) => {
298
+ if (!(0, import_utils2.isString)(val)) return;
299
+ const [alignItems, justifyContent] = val.split(" ");
300
+ return {
301
+ display: "flex",
302
+ alignItems,
303
+ justifyContent
304
+ };
305
+ },
306
+ round: (val, { props }) => (0, import_scratch2.transformBorderRadius)(val || props.borderRadius, props, "round"),
307
+ borderRadius: (val, { props }) => (0, import_scratch2.transformBorderRadius)(val || props.round, props, "borderRadius")
308
+ };
309
+
310
+ // src/props/font.js
311
+ var import_scratch3 = __require("@symbo.ls/scratch");
312
+ var FONT_PROPS = {
313
+ fontSize: (value) => {
314
+ return (0, import_scratch3.getFontSizeByKey)(value) || value;
315
+ },
316
+ fontFamily: (value) => ({
317
+ fontFamily: (0, import_scratch3.getFontFamily)(value) || value
318
+ }),
319
+ fontWeight: (value) => ({
320
+ fontWeight: value,
321
+ fontVariationSettings: '"wght" ' + value
322
+ })
323
+ };
324
+
325
+ // src/props/misc.js
326
+ var MISC_PROPS = {
327
+ overflow: (value) => ({
328
+ overflow: value,
329
+ scrollBehavior: "smooth"
330
+ }),
331
+ cursor: (value, el, s, ctx) => {
332
+ if (!value) return;
333
+ const file = ctx.files && ctx.files[value];
334
+ if (file && file.content) value = `url(${file.content.src})`;
335
+ return { cursor: value };
336
+ }
337
+ };
338
+
339
+ // src/props/position.js
340
+ var import_scratch4 = __require("@symbo.ls/scratch");
341
+ var POSITION_PROPS = {
342
+ inset: (val, el) => {
343
+ if (el.call("isNumber", val)) return { inset: val };
344
+ if (!el.call("isString", val)) return;
345
+ return { inset: val.split(" ").map((v) => (0, import_scratch4.getSpacingByKey)(v, "k").k).join(" ") };
346
+ },
347
+ left: (val) => (0, import_scratch4.getSpacingByKey)(val, "left"),
348
+ top: (val) => (0, import_scratch4.getSpacingByKey)(val, "top"),
349
+ right: (val) => (0, import_scratch4.getSpacingByKey)(val, "right"),
350
+ bottom: (val) => (0, import_scratch4.getSpacingByKey)(val, "bottom"),
351
+ verticalInset: (val) => {
352
+ if (typeof val !== "string") return;
353
+ const vi = val.split(" ").map((v) => (0, import_scratch4.getSpacingByKey)(v, "k").k);
354
+ return {
355
+ top: vi[0],
356
+ bottom: vi[1] || vi[0]
357
+ };
358
+ },
359
+ horizontalInset: (val) => {
360
+ if (typeof val !== "string") return;
361
+ const vi = val.split(" ").map((v) => (0, import_scratch4.getSpacingByKey)(v, "k").k);
362
+ return {
363
+ left: vi[0],
364
+ right: vi[1] || vi[0]
365
+ };
366
+ }
367
+ };
368
+
369
+ // src/props/theme.js
370
+ var import_scratch5 = __require("@symbo.ls/scratch");
371
+ var import_utils3 = __require("@domql/utils");
372
+ var getSystemGlobalTheme = ({ context, state }) => {
373
+ const theme = state?.root?.globalTheme || context.designSystem?.globalTheme;
374
+ return theme === "auto" ? null : theme;
375
+ };
376
+ var THEME_PROPS = {
377
+ theme: (val, element) => {
378
+ const { props } = element;
379
+ const globalTheme = getSystemGlobalTheme(element);
380
+ if (!val) return;
381
+ const hasSubtheme = val.includes(" ") && !val.includes("@");
382
+ const globalThemeForced = `@${props.themeModifier || globalTheme}`;
383
+ if (hasSubtheme) {
384
+ const themeAppliedInVal = val.split(" ");
385
+ themeAppliedInVal.splice(1, 0, globalThemeForced);
386
+ return (0, import_scratch5.getMediaTheme)(themeAppliedInVal);
387
+ } else if (val.includes("@{globalTheme}")) val.replace("@{globalTheme}", globalThemeForced);
388
+ return (0, import_scratch5.getMediaTheme)(val, `@${props.themeModifier || globalTheme}`);
389
+ },
390
+ color: (val, element) => {
391
+ const globalTheme = getSystemGlobalTheme(element);
392
+ if (!val) return;
393
+ return {
394
+ color: (0, import_scratch5.getMediaColor)(val, globalTheme)
395
+ };
396
+ },
397
+ background: (val, element) => {
398
+ const globalTheme = getSystemGlobalTheme(element);
399
+ if (!val) return;
400
+ if ((0, import_utils3.isString)(val) && val.includes("gradient")) {
401
+ return { background: (0, import_scratch5.resolveColorsInGradient)(val, globalTheme) };
402
+ }
403
+ return {
404
+ background: (0, import_scratch5.getMediaColor)(val, globalTheme)
405
+ };
406
+ },
407
+ backgroundColor: (val, element) => {
408
+ const globalTheme = getSystemGlobalTheme(element);
409
+ if (!val) return;
410
+ return {
411
+ backgroundColor: (0, import_scratch5.getMediaColor)(val, globalTheme)
412
+ };
413
+ },
414
+ backgroundImage: (val, element, s, ctx) => {
415
+ const globalTheme = getSystemGlobalTheme(element);
416
+ if (!val) return;
417
+ const file = ctx.files && ctx.files[val];
418
+ if (file && file.content) val = file.content.src;
419
+ return {
420
+ backgroundImage: (0, import_scratch5.transformBackgroundImage)(val, globalTheme)
421
+ };
422
+ },
423
+ textStroke: (val) => ({
424
+ WebkitTextStroke: (0, import_scratch5.transformTextStroke)(val)
425
+ }),
426
+ outline: (val) => ({
427
+ outline: (0, import_scratch5.transformBorder)(val)
428
+ }),
429
+ outlineOffset: (val, { props }) => (0, import_scratch5.transformSizeRatio)("outlineOffset", val, props),
430
+ border: (val) => ({
431
+ border: (0, import_scratch5.transformBorder)(val)
432
+ }),
433
+ borderColor: (val, element) => {
434
+ const globalTheme = getSystemGlobalTheme(element);
435
+ if (!val) return;
436
+ return {
437
+ borderColor: (0, import_scratch5.getMediaColor)(val, globalTheme)
438
+ };
439
+ },
440
+ borderTopColor: (val, element) => {
441
+ const globalTheme = getSystemGlobalTheme(element);
442
+ if (!val) return;
443
+ return { borderTopColor: (0, import_scratch5.getMediaColor)(val, globalTheme) };
444
+ },
445
+ borderBottomColor: (val, element) => {
446
+ const globalTheme = getSystemGlobalTheme(element);
447
+ if (!val) return;
448
+ return { borderBottomColor: (0, import_scratch5.getMediaColor)(val, globalTheme) };
449
+ },
450
+ borderLeftColor: (val, element) => {
451
+ const globalTheme = getSystemGlobalTheme(element);
452
+ if (!val) return;
453
+ return { borderLeftColor: (0, import_scratch5.getMediaColor)(val, globalTheme) };
454
+ },
455
+ borderRightColor: (val, element) => {
456
+ const globalTheme = getSystemGlobalTheme(element);
457
+ if (!val) return;
458
+ return { borderRightColor: (0, import_scratch5.getMediaColor)(val, globalTheme) };
459
+ },
460
+ borderLeft: (val) => ({
461
+ borderLeft: (0, import_scratch5.transformBorder)(val)
462
+ }),
463
+ borderTop: (val) => ({
464
+ borderTop: (0, import_scratch5.transformBorder)(val)
465
+ }),
466
+ borderRight: (val) => ({
467
+ borderRight: (0, import_scratch5.transformBorder)(val)
468
+ }),
469
+ borderBottom: (val) => ({
470
+ borderBottom: (0, import_scratch5.transformBorder)(val)
471
+ }),
472
+ shadow: (val, element) => {
473
+ const globalTheme = getSystemGlobalTheme(element);
474
+ if (!val) return;
475
+ return {
476
+ boxShadow: (0, import_scratch5.transformShadow)(val, globalTheme)
477
+ };
478
+ },
479
+ boxShadow: (val, element) => {
480
+ if (!(0, import_utils3.isString)(val)) return;
481
+ const [value, hasImportant] = val.split("!importan");
482
+ const globalTheme = getSystemGlobalTheme(element);
483
+ const important = hasImportant ? " !important" : "";
484
+ return {
485
+ boxShadow: (0, import_scratch5.transformBoxShadow)(value.trim(), globalTheme) + important
486
+ };
487
+ },
488
+ textShadow: (val, { context }) => ({
489
+ textShadow: (0, import_scratch5.transformBoxShadow)(val, context.designSystem.globalTheme)
490
+ }),
491
+ columnRule: (val) => ({
492
+ columnRule: (0, import_scratch5.transformBorder)(val)
493
+ })
494
+ };
495
+
496
+ // src/props/timing.js
497
+ var import_scratch6 = __require("@symbo.ls/scratch");
498
+ var TIMING_PROPS = {
499
+ transition: (val) => ({
500
+ transition: (0, import_scratch6.splitTransition)(val)
501
+ }),
502
+ transitionDuration: (val) => ({
503
+ transitionDuration: (0, import_scratch6.transformDuration)(val)
504
+ }),
505
+ transitionDelay: (val) => ({
506
+ transitionDelay: (0, import_scratch6.transformDuration)(val)
507
+ }),
508
+ transitionTimingFunction: (val) => ({
509
+ transitionTimingFunction: (0, import_scratch6.getTimingFunction)(val)
510
+ }),
511
+ transitionProperty: (val) => ({
512
+ transitionProperty: val,
513
+ willChange: val
514
+ })
515
+ };
516
+
517
+ // src/props/flex.js
518
+ var import_utils4 = __require("@domql/utils");
519
+ var FLEX_PROPS = {
520
+ flow: (value, el) => {
521
+ const { props } = el;
522
+ const { reverse } = props;
523
+ if (!(0, import_utils4.isString)(value)) return;
524
+ let [direction, wrap] = (value || "row").split(" ");
525
+ if (value.startsWith("x") || value === "row") direction = "row";
526
+ if (value.startsWith("y") || value === "column") direction = "column";
527
+ return {
528
+ display: "flex",
529
+ flexFlow: (direction || "") + (!direction.includes("-reverse") && reverse ? "-reverse" : "") + " " + (wrap || "")
530
+ };
531
+ },
532
+ wrap: (value, { props }) => {
533
+ return { display: "flex", flexWrap: value };
534
+ },
535
+ align: (value, { props }) => {
536
+ const [alignItems, justifyContent] = value.split(" ");
537
+ return { display: "flex", alignItems, justifyContent };
538
+ }
539
+ };
540
+
541
+ // src/props/grid.js
542
+ var GRID_PROPS = {
543
+ area: (value) => ({ gridArea: value }),
544
+ template: (value) => ({ gridTemplate: value }),
545
+ templateAreas: (value) => ({ gridTemplateAreas: value }),
546
+ column: (value) => ({ gridColumn: value }),
547
+ columns: (value) => ({ gridTemplateColumns: value }),
548
+ templateColumns: (value) => ({ gridTemplateColumns: value }),
549
+ autoColumns: (value) => ({ gridAutoColumns: value }),
550
+ columnStart: (value) => ({ gridColumnStart: value }),
551
+ row: (value) => ({ gridRow: value }),
552
+ rows: (value) => ({ gridTemplateRows: value }),
553
+ templateRows: (value) => ({ gridTemplateRows: value }),
554
+ autoRows: (value) => ({ gridAutoRows: value }),
555
+ rowStart: (value) => ({ gridRowStart: value }),
556
+ autoFlow: (value) => ({ gridAutoFlow: value })
557
+ };
558
+
559
+ // src/props/index.js
560
+ var CSS_PROPS_REGISTRY = {
561
+ ...ANIMATION_PROPS,
562
+ ...BLOCK_PROPS,
563
+ ...FONT_PROPS,
564
+ ...MISC_PROPS,
565
+ ...MISC_PROPS,
566
+ ...POSITION_PROPS,
567
+ ...THEME_PROPS,
568
+ ...TIMING_PROPS,
569
+ ...FLEX_PROPS,
570
+ ...GRID_PROPS
571
+ };
572
+
573
+ // src/props/defaults.js
574
+ var DEFAULT_CSS_PROPERTIES_LIST = /* @__PURE__ */ new Set([
575
+ "accentColor",
576
+ "alignContent",
577
+ "alignItems",
578
+ "alignSelf",
579
+ "alignmentBaseline",
580
+ "all",
581
+ "animation",
582
+ "animationDelay",
583
+ "animationDirection",
584
+ "animationDuration",
585
+ "animationFillMode",
586
+ "animationIterationCount",
587
+ "animationName",
588
+ "animationPlayState",
589
+ "animationTimingFunction",
590
+ "appearance",
591
+ "aspectRatio",
592
+ "backdropFilter",
593
+ "backfaceVisibility",
594
+ "background",
595
+ "backgroundAttachment",
596
+ "backgroundBlendMode",
597
+ "backgroundClip",
598
+ "backgroundColor",
599
+ "backgroundImage",
600
+ "backgroundOrigin",
601
+ "backgroundPosition",
602
+ "backgroundPositionX",
603
+ "backgroundPositionY",
604
+ "backgroundRepeat",
605
+ "backgroundRepeatX",
606
+ "backgroundRepeatY",
607
+ "backgroundSize",
608
+ "baselineShift",
609
+ "blockSize",
610
+ "border",
611
+ "borderBlock",
612
+ "borderBlockColor",
613
+ "borderBlockEnd",
614
+ "borderBlockEndColor",
615
+ "borderBlockEndStyle",
616
+ "borderBlockEndWidth",
617
+ "borderBlockStart",
618
+ "borderBlockStartColor",
619
+ "borderBlockStartStyle",
620
+ "borderBlockStartWidth",
621
+ "borderBlockStyle",
622
+ "borderBlockWidth",
623
+ "borderBottom",
624
+ "borderBottomColor",
625
+ "borderBottomLeftRadius",
626
+ "borderBottomRightRadius",
627
+ "borderBottomStyle",
628
+ "borderBottomWidth",
629
+ "borderCollapse",
630
+ "borderColor",
631
+ "borderImage",
632
+ "borderImageOutset",
633
+ "borderImageRepeat",
634
+ "borderImageSlice",
635
+ "borderImageSource",
636
+ "borderImageWidth",
637
+ "borderLeft",
638
+ "borderLeftColor",
639
+ "borderLeftStyle",
640
+ "borderLeftWidth",
641
+ "borderRadius",
642
+ "borderRight",
643
+ "borderRightColor",
644
+ "borderRightStyle",
645
+ "borderRightWidth",
646
+ "borderSpacing",
647
+ "borderStyle",
648
+ "borderTop",
649
+ "borderTopColor",
650
+ "borderTopLeftRadius",
651
+ "borderTopRightRadius",
652
+ "borderTopStyle",
653
+ "borderTopWidth",
654
+ "borderWidth",
655
+ "bottom",
656
+ "boxDecorationBreak",
657
+ "boxShadow",
658
+ "boxSizing",
659
+ "breakAfter",
660
+ "breakBefore",
661
+ "breakInside",
662
+ "captionSide",
663
+ "caretColor",
664
+ "clear",
665
+ "clip",
666
+ "clipPath",
667
+ "color",
668
+ "colorAdjust",
669
+ "colorInterpolation",
670
+ "colorInterpolationFilters",
671
+ "colorRendering",
672
+ "columnCount",
673
+ "columnFill",
674
+ "columnGap",
675
+ "columnRule",
676
+ "columnRuleColor",
677
+ "columnRuleStyle",
678
+ "columnRuleWidth",
679
+ "columnSpan",
680
+ "columnWidth",
681
+ "columns",
682
+ "contain",
683
+ "content",
684
+ "counterIncrement",
685
+ "counterReset",
686
+ "cursor",
687
+ "direction",
688
+ "display",
689
+ "emptyCells",
690
+ "filter",
691
+ "flex",
692
+ "flexBasis",
693
+ "flexDirection",
694
+ "flexFlow",
695
+ "flexGrow",
696
+ "flexShrink",
697
+ "flexWrap",
698
+ "float",
699
+ "font",
700
+ "fontFamily",
701
+ "fontFeatureSettings",
702
+ "fontKerning",
703
+ "fontLanguageOverride",
704
+ "fontSize",
705
+ "fontSizeAdjust",
706
+ "fontStretch",
707
+ "fontStyle",
708
+ "fontVariant",
709
+ "fontVariantAlternates",
710
+ "fontVariantCaps",
711
+ "fontVariantEastAsian",
712
+ "fontVariantNumeric",
713
+ "fontVariantPosition",
714
+ "fontWeight",
715
+ "fontVariationSettings",
716
+ "fontSynthesis",
717
+ "forcedColorAdjust",
718
+ "gap",
719
+ "grid",
720
+ "gridArea",
721
+ "gridAutoColumns",
722
+ "gridAutoFlow",
723
+ "gridAutoRows",
724
+ "gridColumn",
725
+ "gridColumnEnd",
726
+ "gridColumnGap",
727
+ "gridColumnStart",
728
+ "gridGap",
729
+ "gridRow",
730
+ "gridRowEnd",
731
+ "gridRowGap",
732
+ "gridRowStart",
733
+ "gridTemplate",
734
+ "gridTemplateAreas",
735
+ "gridTemplateColumns",
736
+ "gridTemplateRows",
737
+ "height",
738
+ "hyphens",
739
+ "imageOrientation",
740
+ "imageRendering",
741
+ "imeMode",
742
+ "inset",
743
+ "insetBlock",
744
+ "insetBlockEnd",
745
+ "insetBlockStart",
746
+ "insetInline",
747
+ "insetInlineEnd",
748
+ "insetInlineStart",
749
+ "initialLetter",
750
+ "isolation",
751
+ "justifyContent",
752
+ "justifyItems",
753
+ "justifySelf",
754
+ "left",
755
+ "letterSpacing",
756
+ "lineBreak",
757
+ "lineClamp",
758
+ "lineHeight",
759
+ "listStyle",
760
+ "listStyleImage",
761
+ "listStylePosition",
762
+ "listStyleType",
763
+ "margin",
764
+ "marginBottom",
765
+ "marginLeft",
766
+ "marginRight",
767
+ "marginTop",
768
+ "marginBlock",
769
+ "marginBlockEnd",
770
+ "marginBlockStart",
771
+ "marginInline",
772
+ "marginInlineEnd",
773
+ "marginInlineStart",
774
+ "mask",
775
+ "maskBorder",
776
+ "maskBorderImage",
777
+ "maskBorderOutset",
778
+ "maskBorderRepeat",
779
+ "maskBorderSlice",
780
+ "maskBorderSource",
781
+ "maskBorderWidth",
782
+ "maskClip",
783
+ "maskComposite",
784
+ "maskImage",
785
+ "maskOrigin",
786
+ "maskPosition",
787
+ "maskRepeat",
788
+ "maskSize",
789
+ "maskType",
790
+ "maxBlockSize",
791
+ "maxHeight",
792
+ "maxInlineSize",
793
+ "maxWidth",
794
+ "minBlockSize",
795
+ "minHeight",
796
+ "minInlineSize",
797
+ "minWidth",
798
+ "mixBlendMode",
799
+ "objectFit",
800
+ "objectPosition",
801
+ "objectViewBox",
802
+ "offset",
803
+ "offsetDistance",
804
+ "offsetPath",
805
+ "offsetRotate",
806
+ "opacity",
807
+ "order",
808
+ "orientation",
809
+ "outline",
810
+ "outlineColor",
811
+ "outlineOffset",
812
+ "outlineStyle",
813
+ "outlineWidth",
814
+ "overflow",
815
+ "overflowAnchor",
816
+ "overflowClip",
817
+ "overflowScrolling",
818
+ "overflowWrap",
819
+ "overflowX",
820
+ "overflowY",
821
+ "padding",
822
+ "paddingBottom",
823
+ "paddingLeft",
824
+ "paddingRight",
825
+ "paddingTop",
826
+ "pageBreakAfter",
827
+ "pageBreakBefore",
828
+ "pageBreakInside",
829
+ "paintOrder",
830
+ "perspective",
831
+ "perspectiveOrigin",
832
+ "placeContent",
833
+ "placeItems",
834
+ "placeSelf",
835
+ "pointerEvents",
836
+ "position",
837
+ "resize",
838
+ "right",
839
+ "rotate",
840
+ "rowGap",
841
+ "scrollBehavior",
842
+ "scrollPadding",
843
+ "scrollSnapAlign",
844
+ "scrollSnapType",
845
+ "scrollbarColor",
846
+ "scrollbarWidth",
847
+ "shapeImageThreshold",
848
+ "shapeMargin",
849
+ "shapeOutside",
850
+ "tabSize",
851
+ "tableLayout",
852
+ "textAlign",
853
+ "textAlignLast",
854
+ "textDecoration",
855
+ "textDecorationColor",
856
+ "textDecorationLine",
857
+ "textDecorationSkipInk",
858
+ "textDecorationStyle",
859
+ "textDecorationThickness",
860
+ "textIndent",
861
+ "textOverflow",
862
+ "textShadow",
863
+ "textTransform",
864
+ "textUnderlineOffset",
865
+ "top",
866
+ "transform",
867
+ "transformOrigin",
868
+ "transformStyle",
869
+ "transition",
870
+ "transitionDelay",
871
+ "transitionDuration",
872
+ "transitionProperty",
873
+ "transitionTimingFunction",
874
+ "translate",
875
+ "translateX",
876
+ "translateY",
877
+ "translateZ",
878
+ "unicodeBidi",
879
+ "userSelect",
880
+ "verticalAlign",
881
+ "visibility",
882
+ "whiteSpace",
883
+ "widows",
884
+ "width",
885
+ "willChange",
886
+ "wordBreak",
887
+ "wordSpacing",
888
+ "wordWrap",
889
+ "writingMode",
890
+ "zIndex"
891
+ ]);
892
+
893
+ // src/transform/transformers.js
894
+ var applyMediaProps = (key, selectorProps, element) => {
895
+ const { context } = element;
896
+ if (!context.designSystem?.MEDIA) return;
897
+ const mediaValue = context.designSystem.MEDIA[key.slice(1)];
898
+ const generatedClass = useCssInProps(selectorProps, element);
899
+ const mediaKey = mediaValue ? "@media " + (mediaValue === "print" ? mediaValue : `screen and ${mediaValue}`) : key;
900
+ return { [mediaKey]: generatedClass };
901
+ };
902
+ var applyAndProps = (key, selectorProps, element) => {
903
+ return { [key]: useCssInProps(selectorProps, element) };
904
+ };
905
+ var applySelectorProps = (key, selectorProps, element) => {
906
+ const selectorKey = `&${key}`;
907
+ return { [selectorKey]: useCssInProps(selectorProps, element) };
908
+ };
909
+ var applyCaseProps = (key, selectorProps, element) => {
910
+ const { CASES } = element.context?.designSystem || {};
911
+ const caseKey = key.slice(1);
912
+ const isCaseTrue = !CASES?.[caseKey] && !element.props[caseKey];
913
+ if (!isCaseTrue) return;
914
+ return useCssInProps(selectorProps, element);
915
+ };
916
+ var applyVariableProps = (key, selectorVal, element) => {
917
+ return { [key]: selectorVal };
918
+ };
919
+ var applyConditionalCaseProps = (key, selectorProps, element) => {
920
+ const caseKey = key.slice(1);
921
+ const isCaseTrue = element.props[caseKey] === true || element.state[caseKey] || element[caseKey];
922
+ if (!isCaseTrue) return;
923
+ return useCssInProps(selectorProps, element);
924
+ };
925
+ var applyConditionalFalsyProps = (key, selectorProps, element) => {
926
+ const caseKey = key.slice(1);
927
+ const isCaseTrue = element.props[caseKey] === true || element.state[caseKey] || element[caseKey];
928
+ if (isCaseTrue) return;
929
+ return useCssInProps(selectorProps, element);
930
+ };
931
+ var applyTrueProps = (selectorProps, element) => {
932
+ return useCssInProps(selectorProps, element);
933
+ };
934
+ var transformersByPrefix = {
935
+ "@": applyMediaProps,
936
+ // Selector handlers
937
+ ":": applySelectorProps,
938
+ "[": applySelectorProps,
939
+ "*": applySelectorProps,
940
+ "+": applySelectorProps,
941
+ "~": applySelectorProps,
942
+ "&": applyAndProps,
943
+ ">": applyAndProps,
944
+ // Conditional and variable handlers
945
+ $: applyCaseProps,
946
+ "-": applyVariableProps,
947
+ ".": applyConditionalCaseProps,
948
+ "!": applyConditionalFalsyProps
949
+ };
950
+
951
+ // src/transform/executors.js
952
+ var isProd = (0, import_utils5.isProduction)();
953
+ var usePropsAsCSS = (sourceObj, element, opts) => {
954
+ let obj = {};
955
+ const rest = {};
956
+ const setToObj = (key, val) => {
957
+ if (opts.unpack) {
958
+ obj = { ...obj, ...val };
959
+ return;
960
+ }
961
+ obj[key] = val;
962
+ };
963
+ for (const key in sourceObj) {
964
+ const value = sourceObj[key];
965
+ if (key === "class" && element.call("isString", sourceObj.class)) {
966
+ const val = value.split(" ");
967
+ if (val.length) {
968
+ const CLASS = element.context.designSystem.CLASS;
969
+ const result = val.reduce((acc, curr) => (0, import_utils5.merge)(acc, CLASS[curr]), {});
970
+ obj.designSystemClass = result;
971
+ }
972
+ } else if (key === "true") {
973
+ const val = (0, import_utils5.exec)(value, element);
974
+ (0, import_utils5.merge)(obj, applyTrueProps(val, element));
975
+ } else if (element.classlist[key]) {
976
+ const originalFromClass = element.classlist[key];
977
+ const result = (0, import_utils5.isFunction)(originalFromClass) ? originalFromClass(element, element.state, element.context) : originalFromClass;
978
+ if (result) setToObj(key, result);
979
+ if (!isProd && (0, import_utils5.isObject)(obj[key])) obj[key].label = key;
980
+ } else if (CSS_PROPS_REGISTRY[key]) {
981
+ let val = (0, import_utils5.exec)(value, element);
982
+ if ((0, import_utils5.isArray)(val)) {
983
+ val = val.reduce((a, c) => (0, import_utils5.merge)(a, c), {});
984
+ }
985
+ let result = CSS_PROPS_REGISTRY[key](val, element, element.state, element.context);
986
+ if ((0, import_utils5.isArray)(result)) result = result.reduce((a, c) => (0, import_utils5.merge)(a, c), {});
987
+ if (result) setToObj(key, result);
988
+ if (!isProd && (0, import_utils5.isObject)(obj[key])) obj[key].label = key;
989
+ } else if (DEFAULT_CSS_PROPERTIES_LIST.has(key)) {
990
+ const result = (0, import_utils5.exec)(value, element);
991
+ setToObj(key, { [key]: result });
992
+ if (!isProd && (0, import_utils5.isObject)(obj[key])) obj[key].label = key;
993
+ } else {
994
+ rest[key] = value;
995
+ }
996
+ }
997
+ return [obj, rest];
998
+ };
999
+ var useSelectorsAsCSS = (sourceObj, element) => {
1000
+ const obj = {};
1001
+ for (const key in sourceObj) {
1002
+ const selectroSetter = transformersByPrefix[key.slice(0, 1)];
1003
+ if (selectroSetter) {
1004
+ const result = selectroSetter(key, sourceObj[key], element);
1005
+ if (result) (0, import_utils5.overwriteDeep)(obj, result);
1006
+ }
1007
+ }
1008
+ return obj;
1009
+ };
1010
+ var useCssInProps = (selectorProps, element, opts = { unpack: true }) => {
1011
+ const [cssObj, restProps] = usePropsAsCSS(selectorProps, element, opts);
1012
+ const selectorsObj = useSelectorsAsCSS(restProps, element);
1013
+ let hasSelectors = false;
1014
+ for (const _k in selectorsObj) {
1015
+ hasSelectors = true;
1016
+ break;
1017
+ }
1018
+ if (hasSelectors) {
1019
+ if (opts.unpack) return (0, import_utils5.overwrite)(cssObj, selectorsObj);
1020
+ cssObj._selectors = selectorsObj;
1021
+ }
1022
+ return cssObj;
1023
+ };
1024
+ var exetuteClassPerComponent = (component, element) => {
1025
+ const classObj = {};
1026
+ if (component.class) {
1027
+ for (const classProp in component.class) {
1028
+ classObj[classProp] = component.class[classProp](element);
1029
+ }
1030
+ }
1031
+ return classObj;
1032
+ };
1033
+
1034
+ // src/emotion.js
1035
+ var import_utils6 = __require("@domql/utils");
1036
+ var import_emotion2 = __require("@symbo.ls/emotion");
1037
+ var { css } = import_emotion2.emotion;
1038
+ var transformEmotion = (props, callback) => {
1039
+ return (0, import_utils6.isFunction)(callback) ? callback(props) : css(props);
1040
+ };
1041
+ return __toCommonJS(index_exports);
1042
+ })();