@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: () => arrayzeValue,
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,20 +310,15 @@ 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 arrayzeValue = (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
  });
@@ -281,59 +341,114 @@ __export(sequence_exports, {
281
341
  });
282
342
  module.exports = __toCommonJS(sequence_exports);
283
343
 
284
- // ../../node_modules/@domql/utils/dist/esm/globals.js
344
+ // ../../node_modules/@domql/utils/globals.js
285
345
  var window2 = globalThis;
286
346
  var document2 = window2.document;
287
347
 
288
- // ../../node_modules/@domql/utils/dist/esm/node.js
348
+ // ../../node_modules/@domql/utils/node.js
289
349
  var isDOMNode = (obj) => {
290
350
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
291
351
  };
292
352
 
293
- // ../../node_modules/@domql/utils/dist/esm/types.js
353
+ // ../../node_modules/@domql/utils/types.js
294
354
  var isString = (arg) => typeof arg === "string";
295
355
  var isFunction = (arg) => typeof arg === "function";
296
356
  var isNull = (arg) => arg === null;
297
357
  var isArray = (arg) => Array.isArray(arg);
298
358
  var isObjectLike = (arg) => {
299
- if (arg === null)
300
- return false;
359
+ if (arg === null) return false;
301
360
  return typeof arg === "object";
302
361
  };
303
362
  var isUndefined = (arg) => {
304
363
  return arg === void 0;
305
364
  };
306
365
 
307
- // ../../node_modules/@domql/utils/dist/esm/array.js
308
- var mergeArray = (arr, exclude = []) => {
309
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
310
- };
311
-
312
- // ../../node_modules/@domql/utils/dist/esm/object.js
313
- var __defProp2 = Object.defineProperty;
314
- var __defProps = Object.defineProperties;
315
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
316
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
317
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
318
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
319
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
320
- var __spreadValues = (a, b) => {
321
- for (var prop in b || (b = {}))
322
- if (__hasOwnProp2.call(b, prop))
323
- __defNormalProp(a, prop, b[prop]);
324
- if (__getOwnPropSymbols)
325
- for (var prop of __getOwnPropSymbols(b)) {
326
- if (__propIsEnum.call(b, prop))
327
- __defNormalProp(a, prop, b[prop]);
328
- }
329
- return a;
330
- };
331
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
332
- var deepMerge = (element, extend, excludeFrom = []) => {
366
+ // ../../node_modules/@domql/utils/array.js
367
+ var unstackArrayOfObjects = (arr, exclude = []) => {
368
+ return arr.reduce(
369
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
370
+ {}
371
+ );
372
+ };
373
+
374
+ // ../../node_modules/@domql/utils/keys.js
375
+ var STATE_METHODS = [
376
+ "update",
377
+ "parse",
378
+ "clean",
379
+ "create",
380
+ "destroy",
381
+ "add",
382
+ "toggle",
383
+ "remove",
384
+ "apply",
385
+ "set",
386
+ "reset",
387
+ "replace",
388
+ "quietReplace",
389
+ "quietUpdate",
390
+ "applyReplace",
391
+ "applyFunction",
392
+ "keys",
393
+ "values",
394
+ "ref",
395
+ "rootUpdate",
396
+ "parentUpdate",
397
+ "parent",
398
+ "__element",
399
+ "__depends",
400
+ "__ref",
401
+ "__children",
402
+ "root",
403
+ "setByPath",
404
+ "setPathCollection",
405
+ "removeByPath",
406
+ "removePathCollection",
407
+ "getByPath"
408
+ ];
409
+ var PROPS_METHODS = ["update", "__element"];
410
+ var METHODS = [
411
+ "set",
412
+ "reset",
413
+ "update",
414
+ "remove",
415
+ "updateContent",
416
+ "removeContent",
417
+ "lookup",
418
+ "lookdown",
419
+ "lookdownAll",
420
+ "getRef",
421
+ "getPath",
422
+ "setNodeStyles",
423
+ "spotByPath",
424
+ "keys",
425
+ "parse",
426
+ "setProps",
427
+ "parseDeep",
428
+ "variables",
429
+ "if",
430
+ "log",
431
+ "verbose",
432
+ "warn",
433
+ "error",
434
+ "call",
435
+ "nextElement",
436
+ "previousElement"
437
+ ];
438
+ var METHODS_EXL = [
439
+ ...["node", "context", "extends", "__element", "__ref"],
440
+ ...METHODS,
441
+ ...STATE_METHODS,
442
+ ...PROPS_METHODS
443
+ ];
444
+
445
+ // ../../node_modules/@domql/utils/object.js
446
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
333
447
  for (const e in extend) {
334
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
335
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__"))
448
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
449
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
336
450
  continue;
451
+ }
337
452
  const elementProp = element[e];
338
453
  const extendProp = extend[e];
339
454
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -351,7 +466,7 @@ var deepClone = (obj, options = {}) => {
351
466
  cleanNull = false,
352
467
  window: targetWindow,
353
468
  visited = /* @__PURE__ */ new WeakMap(),
354
- handleExtend = false
469
+ handleExtends = false
355
470
  } = options;
356
471
  if (!isObjectLike(obj) || isDOMNode(obj)) {
357
472
  return obj;
@@ -359,44 +474,46 @@ var deepClone = (obj, options = {}) => {
359
474
  if (visited.has(obj)) {
360
475
  return visited.get(obj);
361
476
  }
362
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
363
- visited.set(obj, clone2);
477
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
478
+ visited.set(obj, clone);
364
479
  for (const key in obj) {
365
- if (!Object.prototype.hasOwnProperty.call(obj, key))
366
- continue;
367
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__")
480
+ if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
481
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
368
482
  continue;
483
+ }
369
484
  const value = obj[key];
370
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value))
485
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
371
486
  continue;
487
+ }
372
488
  if (isDOMNode(value)) {
373
- clone2[key] = value;
489
+ clone[key] = value;
374
490
  continue;
375
491
  }
376
- if (handleExtend && key === "extend" && isArray(value)) {
377
- clone2[key] = mergeArray(value, exclude);
492
+ if (handleExtends && key === "extends" && isArray(value)) {
493
+ clone[key] = unstackArrayOfObjects(value, exclude);
378
494
  continue;
379
495
  }
380
496
  if (isFunction(value) && targetWindow) {
381
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
497
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
382
498
  continue;
383
499
  }
384
500
  if (isObjectLike(value)) {
385
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
501
+ clone[key] = deepClone(value, {
502
+ ...options,
386
503
  visited
387
- }));
504
+ });
388
505
  } else {
389
- clone2[key] = value;
506
+ clone[key] = value;
390
507
  }
391
508
  }
392
- return clone2;
509
+ return clone;
393
510
  };
394
511
 
395
- // ../../node_modules/@domql/utils/dist/esm/cookie.js
512
+ // ../../node_modules/@domql/utils/cookie.js
396
513
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
397
514
 
398
515
  // src/utils/sequence.js
399
- var import_utils3 = __toESM(require_cjs(), 1);
516
+ var import_utils5 = __toESM(require_cjs(), 1);
400
517
 
401
518
  // src/defaultConfig/index.js
402
519
  var defaultConfig_exports = {};
@@ -670,8 +787,7 @@ var setSequenceValue = (props, sequenceProps) => {
670
787
  var setScalingVar = (key, sequenceProps) => {
671
788
  const { base, type, unit } = sequenceProps;
672
789
  const defaultVal = (isScalingUnit(unit) ? 1 : base) + unit;
673
- if (key === 0)
674
- return defaultVal;
790
+ if (key === 0) return defaultVal;
675
791
  const prefix = "--" + (type && type.replace(".", "-"));
676
792
  const ratioVar = `${prefix}-ratio`;
677
793
  if (key > 0) {
@@ -708,10 +824,8 @@ var generateSubSequence = (props, sequenceProps) => {
708
824
  const diffRounded = ~~next - ~~value;
709
825
  let arr;
710
826
  const [first, middle, second] = getSubratioDifference(value, ratio);
711
- if (diffRounded > 16)
712
- arr = [first, middle, second];
713
- else
714
- arr = [first, second];
827
+ if (diffRounded > 16) arr = [first, middle, second];
828
+ else arr = [first, second];
715
829
  arr.forEach((v, k) => {
716
830
  const scaling = ~~(v / base * 1e3) / 1e3;
717
831
  const newVar = variable + (k + 1);
@@ -753,14 +867,13 @@ var generateSequence = (sequenceProps) => {
753
867
  index: key
754
868
  };
755
869
  setSequenceValue(props, sequenceProps);
756
- if (subSequence)
757
- generateSubSequence(props, sequenceProps);
870
+ if (subSequence) generateSubSequence(props, sequenceProps);
758
871
  }
759
872
  return sequenceProps;
760
873
  };
761
874
  var generateSequencePosition = (sequenceProps, position = 0) => {
762
875
  const { type, base, ratio, subSequence } = sequenceProps;
763
- const letterKey = isString(position) ? position : numToLetterMap[position];
876
+ const letterKey = (void 0).call("isString", position) ? position : numToLetterMap[position];
764
877
  if (!letterKey) {
765
878
  console.warn(`Position ${position} is out of range in numToLetterMap`);
766
879
  return null;
@@ -800,13 +913,11 @@ var getSequenceValue = (value = "A", sequenceProps) => {
800
913
  unit = UNIT2.default,
801
914
  useVariable
802
915
  } = sequenceProps;
803
- if (isString(value) && value.slice(0, 2) === "--")
804
- return `var(${value})`;
805
- const prefix = `--${(0, import_utils3.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
916
+ if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
917
+ const prefix = `--${(0, import_utils5.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
806
918
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
807
919
  const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
808
- if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter)
809
- return value;
920
+ if (value === "none" || value === "auto" || value === "unset" || value === "inherit" || value === "fit-content" || value === "min-content" || value === "max-content" || value.includes("calc") || value.includes("var") || !startsWithDashOrLetter) return value;
810
921
  const letterVal = value.toUpperCase();
811
922
  const isNegative = letterVal.slice(0, 1) === "-" ? "-" : "";
812
923
  let absValue = isNegative ? letterVal.slice(1) : letterVal;
@@ -830,8 +941,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
830
941
  return isNegative ? `calc((${joint}) * -1)` : `calc(${joint})`;
831
942
  }
832
943
  if (!sequence[absValue] && absValue.length === 2) {
833
- if (CONFIG2.verbose)
834
- console.warn(absValue, "- value is not found because `subSequence` is set to false");
944
+ if (CONFIG2.verbose) console.warn(absValue, "- value is not found because `subSequence` is set to false");
835
945
  absValue = absValue.slice(0, 1);
836
946
  }
837
947
  if (useVariable || CONFIG2.useVariable) {
@@ -839,8 +949,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
839
949
  return isNegative ? `calc(${varValue2} * -1)` : varValue2;
840
950
  }
841
951
  const sequenceItem = sequence ? sequence[absValue] : null;
842
- if (!sequenceItem)
843
- return console.warn("can't find", sequence, absValue);
952
+ if (!sequenceItem) return console.warn("can't find", sequence, absValue);
844
953
  if (unit === "ms" || unit === "s") {
845
954
  return isNegative + sequenceItem.val + unit;
846
955
  }
@@ -849,12 +958,10 @@ var getSequenceValue = (value = "A", sequenceProps) => {
849
958
  var getSequenceValuePropertyPair = (value, propertyName, sequenceProps) => {
850
959
  if (typeof value !== "string") {
851
960
  const CONFIG2 = getActiveConfig();
852
- if (CONFIG2.verbose)
853
- console.warn(propertyName, value, "is not a string");
961
+ if (CONFIG2.verbose) console.warn(propertyName, value, "is not a string");
854
962
  return { [propertyName]: value };
855
963
  }
856
- if (value === "-" || value === "")
857
- return {};
964
+ if (value === "-" || value === "") return {};
858
965
  return { [propertyName]: getSequenceValue(value, sequenceProps) };
859
966
  };
860
967
  var findHeadingLetter = (h1Matches, index) => numToLetterMap[h1Matches - index];