domql 3.8.1 → 3.8.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/dist/iife/index.js +54 -12
- package/package.json +4 -4
package/dist/iife/index.js
CHANGED
|
@@ -337,6 +337,7 @@ var Domql = (() => {
|
|
|
337
337
|
exec = (param, element, state2, context) => {
|
|
338
338
|
if (isFunction(param)) {
|
|
339
339
|
if (!element) return;
|
|
340
|
+
if (typeof param.call !== "function") return param;
|
|
340
341
|
const result = param.call(
|
|
341
342
|
element,
|
|
342
343
|
element,
|
|
@@ -352,6 +353,17 @@ var Domql = (() => {
|
|
|
352
353
|
}
|
|
353
354
|
return result;
|
|
354
355
|
}
|
|
356
|
+
if (param != null && element?.context?.plugins && (isArray(param) || isObject(param) && !isDOMNode(param))) {
|
|
357
|
+
const plugins = element.context.plugins;
|
|
358
|
+
for (const plugin of plugins) {
|
|
359
|
+
if (plugin.resolveHandler) {
|
|
360
|
+
const resolved = plugin.resolveHandler(param, element);
|
|
361
|
+
if (typeof resolved === "function") {
|
|
362
|
+
return exec(resolved, element, state2, context);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
355
367
|
return param;
|
|
356
368
|
};
|
|
357
369
|
merge = (element, obj, excludeFrom = []) => {
|
|
@@ -671,11 +683,29 @@ var Domql = (() => {
|
|
|
671
683
|
var init_if = __esm({
|
|
672
684
|
"../utils/dist/esm/if.js"() {
|
|
673
685
|
init_types();
|
|
686
|
+
init_object();
|
|
674
687
|
createIfConditionFlag = (element, parent) => {
|
|
675
688
|
const { __ref: ref } = element;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
689
|
+
const ifVal = element.if;
|
|
690
|
+
if (isFunction(ifVal)) {
|
|
691
|
+
let result;
|
|
692
|
+
try {
|
|
693
|
+
result = ifVal(element, element.state, element.context);
|
|
694
|
+
} catch (e) {
|
|
695
|
+
if (typeof console !== "undefined") console.warn("[DOMQL] if condition error:", e);
|
|
696
|
+
delete ref.__if;
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (!result) {
|
|
700
|
+
delete ref.__if;
|
|
701
|
+
} else ref.__if = true;
|
|
702
|
+
} else if (ifVal != null && typeof ifVal === "object") {
|
|
703
|
+
const result = exec(ifVal, element);
|
|
704
|
+
if (!result) delete ref.__if;
|
|
705
|
+
else ref.__if = true;
|
|
706
|
+
} else {
|
|
707
|
+
ref.__if = true;
|
|
708
|
+
}
|
|
679
709
|
};
|
|
680
710
|
}
|
|
681
711
|
});
|
|
@@ -1863,13 +1893,18 @@ var Domql = (() => {
|
|
|
1863
1893
|
if (result && typeof result.then === "function") {
|
|
1864
1894
|
result.catch((err) => {
|
|
1865
1895
|
element.error = err;
|
|
1866
|
-
console.
|
|
1896
|
+
if (err instanceof ReferenceError) console.warn("[DOMQL] Async event warning:", err.message);
|
|
1897
|
+
else console.error("[DOMQL] Async event error:", err);
|
|
1867
1898
|
});
|
|
1868
1899
|
}
|
|
1869
1900
|
return result;
|
|
1870
1901
|
} catch (err) {
|
|
1871
1902
|
element.error = err;
|
|
1872
|
-
|
|
1903
|
+
if (err instanceof ReferenceError) {
|
|
1904
|
+
console.warn("[DOMQL] Event handler warning:", err.message);
|
|
1905
|
+
} else {
|
|
1906
|
+
console.error("[DOMQL] Event handler error:", err);
|
|
1907
|
+
}
|
|
1873
1908
|
if (element.context?.strictMode) throw err;
|
|
1874
1909
|
}
|
|
1875
1910
|
};
|
|
@@ -5412,12 +5447,18 @@ ${element}` : "";
|
|
|
5412
5447
|
return;
|
|
5413
5448
|
}
|
|
5414
5449
|
const ref = element.__ref;
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
element.
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5450
|
+
let ifPassed;
|
|
5451
|
+
try {
|
|
5452
|
+
ifPassed = (element.if || element.props?.if)(
|
|
5453
|
+
element,
|
|
5454
|
+
element.state,
|
|
5455
|
+
element.context,
|
|
5456
|
+
options
|
|
5457
|
+
);
|
|
5458
|
+
} catch (e) {
|
|
5459
|
+
console.warn("[DOMQL] if condition error:", e);
|
|
5460
|
+
return;
|
|
5461
|
+
}
|
|
5421
5462
|
const itWasFalse = ref.__if !== true;
|
|
5422
5463
|
if (ifPassed) {
|
|
5423
5464
|
ref.__if = true;
|
|
@@ -6707,7 +6748,8 @@ ${element}` : "";
|
|
|
6707
6748
|
isDemoComponent ? isDemoComponent + " " : "" + path.join(".")
|
|
6708
6749
|
);
|
|
6709
6750
|
element.verbose();
|
|
6710
|
-
console.
|
|
6751
|
+
if (e instanceof ReferenceError) console.warn("[DOMQL] Render warning:", e.message);
|
|
6752
|
+
else console.error("[DOMQL] Render error:", e);
|
|
6711
6753
|
if (element.on?.error) {
|
|
6712
6754
|
element.on.error(e, element, element.state, element.context, options);
|
|
6713
6755
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domql",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.7",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"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"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@domql/element": "^3.8.
|
|
29
|
-
"@domql/state": "^3.8.
|
|
30
|
-
"@domql/utils": "^3.8.
|
|
28
|
+
"@domql/element": "^3.8.7",
|
|
29
|
+
"@domql/state": "^3.8.7",
|
|
30
|
+
"@domql/utils": "^3.8.7"
|
|
31
31
|
},
|
|
32
32
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
33
33
|
"browser": "./dist/esm/index.js",
|