@symbo.ls/scratch 2.11.522 → 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 +192 -382
- 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 +66 -154
- package/dist/cjs/utils/sequence.js +33 -57
- 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/dist/cjs/system/font.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: () => arrayzeValue2,
|
|
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,60 +241,19 @@ 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 arrayzeValue2 = (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
|
});
|
|
265
256
|
|
|
266
|
-
// ../../node_modules/@domql/globals/dist/cjs/index.js
|
|
267
|
-
var require_cjs2 = __commonJS({
|
|
268
|
-
"../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
|
|
269
|
-
"use strict";
|
|
270
|
-
var __defProp3 = Object.defineProperty;
|
|
271
|
-
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
272
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
273
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
274
|
-
var __export2 = (target, all) => {
|
|
275
|
-
for (var name in all)
|
|
276
|
-
__defProp3(target, name, { get: all[name], enumerable: true });
|
|
277
|
-
};
|
|
278
|
-
var __copyProps2 = (to, from, except, desc) => {
|
|
279
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
280
|
-
for (let key of __getOwnPropNames2(from))
|
|
281
|
-
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
282
|
-
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
283
|
-
}
|
|
284
|
-
return to;
|
|
285
|
-
};
|
|
286
|
-
var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
|
|
287
|
-
var globals_exports = {};
|
|
288
|
-
__export2(globals_exports, {
|
|
289
|
-
document: () => document4,
|
|
290
|
-
global: () => global,
|
|
291
|
-
self: () => self,
|
|
292
|
-
window: () => window4
|
|
293
|
-
});
|
|
294
|
-
module2.exports = __toCommonJS2(globals_exports);
|
|
295
|
-
var global = globalThis;
|
|
296
|
-
var self = globalThis;
|
|
297
|
-
var window4 = globalThis;
|
|
298
|
-
var document4 = window4.document;
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
|
|
302
257
|
// src/system/font.js
|
|
303
258
|
var font_exports = {};
|
|
304
259
|
__export(font_exports, {
|
|
@@ -308,39 +263,37 @@ __export(font_exports, {
|
|
|
308
263
|
});
|
|
309
264
|
module.exports = __toCommonJS(font_exports);
|
|
310
265
|
|
|
311
|
-
//
|
|
266
|
+
// node_modules/@domql/utils/dist/esm/globals.js
|
|
312
267
|
var window2 = globalThis;
|
|
313
268
|
var document2 = window2.document;
|
|
314
269
|
|
|
315
|
-
//
|
|
270
|
+
// node_modules/@domql/utils/dist/esm/node.js
|
|
316
271
|
var isDOMNode = (obj) => {
|
|
317
272
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
318
273
|
};
|
|
319
274
|
|
|
320
|
-
//
|
|
275
|
+
// node_modules/@domql/utils/dist/esm/types.js
|
|
321
276
|
var isObject = (arg) => {
|
|
322
|
-
if (arg === null)
|
|
323
|
-
return false;
|
|
277
|
+
if (arg === null) return false;
|
|
324
278
|
return typeof arg === "object" && arg.constructor === Object;
|
|
325
279
|
};
|
|
326
280
|
var isFunction = (arg) => typeof arg === "function";
|
|
327
281
|
var isNull = (arg) => arg === null;
|
|
328
282
|
var isArray = (arg) => Array.isArray(arg);
|
|
329
283
|
var isObjectLike = (arg) => {
|
|
330
|
-
if (arg === null)
|
|
331
|
-
return false;
|
|
284
|
+
if (arg === null) return false;
|
|
332
285
|
return typeof arg === "object";
|
|
333
286
|
};
|
|
334
287
|
var isUndefined = (arg) => {
|
|
335
288
|
return arg === void 0;
|
|
336
289
|
};
|
|
337
290
|
|
|
338
|
-
//
|
|
291
|
+
// node_modules/@domql/utils/dist/esm/array.js
|
|
339
292
|
var mergeArray = (arr, exclude = []) => {
|
|
340
293
|
return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
|
|
341
294
|
};
|
|
342
295
|
|
|
343
|
-
//
|
|
296
|
+
// node_modules/@domql/utils/dist/esm/object.js
|
|
344
297
|
var __defProp2 = Object.defineProperty;
|
|
345
298
|
var __defProps = Object.defineProperties;
|
|
346
299
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -363,8 +316,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
363
316
|
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
364
317
|
for (const e in extend) {
|
|
365
318
|
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
|
|
366
|
-
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
|
|
367
|
-
continue;
|
|
319
|
+
if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
|
|
368
320
|
const elementProp = element[e];
|
|
369
321
|
const extendProp = extend[e];
|
|
370
322
|
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
@@ -393,13 +345,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
393
345
|
const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
|
|
394
346
|
visited.set(obj, clone2);
|
|
395
347
|
for (const key in obj) {
|
|
396
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key))
|
|
397
|
-
|
|
398
|
-
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
|
|
399
|
-
continue;
|
|
348
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
349
|
+
if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
|
|
400
350
|
const value = obj[key];
|
|
401
|
-
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
|
|
402
|
-
continue;
|
|
351
|
+
if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
|
|
403
352
|
if (isDOMNode(value)) {
|
|
404
353
|
clone2[key] = value;
|
|
405
354
|
continue;
|
|
@@ -423,7 +372,7 @@ var deepClone = (obj, options = {}) => {
|
|
|
423
372
|
return clone2;
|
|
424
373
|
};
|
|
425
374
|
|
|
426
|
-
//
|
|
375
|
+
// node_modules/@domql/utils/dist/esm/cookie.js
|
|
427
376
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
428
377
|
|
|
429
378
|
// src/system/font.js
|
|
@@ -650,15 +599,10 @@ var getActiveConfig = (def) => {
|
|
|
650
599
|
return FACTORY[def || FACTORY.active] || CONFIG;
|
|
651
600
|
};
|
|
652
601
|
|
|
653
|
-
// src/utils/color.js
|
|
654
|
-
var import_globals4 = __toESM(require_cjs2(), 1);
|
|
655
|
-
|
|
656
602
|
// src/utils/font.js
|
|
657
603
|
var getDefaultOrFirstKey = (LIBRARY, key) => {
|
|
658
|
-
if (LIBRARY[key])
|
|
659
|
-
|
|
660
|
-
if (LIBRARY.default)
|
|
661
|
-
return LIBRARY[LIBRARY.default].value;
|
|
604
|
+
if (LIBRARY[key]) return LIBRARY[key].value;
|
|
605
|
+
if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
|
|
662
606
|
const hasValue = Object.keys(LIBRARY)[0];
|
|
663
607
|
return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
|
|
664
608
|
};
|
|
@@ -685,8 +629,7 @@ var import_utils4 = __toESM(require_cjs(), 1);
|
|
|
685
629
|
// src/system/font.js
|
|
686
630
|
var setFont = (val, key) => {
|
|
687
631
|
const CSSvar = `--font-${key}`;
|
|
688
|
-
if (!val || isArray(val) && !val[0])
|
|
689
|
-
return;
|
|
632
|
+
if (!val || isArray(val) && !val[0]) return;
|
|
690
633
|
const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
|
|
691
634
|
return { var: CSSvar, value: val, fontFace };
|
|
692
635
|
};
|
|
@@ -699,10 +642,8 @@ var setFontFamily = (val, key) => {
|
|
|
699
642
|
const CONFIG2 = getActiveConfig();
|
|
700
643
|
const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
|
|
701
644
|
let { value, type } = val;
|
|
702
|
-
if (val.isDefault)
|
|
703
|
-
|
|
704
|
-
if (isObject(value))
|
|
705
|
-
value = (0, import_utils8.arrayzeValue)(value);
|
|
645
|
+
if (val.isDefault) FONT_FAMILY2.default = key;
|
|
646
|
+
if (isObject(value)) value = (0, import_utils8.arrayzeValue)(value);
|
|
706
647
|
const CSSvar = `--font-family-${key}`;
|
|
707
648
|
const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
|
|
708
649
|
return { var: CSSvar, value: str, arr: value, type };
|