@symbo.ls/scratch 3.0.1 → 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.
package/dist/cjs/set.js CHANGED
@@ -34,23 +34,23 @@ 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);
53
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
54
  var index_exports = {};
55
55
  __export2(index_exports, {
56
56
  arrayzeValue: () => arrayzeValue3,
@@ -83,6 +83,75 @@ var require_cjs = __commonJS({
83
83
  var isString2 = (arg) => typeof arg === "string";
84
84
  var isNumber2 = (arg) => typeof arg === "number";
85
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
+ ];
86
155
  var isMobile2 = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
87
156
  async function toggleFullscreen(opts) {
88
157
  if (!document.fullscreenElement) {
@@ -264,16 +333,16 @@ __export(set_exports, {
264
333
  });
265
334
  module.exports = __toCommonJS(set_exports);
266
335
 
267
- // node_modules/@domql/utils/dist/esm/globals.js
336
+ // ../../node_modules/@domql/utils/globals.js
268
337
  var window2 = globalThis;
269
338
  var document2 = window2.document;
270
339
 
271
- // node_modules/@domql/utils/dist/esm/node.js
340
+ // ../../node_modules/@domql/utils/node.js
272
341
  var isDOMNode = (obj) => {
273
342
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
274
343
  };
275
344
 
276
- // node_modules/@domql/utils/dist/esm/types.js
345
+ // ../../node_modules/@domql/utils/types.js
277
346
  var isObject = (arg) => {
278
347
  if (arg === null) return false;
279
348
  return typeof arg === "object" && arg.constructor === Object;
@@ -291,35 +360,92 @@ var isUndefined = (arg) => {
291
360
  return arg === void 0;
292
361
  };
293
362
 
294
- // node_modules/@domql/utils/dist/esm/array.js
295
- var mergeArray = (arr, exclude = []) => {
296
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
363
+ // ../../node_modules/@domql/utils/array.js
364
+ var unstackArrayOfObjects = (arr, exclude = []) => {
365
+ return arr.reduce(
366
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
367
+ {}
368
+ );
297
369
  };
298
370
 
299
- // node_modules/@domql/utils/dist/esm/object.js
300
- var __defProp2 = Object.defineProperty;
301
- var __defProps = Object.defineProperties;
302
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
303
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
304
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
305
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
306
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
307
- var __spreadValues = (a, b) => {
308
- for (var prop in b || (b = {}))
309
- if (__hasOwnProp2.call(b, prop))
310
- __defNormalProp(a, prop, b[prop]);
311
- if (__getOwnPropSymbols)
312
- for (var prop of __getOwnPropSymbols(b)) {
313
- if (__propIsEnum.call(b, prop))
314
- __defNormalProp(a, prop, b[prop]);
315
- }
316
- return a;
317
- };
318
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
371
+ // ../../node_modules/@domql/utils/keys.js
372
+ var STATE_METHODS = [
373
+ "update",
374
+ "parse",
375
+ "clean",
376
+ "create",
377
+ "destroy",
378
+ "add",
379
+ "toggle",
380
+ "remove",
381
+ "apply",
382
+ "set",
383
+ "reset",
384
+ "replace",
385
+ "quietReplace",
386
+ "quietUpdate",
387
+ "applyReplace",
388
+ "applyFunction",
389
+ "keys",
390
+ "values",
391
+ "ref",
392
+ "rootUpdate",
393
+ "parentUpdate",
394
+ "parent",
395
+ "__element",
396
+ "__depends",
397
+ "__ref",
398
+ "__children",
399
+ "root",
400
+ "setByPath",
401
+ "setPathCollection",
402
+ "removeByPath",
403
+ "removePathCollection",
404
+ "getByPath"
405
+ ];
406
+ var PROPS_METHODS = ["update", "__element"];
407
+ var METHODS = [
408
+ "set",
409
+ "reset",
410
+ "update",
411
+ "remove",
412
+ "updateContent",
413
+ "removeContent",
414
+ "lookup",
415
+ "lookdown",
416
+ "lookdownAll",
417
+ "getRef",
418
+ "getPath",
419
+ "setNodeStyles",
420
+ "spotByPath",
421
+ "keys",
422
+ "parse",
423
+ "setProps",
424
+ "parseDeep",
425
+ "variables",
426
+ "if",
427
+ "log",
428
+ "verbose",
429
+ "warn",
430
+ "error",
431
+ "call",
432
+ "nextElement",
433
+ "previousElement"
434
+ ];
435
+ var METHODS_EXL = [
436
+ ...["node", "context", "extends", "__element", "__ref"],
437
+ ...METHODS,
438
+ ...STATE_METHODS,
439
+ ...PROPS_METHODS
440
+ ];
441
+
442
+ // ../../node_modules/@domql/utils/object.js
319
443
  var merge = (element, obj, excludeFrom = []) => {
320
444
  for (const e in obj) {
321
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj, e);
322
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
445
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
446
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
447
+ continue;
448
+ }
323
449
  const elementProp = element[e];
324
450
  const objProp = obj[e];
325
451
  if (elementProp === void 0) {
@@ -328,10 +454,12 @@ var merge = (element, obj, excludeFrom = []) => {
328
454
  }
329
455
  return element;
330
456
  };
331
- var deepMerge = (element, extend, excludeFrom = []) => {
457
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
332
458
  for (const e in extend) {
333
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
334
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
459
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
460
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
461
+ continue;
462
+ }
335
463
  const elementProp = element[e];
336
464
  const extendProp = extend[e];
337
465
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -349,7 +477,7 @@ var deepClone = (obj, options = {}) => {
349
477
  cleanNull = false,
350
478
  window: targetWindow,
351
479
  visited = /* @__PURE__ */ new WeakMap(),
352
- handleExtend = false
480
+ handleExtends = false
353
481
  } = options;
354
482
  if (!isObjectLike(obj) || isDOMNode(obj)) {
355
483
  return obj;
@@ -357,34 +485,39 @@ var deepClone = (obj, options = {}) => {
357
485
  if (visited.has(obj)) {
358
486
  return visited.get(obj);
359
487
  }
360
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
361
- visited.set(obj, clone2);
488
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
489
+ visited.set(obj, clone);
362
490
  for (const key in obj) {
363
491
  if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
364
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
492
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
493
+ continue;
494
+ }
365
495
  const value = obj[key];
366
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
496
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
497
+ continue;
498
+ }
367
499
  if (isDOMNode(value)) {
368
- clone2[key] = value;
500
+ clone[key] = value;
369
501
  continue;
370
502
  }
371
- if (handleExtend && key === "extend" && isArray(value)) {
372
- clone2[key] = mergeArray(value, exclude);
503
+ if (handleExtends && key === "extends" && isArray(value)) {
504
+ clone[key] = unstackArrayOfObjects(value, exclude);
373
505
  continue;
374
506
  }
375
507
  if (isFunction(value) && targetWindow) {
376
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
508
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
377
509
  continue;
378
510
  }
379
511
  if (isObjectLike(value)) {
380
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
512
+ clone[key] = deepClone(value, {
513
+ ...options,
381
514
  visited
382
- }));
515
+ });
383
516
  } else {
384
- clone2[key] = value;
517
+ clone[key] = value;
385
518
  }
386
519
  }
387
- return clone2;
520
+ return clone;
388
521
  };
389
522
  var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
390
523
  const excl = opts.exclude || [];
@@ -410,7 +543,7 @@ var overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakM
410
543
  return obj;
411
544
  };
412
545
 
413
- // node_modules/@domql/utils/dist/esm/cookie.js
546
+ // ../../node_modules/@domql/utils/cookie.js
414
547
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
415
548
 
416
549
  // src/defaultConfig/index.js
@@ -758,7 +891,7 @@ var getFontFaceEach = (name, weights) => {
758
891
  };
759
892
 
760
893
  // src/utils/sequence.js
761
- var import_utils4 = __toESM(require_cjs(), 1);
894
+ var import_utils6 = __toESM(require_cjs(), 1);
762
895
  var numToLetterMap = {
763
896
  "-6": "U",
764
897
  "-5": "V",
@@ -897,7 +1030,7 @@ var getSequenceValue = (value = "A", sequenceProps) => {
897
1030
  useVariable
898
1031
  } = sequenceProps;
899
1032
  if (isString(value) && value.slice(0, 2) === "--") return `var(${value})`;
900
- const prefix = `--${(0, import_utils4.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
1033
+ const prefix = `--${(0, import_utils6.toDashCase)(sequenceProps.type.replace(".", "-"))}-`;
901
1034
  const startsWithDashOrLetterRegex = /^-?[a-zA-Z]/i;
902
1035
  const startsWithDashOrLetter = startsWithDashOrLetterRegex.test(value);
903
1036
  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;
@@ -1363,7 +1496,7 @@ var getMediaTheme = (value, modifier) => {
1363
1496
  };
1364
1497
 
1365
1498
  // src/system/font.js
1366
- var import_utils11 = __toESM(require_cjs(), 1);
1499
+ var import_utils13 = __toESM(require_cjs(), 1);
1367
1500
  var setFont = (val, key) => {
1368
1501
  const CSSvar = `--font-${key}`;
1369
1502
  if (!val || isArray(val) && !val[0]) return;
@@ -1375,7 +1508,7 @@ var setFontFamily = (val, key) => {
1375
1508
  const { FONT_FAMILY: FONT_FAMILY2, FONT_FAMILY_TYPES: FONT_FAMILY_TYPES2 } = CONFIG2;
1376
1509
  let { value, type } = val;
1377
1510
  if (val.isDefault) FONT_FAMILY2.default = key;
1378
- if (isObject(value)) value = (0, import_utils11.arrayzeValue)(value);
1511
+ if (isObject(value)) value = (0, import_utils13.arrayzeValue)(value);
1379
1512
  const CSSvar = `--font-family-${key}`;
1380
1513
  const str = `${value.join(", ")}, ${FONT_FAMILY_TYPES2[type]}`;
1381
1514
  return { var: CSSvar, value: str, arr: value, type };
@@ -1457,7 +1590,7 @@ var applyTypographySequence = () => {
1457
1590
  };
1458
1591
 
1459
1592
  // src/system/spacing.js
1460
- var import_utils15 = __toESM(require_cjs(), 1);
1593
+ var import_utils17 = __toESM(require_cjs(), 1);
1461
1594
  var runThroughMedia2 = (FACTORY2) => {
1462
1595
  for (const prop in FACTORY2) {
1463
1596
  const mediaProps = FACTORY2[prop];
@@ -1508,7 +1641,7 @@ var getSpacingByKey = (value, propertyName = "padding", sequenceProps) => {
1508
1641
  if (isString(value) && (value.includes("calc") || value.includes("var"))) {
1509
1642
  return { [propertyName]: value };
1510
1643
  }
1511
- const stack = (0, import_utils15.arrayzeValue)(value);
1644
+ const stack = (0, import_utils17.arrayzeValue)(value);
1512
1645
  if (!isArray(stack)) return;
1513
1646
  if (stack.length > 1) {
1514
1647
  let suffix = "";
@@ -1577,7 +1710,7 @@ var setShadow = (value, key, suffix, prefers) => {
1577
1710
  };
1578
1711
 
1579
1712
  // src/system/timing.js
1580
- var import_utils19 = __toESM(require_cjs(), 1);
1713
+ var import_utils21 = __toESM(require_cjs(), 1);
1581
1714
  var applyTimingSequence = () => {
1582
1715
  const CONFIG2 = getActiveConfig();
1583
1716
  const { TIMING: TIMING2 } = CONFIG2;