@symbo.ls/scratch 2.11.55 → 2.11.92
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 +22 -3
|
@@ -282,13 +282,13 @@ var require_cjs3 = __commonJS({
|
|
|
282
282
|
document: () => document3,
|
|
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 document3 =
|
|
290
|
+
var window2 = globalThis;
|
|
291
|
+
var document3 = window2.document;
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
294
|
|
|
@@ -360,10 +360,10 @@ var require_types = __commonJS({
|
|
|
360
360
|
isFunction: () => isFunction,
|
|
361
361
|
isNot: () => isNot,
|
|
362
362
|
isNull: () => isNull,
|
|
363
|
-
isNumber: () =>
|
|
363
|
+
isNumber: () => isNumber2,
|
|
364
364
|
isObject: () => isObject4,
|
|
365
365
|
isObjectLike: () => isObjectLike2,
|
|
366
|
-
isString: () =>
|
|
366
|
+
isString: () => isString6,
|
|
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 isString6 = (arg) => typeof arg === "string";
|
|
380
|
+
var isNumber2 = (arg) => typeof arg === "number";
|
|
381
381
|
var isFunction = (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 isObject4(arg) || isObjectLike2(arg) ||
|
|
391
|
+
return isObject4(arg) || isObjectLike2(arg) || isString6(arg) || isNumber2(arg) || isFunction(arg) || isArray4(arg) || isObjectLike2(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: isArray4,
|
|
399
399
|
object: isObject4,
|
|
400
|
-
string:
|
|
401
|
-
number:
|
|
400
|
+
string: isString6,
|
|
401
|
+
number: isNumber2,
|
|
402
402
|
null: isNull,
|
|
403
403
|
function: isFunction,
|
|
404
404
|
objectLike: isObjectLike2,
|
|
@@ -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: () => merge2,
|
|
526
596
|
mergeArrayExclude: () => mergeArrayExclude,
|
|
527
597
|
mergeIfExisted: () => mergeIfExisted,
|
|
598
|
+
objectToString: () => objectToString,
|
|
528
599
|
overwrite: () => overwrite,
|
|
529
600
|
overwriteDeep: () => overwriteDeep,
|
|
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_globals2 = 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 merge2 = (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 deepMerge2 = (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_globals2.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 overwriteDeep = (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
|
|
|
@@ -986,7 +1104,7 @@ var import_utils2 = __toESM(require_cjs4());
|
|
|
986
1104
|
var import_utils = __toESM(require_cjs4());
|
|
987
1105
|
|
|
988
1106
|
// ../utils/src/index.js
|
|
989
|
-
var toDashCase = (val) => val.replace(/[
|
|
1107
|
+
var toDashCase = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
990
1108
|
var arrayzeValue = (val) => {
|
|
991
1109
|
if ((0, import_utils2.isString)(val))
|
|
992
1110
|
return val.split(" ");
|
|
@@ -997,7 +1115,7 @@ var arrayzeValue = (val) => {
|
|
|
997
1115
|
};
|
|
998
1116
|
|
|
999
1117
|
// src/system/spacing.js
|
|
1000
|
-
var
|
|
1118
|
+
var import_utils10 = __toESM(require_cjs4(), 1);
|
|
1001
1119
|
|
|
1002
1120
|
// src/factory.js
|
|
1003
1121
|
var import_utils3 = __toESM(require_cjs4(), 1);
|
|
@@ -1220,9 +1338,10 @@ var getActiveConfig = (def) => {
|
|
|
1220
1338
|
|
|
1221
1339
|
// src/utils/color.js
|
|
1222
1340
|
var import_globals = __toESM(require_cjs3(), 1);
|
|
1341
|
+
var import_utils4 = __toESM(require_cjs4(), 1);
|
|
1223
1342
|
|
|
1224
1343
|
// src/utils/sequence.js
|
|
1225
|
-
var
|
|
1344
|
+
var import_utils5 = __toESM(require_cjs4(), 1);
|
|
1226
1345
|
var numToLetterMap = {
|
|
1227
1346
|
"-6": "U",
|
|
1228
1347
|
"-5": "V",
|
|
@@ -1329,7 +1448,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
1329
1448
|
unit = UNIT2.default,
|
|
1330
1449
|
useVariable
|
|
1331
1450
|
} = sequenceProps;
|
|
1332
|
-
if ((0,
|
|
1451
|
+
if ((0, import_utils5.isString)(value) && value.slice(0, 2) === "--")
|
|
1333
1452
|
return `var(${value})`;
|
|
1334
1453
|
const prefix = `--${toDashCase(sequenceProps.type.replace(".", "-"))}-`;
|
|
1335
1454
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
@@ -1384,7 +1503,7 @@ var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
|
1384
1503
|
};
|
|
1385
1504
|
|
|
1386
1505
|
// src/utils/var.js
|
|
1387
|
-
var
|
|
1506
|
+
var import_utils7 = __toESM(require_cjs4(), 1);
|
|
1388
1507
|
var applySequenceVars = (props, mediaName, options = {}) => {
|
|
1389
1508
|
const CONFIG2 = getActiveConfig();
|
|
1390
1509
|
const { UNIT: UNIT2, MEDIA: MEDIA2, TIMING: TIMING2, CSS_VARS: CSS_VARS2 } = CONFIG2;
|
|
@@ -1416,7 +1535,7 @@ var applySequenceVars = (props, mediaName, options = {}) => {
|
|
|
1416
1535
|
};
|
|
1417
1536
|
|
|
1418
1537
|
// src/utils/sprite.js
|
|
1419
|
-
var
|
|
1538
|
+
var import_utils8 = __toESM(require_cjs4(), 1);
|
|
1420
1539
|
|
|
1421
1540
|
// src/system/spacing.js
|
|
1422
1541
|
var runThroughMedia = (sequenceProps) => {
|
|
@@ -1424,7 +1543,7 @@ var runThroughMedia = (sequenceProps) => {
|
|
|
1424
1543
|
const mediaProps = sequenceProps[prop];
|
|
1425
1544
|
if (prop.slice(0, 1) === "@") {
|
|
1426
1545
|
const { type, base, ratio, range, subSequence, h1Matches, unit } = sequenceProps;
|
|
1427
|
-
(0,
|
|
1546
|
+
(0, import_utils10.merge)(mediaProps, {
|
|
1428
1547
|
type,
|
|
1429
1548
|
base,
|
|
1430
1549
|
ratio,
|
|
@@ -1463,7 +1582,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
|
|
|
1463
1582
|
const stack = arrayzeValue(value);
|
|
1464
1583
|
if (!stack)
|
|
1465
1584
|
return;
|
|
1466
|
-
if ((0,
|
|
1585
|
+
if ((0, import_utils10.isString)(value) && value.includes("calc")) {
|
|
1467
1586
|
return { [propertyName]: value };
|
|
1468
1587
|
}
|
|
1469
1588
|
if (stack.length > 1) {
|
|
@@ -1499,7 +1618,7 @@ var getSpacingBasedOnRatio = (props, propertyName, val) => {
|
|
|
1499
1618
|
let sequenceProps = SPACING2[spacingRatio];
|
|
1500
1619
|
if (!sequenceProps) {
|
|
1501
1620
|
const { type, base, range, subSequence } = SPACING2;
|
|
1502
|
-
sequenceProps = SPACING2[spacingRatio] = (0,
|
|
1621
|
+
sequenceProps = SPACING2[spacingRatio] = (0, import_utils10.merge)({
|
|
1503
1622
|
ratio: spacingRatio,
|
|
1504
1623
|
type: type + "-" + spacingRatio,
|
|
1505
1624
|
unit,
|