@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,58 +330,113 @@ __export(document_exports, {
306
330
  });
307
331
  module.exports = __toCommonJS(document_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 isFunction = (arg) => typeof arg === "function";
320
344
  var isNull = (arg) => arg === null;
321
345
  var isArray = (arg) => Array.isArray(arg);
322
346
  var isObjectLike = (arg) => {
323
- if (arg === null)
324
- return false;
347
+ if (arg === null) return false;
325
348
  return typeof arg === "object";
326
349
  };
327
350
  var isUndefined = (arg) => {
328
351
  return arg === void 0;
329
352
  };
330
353
 
331
- // ../../node_modules/@domql/utils/dist/esm/array.js
332
- var mergeArray = (arr, exclude = []) => {
333
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
354
+ // ../../node_modules/@domql/utils/array.js
355
+ var unstackArrayOfObjects = (arr, exclude = []) => {
356
+ return arr.reduce(
357
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
358
+ {}
359
+ );
334
360
  };
335
361
 
336
- // ../../node_modules/@domql/utils/dist/esm/object.js
337
- var __defProp2 = Object.defineProperty;
338
- var __defProps = Object.defineProperties;
339
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
340
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
341
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
342
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
343
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
344
- var __spreadValues = (a, b) => {
345
- for (var prop in b || (b = {}))
346
- if (__hasOwnProp2.call(b, prop))
347
- __defNormalProp(a, prop, b[prop]);
348
- if (__getOwnPropSymbols)
349
- for (var prop of __getOwnPropSymbols(b)) {
350
- if (__propIsEnum.call(b, prop))
351
- __defNormalProp(a, prop, b[prop]);
352
- }
353
- return a;
354
- };
355
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
362
+ // ../../node_modules/@domql/utils/keys.js
363
+ var STATE_METHODS = [
364
+ "update",
365
+ "parse",
366
+ "clean",
367
+ "create",
368
+ "destroy",
369
+ "add",
370
+ "toggle",
371
+ "remove",
372
+ "apply",
373
+ "set",
374
+ "reset",
375
+ "replace",
376
+ "quietReplace",
377
+ "quietUpdate",
378
+ "applyReplace",
379
+ "applyFunction",
380
+ "keys",
381
+ "values",
382
+ "ref",
383
+ "rootUpdate",
384
+ "parentUpdate",
385
+ "parent",
386
+ "__element",
387
+ "__depends",
388
+ "__ref",
389
+ "__children",
390
+ "root",
391
+ "setByPath",
392
+ "setPathCollection",
393
+ "removeByPath",
394
+ "removePathCollection",
395
+ "getByPath"
396
+ ];
397
+ var PROPS_METHODS = ["update", "__element"];
398
+ var METHODS = [
399
+ "set",
400
+ "reset",
401
+ "update",
402
+ "remove",
403
+ "updateContent",
404
+ "removeContent",
405
+ "lookup",
406
+ "lookdown",
407
+ "lookdownAll",
408
+ "getRef",
409
+ "getPath",
410
+ "setNodeStyles",
411
+ "spotByPath",
412
+ "keys",
413
+ "parse",
414
+ "setProps",
415
+ "parseDeep",
416
+ "variables",
417
+ "if",
418
+ "log",
419
+ "verbose",
420
+ "warn",
421
+ "error",
422
+ "call",
423
+ "nextElement",
424
+ "previousElement"
425
+ ];
426
+ var METHODS_EXL = [
427
+ ...["node", "context", "extends", "__element", "__ref"],
428
+ ...METHODS,
429
+ ...STATE_METHODS,
430
+ ...PROPS_METHODS
431
+ ];
432
+
433
+ // ../../node_modules/@domql/utils/object.js
356
434
  var merge = (element, obj, excludeFrom = []) => {
357
435
  for (const e in obj) {
358
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
359
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
436
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
437
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
360
438
  continue;
439
+ }
361
440
  const elementProp = element[e];
362
441
  const objProp = obj[e];
363
442
  if (elementProp === void 0) {
@@ -366,11 +445,12 @@ var merge = (element, obj, excludeFrom = []) => {
366
445
  }
367
446
  return element;
368
447
  };
369
- var deepMerge = (element, extend, excludeFrom = []) => {
448
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
370
449
  for (const e in extend) {
371
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
372
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
450
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
451
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
373
452
  continue;
453
+ }
374
454
  const elementProp = element[e];
375
455
  const extendProp = extend[e];
376
456
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -388,7 +468,7 @@ var deepClone = (obj, options = {}) => {
388
468
  cleanNull = false,
389
469
  window: targetWindow,
390
470
  visited = /* @__PURE__ */ new WeakMap(),
391
- handleExtend = false
471
+ handleExtends = false
392
472
  } = options;
393
473
  if (!isObjectLike(obj) || isDOMNode(obj)) {
394
474
  return obj;
@@ -396,40 +476,42 @@ var deepClone = (obj, options = {}) => {
396
476
  if (visited.has(obj)) {
397
477
  return visited.get(obj);
398
478
  }
399
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
400
- visited.set(obj, clone2);
479
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
480
+ visited.set(obj, clone);
401
481
  for (const key in obj) {
402
- if (!Object.prototype.hasOwnProperty.call(obj, key))
403
- continue;
404
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
482
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
483
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
405
484
  continue;
485
+ }
406
486
  const value = obj[key];
407
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
487
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
408
488
  continue;
489
+ }
409
490
  if (isDOMNode(value)) {
410
- clone2[key] = value;
491
+ clone[key] = value;
411
492
  continue;
412
493
  }
413
- if (handleExtend && key === "extend" && isArray(value)) {
414
- clone2[key] = mergeArray(value, exclude);
494
+ if (handleExtends && key === "extends" && isArray(value)) {
495
+ clone[key] = unstackArrayOfObjects(value, exclude);
415
496
  continue;
416
497
  }
417
498
  if (isFunction(value) && targetWindow) {
418
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
499
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
419
500
  continue;
420
501
  }
421
502
  if (isObjectLike(value)) {
422
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
503
+ clone[key] = deepClone(value, {
504
+ ...options,
423
505
  visited
424
- }));
506
+ });
425
507
  } else {
426
- clone2[key] = value;
508
+ clone[key] = value;
427
509
  }
428
510
  }
429
- return clone2;
511
+ return clone;
430
512
  };
431
513
 
432
- // ../../node_modules/@domql/utils/dist/esm/cookie.js
514
+ // ../../node_modules/@domql/utils/cookie.js
433
515
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
434
516
 
435
517
  // src/defaultConfig/index.js
@@ -653,21 +735,16 @@ var getActiveConfig = (def) => {
653
735
  return FACTORY[def || FACTORY.active] || CONFIG;
654
736
  };
655
737
 
656
- // src/utils/color.js
657
- var import_globals4 = __toESM(require_cjs(), 1);
658
-
659
738
  // src/utils/font.js
660
739
  var getDefaultOrFirstKey = (LIBRARY, key) => {
661
- if (LIBRARY[key])
662
- return LIBRARY[key].value;
663
- if (LIBRARY.default)
664
- return LIBRARY[LIBRARY.default].value;
740
+ if (LIBRARY[key]) return LIBRARY[key].value;
741
+ if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
665
742
  const hasValue = Object.keys(LIBRARY)[0];
666
743
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
667
744
  };
668
745
 
669
746
  // src/utils/sequence.js
670
- var import_utils4 = __toESM(require_cjs2(), 1);
747
+ var import_utils6 = __toESM(require_cjs(), 1);
671
748
 
672
749
  // src/system/document.js
673
750
  var applyDocument = () => {