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 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.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" || 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 }), this.setVariable("__callMethodResult__", 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) && this.callFunction(`__implementMethod$${e}__`, i);
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): 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;
@@ -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
- }): void;
56
+ }): {
57
+ [key: string]: any;
58
+ } | undefined;
57
59
  callCustomMethod(key: string, inputs: {
58
60
  [key: string]: any;
59
- }): void;
61
+ }): any;
60
62
  private states;
61
63
  resetStates(): void;
62
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.68",
4
+ "version": "0.8.70",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",