use behavitor3-ts types
This commit is contained in:
1 parent
cd84575197
commit
05b5afdfbc
6 files changed
+36
-102
No files matched your search
+3
-72
@@ -1,43 +1,8 @@
|
||||
import { TreeGraphData as G6TreeGraphData } from "@antv/g6";
|
||||
import { NodeDef } from "../behavior3/src/behavior3";
|
||||
|
||||
export type NodeType = "Action" | "Composite" | "Decorator" | "Condition" | "Other" | "Error";
|
||||
|
||||
export interface NodeArg {
|
||||
name: string;
|
||||
type:
|
||||
| "bool"
|
||||
| "bool?"
|
||||
| "bool[]"
|
||||
| "bool[]?"
|
||||
| "int"
|
||||
| "int?"
|
||||
| "int[]"
|
||||
| "int[]?"
|
||||
| "float"
|
||||
| "float?"
|
||||
| "float[]"
|
||||
| "float[]?"
|
||||
| "string"
|
||||
| "string?"
|
||||
| "string[]"
|
||||
| "string[]?"
|
||||
| "json"
|
||||
| "json?"
|
||||
| "json[]"
|
||||
| "json[]?"
|
||||
| "enum"
|
||||
| "enum?"
|
||||
| "enum[]"
|
||||
| "enum[]?"
|
||||
| "expr"
|
||||
| "expr?"
|
||||
| "expr[]"
|
||||
| "expr[]?";
|
||||
desc: string;
|
||||
oneof?: string;
|
||||
default?: unknown;
|
||||
options?: { name: string; value: string | number }[];
|
||||
}
|
||||
export type NodeType = NodeDef["type"] | "Other" | "Error";
|
||||
export type NodeArg = Exclude<NodeDef["args"], undefined>[number];
|
||||
|
||||
export const isIntType = (type: string) => type.startsWith("int");
|
||||
export const isFloatType = (type: string) => type.startsWith("float");
|
||||
@@ -47,40 +12,6 @@ export const isEnumType = (type: string) => type.startsWith("enum");
|
||||
export const isExprType = (type: string) => type.startsWith("expr") || type.startsWith("code");
|
||||
export const isJsonType = (type: string) => type.startsWith("json");
|
||||
|
||||
export interface NodeDef {
|
||||
name: string;
|
||||
type: NodeType;
|
||||
desc?: string;
|
||||
args?: NodeArg[];
|
||||
input?: string[];
|
||||
output?: string[];
|
||||
doc?: string;
|
||||
color?: string;
|
||||
icon?: string;
|
||||
/**
|
||||
* + `!success` !(child_success|child_success|...)
|
||||
* + `!failure` !(child_failure|child_failure|...)
|
||||
* + `|success` child_success|child_success|...
|
||||
* + `|failure` child_failure|child_failure|...
|
||||
* + `|running` child_running|child_running|...
|
||||
* + `&success` child_success&child_success&...
|
||||
* + `&failure` child_failure&child_failure&...
|
||||
*/
|
||||
status?: (
|
||||
| "success"
|
||||
| "failure"
|
||||
| "running"
|
||||
| "!success"
|
||||
| "!failure"
|
||||
| "|success"
|
||||
| "|failure"
|
||||
| "|running"
|
||||
| "&success"
|
||||
| "&failure"
|
||||
)[];
|
||||
children?: -1 | 0 | 1;
|
||||
}
|
||||
|
||||
export interface NodeModel {
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
+1
-1
@@ -1,4 +1,5 @@
|
||||
import * as fs from "fs";
|
||||
import { NodeDef } from "../behavior3/src/behavior3";
|
||||
import {
|
||||
isBoolType,
|
||||
isEnumType,
|
||||
@@ -8,7 +9,6 @@ import {
|
||||
isJsonType,
|
||||
isStringType,
|
||||
NodeArg,
|
||||
NodeDef,
|
||||
NodeModel,
|
||||
TreeGraphData,
|
||||
TreeModel,
|
||||
|
||||
Reference in new issue
Block a user