@symbo.ls/scratch 3.1.1 → 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 +40 -20
- package/dist/cjs/index.js +131 -72
- package/dist/cjs/set.js +127 -58
- package/dist/cjs/system/color.js +121 -41
- package/dist/cjs/system/document.js +120 -38
- package/dist/cjs/system/font.js +118 -36
- package/dist/cjs/system/index.js +128 -63
- package/dist/cjs/system/reset.js +120 -38
- package/dist/cjs/system/shadow.js +121 -41
- package/dist/cjs/system/spacing.js +120 -38
- package/dist/cjs/system/svg.js +119 -39
- package/dist/cjs/system/theme.js +121 -41
- package/dist/cjs/system/timing.js +118 -36
- package/dist/cjs/system/typography.js +124 -55
- package/dist/cjs/transforms/index.js +123 -43
- package/dist/cjs/utils/color.js +16 -18
- package/dist/cjs/utils/index.js +125 -53
- package/dist/cjs/utils/sequence.js +110 -36
- package/dist/cjs/utils/sprite.js +49 -23
- package/dist/cjs/utils/var.js +110 -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
|
@@ -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;
|
|
@@ -413,16 +467,16 @@ __export(transforms_exports, {
|
|
|
413
467
|
});
|
|
414
468
|
module.exports = __toCommonJS(transforms_exports);
|
|
415
469
|
|
|
416
|
-
// ../../../domql/packages/utils/globals.js
|
|
470
|
+
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
417
471
|
var window2 = globalThis;
|
|
418
472
|
var document2 = window2.document;
|
|
419
473
|
|
|
420
|
-
// ../../../domql/packages/utils/node.js
|
|
474
|
+
// ../../../domql/packages/utils/dist/esm/node.js
|
|
421
475
|
var isDOMNode = (obj) => {
|
|
422
476
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
423
477
|
};
|
|
424
478
|
|
|
425
|
-
// ../../../domql/packages/utils/types.js
|
|
479
|
+
// ../../../domql/packages/utils/dist/esm/types.js
|
|
426
480
|
var isObject = (arg) => {
|
|
427
481
|
if (arg === null) return false;
|
|
428
482
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -440,7 +494,7 @@ var isUndefined = (arg) => {
|
|
|
440
494
|
return arg === void 0;
|
|
441
495
|
};
|
|
442
496
|
|
|
443
|
-
// ../../../domql/packages/utils/array.js
|
|
497
|
+
// ../../../domql/packages/utils/dist/esm/array.js
|
|
444
498
|
var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
445
499
|
return arr.reduce(
|
|
446
500
|
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
@@ -448,7 +502,7 @@ var unstackArrayOfObjects = (arr, exclude = []) => {
|
|
|
448
502
|
);
|
|
449
503
|
};
|
|
450
504
|
|
|
451
|
-
// ../../../domql/packages/utils/keys.js
|
|
505
|
+
// ../../../domql/packages/utils/dist/esm/keys.js
|
|
452
506
|
var STATE_METHODS = [
|
|
453
507
|
"update",
|
|
454
508
|
"parse",
|
|
@@ -519,11 +573,30 @@ var METHODS_EXL = [
|
|
|
519
573
|
...PROPS_METHODS
|
|
520
574
|
];
|
|
521
575
|
|
|
522
|
-
// ../../../domql/packages/utils/object.js
|
|
576
|
+
// ../../../domql/packages/utils/dist/esm/object.js
|
|
577
|
+
var __defProp2 = Object.defineProperty;
|
|
578
|
+
var __defProps = Object.defineProperties;
|
|
579
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
580
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
581
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
582
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
583
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
584
|
+
var __spreadValues = (a, b) => {
|
|
585
|
+
for (var prop in b || (b = {}))
|
|
586
|
+
if (__hasOwnProp2.call(b, prop))
|
|
587
|
+
__defNormalProp(a, prop, b[prop]);
|
|
588
|
+
if (__getOwnPropSymbols)
|
|
589
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
590
|
+
if (__propIsEnum.call(b, prop))
|
|
591
|
+
__defNormalProp(a, prop, b[prop]);
|
|
592
|
+
}
|
|
593
|
+
return a;
|
|
594
|
+
};
|
|
595
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
523
596
|
var merge = (element, obj, excludeFrom = []) => {
|
|
524
597
|
for (const e in obj) {
|
|
525
|
-
const
|
|
526
|
-
if (!
|
|
598
|
+
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
|
|
599
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
527
600
|
continue;
|
|
528
601
|
}
|
|
529
602
|
const elementProp = element[e];
|
|
@@ -536,8 +609,8 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
536
609
|
};
|
|
537
610
|
var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
538
611
|
for (const e in extend) {
|
|
539
|
-
const
|
|
540
|
-
if (!
|
|
612
|
+
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
613
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) {
|
|
541
614
|
continue;
|
|
542
615
|
}
|
|
543
616
|
const elementProp = element[e];
|
|
@@ -559,14 +632,15 @@ var deepClone = (obj, options = {}) => {
|
|
|
559
632
|
visited = /* @__PURE__ */ new WeakMap(),
|
|
560
633
|
handleExtends = false
|
|
561
634
|
} = options;
|
|
635
|
+
const contentWindow = targetWindow || window2 || globalThis;
|
|
562
636
|
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
563
637
|
return obj;
|
|
564
638
|
}
|
|
565
639
|
if (visited.has(obj)) {
|
|
566
640
|
return visited.get(obj);
|
|
567
641
|
}
|
|
568
|
-
const
|
|
569
|
-
visited.set(obj,
|
|
642
|
+
const clone2 = contentWindow ? isArray(obj) ? new contentWindow.Array() : new contentWindow.Object() : isArray(obj) ? [] : {};
|
|
643
|
+
visited.set(obj, clone2);
|
|
570
644
|
for (const key in obj) {
|
|
571
645
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
572
646
|
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
|
|
@@ -577,30 +651,34 @@ var deepClone = (obj, options = {}) => {
|
|
|
577
651
|
continue;
|
|
578
652
|
}
|
|
579
653
|
if (isDOMNode(value)) {
|
|
580
|
-
|
|
654
|
+
clone2[key] = value;
|
|
581
655
|
continue;
|
|
582
656
|
}
|
|
583
657
|
if (handleExtends && key === "extends" && isArray(value)) {
|
|
584
|
-
|
|
658
|
+
clone2[key] = unstackArrayOfObjects(value, exclude);
|
|
585
659
|
continue;
|
|
586
660
|
}
|
|
587
|
-
if (isFunction(value) &&
|
|
588
|
-
|
|
661
|
+
if (isFunction(value) && options.window) {
|
|
662
|
+
clone2[key] = contentWindow.eval("(" + value.toString() + ")");
|
|
589
663
|
continue;
|
|
590
664
|
}
|
|
591
665
|
if (isObjectLike(value)) {
|
|
592
|
-
|
|
593
|
-
...options,
|
|
666
|
+
clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
|
|
594
667
|
visited
|
|
595
|
-
});
|
|
668
|
+
}));
|
|
596
669
|
} else {
|
|
597
|
-
|
|
670
|
+
clone2[key] = value;
|
|
598
671
|
}
|
|
599
672
|
}
|
|
600
|
-
return
|
|
673
|
+
return clone2;
|
|
601
674
|
};
|
|
602
675
|
|
|
603
|
-
// ../../../domql/packages/utils/
|
|
676
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
677
|
+
var NODE_ENV = "development";
|
|
678
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
679
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
680
|
+
|
|
681
|
+
// ../../../domql/packages/utils/dist/esm/cookie.js
|
|
604
682
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
605
683
|
|
|
606
684
|
// ../../../domql/packages/event/dist/esm/keys.js
|
|
@@ -957,10 +1035,7 @@ var rgbToHSL = (r, g, b) => {
|
|
|
957
1035
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
958
1036
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
959
1037
|
};
|
|
960
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
961
|
-
Math.min(k - 3, 9 - k, 1),
|
|
962
|
-
-1
|
|
963
|
-
)) => [f(0), f(8), f(4)];
|
|
1038
|
+
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)];
|
|
964
1039
|
var getColorShade = (col, amt) => {
|
|
965
1040
|
const num = parseInt(col, 16);
|
|
966
1041
|
let r = (num >> 16) + amt;
|
|
@@ -975,7 +1050,8 @@ var getColorShade = (col, amt) => {
|
|
|
975
1050
|
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
976
1051
|
};
|
|
977
1052
|
var getRgbTone = (rgb, tone) => {
|
|
978
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
1053
|
+
if (isString(rgb) && rgb.includes("rgb"))
|
|
1054
|
+
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
979
1055
|
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
980
1056
|
if (isNumber(tone)) tone += "";
|
|
981
1057
|
const toHex = rgbArrayToHex(rgb);
|
|
@@ -1224,6 +1300,9 @@ var applySequenceVars = (FACTORY2, options = {}) => {
|
|
|
1224
1300
|
}
|
|
1225
1301
|
};
|
|
1226
1302
|
|
|
1303
|
+
// src/utils/sprite.js
|
|
1304
|
+
var isDev = isNotProduction();
|
|
1305
|
+
|
|
1227
1306
|
// src/system/color.js
|
|
1228
1307
|
var getColor = (value, key, config) => {
|
|
1229
1308
|
const CONFIG2 = config || getActiveConfig();
|
|
@@ -1531,3 +1610,4 @@ var transformBorderRadius = (radius, props, propertyName) => {
|
|
|
1531
1610
|
borderRadius: radius.split(" ").map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(" ")
|
|
1532
1611
|
};
|
|
1533
1612
|
};
|
|
1613
|
+
// @preserve-env
|
package/dist/cjs/utils/color.js
CHANGED
|
@@ -38,15 +38,15 @@ __export(color_exports, {
|
|
|
38
38
|
});
|
|
39
39
|
module.exports = __toCommonJS(color_exports);
|
|
40
40
|
|
|
41
|
-
// ../../../domql/packages/utils/globals.js
|
|
41
|
+
// ../../../domql/packages/utils/dist/esm/globals.js
|
|
42
42
|
var window2 = globalThis;
|
|
43
43
|
var document2 = window2.document;
|
|
44
44
|
|
|
45
|
-
// ../../../domql/packages/utils/types.js
|
|
45
|
+
// ../../../domql/packages/utils/dist/esm/types.js
|
|
46
46
|
var isString = (arg) => typeof arg === "string";
|
|
47
47
|
var isNumber = (arg) => typeof arg === "number";
|
|
48
48
|
|
|
49
|
-
// ../../../domql/packages/utils/keys.js
|
|
49
|
+
// ../../../domql/packages/utils/dist/esm/keys.js
|
|
50
50
|
var STATE_METHODS = [
|
|
51
51
|
"update",
|
|
52
52
|
"parse",
|
|
@@ -117,7 +117,12 @@ var METHODS_EXL = [
|
|
|
117
117
|
...PROPS_METHODS
|
|
118
118
|
];
|
|
119
119
|
|
|
120
|
-
// ../../../domql/packages/utils/
|
|
120
|
+
// ../../../domql/packages/utils/dist/esm/env.js
|
|
121
|
+
var NODE_ENV = "development";
|
|
122
|
+
var isProduction = (env = NODE_ENV) => env === "production";
|
|
123
|
+
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
124
|
+
|
|
125
|
+
// ../../../domql/packages/utils/dist/esm/cookie.js
|
|
121
126
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
122
127
|
|
|
123
128
|
// ../../../domql/packages/event/dist/esm/keys.js
|
|
@@ -196,7 +201,6 @@ var window3 = globalThis;
|
|
|
196
201
|
var document3 = window3.document;
|
|
197
202
|
|
|
198
203
|
// src/utils/color.js
|
|
199
|
-
var ENV = "development";
|
|
200
204
|
var colorStringToRgbaArray = (color) => {
|
|
201
205
|
if (color === "") return [0, 0, 0, 0];
|
|
202
206
|
if (color.toLowerCase() === "transparent") return [0, 0, 0, 0];
|
|
@@ -267,10 +271,7 @@ var mixTwoRgb = (colorA, colorB, range = 0.5) => {
|
|
|
267
271
|
};
|
|
268
272
|
var changeLightness = (delta, hsl) => {
|
|
269
273
|
const [hue, saturation, lightness] = hsl;
|
|
270
|
-
const newLightness = Math.max(
|
|
271
|
-
0,
|
|
272
|
-
Math.min(100, lightness + parseFloat(delta))
|
|
273
|
-
);
|
|
274
|
+
const newLightness = Math.max(0, Math.min(100, lightness + parseFloat(delta)));
|
|
274
275
|
return [hue, saturation, newLightness];
|
|
275
276
|
};
|
|
276
277
|
var rgbToHSL = (r, g, b) => {
|
|
@@ -280,10 +281,7 @@ var rgbToHSL = (r, g, b) => {
|
|
|
280
281
|
const h = n && (a == r ? (g - b) / n : a == g ? 2 + (b - r) / n : 4 + (r - g) / n);
|
|
281
282
|
return [60 * (h < 0 ? h + 6 : h), f ? n / f : 0, (a + a - n) / 2];
|
|
282
283
|
};
|
|
283
|
-
var hslToRgb = (h, s, l, a = s * Math.min(l, 1 - l), f = (n, k = (n + h / 30) % 12) => l - a * Math.max(
|
|
284
|
-
Math.min(k - 3, 9 - k, 1),
|
|
285
|
-
-1
|
|
286
|
-
)) => [f(0), f(8), f(4)];
|
|
284
|
+
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)];
|
|
287
285
|
var getColorShade = (col, amt) => {
|
|
288
286
|
const num = parseInt(col, 16);
|
|
289
287
|
let r = (num >> 16) + amt;
|
|
@@ -301,23 +299,22 @@ var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
|
301
299
|
const arr = [];
|
|
302
300
|
for (let i = 0; i < 4; i++) {
|
|
303
301
|
const round = i === 3 ? (x) => x : Math.round;
|
|
304
|
-
arr[i] = round(
|
|
305
|
-
colorA[i] + (colorB[i] - colorA[i]) * range
|
|
306
|
-
);
|
|
302
|
+
arr[i] = round(colorA[i] + (colorB[i] - colorA[i]) * range);
|
|
307
303
|
}
|
|
308
304
|
return `rgba(${arr})`;
|
|
309
305
|
};
|
|
310
306
|
var opacify = (color, opacity) => {
|
|
311
307
|
const arr = colorStringToRgbaArray(color);
|
|
312
308
|
if (!arr) {
|
|
313
|
-
if (
|
|
309
|
+
if (isNotProduction()) console.warn(color + " color is not rgba");
|
|
314
310
|
return;
|
|
315
311
|
}
|
|
316
312
|
arr[3] = opacity;
|
|
317
313
|
return `rgba(${arr})`;
|
|
318
314
|
};
|
|
319
315
|
var getRgbTone = (rgb, tone) => {
|
|
320
|
-
if (isString(rgb) && rgb.includes("rgb"))
|
|
316
|
+
if (isString(rgb) && rgb.includes("rgb"))
|
|
317
|
+
rgb = colorStringToRgbaArray(rgb).join(", ");
|
|
321
318
|
if (isString(rgb)) rgb = rgb.split(",").map((v) => parseFloat(v.trim()));
|
|
322
319
|
if (isNumber(tone)) tone += "";
|
|
323
320
|
const toHex = rgbArrayToHex(rgb);
|
|
@@ -333,3 +330,4 @@ var getRgbTone = (rgb, tone) => {
|
|
|
333
330
|
return newRgb;
|
|
334
331
|
}
|
|
335
332
|
};
|
|
333
|
+
// @preserve-env
|