nodes/packages/types/inputs.ts
2024-04-17 15:34:28 +02:00

49 lines
851 B
TypeScript

type NodeInputFloat = {
type: "float";
value?: number;
min?: number;
max?: number;
step?: number;
}
type NodeInputInteger = {
type: "integer";
value?: number;
min?: number;
max?: number;
}
type NodeInputBoolean = {
type: "boolean";
value?: boolean;
}
type NodeInputSelect = {
type: "select";
labels: string[];
value?: number;
}
type NodeInputSeed = {
type: "seed"
value?: number;
}
type DefaultOptions = {
internal?: boolean;
external?: boolean;
setting?: string;
label?: string;
}
type InputTypes = (NodeInputSeed | NodeInputBoolean | NodeInputFloat | NodeInputInteger | NodeInputSelect);
export type NodeInput = InputTypes & {
type: InputTypes["type"] | InputTypes["type"][];
} & DefaultOptions;
export type NodeInputType<T extends Record<string, NodeInput>> = {
[K in keyof T]: T[K]["value"]
};