x-block-lib 0.4.29 → 0.4.31

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.
@@ -7,7 +7,7 @@ interface FuncInfo {
7
7
  export declare function getAllFuncInfos(spaceid: string): FuncInfo[];
8
8
  export declare function getFuncInfo(spaceid: string, id: string): FuncInfo | undefined;
9
9
  export declare function genFuncOpts(spaceid: string): Blockly.MenuOption[];
10
- export declare function getCurrFunc(): {
10
+ export declare function getActiveFunc(): {
11
11
  id: string;
12
12
  name: string;
13
13
  inputs: {
@@ -2,7 +2,7 @@ import * as Blockly from 'blockly/core';
2
2
  interface SpaceInfo {
3
3
  id: string;
4
4
  name: string;
5
- sort?: number;
5
+ sort: number;
6
6
  }
7
7
  export declare function getAllSpaceInfos(): SpaceInfo[];
8
8
  export declare function getSpaceInfo(id: string): SpaceInfo | undefined;
package/dist/index.js CHANGED
@@ -347,15 +347,13 @@ const Lt = function() {
347
347
  },
348
348
  compute: {
349
349
  spaces: {},
350
- funcs: {},
351
- currFunc: {
350
+ activeFunc: {
352
351
  id: "",
353
352
  name: "",
354
353
  inputs: [],
355
354
  outputs: []
356
355
  },
357
- flows: {},
358
- currFlow: {
356
+ activeFlow: {
359
357
  id: "",
360
358
  name: ""
361
359
  }
@@ -375,12 +373,8 @@ const Lt = function() {
375
373
  function Ar() {
376
374
  const { spaces: e } = Lt.compute, t = [];
377
375
  for (const n in e) {
378
- const o = e[n];
379
- t.push({
380
- id: o.id,
381
- name: o.name,
382
- sort: o.sort
383
- });
376
+ const { id: o, name: r, sort: i } = e[n];
377
+ t.push({ id: o, name: r, sort: i });
384
378
  }
385
379
  return t.sort((n, o) => n.sort - o.sort), t;
386
380
  }
@@ -391,19 +385,19 @@ function ba() {
391
385
  }), Cr(e);
392
386
  }
393
387
  function Lr(e) {
394
- const { spaces: t, funcs: n } = Lt.compute;
395
- if (!t[e])
388
+ const { spaces: t } = Lt.compute, n = t[e];
389
+ if (!n)
396
390
  return [];
397
- const r = [];
398
- for (const i in n) {
399
- const a = n[i];
400
- a.spaceid === e && r.push({
401
- id: a.id,
402
- name: a.name,
403
- sort: a.sort
391
+ const o = [];
392
+ for (const r in n.funcs) {
393
+ const i = n.funcs[r];
394
+ o.push({
395
+ id: i.id,
396
+ name: i.name,
397
+ sort: i.sort
404
398
  });
405
399
  }
406
- return r.sort((i, a) => i.sort - a.sort), r;
400
+ return o.sort((r, i) => r.sort - i.sort), o;
407
401
  }
408
402
  function Oa(e) {
409
403
  const t = [];
@@ -412,7 +406,7 @@ function Oa(e) {
412
406
  }), Cr(t);
413
407
  }
414
408
  function Co() {
415
- return Lt.compute.currFunc;
409
+ return Lt.compute.activeFunc;
416
410
  }
417
411
  const Ia = {
418
412
  init: function() {
@@ -53,29 +53,35 @@ export type BlocklyState = {
53
53
  id: string;
54
54
  name: string;
55
55
  sort: number;
56
- };
57
- };
58
- funcs: {
59
- [funcid: string]: {
60
- id: string;
61
- spaceid: string;
62
- name: string;
63
- inputs: {
64
- id: string;
65
- name: string;
66
- type: string;
56
+ funcs: {
57
+ [funcid: string]: {
58
+ id: string;
59
+ name: string;
60
+ sort: number;
61
+ dev: string;
62
+ prod: string;
63
+ inputs: {
64
+ id: string;
65
+ name: string;
66
+ type: string;
67
+ }[];
68
+ outputs: {
69
+ id: string;
70
+ name: string;
71
+ type: string;
72
+ }[];
73
+ };
67
74
  };
68
- outputs: {
69
- id: string;
70
- name: string;
71
- type: string;
75
+ flows: {
76
+ [flowid: string]: {
77
+ id: string;
78
+ name: string;
79
+ sort: number;
80
+ };
72
81
  };
73
- dev: string;
74
- prod: string;
75
- sort: number;
76
82
  };
77
83
  };
78
- currFunc: {
84
+ activeFunc: {
79
85
  id: string;
80
86
  name: string;
81
87
  inputs: {
@@ -89,14 +95,7 @@ export type BlocklyState = {
89
95
  type: string;
90
96
  }[];
91
97
  };
92
- flows: {
93
- [flowid: string]: {
94
- id: string;
95
- spaceid: string;
96
- name: string;
97
- };
98
- };
99
- currFlow: {
98
+ activeFlow: {
100
99
  id: string;
101
100
  name: string;
102
101
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-block-lib",
3
3
  "private": false,
4
- "version": "0.4.29",
4
+ "version": "0.4.31",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",