css-in-props 3.14.0 → 3.14.3

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