x-runtime-lib 0.8.68 → 0.8.70
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/index.js +21 -16
- package/dist/sandbox/sandbox/index.d.ts +5 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8481,19 +8481,23 @@ function Su(t) {
|
|
|
8481
8481
|
u && u.setCustomProperty(d, a);
|
|
8482
8482
|
} else c === "customProperty" ? t.setCustomProperty(d, a) : c === "elementSlotProperty" || c === "customSlotProperty" ? t.setAdaptSlotProperty(d, a) : console.assert(!1);
|
|
8483
8483
|
}
|
|
8484
|
-
), t.
|
|
8484
|
+
), t.bindAsyncFunction(
|
|
8485
8485
|
"__callMethodV1__",
|
|
8486
|
-
(e, i, o) => {
|
|
8487
|
-
const
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8486
|
+
(e, i, o, s) => {
|
|
8487
|
+
const r = t.pseudoToNative(e), a = t.pseudoToNative(i), c = t.pseudoToNative(o), { kind: p, nodeId: d, methodKey: u } = jo(r);
|
|
8488
|
+
let m;
|
|
8489
|
+
if (p === "elementMethod")
|
|
8490
|
+
m = t.callElementMethod(r, c);
|
|
8491
|
+
else if (p === "referenceMethod") {
|
|
8492
|
+
const y = t.children[d];
|
|
8493
|
+
y && (m = y.callCustomMethod(u, c));
|
|
8494
|
+
} else if (p === "multipleRefMethod") {
|
|
8495
|
+
const y = t.children[d + "/" + a];
|
|
8496
|
+
y && (m = y.callCustomMethod(u, c));
|
|
8497
|
+
} else p === "customMethod" || p === "customSlotMethod" || console.assert(!1);
|
|
8498
|
+
setTimeout(() => {
|
|
8499
|
+
s(t.nativeToPseudo(m)), t.run();
|
|
8500
|
+
}, 1e3);
|
|
8497
8501
|
}
|
|
8498
8502
|
), t.bindNativeFunction("__getStateV1__", (e) => {
|
|
8499
8503
|
const i = t.pseudoToNative(e), o = t.getState(i);
|
|
@@ -8757,12 +8761,12 @@ ${Ir(e)}} catch (e) {
|
|
|
8757
8761
|
for (const r of i)
|
|
8758
8762
|
o.push(JSON.stringify(r));
|
|
8759
8763
|
const s = `try {
|
|
8760
|
-
${e}(${o.join(", ")});
|
|
8764
|
+
var __callFunctionResult__ = ${e}(${o.join(", ")});
|
|
8761
8765
|
} catch (e) {
|
|
8762
8766
|
__messageV1__('error', 'run exception: ' + e.message);
|
|
8763
8767
|
}
|
|
8764
8768
|
`;
|
|
8765
|
-
to(s), this.interpreter.appendCode(s), this.interpreter.run();
|
|
8769
|
+
return to(s), this.interpreter.appendCode(s), this.interpreter.run(), this.getVariable("__callFunctionResult__");
|
|
8766
8770
|
}
|
|
8767
8771
|
//--------------------------
|
|
8768
8772
|
// 元素属性
|
|
@@ -8850,10 +8854,11 @@ ${Ir(e)}} catch (e) {
|
|
|
8850
8854
|
if (!Q(this.mode))
|
|
8851
8855
|
return;
|
|
8852
8856
|
const { methodKey: o } = jo(e), s = {};
|
|
8853
|
-
this.eventBus.emit(e, { key: o, inputs: i, outputs: s }),
|
|
8857
|
+
return this.eventBus.emit(e, { key: o, inputs: i, outputs: s }), s;
|
|
8854
8858
|
}
|
|
8855
8859
|
callCustomMethod(e, i) {
|
|
8856
|
-
Q(this.mode)
|
|
8860
|
+
if (Q(this.mode))
|
|
8861
|
+
return this.callFunction(`__implementMethod$${e}__`, i);
|
|
8857
8862
|
}
|
|
8858
8863
|
//--------------------------
|
|
8859
8864
|
// 状态
|
|
@@ -36,7 +36,7 @@ export declare class Sandbox {
|
|
|
36
36
|
setVariable(varName: string, value: any): void;
|
|
37
37
|
run(): void;
|
|
38
38
|
runCode(code: string): void;
|
|
39
|
-
callFunction(funcName: string, ...params: any):
|
|
39
|
+
callFunction(funcName: string, ...params: any): any;
|
|
40
40
|
private nodes;
|
|
41
41
|
syncNodes(data: Data | undefined): void;
|
|
42
42
|
getElementPropertyInner(node: any, propertyKeys: PropertyKeys): any;
|
|
@@ -53,10 +53,12 @@ export declare class Sandbox {
|
|
|
53
53
|
setAdaptSlotProperty(key: string, newValue: any): void;
|
|
54
54
|
callElementMethod(id: string, inputs: {
|
|
55
55
|
[key: string]: any;
|
|
56
|
-
}):
|
|
56
|
+
}): {
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
} | undefined;
|
|
57
59
|
callCustomMethod(key: string, inputs: {
|
|
58
60
|
[key: string]: any;
|
|
59
|
-
}):
|
|
61
|
+
}): any;
|
|
60
62
|
private states;
|
|
61
63
|
resetStates(): void;
|
|
62
64
|
getState(stateId: string): any;
|