diff --git a/README.md b/README.md index 74d6811..75169d9 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,14 @@ export interface NodeDef { | "enum?" | "string" | "string?" + | "json" + | "json?" | "code" | "code?"; desc: string; default?: unknown; + /** Input `value`, only one is allowed between `value` and this arg.*/ + oneof?: string; options?: { name: string; value: unknown }[]; }[]; status?: diff --git a/src/components/inspector.tsx b/src/components/inspector.tsx index b306177..b6cc552 100644 --- a/src/components/inspector.tsx +++ b/src/components/inspector.tsx @@ -1,5 +1,5 @@ import { EditNode, EditTree, useWorkspace } from "@/contexts/workspace-context"; -import { NodeArg, NodeArgType, NodeModel, TreeGraphData } from "@/misc/b3type"; +import { NodeArg, NodeModel, TreeGraphData } from "@/misc/b3type"; import { checkOneof } from "@/misc/b3util"; import { Hotkey, isMacos } from "@/misc/keys"; import { EditOutlined } from "@ant-design/icons"; @@ -388,7 +388,7 @@ const NodeInspector: FC = () => { {def.args.map((v) => { const required = v.type.indexOf("?") === -1; - const type = v.type.replace("?", "") as NodeArgType; + const type = v.type.replace("?", "") as NodeArg["type"]; return ( []; + /** + * + `!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; } diff --git a/src/misc/b3util.ts b/src/misc/b3util.ts index 9c460ac..9ed3419 100644 --- a/src/misc/b3util.ts +++ b/src/misc/b3util.ts @@ -1,5 +1,5 @@ import { useWorkspace } from "@/contexts/workspace-context"; -import { NodeArg, NodeArgType, NodeDef, NodeModel, TreeGraphData, TreeModel } from "@/misc/b3type"; +import { NodeArg, NodeDef, NodeModel, TreeGraphData, TreeModel } from "@/misc/b3type"; import * as fs from "fs"; import { message } from "./hooks"; import Path from "./path"; @@ -79,7 +79,7 @@ const checkNodeArg = ( ) => { let hasError = false; const arg = conf.args![i] as NodeArg; - const type = arg.type.replace("?", "") as NodeArgType; + const type = arg.type.replace("?", "") as NodeArg["type"]; const value = data.args?.[arg.name]; if (type === "float") { const isNumber = typeof value === "number";