@domql/state 3.6.4 → 3.6.7
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/LICENSE +25 -12
- package/dist/cjs/updateState.js +5 -6
- package/dist/esm/updateState.js +5 -6
- package/dist/iife/index.js +755 -584
- package/package.json +4 -4
- package/updateState.js +6 -7
package/dist/iife/index.js
CHANGED
|
@@ -4,6 +4,9 @@ var DomqlState = (() => {
|
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
7
10
|
var __export = (target, all) => {
|
|
8
11
|
for (var name in all)
|
|
9
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,621 +21,788 @@ var DomqlState = (() => {
|
|
|
18
21
|
};
|
|
19
22
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
23
|
|
|
21
|
-
// index.js
|
|
22
|
-
var index_exports = {};
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
add: () => add,
|
|
25
|
-
apply: () => apply,
|
|
26
|
-
applyFunction: () => applyFunction,
|
|
27
|
-
applyInitialState: () => applyInitialState,
|
|
28
|
-
applyReplace: () => applyReplace,
|
|
29
|
-
applyStateMethods: () => applyStateMethods,
|
|
30
|
-
clean: () => clean,
|
|
31
|
-
createState: () => createState,
|
|
32
|
-
destroy: () => destroy,
|
|
33
|
-
getByPath: () => getByPath,
|
|
34
|
-
hoistStateUpdate: () => hoistStateUpdate,
|
|
35
|
-
keys: () => keys,
|
|
36
|
-
parentUpdate: () => parentUpdate,
|
|
37
|
-
parse: () => parse,
|
|
38
|
-
quietReplace: () => quietReplace,
|
|
39
|
-
quietUpdate: () => quietUpdate,
|
|
40
|
-
remove: () => remove,
|
|
41
|
-
removeByPath: () => removeByPath,
|
|
42
|
-
removePathCollection: () => removePathCollection,
|
|
43
|
-
replace: () => replace,
|
|
44
|
-
reset: () => reset,
|
|
45
|
-
rootUpdate: () => rootUpdate,
|
|
46
|
-
set: () => set,
|
|
47
|
-
setByPath: () => setByPath,
|
|
48
|
-
setPathCollection: () => setPathCollection,
|
|
49
|
-
toggle: () => toggle,
|
|
50
|
-
updateState: () => updateState,
|
|
51
|
-
values: () => values
|
|
52
|
-
});
|
|
53
|
-
|
|
54
24
|
// ../utils/dist/esm/globals.js
|
|
55
|
-
var
|
|
56
|
-
var
|
|
25
|
+
var window2, document2;
|
|
26
|
+
var init_globals = __esm({
|
|
27
|
+
"../utils/dist/esm/globals.js"() {
|
|
28
|
+
window2 = globalThis;
|
|
29
|
+
document2 = window2.document;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
57
32
|
|
|
58
33
|
// ../utils/dist/esm/node.js
|
|
59
|
-
var isNode
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
34
|
+
var isNode, isHtmlElement, isDOMNode;
|
|
35
|
+
var init_node = __esm({
|
|
36
|
+
"../utils/dist/esm/node.js"() {
|
|
37
|
+
init_globals();
|
|
38
|
+
isNode = (obj) => {
|
|
39
|
+
return (typeof Node === "object" ? obj instanceof window2.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
|
|
40
|
+
};
|
|
41
|
+
isHtmlElement = (obj) => {
|
|
42
|
+
return (typeof HTMLElement === "object" ? obj instanceof window2.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
43
|
+
};
|
|
44
|
+
isDOMNode = (obj) => {
|
|
45
|
+
return typeof window2 !== "undefined" && (window2.Node && obj instanceof window2.Node || window2.Window && obj instanceof window2.Window || obj === window2 || obj === document);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
68
49
|
|
|
69
50
|
// ../utils/dist/esm/types.js
|
|
70
|
-
var isObject
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
51
|
+
var isObject, isString, isNumber, isFunction, isBoolean, isNull, isArray, isDate, isObjectLike, isDefined, isUndefined, TYPES, is;
|
|
52
|
+
var init_types = __esm({
|
|
53
|
+
"../utils/dist/esm/types.js"() {
|
|
54
|
+
init_node();
|
|
55
|
+
isObject = (arg) => {
|
|
56
|
+
if (arg === null) return false;
|
|
57
|
+
return typeof arg === "object" && arg.constructor === Object;
|
|
58
|
+
};
|
|
59
|
+
isString = (arg) => typeof arg === "string";
|
|
60
|
+
isNumber = (arg) => typeof arg === "number";
|
|
61
|
+
isFunction = (arg) => typeof arg === "function";
|
|
62
|
+
isBoolean = (arg) => arg === true || arg === false;
|
|
63
|
+
isNull = (arg) => arg === null;
|
|
64
|
+
isArray = (arg) => Array.isArray(arg);
|
|
65
|
+
isDate = (d) => d instanceof Date;
|
|
66
|
+
isObjectLike = (arg) => {
|
|
67
|
+
if (arg === null) return false;
|
|
68
|
+
return typeof arg === "object";
|
|
69
|
+
};
|
|
70
|
+
isDefined = (arg) => arg !== void 0;
|
|
71
|
+
isUndefined = (arg) => arg === void 0;
|
|
72
|
+
TYPES = {
|
|
73
|
+
boolean: isBoolean,
|
|
74
|
+
array: isArray,
|
|
75
|
+
object: isObject,
|
|
76
|
+
string: isString,
|
|
77
|
+
date: isDate,
|
|
78
|
+
number: isNumber,
|
|
79
|
+
null: isNull,
|
|
80
|
+
function: isFunction,
|
|
81
|
+
objectLike: isObjectLike,
|
|
82
|
+
node: isNode,
|
|
83
|
+
htmlElement: isHtmlElement,
|
|
84
|
+
defined: isDefined
|
|
85
|
+
};
|
|
86
|
+
is = (arg) => {
|
|
87
|
+
return (...args) => args.some((val) => TYPES[val](arg));
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
104
91
|
|
|
105
92
|
// ../utils/dist/esm/array.js
|
|
106
|
-
var removeFromArray
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
var removeFromArray, unstackArrayOfObjects, addProtoToArray;
|
|
94
|
+
var init_array = __esm({
|
|
95
|
+
"../utils/dist/esm/array.js"() {
|
|
96
|
+
init_object();
|
|
97
|
+
init_types();
|
|
98
|
+
removeFromArray = (arr, index) => {
|
|
99
|
+
if (isString(index)) index = parseInt(index);
|
|
100
|
+
if (isNumber(index)) {
|
|
101
|
+
if (index < 0 || index >= arr.length || isNaN(index)) {
|
|
102
|
+
throw new Error("Invalid index");
|
|
103
|
+
}
|
|
104
|
+
arr.splice(index, 1);
|
|
105
|
+
} else {
|
|
106
|
+
throw new Error("Invalid index");
|
|
107
|
+
}
|
|
108
|
+
return arr;
|
|
109
|
+
};
|
|
110
|
+
unstackArrayOfObjects = (arr, exclude = []) => {
|
|
111
|
+
return arr.reduce(
|
|
112
|
+
(a, c) => deepMerge(a, deepClone(c, { exclude }), exclude),
|
|
113
|
+
{}
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
addProtoToArray = (state, proto) => {
|
|
117
|
+
for (const key in proto) {
|
|
118
|
+
Object.defineProperty(state, key, {
|
|
119
|
+
value: proto[key],
|
|
120
|
+
enumerable: false,
|
|
121
|
+
// Set this to true if you want the method to appear in for...in loops
|
|
122
|
+
configurable: true,
|
|
123
|
+
// Set this to true if you want to allow redefining/removing the property later
|
|
124
|
+
writable: true
|
|
125
|
+
// Set this to true if you want to allow changing the function later
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
};
|
|
115
129
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{}
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
var addProtoToArray = (state, proto) => {
|
|
125
|
-
for (const key in proto) {
|
|
126
|
-
Object.defineProperty(state, key, {
|
|
127
|
-
value: proto[key],
|
|
128
|
-
enumerable: false,
|
|
129
|
-
// Set this to true if you want the method to appear in for...in loops
|
|
130
|
-
configurable: true,
|
|
131
|
-
// Set this to true if you want to allow redefining/removing the property later
|
|
132
|
-
writable: true
|
|
133
|
-
// Set this to true if you want to allow changing the function later
|
|
134
|
-
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// ../utils/dist/esm/string.js
|
|
133
|
+
var init_string = __esm({
|
|
134
|
+
"../utils/dist/esm/string.js"() {
|
|
135
135
|
}
|
|
136
|
-
};
|
|
136
|
+
});
|
|
137
137
|
|
|
138
138
|
// ../utils/dist/esm/keys.js
|
|
139
|
-
var STATE_METHODS
|
|
140
|
-
|
|
141
|
-
"
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
139
|
+
var STATE_METHODS, PROPS_METHODS, METHODS, METHODS_EXL;
|
|
140
|
+
var init_keys = __esm({
|
|
141
|
+
"../utils/dist/esm/keys.js"() {
|
|
142
|
+
STATE_METHODS = /* @__PURE__ */ new Set([
|
|
143
|
+
"update",
|
|
144
|
+
"parse",
|
|
145
|
+
"clean",
|
|
146
|
+
"create",
|
|
147
|
+
"destroy",
|
|
148
|
+
"add",
|
|
149
|
+
"toggle",
|
|
150
|
+
"remove",
|
|
151
|
+
"apply",
|
|
152
|
+
"set",
|
|
153
|
+
"reset",
|
|
154
|
+
"replace",
|
|
155
|
+
"quietReplace",
|
|
156
|
+
"quietUpdate",
|
|
157
|
+
"applyReplace",
|
|
158
|
+
"applyFunction",
|
|
159
|
+
"keys",
|
|
160
|
+
"values",
|
|
161
|
+
"ref",
|
|
162
|
+
"rootUpdate",
|
|
163
|
+
"parentUpdate",
|
|
164
|
+
"parent",
|
|
165
|
+
"__element",
|
|
166
|
+
"__depends",
|
|
167
|
+
"__ref",
|
|
168
|
+
"__children",
|
|
169
|
+
"root",
|
|
170
|
+
"setByPath",
|
|
171
|
+
"setPathCollection",
|
|
172
|
+
"removeByPath",
|
|
173
|
+
"removePathCollection",
|
|
174
|
+
"getByPath"
|
|
175
|
+
]);
|
|
176
|
+
PROPS_METHODS = /* @__PURE__ */ new Set(["update", "__element"]);
|
|
177
|
+
METHODS = /* @__PURE__ */ new Set([
|
|
178
|
+
"set",
|
|
179
|
+
"reset",
|
|
180
|
+
"update",
|
|
181
|
+
"remove",
|
|
182
|
+
"updateContent",
|
|
183
|
+
"removeContent",
|
|
184
|
+
"lookup",
|
|
185
|
+
"lookdown",
|
|
186
|
+
"lookdownAll",
|
|
187
|
+
"getRef",
|
|
188
|
+
"getPath",
|
|
189
|
+
"setNodeStyles",
|
|
190
|
+
"spotByPath",
|
|
191
|
+
"keys",
|
|
192
|
+
"parse",
|
|
193
|
+
"setProps",
|
|
194
|
+
"parseDeep",
|
|
195
|
+
"variables",
|
|
196
|
+
"if",
|
|
197
|
+
"log",
|
|
198
|
+
"verbose",
|
|
199
|
+
"warn",
|
|
200
|
+
"error",
|
|
201
|
+
"call",
|
|
202
|
+
"nextElement",
|
|
203
|
+
"previousElement",
|
|
204
|
+
"getRootState",
|
|
205
|
+
"getRoot",
|
|
206
|
+
"getRootData",
|
|
207
|
+
"getRootContext",
|
|
208
|
+
"getContext",
|
|
209
|
+
"getQuery",
|
|
210
|
+
"getDB",
|
|
211
|
+
"getChildren"
|
|
212
|
+
]);
|
|
213
|
+
METHODS_EXL = /* @__PURE__ */ new Set([
|
|
214
|
+
"node",
|
|
215
|
+
"context",
|
|
216
|
+
"extends",
|
|
217
|
+
"__element",
|
|
218
|
+
"__ref",
|
|
219
|
+
...METHODS,
|
|
220
|
+
...STATE_METHODS,
|
|
221
|
+
...PROPS_METHODS
|
|
222
|
+
]);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
218
225
|
|
|
219
226
|
// ../utils/dist/esm/object.js
|
|
220
|
-
var _startsWithDunder
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
clone2
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
227
|
+
var _startsWithDunder, merge, deepMerge, deepClone, overwriteShallow, overwriteDeep, removeFromObject, createNestedObject, removeNestedKeyByPath, setInObjectByPath, getInObjectByPath;
|
|
228
|
+
var init_object = __esm({
|
|
229
|
+
"../utils/dist/esm/object.js"() {
|
|
230
|
+
init_globals();
|
|
231
|
+
init_types();
|
|
232
|
+
init_array();
|
|
233
|
+
init_node();
|
|
234
|
+
init_keys();
|
|
235
|
+
_startsWithDunder = (e) => e.charCodeAt(0) === 95 && e.charCodeAt(1) === 95;
|
|
236
|
+
merge = (element, obj, excludeFrom = []) => {
|
|
237
|
+
const useSet = excludeFrom instanceof Set;
|
|
238
|
+
for (const e in obj) {
|
|
239
|
+
if (!Object.prototype.hasOwnProperty.call(obj, e)) continue;
|
|
240
|
+
if (_startsWithDunder(e)) continue;
|
|
241
|
+
if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
|
|
242
|
+
if (element[e] === void 0) {
|
|
243
|
+
element[e] = obj[e];
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return element;
|
|
247
|
+
};
|
|
248
|
+
deepMerge = (element, extend, excludeFrom = METHODS_EXL) => {
|
|
249
|
+
const useSet = excludeFrom instanceof Set;
|
|
250
|
+
for (const e in extend) {
|
|
251
|
+
if (!Object.prototype.hasOwnProperty.call(extend, e)) continue;
|
|
252
|
+
if (_startsWithDunder(e)) continue;
|
|
253
|
+
if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
|
|
254
|
+
const elementProp = element[e];
|
|
255
|
+
const extendProp = extend[e];
|
|
256
|
+
if (isObjectLike(elementProp) && isObjectLike(extendProp)) {
|
|
257
|
+
deepMerge(elementProp, extendProp, excludeFrom);
|
|
258
|
+
} else if (elementProp === void 0) {
|
|
259
|
+
element[e] = extendProp;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return element;
|
|
263
|
+
};
|
|
264
|
+
deepClone = (obj, options = {}) => {
|
|
265
|
+
const {
|
|
266
|
+
exclude = [],
|
|
267
|
+
cleanUndefined = false,
|
|
268
|
+
cleanNull = false,
|
|
269
|
+
window: targetWindow,
|
|
270
|
+
visited = /* @__PURE__ */ new WeakMap(),
|
|
271
|
+
handleExtends = false
|
|
272
|
+
} = options;
|
|
273
|
+
const contentWindow = targetWindow || window2 || globalThis;
|
|
274
|
+
if (!isObjectLike(obj) || isDOMNode(obj)) {
|
|
275
|
+
return obj;
|
|
276
|
+
}
|
|
277
|
+
if (visited.has(obj)) {
|
|
278
|
+
return visited.get(obj);
|
|
279
|
+
}
|
|
280
|
+
const isArr = isArray(obj);
|
|
281
|
+
const clone2 = isArr ? [] : {};
|
|
282
|
+
visited.set(obj, clone2);
|
|
283
|
+
const excludeSet = exclude instanceof Set ? exclude : exclude.length > 3 ? new Set(exclude) : null;
|
|
284
|
+
for (const key in obj) {
|
|
285
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
286
|
+
if (_startsWithDunder(key) || key === "__proto__") continue;
|
|
287
|
+
if (excludeSet ? excludeSet.has(key) : exclude.includes(key)) continue;
|
|
288
|
+
const value = obj[key];
|
|
289
|
+
if (cleanUndefined && value === void 0) continue;
|
|
290
|
+
if (cleanNull && value === null) continue;
|
|
291
|
+
if (isDOMNode(value)) {
|
|
292
|
+
clone2[key] = value;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (handleExtends && key === "extends" && isArray(value)) {
|
|
296
|
+
clone2[key] = unstackArrayOfObjects(value, exclude);
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (isFunction(value) && options.window) {
|
|
300
|
+
clone2[key] = contentWindow.eval("(" + value.toString() + ")");
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (isObjectLike(value)) {
|
|
304
|
+
clone2[key] = deepClone(value, {
|
|
305
|
+
...options,
|
|
306
|
+
visited
|
|
307
|
+
});
|
|
308
|
+
} else {
|
|
309
|
+
clone2[key] = value;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return clone2;
|
|
313
|
+
};
|
|
314
|
+
overwriteShallow = (obj, params, excludeFrom = []) => {
|
|
315
|
+
const useSet = excludeFrom instanceof Set;
|
|
316
|
+
for (const e in params) {
|
|
317
|
+
if (_startsWithDunder(e)) continue;
|
|
318
|
+
if (useSet ? excludeFrom.has(e) : excludeFrom.includes(e)) continue;
|
|
319
|
+
obj[e] = params[e];
|
|
320
|
+
}
|
|
321
|
+
return obj;
|
|
322
|
+
};
|
|
323
|
+
overwriteDeep = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
|
|
324
|
+
if (!isObjectLike(obj) || !isObjectLike(params) || isDOMNode(obj) || isDOMNode(params)) {
|
|
325
|
+
return params;
|
|
326
|
+
}
|
|
327
|
+
if (visited.has(obj)) return visited.get(obj);
|
|
328
|
+
visited.set(obj, obj);
|
|
329
|
+
const excl = opts.exclude;
|
|
330
|
+
const exclSet = excl ? excl instanceof Set ? excl : new Set(excl) : null;
|
|
331
|
+
const forcedExclude = !opts.preventForce;
|
|
332
|
+
for (const e in params) {
|
|
333
|
+
if (!Object.prototype.hasOwnProperty.call(params, e)) continue;
|
|
334
|
+
if (exclSet && exclSet.has(e) || forcedExclude && _startsWithDunder(e)) continue;
|
|
335
|
+
const objProp = obj[e];
|
|
336
|
+
const paramsProp = params[e];
|
|
337
|
+
if (isDOMNode(paramsProp)) {
|
|
338
|
+
obj[e] = paramsProp;
|
|
339
|
+
} else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {
|
|
340
|
+
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
341
|
+
} else if (paramsProp !== void 0) {
|
|
342
|
+
obj[e] = paramsProp;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return obj;
|
|
346
|
+
};
|
|
347
|
+
removeFromObject = (obj, props) => {
|
|
348
|
+
if (props === void 0 || props === null) return obj;
|
|
349
|
+
if (is(props)("string", "number")) {
|
|
350
|
+
delete obj[props];
|
|
351
|
+
} else if (isArray(props)) {
|
|
352
|
+
for (let i = 0; i < props.length; i++) delete obj[props[i]];
|
|
353
|
+
} else {
|
|
354
|
+
throw new Error(
|
|
355
|
+
"Invalid input: props must be a string or an array of strings"
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
return obj;
|
|
359
|
+
};
|
|
360
|
+
createNestedObject = (arr, lastValue) => {
|
|
361
|
+
if (arr.length === 0) return lastValue;
|
|
362
|
+
const nestedObject = {};
|
|
363
|
+
let current = nestedObject;
|
|
364
|
+
for (let i = 0; i < arr.length; i++) {
|
|
365
|
+
if (i === arr.length - 1 && lastValue) {
|
|
366
|
+
current[arr[i]] = lastValue;
|
|
367
|
+
} else {
|
|
368
|
+
current[arr[i]] = {};
|
|
369
|
+
current = current[arr[i]];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return nestedObject;
|
|
373
|
+
};
|
|
374
|
+
removeNestedKeyByPath = (obj, path) => {
|
|
375
|
+
if (!Array.isArray(path)) {
|
|
376
|
+
throw new Error("Path must be an array.");
|
|
377
|
+
}
|
|
378
|
+
let current = obj;
|
|
379
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
380
|
+
if (current[path[i]] === void 0) return;
|
|
381
|
+
current = current[path[i]];
|
|
382
|
+
}
|
|
383
|
+
const lastKey = path[path.length - 1];
|
|
384
|
+
if (current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
385
|
+
delete current[lastKey];
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
setInObjectByPath = (obj, path, value) => {
|
|
389
|
+
if (!Array.isArray(path)) {
|
|
390
|
+
throw new Error("Path must be an array.");
|
|
391
|
+
}
|
|
392
|
+
let current = obj;
|
|
393
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
394
|
+
if (!current[path[i]] || typeof current[path[i]] !== "object") {
|
|
395
|
+
current[path[i]] = {};
|
|
396
|
+
}
|
|
397
|
+
current = current[path[i]];
|
|
398
|
+
}
|
|
399
|
+
current[path[path.length - 1]] = value;
|
|
400
|
+
return obj;
|
|
401
|
+
};
|
|
402
|
+
getInObjectByPath = (obj, path) => {
|
|
403
|
+
if (!Array.isArray(path)) {
|
|
404
|
+
throw new Error("Path must be an array.");
|
|
405
|
+
}
|
|
406
|
+
let current = obj;
|
|
407
|
+
for (let i = 0; i < path.length; i++) {
|
|
408
|
+
if (current === void 0 || current === null) {
|
|
409
|
+
return void 0;
|
|
410
|
+
}
|
|
411
|
+
current = current[path[i]];
|
|
412
|
+
}
|
|
413
|
+
return current;
|
|
414
|
+
};
|
|
325
415
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
// ../utils/dist/esm/key.js
|
|
419
|
+
var init_key = __esm({
|
|
420
|
+
"../utils/dist/esm/key.js"() {
|
|
331
421
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
for (const e in params) {
|
|
338
|
-
if (!Object.prototype.hasOwnProperty.call(params, e)) continue;
|
|
339
|
-
if (exclSet && exclSet.has(e) || forcedExclude && _startsWithDunder(e)) continue;
|
|
340
|
-
const objProp = obj[e];
|
|
341
|
-
const paramsProp = params[e];
|
|
342
|
-
if (isDOMNode(paramsProp)) {
|
|
343
|
-
obj[e] = paramsProp;
|
|
344
|
-
} else if (isObjectLike(objProp) && isObjectLike(paramsProp)) {
|
|
345
|
-
obj[e] = overwriteDeep(objProp, paramsProp, opts, visited);
|
|
346
|
-
} else if (paramsProp !== void 0) {
|
|
347
|
-
obj[e] = paramsProp;
|
|
348
|
-
}
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
// ../utils/dist/esm/env.js
|
|
425
|
+
var init_env = __esm({
|
|
426
|
+
"../utils/dist/esm/env.js"() {
|
|
349
427
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
delete obj[props];
|
|
356
|
-
} else if (isArray(props)) {
|
|
357
|
-
for (let i = 0; i < props.length; i++) delete obj[props[i]];
|
|
358
|
-
} else {
|
|
359
|
-
throw new Error(
|
|
360
|
-
"Invalid input: props must be a string or an array of strings"
|
|
361
|
-
);
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
// ../utils/dist/esm/function.js
|
|
431
|
+
var init_function = __esm({
|
|
432
|
+
"../utils/dist/esm/function.js"() {
|
|
362
433
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
let current = nestedObject;
|
|
369
|
-
for (let i = 0; i < arr.length; i++) {
|
|
370
|
-
if (i === arr.length - 1 && lastValue) {
|
|
371
|
-
current[arr[i]] = lastValue;
|
|
372
|
-
} else {
|
|
373
|
-
current[arr[i]] = {};
|
|
374
|
-
current = current[arr[i]];
|
|
375
|
-
}
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
// ../utils/dist/esm/if.js
|
|
437
|
+
var init_if = __esm({
|
|
438
|
+
"../utils/dist/esm/if.js"() {
|
|
376
439
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
// ../utils/dist/esm/log.js
|
|
443
|
+
var init_log = __esm({
|
|
444
|
+
"../utils/dist/esm/log.js"() {
|
|
382
445
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// ../utils/dist/esm/cookie.js
|
|
449
|
+
var isMobile;
|
|
450
|
+
var init_cookie = __esm({
|
|
451
|
+
"../utils/dist/esm/cookie.js"() {
|
|
452
|
+
isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
387
453
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// ../utils/dist/esm/tags.js
|
|
457
|
+
var init_tags = __esm({
|
|
458
|
+
"../utils/dist/esm/tags.js"() {
|
|
391
459
|
}
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
// ../utils/dist/esm/extends.js
|
|
463
|
+
var init_extends = __esm({
|
|
464
|
+
"../utils/dist/esm/extends.js"() {
|
|
396
465
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
current = current[path[i]];
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// ../utils/dist/esm/component.js
|
|
469
|
+
var init_component = __esm({
|
|
470
|
+
"../utils/dist/esm/component.js"() {
|
|
403
471
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
throw new Error("Path must be an array.");
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
// ../utils/dist/esm/props.js
|
|
475
|
+
var init_props = __esm({
|
|
476
|
+
"../utils/dist/esm/props.js"() {
|
|
410
477
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
current = current[path[i]];
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// ../utils/dist/esm/element.js
|
|
481
|
+
var init_element = __esm({
|
|
482
|
+
"../utils/dist/esm/element.js"() {
|
|
417
483
|
}
|
|
418
|
-
|
|
419
|
-
};
|
|
484
|
+
});
|
|
420
485
|
|
|
421
486
|
// ../utils/dist/esm/state.js
|
|
422
|
-
var checkForStateTypes
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
__depends
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
487
|
+
var checkForStateTypes, getRootStateInKey, getParentStateInKey, getChildStateInKey, findInheritedState, createInheritedState, checkIfInherits, createNestedObjectByKeyPath, applyDependentState, overwriteState;
|
|
488
|
+
var init_state = __esm({
|
|
489
|
+
"../utils/dist/esm/state.js"() {
|
|
490
|
+
init_array();
|
|
491
|
+
init_keys();
|
|
492
|
+
init_object();
|
|
493
|
+
init_types();
|
|
494
|
+
checkForStateTypes = (element) => {
|
|
495
|
+
const { state: orig, props, __ref: ref } = element;
|
|
496
|
+
const state = props?.state || orig;
|
|
497
|
+
if (is(state)("string", "number")) {
|
|
498
|
+
ref.__state = state;
|
|
499
|
+
return { value: state };
|
|
500
|
+
} else if (state === true) {
|
|
501
|
+
ref.__state = element.key;
|
|
502
|
+
return {};
|
|
503
|
+
} else if (state) {
|
|
504
|
+
ref.__hasRootState = true;
|
|
505
|
+
return state;
|
|
506
|
+
} else {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
getRootStateInKey = (stateKey, parentState) => {
|
|
511
|
+
if (!stateKey.includes("~/")) return;
|
|
512
|
+
const arr = stateKey.split("~/");
|
|
513
|
+
if (arr.length > 1) return parentState.root;
|
|
514
|
+
};
|
|
515
|
+
getParentStateInKey = (stateKey, parentState) => {
|
|
516
|
+
if (!stateKey.includes("../")) return;
|
|
517
|
+
const arr = stateKey.split("../");
|
|
518
|
+
const arrLength = arr.length - 1;
|
|
519
|
+
for (let i = 0; i < arrLength; i++) {
|
|
520
|
+
if (!parentState.parent) return null;
|
|
521
|
+
parentState = parentState.parent;
|
|
522
|
+
}
|
|
523
|
+
return parentState;
|
|
524
|
+
};
|
|
525
|
+
getChildStateInKey = (stateKey, parentState, options = {}) => {
|
|
526
|
+
const arr = isString(stateKey) ? stateKey.split("/") : [stateKey];
|
|
527
|
+
const arrLength = arr.length - 1;
|
|
528
|
+
for (let i = 0; i < arrLength; i++) {
|
|
529
|
+
const childKey = arr[i];
|
|
530
|
+
const grandChildKey = arr[i + 1];
|
|
531
|
+
if (childKey === "__proto__" || grandChildKey === "__proto__") return;
|
|
532
|
+
let childInParent = parentState[childKey];
|
|
533
|
+
if (!childInParent) childInParent = parentState[childKey] = {};
|
|
534
|
+
if (!childInParent[grandChildKey]) childInParent[grandChildKey] = {};
|
|
535
|
+
stateKey = grandChildKey;
|
|
536
|
+
parentState = childInParent;
|
|
537
|
+
}
|
|
538
|
+
if (options.returnParent) return parentState;
|
|
539
|
+
return parentState[stateKey];
|
|
540
|
+
};
|
|
541
|
+
findInheritedState = (element, parent, options = {}) => {
|
|
542
|
+
const ref = element.__ref;
|
|
543
|
+
let stateKey = ref.__state;
|
|
544
|
+
if (!checkIfInherits(element)) return;
|
|
545
|
+
const rootState = getRootStateInKey(stateKey, parent.state);
|
|
546
|
+
let parentState = parent.state;
|
|
547
|
+
if (rootState) {
|
|
548
|
+
parentState = rootState;
|
|
549
|
+
stateKey = stateKey.replaceAll("~/", "");
|
|
550
|
+
} else {
|
|
551
|
+
const findGrandParentState = getParentStateInKey(stateKey, parent.state);
|
|
552
|
+
if (findGrandParentState) {
|
|
553
|
+
parentState = findGrandParentState;
|
|
554
|
+
stateKey = stateKey.replaceAll("../", "");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
if (!parentState) return;
|
|
558
|
+
return getChildStateInKey(stateKey, parentState, options);
|
|
559
|
+
};
|
|
560
|
+
createInheritedState = (element, parent) => {
|
|
561
|
+
const ref = element.__ref;
|
|
562
|
+
const inheritedState = findInheritedState(element, parent);
|
|
563
|
+
if (inheritedState === void 0) return element.state;
|
|
564
|
+
if (is(inheritedState)("object", "array")) {
|
|
565
|
+
return deepClone(inheritedState);
|
|
566
|
+
} else if (is(inheritedState)("string", "number", "boolean")) {
|
|
567
|
+
ref.__stateType = typeof inheritedState;
|
|
568
|
+
return { value: inheritedState };
|
|
569
|
+
}
|
|
570
|
+
console.warn(ref.__state, "is not present. Replacing with", {});
|
|
571
|
+
};
|
|
572
|
+
checkIfInherits = (element) => {
|
|
573
|
+
const { __ref: ref } = element;
|
|
574
|
+
const stateKey = ref?.__state;
|
|
575
|
+
if (stateKey && is(stateKey)("number", "string", "boolean")) return true;
|
|
576
|
+
return false;
|
|
577
|
+
};
|
|
578
|
+
createNestedObjectByKeyPath = (path, value) => {
|
|
579
|
+
if (!path) {
|
|
580
|
+
return value || {};
|
|
581
|
+
}
|
|
582
|
+
const keys2 = path.split("/");
|
|
583
|
+
const obj = {};
|
|
584
|
+
let ref = obj;
|
|
585
|
+
const lastIdx = keys2.length - 1;
|
|
586
|
+
for (let i = 0; i <= lastIdx; i++) {
|
|
587
|
+
ref[keys2[i]] = i === lastIdx ? value || {} : {};
|
|
588
|
+
ref = ref[keys2[i]];
|
|
589
|
+
}
|
|
590
|
+
return obj;
|
|
591
|
+
};
|
|
592
|
+
applyDependentState = (element, state) => {
|
|
593
|
+
const { __element } = state;
|
|
594
|
+
const origState = __element?.state;
|
|
595
|
+
if (!origState) return;
|
|
596
|
+
const dependentState = deepClone(origState, STATE_METHODS);
|
|
597
|
+
const newDepends = { [element.key]: dependentState };
|
|
598
|
+
const __depends = isObject(origState.__depends) ? { ...origState.__depends, ...newDepends } : newDepends;
|
|
599
|
+
if (Array.isArray(origState)) {
|
|
600
|
+
addProtoToArray(origState, {
|
|
601
|
+
...Object.getPrototypeOf(origState),
|
|
602
|
+
__depends
|
|
603
|
+
});
|
|
604
|
+
} else {
|
|
605
|
+
Object.setPrototypeOf(origState, {
|
|
606
|
+
...Object.getPrototypeOf(origState),
|
|
607
|
+
__depends
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
return dependentState;
|
|
611
|
+
};
|
|
612
|
+
overwriteState = (state, obj, options = {}) => {
|
|
613
|
+
const { overwrite } = options;
|
|
614
|
+
if (!overwrite) return;
|
|
615
|
+
const shallow = overwrite === "shallow";
|
|
616
|
+
const merge2 = overwrite === "merge";
|
|
617
|
+
if (merge2) {
|
|
618
|
+
deepMerge(state, obj, STATE_METHODS);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
const overwriteFunc = shallow ? overwriteShallow : overwriteDeep;
|
|
622
|
+
overwriteFunc(state, obj, STATE_METHODS);
|
|
623
|
+
};
|
|
540
624
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const shallow = overwrite === "shallow";
|
|
547
|
-
const merge2 = overwrite === "merge";
|
|
548
|
-
if (merge2) {
|
|
549
|
-
deepMerge(state, obj, STATE_METHODS);
|
|
550
|
-
return;
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
// ../utils/dist/esm/scope.js
|
|
628
|
+
var init_scope = __esm({
|
|
629
|
+
"../utils/dist/esm/scope.js"() {
|
|
551
630
|
}
|
|
552
|
-
|
|
553
|
-
overwriteFunc(state, obj, STATE_METHODS);
|
|
554
|
-
};
|
|
631
|
+
});
|
|
555
632
|
|
|
556
633
|
// ../utils/dist/esm/triggerEvent.js
|
|
557
|
-
var getOnOrPropsEvent
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
634
|
+
var getOnOrPropsEvent, applyEvent, triggerEventOn, applyEventUpdate, triggerEventOnUpdate;
|
|
635
|
+
var init_triggerEvent = __esm({
|
|
636
|
+
"../utils/dist/esm/triggerEvent.js"() {
|
|
637
|
+
init_types();
|
|
638
|
+
getOnOrPropsEvent = (param, element) => {
|
|
639
|
+
const onEvent = element.on?.[param];
|
|
640
|
+
if (onEvent) return onEvent;
|
|
641
|
+
const props = element.props;
|
|
642
|
+
if (!props) return;
|
|
643
|
+
const propKey = "on" + param.charAt(0).toUpperCase() + param.slice(1);
|
|
644
|
+
return props[propKey];
|
|
645
|
+
};
|
|
646
|
+
applyEvent = (param, element, state, context, options) => {
|
|
647
|
+
if (!isFunction(param)) return;
|
|
648
|
+
try {
|
|
649
|
+
const result = param.call(
|
|
650
|
+
element,
|
|
651
|
+
element,
|
|
652
|
+
state || element.state,
|
|
653
|
+
context || element.context,
|
|
654
|
+
options
|
|
655
|
+
);
|
|
656
|
+
if (result && typeof result.then === "function") {
|
|
657
|
+
result.catch((err) => {
|
|
658
|
+
element.error = err;
|
|
659
|
+
console.error("[DomQL] Async event error:", err);
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
return result;
|
|
663
|
+
} catch (err) {
|
|
577
664
|
element.error = err;
|
|
578
|
-
console.error("[DomQL]
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
665
|
+
console.error("[DomQL] Event handler error:", err);
|
|
666
|
+
if (element.context?.strictMode) throw err;
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
triggerEventOn = (param, element, options) => {
|
|
670
|
+
if (!element) {
|
|
671
|
+
throw new Error("Element is required");
|
|
672
|
+
}
|
|
673
|
+
const appliedFunction = getOnOrPropsEvent(param, element);
|
|
674
|
+
if (appliedFunction) {
|
|
675
|
+
const { state, context } = element;
|
|
676
|
+
return applyEvent(appliedFunction, element, state, context, options);
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
applyEventUpdate = (param, updatedObj, element, state, context, options) => {
|
|
680
|
+
if (!isFunction(param)) return;
|
|
681
|
+
try {
|
|
682
|
+
const result = param.call(
|
|
683
|
+
element,
|
|
684
|
+
updatedObj,
|
|
685
|
+
element,
|
|
686
|
+
state || element.state,
|
|
687
|
+
context || element.context,
|
|
688
|
+
options
|
|
689
|
+
);
|
|
690
|
+
if (result && typeof result.then === "function") {
|
|
691
|
+
result.catch((err) => {
|
|
692
|
+
element.error = err;
|
|
693
|
+
console.error("[DomQL] Async event update error:", err);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
return result;
|
|
697
|
+
} catch (err) {
|
|
698
|
+
element.error = err;
|
|
699
|
+
console.error("[DomQL] Event update error:", err);
|
|
700
|
+
if (element.context?.strictMode) throw err;
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
triggerEventOnUpdate = (param, updatedObj, element, options) => {
|
|
704
|
+
const appliedFunction = getOnOrPropsEvent(param, element);
|
|
705
|
+
if (appliedFunction) {
|
|
706
|
+
const { state, context } = element;
|
|
707
|
+
return applyEventUpdate(
|
|
708
|
+
appliedFunction,
|
|
709
|
+
updatedObj,
|
|
710
|
+
element,
|
|
711
|
+
state,
|
|
712
|
+
context,
|
|
713
|
+
options
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
};
|
|
586
717
|
}
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// ../utils/dist/esm/cache.js
|
|
721
|
+
var init_cache = __esm({
|
|
722
|
+
"../utils/dist/esm/cache.js"() {
|
|
591
723
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
// ../utils/dist/esm/methods.js
|
|
727
|
+
var init_methods = __esm({
|
|
728
|
+
"../utils/dist/esm/methods.js"() {
|
|
596
729
|
}
|
|
597
|
-
};
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
element,
|
|
603
|
-
updatedObj,
|
|
604
|
-
element,
|
|
605
|
-
state || element.state,
|
|
606
|
-
context || element.context,
|
|
607
|
-
options
|
|
608
|
-
);
|
|
609
|
-
if (result && typeof result.then === "function") {
|
|
610
|
-
result.catch((err) => {
|
|
611
|
-
element.error = err;
|
|
612
|
-
console.error("[DomQL] Async event update error:", err);
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
return result;
|
|
616
|
-
} catch (err) {
|
|
617
|
-
element.error = err;
|
|
618
|
-
console.error("[DomQL] Event update error:", err);
|
|
619
|
-
if (element.context?.strictMode) throw err;
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
// ../utils/dist/esm/update.js
|
|
733
|
+
var init_update = __esm({
|
|
734
|
+
"../utils/dist/esm/update.js"() {
|
|
620
735
|
}
|
|
621
|
-
};
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
);
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
// ../utils/dist/esm/index.js
|
|
739
|
+
var init_esm = __esm({
|
|
740
|
+
"../utils/dist/esm/index.js"() {
|
|
741
|
+
init_key();
|
|
742
|
+
init_env();
|
|
743
|
+
init_types();
|
|
744
|
+
init_object();
|
|
745
|
+
init_function();
|
|
746
|
+
init_array();
|
|
747
|
+
init_node();
|
|
748
|
+
init_if();
|
|
749
|
+
init_log();
|
|
750
|
+
init_string();
|
|
751
|
+
init_globals();
|
|
752
|
+
init_cookie();
|
|
753
|
+
init_tags();
|
|
754
|
+
init_component();
|
|
755
|
+
init_props();
|
|
756
|
+
init_extends();
|
|
757
|
+
init_element();
|
|
758
|
+
init_state();
|
|
759
|
+
init_keys();
|
|
760
|
+
init_scope();
|
|
761
|
+
init_methods();
|
|
762
|
+
init_cache();
|
|
763
|
+
init_update();
|
|
764
|
+
init_triggerEvent();
|
|
634
765
|
}
|
|
635
|
-
};
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
// index.js
|
|
769
|
+
var index_exports = {};
|
|
770
|
+
__export(index_exports, {
|
|
771
|
+
add: () => add,
|
|
772
|
+
apply: () => apply,
|
|
773
|
+
applyFunction: () => applyFunction,
|
|
774
|
+
applyInitialState: () => applyInitialState,
|
|
775
|
+
applyReplace: () => applyReplace,
|
|
776
|
+
applyStateMethods: () => applyStateMethods,
|
|
777
|
+
clean: () => clean,
|
|
778
|
+
createState: () => createState,
|
|
779
|
+
destroy: () => destroy,
|
|
780
|
+
getByPath: () => getByPath,
|
|
781
|
+
hoistStateUpdate: () => hoistStateUpdate,
|
|
782
|
+
keys: () => keys,
|
|
783
|
+
parentUpdate: () => parentUpdate,
|
|
784
|
+
parse: () => parse,
|
|
785
|
+
quietReplace: () => quietReplace,
|
|
786
|
+
quietUpdate: () => quietUpdate,
|
|
787
|
+
remove: () => remove,
|
|
788
|
+
removeByPath: () => removeByPath,
|
|
789
|
+
removePathCollection: () => removePathCollection,
|
|
790
|
+
replace: () => replace,
|
|
791
|
+
reset: () => reset,
|
|
792
|
+
rootUpdate: () => rootUpdate,
|
|
793
|
+
set: () => set,
|
|
794
|
+
setByPath: () => setByPath,
|
|
795
|
+
setPathCollection: () => setPathCollection,
|
|
796
|
+
toggle: () => toggle,
|
|
797
|
+
updateState: () => updateState,
|
|
798
|
+
values: () => values
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
// create.js
|
|
802
|
+
init_esm();
|
|
803
|
+
|
|
804
|
+
// methods.js
|
|
805
|
+
init_esm();
|
|
636
806
|
|
|
637
807
|
// ../../plugins/report/index.js
|
|
638
808
|
var ERRORS_REGISTRY = {
|
|
@@ -701,12 +871,12 @@ ${element}` : "";
|
|
|
701
871
|
};
|
|
702
872
|
|
|
703
873
|
// updateState.js
|
|
874
|
+
init_esm();
|
|
704
875
|
var STATE_UPDATE_OPTIONS = {
|
|
705
876
|
overwrite: true,
|
|
706
877
|
preventHoistElementUpdate: false,
|
|
707
878
|
updateByState: true,
|
|
708
|
-
isHoisted: true
|
|
709
|
-
execStateFunction: true
|
|
879
|
+
isHoisted: true
|
|
710
880
|
};
|
|
711
881
|
var updateState = function(obj, options = STATE_UPDATE_OPTIONS) {
|
|
712
882
|
const state = this;
|
|
@@ -753,15 +923,15 @@ ${element}` : "";
|
|
|
753
923
|
const passedValue = isStringState ? state.value : obj;
|
|
754
924
|
const findRootState = getRootStateInKey(stateKey, parent.state);
|
|
755
925
|
const findGrandParentState = getParentStateInKey(stateKey, parent.state);
|
|
756
|
-
const
|
|
926
|
+
const cleanKey = stateKey.replaceAll("~/", "").replaceAll("../", "");
|
|
927
|
+
const changesValue = createNestedObjectByKeyPath(cleanKey, passedValue);
|
|
757
928
|
const targetParent = findRootState || findGrandParentState || parent.state;
|
|
758
929
|
if (options.replace) overwriteDeep(targetParent, changesValue || value);
|
|
759
930
|
targetParent.update(changesValue, {
|
|
760
|
-
|
|
931
|
+
...options,
|
|
761
932
|
isHoisted: true,
|
|
762
933
|
preventUpdate: options.preventHoistElementUpdate,
|
|
763
|
-
overwrite: !options.replace
|
|
764
|
-
...options
|
|
934
|
+
overwrite: !options.replace
|
|
765
935
|
});
|
|
766
936
|
const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
|
|
767
937
|
if (!options.preventStateUpdateListener && hasNotUpdated) {
|
|
@@ -1065,3 +1235,4 @@ ${element}` : "";
|
|
|
1065
1235
|
};
|
|
1066
1236
|
return __toCommonJS(index_exports);
|
|
1067
1237
|
})();
|
|
1238
|
+
// @preserve-env
|