@symbo.ls/scratch 2.11.55 → 2.11.92

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.
@@ -56,13 +56,13 @@ var require_cjs = __commonJS({
56
56
  document: () => document3,
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 document3 = window3.document;
64
+ var window2 = globalThis;
65
+ var document3 = window2.document;
66
66
  }
67
67
  });
68
68
 
@@ -360,10 +360,10 @@ var require_types = __commonJS({
360
360
  isFunction: () => isFunction,
361
361
  isNot: () => isNot,
362
362
  isNull: () => isNull,
363
- isNumber: () => isNumber,
363
+ isNumber: () => isNumber2,
364
364
  isObject: () => isObject4,
365
365
  isObjectLike: () => isObjectLike2,
366
- isString: () => isString4,
366
+ isString: () => isString5,
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 isString4 = (arg) => typeof arg === "string";
380
- var isNumber = (arg) => typeof arg === "number";
379
+ var isString5 = (arg) => typeof arg === "string";
380
+ var isNumber2 = (arg) => typeof arg === "number";
381
381
  var isFunction = (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 isObject4(arg) || isObjectLike2(arg) || isString4(arg) || isNumber(arg) || isFunction(arg) || isArray4(arg) || isObjectLike2(arg) || isBoolean(arg) || isNull(arg);
391
+ return isObject4(arg) || isObjectLike2(arg) || isString5(arg) || isNumber2(arg) || isFunction(arg) || isArray4(arg) || isObjectLike2(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: isArray4,
399
399
  object: isObject4,
400
- string: isString4,
401
- number: isNumber,
400
+ string: isString5,
401
+ number: isNumber2,
402
402
  null: isNull,
403
403
  function: isFunction,
404
404
  objectLike: isObjectLike2,
@@ -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: () => merge,
526
596
  mergeArrayExclude: () => mergeArrayExclude,
527
597
  mergeIfExisted: () => mergeIfExisted,
598
+ objectToString: () => objectToString,
528
599
  overwrite: () => overwrite,
529
600
  overwriteDeep: () => overwriteDeep,
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_globals2 = 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 merge = (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 deepMerge2 = (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_globals2.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 overwriteDeep = (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
 
@@ -989,6 +1107,7 @@ __export(utils_exports, {
989
1107
  getFontFaceEachString: () => getFontFaceEachString,
990
1108
  getFontFaceString: () => getFontFaceString,
991
1109
  getFontFormat: () => getFontFormat,
1110
+ getRgbTone: () => getRgbTone,
992
1111
  getSequenceValue: () => getSequenceValue,
993
1112
  getSequenceValuePropertyPair: () => getSequenceValuePropertyPair,
994
1113
  hexToRgb: () => hexToRgb,
@@ -1013,6 +1132,7 @@ module.exports = __toCommonJS(utils_exports);
1013
1132
 
1014
1133
  // src/utils/color.js
1015
1134
  var import_globals = __toESM(require_cjs(), 1);
1135
+ var import_utils = __toESM(require_cjs4(), 1);
1016
1136
  var ENV = "development";
1017
1137
  var colorStringToRgbaArray = (color) => {
1018
1138
  if (color === "")
@@ -1065,7 +1185,7 @@ var hexToRgbArray = (hex, alpha = 1) => {
1065
1185
  return [r, g, b];
1066
1186
  };
1067
1187
  var rgbToHex = (r, g, b) => {
1068
- return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
1188
+ return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1);
1069
1189
  };
1070
1190
  var rgbArrayToHex = ([r, g, b]) => {
1071
1191
  return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
@@ -1117,7 +1237,7 @@ var getColorShade = (col, amt) => {
1117
1237
  g = 255;
1118
1238
  else if (g < 0)
1119
1239
  g = 0;
1120
- return (g | b << 8 | r << 16).toString(16);
1240
+ return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
1121
1241
  };
1122
1242
  var mixTwoRgba = (colorA, colorB, range = 0.5) => {
1123
1243
  const arr = [];
@@ -1139,6 +1259,24 @@ var opacify = (color, opacity) => {
1139
1259
  arr[3] = opacity;
1140
1260
  return `rgba(${arr})`;
1141
1261
  };
1262
+ var getRgbTone = (rgb, tone) => {
1263
+ if ((0, import_utils.isString)(rgb))
1264
+ rgb = rgb.split(", ").map((v) => parseFloat(v));
1265
+ if ((0, import_utils.isNumber)(tone))
1266
+ tone += "";
1267
+ const toHex = rgbArrayToHex(rgb);
1268
+ const abs = tone.slice(0, 1);
1269
+ if (abs === "-" || abs === "+") {
1270
+ const colorShade = getColorShade(toHex, parseFloat(tone));
1271
+ return hexToRgbArray(colorShade).join(", ");
1272
+ } else {
1273
+ const [r, g, b] = rgb;
1274
+ const hsl = rgbToHSL(r, g, b);
1275
+ const [h, s, l] = hsl;
1276
+ const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
1277
+ return newRgb;
1278
+ }
1279
+ };
1142
1280
 
1143
1281
  // src/utils/theme.js
1144
1282
  var returnSubThemeOrDefault = (orig, theme) => {
@@ -1193,19 +1331,19 @@ var getFontFaceString = (LIBRARY) => {
1193
1331
  };
1194
1332
 
1195
1333
  // src/utils/sequence.js
1196
- var import_utils4 = __toESM(require_cjs4(), 1);
1334
+ var import_utils5 = __toESM(require_cjs4(), 1);
1197
1335
 
1198
1336
  // ../utils/src/index.js
1199
- var import_utils2 = __toESM(require_cjs4());
1337
+ var import_utils3 = __toESM(require_cjs4());
1200
1338
 
1201
1339
  // ../utils/src/scaling.js
1202
- var import_utils = __toESM(require_cjs4());
1340
+ var import_utils2 = __toESM(require_cjs4());
1203
1341
 
1204
1342
  // ../utils/src/index.js
1205
- var toDashCase = (val) => val.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()).replace(".", "-");
1343
+ var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
1206
1344
 
1207
1345
  // src/factory.js
1208
- var import_utils3 = __toESM(require_cjs4(), 1);
1346
+ var import_utils4 = __toESM(require_cjs4(), 1);
1209
1347
 
1210
1348
  // src/defaultConfig/index.js
1211
1349
  var defaultConfig_exports = {};
@@ -1414,7 +1552,7 @@ var CONFIG = {
1414
1552
  CSS_VARS,
1415
1553
  ...defaultConfig_exports
1416
1554
  };
1417
- var cachedConfig = (0, import_utils3.deepClone)(CONFIG);
1555
+ var cachedConfig = (0, import_utils4.deepClone)(CONFIG);
1418
1556
  var FACTORY = {
1419
1557
  active: "0",
1420
1558
  0: CONFIG
@@ -1530,7 +1668,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
1530
1668
  unit = UNIT2.default,
1531
1669
  useVariable
1532
1670
  } = sequenceProps;
1533
- if ((0, import_utils4.isString)(value) && value.slice(0, 2) === "--")
1671
+ if ((0, import_utils5.isString)(value) && value.slice(0, 2) === "--")
1534
1672
  return `var(${value})`;
1535
1673
  const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
1536
1674
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
@@ -1593,11 +1731,11 @@ var findHeadings = (propertyNames) => {
1593
1731
  };
1594
1732
 
1595
1733
  // src/utils/var.js
1596
- var import_utils6 = __toESM(require_cjs4(), 1);
1734
+ var import_utils7 = __toESM(require_cjs4(), 1);
1597
1735
  var setVariables = (result, key) => {
1598
1736
  const CONFIG2 = getActiveConfig();
1599
1737
  const { CSS_VARS: CSS_VARS2 } = CONFIG2;
1600
- if ((0, import_utils6.isObjectLike)(result.value)) {
1738
+ if ((0, import_utils7.isObjectLike)(result.value)) {
1601
1739
  } else {
1602
1740
  CSS_VARS2[result.var] = result.value;
1603
1741
  }
@@ -1633,7 +1771,7 @@ var applySequenceVars = (props, mediaName, options = {}) => {
1633
1771
  };
1634
1772
 
1635
1773
  // src/utils/sprite.js
1636
- var import_utils7 = __toESM(require_cjs4(), 1);
1774
+ var import_utils8 = __toESM(require_cjs4(), 1);
1637
1775
  var generateSprite = (icons) => {
1638
1776
  const CONFIG2 = getActiveConfig();
1639
1777
  let sprite = "";
@@ -1647,7 +1785,7 @@ var generateSprite = (icons) => {
1647
1785
  return sprite;
1648
1786
  };
1649
1787
  var parseRootAttributes = (htmlString) => {
1650
- if (!(0, import_utils7.isString)(htmlString)) {
1788
+ if (!(0, import_utils8.isString)(htmlString)) {
1651
1789
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1652
1790
  }
1653
1791
  const match = htmlString.match(/<svg\s+(.*?)>/);
@@ -1667,7 +1805,7 @@ var replaceIdsAndUrls = (code, key) => {
1667
1805
  const urlRegex = /url\(#([^)]*)\)/g;
1668
1806
  const matches = code.match(/id="([^"]*)"/g);
1669
1807
  let replacedCode = code;
1670
- if ((0, import_utils7.isArray)(matches)) {
1808
+ if ((0, import_utils8.isArray)(matches)) {
1671
1809
  matches.forEach(() => {
1672
1810
  const randomKey = Math.floor(Math.random() * 1e5);
1673
1811
  replacedCode = code.replace(idRegex, `id="${key}-${randomKey}"`).replace(urlRegex, `url(#${key}-${randomKey})`);