@symbo.ls/scratch 2.10.223 → 2.10.225

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 (42) hide show
  1. package/dist/cjs/defaultConfig/animation.js +3 -1
  2. package/dist/cjs/defaultConfig/cases.js +3 -1
  3. package/dist/cjs/defaultConfig/color.js +4 -8
  4. package/dist/cjs/defaultConfig/document.js +3 -1
  5. package/dist/cjs/defaultConfig/font-family.js +5 -9
  6. package/dist/cjs/defaultConfig/font.js +3 -10
  7. package/dist/cjs/defaultConfig/icons.js +3 -1
  8. package/dist/cjs/defaultConfig/index.js +184 -19
  9. package/dist/cjs/defaultConfig/media.js +3 -1
  10. package/dist/cjs/defaultConfig/responsive.js +4 -2
  11. package/dist/cjs/defaultConfig/sequence.js +3 -1
  12. package/dist/cjs/defaultConfig/spacing.js +53 -6
  13. package/dist/cjs/defaultConfig/svg.js +4 -2
  14. package/dist/cjs/defaultConfig/theme.js +3 -13
  15. package/dist/cjs/defaultConfig/timing.js +35 -4
  16. package/dist/cjs/defaultConfig/typography.js +35 -4
  17. package/dist/cjs/defaultConfig/unit.js +3 -1
  18. package/dist/cjs/factory.js +999 -10
  19. package/dist/cjs/index.js +2462 -6
  20. package/dist/cjs/set.js +2172 -46
  21. package/dist/cjs/system/color.js +1162 -44
  22. package/dist/cjs/system/document.js +1062 -11
  23. package/dist/cjs/system/font.js +1093 -17
  24. package/dist/cjs/system/index.js +2136 -10
  25. package/dist/cjs/system/reset.js +1131 -20
  26. package/dist/cjs/system/spacing.js +1274 -33
  27. package/dist/cjs/system/svg.js +1104 -25
  28. package/dist/cjs/system/theme.js +1187 -68
  29. package/dist/cjs/system/timing.js +1255 -19
  30. package/dist/cjs/system/typography.js +1270 -28
  31. package/dist/cjs/tests/index.js +4 -2
  32. package/dist/cjs/utils/color.js +68 -16
  33. package/dist/cjs/utils/font.js +11 -9
  34. package/dist/cjs/utils/index.js +1508 -7
  35. package/dist/cjs/utils/sequence.js +1051 -19
  36. package/dist/cjs/utils/sprite.js +815 -4
  37. package/dist/cjs/utils/theme.js +3 -1
  38. package/dist/cjs/utils/var.js +1044 -21
  39. package/package.json +3 -3
  40. package/src/index.js +4 -0
  41. package/src/set.js +0 -2
  42. package/src/utils/color.js +3 -0
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
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
+ };
6
15
  var __copyProps = (to, from, except, desc) => {
7
16
  if (from && typeof from === "object" || typeof from === "function") {
8
17
  for (let key of __getOwnPropNames(from))
@@ -11,12 +20,2459 @@ var __copyProps = (to, from, except, desc) => {
11
20
  }
12
21
  return to;
13
22
  };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
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
+ ));
15
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/@domql/globals/dist/cjs/index.js
34
+ var require_cjs = __commonJS({
35
+ "../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
36
+ "use strict";
37
+ var __defProp2 = Object.defineProperty;
38
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
41
+ var __export2 = (target, all) => {
42
+ for (var name in all)
43
+ __defProp2(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 (!__hasOwnProp2.call(to, key) && key !== except)
49
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
+ }
51
+ return to;
52
+ };
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
+ var globals_exports = {};
55
+ __export2(globals_exports, {
56
+ document: () => document4,
57
+ global: () => global,
58
+ self: () => self,
59
+ window: () => window3
60
+ });
61
+ module2.exports = __toCommonJS2(globals_exports);
62
+ var global = globalThis;
63
+ var self = globalThis;
64
+ var window3 = globalThis;
65
+ var document4 = window3.document;
66
+ }
67
+ });
68
+
69
+ // ../../node_modules/@domql/tags/dist/cjs/htmlTags.js
70
+ var require_htmlTags = __commonJS({
71
+ "../../node_modules/@domql/tags/dist/cjs/htmlTags.js"(exports, module2) {
72
+ "use strict";
73
+ var __defProp2 = Object.defineProperty;
74
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
75
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
76
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
77
+ var __export2 = (target, all) => {
78
+ for (var name in all)
79
+ __defProp2(target, name, { get: all[name], enumerable: true });
80
+ };
81
+ var __copyProps2 = (to, from, except, desc) => {
82
+ if (from && typeof from === "object" || typeof from === "function") {
83
+ for (let key of __getOwnPropNames2(from))
84
+ if (!__hasOwnProp2.call(to, key) && key !== except)
85
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
86
+ }
87
+ return to;
88
+ };
89
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
90
+ var htmlTags_exports = {};
91
+ __export2(htmlTags_exports, {
92
+ HTML_TAGS: () => HTML_TAGS
93
+ });
94
+ module2.exports = __toCommonJS2(htmlTags_exports);
95
+ var HTML_TAGS = {
96
+ root: [
97
+ "body",
98
+ "html"
99
+ ],
100
+ head: [
101
+ "title",
102
+ "base",
103
+ "meta",
104
+ "style"
105
+ ],
106
+ body: [
107
+ "string",
108
+ "fragment",
109
+ "a",
110
+ "abbr",
111
+ "acronym",
112
+ "address",
113
+ "applet",
114
+ "area",
115
+ "article",
116
+ "aside",
117
+ "audio",
118
+ "b",
119
+ "basefont",
120
+ "bdi",
121
+ "bdo",
122
+ "big",
123
+ "blockquote",
124
+ "br",
125
+ "button",
126
+ "canvas",
127
+ "caption",
128
+ "center",
129
+ "cite",
130
+ "code",
131
+ "col",
132
+ "colgroup",
133
+ "data",
134
+ "datalist",
135
+ "dd",
136
+ "del",
137
+ "details",
138
+ "dfn",
139
+ "dialog",
140
+ "dir",
141
+ "div",
142
+ "dl",
143
+ "dt",
144
+ "em",
145
+ "embed",
146
+ "fieldset",
147
+ "figcaption",
148
+ "figure",
149
+ "font",
150
+ "footer",
151
+ "form",
152
+ "frame",
153
+ "frameset",
154
+ "h1",
155
+ "h2",
156
+ "h3",
157
+ "h4",
158
+ "h5",
159
+ "h6",
160
+ "head",
161
+ "header",
162
+ "hr",
163
+ "i",
164
+ "iframe",
165
+ "img",
166
+ "input",
167
+ "ins",
168
+ "kbd",
169
+ "label",
170
+ "legend",
171
+ "li",
172
+ "link",
173
+ "main",
174
+ "map",
175
+ "mark",
176
+ "meter",
177
+ "nav",
178
+ "noframes",
179
+ "noscript",
180
+ "object",
181
+ "ol",
182
+ "optgroup",
183
+ "option",
184
+ "output",
185
+ "p",
186
+ "param",
187
+ "picture",
188
+ "pre",
189
+ "progress",
190
+ "q",
191
+ "rp",
192
+ "rt",
193
+ "ruby",
194
+ "s",
195
+ "samp",
196
+ "script",
197
+ "section",
198
+ "select",
199
+ "small",
200
+ "source",
201
+ "span",
202
+ "strike",
203
+ "strong",
204
+ "sub",
205
+ "summary",
206
+ "sup",
207
+ "table",
208
+ "tbody",
209
+ "td",
210
+ "template",
211
+ "textarea",
212
+ "tfoot",
213
+ "th",
214
+ "thead",
215
+ "time",
216
+ "tr",
217
+ "track",
218
+ "tt",
219
+ "u",
220
+ "ul",
221
+ "var",
222
+ "video",
223
+ "wbr",
224
+ // SVG
225
+ "svg",
226
+ "path"
227
+ ]
228
+ };
229
+ }
230
+ });
231
+
232
+ // ../../node_modules/@domql/tags/dist/cjs/index.js
233
+ var require_cjs2 = __commonJS({
234
+ "../../node_modules/@domql/tags/dist/cjs/index.js"(exports, module2) {
235
+ "use strict";
236
+ var __defProp2 = Object.defineProperty;
237
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
238
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
239
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
240
+ var __copyProps2 = (to, from, except, desc) => {
241
+ if (from && typeof from === "object" || typeof from === "function") {
242
+ for (let key of __getOwnPropNames2(from))
243
+ if (!__hasOwnProp2.call(to, key) && key !== except)
244
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
245
+ }
246
+ return to;
247
+ };
248
+ var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
249
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
250
+ var tags_exports = {};
251
+ module2.exports = __toCommonJS2(tags_exports);
252
+ __reExport(tags_exports, require_htmlTags(), module2.exports);
253
+ }
254
+ });
255
+
256
+ // ../../node_modules/@domql/utils/dist/cjs/types.js
257
+ var require_types = __commonJS({
258
+ "../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
259
+ "use strict";
260
+ var __defProp2 = Object.defineProperty;
261
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
262
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
263
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
264
+ var __export2 = (target, all) => {
265
+ for (var name in all)
266
+ __defProp2(target, name, { get: all[name], enumerable: true });
267
+ };
268
+ var __copyProps2 = (to, from, except, desc) => {
269
+ if (from && typeof from === "object" || typeof from === "function") {
270
+ for (let key of __getOwnPropNames2(from))
271
+ if (!__hasOwnProp2.call(to, key) && key !== except)
272
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
273
+ }
274
+ return to;
275
+ };
276
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
277
+ var types_exports = {};
278
+ __export2(types_exports, {
279
+ TYPES: () => TYPES,
280
+ is: () => is,
281
+ isArray: () => isArray5,
282
+ isBoolean: () => isBoolean,
283
+ isDefined: () => isDefined2,
284
+ isFunction: () => isFunction2,
285
+ isHtmlElement: () => isHtmlElement,
286
+ isNode: () => isNode,
287
+ isNot: () => isNot,
288
+ isNull: () => isNull,
289
+ isNumber: () => isNumber,
290
+ isObject: () => isObject6,
291
+ isObjectLike: () => isObjectLike3,
292
+ isString: () => isString7,
293
+ isUndefined: () => isUndefined,
294
+ isValidHtmlTag: () => isValidHtmlTag
295
+ });
296
+ module2.exports = __toCommonJS2(types_exports);
297
+ var import_globals3 = require_cjs();
298
+ var import_tags = require_cjs2();
299
+ var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.indexOf(arg);
300
+ var isObject6 = (arg) => {
301
+ if (arg === null)
302
+ return false;
303
+ return typeof arg === "object" && arg.constructor === Object;
304
+ };
305
+ var isString7 = (arg) => typeof arg === "string";
306
+ var isNumber = (arg) => typeof arg === "number";
307
+ var isFunction2 = (arg) => typeof arg === "function";
308
+ var isBoolean = (arg) => arg === true || arg === false;
309
+ var isNull = (arg) => arg === null;
310
+ var isArray5 = (arg) => Array.isArray(arg);
311
+ var isObjectLike3 = (arg) => {
312
+ if (arg === null)
313
+ return false;
314
+ return typeof arg === "object";
315
+ };
316
+ var isNode = (obj) => {
317
+ return typeof import_globals3.window.Node === "object" ? obj instanceof import_globals3.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string";
318
+ };
319
+ var isHtmlElement = (obj) => {
320
+ return typeof import_globals3.window.HTMLElement === "object" ? obj instanceof import_globals3.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string";
321
+ };
322
+ var isDefined2 = (arg) => {
323
+ return isObject6(arg) || isObjectLike3(arg) || isString7(arg) || isNumber(arg) || isFunction2(arg) || isArray5(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
324
+ };
325
+ var isUndefined = (arg) => {
326
+ return arg === void 0;
327
+ };
328
+ var TYPES = {
329
+ boolean: isBoolean,
330
+ array: isArray5,
331
+ object: isObject6,
332
+ string: isString7,
333
+ number: isNumber,
334
+ null: isNull,
335
+ function: isFunction2,
336
+ objectLike: isObjectLike3,
337
+ node: isNode,
338
+ htmlElement: isHtmlElement,
339
+ defined: isDefined2
340
+ };
341
+ var is = (arg) => {
342
+ return (...args) => {
343
+ return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
344
+ };
345
+ };
346
+ var isNot = (arg) => {
347
+ return (...args) => {
348
+ return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
349
+ };
350
+ };
351
+ }
352
+ });
353
+
354
+ // ../../node_modules/@domql/utils/dist/cjs/object.js
355
+ var require_object = __commonJS({
356
+ "../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
357
+ "use strict";
358
+ var __defProp2 = Object.defineProperty;
359
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
360
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
361
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
362
+ var __export2 = (target, all) => {
363
+ for (var name in all)
364
+ __defProp2(target, name, { get: all[name], enumerable: true });
365
+ };
366
+ var __copyProps2 = (to, from, except, desc) => {
367
+ if (from && typeof from === "object" || typeof from === "function") {
368
+ for (let key of __getOwnPropNames2(from))
369
+ if (!__hasOwnProp2.call(to, key) && key !== except)
370
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
371
+ }
372
+ return to;
373
+ };
374
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
375
+ var object_exports = {};
376
+ __export2(object_exports, {
377
+ clone: () => clone,
378
+ deepClone: () => deepClone2,
379
+ deepCloneExclude: () => deepCloneExclude,
380
+ deepDestringify: () => deepDestringify,
381
+ deepMerge: () => deepMerge2,
382
+ deepStringify: () => deepStringify,
383
+ diff: () => diff,
384
+ exec: () => exec,
385
+ flattenRecursive: () => flattenRecursive,
386
+ isEqualDeep: () => isEqualDeep,
387
+ map: () => map,
388
+ merge: () => merge5,
389
+ mergeAndCloneIfArray: () => mergeAndCloneIfArray,
390
+ mergeArray: () => mergeArray,
391
+ mergeArrayExclude: () => mergeArrayExclude,
392
+ mergeIfExisted: () => mergeIfExisted,
393
+ overwrite: () => overwrite,
394
+ overwriteDeep: () => overwriteDeep,
395
+ overwriteObj: () => overwriteObj
396
+ });
397
+ module2.exports = __toCommonJS2(object_exports);
398
+ var import_globals3 = require_cjs();
399
+ var import_types = require_types();
400
+ var exec = (param, element, state, context) => {
401
+ if ((0, import_types.isFunction)(param)) {
402
+ return param(
403
+ element,
404
+ state || element.state,
405
+ context || element.context
406
+ );
407
+ }
408
+ return param;
409
+ };
410
+ var map = (obj, extention, element) => {
411
+ for (const e in extention) {
412
+ obj[e] = exec(extention[e], element);
413
+ }
414
+ };
415
+ var merge5 = (element, obj) => {
416
+ for (const e in obj) {
417
+ const elementProp = element[e];
418
+ const objProp = obj[e];
419
+ if (elementProp === void 0) {
420
+ element[e] = objProp;
421
+ }
422
+ }
423
+ return element;
424
+ };
425
+ var deepMerge2 = (element, extend) => {
426
+ for (const e in extend) {
427
+ const extendProp = extend[e];
428
+ if (e === "parent" || e === "props")
429
+ continue;
430
+ if (element[e] === void 0) {
431
+ element[e] = extendProp;
432
+ } else if ((0, import_types.isObjectLike)(element[e]) && (0, import_types.isObjectLike)(extendProp)) {
433
+ deepMerge2(element[e], extendProp);
434
+ } else {
435
+ element[e] = extendProp;
436
+ }
437
+ }
438
+ return element;
439
+ };
440
+ var clone = (obj) => {
441
+ const o = {};
442
+ for (const prop in obj) {
443
+ if (prop === "node")
444
+ continue;
445
+ o[prop] = obj[prop];
446
+ }
447
+ return o;
448
+ };
449
+ var deepCloneExclude = (obj, exclude = []) => {
450
+ if ((0, import_types.isArray)(obj)) {
451
+ return obj.map((x) => deepCloneExclude(x, exclude));
452
+ }
453
+ const o = {};
454
+ for (const k in obj) {
455
+ if (exclude.indexOf(k) > -1)
456
+ continue;
457
+ let v = obj[k];
458
+ if (k === "extend" && (0, import_types.isArray)(v)) {
459
+ v = mergeArrayExclude(v, exclude);
460
+ }
461
+ if ((0, import_types.isArray)(v)) {
462
+ o[k] = v.map((x) => deepCloneExclude(x, exclude));
463
+ } else if ((0, import_types.isObject)(v)) {
464
+ o[k] = deepCloneExclude(v, exclude);
465
+ } else
466
+ o[k] = v;
467
+ }
468
+ return o;
469
+ };
470
+ var mergeArrayExclude = (arr, excl = []) => {
471
+ return arr.reduce((acc, curr) => deepMerge2(acc, deepCloneExclude(curr, excl)), {});
472
+ };
473
+ var deepClone2 = (obj) => {
474
+ if ((0, import_types.isArray)(obj)) {
475
+ return obj.map(deepClone2);
476
+ }
477
+ const o = {};
478
+ for (const prop in obj) {
479
+ let objProp = obj[prop];
480
+ if (prop === "extend" && (0, import_types.isArray)(objProp)) {
481
+ objProp = mergeArray(objProp);
482
+ }
483
+ if ((0, import_types.isArray)(objProp)) {
484
+ o[prop] = objProp.map((v) => (0, import_types.isObject)(v) ? deepClone2(v) : v);
485
+ } else if ((0, import_types.isObject)(objProp)) {
486
+ o[prop] = deepClone2(objProp);
487
+ } else
488
+ o[prop] = objProp;
489
+ }
490
+ return o;
491
+ };
492
+ var deepStringify = (obj, stringified = {}) => {
493
+ for (const prop in obj) {
494
+ const objProp = obj[prop];
495
+ if ((0, import_types.isFunction)(objProp)) {
496
+ stringified[prop] = objProp.toString();
497
+ } else if ((0, import_types.isObject)(objProp)) {
498
+ stringified[prop] = {};
499
+ deepStringify(objProp, stringified[prop]);
500
+ } else if ((0, import_types.isArray)(objProp)) {
501
+ stringified[prop] = [];
502
+ objProp.forEach((v, i) => {
503
+ if ((0, import_types.isObject)(v)) {
504
+ stringified[prop][i] = {};
505
+ deepStringify(v, stringified[prop][i]);
506
+ } else if ((0, import_types.isFunction)(v)) {
507
+ stringified[prop][i] = v.toString();
508
+ } else {
509
+ stringified[prop][i] = v;
510
+ }
511
+ });
512
+ } else {
513
+ stringified[prop] = objProp;
514
+ }
515
+ }
516
+ return stringified;
517
+ };
518
+ var deepDestringify = (obj, stringified = {}) => {
519
+ for (const prop in obj) {
520
+ const objProp = obj[prop];
521
+ if ((0, import_types.isString)(objProp)) {
522
+ if (objProp.includes("=>") || objProp.includes("function") || objProp.startsWith("(")) {
523
+ try {
524
+ const evalProp = import_globals3.window.eval(`(${objProp})`);
525
+ stringified[prop] = evalProp;
526
+ } catch (e) {
527
+ if (e)
528
+ stringified[prop] = objProp;
529
+ }
530
+ } else {
531
+ stringified[prop] = objProp;
532
+ }
533
+ } else if ((0, import_types.isArray)(objProp)) {
534
+ stringified[prop] = [];
535
+ objProp.forEach((arrProp) => {
536
+ if ((0, import_types.isString)(arrProp)) {
537
+ if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
538
+ try {
539
+ const evalProp = import_globals3.window.eval(`(${arrProp})`);
540
+ stringified[prop].push(evalProp);
541
+ } catch (e) {
542
+ if (e)
543
+ stringified[prop].push(arrProp);
544
+ }
545
+ } else {
546
+ stringified[prop].push(arrProp);
547
+ }
548
+ } else if ((0, import_types.isObject)(arrProp)) {
549
+ stringified[prop].push(deepDestringify(arrProp));
550
+ } else {
551
+ stringified[prop].push(arrProp);
552
+ }
553
+ });
554
+ } else if ((0, import_types.isObject)(objProp)) {
555
+ stringified[prop] = deepDestringify(objProp, stringified[prop]);
556
+ } else {
557
+ stringified[prop] = objProp;
558
+ }
559
+ }
560
+ return stringified;
561
+ };
562
+ var overwrite = (element, params, options) => {
563
+ const { ref } = element;
564
+ const changes = {};
565
+ for (const e in params) {
566
+ if (e === "props")
567
+ continue;
568
+ const elementProp = element[e];
569
+ const paramsProp = params[e];
570
+ if (paramsProp) {
571
+ ref.__cache[e] = changes[e] = elementProp;
572
+ ref[e] = paramsProp;
573
+ }
574
+ }
575
+ return changes;
576
+ };
577
+ var diff = (obj, original, cache) => {
578
+ const changes = cache || {};
579
+ for (const e in obj) {
580
+ if (e === "ref")
581
+ continue;
582
+ const originalProp = original[e];
583
+ const objProp = obj[e];
584
+ if ((0, import_types.isObjectLike)(originalProp) && (0, import_types.isObjectLike)(objProp)) {
585
+ changes[e] = {};
586
+ diff(originalProp, objProp, changes[e]);
587
+ } else if (objProp !== void 0) {
588
+ changes[e] = objProp;
589
+ }
590
+ }
591
+ return changes;
592
+ };
593
+ var overwriteObj = (params, obj) => {
594
+ const changes = {};
595
+ for (const e in params) {
596
+ const objProp = obj[e];
597
+ const paramsProp = params[e];
598
+ if (paramsProp) {
599
+ obj[e] = changes[e] = objProp;
600
+ }
601
+ }
602
+ return changes;
603
+ };
604
+ var overwriteDeep = (params, obj) => {
605
+ for (const e in params) {
606
+ const objProp = obj[e];
607
+ const paramsProp = params[e];
608
+ if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
609
+ overwriteDeep(paramsProp, objProp);
610
+ } else if (paramsProp !== void 0) {
611
+ obj[e] = paramsProp;
612
+ }
613
+ }
614
+ return obj;
615
+ };
616
+ var mergeIfExisted = (a, b) => {
617
+ if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
618
+ return deepMerge2(a, b);
619
+ return a || b;
620
+ };
621
+ var mergeArray = (arr) => {
622
+ return arr.reduce((a, c) => deepMerge2(a, deepClone2(c)), {});
623
+ };
624
+ var mergeAndCloneIfArray = (obj) => {
625
+ return (0, import_types.isArray)(obj) ? mergeArray(obj) : deepClone2(obj);
626
+ };
627
+ var flattenRecursive = (param, prop, stack = []) => {
628
+ const objectized = mergeAndCloneIfArray(param);
629
+ stack.push(objectized);
630
+ const extendOfExtend = objectized[prop];
631
+ if (extendOfExtend)
632
+ flattenRecursive(extendOfExtend, prop, stack);
633
+ delete objectized[prop];
634
+ return stack;
635
+ };
636
+ var isEqualDeep = (param, element) => {
637
+ if (param === element)
638
+ return true;
639
+ if (!param || !element)
640
+ return false;
641
+ for (const prop in param) {
642
+ const paramProp = param[prop];
643
+ const elementProp = element[prop];
644
+ if ((0, import_types.isObjectLike)(paramProp)) {
645
+ const isEqual = isEqualDeep(paramProp, elementProp);
646
+ if (!isEqual)
647
+ return false;
648
+ } else {
649
+ const isEqual = paramProp === elementProp;
650
+ if (!isEqual)
651
+ return false;
652
+ }
653
+ }
654
+ return true;
655
+ };
656
+ }
657
+ });
658
+
659
+ // ../../node_modules/@domql/utils/dist/cjs/function.js
660
+ var require_function = __commonJS({
661
+ "../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
662
+ "use strict";
663
+ var __defProp2 = Object.defineProperty;
664
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
665
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
666
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
667
+ var __export2 = (target, all) => {
668
+ for (var name in all)
669
+ __defProp2(target, name, { get: all[name], enumerable: true });
670
+ };
671
+ var __copyProps2 = (to, from, except, desc) => {
672
+ if (from && typeof from === "object" || typeof from === "function") {
673
+ for (let key of __getOwnPropNames2(from))
674
+ if (!__hasOwnProp2.call(to, key) && key !== except)
675
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
676
+ }
677
+ return to;
678
+ };
679
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
680
+ var function_exports = {};
681
+ __export2(function_exports, {
682
+ debounce: () => debounce,
683
+ memoize: () => memoize
684
+ });
685
+ module2.exports = __toCommonJS2(function_exports);
686
+ var debounce = (element, func, timeout = 300) => {
687
+ let timer;
688
+ return (...args) => {
689
+ clearTimeout(timer);
690
+ timer = setTimeout(() => {
691
+ func.apply(element, args);
692
+ }, timeout);
693
+ };
694
+ };
695
+ var memoize = (fn) => {
696
+ const cache = {};
697
+ return (...args) => {
698
+ const n = args[0];
699
+ if (n in cache) {
700
+ return cache[n];
701
+ } else {
702
+ const result = fn(n);
703
+ cache[n] = result;
704
+ return result;
705
+ }
706
+ };
707
+ };
708
+ }
709
+ });
710
+
711
+ // ../../node_modules/@domql/utils/dist/cjs/array.js
712
+ var require_array = __commonJS({
713
+ "../../node_modules/@domql/utils/dist/cjs/array.js"() {
714
+ "use strict";
715
+ }
716
+ });
717
+
718
+ // ../../node_modules/@domql/utils/dist/cjs/node.js
719
+ var require_node = __commonJS({
720
+ "../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
721
+ "use strict";
722
+ var __defProp2 = Object.defineProperty;
723
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
724
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
725
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
726
+ var __export2 = (target, all) => {
727
+ for (var name in all)
728
+ __defProp2(target, name, { get: all[name], enumerable: true });
729
+ };
730
+ var __copyProps2 = (to, from, except, desc) => {
731
+ if (from && typeof from === "object" || typeof from === "function") {
732
+ for (let key of __getOwnPropNames2(from))
733
+ if (!__hasOwnProp2.call(to, key) && key !== except)
734
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
735
+ }
736
+ return to;
737
+ };
738
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
739
+ var node_exports = {};
740
+ __export2(node_exports, {
741
+ cleanWithNode: () => cleanWithNode,
742
+ createID: () => createID,
743
+ createSnapshotId: () => createSnapshotId
744
+ });
745
+ module2.exports = __toCommonJS2(node_exports);
746
+ var cleanWithNode = (extend) => delete extend.node && extend;
747
+ var createID = function() {
748
+ let index = 0;
749
+ function newId() {
750
+ index++;
751
+ return index;
752
+ }
753
+ return newId;
754
+ }();
755
+ var createSnapshotId = createID;
756
+ }
757
+ });
758
+
759
+ // ../../node_modules/@domql/utils/dist/cjs/log.js
760
+ var require_log = __commonJS({
761
+ "../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
762
+ "use strict";
763
+ var __defProp2 = Object.defineProperty;
764
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
765
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
766
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
767
+ var __export2 = (target, all) => {
768
+ for (var name in all)
769
+ __defProp2(target, name, { get: all[name], enumerable: true });
770
+ };
771
+ var __copyProps2 = (to, from, except, desc) => {
772
+ if (from && typeof from === "object" || typeof from === "function") {
773
+ for (let key of __getOwnPropNames2(from))
774
+ if (!__hasOwnProp2.call(to, key) && key !== except)
775
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
776
+ }
777
+ return to;
778
+ };
779
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
780
+ var log_exports = {};
781
+ __export2(log_exports, {
782
+ logGroupIf: () => logGroupIf,
783
+ logIf: () => logIf
784
+ });
785
+ module2.exports = __toCommonJS2(log_exports);
786
+ var logIf = (bool, ...arg) => {
787
+ if (bool)
788
+ arg.map((v) => console.log(v));
789
+ };
790
+ var logGroupIf = (bool, key, ...arg) => {
791
+ if (bool) {
792
+ console.group(key);
793
+ arg.map((v) => console.log(v));
794
+ console.groupEnd(key);
795
+ }
796
+ };
797
+ }
798
+ });
799
+
800
+ // ../../node_modules/@domql/utils/dist/cjs/index.js
801
+ var require_cjs3 = __commonJS({
802
+ "../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
803
+ "use strict";
804
+ var __defProp2 = Object.defineProperty;
805
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
806
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
807
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
808
+ var __copyProps2 = (to, from, except, desc) => {
809
+ if (from && typeof from === "object" || typeof from === "function") {
810
+ for (let key of __getOwnPropNames2(from))
811
+ if (!__hasOwnProp2.call(to, key) && key !== except)
812
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
813
+ }
814
+ return to;
815
+ };
816
+ var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
817
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
818
+ var utils_exports2 = {};
819
+ module2.exports = __toCommonJS2(utils_exports2);
820
+ __reExport(utils_exports2, require_types(), module2.exports);
821
+ __reExport(utils_exports2, require_object(), module2.exports);
822
+ __reExport(utils_exports2, require_function(), module2.exports);
823
+ __reExport(utils_exports2, require_array(), module2.exports);
824
+ __reExport(utils_exports2, require_node(), module2.exports);
825
+ __reExport(utils_exports2, require_log(), module2.exports);
826
+ }
827
+ });
828
+
829
+ // src/index.js
16
830
  var src_exports = {};
831
+ __export(src_exports, {
832
+ ANIMATION: () => ANIMATION,
833
+ BREAKPOINTS: () => BREAKPOINTS,
834
+ CASES: () => CASES,
835
+ COLOR: () => COLOR,
836
+ CONFIG: () => CONFIG,
837
+ CSS_VARS: () => CSS_VARS,
838
+ DEVICES: () => DEVICES,
839
+ DOCUMENT: () => DOCUMENT,
840
+ FACTORY: () => FACTORY,
841
+ FONT: () => FONT,
842
+ FONT_FACE: () => FONT_FACE,
843
+ FONT_FAMILY: () => FONT_FAMILY,
844
+ FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
845
+ GRADIENT: () => GRADIENT,
846
+ ICONS: () => ICONS,
847
+ MEDIA: () => MEDIA,
848
+ RESET: () => RESET,
849
+ SEQUENCE: () => SEQUENCE,
850
+ SPACING: () => SPACING,
851
+ SVG: () => SVG,
852
+ SVG_DATA: () => SVG_DATA,
853
+ THEME: () => THEME,
854
+ TIMING: () => TIMING,
855
+ TYPOGRAPHY: () => TYPOGRAPHY,
856
+ UNIT: () => UNIT,
857
+ VALUE_TRANSFORMERS: () => VALUE_TRANSFORMERS,
858
+ activateConfig: () => activateConfig,
859
+ appendIconsSprite: () => appendIconsSprite,
860
+ appendSVGSprite: () => appendSVGSprite,
861
+ applyDocument: () => applyDocument,
862
+ applyHeadings: () => applyHeadings,
863
+ applyReset: () => applyReset,
864
+ applySequenceVars: () => applySequenceVars,
865
+ applySpacingSequence: () => applySpacingSequence,
866
+ applyTimingSequence: () => applyTimingSequence,
867
+ applyTypographySequence: () => applyTypographySequence,
868
+ changeLightness: () => changeLightness,
869
+ colorStringToRgbaArray: () => colorStringToRgbaArray,
870
+ convertSvgToSymbol: () => convertSvgToSymbol,
871
+ findHeadingLetter: () => findHeadingLetter,
872
+ findHeadings: () => findHeadings,
873
+ generateSequence: () => generateSequence,
874
+ generateSprite: () => generateSprite,
875
+ generateSubSequence: () => generateSubSequence,
876
+ getActiveConfig: () => getActiveConfig,
877
+ getColor: () => getColor,
878
+ getColorShade: () => getColorShade,
879
+ getDefaultOrFirstKey: () => getDefaultOrFirstKey,
880
+ getFontFace: () => getFontFace,
881
+ getFontFaceEach: () => getFontFaceEach,
882
+ getFontFaceEachString: () => getFontFaceEachString,
883
+ getFontFaceString: () => getFontFaceString,
884
+ getFontFamily: () => getFontFamily,
885
+ getFontFormat: () => getFontFormat,
886
+ getFontSizeByKey: () => getFontSizeByKey,
887
+ getMediaColor: () => getMediaColor,
888
+ getMediaTheme: () => getMediaTheme,
889
+ getSequenceValue: () => getSequenceValue,
890
+ getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
891
+ getSpacingBasedOnRatio: () => getSpacingBasedOnRatio,
892
+ getSpacingByKey: () => getSpacingByKey,
893
+ getTheme: () => getTheme,
894
+ getTimingByKey: () => getTimingByKey,
895
+ getTimingFunction: () => getTimingFunction,
896
+ hexToRgb: () => hexToRgb,
897
+ hexToRgbArray: () => hexToRgbArray,
898
+ hexToRgba: () => hexToRgba,
899
+ hslToRgb: () => hslToRgb,
900
+ mixTwoColors: () => mixTwoColors,
901
+ mixTwoRgb: () => mixTwoRgb,
902
+ mixTwoRgba: () => mixTwoRgba,
903
+ numToLetterMap: () => numToLetterMap,
904
+ opacify: () => opacify,
905
+ returnSubThemeOrDefault: () => returnSubThemeOrDefault,
906
+ rgbArrayToHex: () => rgbArrayToHex,
907
+ rgbToHSL: () => rgbToHSL,
908
+ rgbToHex: () => rgbToHex,
909
+ runThroughMedia: () => runThroughMedia,
910
+ scratchSystem: () => system_exports,
911
+ scratchUtils: () => utils_exports,
912
+ set: () => set,
913
+ setActiveConfig: () => setActiveConfig,
914
+ setColor: () => setColor,
915
+ setCustomFont: () => setCustomFont,
916
+ setCustomFontMedia: () => setCustomFontMedia,
917
+ setEach: () => setEach,
918
+ setFont: () => setFont,
919
+ setFontFamily: () => setFontFamily,
920
+ setGradient: () => setGradient,
921
+ setIcon: () => setIcon,
922
+ setInCustomFontMedia: () => setInCustomFontMedia,
923
+ setMediaTheme: () => setMediaTheme,
924
+ setSVG: () => setSVG,
925
+ setTheme: () => setTheme,
926
+ setValue: () => setValue,
927
+ setVariables: () => setVariables
928
+ });
17
929
  module.exports = __toCommonJS(src_exports);
18
- __reExport(src_exports, require("./factory.js"), module.exports);
19
- __reExport(src_exports, require("./defaultConfig"), module.exports);
20
- __reExport(src_exports, require("./system"), module.exports);
21
- __reExport(src_exports, require("./utils"), module.exports);
22
- __reExport(src_exports, require("./set.js"), module.exports);
930
+
931
+ // src/utils/index.js
932
+ var utils_exports = {};
933
+ __export(utils_exports, {
934
+ applySequenceVars: () => applySequenceVars,
935
+ changeLightness: () => changeLightness,
936
+ colorStringToRgbaArray: () => colorStringToRgbaArray,
937
+ convertSvgToSymbol: () => convertSvgToSymbol,
938
+ findHeadingLetter: () => findHeadingLetter,
939
+ findHeadings: () => findHeadings,
940
+ generateSequence: () => generateSequence,
941
+ generateSprite: () => generateSprite,
942
+ generateSubSequence: () => generateSubSequence,
943
+ getColorShade: () => getColorShade,
944
+ getDefaultOrFirstKey: () => getDefaultOrFirstKey,
945
+ getFontFace: () => getFontFace,
946
+ getFontFaceEach: () => getFontFaceEach,
947
+ getFontFaceEachString: () => getFontFaceEachString,
948
+ getFontFaceString: () => getFontFaceString,
949
+ getFontFormat: () => getFontFormat,
950
+ getSequenceValue: () => getSequenceValue,
951
+ getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
952
+ hexToRgb: () => hexToRgb,
953
+ hexToRgbArray: () => hexToRgbArray,
954
+ hexToRgba: () => hexToRgba,
955
+ hslToRgb: () => hslToRgb,
956
+ mixTwoColors: () => mixTwoColors,
957
+ mixTwoRgb: () => mixTwoRgb,
958
+ mixTwoRgba: () => mixTwoRgba,
959
+ numToLetterMap: () => numToLetterMap,
960
+ opacify: () => opacify,
961
+ returnSubThemeOrDefault: () => returnSubThemeOrDefault,
962
+ rgbArrayToHex: () => rgbArrayToHex,
963
+ rgbToHSL: () => rgbToHSL,
964
+ rgbToHex: () => rgbToHex,
965
+ setCustomFont: () => setCustomFont,
966
+ setCustomFontMedia: () => setCustomFontMedia,
967
+ setInCustomFontMedia: () => setInCustomFontMedia,
968
+ setVariables: () => setVariables
969
+ });
970
+
971
+ // src/utils/color.js
972
+ var import_globals = __toESM(require_cjs(), 1);
973
+ var ENV = "development";
974
+ var colorStringToRgbaArray = (color) => {
975
+ if (color === "")
976
+ return;
977
+ if (color.toLowerCase() === "transparent")
978
+ return [0, 0, 0, 0];
979
+ if (color[0] === "#") {
980
+ if (color.length < 7) {
981
+ color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
982
+ }
983
+ return [
984
+ parseInt(color.substr(1, 2), 16),
985
+ parseInt(color.substr(3, 2), 16),
986
+ parseInt(color.substr(5, 2), 16),
987
+ color.length > 7 ? parseInt(color.substr(7, 2), 16) / 255 : 1
988
+ ];
989
+ }
990
+ if (color.indexOf("rgb") === -1) {
991
+ if (import_globals.document && import_globals.window) {
992
+ const elem = import_globals.document.body.appendChild(import_globals.document.createElement("fictum"));
993
+ const flag = "rgb(1, 2, 3)";
994
+ elem.style.color = flag;
995
+ if (elem.style.color !== flag)
996
+ return;
997
+ elem.style.color = color;
998
+ if (elem.style.color === flag || elem.style.color === "")
999
+ return;
1000
+ color = import_globals.window.getComputedStyle(elem).color;
1001
+ import_globals.document.body.removeChild(elem);
1002
+ } else
1003
+ console.warn("Color conversion failed, no document or window object found");
1004
+ }
1005
+ if (color.indexOf("rgb") === 0) {
1006
+ if (color.indexOf("rgba") === -1)
1007
+ color = `${color}, 1`;
1008
+ return color.match(/[\.\d]+/g).map((a) => +a);
1009
+ }
1010
+ return [];
1011
+ };
1012
+ var mixTwoColors = (colorA, colorB, range = 0.5) => {
1013
+ colorA = colorStringToRgbaArray(colorA);
1014
+ colorB = colorStringToRgbaArray(colorB);
1015
+ return mixTwoRgba(colorA, colorB, range);
1016
+ };
1017
+ var hexToRgb = (hex, alpha = 1) => {
1018
+ const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
1019
+ return `rgb(${r},${g},${b})`;
1020
+ };
1021
+ var hexToRgbArray = (hex, alpha = 1) => {
1022
+ const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
1023
+ return [r, g, b];
1024
+ };
1025
+ var rgbToHex = (r, g, b) => {
1026
+ return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1027
+ };
1028
+ var rgbArrayToHex = ([r, g, b]) => {
1029
+ return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1030
+ };
1031
+ var hexToRgba = (hex, alpha = 1) => {
1032
+ const [r, g, b] = hex.match(/\w\w/g).map((x) => parseInt(x, 16));
1033
+ return `rgba(${r},${g},${b},${alpha})`;
1034
+ };
1035
+ var mixTwoRgb = (colorA, colorB, range = 0.5) => {
1036
+ const arr = [];
1037
+ for (let i = 0; i < 3; i++) {
1038
+ arr[i] = ~~(colorA[i] + (colorB[i] - colorA[i]) * range);
1039
+ }
1040
+ return `rgb(${arr})`;
1041
+ };
1042
+ var changeLightness = (delta, hsl) => {
1043
+ const [hue, saturation, lightness] = hsl;
1044
+ const newLightness = Math.max(
1045
+ 0,
1046
+ Math.min(100, lightness + parseFloat(delta))
1047
+ );
1048
+ return [hue, saturation, newLightness];
1049
+ };
1050
+ var rgbToHSL = (r, g, b) => {
1051
+ const a = Math.max(r, g, b);
1052
+ const n = a - Math.min(r, g, b);
1053
+ const f = 1 - Math.abs(a + a - n - 1);
1054
+ const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
1055
+ return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
1056
+ };
1057
+ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
1058
+ Math.min(k - 3, 9 - k, 1),
1059
+ -1
1060
+ )) => [f(0), f(8), f(4)];
1061
+ var getColorShade = (col, amt) => {
1062
+ const num = parseInt(col, 16);
1063
+ let r = (num >> 16) + amt;
1064
+ if (r > 255)
1065
+ r = 255;
1066
+ else if (r < 0)
1067
+ r = 0;
1068
+ let b = (num >> 8 & 255) + amt;
1069
+ if (b > 255)
1070
+ b = 255;
1071
+ else if (b < 0)
1072
+ b = 0;
1073
+ let g = (num & 255) + amt;
1074
+ if (g > 255)
1075
+ g = 255;
1076
+ else if (g < 0)
1077
+ g = 0;
1078
+ return (g | b << 8 | r << 16).toString(16);
1079
+ };
1080
+ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
1081
+ const arr = [];
1082
+ for (let i = 0; i < 4; i++) {
1083
+ const round = i === 3 ? (x) => x : Math.round;
1084
+ arr[i] = round(
1085
+ colorA[i] + (colorB[i] - colorA[i]) * range
1086
+ );
1087
+ }
1088
+ return `rgba(${arr})`;
1089
+ };
1090
+ var opacify = (color, opacity) => {
1091
+ const arr = colorStringToRgbaArray(color);
1092
+ if (!arr) {
1093
+ if (ENV === "test" || ENV === "development")
1094
+ console.warn(color + "color is not rgba");
1095
+ return;
1096
+ }
1097
+ arr[3] = opacity;
1098
+ return `rgba(${arr})`;
1099
+ };
1100
+
1101
+ // src/utils/theme.js
1102
+ var returnSubThemeOrDefault = (orig, theme) => {
1103
+ if (!orig)
1104
+ return;
1105
+ if (orig.themes && orig.themes[theme])
1106
+ return orig.themes[theme];
1107
+ if (orig[theme])
1108
+ return [orig, orig[theme]];
1109
+ return orig;
1110
+ };
1111
+
1112
+ // src/utils/font.js
1113
+ var getDefaultOrFirstKey = (LIBRARY, key) => {
1114
+ if (LIBRARY[key])
1115
+ return LIBRARY[key].value;
1116
+ if (LIBRARY.default)
1117
+ return LIBRARY[LIBRARY.default].value;
1118
+ const hasValue = Object.keys(LIBRARY)[0];
1119
+ return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
1120
+ };
1121
+ var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
1122
+ var setInCustomFontMedia = (str) => `@font-face { ${str} }`;
1123
+ var setCustomFont = (name, url, weight) => `
1124
+ font-family: '${name}';
1125
+ font-style: normal;
1126
+ ${weight && `font-weight: ${weight};`}
1127
+ src: url('${url}') format('${getFontFormat(url)}');`;
1128
+ var setCustomFontMedia = (name, url, weight) => `@font-face {
1129
+ ${setCustomFont(name, url, weight)}
1130
+ }`;
1131
+ var getFontFaceEach = (name, weights) => {
1132
+ const keys = Object.keys(weights);
1133
+ return keys.map((key) => {
1134
+ const { url, fontWeight } = weights[key];
1135
+ return setCustomFont(name, url, fontWeight);
1136
+ });
1137
+ };
1138
+ var getFontFace = (LIBRARY) => {
1139
+ const keys = Object.keys(LIBRARY);
1140
+ return keys.map((key) => getFontFaceEach(key, LIBRARY[key].value));
1141
+ };
1142
+ var getFontFaceEachString = (name, weights) => {
1143
+ const isArr = weights[0];
1144
+ if (isArr)
1145
+ return getFontFaceEach(name, weights).map(setInCustomFontMedia);
1146
+ return setCustomFontMedia(name, weights.url);
1147
+ };
1148
+ var getFontFaceString = (LIBRARY) => {
1149
+ const keys = Object.keys(LIBRARY);
1150
+ return keys.map((key) => getFontFaceEachString(key, LIBRARY[key].value));
1151
+ };
1152
+
1153
+ // src/utils/sequence.js
1154
+ var import_utils4 = __toESM(require_cjs3(), 1);
1155
+
1156
+ // ../utils/src/index.js
1157
+ var import_utils2 = __toESM(require_cjs3());
1158
+
1159
+ // ../utils/src/scaling.js
1160
+ var import_utils = __toESM(require_cjs3());
1161
+
1162
+ // ../utils/src/index.js
1163
+ var toCamelCase = (str) => {
1164
+ return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
1165
+ return index === 0 ? word.toLowerCase() : word.toUpperCase();
1166
+ }).replaceAll(/\s+/g, "");
1167
+ };
1168
+ var toDashCase = (val) => val.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()).replace(".", "-");
1169
+ var arrayzeValue = (val) => {
1170
+ if ((0, import_utils2.isString)(val))
1171
+ return val.split(" ");
1172
+ if ((0, import_utils2.isObject)(val))
1173
+ return Object.keys(val).map((v) => val[v]);
1174
+ if ((0, import_utils2.isArray)(val))
1175
+ return val;
1176
+ };
1177
+
1178
+ // src/factory.js
1179
+ var import_utils3 = __toESM(require_cjs3(), 1);
1180
+
1181
+ // src/defaultConfig/index.js
1182
+ var defaultConfig_exports = {};
1183
+ __export(defaultConfig_exports, {
1184
+ ANIMATION: () => ANIMATION,
1185
+ BREAKPOINTS: () => BREAKPOINTS,
1186
+ CASES: () => CASES,
1187
+ COLOR: () => COLOR,
1188
+ DEVICES: () => DEVICES,
1189
+ DOCUMENT: () => DOCUMENT,
1190
+ FONT: () => FONT,
1191
+ FONT_FACE: () => FONT_FACE,
1192
+ FONT_FAMILY: () => FONT_FAMILY,
1193
+ FONT_FAMILY_TYPES: () => FONT_FAMILY_TYPES,
1194
+ GRADIENT: () => GRADIENT,
1195
+ ICONS: () => ICONS,
1196
+ MEDIA: () => MEDIA,
1197
+ RESET: () => RESET,
1198
+ SEQUENCE: () => SEQUENCE,
1199
+ SPACING: () => SPACING,
1200
+ SVG: () => SVG,
1201
+ SVG_DATA: () => SVG_DATA,
1202
+ THEME: () => THEME,
1203
+ TIMING: () => TIMING,
1204
+ TYPOGRAPHY: () => TYPOGRAPHY,
1205
+ UNIT: () => UNIT
1206
+ });
1207
+
1208
+ // src/defaultConfig/sequence.js
1209
+ var SEQUENCE = {
1210
+ "minor-second": 1.067,
1211
+ "major-second": 1.125,
1212
+ "minor-third": 1.2,
1213
+ "major-third": 1.25,
1214
+ "perfect-fourth": 1.333,
1215
+ "augmented-fourth": 1.414,
1216
+ "perfect-fifth": 1.5,
1217
+ "minor-sixth": 1.6,
1218
+ phi: 1.618,
1219
+ // golden-ratio
1220
+ "major-sixth": 1.667,
1221
+ "square-root-3": 1.732,
1222
+ // theodorus
1223
+ "minor-seventh": 1.778,
1224
+ "major-seventh": 1.875,
1225
+ octave: 2,
1226
+ "square-root-5": 2.23,
1227
+ // pythagoras
1228
+ "major-tenth": 2.5,
1229
+ "major-eleventh": 2.667,
1230
+ "major-twelfth": 3,
1231
+ pi: 3.14,
1232
+ // archimedes
1233
+ "double-octave": 4
1234
+ };
1235
+
1236
+ // src/defaultConfig/unit.js
1237
+ var UNIT = {
1238
+ default: "em"
1239
+ };
1240
+
1241
+ // src/defaultConfig/typography.js
1242
+ var defaultProps = {
1243
+ browserDefault: 16,
1244
+ base: 16,
1245
+ type: "font-size",
1246
+ ratio: SEQUENCE["minor-third"],
1247
+ range: [-3, 12],
1248
+ h1Matches: 6,
1249
+ lineHeight: 1.5,
1250
+ unit: "em",
1251
+ templates: {},
1252
+ sequence: {},
1253
+ scales: {},
1254
+ vars: {}
1255
+ };
1256
+ var TYPOGRAPHY = defaultProps;
1257
+
1258
+ // src/defaultConfig/font.js
1259
+ var FONT = {};
1260
+
1261
+ // src/defaultConfig/font-family.js
1262
+ var FONT_FAMILY = {};
1263
+ var FONT_FAMILY_TYPES = {
1264
+ "sans-serif": "Helvetica, Arial, sans-serif, --system-default",
1265
+ serif: "Times New Roman, Georgia, serif, --system-default",
1266
+ monospace: "Courier New, monospace, --system-default"
1267
+ };
1268
+ var FONT_FACE = {};
1269
+
1270
+ // src/defaultConfig/media.js
1271
+ var MEDIA = {
1272
+ tv: "(min-width: 2780px)",
1273
+ screenL: "(max-width: 1920px)",
1274
+ screenM: "(max-width: 1680px)",
1275
+ screenS: "(max-width: 1440px)",
1276
+ tabletL: "(max-width: 1366px)",
1277
+ tabletM: "(max-width: 1280px)",
1278
+ tabletS: "(max-width: 1024px)",
1279
+ mobileL: "(max-width: 768px)",
1280
+ mobileM: "(max-width: 560px)",
1281
+ mobileS: "(max-width: 480px)",
1282
+ mobileXS: "(max-width: 375px)",
1283
+ light: "(prefers-color-scheme: light)",
1284
+ dark: "(prefers-color-scheme: dark)",
1285
+ print: "print"
1286
+ };
1287
+
1288
+ // src/defaultConfig/spacing.js
1289
+ var defaultProps2 = {
1290
+ base: TYPOGRAPHY.base,
1291
+ type: "spacing",
1292
+ ratio: SEQUENCE.phi,
1293
+ range: [-5, 15],
1294
+ subSequence: true,
1295
+ unit: "em",
1296
+ sequence: {},
1297
+ scales: {},
1298
+ vars: {}
1299
+ };
1300
+ var SPACING = defaultProps2;
1301
+
1302
+ // src/defaultConfig/color.js
1303
+ var COLOR = {};
1304
+ var GRADIENT = {};
1305
+
1306
+ // src/defaultConfig/theme.js
1307
+ var THEME = {};
1308
+
1309
+ // src/defaultConfig/icons.js
1310
+ var ICONS = {};
1311
+
1312
+ // src/defaultConfig/timing.js
1313
+ var defaultProps3 = {
1314
+ default: 150,
1315
+ base: 150,
1316
+ type: "timing",
1317
+ ratio: SEQUENCE["perfect-fourth"],
1318
+ range: [-3, 12],
1319
+ unit: "ms",
1320
+ sequence: {},
1321
+ scales: {},
1322
+ vars: {}
1323
+ };
1324
+ var TIMING = defaultProps3;
1325
+
1326
+ // src/defaultConfig/document.js
1327
+ var DOCUMENT = {};
1328
+
1329
+ // src/defaultConfig/responsive.js
1330
+ var BREAKPOINTS = {
1331
+ screenL: 1920,
1332
+ screenM: 1680,
1333
+ screenS: 1440,
1334
+ tabletL: 1366,
1335
+ tabletM: 1280,
1336
+ tabletS: 1024,
1337
+ mobileL: 768,
1338
+ mobileM: 560,
1339
+ mobileS: 480,
1340
+ mobileXS: 375
1341
+ };
1342
+ var DEVICES = {
1343
+ screenL: [1920, 1024],
1344
+ screenM: [1680, 1024],
1345
+ screenS: [1440, 978],
1346
+ tabletL: [1366, 926],
1347
+ tabletM: [1280, 768],
1348
+ tabletS: [1024, 768],
1349
+ mobileL: [768, 375],
1350
+ mobileM: [560, 768],
1351
+ mobileS: [480, 768],
1352
+ mobileXS: [375, 768]
1353
+ };
1354
+
1355
+ // src/defaultConfig/cases.js
1356
+ var CASES = {};
1357
+
1358
+ // src/defaultConfig/animation.js
1359
+ var ANIMATION = {};
1360
+
1361
+ // src/defaultConfig/svg.js
1362
+ var SVG = {};
1363
+ var SVG_DATA = {};
1364
+
1365
+ // src/defaultConfig/index.js
1366
+ var RESET = {};
1367
+
1368
+ // src/factory.js
1369
+ var CSS_VARS = {};
1370
+ var CONFIG = {
1371
+ verbose: false,
1372
+ useVariable: true,
1373
+ useReset: true,
1374
+ CSS_VARS,
1375
+ ...defaultConfig_exports
1376
+ };
1377
+ var cachedConfig = (0, import_utils3.deepClone)(CONFIG);
1378
+ var FACTORY = {
1379
+ active: "0",
1380
+ 0: CONFIG
1381
+ };
1382
+ var activateConfig = (def) => {
1383
+ if ((0, import_utils3.isDefined)(def)) {
1384
+ FACTORY.active = def;
1385
+ }
1386
+ return FACTORY[def || FACTORY.active];
1387
+ };
1388
+ var getActiveConfig = (def) => {
1389
+ if ((0, import_utils3.isDefined)(def) && !FACTORY[def]) {
1390
+ FACTORY[def] = (0, import_utils3.deepClone)(cachedConfig);
1391
+ return FACTORY[def];
1392
+ }
1393
+ return FACTORY[def || FACTORY.active];
1394
+ };
1395
+ var setActiveConfig = (def) => {
1396
+ return FACTORY.active = FACTORY[def];
1397
+ };
1398
+
1399
+ // src/utils/sequence.js
1400
+ var numToLetterMap = {
1401
+ "-6": "U",
1402
+ "-5": "V",
1403
+ "-4": "W",
1404
+ "-3": "X",
1405
+ "-2": "Y",
1406
+ "-1": "Z",
1407
+ 0: "A",
1408
+ 1: "B",
1409
+ 2: "C",
1410
+ 3: "D",
1411
+ 4: "E",
1412
+ 5: "F",
1413
+ 6: "G",
1414
+ 7: "H",
1415
+ 8: "I",
1416
+ 9: "J",
1417
+ 10: "K",
1418
+ 11: "L",
1419
+ 12: "M",
1420
+ 13: "N",
1421
+ 14: "O",
1422
+ 15: "P",
1423
+ 16: "Q",
1424
+ 17: "R",
1425
+ 18: "S",
1426
+ 19: "T"
1427
+ };
1428
+ var setSequenceValue = (props, sequenceProps) => {
1429
+ const { key, variable, value, scaling, index } = props;
1430
+ sequenceProps.sequence[key] = {
1431
+ key,
1432
+ decimal: ~~(value * 100) / 100,
1433
+ val: ~~value,
1434
+ scaling,
1435
+ index,
1436
+ variable
1437
+ };
1438
+ sequenceProps.scales[key] = scaling;
1439
+ sequenceProps.vars[variable] = scaling + sequenceProps.unit;
1440
+ };
1441
+ var generateSubSequence = (props, sequenceProps) => {
1442
+ const { key, base, value, ratio, variable, index } = props;
1443
+ const next = value * ratio;
1444
+ const diff = next - value;
1445
+ const smallscale = diff / 1.618;
1446
+ const valueRounded = ~~value;
1447
+ const nextRounded = ~~next;
1448
+ const diffRounded = nextRounded - valueRounded;
1449
+ let arr = [];
1450
+ const first = next - smallscale;
1451
+ const second = value + smallscale;
1452
+ const middle = (first + second) / 2;
1453
+ if (diffRounded > 16)
1454
+ arr = [first, middle, second];
1455
+ else
1456
+ arr = [first, second];
1457
+ arr.map((v, k) => {
1458
+ const scaling = ~~(v / base * 1e3) / 1e3;
1459
+ const newVar = variable + (k + 1);
1460
+ const props2 = {
1461
+ key: key + (k + 1),
1462
+ variable: newVar,
1463
+ value: v,
1464
+ scaling,
1465
+ index: index + (k + 1) / 10
1466
+ };
1467
+ return setSequenceValue(props2, sequenceProps);
1468
+ });
1469
+ };
1470
+ var switchSequenceOnNegative = (key, base, ratio) => {
1471
+ return base * Math.pow(ratio, key);
1472
+ };
1473
+ var generateSequence = (sequenceProps) => {
1474
+ const { type, base, ratio, range, subSequence } = sequenceProps;
1475
+ const n = Math.abs(range[0]) + Math.abs(range[1]);
1476
+ const prefix = "--" + (type && type.replace(".", "-")) + "-";
1477
+ for (let i = 0; i <= n; i++) {
1478
+ const key = range[1] - i;
1479
+ const letterKey = numToLetterMap[key];
1480
+ const value = switchSequenceOnNegative(key, base, ratio);
1481
+ const scaling = ~~(value / base * 100) / 100;
1482
+ const variable = prefix + letterKey;
1483
+ const props = {
1484
+ key: letterKey,
1485
+ variable,
1486
+ value,
1487
+ base,
1488
+ scaling,
1489
+ ratio,
1490
+ index: key
1491
+ };
1492
+ setSequenceValue(props, sequenceProps);
1493
+ if (subSequence)
1494
+ generateSubSequence(props, sequenceProps);
1495
+ }
1496
+ return sequenceProps;
1497
+ };
1498
+ var getSequenceValue = (value = "A", sequenceProps) => {
1499
+ const CONFIG2 = getActiveConfig();
1500
+ const { UNIT: UNIT2 } = CONFIG2;
1501
+ const {
1502
+ sequence,
1503
+ unit = UNIT2.default,
1504
+ useVariable
1505
+ } = sequenceProps;
1506
+ if ((0, import_utils4.isString)(value) && value.slice(0, 2) === "--")
1507
+ return `var(${value})`;
1508
+ const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
1509
+ const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
1510
+ const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
1511
+ if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || !startsWithDashOrLetter)
1512
+ return value;
1513
+ const letterVal = value.toUpperCase();
1514
+ const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
1515
+ let absValue = isNegative ? letterVal.slice(1) : letterVal;
1516
+ let mediaName = "";
1517
+ if (absValue.includes("-")) {
1518
+ mediaName = "-" + absValue.split("-")[1].toLowerCase();
1519
+ absValue = absValue.split("-")[0];
1520
+ }
1521
+ const varValue = (v) => `var(${prefix}${v}${mediaName})`;
1522
+ if (absValue.includes("+")) {
1523
+ const args = absValue.split("+");
1524
+ const [first, second] = args;
1525
+ const joint = `${varValue(first)} + ${varValue(second)}`;
1526
+ return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1527
+ } else if (absValue.includes("-")) {
1528
+ const args = absValue.split("-");
1529
+ const [first, second] = args;
1530
+ const joint = `${varValue(first)} - ${varValue(second)}`;
1531
+ return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1532
+ }
1533
+ if (!sequence[absValue] && absValue.length === 2) {
1534
+ if (CONFIG2.verbose)
1535
+ console.warn(absValue, "- value is not found because `subSequence` is set to false");
1536
+ absValue = absValue.slice(0, 1);
1537
+ }
1538
+ if (useVariable || CONFIG2.useVariable) {
1539
+ const varValue2 = `var(${prefix}${absValue}${mediaName})`;
1540
+ return isNegative ? `calc(${varValue2} * -1)` : varValue2;
1541
+ }
1542
+ const sequenceItem = sequence ? sequence[absValue] : null;
1543
+ if (!sequenceItem)
1544
+ return console.warn("can't find", sequence, absValue);
1545
+ if (unit === "ms" || unit === "s") {
1546
+ return isNegative + sequenceItem.val + unit;
1547
+ }
1548
+ return isNegative + sequenceItem.scaling + unit;
1549
+ };
1550
+ var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
1551
+ if (typeof value !== "string") {
1552
+ console.warn(propertyName, value, "is not a string");
1553
+ return {};
1554
+ }
1555
+ if (value === "-" || value === "")
1556
+ return {};
1557
+ return { [propertyName]: getSequenceValue(value, sequenceProps) };
1558
+ };
1559
+ var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
1560
+ var findHeadings = (propertyNames) => {
1561
+ const { h1Matches, sequence } = propertyNames;
1562
+ return new Array(6).fill(null).map((_, i) => {
1563
+ const findLetter = findHeadingLetter(h1Matches, i);
1564
+ return sequence[findLetter];
1565
+ });
1566
+ };
1567
+
1568
+ // src/utils/var.js
1569
+ var import_utils6 = __toESM(require_cjs3(), 1);
1570
+ var setVariables = (result, key) => {
1571
+ const CONFIG2 = getActiveConfig();
1572
+ const { CSS_VARS: CSS_VARS2 } = CONFIG2;
1573
+ if ((0, import_utils6.isObjectLike)(result.value)) {
1574
+ } else {
1575
+ CSS_VARS2[result.var] = result.value;
1576
+ }
1577
+ };
1578
+ var applySequenceVars = (props, mediaName, options = {}) => {
1579
+ const CONFIG2 = getActiveConfig();
1580
+ const { UNIT: UNIT2, MEDIA: MEDIA2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
1581
+ const unit = props.unit || UNIT2.default;
1582
+ const { sequence, scales } = props;
1583
+ for (const key in sequence) {
1584
+ const item = sequence[key];
1585
+ const value = (props.type === TIMING2.type ? sequence[key].val : scales[key]) + unit;
1586
+ if (mediaName) {
1587
+ const query = MEDIA2[mediaName];
1588
+ if (!query) {
1589
+ if (CONFIG2.verbose)
1590
+ console.warn("Can't find query ", query);
1591
+ }
1592
+ let underMediaQuery = CSS_VARS2[`@media ${query}`];
1593
+ if (!underMediaQuery)
1594
+ underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1595
+ underMediaQuery[item.variable] = `var(${item.variable + "-" + mediaName})`;
1596
+ CSS_VARS2[item.variable + "-" + mediaName] = value;
1597
+ } else {
1598
+ if (options.useDefault === false) {
1599
+ CSS_VARS2[item.variable] = value;
1600
+ } else {
1601
+ CSS_VARS2[item.variable + "-default"] = value;
1602
+ CSS_VARS2[item.variable] = `var(${item.variable + "-default"})`;
1603
+ }
1604
+ }
1605
+ }
1606
+ };
1607
+
1608
+ // src/utils/sprite.js
1609
+ var import_utils7 = __toESM(require_cjs3(), 1);
1610
+ var generateSprite = (icons) => {
1611
+ let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
1612
+ for (let key in icons) {
1613
+ sprite += icons[key];
1614
+ }
1615
+ sprite += "</svg>";
1616
+ return sprite;
1617
+ };
1618
+ var parseRootAttributes = (htmlString) => {
1619
+ if (!(0, import_utils7.isString)(htmlString)) {
1620
+ return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1621
+ }
1622
+ let match = htmlString.match(/<svg\s+(.*?)>/);
1623
+ if (!match || !match[1]) {
1624
+ return {};
1625
+ }
1626
+ let attrString = match[1];
1627
+ let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1628
+ return attrs.reduce((acc, attr) => {
1629
+ let [key, value] = attr.split("=");
1630
+ acc[key] = value.replace(/['"]/g, "");
1631
+ return acc;
1632
+ }, {});
1633
+ };
1634
+ var convertSvgToSymbol = (key, code) => {
1635
+ const extractAttrs = parseRootAttributes(code);
1636
+ const { width, height } = extractAttrs;
1637
+ const viewBox = extractAttrs.viewBox || `0 0 ${width || 24} ${height || 24}`;
1638
+ const xmlns = "http://www.w3.org/2000/svg";
1639
+ let symbol = code.replace(
1640
+ "<svg",
1641
+ `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
1642
+ );
1643
+ symbol = symbol.replace(/width="[^\"]*/, "");
1644
+ symbol = symbol.replace(/height="[^\"]*/, "");
1645
+ symbol = symbol.replace("</svg", "</symbol");
1646
+ return symbol;
1647
+ };
1648
+
1649
+ // src/system/index.js
1650
+ var system_exports = {};
1651
+ __export(system_exports, {
1652
+ appendIconsSprite: () => appendIconsSprite,
1653
+ appendSVGSprite: () => appendSVGSprite,
1654
+ applyDocument: () => applyDocument,
1655
+ applyHeadings: () => applyHeadings,
1656
+ applyReset: () => applyReset,
1657
+ applySpacingSequence: () => applySpacingSequence,
1658
+ applyTimingSequence: () => applyTimingSequence,
1659
+ applyTypographySequence: () => applyTypographySequence,
1660
+ getColor: () => getColor,
1661
+ getFontFamily: () => getFontFamily,
1662
+ getFontSizeByKey: () => getFontSizeByKey,
1663
+ getMediaColor: () => getMediaColor,
1664
+ getMediaTheme: () => getMediaTheme,
1665
+ getSpacingBasedOnRatio: () => getSpacingBasedOnRatio,
1666
+ getSpacingByKey: () => getSpacingByKey,
1667
+ getTheme: () => getTheme,
1668
+ getTimingByKey: () => getTimingByKey,
1669
+ getTimingFunction: () => getTimingFunction,
1670
+ runThroughMedia: () => runThroughMedia,
1671
+ setColor: () => setColor,
1672
+ setFont: () => setFont,
1673
+ setFontFamily: () => setFontFamily,
1674
+ setGradient: () => setGradient,
1675
+ setIcon: () => setIcon,
1676
+ setMediaTheme: () => setMediaTheme,
1677
+ setSVG: () => setSVG,
1678
+ setTheme: () => setTheme
1679
+ });
1680
+
1681
+ // src/system/color.js
1682
+ var import_utils8 = __toESM(require_cjs3(), 1);
1683
+ var getColor = (value, key) => {
1684
+ const CONFIG2 = getActiveConfig();
1685
+ if (!(0, import_utils8.isString)(value)) {
1686
+ if (CONFIG2.verbose)
1687
+ console.warn(value, "- type for color is not valid");
1688
+ return;
1689
+ }
1690
+ if (value.slice(0, 2) === "--")
1691
+ return `var(${value})`;
1692
+ if (key && value[key])
1693
+ value = value[key];
1694
+ const [name, alpha, tone] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
1695
+ const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1696
+ let val = COLOR2[name] || GRADIENT2[name];
1697
+ if (!val) {
1698
+ if (CONFIG2.verbose)
1699
+ console.warn("Can't find color ", name);
1700
+ return value;
1701
+ }
1702
+ if (key) {
1703
+ if (val[key])
1704
+ val = val[key];
1705
+ else if (CONFIG2.verbose)
1706
+ console.warn(value, " - does not have ", key);
1707
+ }
1708
+ let rgb = val.rgb;
1709
+ if (rgb) {
1710
+ if (tone) {
1711
+ if (!val[tone]) {
1712
+ const toHex = rgbArrayToHex(rgb.split(", ").map((v) => parseFloat(v)));
1713
+ if (tone.slice(0, 1) === "-" || tone.slice(0, 1) === "+") {
1714
+ rgb = hexToRgbArray(getColorShade(toHex, parseFloat(tone))).join(", ");
1715
+ } else {
1716
+ const [r, g, b] = [...rgb.split(", ").map((v) => parseInt(v))];
1717
+ const hsl = rgbToHSL(r, g, b);
1718
+ const [h, s, l] = hsl;
1719
+ const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
1720
+ rgb = newRgb;
1721
+ }
1722
+ val[tone] = { rgb, var: `${val.var}-${tone}` };
1723
+ } else
1724
+ rgb = val[tone].rgb;
1725
+ }
1726
+ if (alpha)
1727
+ return `rgba(${rgb}, ${alpha})`;
1728
+ return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
1729
+ } else
1730
+ return CONFIG2.useVariable ? `var(${val.var})` : val.value;
1731
+ };
1732
+ var getMediaColor = (value, property, globalTheme) => {
1733
+ const CONFIG2 = getActiveConfig();
1734
+ if (!globalTheme)
1735
+ globalTheme = CONFIG2.globalTheme;
1736
+ if (!(0, import_utils8.isString)(value)) {
1737
+ if (CONFIG2.verbose)
1738
+ console.warn(value, "- type for color is not valid");
1739
+ return;
1740
+ }
1741
+ if (value.slice(0, 2) === "--")
1742
+ return { [property]: `var(${value})` };
1743
+ const [name] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
1744
+ const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1745
+ const val = COLOR2[name] || GRADIENT2[name];
1746
+ const isObj = (0, import_utils8.isObject)(val);
1747
+ if (isObj && val.value)
1748
+ return { [property]: getColor(value, globalTheme) };
1749
+ else if (isObj) {
1750
+ if (globalTheme)
1751
+ return { [property]: getColor(value, `@${globalTheme}`) };
1752
+ else {
1753
+ const obj = {};
1754
+ for (const mediaName in val) {
1755
+ const query = CONFIG2.MEDIA[mediaName.slice(1)];
1756
+ const media = `@media screen and ${query}`;
1757
+ obj[media] = { [property]: getColor(value, mediaName) };
1758
+ }
1759
+ return obj;
1760
+ }
1761
+ } else {
1762
+ if (CONFIG2.verbose)
1763
+ console.warn("Can't find color", value);
1764
+ return { [property]: value };
1765
+ }
1766
+ };
1767
+ var setColor = (val, key, suffix) => {
1768
+ const CONFIG2 = getActiveConfig();
1769
+ if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
1770
+ val = getColor(val.slice(2));
1771
+ if ((0, import_utils8.isArray)(val)) {
1772
+ return {
1773
+ "@light": setColor(val[0], key, "light"),
1774
+ "@dark": setColor(val[1], key, "dark")
1775
+ };
1776
+ }
1777
+ if ((0, import_utils8.isObject)(val)) {
1778
+ const obj = {};
1779
+ for (const variant in val)
1780
+ obj[variant] = setColor(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1781
+ return obj;
1782
+ }
1783
+ const CSSVar = `--color-${key}` + (suffix ? `-${suffix}` : "");
1784
+ const [r, g, b, a = 1] = colorStringToRgbaArray(val.value || val);
1785
+ const alpha = parseFloat(a.toFixed(2));
1786
+ const rgb = `${r}, ${g}, ${b}`;
1787
+ const value = `rgba(${rgb}, ${alpha})`;
1788
+ if (CONFIG2.useVariable) {
1789
+ CONFIG2.CSS_VARS[CSSVar] = value;
1790
+ }
1791
+ return {
1792
+ var: CSSVar,
1793
+ rgb,
1794
+ alpha,
1795
+ value
1796
+ };
1797
+ };
1798
+ var setGradient = (val, key, suffix) => {
1799
+ const CONFIG2 = getActiveConfig();
1800
+ if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
1801
+ val = getColor(val.slice(2));
1802
+ if ((0, import_utils8.isArray)(val)) {
1803
+ return {
1804
+ "@light": setGradient(val[0], key, "light"),
1805
+ "@dark": setGradient(val[0], key, "dark")
1806
+ };
1807
+ }
1808
+ if ((0, import_utils8.isObject)(val)) {
1809
+ const obj = {};
1810
+ for (const variant in val)
1811
+ obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1812
+ return obj;
1813
+ }
1814
+ const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
1815
+ if (CONFIG2.useVariable) {
1816
+ CONFIG2.CSS_VARS[CSSVar] = val.value || val;
1817
+ }
1818
+ return {
1819
+ var: CSSVar,
1820
+ value: val.value || val
1821
+ };
1822
+ };
1823
+
1824
+ // src/system/theme.js
1825
+ var import_utils10 = __toESM(require_cjs3(), 1);
1826
+ var setThemeValue = (theme) => {
1827
+ const value = {};
1828
+ const { state, media, helpers, ...rest } = theme;
1829
+ const keys = Object.keys(rest);
1830
+ keys.map((key) => {
1831
+ const conditions = ["color", "Color", "background", "border"];
1832
+ const isColor = conditions.some((k) => key.includes(k));
1833
+ return value[key] = isColor ? getColor(theme[key]) : theme[key];
1834
+ });
1835
+ return value;
1836
+ };
1837
+ var getThemeValue = (theme) => {
1838
+ if (theme.value)
1839
+ return theme.value;
1840
+ theme.value = setThemeValue(theme);
1841
+ return theme.value;
1842
+ };
1843
+ var getTheme = (value, modifier) => {
1844
+ const CONFIG2 = getActiveConfig();
1845
+ if (CONFIG2.useVariable)
1846
+ return getMediaTheme(value, modifier);
1847
+ const { THEME: THEME2 } = CONFIG2;
1848
+ if ((0, import_utils10.isString)(value)) {
1849
+ const [theme, subtheme] = value.split(" ");
1850
+ const isOurTheme = THEME2[theme];
1851
+ if (isOurTheme) {
1852
+ if (!subtheme && !modifier)
1853
+ return getThemeValue(isOurTheme);
1854
+ value = [theme, subtheme || modifier];
1855
+ }
1856
+ }
1857
+ if ((0, import_utils10.isObjectLike)(value) && value[1]) {
1858
+ const themeName = value[0];
1859
+ const subThemeName = value[1];
1860
+ const { helpers, media, state } = THEME2[themeName];
1861
+ if (media && media[subThemeName])
1862
+ return getThemeValue(media[subThemeName]);
1863
+ if (helpers && helpers[subThemeName])
1864
+ return getThemeValue(helpers[subThemeName]);
1865
+ if (state && state[subThemeName])
1866
+ return getThemeValue(state[subThemeName]);
1867
+ } else if ((0, import_utils10.isObject)(value))
1868
+ return setThemeValue(value);
1869
+ };
1870
+ var setInverseTheme = (theme, variant, value) => {
1871
+ if ((0, import_utils10.isObject)(variant)) {
1872
+ theme.variants.inverse.value = setThemeValue(variant);
1873
+ } else if (variant === true) {
1874
+ const { color, background } = value;
1875
+ theme.variants.inverse = {
1876
+ value: {
1877
+ color: background,
1878
+ background: color
1879
+ }
1880
+ };
1881
+ }
1882
+ };
1883
+ var setPseudo = (theme, key, variant, themeValue) => {
1884
+ const result = getTheme(variant);
1885
+ themeValue[`&:${key}`] = result;
1886
+ if ((0, import_utils10.isObject)(variant) && !variant.value)
1887
+ variant.value = result;
1888
+ };
1889
+ var setSelectors = (theme, value) => {
1890
+ const { state } = theme;
1891
+ if (!state)
1892
+ return;
1893
+ const keys = Object.keys(state);
1894
+ keys.map((key) => {
1895
+ const variant = state[key];
1896
+ setPseudo(theme, key, variant, value);
1897
+ return theme;
1898
+ });
1899
+ return theme;
1900
+ };
1901
+ var setPrefersScheme = (theme, key, variant, themeValue) => {
1902
+ const result = getTheme(variant);
1903
+ themeValue[`@media (prefers-color-scheme: ${key})`] = result;
1904
+ if ((0, import_utils10.isObject)(variant) && !variant.value)
1905
+ variant.value = result;
1906
+ };
1907
+ var setMedia = (theme, value) => {
1908
+ const { media } = theme;
1909
+ if (!media)
1910
+ return;
1911
+ const keys = Object.keys(media);
1912
+ keys.map((key) => {
1913
+ const variant = media[key];
1914
+ if (key === "dark" || key === "light")
1915
+ setPrefersScheme(theme, key, variant, value);
1916
+ if (key === "inverse")
1917
+ setInverseTheme(theme, variant, value);
1918
+ return theme;
1919
+ });
1920
+ return theme;
1921
+ };
1922
+ var setHelpers = (theme, value) => {
1923
+ const CONFIG2 = getActiveConfig();
1924
+ const { helpers } = theme;
1925
+ if (!helpers)
1926
+ return;
1927
+ const keys = Object.keys(helpers);
1928
+ keys.map((key) => {
1929
+ const helper = helpers[key];
1930
+ if ((0, import_utils10.isString)(helper))
1931
+ helpers[key] = CONFIG2.THEME[helper];
1932
+ else
1933
+ getThemeValue(helpers[key]);
1934
+ return theme;
1935
+ });
1936
+ return theme;
1937
+ };
1938
+ var setTheme = (val, key) => {
1939
+ const CONFIG2 = getActiveConfig();
1940
+ if (CONFIG2.useVariable)
1941
+ return setMediaTheme(val, key);
1942
+ const { state, media, helpers } = val;
1943
+ const value = setThemeValue(val, key);
1944
+ const CSSvar = `--theme-${key}`;
1945
+ setSelectors(val, value);
1946
+ setMedia(val, value);
1947
+ setHelpers(val, value);
1948
+ return { var: CSSvar, value, state, media, helpers };
1949
+ };
1950
+ var setMediaTheme = (val, key, suffix, prefers) => {
1951
+ const CONFIG2 = getActiveConfig();
1952
+ const { CSS_VARS: CSS_VARS2 } = CONFIG2;
1953
+ const theme = { value: val };
1954
+ if ((0, import_utils10.isObjectLike)(val)) {
1955
+ for (const param in val) {
1956
+ const symb = param.slice(0, 1);
1957
+ const value = val[param];
1958
+ if (symb === "@" || symb === ":" || symb === ".") {
1959
+ const hasPrefers = symb === "@" && param;
1960
+ theme[param] = setMediaTheme(value, key, param, prefers || hasPrefers);
1961
+ } else {
1962
+ const color = getColor(value, prefers);
1963
+ const metaSuffixes = [...new Set([prefers, suffix].filter((v) => v).map((v) => v.slice(1)))];
1964
+ const varmetaSuffixName = metaSuffixes.length ? "-" + metaSuffixes.join("-") : "";
1965
+ const CSSVar = `--theme-${key}${varmetaSuffixName}-${param}`;
1966
+ if (CONFIG2.useVariable) {
1967
+ CSS_VARS2[CSSVar] = color;
1968
+ theme[param] = `var(${CSSVar})`;
1969
+ } else {
1970
+ theme[param] = color;
1971
+ }
1972
+ theme[`.${param}`] = { [param]: theme[param] };
1973
+ }
1974
+ }
1975
+ if (theme["background"] || theme["color"] || theme["backgroundColor"]) {
1976
+ theme[".inversed"] = {
1977
+ color: theme["background"] || theme["backgroundColor"],
1978
+ background: theme["color"]
1979
+ };
1980
+ }
1981
+ }
1982
+ if ((0, import_utils10.isString)(val) && val.slice(0, 2) === "--") {
1983
+ const { THEME: THEME2 } = CONFIG2;
1984
+ const value = THEME2[val.slice(2)];
1985
+ const getReferenced = getMediaTheme(value, prefers);
1986
+ return getReferenced;
1987
+ }
1988
+ return theme;
1989
+ };
1990
+ var recursiveTheme = (val) => {
1991
+ const CONFIG2 = getActiveConfig();
1992
+ const obj = {};
1993
+ for (const param in val) {
1994
+ const symb = param.slice(0, 1);
1995
+ if ((0, import_utils10.isObjectLike)(val[param])) {
1996
+ if (symb === "@") {
1997
+ const query = CONFIG2.MEDIA[param.slice(1)];
1998
+ const media = `@media screen and ${query}`;
1999
+ obj[media] = recursiveTheme(val[param]);
2000
+ } else if (symb === ":") {
2001
+ obj[`&${param}`] = recursiveTheme(val[param]);
2002
+ }
2003
+ } else
2004
+ obj[param] = val[param];
2005
+ }
2006
+ return obj;
2007
+ };
2008
+ var findModifierFromArray = (val, modifierArray) => {
2009
+ const currentMod = modifierArray.shift();
2010
+ if (val[currentMod])
2011
+ return findModifierFromArray(val[currentMod], modifierArray);
2012
+ return val;
2013
+ };
2014
+ var findModifier = (val, modifier) => {
2015
+ if ((0, import_utils10.isArray)(modifier))
2016
+ return findModifierFromArray(val, modifier);
2017
+ else if ((0, import_utils10.isString)(modifier) && val[modifier])
2018
+ return val[modifier];
2019
+ else
2020
+ return val;
2021
+ };
2022
+ var getMediaTheme = (val, mod) => {
2023
+ const CONFIG2 = getActiveConfig();
2024
+ if ((0, import_utils10.isString)(val) && val.slice(0, 2) === "--")
2025
+ val = getMediaTheme(val.slice(2));
2026
+ if (!val || !(0, import_utils10.isString)(val)) {
2027
+ if (CONFIG2.verbose)
2028
+ console.warn(val, "- theme is not string");
2029
+ return;
2030
+ }
2031
+ const [name, ...modifier] = (0, import_utils10.isArray)(val) ? val : val.split(" ");
2032
+ let value = CONFIG2.THEME[name];
2033
+ if (value && (modifier || mod)) {
2034
+ value = findModifier(value, modifier.length ? modifier : mod);
2035
+ }
2036
+ const r = recursiveTheme(value);
2037
+ return r;
2038
+ };
2039
+
2040
+ // src/system/font.js
2041
+ var import_utils11 = __toESM(require_cjs3(), 1);
2042
+ var setFont = (val, key) => {
2043
+ const CSSvar = `--font-${key}`;
2044
+ const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
2045
+ return { var: CSSvar, value: val, fontFace };
2046
+ };
2047
+ var getFontFamily = (key, factory) => {
2048
+ const CONFIG2 = getActiveConfig();
2049
+ const { FONT_FAMILY: FONT_FAMILY2 } = CONFIG2;
2050
+ return getDefaultOrFirstKey(factory || FONT_FAMILY2, key);
2051
+ };
2052
+ var setFontFamily = (val, key) => {
2053
+ const CONFIG2 = getActiveConfig();
2054
+ const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
2055
+ let { value, type } = val;
2056
+ if (val.isDefault)
2057
+ FONT_FAMILY2.default = key;
2058
+ if ((0, import_utils11.isObject)(value))
2059
+ value = arrayzeValue(value);
2060
+ const CSSvar = `--font-family-${key}`;
2061
+ const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
2062
+ return { var: CSSvar, value: str, arr: value, type };
2063
+ };
2064
+
2065
+ // src/system/typography.js
2066
+ var import_utils14 = __toESM(require_cjs3(), 1);
2067
+ var runThroughMedia = (props) => {
2068
+ const CONFIG2 = getActiveConfig();
2069
+ const { TYPOGRAPHY: TYPOGRAPHY2, MEDIA: MEDIA2 } = CONFIG2;
2070
+ for (const prop in props) {
2071
+ const mediaProps = props[prop];
2072
+ if (prop.slice(0, 1) === "@") {
2073
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = props;
2074
+ (0, import_utils14.merge)(mediaProps, {
2075
+ type,
2076
+ base,
2077
+ ratio,
2078
+ range,
2079
+ subSequence,
2080
+ h1Matches,
2081
+ unit,
2082
+ sequence: {},
2083
+ scales: {},
2084
+ templates: {},
2085
+ vars: {}
2086
+ });
2087
+ generateSequence(mediaProps);
2088
+ const mediaName = prop.slice(1);
2089
+ applySequenceVars(mediaProps, mediaName);
2090
+ const query = MEDIA2[mediaName];
2091
+ TYPOGRAPHY2.templates[`@media screen and ${query}`] = {
2092
+ fontSize: mediaProps.base / TYPOGRAPHY2.browserDefault + unit
2093
+ };
2094
+ }
2095
+ }
2096
+ };
2097
+ var applyHeadings = (props) => {
2098
+ const CONFIG2 = getActiveConfig();
2099
+ if (props.h1Matches) {
2100
+ const unit = props.unit;
2101
+ const HEADINGS = findHeadings(props);
2102
+ const { templates } = props;
2103
+ for (const k in HEADINGS) {
2104
+ const headerName = `h${parseInt(k) + 1}`;
2105
+ const headerStyle = templates[headerName];
2106
+ templates[headerName] = {
2107
+ fontSize: CONFIG2.useVariable ? `var(${HEADINGS[k].variable})` : `${HEADINGS[k].scaling}${unit}`,
2108
+ margin: headerStyle ? headerStyle.margin : 0,
2109
+ lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
2110
+ letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
2111
+ fontWeight: headerStyle ? headerStyle.fontWeight : 900 - k * 100
2112
+ };
2113
+ }
2114
+ }
2115
+ };
2116
+ var applyTypographySequence = () => {
2117
+ const CONFIG2 = getActiveConfig();
2118
+ const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
2119
+ generateSequence(TYPOGRAPHY2);
2120
+ applyHeadings(TYPOGRAPHY2);
2121
+ applySequenceVars(TYPOGRAPHY2);
2122
+ runThroughMedia(TYPOGRAPHY2);
2123
+ };
2124
+ var getFontSizeByKey = (value) => {
2125
+ const CONFIG2 = getActiveConfig();
2126
+ const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
2127
+ return getSequenceValuePropertyPair(
2128
+ value,
2129
+ "fontSize",
2130
+ TYPOGRAPHY2
2131
+ );
2132
+ };
2133
+
2134
+ // src/system/spacing.js
2135
+ var import_utils17 = __toESM(require_cjs3(), 1);
2136
+ var runThroughMedia2 = (sequenceProps) => {
2137
+ for (const prop in sequenceProps) {
2138
+ const mediaProps = sequenceProps[prop];
2139
+ if (prop.slice(0, 1) === "@") {
2140
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = sequenceProps;
2141
+ (0, import_utils17.merge)(mediaProps, {
2142
+ type,
2143
+ base,
2144
+ ratio,
2145
+ range,
2146
+ subSequence,
2147
+ h1Matches,
2148
+ unit,
2149
+ sequence: {},
2150
+ scales: {},
2151
+ templates: {},
2152
+ vars: {}
2153
+ });
2154
+ generateSequence(mediaProps);
2155
+ const mediaName = prop.slice(1);
2156
+ applySequenceVars(mediaProps, mediaName);
2157
+ }
2158
+ }
2159
+ };
2160
+ var applySpacingSequence = () => {
2161
+ const CONFIG2 = getActiveConfig();
2162
+ const { SPACING: SPACING2 } = CONFIG2;
2163
+ generateSequence(SPACING2);
2164
+ applySequenceVars(SPACING2);
2165
+ runThroughMedia2(SPACING2);
2166
+ };
2167
+ var getSequence = (sequenceProps) => {
2168
+ const CONFIG2 = getActiveConfig();
2169
+ const { SPACING: SPACING2 } = CONFIG2;
2170
+ if (!sequenceProps)
2171
+ return SPACING2;
2172
+ const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
2173
+ return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
2174
+ };
2175
+ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
2176
+ const sequence = getSequence(sequenceProps);
2177
+ const stack = arrayzeValue(value);
2178
+ if (!stack)
2179
+ return;
2180
+ if ((0, import_utils17.isString)(value) && value.includes("calc")) {
2181
+ return { [propertyName]: value };
2182
+ }
2183
+ if (stack.length > 1) {
2184
+ let suffix = "";
2185
+ if (propertyName === "borderWidth") {
2186
+ propertyName = "border";
2187
+ suffix = "Width";
2188
+ }
2189
+ const directions = {
2190
+ 2: ["Block", "Inline"],
2191
+ 3: ["BlockStart", "Inline", "BlockEnd"],
2192
+ 4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
2193
+ };
2194
+ const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
2195
+ stack[i],
2196
+ propertyName + direction + suffix,
2197
+ sequence
2198
+ );
2199
+ return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
2200
+ }
2201
+ return getSequenceValuePropertyPair(
2202
+ value,
2203
+ propertyName,
2204
+ sequence
2205
+ );
2206
+ };
2207
+ var getSpacingBasedOnRatio = (props, propertyName, val) => {
2208
+ const CONFIG2 = getActiveConfig();
2209
+ const { SPACING: SPACING2 } = CONFIG2;
2210
+ const { spacingRatio, unit } = props;
2211
+ const value = val || props[propertyName];
2212
+ if (spacingRatio) {
2213
+ let sequenceProps = SPACING2[spacingRatio];
2214
+ if (!sequenceProps) {
2215
+ const { type, base, range, subSequence } = SPACING2;
2216
+ sequenceProps = SPACING2[spacingRatio] = (0, import_utils17.merge)({
2217
+ ratio: spacingRatio,
2218
+ type: type + "-" + spacingRatio,
2219
+ unit,
2220
+ sequence: {},
2221
+ scales: {},
2222
+ templates: {},
2223
+ vars: {}
2224
+ }, {
2225
+ base,
2226
+ range,
2227
+ subSequence,
2228
+ ratio: SPACING2.ratio,
2229
+ unit: SPACING2.unit
2230
+ });
2231
+ }
2232
+ applySequenceVars(sequenceProps, null, { useDefault: false });
2233
+ return getSpacingByKey(value, propertyName, sequenceProps);
2234
+ }
2235
+ return getSpacingByKey(value, propertyName);
2236
+ };
2237
+
2238
+ // src/system/timing.js
2239
+ var applyTimingSequence = () => {
2240
+ const CONFIG2 = getActiveConfig();
2241
+ const { TIMING: TIMING2 } = CONFIG2;
2242
+ generateSequence(TIMING2);
2243
+ applySequenceVars(TIMING2);
2244
+ };
2245
+ var getTimingFunction = (value) => {
2246
+ const CONFIG2 = getActiveConfig();
2247
+ const { TIMING: TIMING2 } = CONFIG2;
2248
+ return TIMING2[value] || TIMING2[toCamelCase(value)] || value;
2249
+ };
2250
+ var getTimingByKey = (value, property = "timing") => {
2251
+ const CONFIG2 = getActiveConfig();
2252
+ const { TIMING: TIMING2 } = CONFIG2;
2253
+ return getSequenceValuePropertyPair(
2254
+ value,
2255
+ property,
2256
+ TIMING2
2257
+ );
2258
+ };
2259
+
2260
+ // src/system/document.js
2261
+ var import_utils21 = __toESM(require_cjs3(), 1);
2262
+ var applyDocument = () => {
2263
+ const CONFIG2 = getActiveConfig();
2264
+ const { DOCUMENT: DOCUMENT2, FONT_FAMILY: FONT_FAMILY2, THEME: THEME2, TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
2265
+ return (0, import_utils21.merge)(DOCUMENT2, {
2266
+ theme: THEME2.document,
2267
+ fontFamily: getDefaultOrFirstKey(FONT_FAMILY2),
2268
+ fontSize: TYPOGRAPHY2.base,
2269
+ lineHeight: TYPOGRAPHY2.lineHeight
2270
+ });
2271
+ };
2272
+
2273
+ // src/system/svg.js
2274
+ var import_globals2 = __toESM(require_cjs(), 1);
2275
+ var DEF_OPTIONS = {
2276
+ document: import_globals2.document
2277
+ };
2278
+ var setSVG = (val, key) => {
2279
+ if (!val) {
2280
+ if (CONFIG2.verbose)
2281
+ console.warn("setSVG: val is not defined", key);
2282
+ return;
2283
+ }
2284
+ const CONFIG2 = getActiveConfig();
2285
+ if (CONFIG2.useSvgSprite) {
2286
+ return convertSvgToSymbol(key, val);
2287
+ }
2288
+ return val;
2289
+ };
2290
+ var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
2291
+ const CONFIG2 = getActiveConfig();
2292
+ const doc = options.document || import_globals2.document;
2293
+ const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
2294
+ for (let key in LIBRARY)
2295
+ lib[key] = CONFIG2.SVG[key];
2296
+ const SVGsprite = generateSprite(lib);
2297
+ if (!doc) {
2298
+ console.warn("To append SVG sprites it should be run in browser environment");
2299
+ return SVGsprite;
2300
+ }
2301
+ const svgSpriteDOM = doc.createElement("template");
2302
+ svgSpriteDOM.innerHTML = SVGsprite;
2303
+ doc.body.appendChild(svgSpriteDOM.content);
2304
+ };
2305
+ var setIcon = (val, key) => {
2306
+ const CONFIG2 = getActiveConfig();
2307
+ if (CONFIG2.useIconSprite) {
2308
+ return setSVG(val, key);
2309
+ }
2310
+ return val;
2311
+ };
2312
+ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2313
+ const CONFIG2 = getActiveConfig();
2314
+ const doc = options.document || import_globals2.document;
2315
+ const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
2316
+ for (let key in LIBRARY)
2317
+ lib[key] = CONFIG2.ICONS[key];
2318
+ const SVGsprite = generateSprite(lib);
2319
+ if (!doc) {
2320
+ console.warn("To append SVG Icon sprites it should be run in browser environment");
2321
+ return SVGsprite;
2322
+ }
2323
+ const iconsSpriteDOM = doc.createElement("template");
2324
+ iconsSpriteDOM.innerHTML = SVGsprite;
2325
+ doc.body.appendChild(iconsSpriteDOM.content);
2326
+ };
2327
+
2328
+ // src/system/reset.js
2329
+ var import_utils24 = __toESM(require_cjs3(), 1);
2330
+ var applyReset = (reset = {}) => {
2331
+ const CONFIG2 = getActiveConfig();
2332
+ const { CSS_VARS: CSS_VARS2, RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
2333
+ if (RESET2) {
2334
+ if (RESET2[":root"]) {
2335
+ const configReset = RESET2;
2336
+ const configTemplates = TYPOGRAPHY2.templates;
2337
+ configReset.body = {
2338
+ ...getMediaTheme("document", `@${CONFIG2.globalTheme}`),
2339
+ ...configTemplates.body
2340
+ };
2341
+ configReset.h1 = configTemplates.h1;
2342
+ configReset.h2 = configTemplates.h2;
2343
+ configReset.h3 = configTemplates.h3;
2344
+ configReset.h4 = configTemplates.h4;
2345
+ configReset.h5 = configTemplates.h5;
2346
+ configReset.h6 = configTemplates.h6;
2347
+ }
2348
+ const { body, ...templates } = TYPOGRAPHY2.templates;
2349
+ return (0, import_utils24.deepMerge)((0, import_utils24.merge)(RESET2, reset), {
2350
+ html: {
2351
+ position: "absolute",
2352
+ // overflow: 'hidden',
2353
+ width: "100%",
2354
+ height: "100%",
2355
+ top: "0",
2356
+ left: "0",
2357
+ margin: "0",
2358
+ WebkitFontSmoothing: "antialiased",
2359
+ transform: "translate3d(0, 0, 1px)",
2360
+ scrollBehavior: "smooth",
2361
+ fontSize: TYPOGRAPHY2.browserDefault + "px",
2362
+ ...CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {},
2363
+ fontFamily: DOCUMENT2.fontFamily,
2364
+ lineHeight: DOCUMENT2.lineHeight
2365
+ },
2366
+ body: {
2367
+ boxSizing: "border-box",
2368
+ height: "100%",
2369
+ margin: 0,
2370
+ fontFamily: DOCUMENT2.fontFamily,
2371
+ fontSize: TYPOGRAPHY2.base / TYPOGRAPHY2.browserDefault + CONFIG2.UNIT.default,
2372
+ ...templates,
2373
+ ...body
2374
+ },
2375
+ // form elements
2376
+ fieldset: {
2377
+ border: 0,
2378
+ padding: 0,
2379
+ margin: 0
2380
+ },
2381
+ "select, input": {
2382
+ fontFamily: DOCUMENT2.fontFamily
2383
+ }
2384
+ });
2385
+ }
2386
+ };
2387
+
2388
+ // src/set.js
2389
+ var import_utils25 = __toESM(require_cjs3(), 1);
2390
+ var setCases = (val, key) => {
2391
+ if ((0, import_utils25.isFunction)(val))
2392
+ return val();
2393
+ return val;
2394
+ };
2395
+ var setSameValue = (val, key) => val;
2396
+ var VALUE_TRANSFORMERS = {
2397
+ color: setColor,
2398
+ gradient: setGradient,
2399
+ font: setFont,
2400
+ font_family: setFontFamily,
2401
+ theme: setTheme,
2402
+ icons: setIcon,
2403
+ svg: setSVG,
2404
+ svg_data: setSameValue,
2405
+ typography: setSameValue,
2406
+ cases: setCases,
2407
+ spacing: setSameValue,
2408
+ media: setSameValue,
2409
+ timing: setSameValue,
2410
+ reset: setSameValue,
2411
+ unit: setSameValue,
2412
+ animation: setSameValue
2413
+ };
2414
+ var setValue = (FACTORY_NAME, value, key) => {
2415
+ const CONFIG2 = getActiveConfig();
2416
+ const factoryName = FACTORY_NAME.toLowerCase();
2417
+ const FACTORY2 = CONFIG2[FACTORY_NAME];
2418
+ if (VALUE_TRANSFORMERS[factoryName]) {
2419
+ const result = VALUE_TRANSFORMERS[factoryName](value, key);
2420
+ FACTORY2[key] = result;
2421
+ return FACTORY2;
2422
+ }
2423
+ if (CONFIG2.verbose)
2424
+ console.warn("Can not find", factoryName, "method in scratch");
2425
+ };
2426
+ var setEach = (factoryName, props) => {
2427
+ const CONFIG2 = getActiveConfig();
2428
+ const FACTORY_NAME = factoryName.toUpperCase();
2429
+ const keys = Object.keys(props);
2430
+ keys.map((key) => setValue(FACTORY_NAME, props[key], key));
2431
+ return CONFIG2[FACTORY_NAME];
2432
+ };
2433
+ var SET_OPTIONS = {};
2434
+ var set = (recivedConfig, options = SET_OPTIONS) => {
2435
+ let CONFIG2 = getActiveConfig();
2436
+ const {
2437
+ version,
2438
+ verbose,
2439
+ useVariable,
2440
+ useReset,
2441
+ useSvgSprite,
2442
+ useFontImport,
2443
+ useIconSprite,
2444
+ globalTheme,
2445
+ useDocumentTheme,
2446
+ ...config
2447
+ } = recivedConfig;
2448
+ if (options.newConfig) {
2449
+ FACTORY["active"] = options.newConfig;
2450
+ CONFIG2 = getActiveConfig(options.newConfig);
2451
+ }
2452
+ if (verbose !== void 0)
2453
+ CONFIG2.verbose = verbose;
2454
+ if (useVariable !== void 0)
2455
+ CONFIG2.useVariable = useVariable;
2456
+ if (useReset !== void 0)
2457
+ CONFIG2.useReset = useReset;
2458
+ if (useFontImport !== void 0)
2459
+ CONFIG2.useFontImport = useFontImport;
2460
+ if (useSvgSprite !== void 0)
2461
+ CONFIG2.useSvgSprite = useSvgSprite;
2462
+ if (useIconSprite !== void 0)
2463
+ CONFIG2.useIconSprite = useIconSprite;
2464
+ if (useDocumentTheme !== void 0)
2465
+ CONFIG2.useDocumentTheme = useDocumentTheme;
2466
+ if (globalTheme !== void 0)
2467
+ CONFIG2.globalTheme = globalTheme;
2468
+ if (CONFIG2.verbose)
2469
+ console.log(CONFIG2);
2470
+ const keys = Object.keys(config);
2471
+ keys.map((key) => setEach(key, config[key]));
2472
+ applyTypographySequence();
2473
+ applySpacingSequence();
2474
+ applyTimingSequence();
2475
+ applyDocument();
2476
+ applyReset();
2477
+ return CONFIG2;
2478
+ };