x-runtime-lib 0.8.67 → 0.8.69

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 CHANGED
@@ -8481,19 +8481,21 @@ 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.bindNativeFunction(
8484
+ ), t.bindAsyncFunction(
8485
8485
  "__callMethodV1__",
8486
- (e, i, o) => {
8487
- const s = t.pseudoToNative(e), r = t.pseudoToNative(i), a = t.pseudoToNative(o), { kind: c, nodeId: p, methodKey: d } = jo(s);
8488
- if (c === "elementMethod")
8489
- t.callElementMethod(s, a);
8490
- else if (c === "referenceMethod") {
8491
- const u = t.children[p];
8492
- u && u.callCustomMethod(d, a);
8493
- } else if (c === "multipleRefMethod") {
8494
- const u = t.children[p + "/" + r];
8495
- u && u.callCustomMethod(d, a);
8496
- } else c === "customMethod" ? t.callCustomMethod(d, a) : c === "customSlotMethod" || console.assert(!1);
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" ? m = t.callCustomMethod(u, c) : p === "customSlotMethod" || console.assert(!1);
8498
+ s(t.nativeToPseudo(m)), t.run();
8497
8499
  }
8498
8500
  ), t.bindNativeFunction("__getStateV1__", (e) => {
8499
8501
  const i = t.pseudoToNative(e), o = t.getState(i);
@@ -8757,12 +8759,12 @@ ${Ir(e)}} catch (e) {
8757
8759
  for (const r of i)
8758
8760
  o.push(JSON.stringify(r));
8759
8761
  const s = `try {
8760
- ${e}(${o.join(", ")});
8762
+ var __callFunctionResult__ = ${e}(${o.join(", ")});
8761
8763
  } catch (e) {
8762
8764
  __messageV1__('error', 'run exception: ' + e.message);
8763
8765
  }
8764
8766
  `;
8765
- to(s), this.interpreter.appendCode(s), this.interpreter.run();
8767
+ return to(s), this.interpreter.appendCode(s), this.interpreter.run(), this.getVariable("__callFunctionResult__");
8766
8768
  }
8767
8769
  //--------------------------
8768
8770
  // 元素属性
@@ -8853,7 +8855,8 @@ ${Ir(e)}} catch (e) {
8853
8855
  return this.eventBus.emit(e, { key: o, inputs: i, outputs: s }), s;
8854
8856
  }
8855
8857
  callCustomMethod(e, i) {
8856
- Q(this.mode) && this.callFunction(`__implementMethod$${e}__`, i);
8858
+ if (Q(this.mode))
8859
+ return this.callFunction(`__implementMethod$${e}__`, i);
8857
8860
  }
8858
8861
  //--------------------------
8859
8862
  // 状态
@@ -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): void;
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;
@@ -58,7 +58,7 @@ export declare class Sandbox {
58
58
  } | undefined;
59
59
  callCustomMethod(key: string, inputs: {
60
60
  [key: string]: any;
61
- }): void;
61
+ }): any;
62
62
  private states;
63
63
  resetStates(): void;
64
64
  getState(stateId: string): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-runtime-lib",
3
3
  "private": false,
4
- "version": "0.8.67",
4
+ "version": "0.8.69",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",