forked from bitfocus/companion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
instance_skel_types.d.ts
228 lines (202 loc) · 5.61 KB
/
instance_skel_types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/// <reference types="node" />
import { EventEmitter } from 'events'
export interface CompanionSystem extends EventEmitter {}
export type InputValue = number | string | boolean
export type CompanionBank = CompanionBankPage | CompanionBankPNG | CompanionBankPreset
export interface CompanionBankPage {
style: 'pageup' | 'pagedown' | 'pagenum'
}
export type CompanionAlignment =
| 'left:top'
| 'center:top'
| 'right:top'
| 'left:center'
| 'center:center'
| 'right:center'
| 'left:bottom'
| 'center:bottom'
| 'right:bottom'
export type CompanionTextSize = 'auto' | '7' | '14' | '18' | '24' | '30' | '44'
export interface CompanionBankRequiredProps {
text: string
size: CompanionTextSize
color: number
bgcolor: number
}
export interface CompanionBankAdditionalProps {
alignment: CompanionAlignment
pngalignment: CompanionAlignment
png64?: string
latch: boolean
relative_delay: boolean
}
export interface CompanionBankPNG extends CompanionBankRequiredProps, CompanionBankAdditionalProps {
style: 'png'
}
export interface CompanionBankPreset extends CompanionBankRequiredProps, Partial<CompanionBankAdditionalProps> {
style: 'png' | 'text' // 'text' for backwards compatability
}
export interface CompanionAction {
label: string
options: SomeCompanionInputField[]
callback?: (action: CompanionActionEvent, info: CompanionActionEventInfo) => void
subscribe?: (action: CompanionActionEvent) => void
unsubscribe?: (action: CompanionActionEvent) => void
}
export interface CompanionActionEvent {
id: string
action: string
options: { [key: string]: InputValue | undefined }
}
export interface CompanionActionEventInfo {
deviceId: string | undefined
page: number
bank: number
}
export interface CompanionFeedbackEventInfo {
page: number
bank: number
}
export interface CompanionFeedbackEvent {
id: string
type: string
options: { [key: string]: InputValue | undefined }
}
export interface CompanionFeedbackResult {
color?: number
bgcolor?: number
}
export type ConfigValue = string | number
export interface DropdownChoice {
id: ConfigValue
label: string
}
export type SomeCompanionInputField =
| CompanionInputFieldText
| CompanionInputFieldColor
| CompanionInputFieldTextInput
| CompanionInputFieldDropdown
| CompanionInputFieldMultiDropdown
| CompanionInputFieldNumber
| CompanionInputFieldCheckbox
export interface CompanionInputField {
id: string
type: 'text' | 'textinput' | 'dropdown' | 'colorpicker' | 'number' | 'checkbox'
label: string
tooltip?: string
}
export interface CompanionInputFieldText extends CompanionInputField {
type: 'text'
value: string
}
export interface CompanionInputFieldColor extends CompanionInputField {
type: 'colorpicker'
default: number
}
export interface CompanionInputFieldTextInput extends CompanionInputField {
type: 'textinput'
regex?: string
default?: string
required?: boolean
}
export interface CompanionInputFieldDropdown extends CompanionInputFieldDropdownBase {
multiple?: false
default: ConfigValue
}
export interface CompanionInputFieldMultiDropdown extends CompanionInputFieldDropdownBase {
multiple: true
default: ConfigValue[]
required?: boolean
/** The minimum number of selected values */
minSelection?: number
/** The maximum number of selected values */
maximumSelectionLength?: number
}
export interface CompanionInputFieldDropdownBase extends CompanionInputField {
type: 'dropdown'
// default: ConfigValue
choices: DropdownChoice[]
multiple?: boolean
/** The minimum number of entries the dropdown must have before it allows searching */
minChoicesForSearch?: number
}
export interface CompanionInputFieldCheckbox extends CompanionInputField {
type: 'checkbox'
default: boolean
}
export interface CompanionInputFieldNumber extends CompanionInputField {
type: 'number'
min: number
max: number
step?: number
range?: boolean
required?: boolean
default: number
}
export interface CompanionConfigField extends CompanionInputField {
width: number
}
export type SomeCompanionConfigField = SomeCompanionInputField & CompanionConfigField
export interface CompanionVariable {
label: string
name: string
}
export interface CompanionFeedback {
label: string
description: string
options: SomeCompanionInputField[]
callback?: (
feedback: CompanionFeedbackEvent,
bank: CompanionBankPNG,
info: CompanionFeedbackEventInfo
) => CompanionFeedbackResult
subscribe?: (feedback: CompanionFeedbackEvent) => void
unsubscribe?: (feedback: CompanionFeedbackEvent) => void
}
export interface CompanionPreset {
category: string
label: string
bank: CompanionBankPreset
feedbacks: Array<{
type: string
options: { [key: string]: InputValue | undefined }
}>
actions: Array<{
action: string
options: { [key: string]: InputValue | undefined }
}>
release_actions?: Array<{
action: string
options: { [key: string]: InputValue | undefined }
}>
}
export interface CompanionFeedbacks {
[id: string]: CompanionFeedback | undefined
}
export interface CompanionActions {
[id: string]: CompanionAction | undefined
}
export type CompanionUpgradeScript<TConfig> = (
config: CompanionCoreInstanceconfig & TConfig,
actions: CompanionMigrationAction[],
release_actions: CompanionMigrationAction[],
feedbacks: CompanionMigrationFeedback[]
) => boolean
export interface CompanionCoreInstanceconfig {
instance_type: string
label: string
enabled: boolean
}
export interface CompanionMigrationAction {
readonly id: string
readonly instance: string
label: string
action: string
options: { [key: string]: InputValue | undefined }
}
export interface CompanionMigrationFeedback {
readonly id: string
readonly instance_id: string
type: string
options: { [key: string]: InputValue | undefined }
}