@symbo.ls/scratch 3.0.1 → 3.1.1

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.
@@ -25,16 +25,16 @@ __export(sprite_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(sprite_exports);
27
27
 
28
- // node_modules/@domql/utils/dist/esm/globals.js
28
+ // ../../../domql/packages/utils/globals.js
29
29
  var window2 = globalThis;
30
30
  var document2 = window2.document;
31
31
 
32
- // node_modules/@domql/utils/dist/esm/node.js
32
+ // ../../../domql/packages/utils/node.js
33
33
  var isDOMNode = (obj) => {
34
34
  return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
35
35
  };
36
36
 
37
- // node_modules/@domql/utils/dist/esm/types.js
37
+ // ../../../domql/packages/utils/types.js
38
38
  var isString = (arg) => typeof arg === "string";
39
39
  var isFunction = (arg) => typeof arg === "function";
40
40
  var isNull = (arg) => arg === null;
@@ -47,35 +47,92 @@ var isUndefined = (arg) => {
47
47
  return arg === void 0;
48
48
  };
49
49
 
50
- // node_modules/@domql/utils/dist/esm/array.js
51
- var mergeArray = (arr, exclude = []) => {
52
- return arr.reduce((a, c) => deepMerge(a, deepClone(c, { exclude }), exclude), {});
50
+ // ../../../domql/packages/utils/array.js
51
+ var unstackArrayOfObjects = (arr, exclude = []) => {
52
+ return arr.reduce(
53
+ (a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
54
+ {}
55
+ );
53
56
  };
54
57
 
55
- // node_modules/@domql/utils/dist/esm/object.js
56
- var __defProp2 = Object.defineProperty;
57
- var __defProps = Object.defineProperties;
58
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
59
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
60
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
61
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
62
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
63
- var __spreadValues = (a, b) => {
64
- for (var prop in b || (b = {}))
65
- if (__hasOwnProp2.call(b, prop))
66
- __defNormalProp(a, prop, b[prop]);
67
- if (__getOwnPropSymbols)
68
- for (var prop of __getOwnPropSymbols(b)) {
69
- if (__propIsEnum.call(b, prop))
70
- __defNormalProp(a, prop, b[prop]);
71
- }
72
- return a;
73
- };
74
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
75
- var deepMerge = (element, extend, excludeFrom = []) => {
58
+ // ../../../domql/packages/utils/keys.js
59
+ var STATE_METHODS = [
60
+ "update",
61
+ "parse",
62
+ "clean",
63
+ "create",
64
+ "destroy",
65
+ "add",
66
+ "toggle",
67
+ "remove",
68
+ "apply",
69
+ "set",
70
+ "reset",
71
+ "replace",
72
+ "quietReplace",
73
+ "quietUpdate",
74
+ "applyReplace",
75
+ "applyFunction",
76
+ "keys",
77
+ "values",
78
+ "ref",
79
+ "rootUpdate",
80
+ "parentUpdate",
81
+ "parent",
82
+ "__element",
83
+ "__depends",
84
+ "__ref",
85
+ "__children",
86
+ "root",
87
+ "setByPath",
88
+ "setPathCollection",
89
+ "removeByPath",
90
+ "removePathCollection",
91
+ "getByPath"
92
+ ];
93
+ var PROPS_METHODS = ["update", "__element"];
94
+ var METHODS = [
95
+ "set",
96
+ "reset",
97
+ "update",
98
+ "remove",
99
+ "updateContent",
100
+ "removeContent",
101
+ "lookup",
102
+ "lookdown",
103
+ "lookdownAll",
104
+ "getRef",
105
+ "getPath",
106
+ "setNodeStyles",
107
+ "spotByPath",
108
+ "keys",
109
+ "parse",
110
+ "setProps",
111
+ "parseDeep",
112
+ "variables",
113
+ "if",
114
+ "log",
115
+ "verbose",
116
+ "warn",
117
+ "error",
118
+ "call",
119
+ "nextElement",
120
+ "previousElement"
121
+ ];
122
+ var METHODS_EXL = [
123
+ ...["node", "context", "extends", "__element", "__ref"],
124
+ ...METHODS,
125
+ ...STATE_METHODS,
126
+ ...PROPS_METHODS
127
+ ];
128
+
129
+ // ../../../domql/packages/utils/object.js
130
+ var deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
76
131
  for (const e in extend) {
77
- const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(extend, e);
78
- if (!hasOwnProperty2 || excludeFrom.includes(e) || e.startsWith("__")) continue;
132
+ const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
133
+ if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__")) {
134
+ continue;
135
+ }
79
136
  const elementProp = element[e];
80
137
  const extendProp = extend[e];
81
138
  if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
@@ -93,7 +150,7 @@ var deepClone = (obj, options = {}) => {
93
150
  cleanNull = false,
94
151
  window: targetWindow,
95
152
  visited = /* @__PURE__ */ new WeakMap(),
96
- handleExtend = false
153
+ handleExtends = false
97
154
  } = options;
98
155
  if (!isObjectLike(obj) || isDOMNode(obj)) {
99
156
  return obj;
@@ -101,39 +158,119 @@ var deepClone = (obj, options = {}) => {
101
158
  if (visited.has(obj)) {
102
159
  return visited.get(obj);
103
160
  }
104
- const clone2 = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
105
- visited.set(obj, clone2);
161
+ const clone = targetWindow ? isArray(obj) ? new targetWindow.Array() : new targetWindow.Object() : isArray(obj) ? [] : {};
162
+ visited.set(obj, clone);
106
163
  for (const key in obj) {
107
164
  if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
108
- if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") continue;
165
+ if (exclude.includes(key) || key.startsWith("__") || key === "__proto__") {
166
+ continue;
167
+ }
109
168
  const value = obj[key];
110
- if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) continue;
169
+ if (cleanUndefined && isUndefined(value) || cleanNull && isNull(value)) {
170
+ continue;
171
+ }
111
172
  if (isDOMNode(value)) {
112
- clone2[key] = value;
173
+ clone[key] = value;
113
174
  continue;
114
175
  }
115
- if (handleExtend && key === "extend" && isArray(value)) {
116
- clone2[key] = mergeArray(value, exclude);
176
+ if (handleExtends && key === "extends" && isArray(value)) {
177
+ clone[key] = unstackArrayOfObjects(value, exclude);
117
178
  continue;
118
179
  }
119
180
  if (isFunction(value) && targetWindow) {
120
- clone2[key] = targetWindow.eval("(" + value.toString() + ")");
181
+ clone[key] = targetWindow.eval("(" + value.toString() + ")");
121
182
  continue;
122
183
  }
123
184
  if (isObjectLike(value)) {
124
- clone2[key] = deepClone(value, __spreadProps(__spreadValues({}, options), {
185
+ clone[key] = deepClone(value, {
186
+ ...options,
125
187
  visited
126
- }));
188
+ });
127
189
  } else {
128
- clone2[key] = value;
190
+ clone[key] = value;
129
191
  }
130
192
  }
131
- return clone2;
193
+ return clone;
132
194
  };
133
195
 
134
- // node_modules/@domql/utils/dist/esm/cookie.js
196
+ // ../../../domql/packages/utils/cookie.js
135
197
  var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
136
198
 
199
+ // ../../../domql/packages/event/dist/esm/keys.js
200
+ var STATE_METHODS2 = [
201
+ "update",
202
+ "parse",
203
+ "clean",
204
+ "create",
205
+ "destroy",
206
+ "add",
207
+ "toggle",
208
+ "remove",
209
+ "apply",
210
+ "set",
211
+ "reset",
212
+ "replace",
213
+ "quietReplace",
214
+ "quietUpdate",
215
+ "applyReplace",
216
+ "applyFunction",
217
+ "keys",
218
+ "values",
219
+ "ref",
220
+ "rootUpdate",
221
+ "parentUpdate",
222
+ "parent",
223
+ "__element",
224
+ "__depends",
225
+ "__ref",
226
+ "__children",
227
+ "root",
228
+ "setByPath",
229
+ "setPathCollection",
230
+ "removeByPath",
231
+ "removePathCollection",
232
+ "getByPath"
233
+ ];
234
+ var PROPS_METHODS2 = ["update", "__element"];
235
+ var METHODS2 = [
236
+ "set",
237
+ "reset",
238
+ "update",
239
+ "remove",
240
+ "updateContent",
241
+ "removeContent",
242
+ "lookup",
243
+ "lookdown",
244
+ "lookdownAll",
245
+ "getRef",
246
+ "getPath",
247
+ "setNodeStyles",
248
+ "spotByPath",
249
+ "keys",
250
+ "parse",
251
+ "setProps",
252
+ "parseDeep",
253
+ "variables",
254
+ "if",
255
+ "log",
256
+ "verbose",
257
+ "warn",
258
+ "error",
259
+ "call",
260
+ "nextElement",
261
+ "previousElement"
262
+ ];
263
+ var METHODS_EXL2 = [
264
+ ...["node", "context", "extends", "__element", "__ref"],
265
+ ...METHODS2,
266
+ ...STATE_METHODS2,
267
+ ...PROPS_METHODS2
268
+ ];
269
+
270
+ // ../../../domql/packages/event/dist/esm/globals.js
271
+ var window3 = globalThis;
272
+ var document3 = window3.document;
273
+
137
274
  // src/defaultConfig/index.js
138
275
  var defaultConfig_exports = {};
139
276
  __export(defaultConfig_exports, {
@@ -356,6 +493,8 @@ var getActiveConfig = (def) => {
356
493
  };
357
494
 
358
495
  // src/utils/sprite.js
496
+ var ENV = "development";
497
+ var isDev = ENV === "development" || ENV === "testing";
359
498
  var generateSprite = (icons) => {
360
499
  const CONFIG2 = getActiveConfig();
361
500
  let sprite = "";
@@ -369,7 +508,8 @@ var generateSprite = (icons) => {
369
508
  var parseRootAttributes = (htmlString) => {
370
509
  const val = htmlString.default || htmlString;
371
510
  if (!isString(val)) {
372
- return console.warn(`parseRootAttributes: ${val} is not a string`);
511
+ if (isDev) console.warn("parseRootAttributes:", val, "is not a string");
512
+ return;
373
513
  }
374
514
  const match = val.match(/<svg\s+(.*?)>/);
375
515
  if (!match || !match[1]) {