@symbo.ls/scratch 3.1.2 → 3.2.3
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 +39 -20
- package/dist/cjs/index.js +130 -72
- package/dist/cjs/set.js +126 -58
- package/dist/cjs/system/color.js +120 -41
- package/dist/cjs/system/document.js +119 -38
- package/dist/cjs/system/font.js +117 -36
- package/dist/cjs/system/index.js +127 -63
- package/dist/cjs/system/reset.js +119 -38
- package/dist/cjs/system/shadow.js +120 -41
- package/dist/cjs/system/spacing.js +119 -38
- package/dist/cjs/system/svg.js +118 -39
- package/dist/cjs/system/theme.js +120 -41
- package/dist/cjs/system/timing.js +117 -36
- package/dist/cjs/system/typography.js +123 -55
- package/dist/cjs/transforms/index.js +122 -43
- package/dist/cjs/utils/color.js +15 -18
- package/dist/cjs/utils/index.js +124 -53
- package/dist/cjs/utils/sequence.js +109 -36
- package/dist/cjs/utils/sprite.js +48 -23
- package/dist/cjs/utils/var.js +109 -36
- package/package.json +7 -7
- package/src/system/typography.js +12 -20
- package/src/utils/color.js +42 -31
- package/src/utils/sprite.js +12 -8
package/dist/cjs/set.js
CHANGED
|
@@ -34,23 +34,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
34
34
|
var require_cjs = __commonJS({
|
|
35
35
|
"../utils/dist/cjs/index.js"(exports, module2) {
|
|
36
36
|
"use strict";
|
|
37
|
-
var
|
|
37
|
+
var __defProp3 = Object.defineProperty;
|
|
38
38
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
39
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var
|
|
40
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
41
41
|
var __export2 = (target, all) => {
|
|
42
42
|
for (var name in all)
|
|
43
|
-
|
|
43
|
+
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
44
44
|
};
|
|
45
45
|
var __copyProps2 = (to, from, except, desc) => {
|
|
46
46
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
47
|
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!
|
|
49
|
-
|
|
48
|
+
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
49
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
50
|
}
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(
|
|
53
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
54
|
var index_exports = {};
|
|
55
55
|
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue3,
|
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase2,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -273,10 +275,12 @@ var require_cjs = __commonJS({
|
|
|
273
275
|
});
|
|
274
276
|
});
|
|
275
277
|
scriptEle.addEventListener("error", (ev) => {
|
|
276
|
-
reject(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
reject(
|
|
279
|
+
new Error({
|
|
280
|
+
status: false,
|
|
281
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
282
|
+
})
|
|
283
|
+
);
|
|
280
284
|
});
|
|
281
285
|
doc.body.appendChild(scriptEle);
|
|
282
286
|
} catch (error) {
|
|
@@ -347,6 +351,59 @@ var require_cjs = __commonJS({
|
|
|
347
351
|
console.warn(error);
|
|
348
352
|
}
|
|
349
353
|
};
|
|
354
|
+
function loadRemoteScript(url, options = {}) {
|
|
355
|
+
const { window: window4 = globalThis } = options;
|
|
356
|
+
const { document: document4 = window4.document } = options;
|
|
357
|
+
return new Promise((resolve, reject) => {
|
|
358
|
+
const existingScript = document4.querySelector(`script[src="${url}"]`);
|
|
359
|
+
if (existingScript) {
|
|
360
|
+
return resolve(existingScript);
|
|
361
|
+
}
|
|
362
|
+
const script = document4.createElement("script");
|
|
363
|
+
script.src = url;
|
|
364
|
+
script.async = options.async === true;
|
|
365
|
+
script.type = options.type || "text/javascript";
|
|
366
|
+
if (options.id) script.id = options.id;
|
|
367
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
368
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
369
|
+
script.onload = () => {
|
|
370
|
+
script.onerror = script.onload = null;
|
|
371
|
+
resolve(script);
|
|
372
|
+
};
|
|
373
|
+
script.onerror = () => {
|
|
374
|
+
script.onerror = script.onload = null;
|
|
375
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
376
|
+
};
|
|
377
|
+
document4.head.appendChild(script);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
381
|
+
const { window: window4 = globalThis } = options;
|
|
382
|
+
const { document: document4 = window4.document } = options;
|
|
383
|
+
return new Promise((resolve, reject) => {
|
|
384
|
+
const existingLink = document4.querySelector(`link[href="${url}"]`);
|
|
385
|
+
if (existingLink) {
|
|
386
|
+
return resolve(existingLink);
|
|
387
|
+
}
|
|
388
|
+
const link = document4.createElement("link");
|
|
389
|
+
link.href = url;
|
|
390
|
+
link.rel = options.rel || "stylesheet";
|
|
391
|
+
link.type = "text/css";
|
|
392
|
+
link.media = options.media || "all";
|
|
393
|
+
if (options.id) link.id = options.id;
|
|
394
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
395
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
396
|
+
link.onload = () => {
|
|
397
|
+
link.onerror = link.onload = null;
|
|
398
|
+
resolve(link);
|
|
399
|
+
};
|
|
400
|
+
link.onerror = () => {
|
|
401
|
+
link.onerror = link.onload = null;
|
|
402
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
403
|
+
};
|
|
404
|
+
document4.head.appendChild(link);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
350
407
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
351
408
|
var copyStringToClipboard = async (str) => {
|
|
352
409
|
try {
|
|
@@ -373,12 +430,9 @@ var require_cjs = __commonJS({
|
|
|
373
430
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
374
431
|
}).replaceAll(/\s+/g, "");
|
|
375
432
|
};
|
|
376
|
-
var toTitleCase = (str) => str && str.replace(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
380
|
-
}
|
|
381
|
-
);
|
|
433
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
434
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
435
|
+
});
|
|
382
436
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
383
437
|
var toDescriptionCase = (str = "") => {
|
|
384
438
|
if (typeof str !== "string") return;
|
|
@@ -404,16 +458,16 @@ __export(set_exports, {
|
|
|
404
458
|
});
|
|
405
459
|
module.exports = __toCommonJS(set_exports);
|
|
406
460
|
|
|
407
|
-
// ../../../domql/packages/utils/globals.js
|
|
461
|
+
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
408
462
|
var window2 = globalThis;
|
|
409
463
|
var document2 = window2.document;
|
|
410
464
|
|
|
411
|
-
// ../../../domql/packages/utils/node.js
|
|
465
|
+
// ../../../domql/packages/utils/dist/esm/node.js
|
|
412
466
|
var isDOMNode = (obj) => {
|
|
413
467
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
414
468
|
};
|
|
415
469
|
|
|
416
|
-
// ../../../domql/packages/utils/types.js
|
|
470
|
+
// ../../../domql/packages/utils/dist/esm/types.js
|
|
417
471
|
var isObject = (arg) => {
|
|
418
472
|
if (arg === null) return false;
|
|
419
473
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -431,7 +485,7 @@ var isUndefined = (arg) => {
|
|
|
431
485
|
return arg === void 0;
|
|
432
486
|
};
|
|
433
487
|
|
|
434
|
-
// ../../../domql/packages/utils/array.js
|
|
488
|
+
// ../../../domql/packages/utils/dist/esm/array.js
|
|
435
489
|
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
436
490
|
return arr.reduce(
|
|
437
491
|
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
@@ -439,7 +493,7 @@ var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
|
439
493
|
);
|
|
440
494
|
};
|
|
441
495
|
|
|
442
|
-
// ../../../domql/packages/utils/keys.js
|
|
496
|
+
// ../../../domql/packages/utils/dist/esm/keys.js
|
|
443
497
|
var STATE_METHODS = [
|
|
444
498
|
"update",
|
|
445
499
|
"parse",
|
|
@@ -510,11 +564,30 @@ var METHODS_EXL = [
|
|
|
510
564
|
...PROPS_METHODS
|
|
511
565
|
];
|
|
512
566
|
|
|
513
|
-
// ../../../domql/packages/utils/object.js
|
|
567
|
+
// ../../../domql/packages/utils/dist/esm/object.js
|
|
568
|
+
var __defProp2 = Object.defineProperty;
|
|
569
|
+
var __defProps = Object.defineProperties;
|
|
570
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
571
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
572
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
573
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
574
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
575
|
+
var __spreadValues = (a, b) => {
|
|
576
|
+
for (var prop in b || (b = {}))
|
|
577
|
+
if (__hasOwnProp2.call(b, prop))
|
|
578
|
+
__defNormalProp(a, prop, b[prop]);
|
|
579
|
+
if (__getOwnPropSymbols)
|
|
580
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
581
|
+
if (__propIsEnum.call(b, prop))
|
|
582
|
+
__defNormalProp(a, prop, b[prop]);
|
|
583
|
+
}
|
|
584
|
+
return a;
|
|
585
|
+
};
|
|
586
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
514
587
|
var merge = (element, obj, excludeFrom = []) => {
|
|
515
588
|
for (const e in obj) {
|
|
516
|
-
const
|
|
517
|
-
if (!
|
|
589
|
+
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
|
|
590
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
518
591
|
continue;
|
|
519
592
|
}
|
|
520
593
|
const elementProp = element[e];
|
|
@@ -527,8 +600,8 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
527
600
|
};
|
|
528
601
|
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
529
602
|
for (const e in extend) {
|
|
530
|
-
const
|
|
531
|
-
if (!
|
|
603
|
+
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
604
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
532
605
|
continue;
|
|
533
606
|
}
|
|
534
607
|
const elementProp = element[e];
|
|
@@ -550,14 +623,15 @@ var deepClone = (obj, options = {}) => {
|
|
|
550
623
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
551
624
|
handleExtends = false
|
|
552
625
|
} = options;
|
|
626
|
+
const contentWindow = targetWindow || window2 || globalThis;
|
|
553
627
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
554
628
|
return obj;
|
|
555
629
|
}
|
|
556
630
|
if (visited.has(obj)) {
|
|
557
631
|
return visited.get(obj);
|
|
558
632
|
}
|
|
559
|
-
const
|
|
560
|
-
visited.set(obj,
|
|
633
|
+
const clone2 = contentWindow ? isArray(obj) ? new contentWindow.Array() : new contentWindow.Object() : isArray(obj) ? [] : {};
|
|
634
|
+
visited.set(obj, clone2);
|
|
561
635
|
for (const key in obj) {
|
|
562
636
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
563
637
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
@@ -568,27 +642,26 @@ var deepClone = (obj, options = {}) => {
|
|
|
568
642
|
continue;
|
|
569
643
|
}
|
|
570
644
|
if (isDOMNode(value)) {
|
|
571
|
-
|
|
645
|
+
clone2[key] = value;
|
|
572
646
|
continue;
|
|
573
647
|
}
|
|
574
648
|
if (handleExtends && key === "extends" && isArray(value)) {
|
|
575
|
-
|
|
649
|
+
clone2[key] = unstackArrayOfObjects(value, exclude);
|
|
576
650
|
continue;
|
|
577
651
|
}
|
|
578
|
-
if (isFunction(value) &&
|
|
579
|
-
|
|
652
|
+
if (isFunction(value) && options.window) {
|
|
653
|
+
clone2[key] = contentWindow.eval("(" + value.toString() + ")");
|
|
580
654
|
continue;
|
|
581
655
|
}
|
|
582
656
|
if (isObjectLike(value)) {
|
|
583
|
-
|
|
584
|
-
...options,
|
|
657
|
+
clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
|
|
585
658
|
visited
|
|
586
|
-
});
|
|
659
|
+
}));
|
|
587
660
|
} else {
|
|
588
|
-
|
|
661
|
+
clone2[key] = value;
|
|
589
662
|
}
|
|
590
663
|
}
|
|
591
|
-
return
|
|
664
|
+
return clone2;
|
|
592
665
|
};
|
|
593
666
|
var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
594
667
|
const excl = opts.exclude || [];
|
|
@@ -614,7 +687,12 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
|
|
|
614
687
|
return obj;
|
|
615
688
|
};
|
|
616
689
|
|
|
617
|
-
// ../../../domql/packages/utils/
|
|
690
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
691
|
+
var NODE_ENV = "development";
|
|
692
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
693
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
694
|
+
|
|
695
|
+
// ../../../domql/packages/utils/dist/esm/cookie.js
|
|
618
696
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
619
697
|
|
|
620
698
|
// ../../../domql/packages/event/dist/esm/keys.js
|
|
@@ -977,10 +1055,7 @@ var rgbToHSL = (r, g, b) => {
|
|
|
977
1055
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
978
1056
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
979
1057
|
};
|
|
980
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
981
|
-
Math.min(k - 3, 9 - k, 1),
|
|
982
|
-
-1
|
|
983
|
-
)) => [f(0), f(8), f(4)];
|
|
1058
|
+
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)];
|
|
984
1059
|
var getColorShade = (col, amt) => {
|
|
985
1060
|
const num = parseInt(col, 16);
|
|
986
1061
|
let r = (num >> 16) + amt;
|
|
@@ -995,7 +1070,8 @@ var getColorShade = (col, amt) => {
|
|
|
995
1070
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
996
1071
|
};
|
|
997
1072
|
var getRgbTone = (rgb, tone) => {
|
|
998
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
1073
|
+
if (isString(rgb) && rgb.includes("rgb"))
|
|
1074
|
+
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
999
1075
|
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
1000
1076
|
if (isNumber(tone)) tone += "";
|
|
1001
1077
|
const toHex = rgbArrayToHex(rgb);
|
|
@@ -1302,8 +1378,7 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
1302
1378
|
};
|
|
1303
1379
|
|
|
1304
1380
|
// src/utils/sprite.js
|
|
1305
|
-
var
|
|
1306
|
-
var isDev = ENV === "development" || ENV === "testing";
|
|
1381
|
+
var isDev = isNotProduction();
|
|
1307
1382
|
var parseRootAttributes = (htmlString) => {
|
|
1308
1383
|
const val = htmlString.default || htmlString;
|
|
1309
1384
|
if (!isString(val)) {
|
|
@@ -1315,7 +1390,9 @@ var parseRootAttributes = (htmlString) => {
|
|
|
1315
1390
|
return {};
|
|
1316
1391
|
}
|
|
1317
1392
|
const attrString = match[1];
|
|
1318
|
-
const attrs = attrString.match(
|
|
1393
|
+
const attrs = attrString.match(
|
|
1394
|
+
/(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|\s*\/?[>"']))+.)["']?/gm
|
|
1395
|
+
);
|
|
1319
1396
|
return attrs.reduce((acc, attr) => {
|
|
1320
1397
|
const [key, value] = attr.split("=");
|
|
1321
1398
|
acc[key] = value.replace(/['"]/g, "");
|
|
@@ -1673,15 +1750,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1673
1750
|
if (!isPropMedia) continue;
|
|
1674
1751
|
const { mediaRegenerate } = FACTORY2;
|
|
1675
1752
|
const mediaName = prop.slice(1);
|
|
1676
|
-
const {
|
|
1677
|
-
type,
|
|
1678
|
-
base,
|
|
1679
|
-
ratio,
|
|
1680
|
-
range,
|
|
1681
|
-
subSequence,
|
|
1682
|
-
h1Matches,
|
|
1683
|
-
unit
|
|
1684
|
-
} = FACTORY2;
|
|
1753
|
+
const { type, base, ratio, range, subSequence, h1Matches, unit } = FACTORY2;
|
|
1685
1754
|
merge(mediaValue, {
|
|
1686
1755
|
type,
|
|
1687
1756
|
base,
|
|
@@ -1711,7 +1780,7 @@ var runThroughMedia = (FACTORY2) => {
|
|
|
1711
1780
|
}
|
|
1712
1781
|
};
|
|
1713
1782
|
var applyHeadings = (props) => {
|
|
1714
|
-
var _a;
|
|
1783
|
+
var _a, _b;
|
|
1715
1784
|
const CONFIG2 = getActiveConfig();
|
|
1716
1785
|
if (props.h1Matches) {
|
|
1717
1786
|
const unit = props.unit;
|
|
@@ -1720,9 +1789,8 @@ var applyHeadings = (props) => {
|
|
|
1720
1789
|
for (const k in HEADINGS) {
|
|
1721
1790
|
const headerName = `h${parseInt(k) + 1}`;
|
|
1722
1791
|
const headerStyle = templates[headerName];
|
|
1723
|
-
if (!HEADINGS[k]) continue;
|
|
1724
1792
|
templates[headerName] = {
|
|
1725
|
-
fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${HEADINGS[k].scaling}${unit}`,
|
|
1793
|
+
fontSize: CONFIG2.useVariable ? `var(${(_a = HEADINGS[k]) == null ? void 0 : _a.variable})` : `${(_b = HEADINGS[k]) == null ? void 0 : _b.scaling}${unit}`,
|
|
1726
1794
|
margin: headerStyle ? headerStyle.margin : 0,
|
|
1727
1795
|
lineHeight: headerStyle ? headerStyle.lineHeight : props.lineHeight,
|
|
1728
1796
|
letterSpacing: headerStyle ? headerStyle.letterSpacing : props.letterSpacing,
|
package/dist/cjs/system/color.js
CHANGED
|
@@ -34,23 +34,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
34
34
|
var require_cjs = __commonJS({
|
|
35
35
|
"../utils/dist/cjs/index.js"(exports, module2) {
|
|
36
36
|
"use strict";
|
|
37
|
-
var
|
|
37
|
+
var __defProp3 = Object.defineProperty;
|
|
38
38
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
39
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
-
var
|
|
40
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
41
41
|
var __export2 = (target, all) => {
|
|
42
42
|
for (var name in all)
|
|
43
|
-
|
|
43
|
+
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
44
44
|
};
|
|
45
45
|
var __copyProps2 = (to, from, except, desc) => {
|
|
46
46
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
47
|
for (let key of __getOwnPropNames2(from))
|
|
48
|
-
if (!
|
|
49
|
-
|
|
48
|
+
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
49
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
50
|
}
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
|
-
var __toCommonJS2 = (mod) => __copyProps2(
|
|
53
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
54
|
var index_exports = {};
|
|
55
55
|
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
@@ -66,6 +66,8 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
loadJavascriptFile: () => loadJavascriptFile,
|
|
67
67
|
loadJavascriptFileEmbedSync: () => loadJavascriptFileEmbedSync,
|
|
68
68
|
loadJavascriptFileSync: () => loadJavascriptFileSync,
|
|
69
|
+
loadRemoteCSS: () => loadRemoteCSS,
|
|
70
|
+
loadRemoteScript: () => loadRemoteScript,
|
|
69
71
|
removeChars: () => removeChars,
|
|
70
72
|
toCamelCase: () => toCamelCase,
|
|
71
73
|
toDashCase: () => toDashCase2,
|
|
@@ -273,10 +275,12 @@ var require_cjs = __commonJS({
|
|
|
273
275
|
});
|
|
274
276
|
});
|
|
275
277
|
scriptEle.addEventListener("error", (ev) => {
|
|
276
|
-
reject(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
reject(
|
|
279
|
+
new Error({
|
|
280
|
+
status: false,
|
|
281
|
+
message: `Failed to load the script ${FILE_URL}`
|
|
282
|
+
})
|
|
283
|
+
);
|
|
280
284
|
});
|
|
281
285
|
doc.body.appendChild(scriptEle);
|
|
282
286
|
} catch (error) {
|
|
@@ -347,6 +351,59 @@ var require_cjs = __commonJS({
|
|
|
347
351
|
console.warn(error);
|
|
348
352
|
}
|
|
349
353
|
};
|
|
354
|
+
function loadRemoteScript(url, options = {}) {
|
|
355
|
+
const { window: window4 = globalThis } = options;
|
|
356
|
+
const { document: document4 = window4.document } = options;
|
|
357
|
+
return new Promise((resolve, reject) => {
|
|
358
|
+
const existingScript = document4.querySelector(`script[src="${url}"]`);
|
|
359
|
+
if (existingScript) {
|
|
360
|
+
return resolve(existingScript);
|
|
361
|
+
}
|
|
362
|
+
const script = document4.createElement("script");
|
|
363
|
+
script.src = url;
|
|
364
|
+
script.async = options.async === true;
|
|
365
|
+
script.type = options.type || "text/javascript";
|
|
366
|
+
if (options.id) script.id = options.id;
|
|
367
|
+
if (options.integrity) script.integrity = options.integrity;
|
|
368
|
+
if (options.crossOrigin) script.crossOrigin = options.crossOrigin;
|
|
369
|
+
script.onload = () => {
|
|
370
|
+
script.onerror = script.onload = null;
|
|
371
|
+
resolve(script);
|
|
372
|
+
};
|
|
373
|
+
script.onerror = () => {
|
|
374
|
+
script.onerror = script.onload = null;
|
|
375
|
+
reject(new Error(`Failed to load script: ${url}`));
|
|
376
|
+
};
|
|
377
|
+
document4.head.appendChild(script);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
async function loadRemoteCSS(url, options = {}) {
|
|
381
|
+
const { window: window4 = globalThis } = options;
|
|
382
|
+
const { document: document4 = window4.document } = options;
|
|
383
|
+
return new Promise((resolve, reject) => {
|
|
384
|
+
const existingLink = document4.querySelector(`link[href="${url}"]`);
|
|
385
|
+
if (existingLink) {
|
|
386
|
+
return resolve(existingLink);
|
|
387
|
+
}
|
|
388
|
+
const link = document4.createElement("link");
|
|
389
|
+
link.href = url;
|
|
390
|
+
link.rel = options.rel || "stylesheet";
|
|
391
|
+
link.type = "text/css";
|
|
392
|
+
link.media = options.media || "all";
|
|
393
|
+
if (options.id) link.id = options.id;
|
|
394
|
+
if (options.integrity) link.integrity = options.integrity;
|
|
395
|
+
if (options.crossOrigin) link.crossOrigin = options.crossOrigin;
|
|
396
|
+
link.onload = () => {
|
|
397
|
+
link.onerror = link.onload = null;
|
|
398
|
+
resolve(link);
|
|
399
|
+
};
|
|
400
|
+
link.onerror = () => {
|
|
401
|
+
link.onerror = link.onload = null;
|
|
402
|
+
reject(new Error(`Failed to load stylesheet: ${url}`));
|
|
403
|
+
};
|
|
404
|
+
document4.head.appendChild(link);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
350
407
|
var isPhoto = (format) => ["jpeg", "gif", "jpg", "png", "tiff", "woff"].includes(format);
|
|
351
408
|
var copyStringToClipboard = async (str) => {
|
|
352
409
|
try {
|
|
@@ -373,12 +430,9 @@ var require_cjs = __commonJS({
|
|
|
373
430
|
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
374
431
|
}).replaceAll(/\s+/g, "");
|
|
375
432
|
};
|
|
376
|
-
var toTitleCase = (str) => str && str.replace(
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
380
|
-
}
|
|
381
|
-
);
|
|
433
|
+
var toTitleCase = (str) => str && str.replace(/\w\S*/g, (txt) => {
|
|
434
|
+
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
|
435
|
+
});
|
|
382
436
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
383
437
|
var toDescriptionCase = (str = "") => {
|
|
384
438
|
if (typeof str !== "string") return;
|
|
@@ -404,16 +458,16 @@ __export(color_exports, {
|
|
|
404
458
|
});
|
|
405
459
|
module.exports = __toCommonJS(color_exports);
|
|
406
460
|
|
|
407
|
-
// ../../../domql/packages/utils/globals.js
|
|
461
|
+
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
408
462
|
var window2 = globalThis;
|
|
409
463
|
var document2 = window2.document;
|
|
410
464
|
|
|
411
|
-
// ../../../domql/packages/utils/node.js
|
|
465
|
+
// ../../../domql/packages/utils/dist/esm/node.js
|
|
412
466
|
var isDOMNode = (obj) => {
|
|
413
467
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
414
468
|
};
|
|
415
469
|
|
|
416
|
-
// ../../../domql/packages/utils/types.js
|
|
470
|
+
// ../../../domql/packages/utils/dist/esm/types.js
|
|
417
471
|
var isObject = (arg) => {
|
|
418
472
|
if (arg === null) return false;
|
|
419
473
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -431,7 +485,7 @@ var isUndefined = (arg) => {
|
|
|
431
485
|
return arg === void 0;
|
|
432
486
|
};
|
|
433
487
|
|
|
434
|
-
// ../../../domql/packages/utils/array.js
|
|
488
|
+
// ../../../domql/packages/utils/dist/esm/array.js
|
|
435
489
|
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
436
490
|
return arr.reduce(
|
|
437
491
|
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
@@ -439,7 +493,7 @@ var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
|
439
493
|
);
|
|
440
494
|
};
|
|
441
495
|
|
|
442
|
-
// ../../../domql/packages/utils/keys.js
|
|
496
|
+
// ../../../domql/packages/utils/dist/esm/keys.js
|
|
443
497
|
var STATE_METHODS = [
|
|
444
498
|
"update",
|
|
445
499
|
"parse",
|
|
@@ -510,11 +564,30 @@ var METHODS_EXL = [
|
|
|
510
564
|
...PROPS_METHODS
|
|
511
565
|
];
|
|
512
566
|
|
|
513
|
-
// ../../../domql/packages/utils/object.js
|
|
567
|
+
// ../../../domql/packages/utils/dist/esm/object.js
|
|
568
|
+
var __defProp2 = Object.defineProperty;
|
|
569
|
+
var __defProps = Object.defineProperties;
|
|
570
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
571
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
572
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
573
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
574
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
575
|
+
var __spreadValues = (a, b) => {
|
|
576
|
+
for (var prop in b || (b = {}))
|
|
577
|
+
if (__hasOwnProp2.call(b, prop))
|
|
578
|
+
__defNormalProp(a, prop, b[prop]);
|
|
579
|
+
if (__getOwnPropSymbols)
|
|
580
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
581
|
+
if (__propIsEnum.call(b, prop))
|
|
582
|
+
__defNormalProp(a, prop, b[prop]);
|
|
583
|
+
}
|
|
584
|
+
return a;
|
|
585
|
+
};
|
|
586
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
514
587
|
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
515
588
|
for (const e in extend) {
|
|
516
|
-
const
|
|
517
|
-
if (!
|
|
589
|
+
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
590
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
518
591
|
continue;
|
|
519
592
|
}
|
|
520
593
|
const elementProp = element[e];
|
|
@@ -536,14 +609,15 @@ var deepClone = (obj, options = {}) => {
|
|
|
536
609
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
537
610
|
handleExtends = false
|
|
538
611
|
} = options;
|
|
612
|
+
const contentWindow = targetWindow || window2 || globalThis;
|
|
539
613
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
540
614
|
return obj;
|
|
541
615
|
}
|
|
542
616
|
if (visited.has(obj)) {
|
|
543
617
|
return visited.get(obj);
|
|
544
618
|
}
|
|
545
|
-
const
|
|
546
|
-
visited.set(obj,
|
|
619
|
+
const clone2 = contentWindow ? isArray(obj) ? new contentWindow.Array() : new contentWindow.Object() : isArray(obj) ? [] : {};
|
|
620
|
+
visited.set(obj, clone2);
|
|
547
621
|
for (const key in obj) {
|
|
548
622
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
549
623
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
@@ -554,30 +628,34 @@ var deepClone = (obj, options = {}) => {
|
|
|
554
628
|
continue;
|
|
555
629
|
}
|
|
556
630
|
if (isDOMNode(value)) {
|
|
557
|
-
|
|
631
|
+
clone2[key] = value;
|
|
558
632
|
continue;
|
|
559
633
|
}
|
|
560
634
|
if (handleExtends && key === "extends" && isArray(value)) {
|
|
561
|
-
|
|
635
|
+
clone2[key] = unstackArrayOfObjects(value, exclude);
|
|
562
636
|
continue;
|
|
563
637
|
}
|
|
564
|
-
if (isFunction(value) &&
|
|
565
|
-
|
|
638
|
+
if (isFunction(value) && options.window) {
|
|
639
|
+
clone2[key] = contentWindow.eval("(" + value.toString() + ")");
|
|
566
640
|
continue;
|
|
567
641
|
}
|
|
568
642
|
if (isObjectLike(value)) {
|
|
569
|
-
|
|
570
|
-
...options,
|
|
643
|
+
clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
|
|
571
644
|
visited
|
|
572
|
-
});
|
|
645
|
+
}));
|
|
573
646
|
} else {
|
|
574
|
-
|
|
647
|
+
clone2[key] = value;
|
|
575
648
|
}
|
|
576
649
|
}
|
|
577
|
-
return
|
|
650
|
+
return clone2;
|
|
578
651
|
};
|
|
579
652
|
|
|
580
|
-
// ../../../domql/packages/utils/
|
|
653
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
654
|
+
var NODE_ENV = "development";
|
|
655
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
656
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
657
|
+
|
|
658
|
+
// ../../../domql/packages/utils/dist/esm/cookie.js
|
|
581
659
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
582
660
|
|
|
583
661
|
// ../../../domql/packages/event/dist/esm/keys.js
|
|
@@ -929,10 +1007,7 @@ var rgbToHSL = (r, g, b) => {
|
|
|
929
1007
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
930
1008
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
931
1009
|
};
|
|
932
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
933
|
-
Math.min(k - 3, 9 - k, 1),
|
|
934
|
-
-1
|
|
935
|
-
)) => [f(0), f(8), f(4)];
|
|
1010
|
+
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)];
|
|
936
1011
|
var getColorShade = (col, amt) => {
|
|
937
1012
|
const num = parseInt(col, 16);
|
|
938
1013
|
let r = (num >> 16) + amt;
|
|
@@ -947,7 +1022,8 @@ var getColorShade = (col, amt) => {
|
|
|
947
1022
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
948
1023
|
};
|
|
949
1024
|
var getRgbTone = (rgb, tone) => {
|
|
950
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
1025
|
+
if (isString(rgb) && rgb.includes("rgb"))
|
|
1026
|
+
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
951
1027
|
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
952
1028
|
if (isNumber(tone)) tone += "";
|
|
953
1029
|
const toHex = rgbArrayToHex(rgb);
|
|
@@ -967,6 +1043,9 @@ var getRgbTone = (rgb, tone) => {
|
|
|
967
1043
|
// src/utils/sequence.js
|
|
968
1044
|
var import_utils5 = __toESM(require_cjs(), 1);
|
|
969
1045
|
|
|
1046
|
+
// src/utils/sprite.js
|
|
1047
|
+
var isDev = isNotProduction();
|
|
1048
|
+
|
|
970
1049
|
// src/system/color.js
|
|
971
1050
|
var getColor = (value, key, config) => {
|
|
972
1051
|
const CONFIG2 = config || getActiveConfig();
|