@symbo.ls/scratch 2.11.55 → 2.11.94
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 +127 -9
- package/dist/cjs/index.js +227 -99
- package/dist/cjs/set.js +208 -82
- package/dist/cjs/system/color.js +177 -51
- package/dist/cjs/system/document.js +145 -26
- package/dist/cjs/system/font.js +143 -24
- package/dist/cjs/system/index.js +213 -87
- package/dist/cjs/system/reset.js +158 -39
- package/dist/cjs/system/spacing.js +147 -28
- package/dist/cjs/system/svg.js +147 -28
- package/dist/cjs/system/theme.js +184 -58
- package/dist/cjs/system/timing.js +143 -24
- package/dist/cjs/system/typography.js +147 -28
- package/dist/cjs/transforms/index.js +186 -60
- package/dist/cjs/utils/color.js +1044 -2
- package/dist/cjs/utils/index.js +171 -33
- package/dist/cjs/utils/sequence.js +131 -13
- package/dist/cjs/utils/sprite.js +127 -9
- package/dist/cjs/utils/var.js +127 -9
- package/package.json +2 -2
- package/src/system/color.js +5 -19
- package/src/utils/color.js +21 -2
package/dist/cjs/set.js
CHANGED
|
@@ -282,13 +282,13 @@ var require_cjs3 = __commonJS({
|
|
|
282
282
|
document: () => document4,
|
|
283
283
|
global: () => global,
|
|
284
284
|
self: () => self,
|
|
285
|
-
window: () =>
|
|
285
|
+
window: () => window2
|
|
286
286
|
});
|
|
287
287
|
module2.exports = __toCommonJS2(globals_exports);
|
|
288
288
|
var global = globalThis;
|
|
289
289
|
var self = globalThis;
|
|
290
|
-
var
|
|
291
|
-
var document4 =
|
|
290
|
+
var window2 = globalThis;
|
|
291
|
+
var document4 = window2.document;
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
294
|
|
|
@@ -360,10 +360,10 @@ var require_types = __commonJS({
|
|
|
360
360
|
isFunction: () => isFunction2,
|
|
361
361
|
isNot: () => isNot,
|
|
362
362
|
isNull: () => isNull,
|
|
363
|
-
isNumber: () =>
|
|
363
|
+
isNumber: () => isNumber2,
|
|
364
364
|
isObject: () => isObject7,
|
|
365
365
|
isObjectLike: () => isObjectLike3,
|
|
366
|
-
isString: () =>
|
|
366
|
+
isString: () => isString8,
|
|
367
367
|
isUndefined: () => isUndefined,
|
|
368
368
|
isValidHtmlTag: () => isValidHtmlTag
|
|
369
369
|
});
|
|
@@ -376,8 +376,8 @@ var require_types = __commonJS({
|
|
|
376
376
|
return false;
|
|
377
377
|
return typeof arg === "object" && arg.constructor === Object;
|
|
378
378
|
};
|
|
379
|
-
var
|
|
380
|
-
var
|
|
379
|
+
var isString8 = (arg) => typeof arg === "string";
|
|
380
|
+
var isNumber2 = (arg) => typeof arg === "number";
|
|
381
381
|
var isFunction2 = (arg) => typeof arg === "function";
|
|
382
382
|
var isBoolean = (arg) => arg === true || arg === false;
|
|
383
383
|
var isNull = (arg) => arg === null;
|
|
@@ -388,7 +388,7 @@ var require_types = __commonJS({
|
|
|
388
388
|
return typeof arg === "object";
|
|
389
389
|
};
|
|
390
390
|
var isDefined2 = (arg) => {
|
|
391
|
-
return isObject7(arg) || isObjectLike3(arg) ||
|
|
391
|
+
return isObject7(arg) || isObjectLike3(arg) || isString8(arg) || isNumber2(arg) || isFunction2(arg) || isArray6(arg) || isObjectLike3(arg) || isBoolean(arg) || isNull(arg);
|
|
392
392
|
};
|
|
393
393
|
var isUndefined = (arg) => {
|
|
394
394
|
return arg === void 0;
|
|
@@ -397,8 +397,8 @@ var require_types = __commonJS({
|
|
|
397
397
|
boolean: isBoolean,
|
|
398
398
|
array: isArray6,
|
|
399
399
|
object: isObject7,
|
|
400
|
-
string:
|
|
401
|
-
number:
|
|
400
|
+
string: isString8,
|
|
401
|
+
number: isNumber2,
|
|
402
402
|
null: isNull,
|
|
403
403
|
function: isFunction2,
|
|
404
404
|
objectLike: isObjectLike3,
|
|
@@ -443,6 +443,9 @@ var require_array = __commonJS({
|
|
|
443
443
|
var array_exports = {};
|
|
444
444
|
__export2(array_exports, {
|
|
445
445
|
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
446
|
+
createNestedObject: () => createNestedObject,
|
|
447
|
+
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
448
|
+
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
446
449
|
joinArrays: () => joinArrays,
|
|
447
450
|
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
448
451
|
mergeArray: () => mergeArray,
|
|
@@ -482,6 +485,73 @@ var require_array = __commonJS({
|
|
|
482
485
|
var mergeAndCloneIfArray = (obj) => {
|
|
483
486
|
return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
|
|
484
487
|
};
|
|
488
|
+
var cutArrayBeforeValue = (arr, value) => {
|
|
489
|
+
const index = arr.indexOf(value);
|
|
490
|
+
if (index !== -1) {
|
|
491
|
+
return arr.slice(0, index);
|
|
492
|
+
}
|
|
493
|
+
return arr;
|
|
494
|
+
};
|
|
495
|
+
var cutArrayAfterValue = (arr, value) => {
|
|
496
|
+
const index = arr.indexOf(value);
|
|
497
|
+
if (index !== -1) {
|
|
498
|
+
return arr.slice(index + 1);
|
|
499
|
+
}
|
|
500
|
+
return arr;
|
|
501
|
+
};
|
|
502
|
+
var createNestedObject = (arr, lastValue) => {
|
|
503
|
+
let nestedObject = {};
|
|
504
|
+
if (arr.length === 0) {
|
|
505
|
+
return lastValue;
|
|
506
|
+
}
|
|
507
|
+
arr.reduce((obj, value, index) => {
|
|
508
|
+
if (!obj[value]) {
|
|
509
|
+
obj[value] = {};
|
|
510
|
+
}
|
|
511
|
+
if (index === arr.length - 1 && lastValue) {
|
|
512
|
+
obj[value] = lastValue;
|
|
513
|
+
}
|
|
514
|
+
return obj[value];
|
|
515
|
+
}, nestedObject);
|
|
516
|
+
return nestedObject;
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// ../../node_modules/@domql/utils/dist/cjs/string.js
|
|
522
|
+
var require_string = __commonJS({
|
|
523
|
+
"../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
|
|
524
|
+
"use strict";
|
|
525
|
+
var __defProp2 = Object.defineProperty;
|
|
526
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
527
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
528
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
529
|
+
var __export2 = (target, all) => {
|
|
530
|
+
for (var name in all)
|
|
531
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
532
|
+
};
|
|
533
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
534
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
535
|
+
for (let key of __getOwnPropNames2(from))
|
|
536
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
537
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
538
|
+
}
|
|
539
|
+
return to;
|
|
540
|
+
};
|
|
541
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
542
|
+
var string_exports = {};
|
|
543
|
+
__export2(string_exports, {
|
|
544
|
+
stringIncludesAny: () => stringIncludesAny
|
|
545
|
+
});
|
|
546
|
+
module2.exports = __toCommonJS2(string_exports);
|
|
547
|
+
var stringIncludesAny = (str, characters) => {
|
|
548
|
+
for (const char of characters) {
|
|
549
|
+
if (str.includes(char)) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return false;
|
|
554
|
+
};
|
|
485
555
|
}
|
|
486
556
|
});
|
|
487
557
|
|
|
@@ -525,15 +595,18 @@ var require_object = __commonJS({
|
|
|
525
595
|
merge: () => merge5,
|
|
526
596
|
mergeArrayExclude: () => mergeArrayExclude,
|
|
527
597
|
mergeIfExisted: () => mergeIfExisted,
|
|
598
|
+
objectToString: () => objectToString,
|
|
528
599
|
overwrite: () => overwrite,
|
|
529
600
|
overwriteDeep: () => overwriteDeep2,
|
|
530
601
|
overwriteShallow: () => overwriteShallow,
|
|
531
|
-
removeFromObject: () => removeFromObject
|
|
602
|
+
removeFromObject: () => removeFromObject,
|
|
603
|
+
stringToObject: () => stringToObject
|
|
532
604
|
});
|
|
533
605
|
module2.exports = __toCommonJS2(object_exports);
|
|
534
606
|
var import_globals3 = require_cjs3();
|
|
535
607
|
var import_types = require_types();
|
|
536
608
|
var import_array = require_array();
|
|
609
|
+
var import_string = require_string();
|
|
537
610
|
var exec = (param, element, state, context) => {
|
|
538
611
|
if ((0, import_types.isFunction)(param)) {
|
|
539
612
|
return param(
|
|
@@ -551,7 +624,7 @@ var require_object = __commonJS({
|
|
|
551
624
|
};
|
|
552
625
|
var merge5 = (element, obj, excludeFrom = []) => {
|
|
553
626
|
for (const e in obj) {
|
|
554
|
-
if (excludeFrom.includes(e) || e.
|
|
627
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
555
628
|
continue;
|
|
556
629
|
const elementProp = element[e];
|
|
557
630
|
const objProp = obj[e];
|
|
@@ -563,7 +636,7 @@ var require_object = __commonJS({
|
|
|
563
636
|
};
|
|
564
637
|
var deepMerge3 = (element, extend, excludeFrom = []) => {
|
|
565
638
|
for (const e in extend) {
|
|
566
|
-
if (excludeFrom.includes(e) || e.
|
|
639
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
567
640
|
continue;
|
|
568
641
|
const elementProp = element[e];
|
|
569
642
|
const extendProp = extend[e];
|
|
@@ -578,7 +651,7 @@ var require_object = __commonJS({
|
|
|
578
651
|
var clone = (obj, excludeFrom = []) => {
|
|
579
652
|
const o = {};
|
|
580
653
|
for (const prop in obj) {
|
|
581
|
-
if (excludeFrom.includes(prop) || prop.
|
|
654
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
582
655
|
continue;
|
|
583
656
|
o[prop] = obj[prop];
|
|
584
657
|
}
|
|
@@ -590,7 +663,7 @@ var require_object = __commonJS({
|
|
|
590
663
|
}
|
|
591
664
|
const o = {};
|
|
592
665
|
for (const k in obj) {
|
|
593
|
-
if (excludeFrom.includes(k) || k.
|
|
666
|
+
if (excludeFrom.includes(k) || k.startsWith("__"))
|
|
594
667
|
continue;
|
|
595
668
|
let v = obj[k];
|
|
596
669
|
if (k === "extend" && (0, import_types.isArray)(v)) {
|
|
@@ -611,7 +684,7 @@ var require_object = __commonJS({
|
|
|
611
684
|
var deepClone2 = (obj, excludeFrom = []) => {
|
|
612
685
|
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
613
686
|
for (const prop in obj) {
|
|
614
|
-
if (excludeFrom.includes(prop) || prop.
|
|
687
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
615
688
|
continue;
|
|
616
689
|
let objProp = obj[prop];
|
|
617
690
|
if (prop === "extend" && (0, import_types.isArray)(objProp)) {
|
|
@@ -650,6 +723,40 @@ var require_object = __commonJS({
|
|
|
650
723
|
}
|
|
651
724
|
return stringified;
|
|
652
725
|
};
|
|
726
|
+
var objectToString = (obj, indent = 0) => {
|
|
727
|
+
const spaces = " ".repeat(indent);
|
|
728
|
+
let str = "{\n";
|
|
729
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
730
|
+
const keyAllowdChars = (0, import_string.stringIncludesAny)(key, ["-", ":", "@", ".", "!"]);
|
|
731
|
+
const stringedKey = keyAllowdChars ? `'${key}'` : key;
|
|
732
|
+
str += `${spaces} ${stringedKey}: `;
|
|
733
|
+
if ((0, import_types.isArray)(value)) {
|
|
734
|
+
str += "[\n";
|
|
735
|
+
for (const element of value) {
|
|
736
|
+
if ((0, import_types.isObject)(element) && element !== null) {
|
|
737
|
+
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
738
|
+
`;
|
|
739
|
+
} else if ((0, import_types.isString)(element)) {
|
|
740
|
+
str += `${spaces} '${element}',
|
|
741
|
+
`;
|
|
742
|
+
} else {
|
|
743
|
+
str += `${spaces} ${element},
|
|
744
|
+
`;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
str += `${spaces} ]`;
|
|
748
|
+
} else if ((0, import_types.isObject)(value)) {
|
|
749
|
+
str += objectToString(value, indent + 1);
|
|
750
|
+
} else if ((0, import_types.isString)(value)) {
|
|
751
|
+
str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
|
|
752
|
+
} else {
|
|
753
|
+
str += value;
|
|
754
|
+
}
|
|
755
|
+
str += ",\n";
|
|
756
|
+
}
|
|
757
|
+
str += `${spaces}}`;
|
|
758
|
+
return str;
|
|
759
|
+
};
|
|
653
760
|
var detachFunctionsFromObject = (obj, detached = {}) => {
|
|
654
761
|
for (const prop in obj) {
|
|
655
762
|
const objProp = obj[prop];
|
|
@@ -720,6 +827,16 @@ var require_object = __commonJS({
|
|
|
720
827
|
}
|
|
721
828
|
return stringified;
|
|
722
829
|
};
|
|
830
|
+
var stringToObject = (str) => {
|
|
831
|
+
let obj;
|
|
832
|
+
try {
|
|
833
|
+
obj = import_globals3.window.eval("(" + str + ")");
|
|
834
|
+
} catch (e) {
|
|
835
|
+
console.warn(e);
|
|
836
|
+
}
|
|
837
|
+
if (obj)
|
|
838
|
+
return obj;
|
|
839
|
+
};
|
|
723
840
|
var diffObjects = (original, objToDiff, cache) => {
|
|
724
841
|
for (const e in objToDiff) {
|
|
725
842
|
if (e === "ref")
|
|
@@ -765,7 +882,7 @@ var require_object = __commonJS({
|
|
|
765
882
|
const { ref } = element;
|
|
766
883
|
const changes = {};
|
|
767
884
|
for (const e in params) {
|
|
768
|
-
if (excludeFrom.includes(e) || e.
|
|
885
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
769
886
|
continue;
|
|
770
887
|
const elementProp = element[e];
|
|
771
888
|
const paramsProp = params[e];
|
|
@@ -778,7 +895,7 @@ var require_object = __commonJS({
|
|
|
778
895
|
};
|
|
779
896
|
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
780
897
|
for (const e in params) {
|
|
781
|
-
if (excludeFrom.includes(e) || e.
|
|
898
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
782
899
|
continue;
|
|
783
900
|
obj[e] = params[e];
|
|
784
901
|
}
|
|
@@ -786,7 +903,7 @@ var require_object = __commonJS({
|
|
|
786
903
|
};
|
|
787
904
|
var overwriteDeep2 = (obj, params, excludeFrom = []) => {
|
|
788
905
|
for (const e in params) {
|
|
789
|
-
if (excludeFrom.includes(e) || e.
|
|
906
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
790
907
|
continue;
|
|
791
908
|
const objProp = obj[e];
|
|
792
909
|
const paramsProp = params[e];
|
|
@@ -967,6 +1084,7 @@ var require_cjs4 = __commonJS({
|
|
|
967
1084
|
__reExport(utils_exports, require_array(), module2.exports);
|
|
968
1085
|
__reExport(utils_exports, require_node(), module2.exports);
|
|
969
1086
|
__reExport(utils_exports, require_log(), module2.exports);
|
|
1087
|
+
__reExport(utils_exports, require_string(), module2.exports);
|
|
970
1088
|
}
|
|
971
1089
|
});
|
|
972
1090
|
|
|
@@ -1207,10 +1325,11 @@ var setActiveConfig = (newConfig) => {
|
|
|
1207
1325
|
};
|
|
1208
1326
|
|
|
1209
1327
|
// src/system/color.js
|
|
1210
|
-
var
|
|
1328
|
+
var import_utils9 = __toESM(require_cjs4(), 1);
|
|
1211
1329
|
|
|
1212
1330
|
// src/utils/color.js
|
|
1213
1331
|
var import_globals = __toESM(require_cjs3(), 1);
|
|
1332
|
+
var import_utils2 = __toESM(require_cjs4(), 1);
|
|
1214
1333
|
var colorStringToRgbaArray = (color) => {
|
|
1215
1334
|
if (color === "")
|
|
1216
1335
|
return;
|
|
@@ -1283,7 +1402,25 @@ var getColorShade = (col, amt) => {
|
|
|
1283
1402
|
g = 255;
|
|
1284
1403
|
else if (g < 0)
|
|
1285
1404
|
g = 0;
|
|
1286
|
-
return (g | b << 8 | r << 16).toString(16);
|
|
1405
|
+
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
1406
|
+
};
|
|
1407
|
+
var getRgbTone = (rgb, tone) => {
|
|
1408
|
+
if ((0, import_utils2.isString)(rgb))
|
|
1409
|
+
rgb = rgb.split(", ").map((v) => parseFloat(v));
|
|
1410
|
+
if ((0, import_utils2.isNumber)(tone))
|
|
1411
|
+
tone += "";
|
|
1412
|
+
const toHex = rgbArrayToHex(rgb);
|
|
1413
|
+
const abs = tone.slice(0, 1);
|
|
1414
|
+
if (abs === "-" || abs === "+") {
|
|
1415
|
+
const colorShade = getColorShade(toHex, parseFloat(tone));
|
|
1416
|
+
return hexToRgbArray(colorShade).join(", ");
|
|
1417
|
+
} else {
|
|
1418
|
+
const [r, g, b] = rgb;
|
|
1419
|
+
const hsl = rgbToHSL(r, g, b);
|
|
1420
|
+
const [h, s, l] = hsl;
|
|
1421
|
+
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
1422
|
+
return newRgb;
|
|
1423
|
+
}
|
|
1287
1424
|
};
|
|
1288
1425
|
|
|
1289
1426
|
// src/utils/font.js
|
|
@@ -1313,21 +1450,21 @@ var getFontFaceEach = (name, weights) => {
|
|
|
1313
1450
|
};
|
|
1314
1451
|
|
|
1315
1452
|
// src/utils/sequence.js
|
|
1316
|
-
var
|
|
1453
|
+
var import_utils5 = __toESM(require_cjs4(), 1);
|
|
1317
1454
|
|
|
1318
1455
|
// ../utils/src/index.js
|
|
1319
|
-
var
|
|
1456
|
+
var import_utils4 = __toESM(require_cjs4());
|
|
1320
1457
|
|
|
1321
1458
|
// ../utils/src/scaling.js
|
|
1322
|
-
var
|
|
1459
|
+
var import_utils3 = __toESM(require_cjs4());
|
|
1323
1460
|
|
|
1324
1461
|
// ../utils/src/index.js
|
|
1325
1462
|
var arrayzeValue = (val) => {
|
|
1326
|
-
if ((0,
|
|
1463
|
+
if ((0, import_utils4.isString)(val))
|
|
1327
1464
|
return val.split(" ");
|
|
1328
|
-
if ((0,
|
|
1465
|
+
if ((0, import_utils4.isObject)(val))
|
|
1329
1466
|
return Object.keys(val).map((v) => val[v]);
|
|
1330
|
-
if ((0,
|
|
1467
|
+
if ((0, import_utils4.isArray)(val))
|
|
1331
1468
|
return val;
|
|
1332
1469
|
};
|
|
1333
1470
|
|
|
@@ -1440,7 +1577,7 @@ var findHeadings = (propertyNames) => {
|
|
|
1440
1577
|
};
|
|
1441
1578
|
|
|
1442
1579
|
// src/utils/var.js
|
|
1443
|
-
var
|
|
1580
|
+
var import_utils7 = __toESM(require_cjs4(), 1);
|
|
1444
1581
|
var applySequenceVars = (props, mediaName, options = {}) => {
|
|
1445
1582
|
const CONFIG2 = getActiveConfig();
|
|
1446
1583
|
const { UNIT: UNIT2, MEDIA: MEDIA2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
@@ -1472,9 +1609,9 @@ var applySequenceVars = (props, mediaName, options = {}) => {
|
|
|
1472
1609
|
};
|
|
1473
1610
|
|
|
1474
1611
|
// src/utils/sprite.js
|
|
1475
|
-
var
|
|
1612
|
+
var import_utils8 = __toESM(require_cjs4(), 1);
|
|
1476
1613
|
var parseRootAttributes = (htmlString) => {
|
|
1477
|
-
if (!(0,
|
|
1614
|
+
if (!(0, import_utils8.isString)(htmlString)) {
|
|
1478
1615
|
return console.warn(`parseRootAttributes: ${htmlString} is not a string`);
|
|
1479
1616
|
}
|
|
1480
1617
|
const match = htmlString.match(/<svg\s+(.*?)>/);
|
|
@@ -1494,7 +1631,7 @@ var replaceIdsAndUrls = (code, key) => {
|
|
|
1494
1631
|
const urlRegex = /url\(#([^)]*)\)/g;
|
|
1495
1632
|
const matches = code.match(/id="([^"]*)"/g);
|
|
1496
1633
|
let replacedCode = code;
|
|
1497
|
-
if ((0,
|
|
1634
|
+
if ((0, import_utils8.isArray)(matches)) {
|
|
1498
1635
|
matches.forEach(() => {
|
|
1499
1636
|
const randomKey = Math.floor(Math.random() * 1e5);
|
|
1500
1637
|
replacedCode = code.replace(idRegex, `id="${key}-${randomKey}"`).replace(urlRegex, `url(#${key}-${randomKey})`);
|
|
@@ -1521,7 +1658,7 @@ var convertSvgToSymbol = (key, code) => {
|
|
|
1521
1658
|
// src/system/color.js
|
|
1522
1659
|
var getColor = (value, key, config) => {
|
|
1523
1660
|
const CONFIG2 = config || getActiveConfig();
|
|
1524
|
-
if (!(0,
|
|
1661
|
+
if (!(0, import_utils9.isString)(value)) {
|
|
1525
1662
|
if (CONFIG2.verbose)
|
|
1526
1663
|
console.warn(value, "- type for color is not valid");
|
|
1527
1664
|
return;
|
|
@@ -1530,7 +1667,7 @@ var getColor = (value, key, config) => {
|
|
|
1530
1667
|
return `var(${value})`;
|
|
1531
1668
|
if (key && value[key])
|
|
1532
1669
|
value = value[key];
|
|
1533
|
-
const [name, alpha, tone] = (0,
|
|
1670
|
+
const [name, alpha, tone] = (0, import_utils9.isArray)(value) ? value : value.split(" ");
|
|
1534
1671
|
const { COLOR: COLOR2, GRADIENT: GRADIENT2 } = CONFIG2;
|
|
1535
1672
|
let val = COLOR2[name] || GRADIENT2[name];
|
|
1536
1673
|
if (!val) {
|
|
@@ -1545,22 +1682,11 @@ var getColor = (value, key, config) => {
|
|
|
1545
1682
|
console.warn(value, " - does not have ", key);
|
|
1546
1683
|
}
|
|
1547
1684
|
let rgb = val.rgb;
|
|
1548
|
-
if (!rgb)
|
|
1685
|
+
if (!rgb) {
|
|
1549
1686
|
return CONFIG2.useVariable ? `var(${val.var})` : val.value;
|
|
1687
|
+
}
|
|
1550
1688
|
if (tone && !val[tone]) {
|
|
1551
|
-
|
|
1552
|
-
const abs = tone.slice(0, 1);
|
|
1553
|
-
if (abs === "-" || abs === "+") {
|
|
1554
|
-
rgb = hexToRgbArray(
|
|
1555
|
-
getColorShade(toHex, parseFloat(tone))
|
|
1556
|
-
).join(", ");
|
|
1557
|
-
} else {
|
|
1558
|
-
const [r, g, b] = [...rgb.split(", ").map((v) => parseInt(v))];
|
|
1559
|
-
const hsl = rgbToHSL(r, g, b);
|
|
1560
|
-
const [h, s, l] = hsl;
|
|
1561
|
-
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
1562
|
-
rgb = newRgb;
|
|
1563
|
-
}
|
|
1689
|
+
rgb = getRgbTone(rgb, tone);
|
|
1564
1690
|
val[tone] = { rgb, var: `${val.var}-${tone}` };
|
|
1565
1691
|
}
|
|
1566
1692
|
if (val[tone])
|
|
@@ -1571,15 +1697,15 @@ var getColor = (value, key, config) => {
|
|
|
1571
1697
|
};
|
|
1572
1698
|
var setColor = (val, key, suffix) => {
|
|
1573
1699
|
const CONFIG2 = getActiveConfig();
|
|
1574
|
-
if ((0,
|
|
1700
|
+
if ((0, import_utils9.isString)(val) && val.slice(0, 2) === "--")
|
|
1575
1701
|
val = getColor(val.slice(2));
|
|
1576
|
-
if ((0,
|
|
1702
|
+
if ((0, import_utils9.isArray)(val)) {
|
|
1577
1703
|
return {
|
|
1578
1704
|
"@light": setColor(val[0], key, "light"),
|
|
1579
1705
|
"@dark": setColor(val[1], key, "dark")
|
|
1580
1706
|
};
|
|
1581
1707
|
}
|
|
1582
|
-
if ((0,
|
|
1708
|
+
if ((0, import_utils9.isObject)(val)) {
|
|
1583
1709
|
const obj = {};
|
|
1584
1710
|
for (const variant in val)
|
|
1585
1711
|
obj[variant] = setColor(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
@@ -1602,15 +1728,15 @@ var setColor = (val, key, suffix) => {
|
|
|
1602
1728
|
};
|
|
1603
1729
|
var setGradient = (val, key, suffix) => {
|
|
1604
1730
|
const CONFIG2 = getActiveConfig();
|
|
1605
|
-
if ((0,
|
|
1731
|
+
if ((0, import_utils9.isString)(val) && val.slice(0, 2) === "--")
|
|
1606
1732
|
val = getColor(val.slice(2));
|
|
1607
|
-
if ((0,
|
|
1733
|
+
if ((0, import_utils9.isArray)(val)) {
|
|
1608
1734
|
return {
|
|
1609
1735
|
"@light": setGradient(val[0], key, "light"),
|
|
1610
1736
|
"@dark": setGradient(val[0], key, "dark")
|
|
1611
1737
|
};
|
|
1612
1738
|
}
|
|
1613
|
-
if ((0,
|
|
1739
|
+
if ((0, import_utils9.isObject)(val)) {
|
|
1614
1740
|
const obj = {};
|
|
1615
1741
|
for (const variant in val)
|
|
1616
1742
|
obj[variant] = setGradient(val[variant], key, variant.slice(0, 1) === "@" ? variant.slice(1) : variant);
|
|
@@ -1627,7 +1753,7 @@ var setGradient = (val, key, suffix) => {
|
|
|
1627
1753
|
};
|
|
1628
1754
|
|
|
1629
1755
|
// src/system/theme.js
|
|
1630
|
-
var
|
|
1756
|
+
var import_utils11 = __toESM(require_cjs4(), 1);
|
|
1631
1757
|
var setThemeValue = (theme) => {
|
|
1632
1758
|
const value = {};
|
|
1633
1759
|
const { state, media, helpers, ...rest } = theme;
|
|
@@ -1650,7 +1776,7 @@ var getTheme = (value, modifier) => {
|
|
|
1650
1776
|
if (CONFIG2.useVariable)
|
|
1651
1777
|
return getMediaTheme(value, modifier);
|
|
1652
1778
|
const { THEME: THEME2 } = CONFIG2;
|
|
1653
|
-
if ((0,
|
|
1779
|
+
if ((0, import_utils11.isString)(value)) {
|
|
1654
1780
|
const [theme, subtheme] = value.split(" ");
|
|
1655
1781
|
const isOurTheme = THEME2[theme];
|
|
1656
1782
|
if (isOurTheme) {
|
|
@@ -1659,7 +1785,7 @@ var getTheme = (value, modifier) => {
|
|
|
1659
1785
|
value = [theme, subtheme || modifier];
|
|
1660
1786
|
}
|
|
1661
1787
|
}
|
|
1662
|
-
if ((0,
|
|
1788
|
+
if ((0, import_utils11.isObjectLike)(value) && value[1]) {
|
|
1663
1789
|
const themeName = value[0];
|
|
1664
1790
|
const subThemeName = value[1];
|
|
1665
1791
|
const { helpers, media, state } = THEME2[themeName];
|
|
@@ -1669,11 +1795,11 @@ var getTheme = (value, modifier) => {
|
|
|
1669
1795
|
return getThemeValue(helpers[subThemeName]);
|
|
1670
1796
|
if (state && state[subThemeName])
|
|
1671
1797
|
return getThemeValue(state[subThemeName]);
|
|
1672
|
-
} else if ((0,
|
|
1798
|
+
} else if ((0, import_utils11.isObject)(value))
|
|
1673
1799
|
return setThemeValue(value);
|
|
1674
1800
|
};
|
|
1675
1801
|
var setInverseTheme = (theme, variant, value) => {
|
|
1676
|
-
if ((0,
|
|
1802
|
+
if ((0, import_utils11.isObject)(variant)) {
|
|
1677
1803
|
theme.variants.inverse.value = setThemeValue(variant);
|
|
1678
1804
|
} else if (variant === true) {
|
|
1679
1805
|
const { color, background } = value;
|
|
@@ -1688,7 +1814,7 @@ var setInverseTheme = (theme, variant, value) => {
|
|
|
1688
1814
|
var setPseudo = (theme, key, variant, themeValue) => {
|
|
1689
1815
|
const result = getTheme(variant);
|
|
1690
1816
|
themeValue[`&:${key}`] = result;
|
|
1691
|
-
if ((0,
|
|
1817
|
+
if ((0, import_utils11.isObject)(variant) && !variant.value)
|
|
1692
1818
|
variant.value = result;
|
|
1693
1819
|
};
|
|
1694
1820
|
var setSelectors = (theme, value) => {
|
|
@@ -1706,7 +1832,7 @@ var setSelectors = (theme, value) => {
|
|
|
1706
1832
|
var setPrefersScheme = (theme, key, variant, themeValue) => {
|
|
1707
1833
|
const result = getTheme(variant);
|
|
1708
1834
|
themeValue[`@media (prefers-color-scheme: ${key})`] = result;
|
|
1709
|
-
if ((0,
|
|
1835
|
+
if ((0, import_utils11.isObject)(variant) && !variant.value)
|
|
1710
1836
|
variant.value = result;
|
|
1711
1837
|
};
|
|
1712
1838
|
var setMedia = (theme, value) => {
|
|
@@ -1732,7 +1858,7 @@ var setHelpers = (theme, value) => {
|
|
|
1732
1858
|
const keys = Object.keys(helpers);
|
|
1733
1859
|
keys.map((key) => {
|
|
1734
1860
|
const helper = helpers[key];
|
|
1735
|
-
if ((0,
|
|
1861
|
+
if ((0, import_utils11.isString)(helper))
|
|
1736
1862
|
helpers[key] = CONFIG2.THEME[helper];
|
|
1737
1863
|
else
|
|
1738
1864
|
getThemeValue(helpers[key]);
|
|
@@ -1756,7 +1882,7 @@ var setMediaTheme = (val, key, suffix, prefers) => {
|
|
|
1756
1882
|
const CONFIG2 = getActiveConfig();
|
|
1757
1883
|
const { CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
1758
1884
|
const theme = { value: val };
|
|
1759
|
-
if ((0,
|
|
1885
|
+
if ((0, import_utils11.isObjectLike)(val)) {
|
|
1760
1886
|
for (const param in val) {
|
|
1761
1887
|
const symb = param.slice(0, 1);
|
|
1762
1888
|
const value = val[param];
|
|
@@ -1784,7 +1910,7 @@ var setMediaTheme = (val, key, suffix, prefers) => {
|
|
|
1784
1910
|
};
|
|
1785
1911
|
}
|
|
1786
1912
|
}
|
|
1787
|
-
if ((0,
|
|
1913
|
+
if ((0, import_utils11.isString)(val) && val.slice(0, 2) === "--") {
|
|
1788
1914
|
const { THEME: THEME2 } = CONFIG2;
|
|
1789
1915
|
const value = THEME2[val.slice(2)];
|
|
1790
1916
|
const getReferenced = getMediaTheme(value, prefers);
|
|
@@ -1797,7 +1923,7 @@ var recursiveTheme = (val) => {
|
|
|
1797
1923
|
const obj = {};
|
|
1798
1924
|
for (const param in val) {
|
|
1799
1925
|
const symb = param.slice(0, 1);
|
|
1800
|
-
if ((0,
|
|
1926
|
+
if ((0, import_utils11.isObjectLike)(val[param])) {
|
|
1801
1927
|
if (symb === "@") {
|
|
1802
1928
|
const query = CONFIG2.MEDIA[param.slice(1)];
|
|
1803
1929
|
const media = `@media screen and ${query}`;
|
|
@@ -1817,23 +1943,23 @@ var findModifierFromArray = (val, modifierArray) => {
|
|
|
1817
1943
|
return val;
|
|
1818
1944
|
};
|
|
1819
1945
|
var findModifier = (val, modifier) => {
|
|
1820
|
-
if ((0,
|
|
1946
|
+
if ((0, import_utils11.isArray)(modifier))
|
|
1821
1947
|
return findModifierFromArray(val, modifier);
|
|
1822
|
-
else if ((0,
|
|
1948
|
+
else if ((0, import_utils11.isString)(modifier) && val[modifier])
|
|
1823
1949
|
return val[modifier];
|
|
1824
1950
|
else
|
|
1825
1951
|
return val;
|
|
1826
1952
|
};
|
|
1827
1953
|
var getMediaTheme = (val, mod) => {
|
|
1828
1954
|
const CONFIG2 = getActiveConfig();
|
|
1829
|
-
if ((0,
|
|
1955
|
+
if ((0, import_utils11.isString)(val) && val.slice(0, 2) === "--")
|
|
1830
1956
|
val = getMediaTheme(val.slice(2));
|
|
1831
|
-
if (!val || !(0,
|
|
1957
|
+
if (!val || !(0, import_utils11.isString)(val)) {
|
|
1832
1958
|
if (CONFIG2.verbose)
|
|
1833
1959
|
console.warn(val, "- theme is not string");
|
|
1834
1960
|
return;
|
|
1835
1961
|
}
|
|
1836
|
-
const [name, ...modifier] = (0,
|
|
1962
|
+
const [name, ...modifier] = (0, import_utils11.isArray)(val) ? val : val.split(" ");
|
|
1837
1963
|
let value = CONFIG2.THEME[name];
|
|
1838
1964
|
if (value && (modifier || mod)) {
|
|
1839
1965
|
value = findModifier(value, modifier.length ? modifier : mod);
|
|
@@ -1843,7 +1969,7 @@ var getMediaTheme = (val, mod) => {
|
|
|
1843
1969
|
};
|
|
1844
1970
|
|
|
1845
1971
|
// src/system/font.js
|
|
1846
|
-
var
|
|
1972
|
+
var import_utils12 = __toESM(require_cjs4(), 1);
|
|
1847
1973
|
var setFont = (val, key) => {
|
|
1848
1974
|
const CSSvar = `--font-${key}`;
|
|
1849
1975
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
@@ -1855,7 +1981,7 @@ var setFontFamily = (val, key) => {
|
|
|
1855
1981
|
let { value, type } = val;
|
|
1856
1982
|
if (val.isDefault)
|
|
1857
1983
|
FONT_FAMILY2.default = key;
|
|
1858
|
-
if ((0,
|
|
1984
|
+
if ((0, import_utils12.isObject)(value))
|
|
1859
1985
|
value = arrayzeValue(value);
|
|
1860
1986
|
const CSSvar = `--font-family-${key}`;
|
|
1861
1987
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
@@ -1863,7 +1989,7 @@ var setFontFamily = (val, key) => {
|
|
|
1863
1989
|
};
|
|
1864
1990
|
|
|
1865
1991
|
// src/system/typography.js
|
|
1866
|
-
var
|
|
1992
|
+
var import_utils15 = __toESM(require_cjs4(), 1);
|
|
1867
1993
|
var runThroughMedia = (props) => {
|
|
1868
1994
|
const CONFIG2 = getActiveConfig();
|
|
1869
1995
|
const { TYPOGRAPHY: TYPOGRAPHY2, MEDIA: MEDIA2 } = CONFIG2;
|
|
@@ -1871,7 +1997,7 @@ var runThroughMedia = (props) => {
|
|
|
1871
1997
|
const mediaProps = props[prop];
|
|
1872
1998
|
if (prop.slice(0, 1) === "@") {
|
|
1873
1999
|
const { type, base, ratio, range, subSequence, h1Matches, unit } = props;
|
|
1874
|
-
(0,
|
|
2000
|
+
(0, import_utils15.merge)(mediaProps, {
|
|
1875
2001
|
type,
|
|
1876
2002
|
base,
|
|
1877
2003
|
ratio,
|
|
@@ -1923,13 +2049,13 @@ var applyTypographySequence = () => {
|
|
|
1923
2049
|
};
|
|
1924
2050
|
|
|
1925
2051
|
// src/system/spacing.js
|
|
1926
|
-
var
|
|
2052
|
+
var import_utils18 = __toESM(require_cjs4(), 1);
|
|
1927
2053
|
var runThroughMedia2 = (sequenceProps) => {
|
|
1928
2054
|
for (const prop in sequenceProps) {
|
|
1929
2055
|
const mediaProps = sequenceProps[prop];
|
|
1930
2056
|
if (prop.slice(0, 1) === "@") {
|
|
1931
2057
|
const { type, base, ratio, range, subSequence, h1Matches, unit } = sequenceProps;
|
|
1932
|
-
(0,
|
|
2058
|
+
(0, import_utils18.merge)(mediaProps, {
|
|
1933
2059
|
type,
|
|
1934
2060
|
base,
|
|
1935
2061
|
ratio,
|
|
@@ -1965,11 +2091,11 @@ var applyTimingSequence = () => {
|
|
|
1965
2091
|
};
|
|
1966
2092
|
|
|
1967
2093
|
// src/system/document.js
|
|
1968
|
-
var
|
|
2094
|
+
var import_utils22 = __toESM(require_cjs4(), 1);
|
|
1969
2095
|
var applyDocument = () => {
|
|
1970
2096
|
const CONFIG2 = getActiveConfig();
|
|
1971
2097
|
const { DOCUMENT: DOCUMENT2, FONT_FAMILY: FONT_FAMILY2, THEME: THEME2, TYPOGRAPHY: TYPOGRAPHY2 } = CONFIG2;
|
|
1972
|
-
return (0,
|
|
2098
|
+
return (0, import_utils22.merge)(DOCUMENT2, {
|
|
1973
2099
|
theme: THEME2.document,
|
|
1974
2100
|
fontFamily: getDefaultOrFirstKey(FONT_FAMILY2),
|
|
1975
2101
|
fontSize: TYPOGRAPHY2.base,
|
|
@@ -2000,7 +2126,7 @@ var setIcon = (val, key) => {
|
|
|
2000
2126
|
};
|
|
2001
2127
|
|
|
2002
2128
|
// src/system/reset.js
|
|
2003
|
-
var
|
|
2129
|
+
var import_utils25 = __toESM(require_cjs4(), 1);
|
|
2004
2130
|
var applyReset = (reset = {}) => {
|
|
2005
2131
|
const CONFIG2 = getActiveConfig();
|
|
2006
2132
|
const { RESET: RESET2, TYPOGRAPHY: TYPOGRAPHY2, DOCUMENT: DOCUMENT2 } = CONFIG2;
|
|
@@ -2022,8 +2148,8 @@ var applyReset = (reset = {}) => {
|
|
|
2022
2148
|
const { body, ...templates } = TYPOGRAPHY2.templates;
|
|
2023
2149
|
const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
|
|
2024
2150
|
if (RESET2.html)
|
|
2025
|
-
(0,
|
|
2026
|
-
return (0,
|
|
2151
|
+
(0, import_utils25.overwriteDeep)(RESET2.html, globalTheme);
|
|
2152
|
+
return (0, import_utils25.deepMerge)((0, import_utils25.merge)(RESET2, reset), {
|
|
2027
2153
|
html: {
|
|
2028
2154
|
position: "absolute",
|
|
2029
2155
|
// overflow: 'hidden',
|
|
@@ -2062,9 +2188,9 @@ var applyReset = (reset = {}) => {
|
|
|
2062
2188
|
};
|
|
2063
2189
|
|
|
2064
2190
|
// src/set.js
|
|
2065
|
-
var
|
|
2191
|
+
var import_utils26 = __toESM(require_cjs4(), 1);
|
|
2066
2192
|
var setCases = (val, key) => {
|
|
2067
|
-
if ((0,
|
|
2193
|
+
if ((0, import_utils26.isFunction)(val))
|
|
2068
2194
|
return val();
|
|
2069
2195
|
return val;
|
|
2070
2196
|
};
|