@symbo.ls/scratch 2.10.258 → 2.10.261

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.
@@ -1091,5 +1091,6 @@ var getActiveConfig = (def) => {
1091
1091
  return FACTORY[def || FACTORY.active];
1092
1092
  };
1093
1093
  var setActiveConfig = (def) => {
1094
- return FACTORY.active = FACTORY[def];
1094
+ FACTORY.active = FACTORY[def];
1095
+ return FACTORY.active;
1095
1096
  };
package/dist/cjs/index.js CHANGED
@@ -1437,7 +1437,8 @@ var getActiveConfig = (def) => {
1437
1437
  return FACTORY[def || FACTORY.active];
1438
1438
  };
1439
1439
  var setActiveConfig = (def) => {
1440
- return FACTORY.active = FACTORY[def];
1440
+ FACTORY.active = FACTORY[def];
1441
+ return FACTORY.active;
1441
1442
  };
1442
1443
 
1443
1444
  // src/utils/sequence.js
@@ -1653,7 +1654,7 @@ var applySequenceVars = (props, mediaName, options = {}) => {
1653
1654
  var import_utils7 = __toESM(require_cjs3(), 1);
1654
1655
  var generateSprite = (icons) => {
1655
1656
  let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
1656
- for (let key in icons) {
1657
+ for (const key in icons) {
1657
1658
  sprite += icons[key];
1658
1659
  }
1659
1660
  sprite += "</svg>";
@@ -1663,14 +1664,14 @@ var parseRootAttributes = (htmlString) => {
1663
1664
  if (!(0, import_utils7.isString)(htmlString)) {
1664
1665
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1665
1666
  }
1666
- let match = htmlString.match(/<svg\s+(.*?)>/);
1667
+ const match = htmlString.match(/<svg\s+(.*?)>/);
1667
1668
  if (!match || !match[1]) {
1668
1669
  return {};
1669
1670
  }
1670
- let attrString = match[1];
1671
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1671
+ const attrString = match[1];
1672
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1672
1673
  return attrs.reduce((acc, attr) => {
1673
- let [key, value] = attr.split("=");
1674
+ const [key, value] = attr.split("=");
1674
1675
  acc[key] = value.replace(/['"]/g, "");
1675
1676
  return acc;
1676
1677
  }, {});
@@ -1684,8 +1685,8 @@ var convertSvgToSymbol = (key, code) => {
1684
1685
  "<svg",
1685
1686
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
1686
1687
  );
1687
- symbol = symbol.replace(/width="[^\"]*/, "");
1688
- symbol = symbol.replace(/height="[^\"]*/, "");
1688
+ symbol = symbol.replace(/width="[^"]*/, "");
1689
+ symbol = symbol.replace(/height="[^"]*/, "");
1689
1690
  symbol = symbol.replace("</svg", "</symbol");
1690
1691
  return symbol;
1691
1692
  };
@@ -2019,10 +2020,10 @@ var setMediaTheme = (val, key, suffix, prefers) => {
2019
2020
  theme[`.${param}`] = { [param]: theme[param] };
2020
2021
  }
2021
2022
  }
2022
- if (theme["background"] || theme["color"] || theme["backgroundColor"]) {
2023
+ if (theme.background || theme.color || theme.backgroundColor) {
2023
2024
  theme[".inversed"] = {
2024
- color: theme["background"] || theme["backgroundColor"],
2025
- background: theme["color"]
2025
+ color: theme.background || theme.backgroundColor,
2026
+ background: theme.color
2026
2027
  };
2027
2028
  }
2028
2029
  }
@@ -2323,12 +2324,12 @@ var DEF_OPTIONS = {
2323
2324
  document: import_globals2.document
2324
2325
  };
2325
2326
  var setSVG = (val, key) => {
2327
+ const CONFIG2 = getActiveConfig();
2326
2328
  if (!val) {
2327
2329
  if (CONFIG2.verbose)
2328
2330
  console.warn("setSVG: val is not defined", key);
2329
2331
  return;
2330
2332
  }
2331
- const CONFIG2 = getActiveConfig();
2332
2333
  if (CONFIG2.useSvgSprite) {
2333
2334
  return convertSvgToSymbol(key, val);
2334
2335
  }
@@ -2338,7 +2339,7 @@ var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
2338
2339
  const CONFIG2 = getActiveConfig();
2339
2340
  const doc = options.document || import_globals2.document;
2340
2341
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
2341
- for (let key in LIBRARY)
2342
+ for (const key in LIBRARY)
2342
2343
  lib[key] = CONFIG2.SVG[key];
2343
2344
  const SVGsprite = generateSprite(lib);
2344
2345
  if (!doc) {
@@ -2360,7 +2361,7 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2360
2361
  const CONFIG2 = getActiveConfig();
2361
2362
  const doc = options.document || import_globals2.document;
2362
2363
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
2363
- for (let key in LIBRARY)
2364
+ for (const key in LIBRARY)
2364
2365
  lib[key] = CONFIG2.ICONS[key];
2365
2366
  const SVGsprite = generateSprite(lib);
2366
2367
  if (!doc) {
@@ -2376,7 +2377,7 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2376
2377
  var import_utils24 = __toESM(require_cjs3(), 1);
2377
2378
  var applyReset = (reset = {}) => {
2378
2379
  const CONFIG2 = getActiveConfig();
2379
- const { CSS_VARS: CSS_VARS2, RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
2380
+ const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
2380
2381
  if (RESET2) {
2381
2382
  if (RESET2[":root"]) {
2382
2383
  const configReset = RESET2;
@@ -2469,6 +2470,7 @@ var transformTextStroke = (stroke) => {
2469
2470
  return v;
2470
2471
  else if (getColor(v))
2471
2472
  return getColor(v);
2473
+ return v;
2472
2474
  }).join(" ");
2473
2475
  };
2474
2476
  var transformShadow = (shadows) => shadows.split("|").map((shadow) => {
@@ -2592,7 +2594,7 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
2592
2594
  ...config
2593
2595
  } = recivedConfig;
2594
2596
  if (options.newConfig) {
2595
- FACTORY["active"] = options.newConfig;
2597
+ FACTORY.active = options.newConfig;
2596
2598
  CONFIG2 = getActiveConfig(options.newConfig);
2597
2599
  }
2598
2600
  if (verbose !== void 0)
package/dist/cjs/set.js CHANGED
@@ -857,35 +857,8 @@ var require_cjs3 = __commonJS({
857
857
  var set_exports = {};
858
858
  __export(set_exports, {
859
859
  VALUE_TRANSFORMERS: () => VALUE_TRANSFORMERS,
860
- appendIconsSprite: () => appendIconsSprite,
861
- appendSVGSprite: () => appendSVGSprite,
862
- applyDocument: () => applyDocument,
863
- applyHeadings: () => applyHeadings,
864
- applyReset: () => applyReset,
865
- applySpacingSequence: () => applySpacingSequence,
866
- applyTimingSequence: () => applyTimingSequence,
867
- applyTypographySequence: () => applyTypographySequence,
868
- getColor: () => getColor,
869
- getFontFamily: () => getFontFamily,
870
- getFontSizeByKey: () => getFontSizeByKey,
871
- getMediaColor: () => getMediaColor,
872
- getMediaTheme: () => getMediaTheme,
873
- getSpacingBasedOnRatio: () => getSpacingBasedOnRatio,
874
- getSpacingByKey: () => getSpacingByKey,
875
- getTheme: () => getTheme,
876
- getTimingByKey: () => getTimingByKey,
877
- getTimingFunction: () => getTimingFunction,
878
- runThroughMedia: () => runThroughMedia,
879
860
  set: () => set,
880
- setColor: () => setColor,
881
861
  setEach: () => setEach,
882
- setFont: () => setFont,
883
- setFontFamily: () => setFontFamily,
884
- setGradient: () => setGradient,
885
- setIcon: () => setIcon,
886
- setMediaTheme: () => setMediaTheme,
887
- setSVG: () => setSVG,
888
- setTheme: () => setTheme,
889
862
  setValue: () => setValue
890
863
  });
891
864
  module.exports = __toCommonJS(set_exports);
@@ -1228,12 +1201,6 @@ var import_utils3 = __toESM(require_cjs3());
1228
1201
  var import_utils2 = __toESM(require_cjs3());
1229
1202
 
1230
1203
  // ../utils/src/index.js
1231
- var toCamelCase = (str) => {
1232
- return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(word, index) {
1233
- return index === 0 ? word.toLowerCase() : word.toUpperCase();
1234
- }).replaceAll(/\s+/g, "");
1235
- };
1236
- var toDashCase = (val) => val.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase()).replace(".", "-");
1237
1204
  var arrayzeValue = (val) => {
1238
1205
  if ((0, import_utils3.isString)(val))
1239
1206
  return val.split(" ");
@@ -1342,67 +1309,6 @@ var generateSequence = (sequenceProps) => {
1342
1309
  }
1343
1310
  return sequenceProps;
1344
1311
  };
1345
- var getSequenceValue = (value = "A", sequenceProps) => {
1346
- const CONFIG2 = getActiveConfig();
1347
- const { UNIT: UNIT2 } = CONFIG2;
1348
- const {
1349
- sequence,
1350
- unit = UNIT2.default,
1351
- useVariable
1352
- } = sequenceProps;
1353
- if ((0, import_utils4.isString)(value) && value.slice(0, 2) === "--")
1354
- return `var(${value})`;
1355
- const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
1356
- const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
1357
- const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
1358
- if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || !startsWithDashOrLetter)
1359
- return value;
1360
- const letterVal = value.toUpperCase();
1361
- const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
1362
- let absValue = isNegative ? letterVal.slice(1) : letterVal;
1363
- let mediaName = "";
1364
- if (absValue.includes("-")) {
1365
- mediaName = "-" + absValue.split("-")[1].toLowerCase();
1366
- absValue = absValue.split("-")[0];
1367
- }
1368
- const varValue = (v) => `var(${prefix}${v}${mediaName})`;
1369
- if (absValue.includes("+")) {
1370
- const args = absValue.split("+");
1371
- const [first, second] = args;
1372
- const joint = `${varValue(first)} + ${varValue(second)}`;
1373
- return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1374
- } else if (absValue.includes("-")) {
1375
- const args = absValue.split("-");
1376
- const [first, second] = args;
1377
- const joint = `${varValue(first)} - ${varValue(second)}`;
1378
- return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1379
- }
1380
- if (!sequence[absValue] && absValue.length === 2) {
1381
- if (CONFIG2.verbose)
1382
- console.warn(absValue, "- value is not found because `subSequence` is set to false");
1383
- absValue = absValue.slice(0, 1);
1384
- }
1385
- if (useVariable || CONFIG2.useVariable) {
1386
- const varValue2 = `var(${prefix}${absValue}${mediaName})`;
1387
- return isNegative ? `calc(${varValue2} * -1)` : varValue2;
1388
- }
1389
- const sequenceItem = sequence ? sequence[absValue] : null;
1390
- if (!sequenceItem)
1391
- return console.warn("can't find", sequence, absValue);
1392
- if (unit === "ms" || unit === "s") {
1393
- return isNegative + sequenceItem.val + unit;
1394
- }
1395
- return isNegative + sequenceItem.scaling + unit;
1396
- };
1397
- var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
1398
- if (typeof value !== "string") {
1399
- console.warn(propertyName, value, "is not a string");
1400
- return {};
1401
- }
1402
- if (value === "-" || value === "")
1403
- return {};
1404
- return { [propertyName]: getSequenceValue(value, sequenceProps) };
1405
- };
1406
1312
  var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
1407
1313
  var findHeadings = (propertyNames) => {
1408
1314
  const { h1Matches, sequence } = propertyNames;
@@ -1446,26 +1352,18 @@ var applySequenceVars = (props, mediaName, options = {}) => {
1446
1352
 
1447
1353
  // src/utils/sprite.js
1448
1354
  var import_utils7 = __toESM(require_cjs3(), 1);
1449
- var generateSprite = (icons) => {
1450
- let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
1451
- for (let key in icons) {
1452
- sprite += icons[key];
1453
- }
1454
- sprite += "</svg>";
1455
- return sprite;
1456
- };
1457
1355
  var parseRootAttributes = (htmlString) => {
1458
1356
  if (!(0, import_utils7.isString)(htmlString)) {
1459
1357
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1460
1358
  }
1461
- let match = htmlString.match(/<svg\s+(.*?)>/);
1359
+ const match = htmlString.match(/<svg\s+(.*?)>/);
1462
1360
  if (!match || !match[1]) {
1463
1361
  return {};
1464
1362
  }
1465
- let attrString = match[1];
1466
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1363
+ const attrString = match[1];
1364
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1467
1365
  return attrs.reduce((acc, attr) => {
1468
- let [key, value] = attr.split("=");
1366
+ const [key, value] = attr.split("=");
1469
1367
  acc[key] = value.replace(/['"]/g, "");
1470
1368
  return acc;
1471
1369
  }, {});
@@ -1479,8 +1377,8 @@ var convertSvgToSymbol = (key, code) => {
1479
1377
  "<svg",
1480
1378
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
1481
1379
  );
1482
- symbol = symbol.replace(/width="[^\"]*/, "");
1483
- symbol = symbol.replace(/height="[^\"]*/, "");
1380
+ symbol = symbol.replace(/width="[^"]*/, "");
1381
+ symbol = symbol.replace(/height="[^"]*/, "");
1484
1382
  symbol = symbol.replace("</svg", "</symbol");
1485
1383
  return symbol;
1486
1384
  };
@@ -1538,41 +1436,6 @@ var getColor = (value, key) => {
1538
1436
  } else
1539
1437
  return CONFIG2.useVariable ? `var(${val.var})` : val.value;
1540
1438
  };
1541
- var getMediaColor = (value, globalTheme) => {
1542
- const CONFIG2 = getActiveConfig();
1543
- if (!globalTheme)
1544
- globalTheme = CONFIG2.globalTheme;
1545
- if (!(0, import_utils8.isString)(value)) {
1546
- if (CONFIG2.verbose)
1547
- console.warn(value, "- type for color is not valid");
1548
- return;
1549
- }
1550
- if (value.slice(0, 2) === "--")
1551
- return `var(${value})`;
1552
- const [name] = (0, import_utils8.isArray)(value) ? value : value.split(" ");
1553
- const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1554
- const val = COLOR2[name] || GRADIENT2[name];
1555
- const isObj = (0, import_utils8.isObject)(val);
1556
- if (isObj && val.value)
1557
- return getColor(value, `@${globalTheme}`);
1558
- else if (isObj) {
1559
- if (globalTheme)
1560
- return getColor(value, `@${globalTheme}`);
1561
- else {
1562
- const obj = {};
1563
- for (const mediaName in val) {
1564
- const query = CONFIG2.MEDIA[mediaName.slice(1)];
1565
- const media = `@media screen and ${query}`;
1566
- obj[media] = getColor(value, mediaName);
1567
- }
1568
- return obj;
1569
- }
1570
- } else {
1571
- if (CONFIG2.verbose)
1572
- console.warn("Can't find color", value);
1573
- return value;
1574
- }
1575
- };
1576
1439
  var setColor = (val, key, suffix) => {
1577
1440
  const CONFIG2 = getActiveConfig();
1578
1441
  if ((0, import_utils8.isString)(val) && val.slice(0, 2) === "--")
@@ -1781,10 +1644,10 @@ var setMediaTheme = (val, key, suffix, prefers) => {
1781
1644
  theme[`.${param}`] = { [param]: theme[param] };
1782
1645
  }
1783
1646
  }
1784
- if (theme["background"] || theme["color"] || theme["backgroundColor"]) {
1647
+ if (theme.background || theme.color || theme.backgroundColor) {
1785
1648
  theme[".inversed"] = {
1786
- color: theme["background"] || theme["backgroundColor"],
1787
- background: theme["color"]
1649
+ color: theme.background || theme.backgroundColor,
1650
+ background: theme.color
1788
1651
  };
1789
1652
  }
1790
1653
  }
@@ -1853,11 +1716,6 @@ var setFont = (val, key) => {
1853
1716
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
1854
1717
  return { var: CSSvar, value: val, fontFace };
1855
1718
  };
1856
- var getFontFamily = (key, factory) => {
1857
- const CONFIG2 = getActiveConfig();
1858
- const { FONT_FAMILY: FONT_FAMILY2 } = CONFIG2;
1859
- return getDefaultOrFirstKey(factory || FONT_FAMILY2, key);
1860
- };
1861
1719
  var setFontFamily = (val, key) => {
1862
1720
  const CONFIG2 = getActiveConfig();
1863
1721
  const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
@@ -1930,15 +1788,6 @@ var applyTypographySequence = () => {
1930
1788
  applySequenceVars(TYPOGRAPHY2);
1931
1789
  runThroughMedia(TYPOGRAPHY2);
1932
1790
  };
1933
- var getFontSizeByKey = (value) => {
1934
- const CONFIG2 = getActiveConfig();
1935
- const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
1936
- return getSequenceValuePropertyPair(
1937
- value,
1938
- "fontSize",
1939
- TYPOGRAPHY2
1940
- );
1941
- };
1942
1791
 
1943
1792
  // src/system/spacing.js
1944
1793
  var import_utils17 = __toESM(require_cjs3(), 1);
@@ -1973,76 +1822,6 @@ var applySpacingSequence = () => {
1973
1822
  applySequenceVars(SPACING2);
1974
1823
  runThroughMedia2(SPACING2);
1975
1824
  };
1976
- var getSequence = (sequenceProps) => {
1977
- const CONFIG2 = getActiveConfig();
1978
- const { SPACING: SPACING2 } = CONFIG2;
1979
- if (!sequenceProps)
1980
- return SPACING2;
1981
- const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
1982
- return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
1983
- };
1984
- var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
1985
- const sequence = getSequence(sequenceProps);
1986
- const stack = arrayzeValue(value);
1987
- if (!stack)
1988
- return;
1989
- if ((0, import_utils17.isString)(value) && value.includes("calc")) {
1990
- return { [propertyName]: value };
1991
- }
1992
- if (stack.length > 1) {
1993
- let suffix = "";
1994
- if (propertyName === "borderWidth") {
1995
- propertyName = "border";
1996
- suffix = "Width";
1997
- }
1998
- const directions = {
1999
- 2: ["Block", "Inline"],
2000
- 3: ["BlockStart", "Inline", "BlockEnd"],
2001
- 4: ["BlockStart", "InlineEnd", "BlockEnd", "InlineStart"]
2002
- };
2003
- const wrapSequenceValueByDirection = (direction, i) => getSequenceValuePropertyPair(
2004
- stack[i],
2005
- propertyName + direction + suffix,
2006
- sequence
2007
- );
2008
- return directions[stack.length].map((dir, key) => wrapSequenceValueByDirection(dir, key));
2009
- }
2010
- return getSequenceValuePropertyPair(
2011
- value,
2012
- propertyName,
2013
- sequence
2014
- );
2015
- };
2016
- var getSpacingBasedOnRatio = (props, propertyName, val) => {
2017
- const CONFIG2 = getActiveConfig();
2018
- const { SPACING: SPACING2 } = CONFIG2;
2019
- const { spacingRatio, unit } = props;
2020
- const value = val || props[propertyName];
2021
- if (spacingRatio) {
2022
- let sequenceProps = SPACING2[spacingRatio];
2023
- if (!sequenceProps) {
2024
- const { type, base, range, subSequence } = SPACING2;
2025
- sequenceProps = SPACING2[spacingRatio] = (0, import_utils17.merge)({
2026
- ratio: spacingRatio,
2027
- type: type + "-" + spacingRatio,
2028
- unit,
2029
- sequence: {},
2030
- scales: {},
2031
- templates: {},
2032
- vars: {}
2033
- }, {
2034
- base,
2035
- range,
2036
- subSequence,
2037
- ratio: SPACING2.ratio,
2038
- unit: SPACING2.unit
2039
- });
2040
- }
2041
- applySequenceVars(sequenceProps, null, { useDefault: false });
2042
- return getSpacingByKey(value, propertyName, sequenceProps);
2043
- }
2044
- return getSpacingByKey(value, propertyName);
2045
- };
2046
1825
 
2047
1826
  // src/system/timing.js
2048
1827
  var applyTimingSequence = () => {
@@ -2051,20 +1830,6 @@ var applyTimingSequence = () => {
2051
1830
  generateSequence(TIMING2);
2052
1831
  applySequenceVars(TIMING2);
2053
1832
  };
2054
- var getTimingFunction = (value) => {
2055
- const CONFIG2 = getActiveConfig();
2056
- const { TIMING: TIMING2 } = CONFIG2;
2057
- return TIMING2[value] || TIMING2[toCamelCase(value)] || value;
2058
- };
2059
- var getTimingByKey = (value, property = "timing") => {
2060
- const CONFIG2 = getActiveConfig();
2061
- const { TIMING: TIMING2 } = CONFIG2;
2062
- return getSequenceValuePropertyPair(
2063
- value,
2064
- property,
2065
- TIMING2
2066
- );
2067
- };
2068
1833
 
2069
1834
  // src/system/document.js
2070
1835
  var import_utils21 = __toESM(require_cjs3(), 1);
@@ -2081,36 +1846,18 @@ var applyDocument = () => {
2081
1846
 
2082
1847
  // src/system/svg.js
2083
1848
  var import_globals2 = __toESM(require_cjs(), 1);
2084
- var DEF_OPTIONS = {
2085
- document: import_globals2.document
2086
- };
2087
1849
  var setSVG = (val, key) => {
1850
+ const CONFIG2 = getActiveConfig();
2088
1851
  if (!val) {
2089
1852
  if (CONFIG2.verbose)
2090
1853
  console.warn("setSVG: val is not defined", key);
2091
1854
  return;
2092
1855
  }
2093
- const CONFIG2 = getActiveConfig();
2094
1856
  if (CONFIG2.useSvgSprite) {
2095
1857
  return convertSvgToSymbol(key, val);
2096
1858
  }
2097
1859
  return val;
2098
1860
  };
2099
- var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
2100
- const CONFIG2 = getActiveConfig();
2101
- const doc = options.document || import_globals2.document;
2102
- const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
2103
- for (let key in LIBRARY)
2104
- lib[key] = CONFIG2.SVG[key];
2105
- const SVGsprite = generateSprite(lib);
2106
- if (!doc) {
2107
- console.warn("To append SVG sprites it should be run in browser environment");
2108
- return SVGsprite;
2109
- }
2110
- const svgSpriteDOM = doc.createElement("template");
2111
- svgSpriteDOM.innerHTML = SVGsprite;
2112
- doc.body.appendChild(svgSpriteDOM.content);
2113
- };
2114
1861
  var setIcon = (val, key) => {
2115
1862
  const CONFIG2 = getActiveConfig();
2116
1863
  if (CONFIG2.useIconSprite) {
@@ -2118,27 +1865,12 @@ var setIcon = (val, key) => {
2118
1865
  }
2119
1866
  return val;
2120
1867
  };
2121
- var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2122
- const CONFIG2 = getActiveConfig();
2123
- const doc = options.document || import_globals2.document;
2124
- const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
2125
- for (let key in LIBRARY)
2126
- lib[key] = CONFIG2.ICONS[key];
2127
- const SVGsprite = generateSprite(lib);
2128
- if (!doc) {
2129
- console.warn("To append SVG Icon sprites it should be run in browser environment");
2130
- return SVGsprite;
2131
- }
2132
- const iconsSpriteDOM = doc.createElement("template");
2133
- iconsSpriteDOM.innerHTML = SVGsprite;
2134
- doc.body.appendChild(iconsSpriteDOM.content);
2135
- };
2136
1868
 
2137
1869
  // src/system/reset.js
2138
1870
  var import_utils24 = __toESM(require_cjs3(), 1);
2139
1871
  var applyReset = (reset = {}) => {
2140
1872
  const CONFIG2 = getActiveConfig();
2141
- const { CSS_VARS: CSS_VARS2, RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
1873
+ const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
2142
1874
  if (RESET2) {
2143
1875
  if (RESET2[":root"]) {
2144
1876
  const configReset = RESET2;
@@ -2254,7 +1986,7 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
2254
1986
  ...config
2255
1987
  } = recivedConfig;
2256
1988
  if (options.newConfig) {
2257
- FACTORY["active"] = options.newConfig;
1989
+ FACTORY.active = options.newConfig;
2258
1990
  CONFIG2 = getActiveConfig(options.newConfig);
2259
1991
  }
2260
1992
  if (verbose !== void 0)
@@ -1444,7 +1444,7 @@ var applySequenceVars = (props, mediaName, options = {}) => {
1444
1444
  var import_utils7 = __toESM(require_cjs3(), 1);
1445
1445
  var generateSprite = (icons) => {
1446
1446
  let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
1447
- for (let key in icons) {
1447
+ for (const key in icons) {
1448
1448
  sprite += icons[key];
1449
1449
  }
1450
1450
  sprite += "</svg>";
@@ -1454,14 +1454,14 @@ var parseRootAttributes = (htmlString) => {
1454
1454
  if (!(0, import_utils7.isString)(htmlString)) {
1455
1455
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1456
1456
  }
1457
- let match = htmlString.match(/<svg\s+(.*?)>/);
1457
+ const match = htmlString.match(/<svg\s+(.*?)>/);
1458
1458
  if (!match || !match[1]) {
1459
1459
  return {};
1460
1460
  }
1461
- let attrString = match[1];
1462
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1461
+ const attrString = match[1];
1462
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1463
1463
  return attrs.reduce((acc, attr) => {
1464
- let [key, value] = attr.split("=");
1464
+ const [key, value] = attr.split("=");
1465
1465
  acc[key] = value.replace(/['"]/g, "");
1466
1466
  return acc;
1467
1467
  }, {});
@@ -1475,8 +1475,8 @@ var convertSvgToSymbol = (key, code) => {
1475
1475
  "<svg",
1476
1476
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
1477
1477
  );
1478
- symbol = symbol.replace(/width="[^\"]*/, "");
1479
- symbol = symbol.replace(/height="[^\"]*/, "");
1478
+ symbol = symbol.replace(/width="[^"]*/, "");
1479
+ symbol = symbol.replace(/height="[^"]*/, "");
1480
1480
  symbol = symbol.replace("</svg", "</symbol");
1481
1481
  return symbol;
1482
1482
  };
@@ -1777,10 +1777,10 @@ var setMediaTheme = (val, key, suffix, prefers) => {
1777
1777
  theme[`.${param}`] = { [param]: theme[param] };
1778
1778
  }
1779
1779
  }
1780
- if (theme["background"] || theme["color"] || theme["backgroundColor"]) {
1780
+ if (theme.background || theme.color || theme.backgroundColor) {
1781
1781
  theme[".inversed"] = {
1782
- color: theme["background"] || theme["backgroundColor"],
1783
- background: theme["color"]
1782
+ color: theme.background || theme.backgroundColor,
1783
+ background: theme.color
1784
1784
  };
1785
1785
  }
1786
1786
  }
@@ -2081,12 +2081,12 @@ var DEF_OPTIONS = {
2081
2081
  document: import_globals2.document
2082
2082
  };
2083
2083
  var setSVG = (val, key) => {
2084
+ const CONFIG2 = getActiveConfig();
2084
2085
  if (!val) {
2085
2086
  if (CONFIG2.verbose)
2086
2087
  console.warn("setSVG: val is not defined", key);
2087
2088
  return;
2088
2089
  }
2089
- const CONFIG2 = getActiveConfig();
2090
2090
  if (CONFIG2.useSvgSprite) {
2091
2091
  return convertSvgToSymbol(key, val);
2092
2092
  }
@@ -2096,7 +2096,7 @@ var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
2096
2096
  const CONFIG2 = getActiveConfig();
2097
2097
  const doc = options.document || import_globals2.document;
2098
2098
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
2099
- for (let key in LIBRARY)
2099
+ for (const key in LIBRARY)
2100
2100
  lib[key] = CONFIG2.SVG[key];
2101
2101
  const SVGsprite = generateSprite(lib);
2102
2102
  if (!doc) {
@@ -2118,7 +2118,7 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2118
2118
  const CONFIG2 = getActiveConfig();
2119
2119
  const doc = options.document || import_globals2.document;
2120
2120
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
2121
- for (let key in LIBRARY)
2121
+ for (const key in LIBRARY)
2122
2122
  lib[key] = CONFIG2.ICONS[key];
2123
2123
  const SVGsprite = generateSprite(lib);
2124
2124
  if (!doc) {
@@ -2134,7 +2134,7 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2134
2134
  var import_utils24 = __toESM(require_cjs3(), 1);
2135
2135
  var applyReset = (reset = {}) => {
2136
2136
  const CONFIG2 = getActiveConfig();
2137
- const { CSS_VARS: CSS_VARS2, RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
2137
+ const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
2138
2138
  if (RESET2) {
2139
2139
  if (RESET2[":root"]) {
2140
2140
  const configReset = RESET2;
@@ -1174,7 +1174,7 @@ var import_globals2 = __toESM(require_cjs(), 1);
1174
1174
  // src/system/reset.js
1175
1175
  var applyReset = (reset = {}) => {
1176
1176
  const CONFIG2 = getActiveConfig();
1177
- const { CSS_VARS: CSS_VARS2, RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
1177
+ const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
1178
1178
  if (RESET2) {
1179
1179
  if (RESET2[":root"]) {
1180
1180
  const configReset = RESET2;
@@ -1105,7 +1105,7 @@ var import_utils6 = __toESM(require_cjs3(), 1);
1105
1105
  var import_utils7 = __toESM(require_cjs3(), 1);
1106
1106
  var generateSprite = (icons) => {
1107
1107
  let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
1108
- for (let key in icons) {
1108
+ for (const key in icons) {
1109
1109
  sprite += icons[key];
1110
1110
  }
1111
1111
  sprite += "</svg>";
@@ -1115,14 +1115,14 @@ var parseRootAttributes = (htmlString) => {
1115
1115
  if (!(0, import_utils7.isString)(htmlString)) {
1116
1116
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1117
1117
  }
1118
- let match = htmlString.match(/<svg\s+(.*?)>/);
1118
+ const match = htmlString.match(/<svg\s+(.*?)>/);
1119
1119
  if (!match || !match[1]) {
1120
1120
  return {};
1121
1121
  }
1122
- let attrString = match[1];
1123
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1122
+ const attrString = match[1];
1123
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1124
1124
  return attrs.reduce((acc, attr) => {
1125
- let [key, value] = attr.split("=");
1125
+ const [key, value] = attr.split("=");
1126
1126
  acc[key] = value.replace(/['"]/g, "");
1127
1127
  return acc;
1128
1128
  }, {});
@@ -1136,8 +1136,8 @@ var convertSvgToSymbol = (key, code) => {
1136
1136
  "<svg",
1137
1137
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
1138
1138
  );
1139
- symbol = symbol.replace(/width="[^\"]*/, "");
1140
- symbol = symbol.replace(/height="[^\"]*/, "");
1139
+ symbol = symbol.replace(/width="[^"]*/, "");
1140
+ symbol = symbol.replace(/height="[^"]*/, "");
1141
1141
  symbol = symbol.replace("</svg", "</symbol");
1142
1142
  return symbol;
1143
1143
  };
@@ -1147,12 +1147,12 @@ var DEF_OPTIONS = {
1147
1147
  document: import_globals2.document
1148
1148
  };
1149
1149
  var setSVG = (val, key) => {
1150
+ const CONFIG2 = getActiveConfig();
1150
1151
  if (!val) {
1151
1152
  if (CONFIG2.verbose)
1152
1153
  console.warn("setSVG: val is not defined", key);
1153
1154
  return;
1154
1155
  }
1155
- const CONFIG2 = getActiveConfig();
1156
1156
  if (CONFIG2.useSvgSprite) {
1157
1157
  return convertSvgToSymbol(key, val);
1158
1158
  }
@@ -1162,7 +1162,7 @@ var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
1162
1162
  const CONFIG2 = getActiveConfig();
1163
1163
  const doc = options.document || import_globals2.document;
1164
1164
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
1165
- for (let key in LIBRARY)
1165
+ for (const key in LIBRARY)
1166
1166
  lib[key] = CONFIG2.SVG[key];
1167
1167
  const SVGsprite = generateSprite(lib);
1168
1168
  if (!doc) {
@@ -1184,7 +1184,7 @@ var appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
1184
1184
  const CONFIG2 = getActiveConfig();
1185
1185
  const doc = options.document || import_globals2.document;
1186
1186
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
1187
- for (let key in LIBRARY)
1187
+ for (const key in LIBRARY)
1188
1188
  lib[key] = CONFIG2.ICONS[key];
1189
1189
  const SVGsprite = generateSprite(lib);
1190
1190
  if (!doc) {
@@ -1348,10 +1348,10 @@ var setMediaTheme = (val, key, suffix, prefers) => {
1348
1348
  theme[`.${param}`] = { [param]: theme[param] };
1349
1349
  }
1350
1350
  }
1351
- if (theme["background"] || theme["color"] || theme["backgroundColor"]) {
1351
+ if (theme.background || theme.color || theme.backgroundColor) {
1352
1352
  theme[".inversed"] = {
1353
- color: theme["background"] || theme["backgroundColor"],
1354
- background: theme["color"]
1353
+ color: theme.background || theme.backgroundColor,
1354
+ background: theme.color
1355
1355
  };
1356
1356
  }
1357
1357
  }
@@ -1528,6 +1528,7 @@ var transformTextStroke = (stroke) => {
1528
1528
  return v;
1529
1529
  else if (getColor(v))
1530
1530
  return getColor(v);
1531
+ return v;
1531
1532
  }).join(" ");
1532
1533
  };
1533
1534
  var transformShadow = (shadows) => shadows.split("|").map((shadow) => {
@@ -1522,7 +1522,7 @@ var applySequenceVars = (props, mediaName, options = {}) => {
1522
1522
  var import_utils7 = __toESM(require_cjs3(), 1);
1523
1523
  var generateSprite = (icons) => {
1524
1524
  let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
1525
- for (let key in icons) {
1525
+ for (const key in icons) {
1526
1526
  sprite += icons[key];
1527
1527
  }
1528
1528
  sprite += "</svg>";
@@ -1532,14 +1532,14 @@ var parseRootAttributes = (htmlString) => {
1532
1532
  if (!(0, import_utils7.isString)(htmlString)) {
1533
1533
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
1534
1534
  }
1535
- let match = htmlString.match(/<svg\s+(.*?)>/);
1535
+ const match = htmlString.match(/<svg\s+(.*?)>/);
1536
1536
  if (!match || !match[1]) {
1537
1537
  return {};
1538
1538
  }
1539
- let attrString = match[1];
1540
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1539
+ const attrString = match[1];
1540
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1541
1541
  return attrs.reduce((acc, attr) => {
1542
- let [key, value] = attr.split("=");
1542
+ const [key, value] = attr.split("=");
1543
1543
  acc[key] = value.replace(/['"]/g, "");
1544
1544
  return acc;
1545
1545
  }, {});
@@ -1553,8 +1553,8 @@ var convertSvgToSymbol = (key, code) => {
1553
1553
  "<svg",
1554
1554
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
1555
1555
  );
1556
- symbol = symbol.replace(/width="[^\"]*/, "");
1557
- symbol = symbol.replace(/height="[^\"]*/, "");
1556
+ symbol = symbol.replace(/width="[^"]*/, "");
1557
+ symbol = symbol.replace(/height="[^"]*/, "");
1558
1558
  symbol = symbol.replace("</svg", "</symbol");
1559
1559
  return symbol;
1560
1560
  };
@@ -863,7 +863,7 @@ module.exports = __toCommonJS(sprite_exports);
863
863
  var import_utils = __toESM(require_cjs3(), 1);
864
864
  var generateSprite = (icons) => {
865
865
  let sprite = '<svg aria-hidden="true" width="0" height="0" style="position:absolute">';
866
- for (let key in icons) {
866
+ for (const key in icons) {
867
867
  sprite += icons[key];
868
868
  }
869
869
  sprite += "</svg>";
@@ -873,14 +873,14 @@ var parseRootAttributes = (htmlString) => {
873
873
  if (!(0, import_utils.isString)(htmlString)) {
874
874
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
875
875
  }
876
- let match = htmlString.match(/<svg\s+(.*?)>/);
876
+ const match = htmlString.match(/<svg\s+(.*?)>/);
877
877
  if (!match || !match[1]) {
878
878
  return {};
879
879
  }
880
- let attrString = match[1];
881
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
880
+ const attrString = match[1];
881
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
882
882
  return attrs.reduce((acc, attr) => {
883
- let [key, value] = attr.split("=");
883
+ const [key, value] = attr.split("=");
884
884
  acc[key] = value.replace(/['"]/g, "");
885
885
  return acc;
886
886
  }, {});
@@ -894,8 +894,8 @@ var convertSvgToSymbol = (key, code) => {
894
894
  "<svg",
895
895
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
896
896
  );
897
- symbol = symbol.replace(/width="[^\"]*/, "");
898
- symbol = symbol.replace(/height="[^\"]*/, "");
897
+ symbol = symbol.replace(/width="[^"]*/, "");
898
+ symbol = symbol.replace(/height="[^"]*/, "");
899
899
  symbol = symbol.replace("</svg", "</symbol");
900
900
  return symbol;
901
901
  };
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.10.258",
5
+ "version": "2.10.261",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -32,5 +32,5 @@
32
32
  "peerDependencies": {
33
33
  "@emotion/css": "^11.5.0"
34
34
  },
35
- "gitHead": "988320990c3bd3a293df5c9dce5419ef4551d29e"
35
+ "gitHead": "39a07b63363c6c6547fe25b904fc3e713ee84284"
36
36
  }
package/src/factory.js CHANGED
@@ -33,5 +33,6 @@ export const getActiveConfig = (def) => {
33
33
  }
34
34
 
35
35
  export const setActiveConfig = (def) => {
36
- return FACTORY.active = FACTORY[def]
36
+ FACTORY.active = FACTORY[def]
37
+ return FACTORY.active
37
38
  }
package/src/set.js CHANGED
@@ -90,10 +90,11 @@ export const set = (recivedConfig, options = SET_OPTIONS) => {
90
90
  useIconSprite,
91
91
  globalTheme,
92
92
  useDocumentTheme,
93
- ...config } = recivedConfig
94
-
93
+ ...config
94
+ } = recivedConfig
95
+
95
96
  if (options.newConfig) {
96
- FACTORY['active'] = options.newConfig
97
+ FACTORY.active = options.newConfig
97
98
  CONFIG = getActiveConfig(options.newConfig)
98
99
  }
99
100
 
@@ -119,5 +120,3 @@ export const set = (recivedConfig, options = SET_OPTIONS) => {
119
120
 
120
121
  return CONFIG
121
122
  }
122
-
123
- export * from './system'
@@ -37,7 +37,6 @@ export const getColor = (value, key) => {
37
37
  else if (CONFIG.verbose) console.warn(value, ' - does not have ', key)
38
38
  }
39
39
 
40
-
41
40
  // TODO: support variables
42
41
  // if (alpha) return `rgba(var(${val[shade || ''].var}), ${modifier})`
43
42
 
@@ -6,7 +6,7 @@ import { getMediaTheme } from '.'
6
6
 
7
7
  export const applyReset = (reset = {}) => {
8
8
  const CONFIG = getActiveConfig()
9
- const { CSS_VARS, RESET, TYPOGRAPHY, DOCUMENT } = CONFIG
9
+ const { RESET, TYPOGRAPHY, DOCUMENT } = CONFIG
10
10
  if (RESET) {
11
11
  if (RESET[':root']) {
12
12
  const configReset = RESET
package/src/system/svg.js CHANGED
@@ -1,19 +1,19 @@
1
1
  'use strict'
2
2
 
3
3
  import { document } from '@domql/globals'
4
- import { generateSprite, convertSvgToSymbol } from "../utils"
4
+ import { generateSprite, convertSvgToSymbol } from '../utils'
5
5
  import { getActiveConfig } from '../factory.js'
6
6
 
7
7
  const DEF_OPTIONS = {
8
- document: document
8
+ document
9
9
  }
10
10
 
11
11
  export const setSVG = (val, key) => {
12
+ const CONFIG = getActiveConfig()
12
13
  if (!val) {
13
14
  if (CONFIG.verbose) console.warn('setSVG: val is not defined', key)
14
15
  return
15
16
  }
16
- const CONFIG = getActiveConfig()
17
17
  if (CONFIG.useSvgSprite) {
18
18
  return convertSvgToSymbol(key, val)
19
19
  } return val
@@ -24,14 +24,14 @@ export const appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
24
24
  const doc = options.document || document
25
25
 
26
26
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG.SVG
27
- for (let key in LIBRARY) lib[key] = CONFIG.SVG[key]
28
-
27
+ for (const key in LIBRARY) lib[key] = CONFIG.SVG[key]
28
+
29
29
  const SVGsprite = generateSprite(lib)
30
30
  if (!doc) {
31
31
  console.warn('To append SVG sprites it should be run in browser environment')
32
32
  return SVGsprite
33
33
  }
34
-
34
+
35
35
  const svgSpriteDOM = doc.createElement('template')
36
36
  svgSpriteDOM.innerHTML = SVGsprite
37
37
  doc.body.appendChild(svgSpriteDOM.content)
@@ -47,10 +47,10 @@ export const setIcon = (val, key) => {
47
47
  export const appendIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
48
48
  const CONFIG = getActiveConfig()
49
49
  const doc = options.document || document
50
-
50
+
51
51
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG.ICONS
52
- for (let key in LIBRARY) lib[key] = CONFIG.ICONS[key]
53
-
52
+ for (const key in LIBRARY) lib[key] = CONFIG.ICONS[key]
53
+
54
54
  const SVGsprite = generateSprite(lib)
55
55
  if (!doc) {
56
56
  console.warn('To append SVG Icon sprites it should be run in browser environment')
@@ -168,10 +168,10 @@ export const setMediaTheme = (val, key, suffix, prefers) => {
168
168
  }
169
169
  }
170
170
 
171
- if (theme['background'] || theme['color'] || theme['backgroundColor']) {
171
+ if (theme.background || theme.color || theme.backgroundColor) {
172
172
  theme['.inversed'] = {
173
- color: theme['background'] || theme['backgroundColor'],
174
- background: theme['color']
173
+ color: theme.background || theme.backgroundColor,
174
+ background: theme.color
175
175
  }
176
176
  }
177
177
  }
@@ -1,14 +1,14 @@
1
1
  'use strict'
2
2
 
3
3
  import { isString } from '@domql/utils'
4
- import { getActiveConfig } from "../factory"
4
+ import { getActiveConfig } from '../factory'
5
5
  import {
6
6
  getSpacingByKey,
7
7
  getColor,
8
8
  getMediaColor,
9
9
  getTimingByKey,
10
10
  getTimingFunction
11
- } from "../system"
11
+ } from '../system'
12
12
 
13
13
  const isBorderStyle = str => [
14
14
  'none',
@@ -41,6 +41,7 @@ export const transformTextStroke = stroke => {
41
41
  if (v.slice(0, 2) === '--') return `var(${v})`
42
42
  if (v.includes('px')) return v
43
43
  else if (getColor(v)) return getColor(v)
44
+ return v
44
45
  }).join(' ')
45
46
  }
46
47
 
@@ -65,8 +66,7 @@ export const transformBackgroundImage = (backgroundImage, globalTheme) => {
65
66
  return {
66
67
  backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG.globalTheme)
67
68
  }
68
- }
69
- else if (v.includes('/') || v.includes('http')) return `url(${v})`
69
+ } else if (v.includes('/') || v.includes('http')) return `url(${v})`
70
70
  return v
71
71
  }).join(' ')
72
72
  }
@@ -5,4 +5,4 @@ export * from './theme.js'
5
5
  export * from './font.js'
6
6
  export * from './sequence.js'
7
7
  export * from './var.js'
8
- export * from './sprite.js'
8
+ export * from './sprite.js'
@@ -6,11 +6,11 @@ export const generateSprite = (icons) => {
6
6
  let sprite =
7
7
  '<svg aria-hidden="true" width="0" height="0" style="position:absolute">'
8
8
 
9
- for (let key in icons) {
9
+ for (const key in icons) {
10
10
  sprite += icons[key]
11
11
  }
12
12
 
13
- sprite += "</svg>"
13
+ sprite += '</svg>'
14
14
 
15
15
  return sprite
16
16
  }
@@ -19,33 +19,33 @@ const parseRootAttributes = (htmlString) => {
19
19
  if (!isString(htmlString)) {
20
20
  return console.warn(`parseRootAttributes: ${htmlString} is not a string`)
21
21
  }
22
-
23
- let match = htmlString.match(/<svg\s+(.*?)>/);
22
+
23
+ const match = htmlString.match(/<svg\s+(.*?)>/)
24
24
  if (!match || !match[1]) {
25
- return {};
25
+ return {}
26
26
  }
27
27
 
28
- let attrString = match[1];
29
- let attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
28
+ const attrString = match[1]
29
+ const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm)
30
30
  return attrs.reduce((acc, attr) => {
31
- let [key, value] = attr.split("=");
32
- acc[key] = value.replace(/['"]/g, "");
33
- return acc;
34
- }, {});
31
+ const [key, value] = attr.split('=')
32
+ acc[key] = value.replace(/['"]/g, '')
33
+ return acc
34
+ }, {})
35
35
  }
36
36
 
37
37
  export const convertSvgToSymbol = (key, code) => {
38
38
  const extractAttrs = parseRootAttributes(code)
39
39
  const { width, height } = extractAttrs
40
-
40
+
41
41
  const viewBox = extractAttrs.viewBox || `0 0 ${width || 24} ${height || 24}`
42
42
  const xmlns = 'http://www.w3.org/2000/svg'
43
43
 
44
- let symbol = code.replace("<svg",
44
+ let symbol = code.replace('<svg',
45
45
  `<symbol id="${key}" xmlns="${xmlns}" viewBox="${viewBox}"`
46
46
  )
47
- symbol = symbol.replace(/width="[^\"]*/, "")
48
- symbol = symbol.replace(/height="[^\"]*/, "")
49
- symbol = symbol.replace("</svg", "</symbol")
47
+ symbol = symbol.replace(/width="[^"]*/, '')
48
+ symbol = symbol.replace(/height="[^"]*/, '')
49
+ symbol = symbol.replace('</svg', '</symbol')
50
50
  return symbol
51
51
  }