@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: () => document5,
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 document5 = 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
  });
@@ -308,64 +332,115 @@ __export(svg_exports, {
308
332
  setSvgIcon: () => setSvgIcon
309
333
  });
310
334
  module.exports = __toCommonJS(svg_exports);
311
- var import_globals5 = __toESM(require_cjs(), 1);
312
-
313
- // src/utils/color.js
314
- var import_globals4 = __toESM(require_cjs(), 1);
315
335
 
316
- // ../../node_modules/@domql/utils/dist/esm/globals.js
336
+ // ../../node_modules/@domql/utils/globals.js
317
337
  var window2 = globalThis;
318
338
  var document2 = window2.document;
319
339
 
320
- // ../../node_modules/@domql/utils/dist/esm/node.js
340
+ // ../../node_modules/@domql/utils/node.js
321
341
  var isDOMNode = (obj) => {
322
342
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
323
343
  };
324
344
 
325
- // ../../node_modules/@domql/utils/dist/esm/types.js
345
+ // ../../node_modules/@domql/utils/types.js
326
346
  var isString = (arg) => typeof arg === "string";
327
347
  var isFunction = (arg) => typeof arg === "function";
328
348
  var isNull = (arg) => arg === null;
329
349
  var isArray = (arg) => Array.isArray(arg);
330
350
  var isObjectLike = (arg) => {
331
- if (arg === null)
332
- return false;
351
+ if (arg === null) return false;
333
352
  return typeof arg === "object";
334
353
  };
335
354
  var isUndefined = (arg) => {
336
355
  return arg === void 0;
337
356
  };
338
357
 
339
- // ../../node_modules/@domql/utils/dist/esm/array.js
340
- var mergeArray = (arr, exclude = []) => {
341
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
342
- };
343
-
344
- // ../../node_modules/@domql/utils/dist/esm/object.js
345
- var __defProp2 = Object.defineProperty;
346
- var __defProps = Object.defineProperties;
347
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
348
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
349
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
350
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
351
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
352
- var __spreadValues = (a, b) => {
353
- for (var prop in b || (b = {}))
354
- if (__hasOwnProp2.call(b, prop))
355
- __defNormalProp(a, prop, b[prop]);
356
- if (__getOwnPropSymbols)
357
- for (var prop of __getOwnPropSymbols(b)) {
358
- if (__propIsEnum.call(b, prop))
359
- __defNormalProp(a, prop, b[prop]);
360
- }
361
- return a;
358
+ // ../../node_modules/@domql/utils/array.js
359
+ var unstackArrayOfObjects = (arr, exclude = []) => {
360
+ return arr.reduce(
361
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
362
+ {}
363
+ );
362
364
  };
363
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
364
- var deepMerge = (element, extend, excludeFrom = []) => {
365
+
366
+ // ../../node_modules/@domql/utils/keys.js
367
+ var STATE_METHODS = [
368
+ "update",
369
+ "parse",
370
+ "clean",
371
+ "create",
372
+ "destroy",
373
+ "add",
374
+ "toggle",
375
+ "remove",
376
+ "apply",
377
+ "set",
378
+ "reset",
379
+ "replace",
380
+ "quietReplace",
381
+ "quietUpdate",
382
+ "applyReplace",
383
+ "applyFunction",
384
+ "keys",
385
+ "values",
386
+ "ref",
387
+ "rootUpdate",
388
+ "parentUpdate",
389
+ "parent",
390
+ "__element",
391
+ "__depends",
392
+ "__ref",
393
+ "__children",
394
+ "root",
395
+ "setByPath",
396
+ "setPathCollection",
397
+ "removeByPath",
398
+ "removePathCollection",
399
+ "getByPath"
400
+ ];
401
+ var PROPS_METHODS = ["update", "__element"];
402
+ var METHODS = [
403
+ "set",
404
+ "reset",
405
+ "update",
406
+ "remove",
407
+ "updateContent",
408
+ "removeContent",
409
+ "lookup",
410
+ "lookdown",
411
+ "lookdownAll",
412
+ "getRef",
413
+ "getPath",
414
+ "setNodeStyles",
415
+ "spotByPath",
416
+ "keys",
417
+ "parse",
418
+ "setProps",
419
+ "parseDeep",
420
+ "variables",
421
+ "if",
422
+ "log",
423
+ "verbose",
424
+ "warn",
425
+ "error",
426
+ "call",
427
+ "nextElement",
428
+ "previousElement"
429
+ ];
430
+ var METHODS_EXL = [
431
+ ...["node", "context", "extends", "__element", "__ref"],
432
+ ...METHODS,
433
+ ...STATE_METHODS,
434
+ ...PROPS_METHODS
435
+ ];
436
+
437
+ // ../../node_modules/@domql/utils/object.js
438
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
365
439
  for (const e in extend) {
366
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
367
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
440
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
441
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
368
442
  continue;
443
+ }
369
444
  const elementProp = element[e];
370
445
  const extendProp = extend[e];
371
446
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -383,7 +458,7 @@ var deepClone = (obj, options = {}) => {
383
458
  cleanNull = false,
384
459
  window: targetWindow,
385
460
  visited = /* @__PURE__ */ new WeakMap(),
386
- handleExtend = false
461
+ handleExtends = false
387
462
  } = options;
388
463
  if (!isObjectLike(obj) || isDOMNode(obj)) {
389
464
  return obj;
@@ -391,44 +466,46 @@ var deepClone = (obj, options = {}) => {
391
466
  if (visited.has(obj)) {
392
467
  return visited.get(obj);
393
468
  }
394
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
395
- visited.set(obj, clone2);
469
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
470
+ visited.set(obj, clone);
396
471
  for (const key in obj) {
397
- if (!Object.prototype.hasOwnProperty.call(obj, key))
398
- continue;
399
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
472
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
473
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
400
474
  continue;
475
+ }
401
476
  const value = obj[key];
402
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
477
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
403
478
  continue;
479
+ }
404
480
  if (isDOMNode(value)) {
405
- clone2[key] = value;
481
+ clone[key] = value;
406
482
  continue;
407
483
  }
408
- if (handleExtend && key === "extend" && isArray(value)) {
409
- clone2[key] = mergeArray(value, exclude);
484
+ if (handleExtends && key === "extends" && isArray(value)) {
485
+ clone[key] = unstackArrayOfObjects(value, exclude);
410
486
  continue;
411
487
  }
412
488
  if (isFunction(value) && targetWindow) {
413
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
489
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
414
490
  continue;
415
491
  }
416
492
  if (isObjectLike(value)) {
417
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
493
+ clone[key] = deepClone(value, {
494
+ ...options,
418
495
  visited
419
- }));
496
+ });
420
497
  } else {
421
- clone2[key] = value;
498
+ clone[key] = value;
422
499
  }
423
500
  }
424
- return clone2;
501
+ return clone;
425
502
  };
426
503
 
427
- // ../../node_modules/@domql/utils/dist/esm/cookie.js
504
+ // ../../node_modules/@domql/utils/cookie.js
428
505
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
429
506
 
430
507
  // src/utils/sequence.js
431
- var import_utils4 = __toESM(require_cjs2(), 1);
508
+ var import_utils6 = __toESM(require_cjs(), 1);
432
509
 
433
510
  // src/defaultConfig/index.js
434
511
  var defaultConfig_exports = {};
@@ -656,10 +733,8 @@ var generateSprite = (icons) => {
656
733
  const CONFIG2 = getActiveConfig();
657
734
  let sprite = "";
658
735
  for (const key in icons) {
659
- if (CONFIG2.__svg_cache[key])
660
- continue;
661
- else
662
- CONFIG2.__svg_cache[key] = true;
736
+ if (CONFIG2.__svg_cache[key]) continue;
737
+ else CONFIG2.__svg_cache[key] = true;
663
738
  sprite += icons[key];
664
739
  }
665
740
  return sprite;
@@ -712,13 +787,12 @@ var convertSvgToSymbol = (key, code) => {
712
787
 
713
788
  // src/system/svg.js
714
789
  var DEF_OPTIONS = {
715
- document: import_globals5.document
790
+ document: document2
716
791
  };
717
792
  var setSVG = (val, key) => {
718
793
  const CONFIG2 = getActiveConfig();
719
794
  if (!val) {
720
- if (CONFIG2.verbose)
721
- console.warn("setSVG: val is not defined", key);
795
+ if (CONFIG2.verbose) console.warn("setSVG: val is not defined", key);
722
796
  return;
723
797
  }
724
798
  if (CONFIG2.useSvgSprite) {
@@ -729,8 +803,7 @@ var setSVG = (val, key) => {
729
803
  var appendSVGSprite = (LIBRARY, options = DEF_OPTIONS) => {
730
804
  const CONFIG2 = getActiveConfig();
731
805
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.SVG;
732
- for (const key in LIBRARY)
733
- lib[key] = CONFIG2.SVG[key];
806
+ for (const key in LIBRARY) lib[key] = CONFIG2.SVG[key];
734
807
  appendSVG(lib, options);
735
808
  };
736
809
  var setSvgIcon = (val, key) => {
@@ -744,14 +817,12 @@ var setSvgIcon = (val, key) => {
744
817
  var appendSvgIconsSprite = (LIBRARY, options = DEF_OPTIONS) => {
745
818
  const CONFIG2 = getActiveConfig();
746
819
  const lib = Object.keys(LIBRARY).length ? {} : CONFIG2.ICONS;
747
- for (const key in LIBRARY)
748
- lib[key] = CONFIG2.ICONS[key];
820
+ for (const key in LIBRARY) lib[key] = CONFIG2.ICONS[key];
749
821
  appendSVG(lib, options);
750
822
  };
751
823
  var createSVGSpriteElement = (options = { isRoot: true }) => {
752
- if (!import_globals5.document || !import_globals5.document.createElementNS)
753
- return;
754
- const svgElem = import_globals5.document.createElementNS("http://www.w3.org/2000/svg", "svg");
824
+ if (!document2 || !document2.createElementNS) return;
825
+ const svgElem = document2.createElementNS("http://www.w3.org/2000/svg", "svg");
755
826
  if (options.isRoot) {
756
827
  svgElem.setAttribute("aria-hidden", "true");
757
828
  svgElem.setAttribute("width", "0");
@@ -763,7 +834,7 @@ var createSVGSpriteElement = (options = { isRoot: true }) => {
763
834
  };
764
835
  var appendSVG = (lib, options = DEF_OPTIONS) => {
765
836
  const CONFIG2 = getActiveConfig();
766
- const doc = options.document || import_globals5.document;
837
+ const doc = options.document || document2;
767
838
  if (!doc || !doc.documentElement) {
768
839
  if (CONFIG2.verbose) {
769
840
  console.warn("To append SVG sprites it should be run in browser environment");