x-block-lib 0.8.78 → 0.8.80

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.
Files changed (2) hide show
  1. package/dist/index.js +36 -14
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2725,21 +2725,33 @@ s.forBlock.call_app_method_v1 = function(t) {
2725
2725
  const { kind: r, nodeId: u, methodKey: h } = ee(o.method.id), l = eo(r, u, h);
2726
2726
  if (o.method.outputs && o.method.outputs.length > 0) {
2727
2727
  const d = s.statementToCode(o, "HANDLE");
2728
- return `{
2728
+ return `try {
2729
2729
  const __outputs__ = await ${l}(${i}, ${a});
2730
- ${c}${d}}
2730
+ ${c}${d}} catch (e) {
2731
+ __messageV1__('error', e.message)
2732
+ }
2731
2733
  `;
2732
2734
  } else
2733
- return `await ${l}(${i}, ${a});
2735
+ return `try {
2736
+ await ${l}(${i}, ${a});
2737
+ } catch (e) {
2738
+ __messageV1__('error', e.message)
2739
+ }
2734
2740
  `;
2735
2741
  } else if (o.method.outputs && o.method.outputs.length > 0) {
2736
2742
  const r = s.statementToCode(o, "HANDLE");
2737
- return `{
2743
+ return `try {
2738
2744
  const __outputs__ = await __callMethodV1__(${n(o.method.id)}, ${i}, ${a});
2739
- ${c}${r}}
2745
+ ${c}${r}} catch (e) {
2746
+ __messageV1__('error', e.message)
2747
+ }
2740
2748
  `;
2741
2749
  } else
2742
- return `await __callMethodV1__(${n(o.method.id)}, ${i}, ${a});
2750
+ return `try {
2751
+ await __callMethodV1__(${n(o.method.id)}, ${i}, ${a});
2752
+ } catch (e) {
2753
+ __messageV1__('error', e.message)
2754
+ }
2743
2755
  `;
2744
2756
  };
2745
2757
  const rs = {
@@ -2822,24 +2834,33 @@ const rs = {
2822
2834
  }, 0);
2823
2835
  },
2824
2836
  updateShape_: function() {
2825
- for (let t = this.method.inputs?.length ?? 0; this.getInput("INPUT" + t); t++) {
2826
- const e = this.getInput("INPUT" + t)?.connection?.targetBlock();
2827
- e && e.dispose(), this.removeInput("INPUT" + t);
2837
+ for (let e = this.method.inputs?.length ?? 0; this.getInput("INPUT" + e); e++) {
2838
+ const n = this.getInput("INPUT" + e)?.connection?.targetBlock();
2839
+ n && n.dispose(), this.removeInput("INPUT" + e);
2828
2840
  }
2829
2841
  if (this.method.inputs)
2830
- for (let t = 0; t < this.method.inputs.length; t++)
2831
- this.getInput("INPUT" + t) || (this.appendValueInput("INPUT" + t), this.moveInputBefore("INPUT" + t, "HANDLE"));
2842
+ for (let e = 0; e < this.method.inputs.length; e++)
2843
+ this.getInput("INPUT" + e) || (this.appendValueInput("INPUT" + e), this.moveInputBefore("INPUT" + e, "HANDLE"));
2844
+ let t = !1;
2845
+ if (this.method.kind === "multipleSlotMethod" && (t = !0), t)
2846
+ this.getInput("INSTANCE") || this.appendValueInput("INSTANCE").setAlign(k.Align.RIGHT).appendField("%{BKY_APP_INSTANCE}").setCheck("String"), this.method.inputs && this.method.inputs.length > 0 && this.moveInputBefore("INSTANCE", "INPUT0");
2847
+ else if (this.getInput("INSTANCE")) {
2848
+ const e = this.getInput("INSTANCE").connection.targetBlock();
2849
+ e && e.dispose(), this.removeInput("INSTANCE");
2850
+ }
2832
2851
  },
2833
2852
  ensureBlocks_: function() {
2834
2853
  if (this.isInsertionMarker())
2835
2854
  return;
2836
- const t = no(this.method.kind), e = [];
2855
+ const t = [];
2856
+ this.getInput("INSTANCE") && t.push(["INSTANCE", "__instance__", "x-runtime-lib.instance", !0]);
2857
+ const e = no(this.method.kind);
2837
2858
  if (this.method.inputs)
2838
2859
  for (let n = 0; n < this.method.inputs.length; n++) {
2839
2860
  const { key: o, name: i } = this.method.inputs[n];
2840
- e.push(["INPUT" + n, `__input$${o}__`, i, t]);
2861
+ t.push(["INPUT" + n, `__input$${o}__`, i, e]);
2841
2862
  }
2842
- j(this, e);
2863
+ j(this, t);
2843
2864
  },
2844
2865
  checkWarning_: function() {
2845
2866
  const t = q(this.node.id);
@@ -4440,6 +4461,7 @@ const Ts = S.xml, Es = [
4440
4461
  },
4441
4462
  {
4442
4463
  type: "implement_app_method_v1",
4464
+ inputs: ["INSTANCE"],
4443
4465
  prefixInputs: ["INPUT"]
4444
4466
  },
4445
4467
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-block-lib",
3
3
  "private": false,
4
- "version": "0.8.78",
4
+ "version": "0.8.80",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -38,7 +38,7 @@
38
38
  "vue-router": "^4.6.4",
39
39
  "vuetify": "^3.11.4",
40
40
  "x-essential-lib": "^0.9.20",
41
- "x-runtime-lib": "^0.8.151",
41
+ "x-runtime-lib": "^0.8.153",
42
42
  "x-state-lib": "^0.3.33"
43
43
  },
44
44
  "devDependencies": {