@symbo.ls/scratch 2.25.3 → 2.27.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +8 -9
- package/dist/cjs/index.js +169 -335
- package/dist/cjs/set.js +120 -237
- package/dist/cjs/system/color.js +48 -86
- package/dist/cjs/system/document.js +20 -30
- package/dist/cjs/system/font.js +24 -38
- package/dist/cjs/system/index.js +120 -240
- package/dist/cjs/system/reset.js +27 -44
- package/dist/cjs/system/shadow.js +63 -116
- package/dist/cjs/system/spacing.js +35 -60
- package/dist/cjs/system/svg.js +25 -40
- package/dist/cjs/system/theme.js +61 -112
- package/dist/cjs/system/timing.js +28 -46
- package/dist/cjs/system/typography.js +37 -74
- package/dist/cjs/transforms/index.js +86 -162
- package/dist/cjs/utils/color.js +13 -26
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +54 -98
- package/dist/cjs/utils/sequence.js +28 -46
- package/dist/cjs/utils/sprite.js +9 -11
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +22 -34
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
|
@@ -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
|
});
|
|
@@ -288,8 +279,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
288
279
|
var isNull = (arg) => arg === null;
|
|
289
280
|
var isArray = (arg) => Array.isArray(arg);
|
|
290
281
|
var isObjectLike = (arg) => {
|
|
291
|
-
if (arg === null)
|
|
292
|
-
return false;
|
|
282
|
+
if (arg === null) return false;
|
|
293
283
|
return typeof arg === "object";
|
|
294
284
|
};
|
|
295
285
|
var isUndefined = (arg) => {
|
|
@@ -298,7 +288,10 @@ var isUndefined = (arg) => {
|
|
|
298
288
|
|
|
299
289
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
300
290
|
var mergeArray = (arr, exclude = []) => {
|
|
301
|
-
return arr.reduce(
|
|
291
|
+
return arr.reduce(
|
|
292
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
293
|
+
{}
|
|
294
|
+
);
|
|
302
295
|
};
|
|
303
296
|
|
|
304
297
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -367,8 +360,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
367
360
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
368
361
|
visited.set(obj, clone2);
|
|
369
362
|
for (const key in obj) {
|
|
370
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
371
|
-
continue;
|
|
363
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
372
364
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
373
365
|
continue;
|
|
374
366
|
const value = obj[key];
|
|
@@ -673,8 +665,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
673
665
|
var setScalingVar = (key, sequenceProps) => {
|
|
674
666
|
const { base, type, unit } = sequenceProps;
|
|
675
667
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
676
|
-
if (key === 0)
|
|
677
|
-
return defaultVal;
|
|
668
|
+
if (key === 0) return defaultVal;
|
|
678
669
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
679
670
|
const ratioVar = `${prefix}-ratio`;
|
|
680
671
|
if (key > 0) {
|
|
@@ -711,10 +702,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
711
702
|
const diffRounded = ~~next - ~~value;
|
|
712
703
|
let arr;
|
|
713
704
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
714
|
-
if (diffRounded > 16)
|
|
715
|
-
|
|
716
|
-
else
|
|
717
|
-
arr = [first, second];
|
|
705
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
706
|
+
else arr = [first, second];
|
|
718
707
|
arr.forEach((v, k) => {
|
|
719
708
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
720
709
|
const newVar = variable + (k + 1);
|
|
@@ -756,8 +745,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
756
745
|
index: key
|
|
757
746
|
};
|
|
758
747
|
setSequenceValue(props, sequenceProps);
|
|
759
|
-
if (subSequence)
|
|
760
|
-
generateSubSequence(props, sequenceProps);
|
|
748
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
761
749
|
}
|
|
762
750
|
return sequenceProps;
|
|
763
751
|
};
|
|
@@ -769,13 +757,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
769
757
|
unit = UNIT2.default,
|
|
770
758
|
useVariable
|
|
771
759
|
} = sequenceProps;
|
|
772
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
773
|
-
return `var(${value})`;
|
|
760
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
774
761
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
775
762
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
776
763
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
777
|
-
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)
|
|
778
|
-
return value;
|
|
764
|
+
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;
|
|
779
765
|
const letterVal = value.toUpperCase();
|
|
780
766
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
781
767
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -799,8 +785,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
799
785
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
800
786
|
}
|
|
801
787
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
802
|
-
if (CONFIG2.verbose)
|
|
803
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
788
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
804
789
|
absValue = absValue.slice(0, 1);
|
|
805
790
|
}
|
|
806
791
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -808,8 +793,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
808
793
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
809
794
|
}
|
|
810
795
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
811
|
-
if (!sequenceItem)
|
|
812
|
-
return console.warn("can't find", sequence, absValue);
|
|
796
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
813
797
|
if (unit === "ms" || unit === "s") {
|
|
814
798
|
return isNegative + sequenceItem.val + unit;
|
|
815
799
|
}
|
|
@@ -818,12 +802,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
818
802
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
819
803
|
if (typeof value !== "string") {
|
|
820
804
|
const CONFIG2 = getActiveConfig();
|
|
821
|
-
if (CONFIG2.verbose)
|
|
822
|
-
console.warn(propertyName, value, "is not a string");
|
|
805
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
823
806
|
return { [propertyName]: value };
|
|
824
807
|
}
|
|
825
|
-
if (value === "-" || value === "")
|
|
826
|
-
return {};
|
|
808
|
+
if (value === "-" || value === "") return {};
|
|
827
809
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
828
810
|
};
|
|
829
811
|
|
|
@@ -875,23 +857,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
875
857
|
const { mediaRegenerate } = FACTORY2;
|
|
876
858
|
const { sequence, scales } = FACTORY2[media];
|
|
877
859
|
const query = MEDIA2[mediaName];
|
|
878
|
-
if (!query && CONFIG2.verbose)
|
|
879
|
-
console.warn("Can't find media query ", query);
|
|
860
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
880
861
|
if (!mediaRegenerate) {
|
|
881
862
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
882
|
-
if (!underMediaQuery)
|
|
883
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
863
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
884
864
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
885
865
|
return;
|
|
886
866
|
}
|
|
887
867
|
for (const key in sequence) {
|
|
888
868
|
const item = sequence[key];
|
|
889
869
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
890
|
-
if (!query && CONFIG2.verbose)
|
|
891
|
-
console.warn("Can't find query ", query);
|
|
870
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
892
871
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
893
|
-
if (!underMediaQuery)
|
|
894
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
872
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
895
873
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
896
874
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
897
875
|
}
|
|
@@ -902,8 +880,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
902
880
|
for (const prop in FACTORY2) {
|
|
903
881
|
const mediaProps = FACTORY2[prop];
|
|
904
882
|
const isMediaName = prop.slice(0, 1) === "@";
|
|
905
|
-
if (!isMediaName)
|
|
906
|
-
continue;
|
|
883
|
+
if (!isMediaName) continue;
|
|
907
884
|
const {
|
|
908
885
|
type,
|
|
909
886
|
base,
|
|
@@ -940,8 +917,7 @@ var applySpacingSequence = () => {
|
|
|
940
917
|
var getSequence = (sequenceProps) => {
|
|
941
918
|
const CONFIG2 = getActiveConfig();
|
|
942
919
|
const { SPACING: SPACING2 } = CONFIG2;
|
|
943
|
-
if (!sequenceProps)
|
|
944
|
-
return SPACING2;
|
|
920
|
+
if (!sequenceProps) return SPACING2;
|
|
945
921
|
const hasGenerated = Object.keys(sequenceProps.sequence).length > 0;
|
|
946
922
|
return hasGenerated ? sequenceProps : generateSequence(sequenceProps);
|
|
947
923
|
};
|
|
@@ -951,8 +927,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
951
927
|
return { [propertyName]: value };
|
|
952
928
|
}
|
|
953
929
|
const stack = (0, import_utils7.arrayzeValue)(value);
|
|
954
|
-
if (!isArray(stack))
|
|
955
|
-
return;
|
|
930
|
+
if (!isArray(stack)) return;
|
|
956
931
|
if (stack.length > 1) {
|
|
957
932
|
let suffix = "";
|
|
958
933
|
if (propertyName === "borderWidth") {
|
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
|
});
|
|
@@ -288,8 +279,7 @@ var isFunction = (arg) => typeof arg === "function";
|
|
|
288
279
|
var isNull = (arg) => arg === null;
|
|
289
280
|
var isArray = (arg) => Array.isArray(arg);
|
|
290
281
|
var isObjectLike = (arg) => {
|
|
291
|
-
if (arg === null)
|
|
292
|
-
return false;
|
|
282
|
+
if (arg === null) return false;
|
|
293
283
|
return typeof arg === "object";
|
|
294
284
|
};
|
|
295
285
|
var isUndefined = (arg) => {
|
|
@@ -298,7 +288,10 @@ var isUndefined = (arg) => {
|
|
|
298
288
|
|
|
299
289
|
// ../../../domql/packages/utils/dist/esm/array.js
|
|
300
290
|
var mergeArray = (arr, exclude = []) => {
|
|
301
|
-
return arr.reduce(
|
|
291
|
+
return arr.reduce(
|
|
292
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
293
|
+
{}
|
|
294
|
+
);
|
|
302
295
|
};
|
|
303
296
|
|
|
304
297
|
// ../../../domql/packages/utils/dist/esm/object.js
|
|
@@ -354,8 +347,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
354
347
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
355
348
|
visited.set(obj, clone2);
|
|
356
349
|
for (const key in obj) {
|
|
357
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
358
|
-
continue;
|
|
350
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
359
351
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
360
352
|
continue;
|
|
361
353
|
const value = obj[key];
|
|
@@ -618,10 +610,8 @@ var generateSprite = (icons) => {
|
|
|
618
610
|
const CONFIG2 = getActiveConfig();
|
|
619
611
|
let sprite = "";
|
|
620
612
|
for (const key in icons) {
|
|
621
|
-
if (CONFIG2.__svg_cache[key])
|
|
622
|
-
|
|
623
|
-
else
|
|
624
|
-
CONFIG2.__svg_cache[key] = true;
|
|
613
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
614
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
625
615
|
sprite += icons[key];
|
|
626
616
|
}
|
|
627
617
|
return sprite;
|
|
@@ -629,8 +619,7 @@ var generateSprite = (icons) => {
|
|
|
629
619
|
var parseRootAttributes = (htmlString) => {
|
|
630
620
|
const val = htmlString.default || htmlString;
|
|
631
621
|
if (!isString(val)) {
|
|
632
|
-
if (isDev)
|
|
633
|
-
console.warn("parseRootAttributes:", val, "is not a string");
|
|
622
|
+
if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
|
|
634
623
|
return;
|
|
635
624
|
}
|
|
636
625
|
const match = val.match(/<svg\s+(.*?)>/);
|
|
@@ -681,8 +670,7 @@ var DEF_OPTIONS = {
|
|
|
681
670
|
var setSVG = (val, key) => {
|
|
682
671
|
const CONFIG2 = getActiveConfig();
|
|
683
672
|
if (!val) {
|
|
684
|
-
if (CONFIG2.verbose)
|
|
685
|
-
console.warn("setSVG: val is not defined", key);
|
|
673
|
+
if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
|
|
686
674
|
return;
|
|
687
675
|
}
|
|
688
676
|
if (CONFIG2.useSvgSprite) {
|
|
@@ -693,8 +681,7 @@ var setSVG = (val, key) => {
|
|
|
693
681
|
var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
694
682
|
const CONFIG2 = getActiveConfig();
|
|
695
683
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
|
|
696
|
-
for (const key in LIBRARY)
|
|
697
|
-
lib[key] = CONFIG2.SVG[key];
|
|
684
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
|
|
698
685
|
appendSVG(lib, options);
|
|
699
686
|
};
|
|
700
687
|
var setSvgIcon = (val, key) => {
|
|
@@ -708,13 +695,11 @@ var setSvgIcon = (val, key) => {
|
|
|
708
695
|
var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
|
|
709
696
|
const CONFIG2 = getActiveConfig();
|
|
710
697
|
const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
|
|
711
|
-
for (const key in LIBRARY)
|
|
712
|
-
lib[key] = CONFIG2.ICONS[key];
|
|
698
|
+
for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
|
|
713
699
|
appendSVG(lib, options);
|
|
714
700
|
};
|
|
715
701
|
var createSVGSpriteElement = (options = { isRoot: true }) => {
|
|
716
|
-
if (!document2 || !document2.createElementNS)
|
|
717
|
-
return;
|
|
702
|
+
if (!document2 || !document2.createElementNS) return;
|
|
718
703
|
const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
719
704
|
if (options.isRoot) {
|
|
720
705
|
svgElem.setAttribute("aria-hidden", "true");
|