@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/factory.js +5 -8
- package/dist/cjs/index.js +177 -345
- package/dist/cjs/set.js +126 -240
- package/dist/cjs/system/color.js +54 -87
- package/dist/cjs/system/document.js +26 -29
- package/dist/cjs/system/font.js +30 -37
- package/dist/cjs/system/index.js +126 -243
- package/dist/cjs/system/reset.js +33 -43
- package/dist/cjs/system/shadow.js +69 -117
- package/dist/cjs/system/spacing.js +41 -59
- package/dist/cjs/system/svg.js +31 -41
- package/dist/cjs/system/theme.js +67 -113
- package/dist/cjs/system/timing.js +34 -45
- package/dist/cjs/system/typography.js +43 -73
- package/dist/cjs/transforms/index.js +92 -163
- package/dist/cjs/utils/color.js +21 -35
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +62 -108
- package/dist/cjs/utils/sequence.js +25 -45
- package/dist/cjs/utils/sprite.js +15 -12
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +19 -33
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
- package/src/utils/color.js +42 -30
- package/src/utils/sprite.js +12 -7
|
@@ -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
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue2,
|
|
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(
|
|
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 arrayzeValue2 = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
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(spacing_exports, {
|
|
|
273
264
|
module.exports = __toCommonJS(spacing_exports);
|
|
274
265
|
var import_utils7 = __toESM(require_cjs(), 1);
|
|
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;
|
|
@@ -288,8 +284,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
288
284
|
var isNull = (arg) => arg === null;
|
|
289
285
|
var isArray = (arg) => Array.isArray(arg);
|
|
290
286
|
var isObjectLike = (arg) => {
|
|
291
|
-
if (arg === null)
|
|
292
|
-
return false;
|
|
287
|
+
if (arg === null) return false;
|
|
293
288
|
return typeof arg === "object";
|
|
294
289
|
};
|
|
295
290
|
var isUndefined = (arg) => {
|
|
@@ -370,8 +365,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
370
365
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
371
366
|
visited.set(obj, clone2);
|
|
372
367
|
for (const key in obj) {
|
|
373
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
374
|
-
continue;
|
|
368
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
375
369
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
376
370
|
continue;
|
|
377
371
|
const value = obj[key];
|
|
@@ -676,8 +670,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
676
670
|
var setScalingVar = (key, sequenceProps) => {
|
|
677
671
|
const { base, type, unit } = sequenceProps;
|
|
678
672
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
679
|
-
if (key === 0)
|
|
680
|
-
return defaultVal;
|
|
673
|
+
if (key === 0) return defaultVal;
|
|
681
674
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
682
675
|
const ratioVar = `${prefix}-ratio`;
|
|
683
676
|
if (key > 0) {
|
|
@@ -714,10 +707,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
714
707
|
const diffRounded = ~~next - ~~value;
|
|
715
708
|
let arr;
|
|
716
709
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
717
|
-
if (diffRounded > 16)
|
|
718
|
-
|
|
719
|
-
else
|
|
720
|
-
arr = [first, second];
|
|
710
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
711
|
+
else arr = [first, second];
|
|
721
712
|
arr.forEach((v, k) => {
|
|
722
713
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
723
714
|
const newVar = variable + (k + 1);
|
|
@@ -759,8 +750,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
759
750
|
index: key
|
|
760
751
|
};
|
|
761
752
|
setSequenceValue(props, sequenceProps);
|
|
762
|
-
if (subSequence)
|
|
763
|
-
generateSubSequence(props, sequenceProps);
|
|
753
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
764
754
|
}
|
|
765
755
|
return sequenceProps;
|
|
766
756
|
};
|
|
@@ -772,13 +762,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
772
762
|
unit = UNIT2.default,
|
|
773
763
|
useVariable
|
|
774
764
|
} = sequenceProps;
|
|
775
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
776
|
-
return `var(${value})`;
|
|
765
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
777
766
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
778
767
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
779
768
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
780
|
-
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)
|
|
781
|
-
return value;
|
|
769
|
+
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;
|
|
782
770
|
const letterVal = value.toUpperCase();
|
|
783
771
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
784
772
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -802,8 +790,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
802
790
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
803
791
|
}
|
|
804
792
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
805
|
-
if (CONFIG2.verbose)
|
|
806
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
793
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
807
794
|
absValue = absValue.slice(0, 1);
|
|
808
795
|
}
|
|
809
796
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -811,8 +798,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
811
798
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
812
799
|
}
|
|
813
800
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
814
|
-
if (!sequenceItem)
|
|
815
|
-
return console.warn("can't find", sequence, absValue);
|
|
801
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
816
802
|
if (unit === "ms" || unit === "s") {
|
|
817
803
|
return isNegative + sequenceItem.val + unit;
|
|
818
804
|
}
|
|
@@ -821,12 +807,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
821
807
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
822
808
|
if (typeof value !== "string") {
|
|
823
809
|
const CONFIG2 = getActiveConfig();
|
|
824
|
-
if (CONFIG2.verbose)
|
|
825
|
-
console.warn(propertyName, value, "is not a string");
|
|
810
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
826
811
|
return { [propertyName]: value };
|
|
827
812
|
}
|
|
828
|
-
if (value === "-" || value === "")
|
|
829
|
-
return {};
|
|
813
|
+
if (value === "-" || value === "") return {};
|
|
830
814
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
831
815
|
};
|
|
832
816
|
|
|
@@ -878,35 +862,34 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
878
862
|
const { mediaRegenerate } = FACTORY2;
|
|
879
863
|
const { sequence, scales } = FACTORY2[media];
|
|
880
864
|
const query = MEDIA2[mediaName];
|
|
881
|
-
if (!query && CONFIG2.verbose)
|
|
882
|
-
console.warn("Can't find media query ", query);
|
|
865
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
883
866
|
if (!mediaRegenerate) {
|
|
884
867
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
885
|
-
if (!underMediaQuery)
|
|
886
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
868
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
887
869
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
888
870
|
return;
|
|
889
871
|
}
|
|
890
872
|
for (const key in sequence) {
|
|
891
873
|
const item = sequence[key];
|
|
892
874
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
893
|
-
if (!query && CONFIG2.verbose)
|
|
894
|
-
console.warn("Can't find query ", query);
|
|
875
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
895
876
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
896
|
-
if (!underMediaQuery)
|
|
897
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
877
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
898
878
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
899
879
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
900
880
|
}
|
|
901
881
|
};
|
|
902
882
|
|
|
883
|
+
// src/utils/sprite.js
|
|
884
|
+
var ENV = "development";
|
|
885
|
+
var isDev = isNotProduction(ENV);
|
|
886
|
+
|
|
903
887
|
// src/system/spacing.js
|
|
904
888
|
var runThroughMedia = (FACTORY2) => {
|
|
905
889
|
for (const prop in FACTORY2) {
|
|
906
890
|
const mediaProps = FACTORY2[prop];
|
|
907
891
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
908
|
-
if (!isMediaName)
|
|
909
|
-
continue;
|
|
892
|
+
if (!isMediaName) continue;
|
|
910
893
|
const {
|
|
911
894
|
type,
|
|
912
895
|
base,
|
|
@@ -943,8 +926,7 @@ var applySpacingSequence = () => {
|
|
|
943
926
|
var getSequence = (sequenceProps) => {
|
|
944
927
|
const CONFIG2 = getActiveConfig();
|
|
945
928
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
946
|
-
if (!sequenceProps)
|
|
947
|
-
return SPACING2;
|
|
929
|
+
if (!sequenceProps) return SPACING2;
|
|
948
930
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
949
931
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
950
932
|
};
|
|
@@ -954,8 +936,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
954
936
|
return { [propertyName]: value };
|
|
955
937
|
}
|
|
956
938
|
const stack = (0, import_utils7.arrayzeValue)(value);
|
|
957
|
-
if (!isArray(stack))
|
|
958
|
-
return;
|
|
939
|
+
if (!isArray(stack)) return;
|
|
959
940
|
if (stack.length > 1) {
|
|
960
941
|
let suffix = "";
|
|
961
942
|
if (propertyName === "borderWidth") {
|
|
@@ -1010,3 +991,4 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
|
1010
991
|
}
|
|
1011
992
|
return getSpacingByKey(value, propertyName);
|
|
1012
993
|
};
|
|
994
|
+
// @preserve-env
|
package/dist/cjs/system/svg.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
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
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(
|
|
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 arrayzeValue = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
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(svg_exports, {
|
|
|
273
264
|
});
|
|
274
265
|
module.exports = __toCommonJS(svg_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;
|
|
@@ -288,8 +284,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
288
284
|
var isNull = (arg) => arg === null;
|
|
289
285
|
var isArray = (arg) => Array.isArray(arg);
|
|
290
286
|
var isObjectLike = (arg) => {
|
|
291
|
-
if (arg === null)
|
|
292
|
-
return false;
|
|
287
|
+
if (arg === null) return false;
|
|
293
288
|
return typeof arg === "object";
|
|
294
289
|
};
|
|
295
290
|
var isUndefined = (arg) => {
|
|
@@ -357,8 +352,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
357
352
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
358
353
|
visited.set(obj, clone2);
|
|
359
354
|
for (const key in obj) {
|
|
360
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
361
|
-
continue;
|
|
355
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
362
356
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
363
357
|
continue;
|
|
364
358
|
const value = obj[key];
|
|
@@ -616,15 +610,13 @@ var getActiveConfig = (def) => {
|
|
|
616
610
|
|
|
617
611
|
// src/utils/sprite.js
|
|
618
612
|
var ENV = "development";
|
|
619
|
-
var isDev = ENV
|
|
613
|
+
var isDev = isNotProduction(ENV);
|
|
620
614
|
var generateSprite = (icons) => {
|
|
621
615
|
const CONFIG2 = getActiveConfig();
|
|
622
616
|
let sprite = "";
|
|
623
617
|
for (const key in icons) {
|
|
624
|
-
if (CONFIG2.__svg_cache[key])
|
|
625
|
-
|
|
626
|
-
else
|
|
627
|
-
CONFIG2.__svg_cache[key] = true;
|
|
618
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
619
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
628
620
|
sprite += icons[key];
|
|
629
621
|
}
|
|
630
622
|
return sprite;
|
|
@@ -632,8 +624,7 @@ var generateSprite = (icons) => {
|
|
|
632
624
|
var parseRootAttributes = (htmlString) => {
|
|
633
625
|
const val = htmlString.default || htmlString;
|
|
634
626
|
if (!isString(val)) {
|
|
635
|
-
if (isDev)
|
|
636
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
627
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
637
628
|
return;
|
|
638
629
|
}
|
|
639
630
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -641,7 +632,9 @@ var parseRootAttributes = (htmlString) => {
|
|
|
641
632
|
return {};
|
|
642
633
|
}
|
|
643
634
|
const attrString = match[1];
|
|
644
|
-
const attrs = attrString.match(
|
|
635
|
+
const attrs = attrString.match(
|
|
636
|
+
/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
|
|
637
|
+
);
|
|
645
638
|
return attrs.reduce((acc, attr) => {
|
|
646
639
|
const [key, value] = attr.split("=");
|
|
647
640
|
acc[key] = value.replace(/['"]/g, "");
|
|
@@ -684,8 +677,7 @@ var DEF_OPTIONS = {
|
|
|
684
677
|
var setSVG = (val, key) => {
|
|
685
678
|
const CONFIG2 = getActiveConfig();
|
|
686
679
|
if (!val) {
|
|
687
|
-
if (CONFIG2.verbose)
|
|
688
|
-
console.warn("setSVG: val is not defined", key);
|
|
680
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
689
681
|
return;
|
|
690
682
|
}
|
|
691
683
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -696,8 +688,7 @@ var setSVG = (val, key) => {
|
|
|
696
688
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
697
689
|
const CONFIG2 = getActiveConfig();
|
|
698
690
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
699
|
-
for (const key in LIBRARY)
|
|
700
|
-
lib[key] = CONFIG2.SVG[key];
|
|
691
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
701
692
|
appendSVG(lib, options);
|
|
702
693
|
};
|
|
703
694
|
var setSvgIcon = (val, key) => {
|
|
@@ -711,13 +702,11 @@ var setSvgIcon = (val, key) => {
|
|
|
711
702
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
712
703
|
const CONFIG2 = getActiveConfig();
|
|
713
704
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
714
|
-
for (const key in LIBRARY)
|
|
715
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
705
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
716
706
|
appendSVG(lib, options);
|
|
717
707
|
};
|
|
718
708
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
719
|
-
if (!document2 || !document2.createElementNS)
|
|
720
|
-
return;
|
|
709
|
+
if (!document2 || !document2.createElementNS) return;
|
|
721
710
|
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
722
711
|
if (options.isRoot) {
|
|
723
712
|
svgElem.setAttribute("aria-hidden", "true");
|
|
@@ -751,3 +740,4 @@ var appendSVG = (lib, options = DEF_OPTIONS) => {
|
|
|
751
740
|
}
|
|
752
741
|
}
|
|
753
742
|
};
|
|
743
|
+
// @preserve-env
|