@symbo.ls/scratch 2.11.522 → 3.0.1
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 +13 -20
- package/dist/cjs/index.js +192 -382
- package/dist/cjs/set.js +132 -282
- package/dist/cjs/system/color.js +61 -142
- package/dist/cjs/system/document.js +28 -84
- package/dist/cjs/system/font.js +29 -88
- package/dist/cjs/system/index.js +135 -285
- package/dist/cjs/system/reset.js +35 -98
- package/dist/cjs/system/shadow.js +77 -173
- package/dist/cjs/system/spacing.js +41 -112
- package/dist/cjs/system/svg.js +34 -94
- package/dist/cjs/system/theme.js +74 -168
- package/dist/cjs/system/timing.js +33 -96
- package/dist/cjs/system/typography.js +41 -110
- package/dist/cjs/transforms/index.js +112 -228
- package/dist/cjs/utils/color.js +22 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +66 -154
- package/dist/cjs/utils/sequence.js +33 -57
- package/dist/cjs/utils/sprite.js +13 -20
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +27 -45
- package/package.json +3 -3
- package/src/system/svg.js +1 -1
- package/src/transforms/index.js +9 -2
- package/src/utils/color.js +1 -2
|
@@ -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,60 +241,19 @@ 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
|
});
|
|
265
256
|
|
|
266
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
267
|
-
var require_cjs2 = __commonJS({
|
|
268
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
269
|
-
"use strict";
|
|
270
|
-
var __defProp3 = Object.defineProperty;
|
|
271
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
272
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
273
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
274
|
-
var __export2 = (target, all) => {
|
|
275
|
-
for (var name in all)
|
|
276
|
-
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
277
|
-
};
|
|
278
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
279
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
280
|
-
for (let key of __getOwnPropNames2(from))
|
|
281
|
-
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
282
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
283
|
-
}
|
|
284
|
-
return to;
|
|
285
|
-
};
|
|
286
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
287
|
-
var globals_exports = {};
|
|
288
|
-
__export2(globals_exports, {
|
|
289
|
-
document: () => document4,
|
|
290
|
-
global: () => global,
|
|
291
|
-
self: () => self,
|
|
292
|
-
window: () => window4
|
|
293
|
-
});
|
|
294
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
295
|
-
var global = globalThis;
|
|
296
|
-
var self = globalThis;
|
|
297
|
-
var window4 = globalThis;
|
|
298
|
-
var document4 = window4.document;
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
257
|
// src/system/timing.js
|
|
303
258
|
var timing_exports = {};
|
|
304
259
|
__export(timing_exports, {
|
|
@@ -309,35 +264,34 @@ __export(timing_exports, {
|
|
|
309
264
|
module.exports = __toCommonJS(timing_exports);
|
|
310
265
|
var import_utils7 = __toESM(require_cjs(), 1);
|
|
311
266
|
|
|
312
|
-
//
|
|
267
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
313
268
|
var window2 = globalThis;
|
|
314
269
|
var document2 = window2.document;
|
|
315
270
|
|
|
316
|
-
//
|
|
271
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
317
272
|
var isDOMNode = (obj) => {
|
|
318
273
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
319
274
|
};
|
|
320
275
|
|
|
321
|
-
//
|
|
276
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
322
277
|
var isString = (arg) => typeof arg === "string";
|
|
323
278
|
var isFunction = (arg) => typeof arg === "function";
|
|
324
279
|
var isNull = (arg) => arg === null;
|
|
325
280
|
var isArray = (arg) => Array.isArray(arg);
|
|
326
281
|
var isObjectLike = (arg) => {
|
|
327
|
-
if (arg === null)
|
|
328
|
-
return false;
|
|
282
|
+
if (arg === null) return false;
|
|
329
283
|
return typeof arg === "object";
|
|
330
284
|
};
|
|
331
285
|
var isUndefined = (arg) => {
|
|
332
286
|
return arg === void 0;
|
|
333
287
|
};
|
|
334
288
|
|
|
335
|
-
//
|
|
289
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
336
290
|
var mergeArray = (arr, exclude = []) => {
|
|
337
291
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
338
292
|
};
|
|
339
293
|
|
|
340
|
-
//
|
|
294
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
341
295
|
var __defProp2 = Object.defineProperty;
|
|
342
296
|
var __defProps = Object.defineProperties;
|
|
343
297
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -360,8 +314,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
360
314
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
361
315
|
for (const e in extend) {
|
|
362
316
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
363
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
364
|
-
continue;
|
|
317
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
365
318
|
const elementProp = element[e];
|
|
366
319
|
const extendProp = extend[e];
|
|
367
320
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -390,13 +343,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
390
343
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
391
344
|
visited.set(obj, clone2);
|
|
392
345
|
for (const key in obj) {
|
|
393
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
394
|
-
|
|
395
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
396
|
-
continue;
|
|
346
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
347
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
397
348
|
const value = obj[key];
|
|
398
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
399
|
-
continue;
|
|
349
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
400
350
|
if (isDOMNode(value)) {
|
|
401
351
|
clone2[key] = value;
|
|
402
352
|
continue;
|
|
@@ -420,7 +370,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
420
370
|
return clone2;
|
|
421
371
|
};
|
|
422
372
|
|
|
423
|
-
//
|
|
373
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
424
374
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
425
375
|
|
|
426
376
|
// src/defaultConfig/index.js
|
|
@@ -649,9 +599,6 @@ var isScalingUnit = (unit) => {
|
|
|
649
599
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
650
600
|
};
|
|
651
601
|
|
|
652
|
-
// src/utils/color.js
|
|
653
|
-
var import_globals4 = __toESM(require_cjs2(), 1);
|
|
654
|
-
|
|
655
602
|
// src/utils/sequence.js
|
|
656
603
|
var import_utils4 = __toESM(require_cjs(), 1);
|
|
657
604
|
var numToLetterMap = {
|
|
@@ -699,8 +646,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
699
646
|
var setScalingVar = (key, sequenceProps) => {
|
|
700
647
|
const { base, type, unit } = sequenceProps;
|
|
701
648
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
702
|
-
if (key === 0)
|
|
703
|
-
return defaultVal;
|
|
649
|
+
if (key === 0) return defaultVal;
|
|
704
650
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
705
651
|
const ratioVar = `${prefix}-ratio`;
|
|
706
652
|
if (key > 0) {
|
|
@@ -737,10 +683,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
737
683
|
const diffRounded = ~~next - ~~value;
|
|
738
684
|
let arr;
|
|
739
685
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
740
|
-
if (diffRounded > 16)
|
|
741
|
-
|
|
742
|
-
else
|
|
743
|
-
arr = [first, second];
|
|
686
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
687
|
+
else arr = [first, second];
|
|
744
688
|
arr.forEach((v, k) => {
|
|
745
689
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
746
690
|
const newVar = variable + (k + 1);
|
|
@@ -782,8 +726,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
782
726
|
index: key
|
|
783
727
|
};
|
|
784
728
|
setSequenceValue(props, sequenceProps);
|
|
785
|
-
if (subSequence)
|
|
786
|
-
generateSubSequence(props, sequenceProps);
|
|
729
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
787
730
|
}
|
|
788
731
|
return sequenceProps;
|
|
789
732
|
};
|
|
@@ -795,13 +738,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
795
738
|
unit = UNIT2.default,
|
|
796
739
|
useVariable
|
|
797
740
|
} = sequenceProps;
|
|
798
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
799
|
-
return `var(${value})`;
|
|
741
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
800
742
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
801
743
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
802
744
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
803
|
-
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)
|
|
804
|
-
return value;
|
|
745
|
+
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;
|
|
805
746
|
const letterVal = value.toUpperCase();
|
|
806
747
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
807
748
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -825,8 +766,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
825
766
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
826
767
|
}
|
|
827
768
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
828
|
-
if (CONFIG2.verbose)
|
|
829
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
769
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
830
770
|
absValue = absValue.slice(0, 1);
|
|
831
771
|
}
|
|
832
772
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -834,8 +774,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
834
774
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
835
775
|
}
|
|
836
776
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
837
|
-
if (!sequenceItem)
|
|
838
|
-
return console.warn("can't find", sequence, absValue);
|
|
777
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
839
778
|
if (unit === "ms" || unit === "s") {
|
|
840
779
|
return isNegative + sequenceItem.val + unit;
|
|
841
780
|
}
|
|
@@ -844,12 +783,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
844
783
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
845
784
|
if (typeof value !== "string") {
|
|
846
785
|
const CONFIG2 = getActiveConfig();
|
|
847
|
-
if (CONFIG2.verbose)
|
|
848
|
-
console.warn(propertyName, value, "is not a string");
|
|
786
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
849
787
|
return { [propertyName]: value };
|
|
850
788
|
}
|
|
851
|
-
if (value === "-" || value === "")
|
|
852
|
-
return {};
|
|
789
|
+
if (value === "-" || value === "") return {};
|
|
853
790
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
854
791
|
};
|
|
855
792
|
|
|
@@ -30,44 +30,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
34
|
-
var require_cjs = __commonJS({
|
|
35
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var __defProp3 = Object.defineProperty;
|
|
38
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
41
|
-
var __export2 = (target, all) => {
|
|
42
|
-
for (var name in all)
|
|
43
|
-
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
44
|
-
};
|
|
45
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
46
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
-
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
49
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
|
-
}
|
|
51
|
-
return to;
|
|
52
|
-
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var globals_exports = {};
|
|
55
|
-
__export2(globals_exports, {
|
|
56
|
-
document: () => document4,
|
|
57
|
-
global: () => global,
|
|
58
|
-
self: () => self,
|
|
59
|
-
window: () => window4
|
|
60
|
-
});
|
|
61
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
62
|
-
var global = globalThis;
|
|
63
|
-
var self = globalThis;
|
|
64
|
-
var window4 = globalThis;
|
|
65
|
-
var document4 = window4.document;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
|
|
69
33
|
// ../utils/dist/cjs/index.js
|
|
70
|
-
var
|
|
34
|
+
var require_cjs = __commonJS({
|
|
71
35
|
"../utils/dist/cjs/index.js"(exports, module2) {
|
|
72
36
|
"use strict";
|
|
73
37
|
var __defProp3 = Object.defineProperty;
|
|
@@ -87,8 +51,8 @@ var require_cjs2 = __commonJS({
|
|
|
87
51
|
return to;
|
|
88
52
|
};
|
|
89
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
90
|
-
var
|
|
91
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
92
56
|
arrayzeValue: () => arrayzeValue,
|
|
93
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
94
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -109,12 +73,11 @@ var require_cjs2 = __commonJS({
|
|
|
109
73
|
toTitleCase: () => toTitleCase,
|
|
110
74
|
toggleFullscreen: () => toggleFullscreen
|
|
111
75
|
});
|
|
112
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
113
77
|
var window22 = globalThis;
|
|
114
78
|
var document22 = window22.document;
|
|
115
79
|
var isObject2 = (arg) => {
|
|
116
|
-
if (arg === null)
|
|
117
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
118
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
119
82
|
};
|
|
120
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -139,13 +102,11 @@ var require_cjs2 = __commonJS({
|
|
|
139
102
|
};
|
|
140
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
141
104
|
val = parseFloat(val);
|
|
142
|
-
if (isObject2(factory))
|
|
143
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
144
106
|
return findClosestNumber(val, factory);
|
|
145
107
|
};
|
|
146
108
|
var formatDate = (timestamp) => {
|
|
147
|
-
if (!timestamp)
|
|
148
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
149
110
|
const d = new Date(timestamp);
|
|
150
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
151
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -212,8 +173,7 @@ var require_cjs2 = __commonJS({
|
|
|
212
173
|
scriptEle.type = type;
|
|
213
174
|
scriptEle.text = xhr.responseText;
|
|
214
175
|
doc.body.appendChild(scriptEle);
|
|
215
|
-
if (typeof fallback === "function")
|
|
216
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
217
177
|
} else {
|
|
218
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
219
179
|
}
|
|
@@ -281,20 +241,15 @@ var require_cjs2 = __commonJS({
|
|
|
281
241
|
);
|
|
282
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
283
243
|
var toDescriptionCase = (str = "") => {
|
|
284
|
-
if (typeof str !== "string")
|
|
285
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
286
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
287
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
288
247
|
};
|
|
289
248
|
var arrayzeValue = (val) => {
|
|
290
|
-
if (isArray2(val))
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
if (isObject2(val))
|
|
295
|
-
return Object.values(val);
|
|
296
|
-
if (isNumber2(val))
|
|
297
|
-
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];
|
|
298
253
|
};
|
|
299
254
|
}
|
|
300
255
|
});
|
|
@@ -309,35 +264,34 @@ __export(typography_exports, {
|
|
|
309
264
|
});
|
|
310
265
|
module.exports = __toCommonJS(typography_exports);
|
|
311
266
|
|
|
312
|
-
//
|
|
267
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
313
268
|
var window2 = globalThis;
|
|
314
269
|
var document2 = window2.document;
|
|
315
270
|
|
|
316
|
-
//
|
|
271
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
317
272
|
var isDOMNode = (obj) => {
|
|
318
273
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
319
274
|
};
|
|
320
275
|
|
|
321
|
-
//
|
|
276
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
322
277
|
var isString = (arg) => typeof arg === "string";
|
|
323
278
|
var isFunction = (arg) => typeof arg === "function";
|
|
324
279
|
var isNull = (arg) => arg === null;
|
|
325
280
|
var isArray = (arg) => Array.isArray(arg);
|
|
326
281
|
var isObjectLike = (arg) => {
|
|
327
|
-
if (arg === null)
|
|
328
|
-
return false;
|
|
282
|
+
if (arg === null) return false;
|
|
329
283
|
return typeof arg === "object";
|
|
330
284
|
};
|
|
331
285
|
var isUndefined = (arg) => {
|
|
332
286
|
return arg === void 0;
|
|
333
287
|
};
|
|
334
288
|
|
|
335
|
-
//
|
|
289
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
336
290
|
var mergeArray = (arr, exclude = []) => {
|
|
337
291
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
338
292
|
};
|
|
339
293
|
|
|
340
|
-
//
|
|
294
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
341
295
|
var __defProp2 = Object.defineProperty;
|
|
342
296
|
var __defProps = Object.defineProperties;
|
|
343
297
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -360,8 +314,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
360
314
|
var merge = (element, obj, excludeFrom = []) => {
|
|
361
315
|
for (const e in obj) {
|
|
362
316
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
|
|
363
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
364
|
-
continue;
|
|
317
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
365
318
|
const elementProp = element[e];
|
|
366
319
|
const objProp = obj[e];
|
|
367
320
|
if (elementProp === void 0) {
|
|
@@ -373,8 +326,7 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
373
326
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
374
327
|
for (const e in extend) {
|
|
375
328
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
376
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
377
|
-
continue;
|
|
329
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
378
330
|
const elementProp = element[e];
|
|
379
331
|
const extendProp = extend[e];
|
|
380
332
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -403,13 +355,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
403
355
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
404
356
|
visited.set(obj, clone2);
|
|
405
357
|
for (const key in obj) {
|
|
406
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
407
|
-
|
|
408
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
409
|
-
continue;
|
|
358
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
359
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
410
360
|
const value = obj[key];
|
|
411
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
412
|
-
continue;
|
|
361
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
413
362
|
if (isDOMNode(value)) {
|
|
414
363
|
clone2[key] = value;
|
|
415
364
|
continue;
|
|
@@ -433,7 +382,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
433
382
|
return clone2;
|
|
434
383
|
};
|
|
435
384
|
|
|
436
|
-
//
|
|
385
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
437
386
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
438
387
|
|
|
439
388
|
// src/defaultConfig/index.js
|
|
@@ -662,11 +611,8 @@ var isScalingUnit = (unit) => {
|
|
|
662
611
|
return unit === "em" || unit === "rem" || unit === "vw" || unit === "vh" || unit === "vmax" || unit === "vmin";
|
|
663
612
|
};
|
|
664
613
|
|
|
665
|
-
// src/utils/color.js
|
|
666
|
-
var import_globals4 = __toESM(require_cjs(), 1);
|
|
667
|
-
|
|
668
614
|
// src/utils/sequence.js
|
|
669
|
-
var import_utils4 = __toESM(
|
|
615
|
+
var import_utils4 = __toESM(require_cjs(), 1);
|
|
670
616
|
var numToLetterMap = {
|
|
671
617
|
"-6": "U",
|
|
672
618
|
"-5": "V",
|
|
@@ -712,8 +658,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
712
658
|
var setScalingVar = (key, sequenceProps) => {
|
|
713
659
|
const { base, type, unit } = sequenceProps;
|
|
714
660
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
715
|
-
if (key === 0)
|
|
716
|
-
return defaultVal;
|
|
661
|
+
if (key === 0) return defaultVal;
|
|
717
662
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
718
663
|
const ratioVar = `${prefix}-ratio`;
|
|
719
664
|
if (key > 0) {
|
|
@@ -750,10 +695,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
750
695
|
const diffRounded = ~~next - ~~value;
|
|
751
696
|
let arr;
|
|
752
697
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
753
|
-
if (diffRounded > 16)
|
|
754
|
-
|
|
755
|
-
else
|
|
756
|
-
arr = [first, second];
|
|
698
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
699
|
+
else arr = [first, second];
|
|
757
700
|
arr.forEach((v, k) => {
|
|
758
701
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
759
702
|
const newVar = variable + (k + 1);
|
|
@@ -795,8 +738,7 @@ var generateSequence = (sequenceProps) => {
|
|
|
795
738
|
index: key
|
|
796
739
|
};
|
|
797
740
|
setSequenceValue(props, sequenceProps);
|
|
798
|
-
if (subSequence)
|
|
799
|
-
generateSubSequence(props, sequenceProps);
|
|
741
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
800
742
|
}
|
|
801
743
|
return sequenceProps;
|
|
802
744
|
};
|
|
@@ -808,13 +750,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
808
750
|
unit = UNIT2.default,
|
|
809
751
|
useVariable
|
|
810
752
|
} = sequenceProps;
|
|
811
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
812
|
-
return `var(${value})`;
|
|
753
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
813
754
|
const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
814
755
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
815
756
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
816
|
-
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)
|
|
817
|
-
return value;
|
|
757
|
+
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;
|
|
818
758
|
const letterVal = value.toUpperCase();
|
|
819
759
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
820
760
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -838,8 +778,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
838
778
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
839
779
|
}
|
|
840
780
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
841
|
-
if (CONFIG2.verbose)
|
|
842
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
781
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
843
782
|
absValue = absValue.slice(0, 1);
|
|
844
783
|
}
|
|
845
784
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -847,8 +786,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
847
786
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
848
787
|
}
|
|
849
788
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
850
|
-
if (!sequenceItem)
|
|
851
|
-
return console.warn("can't find", sequence, absValue);
|
|
789
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
852
790
|
if (unit === "ms" || unit === "s") {
|
|
853
791
|
return isNegative + sequenceItem.val + unit;
|
|
854
792
|
}
|
|
@@ -857,12 +795,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
857
795
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
858
796
|
if (typeof value !== "string") {
|
|
859
797
|
const CONFIG2 = getActiveConfig();
|
|
860
|
-
if (CONFIG2.verbose)
|
|
861
|
-
console.warn(propertyName, value, "is not a string");
|
|
798
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
862
799
|
return { [propertyName]: value };
|
|
863
800
|
}
|
|
864
|
-
if (value === "-" || value === "")
|
|
865
|
-
return {};
|
|
801
|
+
if (value === "-" || value === "") return {};
|
|
866
802
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
867
803
|
};
|
|
868
804
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
|
@@ -922,23 +858,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
922
858
|
const { mediaRegenerate } = FACTORY2;
|
|
923
859
|
const { sequence, scales } = FACTORY2[media];
|
|
924
860
|
const query = MEDIA2[mediaName];
|
|
925
|
-
if (!query && CONFIG2.verbose)
|
|
926
|
-
console.warn("Can't find media query ", query);
|
|
861
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
927
862
|
if (!mediaRegenerate) {
|
|
928
863
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
929
|
-
if (!underMediaQuery)
|
|
930
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
864
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
931
865
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
932
866
|
return;
|
|
933
867
|
}
|
|
934
868
|
for (const key in sequence) {
|
|
935
869
|
const item = sequence[key];
|
|
936
870
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
937
|
-
if (!query && CONFIG2.verbose)
|
|
938
|
-
console.warn("Can't find query ", query);
|
|
871
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
939
872
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
940
|
-
if (!underMediaQuery)
|
|
941
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
873
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
942
874
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
943
875
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
944
876
|
}
|
|
@@ -951,8 +883,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
951
883
|
for (const prop in FACTORY2) {
|
|
952
884
|
const isPropMedia = prop.slice(0, 1) === "@";
|
|
953
885
|
const mediaValue = FACTORY2[prop];
|
|
954
|
-
if (!isPropMedia)
|
|
955
|
-
continue;
|
|
886
|
+
if (!isPropMedia) continue;
|
|
956
887
|
const { mediaRegenerate } = FACTORY2;
|
|
957
888
|
const mediaName = prop.slice(1);
|
|
958
889
|
const {
|