@symbo.ls/scratch 2.27.0 → 2.27.11

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
  });
@@ -273,6 +264,11 @@ __export(set_exports, {
273
264
  });
274
265
  module.exports = __toCommonJS(set_exports);
275
266
 
267
+ // ../../../domql/packages/utils/dist/esm/env.js
268
+ var NODE_ENV = "development";
269
+ var isProduction = (env = NODE_ENV) => env === "production";
270
+ var isNotProduction = (env = NODE_ENV) => !isProduction(env);
271
+
276
272
  // ../../../domql/packages/utils/dist/esm/globals.js
277
273
  var window2 = globalThis;
278
274
  var document2 = window2.document;
@@ -284,8 +280,7 @@ var isDOMNode = (obj) => {
284
280
 
285
281
  // ../../../domql/packages/utils/dist/esm/types.js
286
282
  var isObject = (arg) => {
287
- if (arg === null)
288
- return false;
283
+ if (arg === null) return false;
289
284
  return typeof arg === "object" && arg.constructor === Object;
290
285
  };
291
286
  var isString = (arg) => typeof arg === "string";
@@ -294,8 +289,7 @@ var isFunction = (arg) => typeof arg === "function";
294
289
  var isNull = (arg) => arg === null;
295
290
  var isArray = (arg) => Array.isArray(arg);
296
291
  var isObjectLike = (arg) => {
297
- if (arg === null)
298
- return false;
292
+ if (arg === null) return false;
299
293
  return typeof arg === "object";
300
294
  };
301
295
  var isUndefined = (arg) => {
@@ -376,8 +370,7 @@ var deepClone = (obj, options = {}) => {
376
370
  const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
377
371
  visited.set(obj, clone2);
378
372
  for (const key in obj) {
379
- if (!Object.prototype.hasOwnProperty.call(obj, key))
380
- continue;
373
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
381
374
  if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
382
375
  continue;
383
376
  const value = obj[key];
@@ -411,14 +404,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
411
404
  if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
412
405
  return params;
413
406
  }
414
- if (visited.has(obj))
415
- return visited.get(obj);
407
+ if (visited.has(obj)) return visited.get(obj);
416
408
  visited.set(obj, obj);
417
409
  for (const e in params) {
418
- if (!Object.hasOwnProperty.call(params, e))
419
- continue;
420
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
421
- continue;
410
+ if (!Object.hasOwnProperty.call(params, e)) continue;
411
+ if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
422
412
  const objProp = obj[e];
423
413
  const paramsProp = params[e];
424
414
  if (isDOMNode(paramsProp)) {
@@ -656,8 +646,7 @@ var getActiveConfig = (def) => {
656
646
  return FACTORY[def || FACTORY.active] || CONFIG;
657
647
  };
658
648
  var setActiveConfig = (newConfig) => {
659
- if (!isObject(newConfig))
660
- return;
649
+ if (!isObject(newConfig)) return;
661
650
  FACTORY.active = "1";
662
651
  FACTORY["1"] = deepMerge(newConfig, deepClone(cachedConfig));
663
652
  return newConfig;
@@ -670,10 +659,8 @@ var isScalingUnit = (unit) => {
670
659
 
671
660
  // src/utils/color.js
672
661
  var colorStringToRgbaArray = (color) => {
673
- if (color === "")
674
- return [0, 0, 0, 0];
675
- if (color.toLowerCase() === "transparent")
676
- return [0, 0, 0, 0];
662
+ if (color === "") return [0, 0, 0, 0];
663
+ if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
677
664
  if (color[0] === "#") {
678
665
  if (color.length < 7) {
679
666
  color = "#" + color[1] + color[1] + color[2] + color[2] + color[3] + color[3] + (color.length > 4 ? color[4] + color[4] : "");
@@ -704,8 +691,7 @@ var colorStringToRgbaArray = (color) => {
704
691
  }
705
692
  }
706
693
  if (color.indexOf("rgb") === 0) {
707
- if (color.indexOf("rgba") === -1)
708
- color = `${color}, 1`;
694
+ if (color.indexOf("rgba") === -1) color = `${color}, 1`;
709
695
  return color.match(/[\.\d]+/g).map((a) => +a);
710
696
  }
711
697
  return [0, 0, 0, 0];
@@ -724,36 +710,25 @@ var rgbToHSL = (r, g, b) => {
724
710
  const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
725
711
  return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
726
712
  };
727
- var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
728
- Math.min(k - 3, 9 - k, 1),
729
- -1
730
- )) => [f(0), f(8), f(4)];
713
+ var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)) => [f(0), f(8), f(4)];
731
714
  var getColorShade = (col, amt) => {
732
715
  const num = parseInt(col, 16);
733
716
  let r = (num >> 16) + amt;
734
- if (r > 255)
735
- r = 255;
736
- else if (r < 0)
737
- r = 0;
717
+ if (r > 255) r = 255;
718
+ else if (r < 0) r = 0;
738
719
  let b = (num >> 8 & 255) + amt;
739
- if (b > 255)
740
- b = 255;
741
- else if (b < 0)
742
- b = 0;
720
+ if (b > 255) b = 255;
721
+ else if (b < 0) b = 0;
743
722
  let g = (num & 255) + amt;
744
- if (g > 255)
745
- g = 255;
746
- else if (g < 0)
747
- g = 0;
723
+ if (g > 255) g = 255;
724
+ else if (g < 0) g = 0;
748
725
  return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
749
726
  };
750
727
  var getRgbTone = (rgb, tone) => {
751
728
  if (isString(rgb) && rgb.includes("rgb"))
752
729
  rgb = colorStringToRgbaArray(rgb).join(", ");
753
- if (isString(rgb))
754
- rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
755
- if (isNumber(tone))
756
- tone += "";
730
+ if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
731
+ if (isNumber(tone)) tone += "";
757
732
  const toHex = rgbArrayToHex(rgb);
758
733
  const abs = tone.slice(0, 1);
759
734
  if (abs === "-" || abs === "+") {
@@ -770,10 +745,8 @@ var getRgbTone = (rgb, tone) => {
770
745
 
771
746
  // src/utils/font.js
772
747
  var getDefaultOrFirstKey = (LIBRARY, key) => {
773
- if (LIBRARY[key])
774
- return LIBRARY[key].value;
775
- if (LIBRARY.default)
776
- return LIBRARY[LIBRARY.default].value;
748
+ if (LIBRARY[key]) return LIBRARY[key].value;
749
+ if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
777
750
  const hasValue = Object.keys(LIBRARY)[0];
778
751
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
779
752
  };
@@ -841,8 +814,7 @@ var setSequenceValue = (props, sequenceProps) => {
841
814
  var setScalingVar = (key, sequenceProps) => {
842
815
  const { base, type, unit } = sequenceProps;
843
816
  const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
844
- if (key === 0)
845
- return defaultVal;
817
+ if (key === 0) return defaultVal;
846
818
  const prefix = "--" + (type && type.replace(".", "-"));
847
819
  const ratioVar = `${prefix}-ratio`;
848
820
  if (key > 0) {
@@ -879,10 +851,8 @@ var generateSubSequence = (props, sequenceProps) => {
879
851
  const diffRounded = ~~next - ~~value;
880
852
  let arr;
881
853
  const [first, middle, second] = getSubratioDifference(value, ratio);
882
- if (diffRounded > 16)
883
- arr = [first, middle, second];
884
- else
885
- arr = [first, second];
854
+ if (diffRounded > 16) arr = [first, middle, second];
855
+ else arr = [first, second];
886
856
  arr.forEach((v, k) => {
887
857
  const scaling = ~~(v / base * 1e3) / 1e3;
888
858
  const newVar = variable + (k + 1);
@@ -924,8 +894,7 @@ var generateSequence = (sequenceProps) => {
924
894
  index: key
925
895
  };
926
896
  setSequenceValue(props, sequenceProps);
927
- if (subSequence)
928
- generateSubSequence(props, sequenceProps);
897
+ if (subSequence) generateSubSequence(props, sequenceProps);
929
898
  }
930
899
  return sequenceProps;
931
900
  };
@@ -937,13 +906,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
937
906
  unit = UNIT2.default,
938
907
  useVariable
939
908
  } = sequenceProps;
940
- if (isString(value) && value.slice(0, 2) === "--")
941
- return `var(${value})`;
909
+ if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
942
910
  const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
943
911
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
944
912
  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;
913
+ 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
914
  const letterVal = value.toUpperCase();
948
915
  const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
949
916
  let absValue = isNegative ? letterVal.slice(1) : letterVal;
@@ -967,8 +934,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
967
934
  return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
968
935
  }
969
936
  if (!sequence[absValue] && absValue.length === 2) {
970
- if (CONFIG2.verbose)
971
- console.warn(absValue, "- value is not found because `subSequence` is set to false");
937
+ if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
972
938
  absValue = absValue.slice(0, 1);
973
939
  }
974
940
  if (useVariable || CONFIG2.useVariable) {
@@ -976,8 +942,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
976
942
  return isNegative ? `calc(${varValue2} * -1)` : varValue2;
977
943
  }
978
944
  const sequenceItem = sequence ? sequence[absValue] : null;
979
- if (!sequenceItem)
980
- return console.warn("can't find", sequence, absValue);
945
+ if (!sequenceItem) return console.warn("can't find", sequence, absValue);
981
946
  if (unit === "ms" || unit === "s") {
982
947
  return isNegative + sequenceItem.val + unit;
983
948
  }
@@ -986,12 +951,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
986
951
  var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
987
952
  if (typeof value !== "string") {
988
953
  const CONFIG2 = getActiveConfig();
989
- if (CONFIG2.verbose)
990
- console.warn(propertyName, value, "is not a string");
954
+ if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
991
955
  return { [propertyName]: value };
992
956
  }
993
- if (value === "-" || value === "")
994
- return {};
957
+ if (value === "-" || value === "") return {};
995
958
  return { [propertyName]: getSequenceValue(value, sequenceProps) };
996
959
  };
997
960
  var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
@@ -1051,23 +1014,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
1051
1014
  const { mediaRegenerate } = FACTORY2;
1052
1015
  const { sequence, scales } = FACTORY2[media];
1053
1016
  const query = MEDIA2[mediaName];
1054
- if (!query && CONFIG2.verbose)
1055
- console.warn("Can't find media query ", query);
1017
+ if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
1056
1018
  if (!mediaRegenerate) {
1057
1019
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
1058
- if (!underMediaQuery)
1059
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1020
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1060
1021
  applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
1061
1022
  return;
1062
1023
  }
1063
1024
  for (const key in sequence) {
1064
1025
  const item = sequence[key];
1065
1026
  const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
1066
- if (!query && CONFIG2.verbose)
1067
- console.warn("Can't find query ", query);
1027
+ if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
1068
1028
  let underMediaQuery = CSS_VARS2[`@media ${query}`];
1069
- if (!underMediaQuery)
1070
- underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1029
+ if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
1071
1030
  underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
1072
1031
  CSS_VARS2[item.variable + "_" + mediaName] = value;
1073
1032
  }
@@ -1075,12 +1034,11 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
1075
1034
 
1076
1035
  // src/utils/sprite.js
1077
1036
  var ENV = "development";
1078
- var isDev = ENV === "development" || ENV === "testing";
1037
+ var isDev = isNotProduction(ENV);
1079
1038
  var parseRootAttributes = (htmlString) => {
1080
1039
  const val = htmlString.default || htmlString;
1081
1040
  if (!isString(val)) {
1082
- if (isDev)
1083
- console.warn("parseRootAttributes:", val, "is not a string");
1041
+ if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
1084
1042
  return;
1085
1043
  }
1086
1044
  const match = val.match(/<svg\s+(.*?)>/);
@@ -1088,7 +1046,9 @@ var parseRootAttributes = (htmlString) => {
1088
1046
  return {};
1089
1047
  }
1090
1048
  const attrString = match[1];
1091
- const attrs = attrString.match(/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm);
1049
+ const attrs = attrString.match(
1050
+ /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
1051
+ );
1092
1052
  return attrs.reduce((acc, attr) => {
1093
1053
  const [key, value] = attr.split("=");
1094
1054
  acc[key] = value.replace(/['"]/g, "");
@@ -1128,27 +1088,21 @@ var convertSvgToSymbol = (key, code) => {
1128
1088
  var getColor = (value, key, config) => {
1129
1089
  const CONFIG2 = config || getActiveConfig();
1130
1090
  if (!isString(value)) {
1131
- if (CONFIG2.verbose)
1132
- console.warn(value, "- type for color is not valid");
1091
+ if (CONFIG2.verbose) console.warn(value, "- type for color is not valid");
1133
1092
  return;
1134
1093
  }
1135
- if (value.slice(0, 2) === "--")
1136
- return `var(${value})`;
1137
- if (key && value[key])
1138
- value = value[key];
1094
+ if (value.slice(0, 2) === "--") return `var(${value})`;
1095
+ if (key && value[key]) value = value[key];
1139
1096
  const [name, alpha, tone] = isArray(value) ? value : value.split(" ");
1140
1097
  const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
1141
1098
  let val = COLOR2[name] || GRADIENT2[name];
1142
1099
  if (!val) {
1143
- if (CONFIG2.verbose)
1144
- console.warn("Can't find color ", name);
1100
+ if (CONFIG2.verbose) console.warn("Can't find color ", name);
1145
1101
  return value;
1146
1102
  }
1147
1103
  if (key) {
1148
- if (val[key])
1149
- val = val[key];
1150
- else if (CONFIG2.verbose)
1151
- console.warn(value, " - does not have ", key);
1104
+ if (val[key]) val = val[key];
1105
+ else if (CONFIG2.verbose) console.warn(value, " - does not have ", key);
1152
1106
  }
1153
1107
  let rgb = val.rgb;
1154
1108
  if (!rgb) {
@@ -1158,10 +1112,8 @@ var getColor = (value, key, config) => {
1158
1112
  rgb = getRgbTone(rgb, tone);
1159
1113
  val[tone] = { rgb, var: `${val.var}-${tone}` };
1160
1114
  }
1161
- if (val[tone])
1162
- rgb = val[tone].rgb;
1163
- if (alpha)
1164
- return `rgba(${rgb}, ${alpha})`;
1115
+ if (val[tone]) rgb = val[tone].rgb;
1116
+ if (alpha) return `rgba(${rgb}, ${alpha})`;
1165
1117
  return CONFIG2.useVariable ? `var(${val.var})` : `rgb(${rgb})`;
1166
1118
  };
1167
1119
  var setColor = (val, key, suffix) => {
@@ -1169,8 +1121,7 @@ var setColor = (val, key, suffix) => {
1169
1121
  if (isString(val) && val.slice(0, 2) === "--") {
1170
1122
  val = getColor(val.slice(2));
1171
1123
  if (!(val.includes("rgb") || val.includes("var") || val.includes("#"))) {
1172
- if (CONFIG2.verbose)
1173
- console.warn(val, "- referred but does not exist");
1124
+ if (CONFIG2.verbose) console.warn(val, "- referred but does not exist");
1174
1125
  val = val.split(" ")[0];
1175
1126
  }
1176
1127
  }
@@ -1209,8 +1160,7 @@ var setColor = (val, key, suffix) => {
1209
1160
  };
1210
1161
  var setGradient = (val, key, suffix) => {
1211
1162
  const CONFIG2 = getActiveConfig();
1212
- if (isString(val) && val.slice(0, 2) === "--")
1213
- val = getColor(val.slice(2));
1163
+ if (isString(val) && val.slice(0, 2) === "--") val = getColor(val.slice(2));
1214
1164
  if (isArray(val)) {
1215
1165
  return {
1216
1166
  "@light": setGradient(val[0], key, "light"),
@@ -1219,8 +1169,7 @@ var setGradient = (val, key, suffix) => {
1219
1169
  }
1220
1170
  if (isObject(val)) {
1221
1171
  const obj = {};
1222
- for (const variant in val)
1223
- obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1172
+ for (const variant in val) obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
1224
1173
  return obj;
1225
1174
  }
1226
1175
  const CSSVar = `--gradient-${key}` + (suffix ? `-${suffix}` : "");
@@ -1246,22 +1195,19 @@ var setThemeValue = (theme) => {
1246
1195
  return value;
1247
1196
  };
1248
1197
  var getThemeValue = (theme) => {
1249
- if (theme.value)
1250
- return theme.value;
1198
+ if (theme.value) return theme.value;
1251
1199
  theme.value = setThemeValue(theme);
1252
1200
  return theme.value;
1253
1201
  };
1254
1202
  var getTheme = (value, modifier) => {
1255
1203
  const CONFIG2 = getActiveConfig();
1256
- if (CONFIG2.useVariable)
1257
- return getMediaTheme(value, modifier);
1204
+ if (CONFIG2.useVariable) return getMediaTheme(value, modifier);
1258
1205
  const { THEME: THEME2 } = CONFIG2;
1259
1206
  if (isString(value)) {
1260
1207
  const [theme, subtheme] = value.split(" ");
1261
1208
  const isOurTheme = THEME2[theme];
1262
1209
  if (isOurTheme) {
1263
- if (!subtheme && !modifier)
1264
- return getThemeValue(isOurTheme);
1210
+ if (!subtheme && !modifier) return getThemeValue(isOurTheme);
1265
1211
  value = [theme, subtheme || modifier];
1266
1212
  }
1267
1213
  }
@@ -1269,14 +1215,10 @@ var getTheme = (value, modifier) => {
1269
1215
  const themeName = value[0];
1270
1216
  const subThemeName = value[1];
1271
1217
  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);
1218
+ if (media && media[subThemeName]) return getThemeValue(media[subThemeName]);
1219
+ if (helpers && helpers[subThemeName]) return getThemeValue(helpers[subThemeName]);
1220
+ if (state && state[subThemeName]) return getThemeValue(state[subThemeName]);
1221
+ } else if (isObject(value)) return setThemeValue(value);
1280
1222
  };
1281
1223
  var setInverseTheme = (theme, variant, value) => {
1282
1224
  if (isObject(variant)) {
@@ -1294,13 +1236,11 @@ var setInverseTheme = (theme, variant, value) => {
1294
1236
  var setPseudo = (theme, key, variant, themeValue) => {
1295
1237
  const result = getTheme(variant);
1296
1238
  themeValue[`&:${key}`] = result;
1297
- if (isObject(variant) && !variant.value)
1298
- variant.value = result;
1239
+ if (isObject(variant) && !variant.value) variant.value = result;
1299
1240
  };
1300
1241
  var setSelectors = (theme, value) => {
1301
1242
  const { state } = theme;
1302
- if (!state)
1303
- return;
1243
+ if (!state) return;
1304
1244
  const keys = Object.keys(state);
1305
1245
  keys.map((key) => {
1306
1246
  const variant = state[key];
@@ -1312,20 +1252,16 @@ var setSelectors = (theme, value) => {
1312
1252
  var setPrefersScheme = (theme, key, variant, themeValue) => {
1313
1253
  const result = getTheme(variant);
1314
1254
  themeValue[`@media (prefers-color-scheme: ${key})`] = result;
1315
- if (isObject(variant) && !variant.value)
1316
- variant.value = result;
1255
+ if (isObject(variant) && !variant.value) variant.value = result;
1317
1256
  };
1318
1257
  var setMedia = (theme, value) => {
1319
1258
  const { media } = theme;
1320
- if (!media)
1321
- return;
1259
+ if (!media) return;
1322
1260
  const keys = Object.keys(media);
1323
1261
  keys.map((key) => {
1324
1262
  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);
1263
+ if (key === "dark" || key === "light") setPrefersScheme(theme, key, variant, value);
1264
+ if (key === "inverse") setInverseTheme(theme, variant, value);
1329
1265
  return theme;
1330
1266
  });
1331
1267
  return theme;
@@ -1333,23 +1269,19 @@ var setMedia = (theme, value) => {
1333
1269
  var setHelpers = (theme, value) => {
1334
1270
  const CONFIG2 = getActiveConfig();
1335
1271
  const { helpers } = theme;
1336
- if (!helpers)
1337
- return;
1272
+ if (!helpers) return;
1338
1273
  const keys = Object.keys(helpers);
1339
1274
  keys.map((key) => {
1340
1275
  const helper = helpers[key];
1341
- if (isString(helper))
1342
- helpers[key] = CONFIG2.THEME[helper];
1343
- else
1344
- getThemeValue(helpers[key]);
1276
+ if (isString(helper)) helpers[key] = CONFIG2.THEME[helper];
1277
+ else getThemeValue(helpers[key]);
1345
1278
  return theme;
1346
1279
  });
1347
1280
  return theme;
1348
1281
  };
1349
1282
  var setTheme = (val, key) => {
1350
1283
  const CONFIG2 = getActiveConfig();
1351
- if (CONFIG2.useVariable)
1352
- return setMediaTheme(val, key);
1284
+ if (CONFIG2.useVariable) return setMediaTheme(val, key);
1353
1285
  const { state, media, helpers } = val;
1354
1286
  const value = setThemeValue(val, key);
1355
1287
  const CSSvar = `--theme-${key}`;
@@ -1411,24 +1343,19 @@ var recursiveTheme = (val) => {
1411
1343
  } else if (symb === ":") {
1412
1344
  obj[`&${param}`] = recursiveTheme(val[param]);
1413
1345
  }
1414
- } else
1415
- obj[param] = val[param];
1346
+ } else obj[param] = val[param];
1416
1347
  }
1417
1348
  return obj;
1418
1349
  };
1419
1350
  var findModifierFromArray = (val, modifierArray) => {
1420
1351
  const currentMod = modifierArray.shift();
1421
- if (val[currentMod])
1422
- return findModifierFromArray(val[currentMod], modifierArray);
1352
+ if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
1423
1353
  return val;
1424
1354
  };
1425
1355
  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;
1356
+ if (isArray(modifier)) return findModifierFromArray(val, modifier);
1357
+ else if (isString(modifier) && val[modifier]) return val[modifier];
1358
+ else return val;
1432
1359
  };
1433
1360
  var getMediaTheme = (value, modifier) => {
1434
1361
  const activeConfig = getActiveConfig();
@@ -1454,8 +1381,7 @@ var getMediaTheme = (value, modifier) => {
1454
1381
  var import_utils11 = __toESM(require_cjs(), 1);
1455
1382
  var setFont = (val, key) => {
1456
1383
  const CSSvar = `--font-${key}`;
1457
- if (!val || isArray(val) && !val[0])
1458
- return;
1384
+ if (!val || isArray(val) && !val[0]) return;
1459
1385
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
1460
1386
  return { var: CSSvar, value: val, fontFace };
1461
1387
  };
@@ -1463,10 +1389,8 @@ var setFontFamily = (val, key) => {
1463
1389
  const CONFIG2 = getActiveConfig();
1464
1390
  const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
1465
1391
  let { value, type } = val;
1466
- if (val.isDefault)
1467
- FONT_FAMILY2.default = key;
1468
- if (isObject(value))
1469
- value = (0, import_utils11.arrayzeValue)(value);
1392
+ if (val.isDefault) FONT_FAMILY2.default = key;
1393
+ if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
1470
1394
  const CSSvar = `--font-family-${key}`;
1471
1395
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
1472
1396
  return { var: CSSvar, value: str, arr: value, type };
@@ -1479,19 +1403,10 @@ var runThroughMedia = (FACTORY2) => {
1479
1403
  for (const prop in FACTORY2) {
1480
1404
  const isPropMedia = prop.slice(0, 1) === "@";
1481
1405
  const mediaValue = FACTORY2[prop];
1482
- if (!isPropMedia)
1483
- continue;
1406
+ if (!isPropMedia) continue;
1484
1407
  const { mediaRegenerate } = FACTORY2;
1485
1408
  const mediaName = prop.slice(1);
1486
- const {
1487
- type,
1488
- base,
1489
- ratio,
1490
- range,
1491
- subSequence,
1492
- h1Matches,
1493
- unit
1494
- } = FACTORY2;
1409
+ const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
1495
1410
  merge(mediaValue, {
1496
1411
  type,
1497
1412
  base,
@@ -1521,7 +1436,7 @@ var runThroughMedia = (FACTORY2) => {
1521
1436
  }
1522
1437
  };
1523
1438
  var applyHeadings = (props) => {
1524
- var _a;
1439
+ var _a, _b;
1525
1440
  const CONFIG2 = getActiveConfig();
1526
1441
  if (props.h1Matches) {
1527
1442
  const unit = props.unit;
@@ -1530,10 +1445,8 @@ var applyHeadings = (props) => {
1530
1445
  for (const k in HEADINGS) {
1531
1446
  const headerName = `h${parseInt(k) + 1}`;
1532
1447
  const headerStyle = templates[headerName];
1533
- if (!HEADINGS[k])
1534
- continue;
1535
1448
  templates[headerName] = {
1536
- fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
1449
+ fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
1537
1450
  margin: headerStyle ? headerStyle.margin : 0,
1538
1451
  lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
1539
1452
  letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
@@ -1557,8 +1470,7 @@ var runThroughMedia2 = (FACTORY2) => {
1557
1470
  for (const prop in FACTORY2) {
1558
1471
  const mediaProps = FACTORY2[prop];
1559
1472
  const isMediaName = prop.slice(0, 1) === "@";
1560
- if (!isMediaName)
1561
- continue;
1473
+ if (!isMediaName) continue;
1562
1474
  const {
1563
1475
  type,
1564
1476
  base,
@@ -1595,8 +1507,7 @@ var applySpacingSequence = () => {
1595
1507
  var getSequence = (sequenceProps) => {
1596
1508
  const CONFIG2 = getActiveConfig();
1597
1509
  const { SPACING: SPACING2 } = CONFIG2;
1598
- if (!sequenceProps)
1599
- return SPACING2;
1510
+ if (!sequenceProps) return SPACING2;
1600
1511
  const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
1601
1512
  return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
1602
1513
  };
@@ -1606,8 +1517,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
1606
1517
  return { [propertyName]: value };
1607
1518
  }
1608
1519
  const stack = (0, import_utils15.arrayzeValue)(value);
1609
- if (!isArray(stack))
1610
- return;
1520
+ if (!isArray(stack)) return;
1611
1521
  if (stack.length > 1) {
1612
1522
  let suffix = "";
1613
1523
  if (propertyName === "borderWidth") {
@@ -1656,15 +1566,11 @@ var setShadow = (value, key, suffix, prefers) => {
1656
1566
  if (isString(value) && value.includes(",")) {
1657
1567
  value = value.split(",").map((v) => {
1658
1568
  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;
1569
+ if (v.startsWith("--")) return `var(${v})`;
1570
+ if (getColor(v).length > 2) return getColor(v);
1571
+ if (v.includes("px") || v.slice(-2) === "em") return v;
1665
1572
  const arr = v.split(" ");
1666
- if (!arr.length)
1667
- return v;
1573
+ if (!arr.length) return v;
1668
1574
  return arr.map((v2) => getSpacingByKey(v2, "shadow").shadow).join(" ");
1669
1575
  }).join(" ");
1670
1576
  }
@@ -1703,8 +1609,7 @@ var applyDocument = () => {
1703
1609
  var setSVG = (val, key) => {
1704
1610
  const CONFIG2 = getActiveConfig();
1705
1611
  if (!val) {
1706
- if (CONFIG2.verbose)
1707
- console.warn("setSVG: val is not defined", key);
1612
+ if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
1708
1613
  return;
1709
1614
  }
1710
1615
  if (CONFIG2.useSvgSprite) {
@@ -1742,8 +1647,7 @@ var applyReset = (reset = {}) => {
1742
1647
  }
1743
1648
  const { body, ...templates } = TYPOGRAPHY2.templates;
1744
1649
  const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
1745
- if (RESET2.html)
1746
- overwriteDeep(RESET2.html, globalTheme);
1650
+ if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
1747
1651
  return deepMerge(merge(RESET2, reset), {
1748
1652
  html: {
1749
1653
  position: "absolute",
@@ -1784,8 +1688,7 @@ var applyReset = (reset = {}) => {
1784
1688
 
1785
1689
  // src/set.js
1786
1690
  var setCases = (val, key) => {
1787
- if (isFunction(val))
1788
- return val();
1691
+ if (isFunction(val)) return val();
1789
1692
  return val;
1790
1693
  };
1791
1694
  var setSameValue = (val, key) => val;
@@ -1821,12 +1724,10 @@ var setValue = (FACTORY_NAME, value, key) => {
1821
1724
  FACTORY2[key] = result;
1822
1725
  return FACTORY2;
1823
1726
  } catch (error) {
1824
- if (CONFIG2.verbose)
1825
- console.warn("Error setting", factoryName, "value", value, key, error);
1727
+ if (CONFIG2.verbose) console.warn("Error setting", factoryName, "value", value, key, error);
1826
1728
  }
1827
1729
  }
1828
- if (CONFIG2.verbose)
1829
- console.warn("Can not find", factoryName, "method in scratch");
1730
+ if (CONFIG2.verbose) console.warn("Can not find", factoryName, "method in scratch");
1830
1731
  };
1831
1732
  var setEach = (factoryName, props) => {
1832
1733
  const CONFIG2 = getActiveConfig();
@@ -1836,8 +1737,7 @@ var setEach = (factoryName, props) => {
1836
1737
  try {
1837
1738
  return setValue(FACTORY_NAME, props[key], key);
1838
1739
  } catch (error) {
1839
- if (CONFIG2.verbose)
1840
- console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
1740
+ if (CONFIG2.verbose) console.warn("Error setting", FACTORY_NAME, "value", props[key], key, error);
1841
1741
  }
1842
1742
  });
1843
1743
  return CONFIG2[FACTORY_NAME];
@@ -1862,57 +1762,43 @@ var set = (recivedConfig, options = SET_OPTIONS) => {
1862
1762
  if (options.newConfig) {
1863
1763
  CONFIG2 = setActiveConfig(options.newConfig);
1864
1764
  }
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 = {};
1765
+ if (verbose !== void 0) CONFIG2.verbose = verbose;
1766
+ if (useVariable !== void 0) CONFIG2.useVariable = useVariable;
1767
+ if (useReset !== void 0) CONFIG2.useReset = useReset;
1768
+ if (useFontImport !== void 0) CONFIG2.useFontImport = useFontImport;
1769
+ if (useSvgSprite !== void 0) CONFIG2.useSvgSprite = useSvgSprite;
1770
+ if (useIconSprite !== void 0) CONFIG2.useIconSprite = useIconSprite;
1771
+ if (useDocumentTheme !== void 0) CONFIG2.useDocumentTheme = useDocumentTheme;
1772
+ if (globalTheme !== void 0) CONFIG2.globalTheme = globalTheme;
1773
+ if (useDefaultConfig !== void 0) CONFIG2.useDefaultConfig = useDefaultConfig;
1774
+ if (SEMANTIC_ICONS2 !== void 0) CONFIG2.SEMANTIC_ICONS = SEMANTIC_ICONS2;
1775
+ if (CONFIG2.verbose) console.log(CONFIG2);
1776
+ if (!CONFIG2.__svg_cache) CONFIG2.__svg_cache = {};
1889
1777
  const keys = Object.keys(config);
1890
1778
  keys.map((key) => setEach(key, config[key]));
1891
1779
  if (config.TYPOGRAPHY) {
1892
1780
  try {
1893
1781
  applyTypographySequence();
1894
1782
  } catch (e) {
1895
- if (CONFIG2.verbose)
1896
- console.warn("Error applying typography sequence", e);
1783
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
1897
1784
  }
1898
1785
  }
1899
1786
  if (config.SPACING) {
1900
1787
  try {
1901
1788
  applySpacingSequence();
1902
1789
  } catch (e) {
1903
- if (CONFIG2.verbose)
1904
- console.warn("Error applying typography sequence", e);
1790
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
1905
1791
  }
1906
1792
  }
1907
1793
  if (config.TIMING) {
1908
1794
  try {
1909
1795
  applyTimingSequence();
1910
1796
  } catch (e) {
1911
- if (CONFIG2.verbose)
1912
- console.warn("Error applying typography sequence", e);
1797
+ if (CONFIG2.verbose) console.warn("Error applying typography sequence", e);
1913
1798
  }
1914
1799
  }
1915
1800
  applyDocument();
1916
1801
  applyReset();
1917
1802
  return CONFIG2;
1918
1803
  };
1804
+ // @preserve-env