@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.
@@ -34,25 +34,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
34
34
  var require_cjs = __commonJS({
35
35
  "../utils/dist/cjs/index.js"(exports, module2) {
36
36
  "use strict";
37
- var __defProp3 = Object.defineProperty;
37
+ var __defProp2 = Object.defineProperty;
38
38
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
39
39
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
40
- var __hasOwnProp3 = Object.prototype.hasOwnProperty;
40
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
41
41
  var __export2 = (target, all) => {
42
42
  for (var name in all)
43
- __defProp3(target, name, { get: all[name], enumerable: true });
43
+ __defProp2(target, name, { get: all[name], enumerable: true });
44
44
  };
45
45
  var __copyProps2 = (to, from, except, desc) => {
46
46
  if (from && typeof from === "object" || typeof from === "function") {
47
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 });
48
+ if (!__hasOwnProp2.call(to, key) && key !== except)
49
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
50
50
  }
51
51
  return to;
52
52
  };
53
- var __toCommonJS2 = (mod) => __copyProps2(__defProp3({}, "__esModule", { value: true }), mod);
54
- var src_exports = {};
55
- __export2(src_exports, {
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
+ var index_exports = {};
55
+ __export2(index_exports, {
56
56
  arrayzeValue: () => arrayzeValue2,
57
57
  copyJavaScriptToClipboard: () => copyJavaScriptToClipboard,
58
58
  copyStringToClipboard: () => copyStringToClipboard,
@@ -73,17 +73,85 @@ var require_cjs = __commonJS({
73
73
  toTitleCase: () => toTitleCase,
74
74
  toggleFullscreen: () => toggleFullscreen
75
75
  });
76
- module2.exports = __toCommonJS2(src_exports);
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";
85
84
  var isNumber2 = (arg) => typeof arg === "number";
86
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
+ ];
87
155
  var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
88
156
  async function toggleFullscreen(opts) {
89
157
  if (!document.fullscreenElement) {
@@ -103,13 +171,11 @@ var require_cjs = __commonJS({
103
171
  };
104
172
  var findClosestNumberInFactory = (val, factory) => {
105
173
  val = parseFloat(val);
106
- if (isObject2(factory))
107
- factory = Object.values(factory);
174
+ if (isObject2(factory)) factory = Object.values(factory);
108
175
  return findClosestNumber(val, factory);
109
176
  };
110
177
  var formatDate = (timestamp) => {
111
- if (!timestamp)
112
- return "";
178
+ if (!timestamp) return "";
113
179
  const d = new Date(timestamp);
114
180
  const ye = new Intl.DateTimeFormat("en", { year: "numeric" }).format(d);
115
181
  const mo = new Intl.DateTimeFormat("en", { month: "short" }).format(d);
@@ -176,8 +242,7 @@ var require_cjs = __commonJS({
176
242
  scriptEle.type = type;
177
243
  scriptEle.text = xhr.responseText;
178
244
  doc.body.appendChild(scriptEle);
179
- if (typeof fallback === "function")
180
- fallback();
245
+ if (typeof fallback === "function") fallback();
181
246
  } else {
182
247
  throw new Error(`Failed to load the script ${FILE_URL}`);
183
248
  }
@@ -245,60 +310,19 @@ var require_cjs = __commonJS({
245
310
  );
246
311
  var toDashCase2 = (val) => val.replace(/[^a-zA-Z0-9]/g, " ").trim().toLowerCase().replace(/\s+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
247
312
  var toDescriptionCase = (str = "") => {
248
- if (typeof str !== "string")
249
- return;
313
+ if (typeof str !== "string") return;
250
314
  const result = str.replace(/([A-Z])/g, " $1");
251
315
  return result.charAt(0).toUpperCase() + result.slice(1);
252
316
  };
253
317
  var arrayzeValue2 = (val) => {
254
- if (isArray2(val))
255
- return val;
256
- if (isString2(val))
257
- return val.split(" ");
258
- if (isObject2(val))
259
- return Object.values(val);
260
- if (isNumber2(val))
261
- 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];
262
322
  };
263
323
  }
264
324
  });
265
325
 
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
326
  // src/system/font.js
303
327
  var font_exports = {};
304
328
  __export(font_exports, {
@@ -308,63 +332,117 @@ __export(font_exports, {
308
332
  });
309
333
  module.exports = __toCommonJS(font_exports);
310
334
 
311
- // ../../node_modules/@domql/utils/dist/esm/globals.js
335
+ // ../../node_modules/@domql/utils/globals.js
312
336
  var window2 = globalThis;
313
337
  var document2 = window2.document;
314
338
 
315
- // ../../node_modules/@domql/utils/dist/esm/node.js
339
+ // ../../node_modules/@domql/utils/node.js
316
340
  var isDOMNode = (obj) => {
317
341
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
318
342
  };
319
343
 
320
- // ../../node_modules/@domql/utils/dist/esm/types.js
344
+ // ../../node_modules/@domql/utils/types.js
321
345
  var isObject = (arg) => {
322
- if (arg === null)
323
- return false;
346
+ if (arg === null) return false;
324
347
  return typeof arg === "object" && arg.constructor === Object;
325
348
  };
326
349
  var isFunction = (arg) => typeof arg === "function";
327
350
  var isNull = (arg) => arg === null;
328
351
  var isArray = (arg) => Array.isArray(arg);
329
352
  var isObjectLike = (arg) => {
330
- if (arg === null)
331
- return false;
353
+ if (arg === null) return false;
332
354
  return typeof arg === "object";
333
355
  };
334
356
  var isUndefined = (arg) => {
335
357
  return arg === void 0;
336
358
  };
337
359
 
338
- // ../../node_modules/@domql/utils/dist/esm/array.js
339
- var mergeArray = (arr, exclude = []) => {
340
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
360
+ // ../../node_modules/@domql/utils/array.js
361
+ var unstackArrayOfObjects = (arr, exclude = []) => {
362
+ return arr.reduce(
363
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
364
+ {}
365
+ );
341
366
  };
342
367
 
343
- // ../../node_modules/@domql/utils/dist/esm/object.js
344
- var __defProp2 = Object.defineProperty;
345
- var __defProps = Object.defineProperties;
346
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
347
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
348
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
349
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
350
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
351
- var __spreadValues = (a, b) => {
352
- for (var prop in b || (b = {}))
353
- if (__hasOwnProp2.call(b, prop))
354
- __defNormalProp(a, prop, b[prop]);
355
- if (__getOwnPropSymbols)
356
- for (var prop of __getOwnPropSymbols(b)) {
357
- if (__propIsEnum.call(b, prop))
358
- __defNormalProp(a, prop, b[prop]);
359
- }
360
- return a;
361
- };
362
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
363
- var deepMerge = (element, extend, excludeFrom = []) => {
368
+ // ../../node_modules/@domql/utils/keys.js
369
+ var STATE_METHODS = [
370
+ "update",
371
+ "parse",
372
+ "clean",
373
+ "create",
374
+ "destroy",
375
+ "add",
376
+ "toggle",
377
+ "remove",
378
+ "apply",
379
+ "set",
380
+ "reset",
381
+ "replace",
382
+ "quietReplace",
383
+ "quietUpdate",
384
+ "applyReplace",
385
+ "applyFunction",
386
+ "keys",
387
+ "values",
388
+ "ref",
389
+ "rootUpdate",
390
+ "parentUpdate",
391
+ "parent",
392
+ "__element",
393
+ "__depends",
394
+ "__ref",
395
+ "__children",
396
+ "root",
397
+ "setByPath",
398
+ "setPathCollection",
399
+ "removeByPath",
400
+ "removePathCollection",
401
+ "getByPath"
402
+ ];
403
+ var PROPS_METHODS = ["update", "__element"];
404
+ var METHODS = [
405
+ "set",
406
+ "reset",
407
+ "update",
408
+ "remove",
409
+ "updateContent",
410
+ "removeContent",
411
+ "lookup",
412
+ "lookdown",
413
+ "lookdownAll",
414
+ "getRef",
415
+ "getPath",
416
+ "setNodeStyles",
417
+ "spotByPath",
418
+ "keys",
419
+ "parse",
420
+ "setProps",
421
+ "parseDeep",
422
+ "variables",
423
+ "if",
424
+ "log",
425
+ "verbose",
426
+ "warn",
427
+ "error",
428
+ "call",
429
+ "nextElement",
430
+ "previousElement"
431
+ ];
432
+ var METHODS_EXL = [
433
+ ...["node", "context", "extends", "__element", "__ref"],
434
+ ...METHODS,
435
+ ...STATE_METHODS,
436
+ ...PROPS_METHODS
437
+ ];
438
+
439
+ // ../../node_modules/@domql/utils/object.js
440
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
364
441
  for (const e in extend) {
365
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
366
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
442
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
443
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
367
444
  continue;
445
+ }
368
446
  const elementProp = element[e];
369
447
  const extendProp = extend[e];
370
448
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -382,7 +460,7 @@ var deepClone = (obj, options = {}) => {
382
460
  cleanNull = false,
383
461
  window: targetWindow,
384
462
  visited = /* @__PURE__ */ new WeakMap(),
385
- handleExtend = false
463
+ handleExtends = false
386
464
  } = options;
387
465
  if (!isObjectLike(obj) || isDOMNode(obj)) {
388
466
  return obj;
@@ -390,44 +468,46 @@ var deepClone = (obj, options = {}) => {
390
468
  if (visited.has(obj)) {
391
469
  return visited.get(obj);
392
470
  }
393
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
394
- visited.set(obj, clone2);
471
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
472
+ visited.set(obj, clone);
395
473
  for (const key in obj) {
396
- if (!Object.prototype.hasOwnProperty.call(obj, key))
397
- continue;
398
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
474
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
475
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
399
476
  continue;
477
+ }
400
478
  const value = obj[key];
401
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
479
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
402
480
  continue;
481
+ }
403
482
  if (isDOMNode(value)) {
404
- clone2[key] = value;
483
+ clone[key] = value;
405
484
  continue;
406
485
  }
407
- if (handleExtend && key === "extend" && isArray(value)) {
408
- clone2[key] = mergeArray(value, exclude);
486
+ if (handleExtends && key === "extends" && isArray(value)) {
487
+ clone[key] = unstackArrayOfObjects(value, exclude);
409
488
  continue;
410
489
  }
411
490
  if (isFunction(value) && targetWindow) {
412
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
491
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
413
492
  continue;
414
493
  }
415
494
  if (isObjectLike(value)) {
416
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
495
+ clone[key] = deepClone(value, {
496
+ ...options,
417
497
  visited
418
- }));
498
+ });
419
499
  } else {
420
- clone2[key] = value;
500
+ clone[key] = value;
421
501
  }
422
502
  }
423
- return clone2;
503
+ return clone;
424
504
  };
425
505
 
426
- // ../../node_modules/@domql/utils/dist/esm/cookie.js
506
+ // ../../node_modules/@domql/utils/cookie.js
427
507
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
428
508
 
429
509
  // src/system/font.js
430
- var import_utils8 = __toESM(require_cjs(), 1);
510
+ var import_utils10 = __toESM(require_cjs(), 1);
431
511
 
432
512
  // src/defaultConfig/index.js
433
513
  var defaultConfig_exports = {};
@@ -650,15 +730,10 @@ var getActiveConfig = (def) => {
650
730
  return FACTORY[def || FACTORY.active] || CONFIG;
651
731
  };
652
732
 
653
- // src/utils/color.js
654
- var import_globals4 = __toESM(require_cjs2(), 1);
655
-
656
733
  // src/utils/font.js
657
734
  var getDefaultOrFirstKey = (LIBRARY, key) => {
658
- if (LIBRARY[key])
659
- return LIBRARY[key].value;
660
- if (LIBRARY.default)
661
- return LIBRARY[LIBRARY.default].value;
735
+ if (LIBRARY[key]) return LIBRARY[key].value;
736
+ if (LIBRARY.default) return LIBRARY[LIBRARY.default].value;
662
737
  const hasValue = Object.keys(LIBRARY)[0];
663
738
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
664
739
  };
@@ -680,13 +755,12 @@ var getFontFaceEach = (name, weights) => {
680
755
  };
681
756
 
682
757
  // src/utils/sequence.js
683
- var import_utils4 = __toESM(require_cjs(), 1);
758
+ var import_utils6 = __toESM(require_cjs(), 1);
684
759
 
685
760
  // src/system/font.js
686
761
  var setFont = (val, key) => {
687
762
  const CSSvar = `--font-${key}`;
688
- if (!val || isArray(val) && !val[0])
689
- return;
763
+ if (!val || isArray(val) && !val[0]) return;
690
764
  const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
691
765
  return { var: CSSvar, value: val, fontFace };
692
766
  };
@@ -699,10 +773,8 @@ var setFontFamily = (val, key) => {
699
773
  const CONFIG2 = getActiveConfig();
700
774
  const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
701
775
  let { value, type } = val;
702
- if (val.isDefault)
703
- FONT_FAMILY2.default = key;
704
- if (isObject(value))
705
- value = (0, import_utils8.arrayzeValue)(value);
776
+ if (val.isDefault) FONT_FAMILY2.default = key;
777
+ if (isObject(value)) value = (0, import_utils10.arrayzeValue)(value);
706
778
  const CSSvar = `--font-family-${key}`;
707
779
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
708
780
  return { var: CSSvar, value: str, arr: value, type };