@symbo.ls/scratch 2.11.523 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory.js +13 -20
- package/dist/cjs/index.js +193 -383
- package/dist/cjs/set.js +132 -282
- package/dist/cjs/system/color.js +61 -142
- package/dist/cjs/system/document.js +28 -84
- package/dist/cjs/system/font.js +29 -88
- package/dist/cjs/system/index.js +135 -285
- package/dist/cjs/system/reset.js +35 -98
- package/dist/cjs/system/shadow.js +77 -173
- package/dist/cjs/system/spacing.js +41 -112
- package/dist/cjs/system/svg.js +34 -94
- package/dist/cjs/system/theme.js +74 -168
- package/dist/cjs/system/timing.js +33 -96
- package/dist/cjs/system/typography.js +41 -110
- package/dist/cjs/transforms/index.js +112 -228
- package/dist/cjs/utils/color.js +22 -85
- package/dist/cjs/utils/font.js +3 -6
- package/dist/cjs/utils/index.js +67 -155
- package/dist/cjs/utils/sequence.js +34 -58
- package/dist/cjs/utils/sprite.js +13 -20
- package/dist/cjs/utils/theme.js +3 -6
- package/dist/cjs/utils/var.js +27 -45
- package/package.json +3 -3
- package/src/system/svg.js +1 -1
- package/src/transforms/index.js +9 -2
- package/src/utils/color.js +1 -2
- package/src/utils/sequence.js +1 -1
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
return [val];
|
|
249
|
+
if (isArray2(val)) return val;
|
|
250
|
+
if (isString2(val)) return val.split(" ");
|
|
251
|
+
if (isObject2(val)) return Object.values(val);
|
|
252
|
+
if (isNumber2(val)) return [val];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -281,35 +272,34 @@ __export(sequence_exports, {
|
|
|
281
272
|
});
|
|
282
273
|
module.exports = __toCommonJS(sequence_exports);
|
|
283
274
|
|
|
284
|
-
//
|
|
275
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
285
276
|
var window2 = globalThis;
|
|
286
277
|
var document2 = window2.document;
|
|
287
278
|
|
|
288
|
-
//
|
|
279
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
289
280
|
var isDOMNode = (obj) => {
|
|
290
281
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
291
282
|
};
|
|
292
283
|
|
|
293
|
-
//
|
|
284
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
294
285
|
var isString = (arg) => typeof arg === "string";
|
|
295
286
|
var isFunction = (arg) => typeof arg === "function";
|
|
296
287
|
var isNull = (arg) => arg === null;
|
|
297
288
|
var isArray = (arg) => Array.isArray(arg);
|
|
298
289
|
var isObjectLike = (arg) => {
|
|
299
|
-
if (arg === null)
|
|
300
|
-
return false;
|
|
290
|
+
if (arg === null) return false;
|
|
301
291
|
return typeof arg === "object";
|
|
302
292
|
};
|
|
303
293
|
var isUndefined = (arg) => {
|
|
304
294
|
return arg === void 0;
|
|
305
295
|
};
|
|
306
296
|
|
|
307
|
-
//
|
|
297
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
308
298
|
var mergeArray = (arr, exclude = []) => {
|
|
309
299
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
310
300
|
};
|
|
311
301
|
|
|
312
|
-
//
|
|
302
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
313
303
|
var __defProp2 = Object.defineProperty;
|
|
314
304
|
var __defProps = Object.defineProperties;
|
|
315
305
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -332,8 +322,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
332
322
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
333
323
|
for (const e in extend) {
|
|
334
324
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
335
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
336
|
-
continue;
|
|
325
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
337
326
|
const elementProp = element[e];
|
|
338
327
|
const extendProp = extend[e];
|
|
339
328
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -362,13 +351,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
362
351
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
363
352
|
visited.set(obj, clone2);
|
|
364
353
|
for (const key in obj) {
|
|
365
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
366
|
-
|
|
367
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
368
|
-
continue;
|
|
354
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
355
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
369
356
|
const value = obj[key];
|
|
370
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
371
|
-
continue;
|
|
357
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
372
358
|
if (isDOMNode(value)) {
|
|
373
359
|
clone2[key] = value;
|
|
374
360
|
continue;
|
|
@@ -392,7 +378,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
392
378
|
return clone2;
|
|
393
379
|
};
|
|
394
380
|
|
|
395
|
-
//
|
|
381
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
396
382
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
397
383
|
|
|
398
384
|
// src/utils/sequence.js
|
|
@@ -670,8 +656,7 @@ var setSequenceValue = (props, sequenceProps) => {
|
|
|
670
656
|
var setScalingVar = (key, sequenceProps) => {
|
|
671
657
|
const { base, type, unit } = sequenceProps;
|
|
672
658
|
const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
|
|
673
|
-
if (key === 0)
|
|
674
|
-
return defaultVal;
|
|
659
|
+
if (key === 0) return defaultVal;
|
|
675
660
|
const prefix = "--" + (type && type.replace(".", "-"));
|
|
676
661
|
const ratioVar = `${prefix}-ratio`;
|
|
677
662
|
if (key > 0) {
|
|
@@ -708,10 +693,8 @@ var generateSubSequence = (props, sequenceProps) => {
|
|
|
708
693
|
const diffRounded = ~~next - ~~value;
|
|
709
694
|
let arr;
|
|
710
695
|
const [first, middle, second] = getSubratioDifference(value, ratio);
|
|
711
|
-
if (diffRounded > 16)
|
|
712
|
-
|
|
713
|
-
else
|
|
714
|
-
arr = [first, second];
|
|
696
|
+
if (diffRounded > 16) arr = [first, middle, second];
|
|
697
|
+
else arr = [first, second];
|
|
715
698
|
arr.forEach((v, k) => {
|
|
716
699
|
const scaling = ~~(v / base * 1e3) / 1e3;
|
|
717
700
|
const newVar = variable + (k + 1);
|
|
@@ -753,14 +736,13 @@ var generateSequence = (sequenceProps) => {
|
|
|
753
736
|
index: key
|
|
754
737
|
};
|
|
755
738
|
setSequenceValue(props, sequenceProps);
|
|
756
|
-
if (subSequence)
|
|
757
|
-
generateSubSequence(props, sequenceProps);
|
|
739
|
+
if (subSequence) generateSubSequence(props, sequenceProps);
|
|
758
740
|
}
|
|
759
741
|
return sequenceProps;
|
|
760
742
|
};
|
|
761
743
|
var generateSequencePosition = (sequenceProps, position = 0) => {
|
|
762
744
|
const { type, base, ratio, subSequence } = sequenceProps;
|
|
763
|
-
const letterKey = isString
|
|
745
|
+
const letterKey = (void 0).call("isString", position) ? position : numToLetterMap[position];
|
|
764
746
|
if (!letterKey) {
|
|
765
747
|
console.warn(`Position ${position} is out of range in numToLetterMap`);
|
|
766
748
|
return null;
|
|
@@ -800,13 +782,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
800
782
|
unit = UNIT2.default,
|
|
801
783
|
useVariable
|
|
802
784
|
} = sequenceProps;
|
|
803
|
-
if (isString(value) && value.slice(0, 2) === "--")
|
|
804
|
-
return `var(${value})`;
|
|
785
|
+
if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
|
|
805
786
|
const prefix = `--${(0, import_utils3.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
|
|
806
787
|
const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
|
|
807
788
|
const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
|
|
808
|
-
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
|
|
809
|
-
return value;
|
|
789
|
+
if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
|
|
810
790
|
const letterVal = value.toUpperCase();
|
|
811
791
|
const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
|
|
812
792
|
let absValue = isNegative ? letterVal.slice(1) : letterVal;
|
|
@@ -830,8 +810,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
830
810
|
return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
|
|
831
811
|
}
|
|
832
812
|
if (!sequence[absValue] && absValue.length === 2) {
|
|
833
|
-
if (CONFIG2.verbose)
|
|
834
|
-
console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
813
|
+
if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
|
|
835
814
|
absValue = absValue.slice(0, 1);
|
|
836
815
|
}
|
|
837
816
|
if (useVariable || CONFIG2.useVariable) {
|
|
@@ -839,8 +818,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
839
818
|
return isNegative ? `calc(${varValue2} * -1)` : varValue2;
|
|
840
819
|
}
|
|
841
820
|
const sequenceItem = sequence ? sequence[absValue] : null;
|
|
842
|
-
if (!sequenceItem)
|
|
843
|
-
return console.warn("can't find", sequence, absValue);
|
|
821
|
+
if (!sequenceItem) return console.warn("can't find", sequence, absValue);
|
|
844
822
|
if (unit === "ms" || unit === "s") {
|
|
845
823
|
return isNegative + sequenceItem.val + unit;
|
|
846
824
|
}
|
|
@@ -849,12 +827,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
|
|
|
849
827
|
var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
|
|
850
828
|
if (typeof value !== "string") {
|
|
851
829
|
const CONFIG2 = getActiveConfig();
|
|
852
|
-
if (CONFIG2.verbose)
|
|
853
|
-
console.warn(propertyName, value, "is not a string");
|
|
830
|
+
if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
|
|
854
831
|
return { [propertyName]: value };
|
|
855
832
|
}
|
|
856
|
-
if (value === "-" || value === "")
|
|
857
|
-
return {};
|
|
833
|
+
if (value === "-" || value === "") return {};
|
|
858
834
|
return { [propertyName]: getSequenceValue(value, sequenceProps) };
|
|
859
835
|
};
|
|
860
836
|
var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];
|
package/dist/cjs/utils/sprite.js
CHANGED
|
@@ -25,35 +25,34 @@ __export(sprite_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(sprite_exports);
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
29
29
|
var window2 = globalThis;
|
|
30
30
|
var document2 = window2.document;
|
|
31
31
|
|
|
32
|
-
//
|
|
32
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
33
33
|
var isDOMNode = (obj) => {
|
|
34
34
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
38
38
|
var isString = (arg) => typeof arg === "string";
|
|
39
39
|
var isFunction = (arg) => typeof arg === "function";
|
|
40
40
|
var isNull = (arg) => arg === null;
|
|
41
41
|
var isArray = (arg) => Array.isArray(arg);
|
|
42
42
|
var isObjectLike = (arg) => {
|
|
43
|
-
if (arg === null)
|
|
44
|
-
return false;
|
|
43
|
+
if (arg === null) return false;
|
|
45
44
|
return typeof arg === "object";
|
|
46
45
|
};
|
|
47
46
|
var isUndefined = (arg) => {
|
|
48
47
|
return arg === void 0;
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
//
|
|
50
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
52
51
|
var mergeArray = (arr, exclude = []) => {
|
|
53
52
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
54
53
|
};
|
|
55
54
|
|
|
56
|
-
//
|
|
55
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
57
56
|
var __defProp2 = Object.defineProperty;
|
|
58
57
|
var __defProps = Object.defineProperties;
|
|
59
58
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -76,8 +75,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
76
75
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
77
76
|
for (const e in extend) {
|
|
78
77
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
79
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
80
|
-
continue;
|
|
78
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
81
79
|
const elementProp = element[e];
|
|
82
80
|
const extendProp = extend[e];
|
|
83
81
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -106,13 +104,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
106
104
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
107
105
|
visited.set(obj, clone2);
|
|
108
106
|
for (const key in obj) {
|
|
109
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
110
|
-
|
|
111
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
112
|
-
continue;
|
|
107
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
108
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
113
109
|
const value = obj[key];
|
|
114
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
115
|
-
continue;
|
|
110
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
116
111
|
if (isDOMNode(value)) {
|
|
117
112
|
clone2[key] = value;
|
|
118
113
|
continue;
|
|
@@ -136,7 +131,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
136
131
|
return clone2;
|
|
137
132
|
};
|
|
138
133
|
|
|
139
|
-
//
|
|
134
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
140
135
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
141
136
|
|
|
142
137
|
// src/defaultConfig/index.js
|
|
@@ -365,10 +360,8 @@ var generateSprite = (icons) => {
|
|
|
365
360
|
const CONFIG2 = getActiveConfig();
|
|
366
361
|
let sprite = "";
|
|
367
362
|
for (const key in icons) {
|
|
368
|
-
if (CONFIG2.__svg_cache[key])
|
|
369
|
-
|
|
370
|
-
else
|
|
371
|
-
CONFIG2.__svg_cache[key] = true;
|
|
363
|
+
if (CONFIG2.__svg_cache[key]) continue;
|
|
364
|
+
else CONFIG2.__svg_cache[key] = true;
|
|
372
365
|
sprite += icons[key];
|
|
373
366
|
}
|
|
374
367
|
return sprite;
|
package/dist/cjs/utils/theme.js
CHANGED
|
@@ -24,11 +24,8 @@ __export(theme_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(theme_exports);
|
|
26
26
|
var returnSubThemeOrDefault = (orig, theme) => {
|
|
27
|
-
if (!orig)
|
|
28
|
-
|
|
29
|
-
if (orig
|
|
30
|
-
return orig.themes[theme];
|
|
31
|
-
if (orig[theme])
|
|
32
|
-
return [orig, orig[theme]];
|
|
27
|
+
if (!orig) return;
|
|
28
|
+
if (orig.themes && orig.themes[theme]) return orig.themes[theme];
|
|
29
|
+
if (orig[theme]) return [orig, orig[theme]];
|
|
33
30
|
return orig;
|
|
34
31
|
};
|
package/dist/cjs/utils/var.js
CHANGED
|
@@ -51,8 +51,8 @@ var require_cjs = __commonJS({
|
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
53
|
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
54
|
-
var
|
|
55
|
-
__export2(
|
|
54
|
+
var index_exports = {};
|
|
55
|
+
__export2(index_exports, {
|
|
56
56
|
arrayzeValue: () => arrayzeValue,
|
|
57
57
|
copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
|
|
58
58
|
copyStringToClipboard: () => copyStringToClipboard,
|
|
@@ -73,12 +73,11 @@ var require_cjs = __commonJS({
|
|
|
73
73
|
toTitleCase: () => toTitleCase,
|
|
74
74
|
toggleFullscreen: () => toggleFullscreen
|
|
75
75
|
});
|
|
76
|
-
module2.exports = __toCommonJS2(
|
|
76
|
+
module2.exports = __toCommonJS2(index_exports);
|
|
77
77
|
var window22 = globalThis;
|
|
78
78
|
var document22 = window22.document;
|
|
79
79
|
var isObject2 = (arg) => {
|
|
80
|
-
if (arg === null)
|
|
81
|
-
return false;
|
|
80
|
+
if (arg === null) return false;
|
|
82
81
|
return typeof arg === "object" && arg.constructor === Object;
|
|
83
82
|
};
|
|
84
83
|
var isString2 = (arg) => typeof arg === "string";
|
|
@@ -103,13 +102,11 @@ var require_cjs = __commonJS({
|
|
|
103
102
|
};
|
|
104
103
|
var findClosestNumberInFactory = (val, factory) => {
|
|
105
104
|
val = parseFloat(val);
|
|
106
|
-
if (isObject2(factory))
|
|
107
|
-
factory = Object.values(factory);
|
|
105
|
+
if (isObject2(factory)) factory = Object.values(factory);
|
|
108
106
|
return findClosestNumber(val, factory);
|
|
109
107
|
};
|
|
110
108
|
var formatDate = (timestamp) => {
|
|
111
|
-
if (!timestamp)
|
|
112
|
-
return "";
|
|
109
|
+
if (!timestamp) return "";
|
|
113
110
|
const d = new Date(timestamp);
|
|
114
111
|
const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
|
|
115
112
|
const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
|
|
@@ -176,8 +173,7 @@ var require_cjs = __commonJS({
|
|
|
176
173
|
scriptEle.type = type;
|
|
177
174
|
scriptEle.text = xhr.responseText;
|
|
178
175
|
doc.body.appendChild(scriptEle);
|
|
179
|
-
if (typeof fallback === "function")
|
|
180
|
-
fallback();
|
|
176
|
+
if (typeof fallback === "function") fallback();
|
|
181
177
|
} else {
|
|
182
178
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
183
179
|
}
|
|
@@ -245,20 +241,15 @@ var require_cjs = __commonJS({
|
|
|
245
241
|
);
|
|
246
242
|
var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
247
243
|
var toDescriptionCase = (str = "") => {
|
|
248
|
-
if (typeof str !== "string")
|
|
249
|
-
return;
|
|
244
|
+
if (typeof str !== "string") return;
|
|
250
245
|
const result = str.replace(/([A-Z])/g, " $1");
|
|
251
246
|
return result.charAt(0).toUpperCase() + result.slice(1);
|
|
252
247
|
};
|
|
253
248
|
var arrayzeValue = (val) => {
|
|
254
|
-
if (isArray2(val))
|
|
255
|
-
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
if (isObject2(val))
|
|
259
|
-
return Object.values(val);
|
|
260
|
-
if (isNumber2(val))
|
|
261
|
-
return [val];
|
|
249
|
+
if (isArray2(val)) return val;
|
|
250
|
+
if (isString2(val)) return val.split(" ");
|
|
251
|
+
if (isObject2(val)) return Object.values(val);
|
|
252
|
+
if (isNumber2(val)) return [val];
|
|
262
253
|
};
|
|
263
254
|
}
|
|
264
255
|
});
|
|
@@ -273,34 +264,33 @@ __export(var_exports, {
|
|
|
273
264
|
});
|
|
274
265
|
module.exports = __toCommonJS(var_exports);
|
|
275
266
|
|
|
276
|
-
//
|
|
267
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
277
268
|
var window2 = globalThis;
|
|
278
269
|
var document2 = window2.document;
|
|
279
270
|
|
|
280
|
-
//
|
|
271
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
281
272
|
var isDOMNode = (obj) => {
|
|
282
273
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
283
274
|
};
|
|
284
275
|
|
|
285
|
-
//
|
|
276
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
286
277
|
var isFunction = (arg) => typeof arg === "function";
|
|
287
278
|
var isNull = (arg) => arg === null;
|
|
288
279
|
var isArray = (arg) => Array.isArray(arg);
|
|
289
280
|
var isObjectLike = (arg) => {
|
|
290
|
-
if (arg === null)
|
|
291
|
-
return false;
|
|
281
|
+
if (arg === null) return false;
|
|
292
282
|
return typeof arg === "object";
|
|
293
283
|
};
|
|
294
284
|
var isUndefined = (arg) => {
|
|
295
285
|
return arg === void 0;
|
|
296
286
|
};
|
|
297
287
|
|
|
298
|
-
//
|
|
288
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
299
289
|
var mergeArray = (arr, exclude = []) => {
|
|
300
290
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
301
291
|
};
|
|
302
292
|
|
|
303
|
-
//
|
|
293
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
304
294
|
var __defProp2 = Object.defineProperty;
|
|
305
295
|
var __defProps = Object.defineProperties;
|
|
306
296
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -323,8 +313,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
323
313
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
324
314
|
for (const e in extend) {
|
|
325
315
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
326
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
327
|
-
continue;
|
|
316
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
328
317
|
const elementProp = element[e];
|
|
329
318
|
const extendProp = extend[e];
|
|
330
319
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -353,13 +342,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
353
342
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
354
343
|
visited.set(obj, clone2);
|
|
355
344
|
for (const key in obj) {
|
|
356
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
357
|
-
|
|
358
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
359
|
-
continue;
|
|
345
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
346
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
360
347
|
const value = obj[key];
|
|
361
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
362
|
-
continue;
|
|
348
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
363
349
|
if (isDOMNode(value)) {
|
|
364
350
|
clone2[key] = value;
|
|
365
351
|
continue;
|
|
@@ -383,7 +369,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
383
369
|
return clone2;
|
|
384
370
|
};
|
|
385
371
|
|
|
386
|
-
//
|
|
372
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
387
373
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
388
374
|
|
|
389
375
|
// src/defaultConfig/index.js
|
|
@@ -684,23 +670,19 @@ var applyMediaSequenceVars = (FACTORY2, media, options = {}) => {
|
|
|
684
670
|
const { mediaRegenerate } = FACTORY2;
|
|
685
671
|
const { sequence, scales } = FACTORY2[media];
|
|
686
672
|
const query = MEDIA2[mediaName];
|
|
687
|
-
if (!query && CONFIG2.verbose)
|
|
688
|
-
console.warn("Can't find media query ", query);
|
|
673
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find media query ", query);
|
|
689
674
|
if (!mediaRegenerate) {
|
|
690
675
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
691
|
-
if (!underMediaQuery)
|
|
692
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
676
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
693
677
|
applySequenceGlobalVars(underMediaQuery, FACTORY2[media], options);
|
|
694
678
|
return;
|
|
695
679
|
}
|
|
696
680
|
for (const key in sequence) {
|
|
697
681
|
const item = sequence[key];
|
|
698
682
|
const value = (isScalingUnit(unit) ? scales[key] : sequence[key].val) + unit;
|
|
699
|
-
if (!query && CONFIG2.verbose)
|
|
700
|
-
console.warn("Can't find query ", query);
|
|
683
|
+
if (!query && CONFIG2.verbose) console.warn("Can't find query ", query);
|
|
701
684
|
let underMediaQuery = CSS_VARS2[`@media ${query}`];
|
|
702
|
-
if (!underMediaQuery)
|
|
703
|
-
underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
685
|
+
if (!underMediaQuery) underMediaQuery = CSS_VARS2[`@media ${query}`] = {};
|
|
704
686
|
underMediaQuery[item.variable] = `var(${item.variable + "_" + mediaName})`;
|
|
705
687
|
CSS_VARS2[item.variable + "_" + mediaName] = value;
|
|
706
688
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@symbo.ls/scratch",
|
|
3
3
|
"description": "Φ / CSS framework and methodology.",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "3.0.1",
|
|
6
6
|
"files": [
|
|
7
7
|
"src",
|
|
8
8
|
"dist"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@domql/globals": "latest",
|
|
29
29
|
"@domql/utils": "^2.5.0",
|
|
30
|
-
"@symbo.ls/utils": "^
|
|
30
|
+
"@symbo.ls/utils": "^3.0.1",
|
|
31
31
|
"color-contrast-checker": "^1.5.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "a4e7f586f7e4f60bd7b6a8388bdacc3ae1879433"
|
|
34
34
|
}
|
package/src/system/svg.js
CHANGED
package/src/transforms/index.js
CHANGED
|
@@ -139,8 +139,15 @@ export const transformSize = (propertyName, val, props = {}, opts = {}) => {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
export const transformSizeRatio = (propertyName, props) => {
|
|
143
|
-
return transformSize(propertyName,
|
|
142
|
+
export const transformSizeRatio = (propertyName, val = null, props) => {
|
|
143
|
+
return transformSize(propertyName, val, props, {
|
|
144
144
|
ratio: true
|
|
145
145
|
})
|
|
146
146
|
}
|
|
147
|
+
|
|
148
|
+
export const transformBorderRadius = (radius, props, propertyName) => {
|
|
149
|
+
if (!isString(radius)) return
|
|
150
|
+
return {
|
|
151
|
+
borderRadius: radius.split(' ').map((v, k) => getSpacingBasedOnRatio(props, propertyName, v)[propertyName]).join(' ')
|
|
152
|
+
}
|
|
153
|
+
}
|
package/src/utils/color.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { document, window } from '@domql/
|
|
4
|
-
import { isString, isNumber } from '@domql/utils'
|
|
3
|
+
import { document, window, isString, isNumber } from '@domql/utils'
|
|
5
4
|
const ENV = process.env.NODE_ENV
|
|
6
5
|
|
|
7
6
|
export const colorStringToRgbaArray = color => {
|
package/src/utils/sequence.js
CHANGED
|
@@ -170,7 +170,7 @@ export const generateSequence = (sequenceProps) => {
|
|
|
170
170
|
|
|
171
171
|
export const generateSequencePosition = (sequenceProps, position = 0) => {
|
|
172
172
|
const { type, base, ratio, subSequence } = sequenceProps
|
|
173
|
-
const letterKey = isString
|
|
173
|
+
const letterKey = this.call("isString", position) ? position : numToLetterMap[position]
|
|
174
174
|
|
|
175
175
|
if (!letterKey) {
|
|
176
176
|
console.warn(`Position ${position} is out of range in numToLetterMap`)
|