allow panels to hold commands

This commit is contained in:
2025-12-28 11:48:11 -05:00
parent 59a0c81eb4
commit c3253f3204
11 changed files with 385 additions and 51 deletions

View File

@@ -1,3 +1,29 @@
export const NumericTypes = ['Float32', 'Float64'] as const;
export type NumericTypeId = (typeof NumericTypes)[number];
export const BooleanTypes = ['Boolean'] as const;
export type BooleanTypeId = (typeof BooleanTypes)[number];
export const AnyTypes = [...NumericTypes, ...BooleanTypes] as const;
export type AnyTypeId = (typeof AnyTypes)[number];
export function isNumericType(type: AnyTypeId): type is NumericTypeId {
return NumericTypes.some((it) => it == type);
}
export function isBooleanType(type: AnyTypeId): type is BooleanTypeId {
return BooleanTypes.some((it) => it == type);
}
export type DynamicDataType = number | boolean;
export type CommandParameterData =
| {
type: 'constant';
value: DynamicDataType;
}
| {
type: 'input';
id: string;
};
export type DynamicComponentData =
| { type: 'text'; text: string; justify_right: boolean }
| { type: 'telemetry'; data: string }
@@ -6,6 +32,17 @@ export type DynamicComponentData =
columns: number;
equal_width: boolean;
cells: OptionalDynamicComponentData[][];
}
| {
type: 'input';
id: string;
data_type: AnyTypeId;
}
| {
type: 'command_button';
text: string;
command_name: string;
parameters: { [key: string]: CommandParameterData };
};
export type OptionalDynamicComponentData =