@symbo.ls/scratch 2.11.410 → 2.11.430

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.
@@ -53,7 +53,7 @@ var require_cjs = __commonJS({
53
53
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
54
54
  var globals_exports = {};
55
55
  __export2(globals_exports, {
56
- document: () => document2,
56
+ document: () => document3,
57
57
  global: () => global,
58
58
  self: () => self,
59
59
  window: () => window2
@@ -62,7 +62,7 @@ var require_cjs = __commonJS({
62
62
  var global = globalThis;
63
63
  var self = globalThis;
64
64
  var window2 = globalThis;
65
- var document2 = window2.document;
65
+ var document3 = window2.document;
66
66
  }
67
67
  });
68
68
 
@@ -166,7 +166,7 @@ var require_globals = __commonJS({
166
166
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
167
167
  var globals_exports = {};
168
168
  __export2(globals_exports, {
169
- document: () => document2,
169
+ document: () => document3,
170
170
  global: () => global,
171
171
  self: () => self,
172
172
  window: () => window2
@@ -175,7 +175,7 @@ var require_globals = __commonJS({
175
175
  var global = globalThis;
176
176
  var self = globalThis;
177
177
  var window2 = globalThis;
178
- var document2 = window2.document;
178
+ var document3 = window2.document;
179
179
  }
180
180
  });
181
181
 
@@ -202,6 +202,7 @@ var require_node = __commonJS({
202
202
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
203
203
  var node_exports = {};
204
204
  __export2(node_exports, {
205
+ isDOMNode: () => isDOMNode,
205
206
  isHtmlElement: () => isHtmlElement,
206
207
  isNode: () => isNode
207
208
  });
@@ -213,6 +214,9 @@ var require_node = __commonJS({
213
214
  var isHtmlElement = (obj) => {
214
215
  return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
215
216
  };
217
+ var isDOMNode = (obj) => {
218
+ return typeof import_globals2.window !== "undefined" && (obj instanceof import_globals2.window.Node || obj instanceof import_globals2.window.Window || obj === import_globals2.window || obj === document);
219
+ };
216
220
  }
217
221
  });
218
222
 
@@ -378,10 +382,10 @@ var require_array = __commonJS({
378
382
  return [].concat(...arrays);
379
383
  };
380
384
  var mergeArray = (arr, excludeFrom = []) => {
381
- return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, excludeFrom), excludeFrom), {});
385
+ return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepCloneWithExtend)(c, excludeFrom), excludeFrom), {});
382
386
  };
383
387
  var mergeAndCloneIfArray = (obj) => {
384
- return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
388
+ return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepCloneWithExtend)(obj);
385
389
  };
386
390
  var cutArrayBeforeValue = (arr, value) => {
387
391
  const index = arr.indexOf(value);
@@ -487,6 +491,8 @@ var require_string = __commonJS({
487
491
  __export2(string_exports, {
488
492
  customDecodeURIComponent: () => customDecodeURIComponent,
489
493
  customEncodeURIComponent: () => customEncodeURIComponent,
494
+ decodeNewlines: () => decodeNewlines,
495
+ encodeNewlines: () => encodeNewlines,
490
496
  findKeyPosition: () => findKeyPosition,
491
497
  lowercaseFirstLetter: () => lowercaseFirstLetter,
492
498
  replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields,
@@ -590,6 +596,12 @@ var require_string = __commonJS({
590
596
  return char;
591
597
  });
592
598
  };
599
+ var encodeNewlines = (str) => {
600
+ return str.split("\n").join("/////n").split("`").join("/////tilde").split("$").join("/////dlrsgn");
601
+ };
602
+ var decodeNewlines = (encodedStr) => {
603
+ return encodedStr.split("/////n").join("\n").split("/////tilde").join("`").split("/////dlrsgn").join("$");
604
+ };
593
605
  var customEncodeURIComponent = (str) => {
594
606
  return str.split("").map((char) => {
595
607
  if (/[^a-zA-Z0-9\s]/.test(char)) {
@@ -667,6 +679,7 @@ var require_object = __commonJS({
667
679
  var import_types = require_types();
668
680
  var import_array = require_array();
669
681
  var import_string = require_string();
682
+ var import_node = require_node();
670
683
  var exec = (param, element, state, context) => {
671
684
  if ((0, import_types.isFunction)(param)) {
672
685
  return param(
@@ -745,30 +758,31 @@ var require_object = __commonJS({
745
758
  var mergeArrayExclude = (arr, excl = []) => {
746
759
  return arr.reduce((acc, curr) => deepMerge(acc, deepCloneExclude(curr, excl)), {});
747
760
  };
748
- var deepClone = (obj, excludeFrom = [], cleanUndefined = false) => {
749
- const o = (0, import_types.isArray)(obj) ? [] : {};
750
- for (const prop in obj) {
751
- if (!Object.prototype.hasOwnProperty.call(obj, prop))
752
- continue;
753
- if (prop === "__proto__")
754
- continue;
755
- if (excludeFrom.includes(prop) || prop.startsWith("__"))
756
- continue;
757
- let objProp = obj[prop];
758
- if (cleanUndefined && (0, import_types.isUndefined)(objProp))
759
- continue;
760
- if (prop === "extend" && (0, import_types.isArray)(objProp)) {
761
- objProp = (0, import_array.mergeArray)(objProp);
761
+ var deepClone = (obj, exclude = [], cleanUndefined = false, visited = /* @__PURE__ */ new WeakMap()) => {
762
+ if (!(0, import_types.isObjectLike)(obj) || (0, import_node.isDOMNode)(obj))
763
+ return obj;
764
+ if (visited.has(obj))
765
+ return visited.get(obj);
766
+ const clone2 = (0, import_types.isArray)(obj) ? [] : {};
767
+ visited.set(obj, clone2);
768
+ for (const key in obj) {
769
+ if (Object.prototype.hasOwnProperty.call(obj, key) && !exclude.includes(key)) {
770
+ const value = obj[key];
771
+ if ((0, import_node.isDOMNode)(value)) {
772
+ clone2[key] = value;
773
+ } else if (key === "extend" && (0, import_types.isArray)(value)) {
774
+ clone2[key] = (0, import_array.mergeArray)(value, exclude);
775
+ } else if ((0, import_types.isObjectLike)(value)) {
776
+ clone2[key] = deepClone(value, exclude, cleanUndefined, visited);
777
+ } else {
778
+ clone2[key] = value;
779
+ }
762
780
  }
763
- if ((0, import_types.isObjectLike)(objProp)) {
764
- o[prop] = deepClone(objProp, excludeFrom, cleanUndefined);
765
- } else
766
- o[prop] = objProp;
767
781
  }
768
- return o;
782
+ return clone2;
769
783
  };
770
784
  var deepCloneWithExtend = (obj, excludeFrom = ["node"], options = {}) => {
771
- const o = (0, import_types.isArray)(obj) ? [] : {};
785
+ const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
772
786
  for (const prop in obj) {
773
787
  if (!Object.prototype.hasOwnProperty.call(obj, prop))
774
788
  continue;
@@ -1022,7 +1036,7 @@ var require_object = __commonJS({
1022
1036
  };
1023
1037
  var overwriteDeep = (obj, params, excludeFrom = []) => {
1024
1038
  for (const e in params) {
1025
- if (e === "__proto__")
1039
+ if (e === "__ref")
1026
1040
  continue;
1027
1041
  if (excludeFrom.includes(e) || e.startsWith("__"))
1028
1042
  continue;
@@ -1076,30 +1090,40 @@ var require_object = __commonJS({
1076
1090
  }
1077
1091
  return true;
1078
1092
  };
1079
- var deepContains = (obj1, obj2) => {
1080
- if (typeof obj1 !== typeof obj2) {
1093
+ var deepContains = (obj1, obj2, ignoredKeys = ["node", "__ref"]) => {
1094
+ if (obj1 === obj2)
1095
+ return true;
1096
+ if (!(0, import_types.isObjectLike)(obj1) || !(0, import_types.isObjectLike)(obj2))
1081
1097
  return false;
1082
- }
1083
- if ((0, import_types.isObjectLike)(obj1)) {
1084
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
1085
- if (obj1.length !== obj2.length) {
1098
+ if ((0, import_node.isDOMNode)(obj1) || (0, import_node.isDOMNode)(obj2))
1099
+ return obj1 === obj2;
1100
+ const stack = [[obj1, obj2]];
1101
+ const visited = /* @__PURE__ */ new WeakSet();
1102
+ while (stack.length > 0) {
1103
+ const [current1, current2] = stack.pop();
1104
+ if (visited.has(current1))
1105
+ continue;
1106
+ visited.add(current1);
1107
+ const keys1 = Object.keys(current1).filter((key) => !ignoredKeys.includes(key));
1108
+ const keys2 = Object.keys(current2).filter((key) => !ignoredKeys.includes(key));
1109
+ if (keys1.length !== keys2.length)
1110
+ return false;
1111
+ for (const key of keys1) {
1112
+ if (!Object.prototype.hasOwnProperty.call(current2, key))
1086
1113
  return false;
1087
- }
1088
- for (let i = 0; i < obj1.length; i++) {
1089
- if (!deepContains(obj1[i], obj2[i])) {
1090
- return false;
1091
- }
1092
- }
1093
- } else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) {
1094
- for (const key in obj1) {
1095
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key);
1096
- if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) {
1114
+ const value1 = current1[key];
1115
+ const value2 = current2[key];
1116
+ if ((0, import_node.isDOMNode)(value1) || (0, import_node.isDOMNode)(value2)) {
1117
+ if (value1 !== value2)
1097
1118
  return false;
1119
+ } else if ((0, import_types.isObjectLike)(value1) && (0, import_types.isObjectLike)(value2)) {
1120
+ if (value1 !== value2) {
1121
+ stack.push([value1, value2]);
1098
1122
  }
1123
+ } else if (value1 !== value2) {
1124
+ return false;
1099
1125
  }
1100
1126
  }
1101
- } else {
1102
- return obj2 === obj1;
1103
1127
  }
1104
1128
  return true;
1105
1129
  };
@@ -1144,6 +1168,12 @@ var require_object = __commonJS({
1144
1168
  if (foundString || foundInArray)
1145
1169
  return el;
1146
1170
  }
1171
+ if (el.parent && el.parent.childExtend) {
1172
+ const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
1173
+ const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
1174
+ if (foundString || foundInArray)
1175
+ return el;
1176
+ }
1147
1177
  };
1148
1178
  var getExtendsInElement = (obj) => {
1149
1179
  let result = [];