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