@symbo.ls/scratch 2.11.373 → 2.11.389

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;
@@ -1635,6 +1658,7 @@ var require_cjs2 = __commonJS({
1635
1658
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
1636
1659
  var array_exports = {};
1637
1660
  __export22(array_exports, {
1661
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
1638
1662
  arrayContainsOtherArray: () => arrayContainsOtherArray,
1639
1663
  createNestedObject: () => createNestedObject,
1640
1664
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -1646,6 +1670,7 @@ var require_cjs2 = __commonJS({
1646
1670
  removeFromArray: () => removeFromArray,
1647
1671
  removeValueFromArray: () => removeValueFromArray,
1648
1672
  removeValueFromArrayAll: () => removeValueFromArrayAll,
1673
+ reorderArrayByValues: () => reorderArrayByValues,
1649
1674
  swapItemsInArray: () => swapItemsInArray
1650
1675
  });
1651
1676
  module22.exports = __toCommonJS22(array_exports);
@@ -1730,6 +1755,27 @@ var require_cjs2 = __commonJS({
1730
1755
  var removeValueFromArrayAll = (arr, value) => {
1731
1756
  return arr.filter((item) => item !== value);
1732
1757
  };
1758
+ var addItemAfterEveryElement = (array, item) => {
1759
+ const result = [];
1760
+ for (let i = 0; i < array.length; i++) {
1761
+ result.push(array[i]);
1762
+ if (i < array.length - 1) {
1763
+ result.push(item);
1764
+ }
1765
+ }
1766
+ return result;
1767
+ };
1768
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
1769
+ const newArray = [...array];
1770
+ const indexToMove = newArray.indexOf(valueToMove);
1771
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
1772
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
1773
+ const removedItem = newArray.splice(indexToMove, 1)[0];
1774
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
1775
+ newArray.splice(insertIndex, 0, removedItem);
1776
+ }
1777
+ return newArray;
1778
+ };
1733
1779
  }
1734
1780
  });
1735
1781
  var require_string2 = __commonJS2({
@@ -2002,7 +2048,7 @@ var require_cjs2 = __commonJS({
2002
2048
  }
2003
2049
  return stringified;
2004
2050
  };
2005
- var objectToString = (obj, indent = 0) => {
2051
+ var objectToString = (obj = {}, indent = 0) => {
2006
2052
  const spaces = " ".repeat(indent);
2007
2053
  let str = "{\n";
2008
2054
  for (const [key, value] of Object.entries(obj)) {
@@ -2069,7 +2115,7 @@ var require_cjs2 = __commonJS({
2069
2115
  continue;
2070
2116
  const objProp = obj[prop];
2071
2117
  if ((0, import_types.isString)(objProp)) {
2072
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2118
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2073
2119
  try {
2074
2120
  const evalProp = import_globals.window.eval(`(${objProp})`);
2075
2121
  destringified[prop] = evalProp;
@@ -2837,6 +2883,7 @@ __export(defaultConfig_exports, {
2837
2883
  ICONS: () => ICONS,
2838
2884
  MEDIA: () => MEDIA,
2839
2885
  RESET: () => RESET,
2886
+ SEMANTIC_ICONS: () => SEMANTIC_ICONS,
2840
2887
  SEQUENCE: () => SEQUENCE,
2841
2888
  SHADOW: () => SHADOW,
2842
2889
  SPACING: () => SPACING,
@@ -2948,6 +2995,7 @@ var SHADOW = {};
2948
2995
 
2949
2996
  // src/defaultConfig/icons.js
2950
2997
  var ICONS = {};
2998
+ var SEMANTIC_ICONS = {};
2951
2999
 
2952
3000
  // src/defaultConfig/timing.js
2953
3001
  var defaultProps3 = {
@@ -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;
@@ -1379,6 +1402,7 @@ __export(defaultConfig_exports, {
1379
1402
  ICONS: () => ICONS,
1380
1403
  MEDIA: () => MEDIA,
1381
1404
  RESET: () => RESET,
1405
+ SEMANTIC_ICONS: () => SEMANTIC_ICONS,
1382
1406
  SEQUENCE: () => SEQUENCE,
1383
1407
  SHADOW: () => SHADOW,
1384
1408
  SPACING: () => SPACING,
@@ -1490,6 +1514,7 @@ var SHADOW = {};
1490
1514
 
1491
1515
  // src/defaultConfig/icons.js
1492
1516
  var ICONS = {};
1517
+ var SEMANTIC_ICONS = {};
1493
1518
 
1494
1519
  // src/defaultConfig/timing.js
1495
1520
  var defaultProps3 = {
@@ -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;
@@ -1635,6 +1658,7 @@ var require_cjs2 = __commonJS({
1635
1658
  var __toCommonJS22 = (mod) => __copyProps22(__defProp22({}, "__esModule", { value: true }), mod);
1636
1659
  var array_exports = {};
1637
1660
  __export22(array_exports, {
1661
+ addItemAfterEveryElement: () => addItemAfterEveryElement,
1638
1662
  arrayContainsOtherArray: () => arrayContainsOtherArray,
1639
1663
  createNestedObject: () => createNestedObject,
1640
1664
  cutArrayAfterValue: () => cutArrayAfterValue,
@@ -1646,6 +1670,7 @@ var require_cjs2 = __commonJS({
1646
1670
  removeFromArray: () => removeFromArray,
1647
1671
  removeValueFromArray: () => removeValueFromArray,
1648
1672
  removeValueFromArrayAll: () => removeValueFromArrayAll,
1673
+ reorderArrayByValues: () => reorderArrayByValues,
1649
1674
  swapItemsInArray: () => swapItemsInArray
1650
1675
  });
1651
1676
  module22.exports = __toCommonJS22(array_exports);
@@ -1730,6 +1755,27 @@ var require_cjs2 = __commonJS({
1730
1755
  var removeValueFromArrayAll = (arr, value) => {
1731
1756
  return arr.filter((item) => item !== value);
1732
1757
  };
1758
+ var addItemAfterEveryElement = (array, item) => {
1759
+ const result = [];
1760
+ for (let i = 0; i < array.length; i++) {
1761
+ result.push(array[i]);
1762
+ if (i < array.length - 1) {
1763
+ result.push(item);
1764
+ }
1765
+ }
1766
+ return result;
1767
+ };
1768
+ var reorderArrayByValues = (array, valueToMove, insertBeforeValue) => {
1769
+ const newArray = [...array];
1770
+ const indexToMove = newArray.indexOf(valueToMove);
1771
+ const indexToInsertBefore = newArray.indexOf(insertBeforeValue);
1772
+ if (indexToMove !== -1 && indexToInsertBefore !== -1) {
1773
+ const removedItem = newArray.splice(indexToMove, 1)[0];
1774
+ const insertIndex = indexToInsertBefore < indexToMove ? indexToInsertBefore : indexToInsertBefore + 1;
1775
+ newArray.splice(insertIndex, 0, removedItem);
1776
+ }
1777
+ return newArray;
1778
+ };
1733
1779
  }
1734
1780
  });
1735
1781
  var require_string2 = __commonJS2({
@@ -2002,7 +2048,7 @@ var require_cjs2 = __commonJS({
2002
2048
  }
2003
2049
  return stringified;
2004
2050
  };
2005
- var objectToString = (obj, indent = 0) => {
2051
+ var objectToString = (obj = {}, indent = 0) => {
2006
2052
  const spaces = " ".repeat(indent);
2007
2053
  let str = "{\n";
2008
2054
  for (const [key, value] of Object.entries(obj)) {
@@ -2069,7 +2115,7 @@ var require_cjs2 = __commonJS({
2069
2115
  continue;
2070
2116
  const objProp = obj[prop];
2071
2117
  if ((0, import_types.isString)(objProp)) {
2072
- if ((objProp.includes("=>") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2118
+ if ((objProp.includes("(){") || objProp.includes("() {") || objProp.includes("=>") || objProp.startsWith("()") || objProp.startsWith("async") || objProp.startsWith("function") || objProp.startsWith("(")) && !objProp.startsWith("{") && !objProp.startsWith("[")) {
2073
2119
  try {
2074
2120
  const evalProp = import_globals.window.eval(`(${objProp})`);
2075
2121
  destringified[prop] = evalProp;
@@ -2829,6 +2875,7 @@ __export(defaultConfig_exports, {
2829
2875
  ICONS: () => ICONS,
2830
2876
  MEDIA: () => MEDIA,
2831
2877
  RESET: () => RESET,
2878
+ SEMANTIC_ICONS: () => SEMANTIC_ICONS,
2832
2879
  SEQUENCE: () => SEQUENCE,
2833
2880
  SHADOW: () => SHADOW,
2834
2881
  SPACING: () => SPACING,
@@ -2940,6 +2987,7 @@ var SHADOW = {};
2940
2987
 
2941
2988
  // src/defaultConfig/icons.js
2942
2989
  var ICONS = {};
2990
+ var SEMANTIC_ICONS = {};
2943
2991
 
2944
2992
  // src/defaultConfig/timing.js
2945
2993
  var defaultProps3 = {
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.373",
5
+ "version": "2.11.389",
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": "71ddf72da03fdac28f9d1fe2c9e163b5b6ba9f09"
33
+ "gitHead": "e260280a4a50ca08fd7df53104a884086dc3da88"
34
34
  }
@@ -1,3 +1,4 @@
1
1
  'use strict'
2
2
 
3
3
  export const ICONS = {}
4
+ export const SEMANTIC_ICONS = {}
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
 
package/src/system/svg.js CHANGED
@@ -28,14 +28,14 @@ export const appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
28
28
  appendSVG(lib, options)
29
29
  }
30
30
 
31
- export const setIcon = (val, key) => {
31
+ export const setSvgIcon = (val, key) => {
32
32
  const CONFIG = getActiveConfig()
33
- if (CONFIG.useIconSprite) {
33
+ if (CONFIG.useIconSprite && !CONFIG.SEMANTIC_ICONS?.[key]) {
34
34
  return setSVG(val, key)
35
35
  } return val
36
36
  }
37
37
 
38
- export const appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
38
+ export const appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
39
39
  const CONFIG = getActiveConfig()
40
40
 
41
41
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG.ICONS