@symbo.ls/scratch 2.11.55 → 2.11.94

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.
package/dist/cjs/index.js CHANGED
@@ -56,13 +56,13 @@ var require_cjs = __commonJS({
56
56
  document: () => document4,
57
57
  global: () => global,
58
58
  self: () => self,
59
- window: () => window3
59
+ window: () => window2
60
60
  });
61
61
  module2.exports = __toCommonJS2(globals_exports);
62
62
  var global = globalThis;
63
63
  var self = globalThis;
64
- var window3 = globalThis;
65
- var document4 = window3.document;
64
+ var window2 = globalThis;
65
+ var document4 = window2.document;
66
66
  }
67
67
  });
68
68
 
@@ -360,10 +360,10 @@ var require_types = __commonJS({
360
360
  isFunction: () => isFunction2,
361
361
  isNot: () => isNot,
362
362
  isNull: () => isNull,
363
- isNumber: () => isNumber,
363
+ isNumber: () => isNumber2,
364
364
  isObject: () => isObject7,
365
365
  isObjectLike: () => isObjectLike3,
366
- isString: () => isString8,
366
+ isString: () => isString9,
367
367
  isUndefined: () => isUndefined,
368
368
  isValidHtmlTag: () => isValidHtmlTag
369
369
  });
@@ -376,8 +376,8 @@ var require_types = __commonJS({
376
376
  return false;
377
377
  return typeof arg === "object" && arg.constructor === Object;
378
378
  };
379
- var isString8 = (arg) => typeof arg === "string";
380
- var isNumber = (arg) => typeof arg === "number";
379
+ var isString9 = (arg) => typeof arg === "string";
380
+ var isNumber2 = (arg) => typeof arg === "number";
381
381
  var isFunction2 = (arg) => typeof arg === "function";
382
382
  var isBoolean = (arg) => arg === true || arg === false;
383
383
  var isNull = (arg) => arg === null;
@@ -388,7 +388,7 @@ var require_types = __commonJS({
388
388
  return typeof arg === "object";
389
389
  };
390
390
  var isDefined2 = (arg) => {
391
- return isObject7(arg) || isObjectLike3(arg) || isString8(arg) || isNumber(arg) || isFunction2(arg) || isArray6(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
391
+ return isObject7(arg) || isObjectLike3(arg) || isString9(arg) || isNumber2(arg) || isFunction2(arg) || isArray6(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
392
392
  };
393
393
  var isUndefined = (arg) => {
394
394
  return arg === void 0;
@@ -397,8 +397,8 @@ var require_types = __commonJS({
397
397
  boolean: isBoolean,
398
398
  array: isArray6,
399
399
  object: isObject7,
400
- string: isString8,
401
- number: isNumber,
400
+ string: isString9,
401
+ number: isNumber2,
402
402
  null: isNull,
403
403
  function: isFunction2,
404
404
  objectLike: isObjectLike3,
@@ -443,6 +443,9 @@ var require_array = __commonJS({
443
443
  var array_exports = {};
444
444
  __export2(array_exports, {
445
445
  arrayContainsOtherArray: () => arrayContainsOtherArray,
446
+ createNestedObject: () => createNestedObject,
447
+ cutArrayAfterValue: () => cutArrayAfterValue,
448
+ cutArrayBeforeValue: () => cutArrayBeforeValue,
446
449
  joinArrays: () => joinArrays,
447
450
  mergeAndCloneIfArray: () => mergeAndCloneIfArray,
448
451
  mergeArray: () => mergeArray,
@@ -482,6 +485,73 @@ var require_array = __commonJS({
482
485
  var mergeAndCloneIfArray = (obj) => {
483
486
  return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
484
487
  };
488
+ var cutArrayBeforeValue = (arr, value) => {
489
+ const index = arr.indexOf(value);
490
+ if (index !== -1) {
491
+ return arr.slice(0, index);
492
+ }
493
+ return arr;
494
+ };
495
+ var cutArrayAfterValue = (arr, value) => {
496
+ const index = arr.indexOf(value);
497
+ if (index !== -1) {
498
+ return arr.slice(index + 1);
499
+ }
500
+ return arr;
501
+ };
502
+ var createNestedObject = (arr, lastValue) => {
503
+ let nestedObject = {};
504
+ if (arr.length === 0) {
505
+ return lastValue;
506
+ }
507
+ arr.reduce((obj, value, index) => {
508
+ if (!obj[value]) {
509
+ obj[value] = {};
510
+ }
511
+ if (index === arr.length - 1 && lastValue) {
512
+ obj[value] = lastValue;
513
+ }
514
+ return obj[value];
515
+ }, nestedObject);
516
+ return nestedObject;
517
+ };
518
+ }
519
+ });
520
+
521
+ // ../../node_modules/@domql/utils/dist/cjs/string.js
522
+ var require_string = __commonJS({
523
+ "../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
524
+ "use strict";
525
+ var __defProp2 = Object.defineProperty;
526
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
527
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
528
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
529
+ var __export2 = (target, all) => {
530
+ for (var name in all)
531
+ __defProp2(target, name, { get: all[name], enumerable: true });
532
+ };
533
+ var __copyProps2 = (to, from, except, desc) => {
534
+ if (from && typeof from === "object" || typeof from === "function") {
535
+ for (let key of __getOwnPropNames2(from))
536
+ if (!__hasOwnProp2.call(to, key) && key !== except)
537
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
538
+ }
539
+ return to;
540
+ };
541
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
542
+ var string_exports = {};
543
+ __export2(string_exports, {
544
+ stringIncludesAny: () => stringIncludesAny
545
+ });
546
+ module2.exports = __toCommonJS2(string_exports);
547
+ var stringIncludesAny = (str, characters) => {
548
+ for (const char of characters) {
549
+ if (str.includes(char)) {
550
+ return true;
551
+ }
552
+ }
553
+ return false;
554
+ };
485
555
  }
486
556
  });
487
557
 
@@ -525,15 +595,18 @@ var require_object = __commonJS({
525
595
  merge: () => merge5,
526
596
  mergeArrayExclude: () => mergeArrayExclude,
527
597
  mergeIfExisted: () => mergeIfExisted,
598
+ objectToString: () => objectToString,
528
599
  overwrite: () => overwrite,
529
600
  overwriteDeep: () => overwriteDeep2,
530
601
  overwriteShallow: () => overwriteShallow,
531
- removeFromObject: () => removeFromObject
602
+ removeFromObject: () => removeFromObject,
603
+ stringToObject: () => stringToObject
532
604
  });
533
605
  module2.exports = __toCommonJS2(object_exports);
534
606
  var import_globals3 = require_cjs();
535
607
  var import_types = require_types();
536
608
  var import_array = require_array();
609
+ var import_string = require_string();
537
610
  var exec = (param, element, state, context) => {
538
611
  if ((0, import_types.isFunction)(param)) {
539
612
  return param(
@@ -551,7 +624,7 @@ var require_object = __commonJS({
551
624
  };
552
625
  var merge5 = (element, obj, excludeFrom = []) => {
553
626
  for (const e in obj) {
554
- if (excludeFrom.includes(e) || e.includes("__"))
627
+ if (excludeFrom.includes(e) || e.startsWith("__"))
555
628
  continue;
556
629
  const elementProp = element[e];
557
630
  const objProp = obj[e];
@@ -563,7 +636,7 @@ var require_object = __commonJS({
563
636
  };
564
637
  var deepMerge3 = (element, extend, excludeFrom = []) => {
565
638
  for (const e in extend) {
566
- if (excludeFrom.includes(e) || e.includes("__"))
639
+ if (excludeFrom.includes(e) || e.startsWith("__"))
567
640
  continue;
568
641
  const elementProp = element[e];
569
642
  const extendProp = extend[e];
@@ -578,7 +651,7 @@ var require_object = __commonJS({
578
651
  var clone = (obj, excludeFrom = []) => {
579
652
  const o = {};
580
653
  for (const prop in obj) {
581
- if (excludeFrom.includes(prop) || prop.includes("__"))
654
+ if (excludeFrom.includes(prop) || prop.startsWith("__"))
582
655
  continue;
583
656
  o[prop] = obj[prop];
584
657
  }
@@ -590,7 +663,7 @@ var require_object = __commonJS({
590
663
  }
591
664
  const o = {};
592
665
  for (const k in obj) {
593
- if (excludeFrom.includes(k) || k.includes("__"))
666
+ if (excludeFrom.includes(k) || k.startsWith("__"))
594
667
  continue;
595
668
  let v = obj[k];
596
669
  if (k === "extend" && (0, import_types.isArray)(v)) {
@@ -611,7 +684,7 @@ var require_object = __commonJS({
611
684
  var deepClone2 = (obj, excludeFrom = []) => {
612
685
  const o = (0, import_types.isArray)(obj) ? [] : {};
613
686
  for (const prop in obj) {
614
- if (excludeFrom.includes(prop) || prop.includes("__"))
687
+ if (excludeFrom.includes(prop) || prop.startsWith("__"))
615
688
  continue;
616
689
  let objProp = obj[prop];
617
690
  if (prop === "extend" && (0, import_types.isArray)(objProp)) {
@@ -650,6 +723,40 @@ var require_object = __commonJS({
650
723
  }
651
724
  return stringified;
652
725
  };
726
+ var objectToString = (obj, indent = 0) => {
727
+ const spaces = " ".repeat(indent);
728
+ let str = "{\n";
729
+ for (const [key, value] of Object.entries(obj)) {
730
+ const keyAllowdChars = (0, import_string.stringIncludesAny)(key, ["-", ":", "@", ".", "!"]);
731
+ const stringedKey = keyAllowdChars ? `'${key}'` : key;
732
+ str += `${spaces} ${stringedKey}: `;
733
+ if ((0, import_types.isArray)(value)) {
734
+ str += "[\n";
735
+ for (const element of value) {
736
+ if ((0, import_types.isObject)(element) && element !== null) {
737
+ str += `${spaces} ${objectToString(element, indent + 2)},
738
+ `;
739
+ } else if ((0, import_types.isString)(element)) {
740
+ str += `${spaces} '${element}',
741
+ `;
742
+ } else {
743
+ str += `${spaces} ${element},
744
+ `;
745
+ }
746
+ }
747
+ str += `${spaces} ]`;
748
+ } else if ((0, import_types.isObject)(value)) {
749
+ str += objectToString(value, indent + 1);
750
+ } else if ((0, import_types.isString)(value)) {
751
+ str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
752
+ } else {
753
+ str += value;
754
+ }
755
+ str += ",\n";
756
+ }
757
+ str += `${spaces}}`;
758
+ return str;
759
+ };
653
760
  var detachFunctionsFromObject = (obj, detached = {}) => {
654
761
  for (const prop in obj) {
655
762
  const objProp = obj[prop];
@@ -720,6 +827,16 @@ var require_object = __commonJS({
720
827
  }
721
828
  return stringified;
722
829
  };
830
+ var stringToObject = (str) => {
831
+ let obj;
832
+ try {
833
+ obj = import_globals3.window.eval("(" + str + ")");
834
+ } catch (e) {
835
+ console.warn(e);
836
+ }
837
+ if (obj)
838
+ return obj;
839
+ };
723
840
  var diffObjects = (original, objToDiff, cache) => {
724
841
  for (const e in objToDiff) {
725
842
  if (e === "ref")
@@ -765,7 +882,7 @@ var require_object = __commonJS({
765
882
  const { ref } = element;
766
883
  const changes = {};
767
884
  for (const e in params) {
768
- if (excludeFrom.includes(e) || e.includes("__"))
885
+ if (excludeFrom.includes(e) || e.startsWith("__"))
769
886
  continue;
770
887
  const elementProp = element[e];
771
888
  const paramsProp = params[e];
@@ -778,7 +895,7 @@ var require_object = __commonJS({
778
895
  };
779
896
  var overwriteShallow = (obj, params, excludeFrom = []) => {
780
897
  for (const e in params) {
781
- if (excludeFrom.includes(e) || e.includes("__"))
898
+ if (excludeFrom.includes(e) || e.startsWith("__"))
782
899
  continue;
783
900
  obj[e] = params[e];
784
901
  }
@@ -786,7 +903,7 @@ var require_object = __commonJS({
786
903
  };
787
904
  var overwriteDeep2 = (obj, params, excludeFrom = []) => {
788
905
  for (const e in params) {
789
- if (excludeFrom.includes(e) || e.includes("__"))
906
+ if (excludeFrom.includes(e) || e.startsWith("__"))
790
907
  continue;
791
908
  const objProp = obj[e];
792
909
  const paramsProp = params[e];
@@ -967,6 +1084,7 @@ var require_cjs4 = __commonJS({
967
1084
  __reExport(utils_exports2, require_array(), module2.exports);
968
1085
  __reExport(utils_exports2, require_node(), module2.exports);
969
1086
  __reExport(utils_exports2, require_log(), module2.exports);
1087
+ __reExport(utils_exports2, require_string(), module2.exports);
970
1088
  }
971
1089
  });
972
1090
 
@@ -1030,6 +1148,7 @@ __export(src_exports, {
1030
1148
  getFontSizeByKey: () => getFontSizeByKey,
1031
1149
  getMediaColor: () => getMediaColor,
1032
1150
  getMediaTheme: () => getMediaTheme,
1151
+ getRgbTone: () => getRgbTone,
1033
1152
  getSequenceValue: () => getSequenceValue,
1034
1153
  getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
1035
1154
  getSpacingBasedOnRatio: () => getSpacingBasedOnRatio,
@@ -1099,6 +1218,7 @@ __export(utils_exports, {
1099
1218
  getFontFaceEachString: () => getFontFaceEachString,
1100
1219
  getFontFaceString: () => getFontFaceString,
1101
1220
  getFontFormat: () => getFontFormat,
1221
+ getRgbTone: () => getRgbTone,
1102
1222
  getSequenceValue: () => getSequenceValue,
1103
1223
  getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
1104
1224
  hexToRgb: () => hexToRgb,
@@ -1122,6 +1242,7 @@ __export(utils_exports, {
1122
1242
 
1123
1243
  // src/utils/color.js
1124
1244
  var import_globals = __toESM(require_cjs(), 1);
1245
+ var import_utils = __toESM(require_cjs4(), 1);
1125
1246
  var ENV = "development";
1126
1247
  var colorStringToRgbaArray = (color) => {
1127
1248
  if (color === "")
@@ -1174,7 +1295,7 @@ var hexToRgbArray = (hex, alpha = 1) => {
1174
1295
  return [r, g, b];
1175
1296
  };
1176
1297
  var rgbToHex = (r, g, b) => {
1177
- return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1298
+ return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1);
1178
1299
  };
1179
1300
  var rgbArrayToHex = ([r, g, b]) => {
1180
1301
  return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
@@ -1226,7 +1347,7 @@ var getColorShade = (col, amt) => {
1226
1347
  g = 255;
1227
1348
  else if (g < 0)
1228
1349
  g = 0;
1229
- return (g | b << 8 | r << 16).toString(16);
1350
+ return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
1230
1351
  };
1231
1352
  var mixTwoRgba = (colorA, colorB, range = 0.5) => {
1232
1353
  const arr = [];
@@ -1248,6 +1369,24 @@ var opacify = (color, opacity) => {
1248
1369
  arr[3] = opacity;
1249
1370
  return `rgba(${arr})`;
1250
1371
  };
1372
+ var getRgbTone = (rgb, tone) => {
1373
+ if ((0, import_utils.isString)(rgb))
1374
+ rgb = rgb.split(", ").map((v) => parseFloat(v));
1375
+ if ((0, import_utils.isNumber)(tone))
1376
+ tone += "";
1377
+ const toHex = rgbArrayToHex(rgb);
1378
+ const abs = tone.slice(0, 1);
1379
+ if (abs === "-" || abs === "+") {
1380
+ const colorShade = getColorShade(toHex, parseFloat(tone));
1381
+ return hexToRgbArray(colorShade).join(", ");
1382
+ } else {
1383
+ const [r, g, b] = rgb;
1384
+ const hsl = rgbToHSL(r, g, b);
1385
+ const [h, s, l] = hsl;
1386
+ const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
1387
+ return newRgb;
1388
+ }
1389
+ };
1251
1390
 
1252
1391
  // src/utils/theme.js
1253
1392
  var returnSubThemeOrDefault = (orig, theme) => {
@@ -1302,13 +1441,13 @@ var getFontFaceString = (LIBRARY) => {
1302
1441
  };
1303
1442
 
1304
1443
  // src/utils/sequence.js
1305
- var import_utils4 = __toESM(require_cjs4(), 1);
1444
+ var import_utils5 = __toESM(require_cjs4(), 1);
1306
1445
 
1307
1446
  // ../utils/src/index.js
1308
- var import_utils2 = __toESM(require_cjs4());
1447
+ var import_utils3 = __toESM(require_cjs4());
1309
1448
 
1310
1449
  // ../utils/src/scaling.js
1311
- var import_utils = __toESM(require_cjs4());
1450
+ var import_utils2 = __toESM(require_cjs4());
1312
1451
 
1313
1452
  // ../utils/src/index.js
1314
1453
  var toCamelCase = (str) => {
@@ -1316,18 +1455,18 @@ var toCamelCase = (str) => {
1316
1455
  return index === 0 ? word.toLowerCase() : word.toUpperCase();
1317
1456
  }).replaceAll(/\s+/g, "");
1318
1457
  };
1319
- var toDashCase = (val) => val.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()).replace(".", "-");
1458
+ var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
1320
1459
  var arrayzeValue = (val) => {
1321
- if ((0, import_utils2.isString)(val))
1460
+ if ((0, import_utils3.isString)(val))
1322
1461
  return val.split(" ");
1323
- if ((0, import_utils2.isObject)(val))
1462
+ if ((0, import_utils3.isObject)(val))
1324
1463
  return Object.keys(val).map((v) => val[v]);
1325
- if ((0, import_utils2.isArray)(val))
1464
+ if ((0, import_utils3.isArray)(val))
1326
1465
  return val;
1327
1466
  };
1328
1467
 
1329
1468
  // src/factory.js
1330
- var import_utils3 = __toESM(require_cjs4(), 1);
1469
+ var import_utils4 = __toESM(require_cjs4(), 1);
1331
1470
 
1332
1471
  // src/defaultConfig/index.js
1333
1472
  var defaultConfig_exports = {};
@@ -1536,13 +1675,13 @@ var CONFIG = {
1536
1675
  CSS_VARS,
1537
1676
  ...defaultConfig_exports
1538
1677
  };
1539
- var cachedConfig = (0, import_utils3.deepClone)(CONFIG);
1678
+ var cachedConfig = (0, import_utils4.deepClone)(CONFIG);
1540
1679
  var FACTORY = {
1541
1680
  active: "0",
1542
1681
  0: CONFIG
1543
1682
  };
1544
1683
  var activateConfig = (def) => {
1545
- if ((0, import_utils3.isDefined)(def)) {
1684
+ if ((0, import_utils4.isDefined)(def)) {
1546
1685
  FACTORY.active = def;
1547
1686
  }
1548
1687
  return FACTORY[def || FACTORY.active];
@@ -1551,10 +1690,10 @@ var getActiveConfig = (def) => {
1551
1690
  return FACTORY[def || FACTORY.active];
1552
1691
  };
1553
1692
  var setActiveConfig = (newConfig) => {
1554
- if (!(0, import_utils3.isObject)(newConfig))
1693
+ if (!(0, import_utils4.isObject)(newConfig))
1555
1694
  return;
1556
1695
  FACTORY.active = "1";
1557
- FACTORY["1"] = (0, import_utils3.deepMerge)(newConfig, (0, import_utils3.deepClone)(cachedConfig));
1696
+ FACTORY["1"] = (0, import_utils4.deepMerge)(newConfig, (0, import_utils4.deepClone)(cachedConfig));
1558
1697
  return newConfig;
1559
1698
  };
1560
1699
 
@@ -1665,7 +1804,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
1665
1804
  unit = UNIT2.default,
1666
1805
  useVariable
1667
1806
  } = sequenceProps;
1668
- if ((0, import_utils4.isString)(value) && value.slice(0, 2) === "--")
1807
+ if ((0, import_utils5.isString)(value) && value.slice(0, 2) === "--")
1669
1808
  return `var(${value})`;
1670
1809
  const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
1671
1810
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
@@ -1728,11 +1867,11 @@ var findHeadings = (propertyNames) => {
1728
1867
  };
1729
1868
 
1730
1869
  // src/utils/var.js
1731
- var import_utils6 = __toESM(require_cjs4(), 1);
1870
+ var import_utils7 = __toESM(require_cjs4(), 1);
1732
1871
  var setVariables = (result, key) => {
1733
1872
  const CONFIG2 = getActiveConfig();
1734
1873
  const { CSS_VARS: CSS_VARS2 } = CONFIG2;
1735
- if ((0, import_utils6.isObjectLike)(result.value)) {
1874
+ if ((0, import_utils7.isObjectLike)(result.value)) {
1736
1875
  } else {
1737
1876
  CSS_VARS2[result.var] = result.value;
1738
1877
  }
@@ -1768,7 +1907,7 @@ var applySequenceVars = (props, mediaName, options = {}) => {
1768
1907
  };
1769
1908
 
1770
1909
  // src/utils/sprite.js
1771
- var import_utils7 = __toESM(require_cjs4(), 1);
1910
+ var import_utils8 = __toESM(require_cjs4(), 1);
1772
1911
  var generateSprite = (icons) => {
1773
1912
  const CONFIG2 = getActiveConfig();
1774
1913
  let sprite = "";
@@ -1782,7 +1921,7 @@ var generateSprite = (icons) => {
1782
1921
  return sprite;
1783
1922
  };
1784
1923
  var parseRootAttributes = (htmlString) => {
1785
- if (!(0, import_utils7.isString)(htmlString)) {
1924
+ if (!(0, import_utils8.isString)(htmlString)) {
1786
1925
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1787
1926
  }
1788
1927
  const match = htmlString.match(/<svg\s+(.*?)>/);
@@ -1802,7 +1941,7 @@ var replaceIdsAndUrls = (code, key) => {
1802
1941
  const urlRegex = /url\(#([^)]*)\)/g;
1803
1942
  const matches = code.match(/id="([^"]*)"/g);
1804
1943
  let replacedCode = code;
1805
- if ((0, import_utils7.isArray)(matches)) {
1944
+ if ((0, import_utils8.isArray)(matches)) {
1806
1945
  matches.forEach(() => {
1807
1946
  const randomKey = Math.floor(Math.random() * 1e5);
1808
1947
  replacedCode = code.replace(idRegex, `id="${key}-${randomKey}"`).replace(urlRegex, `url(#${key}-${randomKey})`);
@@ -1859,10 +1998,10 @@ __export(system_exports, {
1859
1998
  });
1860
1999
 
1861
2000
  // src/system/color.js
1862
- var import_utils8 = __toESM(require_cjs4(), 1);
2001
+ var import_utils9 = __toESM(require_cjs4(), 1);
1863
2002
  var getColor = (value, key, config) => {
1864
2003
  const CONFIG2 = config || getActiveConfig();
1865
- if (!(0, import_utils8.isString)(value)) {
2004
+ if (!(0, import_utils9.isString)(value)) {
1866
2005
  if (CONFIG2.verbose)
1867
2006
  console.warn(value, "- type for color is not valid");
1868
2007
  return;
@@ -1871,7 +2010,7 @@ var getColor = (value, key, config) => {
1871
2010
  return `var(${value})`;
1872
2011
  if (key && value[key])
1873
2012
  value = value[key];
1874
- const [name, alpha, tone] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
2013
+ const [name, alpha, tone] = (0, import_utils9.isArray)(value) ? value : value.split(" ");
1875
2014
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1876
2015
  let val = COLOR2[name] || GRADIENT2[name];
1877
2016
  if (!val) {
@@ -1886,22 +2025,11 @@ var getColor = (value, key, config) => {
1886
2025
  console.warn(value, " - does not have ", key);
1887
2026
  }
1888
2027
  let rgb = val.rgb;
1889
- if (!rgb)
2028
+ if (!rgb) {
1890
2029
  return CONFIG2.useVariable ? `var(${val.var})` : val.value;
2030
+ }
1891
2031
  if (tone && !val[tone]) {
1892
- const toHex = rgbArrayToHex(rgb.split(", ").map((v) => parseFloat(v)));
1893
- const abs = tone.slice(0, 1);
1894
- if (abs === "-" || abs === "+") {
1895
- rgb = hexToRgbArray(
1896
- getColorShade(toHex, parseFloat(tone))
1897
- ).join(", ");
1898
- } else {
1899
- const [r, g, b] = [...rgb.split(", ").map((v) => parseInt(v))];
1900
- const hsl = rgbToHSL(r, g, b);
1901
- const [h, s, l] = hsl;
1902
- const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
1903
- rgb = newRgb;
1904
- }
2032
+ rgb = getRgbTone(rgb, tone);
1905
2033
  val[tone] = { rgb, var: `${val.var}-${tone}` };
1906
2034
  }
1907
2035
  if (val[tone])
@@ -1914,17 +2042,17 @@ var getMediaColor = (value, globalTheme, config) => {
1914
2042
  const CONFIG2 = config || getActiveConfig();
1915
2043
  if (!globalTheme)
1916
2044
  globalTheme = CONFIG2.globalTheme;
1917
- if (!(0, import_utils8.isString)(value)) {
2045
+ if (!(0, import_utils9.isString)(value)) {
1918
2046
  if (CONFIG2.verbose)
1919
2047
  console.warn(value, "- type for color is not valid");
1920
2048
  return;
1921
2049
  }
1922
2050
  if (value.slice(0, 2) === "--")
1923
2051
  return `var(${value})`;
1924
- const [name] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
2052
+ const [name] = (0, import_utils9.isArray)(value) ? value : value.split(" ");
1925
2053
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1926
2054
  const val = COLOR2[name] || GRADIENT2[name];
1927
- const isObj = (0, import_utils8.isObject)(val);
2055
+ const isObj = (0, import_utils9.isObject)(val);
1928
2056
  if (isObj && val.value)
1929
2057
  return getColor(value, `@${globalTheme}`, config);
1930
2058
  else if (isObj) {
@@ -1947,15 +2075,15 @@ var getMediaColor = (value, globalTheme, config) => {
1947
2075
  };
1948
2076
  var setColor = (val, key, suffix) => {
1949
2077
  const CONFIG2 = getActiveConfig();
1950
- if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
2078
+ if ((0, import_utils9.isString)(val) && val.slice(0, 2) === "--")
1951
2079
  val = getColor(val.slice(2));
1952
- if ((0, import_utils8.isArray)(val)) {
2080
+ if ((0, import_utils9.isArray)(val)) {
1953
2081
  return {
1954
2082
  "@light": setColor(val[0], key, "light"),
1955
2083
  "@dark": setColor(val[1], key, "dark")
1956
2084
  };
1957
2085
  }
1958
- if ((0, import_utils8.isObject)(val)) {
2086
+ if ((0, import_utils9.isObject)(val)) {
1959
2087
  const obj = {};
1960
2088
  for (const variant in val)
1961
2089
  obj[variant] = setColor(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
@@ -1978,15 +2106,15 @@ var setColor = (val, key, suffix) => {
1978
2106
  };
1979
2107
  var setGradient = (val, key, suffix) => {
1980
2108
  const CONFIG2 = getActiveConfig();
1981
- if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
2109
+ if ((0, import_utils9.isString)(val) && val.slice(0, 2) === "--")
1982
2110
  val = getColor(val.slice(2));
1983
- if ((0, import_utils8.isArray)(val)) {
2111
+ if ((0, import_utils9.isArray)(val)) {
1984
2112
  return {
1985
2113
  "@light": setGradient(val[0], key, "light"),
1986
2114
  "@dark": setGradient(val[0], key, "dark")
1987
2115
  };
1988
2116
  }
1989
- if ((0, import_utils8.isObject)(val)) {
2117
+ if ((0, import_utils9.isObject)(val)) {
1990
2118
  const obj = {};
1991
2119
  for (const variant in val)
1992
2120
  obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
@@ -2003,7 +2131,7 @@ var setGradient = (val, key, suffix) => {
2003
2131
  };
2004
2132
 
2005
2133
  // src/system/theme.js
2006
- var import_utils10 = __toESM(require_cjs4(), 1);
2134
+ var import_utils11 = __toESM(require_cjs4(), 1);
2007
2135
  var setThemeValue = (theme) => {
2008
2136
  const value = {};
2009
2137
  const { state, media, helpers, ...rest } = theme;
@@ -2026,7 +2154,7 @@ var getTheme = (value, modifier) => {
2026
2154
  if (CONFIG2.useVariable)
2027
2155
  return getMediaTheme(value, modifier);
2028
2156
  const { THEME: THEME2 } = CONFIG2;
2029
- if ((0, import_utils10.isString)(value)) {
2157
+ if ((0, import_utils11.isString)(value)) {
2030
2158
  const [theme, subtheme] = value.split(" ");
2031
2159
  const isOurTheme = THEME2[theme];
2032
2160
  if (isOurTheme) {
@@ -2035,7 +2163,7 @@ var getTheme = (value, modifier) => {
2035
2163
  value = [theme, subtheme || modifier];
2036
2164
  }
2037
2165
  }
2038
- if ((0, import_utils10.isObjectLike)(value) && value[1]) {
2166
+ if ((0, import_utils11.isObjectLike)(value) && value[1]) {
2039
2167
  const themeName = value[0];
2040
2168
  const subThemeName = value[1];
2041
2169
  const { helpers, media, state } = THEME2[themeName];
@@ -2045,11 +2173,11 @@ var getTheme = (value, modifier) => {
2045
2173
  return getThemeValue(helpers[subThemeName]);
2046
2174
  if (state && state[subThemeName])
2047
2175
  return getThemeValue(state[subThemeName]);
2048
- } else if ((0, import_utils10.isObject)(value))
2176
+ } else if ((0, import_utils11.isObject)(value))
2049
2177
  return setThemeValue(value);
2050
2178
  };
2051
2179
  var setInverseTheme = (theme, variant, value) => {
2052
- if ((0, import_utils10.isObject)(variant)) {
2180
+ if ((0, import_utils11.isObject)(variant)) {
2053
2181
  theme.variants.inverse.value = setThemeValue(variant);
2054
2182
  } else if (variant === true) {
2055
2183
  const { color, background } = value;
@@ -2064,7 +2192,7 @@ var setInverseTheme = (theme, variant, value) => {
2064
2192
  var setPseudo = (theme, key, variant, themeValue) => {
2065
2193
  const result = getTheme(variant);
2066
2194
  themeValue[`&:${key}`] = result;
2067
- if ((0, import_utils10.isObject)(variant) && !variant.value)
2195
+ if ((0, import_utils11.isObject)(variant) && !variant.value)
2068
2196
  variant.value = result;
2069
2197
  };
2070
2198
  var setSelectors = (theme, value) => {
@@ -2082,7 +2210,7 @@ var setSelectors = (theme, value) => {
2082
2210
  var setPrefersScheme = (theme, key, variant, themeValue) => {
2083
2211
  const result = getTheme(variant);
2084
2212
  themeValue[`@media (prefers-color-scheme: ${key})`] = result;
2085
- if ((0, import_utils10.isObject)(variant) && !variant.value)
2213
+ if ((0, import_utils11.isObject)(variant) && !variant.value)
2086
2214
  variant.value = result;
2087
2215
  };
2088
2216
  var setMedia = (theme, value) => {
@@ -2108,7 +2236,7 @@ var setHelpers = (theme, value) => {
2108
2236
  const keys = Object.keys(helpers);
2109
2237
  keys.map((key) => {
2110
2238
  const helper = helpers[key];
2111
- if ((0, import_utils10.isString)(helper))
2239
+ if ((0, import_utils11.isString)(helper))
2112
2240
  helpers[key] = CONFIG2.THEME[helper];
2113
2241
  else
2114
2242
  getThemeValue(helpers[key]);
@@ -2132,7 +2260,7 @@ var setMediaTheme = (val, key, suffix, prefers) => {
2132
2260
  const CONFIG2 = getActiveConfig();
2133
2261
  const { CSS_VARS: CSS_VARS2 } = CONFIG2;
2134
2262
  const theme = { value: val };
2135
- if ((0, import_utils10.isObjectLike)(val)) {
2263
+ if ((0, import_utils11.isObjectLike)(val)) {
2136
2264
  for (const param in val) {
2137
2265
  const symb = param.slice(0, 1);
2138
2266
  const value = val[param];
@@ -2160,7 +2288,7 @@ var setMediaTheme = (val, key, suffix, prefers) => {
2160
2288
  };
2161
2289
  }
2162
2290
  }
2163
- if ((0, import_utils10.isString)(val) && val.slice(0, 2) === "--") {
2291
+ if ((0, import_utils11.isString)(val) && val.slice(0, 2) === "--") {
2164
2292
  const { THEME: THEME2 } = CONFIG2;
2165
2293
  const value = THEME2[val.slice(2)];
2166
2294
  const getReferenced = getMediaTheme(value, prefers);
@@ -2173,7 +2301,7 @@ var recursiveTheme = (val) => {
2173
2301
  const obj = {};
2174
2302
  for (const param in val) {
2175
2303
  const symb = param.slice(0, 1);
2176
- if ((0, import_utils10.isObjectLike)(val[param])) {
2304
+ if ((0, import_utils11.isObjectLike)(val[param])) {
2177
2305
  if (symb === "@") {
2178
2306
  const query = CONFIG2.MEDIA[param.slice(1)];
2179
2307
  const media = `@media screen and ${query}`;
@@ -2193,23 +2321,23 @@ var findModifierFromArray = (val, modifierArray) => {
2193
2321
  return val;
2194
2322
  };
2195
2323
  var findModifier = (val, modifier) => {
2196
- if ((0, import_utils10.isArray)(modifier))
2324
+ if ((0, import_utils11.isArray)(modifier))
2197
2325
  return findModifierFromArray(val, modifier);
2198
- else if ((0, import_utils10.isString)(modifier) && val[modifier])
2326
+ else if ((0, import_utils11.isString)(modifier) && val[modifier])
2199
2327
  return val[modifier];
2200
2328
  else
2201
2329
  return val;
2202
2330
  };
2203
2331
  var getMediaTheme = (val, mod) => {
2204
2332
  const CONFIG2 = getActiveConfig();
2205
- if ((0, import_utils10.isString)(val) && val.slice(0, 2) === "--")
2333
+ if ((0, import_utils11.isString)(val) && val.slice(0, 2) === "--")
2206
2334
  val = getMediaTheme(val.slice(2));
2207
- if (!val || !(0, import_utils10.isString)(val)) {
2335
+ if (!val || !(0, import_utils11.isString)(val)) {
2208
2336
  if (CONFIG2.verbose)
2209
2337
  console.warn(val, "- theme is not string");
2210
2338
  return;
2211
2339
  }
2212
- const [name, ...modifier] = (0, import_utils10.isArray)(val) ? val : val.split(" ");
2340
+ const [name, ...modifier] = (0, import_utils11.isArray)(val) ? val : val.split(" ");
2213
2341
  let value = CONFIG2.THEME[name];
2214
2342
  if (value && (modifier || mod)) {
2215
2343
  value = findModifier(value, modifier.length ? modifier : mod);
@@ -2219,7 +2347,7 @@ var getMediaTheme = (val, mod) => {
2219
2347
  };
2220
2348
 
2221
2349
  // src/system/font.js
2222
- var import_utils11 = __toESM(require_cjs4(), 1);
2350
+ var import_utils12 = __toESM(require_cjs4(), 1);
2223
2351
  var setFont = (val, key) => {
2224
2352
  const CSSvar = `--font-${key}`;
2225
2353
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
@@ -2236,7 +2364,7 @@ var setFontFamily = (val, key) => {
2236
2364
  let { value, type } = val;
2237
2365
  if (val.isDefault)
2238
2366
  FONT_FAMILY2.default = key;
2239
- if ((0, import_utils11.isObject)(value))
2367
+ if ((0, import_utils12.isObject)(value))
2240
2368
  value = arrayzeValue(value);
2241
2369
  const CSSvar = `--font-family-${key}`;
2242
2370
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
@@ -2244,7 +2372,7 @@ var setFontFamily = (val, key) => {
2244
2372
  };
2245
2373
 
2246
2374
  // src/system/typography.js
2247
- var import_utils14 = __toESM(require_cjs4(), 1);
2375
+ var import_utils15 = __toESM(require_cjs4(), 1);
2248
2376
  var runThroughMedia = (props) => {
2249
2377
  const CONFIG2 = getActiveConfig();
2250
2378
  const { TYPOGRAPHY: TYPOGRAPHY2, MEDIA: MEDIA2 } = CONFIG2;
@@ -2252,7 +2380,7 @@ var runThroughMedia = (props) => {
2252
2380
  const mediaProps = props[prop];
2253
2381
  if (prop.slice(0, 1) === "@") {
2254
2382
  const { type, base, ratio, range, subSequence, h1Matches, unit } = props;
2255
- (0, import_utils14.merge)(mediaProps, {
2383
+ (0, import_utils15.merge)(mediaProps, {
2256
2384
  type,
2257
2385
  base,
2258
2386
  ratio,
@@ -2313,13 +2441,13 @@ var getFontSizeByKey = (value) => {
2313
2441
  };
2314
2442
 
2315
2443
  // src/system/spacing.js
2316
- var import_utils17 = __toESM(require_cjs4(), 1);
2444
+ var import_utils18 = __toESM(require_cjs4(), 1);
2317
2445
  var runThroughMedia2 = (sequenceProps) => {
2318
2446
  for (const prop in sequenceProps) {
2319
2447
  const mediaProps = sequenceProps[prop];
2320
2448
  if (prop.slice(0, 1) === "@") {
2321
2449
  const { type, base, ratio, range, subSequence, h1Matches, unit } = sequenceProps;
2322
- (0, import_utils17.merge)(mediaProps, {
2450
+ (0, import_utils18.merge)(mediaProps, {
2323
2451
  type,
2324
2452
  base,
2325
2453
  ratio,
@@ -2358,7 +2486,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
2358
2486
  const stack = arrayzeValue(value);
2359
2487
  if (!stack)
2360
2488
  return;
2361
- if ((0, import_utils17.isString)(value) && value.includes("calc")) {
2489
+ if ((0, import_utils18.isString)(value) && value.includes("calc")) {
2362
2490
  return { [propertyName]: value };
2363
2491
  }
2364
2492
  if (stack.length > 1) {
@@ -2394,7 +2522,7 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
2394
2522
  let sequenceProps = SPACING2[spacingRatio];
2395
2523
  if (!sequenceProps) {
2396
2524
  const { type, base, range, subSequence } = SPACING2;
2397
- sequenceProps = SPACING2[spacingRatio] = (0, import_utils17.merge)({
2525
+ sequenceProps = SPACING2[spacingRatio] = (0, import_utils18.merge)({
2398
2526
  ratio: spacingRatio,
2399
2527
  type: type + "-" + spacingRatio,
2400
2528
  unit,
@@ -2439,11 +2567,11 @@ var getTimingByKey = (value, property = "timing") => {
2439
2567
  };
2440
2568
 
2441
2569
  // src/system/document.js
2442
- var import_utils21 = __toESM(require_cjs4(), 1);
2570
+ var import_utils22 = __toESM(require_cjs4(), 1);
2443
2571
  var applyDocument = () => {
2444
2572
  const CONFIG2 = getActiveConfig();
2445
2573
  const { DOCUMENT: DOCUMENT2, FONT_FAMILY: FONT_FAMILY2, THEME: THEME2, TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
2446
- return (0, import_utils21.merge)(DOCUMENT2, {
2574
+ return (0, import_utils22.merge)(DOCUMENT2, {
2447
2575
  theme: THEME2.document,
2448
2576
  fontFamily: getDefaultOrFirstKey(FONT_FAMILY2),
2449
2577
  fontSize: TYPOGRAPHY2.base,
@@ -2527,7 +2655,7 @@ var appendSVG = (lib, options = DEF_OPTIONS) => {
2527
2655
  };
2528
2656
 
2529
2657
  // src/system/reset.js
2530
- var import_utils24 = __toESM(require_cjs4(), 1);
2658
+ var import_utils25 = __toESM(require_cjs4(), 1);
2531
2659
  var applyReset = (reset = {}) => {
2532
2660
  const CONFIG2 = getActiveConfig();
2533
2661
  const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
@@ -2549,8 +2677,8 @@ var applyReset = (reset = {}) => {
2549
2677
  const { body, ...templates } = TYPOGRAPHY2.templates;
2550
2678
  const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
2551
2679
  if (RESET2.html)
2552
- (0, import_utils24.overwriteDeep)(RESET2.html, globalTheme);
2553
- return (0, import_utils24.deepMerge)((0, import_utils24.merge)(RESET2, reset), {
2680
+ (0, import_utils25.overwriteDeep)(RESET2.html, globalTheme);
2681
+ return (0, import_utils25.deepMerge)((0, import_utils25.merge)(RESET2, reset), {
2554
2682
  html: {
2555
2683
  position: "absolute",
2556
2684
  // overflow: 'hidden',
@@ -2589,7 +2717,7 @@ var applyReset = (reset = {}) => {
2589
2717
  };
2590
2718
 
2591
2719
  // src/transforms/index.js
2592
- var import_utils25 = __toESM(require_cjs4(), 1);
2720
+ var import_utils26 = __toESM(require_cjs4(), 1);
2593
2721
  var isBorderStyle = (str) => [
2594
2722
  "none",
2595
2723
  "hidden",
@@ -2660,7 +2788,7 @@ var transformBackgroundImage = (backgroundImage, globalTheme) => {
2660
2788
  return v;
2661
2789
  }).join(" ");
2662
2790
  };
2663
- var transfromGap = (gap) => (0, import_utils25.isString)(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
2791
+ var transfromGap = (gap) => (0, import_utils26.isString)(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
2664
2792
  var transformTransition = (transition) => {
2665
2793
  const arr = transition.split(" ");
2666
2794
  if (!arr.length)
@@ -2678,7 +2806,7 @@ var transformTransition = (transition) => {
2678
2806
  }).join(" ");
2679
2807
  };
2680
2808
  var transformDuration = (duration, props, propertyName) => {
2681
- if (!(0, import_utils25.isString)(duration))
2809
+ if (!(0, import_utils26.isString)(duration))
2682
2810
  return;
2683
2811
  return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
2684
2812
  };
@@ -2690,9 +2818,9 @@ var splitTransition = (transition) => {
2690
2818
  };
2691
2819
 
2692
2820
  // src/set.js
2693
- var import_utils26 = __toESM(require_cjs4(), 1);
2821
+ var import_utils27 = __toESM(require_cjs4(), 1);
2694
2822
  var setCases = (val, key) => {
2695
- if ((0, import_utils26.isFunction)(val))
2823
+ if ((0, import_utils27.isFunction)(val))
2696
2824
  return val();
2697
2825
  return val;
2698
2826
  };