domql 3.4.0 → 3.4.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/iife/index.js +20 -12
- package/package.json +4 -4
package/dist/iife/index.js
CHANGED
|
@@ -2614,13 +2614,17 @@ ${element}` : "";
|
|
|
2614
2614
|
};
|
|
2615
2615
|
|
|
2616
2616
|
// ../element/dist/esm/children.js
|
|
2617
|
-
var
|
|
2617
|
+
var deepChildrenEqual = (a, b) => {
|
|
2618
2618
|
if (a === b) return true;
|
|
2619
2619
|
if (!a || !b) return false;
|
|
2620
|
+
const typeA = typeof a;
|
|
2621
|
+
const typeB = typeof b;
|
|
2622
|
+
if (typeA === "function" && typeB === "function") return true;
|
|
2623
|
+
if (typeA !== typeB) return false;
|
|
2620
2624
|
if (isArray(a) && isArray(b)) {
|
|
2621
2625
|
if (a.length !== b.length) return false;
|
|
2622
2626
|
for (let i = 0; i < a.length; i++) {
|
|
2623
|
-
if (a[i]
|
|
2627
|
+
if (!deepChildrenEqual(a[i], b[i])) return false;
|
|
2624
2628
|
}
|
|
2625
2629
|
return true;
|
|
2626
2630
|
}
|
|
@@ -2630,7 +2634,7 @@ ${element}` : "";
|
|
|
2630
2634
|
if (keysA.length !== keysB.length) return false;
|
|
2631
2635
|
for (let i = 0; i < keysA.length; i++) {
|
|
2632
2636
|
const key = keysA[i];
|
|
2633
|
-
if (a[key]
|
|
2637
|
+
if (!deepChildrenEqual(a[key], b[key])) return false;
|
|
2634
2638
|
}
|
|
2635
2639
|
return true;
|
|
2636
2640
|
}
|
|
@@ -2682,7 +2686,7 @@ ${element}` : "";
|
|
|
2682
2686
|
}
|
|
2683
2687
|
let cloned;
|
|
2684
2688
|
if (ref.__childrenCache) {
|
|
2685
|
-
if (
|
|
2689
|
+
if (deepChildrenEqual(children, ref.__childrenCache)) {
|
|
2686
2690
|
ref.__noChildrenDifference = true;
|
|
2687
2691
|
} else {
|
|
2688
2692
|
cloned = deepClone(children);
|
|
@@ -3298,6 +3302,7 @@ ${element}` : "";
|
|
|
3298
3302
|
const hasBeforeUpdate = element.on?.beforeUpdate || element.props?.onBeforeUpdate;
|
|
3299
3303
|
if (hasBeforeUpdate) {
|
|
3300
3304
|
const simulate = { ...params, ...element };
|
|
3305
|
+
Object.setPrototypeOf(simulate, Object.getPrototypeOf(element));
|
|
3301
3306
|
const beforeUpdateReturns = triggerEventOnUpdate(
|
|
3302
3307
|
"beforeUpdate",
|
|
3303
3308
|
params,
|
|
@@ -3356,12 +3361,15 @@ ${element}` : "";
|
|
|
3356
3361
|
options.onEachUpdate(param, element, element.state, element.context);
|
|
3357
3362
|
}
|
|
3358
3363
|
const childParams = params[param];
|
|
3359
|
-
if (childParams === void 0 && !options.isForced)
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3364
|
+
if (childParams === void 0 && !options.isForced) {
|
|
3365
|
+
if (options.onlyUpdate) {
|
|
3366
|
+
if (param !== options.onlyUpdate) continue;
|
|
3367
|
+
} else if (!options.updateByState) {
|
|
3368
|
+
continue;
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
const childOptions = options.onlyUpdate && param === options.onlyUpdate ? { ...options, onlyUpdate: void 0, currentSnapshot: snapshotOnCallee, calleeElement } : { ...options, currentSnapshot: snapshotOnCallee, calleeElement };
|
|
3372
|
+
const childUpdateCall = () => update2.call(prop, childParams, childOptions);
|
|
3365
3373
|
if (lazyLoad) {
|
|
3366
3374
|
window2.requestAnimationFrame(() => {
|
|
3367
3375
|
childUpdateCall();
|
|
@@ -3375,7 +3383,7 @@ ${element}` : "";
|
|
|
3375
3383
|
if (!preventContentUpdate) {
|
|
3376
3384
|
const contentKey = ref.contentElementKey || "content";
|
|
3377
3385
|
const existingContent = element[contentKey];
|
|
3378
|
-
const childrenProp = params.children || element.children;
|
|
3386
|
+
const childrenProp = options.updateByState ? params.children || (ref.__exec?.children ? element.children : void 0) : params.children || element.children;
|
|
3379
3387
|
if (childrenProp) {
|
|
3380
3388
|
const content = children_default(childrenProp, element, opts);
|
|
3381
3389
|
if (content && !ref.__noChildrenDifference) {
|
|
@@ -3413,7 +3421,7 @@ ${element}` : "";
|
|
|
3413
3421
|
} else contentUpdateCall();
|
|
3414
3422
|
} else {
|
|
3415
3423
|
const content = element.children || params.content;
|
|
3416
|
-
if (content) {
|
|
3424
|
+
if (content && !options.updateByState) {
|
|
3417
3425
|
setContent(content, element, options);
|
|
3418
3426
|
}
|
|
3419
3427
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domql",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=Domql --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@domql/element": "^3.4.
|
|
31
|
-
"@domql/state": "^3.4.
|
|
32
|
-
"@domql/utils": "^3.4.
|
|
30
|
+
"@domql/element": "^3.4.2",
|
|
31
|
+
"@domql/state": "^3.4.2",
|
|
32
|
+
"@domql/utils": "^3.4.2"
|
|
33
33
|
},
|
|
34
34
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
35
35
|
"browser": "./dist/iife/index.js",
|