@symbo.ls/scratch 2.11.94 → 2.11.131

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