@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/set.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_exports = {};
55
- __export2(src_exports, {
54
+ var index_exports = {};
55
+ __export2(index_exports, {
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_exports);
76
+ module2.exports = __toCommonJS2(index_exports);
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,20 +241,15 @@ 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
  });
@@ -284,8 +275,7 @@ var isDOMNode = (obj) => {
284
275
 
285
276
  // ../../../domql/packages/utils/dist/esm/types.js
286
277
  var isObject = (arg) => {
287
- if (arg === null)
288
- return false;
278
+ if (arg === null) return false;
289
279
  return typeof arg === "object" && arg.constructor === Object;
290
280
  };
291
281
  var isString = (arg) => typeof arg === "string";
@@ -294,8 +284,7 @@ var isFunction = (arg) => typeof arg === "function";
294
284
  var isNull = (arg) => arg === null;
295
285
  var isArray = (arg) => Array.isArray(arg);
296
286
  var isObjectLike = (arg) => {
297
- if (arg === null)
298
- return false;
287
+ if (arg === null) return false;
299
288
  return typeof arg === "object";
300
289
  };
301
290
  var isUndefined = (arg) => {
@@ -304,7 +293,10 @@ var isUndefined = (arg) => {
304
293
 
305
294
  // ../../../domql/packages/utils/dist/esm/array.js
306
295
  var mergeArray = (arr, exclude = []) => {
307
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
296
+ return arr.reduce(
297
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
298
+ {}
299
+ );
308
300
  };
309
301
 
310
302
  // ../../../domql/packages/utils/dist/esm/object.js
@@ -373,8 +365,7 @@ var deepClone = (obj, options = {}) => {
373
365
  const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
374
366
  visited.set(obj, clone2);
375
367
  for (const key in obj) {
376
- if (!Object.prototype.hasOwnProperty.call(obj, key))
377
- continue;
368
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
378
369
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
379
370
  continue;
380
371
  const value = obj[key];
@@ -408,14 +399,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
408
399
  if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
409
400
  return params;
410
401
  }
411
- if (visited.has(obj))
412
- return visited.get(obj);
402
+ if (visited.has(obj)) return visited.get(obj);
413
403
  visited.set(obj, obj);
414
404
  for (const e in params) {
415
- if (!Object.hasOwnProperty.call(params, e))
416
- continue;
417
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
418
- continue;
405
+ if (!Object.hasOwnProperty.call(params, e)) continue;
406
+ if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
419
407
  const objProp = obj[e];
420
408
  const paramsProp = params[e];
421
409
  if (isDOMNode(paramsProp)) {
@@ -653,8 +641,7 @@ var getActiveConfig = (def) => {
653
641
  return FACTORY[def || FACTORY.active] || CONFIG;
654
642
  };
655
643
  var setActiveConfig = (newConfig) => {
656
- if (!isObject(newConfig))
657
- return;
644
+ if (!isObject(newConfig)) return;
658
645
  FACTORY.active = "1";
659
646
  FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
660
647
  return newConfig;
@@ -667,10 +654,8 @@ var isScalingUnit = (unit) => {
667
654
 
668
655
  // src/utils/color.js
669
656
  var colorStringToRgbaArray = (color) => {
670
- if (color === "")
671
- return [0, 0, 0, 0];
672
- if (color.toLowerCase() === "transparent")
673
- return [0, 0, 0, 0];
657
+ if (color === "") return [0, 0, 0, 0];
658
+ if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
674
659
  if (color[0] === "#") {
675
660
  if (color.length < 7) {
676
661
  color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
@@ -701,8 +686,7 @@ var colorStringToRgbaArray = (color) => {
701
686
  }
702
687
  }
703
688
  if (color.indexOf("rgb") === 0) {
704
- if (color.indexOf("rgba") === -1)
705
- color = `${color}, 1`;
689
+ if (color.indexOf("rgba") === -1) color = `${color}, 1`;
706
690
  return color.match(/[\.\d]+/g).map((a) => +a);
707
691
  }
708
692
  return [0, 0, 0, 0];
@@ -728,29 +712,20 @@ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) %
728
712
  var getColorShade = (col, amt) => {
729
713
  const num = parseInt(col, 16);
730
714
  let r = (num >> 16) + amt;
731
- if (r > 255)
732
- r = 255;
733
- else if (r < 0)
734
- r = 0;
715
+ if (r > 255) r = 255;
716
+ else if (r < 0) r = 0;
735
717
  let b = (num >> 8 & 255) + amt;
736
- if (b > 255)
737
- b = 255;
738
- else if (b < 0)
739
- b = 0;
718
+ if (b > 255) b = 255;
719
+ else if (b < 0) b = 0;
740
720
  let g = (num & 255) + amt;
741
- if (g > 255)
742
- g = 255;
743
- else if (g < 0)
744
- g = 0;
721
+ if (g > 255) g = 255;
722
+ else if (g < 0) g = 0;
745
723
  return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
746
724
  };
747
725
  var getRgbTone = (rgb, tone) => {
748
- if (isString(rgb) && rgb.includes("rgb"))
749
- rgb = colorStringToRgbaArray(rgb).join(", ");
750
- if (isString(rgb))
751
- rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
752
- if (isNumber(tone))
753
- tone += "";
726
+ if (isString(rgb) && rgb.includes("rgb")) rgb = colorStringToRgbaArray(rgb).join(", ");
727
+ if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
728
+ if (isNumber(tone)) tone += "";
754
729
  const toHex = rgbArrayToHex(rgb);
755
730
  const abs = tone.slice(0, 1);
756
731
  if (abs === "-" || abs === "+") {
@@ -767,10 +742,8 @@ var getRgbTone = (rgb, tone) => {
767
742
 
768
743
  // src/utils/font.js
769
744
  var getDefaultOrFirstKey = (LIBRARY, key) => {
770
- if (LIBRARY[key])
771
- return LIBRARY[key].value;
772
- if (LIBRARY.default)
773
- return LIBRARY[LIBRARY.default].value;
745
+ if (LIBRARY[key]) return LIBRARY[key].value;
746
+ if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
774
747
  const hasValue = Object.keys(LIBRARY)[0];
775
748
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
776
749
  };
@@ -838,8 +811,7 @@ var setSequenceValue = (props, sequenceProps) => {
838
811
  var setScalingVar = (key, sequenceProps) => {
839
812
  const { base, type, unit } = sequenceProps;
840
813
  const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
841
- if (key === 0)
842
- return defaultVal;
814
+ if (key === 0) return defaultVal;
843
815
  const prefix = "--" + (type && type.replace(".", "-"));
844
816
  const ratioVar = `${prefix}-ratio`;
845
817
  if (key > 0) {
@@ -876,10 +848,8 @@ var generateSubSequence = (props, sequenceProps) => {
876
848
  const diffRounded = ~~next - ~~value;
877
849
  let arr;
878
850
  const [first, middle, second] = getSubratioDifference(value, ratio);
879
- if (diffRounded > 16)
880
- arr = [first, middle, second];
881
- else
882
- arr = [first, second];
851
+ if (diffRounded > 16) arr = [first, middle, second];
852
+ else arr = [first, second];
883
853
  arr.forEach((v, k) => {
884
854
  const scaling = ~~(v / base * 1e3) / 1e3;
885
855
  const newVar = variable + (k + 1);
@@ -921,8 +891,7 @@ var generateSequence = (sequenceProps) => {
921
891
  index: key
922
892
  };
923
893
  setSequenceValue(props, sequenceProps);
924
- if (subSequence)
925
- generateSubSequence(props, sequenceProps);
894
+ if (subSequence) generateSubSequence(props, sequenceProps);
926
895
  }
927
896
  return sequenceProps;
928
897
  };
@@ -934,13 +903,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
934
903
  unit = UNIT2.default,
935
904
  useVariable
936
905
  } = sequenceProps;
937
- if (isString(value) && value.slice(0, 2) === "--")
938
- return `var(${value})`;
906
+ if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
939
907
  const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
940
908
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
941
909
  const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
942
- 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)
943
- return value;
910
+ 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;
944
911
  const letterVal = value.toUpperCase();
945
912
  const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
946
913
  let absValue = isNegative ? letterVal.slice(1) : letterVal;
@@ -964,8 +931,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
964
931
  return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
965
932
  }
966
933
  if (!sequence[absValue] && absValue.length === 2) {
967
- if (CONFIG2.verbose)
968
- console.warn(absValue, "- value is not found because `subSequence` is set to false");
934
+ if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
969
935
  absValue = absValue.slice(0, 1);
970
936
  }
971
937
  if (useVariable || CONFIG2.useVariable) {
@@ -973,8 +939,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
973
939
  return isNegative ? `calc(${varValue2} * -1)` : varValue2;
974
940
  }
975
941
  const sequenceItem = sequence ? sequence[absValue] : null;
976
- if (!sequenceItem)
977
- return console.warn("can't find", sequence, absValue);
942
+ if (!sequenceItem) return console.warn("can't find", sequence, absValue);
978
943
  if (unit === "ms" || unit === "s") {
979
944
  return isNegative + sequenceItem.val + unit;
980
945
  }
@@ -983,12 +948,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
983
948
  var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
984
949
  if (typeof value !== "string") {
985
950
  const CONFIG2 = getActiveConfig();
986
- if (CONFIG2.verbose)
987
- console.warn(propertyName, value, "is not a string");
951
+ if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
988
952
  return { [propertyName]: value };
989
953
  }
990
- if (value === "-" || value === "")
991
- return {};
954
+ if (value === "-" || value === "") return {};
992
955
  return { [propertyName]: getSequenceValue(value, sequenceProps) };
993
956
  };
994
957
  var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
@@ -1048,23 +1011,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
1048
1011
  const { mediaRegenerate } = FACTORY2;
1049
1012
  const { sequence, scales } = FACTORY2[media];
1050
1013
  const query = MEDIA2[mediaName];
1051
- if (!query && CONFIG2.verbose)
1052
- console.warn("Can't find media query ", query);
1014
+ if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
1053
1015
  if (!mediaRegenerate) {
1054
1016
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
1055
- if (!underMediaQuery)
1056
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1017
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1057
1018
  applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
1058
1019
  return;
1059
1020
  }
1060
1021
  for (const key in sequence) {
1061
1022
  const item = sequence[key];
1062
1023
  const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
1063
- if (!query && CONFIG2.verbose)
1064
- console.warn("Can't find query ", query);
1024
+ if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
1065
1025
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
1066
- if (!underMediaQuery)
1067
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1026
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1068
1027
  underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
1069
1028
  CSS_VARS2[item.variable + "_" + mediaName] = value;
1070
1029
  }
@@ -1076,8 +1035,7 @@ var isDev = ENV === "development" || ENV === "testing";
1076
1035
  var parseRootAttributes = (htmlString) => {
1077
1036
  const val = htmlString.default || htmlString;
1078
1037
  if (!isString(val)) {
1079
- if (isDev)
1080
- console.warn("parseRootAttributes:", val, "is not a string");
1038
+ if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
1081
1039
  return;
1082
1040
  }
1083
1041
  const match = val.match(/<svg\s+(.*?)>/);
@@ -1125,27 +1083,21 @@ var convertSvgToSymbol = (key, code) => {
1125
1083
  var getColor = (value, key, config) => {
1126
1084
  const CONFIG2 = config || getActiveConfig();
1127
1085
  if (!isString(value)) {
1128
- if (CONFIG2.verbose)
1129
- console.warn(value, "- type for color is not valid");
1086
+ if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1130
1087
  return;
1131
1088
  }
1132
- if (value.slice(0, 2) === "--")
1133
- return `var(${value})`;
1134
- if (key && value[key])
1135
- value = value[key];
1089
+ if (value.slice(0, 2) === "--") return `var(${value})`;
1090
+ if (key && value[key]) value = value[key];
1136
1091
  const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
1137
1092
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1138
1093
  let val = COLOR2[name] || GRADIENT2[name];
1139
1094
  if (!val) {
1140
- if (CONFIG2.verbose)
1141
- console.warn("Can't find color ", name);
1095
+ if (CONFIG2.verbose) console.warn("Can't find color ", name);
1142
1096
  return value;
1143
1097
  }
1144
1098
  if (key) {
1145
- if (val[key])
1146
- val = val[key];
1147
- else if (CONFIG2.verbose)
1148
- console.warn(value, " - does not have ", key);
1099
+ if (val[key]) val = val[key];
1100
+ else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
1149
1101
  }
1150
1102
  let rgb = val.rgb;
1151
1103
  if (!rgb) {
@@ -1155,10 +1107,8 @@ var getColor = (value, key, config) => {
1155
1107
  rgb = getRgbTone(rgb, tone);
1156
1108
  val[tone] = { rgb, var: `${val.var}-${tone}` };
1157
1109
  }
1158
- if (val[tone])
1159
- rgb = val[tone].rgb;
1160
- if (alpha)
1161
- return `rgba(${rgb}, ${alpha})`;
1110
+ if (val[tone]) rgb = val[tone].rgb;
1111
+ if (alpha) return `rgba(${rgb}, ${alpha})`;
1162
1112
  return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
1163
1113
  };
1164
1114
  var setColor = (val, key, suffix) => {
@@ -1166,8 +1116,7 @@ var setColor = (val, key, suffix) => {
1166
1116
  if (isString(val) && val.slice(0, 2) === "--") {
1167
1117
  val = getColor(val.slice(2));
1168
1118
  if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
1169
- if (CONFIG2.verbose)
1170
- console.warn(val, "- referred but does not exist");
1119
+ if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
1171
1120
  val = val.split(" ")[0];
1172
1121
  }
1173
1122
  }
@@ -1206,8 +1155,7 @@ var setColor = (val, key, suffix) => {
1206
1155
  };
1207
1156
  var setGradient = (val, key, suffix) => {
1208
1157
  const CONFIG2 = getActiveConfig();
1209
- if (isString(val) && val.slice(0, 2) === "--")
1210
- val = getColor(val.slice(2));
1158
+ if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
1211
1159
  if (isArray(val)) {
1212
1160
  return {
1213
1161
  "@light": setGradient(val[0], key, "light"),
@@ -1216,8 +1164,7 @@ var setGradient = (val, key, suffix) => {
1216
1164
  }
1217
1165
  if (isObject(val)) {
1218
1166
  const obj = {};
1219
- for (const variant in val)
1220
- obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1167
+ for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1221
1168
  return obj;
1222
1169
  }
1223
1170
  const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
@@ -1243,22 +1190,19 @@ var setThemeValue = (theme) => {
1243
1190
  return value;
1244
1191
  };
1245
1192
  var getThemeValue = (theme) => {
1246
- if (theme.value)
1247
- return theme.value;
1193
+ if (theme.value) return theme.value;
1248
1194
  theme.value = setThemeValue(theme);
1249
1195
  return theme.value;
1250
1196
  };
1251
1197
  var getTheme = (value, modifier) => {
1252
1198
  const CONFIG2 = getActiveConfig();
1253
- if (CONFIG2.useVariable)
1254
- return getMediaTheme(value, modifier);
1199
+ if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
1255
1200
  const { THEME: THEME2 } = CONFIG2;
1256
1201
  if (isString(value)) {
1257
1202
  const [theme, subtheme] = value.split(" ");
1258
1203
  const isOurTheme = THEME2[theme];
1259
1204
  if (isOurTheme) {
1260
- if (!subtheme && !modifier)
1261
- return getThemeValue(isOurTheme);
1205
+ if (!subtheme && !modifier) return getThemeValue(isOurTheme);
1262
1206
  value = [theme, subtheme || modifier];
1263
1207
  }
1264
1208
  }
@@ -1266,14 +1210,10 @@ var getTheme = (value, modifier) => {
1266
1210
  const themeName = value[0];
1267
1211
  const subThemeName = value[1];
1268
1212
  const { helpers, media, state } = THEME2[themeName];
1269
- if (media && media[subThemeName])
1270
- return getThemeValue(media[subThemeName]);
1271
- if (helpers && helpers[subThemeName])
1272
- return getThemeValue(helpers[subThemeName]);
1273
- if (state && state[subThemeName])
1274
- return getThemeValue(state[subThemeName]);
1275
- } else if (isObject(value))
1276
- return setThemeValue(value);
1213
+ if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
1214
+ if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
1215
+ if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
1216
+ } else if (isObject(value)) return setThemeValue(value);
1277
1217
  };
1278
1218
  var setInverseTheme = (theme, variant, value) => {
1279
1219
  if (isObject(variant)) {
@@ -1291,13 +1231,11 @@ var setInverseTheme = (theme, variant, value) => {
1291
1231
  var setPseudo = (theme, key, variant, themeValue) => {
1292
1232
  const result = getTheme(variant);
1293
1233
  themeValue[`&:${key}`] = result;
1294
- if (isObject(variant) && !variant.value)
1295
- variant.value = result;
1234
+ if (isObject(variant) && !variant.value) variant.value = result;
1296
1235
  };
1297
1236
  var setSelectors = (theme, value) => {
1298
1237
  const { state } = theme;
1299
- if (!state)
1300
- return;
1238
+ if (!state) return;
1301
1239
  const keys = Object.keys(state);
1302
1240
  keys.map((key) => {
1303
1241
  const variant = state[key];
@@ -1309,20 +1247,16 @@ var setSelectors = (theme, value) => {
1309
1247
  var setPrefersScheme = (theme, key, variant, themeValue) => {
1310
1248
  const result = getTheme(variant);
1311
1249
  themeValue[`@media (prefers-color-scheme: ${key})`] = result;
1312
- if (isObject(variant) && !variant.value)
1313
- variant.value = result;
1250
+ if (isObject(variant) && !variant.value) variant.value = result;
1314
1251
  };
1315
1252
  var setMedia = (theme, value) => {
1316
1253
  const { media } = theme;
1317
- if (!media)
1318
- return;
1254
+ if (!media) return;
1319
1255
  const keys = Object.keys(media);
1320
1256
  keys.map((key) => {
1321
1257
  const variant = media[key];
1322
- if (key === "dark" || key === "light")
1323
- setPrefersScheme(theme, key, variant, value);
1324
- if (key === "inverse")
1325
- setInverseTheme(theme, variant, value);
1258
+ if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
1259
+ if (key === "inverse") setInverseTheme(theme, variant, value);
1326
1260
  return theme;
1327
1261
  });
1328
1262
  return theme;
@@ -1330,23 +1264,19 @@ var setMedia = (theme, value) => {
1330
1264
  var setHelpers = (theme, value) => {
1331
1265
  const CONFIG2 = getActiveConfig();
1332
1266
  const { helpers } = theme;
1333
- if (!helpers)
1334
- return;
1267
+ if (!helpers) return;
1335
1268
  const keys = Object.keys(helpers);
1336
1269
  keys.map((key) => {
1337
1270
  const helper = helpers[key];
1338
- if (isString(helper))
1339
- helpers[key] = CONFIG2.THEME[helper];
1340
- else
1341
- getThemeValue(helpers[key]);
1271
+ if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
1272
+ else getThemeValue(helpers[key]);
1342
1273
  return theme;
1343
1274
  });
1344
1275
  return theme;
1345
1276
  };
1346
1277
  var setTheme = (val, key) => {
1347
1278
  const CONFIG2 = getActiveConfig();
1348
- if (CONFIG2.useVariable)
1349
- return setMediaTheme(val, key);
1279
+ if (CONFIG2.useVariable) return setMediaTheme(val, key);
1350
1280
  const { state, media, helpers } = val;
1351
1281
  const value = setThemeValue(val, key);
1352
1282
  const CSSvar = `--theme-${key}`;
@@ -1408,24 +1338,19 @@ var recursiveTheme = (val) => {
1408
1338
  } else if (symb === ":") {
1409
1339
  obj[`&${param}`] = recursiveTheme(val[param]);
1410
1340
  }
1411
- } else
1412
- obj[param] = val[param];
1341
+ } else obj[param] = val[param];
1413
1342
  }
1414
1343
  return obj;
1415
1344
  };
1416
1345
  var findModifierFromArray = (val, modifierArray) => {
1417
1346
  const currentMod = modifierArray.shift();
1418
- if (val[currentMod])
1419
- return findModifierFromArray(val[currentMod], modifierArray);
1347
+ if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
1420
1348
  return val;
1421
1349
  };
1422
1350
  var findModifier = (val, modifier) => {
1423
- if (isArray(modifier))
1424
- return findModifierFromArray(val, modifier);
1425
- else if (isString(modifier) && val[modifier])
1426
- return val[modifier];
1427
- else
1428
- return val;
1351
+ if (isArray(modifier)) return findModifierFromArray(val, modifier);
1352
+ else if (isString(modifier) && val[modifier]) return val[modifier];
1353
+ else return val;
1429
1354
  };
1430
1355
  var getMediaTheme = (value, modifier) => {
1431
1356
  const activeConfig = getActiveConfig();
@@ -1451,8 +1376,7 @@ var getMediaTheme = (value, modifier) => {
1451
1376
  var import_utils11 = __toESM(require_cjs(), 1);
1452
1377
  var setFont = (val, key) => {
1453
1378
  const CSSvar = `--font-${key}`;
1454
- if (!val || isArray(val) && !val[0])
1455
- return;
1379
+ if (!val || isArray(val) && !val[0]) return;
1456
1380
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
1457
1381
  return { var: CSSvar, value: val, fontFace };
1458
1382
  };
@@ -1460,10 +1384,8 @@ var setFontFamily = (val, key) => {
1460
1384
  const CONFIG2 = getActiveConfig();
1461
1385
  const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
1462
1386
  let { value, type } = val;
1463
- if (val.isDefault)
1464
- FONT_FAMILY2.default = key;
1465
- if (isObject(value))
1466
- value = (0, import_utils11.arrayzeValue)(value);
1387
+ if (val.isDefault) FONT_FAMILY2.default = key;
1388
+ if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
1467
1389
  const CSSvar = `--font-family-${key}`;
1468
1390
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
1469
1391
  return { var: CSSvar, value: str, arr: value, type };
@@ -1476,19 +1398,10 @@ var runThroughMedia = (FACTORY2) => {
1476
1398
  for (const prop in FACTORY2) {
1477
1399
  const isPropMedia = prop.slice(0, 1) === "@";
1478
1400
  const mediaValue = FACTORY2[prop];
1479
- if (!isPropMedia)
1480
- continue;
1401
+ if (!isPropMedia) continue;
1481
1402
  const { mediaRegenerate } = FACTORY2;
1482
1403
  const mediaName = prop.slice(1);
1483
- const {
1484
- type,
1485
- base,
1486
- ratio,
1487
- range,
1488
- subSequence,
1489
- h1Matches,
1490
- unit
1491
- } = FACTORY2;
1404
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
1492
1405
  merge(mediaValue, {
1493
1406
  type,
1494
1407
  base,
@@ -1518,7 +1431,7 @@ var runThroughMedia = (FACTORY2) => {
1518
1431
  }
1519
1432
  };
1520
1433
  var applyHeadings = (props) => {
1521
- var _a;
1434
+ var _a, _b;
1522
1435
  const CONFIG2 = getActiveConfig();
1523
1436
  if (props.h1Matches) {
1524
1437
  const unit = props.unit;
@@ -1527,10 +1440,8 @@ var applyHeadings = (props) => {
1527
1440
  for (const k in HEADINGS) {
1528
1441
  const headerName = `h${parseInt(k) + 1}`;
1529
1442
  const headerStyle = templates[headerName];
1530
- if (!HEADINGS[k])
1531
- continue;
1532
1443
  templates[headerName] = {
1533
- fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
1444
+ fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
1534
1445
  margin: headerStyle ? headerStyle.margin : 0,
1535
1446
  lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
1536
1447
  letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
@@ -1554,8 +1465,7 @@ var runThroughMedia2 = (FACTORY2) => {
1554
1465
  for (const prop in FACTORY2) {
1555
1466
  const mediaProps = FACTORY2[prop];
1556
1467
  const isMediaName = prop.slice(0, 1) === "@";
1557
- if (!isMediaName)
1558
- continue;
1468
+ if (!isMediaName) continue;
1559
1469
  const {
1560
1470
  type,
1561
1471
  base,
@@ -1592,8 +1502,7 @@ var applySpacingSequence = () => {
1592
1502
  var getSequence = (sequenceProps) => {
1593
1503
  const CONFIG2 = getActiveConfig();
1594
1504
  const { SPACING: SPACING2 } = CONFIG2;
1595
- if (!sequenceProps)
1596
- return SPACING2;
1505
+ if (!sequenceProps) return SPACING2;
1597
1506
  const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
1598
1507
  return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
1599
1508
  };
@@ -1603,8 +1512,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
1603
1512
  return { [propertyName]: value };
1604
1513
  }
1605
1514
  const stack = (0, import_utils15.arrayzeValue)(value);
1606
- if (!isArray(stack))
1607
- return;
1515
+ if (!isArray(stack)) return;
1608
1516
  if (stack.length > 1) {
1609
1517
  let suffix = "";
1610
1518
  if (propertyName === "borderWidth") {
@@ -1653,15 +1561,11 @@ var setShadow = (value, key, suffix, prefers) => {
1653
1561
  if (isString(value) && value.includes(",")) {
1654
1562
  value = value.split(",").map((v) => {
1655
1563
  v = v.trim();
1656
- if (v.startsWith("--"))
1657
- return `var(${v})`;
1658
- if (getColor(v).length > 2)
1659
- return getColor(v);
1660
- if (v.includes("px") || v.slice(-2) === "em")
1661
- return v;
1564
+ if (v.startsWith("--")) return `var(${v})`;
1565
+ if (getColor(v).length > 2) return getColor(v);
1566
+ if (v.includes("px") || v.slice(-2) === "em") return v;
1662
1567
  const arr = v.split(" ");
1663
- if (!arr.length)
1664
- return v;
1568
+ if (!arr.length) return v;
1665
1569
  return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
1666
1570
  }).join(" ");
1667
1571
  }
@@ -1700,8 +1604,7 @@ var applyDocument = () => {
1700
1604
  var setSVG = (val, key) => {
1701
1605
  const CONFIG2 = getActiveConfig();
1702
1606
  if (!val) {
1703
- if (CONFIG2.verbose)
1704
- console.warn("setSVG: val is not defined", key);
1607
+ if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
1705
1608
  return;
1706
1609
  }
1707
1610
  if (CONFIG2.useSvgSprite) {
@@ -1739,8 +1642,7 @@ var applyReset = (reset = {}) => {
1739
1642
  }
1740
1643
  const { body, ...templates } = TYPOGRAPHY2.templates;
1741
1644
  const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
1742
- if (RESET2.html)
1743
- overwriteDeep(RESET2.html, globalTheme);
1645
+ if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
1744
1646
  return deepMerge(merge(RESET2, reset), {
1745
1647
  html: {
1746
1648
  position: "absolute",
@@ -1781,8 +1683,7 @@ var applyReset = (reset = {}) => {
1781
1683
 
1782
1684
  // src/set.js
1783
1685
  var setCases = (val, key) => {
1784
- if (isFunction(val))
1785
- return val();
1686
+ if (isFunction(val)) return val();
1786
1687
  return val;
1787
1688
  };
1788
1689
  var setSameValue = (val, key) => val;
@@ -1818,12 +1719,10 @@ var setValue = (FACTORY_NAME, value, key) => {
1818
1719
  FACTORY2[key] = result;
1819
1720
  return FACTORY2;
1820
1721
  } catch (error) {
1821
- if (CONFIG2.verbose)
1822
- console.warn("Error setting", factoryName, "value", value, key, error);
1722
+ if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
1823
1723
  }
1824
1724
  }
1825
- if (CONFIG2.verbose)
1826
- console.warn("Can not find", factoryName, "method in scratch");
1725
+ if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
1827
1726
  };
1828
1727
  var setEach = (factoryName, props) => {
1829
1728
  const CONFIG2 = getActiveConfig();
@@ -1833,8 +1732,7 @@ var setEach = (factoryName, props) => {
1833
1732
  try {
1834
1733
  return setValue(FACTORY_NAME, props[key], key);
1835
1734
  } catch (error) {
1836
- if (CONFIG2.verbose)
1837
- console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
1735
+ if (CONFIG2.verbose) console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
1838
1736
  }
1839
1737
  });
1840
1738
  return CONFIG2[FACTORY_NAME];
@@ -1859,54 +1757,39 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
1859
1757
  if (options.newConfig) {
1860
1758
  CONFIG2 = setActiveConfig(options.newConfig);
1861
1759
  }
1862
- if (verbose !== void 0)
1863
- CONFIG2.verbose = verbose;
1864
- if (useVariable !== void 0)
1865
- CONFIG2.useVariable = useVariable;
1866
- if (useReset !== void 0)
1867
- CONFIG2.useReset = useReset;
1868
- if (useFontImport !== void 0)
1869
- CONFIG2.useFontImport = useFontImport;
1870
- if (useSvgSprite !== void 0)
1871
- CONFIG2.useSvgSprite = useSvgSprite;
1872
- if (useIconSprite !== void 0)
1873
- CONFIG2.useIconSprite = useIconSprite;
1874
- if (useDocumentTheme !== void 0)
1875
- CONFIG2.useDocumentTheme = useDocumentTheme;
1876
- if (globalTheme !== void 0)
1877
- CONFIG2.globalTheme = globalTheme;
1878
- if (useDefaultConfig !== void 0)
1879
- CONFIG2.useDefaultConfig = useDefaultConfig;
1880
- if (SEMANTIC_ICONS2 !== void 0)
1881
- CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
1882
- if (CONFIG2.verbose)
1883
- console.log(CONFIG2);
1884
- if (!CONFIG2.__svg_cache)
1885
- CONFIG2.__svg_cache = {};
1760
+ if (verbose !== void 0) CONFIG2.verbose = verbose;
1761
+ if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
1762
+ if (useReset !== void 0) CONFIG2.useReset = useReset;
1763
+ if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
1764
+ if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
1765
+ if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
1766
+ if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
1767
+ if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
1768
+ if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
1769
+ if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
1770
+ if (CONFIG2.verbose) console.log(CONFIG2);
1771
+ if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
1886
1772
  const keys = Object.keys(config);
1887
1773
  keys.map((key) => setEach(key, config[key]));
1888
1774
  if (config.TYPOGRAPHY) {
1889
1775
  try {
1890
1776
  applyTypographySequence();
1891
1777
  } catch (e) {
1892
- if (CONFIG2.verbose)
1893
- console.warn("Error applying typography sequence", e);
1778
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
1894
1779
  }
1895
1780
  }
1896
1781
  if (config.SPACING) {
1897
1782
  try {
1898
1783
  applySpacingSequence();
1899
1784
  } catch (e) {
1900
- if (CONFIG2.verbose)
1901
- console.warn("Error applying typography sequence", e);
1785
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
1902
1786
  }
1903
1787
  }
1904
1788
  if (config.TIMING) {
1905
1789
  try {
1906
1790
  applyTimingSequence();
1907
1791
  } catch (e) {
1908
- if (CONFIG2.verbose)
1909
- console.warn("Error applying typography sequence", e);
1792
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
1910
1793
  }
1911
1794
  }
1912
1795
  applyDocument();