@symbo.ls/scratch 2.11.523 → 3.0.2

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.
@@ -30,65 +30,29 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // ../../node_modules/@domql/globals/dist/cjs/index.js
34
- var require_cjs = __commonJS({
35
- "../../node_modules/@domql/globals/dist/cjs/index.js"(exports, module2) {
36
- "use strict";
37
- var __defProp3 = Object.defineProperty;
38
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp3 = Object.prototype.hasOwnProperty;
41
- var __export2 = (target, all) => {
42
- for (var name in all)
43
- __defProp3(target, name, { get: all[name], enumerable: true });
44
- };
45
- var __copyProps2 = (to, from, except, desc) => {
46
- if (from && typeof from === "object" || typeof from === "function") {
47
- for (let key of __getOwnPropNames2(from))
48
- if (!__hasOwnProp3.call(to, key) && key !== except)
49
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
- }
51
- return to;
52
- };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
- var globals_exports = {};
55
- __export2(globals_exports, {
56
- document: () => document4,
57
- global: () => global,
58
- self: () => self,
59
- window: () => window4
60
- });
61
- module2.exports = __toCommonJS2(globals_exports);
62
- var global = globalThis;
63
- var self = globalThis;
64
- var window4 = globalThis;
65
- var document4 = window4.document;
66
- }
67
- });
68
-
69
33
  // ../utils/dist/cjs/index.js
70
- var require_cjs2 = __commonJS({
34
+ var require_cjs = __commonJS({
71
35
  "../utils/dist/cjs/index.js"(exports, module2) {
72
36
  "use strict";
73
- var __defProp3 = Object.defineProperty;
37
+ var __defProp2 = Object.defineProperty;
74
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
75
39
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
76
- var __hasOwnProp3 = Object.prototype.hasOwnProperty;
40
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
77
41
  var __export2 = (target, all) => {
78
42
  for (var name in all)
79
- __defProp3(target, name, { get: all[name], enumerable: true });
43
+ __defProp2(target, name, { get: all[name], enumerable: true });
80
44
  };
81
45
  var __copyProps2 = (to, from, except, desc) => {
82
46
  if (from && typeof from === "object" || typeof from === "function") {
83
47
  for (let key of __getOwnPropNames2(from))
84
- if (!__hasOwnProp3.call(to, key) && key !== except)
85
- __defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
48
+ if (!__hasOwnProp2.call(to, key) && key !== except)
49
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
86
50
  }
87
51
  return to;
88
52
  };
89
- var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
90
- var src_exports = {};
91
- __export2(src_exports, {
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
+ var index_exports = {};
55
+ __export2(index_exports, {
92
56
  arrayzeValue: () => arrayzeValue,
93
57
  copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
94
58
  copyStringToClipboard: () => copyStringToClipboard,
@@ -109,17 +73,85 @@ var require_cjs2 = __commonJS({
109
73
  toTitleCase: () => toTitleCase,
110
74
  toggleFullscreen: () => toggleFullscreen
111
75
  });
112
- module2.exports = __toCommonJS2(src_exports);
76
+ module2.exports = __toCommonJS2(index_exports);
113
77
  var window22 = globalThis;
114
78
  var document22 = window22.document;
115
79
  var isObject2 = (arg) => {
116
- if (arg === null)
117
- return false;
80
+ if (arg === null) return false;
118
81
  return typeof arg === "object" && arg.constructor === Object;
119
82
  };
120
83
  var isString2 = (arg) => typeof arg === "string";
121
84
  var isNumber2 = (arg) => typeof arg === "number";
122
85
  var isArray2 = (arg) => Array.isArray(arg);
86
+ var STATE_METHODS2 = [
87
+ "update",
88
+ "parse",
89
+ "clean",
90
+ "create",
91
+ "destroy",
92
+ "add",
93
+ "toggle",
94
+ "remove",
95
+ "apply",
96
+ "set",
97
+ "reset",
98
+ "replace",
99
+ "quietReplace",
100
+ "quietUpdate",
101
+ "applyReplace",
102
+ "applyFunction",
103
+ "keys",
104
+ "values",
105
+ "ref",
106
+ "rootUpdate",
107
+ "parentUpdate",
108
+ "parent",
109
+ "__element",
110
+ "__depends",
111
+ "__ref",
112
+ "__children",
113
+ "root",
114
+ "setByPath",
115
+ "setPathCollection",
116
+ "removeByPath",
117
+ "removePathCollection",
118
+ "getByPath"
119
+ ];
120
+ var PROPS_METHODS2 = ["update", "__element"];
121
+ var METHODS2 = [
122
+ "set",
123
+ "reset",
124
+ "update",
125
+ "remove",
126
+ "updateContent",
127
+ "removeContent",
128
+ "lookup",
129
+ "lookdown",
130
+ "lookdownAll",
131
+ "getRef",
132
+ "getPath",
133
+ "setNodeStyles",
134
+ "spotByPath",
135
+ "keys",
136
+ "parse",
137
+ "setProps",
138
+ "parseDeep",
139
+ "variables",
140
+ "if",
141
+ "log",
142
+ "verbose",
143
+ "warn",
144
+ "error",
145
+ "call",
146
+ "nextElement",
147
+ "previousElement"
148
+ ];
149
+ var METHODS_EXL2 = [
150
+ ...["node", "context", "extends", "__element", "__ref"],
151
+ ...METHODS2,
152
+ ...STATE_METHODS2,
153
+ ...PROPS_METHODS2
154
+ ];
123
155
  var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
124
156
  async function toggleFullscreen(opts) {
125
157
  if (!document.fullscreenElement) {
@@ -139,13 +171,11 @@ var require_cjs2 = __commonJS({
139
171
  };
140
172
  var findClosestNumberInFactory = (val, factory) => {
141
173
  val = parseFloat(val);
142
- if (isObject2(factory))
143
- factory = Object.values(factory);
174
+ if (isObject2(factory)) factory = Object.values(factory);
144
175
  return findClosestNumber(val, factory);
145
176
  };
146
177
  var formatDate = (timestamp) => {
147
- if (!timestamp)
148
- return "";
178
+ if (!timestamp) return "";
149
179
  const d = new Date(timestamp);
150
180
  const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
151
181
  const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
@@ -212,8 +242,7 @@ var require_cjs2 = __commonJS({
212
242
  scriptEle.type = type;
213
243
  scriptEle.text = xhr.responseText;
214
244
  doc.body.appendChild(scriptEle);
215
- if (typeof fallback === "function")
216
- fallback();
245
+ if (typeof fallback === "function") fallback();
217
246
  } else {
218
247
  throw new Error(`Failed to load the script ${FILE_URL}`);
219
248
  }
@@ -281,20 +310,15 @@ var require_cjs2 = __commonJS({
281
310
  );
282
311
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
283
312
  var toDescriptionCase = (str = "") => {
284
- if (typeof str !== "string")
285
- return;
313
+ if (typeof str !== "string") return;
286
314
  const result = str.replace(/([A-Z])/g, " $1");
287
315
  return result.charAt(0).toUpperCase() + result.slice(1);
288
316
  };
289
317
  var arrayzeValue = (val) => {
290
- if (isArray2(val))
291
- return val;
292
- if (isString2(val))
293
- return val.split(" ");
294
- if (isObject2(val))
295
- return Object.values(val);
296
- if (isNumber2(val))
297
- return [val];
318
+ if (isArray2(val)) return val;
319
+ if (isString2(val)) return val.split(" ");
320
+ if (isObject2(val)) return Object.values(val);
321
+ if (isNumber2(val)) return [val];
298
322
  };
299
323
  }
300
324
  });
@@ -306,59 +330,114 @@ __export(reset_exports, {
306
330
  });
307
331
  module.exports = __toCommonJS(reset_exports);
308
332
 
309
- // ../../node_modules/@domql/utils/dist/esm/globals.js
333
+ // ../../node_modules/@domql/utils/globals.js
310
334
  var window2 = globalThis;
311
335
  var document2 = window2.document;
312
336
 
313
- // ../../node_modules/@domql/utils/dist/esm/node.js
337
+ // ../../node_modules/@domql/utils/node.js
314
338
  var isDOMNode = (obj) => {
315
339
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
316
340
  };
317
341
 
318
- // ../../node_modules/@domql/utils/dist/esm/types.js
342
+ // ../../node_modules/@domql/utils/types.js
319
343
  var isString = (arg) => typeof arg === "string";
320
344
  var isFunction = (arg) => typeof arg === "function";
321
345
  var isNull = (arg) => arg === null;
322
346
  var isArray = (arg) => Array.isArray(arg);
323
347
  var isObjectLike = (arg) => {
324
- if (arg === null)
325
- return false;
348
+ if (arg === null) return false;
326
349
  return typeof arg === "object";
327
350
  };
328
351
  var isUndefined = (arg) => {
329
352
  return arg === void 0;
330
353
  };
331
354
 
332
- // ../../node_modules/@domql/utils/dist/esm/array.js
333
- var mergeArray = (arr, exclude = []) => {
334
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
355
+ // ../../node_modules/@domql/utils/array.js
356
+ var unstackArrayOfObjects = (arr, exclude = []) => {
357
+ return arr.reduce(
358
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
359
+ {}
360
+ );
335
361
  };
336
362
 
337
- // ../../node_modules/@domql/utils/dist/esm/object.js
338
- var __defProp2 = Object.defineProperty;
339
- var __defProps = Object.defineProperties;
340
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
341
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
342
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
343
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
344
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
345
- var __spreadValues = (a, b) => {
346
- for (var prop in b || (b = {}))
347
- if (__hasOwnProp2.call(b, prop))
348
- __defNormalProp(a, prop, b[prop]);
349
- if (__getOwnPropSymbols)
350
- for (var prop of __getOwnPropSymbols(b)) {
351
- if (__propIsEnum.call(b, prop))
352
- __defNormalProp(a, prop, b[prop]);
353
- }
354
- return a;
355
- };
356
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
363
+ // ../../node_modules/@domql/utils/keys.js
364
+ var STATE_METHODS = [
365
+ "update",
366
+ "parse",
367
+ "clean",
368
+ "create",
369
+ "destroy",
370
+ "add",
371
+ "toggle",
372
+ "remove",
373
+ "apply",
374
+ "set",
375
+ "reset",
376
+ "replace",
377
+ "quietReplace",
378
+ "quietUpdate",
379
+ "applyReplace",
380
+ "applyFunction",
381
+ "keys",
382
+ "values",
383
+ "ref",
384
+ "rootUpdate",
385
+ "parentUpdate",
386
+ "parent",
387
+ "__element",
388
+ "__depends",
389
+ "__ref",
390
+ "__children",
391
+ "root",
392
+ "setByPath",
393
+ "setPathCollection",
394
+ "removeByPath",
395
+ "removePathCollection",
396
+ "getByPath"
397
+ ];
398
+ var PROPS_METHODS = ["update", "__element"];
399
+ var METHODS = [
400
+ "set",
401
+ "reset",
402
+ "update",
403
+ "remove",
404
+ "updateContent",
405
+ "removeContent",
406
+ "lookup",
407
+ "lookdown",
408
+ "lookdownAll",
409
+ "getRef",
410
+ "getPath",
411
+ "setNodeStyles",
412
+ "spotByPath",
413
+ "keys",
414
+ "parse",
415
+ "setProps",
416
+ "parseDeep",
417
+ "variables",
418
+ "if",
419
+ "log",
420
+ "verbose",
421
+ "warn",
422
+ "error",
423
+ "call",
424
+ "nextElement",
425
+ "previousElement"
426
+ ];
427
+ var METHODS_EXL = [
428
+ ...["node", "context", "extends", "__element", "__ref"],
429
+ ...METHODS,
430
+ ...STATE_METHODS,
431
+ ...PROPS_METHODS
432
+ ];
433
+
434
+ // ../../node_modules/@domql/utils/object.js
357
435
  var merge = (element, obj, excludeFrom = []) => {
358
436
  for (const e in obj) {
359
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
360
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
437
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
438
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
361
439
  continue;
440
+ }
362
441
  const elementProp = element[e];
363
442
  const objProp = obj[e];
364
443
  if (elementProp === void 0) {
@@ -367,11 +446,12 @@ var merge = (element, obj, excludeFrom = []) => {
367
446
  }
368
447
  return element;
369
448
  };
370
- var deepMerge = (element, extend, excludeFrom = []) => {
449
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
371
450
  for (const e in extend) {
372
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
373
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
451
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
452
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
374
453
  continue;
454
+ }
375
455
  const elementProp = element[e];
376
456
  const extendProp = extend[e];
377
457
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -389,7 +469,7 @@ var deepClone = (obj, options = {}) => {
389
469
  cleanNull = false,
390
470
  window: targetWindow,
391
471
  visited = /* @__PURE__ */ new WeakMap(),
392
- handleExtend = false
472
+ handleExtends = false
393
473
  } = options;
394
474
  if (!isObjectLike(obj) || isDOMNode(obj)) {
395
475
  return obj;
@@ -397,37 +477,39 @@ var deepClone = (obj, options = {}) => {
397
477
  if (visited.has(obj)) {
398
478
  return visited.get(obj);
399
479
  }
400
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
401
- visited.set(obj, clone2);
480
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
481
+ visited.set(obj, clone);
402
482
  for (const key in obj) {
403
- if (!Object.prototype.hasOwnProperty.call(obj, key))
404
- continue;
405
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
483
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
484
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
406
485
  continue;
486
+ }
407
487
  const value = obj[key];
408
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
488
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
409
489
  continue;
490
+ }
410
491
  if (isDOMNode(value)) {
411
- clone2[key] = value;
492
+ clone[key] = value;
412
493
  continue;
413
494
  }
414
- if (handleExtend && key === "extend" && isArray(value)) {
415
- clone2[key] = mergeArray(value, exclude);
495
+ if (handleExtends && key === "extends" && isArray(value)) {
496
+ clone[key] = unstackArrayOfObjects(value, exclude);
416
497
  continue;
417
498
  }
418
499
  if (isFunction(value) && targetWindow) {
419
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
500
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
420
501
  continue;
421
502
  }
422
503
  if (isObjectLike(value)) {
423
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
504
+ clone[key] = deepClone(value, {
505
+ ...options,
424
506
  visited
425
- }));
507
+ });
426
508
  } else {
427
- clone2[key] = value;
509
+ clone[key] = value;
428
510
  }
429
511
  }
430
- return clone2;
512
+ return clone;
431
513
  };
432
514
  var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
433
515
  const excl = opts.exclude || [];
@@ -435,14 +517,11 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
435
517
  if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
436
518
  return params;
437
519
  }
438
- if (visited.has(obj))
439
- return visited.get(obj);
520
+ if (visited.has(obj)) return visited.get(obj);
440
521
  visited.set(obj, obj);
441
522
  for (const e in params) {
442
- if (!Object.hasOwnProperty.call(params, e))
443
- continue;
444
- if (excl.includes(e) || forcedExclude && e.startsWith("__"))
445
- continue;
523
+ if (!Object.hasOwnProperty.call(params, e)) continue;
524
+ if (excl.includes(e) || forcedExclude && e.startsWith("__")) continue;
446
525
  const objProp = obj[e];
447
526
  const paramsProp = params[e];
448
527
  if (isDOMNode(paramsProp)) {
@@ -456,7 +535,7 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
456
535
  return obj;
457
536
  };
458
537
 
459
- // ../../node_modules/@domql/utils/dist/esm/cookie.js
538
+ // ../../node_modules/@domql/utils/cookie.js
460
539
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
461
540
 
462
541
  // src/defaultConfig/index.js
@@ -680,11 +759,8 @@ var getActiveConfig = (def) => {
680
759
  return FACTORY[def || FACTORY.active] || CONFIG;
681
760
  };
682
761
 
683
- // src/utils/color.js
684
- var import_globals4 = __toESM(require_cjs(), 1);
685
-
686
762
  // src/utils/sequence.js
687
- var import_utils4 = __toESM(require_cjs2(), 1);
763
+ var import_utils6 = __toESM(require_cjs(), 1);
688
764
 
689
765
  // src/system/theme.js
690
766
  var recursiveTheme = (val) => {
@@ -700,24 +776,19 @@ var recursiveTheme = (val) => {
700
776
  } else if (symb === ":") {
701
777
  obj[`&${param}`] = recursiveTheme(val[param]);
702
778
  }
703
- } else
704
- obj[param] = val[param];
779
+ } else obj[param] = val[param];
705
780
  }
706
781
  return obj;
707
782
  };
708
783
  var findModifierFromArray = (val, modifierArray) => {
709
784
  const currentMod = modifierArray.shift();
710
- if (val[currentMod])
711
- return findModifierFromArray(val[currentMod], modifierArray);
785
+ if (val[currentMod]) return findModifierFromArray(val[currentMod], modifierArray);
712
786
  return val;
713
787
  };
714
788
  var findModifier = (val, modifier) => {
715
- if (isArray(modifier))
716
- return findModifierFromArray(val, modifier);
717
- else if (isString(modifier) && val[modifier])
718
- return val[modifier];
719
- else
720
- return val;
789
+ if (isArray(modifier)) return findModifierFromArray(val, modifier);
790
+ else if (isString(modifier) && val[modifier]) return val[modifier];
791
+ else return val;
721
792
  };
722
793
  var getMediaTheme = (value, modifier) => {
723
794
  const activeConfig = getActiveConfig();
@@ -760,8 +831,7 @@ var applyReset = (reset = {}) => {
760
831
  }
761
832
  const { body, ...templates } = TYPOGRAPHY2.templates;
762
833
  const globalTheme = CONFIG2.useDocumentTheme ? getMediaTheme("document", `@${CONFIG2.globalTheme}`) : {};
763
- if (RESET2.html)
764
- overwriteDeep(RESET2.html, globalTheme);
834
+ if (RESET2.html) overwriteDeep(RESET2.html, globalTheme);
765
835
  return deepMerge(merge(RESET2, reset), {
766
836
  html: {
767
837
  position: "absolute",