@symbo.ls/scratch 2.11.36 → 2.11.92
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/factory.js +127 -9
- package/dist/cjs/index.js +233 -102
- package/dist/cjs/set.js +214 -85
- package/dist/cjs/system/color.js +177 -51
- package/dist/cjs/system/document.js +145 -26
- package/dist/cjs/system/font.js +143 -24
- package/dist/cjs/system/index.js +219 -90
- package/dist/cjs/system/reset.js +164 -42
- package/dist/cjs/system/spacing.js +147 -28
- package/dist/cjs/system/svg.js +147 -28
- package/dist/cjs/system/theme.js +184 -58
- package/dist/cjs/system/timing.js +143 -24
- package/dist/cjs/system/typography.js +147 -28
- package/dist/cjs/transforms/index.js +189 -63
- package/dist/cjs/utils/color.js +1044 -2
- package/dist/cjs/utils/index.js +171 -33
- package/dist/cjs/utils/sequence.js +131 -13
- package/dist/cjs/utils/sprite.js +127 -9
- package/dist/cjs/utils/var.js +127 -9
- package/package.json +2 -2
- package/src/system/color.js +5 -19
- package/src/system/reset.js +7 -3
- package/src/utils/color.js +22 -3
package/dist/cjs/utils/color.js
CHANGED
|
@@ -66,12 +66,1035 @@ var require_cjs = __commonJS({
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
|
|
69
|
+
// ../../node_modules/@domql/key/dist/cjs/index.js
|
|
70
|
+
var require_cjs2 = __commonJS({
|
|
71
|
+
"../../node_modules/@domql/key/dist/cjs/index.js"(exports, module2) {
|
|
72
|
+
"use strict";
|
|
73
|
+
var __defProp2 = Object.defineProperty;
|
|
74
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
75
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
76
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
77
|
+
var __export2 = (target, all) => {
|
|
78
|
+
for (var name in all)
|
|
79
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
80
|
+
};
|
|
81
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
82
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
83
|
+
for (let key of __getOwnPropNames2(from))
|
|
84
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
85
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
86
|
+
}
|
|
87
|
+
return to;
|
|
88
|
+
};
|
|
89
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
90
|
+
var key_exports = {};
|
|
91
|
+
__export2(key_exports, {
|
|
92
|
+
createKey: () => createKey,
|
|
93
|
+
createSnapshotId: () => createSnapshotId
|
|
94
|
+
});
|
|
95
|
+
module2.exports = __toCommonJS2(key_exports);
|
|
96
|
+
var createKey = function() {
|
|
97
|
+
let index = 0;
|
|
98
|
+
function newId() {
|
|
99
|
+
index++;
|
|
100
|
+
return index;
|
|
101
|
+
}
|
|
102
|
+
return newId;
|
|
103
|
+
}();
|
|
104
|
+
var createSnapshotId = createKey;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// ../../node_modules/@domql/tags/dist/cjs/htmlTags.js
|
|
109
|
+
var require_htmlTags = __commonJS({
|
|
110
|
+
"../../node_modules/@domql/tags/dist/cjs/htmlTags.js"(exports, module2) {
|
|
111
|
+
"use strict";
|
|
112
|
+
var __defProp2 = Object.defineProperty;
|
|
113
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
114
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
115
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
116
|
+
var __export2 = (target, all) => {
|
|
117
|
+
for (var name in all)
|
|
118
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
119
|
+
};
|
|
120
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
121
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
122
|
+
for (let key of __getOwnPropNames2(from))
|
|
123
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
124
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
125
|
+
}
|
|
126
|
+
return to;
|
|
127
|
+
};
|
|
128
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
129
|
+
var htmlTags_exports = {};
|
|
130
|
+
__export2(htmlTags_exports, {
|
|
131
|
+
HTML_TAGS: () => HTML_TAGS
|
|
132
|
+
});
|
|
133
|
+
module2.exports = __toCommonJS2(htmlTags_exports);
|
|
134
|
+
var HTML_TAGS = {
|
|
135
|
+
root: [
|
|
136
|
+
"body",
|
|
137
|
+
"html"
|
|
138
|
+
],
|
|
139
|
+
head: [
|
|
140
|
+
"title",
|
|
141
|
+
"base",
|
|
142
|
+
"meta",
|
|
143
|
+
"style"
|
|
144
|
+
],
|
|
145
|
+
body: [
|
|
146
|
+
"string",
|
|
147
|
+
"fragment",
|
|
148
|
+
"a",
|
|
149
|
+
"abbr",
|
|
150
|
+
"acronym",
|
|
151
|
+
"address",
|
|
152
|
+
"applet",
|
|
153
|
+
"area",
|
|
154
|
+
"article",
|
|
155
|
+
"aside",
|
|
156
|
+
"audio",
|
|
157
|
+
"b",
|
|
158
|
+
"basefont",
|
|
159
|
+
"bdi",
|
|
160
|
+
"bdo",
|
|
161
|
+
"big",
|
|
162
|
+
"blockquote",
|
|
163
|
+
"br",
|
|
164
|
+
"button",
|
|
165
|
+
"canvas",
|
|
166
|
+
"caption",
|
|
167
|
+
"center",
|
|
168
|
+
"cite",
|
|
169
|
+
"code",
|
|
170
|
+
"col",
|
|
171
|
+
"colgroup",
|
|
172
|
+
"data",
|
|
173
|
+
"datalist",
|
|
174
|
+
"dd",
|
|
175
|
+
"del",
|
|
176
|
+
"details",
|
|
177
|
+
"dfn",
|
|
178
|
+
"dialog",
|
|
179
|
+
"dir",
|
|
180
|
+
"div",
|
|
181
|
+
"dl",
|
|
182
|
+
"dt",
|
|
183
|
+
"em",
|
|
184
|
+
"embed",
|
|
185
|
+
"fieldset",
|
|
186
|
+
"figcaption",
|
|
187
|
+
"figure",
|
|
188
|
+
"font",
|
|
189
|
+
"footer",
|
|
190
|
+
"form",
|
|
191
|
+
"frame",
|
|
192
|
+
"frameset",
|
|
193
|
+
"h1",
|
|
194
|
+
"h2",
|
|
195
|
+
"h3",
|
|
196
|
+
"h4",
|
|
197
|
+
"h5",
|
|
198
|
+
"h6",
|
|
199
|
+
"head",
|
|
200
|
+
"header",
|
|
201
|
+
"hr",
|
|
202
|
+
"i",
|
|
203
|
+
"iframe",
|
|
204
|
+
"img",
|
|
205
|
+
"input",
|
|
206
|
+
"ins",
|
|
207
|
+
"kbd",
|
|
208
|
+
"label",
|
|
209
|
+
"legend",
|
|
210
|
+
"li",
|
|
211
|
+
"link",
|
|
212
|
+
"main",
|
|
213
|
+
"map",
|
|
214
|
+
"mark",
|
|
215
|
+
"meter",
|
|
216
|
+
"nav",
|
|
217
|
+
"noframes",
|
|
218
|
+
"noscript",
|
|
219
|
+
"object",
|
|
220
|
+
"ol",
|
|
221
|
+
"optgroup",
|
|
222
|
+
"option",
|
|
223
|
+
"output",
|
|
224
|
+
"p",
|
|
225
|
+
"param",
|
|
226
|
+
"picture",
|
|
227
|
+
"pre",
|
|
228
|
+
"progress",
|
|
229
|
+
"q",
|
|
230
|
+
"rp",
|
|
231
|
+
"rt",
|
|
232
|
+
"ruby",
|
|
233
|
+
"s",
|
|
234
|
+
"samp",
|
|
235
|
+
"script",
|
|
236
|
+
"section",
|
|
237
|
+
"select",
|
|
238
|
+
"small",
|
|
239
|
+
"source",
|
|
240
|
+
"span",
|
|
241
|
+
"strike",
|
|
242
|
+
"strong",
|
|
243
|
+
"sub",
|
|
244
|
+
"summary",
|
|
245
|
+
"sup",
|
|
246
|
+
"table",
|
|
247
|
+
"tbody",
|
|
248
|
+
"td",
|
|
249
|
+
"template",
|
|
250
|
+
"textarea",
|
|
251
|
+
"tfoot",
|
|
252
|
+
"th",
|
|
253
|
+
"thead",
|
|
254
|
+
"time",
|
|
255
|
+
"tr",
|
|
256
|
+
"track",
|
|
257
|
+
"tt",
|
|
258
|
+
"u",
|
|
259
|
+
"ul",
|
|
260
|
+
"var",
|
|
261
|
+
"video",
|
|
262
|
+
"wbr",
|
|
263
|
+
// SVG
|
|
264
|
+
"svg",
|
|
265
|
+
"path"
|
|
266
|
+
]
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
// ../../node_modules/@domql/tags/dist/cjs/index.js
|
|
272
|
+
var require_cjs3 = __commonJS({
|
|
273
|
+
"../../node_modules/@domql/tags/dist/cjs/index.js"(exports, module2) {
|
|
274
|
+
"use strict";
|
|
275
|
+
var __defProp2 = Object.defineProperty;
|
|
276
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
277
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
278
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
279
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
280
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
281
|
+
for (let key of __getOwnPropNames2(from))
|
|
282
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
283
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
284
|
+
}
|
|
285
|
+
return to;
|
|
286
|
+
};
|
|
287
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
288
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
289
|
+
var tags_exports = {};
|
|
290
|
+
module2.exports = __toCommonJS2(tags_exports);
|
|
291
|
+
__reExport(tags_exports, require_htmlTags(), module2.exports);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// ../../node_modules/@domql/utils/dist/cjs/node.js
|
|
296
|
+
var require_node = __commonJS({
|
|
297
|
+
"../../node_modules/@domql/utils/dist/cjs/node.js"(exports, module2) {
|
|
298
|
+
"use strict";
|
|
299
|
+
var __defProp2 = Object.defineProperty;
|
|
300
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
301
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
302
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
303
|
+
var __export2 = (target, all) => {
|
|
304
|
+
for (var name in all)
|
|
305
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
306
|
+
};
|
|
307
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
308
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
309
|
+
for (let key of __getOwnPropNames2(from))
|
|
310
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
311
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
312
|
+
}
|
|
313
|
+
return to;
|
|
314
|
+
};
|
|
315
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
316
|
+
var node_exports = {};
|
|
317
|
+
__export2(node_exports, {
|
|
318
|
+
isHtmlElement: () => isHtmlElement,
|
|
319
|
+
isNode: () => isNode
|
|
320
|
+
});
|
|
321
|
+
module2.exports = __toCommonJS2(node_exports);
|
|
322
|
+
var import_globals2 = require_cjs();
|
|
323
|
+
var isNode = (obj) => {
|
|
324
|
+
return (typeof Node === "object" ? obj instanceof import_globals2.window.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
|
|
325
|
+
};
|
|
326
|
+
var isHtmlElement = (obj) => {
|
|
327
|
+
return (typeof HTMLElement === "object" ? obj instanceof import_globals2.window.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
// ../../node_modules/@domql/utils/dist/cjs/types.js
|
|
333
|
+
var require_types = __commonJS({
|
|
334
|
+
"../../node_modules/@domql/utils/dist/cjs/types.js"(exports, module2) {
|
|
335
|
+
"use strict";
|
|
336
|
+
var __defProp2 = Object.defineProperty;
|
|
337
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
338
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
339
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
340
|
+
var __export2 = (target, all) => {
|
|
341
|
+
for (var name in all)
|
|
342
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
343
|
+
};
|
|
344
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
345
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
346
|
+
for (let key of __getOwnPropNames2(from))
|
|
347
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
348
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
349
|
+
}
|
|
350
|
+
return to;
|
|
351
|
+
};
|
|
352
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
353
|
+
var types_exports = {};
|
|
354
|
+
__export2(types_exports, {
|
|
355
|
+
TYPES: () => TYPES,
|
|
356
|
+
is: () => is,
|
|
357
|
+
isArray: () => isArray,
|
|
358
|
+
isBoolean: () => isBoolean,
|
|
359
|
+
isDefined: () => isDefined,
|
|
360
|
+
isFunction: () => isFunction,
|
|
361
|
+
isNot: () => isNot,
|
|
362
|
+
isNull: () => isNull,
|
|
363
|
+
isNumber: () => isNumber2,
|
|
364
|
+
isObject: () => isObject,
|
|
365
|
+
isObjectLike: () => isObjectLike,
|
|
366
|
+
isString: () => isString2,
|
|
367
|
+
isUndefined: () => isUndefined,
|
|
368
|
+
isValidHtmlTag: () => isValidHtmlTag
|
|
369
|
+
});
|
|
370
|
+
module2.exports = __toCommonJS2(types_exports);
|
|
371
|
+
var import_tags = require_cjs3();
|
|
372
|
+
var import_node = require_node();
|
|
373
|
+
var isValidHtmlTag = (arg) => import_tags.HTML_TAGS.body.includes(arg);
|
|
374
|
+
var isObject = (arg) => {
|
|
375
|
+
if (arg === null)
|
|
376
|
+
return false;
|
|
377
|
+
return typeof arg === "object" && arg.constructor === Object;
|
|
378
|
+
};
|
|
379
|
+
var isString2 = (arg) => typeof arg === "string";
|
|
380
|
+
var isNumber2 = (arg) => typeof arg === "number";
|
|
381
|
+
var isFunction = (arg) => typeof arg === "function";
|
|
382
|
+
var isBoolean = (arg) => arg === true || arg === false;
|
|
383
|
+
var isNull = (arg) => arg === null;
|
|
384
|
+
var isArray = (arg) => Array.isArray(arg);
|
|
385
|
+
var isObjectLike = (arg) => {
|
|
386
|
+
if (arg === null)
|
|
387
|
+
return false;
|
|
388
|
+
return typeof arg === "object";
|
|
389
|
+
};
|
|
390
|
+
var isDefined = (arg) => {
|
|
391
|
+
return isObject(arg) || isObjectLike(arg) || isString2(arg) || isNumber2(arg) || isFunction(arg) || isArray(arg) || isObjectLike(arg) || isBoolean(arg) || isNull(arg);
|
|
392
|
+
};
|
|
393
|
+
var isUndefined = (arg) => {
|
|
394
|
+
return arg === void 0;
|
|
395
|
+
};
|
|
396
|
+
var TYPES = {
|
|
397
|
+
boolean: isBoolean,
|
|
398
|
+
array: isArray,
|
|
399
|
+
object: isObject,
|
|
400
|
+
string: isString2,
|
|
401
|
+
number: isNumber2,
|
|
402
|
+
null: isNull,
|
|
403
|
+
function: isFunction,
|
|
404
|
+
objectLike: isObjectLike,
|
|
405
|
+
node: import_node.isNode,
|
|
406
|
+
htmlElement: import_node.isHtmlElement,
|
|
407
|
+
defined: isDefined
|
|
408
|
+
};
|
|
409
|
+
var is = (arg) => {
|
|
410
|
+
return (...args) => {
|
|
411
|
+
return args.map((val) => TYPES[val](arg)).filter((v) => v).length > 0;
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
var isNot = (arg) => {
|
|
415
|
+
return (...args) => {
|
|
416
|
+
return args.map((val) => TYPES[val](arg)).filter((v) => v).length === 0;
|
|
417
|
+
};
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
// ../../node_modules/@domql/utils/dist/cjs/array.js
|
|
423
|
+
var require_array = __commonJS({
|
|
424
|
+
"../../node_modules/@domql/utils/dist/cjs/array.js"(exports, module2) {
|
|
425
|
+
"use strict";
|
|
426
|
+
var __defProp2 = Object.defineProperty;
|
|
427
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
428
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
429
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
430
|
+
var __export2 = (target, all) => {
|
|
431
|
+
for (var name in all)
|
|
432
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
433
|
+
};
|
|
434
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
435
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
436
|
+
for (let key of __getOwnPropNames2(from))
|
|
437
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
438
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
439
|
+
}
|
|
440
|
+
return to;
|
|
441
|
+
};
|
|
442
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
443
|
+
var array_exports = {};
|
|
444
|
+
__export2(array_exports, {
|
|
445
|
+
arrayContainsOtherArray: () => arrayContainsOtherArray,
|
|
446
|
+
createNestedObject: () => createNestedObject,
|
|
447
|
+
cutArrayAfterValue: () => cutArrayAfterValue,
|
|
448
|
+
cutArrayBeforeValue: () => cutArrayBeforeValue,
|
|
449
|
+
joinArrays: () => joinArrays,
|
|
450
|
+
mergeAndCloneIfArray: () => mergeAndCloneIfArray,
|
|
451
|
+
mergeArray: () => mergeArray,
|
|
452
|
+
removeFromArray: () => removeFromArray,
|
|
453
|
+
swapItemsInArray: () => swapItemsInArray
|
|
454
|
+
});
|
|
455
|
+
module2.exports = __toCommonJS2(array_exports);
|
|
456
|
+
var import_object = require_object();
|
|
457
|
+
var import_types = require_types();
|
|
458
|
+
var arrayContainsOtherArray = (arr1, arr2) => {
|
|
459
|
+
return arr2.every((val) => arr1.includes(val));
|
|
460
|
+
};
|
|
461
|
+
var removeFromArray = (arr, index) => {
|
|
462
|
+
if ((0, import_types.isString)(index))
|
|
463
|
+
index = parseInt(index);
|
|
464
|
+
if ((0, import_types.isNumber)(index)) {
|
|
465
|
+
if (index < 0 || index >= arr.length || isNaN(index)) {
|
|
466
|
+
throw new Error("Invalid index");
|
|
467
|
+
}
|
|
468
|
+
arr.splice(index, 1);
|
|
469
|
+
} else if ((0, import_types.isArray)(index)) {
|
|
470
|
+
index.forEach((idx) => removeFromArray(arr, idx));
|
|
471
|
+
} else {
|
|
472
|
+
throw new Error("Invalid index");
|
|
473
|
+
}
|
|
474
|
+
return arr;
|
|
475
|
+
};
|
|
476
|
+
var swapItemsInArray = (arr, i, j) => {
|
|
477
|
+
[arr[i], arr[j]] = [arr[j], arr[i]];
|
|
478
|
+
};
|
|
479
|
+
var joinArrays = (...arrays) => {
|
|
480
|
+
return [].concat(...arrays);
|
|
481
|
+
};
|
|
482
|
+
var mergeArray = (arr, excludeFrom = []) => {
|
|
483
|
+
return arr.reduce((a, c) => (0, import_object.deepMerge)(a, (0, import_object.deepClone)(c, excludeFrom), excludeFrom), {});
|
|
484
|
+
};
|
|
485
|
+
var mergeAndCloneIfArray = (obj) => {
|
|
486
|
+
return (0, import_types.isArray)(obj) ? mergeArray(obj) : (0, import_object.deepClone)(obj);
|
|
487
|
+
};
|
|
488
|
+
var cutArrayBeforeValue = (arr, value) => {
|
|
489
|
+
const index = arr.indexOf(value);
|
|
490
|
+
if (index !== -1) {
|
|
491
|
+
return arr.slice(0, index);
|
|
492
|
+
}
|
|
493
|
+
return arr;
|
|
494
|
+
};
|
|
495
|
+
var cutArrayAfterValue = (arr, value) => {
|
|
496
|
+
const index = arr.indexOf(value);
|
|
497
|
+
if (index !== -1) {
|
|
498
|
+
return arr.slice(index + 1);
|
|
499
|
+
}
|
|
500
|
+
return arr;
|
|
501
|
+
};
|
|
502
|
+
var createNestedObject = (arr, lastValue) => {
|
|
503
|
+
let nestedObject = {};
|
|
504
|
+
if (arr.length === 0) {
|
|
505
|
+
return lastValue;
|
|
506
|
+
}
|
|
507
|
+
arr.reduce((obj, value, index) => {
|
|
508
|
+
if (!obj[value]) {
|
|
509
|
+
obj[value] = {};
|
|
510
|
+
}
|
|
511
|
+
if (index === arr.length - 1 && lastValue) {
|
|
512
|
+
obj[value] = lastValue;
|
|
513
|
+
}
|
|
514
|
+
return obj[value];
|
|
515
|
+
}, nestedObject);
|
|
516
|
+
return nestedObject;
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// ../../node_modules/@domql/utils/dist/cjs/string.js
|
|
522
|
+
var require_string = __commonJS({
|
|
523
|
+
"../../node_modules/@domql/utils/dist/cjs/string.js"(exports, module2) {
|
|
524
|
+
"use strict";
|
|
525
|
+
var __defProp2 = Object.defineProperty;
|
|
526
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
527
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
528
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
529
|
+
var __export2 = (target, all) => {
|
|
530
|
+
for (var name in all)
|
|
531
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
532
|
+
};
|
|
533
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
534
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
535
|
+
for (let key of __getOwnPropNames2(from))
|
|
536
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
537
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
538
|
+
}
|
|
539
|
+
return to;
|
|
540
|
+
};
|
|
541
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
542
|
+
var string_exports = {};
|
|
543
|
+
__export2(string_exports, {
|
|
544
|
+
stringIncludesAny: () => stringIncludesAny
|
|
545
|
+
});
|
|
546
|
+
module2.exports = __toCommonJS2(string_exports);
|
|
547
|
+
var stringIncludesAny = (str, characters) => {
|
|
548
|
+
for (const char of characters) {
|
|
549
|
+
if (str.includes(char)) {
|
|
550
|
+
return true;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return false;
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
// ../../node_modules/@domql/utils/dist/cjs/object.js
|
|
559
|
+
var require_object = __commonJS({
|
|
560
|
+
"../../node_modules/@domql/utils/dist/cjs/object.js"(exports, module2) {
|
|
561
|
+
"use strict";
|
|
562
|
+
var __defProp2 = Object.defineProperty;
|
|
563
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
564
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
565
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
566
|
+
var __export2 = (target, all) => {
|
|
567
|
+
for (var name in all)
|
|
568
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
569
|
+
};
|
|
570
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
571
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
572
|
+
for (let key of __getOwnPropNames2(from))
|
|
573
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
574
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
575
|
+
}
|
|
576
|
+
return to;
|
|
577
|
+
};
|
|
578
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
579
|
+
var object_exports = {};
|
|
580
|
+
__export2(object_exports, {
|
|
581
|
+
clone: () => clone,
|
|
582
|
+
deepClone: () => deepClone,
|
|
583
|
+
deepCloneExclude: () => deepCloneExclude,
|
|
584
|
+
deepDestringify: () => deepDestringify,
|
|
585
|
+
deepMerge: () => deepMerge,
|
|
586
|
+
deepStringify: () => deepStringify,
|
|
587
|
+
detachFunctionsFromObject: () => detachFunctionsFromObject,
|
|
588
|
+
diff: () => diff,
|
|
589
|
+
diffArrays: () => diffArrays,
|
|
590
|
+
diffObjects: () => diffObjects,
|
|
591
|
+
exec: () => exec,
|
|
592
|
+
flattenRecursive: () => flattenRecursive,
|
|
593
|
+
isEqualDeep: () => isEqualDeep,
|
|
594
|
+
map: () => map,
|
|
595
|
+
merge: () => merge,
|
|
596
|
+
mergeArrayExclude: () => mergeArrayExclude,
|
|
597
|
+
mergeIfExisted: () => mergeIfExisted,
|
|
598
|
+
objectToString: () => objectToString,
|
|
599
|
+
overwrite: () => overwrite,
|
|
600
|
+
overwriteDeep: () => overwriteDeep,
|
|
601
|
+
overwriteShallow: () => overwriteShallow,
|
|
602
|
+
removeFromObject: () => removeFromObject,
|
|
603
|
+
stringToObject: () => stringToObject
|
|
604
|
+
});
|
|
605
|
+
module2.exports = __toCommonJS2(object_exports);
|
|
606
|
+
var import_globals2 = require_cjs();
|
|
607
|
+
var import_types = require_types();
|
|
608
|
+
var import_array = require_array();
|
|
609
|
+
var import_string = require_string();
|
|
610
|
+
var exec = (param, element, state, context) => {
|
|
611
|
+
if ((0, import_types.isFunction)(param)) {
|
|
612
|
+
return param(
|
|
613
|
+
element,
|
|
614
|
+
state || element.state,
|
|
615
|
+
context || element.context
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
return param;
|
|
619
|
+
};
|
|
620
|
+
var map = (obj, extention, element) => {
|
|
621
|
+
for (const e in extention) {
|
|
622
|
+
obj[e] = exec(extention[e], element);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
var merge = (element, obj, excludeFrom = []) => {
|
|
626
|
+
for (const e in obj) {
|
|
627
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
628
|
+
continue;
|
|
629
|
+
const elementProp = element[e];
|
|
630
|
+
const objProp = obj[e];
|
|
631
|
+
if (elementProp === void 0) {
|
|
632
|
+
element[e] = objProp;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return element;
|
|
636
|
+
};
|
|
637
|
+
var deepMerge = (element, extend, excludeFrom = []) => {
|
|
638
|
+
for (const e in extend) {
|
|
639
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
640
|
+
continue;
|
|
641
|
+
const elementProp = element[e];
|
|
642
|
+
const extendProp = extend[e];
|
|
643
|
+
if ((0, import_types.isObjectLike)(elementProp) && (0, import_types.isObjectLike)(extendProp)) {
|
|
644
|
+
deepMerge(elementProp, extendProp);
|
|
645
|
+
} else if (elementProp === void 0) {
|
|
646
|
+
element[e] = extendProp;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
return element;
|
|
650
|
+
};
|
|
651
|
+
var clone = (obj, excludeFrom = []) => {
|
|
652
|
+
const o = {};
|
|
653
|
+
for (const prop in obj) {
|
|
654
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
655
|
+
continue;
|
|
656
|
+
o[prop] = obj[prop];
|
|
657
|
+
}
|
|
658
|
+
return o;
|
|
659
|
+
};
|
|
660
|
+
var deepCloneExclude = (obj, excludeFrom = []) => {
|
|
661
|
+
if ((0, import_types.isArray)(obj)) {
|
|
662
|
+
return obj.map((x) => deepCloneExclude(x, excludeFrom));
|
|
663
|
+
}
|
|
664
|
+
const o = {};
|
|
665
|
+
for (const k in obj) {
|
|
666
|
+
if (excludeFrom.includes(k) || k.startsWith("__"))
|
|
667
|
+
continue;
|
|
668
|
+
let v = obj[k];
|
|
669
|
+
if (k === "extend" && (0, import_types.isArray)(v)) {
|
|
670
|
+
v = mergeArrayExclude(v, excludeFrom);
|
|
671
|
+
}
|
|
672
|
+
if ((0, import_types.isArray)(v)) {
|
|
673
|
+
o[k] = v.map((x) => deepCloneExclude(x, excludeFrom));
|
|
674
|
+
} else if ((0, import_types.isObject)(v)) {
|
|
675
|
+
o[k] = deepCloneExclude(v, excludeFrom);
|
|
676
|
+
} else
|
|
677
|
+
o[k] = v;
|
|
678
|
+
}
|
|
679
|
+
return o;
|
|
680
|
+
};
|
|
681
|
+
var mergeArrayExclude = (arr, excl = []) => {
|
|
682
|
+
return arr.reduce((acc, curr) => deepMerge(acc, deepCloneExclude(curr, excl)), {});
|
|
683
|
+
};
|
|
684
|
+
var deepClone = (obj, excludeFrom = []) => {
|
|
685
|
+
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
686
|
+
for (const prop in obj) {
|
|
687
|
+
if (excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
688
|
+
continue;
|
|
689
|
+
let objProp = obj[prop];
|
|
690
|
+
if (prop === "extend" && (0, import_types.isArray)(objProp)) {
|
|
691
|
+
objProp = (0, import_array.mergeArray)(objProp);
|
|
692
|
+
}
|
|
693
|
+
if ((0, import_types.isObjectLike)(objProp)) {
|
|
694
|
+
o[prop] = deepClone(objProp, excludeFrom);
|
|
695
|
+
} else
|
|
696
|
+
o[prop] = objProp;
|
|
697
|
+
}
|
|
698
|
+
return o;
|
|
699
|
+
};
|
|
700
|
+
var deepStringify = (obj, stringified = {}) => {
|
|
701
|
+
for (const prop in obj) {
|
|
702
|
+
const objProp = obj[prop];
|
|
703
|
+
if ((0, import_types.isFunction)(objProp)) {
|
|
704
|
+
stringified[prop] = objProp.toString();
|
|
705
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
706
|
+
stringified[prop] = {};
|
|
707
|
+
deepStringify(objProp, stringified[prop]);
|
|
708
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
709
|
+
stringified[prop] = [];
|
|
710
|
+
objProp.forEach((v, i) => {
|
|
711
|
+
if ((0, import_types.isObject)(v)) {
|
|
712
|
+
stringified[prop][i] = {};
|
|
713
|
+
deepStringify(v, stringified[prop][i]);
|
|
714
|
+
} else if ((0, import_types.isFunction)(v)) {
|
|
715
|
+
stringified[prop][i] = v.toString();
|
|
716
|
+
} else {
|
|
717
|
+
stringified[prop][i] = v;
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
} else {
|
|
721
|
+
stringified[prop] = objProp;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return stringified;
|
|
725
|
+
};
|
|
726
|
+
var objectToString = (obj, indent = 0) => {
|
|
727
|
+
const spaces = " ".repeat(indent);
|
|
728
|
+
let str = "{\n";
|
|
729
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
730
|
+
const keyAllowdChars = (0, import_string.stringIncludesAny)(key, ["-", ":", "@", ".", "!"]);
|
|
731
|
+
const stringedKey = keyAllowdChars ? `'${key}'` : key;
|
|
732
|
+
str += `${spaces} ${stringedKey}: `;
|
|
733
|
+
if ((0, import_types.isArray)(value)) {
|
|
734
|
+
str += "[\n";
|
|
735
|
+
for (const element of value) {
|
|
736
|
+
if ((0, import_types.isObject)(element) && element !== null) {
|
|
737
|
+
str += `${spaces} ${objectToString(element, indent + 2)},
|
|
738
|
+
`;
|
|
739
|
+
} else if ((0, import_types.isString)(element)) {
|
|
740
|
+
str += `${spaces} '${element}',
|
|
741
|
+
`;
|
|
742
|
+
} else {
|
|
743
|
+
str += `${spaces} ${element},
|
|
744
|
+
`;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
str += `${spaces} ]`;
|
|
748
|
+
} else if ((0, import_types.isObject)(value)) {
|
|
749
|
+
str += objectToString(value, indent + 1);
|
|
750
|
+
} else if ((0, import_types.isString)(value)) {
|
|
751
|
+
str += (0, import_string.stringIncludesAny)(value, ["\n", "'"]) ? `\`${value}\`` : `'${value}'`;
|
|
752
|
+
} else {
|
|
753
|
+
str += value;
|
|
754
|
+
}
|
|
755
|
+
str += ",\n";
|
|
756
|
+
}
|
|
757
|
+
str += `${spaces}}`;
|
|
758
|
+
return str;
|
|
759
|
+
};
|
|
760
|
+
var detachFunctionsFromObject = (obj, detached = {}) => {
|
|
761
|
+
for (const prop in obj) {
|
|
762
|
+
const objProp = obj[prop];
|
|
763
|
+
if ((0, import_types.isFunction)(objProp))
|
|
764
|
+
continue;
|
|
765
|
+
else if ((0, import_types.isObject)(objProp)) {
|
|
766
|
+
detached[prop] = {};
|
|
767
|
+
deepStringify(objProp, detached[prop]);
|
|
768
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
769
|
+
detached[prop] = [];
|
|
770
|
+
objProp.forEach((v, i) => {
|
|
771
|
+
if ((0, import_types.isFunction)(v))
|
|
772
|
+
return;
|
|
773
|
+
if ((0, import_types.isObject)(v)) {
|
|
774
|
+
detached[prop][i] = {};
|
|
775
|
+
detachFunctionsFromObject(v, detached[prop][i]);
|
|
776
|
+
} else {
|
|
777
|
+
detached[prop][i] = v;
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
} else {
|
|
781
|
+
detached[prop] = objProp;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return detached;
|
|
785
|
+
};
|
|
786
|
+
var deepDestringify = (obj, stringified = {}) => {
|
|
787
|
+
for (const prop in obj) {
|
|
788
|
+
const objProp = obj[prop];
|
|
789
|
+
if ((0, import_types.isString)(objProp)) {
|
|
790
|
+
if (objProp.includes("=>") || objProp.includes("function") || objProp.startsWith("(")) {
|
|
791
|
+
try {
|
|
792
|
+
const evalProp = import_globals2.window.eval(`(${objProp})`);
|
|
793
|
+
stringified[prop] = evalProp;
|
|
794
|
+
} catch (e) {
|
|
795
|
+
if (e)
|
|
796
|
+
stringified[prop] = objProp;
|
|
797
|
+
}
|
|
798
|
+
} else {
|
|
799
|
+
stringified[prop] = objProp;
|
|
800
|
+
}
|
|
801
|
+
} else if ((0, import_types.isArray)(objProp)) {
|
|
802
|
+
stringified[prop] = [];
|
|
803
|
+
objProp.forEach((arrProp) => {
|
|
804
|
+
if ((0, import_types.isString)(arrProp)) {
|
|
805
|
+
if (arrProp.includes("=>") || arrProp.includes("function") || arrProp.startsWith("(")) {
|
|
806
|
+
try {
|
|
807
|
+
const evalProp = import_globals2.window.eval(`(${arrProp})`);
|
|
808
|
+
stringified[prop].push(evalProp);
|
|
809
|
+
} catch (e) {
|
|
810
|
+
if (e)
|
|
811
|
+
stringified[prop].push(arrProp);
|
|
812
|
+
}
|
|
813
|
+
} else {
|
|
814
|
+
stringified[prop].push(arrProp);
|
|
815
|
+
}
|
|
816
|
+
} else if ((0, import_types.isObject)(arrProp)) {
|
|
817
|
+
stringified[prop].push(deepDestringify(arrProp));
|
|
818
|
+
} else {
|
|
819
|
+
stringified[prop].push(arrProp);
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
} else if ((0, import_types.isObject)(objProp)) {
|
|
823
|
+
stringified[prop] = deepDestringify(objProp, stringified[prop]);
|
|
824
|
+
} else {
|
|
825
|
+
stringified[prop] = objProp;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return stringified;
|
|
829
|
+
};
|
|
830
|
+
var stringToObject = (str) => {
|
|
831
|
+
let obj;
|
|
832
|
+
try {
|
|
833
|
+
obj = import_globals2.window.eval("(" + str + ")");
|
|
834
|
+
} catch (e) {
|
|
835
|
+
console.warn(e);
|
|
836
|
+
}
|
|
837
|
+
if (obj)
|
|
838
|
+
return obj;
|
|
839
|
+
};
|
|
840
|
+
var diffObjects = (original, objToDiff, cache) => {
|
|
841
|
+
for (const e in objToDiff) {
|
|
842
|
+
if (e === "ref")
|
|
843
|
+
continue;
|
|
844
|
+
const originalProp = original[e];
|
|
845
|
+
const objToDiffProp = objToDiff[e];
|
|
846
|
+
if ((0, import_types.isObject)(originalProp) && (0, import_types.isObject)(objToDiffProp)) {
|
|
847
|
+
cache[e] = {};
|
|
848
|
+
diff(originalProp, objToDiffProp, cache[e]);
|
|
849
|
+
} else if (objToDiffProp !== void 0) {
|
|
850
|
+
cache[e] = objToDiffProp;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
return cache;
|
|
854
|
+
};
|
|
855
|
+
var diffArrays = (original, objToDiff, cache) => {
|
|
856
|
+
if (original.length !== objToDiff.length) {
|
|
857
|
+
cache = objToDiff;
|
|
858
|
+
} else {
|
|
859
|
+
const diffArr = [];
|
|
860
|
+
for (let i = 0; i < original.length; i++) {
|
|
861
|
+
const diffObj = diff(original[i], objToDiff[i]);
|
|
862
|
+
if (Object.keys(diffObj).length > 0) {
|
|
863
|
+
diffArr.push(diffObj);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
if (diffArr.length > 0) {
|
|
867
|
+
cache = diffArr;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
return cache;
|
|
871
|
+
};
|
|
872
|
+
var diff = (original, objToDiff, cache = {}) => {
|
|
873
|
+
if ((0, import_types.isArray)(original) && (0, import_types.isArray)(objToDiff)) {
|
|
874
|
+
cache = [];
|
|
875
|
+
diffArrays(original, objToDiff, cache);
|
|
876
|
+
} else {
|
|
877
|
+
diffObjects(original, objToDiff, cache);
|
|
878
|
+
}
|
|
879
|
+
return cache;
|
|
880
|
+
};
|
|
881
|
+
var overwrite = (element, params, excludeFrom = []) => {
|
|
882
|
+
const { ref } = element;
|
|
883
|
+
const changes = {};
|
|
884
|
+
for (const e in params) {
|
|
885
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
886
|
+
continue;
|
|
887
|
+
const elementProp = element[e];
|
|
888
|
+
const paramsProp = params[e];
|
|
889
|
+
if (paramsProp) {
|
|
890
|
+
ref.__cache[e] = changes[e] = elementProp;
|
|
891
|
+
ref[e] = paramsProp;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return changes;
|
|
895
|
+
};
|
|
896
|
+
var overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
897
|
+
for (const e in params) {
|
|
898
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
899
|
+
continue;
|
|
900
|
+
obj[e] = params[e];
|
|
901
|
+
}
|
|
902
|
+
return obj;
|
|
903
|
+
};
|
|
904
|
+
var overwriteDeep = (obj, params, excludeFrom = []) => {
|
|
905
|
+
for (const e in params) {
|
|
906
|
+
if (excludeFrom.includes(e) || e.startsWith("__"))
|
|
907
|
+
continue;
|
|
908
|
+
const objProp = obj[e];
|
|
909
|
+
const paramsProp = params[e];
|
|
910
|
+
if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
|
|
911
|
+
overwriteDeep(objProp, paramsProp);
|
|
912
|
+
} else if (paramsProp !== void 0) {
|
|
913
|
+
obj[e] = paramsProp;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
return obj;
|
|
917
|
+
};
|
|
918
|
+
var mergeIfExisted = (a, b) => {
|
|
919
|
+
if ((0, import_types.isObjectLike)(a) && (0, import_types.isObjectLike)(b))
|
|
920
|
+
return deepMerge(a, b);
|
|
921
|
+
return a || b;
|
|
922
|
+
};
|
|
923
|
+
var flattenRecursive = (param, prop, stack = []) => {
|
|
924
|
+
const objectized = (0, import_array.mergeAndCloneIfArray)(param);
|
|
925
|
+
stack.push(objectized);
|
|
926
|
+
const extendOfExtend = objectized[prop];
|
|
927
|
+
if (extendOfExtend)
|
|
928
|
+
flattenRecursive(extendOfExtend, prop, stack);
|
|
929
|
+
delete objectized[prop];
|
|
930
|
+
return stack;
|
|
931
|
+
};
|
|
932
|
+
var isEqualDeep = (param, element) => {
|
|
933
|
+
if (param === element)
|
|
934
|
+
return true;
|
|
935
|
+
if (!param || !element)
|
|
936
|
+
return false;
|
|
937
|
+
for (const prop in param) {
|
|
938
|
+
const paramProp = param[prop];
|
|
939
|
+
const elementProp = element[prop];
|
|
940
|
+
if ((0, import_types.isObjectLike)(paramProp)) {
|
|
941
|
+
const isEqual = isEqualDeep(paramProp, elementProp);
|
|
942
|
+
if (!isEqual)
|
|
943
|
+
return false;
|
|
944
|
+
} else {
|
|
945
|
+
const isEqual = paramProp === elementProp;
|
|
946
|
+
if (!isEqual)
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return true;
|
|
951
|
+
};
|
|
952
|
+
var removeFromObject = (obj, props) => {
|
|
953
|
+
if (props === void 0 || props === null)
|
|
954
|
+
return obj;
|
|
955
|
+
if ((0, import_types.is)(props)("string", "number")) {
|
|
956
|
+
delete obj[props];
|
|
957
|
+
} else if ((0, import_types.isArray)(props)) {
|
|
958
|
+
props.forEach((prop) => delete obj[prop]);
|
|
959
|
+
} else {
|
|
960
|
+
throw new Error("Invalid input: props must be a string or an array of strings");
|
|
961
|
+
}
|
|
962
|
+
return obj;
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
// ../../node_modules/@domql/utils/dist/cjs/function.js
|
|
968
|
+
var require_function = __commonJS({
|
|
969
|
+
"../../node_modules/@domql/utils/dist/cjs/function.js"(exports, module2) {
|
|
970
|
+
"use strict";
|
|
971
|
+
var __defProp2 = Object.defineProperty;
|
|
972
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
973
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
974
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
975
|
+
var __export2 = (target, all) => {
|
|
976
|
+
for (var name in all)
|
|
977
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
978
|
+
};
|
|
979
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
980
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
981
|
+
for (let key of __getOwnPropNames2(from))
|
|
982
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
983
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
984
|
+
}
|
|
985
|
+
return to;
|
|
986
|
+
};
|
|
987
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
988
|
+
var function_exports = {};
|
|
989
|
+
__export2(function_exports, {
|
|
990
|
+
debounce: () => debounce,
|
|
991
|
+
memoize: () => memoize
|
|
992
|
+
});
|
|
993
|
+
module2.exports = __toCommonJS2(function_exports);
|
|
994
|
+
var debounce = (element, func, timeout = 300) => {
|
|
995
|
+
let timer;
|
|
996
|
+
return (...args) => {
|
|
997
|
+
clearTimeout(timer);
|
|
998
|
+
timer = setTimeout(() => {
|
|
999
|
+
func.apply(element, args);
|
|
1000
|
+
}, timeout);
|
|
1001
|
+
};
|
|
1002
|
+
};
|
|
1003
|
+
var memoize = (fn) => {
|
|
1004
|
+
const cache = {};
|
|
1005
|
+
return (...args) => {
|
|
1006
|
+
const n = args[0];
|
|
1007
|
+
if (n in cache) {
|
|
1008
|
+
return cache[n];
|
|
1009
|
+
} else {
|
|
1010
|
+
const result = fn(n);
|
|
1011
|
+
cache[n] = result;
|
|
1012
|
+
return result;
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
// ../../node_modules/@domql/utils/dist/cjs/log.js
|
|
1020
|
+
var require_log = __commonJS({
|
|
1021
|
+
"../../node_modules/@domql/utils/dist/cjs/log.js"(exports, module2) {
|
|
1022
|
+
"use strict";
|
|
1023
|
+
var __defProp2 = Object.defineProperty;
|
|
1024
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1025
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1026
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1027
|
+
var __export2 = (target, all) => {
|
|
1028
|
+
for (var name in all)
|
|
1029
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
1030
|
+
};
|
|
1031
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
1032
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1033
|
+
for (let key of __getOwnPropNames2(from))
|
|
1034
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1035
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1036
|
+
}
|
|
1037
|
+
return to;
|
|
1038
|
+
};
|
|
1039
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1040
|
+
var log_exports = {};
|
|
1041
|
+
__export2(log_exports, {
|
|
1042
|
+
logGroupIf: () => logGroupIf,
|
|
1043
|
+
logIf: () => logIf
|
|
1044
|
+
});
|
|
1045
|
+
module2.exports = __toCommonJS2(log_exports);
|
|
1046
|
+
var logIf = (bool, ...arg) => {
|
|
1047
|
+
if (bool)
|
|
1048
|
+
arg.map((v) => console.log(v));
|
|
1049
|
+
};
|
|
1050
|
+
var logGroupIf = (bool, key, ...arg) => {
|
|
1051
|
+
if (bool) {
|
|
1052
|
+
console.group(key);
|
|
1053
|
+
arg.map((v) => console.log(v));
|
|
1054
|
+
console.groupEnd(key);
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
// ../../node_modules/@domql/utils/dist/cjs/index.js
|
|
1061
|
+
var require_cjs4 = __commonJS({
|
|
1062
|
+
"../../node_modules/@domql/utils/dist/cjs/index.js"(exports, module2) {
|
|
1063
|
+
"use strict";
|
|
1064
|
+
var __defProp2 = Object.defineProperty;
|
|
1065
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
1066
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
1067
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
1068
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
1069
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1070
|
+
for (let key of __getOwnPropNames2(from))
|
|
1071
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
1072
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
1073
|
+
}
|
|
1074
|
+
return to;
|
|
1075
|
+
};
|
|
1076
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps2(target, mod, "default"), secondTarget && __copyProps2(secondTarget, mod, "default"));
|
|
1077
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
1078
|
+
var utils_exports = {};
|
|
1079
|
+
module2.exports = __toCommonJS2(utils_exports);
|
|
1080
|
+
__reExport(utils_exports, require_cjs2(), module2.exports);
|
|
1081
|
+
__reExport(utils_exports, require_types(), module2.exports);
|
|
1082
|
+
__reExport(utils_exports, require_object(), module2.exports);
|
|
1083
|
+
__reExport(utils_exports, require_function(), module2.exports);
|
|
1084
|
+
__reExport(utils_exports, require_array(), module2.exports);
|
|
1085
|
+
__reExport(utils_exports, require_node(), module2.exports);
|
|
1086
|
+
__reExport(utils_exports, require_log(), module2.exports);
|
|
1087
|
+
__reExport(utils_exports, require_string(), module2.exports);
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
|
|
69
1091
|
// src/utils/color.js
|
|
70
1092
|
var color_exports = {};
|
|
71
1093
|
__export(color_exports, {
|
|
72
1094
|
changeLightness: () => changeLightness,
|
|
73
1095
|
colorStringToRgbaArray: () => colorStringToRgbaArray,
|
|
74
1096
|
getColorShade: () => getColorShade,
|
|
1097
|
+
getRgbTone: () => getRgbTone,
|
|
75
1098
|
hexToRgb: () => hexToRgb,
|
|
76
1099
|
hexToRgbArray: () => hexToRgbArray,
|
|
77
1100
|
hexToRgba: () => hexToRgba,
|
|
@@ -86,6 +1109,7 @@ __export(color_exports, {
|
|
|
86
1109
|
});
|
|
87
1110
|
module.exports = __toCommonJS(color_exports);
|
|
88
1111
|
var import_globals = __toESM(require_cjs(), 1);
|
|
1112
|
+
var import_utils = __toESM(require_cjs4(), 1);
|
|
89
1113
|
var ENV = "development";
|
|
90
1114
|
var colorStringToRgbaArray = (color) => {
|
|
91
1115
|
if (color === "")
|
|
@@ -138,7 +1162,7 @@ var hexToRgbArray = (hex, alpha = 1) => {
|
|
|
138
1162
|
return [r, g, b];
|
|
139
1163
|
};
|
|
140
1164
|
var rgbToHex = (r, g, b) => {
|
|
141
|
-
return "#" + (
|
|
1165
|
+
return "#" + (1 << 24 | r << 16 | g << 8 | b).toString(16).slice(1);
|
|
142
1166
|
};
|
|
143
1167
|
var rgbArrayToHex = ([r, g, b]) => {
|
|
144
1168
|
return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
@@ -190,7 +1214,7 @@ var getColorShade = (col, amt) => {
|
|
|
190
1214
|
g = 255;
|
|
191
1215
|
else if (g < 0)
|
|
192
1216
|
g = 0;
|
|
193
|
-
return (g | b << 8 | r << 16).toString(16);
|
|
1217
|
+
return ((g | b << 8 | r << 16) + 16777216).toString(16).slice(1);
|
|
194
1218
|
};
|
|
195
1219
|
var mixTwoRgba = (colorA, colorB, range = 0.5) => {
|
|
196
1220
|
const arr = [];
|
|
@@ -212,3 +1236,21 @@ var opacify = (color, opacity) => {
|
|
|
212
1236
|
arr[3] = opacity;
|
|
213
1237
|
return `rgba(${arr})`;
|
|
214
1238
|
};
|
|
1239
|
+
var getRgbTone = (rgb, tone) => {
|
|
1240
|
+
if ((0, import_utils.isString)(rgb))
|
|
1241
|
+
rgb = rgb.split(", ").map((v) => parseFloat(v));
|
|
1242
|
+
if ((0, import_utils.isNumber)(tone))
|
|
1243
|
+
tone += "";
|
|
1244
|
+
const toHex = rgbArrayToHex(rgb);
|
|
1245
|
+
const abs = tone.slice(0, 1);
|
|
1246
|
+
if (abs === "-" || abs === "+") {
|
|
1247
|
+
const colorShade = getColorShade(toHex, parseFloat(tone));
|
|
1248
|
+
return hexToRgbArray(colorShade).join(", ");
|
|
1249
|
+
} else {
|
|
1250
|
+
const [r, g, b] = rgb;
|
|
1251
|
+
const hsl = rgbToHSL(r, g, b);
|
|
1252
|
+
const [h, s, l] = hsl;
|
|
1253
|
+
const newRgb = hslToRgb(h, s, parseFloat(tone) / 100 * 255);
|
|
1254
|
+
return newRgb;
|
|
1255
|
+
}
|
|
1256
|
+
};
|