nodes/packages/types/inputs.ts

45 lines
763 B
TypeScript
Raw Normal View History

2024-03-11 19:37:58 +01:00
type NodeInputFloat = {
type: "float";
value?: number;
min?: number;
max?: number;
2024-03-14 16:55:11 +01:00
step?: number;
2024-03-11 19:37:58 +01:00
}
type NodeInputInteger = {
type: "integer";
value?: number;
min?: number;
max?: number;
}
2024-03-14 16:55:11 +01:00
type NodeInputBoolean = {
type: "boolean";
value?: boolean;
}
2024-03-11 19:37:58 +01:00
type NodeInputSelect = {
type: "select";
2024-04-04 19:17:27 +02:00
labels: string[];
value?: number;
2024-03-11 19:37:58 +01:00
}
2024-04-05 19:38:10 +02:00
type NodeInputSeed = {
type: "seed"
2024-04-15 22:13:43 +02:00
value?: number;
2024-04-05 19:38:10 +02:00
}
2024-03-11 22:00:16 +01:00
type DefaultOptions = {
internal?: boolean;
2024-04-05 18:03:23 +02:00
external?: boolean;
2024-04-15 22:13:43 +02:00
setting?: string;
2024-04-05 19:38:10 +02:00
label?: string;
2024-03-11 22:00:16 +01:00
}
2024-04-05 19:38:10 +02:00
export type NodeInput = (NodeInputSeed | NodeInputBoolean | NodeInputFloat | NodeInputInteger | NodeInputSelect) & DefaultOptions;
export type NodeInputType<T extends Record<string, NodeInput>> = {
[K in keyof T]: T[K]["value"]
};