@zaflun/lumio-protocol 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/dist/index.d.ts +456 -0
- package/dist/index.js +257 -0
- package/package.json +49 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zaflun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
|
|
3
|
+
declare const themeColorsSchema: z.ZodObject<{
|
|
4
|
+
primary: z.ZodString;
|
|
5
|
+
secondary: z.ZodString;
|
|
6
|
+
accent: z.ZodString;
|
|
7
|
+
background: z.ZodString;
|
|
8
|
+
surface: z.ZodString;
|
|
9
|
+
text: z.ZodString;
|
|
10
|
+
muted: z.ZodString;
|
|
11
|
+
border: z.ZodString;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type ThemeColors = z.infer<typeof themeColorsSchema>;
|
|
14
|
+
declare const themeFontsSchema: z.ZodObject<{
|
|
15
|
+
heading: z.ZodString;
|
|
16
|
+
body: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
type ThemeFonts = z.infer<typeof themeFontsSchema>;
|
|
19
|
+
declare const themeBorderRadiusSchema: z.ZodObject<{
|
|
20
|
+
sm: z.ZodString;
|
|
21
|
+
md: z.ZodString;
|
|
22
|
+
lg: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
type ThemeBorderRadius = z.infer<typeof themeBorderRadiusSchema>;
|
|
25
|
+
declare const themeSchema: z.ZodObject<{
|
|
26
|
+
colors: z.ZodObject<{
|
|
27
|
+
primary: z.ZodString;
|
|
28
|
+
secondary: z.ZodString;
|
|
29
|
+
accent: z.ZodString;
|
|
30
|
+
background: z.ZodString;
|
|
31
|
+
surface: z.ZodString;
|
|
32
|
+
text: z.ZodString;
|
|
33
|
+
muted: z.ZodString;
|
|
34
|
+
border: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
fonts: z.ZodObject<{
|
|
37
|
+
heading: z.ZodString;
|
|
38
|
+
body: z.ZodString;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
borderRadius: z.ZodObject<{
|
|
41
|
+
sm: z.ZodString;
|
|
42
|
+
md: z.ZodString;
|
|
43
|
+
lg: z.ZodString;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
spacing: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
type Theme = z.infer<typeof themeSchema>;
|
|
48
|
+
declare const extensionConfigSchema: z.ZodObject<{
|
|
49
|
+
extension_id: z.ZodString;
|
|
50
|
+
install_id: z.ZodString;
|
|
51
|
+
account_id: z.ZodString;
|
|
52
|
+
target: z.ZodEnum<{
|
|
53
|
+
editor: "editor";
|
|
54
|
+
layer: "layer";
|
|
55
|
+
interactive: "interactive";
|
|
56
|
+
}>;
|
|
57
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
58
|
+
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
type ExtensionConfig = z.infer<typeof extensionConfigSchema>;
|
|
61
|
+
declare const MESSAGE_TYPES: readonly ["INIT", "CONFIG_UPDATE", "EVENT", "ACTION", "STORAGE_UPDATE", "THEME_CHANGE", "READY", "ERROR"];
|
|
62
|
+
type MessageType = (typeof MESSAGE_TYPES)[number];
|
|
63
|
+
declare const initMessageSchema: z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"INIT">;
|
|
65
|
+
config: z.ZodObject<{
|
|
66
|
+
extension_id: z.ZodString;
|
|
67
|
+
install_id: z.ZodString;
|
|
68
|
+
account_id: z.ZodString;
|
|
69
|
+
target: z.ZodEnum<{
|
|
70
|
+
editor: "editor";
|
|
71
|
+
layer: "layer";
|
|
72
|
+
interactive: "interactive";
|
|
73
|
+
}>;
|
|
74
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
75
|
+
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
78
|
+
colors: z.ZodObject<{
|
|
79
|
+
primary: z.ZodString;
|
|
80
|
+
secondary: z.ZodString;
|
|
81
|
+
accent: z.ZodString;
|
|
82
|
+
background: z.ZodString;
|
|
83
|
+
surface: z.ZodString;
|
|
84
|
+
text: z.ZodString;
|
|
85
|
+
muted: z.ZodString;
|
|
86
|
+
border: z.ZodString;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
fonts: z.ZodObject<{
|
|
89
|
+
heading: z.ZodString;
|
|
90
|
+
body: z.ZodString;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
borderRadius: z.ZodObject<{
|
|
93
|
+
sm: z.ZodString;
|
|
94
|
+
md: z.ZodString;
|
|
95
|
+
lg: z.ZodString;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
spacing: z.ZodNumber;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
type InitMessage = z.infer<typeof initMessageSchema>;
|
|
101
|
+
declare const configUpdateMessageSchema: z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"CONFIG_UPDATE">;
|
|
103
|
+
config: z.ZodObject<{
|
|
104
|
+
extension_id: z.ZodOptional<z.ZodString>;
|
|
105
|
+
install_id: z.ZodOptional<z.ZodString>;
|
|
106
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
107
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
editor: "editor";
|
|
109
|
+
layer: "layer";
|
|
110
|
+
interactive: "interactive";
|
|
111
|
+
}>>;
|
|
112
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
+
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
type ConfigUpdateMessage = z.infer<typeof configUpdateMessageSchema>;
|
|
117
|
+
declare const eventMessageSchema: z.ZodObject<{
|
|
118
|
+
type: z.ZodLiteral<"EVENT">;
|
|
119
|
+
event_type: z.ZodString;
|
|
120
|
+
data: z.ZodUnknown;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
type EventMessage = z.infer<typeof eventMessageSchema>;
|
|
123
|
+
declare const actionMessageSchema: z.ZodObject<{
|
|
124
|
+
type: z.ZodLiteral<"ACTION">;
|
|
125
|
+
action: z.ZodString;
|
|
126
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
type ActionMessage = z.infer<typeof actionMessageSchema>;
|
|
129
|
+
declare const storageUpdateMessageSchema: z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"STORAGE_UPDATE">;
|
|
131
|
+
scope: z.ZodString;
|
|
132
|
+
key: z.ZodString;
|
|
133
|
+
value: z.ZodUnknown;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
type StorageUpdateMessage = z.infer<typeof storageUpdateMessageSchema>;
|
|
136
|
+
declare const themeChangeMessageSchema: z.ZodObject<{
|
|
137
|
+
type: z.ZodLiteral<"THEME_CHANGE">;
|
|
138
|
+
theme: z.ZodObject<{
|
|
139
|
+
colors: z.ZodObject<{
|
|
140
|
+
primary: z.ZodString;
|
|
141
|
+
secondary: z.ZodString;
|
|
142
|
+
accent: z.ZodString;
|
|
143
|
+
background: z.ZodString;
|
|
144
|
+
surface: z.ZodString;
|
|
145
|
+
text: z.ZodString;
|
|
146
|
+
muted: z.ZodString;
|
|
147
|
+
border: z.ZodString;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
fonts: z.ZodObject<{
|
|
150
|
+
heading: z.ZodString;
|
|
151
|
+
body: z.ZodString;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
borderRadius: z.ZodObject<{
|
|
154
|
+
sm: z.ZodString;
|
|
155
|
+
md: z.ZodString;
|
|
156
|
+
lg: z.ZodString;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
spacing: z.ZodNumber;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
type ThemeChangeMessage = z.infer<typeof themeChangeMessageSchema>;
|
|
162
|
+
declare const readyMessageSchema: z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"READY">;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
type ReadyMessage = z.infer<typeof readyMessageSchema>;
|
|
166
|
+
declare const errorMessageSchema: z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"ERROR">;
|
|
168
|
+
code: z.ZodString;
|
|
169
|
+
message: z.ZodString;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
type ErrorMessage = z.infer<typeof errorMessageSchema>;
|
|
172
|
+
declare const lumioMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
173
|
+
type: z.ZodLiteral<"INIT">;
|
|
174
|
+
config: z.ZodObject<{
|
|
175
|
+
extension_id: z.ZodString;
|
|
176
|
+
install_id: z.ZodString;
|
|
177
|
+
account_id: z.ZodString;
|
|
178
|
+
target: z.ZodEnum<{
|
|
179
|
+
editor: "editor";
|
|
180
|
+
layer: "layer";
|
|
181
|
+
interactive: "interactive";
|
|
182
|
+
}>;
|
|
183
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
184
|
+
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
colors: z.ZodObject<{
|
|
188
|
+
primary: z.ZodString;
|
|
189
|
+
secondary: z.ZodString;
|
|
190
|
+
accent: z.ZodString;
|
|
191
|
+
background: z.ZodString;
|
|
192
|
+
surface: z.ZodString;
|
|
193
|
+
text: z.ZodString;
|
|
194
|
+
muted: z.ZodString;
|
|
195
|
+
border: z.ZodString;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
fonts: z.ZodObject<{
|
|
198
|
+
heading: z.ZodString;
|
|
199
|
+
body: z.ZodString;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
borderRadius: z.ZodObject<{
|
|
202
|
+
sm: z.ZodString;
|
|
203
|
+
md: z.ZodString;
|
|
204
|
+
lg: z.ZodString;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
spacing: z.ZodNumber;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
209
|
+
type: z.ZodLiteral<"CONFIG_UPDATE">;
|
|
210
|
+
config: z.ZodObject<{
|
|
211
|
+
extension_id: z.ZodOptional<z.ZodString>;
|
|
212
|
+
install_id: z.ZodOptional<z.ZodString>;
|
|
213
|
+
account_id: z.ZodOptional<z.ZodString>;
|
|
214
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
215
|
+
editor: "editor";
|
|
216
|
+
layer: "layer";
|
|
217
|
+
interactive: "interactive";
|
|
218
|
+
}>>;
|
|
219
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
220
|
+
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
223
|
+
type: z.ZodLiteral<"EVENT">;
|
|
224
|
+
event_type: z.ZodString;
|
|
225
|
+
data: z.ZodUnknown;
|
|
226
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
227
|
+
type: z.ZodLiteral<"ACTION">;
|
|
228
|
+
action: z.ZodString;
|
|
229
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
230
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
231
|
+
type: z.ZodLiteral<"STORAGE_UPDATE">;
|
|
232
|
+
scope: z.ZodString;
|
|
233
|
+
key: z.ZodString;
|
|
234
|
+
value: z.ZodUnknown;
|
|
235
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
|
+
type: z.ZodLiteral<"THEME_CHANGE">;
|
|
237
|
+
theme: z.ZodObject<{
|
|
238
|
+
colors: z.ZodObject<{
|
|
239
|
+
primary: z.ZodString;
|
|
240
|
+
secondary: z.ZodString;
|
|
241
|
+
accent: z.ZodString;
|
|
242
|
+
background: z.ZodString;
|
|
243
|
+
surface: z.ZodString;
|
|
244
|
+
text: z.ZodString;
|
|
245
|
+
muted: z.ZodString;
|
|
246
|
+
border: z.ZodString;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
fonts: z.ZodObject<{
|
|
249
|
+
heading: z.ZodString;
|
|
250
|
+
body: z.ZodString;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
borderRadius: z.ZodObject<{
|
|
253
|
+
sm: z.ZodString;
|
|
254
|
+
md: z.ZodString;
|
|
255
|
+
lg: z.ZodString;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
spacing: z.ZodNumber;
|
|
258
|
+
}, z.core.$strip>;
|
|
259
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
260
|
+
type: z.ZodLiteral<"READY">;
|
|
261
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
262
|
+
type: z.ZodLiteral<"ERROR">;
|
|
263
|
+
code: z.ZodString;
|
|
264
|
+
message: z.ZodString;
|
|
265
|
+
}, z.core.$strip>], "type">;
|
|
266
|
+
type LumioMessage = z.infer<typeof lumioMessageSchema>;
|
|
267
|
+
|
|
268
|
+
declare const LUMIO_EVENT_TYPES: readonly ["twitch:follower", "twitch:subscribe", "twitch:gift_sub", "twitch:resub", "twitch:cheer", "twitch:raid", "twitch:reward", "twitch:hype_train", "twitch:hype_train_end", "twitch:poll", "twitch:poll_end", "twitch:prediction", "twitch:prediction_lock", "twitch:prediction_end", "twitch:goal", "twitch:goal_end", "twitch:ad_break", "twitch:ban", "twitch:unban", "twitch:stream_online", "twitch:stream_offline", "twitch:stream_update", "youtube:subscribe", "youtube:member", "youtube:superchat", "youtube:supersticker", "youtube:gift_membership", "youtube:gift_membership_received", "youtube:poll", "kick:follower", "kick:subscribe", "kick:gift", "kick:stream_online", "kick:stream_offline", "trovo:subscribe", "trovo:spell", "spotify:track", "spotify:play", "spotify:pause", "spotify:skip", "spotify:volume", "spotify:queue_add", "spotify:device", "spotify:playlist_add", "spotify:playlist_remove", "spotify:playlist_create", "spotify:playlist_edit", "spotify:playlist_delete", "streamelements:tip", "twitch:chat", "youtube:chat", "kick:chat", "trovo:chat", "chat:message"];
|
|
269
|
+
type LumioEventType = (typeof LUMIO_EVENT_TYPES)[number];
|
|
270
|
+
declare const lumioEventTypeSchema: z.ZodEnum<{
|
|
271
|
+
"twitch:follower": "twitch:follower";
|
|
272
|
+
"twitch:subscribe": "twitch:subscribe";
|
|
273
|
+
"twitch:gift_sub": "twitch:gift_sub";
|
|
274
|
+
"twitch:resub": "twitch:resub";
|
|
275
|
+
"twitch:cheer": "twitch:cheer";
|
|
276
|
+
"twitch:raid": "twitch:raid";
|
|
277
|
+
"twitch:reward": "twitch:reward";
|
|
278
|
+
"twitch:hype_train": "twitch:hype_train";
|
|
279
|
+
"twitch:hype_train_end": "twitch:hype_train_end";
|
|
280
|
+
"twitch:poll": "twitch:poll";
|
|
281
|
+
"twitch:poll_end": "twitch:poll_end";
|
|
282
|
+
"twitch:prediction": "twitch:prediction";
|
|
283
|
+
"twitch:prediction_lock": "twitch:prediction_lock";
|
|
284
|
+
"twitch:prediction_end": "twitch:prediction_end";
|
|
285
|
+
"twitch:goal": "twitch:goal";
|
|
286
|
+
"twitch:goal_end": "twitch:goal_end";
|
|
287
|
+
"twitch:ad_break": "twitch:ad_break";
|
|
288
|
+
"twitch:ban": "twitch:ban";
|
|
289
|
+
"twitch:unban": "twitch:unban";
|
|
290
|
+
"twitch:stream_online": "twitch:stream_online";
|
|
291
|
+
"twitch:stream_offline": "twitch:stream_offline";
|
|
292
|
+
"twitch:stream_update": "twitch:stream_update";
|
|
293
|
+
"youtube:subscribe": "youtube:subscribe";
|
|
294
|
+
"youtube:member": "youtube:member";
|
|
295
|
+
"youtube:superchat": "youtube:superchat";
|
|
296
|
+
"youtube:supersticker": "youtube:supersticker";
|
|
297
|
+
"youtube:gift_membership": "youtube:gift_membership";
|
|
298
|
+
"youtube:gift_membership_received": "youtube:gift_membership_received";
|
|
299
|
+
"youtube:poll": "youtube:poll";
|
|
300
|
+
"kick:follower": "kick:follower";
|
|
301
|
+
"kick:subscribe": "kick:subscribe";
|
|
302
|
+
"kick:gift": "kick:gift";
|
|
303
|
+
"kick:stream_online": "kick:stream_online";
|
|
304
|
+
"kick:stream_offline": "kick:stream_offline";
|
|
305
|
+
"trovo:subscribe": "trovo:subscribe";
|
|
306
|
+
"trovo:spell": "trovo:spell";
|
|
307
|
+
"spotify:track": "spotify:track";
|
|
308
|
+
"spotify:play": "spotify:play";
|
|
309
|
+
"spotify:pause": "spotify:pause";
|
|
310
|
+
"spotify:skip": "spotify:skip";
|
|
311
|
+
"spotify:volume": "spotify:volume";
|
|
312
|
+
"spotify:queue_add": "spotify:queue_add";
|
|
313
|
+
"spotify:device": "spotify:device";
|
|
314
|
+
"spotify:playlist_add": "spotify:playlist_add";
|
|
315
|
+
"spotify:playlist_remove": "spotify:playlist_remove";
|
|
316
|
+
"spotify:playlist_create": "spotify:playlist_create";
|
|
317
|
+
"spotify:playlist_edit": "spotify:playlist_edit";
|
|
318
|
+
"spotify:playlist_delete": "spotify:playlist_delete";
|
|
319
|
+
"streamelements:tip": "streamelements:tip";
|
|
320
|
+
"twitch:chat": "twitch:chat";
|
|
321
|
+
"youtube:chat": "youtube:chat";
|
|
322
|
+
"kick:chat": "kick:chat";
|
|
323
|
+
"trovo:chat": "trovo:chat";
|
|
324
|
+
"chat:message": "chat:message";
|
|
325
|
+
}>;
|
|
326
|
+
declare const ACTION_TYPES: readonly ["chat:send", "chat:delete", "chat:ban", "chat:unban", "chat:timeout", "obs:set_scene", "obs:set_source_visible", "obs:start_stream", "obs:stop_stream", "obs:start_recording", "obs:stop_recording", "spotify:play", "spotify:pause", "spotify:skip", "spotify:seek", "spotify:volume", "spotify:shuffle", "spotify:repeat", "spotify:queue_add", "events:emit", "overlay:update_layer"];
|
|
327
|
+
type LumioActionType = (typeof ACTION_TYPES)[number];
|
|
328
|
+
declare const lumioActionTypeSchema: z.ZodEnum<{
|
|
329
|
+
"spotify:play": "spotify:play";
|
|
330
|
+
"spotify:pause": "spotify:pause";
|
|
331
|
+
"spotify:skip": "spotify:skip";
|
|
332
|
+
"spotify:volume": "spotify:volume";
|
|
333
|
+
"spotify:queue_add": "spotify:queue_add";
|
|
334
|
+
"chat:send": "chat:send";
|
|
335
|
+
"chat:delete": "chat:delete";
|
|
336
|
+
"chat:ban": "chat:ban";
|
|
337
|
+
"chat:unban": "chat:unban";
|
|
338
|
+
"chat:timeout": "chat:timeout";
|
|
339
|
+
"obs:set_scene": "obs:set_scene";
|
|
340
|
+
"obs:set_source_visible": "obs:set_source_visible";
|
|
341
|
+
"obs:start_stream": "obs:start_stream";
|
|
342
|
+
"obs:stop_stream": "obs:stop_stream";
|
|
343
|
+
"obs:start_recording": "obs:start_recording";
|
|
344
|
+
"obs:stop_recording": "obs:stop_recording";
|
|
345
|
+
"spotify:seek": "spotify:seek";
|
|
346
|
+
"spotify:shuffle": "spotify:shuffle";
|
|
347
|
+
"spotify:repeat": "spotify:repeat";
|
|
348
|
+
"events:emit": "events:emit";
|
|
349
|
+
"overlay:update_layer": "overlay:update_layer";
|
|
350
|
+
}>;
|
|
351
|
+
declare const STORAGE_SCOPES: readonly ["instance", "overlay", "account", "global"];
|
|
352
|
+
type StorageScope = (typeof STORAGE_SCOPES)[number];
|
|
353
|
+
declare const storageScopeSchema: z.ZodEnum<{
|
|
354
|
+
instance: "instance";
|
|
355
|
+
overlay: "overlay";
|
|
356
|
+
account: "account";
|
|
357
|
+
global: "global";
|
|
358
|
+
}>;
|
|
359
|
+
|
|
360
|
+
declare const LUMIO_COMPONENT_TYPES: readonly ["Box", "VStack", "HStack", "CompactView", "List", "Text", "Image", "Button", "Toggle", "TextField", "TextArea", "NumberField", "Dropdown", "Slider"];
|
|
361
|
+
type LumioComponentType = (typeof LUMIO_COMPONENT_TYPES)[number];
|
|
362
|
+
interface LumioComponentNode {
|
|
363
|
+
_id: string;
|
|
364
|
+
type: LumioComponentType;
|
|
365
|
+
props: Record<string, unknown>;
|
|
366
|
+
children: LumioComponentNode[];
|
|
367
|
+
}
|
|
368
|
+
interface JsonRpcNotification {
|
|
369
|
+
jsonrpc: "2.0";
|
|
370
|
+
method: string;
|
|
371
|
+
params?: unknown;
|
|
372
|
+
}
|
|
373
|
+
interface JsonRpcRequest {
|
|
374
|
+
jsonrpc: "2.0";
|
|
375
|
+
id: string;
|
|
376
|
+
method: string;
|
|
377
|
+
params?: unknown;
|
|
378
|
+
}
|
|
379
|
+
interface JsonRpcResponse {
|
|
380
|
+
jsonrpc: "2.0";
|
|
381
|
+
id: string;
|
|
382
|
+
result?: unknown;
|
|
383
|
+
error?: {
|
|
384
|
+
code: number;
|
|
385
|
+
message: string;
|
|
386
|
+
data?: unknown;
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
type JsonRpcMessage = JsonRpcNotification | JsonRpcRequest | JsonRpcResponse;
|
|
390
|
+
interface UiRenderParams {
|
|
391
|
+
tree: LumioComponentNode[];
|
|
392
|
+
}
|
|
393
|
+
interface UiReadyParams {
|
|
394
|
+
}
|
|
395
|
+
interface UiKeyframesParams {
|
|
396
|
+
css: string;
|
|
397
|
+
}
|
|
398
|
+
interface StorageSetParams {
|
|
399
|
+
key: string;
|
|
400
|
+
value: unknown;
|
|
401
|
+
}
|
|
402
|
+
interface StorageGetParams {
|
|
403
|
+
key: string;
|
|
404
|
+
}
|
|
405
|
+
interface ServerQueryParams {
|
|
406
|
+
fn: string;
|
|
407
|
+
params: Record<string, unknown>;
|
|
408
|
+
}
|
|
409
|
+
interface ServerMutationParams {
|
|
410
|
+
fn: string;
|
|
411
|
+
params: Record<string, unknown>;
|
|
412
|
+
}
|
|
413
|
+
interface LifecycleInitParams {
|
|
414
|
+
extensionId: string;
|
|
415
|
+
installId: string;
|
|
416
|
+
accountId: string;
|
|
417
|
+
target: "editor" | "layer" | "interactive";
|
|
418
|
+
storage: Record<string, unknown>;
|
|
419
|
+
theme: Theme;
|
|
420
|
+
}
|
|
421
|
+
interface LifecycleDestroyParams {
|
|
422
|
+
}
|
|
423
|
+
interface EventCallbackParams {
|
|
424
|
+
handlerId: string;
|
|
425
|
+
args: unknown[];
|
|
426
|
+
}
|
|
427
|
+
interface EventPlatformParams {
|
|
428
|
+
eventType: string;
|
|
429
|
+
data: unknown;
|
|
430
|
+
}
|
|
431
|
+
interface StorageUpdateParams {
|
|
432
|
+
key: string;
|
|
433
|
+
value: unknown;
|
|
434
|
+
}
|
|
435
|
+
interface ThemeChangeParams {
|
|
436
|
+
theme: Theme;
|
|
437
|
+
}
|
|
438
|
+
declare const WORKER_METHODS: {
|
|
439
|
+
readonly UI_RENDER: "ui.render";
|
|
440
|
+
readonly UI_READY: "ui.ready";
|
|
441
|
+
readonly UI_KEYFRAMES: "ui.keyframes";
|
|
442
|
+
readonly STORAGE_SET: "storage.set";
|
|
443
|
+
readonly STORAGE_GET: "storage.get";
|
|
444
|
+
readonly SERVER_QUERY: "server.query";
|
|
445
|
+
readonly SERVER_MUTATION: "server.mutation";
|
|
446
|
+
};
|
|
447
|
+
declare const HOST_METHODS: {
|
|
448
|
+
readonly LIFECYCLE_INIT: "lifecycle.init";
|
|
449
|
+
readonly LIFECYCLE_DESTROY: "lifecycle.destroy";
|
|
450
|
+
readonly EVENT_CALLBACK: "event.callback";
|
|
451
|
+
readonly EVENT_PLATFORM: "event.platform";
|
|
452
|
+
readonly STORAGE_UPDATE: "storage.update";
|
|
453
|
+
readonly THEME_CHANGE: "theme.change";
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export { ACTION_TYPES, type ActionMessage, type ConfigUpdateMessage, type ErrorMessage, type EventCallbackParams, type EventMessage, type EventPlatformParams, type ExtensionConfig, HOST_METHODS, type InitMessage, type JsonRpcMessage, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, LUMIO_COMPONENT_TYPES, LUMIO_EVENT_TYPES, type LifecycleDestroyParams, type LifecycleInitParams, type LumioActionType, type LumioComponentNode, type LumioComponentType, type LumioEventType, type LumioMessage, MESSAGE_TYPES, type MessageType, type ReadyMessage, STORAGE_SCOPES, type ServerMutationParams, type ServerQueryParams, type StorageGetParams, type StorageScope, type StorageSetParams, type StorageUpdateMessage, type StorageUpdateParams, type Theme, type ThemeBorderRadius, type ThemeChangeMessage, type ThemeChangeParams, type ThemeColors, type ThemeFonts, type UiKeyframesParams, type UiReadyParams, type UiRenderParams, WORKER_METHODS, actionMessageSchema, configUpdateMessageSchema, errorMessageSchema, eventMessageSchema, extensionConfigSchema, initMessageSchema, lumioActionTypeSchema, lumioEventTypeSchema, lumioMessageSchema, readyMessageSchema, storageScopeSchema, storageUpdateMessageSchema, themeBorderRadiusSchema, themeChangeMessageSchema, themeColorsSchema, themeFontsSchema, themeSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
// src/messages.ts
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
var themeColorsSchema = z.object({
|
|
4
|
+
primary: z.string(),
|
|
5
|
+
secondary: z.string(),
|
|
6
|
+
accent: z.string(),
|
|
7
|
+
background: z.string(),
|
|
8
|
+
surface: z.string(),
|
|
9
|
+
text: z.string(),
|
|
10
|
+
muted: z.string(),
|
|
11
|
+
border: z.string()
|
|
12
|
+
});
|
|
13
|
+
var themeFontsSchema = z.object({
|
|
14
|
+
heading: z.string(),
|
|
15
|
+
body: z.string()
|
|
16
|
+
});
|
|
17
|
+
var themeBorderRadiusSchema = z.object({
|
|
18
|
+
sm: z.string(),
|
|
19
|
+
md: z.string(),
|
|
20
|
+
lg: z.string()
|
|
21
|
+
});
|
|
22
|
+
var themeSchema = z.object({
|
|
23
|
+
colors: themeColorsSchema,
|
|
24
|
+
fonts: themeFontsSchema,
|
|
25
|
+
borderRadius: themeBorderRadiusSchema,
|
|
26
|
+
spacing: z.number()
|
|
27
|
+
});
|
|
28
|
+
var extensionConfigSchema = z.object({
|
|
29
|
+
extension_id: z.string(),
|
|
30
|
+
install_id: z.string(),
|
|
31
|
+
account_id: z.string(),
|
|
32
|
+
target: z.enum(["editor", "layer", "interactive"]),
|
|
33
|
+
permissions: z.array(z.string()),
|
|
34
|
+
settings: z.record(z.string(), z.unknown())
|
|
35
|
+
});
|
|
36
|
+
var MESSAGE_TYPES = [
|
|
37
|
+
"INIT",
|
|
38
|
+
"CONFIG_UPDATE",
|
|
39
|
+
"EVENT",
|
|
40
|
+
"ACTION",
|
|
41
|
+
"STORAGE_UPDATE",
|
|
42
|
+
"THEME_CHANGE",
|
|
43
|
+
"READY",
|
|
44
|
+
"ERROR"
|
|
45
|
+
];
|
|
46
|
+
var initMessageSchema = z.object({
|
|
47
|
+
type: z.literal("INIT"),
|
|
48
|
+
config: extensionConfigSchema,
|
|
49
|
+
theme: themeSchema.optional()
|
|
50
|
+
});
|
|
51
|
+
var configUpdateMessageSchema = z.object({
|
|
52
|
+
type: z.literal("CONFIG_UPDATE"),
|
|
53
|
+
config: extensionConfigSchema.partial()
|
|
54
|
+
});
|
|
55
|
+
var eventMessageSchema = z.object({
|
|
56
|
+
type: z.literal("EVENT"),
|
|
57
|
+
event_type: z.string(),
|
|
58
|
+
data: z.unknown()
|
|
59
|
+
});
|
|
60
|
+
var actionMessageSchema = z.object({
|
|
61
|
+
type: z.literal("ACTION"),
|
|
62
|
+
action: z.string(),
|
|
63
|
+
params: z.record(z.string(), z.unknown())
|
|
64
|
+
});
|
|
65
|
+
var storageUpdateMessageSchema = z.object({
|
|
66
|
+
type: z.literal("STORAGE_UPDATE"),
|
|
67
|
+
scope: z.string(),
|
|
68
|
+
key: z.string(),
|
|
69
|
+
value: z.unknown()
|
|
70
|
+
});
|
|
71
|
+
var themeChangeMessageSchema = z.object({
|
|
72
|
+
type: z.literal("THEME_CHANGE"),
|
|
73
|
+
theme: themeSchema
|
|
74
|
+
});
|
|
75
|
+
var readyMessageSchema = z.object({
|
|
76
|
+
type: z.literal("READY")
|
|
77
|
+
});
|
|
78
|
+
var errorMessageSchema = z.object({
|
|
79
|
+
type: z.literal("ERROR"),
|
|
80
|
+
code: z.string(),
|
|
81
|
+
message: z.string()
|
|
82
|
+
});
|
|
83
|
+
var lumioMessageSchema = z.discriminatedUnion("type", [
|
|
84
|
+
initMessageSchema,
|
|
85
|
+
configUpdateMessageSchema,
|
|
86
|
+
eventMessageSchema,
|
|
87
|
+
actionMessageSchema,
|
|
88
|
+
storageUpdateMessageSchema,
|
|
89
|
+
themeChangeMessageSchema,
|
|
90
|
+
readyMessageSchema,
|
|
91
|
+
errorMessageSchema
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
// src/events.ts
|
|
95
|
+
import { z as z2 } from "zod/v4";
|
|
96
|
+
var LUMIO_EVENT_TYPES = [
|
|
97
|
+
// Twitch
|
|
98
|
+
"twitch:follower",
|
|
99
|
+
"twitch:subscribe",
|
|
100
|
+
"twitch:gift_sub",
|
|
101
|
+
"twitch:resub",
|
|
102
|
+
"twitch:cheer",
|
|
103
|
+
"twitch:raid",
|
|
104
|
+
"twitch:reward",
|
|
105
|
+
"twitch:hype_train",
|
|
106
|
+
"twitch:hype_train_end",
|
|
107
|
+
"twitch:poll",
|
|
108
|
+
"twitch:poll_end",
|
|
109
|
+
"twitch:prediction",
|
|
110
|
+
"twitch:prediction_lock",
|
|
111
|
+
"twitch:prediction_end",
|
|
112
|
+
"twitch:goal",
|
|
113
|
+
"twitch:goal_end",
|
|
114
|
+
"twitch:ad_break",
|
|
115
|
+
"twitch:ban",
|
|
116
|
+
"twitch:unban",
|
|
117
|
+
"twitch:stream_online",
|
|
118
|
+
"twitch:stream_offline",
|
|
119
|
+
"twitch:stream_update",
|
|
120
|
+
// YouTube
|
|
121
|
+
"youtube:subscribe",
|
|
122
|
+
"youtube:member",
|
|
123
|
+
"youtube:superchat",
|
|
124
|
+
"youtube:supersticker",
|
|
125
|
+
"youtube:gift_membership",
|
|
126
|
+
"youtube:gift_membership_received",
|
|
127
|
+
"youtube:poll",
|
|
128
|
+
// Kick
|
|
129
|
+
"kick:follower",
|
|
130
|
+
"kick:subscribe",
|
|
131
|
+
"kick:gift",
|
|
132
|
+
"kick:stream_online",
|
|
133
|
+
"kick:stream_offline",
|
|
134
|
+
// Trovo
|
|
135
|
+
"trovo:subscribe",
|
|
136
|
+
"trovo:spell",
|
|
137
|
+
// Spotify
|
|
138
|
+
"spotify:track",
|
|
139
|
+
"spotify:play",
|
|
140
|
+
"spotify:pause",
|
|
141
|
+
"spotify:skip",
|
|
142
|
+
"spotify:volume",
|
|
143
|
+
"spotify:queue_add",
|
|
144
|
+
"spotify:device",
|
|
145
|
+
"spotify:playlist_add",
|
|
146
|
+
"spotify:playlist_remove",
|
|
147
|
+
"spotify:playlist_create",
|
|
148
|
+
"spotify:playlist_edit",
|
|
149
|
+
"spotify:playlist_delete",
|
|
150
|
+
// StreamElements
|
|
151
|
+
"streamelements:tip",
|
|
152
|
+
// Chat (per-platform)
|
|
153
|
+
"twitch:chat",
|
|
154
|
+
"youtube:chat",
|
|
155
|
+
"kick:chat",
|
|
156
|
+
"trovo:chat",
|
|
157
|
+
// Chat (cross-platform catch-all — fires for ALL platforms)
|
|
158
|
+
"chat:message"
|
|
159
|
+
];
|
|
160
|
+
var lumioEventTypeSchema = z2.enum(LUMIO_EVENT_TYPES);
|
|
161
|
+
var ACTION_TYPES = [
|
|
162
|
+
// Chat
|
|
163
|
+
"chat:send",
|
|
164
|
+
"chat:delete",
|
|
165
|
+
"chat:ban",
|
|
166
|
+
"chat:unban",
|
|
167
|
+
"chat:timeout",
|
|
168
|
+
// OBS
|
|
169
|
+
"obs:set_scene",
|
|
170
|
+
"obs:set_source_visible",
|
|
171
|
+
"obs:start_stream",
|
|
172
|
+
"obs:stop_stream",
|
|
173
|
+
"obs:start_recording",
|
|
174
|
+
"obs:stop_recording",
|
|
175
|
+
// Spotify
|
|
176
|
+
"spotify:play",
|
|
177
|
+
"spotify:pause",
|
|
178
|
+
"spotify:skip",
|
|
179
|
+
"spotify:seek",
|
|
180
|
+
"spotify:volume",
|
|
181
|
+
"spotify:shuffle",
|
|
182
|
+
"spotify:repeat",
|
|
183
|
+
"spotify:queue_add",
|
|
184
|
+
// Events
|
|
185
|
+
"events:emit",
|
|
186
|
+
// Overlay
|
|
187
|
+
"overlay:update_layer"
|
|
188
|
+
];
|
|
189
|
+
var lumioActionTypeSchema = z2.enum(ACTION_TYPES);
|
|
190
|
+
var STORAGE_SCOPES = [
|
|
191
|
+
"instance",
|
|
192
|
+
"overlay",
|
|
193
|
+
"account",
|
|
194
|
+
"global"
|
|
195
|
+
];
|
|
196
|
+
var storageScopeSchema = z2.enum(STORAGE_SCOPES);
|
|
197
|
+
|
|
198
|
+
// src/components.ts
|
|
199
|
+
var LUMIO_COMPONENT_TYPES = [
|
|
200
|
+
"Box",
|
|
201
|
+
"VStack",
|
|
202
|
+
"HStack",
|
|
203
|
+
"CompactView",
|
|
204
|
+
"List",
|
|
205
|
+
"Text",
|
|
206
|
+
"Image",
|
|
207
|
+
"Button",
|
|
208
|
+
"Toggle",
|
|
209
|
+
"TextField",
|
|
210
|
+
"TextArea",
|
|
211
|
+
"NumberField",
|
|
212
|
+
"Dropdown",
|
|
213
|
+
"Slider"
|
|
214
|
+
];
|
|
215
|
+
var WORKER_METHODS = {
|
|
216
|
+
UI_RENDER: "ui.render",
|
|
217
|
+
UI_READY: "ui.ready",
|
|
218
|
+
UI_KEYFRAMES: "ui.keyframes",
|
|
219
|
+
STORAGE_SET: "storage.set",
|
|
220
|
+
STORAGE_GET: "storage.get",
|
|
221
|
+
SERVER_QUERY: "server.query",
|
|
222
|
+
SERVER_MUTATION: "server.mutation"
|
|
223
|
+
};
|
|
224
|
+
var HOST_METHODS = {
|
|
225
|
+
LIFECYCLE_INIT: "lifecycle.init",
|
|
226
|
+
LIFECYCLE_DESTROY: "lifecycle.destroy",
|
|
227
|
+
EVENT_CALLBACK: "event.callback",
|
|
228
|
+
EVENT_PLATFORM: "event.platform",
|
|
229
|
+
STORAGE_UPDATE: "storage.update",
|
|
230
|
+
THEME_CHANGE: "theme.change"
|
|
231
|
+
};
|
|
232
|
+
export {
|
|
233
|
+
ACTION_TYPES,
|
|
234
|
+
HOST_METHODS,
|
|
235
|
+
LUMIO_COMPONENT_TYPES,
|
|
236
|
+
LUMIO_EVENT_TYPES,
|
|
237
|
+
MESSAGE_TYPES,
|
|
238
|
+
STORAGE_SCOPES,
|
|
239
|
+
WORKER_METHODS,
|
|
240
|
+
actionMessageSchema,
|
|
241
|
+
configUpdateMessageSchema,
|
|
242
|
+
errorMessageSchema,
|
|
243
|
+
eventMessageSchema,
|
|
244
|
+
extensionConfigSchema,
|
|
245
|
+
initMessageSchema,
|
|
246
|
+
lumioActionTypeSchema,
|
|
247
|
+
lumioEventTypeSchema,
|
|
248
|
+
lumioMessageSchema,
|
|
249
|
+
readyMessageSchema,
|
|
250
|
+
storageScopeSchema,
|
|
251
|
+
storageUpdateMessageSchema,
|
|
252
|
+
themeBorderRadiusSchema,
|
|
253
|
+
themeChangeMessageSchema,
|
|
254
|
+
themeColorsSchema,
|
|
255
|
+
themeFontsSchema,
|
|
256
|
+
themeSchema
|
|
257
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zaflun/lumio-protocol",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Wire-format types for Lumio extension iframe-to-host communication",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"zod": "^4.3.6"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^6.0.2",
|
|
25
|
+
"tsup": "^8.4.0"
|
|
26
|
+
},
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "zaflun",
|
|
29
|
+
"email": "developers@zaflun.com",
|
|
30
|
+
"url": "https://withzaflun.com"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/zaflun/lumio.git",
|
|
36
|
+
"directory": "packages/protocol"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://developers.lumio.vision",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/zaflun/lumio/issues",
|
|
41
|
+
"email": "developers@zaflun.com"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
45
|
+
"typecheck": "tsc --noEmit",
|
|
46
|
+
"lint": "eslint src/",
|
|
47
|
+
"test": "vitest run"
|
|
48
|
+
}
|
|
49
|
+
}
|