vscode-behavior3 2.3.0 → 2.5.0

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.
@@ -5,12 +5,12 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="stylesheet" href="./codicons/codicon.css" />
7
7
  <title>Behavior3 Editor</title>
8
- <script type="module" crossorigin src="./assets/editor-466vlAsX.js"></script>
8
+ <script type="module" crossorigin src="./assets/editor-BPxOdZMY.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/rolldown-runtime-BYbx6iT9.js">
10
10
  <link rel="modulepreload" crossorigin href="./assets/graph-vendor-ww5KcpJ-.js">
11
11
  <link rel="modulepreload" crossorigin href="./assets/ui-vendor-CpXf__no.js">
12
- <link rel="modulepreload" crossorigin href="./assets/vendor-Ctok02TG.js">
13
- <link rel="stylesheet" crossorigin href="./assets/editor-CTBBjkkm.css">
12
+ <link rel="modulepreload" crossorigin href="./assets/vendor-ZD6A8unu.js">
13
+ <link rel="stylesheet" crossorigin href="./assets/editor-CPHgtP2i.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vscode-behavior3",
3
3
  "displayName": "%extension.displayName%",
4
4
  "description": "%extension.description%",
5
- "version": "2.3.0",
5
+ "version": "2.5.0",
6
6
  "publisher": "codetypess",
7
7
  "repository": {
8
8
  "type": "git",
@@ -329,7 +329,7 @@
329
329
  "format": "prettier --write package.json \"test/**/*.js\" \"test/**/*.ts\""
330
330
  },
331
331
  "dependencies": {
332
- "behavior3": "^1.1.0"
332
+ "behavior3": "^1.3.0"
333
333
  },
334
334
  "devDependencies": {
335
335
  "@ant-design/icons": "^6.1.1",
@@ -2,6 +2,18 @@ import type { NodeDef } from "behavior3";
2
2
  import type { NodeData, TreeData } from "./b3type";
3
3
 
4
4
  export type NodeArg = Exclude<NodeDef["args"], undefined>[number];
5
+ export type NodeInputSlot = Exclude<Exclude<NodeDef["input"], undefined>[number], string>;
6
+ export type NodeOutputSlot = Exclude<Exclude<NodeDef["output"], undefined>[number], string>;
7
+ export type NodeFieldKind = "arg" | "input" | "output";
8
+
9
+ export type NodeSlotField = {
10
+ name: string;
11
+ label: string;
12
+ required: boolean;
13
+ variadic: boolean;
14
+ checker?: string;
15
+ visible?: string;
16
+ };
5
17
 
6
18
  export type BuildLogger = {
7
19
  log: (...args: unknown[]) => void;
@@ -15,7 +27,10 @@ export type FsLike = {
15
27
  readFileSync(path: string, encoding: "utf8" | "utf-8"): string;
16
28
  writeFileSync(path: string, data: string, encoding?: "utf8" | "utf-8"): void;
17
29
  readdirSync(path: string): string[];
18
- readdirSync(path: string, options: { encoding: "utf8" | "utf-8"; recursive?: boolean }): string[];
30
+ readdirSync(
31
+ path: string,
32
+ options: { encoding: "utf8" | "utf-8"; recursive?: boolean }
33
+ ): string[];
19
34
  statSync(path: string): { mtimeMs: number; isFile(): boolean };
20
35
  mkdirSync(path: string, options?: { recursive?: boolean }): unknown;
21
36
  copyFileSync(source: string, destination: string): void;
@@ -45,20 +60,46 @@ export type BuildEnv = {
45
60
  logger: BuildLogger;
46
61
  };
47
62
 
48
- export type NodeArgCheckResult = string | string[] | null | undefined;
63
+ export type NodeFieldCheckResult = string | string[] | null | undefined;
64
+ export type NodeFieldVisibleResult = boolean | null | undefined;
49
65
 
50
- export type NodeArgCheckContext = {
66
+ type NodeFieldBaseContext = {
51
67
  node: NodeData;
52
68
  tree: TreeData;
53
69
  nodeDef: NodeDef;
54
- arg: NodeArg;
55
- argName: string;
70
+ fieldKind: NodeFieldKind;
71
+ fieldName: string;
72
+ fieldIndex?: number;
56
73
  treePath: string;
57
74
  env: BuildEnv;
58
75
  };
59
76
 
60
- export interface NodeArgChecker {
61
- validate(value: unknown, ctx: NodeArgCheckContext): NodeArgCheckResult;
77
+ export type NodeFieldCheckContext =
78
+ | (NodeFieldBaseContext & {
79
+ fieldKind: "arg";
80
+ arg: NodeArg;
81
+ })
82
+ | (NodeFieldBaseContext & {
83
+ fieldKind: "input";
84
+ slot: NodeInputSlot;
85
+ slotField: NodeSlotField;
86
+ fieldIndex: number;
87
+ })
88
+ | (NodeFieldBaseContext & {
89
+ fieldKind: "output";
90
+ slot: NodeOutputSlot;
91
+ slotField: NodeSlotField;
92
+ fieldIndex: number;
93
+ });
94
+
95
+ export type NodeFieldVisibleContext = NodeFieldCheckContext;
96
+
97
+ export interface NodeFieldChecker {
98
+ validate(value: unknown, ctx: NodeFieldCheckContext): NodeFieldCheckResult;
99
+ }
100
+
101
+ export interface NodeFieldVisible {
102
+ visible(value: unknown, ctx: NodeFieldVisibleContext): NodeFieldVisibleResult;
62
103
  }
63
104
 
64
105
  export type BuildScript = {
@@ -74,7 +115,10 @@ export type BatchScript = BuildScript & {
74
115
 
75
116
  export type BuildHookClass<T extends BuildScript = BuildScript> = new (...args: any[]) => T;
76
117
  export type BatchHookClass<T extends BatchScript = BatchScript> = new (...args: any[]) => T;
77
- export type NodeArgCheckerClass<T extends NodeArgChecker = NodeArgChecker> = new (
118
+ export type NodeFieldCheckerClass<T extends NodeFieldChecker = NodeFieldChecker> = new (
119
+ ...args: any[]
120
+ ) => T;
121
+ export type NodeFieldVisibleClass<T extends NodeFieldVisible = NodeFieldVisible> = new (
78
122
  ...args: any[]
79
123
  ) => T;
80
124
 
@@ -89,15 +133,22 @@ export type BatchDecorator = {
89
133
  };
90
134
 
91
135
  export type CheckDecorator = {
92
- <T extends NodeArgCheckerClass>(target: T): T | void;
93
- <T extends NodeArgCheckerClass>(target: T, context: ClassDecoratorContext<T>): T | void;
94
- (name?: string): <T extends NodeArgCheckerClass>(target: T) => T | void;
136
+ <T extends NodeFieldCheckerClass>(target: T): T | void;
137
+ <T extends NodeFieldCheckerClass>(target: T, context: ClassDecoratorContext<T>): T | void;
138
+ (name?: string): <T extends NodeFieldCheckerClass>(target: T) => T | void;
139
+ };
140
+
141
+ export type VisibleDecorator = {
142
+ <T extends NodeFieldVisibleClass>(target: T): T | void;
143
+ <T extends NodeFieldVisibleClass>(target: T, context: ClassDecoratorContext<T>): T | void;
144
+ (name?: string): <T extends NodeFieldVisibleClass>(target: T) => T | void;
95
145
  };
96
146
 
97
147
  export type BuildRuntime = {
98
148
  build: BuildDecorator;
99
149
  batch: BatchDecorator;
100
150
  check: CheckDecorator;
151
+ visible: VisibleDecorator;
101
152
  };
102
153
 
103
154
  export declare class BuildHook implements BuildScript {