diff --git a/src/module-api/preset.ts b/src/module-api/preset.ts index 2fff663..b48458d 100644 --- a/src/module-api/preset.ts +++ b/src/module-api/preset.ts @@ -90,3 +90,74 @@ export interface CompanionButtonStepActions { export interface CompanionPresetDefinitions { [id: string]: CompanionButtonPresetDefinition | undefined } + +export type StrictPresetDefinitions = StrictPresetDefinitionCategory[] +export type StrictPresetDefinitionCategory = { + name: string + presets: Record> +} + +export interface StrictButtonPresetDefinition { + /** The type of this preset */ + type: 'button-strict' + /** The category of this preset, for grouping */ + // category: string + /** The name of this preset */ + name: string + /** The base style of this preset, this will be copied to the button */ + style: CompanionButtonStyleProps + /** Preview style for preset, will be used in GUI for preview */ + previewStyle?: CompanionButtonStyleProps + /** Options for this preset */ + options?: CompanionButtonPresetOptions + /** The feedbacks on the button */ + feedbacks: StrictPresetFeedback[] + steps: StrictButtonStepActions[] +} + +type StrictPresetFeedbackInner = Id extends any + ? { + /** The id of the feedback definition */ + feedbackId: Id + /** The option values for the feedback */ + options: TTypes[Id] + /** + * If a boolean feedback, the style effect of the feedback + */ + style?: CompanionFeedbackButtonStyleResult + /** + * If a boolean feedback, invert the value of the feedback + */ + isInverted?: boolean + } + : never + +export type StrictPresetFeedback = StrictPresetFeedbackInner + +type StrictPresetActionInner = Id extends any + ? { + /** The id of the action definition */ + actionId: Id + /** The option values for the action */ + options: TTypes[Id] + /** The execution delay of the action */ + delay?: number + } + : never + +export type StrictPresetAction = StrictPresetActionInner + +export interface StrictButtonStepActions { + /** The button down actions */ + down: StrictPresetAction[] + /** The button up actions */ + up: StrictPresetAction[] + rotateLeft?: StrictPresetAction[] + rotateRight?: StrictPresetAction[] + [delay: number]: StrictPresetActionsWithOptions | StrictPresetAction[] +} + +export interface StrictPresetActionsWithOptions { + options?: CompanionActionSetOptions + actions: StrictPresetAction[] +}