@symbo.ls/utils 2.34.0 → 2.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/domqlv3hacks.js +96 -141
- package/dist/cjs/index.js +96 -141
- package/dist/cjs/scaling.js +3 -3
- package/package.json +4 -4
- package/src/domqlv3hacks.js +0 -2
package/dist/cjs/domqlv3hacks.js
CHANGED
|
@@ -24,7 +24,7 @@ __export(domqlv3hacks_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(domqlv3hacks_exports);
|
|
26
26
|
|
|
27
|
-
// ../../../domql/packages/utils/
|
|
27
|
+
// ../../../domql/packages/utils/key.js
|
|
28
28
|
var generateKey = /* @__PURE__ */ (function() {
|
|
29
29
|
let index = 0;
|
|
30
30
|
function newId() {
|
|
@@ -35,16 +35,16 @@ var generateKey = /* @__PURE__ */ (function() {
|
|
|
35
35
|
})();
|
|
36
36
|
var createSnapshotId = generateKey;
|
|
37
37
|
|
|
38
|
-
// ../../../domql/packages/utils/
|
|
38
|
+
// ../../../domql/packages/utils/env.js
|
|
39
39
|
var NODE_ENV = "development";
|
|
40
40
|
var isProduction = (env = NODE_ENV) => env === "production";
|
|
41
41
|
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
42
42
|
|
|
43
|
-
// ../../../domql/packages/utils/
|
|
43
|
+
// ../../../domql/packages/utils/globals.js
|
|
44
44
|
var window2 = globalThis;
|
|
45
45
|
var document2 = window2.document;
|
|
46
46
|
|
|
47
|
-
// ../../../domql/packages/utils/
|
|
47
|
+
// ../../../domql/packages/utils/node.js
|
|
48
48
|
var isNode = (obj) => {
|
|
49
49
|
return (typeof Node === "object" ? obj instanceof window2.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
|
|
50
50
|
};
|
|
@@ -55,7 +55,7 @@ var isDOMNode = (obj) => {
|
|
|
55
55
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
// ../../../domql/packages/utils/
|
|
58
|
+
// ../../../domql/packages/utils/types.js
|
|
59
59
|
var isObject = (arg) => {
|
|
60
60
|
if (arg === null) return false;
|
|
61
61
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -102,7 +102,7 @@ var isNot = (arg) => {
|
|
|
102
102
|
};
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
// ../../../domql/packages/utils/
|
|
105
|
+
// ../../../domql/packages/utils/array.js
|
|
106
106
|
var removeFromArray = (arr, index) => {
|
|
107
107
|
if (isString(index)) index = parseInt(index);
|
|
108
108
|
if (isNumber(index)) {
|
|
@@ -136,31 +136,12 @@ var removeValueFromArray = (arr, value) => {
|
|
|
136
136
|
return arr;
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
// ../../../domql/packages/utils/
|
|
139
|
+
// ../../../domql/packages/utils/string.js
|
|
140
140
|
var lowercaseFirstLetter = (inputString) => {
|
|
141
141
|
return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
// ../../../domql/packages/utils/
|
|
145
|
-
var __defProp2 = Object.defineProperty;
|
|
146
|
-
var __defProps = Object.defineProperties;
|
|
147
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
148
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
149
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
150
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
151
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
152
|
-
var __spreadValues = (a, b) => {
|
|
153
|
-
for (var prop in b || (b = {}))
|
|
154
|
-
if (__hasOwnProp2.call(b, prop))
|
|
155
|
-
__defNormalProp(a, prop, b[prop]);
|
|
156
|
-
if (__getOwnPropSymbols)
|
|
157
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
158
|
-
if (__propIsEnum.call(b, prop))
|
|
159
|
-
__defNormalProp(a, prop, b[prop]);
|
|
160
|
-
}
|
|
161
|
-
return a;
|
|
162
|
-
};
|
|
163
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
144
|
+
// ../../../domql/packages/utils/object.js
|
|
164
145
|
function exec(param, element, state2, context, opts = {}) {
|
|
165
146
|
if (!element) element = this;
|
|
166
147
|
if (isFunction(param)) {
|
|
@@ -189,8 +170,8 @@ var map = (obj, extention, element) => {
|
|
|
189
170
|
};
|
|
190
171
|
var merge = (element, obj, excludeFrom = []) => {
|
|
191
172
|
for (const e in obj) {
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
173
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
|
|
174
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__"))
|
|
194
175
|
continue;
|
|
195
176
|
const elementProp = element[e];
|
|
196
177
|
const objProp = obj[e];
|
|
@@ -202,8 +183,8 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
202
183
|
};
|
|
203
184
|
var deepMerge = (element, extend, excludeFrom = [], level = Infinity) => {
|
|
204
185
|
for (const e in extend) {
|
|
205
|
-
const
|
|
206
|
-
if (!
|
|
186
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
187
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__"))
|
|
207
188
|
continue;
|
|
208
189
|
const elementProp = element[e];
|
|
209
190
|
const extendProp = extend[e];
|
|
@@ -225,8 +206,8 @@ var deepMerge = (element, extend, excludeFrom = [], level = Infinity) => {
|
|
|
225
206
|
var clone = (obj, excludeFrom = []) => {
|
|
226
207
|
const o = {};
|
|
227
208
|
for (const prop in obj) {
|
|
228
|
-
const
|
|
229
|
-
if (!
|
|
209
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, prop);
|
|
210
|
+
if (!hasOwnProperty || excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
230
211
|
continue;
|
|
231
212
|
o[prop] = obj[prop];
|
|
232
213
|
}
|
|
@@ -277,9 +258,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
277
258
|
}
|
|
278
259
|
if (isObjectLike(value)) {
|
|
279
260
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
280
|
-
clone2[key] = deepClone(value,
|
|
261
|
+
clone2[key] = deepClone(value, {
|
|
262
|
+
...options,
|
|
281
263
|
visited
|
|
282
|
-
})
|
|
264
|
+
});
|
|
283
265
|
} else {
|
|
284
266
|
clone2[key] = value;
|
|
285
267
|
}
|
|
@@ -584,16 +566,16 @@ var detectInfiniteLoop = (arr) => {
|
|
|
584
566
|
}
|
|
585
567
|
};
|
|
586
568
|
|
|
587
|
-
// ../../../domql/packages/utils/
|
|
569
|
+
// ../../../domql/packages/utils/function.js
|
|
588
570
|
function getContextFunction(fnKey) {
|
|
589
571
|
var _a, _b, _c, _d;
|
|
590
572
|
return ((_a = this.context.utils) == null ? void 0 : _a[fnKey]) || ((_b = this.context.functions) == null ? void 0 : _b[fnKey]) || ((_c = this.context.methods) == null ? void 0 : _c[fnKey]) || ((_d = this.context.snippets) == null ? void 0 : _d[fnKey]);
|
|
591
573
|
}
|
|
592
574
|
|
|
593
|
-
// ../../../domql/packages/utils/
|
|
575
|
+
// ../../../domql/packages/utils/cookie.js
|
|
594
576
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
595
577
|
|
|
596
|
-
// ../../../domql/packages/utils/
|
|
578
|
+
// ../../../domql/packages/utils/tags.js
|
|
597
579
|
var HTML_TAGS = {
|
|
598
580
|
root: ["body", "html"],
|
|
599
581
|
head: ["title", "base", "meta", "style", "noscript", "script"],
|
|
@@ -726,26 +708,7 @@ var HTML_TAGS = {
|
|
|
726
708
|
};
|
|
727
709
|
var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
|
|
728
710
|
|
|
729
|
-
// ../../../domql/packages/utils/
|
|
730
|
-
var __defProp3 = Object.defineProperty;
|
|
731
|
-
var __defProps2 = Object.defineProperties;
|
|
732
|
-
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
733
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
734
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
735
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
736
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
737
|
-
var __spreadValues2 = (a, b) => {
|
|
738
|
-
for (var prop in b || (b = {}))
|
|
739
|
-
if (__hasOwnProp3.call(b, prop))
|
|
740
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
741
|
-
if (__getOwnPropSymbols2)
|
|
742
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
|
743
|
-
if (__propIsEnum2.call(b, prop))
|
|
744
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
745
|
-
}
|
|
746
|
-
return a;
|
|
747
|
-
};
|
|
748
|
-
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
711
|
+
// ../../../domql/packages/utils/component.js
|
|
749
712
|
var checkIfKeyIsComponent = (key) => {
|
|
750
713
|
const isFirstKeyString = isString(key);
|
|
751
714
|
if (!isFirstKeyString) return;
|
|
@@ -758,7 +721,7 @@ var addAdditionalExtend = (newExtend, element) => {
|
|
|
758
721
|
const originalArray = isArray(elementExtend) ? elementExtend : [elementExtend];
|
|
759
722
|
const receivedArray = isArray(newExtend) ? newExtend : [newExtend];
|
|
760
723
|
const extend = joinArrays(receivedArray, originalArray);
|
|
761
|
-
return
|
|
724
|
+
return { ...element, extend };
|
|
762
725
|
};
|
|
763
726
|
var checkIfSugar = (element, parent2, key) => {
|
|
764
727
|
var _a;
|
|
@@ -802,7 +765,7 @@ var extendizeByKey = (element, parent2, key) => {
|
|
|
802
765
|
const newElem = addAdditionalExtend(element.extends, {
|
|
803
766
|
extend: extendFromKey,
|
|
804
767
|
tag,
|
|
805
|
-
props:
|
|
768
|
+
props: { ...element }
|
|
806
769
|
});
|
|
807
770
|
if (newElem.props.data) {
|
|
808
771
|
newElem.data = newElem.props.data;
|
|
@@ -823,17 +786,18 @@ var extendizeByKey = (element, parent2, key) => {
|
|
|
823
786
|
if (childExtends) newElem.childExtend = childExtends;
|
|
824
787
|
return newElem;
|
|
825
788
|
} else if (!extend || extend === true) {
|
|
826
|
-
return
|
|
789
|
+
return {
|
|
790
|
+
...element,
|
|
827
791
|
tag,
|
|
828
792
|
extend: extendFromKey
|
|
829
|
-
}
|
|
793
|
+
};
|
|
830
794
|
} else if (extend) {
|
|
831
795
|
return addAdditionalExtend(extendFromKey, element);
|
|
832
796
|
} else if (isFunction(element)) {
|
|
833
797
|
return {
|
|
834
798
|
extend: extendFromKey,
|
|
835
799
|
tag,
|
|
836
|
-
props:
|
|
800
|
+
props: { ...exec(element, parent2) }
|
|
837
801
|
};
|
|
838
802
|
}
|
|
839
803
|
};
|
|
@@ -2150,25 +2114,25 @@ var IGNORE_STATE_PARAMS2 = [
|
|
|
2150
2114
|
];
|
|
2151
2115
|
|
|
2152
2116
|
// ../../../domql/packages/state/dist/esm/methods.js
|
|
2153
|
-
var
|
|
2154
|
-
var
|
|
2155
|
-
var
|
|
2156
|
-
var
|
|
2157
|
-
var
|
|
2158
|
-
var
|
|
2159
|
-
var
|
|
2160
|
-
var
|
|
2117
|
+
var __defProp2 = Object.defineProperty;
|
|
2118
|
+
var __defProps = Object.defineProperties;
|
|
2119
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2120
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2121
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
2122
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2123
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2124
|
+
var __spreadValues = (a, b) => {
|
|
2161
2125
|
for (var prop in b || (b = {}))
|
|
2162
|
-
if (
|
|
2163
|
-
|
|
2164
|
-
if (
|
|
2165
|
-
for (var prop of
|
|
2166
|
-
if (
|
|
2167
|
-
|
|
2126
|
+
if (__hasOwnProp2.call(b, prop))
|
|
2127
|
+
__defNormalProp(a, prop, b[prop]);
|
|
2128
|
+
if (__getOwnPropSymbols)
|
|
2129
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
2130
|
+
if (__propIsEnum.call(b, prop))
|
|
2131
|
+
__defNormalProp(a, prop, b[prop]);
|
|
2168
2132
|
}
|
|
2169
2133
|
return a;
|
|
2170
2134
|
};
|
|
2171
|
-
var
|
|
2135
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2172
2136
|
var parse2 = function() {
|
|
2173
2137
|
const state2 = this;
|
|
2174
2138
|
if (isObject(state2)) {
|
|
@@ -2190,7 +2154,7 @@ var clean = async function(options = {}) {
|
|
|
2190
2154
|
}
|
|
2191
2155
|
}
|
|
2192
2156
|
if (!options.preventStateUpdate) {
|
|
2193
|
-
await state2.update(state2,
|
|
2157
|
+
await state2.update(state2, __spreadValues({ replace: true }, options));
|
|
2194
2158
|
}
|
|
2195
2159
|
return state2;
|
|
2196
2160
|
};
|
|
@@ -2199,7 +2163,7 @@ var destroy = async function(options = {}) {
|
|
|
2199
2163
|
const element = state2.__element;
|
|
2200
2164
|
const stateKey = element.__ref.__state;
|
|
2201
2165
|
if (isString(stateKey)) {
|
|
2202
|
-
await element.parent.state.remove(stateKey,
|
|
2166
|
+
await element.parent.state.remove(stateKey, __spreadValues({ isHoisted: true }, options));
|
|
2203
2167
|
return element.state;
|
|
2204
2168
|
}
|
|
2205
2169
|
delete element.state;
|
|
@@ -2227,25 +2191,25 @@ var destroy = async function(options = {}) {
|
|
|
2227
2191
|
}
|
|
2228
2192
|
}
|
|
2229
2193
|
}
|
|
2230
|
-
await element.state.update({},
|
|
2194
|
+
await element.state.update({}, __spreadValues({ isHoisted: true }, options));
|
|
2231
2195
|
return element.state;
|
|
2232
2196
|
};
|
|
2233
2197
|
var parentUpdate = async function(obj, options = {}) {
|
|
2234
2198
|
const state2 = this;
|
|
2235
2199
|
if (!state2 || !state2.parent) return;
|
|
2236
|
-
return await state2.parent.update(obj,
|
|
2200
|
+
return await state2.parent.update(obj, __spreadValues({ isHoisted: true }, options));
|
|
2237
2201
|
};
|
|
2238
2202
|
var rootUpdate = async function(obj, options = {}) {
|
|
2239
2203
|
const state2 = this;
|
|
2240
2204
|
if (!state2) return;
|
|
2241
2205
|
const rootState = state2.__element.__ref.root.state;
|
|
2242
|
-
return await rootState.update(obj,
|
|
2206
|
+
return await rootState.update(obj, __spreadValues({ isHoisted: false }, options));
|
|
2243
2207
|
};
|
|
2244
2208
|
var add = async function(value, options = {}) {
|
|
2245
2209
|
const state2 = this;
|
|
2246
2210
|
if (isArray(state2)) {
|
|
2247
2211
|
await state2.push(value);
|
|
2248
|
-
return await state2.update(state2.parse(),
|
|
2212
|
+
return await state2.update(state2.parse(), __spreadValues({ overwrite: true }, options));
|
|
2249
2213
|
} else if (isObject(state2)) {
|
|
2250
2214
|
const key = Object.keys(state2).length;
|
|
2251
2215
|
return await state2.update({ [key]: value }, options);
|
|
@@ -2260,13 +2224,13 @@ var remove2 = async function(key, options = {}) {
|
|
|
2260
2224
|
if (isArray(state2)) removeFromArray(state2, key);
|
|
2261
2225
|
if (isObject(state2)) removeFromObject(state2, key);
|
|
2262
2226
|
if (options.applyReset)
|
|
2263
|
-
return await state2.set(state2.parse(),
|
|
2227
|
+
return await state2.set(state2.parse(), __spreadValues({ replace: true }, options));
|
|
2264
2228
|
return await state2.update();
|
|
2265
2229
|
};
|
|
2266
2230
|
var set = async function(val, options = {}) {
|
|
2267
2231
|
const state2 = this;
|
|
2268
2232
|
const value = deepClone(val);
|
|
2269
|
-
await state2.clean(
|
|
2233
|
+
await state2.clean(__spreadValues({ preventStateUpdate: true }, options));
|
|
2270
2234
|
await state2.replace(value, options);
|
|
2271
2235
|
return state2;
|
|
2272
2236
|
};
|
|
@@ -2283,7 +2247,7 @@ var setPathCollection = async function(changes, options = {}) {
|
|
|
2283
2247
|
const update3 = await changes.reduce(async (promacc, change) => {
|
|
2284
2248
|
const acc = await promacc;
|
|
2285
2249
|
if (change[0] === "update") {
|
|
2286
|
-
const result = await setByPath.call(state2, change[1], change[2],
|
|
2250
|
+
const result = await setByPath.call(state2, change[1], change[2], __spreadProps(__spreadValues({}, options), {
|
|
2287
2251
|
preventStateUpdate: true
|
|
2288
2252
|
}));
|
|
2289
2253
|
return overwriteDeep(acc, result);
|
|
@@ -2321,13 +2285,13 @@ var getByPath = function(path, options = {}) {
|
|
|
2321
2285
|
var reset = async function(options = {}) {
|
|
2322
2286
|
const state2 = this;
|
|
2323
2287
|
const value = deepClone(state2.parse());
|
|
2324
|
-
return await state2.set(value,
|
|
2288
|
+
return await state2.set(value, __spreadValues({ replace: true }, options));
|
|
2325
2289
|
};
|
|
2326
2290
|
var apply = async function(func, options = {}) {
|
|
2327
2291
|
const state2 = this;
|
|
2328
2292
|
if (isFunction(func)) {
|
|
2329
2293
|
const value = func(state2);
|
|
2330
|
-
return await state2.update(value,
|
|
2294
|
+
return await state2.update(value, __spreadValues({ replace: true }, options));
|
|
2331
2295
|
}
|
|
2332
2296
|
};
|
|
2333
2297
|
var applyReplace = async function(func, options = {}) {
|
|
@@ -2343,12 +2307,12 @@ var applyFunction = async function(func, options = {}) {
|
|
|
2343
2307
|
const result = func(state2);
|
|
2344
2308
|
if (result instanceof Promise) await result;
|
|
2345
2309
|
else result;
|
|
2346
|
-
return await state2.update(state2.parse(),
|
|
2310
|
+
return await state2.update(state2.parse(), __spreadValues({ replace: true }, options));
|
|
2347
2311
|
}
|
|
2348
2312
|
};
|
|
2349
2313
|
var quietUpdate = async function(obj, options = {}) {
|
|
2350
2314
|
const state2 = this;
|
|
2351
|
-
return await state2.update(obj,
|
|
2315
|
+
return await state2.update(obj, __spreadValues({ preventUpdate: true }, options));
|
|
2352
2316
|
};
|
|
2353
2317
|
var replace = async function(obj, options = {}) {
|
|
2354
2318
|
const state2 = this;
|
|
@@ -2359,7 +2323,7 @@ var replace = async function(obj, options = {}) {
|
|
|
2359
2323
|
};
|
|
2360
2324
|
var quietReplace = async function(obj, options = {}) {
|
|
2361
2325
|
const state2 = this;
|
|
2362
|
-
return await state2.replace(obj,
|
|
2326
|
+
return await state2.replace(obj, __spreadValues({ preventUpdate: true }, options));
|
|
2363
2327
|
};
|
|
2364
2328
|
var keys2 = function(obj, options = {}) {
|
|
2365
2329
|
const state2 = this;
|
|
@@ -2454,25 +2418,25 @@ var createNestedObjectByKeyPath = (path, value) => {
|
|
|
2454
2418
|
};
|
|
2455
2419
|
|
|
2456
2420
|
// ../../../domql/packages/state/dist/esm/updateState.js
|
|
2457
|
-
var
|
|
2458
|
-
var
|
|
2459
|
-
var
|
|
2460
|
-
var
|
|
2461
|
-
var
|
|
2462
|
-
var
|
|
2463
|
-
var
|
|
2464
|
-
var
|
|
2421
|
+
var __defProp3 = Object.defineProperty;
|
|
2422
|
+
var __defProps2 = Object.defineProperties;
|
|
2423
|
+
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
2424
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
2425
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
2426
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
2427
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2428
|
+
var __spreadValues2 = (a, b) => {
|
|
2465
2429
|
for (var prop in b || (b = {}))
|
|
2466
|
-
if (
|
|
2467
|
-
|
|
2468
|
-
if (
|
|
2469
|
-
for (var prop of
|
|
2470
|
-
if (
|
|
2471
|
-
|
|
2430
|
+
if (__hasOwnProp3.call(b, prop))
|
|
2431
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
2432
|
+
if (__getOwnPropSymbols2)
|
|
2433
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
2434
|
+
if (__propIsEnum2.call(b, prop))
|
|
2435
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
2472
2436
|
}
|
|
2473
2437
|
return a;
|
|
2474
2438
|
};
|
|
2475
|
-
var
|
|
2439
|
+
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
2476
2440
|
var STATE_UPDATE_OPTIONS = {
|
|
2477
2441
|
overwrite: true,
|
|
2478
2442
|
preventHoistElementUpdate: false,
|
|
@@ -2541,7 +2505,7 @@ var hoistStateUpdate = async (state2, obj, options) => {
|
|
|
2541
2505
|
const changesValue = createNestedObjectByKeyPath(stateKey, passedValue);
|
|
2542
2506
|
const targetParent = findRootState || findGrandParentState || parent2.state;
|
|
2543
2507
|
if (options.replace) overwriteDeep(targetParent, changesValue || value);
|
|
2544
|
-
await targetParent.update(changesValue,
|
|
2508
|
+
await targetParent.update(changesValue, __spreadValues2({
|
|
2545
2509
|
isHoisted: true,
|
|
2546
2510
|
preventUpdate: options.preventHoistElementUpdate,
|
|
2547
2511
|
overwrite: !options.replace
|
|
@@ -2564,14 +2528,14 @@ var applyElementUpdate = async (state2, obj, options) => {
|
|
|
2564
2528
|
if (options.preventUpdate !== true) {
|
|
2565
2529
|
return await element.update(
|
|
2566
2530
|
{},
|
|
2567
|
-
|
|
2531
|
+
__spreadProps2(__spreadValues2({}, options), {
|
|
2568
2532
|
updateByState: true
|
|
2569
2533
|
})
|
|
2570
2534
|
);
|
|
2571
2535
|
} else if (options.preventUpdate === "recursive") {
|
|
2572
2536
|
return await element.update(
|
|
2573
2537
|
{},
|
|
2574
|
-
|
|
2538
|
+
__spreadProps2(__spreadValues2({}, options), {
|
|
2575
2539
|
isHoisted: false,
|
|
2576
2540
|
updateByState: true,
|
|
2577
2541
|
preventUpdate: true
|
|
@@ -2581,25 +2545,25 @@ var applyElementUpdate = async (state2, obj, options) => {
|
|
|
2581
2545
|
};
|
|
2582
2546
|
|
|
2583
2547
|
// ../../../domql/packages/state/dist/esm/create.js
|
|
2584
|
-
var
|
|
2585
|
-
var
|
|
2586
|
-
var
|
|
2587
|
-
var
|
|
2588
|
-
var
|
|
2589
|
-
var
|
|
2590
|
-
var
|
|
2591
|
-
var
|
|
2548
|
+
var __defProp4 = Object.defineProperty;
|
|
2549
|
+
var __defProps3 = Object.defineProperties;
|
|
2550
|
+
var __getOwnPropDescs3 = Object.getOwnPropertyDescriptors;
|
|
2551
|
+
var __getOwnPropSymbols3 = Object.getOwnPropertySymbols;
|
|
2552
|
+
var __hasOwnProp4 = Object.prototype.hasOwnProperty;
|
|
2553
|
+
var __propIsEnum3 = Object.prototype.propertyIsEnumerable;
|
|
2554
|
+
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2555
|
+
var __spreadValues3 = (a, b) => {
|
|
2592
2556
|
for (var prop in b || (b = {}))
|
|
2593
|
-
if (
|
|
2594
|
-
|
|
2595
|
-
if (
|
|
2596
|
-
for (var prop of
|
|
2597
|
-
if (
|
|
2598
|
-
|
|
2557
|
+
if (__hasOwnProp4.call(b, prop))
|
|
2558
|
+
__defNormalProp3(a, prop, b[prop]);
|
|
2559
|
+
if (__getOwnPropSymbols3)
|
|
2560
|
+
for (var prop of __getOwnPropSymbols3(b)) {
|
|
2561
|
+
if (__propIsEnum3.call(b, prop))
|
|
2562
|
+
__defNormalProp3(a, prop, b[prop]);
|
|
2599
2563
|
}
|
|
2600
2564
|
return a;
|
|
2601
2565
|
};
|
|
2602
|
-
var
|
|
2566
|
+
var __spreadProps3 = (a, b) => __defProps3(a, __getOwnPropDescs3(b));
|
|
2603
2567
|
var createState = async function(element, parent2, options) {
|
|
2604
2568
|
element.state = await applyInitialState(element, parent2, options);
|
|
2605
2569
|
return element.state;
|
|
@@ -2629,13 +2593,13 @@ var applyDependentState = (element, state2) => {
|
|
|
2629
2593
|
if (!origState) return;
|
|
2630
2594
|
const dependentState = deepClone(origState, IGNORE_STATE_PARAMS2);
|
|
2631
2595
|
const newDepends = { [element.key + Math.random()]: dependentState };
|
|
2632
|
-
const __depends = isObject(origState.__depends) ?
|
|
2596
|
+
const __depends = isObject(origState.__depends) ? __spreadValues3(__spreadValues3({}, origState.__depends), newDepends) : newDepends;
|
|
2633
2597
|
if (Array.isArray(origState)) {
|
|
2634
|
-
addProtoToArray(origState,
|
|
2598
|
+
addProtoToArray(origState, __spreadProps3(__spreadValues3({}, Object.getPrototypeOf(origState)), {
|
|
2635
2599
|
__depends
|
|
2636
2600
|
}));
|
|
2637
2601
|
} else {
|
|
2638
|
-
Object.setPrototypeOf(origState,
|
|
2602
|
+
Object.setPrototypeOf(origState, __spreadProps3(__spreadValues3({}, Object.getPrototypeOf(origState)), {
|
|
2639
2603
|
__depends
|
|
2640
2604
|
}));
|
|
2641
2605
|
}
|
|
@@ -3020,11 +2984,6 @@ var addMethods = (element, parent2, options = {}) => {
|
|
|
3020
2984
|
Object.setPrototypeOf(element, proto);
|
|
3021
2985
|
};
|
|
3022
2986
|
|
|
3023
|
-
// ../../../domql/packages/utils/env.js
|
|
3024
|
-
var NODE_ENV2 = "development";
|
|
3025
|
-
var isProduction2 = (env = NODE_ENV2) => env === "production";
|
|
3026
|
-
var isNotProduction2 = (env = NODE_ENV2) => !isProduction2(env);
|
|
3027
|
-
|
|
3028
2987
|
// ../../../domql/packages/element/create.js
|
|
3029
2988
|
var create = async (element, parent2, key, options = OPTIONS.create || {}, attachOptions) => {
|
|
3030
2989
|
const isValid = validateElement(element, options);
|
|
@@ -3087,7 +3046,7 @@ var create = async (element, parent2, key, options = OPTIONS.create || {}, attac
|
|
|
3087
3046
|
};
|
|
3088
3047
|
var createBasedOnType = (element, parent2, key, options) => {
|
|
3089
3048
|
if (element === void 0) {
|
|
3090
|
-
if (
|
|
3049
|
+
if (isNotProduction()) {
|
|
3091
3050
|
console.warn(
|
|
3092
3051
|
key,
|
|
3093
3052
|
"element is undefined in",
|
|
@@ -3097,7 +3056,7 @@ var createBasedOnType = (element, parent2, key, options) => {
|
|
|
3097
3056
|
return {};
|
|
3098
3057
|
}
|
|
3099
3058
|
if (isString(key) && key.slice(0, false)) {
|
|
3100
|
-
if (
|
|
3059
|
+
if (isNotProduction()) {
|
|
3101
3060
|
console.warn(key, "seems like to be in __ref");
|
|
3102
3061
|
}
|
|
3103
3062
|
}
|
|
@@ -3215,7 +3174,7 @@ var visitedElements = /* @__PURE__ */ new WeakMap();
|
|
|
3215
3174
|
var renderElement = async (element, parent2, options, attachOptions) => {
|
|
3216
3175
|
var _a, _b, _c, _d;
|
|
3217
3176
|
if (visitedElements.has(element)) {
|
|
3218
|
-
if (
|
|
3177
|
+
if (isNotProduction())
|
|
3219
3178
|
console.warn("Cyclic rendering detected:", element.__ref.path);
|
|
3220
3179
|
}
|
|
3221
3180
|
visitedElements.set(element, true);
|
|
@@ -3226,7 +3185,7 @@ var renderElement = async (element, parent2, options, attachOptions) => {
|
|
|
3226
3185
|
await createNode(element, options);
|
|
3227
3186
|
ref.__uniqId = Math.random();
|
|
3228
3187
|
};
|
|
3229
|
-
if (
|
|
3188
|
+
if (isNotProduction()) {
|
|
3230
3189
|
await createNestedChild();
|
|
3231
3190
|
} else {
|
|
3232
3191
|
try {
|
|
@@ -3782,8 +3741,6 @@ var parseFilters = {
|
|
|
3782
3741
|
|
|
3783
3742
|
// src/domqlv3hacks.js
|
|
3784
3743
|
function temporaryDomqlHack(value) {
|
|
3785
|
-
var _a;
|
|
3786
|
-
if (this && !((_a = this.getUserSettings) == null ? void 0 : _a.call(this, "useDomql3"))) return value;
|
|
3787
3744
|
let obj = { ...value };
|
|
3788
3745
|
const on = obj.on;
|
|
3789
3746
|
if (this.call("isObject", on)) {
|
|
@@ -3812,8 +3769,6 @@ function temporaryDomqlHack(value) {
|
|
|
3812
3769
|
return { ...extendObj, ...obj };
|
|
3813
3770
|
}
|
|
3814
3771
|
function temporaryDomqlHackReverse(value) {
|
|
3815
|
-
var _a;
|
|
3816
|
-
if (this && !((_a = this.getUserSettings) == null ? void 0 : _a.call(this, "useDomql3"))) return value;
|
|
3817
3772
|
const obj = { ...value };
|
|
3818
3773
|
if (obj.extends) {
|
|
3819
3774
|
obj.extend = obj.extends;
|
package/dist/cjs/index.js
CHANGED
|
@@ -46,7 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
});
|
|
47
47
|
module.exports = __toCommonJS(index_exports);
|
|
48
48
|
|
|
49
|
-
// ../../../domql/packages/utils/
|
|
49
|
+
// ../../../domql/packages/utils/key.js
|
|
50
50
|
var generateKey = /* @__PURE__ */ (function() {
|
|
51
51
|
let index = 0;
|
|
52
52
|
function newId() {
|
|
@@ -57,16 +57,16 @@ var generateKey = /* @__PURE__ */ (function() {
|
|
|
57
57
|
})();
|
|
58
58
|
var createSnapshotId = generateKey;
|
|
59
59
|
|
|
60
|
-
// ../../../domql/packages/utils/
|
|
60
|
+
// ../../../domql/packages/utils/env.js
|
|
61
61
|
var NODE_ENV = "development";
|
|
62
62
|
var isProduction = (env = NODE_ENV) => env === "production";
|
|
63
63
|
var isNotProduction = (env = NODE_ENV) => !isProduction(env);
|
|
64
64
|
|
|
65
|
-
// ../../../domql/packages/utils/
|
|
65
|
+
// ../../../domql/packages/utils/globals.js
|
|
66
66
|
var window2 = globalThis;
|
|
67
67
|
var document2 = window2.document;
|
|
68
68
|
|
|
69
|
-
// ../../../domql/packages/utils/
|
|
69
|
+
// ../../../domql/packages/utils/node.js
|
|
70
70
|
var isNode = (obj) => {
|
|
71
71
|
return (typeof Node === "object" ? obj instanceof window2.Node : obj && typeof obj === "object" && typeof obj.nodeType === "number" && typeof obj.nodeName === "string") || false;
|
|
72
72
|
};
|
|
@@ -77,7 +77,7 @@ var isDOMNode = (obj) => {
|
|
|
77
77
|
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
// ../../../domql/packages/utils/
|
|
80
|
+
// ../../../domql/packages/utils/types.js
|
|
81
81
|
var isObject = (arg) => {
|
|
82
82
|
if (arg === null) return false;
|
|
83
83
|
return typeof arg === "object" && arg.constructor === Object;
|
|
@@ -124,7 +124,7 @@ var isNot = (arg) => {
|
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
// ../../../domql/packages/utils/
|
|
127
|
+
// ../../../domql/packages/utils/array.js
|
|
128
128
|
var removeFromArray = (arr, index) => {
|
|
129
129
|
if (isString(index)) index = parseInt(index);
|
|
130
130
|
if (isNumber(index)) {
|
|
@@ -158,31 +158,12 @@ var removeValueFromArray = (arr, value) => {
|
|
|
158
158
|
return arr;
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
// ../../../domql/packages/utils/
|
|
161
|
+
// ../../../domql/packages/utils/string.js
|
|
162
162
|
var lowercaseFirstLetter = (inputString) => {
|
|
163
163
|
return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
// ../../../domql/packages/utils/
|
|
167
|
-
var __defProp2 = Object.defineProperty;
|
|
168
|
-
var __defProps = Object.defineProperties;
|
|
169
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
170
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
171
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
172
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
173
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
174
|
-
var __spreadValues = (a, b) => {
|
|
175
|
-
for (var prop in b || (b = {}))
|
|
176
|
-
if (__hasOwnProp2.call(b, prop))
|
|
177
|
-
__defNormalProp(a, prop, b[prop]);
|
|
178
|
-
if (__getOwnPropSymbols)
|
|
179
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
180
|
-
if (__propIsEnum.call(b, prop))
|
|
181
|
-
__defNormalProp(a, prop, b[prop]);
|
|
182
|
-
}
|
|
183
|
-
return a;
|
|
184
|
-
};
|
|
185
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
166
|
+
// ../../../domql/packages/utils/object.js
|
|
186
167
|
function exec(param, element, state2, context, opts = {}) {
|
|
187
168
|
if (!element) element = this;
|
|
188
169
|
if (isFunction(param)) {
|
|
@@ -211,8 +192,8 @@ var map = (obj, extention, element) => {
|
|
|
211
192
|
};
|
|
212
193
|
var merge = (element, obj, excludeFrom = []) => {
|
|
213
194
|
for (const e in obj) {
|
|
214
|
-
const
|
|
215
|
-
if (!
|
|
195
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, e);
|
|
196
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__"))
|
|
216
197
|
continue;
|
|
217
198
|
const elementProp = element[e];
|
|
218
199
|
const objProp = obj[e];
|
|
@@ -224,8 +205,8 @@ var merge = (element, obj, excludeFrom = []) => {
|
|
|
224
205
|
};
|
|
225
206
|
var deepMerge = (element, extend, excludeFrom = [], level = Infinity) => {
|
|
226
207
|
for (const e in extend) {
|
|
227
|
-
const
|
|
228
|
-
if (!
|
|
208
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(extend, e);
|
|
209
|
+
if (!hasOwnProperty || excludeFrom.includes(e) || e.startsWith("__"))
|
|
229
210
|
continue;
|
|
230
211
|
const elementProp = element[e];
|
|
231
212
|
const extendProp = extend[e];
|
|
@@ -247,8 +228,8 @@ var deepMerge = (element, extend, excludeFrom = [], level = Infinity) => {
|
|
|
247
228
|
var clone = (obj, excludeFrom = []) => {
|
|
248
229
|
const o = {};
|
|
249
230
|
for (const prop in obj) {
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
231
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj, prop);
|
|
232
|
+
if (!hasOwnProperty || excludeFrom.includes(prop) || prop.startsWith("__"))
|
|
252
233
|
continue;
|
|
253
234
|
o[prop] = obj[prop];
|
|
254
235
|
}
|
|
@@ -299,9 +280,10 @@ var deepClone = (obj, options = {}) => {
|
|
|
299
280
|
}
|
|
300
281
|
if (isObjectLike(value)) {
|
|
301
282
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
302
|
-
clone2[key] = deepClone(value,
|
|
283
|
+
clone2[key] = deepClone(value, {
|
|
284
|
+
...options,
|
|
303
285
|
visited
|
|
304
|
-
})
|
|
286
|
+
});
|
|
305
287
|
} else {
|
|
306
288
|
clone2[key] = value;
|
|
307
289
|
}
|
|
@@ -606,16 +588,16 @@ var detectInfiniteLoop = (arr) => {
|
|
|
606
588
|
}
|
|
607
589
|
};
|
|
608
590
|
|
|
609
|
-
// ../../../domql/packages/utils/
|
|
591
|
+
// ../../../domql/packages/utils/function.js
|
|
610
592
|
function getContextFunction(fnKey) {
|
|
611
593
|
var _a, _b, _c, _d;
|
|
612
594
|
return ((_a = this.context.utils) == null ? void 0 : _a[fnKey]) || ((_b = this.context.functions) == null ? void 0 : _b[fnKey]) || ((_c = this.context.methods) == null ? void 0 : _c[fnKey]) || ((_d = this.context.snippets) == null ? void 0 : _d[fnKey]);
|
|
613
595
|
}
|
|
614
596
|
|
|
615
|
-
// ../../../domql/packages/utils/
|
|
597
|
+
// ../../../domql/packages/utils/cookie.js
|
|
616
598
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
617
599
|
|
|
618
|
-
// ../../../domql/packages/utils/
|
|
600
|
+
// ../../../domql/packages/utils/tags.js
|
|
619
601
|
var HTML_TAGS = {
|
|
620
602
|
root: ["body", "html"],
|
|
621
603
|
head: ["title", "base", "meta", "style", "noscript", "script"],
|
|
@@ -748,26 +730,7 @@ var HTML_TAGS = {
|
|
|
748
730
|
};
|
|
749
731
|
var isValidHtmlTag = (arg) => HTML_TAGS.body.includes(arg);
|
|
750
732
|
|
|
751
|
-
// ../../../domql/packages/utils/
|
|
752
|
-
var __defProp3 = Object.defineProperty;
|
|
753
|
-
var __defProps2 = Object.defineProperties;
|
|
754
|
-
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
755
|
-
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
756
|
-
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
757
|
-
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
758
|
-
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
759
|
-
var __spreadValues2 = (a, b) => {
|
|
760
|
-
for (var prop in b || (b = {}))
|
|
761
|
-
if (__hasOwnProp3.call(b, prop))
|
|
762
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
763
|
-
if (__getOwnPropSymbols2)
|
|
764
|
-
for (var prop of __getOwnPropSymbols2(b)) {
|
|
765
|
-
if (__propIsEnum2.call(b, prop))
|
|
766
|
-
__defNormalProp2(a, prop, b[prop]);
|
|
767
|
-
}
|
|
768
|
-
return a;
|
|
769
|
-
};
|
|
770
|
-
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
733
|
+
// ../../../domql/packages/utils/component.js
|
|
771
734
|
var checkIfKeyIsComponent = (key) => {
|
|
772
735
|
const isFirstKeyString = isString(key);
|
|
773
736
|
if (!isFirstKeyString) return;
|
|
@@ -780,7 +743,7 @@ var addAdditionalExtend = (newExtend, element) => {
|
|
|
780
743
|
const originalArray = isArray(elementExtend) ? elementExtend : [elementExtend];
|
|
781
744
|
const receivedArray = isArray(newExtend) ? newExtend : [newExtend];
|
|
782
745
|
const extend = joinArrays(receivedArray, originalArray);
|
|
783
|
-
return
|
|
746
|
+
return { ...element, extend };
|
|
784
747
|
};
|
|
785
748
|
var checkIfSugar = (element, parent2, key) => {
|
|
786
749
|
var _a;
|
|
@@ -824,7 +787,7 @@ var extendizeByKey = (element, parent2, key) => {
|
|
|
824
787
|
const newElem = addAdditionalExtend(element.extends, {
|
|
825
788
|
extend: extendFromKey,
|
|
826
789
|
tag,
|
|
827
|
-
props:
|
|
790
|
+
props: { ...element }
|
|
828
791
|
});
|
|
829
792
|
if (newElem.props.data) {
|
|
830
793
|
newElem.data = newElem.props.data;
|
|
@@ -845,17 +808,18 @@ var extendizeByKey = (element, parent2, key) => {
|
|
|
845
808
|
if (childExtends) newElem.childExtend = childExtends;
|
|
846
809
|
return newElem;
|
|
847
810
|
} else if (!extend || extend === true) {
|
|
848
|
-
return
|
|
811
|
+
return {
|
|
812
|
+
...element,
|
|
849
813
|
tag,
|
|
850
814
|
extend: extendFromKey
|
|
851
|
-
}
|
|
815
|
+
};
|
|
852
816
|
} else if (extend) {
|
|
853
817
|
return addAdditionalExtend(extendFromKey, element);
|
|
854
818
|
} else if (isFunction(element)) {
|
|
855
819
|
return {
|
|
856
820
|
extend: extendFromKey,
|
|
857
821
|
tag,
|
|
858
|
-
props:
|
|
822
|
+
props: { ...exec(element, parent2) }
|
|
859
823
|
};
|
|
860
824
|
}
|
|
861
825
|
};
|
|
@@ -2363,25 +2327,25 @@ var IGNORE_STATE_PARAMS2 = [
|
|
|
2363
2327
|
];
|
|
2364
2328
|
|
|
2365
2329
|
// ../../../domql/packages/state/dist/esm/methods.js
|
|
2366
|
-
var
|
|
2367
|
-
var
|
|
2368
|
-
var
|
|
2369
|
-
var
|
|
2370
|
-
var
|
|
2371
|
-
var
|
|
2372
|
-
var
|
|
2373
|
-
var
|
|
2330
|
+
var __defProp2 = Object.defineProperty;
|
|
2331
|
+
var __defProps = Object.defineProperties;
|
|
2332
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2333
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2334
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
2335
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2336
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2337
|
+
var __spreadValues = (a, b) => {
|
|
2374
2338
|
for (var prop in b || (b = {}))
|
|
2375
|
-
if (
|
|
2376
|
-
|
|
2377
|
-
if (
|
|
2378
|
-
for (var prop of
|
|
2379
|
-
if (
|
|
2380
|
-
|
|
2339
|
+
if (__hasOwnProp2.call(b, prop))
|
|
2340
|
+
__defNormalProp(a, prop, b[prop]);
|
|
2341
|
+
if (__getOwnPropSymbols)
|
|
2342
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
2343
|
+
if (__propIsEnum.call(b, prop))
|
|
2344
|
+
__defNormalProp(a, prop, b[prop]);
|
|
2381
2345
|
}
|
|
2382
2346
|
return a;
|
|
2383
2347
|
};
|
|
2384
|
-
var
|
|
2348
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2385
2349
|
var parse2 = function() {
|
|
2386
2350
|
const state2 = this;
|
|
2387
2351
|
if (isObject(state2)) {
|
|
@@ -2403,7 +2367,7 @@ var clean = async function(options = {}) {
|
|
|
2403
2367
|
}
|
|
2404
2368
|
}
|
|
2405
2369
|
if (!options.preventStateUpdate) {
|
|
2406
|
-
await state2.update(state2,
|
|
2370
|
+
await state2.update(state2, __spreadValues({ replace: true }, options));
|
|
2407
2371
|
}
|
|
2408
2372
|
return state2;
|
|
2409
2373
|
};
|
|
@@ -2412,7 +2376,7 @@ var destroy = async function(options = {}) {
|
|
|
2412
2376
|
const element = state2.__element;
|
|
2413
2377
|
const stateKey = element.__ref.__state;
|
|
2414
2378
|
if (isString(stateKey)) {
|
|
2415
|
-
await element.parent.state.remove(stateKey,
|
|
2379
|
+
await element.parent.state.remove(stateKey, __spreadValues({ isHoisted: true }, options));
|
|
2416
2380
|
return element.state;
|
|
2417
2381
|
}
|
|
2418
2382
|
delete element.state;
|
|
@@ -2440,25 +2404,25 @@ var destroy = async function(options = {}) {
|
|
|
2440
2404
|
}
|
|
2441
2405
|
}
|
|
2442
2406
|
}
|
|
2443
|
-
await element.state.update({},
|
|
2407
|
+
await element.state.update({}, __spreadValues({ isHoisted: true }, options));
|
|
2444
2408
|
return element.state;
|
|
2445
2409
|
};
|
|
2446
2410
|
var parentUpdate = async function(obj, options = {}) {
|
|
2447
2411
|
const state2 = this;
|
|
2448
2412
|
if (!state2 || !state2.parent) return;
|
|
2449
|
-
return await state2.parent.update(obj,
|
|
2413
|
+
return await state2.parent.update(obj, __spreadValues({ isHoisted: true }, options));
|
|
2450
2414
|
};
|
|
2451
2415
|
var rootUpdate = async function(obj, options = {}) {
|
|
2452
2416
|
const state2 = this;
|
|
2453
2417
|
if (!state2) return;
|
|
2454
2418
|
const rootState = state2.__element.__ref.root.state;
|
|
2455
|
-
return await rootState.update(obj,
|
|
2419
|
+
return await rootState.update(obj, __spreadValues({ isHoisted: false }, options));
|
|
2456
2420
|
};
|
|
2457
2421
|
var add = async function(value, options = {}) {
|
|
2458
2422
|
const state2 = this;
|
|
2459
2423
|
if (isArray(state2)) {
|
|
2460
2424
|
await state2.push(value);
|
|
2461
|
-
return await state2.update(state2.parse(),
|
|
2425
|
+
return await state2.update(state2.parse(), __spreadValues({ overwrite: true }, options));
|
|
2462
2426
|
} else if (isObject(state2)) {
|
|
2463
2427
|
const key = Object.keys(state2).length;
|
|
2464
2428
|
return await state2.update({ [key]: value }, options);
|
|
@@ -2473,13 +2437,13 @@ var remove2 = async function(key, options = {}) {
|
|
|
2473
2437
|
if (isArray(state2)) removeFromArray(state2, key);
|
|
2474
2438
|
if (isObject(state2)) removeFromObject(state2, key);
|
|
2475
2439
|
if (options.applyReset)
|
|
2476
|
-
return await state2.set(state2.parse(),
|
|
2440
|
+
return await state2.set(state2.parse(), __spreadValues({ replace: true }, options));
|
|
2477
2441
|
return await state2.update();
|
|
2478
2442
|
};
|
|
2479
2443
|
var set = async function(val, options = {}) {
|
|
2480
2444
|
const state2 = this;
|
|
2481
2445
|
const value = deepClone(val);
|
|
2482
|
-
await state2.clean(
|
|
2446
|
+
await state2.clean(__spreadValues({ preventStateUpdate: true }, options));
|
|
2483
2447
|
await state2.replace(value, options);
|
|
2484
2448
|
return state2;
|
|
2485
2449
|
};
|
|
@@ -2496,7 +2460,7 @@ var setPathCollection = async function(changes, options = {}) {
|
|
|
2496
2460
|
const update3 = await changes.reduce(async (promacc, change) => {
|
|
2497
2461
|
const acc = await promacc;
|
|
2498
2462
|
if (change[0] === "update") {
|
|
2499
|
-
const result = await setByPath.call(state2, change[1], change[2],
|
|
2463
|
+
const result = await setByPath.call(state2, change[1], change[2], __spreadProps(__spreadValues({}, options), {
|
|
2500
2464
|
preventStateUpdate: true
|
|
2501
2465
|
}));
|
|
2502
2466
|
return overwriteDeep(acc, result);
|
|
@@ -2534,13 +2498,13 @@ var getByPath = function(path, options = {}) {
|
|
|
2534
2498
|
var reset = async function(options = {}) {
|
|
2535
2499
|
const state2 = this;
|
|
2536
2500
|
const value = deepClone(state2.parse());
|
|
2537
|
-
return await state2.set(value,
|
|
2501
|
+
return await state2.set(value, __spreadValues({ replace: true }, options));
|
|
2538
2502
|
};
|
|
2539
2503
|
var apply = async function(func, options = {}) {
|
|
2540
2504
|
const state2 = this;
|
|
2541
2505
|
if (isFunction(func)) {
|
|
2542
2506
|
const value = func(state2);
|
|
2543
|
-
return await state2.update(value,
|
|
2507
|
+
return await state2.update(value, __spreadValues({ replace: true }, options));
|
|
2544
2508
|
}
|
|
2545
2509
|
};
|
|
2546
2510
|
var applyReplace = async function(func, options = {}) {
|
|
@@ -2556,12 +2520,12 @@ var applyFunction = async function(func, options = {}) {
|
|
|
2556
2520
|
const result = func(state2);
|
|
2557
2521
|
if (result instanceof Promise) await result;
|
|
2558
2522
|
else result;
|
|
2559
|
-
return await state2.update(state2.parse(),
|
|
2523
|
+
return await state2.update(state2.parse(), __spreadValues({ replace: true }, options));
|
|
2560
2524
|
}
|
|
2561
2525
|
};
|
|
2562
2526
|
var quietUpdate = async function(obj, options = {}) {
|
|
2563
2527
|
const state2 = this;
|
|
2564
|
-
return await state2.update(obj,
|
|
2528
|
+
return await state2.update(obj, __spreadValues({ preventUpdate: true }, options));
|
|
2565
2529
|
};
|
|
2566
2530
|
var replace = async function(obj, options = {}) {
|
|
2567
2531
|
const state2 = this;
|
|
@@ -2572,7 +2536,7 @@ var replace = async function(obj, options = {}) {
|
|
|
2572
2536
|
};
|
|
2573
2537
|
var quietReplace = async function(obj, options = {}) {
|
|
2574
2538
|
const state2 = this;
|
|
2575
|
-
return await state2.replace(obj,
|
|
2539
|
+
return await state2.replace(obj, __spreadValues({ preventUpdate: true }, options));
|
|
2576
2540
|
};
|
|
2577
2541
|
var keys2 = function(obj, options = {}) {
|
|
2578
2542
|
const state2 = this;
|
|
@@ -2667,25 +2631,25 @@ var createNestedObjectByKeyPath = (path, value) => {
|
|
|
2667
2631
|
};
|
|
2668
2632
|
|
|
2669
2633
|
// ../../../domql/packages/state/dist/esm/updateState.js
|
|
2670
|
-
var
|
|
2671
|
-
var
|
|
2672
|
-
var
|
|
2673
|
-
var
|
|
2674
|
-
var
|
|
2675
|
-
var
|
|
2676
|
-
var
|
|
2677
|
-
var
|
|
2634
|
+
var __defProp3 = Object.defineProperty;
|
|
2635
|
+
var __defProps2 = Object.defineProperties;
|
|
2636
|
+
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
2637
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
2638
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
2639
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
2640
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2641
|
+
var __spreadValues2 = (a, b) => {
|
|
2678
2642
|
for (var prop in b || (b = {}))
|
|
2679
|
-
if (
|
|
2680
|
-
|
|
2681
|
-
if (
|
|
2682
|
-
for (var prop of
|
|
2683
|
-
if (
|
|
2684
|
-
|
|
2643
|
+
if (__hasOwnProp3.call(b, prop))
|
|
2644
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
2645
|
+
if (__getOwnPropSymbols2)
|
|
2646
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
2647
|
+
if (__propIsEnum2.call(b, prop))
|
|
2648
|
+
__defNormalProp2(a, prop, b[prop]);
|
|
2685
2649
|
}
|
|
2686
2650
|
return a;
|
|
2687
2651
|
};
|
|
2688
|
-
var
|
|
2652
|
+
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
2689
2653
|
var STATE_UPDATE_OPTIONS = {
|
|
2690
2654
|
overwrite: true,
|
|
2691
2655
|
preventHoistElementUpdate: false,
|
|
@@ -2754,7 +2718,7 @@ var hoistStateUpdate = async (state2, obj, options) => {
|
|
|
2754
2718
|
const changesValue = createNestedObjectByKeyPath(stateKey, passedValue);
|
|
2755
2719
|
const targetParent = findRootState || findGrandParentState || parent2.state;
|
|
2756
2720
|
if (options.replace) overwriteDeep(targetParent, changesValue || value);
|
|
2757
|
-
await targetParent.update(changesValue,
|
|
2721
|
+
await targetParent.update(changesValue, __spreadValues2({
|
|
2758
2722
|
isHoisted: true,
|
|
2759
2723
|
preventUpdate: options.preventHoistElementUpdate,
|
|
2760
2724
|
overwrite: !options.replace
|
|
@@ -2777,14 +2741,14 @@ var applyElementUpdate = async (state2, obj, options) => {
|
|
|
2777
2741
|
if (options.preventUpdate !== true) {
|
|
2778
2742
|
return await element.update(
|
|
2779
2743
|
{},
|
|
2780
|
-
|
|
2744
|
+
__spreadProps2(__spreadValues2({}, options), {
|
|
2781
2745
|
updateByState: true
|
|
2782
2746
|
})
|
|
2783
2747
|
);
|
|
2784
2748
|
} else if (options.preventUpdate === "recursive") {
|
|
2785
2749
|
return await element.update(
|
|
2786
2750
|
{},
|
|
2787
|
-
|
|
2751
|
+
__spreadProps2(__spreadValues2({}, options), {
|
|
2788
2752
|
isHoisted: false,
|
|
2789
2753
|
updateByState: true,
|
|
2790
2754
|
preventUpdate: true
|
|
@@ -2794,25 +2758,25 @@ var applyElementUpdate = async (state2, obj, options) => {
|
|
|
2794
2758
|
};
|
|
2795
2759
|
|
|
2796
2760
|
// ../../../domql/packages/state/dist/esm/create.js
|
|
2797
|
-
var
|
|
2798
|
-
var
|
|
2799
|
-
var
|
|
2800
|
-
var
|
|
2801
|
-
var
|
|
2802
|
-
var
|
|
2803
|
-
var
|
|
2804
|
-
var
|
|
2761
|
+
var __defProp4 = Object.defineProperty;
|
|
2762
|
+
var __defProps3 = Object.defineProperties;
|
|
2763
|
+
var __getOwnPropDescs3 = Object.getOwnPropertyDescriptors;
|
|
2764
|
+
var __getOwnPropSymbols3 = Object.getOwnPropertySymbols;
|
|
2765
|
+
var __hasOwnProp4 = Object.prototype.hasOwnProperty;
|
|
2766
|
+
var __propIsEnum3 = Object.prototype.propertyIsEnumerable;
|
|
2767
|
+
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2768
|
+
var __spreadValues3 = (a, b) => {
|
|
2805
2769
|
for (var prop in b || (b = {}))
|
|
2806
|
-
if (
|
|
2807
|
-
|
|
2808
|
-
if (
|
|
2809
|
-
for (var prop of
|
|
2810
|
-
if (
|
|
2811
|
-
|
|
2770
|
+
if (__hasOwnProp4.call(b, prop))
|
|
2771
|
+
__defNormalProp3(a, prop, b[prop]);
|
|
2772
|
+
if (__getOwnPropSymbols3)
|
|
2773
|
+
for (var prop of __getOwnPropSymbols3(b)) {
|
|
2774
|
+
if (__propIsEnum3.call(b, prop))
|
|
2775
|
+
__defNormalProp3(a, prop, b[prop]);
|
|
2812
2776
|
}
|
|
2813
2777
|
return a;
|
|
2814
2778
|
};
|
|
2815
|
-
var
|
|
2779
|
+
var __spreadProps3 = (a, b) => __defProps3(a, __getOwnPropDescs3(b));
|
|
2816
2780
|
var createState = async function(element, parent2, options) {
|
|
2817
2781
|
element.state = await applyInitialState(element, parent2, options);
|
|
2818
2782
|
return element.state;
|
|
@@ -2842,13 +2806,13 @@ var applyDependentState = (element, state2) => {
|
|
|
2842
2806
|
if (!origState) return;
|
|
2843
2807
|
const dependentState = deepClone(origState, IGNORE_STATE_PARAMS2);
|
|
2844
2808
|
const newDepends = { [element.key + Math.random()]: dependentState };
|
|
2845
|
-
const __depends = isObject(origState.__depends) ?
|
|
2809
|
+
const __depends = isObject(origState.__depends) ? __spreadValues3(__spreadValues3({}, origState.__depends), newDepends) : newDepends;
|
|
2846
2810
|
if (Array.isArray(origState)) {
|
|
2847
|
-
addProtoToArray(origState,
|
|
2811
|
+
addProtoToArray(origState, __spreadProps3(__spreadValues3({}, Object.getPrototypeOf(origState)), {
|
|
2848
2812
|
__depends
|
|
2849
2813
|
}));
|
|
2850
2814
|
} else {
|
|
2851
|
-
Object.setPrototypeOf(origState,
|
|
2815
|
+
Object.setPrototypeOf(origState, __spreadProps3(__spreadValues3({}, Object.getPrototypeOf(origState)), {
|
|
2852
2816
|
__depends
|
|
2853
2817
|
}));
|
|
2854
2818
|
}
|
|
@@ -3233,11 +3197,6 @@ var addMethods = (element, parent2, options = {}) => {
|
|
|
3233
3197
|
Object.setPrototypeOf(element, proto);
|
|
3234
3198
|
};
|
|
3235
3199
|
|
|
3236
|
-
// ../../../domql/packages/utils/env.js
|
|
3237
|
-
var NODE_ENV2 = "development";
|
|
3238
|
-
var isProduction2 = (env = NODE_ENV2) => env === "production";
|
|
3239
|
-
var isNotProduction2 = (env = NODE_ENV2) => !isProduction2(env);
|
|
3240
|
-
|
|
3241
3200
|
// ../../../domql/packages/element/create.js
|
|
3242
3201
|
var create = async (element, parent2, key, options = OPTIONS.create || {}, attachOptions) => {
|
|
3243
3202
|
const isValid = validateElement(element, options);
|
|
@@ -3300,7 +3259,7 @@ var create = async (element, parent2, key, options = OPTIONS.create || {}, attac
|
|
|
3300
3259
|
};
|
|
3301
3260
|
var createBasedOnType = (element, parent2, key, options) => {
|
|
3302
3261
|
if (element === void 0) {
|
|
3303
|
-
if (
|
|
3262
|
+
if (isNotProduction()) {
|
|
3304
3263
|
console.warn(
|
|
3305
3264
|
key,
|
|
3306
3265
|
"element is undefined in",
|
|
@@ -3310,7 +3269,7 @@ var createBasedOnType = (element, parent2, key, options) => {
|
|
|
3310
3269
|
return {};
|
|
3311
3270
|
}
|
|
3312
3271
|
if (isString(key) && key.slice(0, false)) {
|
|
3313
|
-
if (
|
|
3272
|
+
if (isNotProduction()) {
|
|
3314
3273
|
console.warn(key, "seems like to be in __ref");
|
|
3315
3274
|
}
|
|
3316
3275
|
}
|
|
@@ -3428,7 +3387,7 @@ var visitedElements = /* @__PURE__ */ new WeakMap();
|
|
|
3428
3387
|
var renderElement = async (element, parent2, options, attachOptions) => {
|
|
3429
3388
|
var _a, _b, _c, _d;
|
|
3430
3389
|
if (visitedElements.has(element)) {
|
|
3431
|
-
if (
|
|
3390
|
+
if (isNotProduction())
|
|
3432
3391
|
console.warn("Cyclic rendering detected:", element.__ref.path);
|
|
3433
3392
|
}
|
|
3434
3393
|
visitedElements.set(element, true);
|
|
@@ -3439,7 +3398,7 @@ var renderElement = async (element, parent2, options, attachOptions) => {
|
|
|
3439
3398
|
await createNode(element, options);
|
|
3440
3399
|
ref.__uniqId = Math.random();
|
|
3441
3400
|
};
|
|
3442
|
-
if (
|
|
3401
|
+
if (isNotProduction()) {
|
|
3443
3402
|
await createNestedChild();
|
|
3444
3403
|
} else {
|
|
3445
3404
|
try {
|
|
@@ -3995,8 +3954,6 @@ var parseFilters = {
|
|
|
3995
3954
|
|
|
3996
3955
|
// src/domqlv3hacks.js
|
|
3997
3956
|
function temporaryDomqlHack(value) {
|
|
3998
|
-
var _a;
|
|
3999
|
-
if (this && !((_a = this.getUserSettings) == null ? void 0 : _a.call(this, "useDomql3"))) return value;
|
|
4000
3957
|
let obj = { ...value };
|
|
4001
3958
|
const on = obj.on;
|
|
4002
3959
|
if (this.call("isObject", on)) {
|
|
@@ -4025,8 +3982,6 @@ function temporaryDomqlHack(value) {
|
|
|
4025
3982
|
return { ...extendObj, ...obj };
|
|
4026
3983
|
}
|
|
4027
3984
|
function temporaryDomqlHackReverse(value) {
|
|
4028
|
-
var _a;
|
|
4029
|
-
if (this && !((_a = this.getUserSettings) == null ? void 0 : _a.call(this, "useDomql3"))) return value;
|
|
4030
3985
|
const obj = { ...value };
|
|
4031
3986
|
if (obj.extends) {
|
|
4032
3987
|
obj.extend = obj.extends;
|
package/dist/cjs/scaling.js
CHANGED
|
@@ -25,18 +25,18 @@ __export(scaling_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(scaling_exports);
|
|
27
27
|
|
|
28
|
-
// ../../../domql/packages/utils/
|
|
28
|
+
// ../../../domql/packages/utils/globals.js
|
|
29
29
|
var window2 = globalThis;
|
|
30
30
|
var document2 = window2.document;
|
|
31
31
|
|
|
32
|
-
// ../../../domql/packages/utils/
|
|
32
|
+
// ../../../domql/packages/utils/types.js
|
|
33
33
|
var isObject = (arg) => {
|
|
34
34
|
if (arg === null) return false;
|
|
35
35
|
return typeof arg === "object" && arg.constructor === Object;
|
|
36
36
|
};
|
|
37
37
|
var isArray = (arg) => Array.isArray(arg);
|
|
38
38
|
|
|
39
|
-
// ../../../domql/packages/utils/
|
|
39
|
+
// ../../../domql/packages/utils/cookie.js
|
|
40
40
|
var isMobile = (() => typeof navigator === "undefined" ? false : /Mobi/.test(navigator.userAgent))();
|
|
41
41
|
|
|
42
42
|
// src/scaling.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/utils",
|
|
3
|
-
"version": "2.34.
|
|
3
|
+
"version": "2.34.2",
|
|
4
4
|
"author": "symbo.ls",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@domql/element": "^2.34.
|
|
28
|
-
"@domql/utils": "^2.34.
|
|
27
|
+
"@domql/element": "^2.34.2",
|
|
28
|
+
"@domql/utils": "^2.34.2"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "fb12105837bedc8f038614c2cf77ed7a5e02619b"
|
|
31
31
|
}
|
package/src/domqlv3hacks.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { REGISTRY } from '@domql/element/mixins/registry.js'
|
|
2
2
|
|
|
3
3
|
export function temporaryDomqlHack(value) {
|
|
4
|
-
if (this && !this.getUserSettings?.('useDomql3')) return value
|
|
5
4
|
let obj = { ...value }
|
|
6
5
|
const on = obj.on
|
|
7
6
|
if (this.call('isObject', on)) {
|
|
@@ -31,7 +30,6 @@ export function temporaryDomqlHack(value) {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
export function temporaryDomqlHackReverse(value) {
|
|
34
|
-
if (this && !this.getUserSettings?.('useDomql3')) return value
|
|
35
33
|
const obj = { ...value }
|
|
36
34
|
if (obj.extends) {
|
|
37
35
|
obj.extend = obj.extends
|