@symbo.ls/scratch 2.11.375 → 2.11.394

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.
@@ -293,6 +293,7 @@ var require_array = __commonJS({
293
293
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
294
294
  var array_exports = {};
295
295
  __export2(array_exports, {
296
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
296
297
  arrayContainsOtherArray: () => arrayContainsOtherArray,
297
298
  createNestedObject: () => createNestedObject,
298
299
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -304,6 +305,7 @@ var require_array = __commonJS({
304
305
  removeFromArray: () => removeFromArray,
305
306
  removeValueFromArray: () => removeValueFromArray,
306
307
  removeValueFromArrayAll: () => removeValueFromArrayAll,
308
+ reorderArrayByValues: () => reorderArrayByValues,
307
309
  swapItemsInArray: () => swapItemsInArray
308
310
  });
309
311
  module2.exports = __toCommonJS2(array_exports);
@@ -388,6 +390,27 @@ var require_array = __commonJS({
388
390
  var removeValueFromArrayAll = (arr, value) => {
389
391
  return arr.filter((item) => item !== value);
390
392
  };
393
+ var addItemAfterEveryElement = (array, item) => {
394
+ const result = [];
395
+ for (let i = 0; i < array.length; i++) {
396
+ result.push(array[i]);
397
+ if (i < array.length - 1) {
398
+ result.push(item);
399
+ }
400
+ }
401
+ return result;
402
+ };
403
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
404
+ const newArray = [...array];
405
+ const indexToMove = newArray.indexOf(valueToMove);
406
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
407
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
408
+ const removedItem = newArray.splice(indexToMove, 1)[0];
409
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
410
+ newArray.splice(insertIndex, 0, removedItem);
411
+ }
412
+ return newArray;
413
+ };
391
414
  }
392
415
  });
393
416
 
@@ -664,7 +687,7 @@ var require_object = __commonJS({
664
687
  }
665
688
  return stringified;
666
689
  };
667
- var objectToString = (obj, indent = 0) => {
690
+ var objectToString = (obj = {}, indent = 0) => {
668
691
  const spaces = " ".repeat(indent);
669
692
  let str = "{\n";
670
693
  for (const [key, value] of Object.entries(obj)) {
@@ -731,7 +754,7 @@ var require_object = __commonJS({
731
754
  continue;
732
755
  const objProp = obj[prop];
733
756
  if ((0, import_types.isString)(objProp)) {
734
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
757
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
735
758
  try {
736
759
  const evalProp = import_globals.window.eval(`(${objProp})`);
737
760
  destringified[prop] = evalProp;
@@ -1119,20 +1142,21 @@ var require_cookie = __commonJS({
1119
1142
  });
1120
1143
  module2.exports = __toCommonJS2(cookie_exports);
1121
1144
  var import_types = require_types();
1145
+ var import_utils4 = require_cjs();
1122
1146
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1123
1147
  var setCookie = (cname, cvalue, exdays = 365) => {
1124
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1148
+ if ((0, import_types.isUndefined)(import_utils4.document) || (0, import_types.isUndefined)(import_utils4.document.cookie))
1125
1149
  return;
1126
1150
  const d = /* @__PURE__ */ new Date();
1127
1151
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1128
1152
  const expires = `expires=${d.toUTCString()}`;
1129
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
1153
+ import_utils4.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1130
1154
  };
1131
1155
  var getCookie = (cname) => {
1132
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1156
+ if ((0, import_types.isUndefined)(import_utils4.document) || (0, import_types.isUndefined)(import_utils4.document.cookie))
1133
1157
  return;
1134
1158
  const name = `${cname}=`;
1135
- const decodedCookie = decodeURIComponent(document.cookie);
1159
+ const decodedCookie = decodeURIComponent(import_utils4.document.cookie);
1136
1160
  const ca = decodedCookie.split(";");
1137
1161
  for (let i = 0; i < ca.length; i++) {
1138
1162
  let c = ca[i];
@@ -1635,6 +1659,7 @@ var require_cjs2 = __commonJS({
1635
1659
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
1636
1660
  var array_exports = {};
1637
1661
  __export22(array_exports, {
1662
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
1638
1663
  arrayContainsOtherArray: () => arrayContainsOtherArray,
1639
1664
  createNestedObject: () => createNestedObject,
1640
1665
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -1646,6 +1671,7 @@ var require_cjs2 = __commonJS({
1646
1671
  removeFromArray: () => removeFromArray,
1647
1672
  removeValueFromArray: () => removeValueFromArray,
1648
1673
  removeValueFromArrayAll: () => removeValueFromArrayAll,
1674
+ reorderArrayByValues: () => reorderArrayByValues,
1649
1675
  swapItemsInArray: () => swapItemsInArray
1650
1676
  });
1651
1677
  module22.exports = __toCommonJS22(array_exports);
@@ -1730,6 +1756,27 @@ var require_cjs2 = __commonJS({
1730
1756
  var removeValueFromArrayAll = (arr, value) => {
1731
1757
  return arr.filter((item) => item !== value);
1732
1758
  };
1759
+ var addItemAfterEveryElement = (array, item) => {
1760
+ const result = [];
1761
+ for (let i = 0; i < array.length; i++) {
1762
+ result.push(array[i]);
1763
+ if (i < array.length - 1) {
1764
+ result.push(item);
1765
+ }
1766
+ }
1767
+ return result;
1768
+ };
1769
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
1770
+ const newArray = [...array];
1771
+ const indexToMove = newArray.indexOf(valueToMove);
1772
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
1773
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
1774
+ const removedItem = newArray.splice(indexToMove, 1)[0];
1775
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
1776
+ newArray.splice(insertIndex, 0, removedItem);
1777
+ }
1778
+ return newArray;
1779
+ };
1733
1780
  }
1734
1781
  });
1735
1782
  var require_string2 = __commonJS2({
@@ -2002,7 +2049,7 @@ var require_cjs2 = __commonJS({
2002
2049
  }
2003
2050
  return stringified;
2004
2051
  };
2005
- var objectToString = (obj, indent = 0) => {
2052
+ var objectToString = (obj = {}, indent = 0) => {
2006
2053
  const spaces = " ".repeat(indent);
2007
2054
  let str = "{\n";
2008
2055
  for (const [key, value] of Object.entries(obj)) {
@@ -2069,7 +2116,7 @@ var require_cjs2 = __commonJS({
2069
2116
  continue;
2070
2117
  const objProp = obj[prop];
2071
2118
  if ((0, import_types.isString)(objProp)) {
2072
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2119
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2073
2120
  try {
2074
2121
  const evalProp = import_globals.window.eval(`(${objProp})`);
2075
2122
  destringified[prop] = evalProp;
@@ -2451,20 +2498,21 @@ var require_cjs2 = __commonJS({
2451
2498
  });
2452
2499
  module22.exports = __toCommonJS22(cookie_exports);
2453
2500
  var import_types = require_types2();
2501
+ var import_utils32 = require_cjs3();
2454
2502
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
2455
2503
  var setCookie = (cname, cvalue, exdays = 365) => {
2456
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
2504
+ if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
2457
2505
  return;
2458
2506
  const d = /* @__PURE__ */ new Date();
2459
2507
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
2460
2508
  const expires = `expires=${d.toUTCString()}`;
2461
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
2509
+ import_utils32.document.cookie = `${cname}=${cvalue};${expires};path=/`;
2462
2510
  };
2463
2511
  var getCookie = (cname) => {
2464
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
2512
+ if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
2465
2513
  return;
2466
2514
  const name = `${cname}=`;
2467
- const decodedCookie = decodeURIComponent(document.cookie);
2515
+ const decodedCookie = decodeURIComponent(import_utils32.document.cookie);
2468
2516
  const ca = decodedCookie.split(";");
2469
2517
  for (let i = 0; i < ca.length; i++) {
2470
2518
  let c = ca[i];
@@ -2684,6 +2732,7 @@ var require_cjs2 = __commonJS({
2684
2732
  findClosestNumber: () => findClosestNumber,
2685
2733
  findClosestNumberInFactory: () => findClosestNumberInFactory,
2686
2734
  formatDate: () => formatDate,
2735
+ loadJavascript: () => loadJavascript,
2687
2736
  loadJavascriptFile: () => loadJavascriptFile,
2688
2737
  removeChars: () => removeChars,
2689
2738
  toCamelCase: () => toCamelCase,
@@ -2755,6 +2804,17 @@ var require_cjs2 = __commonJS({
2755
2804
  }
2756
2805
  });
2757
2806
  };
2807
+ var loadJavascript = (body, async = true, doc = document, type = "text/javascript") => {
2808
+ try {
2809
+ const scriptEle = doc.createElement("script");
2810
+ scriptEle.type = type;
2811
+ scriptEle.async = async;
2812
+ scriptEle.innerHTML = body;
2813
+ doc.body.appendChild(scriptEle);
2814
+ } catch (error) {
2815
+ console.warn(error);
2816
+ }
2817
+ };
2758
2818
  var copyStringToClipboard = (str) => {
2759
2819
  const el = document.createElement("textarea");
2760
2820
  el.value = str;
@@ -2781,6 +2841,8 @@ var require_cjs2 = __commonJS({
2781
2841
  );
2782
2842
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
2783
2843
  var toDescriptionCase = (str = "") => {
2844
+ if (typeof str !== "string")
2845
+ return;
2784
2846
  const result = str.replace(/([A-Z])/g, " $1");
2785
2847
  return result.charAt(0).toUpperCase() + result.slice(1);
2786
2848
  };
@@ -2837,6 +2899,7 @@ __export(defaultConfig_exports, {
2837
2899
  ICONS: () => ICONS,
2838
2900
  MEDIA: () => MEDIA,
2839
2901
  RESET: () => RESET,
2902
+ SEMANTIC_ICONS: () => SEMANTIC_ICONS,
2840
2903
  SEQUENCE: () => SEQUENCE,
2841
2904
  SHADOW: () => SHADOW,
2842
2905
  SPACING: () => SPACING,
@@ -2948,6 +3011,7 @@ var SHADOW = {};
2948
3011
 
2949
3012
  // src/defaultConfig/icons.js
2950
3013
  var ICONS = {};
3014
+ var SEMANTIC_ICONS = {};
2951
3015
 
2952
3016
  // src/defaultConfig/timing.js
2953
3017
  var defaultProps3 = {
@@ -3028,7 +3092,7 @@ var FACTORY = {
3028
3092
  0: CONFIG
3029
3093
  };
3030
3094
  var getActiveConfig = (def) => {
3031
- return FACTORY[def || FACTORY.active];
3095
+ return FACTORY[def || FACTORY.active] || CONFIG;
3032
3096
  };
3033
3097
 
3034
3098
  // src/utils/unit.js
@@ -130,7 +130,7 @@ var require_globals = __commonJS({
130
130
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
131
131
  var globals_exports = {};
132
132
  __export2(globals_exports, {
133
- document: () => document2,
133
+ document: () => document,
134
134
  global: () => global,
135
135
  self: () => self,
136
136
  window: () => window
@@ -139,7 +139,7 @@ var require_globals = __commonJS({
139
139
  var global = globalThis;
140
140
  var self = globalThis;
141
141
  var window = globalThis;
142
- var document2 = window.document;
142
+ var document = window.document;
143
143
  }
144
144
  });
145
145
 
@@ -293,6 +293,7 @@ var require_array = __commonJS({
293
293
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
294
294
  var array_exports = {};
295
295
  __export2(array_exports, {
296
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
296
297
  arrayContainsOtherArray: () => arrayContainsOtherArray,
297
298
  createNestedObject: () => createNestedObject,
298
299
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -304,6 +305,7 @@ var require_array = __commonJS({
304
305
  removeFromArray: () => removeFromArray,
305
306
  removeValueFromArray: () => removeValueFromArray,
306
307
  removeValueFromArrayAll: () => removeValueFromArrayAll,
308
+ reorderArrayByValues: () => reorderArrayByValues,
307
309
  swapItemsInArray: () => swapItemsInArray
308
310
  });
309
311
  module2.exports = __toCommonJS2(array_exports);
@@ -388,6 +390,27 @@ var require_array = __commonJS({
388
390
  var removeValueFromArrayAll = (arr, value) => {
389
391
  return arr.filter((item) => item !== value);
390
392
  };
393
+ var addItemAfterEveryElement = (array, item) => {
394
+ const result = [];
395
+ for (let i = 0; i < array.length; i++) {
396
+ result.push(array[i]);
397
+ if (i < array.length - 1) {
398
+ result.push(item);
399
+ }
400
+ }
401
+ return result;
402
+ };
403
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
404
+ const newArray = [...array];
405
+ const indexToMove = newArray.indexOf(valueToMove);
406
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
407
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
408
+ const removedItem = newArray.splice(indexToMove, 1)[0];
409
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
410
+ newArray.splice(insertIndex, 0, removedItem);
411
+ }
412
+ return newArray;
413
+ };
391
414
  }
392
415
  });
393
416
 
@@ -664,7 +687,7 @@ var require_object = __commonJS({
664
687
  }
665
688
  return stringified;
666
689
  };
667
- var objectToString = (obj, indent = 0) => {
690
+ var objectToString = (obj = {}, indent = 0) => {
668
691
  const spaces = " ".repeat(indent);
669
692
  let str = "{\n";
670
693
  for (const [key, value] of Object.entries(obj)) {
@@ -731,7 +754,7 @@ var require_object = __commonJS({
731
754
  continue;
732
755
  const objProp = obj[prop];
733
756
  if ((0, import_types.isString)(objProp)) {
734
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
757
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
735
758
  try {
736
759
  const evalProp = import_globals.window.eval(`(${objProp})`);
737
760
  destringified[prop] = evalProp;
@@ -1119,20 +1142,21 @@ var require_cookie = __commonJS({
1119
1142
  });
1120
1143
  module2.exports = __toCommonJS2(cookie_exports);
1121
1144
  var import_types = require_types();
1145
+ var import_utils3 = require_cjs();
1122
1146
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1123
1147
  var setCookie = (cname, cvalue, exdays = 365) => {
1124
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1148
+ if ((0, import_types.isUndefined)(import_utils3.document) || (0, import_types.isUndefined)(import_utils3.document.cookie))
1125
1149
  return;
1126
1150
  const d = /* @__PURE__ */ new Date();
1127
1151
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1128
1152
  const expires = `expires=${d.toUTCString()}`;
1129
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
1153
+ import_utils3.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1130
1154
  };
1131
1155
  var getCookie = (cname) => {
1132
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1156
+ if ((0, import_types.isUndefined)(import_utils3.document) || (0, import_types.isUndefined)(import_utils3.document.cookie))
1133
1157
  return;
1134
1158
  const name = `${cname}=`;
1135
- const decodedCookie = decodeURIComponent(document.cookie);
1159
+ const decodedCookie = decodeURIComponent(import_utils3.document.cookie);
1136
1160
  const ca = decodedCookie.split(";");
1137
1161
  for (let i = 0; i < ca.length; i++) {
1138
1162
  let c = ca[i];
@@ -1379,6 +1403,7 @@ __export(defaultConfig_exports, {
1379
1403
  ICONS: () => ICONS,
1380
1404
  MEDIA: () => MEDIA,
1381
1405
  RESET: () => RESET,
1406
+ SEMANTIC_ICONS: () => SEMANTIC_ICONS,
1382
1407
  SEQUENCE: () => SEQUENCE,
1383
1408
  SHADOW: () => SHADOW,
1384
1409
  SPACING: () => SPACING,
@@ -1490,6 +1515,7 @@ var SHADOW = {};
1490
1515
 
1491
1516
  // src/defaultConfig/icons.js
1492
1517
  var ICONS = {};
1518
+ var SEMANTIC_ICONS = {};
1493
1519
 
1494
1520
  // src/defaultConfig/timing.js
1495
1521
  var defaultProps3 = {
@@ -1570,7 +1596,7 @@ var FACTORY = {
1570
1596
  0: CONFIG
1571
1597
  };
1572
1598
  var getActiveConfig = (def) => {
1573
- return FACTORY[def || FACTORY.active];
1599
+ return FACTORY[def || FACTORY.active] || CONFIG;
1574
1600
  };
1575
1601
 
1576
1602
  // src/utils/sprite.js
@@ -293,6 +293,7 @@ var require_array = __commonJS({
293
293
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
294
294
  var array_exports = {};
295
295
  __export2(array_exports, {
296
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
296
297
  arrayContainsOtherArray: () => arrayContainsOtherArray,
297
298
  createNestedObject: () => createNestedObject,
298
299
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -304,6 +305,7 @@ var require_array = __commonJS({
304
305
  removeFromArray: () => removeFromArray,
305
306
  removeValueFromArray: () => removeValueFromArray,
306
307
  removeValueFromArrayAll: () => removeValueFromArrayAll,
308
+ reorderArrayByValues: () => reorderArrayByValues,
307
309
  swapItemsInArray: () => swapItemsInArray
308
310
  });
309
311
  module2.exports = __toCommonJS2(array_exports);
@@ -388,6 +390,27 @@ var require_array = __commonJS({
388
390
  var removeValueFromArrayAll = (arr, value) => {
389
391
  return arr.filter((item) => item !== value);
390
392
  };
393
+ var addItemAfterEveryElement = (array, item) => {
394
+ const result = [];
395
+ for (let i = 0; i < array.length; i++) {
396
+ result.push(array[i]);
397
+ if (i < array.length - 1) {
398
+ result.push(item);
399
+ }
400
+ }
401
+ return result;
402
+ };
403
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
404
+ const newArray = [...array];
405
+ const indexToMove = newArray.indexOf(valueToMove);
406
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
407
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
408
+ const removedItem = newArray.splice(indexToMove, 1)[0];
409
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
410
+ newArray.splice(insertIndex, 0, removedItem);
411
+ }
412
+ return newArray;
413
+ };
391
414
  }
392
415
  });
393
416
 
@@ -664,7 +687,7 @@ var require_object = __commonJS({
664
687
  }
665
688
  return stringified;
666
689
  };
667
- var objectToString = (obj, indent = 0) => {
690
+ var objectToString = (obj = {}, indent = 0) => {
668
691
  const spaces = " ".repeat(indent);
669
692
  let str = "{\n";
670
693
  for (const [key, value] of Object.entries(obj)) {
@@ -731,7 +754,7 @@ var require_object = __commonJS({
731
754
  continue;
732
755
  const objProp = obj[prop];
733
756
  if ((0, import_types.isString)(objProp)) {
734
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
757
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
735
758
  try {
736
759
  const evalProp = import_globals.window.eval(`(${objProp})`);
737
760
  destringified[prop] = evalProp;
@@ -1119,20 +1142,21 @@ var require_cookie = __commonJS({
1119
1142
  });
1120
1143
  module2.exports = __toCommonJS2(cookie_exports);
1121
1144
  var import_types = require_types();
1145
+ var import_utils5 = require_cjs();
1122
1146
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
1123
1147
  var setCookie = (cname, cvalue, exdays = 365) => {
1124
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1148
+ if ((0, import_types.isUndefined)(import_utils5.document) || (0, import_types.isUndefined)(import_utils5.document.cookie))
1125
1149
  return;
1126
1150
  const d = /* @__PURE__ */ new Date();
1127
1151
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
1128
1152
  const expires = `expires=${d.toUTCString()}`;
1129
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
1153
+ import_utils5.document.cookie = `${cname}=${cvalue};${expires};path=/`;
1130
1154
  };
1131
1155
  var getCookie = (cname) => {
1132
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
1156
+ if ((0, import_types.isUndefined)(import_utils5.document) || (0, import_types.isUndefined)(import_utils5.document.cookie))
1133
1157
  return;
1134
1158
  const name = `${cname}=`;
1135
- const decodedCookie = decodeURIComponent(document.cookie);
1159
+ const decodedCookie = decodeURIComponent(import_utils5.document.cookie);
1136
1160
  const ca = decodedCookie.split(";");
1137
1161
  for (let i = 0; i < ca.length; i++) {
1138
1162
  let c = ca[i];
@@ -1635,6 +1659,7 @@ var require_cjs2 = __commonJS({
1635
1659
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
1636
1660
  var array_exports = {};
1637
1661
  __export22(array_exports, {
1662
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
1638
1663
  arrayContainsOtherArray: () => arrayContainsOtherArray,
1639
1664
  createNestedObject: () => createNestedObject,
1640
1665
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -1646,6 +1671,7 @@ var require_cjs2 = __commonJS({
1646
1671
  removeFromArray: () => removeFromArray,
1647
1672
  removeValueFromArray: () => removeValueFromArray,
1648
1673
  removeValueFromArrayAll: () => removeValueFromArrayAll,
1674
+ reorderArrayByValues: () => reorderArrayByValues,
1649
1675
  swapItemsInArray: () => swapItemsInArray
1650
1676
  });
1651
1677
  module22.exports = __toCommonJS22(array_exports);
@@ -1730,6 +1756,27 @@ var require_cjs2 = __commonJS({
1730
1756
  var removeValueFromArrayAll = (arr, value) => {
1731
1757
  return arr.filter((item) => item !== value);
1732
1758
  };
1759
+ var addItemAfterEveryElement = (array, item) => {
1760
+ const result = [];
1761
+ for (let i = 0; i < array.length; i++) {
1762
+ result.push(array[i]);
1763
+ if (i < array.length - 1) {
1764
+ result.push(item);
1765
+ }
1766
+ }
1767
+ return result;
1768
+ };
1769
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
1770
+ const newArray = [...array];
1771
+ const indexToMove = newArray.indexOf(valueToMove);
1772
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
1773
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
1774
+ const removedItem = newArray.splice(indexToMove, 1)[0];
1775
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
1776
+ newArray.splice(insertIndex, 0, removedItem);
1777
+ }
1778
+ return newArray;
1779
+ };
1733
1780
  }
1734
1781
  });
1735
1782
  var require_string2 = __commonJS2({
@@ -2002,7 +2049,7 @@ var require_cjs2 = __commonJS({
2002
2049
  }
2003
2050
  return stringified;
2004
2051
  };
2005
- var objectToString = (obj, indent = 0) => {
2052
+ var objectToString = (obj = {}, indent = 0) => {
2006
2053
  const spaces = " ".repeat(indent);
2007
2054
  let str = "{\n";
2008
2055
  for (const [key, value] of Object.entries(obj)) {
@@ -2069,7 +2116,7 @@ var require_cjs2 = __commonJS({
2069
2116
  continue;
2070
2117
  const objProp = obj[prop];
2071
2118
  if ((0, import_types.isString)(objProp)) {
2072
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2119
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2073
2120
  try {
2074
2121
  const evalProp = import_globals.window.eval(`(${objProp})`);
2075
2122
  destringified[prop] = evalProp;
@@ -2451,20 +2498,21 @@ var require_cjs2 = __commonJS({
2451
2498
  });
2452
2499
  module22.exports = __toCommonJS22(cookie_exports);
2453
2500
  var import_types = require_types2();
2501
+ var import_utils32 = require_cjs3();
2454
2502
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
2455
2503
  var setCookie = (cname, cvalue, exdays = 365) => {
2456
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
2504
+ if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
2457
2505
  return;
2458
2506
  const d = /* @__PURE__ */ new Date();
2459
2507
  d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1e3);
2460
2508
  const expires = `expires=${d.toUTCString()}`;
2461
- document.cookie = `${cname}=${cvalue};${expires};path=/`;
2509
+ import_utils32.document.cookie = `${cname}=${cvalue};${expires};path=/`;
2462
2510
  };
2463
2511
  var getCookie = (cname) => {
2464
- if ((0, import_types.isUndefined)(document) || (0, import_types.isUndefined)(document.cookie))
2512
+ if ((0, import_types.isUndefined)(import_utils32.document) || (0, import_types.isUndefined)(import_utils32.document.cookie))
2465
2513
  return;
2466
2514
  const name = `${cname}=`;
2467
- const decodedCookie = decodeURIComponent(document.cookie);
2515
+ const decodedCookie = decodeURIComponent(import_utils32.document.cookie);
2468
2516
  const ca = decodedCookie.split(";");
2469
2517
  for (let i = 0; i < ca.length; i++) {
2470
2518
  let c = ca[i];
@@ -2684,6 +2732,7 @@ var require_cjs2 = __commonJS({
2684
2732
  findClosestNumber: () => findClosestNumber,
2685
2733
  findClosestNumberInFactory: () => findClosestNumberInFactory,
2686
2734
  formatDate: () => formatDate,
2735
+ loadJavascript: () => loadJavascript,
2687
2736
  loadJavascriptFile: () => loadJavascriptFile,
2688
2737
  removeChars: () => removeChars,
2689
2738
  toCamelCase: () => toCamelCase,
@@ -2755,6 +2804,17 @@ var require_cjs2 = __commonJS({
2755
2804
  }
2756
2805
  });
2757
2806
  };
2807
+ var loadJavascript = (body, async = true, doc = document, type = "text/javascript") => {
2808
+ try {
2809
+ const scriptEle = doc.createElement("script");
2810
+ scriptEle.type = type;
2811
+ scriptEle.async = async;
2812
+ scriptEle.innerHTML = body;
2813
+ doc.body.appendChild(scriptEle);
2814
+ } catch (error) {
2815
+ console.warn(error);
2816
+ }
2817
+ };
2758
2818
  var copyStringToClipboard = (str) => {
2759
2819
  const el = document.createElement("textarea");
2760
2820
  el.value = str;
@@ -2781,6 +2841,8 @@ var require_cjs2 = __commonJS({
2781
2841
  );
2782
2842
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
2783
2843
  var toDescriptionCase = (str = "") => {
2844
+ if (typeof str !== "string")
2845
+ return;
2784
2846
  const result = str.replace(/([A-Z])/g, " $1");
2785
2847
  return result.charAt(0).toUpperCase() + result.slice(1);
2786
2848
  };
@@ -2829,6 +2891,7 @@ __export(defaultConfig_exports, {
2829
2891
  ICONS: () => ICONS,
2830
2892
  MEDIA: () => MEDIA,
2831
2893
  RESET: () => RESET,
2894
+ SEMANTIC_ICONS: () => SEMANTIC_ICONS,
2832
2895
  SEQUENCE: () => SEQUENCE,
2833
2896
  SHADOW: () => SHADOW,
2834
2897
  SPACING: () => SPACING,
@@ -2940,6 +3003,7 @@ var SHADOW = {};
2940
3003
 
2941
3004
  // src/defaultConfig/icons.js
2942
3005
  var ICONS = {};
3006
+ var SEMANTIC_ICONS = {};
2943
3007
 
2944
3008
  // src/defaultConfig/timing.js
2945
3009
  var defaultProps3 = {
@@ -3020,7 +3084,7 @@ var FACTORY = {
3020
3084
  0: CONFIG
3021
3085
  };
3022
3086
  var getActiveConfig = (def) => {
3023
- return FACTORY[def || FACTORY.active];
3087
+ return FACTORY[def || FACTORY.active] || CONFIG;
3024
3088
  };
3025
3089
 
3026
3090
  // src/utils/sequence.js
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "2.11.375",
5
+ "version": "2.11.394",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -30,5 +30,5 @@
30
30
  "@symbo.ls/utils": "latest",
31
31
  "color-contrast-checker": "^1.5.0"
32
32
  },
33
- "gitHead": "4fddad68b778dbfd8298ac6ca8d500bdabbb2282"
33
+ "gitHead": "96fc31e44dd43084955c647e91b5d0e70d56aee8"
34
34
  }
@@ -1,3 +1,4 @@
1
1
  'use strict'
2
2
 
3
3
  export const ICONS = {}
4
+ export const SEMANTIC_ICONS = {}
package/src/factory.js CHANGED
@@ -30,7 +30,7 @@ export const activateConfig = (def) => {
30
30
  }
31
31
 
32
32
  export const getActiveConfig = (def) => {
33
- return FACTORY[def || FACTORY.active]
33
+ return FACTORY[def || FACTORY.active] || CONFIG
34
34
  }
35
35
 
36
36
  export const setActiveConfig = (newConfig) => {
package/src/set.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  setFont,
8
8
  setFontFamily,
9
9
  setTheme,
10
- setIcon,
10
+ setSvgIcon,
11
11
  setSVG,
12
12
  applyTypographySequence,
13
13
  applySpacingSequence,
@@ -32,7 +32,8 @@ export const VALUE_TRANSFORMERS = {
32
32
  font: setFont,
33
33
  font_family: setFontFamily,
34
34
  theme: setTheme,
35
- icons: setIcon,
35
+ icons: setSvgIcon,
36
+ semantic_icons: setSameValue,
36
37
  svg: setSVG,
37
38
  svg_data: setSameValue,
38
39
  typography: setSameValue,
@@ -94,6 +95,7 @@ export const set = (recivedConfig, options = SET_OPTIONS) => {
94
95
  globalTheme,
95
96
  useDocumentTheme,
96
97
  useDefaultConfig,
98
+ SEMANTIC_ICONS,
97
99
  ...config
98
100
  } = recivedConfig
99
101
 
@@ -110,6 +112,7 @@ export const set = (recivedConfig, options = SET_OPTIONS) => {
110
112
  if (useDocumentTheme !== undefined) CONFIG.useDocumentTheme = useDocumentTheme
111
113
  if (globalTheme !== undefined) CONFIG.globalTheme = globalTheme
112
114
  if (useDefaultConfig !== undefined) CONFIG.useDefaultConfig = useDefaultConfig
115
+ if (SEMANTIC_ICONS !== undefined) CONFIG.SEMANTIC_ICONS = SEMANTIC_ICONS
113
116
  if (CONFIG.verbose) console.log(CONFIG)
114
117
 
115
118
  if (!CONFIG.__svg_cache) CONFIG.__svg_cache = {}
@@ -118,9 +121,9 @@ export const set = (recivedConfig, options = SET_OPTIONS) => {
118
121
  keys.map(key => setEach(key, config[key]))
119
122
 
120
123
  // apply generic configs
121
- applyTypographySequence()
122
- applySpacingSequence()
123
- applyTimingSequence()
124
+ if (config.TYPOGRAPHY) applyTypographySequence()
125
+ if (config.SPACING) applySpacingSequence()
126
+ if (config.TIMING) applyTimingSequence()
124
127
  applyDocument()
125
128
  applyReset()
126
129