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