@symbo.ls/scratch 2.25.3 → 2.27.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
51
51
  return to;
52
52
  };
53
53
  var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
- var src_exports2 = {};
55
- __export2(src_exports2, {
54
+ var index_exports2 = {};
55
+ __export2(index_exports2, {
56
56
  arrayzeValue: () => arrayzeValue3,
57
57
  copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
58
58
  copyStringToClipboard: () => copyStringToClipboard,
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
73
73
  toTitleCase: () => toTitleCase,
74
74
  toggleFullscreen: () => toggleFullscreen
75
75
  });
76
- module2.exports = __toCommonJS2(src_exports2);
76
+ module2.exports = __toCommonJS2(index_exports2);
77
77
  var window22 = globalThis;
78
78
  var document22 = window22.document;
79
79
  var isObject2 = (arg) => {
80
- if (arg === null)
81
- return false;
80
+ if (arg === null) return false;
82
81
  return typeof arg === "object" && arg.constructor === Object;
83
82
  };
84
83
  var isString2 = (arg) => typeof arg === "string";
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
103
102
  };
104
103
  var findClosestNumberInFactory = (val, factory) => {
105
104
  val = parseFloat(val);
106
- if (isObject2(factory))
107
- factory = Object.values(factory);
105
+ if (isObject2(factory)) factory = Object.values(factory);
108
106
  return findClosestNumber(val, factory);
109
107
  };
110
108
  var formatDate = (timestamp) => {
111
- if (!timestamp)
112
- return "";
109
+ if (!timestamp) return "";
113
110
  const d = new Date(timestamp);
114
111
  const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
115
112
  const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
176
173
  scriptEle.type = type;
177
174
  scriptEle.text = xhr.responseText;
178
175
  doc.body.appendChild(scriptEle);
179
- if (typeof fallback === "function")
180
- fallback();
176
+ if (typeof fallback === "function") fallback();
181
177
  } else {
182
178
  throw new Error(`Failed to load the script ${FILE_URL}`);
183
179
  }
@@ -245,27 +241,22 @@ var require_cjs = __commonJS({
245
241
  );
246
242
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
247
243
  var toDescriptionCase = (str = "") => {
248
- if (typeof str !== "string")
249
- return;
244
+ if (typeof str !== "string") return;
250
245
  const result = str.replace(/([A-Z])/g, " $1");
251
246
  return result.charAt(0).toUpperCase() + result.slice(1);
252
247
  };
253
248
  var arrayzeValue3 = (val) => {
254
- if (isArray2(val))
255
- return val;
256
- if (isString2(val))
257
- return val.split(" ");
258
- if (isObject2(val))
259
- return Object.values(val);
260
- if (isNumber2(val))
261
- return [val];
249
+ if (isArray2(val)) return val;
250
+ if (isString2(val)) return val.split(" ");
251
+ if (isObject2(val)) return Object.values(val);
252
+ if (isNumber2(val)) return [val];
262
253
  };
263
254
  }
264
255
  });
265
256
 
266
257
  // src/index.js
267
- var src_exports = {};
268
- __export(src_exports, {
258
+ var index_exports = {};
259
+ __export(index_exports, {
269
260
  ANIMATION: () => ANIMATION,
270
261
  BREAKPOINTS: () => BREAKPOINTS,
271
262
  CASES: () => CASES,
@@ -391,7 +382,7 @@ __export(src_exports, {
391
382
  transformTransition: () => transformTransition,
392
383
  transfromGap: () => transfromGap
393
384
  });
394
- module.exports = __toCommonJS(src_exports);
385
+ module.exports = __toCommonJS(index_exports);
395
386
 
396
387
  // src/utils/index.js
397
388
  var utils_exports = {};
@@ -458,8 +449,7 @@ var isDOMNode = (obj) => {
458
449
 
459
450
  // ../../../domql/packages/utils/dist/esm/types.js
460
451
  var isObject = (arg) => {
461
- if (arg === null)
462
- return false;
452
+ if (arg === null) return false;
463
453
  return typeof arg === "object" && arg.constructor === Object;
464
454
  };
465
455
  var isString = (arg) => typeof arg === "string";
@@ -470,8 +460,7 @@ var isNull = (arg) => arg === null;
470
460
  var isArray = (arg) => Array.isArray(arg);
471
461
  var isDate = (d) => d instanceof Date;
472
462
  var isObjectLike = (arg) => {
473
- if (arg === null)
474
- return false;
463
+ if (arg === null) return false;
475
464
  return typeof arg === "object";
476
465
  };
477
466
  var isDefined = (arg) => {
@@ -483,7 +472,10 @@ var isUndefined = (arg) => {
483
472
 
484
473
  // ../../../domql/packages/utils/dist/esm/array.js
485
474
  var mergeArray = (arr, exclude = []) => {
486
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
475
+ return arr.reduce(
476
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
477
+ {}
478
+ );
487
479
  };
488
480
 
489
481
  // ../../../domql/packages/utils/dist/esm/object.js
@@ -552,8 +544,7 @@ var deepClone = (obj, options = {}) => {
552
544
  const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
553
545
  visited.set(obj, clone2);
554
546
  for (const key in obj) {
555
- if (!Object.prototype.hasOwnProperty.call(obj, key))
556
- continue;
547
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
557
548
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
558
549
  continue;
559
550
  const value = obj[key];
@@ -587,14 +578,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
587
578
  if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
588
579
  return params;
589
580
  }
590
- if (visited.has(obj))
591
- return visited.get(obj);
581
+ if (visited.has(obj)) return visited.get(obj);
592
582
  visited.set(obj, obj);
593
583
  for (const e in params) {
594
- if (!Object.hasOwnProperty.call(params, e))
595
- continue;
596
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
597
- continue;
584
+ if (!Object.hasOwnProperty.call(params, e)) continue;
585
+ if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
598
586
  const objProp = obj[e];
599
587
  const paramsProp = params[e];
600
588
  if (isDOMNode(paramsProp)) {
@@ -614,10 +602,8 @@ var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(nav
614
602
  // src/utils/color.js
615
603
  var ENV = "development";
616
604
  var colorStringToRgbaArray = (color) => {
617
- if (color === "")
618
- return [0, 0, 0, 0];
619
- if (color.toLowerCase() === "transparent")
620
- return [0, 0, 0, 0];
605
+ if (color === "") return [0, 0, 0, 0];
606
+ if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
621
607
  if (color[0] === "#") {
622
608
  if (color.length < 7) {
623
609
  color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
@@ -648,8 +634,7 @@ var colorStringToRgbaArray = (color) => {
648
634
  }
649
635
  }
650
636
  if (color.indexOf("rgb") === 0) {
651
- if (color.indexOf("rgba") === -1)
652
- color = `${color}, 1`;
637
+ if (color.indexOf("rgba") === -1) color = `${color}, 1`;
653
638
  return color.match(/[\.\d]+/g).map((a) => +a);
654
639
  }
655
640
  return [0, 0, 0, 0];
@@ -706,20 +691,14 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
706
691
  var getColorShade = (col, amt) => {
707
692
  const num = parseInt(col, 16);
708
693
  let r = (num >> 16) + amt;
709
- if (r > 255)
710
- r = 255;
711
- else if (r < 0)
712
- r = 0;
694
+ if (r > 255) r = 255;
695
+ else if (r < 0) r = 0;
713
696
  let b = (num >> 8 & 255) + amt;
714
- if (b > 255)
715
- b = 255;
716
- else if (b < 0)
717
- b = 0;
697
+ if (b > 255) b = 255;
698
+ else if (b < 0) b = 0;
718
699
  let g = (num & 255) + amt;
719
- if (g > 255)
720
- g = 255;
721
- else if (g < 0)
722
- g = 0;
700
+ if (g > 255) g = 255;
701
+ else if (g < 0) g = 0;
723
702
  return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
724
703
  };
725
704
  var mixTwoRgba = (colorA, colorB, range = 0.5) => {
@@ -735,20 +714,16 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
735
714
  var opacify = (color, opacity) => {
736
715
  const arr = colorStringToRgbaArray(color);
737
716
  if (!arr) {
738
- if (ENV === "testing" || ENV === "development")
739
- console.warn(color + " color is not rgba");
717
+ if (ENV === "testing" || ENV === "development") console.warn(color + " color is not rgba");
740
718
  return;
741
719
  }
742
720
  arr[3] = opacity;
743
721
  return `rgba(${arr})`;
744
722
  };
745
723
  var getRgbTone = (rgb, tone) => {
746
- if (isString(rgb) && rgb.includes("rgb"))
747
- rgb = colorStringToRgbaArray(rgb).join(", ");
748
- if (isString(rgb))
749
- rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
750
- if (isNumber(tone))
751
- tone += "";
724
+ if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
725
+ if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
726
+ if (isNumber(tone)) tone += "";
752
727
  const toHex = rgbArrayToHex(rgb);
753
728
  const abs = tone.slice(0, 1);
754
729
  if (abs === "-" || abs === "+") {
@@ -765,21 +740,16 @@ var getRgbTone = (rgb, tone) => {
765
740
 
766
741
  // src/utils/theme.js
767
742
  var returnSubThemeOrDefault = (orig, theme) => {
768
- if (!orig)
769
- return;
770
- if (orig.themes && orig.themes[theme])
771
- return orig.themes[theme];
772
- if (orig[theme])
773
- return [orig, orig[theme]];
743
+ if (!orig) return;
744
+ if (orig.themes && orig.themes[theme]) return orig.themes[theme];
745
+ if (orig[theme]) return [orig, orig[theme]];
774
746
  return orig;
775
747
  };
776
748
 
777
749
  // src/utils/font.js
778
750
  var getDefaultOrFirstKey = (LIBRARY, key) => {
779
- if (LIBRARY[key])
780
- return LIBRARY[key].value;
781
- if (LIBRARY.default)
782
- return LIBRARY[LIBRARY.default].value;
751
+ if (LIBRARY[key]) return LIBRARY[key].value;
752
+ if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
783
753
  const hasValue = Object.keys(LIBRARY)[0];
784
754
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
785
755
  };
@@ -806,8 +776,7 @@ var getFontFace = (LIBRARY) => {
806
776
  };
807
777
  var getFontFaceEachString = (name, weights) => {
808
778
  const isArr = weights[0];
809
- if (isArr)
810
- return getFontFaceEach(name, weights).map(setInCustomFontMedia);
779
+ if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
811
780
  return setCustomFontMedia(name, weights.url);
812
781
  };
813
782
  var getFontFaceString = (LIBRARY) => {
@@ -1045,8 +1014,7 @@ var getActiveConfig = (def) => {
1045
1014
  return FACTORY[def || FACTORY.active] || CONFIG;
1046
1015
  };
1047
1016
  var setActiveConfig = (newConfig) => {
1048
- if (!isObject(newConfig))
1049
- return;
1017
+ if (!isObject(newConfig)) return;
1050
1018
  FACTORY.active = "1";
1051
1019
  FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
1052
1020
  return newConfig;
@@ -1098,8 +1066,7 @@ var setSequenceValue = (props, sequenceProps) => {
1098
1066
  var setScalingVar = (key, sequenceProps) => {
1099
1067
  const { base, type, unit } = sequenceProps;
1100
1068
  const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
1101
- if (key === 0)
1102
- return defaultVal;
1069
+ if (key === 0) return defaultVal;
1103
1070
  const prefix = "--" + (type && type.replace(".", "-"));
1104
1071
  const ratioVar = `${prefix}-ratio`;
1105
1072
  if (key > 0) {
@@ -1136,10 +1103,8 @@ var generateSubSequence = (props, sequenceProps) => {
1136
1103
  const diffRounded = ~~next - ~~value;
1137
1104
  let arr;
1138
1105
  const [first, middle, second] = getSubratioDifference(value, ratio);
1139
- if (diffRounded > 16)
1140
- arr = [first, middle, second];
1141
- else
1142
- arr = [first, second];
1106
+ if (diffRounded > 16) arr = [first, middle, second];
1107
+ else arr = [first, second];
1143
1108
  arr.forEach((v, k) => {
1144
1109
  const scaling = ~~(v / base * 1e3) / 1e3;
1145
1110
  const newVar = variable + (k + 1);
@@ -1181,8 +1146,7 @@ var generateSequence = (sequenceProps) => {
1181
1146
  index: key
1182
1147
  };
1183
1148
  setSequenceValue(props, sequenceProps);
1184
- if (subSequence)
1185
- generateSubSequence(props, sequenceProps);
1149
+ if (subSequence) generateSubSequence(props, sequenceProps);
1186
1150
  }
1187
1151
  return sequenceProps;
1188
1152
  };
@@ -1232,13 +1196,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
1232
1196
  unit = UNIT2.default,
1233
1197
  useVariable
1234
1198
  } = sequenceProps;
1235
- if (isString(value) && value.slice(0, 2) === "--")
1236
- return `var(${value})`;
1199
+ if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
1237
1200
  const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
1238
1201
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
1239
1202
  const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
1240
- if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
1241
- return value;
1203
+ if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
1242
1204
  const letterVal = value.toUpperCase();
1243
1205
  const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
1244
1206
  let absValue = isNegative ? letterVal.slice(1) : letterVal;
@@ -1262,8 +1224,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
1262
1224
  return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
1263
1225
  }
1264
1226
  if (!sequence[absValue] && absValue.length === 2) {
1265
- if (CONFIG2.verbose)
1266
- console.warn(absValue, "- value is not found because `subSequence` is set to false");
1227
+ if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
1267
1228
  absValue = absValue.slice(0, 1);
1268
1229
  }
1269
1230
  if (useVariable || CONFIG2.useVariable) {
@@ -1271,8 +1232,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
1271
1232
  return isNegative ? `calc(${varValue2} * -1)` : varValue2;
1272
1233
  }
1273
1234
  const sequenceItem = sequence ? sequence[absValue] : null;
1274
- if (!sequenceItem)
1275
- return console.warn("can't find", sequence, absValue);
1235
+ if (!sequenceItem) return console.warn("can't find", sequence, absValue);
1276
1236
  if (unit === "ms" || unit === "s") {
1277
1237
  return isNegative + sequenceItem.val + unit;
1278
1238
  }
@@ -1281,12 +1241,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
1281
1241
  var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
1282
1242
  if (typeof value !== "string") {
1283
1243
  const CONFIG2 = getActiveConfig();
1284
- if (CONFIG2.verbose)
1285
- console.warn(propertyName, value, "is not a string");
1244
+ if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
1286
1245
  return { [propertyName]: value };
1287
1246
  }
1288
- if (value === "-" || value === "")
1289
- return {};
1247
+ if (value === "-" || value === "") return {};
1290
1248
  return { [propertyName]: getSequenceValue(value, sequenceProps) };
1291
1249
  };
1292
1250
  var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
@@ -1354,23 +1312,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
1354
1312
  const { mediaRegenerate } = FACTORY2;
1355
1313
  const { sequence, scales } = FACTORY2[media];
1356
1314
  const query = MEDIA2[mediaName];
1357
- if (!query && CONFIG2.verbose)
1358
- console.warn("Can't find media query ", query);
1315
+ if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
1359
1316
  if (!mediaRegenerate) {
1360
1317
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
1361
- if (!underMediaQuery)
1362
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1318
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1363
1319
  applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
1364
1320
  return;
1365
1321
  }
1366
1322
  for (const key in sequence) {
1367
1323
  const item = sequence[key];
1368
1324
  const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
1369
- if (!query && CONFIG2.verbose)
1370
- console.warn("Can't find query ", query);
1325
+ if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
1371
1326
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
1372
- if (!underMediaQuery)
1373
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1327
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1374
1328
  underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
1375
1329
  CSS_VARS2[item.variable + "_" + mediaName] = value;
1376
1330
  }
@@ -1383,10 +1337,8 @@ var generateSprite = (icons) => {
1383
1337
  const CONFIG2 = getActiveConfig();
1384
1338
  let sprite = "";
1385
1339
  for (const key in icons) {
1386
- if (CONFIG2.__svg_cache[key])
1387
- continue;
1388
- else
1389
- CONFIG2.__svg_cache[key] = true;
1340
+ if (CONFIG2.__svg_cache[key]) continue;
1341
+ else CONFIG2.__svg_cache[key] = true;
1390
1342
  sprite += icons[key];
1391
1343
  }
1392
1344
  return sprite;
@@ -1394,8 +1346,7 @@ var generateSprite = (icons) => {
1394
1346
  var parseRootAttributes = (htmlString) => {
1395
1347
  const val = htmlString.default || htmlString;
1396
1348
  if (!isString(val)) {
1397
- if (isDev)
1398
- console.warn("parseRootAttributes:", val, "is not a string");
1349
+ if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
1399
1350
  return;
1400
1351
  }
1401
1352
  const match = val.match(/<svg\s+(.*?)>/);
@@ -1477,27 +1428,21 @@ __export(system_exports, {
1477
1428
  var getColor = (value, key, config) => {
1478
1429
  const CONFIG2 = config || getActiveConfig();
1479
1430
  if (!isString(value)) {
1480
- if (CONFIG2.verbose)
1481
- console.warn(value, "- type for color is not valid");
1431
+ if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1482
1432
  return;
1483
1433
  }
1484
- if (value.slice(0, 2) === "--")
1485
- return `var(${value})`;
1486
- if (key && value[key])
1487
- value = value[key];
1434
+ if (value.slice(0, 2) === "--") return `var(${value})`;
1435
+ if (key && value[key]) value = value[key];
1488
1436
  const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
1489
1437
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1490
1438
  let val = COLOR2[name] || GRADIENT2[name];
1491
1439
  if (!val) {
1492
- if (CONFIG2.verbose)
1493
- console.warn("Can't find color ", name);
1440
+ if (CONFIG2.verbose) console.warn("Can't find color ", name);
1494
1441
  return value;
1495
1442
  }
1496
1443
  if (key) {
1497
- if (val[key])
1498
- val = val[key];
1499
- else if (CONFIG2.verbose)
1500
- console.warn(value, " - does not have ", key);
1444
+ if (val[key]) val = val[key];
1445
+ else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
1501
1446
  }
1502
1447
  let rgb = val.rgb;
1503
1448
  if (!rgb) {
@@ -1507,32 +1452,25 @@ var getColor = (value, key, config) => {
1507
1452
  rgb = getRgbTone(rgb, tone);
1508
1453
  val[tone] = { rgb, var: `${val.var}-${tone}` };
1509
1454
  }
1510
- if (val[tone])
1511
- rgb = val[tone].rgb;
1512
- if (alpha)
1513
- return `rgba(${rgb}, ${alpha})`;
1455
+ if (val[tone]) rgb = val[tone].rgb;
1456
+ if (alpha) return `rgba(${rgb}, ${alpha})`;
1514
1457
  return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
1515
1458
  };
1516
1459
  var getMediaColor = (value, globalTheme, config) => {
1517
1460
  const CONFIG2 = config || getActiveConfig();
1518
- if (!globalTheme)
1519
- globalTheme = CONFIG2.globalTheme;
1461
+ if (!globalTheme) globalTheme = CONFIG2.globalTheme;
1520
1462
  if (!isString(value)) {
1521
- if (CONFIG2.verbose)
1522
- console.warn(value, "- type for color is not valid");
1463
+ if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1523
1464
  return;
1524
1465
  }
1525
- if (value.slice(0, 2) === "--")
1526
- return `var(${value})`;
1466
+ if (value.slice(0, 2) === "--") return `var(${value})`;
1527
1467
  const [name] = isArray(value) ? value : value.split(" ");
1528
1468
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1529
1469
  const val = COLOR2[name] || GRADIENT2[name];
1530
1470
  const isObj = isObject(val);
1531
- if (isObj && val.value)
1532
- return getColor(value, `@${globalTheme}`, config);
1471
+ if (isObj && val.value) return getColor(value, `@${globalTheme}`, config);
1533
1472
  else if (isObj) {
1534
- if (globalTheme)
1535
- return getColor(value, `@${globalTheme}`, config);
1473
+ if (globalTheme) return getColor(value, `@${globalTheme}`, config);
1536
1474
  else {
1537
1475
  const obj = {};
1538
1476
  for (const mediaName in val) {
@@ -1543,8 +1481,7 @@ var getMediaColor = (value, globalTheme, config) => {
1543
1481
  return obj;
1544
1482
  }
1545
1483
  } else {
1546
- if (CONFIG2.verbose)
1547
- console.warn("Can't find color", value);
1484
+ if (CONFIG2.verbose) console.warn("Can't find color", value);
1548
1485
  return value;
1549
1486
  }
1550
1487
  };
@@ -1553,8 +1490,7 @@ var setColor = (val, key, suffix) => {
1553
1490
  if (isString(val) && val.slice(0, 2) === "--") {
1554
1491
  val = getColor(val.slice(2));
1555
1492
  if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
1556
- if (CONFIG2.verbose)
1557
- console.warn(val, "- referred but does not exist");
1493
+ if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
1558
1494
  val = val.split(" ")[0];
1559
1495
  }
1560
1496
  }
@@ -1593,8 +1529,7 @@ var setColor = (val, key, suffix) => {
1593
1529
  };
1594
1530
  var setGradient = (val, key, suffix) => {
1595
1531
  const CONFIG2 = getActiveConfig();
1596
- if (isString(val) && val.slice(0, 2) === "--")
1597
- val = getColor(val.slice(2));
1532
+ if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
1598
1533
  if (isArray(val)) {
1599
1534
  return {
1600
1535
  "@light": setGradient(val[0], key, "light"),
@@ -1603,8 +1538,7 @@ var setGradient = (val, key, suffix) => {
1603
1538
  }
1604
1539
  if (isObject(val)) {
1605
1540
  const obj = {};
1606
- for (const variant in val)
1607
- obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1541
+ for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1608
1542
  return obj;
1609
1543
  }
1610
1544
  const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
@@ -1630,22 +1564,19 @@ var setThemeValue = (theme) => {
1630
1564
  return value;
1631
1565
  };
1632
1566
  var getThemeValue = (theme) => {
1633
- if (theme.value)
1634
- return theme.value;
1567
+ if (theme.value) return theme.value;
1635
1568
  theme.value = setThemeValue(theme);
1636
1569
  return theme.value;
1637
1570
  };
1638
1571
  var getTheme = (value, modifier) => {
1639
1572
  const CONFIG2 = getActiveConfig();
1640
- if (CONFIG2.useVariable)
1641
- return getMediaTheme(value, modifier);
1573
+ if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
1642
1574
  const { THEME: THEME2 } = CONFIG2;
1643
1575
  if (isString(value)) {
1644
1576
  const [theme, subtheme] = value.split(" ");
1645
1577
  const isOurTheme = THEME2[theme];
1646
1578
  if (isOurTheme) {
1647
- if (!subtheme && !modifier)
1648
- return getThemeValue(isOurTheme);
1579
+ if (!subtheme && !modifier) return getThemeValue(isOurTheme);
1649
1580
  value = [theme, subtheme || modifier];
1650
1581
  }
1651
1582
  }
@@ -1653,14 +1584,10 @@ var getTheme = (value, modifier) => {
1653
1584
  const themeName = value[0];
1654
1585
  const subThemeName = value[1];
1655
1586
  const { helpers, media, state } = THEME2[themeName];
1656
- if (media && media[subThemeName])
1657
- return getThemeValue(media[subThemeName]);
1658
- if (helpers && helpers[subThemeName])
1659
- return getThemeValue(helpers[subThemeName]);
1660
- if (state && state[subThemeName])
1661
- return getThemeValue(state[subThemeName]);
1662
- } else if (isObject(value))
1663
- return setThemeValue(value);
1587
+ if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
1588
+ if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
1589
+ if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
1590
+ } else if (isObject(value)) return setThemeValue(value);
1664
1591
  };
1665
1592
  var setInverseTheme = (theme, variant, value) => {
1666
1593
  if (isObject(variant)) {
@@ -1678,13 +1605,11 @@ var setInverseTheme = (theme, variant, value) => {
1678
1605
  var setPseudo = (theme, key, variant, themeValue) => {
1679
1606
  const result = getTheme(variant);
1680
1607
  themeValue[`&:${key}`] = result;
1681
- if (isObject(variant) && !variant.value)
1682
- variant.value = result;
1608
+ if (isObject(variant) && !variant.value) variant.value = result;
1683
1609
  };
1684
1610
  var setSelectors = (theme, value) => {
1685
1611
  const { state } = theme;
1686
- if (!state)
1687
- return;
1612
+ if (!state) return;
1688
1613
  const keys = Object.keys(state);
1689
1614
  keys.map((key) => {
1690
1615
  const variant = state[key];
@@ -1696,20 +1621,16 @@ var setSelectors = (theme, value) => {
1696
1621
  var setPrefersScheme = (theme, key, variant, themeValue) => {
1697
1622
  const result = getTheme(variant);
1698
1623
  themeValue[`@media (prefers-color-scheme: ${key})`] = result;
1699
- if (isObject(variant) && !variant.value)
1700
- variant.value = result;
1624
+ if (isObject(variant) && !variant.value) variant.value = result;
1701
1625
  };
1702
1626
  var setMedia = (theme, value) => {
1703
1627
  const { media } = theme;
1704
- if (!media)
1705
- return;
1628
+ if (!media) return;
1706
1629
  const keys = Object.keys(media);
1707
1630
  keys.map((key) => {
1708
1631
  const variant = media[key];
1709
- if (key === "dark" || key === "light")
1710
- setPrefersScheme(theme, key, variant, value);
1711
- if (key === "inverse")
1712
- setInverseTheme(theme, variant, value);
1632
+ if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
1633
+ if (key === "inverse") setInverseTheme(theme, variant, value);
1713
1634
  return theme;
1714
1635
  });
1715
1636
  return theme;
@@ -1717,23 +1638,19 @@ var setMedia = (theme, value) => {
1717
1638
  var setHelpers = (theme, value) => {
1718
1639
  const CONFIG2 = getActiveConfig();
1719
1640
  const { helpers } = theme;
1720
- if (!helpers)
1721
- return;
1641
+ if (!helpers) return;
1722
1642
  const keys = Object.keys(helpers);
1723
1643
  keys.map((key) => {
1724
1644
  const helper = helpers[key];
1725
- if (isString(helper))
1726
- helpers[key] = CONFIG2.THEME[helper];
1727
- else
1728
- getThemeValue(helpers[key]);
1645
+ if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
1646
+ else getThemeValue(helpers[key]);
1729
1647
  return theme;
1730
1648
  });
1731
1649
  return theme;
1732
1650
  };
1733
1651
  var setTheme = (val, key) => {
1734
1652
  const CONFIG2 = getActiveConfig();
1735
- if (CONFIG2.useVariable)
1736
- return setMediaTheme(val, key);
1653
+ if (CONFIG2.useVariable) return setMediaTheme(val, key);
1737
1654
  const { state, media, helpers } = val;
1738
1655
  const value = setThemeValue(val, key);
1739
1656
  const CSSvar = `--theme-${key}`;
@@ -1795,24 +1712,19 @@ var recursiveTheme = (val) => {
1795
1712
  } else if (symb === ":") {
1796
1713
  obj[`&${param}`] = recursiveTheme(val[param]);
1797
1714
  }
1798
- } else
1799
- obj[param] = val[param];
1715
+ } else obj[param] = val[param];
1800
1716
  }
1801
1717
  return obj;
1802
1718
  };
1803
1719
  var findModifierFromArray = (val, modifierArray) => {
1804
1720
  const currentMod = modifierArray.shift();
1805
- if (val[currentMod])
1806
- return findModifierFromArray(val[currentMod], modifierArray);
1721
+ if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
1807
1722
  return val;
1808
1723
  };
1809
1724
  var findModifier = (val, modifier) => {
1810
- if (isArray(modifier))
1811
- return findModifierFromArray(val, modifier);
1812
- else if (isString(modifier) && val[modifier])
1813
- return val[modifier];
1814
- else
1815
- return val;
1725
+ if (isArray(modifier)) return findModifierFromArray(val, modifier);
1726
+ else if (isString(modifier) && val[modifier]) return val[modifier];
1727
+ else return val;
1816
1728
  };
1817
1729
  var getMediaTheme = (value, modifier) => {
1818
1730
  const activeConfig = getActiveConfig();
@@ -1838,8 +1750,7 @@ var getMediaTheme = (value, modifier) => {
1838
1750
  var import_utils11 = __toESM(require_cjs(), 1);
1839
1751
  var setFont = (val, key) => {
1840
1752
  const CSSvar = `--font-${key}`;
1841
- if (!val || isArray(val) && !val[0])
1842
- return;
1753
+ if (!val || isArray(val) && !val[0]) return;
1843
1754
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
1844
1755
  return { var: CSSvar, value: val, fontFace };
1845
1756
  };
@@ -1852,10 +1763,8 @@ var setFontFamily = (val, key) => {
1852
1763
  const CONFIG2 = getActiveConfig();
1853
1764
  const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
1854
1765
  let { value, type } = val;
1855
- if (val.isDefault)
1856
- FONT_FAMILY2.default = key;
1857
- if (isObject(value))
1858
- value = (0, import_utils11.arrayzeValue)(value);
1766
+ if (val.isDefault) FONT_FAMILY2.default = key;
1767
+ if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
1859
1768
  const CSSvar = `--font-family-${key}`;
1860
1769
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
1861
1770
  return { var: CSSvar, value: str, arr: value, type };
@@ -1868,19 +1777,10 @@ var runThroughMedia = (FACTORY2) => {
1868
1777
  for (const prop in FACTORY2) {
1869
1778
  const isPropMedia = prop.slice(0, 1) === "@";
1870
1779
  const mediaValue = FACTORY2[prop];
1871
- if (!isPropMedia)
1872
- continue;
1780
+ if (!isPropMedia) continue;
1873
1781
  const { mediaRegenerate } = FACTORY2;
1874
1782
  const mediaName = prop.slice(1);
1875
- const {
1876
- type,
1877
- base,
1878
- ratio,
1879
- range,
1880
- subSequence,
1881
- h1Matches,
1882
- unit
1883
- } = FACTORY2;
1783
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
1884
1784
  merge(mediaValue, {
1885
1785
  type,
1886
1786
  base,
@@ -1910,7 +1810,7 @@ var runThroughMedia = (FACTORY2) => {
1910
1810
  }
1911
1811
  };
1912
1812
  var applyHeadings = (props) => {
1913
- var _a;
1813
+ var _a, _b;
1914
1814
  const CONFIG2 = getActiveConfig();
1915
1815
  if (props.h1Matches) {
1916
1816
  const unit = props.unit;
@@ -1919,10 +1819,8 @@ var applyHeadings = (props) => {
1919
1819
  for (const k in HEADINGS) {
1920
1820
  const headerName = `h${parseInt(k) + 1}`;
1921
1821
  const headerStyle = templates[headerName];
1922
- if (!HEADINGS[k])
1923
- continue;
1924
1822
  templates[headerName] = {
1925
- fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
1823
+ fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
1926
1824
  margin: headerStyle ? headerStyle.margin : 0,
1927
1825
  lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
1928
1826
  letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
@@ -1942,11 +1840,7 @@ var applyTypographySequence = () => {
1942
1840
  var getFontSizeByKey = (value) => {
1943
1841
  const CONFIG2 = getActiveConfig();
1944
1842
  const { TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
1945
- return getSequenceValuePropertyPair(
1946
- value,
1947
- "fontSize",
1948
- TYPOGRAPHY2
1949
- );
1843
+ return getSequenceValuePropertyPair(value, "fontSize", TYPOGRAPHY2);
1950
1844
  };
1951
1845
 
1952
1846
  // src/system/spacing.js
@@ -1955,8 +1849,7 @@ var runThroughMedia2 = (FACTORY2) => {
1955
1849
  for (const prop in FACTORY2) {
1956
1850
  const mediaProps = FACTORY2[prop];
1957
1851
  const isMediaName = prop.slice(0, 1) === "@";
1958
- if (!isMediaName)
1959
- continue;
1852
+ if (!isMediaName) continue;
1960
1853
  const {
1961
1854
  type,
1962
1855
  base,
@@ -1993,8 +1886,7 @@ var applySpacingSequence = () => {
1993
1886
  var getSequence = (sequenceProps) => {
1994
1887
  const CONFIG2 = getActiveConfig();
1995
1888
  const { SPACING: SPACING2 } = CONFIG2;
1996
- if (!sequenceProps)
1997
- return SPACING2;
1889
+ if (!sequenceProps) return SPACING2;
1998
1890
  const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
1999
1891
  return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
2000
1892
  };
@@ -2004,8 +1896,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
2004
1896
  return { [propertyName]: value };
2005
1897
  }
2006
1898
  const stack = (0, import_utils15.arrayzeValue)(value);
2007
- if (!isArray(stack))
2008
- return;
1899
+ if (!isArray(stack)) return;
2009
1900
  if (stack.length > 1) {
2010
1901
  let suffix = "";
2011
1902
  if (propertyName === "borderWidth") {
@@ -2084,15 +1975,11 @@ var setShadow = (value, key, suffix, prefers) => {
2084
1975
  if (isString(value) && value.includes(",")) {
2085
1976
  value = value.split(",").map((v) => {
2086
1977
  v = v.trim();
2087
- if (v.startsWith("--"))
2088
- return `var(${v})`;
2089
- if (getColor(v).length > 2)
2090
- return getColor(v);
2091
- if (v.includes("px") || v.slice(-2) === "em")
2092
- return v;
1978
+ if (v.startsWith("--")) return `var(${v})`;
1979
+ if (getColor(v).length > 2) return getColor(v);
1980
+ if (v.includes("px") || v.slice(-2) === "em") return v;
2093
1981
  const arr = v.split(" ");
2094
- if (!arr.length)
2095
- return v;
1982
+ if (!arr.length) return v;
2096
1983
  return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
2097
1984
  }).join(" ");
2098
1985
  }
@@ -2107,32 +1994,25 @@ var setShadow = (value, key, suffix, prefers) => {
2107
1994
  };
2108
1995
  var getShadow = (value, globalTheme) => {
2109
1996
  const CONFIG2 = getActiveConfig();
2110
- if (!globalTheme)
2111
- globalTheme = CONFIG2.globalTheme;
1997
+ if (!globalTheme) globalTheme = CONFIG2.globalTheme;
2112
1998
  if (!isString(value)) {
2113
- if (CONFIG2.verbose)
2114
- console.warn(value, "- type for color is not valid");
1999
+ if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
2115
2000
  return;
2116
2001
  }
2117
- if (value.slice(0, 2) === "--")
2118
- return `var(${value})`;
2002
+ if (value.slice(0, 2) === "--") return `var(${value})`;
2119
2003
  const [name] = isArray(value) ? value : value.split(" ");
2120
2004
  const { SHADOW: SHADOW2 } = CONFIG2;
2121
2005
  const val = SHADOW2[name];
2122
2006
  const isObj = isObject(val);
2123
2007
  if (!val) {
2124
- if (CONFIG2.verbose)
2125
- console.warn("Can't find color ", name);
2008
+ if (CONFIG2.verbose) console.warn("Can't find color ", name);
2126
2009
  return value;
2127
2010
  }
2128
2011
  if (globalTheme) {
2129
- if (val[globalTheme])
2130
- return val[globalTheme].value;
2131
- else if (CONFIG2.verbose)
2132
- console.warn(value, " - does not have ", globalTheme);
2012
+ if (val[globalTheme]) return val[globalTheme].value;
2013
+ else if (CONFIG2.verbose) console.warn(value, " - does not have ", globalTheme);
2133
2014
  }
2134
- if (isObj && val.value)
2135
- return val.value;
2015
+ if (isObj && val.value) return val.value;
2136
2016
  if (isObj) {
2137
2017
  const obj = {};
2138
2018
  for (const mediaName in val) {
@@ -2142,8 +2022,7 @@ var getShadow = (value, globalTheme) => {
2142
2022
  }
2143
2023
  return obj;
2144
2024
  }
2145
- if (CONFIG2.verbose)
2146
- console.warn("Can't find color", value);
2025
+ if (CONFIG2.verbose) console.warn("Can't find color", value);
2147
2026
  return value;
2148
2027
  };
2149
2028
 
@@ -2189,8 +2068,7 @@ var DEF_OPTIONS = {
2189
2068
  var setSVG = (val, key) => {
2190
2069
  const CONFIG2 = getActiveConfig();
2191
2070
  if (!val) {
2192
- if (CONFIG2.verbose)
2193
- console.warn("setSVG: val is not defined", key);
2071
+ if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
2194
2072
  return;
2195
2073
  }
2196
2074
  if (CONFIG2.useSvgSprite) {
@@ -2201,8 +2079,7 @@ var setSVG = (val, key) => {
2201
2079
  var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
2202
2080
  const CONFIG2 = getActiveConfig();
2203
2081
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
2204
- for (const key in LIBRARY)
2205
- lib[key] = CONFIG2.SVG[key];
2082
+ for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
2206
2083
  appendSVG(lib, options);
2207
2084
  };
2208
2085
  var setSvgIcon = (val, key) => {
@@ -2216,13 +2093,11 @@ var setSvgIcon = (val, key) => {
2216
2093
  var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
2217
2094
  const CONFIG2 = getActiveConfig();
2218
2095
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
2219
- for (const key in LIBRARY)
2220
- lib[key] = CONFIG2.ICONS[key];
2096
+ for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
2221
2097
  appendSVG(lib, options);
2222
2098
  };
2223
2099
  var createSVGSpriteElement = (options = { isRoot: true }) => {
2224
- if (!document2 || !document2.createElementNS)
2225
- return;
2100
+ if (!document2 || !document2.createElementNS) return;
2226
2101
  const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
2227
2102
  if (options.isRoot) {
2228
2103
  svgElem.setAttribute("aria-hidden", "true");
@@ -2278,8 +2153,7 @@ var applyReset = (reset = {}) => {
2278
2153
  }
2279
2154
  const { body, ...templates } = TYPOGRAPHY2.templates;
2280
2155
  const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
2281
- if (RESET2.html)
2282
- overwriteDeep(RESET2.html, globalTheme);
2156
+ if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
2283
2157
  return deepMerge(merge(RESET2, reset), {
2284
2158
  html: {
2285
2159
  position: "absolute",
@@ -2336,25 +2210,18 @@ var transformBorder = (border) => {
2336
2210
  const arr = border.split(", ");
2337
2211
  return arr.map((v) => {
2338
2212
  v = v.trim();
2339
- if (v.slice(0, 2) === "--")
2340
- return `var(${v})`;
2341
- else if (isBorderStyle(v))
2342
- return v || "solid";
2343
- else if (v.slice(-2) === "px" || v.slice(-2) === "em")
2344
- return v;
2345
- else if (getColor(v).length > 2)
2346
- return getColor(v);
2213
+ if (v.slice(0, 2) === "--") return `var(${v})`;
2214
+ else if (isBorderStyle(v)) return v || "solid";
2215
+ else if (v.slice(-2) === "px" || v.slice(-2) === "em") return v;
2216
+ else if (getColor(v).length > 2) return getColor(v);
2347
2217
  return getSpacingByKey(v, "border").border;
2348
2218
  }).join(" ");
2349
2219
  };
2350
2220
  var transformTextStroke = (stroke) => {
2351
2221
  return stroke.split(", ").map((v) => {
2352
- if (v.slice(0, 2) === "--")
2353
- return `var(${v})`;
2354
- if (v.includes("px"))
2355
- return v;
2356
- else if (getColor(v))
2357
- return getColor(v);
2222
+ if (v.slice(0, 2) === "--") return `var(${v})`;
2223
+ if (v.includes("px")) return v;
2224
+ else if (getColor(v)) return getColor(v);
2358
2225
  return v;
2359
2226
  }).join(" ");
2360
2227
  };
@@ -2362,64 +2229,52 @@ var transformShadow = (sh, globalTheme) => getShadow(sh, globalTheme);
2362
2229
  var transformBoxShadow = (shadows, globalTheme) => shadows.split("|").map((shadow) => {
2363
2230
  return shadow.split(",").map((v) => {
2364
2231
  v = v.trim();
2365
- if (v.slice(0, 2) === "--")
2366
- return `var(${v})`;
2232
+ if (v.slice(0, 2) === "--") return `var(${v})`;
2367
2233
  if (getColor(v).length > 2) {
2368
2234
  const color = getMediaColor(v, globalTheme);
2369
- if (isObject(color))
2370
- return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
2235
+ if (isObject(color)) return Object.values(color).filter((v2) => v2.includes(": " + globalTheme))[0];
2371
2236
  return color;
2372
2237
  }
2373
- if (v.includes("px") || v.slice(-2) === "em")
2374
- return v;
2238
+ if (v.includes("px") || v.slice(-2) === "em") return v;
2375
2239
  const arr = v.split(" ");
2376
- if (!arr.length)
2377
- return v;
2240
+ if (!arr.length) return v;
2378
2241
  return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
2379
2242
  }).join(" ");
2380
2243
  }).join(",");
2381
2244
  var transformBackgroundImage = (backgroundImage, globalTheme) => {
2382
2245
  const CONFIG2 = getActiveConfig();
2383
2246
  return backgroundImage.split(", ").map((v) => {
2384
- if (v.slice(0, 2) === "--")
2385
- return `var(${v})`;
2386
- if (v.includes("url") || v.includes("gradient"))
2387
- return v;
2247
+ if (v.slice(0, 2) === "--") return `var(${v})`;
2248
+ if (v.includes("url") || v.includes("gradient")) return v;
2388
2249
  else if (CONFIG2.GRADIENT[backgroundImage]) {
2389
2250
  return {
2390
2251
  backgroundImage: getMediaColor(backgroundImage, globalTheme || CONFIG2.globalTheme)
2391
2252
  };
2392
- } else if (v.includes("/") || v.startsWith("http") || v.includes("."))
2393
- return `url(${v})`;
2253
+ } else if (v.includes("/") || v.startsWith("http") || v.includes(".")) return `url(${v})`;
2394
2254
  return v;
2395
2255
  }).join(" ");
2396
2256
  };
2397
2257
  var transfromGap = (gap) => isString(gap) && gap.split(" ").map((v) => getSpacingByKey(v, "gap").gap).join(" ");
2398
2258
  var transformTransition = (transition) => {
2399
2259
  const arr = transition.split(" ");
2400
- if (!arr.length)
2401
- return transition;
2260
+ if (!arr.length) return transition;
2402
2261
  return arr.map((v) => {
2403
- if (v.slice(0, 2) === "--")
2404
- return `var(${v})`;
2262
+ if (v.slice(0, 2) === "--") return `var(${v})`;
2405
2263
  if (v.length < 3 || v.includes("ms")) {
2406
2264
  const mapWithSequence = getTimingByKey(v);
2407
2265
  return mapWithSequence.timing || v;
2408
2266
  }
2409
- if (getTimingFunction(v))
2410
- return getTimingFunction(v);
2267
+ if (getTimingFunction(v)) return getTimingFunction(v);
2411
2268
  return v;
2412
2269
  }).join(" ");
2413
2270
  };
2414
2271
  var transformDuration = (duration, props, propertyName) => {
2415
- if (!isString(duration))
2416
- return;
2272
+ if (!isString(duration)) return;
2417
2273
  return duration.split(",").map((v) => getTimingByKey(v).timing || v).join(",");
2418
2274
  };
2419
2275
  var splitTransition = (transition) => {
2420
2276
  const arr = transition.split(",");
2421
- if (!arr.length)
2422
- return;
2277
+ if (!arr.length) return;
2423
2278
  return arr.map(transformTransition).join(",");
2424
2279
  };
2425
2280
  var checkIfBoxSize = (propertyName) => {
@@ -2428,16 +2283,14 @@ var checkIfBoxSize = (propertyName) => {
2428
2283
  };
2429
2284
  var transformSize = (propertyName, val, props = {}, opts = {}) => {
2430
2285
  let value = val || props[propertyName];
2431
- if (isUndefined(value) && isNull(value))
2432
- return;
2286
+ if (isUndefined(value) && isNull(value)) return;
2433
2287
  const shouldScaleBoxSize = props.scaleBoxSize;
2434
2288
  const isBoxSize = checkIfBoxSize(propertyName);
2435
2289
  if (!shouldScaleBoxSize && isBoxSize && isString(value)) {
2436
2290
  value = value.split(" ").map((v) => {
2437
2291
  const isSingleLetter = v.length < 3 && /[A-Z]/.test(v);
2438
2292
  const hasUnits = ["%", "vw", "vh", "ch"].some((unit) => value.includes(unit));
2439
- if (isSingleLetter && !hasUnits)
2440
- return v + "_default";
2293
+ if (isSingleLetter && !hasUnits) return v + "_default";
2441
2294
  return v;
2442
2295
  }).join(" ");
2443
2296
  }
@@ -2455,8 +2308,7 @@ var transformSizeRatio = (propertyName, props) => {
2455
2308
 
2456
2309
  // src/set.js
2457
2310
  var setCases = (val, key) => {
2458
- if (isFunction(val))
2459
- return val();
2311
+ if (isFunction(val)) return val();
2460
2312
  return val;
2461
2313
  };
2462
2314
  var setSameValue = (val, key) => val;
@@ -2492,12 +2344,10 @@ var setValue = (FACTORY_NAME, value, key) => {
2492
2344
  FACTORY2[key] = result;
2493
2345
  return FACTORY2;
2494
2346
  } catch (error) {
2495
- if (CONFIG2.verbose)
2496
- console.warn("Error setting", factoryName, "value", value, key, error);
2347
+ if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
2497
2348
  }
2498
2349
  }
2499
- if (CONFIG2.verbose)
2500
- console.warn("Can not find", factoryName, "method in scratch");
2350
+ if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
2501
2351
  };
2502
2352
  var setEach = (factoryName, props) => {
2503
2353
  const CONFIG2 = getActiveConfig();
@@ -2507,8 +2357,7 @@ var setEach = (factoryName, props) => {
2507
2357
  try {
2508
2358
  return setValue(FACTORY_NAME, props[key], key);
2509
2359
  } catch (error) {
2510
- if (CONFIG2.verbose)
2511
- console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
2360
+ if (CONFIG2.verbose) console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
2512
2361
  }
2513
2362
  });
2514
2363
  return CONFIG2[FACTORY_NAME];
@@ -2533,54 +2382,39 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
2533
2382
  if (options.newConfig) {
2534
2383
  CONFIG2 = setActiveConfig(options.newConfig);
2535
2384
  }
2536
- if (verbose !== void 0)
2537
- CONFIG2.verbose = verbose;
2538
- if (useVariable !== void 0)
2539
- CONFIG2.useVariable = useVariable;
2540
- if (useReset !== void 0)
2541
- CONFIG2.useReset = useReset;
2542
- if (useFontImport !== void 0)
2543
- CONFIG2.useFontImport = useFontImport;
2544
- if (useSvgSprite !== void 0)
2545
- CONFIG2.useSvgSprite = useSvgSprite;
2546
- if (useIconSprite !== void 0)
2547
- CONFIG2.useIconSprite = useIconSprite;
2548
- if (useDocumentTheme !== void 0)
2549
- CONFIG2.useDocumentTheme = useDocumentTheme;
2550
- if (globalTheme !== void 0)
2551
- CONFIG2.globalTheme = globalTheme;
2552
- if (useDefaultConfig !== void 0)
2553
- CONFIG2.useDefaultConfig = useDefaultConfig;
2554
- if (SEMANTIC_ICONS2 !== void 0)
2555
- CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
2556
- if (CONFIG2.verbose)
2557
- console.log(CONFIG2);
2558
- if (!CONFIG2.__svg_cache)
2559
- CONFIG2.__svg_cache = {};
2385
+ if (verbose !== void 0) CONFIG2.verbose = verbose;
2386
+ if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
2387
+ if (useReset !== void 0) CONFIG2.useReset = useReset;
2388
+ if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
2389
+ if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
2390
+ if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
2391
+ if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
2392
+ if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
2393
+ if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
2394
+ if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
2395
+ if (CONFIG2.verbose) console.log(CONFIG2);
2396
+ if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
2560
2397
  const keys = Object.keys(config);
2561
2398
  keys.map((key) => setEach(key, config[key]));
2562
2399
  if (config.TYPOGRAPHY) {
2563
2400
  try {
2564
2401
  applyTypographySequence();
2565
2402
  } catch (e) {
2566
- if (CONFIG2.verbose)
2567
- console.warn("Error applying typography sequence", e);
2403
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
2568
2404
  }
2569
2405
  }
2570
2406
  if (config.SPACING) {
2571
2407
  try {
2572
2408
  applySpacingSequence();
2573
2409
  } catch (e) {
2574
- if (CONFIG2.verbose)
2575
- console.warn("Error applying typography sequence", e);
2410
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
2576
2411
  }
2577
2412
  }
2578
2413
  if (config.TIMING) {
2579
2414
  try {
2580
2415
  applyTimingSequence();
2581
2416
  } catch (e) {
2582
- if (CONFIG2.verbose)
2583
- console.warn("Error applying typography sequence", e);
2417
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
2584
2418
  }
2585
2419
  }
2586
2420
  applyDocument();