@symbo.ls/scratch 3.2.3 → 3.2.7

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 (66) hide show
  1. package/dist/cjs/factory.js +23 -494
  2. package/dist/cjs/index.js +11 -2742
  3. package/dist/cjs/set.js +66 -2060
  4. package/dist/esm/factory.js +43 -0
  5. package/dist/esm/index.js +12 -0
  6. package/dist/esm/set.js +148 -0
  7. package/dist/iife/index.js +2580 -0
  8. package/package.json +25 -15
  9. package/src/set.js +22 -7
  10. package/src/system/color.js +48 -11
  11. package/src/system/font.js +19 -5
  12. package/src/system/reset.js +12 -3
  13. package/src/system/shadow.js +20 -13
  14. package/src/system/spacing.js +63 -56
  15. package/src/system/theme.js +4 -3
  16. package/src/system/timing.js +1 -1
  17. package/src/transforms/index.js +212 -95
  18. package/src/utils/color.js +79 -0
  19. package/src/utils/font.js +54 -14
  20. package/src/utils/sequence.js +94 -39
  21. package/src/utils/sprite.js +2 -2
  22. package/src/utils/unit.js +69 -2
  23. package/src/utils/var.js +1 -2
  24. package/dist/cjs/defaultConfig/animation.js +0 -26
  25. package/dist/cjs/defaultConfig/cases.js +0 -26
  26. package/dist/cjs/defaultConfig/class.js +0 -27
  27. package/dist/cjs/defaultConfig/color.js +0 -28
  28. package/dist/cjs/defaultConfig/document.js +0 -26
  29. package/dist/cjs/defaultConfig/font-family.js +0 -34
  30. package/dist/cjs/defaultConfig/font.js +0 -26
  31. package/dist/cjs/defaultConfig/grid.js +0 -27
  32. package/dist/cjs/defaultConfig/icons.js +0 -28
  33. package/dist/cjs/defaultConfig/index.js +0 -222
  34. package/dist/cjs/defaultConfig/media.js +0 -31
  35. package/dist/cjs/defaultConfig/responsive.js +0 -52
  36. package/dist/cjs/defaultConfig/sequence.js +0 -51
  37. package/dist/cjs/defaultConfig/shadow.js +0 -26
  38. package/dist/cjs/defaultConfig/spacing.js +0 -87
  39. package/dist/cjs/defaultConfig/svg.js +0 -28
  40. package/dist/cjs/defaultConfig/templates.js +0 -26
  41. package/dist/cjs/defaultConfig/theme.js +0 -26
  42. package/dist/cjs/defaultConfig/timing.js +0 -68
  43. package/dist/cjs/defaultConfig/typography.js +0 -72
  44. package/dist/cjs/defaultConfig/unit.js +0 -28
  45. package/dist/cjs/package.json +0 -4
  46. package/dist/cjs/system/color.js +0 -1175
  47. package/dist/cjs/system/document.js +0 -987
  48. package/dist/cjs/system/font.js +0 -1009
  49. package/dist/cjs/system/index.js +0 -2227
  50. package/dist/cjs/system/reset.js +0 -1099
  51. package/dist/cjs/system/shadow.js +0 -1384
  52. package/dist/cjs/system/spacing.js +0 -1338
  53. package/dist/cjs/system/svg.js +0 -1086
  54. package/dist/cjs/system/theme.js +0 -1276
  55. package/dist/cjs/system/timing.js +0 -1213
  56. package/dist/cjs/system/typography.js +0 -1311
  57. package/dist/cjs/tests/index.js +0 -30
  58. package/dist/cjs/transforms/index.js +0 -1613
  59. package/dist/cjs/utils/color.js +0 -333
  60. package/dist/cjs/utils/font.js +0 -69
  61. package/dist/cjs/utils/index.js +0 -1548
  62. package/dist/cjs/utils/sequence.js +0 -1198
  63. package/dist/cjs/utils/sprite.js +0 -579
  64. package/dist/cjs/utils/theme.js +0 -31
  65. package/dist/cjs/utils/unit.js +0 -28
  66. package/dist/cjs/utils/var.js +0 -1040
@@ -1,1613 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
-
33
- // ../utils/dist/cjs/index.js
34
- var require_cjs = __commonJS({
35
- "../utils/dist/cjs/index.js"(exports, module2) {
36
- "use strict";
37
- var __defProp3 = Object.defineProperty;
38
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp3 = Object.prototype.hasOwnProperty;
41
- var __export2 = (target, all) => {
42
- for (var name in all)
43
- __defProp3(target, name, { get: all[name], enumerable: true });
44
- };
45
- var __copyProps2 = (to, from, except, desc) => {
46
- if (from && typeof from === "object" || typeof from === "function") {
47
- for (let key of __getOwnPropNames2(from))
48
- if (!__hasOwnProp3.call(to, key) && key !== except)
49
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
- }
51
- return to;
52
- };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
- var index_exports = {};
55
- __export2(index_exports, {
56
- arrayzeValue: () => arrayzeValue3,
57
- copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
58
- copyStringToClipboard: () => copyStringToClipboard,
59
- fibonacciNumberByIndex: () => fibonacciNumberByIndex,
60
- findClosestNumber: () => findClosestNumber,
61
- findClosestNumberInFactory: () => findClosestNumberInFactory,
62
- formatDate: () => formatDate,
63
- isPhoto: () => isPhoto,
64
- loadCssFile: () => loadCssFile,
65
- loadJavascript: () => loadJavascript,
66
- loadJavascriptFile: () => loadJavascriptFile,
67
- loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
68
- loadJavascriptFileSync: () => loadJavascriptFileSync,
69
- loadRemoteCSS: () => loadRemoteCSS,
70
- loadRemoteScript: () => loadRemoteScript,
71
- removeChars: () => removeChars,
72
- toCamelCase: () => toCamelCase2,
73
- toDashCase: () => toDashCase2,
74
- toDescriptionCase: () => toDescriptionCase,
75
- toTitleCase: () => toTitleCase,
76
- toggleFullscreen: () => toggleFullscreen
77
- });
78
- module2.exports = __toCommonJS2(index_exports);
79
- var window22 = globalThis;
80
- var document22 = window22.document;
81
- var isObject2 = (arg) => {
82
- if (arg === null) return false;
83
- return typeof arg === "object" && arg.constructor === Object;
84
- };
85
- var isString2 = (arg) => typeof arg === "string";
86
- var isNumber2 = (arg) => typeof arg === "number";
87
- var isArray2 = (arg) => Array.isArray(arg);
88
- var STATE_METHODS3 = [
89
- "update",
90
- "parse",
91
- "clean",
92
- "create",
93
- "destroy",
94
- "add",
95
- "toggle",
96
- "remove",
97
- "apply",
98
- "set",
99
- "reset",
100
- "replace",
101
- "quietReplace",
102
- "quietUpdate",
103
- "applyReplace",
104
- "applyFunction",
105
- "keys",
106
- "values",
107
- "ref",
108
- "rootUpdate",
109
- "parentUpdate",
110
- "parent",
111
- "__element",
112
- "__depends",
113
- "__ref",
114
- "__children",
115
- "root",
116
- "setByPath",
117
- "setPathCollection",
118
- "removeByPath",
119
- "removePathCollection",
120
- "getByPath"
121
- ];
122
- var PROPS_METHODS3 = ["update", "__element"];
123
- var METHODS3 = [
124
- "set",
125
- "reset",
126
- "update",
127
- "remove",
128
- "updateContent",
129
- "removeContent",
130
- "lookup",
131
- "lookdown",
132
- "lookdownAll",
133
- "getRef",
134
- "getPath",
135
- "setNodeStyles",
136
- "spotByPath",
137
- "keys",
138
- "parse",
139
- "setProps",
140
- "parseDeep",
141
- "variables",
142
- "if",
143
- "log",
144
- "verbose",
145
- "warn",
146
- "error",
147
- "call",
148
- "nextElement",
149
- "previousElement"
150
- ];
151
- var METHODS_EXL3 = [
152
- ...["node", "context", "extends", "__element", "__ref"],
153
- ...METHODS3,
154
- ...STATE_METHODS3,
155
- ...PROPS_METHODS3
156
- ];
157
- var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
158
- var STATE_METHODS22 = [
159
- "update",
160
- "parse",
161
- "clean",
162
- "create",
163
- "destroy",
164
- "add",
165
- "toggle",
166
- "remove",
167
- "apply",
168
- "set",
169
- "reset",
170
- "replace",
171
- "quietReplace",
172
- "quietUpdate",
173
- "applyReplace",
174
- "applyFunction",
175
- "keys",
176
- "values",
177
- "ref",
178
- "rootUpdate",
179
- "parentUpdate",
180
- "parent",
181
- "__element",
182
- "__depends",
183
- "__ref",
184
- "__children",
185
- "root",
186
- "setByPath",
187
- "setPathCollection",
188
- "removeByPath",
189
- "removePathCollection",
190
- "getByPath"
191
- ];
192
- var PROPS_METHODS22 = ["update", "__element"];
193
- var METHODS22 = [
194
- "set",
195
- "reset",
196
- "update",
197
- "remove",
198
- "updateContent",
199
- "removeContent",
200
- "lookup",
201
- "lookdown",
202
- "lookdownAll",
203
- "getRef",
204
- "getPath",
205
- "setNodeStyles",
206
- "spotByPath",
207
- "keys",
208
- "parse",
209
- "setProps",
210
- "parseDeep",
211
- "variables",
212
- "if",
213
- "log",
214
- "verbose",
215
- "warn",
216
- "error",
217
- "call",
218
- "nextElement",
219
- "previousElement"
220
- ];
221
- var METHODS_EXL22 = [
222
- ...["node", "context", "extends", "__element", "__ref"],
223
- ...METHODS22,
224
- ...STATE_METHODS22,
225
- ...PROPS_METHODS22
226
- ];
227
- var window32 = globalThis;
228
- var document32 = window32.document;
229
- async function toggleFullscreen(opts) {
230
- if (!document.fullscreenElement) {
231
- try {
232
- await (this.node || document).requestFullscreen();
233
- } catch (err) {
234
- console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`);
235
- }
236
- } else {
237
- await document.exitFullscreen();
238
- }
239
- }
240
- var findClosestNumber = (number, arr) => {
241
- return (isArray2(arr) ? arr : Object.values(arr)).reduce((prev, curr) => {
242
- return Math.abs(curr - number) < Math.abs(prev - number) ? curr : prev;
243
- });
244
- };
245
- var findClosestNumberInFactory = (val, factory) => {
246
- val = parseFloat(val);
247
- if (isObject2(factory)) factory = Object.values(factory);
248
- return findClosestNumber(val, factory);
249
- };
250
- var formatDate = (timestamp) => {
251
- if (!timestamp) return "";
252
- const d = new Date(timestamp);
253
- const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
254
- const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
255
- const da = new Intl.DateTimeFormat("en", { day: "2-digit" }).format(d);
256
- return `${da} ${mo}, ${ye}`;
257
- };
258
- var fibonacciNumberByIndex = function fibonacciNumberByIndex2(n) {
259
- const fib = [0, 1];
260
- for (let i = 2; i <= n; i++) {
261
- fib[i] = fib[i - 1] + fib[i - 2];
262
- }
263
- return fib[n];
264
- };
265
- var loadJavascriptFile = (FILE_URL, async = false, doc = document, type = "text/javascript") => {
266
- return new Promise((resolve, reject) => {
267
- try {
268
- const scriptEle = doc.createElement("script");
269
- scriptEle.type = type;
270
- scriptEle.async = async;
271
- scriptEle.src = FILE_URL;
272
- scriptEle.addEventListener("load", (ev) => {
273
- resolve({
274
- status: true
275
- });
276
- });
277
- scriptEle.addEventListener("error", (ev) => {
278
- reject(
279
- new Error({
280
- status: false,
281
- message: `Failed to load the script ${FILE_URL}`
282
- })
283
- );
284
- });
285
- doc.body.appendChild(scriptEle);
286
- } catch (error) {
287
- reject(error);
288
- }
289
- });
290
- };
291
- var loadJavascriptFileSync = (fileUrl, doc = document, type = "text/javascript") => {
292
- return new Promise((resolve, reject) => {
293
- const scriptEle = doc.createElement("script");
294
- scriptEle.type = type;
295
- scriptEle.src = fileUrl;
296
- const blocker = doc.createElement("div");
297
- blocker.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.8);z-index:9999;";
298
- doc.body.appendChild(blocker);
299
- scriptEle.onload = () => {
300
- console.log(`Successfully loaded: ${fileUrl}`);
301
- doc.body.removeChild(blocker);
302
- resolve();
303
- };
304
- scriptEle.onerror = () => {
305
- doc.body.removeChild(blocker);
306
- reject(new Error(`Failed to load: ${fileUrl}`));
307
- };
308
- doc.body.appendChild(scriptEle);
309
- });
310
- };
311
- var loadJavascriptFileEmbedSync = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
312
- const xhr = new window.XMLHttpRequest();
313
- xhr.open("GET", FILE_URL, false);
314
- xhr.send();
315
- if (xhr.status === 200) {
316
- const scriptEle = doc.createElement("script");
317
- scriptEle.type = type;
318
- scriptEle.text = xhr.responseText;
319
- doc.body.appendChild(scriptEle);
320
- if (typeof fallback === "function") fallback();
321
- } else {
322
- throw new Error(`Failed to load the script ${FILE_URL}`);
323
- }
324
- };
325
- var loadCssFile = (FILE_URL, async = false, doc = document, type = "text/javascript") => {
326
- return new Promise((resolve, reject) => {
327
- try {
328
- const linkElem = doc.createElement("link");
329
- linkElem.rel = "stylesheet";
330
- linkElem.href = FILE_URL;
331
- linkElem.addEventListener("load", (ev) => {
332
- resolve({
333
- status: true
334
- });
335
- });
336
- doc.head.appendChild(linkElem);
337
- } catch (error) {
338
- reject(error);
339
- }
340
- });
341
- };
342
- var loadJavascript = (body, async = false, doc = document, type = "text/javascript", id = "smbls-script") => {
343
- try {
344
- const scriptEle = doc.createElement("script");
345
- scriptEle.type = type;
346
- scriptEle.async = async;
347
- scriptEle.id = id;
348
- scriptEle.innerHTML = body;
349
- doc.body.appendChild(scriptEle);
350
- } catch (error) {
351
- console.warn(error);
352
- }
353
- };
354
- function loadRemoteScript(url, options = {}) {
355
- const { window: window4 = globalThis } = options;
356
- const { document: document4 = window4.document } = options;
357
- return new Promise((resolve, reject) => {
358
- const existingScript = document4.querySelector(`script[src="${url}"]`);
359
- if (existingScript) {
360
- return resolve(existingScript);
361
- }
362
- const script = document4.createElement("script");
363
- script.src = url;
364
- script.async = options.async === true;
365
- script.type = options.type || "text/javascript";
366
- if (options.id) script.id = options.id;
367
- if (options.integrity) script.integrity = options.integrity;
368
- if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
369
- script.onload = () => {
370
- script.onerror = script.onload = null;
371
- resolve(script);
372
- };
373
- script.onerror = () => {
374
- script.onerror = script.onload = null;
375
- reject(new Error(`Failed to load script: ${url}`));
376
- };
377
- document4.head.appendChild(script);
378
- });
379
- }
380
- async function loadRemoteCSS(url, options = {}) {
381
- const { window: window4 = globalThis } = options;
382
- const { document: document4 = window4.document } = options;
383
- return new Promise((resolve, reject) => {
384
- const existingLink = document4.querySelector(`link[href="${url}"]`);
385
- if (existingLink) {
386
- return resolve(existingLink);
387
- }
388
- const link = document4.createElement("link");
389
- link.href = url;
390
- link.rel = options.rel || "stylesheet";
391
- link.type = "text/css";
392
- link.media = options.media || "all";
393
- if (options.id) link.id = options.id;
394
- if (options.integrity) link.integrity = options.integrity;
395
- if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
396
- link.onload = () => {
397
- link.onerror = link.onload = null;
398
- resolve(link);
399
- };
400
- link.onerror = () => {
401
- link.onerror = link.onload = null;
402
- reject(new Error(`Failed to load stylesheet: ${url}`));
403
- };
404
- document4.head.appendChild(link);
405
- });
406
- }
407
- var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
408
- var copyStringToClipboard = async (str) => {
409
- try {
410
- await navigator.clipboard.writeText(str);
411
- } catch (err) {
412
- console.warn("Failed to copy text: ", err);
413
- }
414
- };
415
- var copyJavaScriptToClipboard = async (jsCode) => {
416
- try {
417
- const blob = new Blob([jsCode], { type: "text/javascript" });
418
- const clipboardItem = new window.ClipboardItem({ "text/plain": blob });
419
- await navigator.clipboard.write([clipboardItem]);
420
- console.log("JavaScript code copied to clipboard as text/javascript");
421
- } catch (err) {
422
- console.error("Failed to copy JavaScript code: ", err);
423
- }
424
- };
425
- var removeChars = (str) => {
426
- return str.replace(/[^a-zA-Z0-9_]/g, "");
427
- };
428
- var toCamelCase2 = (str) => {
429
- return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
430
- return index === 0 ? word.toLowerCase() : word.toUpperCase();
431
- }).replaceAll(/\s+/g, "");
432
- };
433
- var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
434
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
435
- });
436
- var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
437
- var toDescriptionCase = (str = "") => {
438
- if (typeof str !== "string") return;
439
- const result = str.replace(/([A-Z])/g, " $1");
440
- return result.charAt(0).toUpperCase() + result.slice(1);
441
- };
442
- var arrayzeValue3 = (val) => {
443
- if (isArray2(val)) return val;
444
- if (isString2(val)) return val.split(" ");
445
- if (isObject2(val)) return Object.values(val);
446
- if (isNumber2(val)) return [val];
447
- };
448
- }
449
- });
450
-
451
- // src/transforms/index.js
452
- var transforms_exports = {};
453
- __export(transforms_exports, {
454
- checkIfBoxSize: () => checkIfBoxSize,
455
- splitTransition: () => splitTransition,
456
- transformBackgroundImage: () => transformBackgroundImage,
457
- transformBorder: () => transformBorder,
458
- transformBorderRadius: () => transformBorderRadius,
459
- transformBoxShadow: () => transformBoxShadow,
460
- transformDuration: () => transformDuration,
461
- transformShadow: () => transformShadow,
462
- transformSize: () => transformSize,
463
- transformSizeRatio: () => transformSizeRatio,
464
- transformTextStroke: () => transformTextStroke,
465
- transformTransition: () => transformTransition,
466
- transfromGap: () => transfromGap
467
- });
468
- module.exports = __toCommonJS(transforms_exports);
469
-
470
- // ../../../domql/packages/utils/dist/esm/globals.js
471
- var window2 = globalThis;
472
- var document2 = window2.document;
473
-
474
- // ../../../domql/packages/utils/dist/esm/node.js
475
- var isDOMNode = (obj) => {
476
- return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
477
- };
478
-
479
- // ../../../domql/packages/utils/dist/esm/types.js
480
- var isObject = (arg) => {
481
- if (arg === null) return false;
482
- return typeof arg === "object" && arg.constructor === Object;
483
- };
484
- var isString = (arg) => typeof arg === "string";
485
- var isNumber = (arg) => typeof arg === "number";
486
- var isFunction = (arg) => typeof arg === "function";
487
- var isNull = (arg) => arg === null;
488
- var isArray = (arg) => Array.isArray(arg);
489
- var isObjectLike = (arg) => {
490
- if (arg === null) return false;
491
- return typeof arg === "object";
492
- };
493
- var isUndefined = (arg) => {
494
- return arg === void 0;
495
- };
496
-
497
- // ../../../domql/packages/utils/dist/esm/array.js
498
- var unstackArrayOfObjects = (arr, exclude = []) => {
499
- return arr.reduce(
500
- (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
501
- {}
502
- );
503
- };
504
-
505
- // ../../../domql/packages/utils/dist/esm/keys.js
506
- var STATE_METHODS = [
507
- "update",
508
- "parse",
509
- "clean",
510
- "create",
511
- "destroy",
512
- "add",
513
- "toggle",
514
- "remove",
515
- "apply",
516
- "set",
517
- "reset",
518
- "replace",
519
- "quietReplace",
520
- "quietUpdate",
521
- "applyReplace",
522
- "applyFunction",
523
- "keys",
524
- "values",
525
- "ref",
526
- "rootUpdate",
527
- "parentUpdate",
528
- "parent",
529
- "__element",
530
- "__depends",
531
- "__ref",
532
- "__children",
533
- "root",
534
- "setByPath",
535
- "setPathCollection",
536
- "removeByPath",
537
- "removePathCollection",
538
- "getByPath"
539
- ];
540
- var PROPS_METHODS = ["update", "__element"];
541
- var METHODS = [
542
- "set",
543
- "reset",
544
- "update",
545
- "remove",
546
- "updateContent",
547
- "removeContent",
548
- "lookup",
549
- "lookdown",
550
- "lookdownAll",
551
- "getRef",
552
- "getPath",
553
- "setNodeStyles",
554
- "spotByPath",
555
- "keys",
556
- "parse",
557
- "setProps",
558
- "parseDeep",
559
- "variables",
560
- "if",
561
- "log",
562
- "verbose",
563
- "warn",
564
- "error",
565
- "call",
566
- "nextElement",
567
- "previousElement"
568
- ];
569
- var METHODS_EXL = [
570
- ...["node", "context", "extends", "__element", "__ref"],
571
- ...METHODS,
572
- ...STATE_METHODS,
573
- ...PROPS_METHODS
574
- ];
575
-
576
- // ../../../domql/packages/utils/dist/esm/object.js
577
- var __defProp2 = Object.defineProperty;
578
- var __defProps = Object.defineProperties;
579
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
580
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
581
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
582
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
583
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
584
- var __spreadValues = (a, b) => {
585
- for (var prop in b || (b = {}))
586
- if (__hasOwnProp2.call(b, prop))
587
- __defNormalProp(a, prop, b[prop]);
588
- if (__getOwnPropSymbols)
589
- for (var prop of __getOwnPropSymbols(b)) {
590
- if (__propIsEnum.call(b, prop))
591
- __defNormalProp(a, prop, b[prop]);
592
- }
593
- return a;
594
- };
595
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
596
- var merge = (element, obj, excludeFrom = []) => {
597
- for (const e in obj) {
598
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
599
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
600
- continue;
601
- }
602
- const elementProp = element[e];
603
- const objProp = obj[e];
604
- if (elementProp === void 0) {
605
- element[e] = objProp;
606
- }
607
- }
608
- return element;
609
- };
610
- var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
611
- for (const e in extend) {
612
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
613
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
614
- continue;
615
- }
616
- const elementProp = element[e];
617
- const extendProp = extend[e];
618
- if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
619
- deepMerge(elementProp, extendProp, excludeFrom);
620
- } else if (elementProp === void 0) {
621
- element[e] = extendProp;
622
- }
623
- }
624
- return element;
625
- };
626
- var deepClone = (obj, options = {}) => {
627
- const {
628
- exclude = [],
629
- cleanUndefined = false,
630
- cleanNull = false,
631
- window: targetWindow,
632
- visited = /* @__PURE__ */ new WeakMap(),
633
- handleExtends = false
634
- } = options;
635
- const contentWindow = targetWindow || window2 || globalThis;
636
- if (!isObjectLike(obj) || isDOMNode(obj)) {
637
- return obj;
638
- }
639
- if (visited.has(obj)) {
640
- return visited.get(obj);
641
- }
642
- const clone2 = contentWindow ? isArray(obj) ? new contentWindow.Array() : new contentWindow.Object() : isArray(obj) ? [] : {};
643
- visited.set(obj, clone2);
644
- for (const key in obj) {
645
- if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
646
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
647
- continue;
648
- }
649
- const value = obj[key];
650
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
651
- continue;
652
- }
653
- if (isDOMNode(value)) {
654
- clone2[key] = value;
655
- continue;
656
- }
657
- if (handleExtends && key === "extends" && isArray(value)) {
658
- clone2[key] = unstackArrayOfObjects(value, exclude);
659
- continue;
660
- }
661
- if (isFunction(value) && options.window) {
662
- clone2[key] = contentWindow.eval("(" + value.toString() + ")");
663
- continue;
664
- }
665
- if (isObjectLike(value)) {
666
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
667
- visited
668
- }));
669
- } else {
670
- clone2[key] = value;
671
- }
672
- }
673
- return clone2;
674
- };
675
-
676
- // ../../../domql/packages/utils/dist/esm/env.js
677
- var NODE_ENV = "development";
678
- var isProduction = (env = NODE_ENV) => env === "production";
679
- var isNotProduction = (env = NODE_ENV) => !isProduction(env);
680
-
681
- // ../../../domql/packages/utils/dist/esm/cookie.js
682
- var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
683
-
684
- // ../../../domql/packages/event/dist/esm/keys.js
685
- var STATE_METHODS2 = [
686
- "update",
687
- "parse",
688
- "clean",
689
- "create",
690
- "destroy",
691
- "add",
692
- "toggle",
693
- "remove",
694
- "apply",
695
- "set",
696
- "reset",
697
- "replace",
698
- "quietReplace",
699
- "quietUpdate",
700
- "applyReplace",
701
- "applyFunction",
702
- "keys",
703
- "values",
704
- "ref",
705
- "rootUpdate",
706
- "parentUpdate",
707
- "parent",
708
- "__element",
709
- "__depends",
710
- "__ref",
711
- "__children",
712
- "root",
713
- "setByPath",
714
- "setPathCollection",
715
- "removeByPath",
716
- "removePathCollection",
717
- "getByPath"
718
- ];
719
- var PROPS_METHODS2 = ["update", "__element"];
720
- var METHODS2 = [
721
- "set",
722
- "reset",
723
- "update",
724
- "remove",
725
- "updateContent",
726
- "removeContent",
727
- "lookup",
728
- "lookdown",
729
- "lookdownAll",
730
- "getRef",
731
- "getPath",
732
- "setNodeStyles",
733
- "spotByPath",
734
- "keys",
735
- "parse",
736
- "setProps",
737
- "parseDeep",
738
- "variables",
739
- "if",
740
- "log",
741
- "verbose",
742
- "warn",
743
- "error",
744
- "call",
745
- "nextElement",
746
- "previousElement"
747
- ];
748
- var METHODS_EXL2 = [
749
- ...["node", "context", "extends", "__element", "__ref"],
750
- ...METHODS2,
751
- ...STATE_METHODS2,
752
- ...PROPS_METHODS2
753
- ];
754
-
755
- // ../../../domql/packages/event/dist/esm/globals.js
756
- var window3 = globalThis;
757
- var document3 = window3.document;
758
-
759
- // src/defaultConfig/index.js
760
- var defaultConfig_exports = {};
761
- __export(defaultConfig_exports, {
762
- ANIMATION: () => ANIMATION,
763
- BREAKPOINTS: () => BREAKPOINTS,
764
- CASES: () => CASES,
765
- CLASS: () => CLASS,
766
- COLOR: () => COLOR,
767
- DEVICES: () => DEVICES,
768
- DOCUMENT: () => DOCUMENT,
769
- FONT: () => FONT,
770
- FONT_FACE: () => FONT_FACE,
771
- FONT_FAMILY: () => FONT_FAMILY,
772
- FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
773
- GRADIENT: () => GRADIENT,
774
- GRID: () => GRID,
775
- ICONS: () => ICONS,
776
- MEDIA: () => MEDIA,
777
- RESET: () => RESET,
778
- SEMANTIC_ICONS: () => SEMANTIC_ICONS,
779
- SEQUENCE: () => SEQUENCE,
780
- SHADOW: () => SHADOW,
781
- SPACING: () => SPACING,
782
- SVG: () => SVG,
783
- SVG_DATA: () => SVG_DATA,
784
- TEMPLATES: () => TEMPLATES,
785
- THEME: () => THEME,
786
- TIMING: () => TIMING,
787
- TYPOGRAPHY: () => TYPOGRAPHY,
788
- UNIT: () => UNIT
789
- });
790
-
791
- // src/defaultConfig/sequence.js
792
- var SEQUENCE = {
793
- "minor-second": 1.067,
794
- "major-second": 1.125,
795
- "minor-third": 1.2,
796
- "major-third": 1.25,
797
- "perfect-fourth": 1.333,
798
- "augmented-fourth": 1.414,
799
- "perfect-fifth": 1.5,
800
- "minor-sixth": 1.6,
801
- phi: 1.618,
802
- // golden-ratio
803
- "major-sixth": 1.667,
804
- "square-root-3": 1.732,
805
- // theodorus
806
- "minor-seventh": 1.778,
807
- "major-seventh": 1.875,
808
- octave: 2,
809
- "square-root-5": 2.23,
810
- // pythagoras
811
- "major-tenth": 2.5,
812
- "major-eleventh": 2.667,
813
- "major-twelfth": 3,
814
- pi: 3.14,
815
- // archimedes
816
- "double-octave": 4
817
- };
818
-
819
- // src/defaultConfig/unit.js
820
- var UNIT = {
821
- default: "em"
822
- };
823
-
824
- // src/defaultConfig/typography.js
825
- var defaultProps = {
826
- browserDefault: 16,
827
- base: 16,
828
- type: "font-size",
829
- ratio: SEQUENCE["minor-third"],
830
- range: [-3, 12],
831
- h1Matches: 6,
832
- lineHeight: 1.5,
833
- subSequence: true,
834
- mediaRegenerate: false,
835
- unit: "em",
836
- templates: {},
837
- sequence: {},
838
- scales: {},
839
- vars: {}
840
- };
841
- var TYPOGRAPHY = defaultProps;
842
-
843
- // src/defaultConfig/font.js
844
- var FONT = {};
845
-
846
- // src/defaultConfig/font-family.js
847
- var FONT_FAMILY = {};
848
- var FONT_FAMILY_TYPES = {
849
- "sans-serif": "Helvetica, Arial, sans-serif, --system-default",
850
- serif: "Times New Roman, Georgia, serif, --system-default",
851
- monospace: "Courier New, monospace, --system-default"
852
- };
853
- var FONT_FACE = {};
854
-
855
- // src/defaultConfig/media.js
856
- var MEDIA = {
857
- tv: "(min-width: 2780px)",
858
- light: "(prefers-color-scheme: light)",
859
- dark: "(prefers-color-scheme: dark)",
860
- print: "print"
861
- };
862
-
863
- // src/defaultConfig/spacing.js
864
- var defaultProps2 = {
865
- base: TYPOGRAPHY.base,
866
- type: "spacing",
867
- ratio: SEQUENCE.phi,
868
- range: [-5, 15],
869
- subSequence: true,
870
- mediaRegenerate: false,
871
- unit: "em",
872
- sequence: {},
873
- scales: {},
874
- vars: {}
875
- };
876
- var SPACING = defaultProps2;
877
-
878
- // src/defaultConfig/color.js
879
- var COLOR = {};
880
- var GRADIENT = {};
881
-
882
- // src/defaultConfig/theme.js
883
- var THEME = {};
884
-
885
- // src/defaultConfig/shadow.js
886
- var SHADOW = {};
887
-
888
- // src/defaultConfig/icons.js
889
- var ICONS = {};
890
- var SEMANTIC_ICONS = {};
891
-
892
- // src/defaultConfig/timing.js
893
- var defaultProps3 = {
894
- default: 150,
895
- base: 150,
896
- type: "timing",
897
- ratio: SEQUENCE["perfect-fourth"],
898
- range: [-3, 12],
899
- mediaRegenerate: false,
900
- unit: "ms",
901
- sequence: {},
902
- scales: {},
903
- vars: {}
904
- };
905
- var TIMING = defaultProps3;
906
-
907
- // src/defaultConfig/document.js
908
- var DOCUMENT = {};
909
-
910
- // src/defaultConfig/responsive.js
911
- var BREAKPOINTS = {
912
- screenL: 1920,
913
- screenM: 1680,
914
- screenS: 1440,
915
- tabletL: 1366,
916
- tabletM: 1280,
917
- tabletS: 1024,
918
- mobileL: 768,
919
- mobileM: 560,
920
- mobileS: 480,
921
- mobileXS: 375
922
- };
923
- var DEVICES = {
924
- screenXXL: [2560, 1440],
925
- screenXL: [2240, 1260],
926
- screenL: [1920, 1024],
927
- screenM: [1680, 1024],
928
- screenS: [1440, 720],
929
- tabletL: [1366, 926],
930
- tabletM: [1280, 768],
931
- tabletS: [1024, 768],
932
- mobileL: [768, 375],
933
- mobileM: [560, 768],
934
- mobileS: [480, 768],
935
- mobileXS: [375, 768]
936
- };
937
-
938
- // src/defaultConfig/cases.js
939
- var CASES = {};
940
-
941
- // src/defaultConfig/animation.js
942
- var ANIMATION = {};
943
-
944
- // src/defaultConfig/svg.js
945
- var SVG = {};
946
- var SVG_DATA = {};
947
-
948
- // src/defaultConfig/templates.js
949
- var TEMPLATES = {};
950
-
951
- // src/defaultConfig/grid.js
952
- var defaultProps4 = {};
953
- var GRID = defaultProps4;
954
-
955
- // src/defaultConfig/class.js
956
- var defaultProps5 = {};
957
- var CLASS = defaultProps5;
958
-
959
- // src/defaultConfig/index.js
960
- var RESET = {};
961
-
962
- // src/factory.js
963
- var CSS_VARS = {};
964
- var CONFIG = {
965
- verbose: false,
966
- useVariable: true,
967
- useReset: true,
968
- CSS_VARS,
969
- ...void 0 || defaultConfig_exports
970
- };
971
- var cachedConfig = deepClone(CONFIG);
972
- var FACTORY = {
973
- active: "0",
974
- 0: CONFIG
975
- };
976
- var getActiveConfig = (def) => {
977
- return FACTORY[def || FACTORY.active] || CONFIG;
978
- };
979
-
980
- // src/utils/unit.js
981
- var isScalingUnit = (unit) => {
982
- return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
983
- };
984
-
985
- // src/utils/color.js
986
- var colorStringToRgbaArray = (color) => {
987
- if (color === "") return [0, 0, 0, 0];
988
- if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
989
- if (color[0] === "#") {
990
- if (color.length < 7) {
991
- color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
992
- }
993
- return [
994
- parseInt(color.substr(1, 2), 16),
995
- parseInt(color.substr(3, 2), 16),
996
- parseInt(color.substr(5, 2), 16),
997
- color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
998
- ];
999
- }
1000
- if (color.indexOf("rgb") === -1) {
1001
- if (document2 && window2) {
1002
- const elem = document2.body.appendChild(document2.createElement("fictum"));
1003
- const flag = "rgb(1, 2, 3)";
1004
- elem.style.color = flag;
1005
- if (elem.style.color !== flag) {
1006
- document2.body.removeChild(elem);
1007
- return;
1008
- }
1009
- elem.style.color = color;
1010
- if (elem.style.color === flag || elem.style.color === "") {
1011
- document2.body.removeChild(elem);
1012
- return [0, 0, 0, 0];
1013
- }
1014
- color = window2.getComputedStyle(elem).color;
1015
- document2.body.removeChild(elem);
1016
- }
1017
- }
1018
- if (color.indexOf("rgb") === 0) {
1019
- if (color.indexOf("rgba") === -1) color = `${color}, 1`;
1020
- return color.match(/[\.\d]+/g).map((a) => +a);
1021
- }
1022
- return [0, 0, 0, 0];
1023
- };
1024
- var hexToRgbArray = (hex, alpha = 1) => {
1025
- const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
1026
- return [r, g, b];
1027
- };
1028
- var rgbArrayToHex = ([r, g, b]) => {
1029
- return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1030
- };
1031
- var rgbToHSL = (r, g, b) => {
1032
- const a = Math.max(r, g, b);
1033
- const n = a - Math.min(r, g, b);
1034
- const f = 1 - Math.abs(a + a - n - 1);
1035
- const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
1036
- return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
1037
- };
1038
- var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)) => [f(0), f(8), f(4)];
1039
- var getColorShade = (col, amt) => {
1040
- const num = parseInt(col, 16);
1041
- let r = (num >> 16) + amt;
1042
- if (r > 255) r = 255;
1043
- else if (r < 0) r = 0;
1044
- let b = (num >> 8 & 255) + amt;
1045
- if (b > 255) b = 255;
1046
- else if (b < 0) b = 0;
1047
- let g = (num & 255) + amt;
1048
- if (g > 255) g = 255;
1049
- else if (g < 0) g = 0;
1050
- return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
1051
- };
1052
- var getRgbTone = (rgb, tone) => {
1053
- if (isString(rgb) && rgb.includes("rgb"))
1054
- rgb = colorStringToRgbaArray(rgb).join(", ");
1055
- if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
1056
- if (isNumber(tone)) tone += "";
1057
- const toHex = rgbArrayToHex(rgb);
1058
- const abs = tone.slice(0, 1);
1059
- if (abs === "-" || abs === "+") {
1060
- const colorShade = getColorShade(toHex, parseFloat(tone));
1061
- return hexToRgbArray(colorShade).join(", ");
1062
- } else {
1063
- const [r, g, b] = rgb;
1064
- const hsl = rgbToHSL(r, g, b);
1065
- const [h, s, l] = hsl;
1066
- const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
1067
- return newRgb;
1068
- }
1069
- };
1070
-
1071
- // src/utils/sequence.js
1072
- var import_utils5 = __toESM(require_cjs(), 1);
1073
- var numToLetterMap = {
1074
- "-6": "U",
1075
- "-5": "V",
1076
- "-4": "W",
1077
- "-3": "X",
1078
- "-2": "Y",
1079
- "-1": "Z",
1080
- 0: "A",
1081
- 1: "B",
1082
- 2: "C",
1083
- 3: "D",
1084
- 4: "E",
1085
- 5: "F",
1086
- 6: "G",
1087
- 7: "H",
1088
- 8: "I",
1089
- 9: "J",
1090
- 10: "K",
1091
- 11: "L",
1092
- 12: "M",
1093
- 13: "N",
1094
- 14: "O",
1095
- 15: "P",
1096
- 16: "Q",
1097
- 17: "R",
1098
- 18: "S",
1099
- 19: "T"
1100
- };
1101
- var setSequenceValue = (props, sequenceProps) => {
1102
- const { key, variable, value, scaling, index, scalingVariable } = props;
1103
- sequenceProps.sequence[key] = {
1104
- key,
1105
- decimal: ~~(value * 100) / 100,
1106
- val: ~~value,
1107
- scaling,
1108
- index,
1109
- scalingVariable,
1110
- variable
1111
- };
1112
- sequenceProps.scales[key] = scaling;
1113
- sequenceProps.vars[variable] = scaling + sequenceProps.unit;
1114
- };
1115
- var setScalingVar = (key, sequenceProps) => {
1116
- const { base, type, unit } = sequenceProps;
1117
- const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
1118
- if (key === 0) return defaultVal;
1119
- const prefix = "--" + (type && type.replace(".", "-"));
1120
- const ratioVar = `${prefix}-ratio`;
1121
- if (key > 0) {
1122
- const prevLetterKey = numToLetterMap[key - 1];
1123
- return `calc(var(${prefix}-${prevLetterKey}) * var(${ratioVar}))`;
1124
- }
1125
- if (key < 0) {
1126
- const nextLetterKey = numToLetterMap[key + 1];
1127
- return `calc(var(${prefix}-${nextLetterKey}) / var(${ratioVar}))`;
1128
- }
1129
- };
1130
- var setSubScalingVar = (index, arr, variable, sequenceProps) => {
1131
- const { type } = sequenceProps;
1132
- const skipMiddle = index === 2 && arr.length === 2;
1133
- const indexMapWithLength = skipMiddle ? index + 1 : index;
1134
- const prefix = "--" + (type && type.replace(".", "-"));
1135
- const subRatioVarPrefix = `${prefix}-sub-ratio-`;
1136
- return `calc(var(${variable}) * var(${subRatioVarPrefix + indexMapWithLength}))`;
1137
- };
1138
- var getSubratioDifference = (base, ratio) => {
1139
- const diff = base * ratio - base;
1140
- const subRatio = diff / 1.618;
1141
- const first = base * ratio - subRatio;
1142
- const second = base + subRatio;
1143
- const middle = (first + second) / 2;
1144
- return [first, middle, second];
1145
- };
1146
- var getSubratio = (base, ratio) => {
1147
- return getSubratioDifference(base, ratio).map((v) => v / base);
1148
- };
1149
- var generateSubSequence = (props, sequenceProps) => {
1150
- const { key, base, value, ratio, variable, index } = props;
1151
- const next = value * ratio;
1152
- const diffRounded = ~~next - ~~value;
1153
- let arr;
1154
- const [first, middle, second] = getSubratioDifference(value, ratio);
1155
- if (diffRounded > 16) arr = [first, middle, second];
1156
- else arr = [first, second];
1157
- arr.forEach((v, k) => {
1158
- const scaling = ~~(v / base * 1e3) / 1e3;
1159
- const newVar = variable + (k + 1);
1160
- const newIndex = index + (k + 1) / 10;
1161
- const scalingVariable = setSubScalingVar(k + 1, arr, variable, sequenceProps);
1162
- const props2 = {
1163
- key: key + (k + 1),
1164
- variable: newVar,
1165
- value: v,
1166
- scaling,
1167
- scalingVariable,
1168
- index: newIndex
1169
- };
1170
- setSequenceValue(props2, sequenceProps);
1171
- });
1172
- };
1173
- var switchSequenceOnNegative = (key, base, ratio) => {
1174
- return base * Math.pow(ratio, key);
1175
- };
1176
- var generateSequence = (sequenceProps) => {
1177
- const { type, base, ratio, range, subSequence } = sequenceProps;
1178
- const n = Math.abs(range[0]) + Math.abs(range[1]);
1179
- const prefix = "--" + (type && type.replace(".", "-")) + "-";
1180
- for (let i = 0; i <= n; i++) {
1181
- const key = range[1] - i;
1182
- const letterKey = numToLetterMap[key];
1183
- const value = switchSequenceOnNegative(key, base, ratio);
1184
- const scaling = ~~(value / base * 100) / 100;
1185
- const variable = prefix + letterKey;
1186
- const scalingVariable = setScalingVar(key, sequenceProps);
1187
- const props = {
1188
- key: letterKey,
1189
- variable,
1190
- value,
1191
- base,
1192
- scaling,
1193
- scalingVariable,
1194
- ratio,
1195
- index: key
1196
- };
1197
- setSequenceValue(props, sequenceProps);
1198
- if (subSequence) generateSubSequence(props, sequenceProps);
1199
- }
1200
- return sequenceProps;
1201
- };
1202
- var getSequenceValue = (value = "A", sequenceProps) => {
1203
- const CONFIG2 = getActiveConfig();
1204
- const { UNIT: UNIT2 } = CONFIG2;
1205
- const {
1206
- sequence,
1207
- unit = UNIT2.default,
1208
- useVariable
1209
- } = sequenceProps;
1210
- if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
1211
- const prefix = `--${(0, import_utils5.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
1212
- const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
1213
- const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
1214
- if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
1215
- const letterVal = value.toUpperCase();
1216
- const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
1217
- let absValue = isNegative ? letterVal.slice(1) : letterVal;
1218
- let mediaName = "";
1219
- if (absValue.includes("_")) {
1220
- mediaName = "_" + absValue.split("_")[1].toLowerCase();
1221
- absValue = absValue.split("_")[0];
1222
- }
1223
- const varValue = (v) => startsWithDashOrLetterRegex.test(v) ? `var(${prefix}${v}${mediaName})` : v;
1224
- if (absValue.includes("+")) {
1225
- const [first, second] = absValue.split("+");
1226
- const joint = `${varValue(first)} + ${varValue(second)}`;
1227
- return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1228
- } else if (absValue.includes("*")) {
1229
- const [first, second] = absValue.split("*");
1230
- const joint = `${varValue(first)} * ${varValue(second)}`;
1231
- return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1232
- } else if (absValue.includes("-")) {
1233
- const [first, second] = absValue.split("-");
1234
- const joint = `${varValue(first)} - ${varValue(second)}`;
1235
- return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1236
- }
1237
- if (!sequence[absValue] && absValue.length === 2) {
1238
- if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
1239
- absValue = absValue.slice(0, 1);
1240
- }
1241
- if (useVariable || CONFIG2.useVariable) {
1242
- const varValue2 = `var(${prefix}${absValue}${mediaName})`;
1243
- return isNegative ? `calc(${varValue2} * -1)` : varValue2;
1244
- }
1245
- const sequenceItem = sequence ? sequence[absValue] : null;
1246
- if (!sequenceItem) return console.warn("can't find", sequence, absValue);
1247
- if (unit === "ms" || unit === "s") {
1248
- return isNegative + sequenceItem.val + unit;
1249
- }
1250
- return isNegative + sequenceItem.scaling + unit;
1251
- };
1252
- var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
1253
- if (typeof value !== "string") {
1254
- const CONFIG2 = getActiveConfig();
1255
- if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
1256
- return { [propertyName]: value };
1257
- }
1258
- if (value === "-" || value === "") return {};
1259
- return { [propertyName]: getSequenceValue(value, sequenceProps) };
1260
- };
1261
-
1262
- // src/utils/var.js
1263
- var applySequenceGlobalVars = (vars, obj, options) => {
1264
- const CONFIG2 = getActiveConfig();
1265
- const { UNIT: UNIT2 } = CONFIG2;
1266
- const unit = obj.unit || UNIT2.default;
1267
- const { base, ratio, type } = obj;
1268
- const prefix = "--" + (type && type.replace(".", "-"));
1269
- vars[`${prefix}-base`] = base;
1270
- vars[`${prefix}-unit`] = unit;
1271
- const ratioVar = `${prefix}-ratio`;
1272
- vars[ratioVar] = ratio;
1273
- const [first, middle, second] = getSubratio(base, ratio);
1274
- vars[`${prefix}-sub-ratio-1`] = `calc(var(${prefix}-ratio) * ${first / ratio})`;
1275
- vars[`${prefix}-sub-ratio-2`] = `calc(var(${prefix}-ratio) * ${middle / ratio})`;
1276
- vars[`${prefix}-sub-ratio-3`] = `calc(var(${prefix}-ratio) * ${second / ratio})`;
1277
- };
1278
- var applySequenceVars = (FACTORY2, options = {}) => {
1279
- const CONFIG2 = getActiveConfig();
1280
- const { UNIT: UNIT2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
1281
- const unit = FACTORY2.unit || UNIT2.default;
1282
- const { mediaRegenerate, sequence, scales } = FACTORY2;
1283
- if (!mediaRegenerate) {
1284
- applySequenceGlobalVars(CSS_VARS2, FACTORY2, options);
1285
- }
1286
- for (const key in sequence) {
1287
- const item = sequence[key];
1288
- const value = (FACTORY2.type === TIMING2.type ? sequence[key].val : scales[key]) + unit;
1289
- if (!mediaRegenerate) {
1290
- CSS_VARS2[item.variable + "_default"] = value;
1291
- CSS_VARS2[item.variable] = item.scalingVariable;
1292
- continue;
1293
- }
1294
- if (options.useDefault === false) {
1295
- CSS_VARS2[item.variable] = value;
1296
- } else {
1297
- CSS_VARS2[item.variable + "_default"] = value;
1298
- CSS_VARS2[item.variable] = `var(${item.variable + "_default"})`;
1299
- }
1300
- }
1301
- };
1302
-
1303
- // src/utils/sprite.js
1304
- var isDev = isNotProduction();
1305
-
1306
- // src/system/color.js
1307
- var getColor = (value, key, config) => {
1308
- const CONFIG2 = config || getActiveConfig();
1309
- if (!isString(value)) {
1310
- if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1311
- return;
1312
- }
1313
- if (value.slice(0, 2) === "--") return `var(${value})`;
1314
- if (key && value[key]) value = value[key];
1315
- const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
1316
- const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1317
- let val = COLOR2[name] || GRADIENT2[name];
1318
- if (!val) {
1319
- if (CONFIG2.verbose) console.warn("Can't find color ", name);
1320
- return value;
1321
- }
1322
- if (key) {
1323
- if (val[key]) val = val[key];
1324
- else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
1325
- }
1326
- let rgb = val.rgb;
1327
- if (!rgb) {
1328
- return CONFIG2.useVariable ? `var(${val.var})` : val.value;
1329
- }
1330
- if (tone && !val[tone]) {
1331
- rgb = getRgbTone(rgb, tone);
1332
- val[tone] = { rgb, var: `${val.var}-${tone}` };
1333
- }
1334
- if (val[tone]) rgb = val[tone].rgb;
1335
- if (alpha) return `rgba(${rgb}, ${alpha})`;
1336
- return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
1337
- };
1338
- var getMediaColor = (value, globalTheme, config) => {
1339
- const CONFIG2 = config || getActiveConfig();
1340
- if (!globalTheme) globalTheme = CONFIG2.globalTheme;
1341
- if (!isString(value)) {
1342
- if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1343
- return;
1344
- }
1345
- if (value.slice(0, 2) === "--") return `var(${value})`;
1346
- const [name] = isArray(value) ? value : value.split(" ");
1347
- const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1348
- const val = COLOR2[name] || GRADIENT2[name];
1349
- const isObj = isObject(val);
1350
- if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
1351
- else if (isObj) {
1352
- if (globalTheme) return getColor(value, `@${globalTheme}`, config);
1353
- else {
1354
- const obj = {};
1355
- for (const mediaName in val) {
1356
- const query = CONFIG2.MEDIA[mediaName.slice(1)];
1357
- const media = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
1358
- obj[media] = getColor(value, mediaName, config);
1359
- }
1360
- return obj;
1361
- }
1362
- } else {
1363
- if (CONFIG2.verbose) console.warn("Can't find color", value);
1364
- return value;
1365
- }
1366
- };
1367
-
1368
- // src/system/font.js
1369
- var import_utils12 = __toESM(require_cjs(), 1);
1370
-
1371
- // src/system/spacing.js
1372
- var import_utils16 = __toESM(require_cjs(), 1);
1373
- var getSequence = (sequenceProps) => {
1374
- const CONFIG2 = getActiveConfig();
1375
- const { SPACING: SPACING2 } = CONFIG2;
1376
- if (!sequenceProps) return SPACING2;
1377
- const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
1378
- return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
1379
- };
1380
- var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
1381
- const sequence = getSequence(sequenceProps);
1382
- if (isString(value) && (value.includes("calc") || value.includes("var"))) {
1383
- return { [propertyName]: value };
1384
- }
1385
- const stack = (0, import_utils16.arrayzeValue)(value);
1386
- if (!isArray(stack)) return;
1387
- if (stack.length > 1) {
1388
- let suffix = "";
1389
- if (propertyName === "borderWidth") {
1390
- propertyName = "border";
1391
- suffix = "Width";
1392
- }
1393
- const directions = {
1394
- 2: ["Block", "Inline"],
1395
- 3: ["BlockStart", "Inline", "BlockEnd"],
1396
- 4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
1397
- };
1398
- const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
1399
- stack[i],
1400
- propertyName + direction + suffix,
1401
- sequence
1402
- );
1403
- return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
1404
- }
1405
- return getSequenceValuePropertyPair(
1406
- value,
1407
- propertyName,
1408
- sequence
1409
- );
1410
- };
1411
- var getSpacingBasedOnRatio = (props, propertyName, val) => {
1412
- const CONFIG2 = getActiveConfig();
1413
- const { SPACING: SPACING2 } = CONFIG2;
1414
- const { spacingRatio, unit } = props;
1415
- const value = val || props[propertyName];
1416
- if (spacingRatio) {
1417
- let sequenceProps = SPACING2[spacingRatio];
1418
- if (!sequenceProps) {
1419
- const { type, base, range, subSequence } = SPACING2;
1420
- sequenceProps = SPACING2[spacingRatio] = merge({
1421
- ratio: spacingRatio,
1422
- type: type + "-" + spacingRatio,
1423
- unit,
1424
- sequence: {},
1425
- scales: {},
1426
- templates: {},
1427
- vars: {}
1428
- }, {
1429
- base,
1430
- range,
1431
- subSequence,
1432
- ratio: SPACING2.ratio,
1433
- unit: SPACING2.unit
1434
- });
1435
- }
1436
- applySequenceVars(sequenceProps, { useDefault: false });
1437
- return getSpacingByKey(value, propertyName, sequenceProps);
1438
- }
1439
- return getSpacingByKey(value, propertyName);
1440
- };
1441
-
1442
- // src/system/shadow.js
1443
- var getShadow = (value, globalTheme) => {
1444
- const CONFIG2 = getActiveConfig();
1445
- if (!globalTheme) globalTheme = CONFIG2.globalTheme;
1446
- if (!isString(value)) {
1447
- if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1448
- return;
1449
- }
1450
- if (value.slice(0, 2) === "--") return `var(${value})`;
1451
- const [name] = isArray(value) ? value : value.split(" ");
1452
- const { SHADOW: SHADOW2 } = CONFIG2;
1453
- const val = SHADOW2[name];
1454
- const isObj = isObject(val);
1455
- if (!val) {
1456
- if (CONFIG2.verbose) console.warn("Can't find color ", name);
1457
- return value;
1458
- }
1459
- if (globalTheme) {
1460
- if (val[globalTheme]) return val[globalTheme].value;
1461
- else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
1462
- }
1463
- if (isObj && val.value) return val.value;
1464
- if (isObj) {
1465
- const obj = {};
1466
- for (const mediaName in val) {
1467
- const query = CONFIG2.MEDIA[mediaName.slice(1)];
1468
- const media = "@media " + (query === "print" ? `${query}` : `screen and ${query}`);
1469
- obj[media] = val.value;
1470
- }
1471
- return obj;
1472
- }
1473
- if (CONFIG2.verbose) console.warn("Can't find color", value);
1474
- return value;
1475
- };
1476
-
1477
- // src/system/timing.js
1478
- var import_utils20 = __toESM(require_cjs(), 1);
1479
- var getTimingFunction = (value) => {
1480
- const CONFIG2 = getActiveConfig();
1481
- const { TIMING: TIMING2 } = CONFIG2;
1482
- return TIMING2[value] || TIMING2[(0, import_utils20.toCamelCase)(value)] || value;
1483
- };
1484
- var getTimingByKey = (value, property = "timing") => {
1485
- const CONFIG2 = getActiveConfig();
1486
- const { TIMING: TIMING2 } = CONFIG2;
1487
- return getSequenceValuePropertyPair(
1488
- value,
1489
- property,
1490
- TIMING2
1491
- );
1492
- };
1493
-
1494
- // src/transforms/index.js
1495
- var isBorderStyle = (str) => [
1496
- "none",
1497
- "hidden",
1498
- "dotted",
1499
- "dashed",
1500
- "solid",
1501
- "double",
1502
- "groove",
1503
- "ridge",
1504
- "inset",
1505
- "outset",
1506
- "initial"
1507
- ].some((v) => str.includes(v));
1508
- var transformBorder = (border) => {
1509
- const arr = border.split(", ");
1510
- return arr.map((v) => {
1511
- v = v.trim();
1512
- if (v.slice(0, 2) === "--") return `var(${v})`;
1513
- else if (isBorderStyle(v)) return v || "solid";
1514
- else if (v.slice(-2) === "px" || v.slice(-2) === "em") return v;
1515
- else if (getColor(v).length > 2) return getColor(v);
1516
- return getSpacingByKey(v, "border").border;
1517
- }).join(" ");
1518
- };
1519
- var transformTextStroke = (stroke) => {
1520
- return stroke.split(", ").map((v) => {
1521
- if (v.slice(0, 2) === "--") return `var(${v})`;
1522
- if (v.includes("px")) return v;
1523
- else if (getColor(v)) return getColor(v);
1524
- return v;
1525
- }).join(" ");
1526
- };
1527
- var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
1528
- var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shadow) => {
1529
- return shadow.split(",").map((v) => {
1530
- v = v.trim();
1531
- if (v.slice(0, 2) === "--") return `var(${v})`;
1532
- if (getColor(v).length > 2) {
1533
- const color = getMediaColor(v, globalTheme);
1534
- if (isObject(color)) return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
1535
- return color;
1536
- }
1537
- if (v.includes("px") || v.slice(-2) === "em") return v;
1538
- const arr = v.split(" ");
1539
- if (!arr.length) return v;
1540
- return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
1541
- }).join(" ");
1542
- }).join(",");
1543
- var transformBackgroundImage = (backgroundImage, globalTheme) => {
1544
- const CONFIG2 = getActiveConfig();
1545
- return backgroundImage.split(", ").map((v) => {
1546
- if (v.slice(0, 2) === "--") return `var(${v})`;
1547
- if (v.includes("url") || v.includes("gradient")) return v;
1548
- else if (CONFIG2.GRADIENT[backgroundImage]) {
1549
- return {
1550
- backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
1551
- };
1552
- } else if (v.includes("/") || v.startsWith("http") || v.includes(".")) return `url(${v})`;
1553
- return v;
1554
- }).join(" ");
1555
- };
1556
- var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
1557
- var transformTransition = (transition) => {
1558
- const arr = transition.split(" ");
1559
- if (!arr.length) return transition;
1560
- return arr.map((v) => {
1561
- if (v.slice(0, 2) === "--") return `var(${v})`;
1562
- if (v.length < 3 || v.includes("ms")) {
1563
- const mapWithSequence = getTimingByKey(v);
1564
- return mapWithSequence.timing || v;
1565
- }
1566
- if (getTimingFunction(v)) return getTimingFunction(v);
1567
- return v;
1568
- }).join(" ");
1569
- };
1570
- var transformDuration = (duration, props, propertyName) => {
1571
- if (!isString(duration)) return;
1572
- return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
1573
- };
1574
- var splitTransition = (transition) => {
1575
- const arr = transition.split(",");
1576
- if (!arr.length) return;
1577
- return arr.map(transformTransition).join(",");
1578
- };
1579
- var checkIfBoxSize = (propertyName) => {
1580
- const prop = propertyName.toLowerCase();
1581
- return (prop.includes("width") || prop.includes("height")) && !prop.includes("border");
1582
- };
1583
- var transformSize = (propertyName, val, props = {}, opts = {}) => {
1584
- let value = val || props[propertyName];
1585
- if (isUndefined(value) && isNull(value)) return;
1586
- const shouldScaleBoxSize = props.scaleBoxSize;
1587
- const isBoxSize = checkIfBoxSize(propertyName);
1588
- if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
1589
- value = value.split(" ").map((v) => {
1590
- const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
1591
- const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
1592
- if (isSingleLetter && !hasUnits) return v + "_default";
1593
- return v;
1594
- }).join(" ");
1595
- }
1596
- if (opts.ratio) {
1597
- return getSpacingBasedOnRatio(props, propertyName, value);
1598
- } else {
1599
- return getSpacingByKey(value, propertyName);
1600
- }
1601
- };
1602
- var transformSizeRatio = (propertyName, val = null, props) => {
1603
- return transformSize(propertyName, val, props, {
1604
- ratio: true
1605
- });
1606
- };
1607
- var transformBorderRadius = (radius, props, propertyName) => {
1608
- if (!isString(radius)) return;
1609
- return {
1610
- borderRadius: radius.split(" ").map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(" ")
1611
- };
1612
- };
1613
- // @preserve-env