@symbo.ls/scratch 3.1.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,23 +34,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  var require_cjs = __commonJS({
35
35
  "../utils/dist/cjs/index.js"(exports, module2) {
36
36
  "use strict";
37
- var __defProp2 = Object.defineProperty;
37
+ var __defProp3 = Object.defineProperty;
38
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
39
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
40
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
41
41
  var __export2 = (target, all) => {
42
42
  for (var name in all)
43
- __defProp2(target, name, { get: all[name], enumerable: true });
43
+ __defProp3(target, name, { get: all[name], enumerable: true });
44
44
  };
45
45
  var __copyProps2 = (to, from, except, desc) => {
46
46
  if (from && typeof from === "object" || typeof from === "function") {
47
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 });
48
+ if (!__hasOwnProp3.call(to, key) && key !== except)
49
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
50
  }
51
51
  return to;
52
52
  };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
54
  var index_exports = {};
55
55
  __export2(index_exports, {
56
56
  arrayzeValue: () => arrayzeValue3,
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
66
66
  loadJavascriptFile: () => loadJavascriptFile,
67
67
  loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
68
68
  loadJavascriptFileSync: () => loadJavascriptFileSync,
69
+ loadRemoteCSS: () => loadRemoteCSS,
70
+ loadRemoteScript: () => loadRemoteScript,
69
71
  removeChars: () => removeChars,
70
72
  toCamelCase: () => toCamelCase2,
71
73
  toDashCase: () => toDashCase2,
@@ -273,10 +275,12 @@ var require_cjs = __commonJS({
273
275
  });
274
276
  });
275
277
  scriptEle.addEventListener("error", (ev) => {
276
- reject(new Error({
277
- status: false,
278
- message: `Failed to load the script ${FILE_URL}`
279
- }));
278
+ reject(
279
+ new Error({
280
+ status: false,
281
+ message: `Failed to load the script ${FILE_URL}`
282
+ })
283
+ );
280
284
  });
281
285
  doc.body.appendChild(scriptEle);
282
286
  } catch (error) {
@@ -347,6 +351,59 @@ var require_cjs = __commonJS({
347
351
  console.warn(error);
348
352
  }
349
353
  };
354
+ function loadRemoteScript(url, options = {}) {
355
+ const { window: window4 = globalThis } = options;
356
+ const { document: document4 = window4.document } = options;
357
+ return new Promise((resolve, reject) => {
358
+ const existingScript = document4.querySelector(`script[src="${url}"]`);
359
+ if (existingScript) {
360
+ return resolve(existingScript);
361
+ }
362
+ const script = document4.createElement("script");
363
+ script.src = url;
364
+ script.async = options.async === true;
365
+ script.type = options.type || "text/javascript";
366
+ if (options.id) script.id = options.id;
367
+ if (options.integrity) script.integrity = options.integrity;
368
+ if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
369
+ script.onload = () => {
370
+ script.onerror = script.onload = null;
371
+ resolve(script);
372
+ };
373
+ script.onerror = () => {
374
+ script.onerror = script.onload = null;
375
+ reject(new Error(`Failed to load script: ${url}`));
376
+ };
377
+ document4.head.appendChild(script);
378
+ });
379
+ }
380
+ async function loadRemoteCSS(url, options = {}) {
381
+ const { window: window4 = globalThis } = options;
382
+ const { document: document4 = window4.document } = options;
383
+ return new Promise((resolve, reject) => {
384
+ const existingLink = document4.querySelector(`link[href="${url}"]`);
385
+ if (existingLink) {
386
+ return resolve(existingLink);
387
+ }
388
+ const link = document4.createElement("link");
389
+ link.href = url;
390
+ link.rel = options.rel || "stylesheet";
391
+ link.type = "text/css";
392
+ link.media = options.media || "all";
393
+ if (options.id) link.id = options.id;
394
+ if (options.integrity) link.integrity = options.integrity;
395
+ if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
396
+ link.onload = () => {
397
+ link.onerror = link.onload = null;
398
+ resolve(link);
399
+ };
400
+ link.onerror = () => {
401
+ link.onerror = link.onload = null;
402
+ reject(new Error(`Failed to load stylesheet: ${url}`));
403
+ };
404
+ document4.head.appendChild(link);
405
+ });
406
+ }
350
407
  var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
351
408
  var copyStringToClipboard = async (str) => {
352
409
  try {
@@ -373,12 +430,9 @@ var require_cjs = __commonJS({
373
430
  return index === 0 ? word.toLowerCase() : word.toUpperCase();
374
431
  }).replaceAll(/\s+/g, "");
375
432
  };
376
- var toTitleCase = (str) => str && str.replace(
377
- /\w\S*/g,
378
- (txt) => {
379
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
380
- }
381
- );
433
+ var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
434
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
435
+ });
382
436
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
383
437
  var toDescriptionCase = (str = "") => {
384
438
  if (typeof str !== "string") return;
@@ -429,16 +483,16 @@ __export(system_exports, {
429
483
  });
430
484
  module.exports = __toCommonJS(system_exports);
431
485
 
432
- // ../../../domql/packages/utils/globals.js
486
+ // ../../../domql/packages/utils/dist/esm/globals.js
433
487
  var window2 = globalThis;
434
488
  var document2 = window2.document;
435
489
 
436
- // ../../../domql/packages/utils/node.js
490
+ // ../../../domql/packages/utils/dist/esm/node.js
437
491
  var isDOMNode = (obj) => {
438
492
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
439
493
  };
440
494
 
441
- // ../../../domql/packages/utils/types.js
495
+ // ../../../domql/packages/utils/dist/esm/types.js
442
496
  var isObject = (arg) => {
443
497
  if (arg === null) return false;
444
498
  return typeof arg === "object" && arg.constructor === Object;
@@ -456,7 +510,7 @@ var isUndefined = (arg) => {
456
510
  return arg === void 0;
457
511
  };
458
512
 
459
- // ../../../domql/packages/utils/array.js
513
+ // ../../../domql/packages/utils/dist/esm/array.js
460
514
  var unstackArrayOfObjects = (arr, exclude = []) => {
461
515
  return arr.reduce(
462
516
  (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
@@ -464,7 +518,7 @@ var unstackArrayOfObjects = (arr, exclude = []) => {
464
518
  );
465
519
  };
466
520
 
467
- // ../../../domql/packages/utils/keys.js
521
+ // ../../../domql/packages/utils/dist/esm/keys.js
468
522
  var STATE_METHODS = [
469
523
  "update",
470
524
  "parse",
@@ -535,11 +589,30 @@ var METHODS_EXL = [
535
589
  ...PROPS_METHODS
536
590
  ];
537
591
 
538
- // ../../../domql/packages/utils/object.js
592
+ // ../../../domql/packages/utils/dist/esm/object.js
593
+ var __defProp2 = Object.defineProperty;
594
+ var __defProps = Object.defineProperties;
595
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
596
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
597
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
598
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
599
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
600
+ var __spreadValues = (a, b) => {
601
+ for (var prop in b || (b = {}))
602
+ if (__hasOwnProp2.call(b, prop))
603
+ __defNormalProp(a, prop, b[prop]);
604
+ if (__getOwnPropSymbols)
605
+ for (var prop of __getOwnPropSymbols(b)) {
606
+ if (__propIsEnum.call(b, prop))
607
+ __defNormalProp(a, prop, b[prop]);
608
+ }
609
+ return a;
610
+ };
611
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
539
612
  var merge = (element, obj, excludeFrom = []) => {
540
613
  for (const e in obj) {
541
- const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
542
- if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
614
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
615
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
543
616
  continue;
544
617
  }
545
618
  const elementProp = element[e];
@@ -552,8 +625,8 @@ var merge = (element, obj, excludeFrom = []) => {
552
625
  };
553
626
  var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
554
627
  for (const e in extend) {
555
- const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
556
- if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
628
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
629
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
557
630
  continue;
558
631
  }
559
632
  const elementProp = element[e];
@@ -575,14 +648,15 @@ var deepClone = (obj, options = {}) => {
575
648
  visited = /* @__PURE__ */ new WeakMap(),
576
649
  handleExtends = false
577
650
  } = options;
651
+ const contentWindow = targetWindow || window2 || globalThis;
578
652
  if (!isObjectLike(obj) || isDOMNode(obj)) {
579
653
  return obj;
580
654
  }
581
655
  if (visited.has(obj)) {
582
656
  return visited.get(obj);
583
657
  }
584
- const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
585
- visited.set(obj, clone);
658
+ const clone2 = contentWindow ? isArray(obj) ? new contentWindow.Array() : new contentWindow.Object() : isArray(obj) ? [] : {};
659
+ visited.set(obj, clone2);
586
660
  for (const key in obj) {
587
661
  if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
588
662
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
@@ -593,27 +667,26 @@ var deepClone = (obj, options = {}) => {
593
667
  continue;
594
668
  }
595
669
  if (isDOMNode(value)) {
596
- clone[key] = value;
670
+ clone2[key] = value;
597
671
  continue;
598
672
  }
599
673
  if (handleExtends && key === "extends" && isArray(value)) {
600
- clone[key] = unstackArrayOfObjects(value, exclude);
674
+ clone2[key] = unstackArrayOfObjects(value, exclude);
601
675
  continue;
602
676
  }
603
- if (isFunction(value) && targetWindow) {
604
- clone[key] = targetWindow.eval("(" + value.toString() + ")");
677
+ if (isFunction(value) && options.window) {
678
+ clone2[key] = contentWindow.eval("(" + value.toString() + ")");
605
679
  continue;
606
680
  }
607
681
  if (isObjectLike(value)) {
608
- clone[key] = deepClone(value, {
609
- ...options,
682
+ clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
610
683
  visited
611
- });
684
+ }));
612
685
  } else {
613
- clone[key] = value;
686
+ clone2[key] = value;
614
687
  }
615
688
  }
616
- return clone;
689
+ return clone2;
617
690
  };
618
691
  var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
619
692
  const excl = opts.exclude || [];
@@ -639,7 +712,12 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
639
712
  return obj;
640
713
  };
641
714
 
642
- // ../../../domql/packages/utils/cookie.js
715
+ // ../../../domql/packages/utils/dist/esm/env.js
716
+ var NODE_ENV = "development";
717
+ var isProduction = (env = NODE_ENV) => env === "production";
718
+ var isNotProduction = (env = NODE_ENV) => !isProduction(env);
719
+
720
+ // ../../../domql/packages/utils/dist/esm/cookie.js
643
721
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
644
722
 
645
723
  // ../../../domql/packages/event/dist/esm/keys.js
@@ -996,10 +1074,7 @@ var rgbToHSL = (r, g, b) => {
996
1074
  const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
997
1075
  return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
998
1076
  };
999
- var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
1000
- Math.min(k - 3, 9 - k, 1),
1001
- -1
1002
- )) => [f(0), f(8), f(4)];
1077
+ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)) => [f(0), f(8), f(4)];
1003
1078
  var getColorShade = (col, amt) => {
1004
1079
  const num = parseInt(col, 16);
1005
1080
  let r = (num >> 16) + amt;
@@ -1014,7 +1089,8 @@ var getColorShade = (col, amt) => {
1014
1089
  return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
1015
1090
  };
1016
1091
  var getRgbTone = (rgb, tone) => {
1017
- if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
1092
+ if (isString(rgb) && rgb.includes("rgb"))
1093
+ rgb = colorStringToRgbaArray(rgb).join(", ");
1018
1094
  if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
1019
1095
  if (isNumber(tone)) tone += "";
1020
1096
  const toHex = rgbArrayToHex(rgb);
@@ -1321,8 +1397,7 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
1321
1397
  };
1322
1398
 
1323
1399
  // src/utils/sprite.js
1324
- var ENV = "development";
1325
- var isDev = ENV === "development" || ENV === "testing";
1400
+ var isDev = isNotProduction();
1326
1401
  var generateSprite = (icons) => {
1327
1402
  const CONFIG2 = getActiveConfig();
1328
1403
  let sprite = "";
@@ -1344,7 +1419,9 @@ var parseRootAttributes = (htmlString) => {
1344
1419
  return {};
1345
1420
  }
1346
1421
  const attrString = match[1];
1347
- const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1422
+ const attrs = attrString.match(
1423
+ /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
1424
+ );
1348
1425
  return attrs.reduce((acc, attr) => {
1349
1426
  const [key, value] = attr.split("=");
1350
1427
  acc[key] = value.replace(/['"]/g, "");
@@ -1736,15 +1813,7 @@ var runThroughMedia = (FACTORY2) => {
1736
1813
  if (!isPropMedia) continue;
1737
1814
  const { mediaRegenerate } = FACTORY2;
1738
1815
  const mediaName = prop.slice(1);
1739
- const {
1740
- type,
1741
- base,
1742
- ratio,
1743
- range,
1744
- subSequence,
1745
- h1Matches,
1746
- unit
1747
- } = FACTORY2;
1816
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
1748
1817
  merge(mediaValue, {
1749
1818
  type,
1750
1819
  base,
@@ -1774,7 +1843,7 @@ var runThroughMedia = (FACTORY2) => {
1774
1843
  }
1775
1844
  };
1776
1845
  var applyHeadings = (props) => {
1777
- var _a;
1846
+ var _a, _b;
1778
1847
  const CONFIG2 = getActiveConfig();
1779
1848
  if (props.h1Matches) {
1780
1849
  const unit = props.unit;
@@ -1783,9 +1852,8 @@ var applyHeadings = (props) => {
1783
1852
  for (const k in HEADINGS) {
1784
1853
  const headerName = `h${parseInt(k) + 1}`;
1785
1854
  const headerStyle = templates[headerName];
1786
- if (!HEADINGS[k]) continue;
1787
1855
  templates[headerName] = {
1788
- fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
1856
+ fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
1789
1857
  margin: headerStyle ? headerStyle.margin : 0,
1790
1858
  lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
1791
1859
  letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
@@ -1805,11 +1873,7 @@ var applyTypographySequence = () => {
1805
1873
  var getFontSizeByKey = (value) => {
1806
1874
  const CONFIG2 = getActiveConfig();
1807
1875
  const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
1808
- return getSequenceValuePropertyPair(
1809
- value,
1810
- "fontSize",
1811
- TYPOGRAPHY2
1812
- );
1876
+ return getSequenceValuePropertyPair(value, "fontSize", TYPOGRAPHY2);
1813
1877
  };
1814
1878
 
1815
1879
  // src/system/spacing.js
@@ -34,23 +34,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  var require_cjs = __commonJS({
35
35
  "../utils/dist/cjs/index.js"(exports, module2) {
36
36
  "use strict";
37
- var __defProp2 = Object.defineProperty;
37
+ var __defProp3 = Object.defineProperty;
38
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
39
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
40
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
41
41
  var __export2 = (target, all) => {
42
42
  for (var name in all)
43
- __defProp2(target, name, { get: all[name], enumerable: true });
43
+ __defProp3(target, name, { get: all[name], enumerable: true });
44
44
  };
45
45
  var __copyProps2 = (to, from, except, desc) => {
46
46
  if (from && typeof from === "object" || typeof from === "function") {
47
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 });
48
+ if (!__hasOwnProp3.call(to, key) && key !== except)
49
+ __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
50
  }
51
51
  return to;
52
52
  };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
54
  var index_exports = {};
55
55
  __export2(index_exports, {
56
56
  arrayzeValue: () => arrayzeValue,
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
66
66
  loadJavascriptFile: () => loadJavascriptFile,
67
67
  loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
68
68
  loadJavascriptFileSync: () => loadJavascriptFileSync,
69
+ loadRemoteCSS: () => loadRemoteCSS,
70
+ loadRemoteScript: () => loadRemoteScript,
69
71
  removeChars: () => removeChars,
70
72
  toCamelCase: () => toCamelCase,
71
73
  toDashCase: () => toDashCase2,
@@ -273,10 +275,12 @@ var require_cjs = __commonJS({
273
275
  });
274
276
  });
275
277
  scriptEle.addEventListener("error", (ev) => {
276
- reject(new Error({
277
- status: false,
278
- message: `Failed to load the script ${FILE_URL}`
279
- }));
278
+ reject(
279
+ new Error({
280
+ status: false,
281
+ message: `Failed to load the script ${FILE_URL}`
282
+ })
283
+ );
280
284
  });
281
285
  doc.body.appendChild(scriptEle);
282
286
  } catch (error) {
@@ -347,6 +351,59 @@ var require_cjs = __commonJS({
347
351
  console.warn(error);
348
352
  }
349
353
  };
354
+ function loadRemoteScript(url, options = {}) {
355
+ const { window: window4 = globalThis } = options;
356
+ const { document: document4 = window4.document } = options;
357
+ return new Promise((resolve, reject) => {
358
+ const existingScript = document4.querySelector(`script[src="${url}"]`);
359
+ if (existingScript) {
360
+ return resolve(existingScript);
361
+ }
362
+ const script = document4.createElement("script");
363
+ script.src = url;
364
+ script.async = options.async === true;
365
+ script.type = options.type || "text/javascript";
366
+ if (options.id) script.id = options.id;
367
+ if (options.integrity) script.integrity = options.integrity;
368
+ if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
369
+ script.onload = () => {
370
+ script.onerror = script.onload = null;
371
+ resolve(script);
372
+ };
373
+ script.onerror = () => {
374
+ script.onerror = script.onload = null;
375
+ reject(new Error(`Failed to load script: ${url}`));
376
+ };
377
+ document4.head.appendChild(script);
378
+ });
379
+ }
380
+ async function loadRemoteCSS(url, options = {}) {
381
+ const { window: window4 = globalThis } = options;
382
+ const { document: document4 = window4.document } = options;
383
+ return new Promise((resolve, reject) => {
384
+ const existingLink = document4.querySelector(`link[href="${url}"]`);
385
+ if (existingLink) {
386
+ return resolve(existingLink);
387
+ }
388
+ const link = document4.createElement("link");
389
+ link.href = url;
390
+ link.rel = options.rel || "stylesheet";
391
+ link.type = "text/css";
392
+ link.media = options.media || "all";
393
+ if (options.id) link.id = options.id;
394
+ if (options.integrity) link.integrity = options.integrity;
395
+ if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
396
+ link.onload = () => {
397
+ link.onerror = link.onload = null;
398
+ resolve(link);
399
+ };
400
+ link.onerror = () => {
401
+ link.onerror = link.onload = null;
402
+ reject(new Error(`Failed to load stylesheet: ${url}`));
403
+ };
404
+ document4.head.appendChild(link);
405
+ });
406
+ }
350
407
  var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
351
408
  var copyStringToClipboard = async (str) => {
352
409
  try {
@@ -373,12 +430,9 @@ var require_cjs = __commonJS({
373
430
  return index === 0 ? word.toLowerCase() : word.toUpperCase();
374
431
  }).replaceAll(/\s+/g, "");
375
432
  };
376
- var toTitleCase = (str) => str && str.replace(
377
- /\w\S*/g,
378
- (txt) => {
379
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
380
- }
381
- );
433
+ var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
434
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
435
+ });
382
436
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
383
437
  var toDescriptionCase = (str = "") => {
384
438
  if (typeof str !== "string") return;
@@ -401,16 +455,16 @@ __export(reset_exports, {
401
455
  });
402
456
  module.exports = __toCommonJS(reset_exports);
403
457
 
404
- // ../../../domql/packages/utils/globals.js
458
+ // ../../../domql/packages/utils/dist/esm/globals.js
405
459
  var window2 = globalThis;
406
460
  var document2 = window2.document;
407
461
 
408
- // ../../../domql/packages/utils/node.js
462
+ // ../../../domql/packages/utils/dist/esm/node.js
409
463
  var isDOMNode = (obj) => {
410
464
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
411
465
  };
412
466
 
413
- // ../../../domql/packages/utils/types.js
467
+ // ../../../domql/packages/utils/dist/esm/types.js
414
468
  var isString = (arg) => typeof arg === "string";
415
469
  var isFunction = (arg) => typeof arg === "function";
416
470
  var isNull = (arg) => arg === null;
@@ -423,7 +477,7 @@ var isUndefined = (arg) => {
423
477
  return arg === void 0;
424
478
  };
425
479
 
426
- // ../../../domql/packages/utils/array.js
480
+ // ../../../domql/packages/utils/dist/esm/array.js
427
481
  var unstackArrayOfObjects = (arr, exclude = []) => {
428
482
  return arr.reduce(
429
483
  (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
@@ -431,7 +485,7 @@ var unstackArrayOfObjects = (arr, exclude = []) => {
431
485
  );
432
486
  };
433
487
 
434
- // ../../../domql/packages/utils/keys.js
488
+ // ../../../domql/packages/utils/dist/esm/keys.js
435
489
  var STATE_METHODS = [
436
490
  "update",
437
491
  "parse",
@@ -502,11 +556,30 @@ var METHODS_EXL = [
502
556
  ...PROPS_METHODS
503
557
  ];
504
558
 
505
- // ../../../domql/packages/utils/object.js
559
+ // ../../../domql/packages/utils/dist/esm/object.js
560
+ var __defProp2 = Object.defineProperty;
561
+ var __defProps = Object.defineProperties;
562
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
563
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
564
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
565
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
566
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
567
+ var __spreadValues = (a, b) => {
568
+ for (var prop in b || (b = {}))
569
+ if (__hasOwnProp2.call(b, prop))
570
+ __defNormalProp(a, prop, b[prop]);
571
+ if (__getOwnPropSymbols)
572
+ for (var prop of __getOwnPropSymbols(b)) {
573
+ if (__propIsEnum.call(b, prop))
574
+ __defNormalProp(a, prop, b[prop]);
575
+ }
576
+ return a;
577
+ };
578
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
506
579
  var merge = (element, obj, excludeFrom = []) => {
507
580
  for (const e in obj) {
508
- const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
509
- if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
581
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
582
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
510
583
  continue;
511
584
  }
512
585
  const elementProp = element[e];
@@ -519,8 +592,8 @@ var merge = (element, obj, excludeFrom = []) => {
519
592
  };
520
593
  var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
521
594
  for (const e in extend) {
522
- const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
523
- if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
595
+ const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
596
+ if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
524
597
  continue;
525
598
  }
526
599
  const elementProp = element[e];
@@ -542,14 +615,15 @@ var deepClone = (obj, options = {}) => {
542
615
  visited = /* @__PURE__ */ new WeakMap(),
543
616
  handleExtends = false
544
617
  } = options;
618
+ const contentWindow = targetWindow || window2 || globalThis;
545
619
  if (!isObjectLike(obj) || isDOMNode(obj)) {
546
620
  return obj;
547
621
  }
548
622
  if (visited.has(obj)) {
549
623
  return visited.get(obj);
550
624
  }
551
- const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
552
- visited.set(obj, clone);
625
+ const clone2 = contentWindow ? isArray(obj) ? new contentWindow.Array() : new contentWindow.Object() : isArray(obj) ? [] : {};
626
+ visited.set(obj, clone2);
553
627
  for (const key in obj) {
554
628
  if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
555
629
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
@@ -560,27 +634,26 @@ var deepClone = (obj, options = {}) => {
560
634
  continue;
561
635
  }
562
636
  if (isDOMNode(value)) {
563
- clone[key] = value;
637
+ clone2[key] = value;
564
638
  continue;
565
639
  }
566
640
  if (handleExtends && key === "extends" && isArray(value)) {
567
- clone[key] = unstackArrayOfObjects(value, exclude);
641
+ clone2[key] = unstackArrayOfObjects(value, exclude);
568
642
  continue;
569
643
  }
570
- if (isFunction(value) && targetWindow) {
571
- clone[key] = targetWindow.eval("(" + value.toString() + ")");
644
+ if (isFunction(value) && options.window) {
645
+ clone2[key] = contentWindow.eval("(" + value.toString() + ")");
572
646
  continue;
573
647
  }
574
648
  if (isObjectLike(value)) {
575
- clone[key] = deepClone(value, {
576
- ...options,
649
+ clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
577
650
  visited
578
- });
651
+ }));
579
652
  } else {
580
- clone[key] = value;
653
+ clone2[key] = value;
581
654
  }
582
655
  }
583
- return clone;
656
+ return clone2;
584
657
  };
585
658
  var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
586
659
  const excl = opts.exclude || [];
@@ -606,7 +679,12 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
606
679
  return obj;
607
680
  };
608
681
 
609
- // ../../../domql/packages/utils/cookie.js
682
+ // ../../../domql/packages/utils/dist/esm/env.js
683
+ var NODE_ENV = "development";
684
+ var isProduction = (env = NODE_ENV) => env === "production";
685
+ var isNotProduction = (env = NODE_ENV) => !isProduction(env);
686
+
687
+ // ../../../domql/packages/utils/dist/esm/cookie.js
610
688
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
611
689
 
612
690
  // ../../../domql/packages/event/dist/esm/keys.js
@@ -908,6 +986,9 @@ var getActiveConfig = (def) => {
908
986
  // src/utils/sequence.js
909
987
  var import_utils5 = __toESM(require_cjs(), 1);
910
988
 
989
+ // src/utils/sprite.js
990
+ var isDev = isNotProduction();
991
+
911
992
  // src/system/theme.js
912
993
  var recursiveTheme = (val) => {
913
994
  const CONFIG2 = getActiveConfig();