@zaflun/lumio-protocol 0.1.1 → 0.2.3
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/README.md +1 -1
- package/dist/index.d.ts +66 -5
- package/dist/index.js +44 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare const extensionConfigSchema: z.ZodObject<{
|
|
|
58
58
|
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
59
59
|
}, z.core.$strip>;
|
|
60
60
|
type ExtensionConfig = z.infer<typeof extensionConfigSchema>;
|
|
61
|
-
declare const MESSAGE_TYPES: readonly ["INIT", "CONFIG_UPDATE", "EVENT", "ACTION", "STORAGE_UPDATE", "THEME_CHANGE", "READY", "ERROR"];
|
|
61
|
+
declare const MESSAGE_TYPES: readonly ["INIT", "CONFIG_UPDATE", "EVENT", "ACTION", "STORAGE_UPDATE", "THEME_CHANGE", "READY", "ERROR", "NODE_CONFIG_REQUEST", "NODE_CONFIG_UPDATE"];
|
|
62
62
|
type MessageType = (typeof MESSAGE_TYPES)[number];
|
|
63
63
|
declare const initMessageSchema: z.ZodObject<{
|
|
64
64
|
type: z.ZodLiteral<"INIT">;
|
|
@@ -169,6 +169,19 @@ declare const errorMessageSchema: z.ZodObject<{
|
|
|
169
169
|
message: z.ZodString;
|
|
170
170
|
}, z.core.$strip>;
|
|
171
171
|
type ErrorMessage = z.infer<typeof errorMessageSchema>;
|
|
172
|
+
declare const nodeConfigRequestMessageSchema: z.ZodObject<{
|
|
173
|
+
type: z.ZodLiteral<"NODE_CONFIG_REQUEST">;
|
|
174
|
+
node_id: z.ZodString;
|
|
175
|
+
install_id: z.ZodString;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
type NodeConfigRequestMessage = z.infer<typeof nodeConfigRequestMessageSchema>;
|
|
178
|
+
declare const nodeConfigUpdateMessageSchema: z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"NODE_CONFIG_UPDATE">;
|
|
180
|
+
node_id: z.ZodString;
|
|
181
|
+
install_id: z.ZodString;
|
|
182
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
type NodeConfigUpdateMessage = z.infer<typeof nodeConfigUpdateMessageSchema>;
|
|
172
185
|
declare const lumioMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
173
186
|
type: z.ZodLiteral<"INIT">;
|
|
174
187
|
config: z.ZodObject<{
|
|
@@ -262,6 +275,15 @@ declare const lumioMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
262
275
|
type: z.ZodLiteral<"ERROR">;
|
|
263
276
|
code: z.ZodString;
|
|
264
277
|
message: z.ZodString;
|
|
278
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
279
|
+
type: z.ZodLiteral<"NODE_CONFIG_REQUEST">;
|
|
280
|
+
node_id: z.ZodString;
|
|
281
|
+
install_id: z.ZodString;
|
|
282
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
283
|
+
type: z.ZodLiteral<"NODE_CONFIG_UPDATE">;
|
|
284
|
+
node_id: z.ZodString;
|
|
285
|
+
install_id: z.ZodString;
|
|
286
|
+
config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
265
287
|
}, z.core.$strip>], "type">;
|
|
266
288
|
type LumioMessage = z.infer<typeof lumioMessageSchema>;
|
|
267
289
|
|
|
@@ -348,20 +370,37 @@ declare const lumioActionTypeSchema: z.ZodEnum<{
|
|
|
348
370
|
"events:emit": "events:emit";
|
|
349
371
|
"overlay:update_layer": "overlay:update_layer";
|
|
350
372
|
}>;
|
|
373
|
+
interface SoundPlayEvent {
|
|
374
|
+
sound_id: string;
|
|
375
|
+
stream_path: string;
|
|
376
|
+
name: string;
|
|
377
|
+
volume: number;
|
|
378
|
+
target?: {
|
|
379
|
+
type: "widget" | "overlay";
|
|
380
|
+
id: string;
|
|
381
|
+
} | null;
|
|
382
|
+
}
|
|
383
|
+
interface SoundStopEvent {
|
|
384
|
+
sound_id: string;
|
|
385
|
+
target?: {
|
|
386
|
+
type: "widget" | "overlay";
|
|
387
|
+
id: string;
|
|
388
|
+
} | null;
|
|
389
|
+
}
|
|
351
390
|
declare const STORAGE_SCOPES: readonly ["instance", "overlay", "account", "global"];
|
|
352
391
|
type StorageScope = (typeof STORAGE_SCOPES)[number];
|
|
353
392
|
declare const storageScopeSchema: z.ZodEnum<{
|
|
354
|
-
instance: "instance";
|
|
355
393
|
overlay: "overlay";
|
|
394
|
+
instance: "instance";
|
|
356
395
|
account: "account";
|
|
357
396
|
global: "global";
|
|
358
397
|
}>;
|
|
359
398
|
|
|
360
|
-
declare const LUMIO_COMPONENT_TYPES: readonly ["Box", "VStack", "HStack", "CompactView", "List", "Text", "Image", "Button", "Toggle", "TextField", "TextArea", "NumberField", "Dropdown", "Slider"];
|
|
399
|
+
declare const LUMIO_COMPONENT_TYPES: readonly ["Box", "VStack", "HStack", "CompactView", "List", "Text", "Image", "Button", "Toggle", "TextField", "TextArea", "NumberField", "Dropdown", "Slider", "IconPicker", "IconDisplay", "EditorInput", "EditorTextarea", "EditorSelect", "EditorCheckbox", "EditorSlider", "EditorColorPicker", "EditorGroup", "EditorLabel", "EditorDivider", "EditorInfo", "EditorFontRow", "EditorButton", "EditorFontPicker", "EditorChannelRow"];
|
|
361
400
|
type LumioComponentType = (typeof LUMIO_COMPONENT_TYPES)[number];
|
|
362
401
|
interface LumioComponentNode {
|
|
363
402
|
_id: string;
|
|
364
|
-
type: LumioComponentType;
|
|
403
|
+
type: LumioComponentType | (string & {});
|
|
365
404
|
props: Record<string, unknown>;
|
|
366
405
|
children: LumioComponentNode[];
|
|
367
406
|
}
|
|
@@ -410,6 +449,22 @@ interface ServerMutationParams {
|
|
|
410
449
|
fn: string;
|
|
411
450
|
params: Record<string, unknown>;
|
|
412
451
|
}
|
|
452
|
+
interface SoundPlayParams {
|
|
453
|
+
sound_id: string;
|
|
454
|
+
volume?: number;
|
|
455
|
+
}
|
|
456
|
+
interface SoundStopParams {
|
|
457
|
+
sound_id: string;
|
|
458
|
+
}
|
|
459
|
+
interface SoundGetListParams {
|
|
460
|
+
}
|
|
461
|
+
interface Sound {
|
|
462
|
+
id: string;
|
|
463
|
+
name: string;
|
|
464
|
+
file_size: number;
|
|
465
|
+
duration_ms: number | null;
|
|
466
|
+
created_at: string;
|
|
467
|
+
}
|
|
413
468
|
interface LifecycleInitParams {
|
|
414
469
|
extensionId: string;
|
|
415
470
|
installId: string;
|
|
@@ -443,6 +498,11 @@ declare const WORKER_METHODS: {
|
|
|
443
498
|
readonly STORAGE_GET: "storage.get";
|
|
444
499
|
readonly SERVER_QUERY: "server.query";
|
|
445
500
|
readonly SERVER_MUTATION: "server.mutation";
|
|
501
|
+
readonly CONFIG_UPDATE: "config.update";
|
|
502
|
+
readonly UI_ACTION: "ui.action";
|
|
503
|
+
readonly SOUND_PLAY: "sound.play";
|
|
504
|
+
readonly SOUND_STOP: "sound.stop";
|
|
505
|
+
readonly SOUND_LIST: "sound.list";
|
|
446
506
|
};
|
|
447
507
|
declare const HOST_METHODS: {
|
|
448
508
|
readonly LIFECYCLE_INIT: "lifecycle.init";
|
|
@@ -451,6 +511,7 @@ declare const HOST_METHODS: {
|
|
|
451
511
|
readonly EVENT_PLATFORM: "event.platform";
|
|
452
512
|
readonly STORAGE_UPDATE: "storage.update";
|
|
453
513
|
readonly THEME_CHANGE: "theme.change";
|
|
514
|
+
readonly CONFIG_UPDATE: "config.update";
|
|
454
515
|
};
|
|
455
516
|
|
|
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 };
|
|
517
|
+
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 NodeConfigRequestMessage, type NodeConfigUpdateMessage, type ReadyMessage, STORAGE_SCOPES, type ServerMutationParams, type ServerQueryParams, type Sound, type SoundGetListParams, type SoundPlayEvent, type SoundPlayParams, type SoundStopEvent, type SoundStopParams, 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, nodeConfigRequestMessageSchema, nodeConfigUpdateMessageSchema, readyMessageSchema, storageScopeSchema, storageUpdateMessageSchema, themeBorderRadiusSchema, themeChangeMessageSchema, themeColorsSchema, themeFontsSchema, themeSchema };
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,9 @@ var MESSAGE_TYPES = [
|
|
|
41
41
|
"STORAGE_UPDATE",
|
|
42
42
|
"THEME_CHANGE",
|
|
43
43
|
"READY",
|
|
44
|
-
"ERROR"
|
|
44
|
+
"ERROR",
|
|
45
|
+
"NODE_CONFIG_REQUEST",
|
|
46
|
+
"NODE_CONFIG_UPDATE"
|
|
45
47
|
];
|
|
46
48
|
var initMessageSchema = z.object({
|
|
47
49
|
type: z.literal("INIT"),
|
|
@@ -80,6 +82,17 @@ var errorMessageSchema = z.object({
|
|
|
80
82
|
code: z.string(),
|
|
81
83
|
message: z.string()
|
|
82
84
|
});
|
|
85
|
+
var nodeConfigRequestMessageSchema = z.object({
|
|
86
|
+
type: z.literal("NODE_CONFIG_REQUEST"),
|
|
87
|
+
node_id: z.string(),
|
|
88
|
+
install_id: z.string()
|
|
89
|
+
});
|
|
90
|
+
var nodeConfigUpdateMessageSchema = z.object({
|
|
91
|
+
type: z.literal("NODE_CONFIG_UPDATE"),
|
|
92
|
+
node_id: z.string(),
|
|
93
|
+
install_id: z.string(),
|
|
94
|
+
config: z.record(z.string(), z.unknown())
|
|
95
|
+
});
|
|
83
96
|
var lumioMessageSchema = z.discriminatedUnion("type", [
|
|
84
97
|
initMessageSchema,
|
|
85
98
|
configUpdateMessageSchema,
|
|
@@ -88,7 +101,9 @@ var lumioMessageSchema = z.discriminatedUnion("type", [
|
|
|
88
101
|
storageUpdateMessageSchema,
|
|
89
102
|
themeChangeMessageSchema,
|
|
90
103
|
readyMessageSchema,
|
|
91
|
-
errorMessageSchema
|
|
104
|
+
errorMessageSchema,
|
|
105
|
+
nodeConfigRequestMessageSchema,
|
|
106
|
+
nodeConfigUpdateMessageSchema
|
|
92
107
|
]);
|
|
93
108
|
|
|
94
109
|
// src/events.ts
|
|
@@ -210,7 +225,23 @@ var LUMIO_COMPONENT_TYPES = [
|
|
|
210
225
|
"TextArea",
|
|
211
226
|
"NumberField",
|
|
212
227
|
"Dropdown",
|
|
213
|
-
"Slider"
|
|
228
|
+
"Slider",
|
|
229
|
+
"IconPicker",
|
|
230
|
+
"IconDisplay",
|
|
231
|
+
"EditorInput",
|
|
232
|
+
"EditorTextarea",
|
|
233
|
+
"EditorSelect",
|
|
234
|
+
"EditorCheckbox",
|
|
235
|
+
"EditorSlider",
|
|
236
|
+
"EditorColorPicker",
|
|
237
|
+
"EditorGroup",
|
|
238
|
+
"EditorLabel",
|
|
239
|
+
"EditorDivider",
|
|
240
|
+
"EditorInfo",
|
|
241
|
+
"EditorFontRow",
|
|
242
|
+
"EditorButton",
|
|
243
|
+
"EditorFontPicker",
|
|
244
|
+
"EditorChannelRow"
|
|
214
245
|
];
|
|
215
246
|
var WORKER_METHODS = {
|
|
216
247
|
UI_RENDER: "ui.render",
|
|
@@ -219,7 +250,12 @@ var WORKER_METHODS = {
|
|
|
219
250
|
STORAGE_SET: "storage.set",
|
|
220
251
|
STORAGE_GET: "storage.get",
|
|
221
252
|
SERVER_QUERY: "server.query",
|
|
222
|
-
SERVER_MUTATION: "server.mutation"
|
|
253
|
+
SERVER_MUTATION: "server.mutation",
|
|
254
|
+
CONFIG_UPDATE: "config.update",
|
|
255
|
+
UI_ACTION: "ui.action",
|
|
256
|
+
SOUND_PLAY: "sound.play",
|
|
257
|
+
SOUND_STOP: "sound.stop",
|
|
258
|
+
SOUND_LIST: "sound.list"
|
|
223
259
|
};
|
|
224
260
|
var HOST_METHODS = {
|
|
225
261
|
LIFECYCLE_INIT: "lifecycle.init",
|
|
@@ -227,7 +263,8 @@ var HOST_METHODS = {
|
|
|
227
263
|
EVENT_CALLBACK: "event.callback",
|
|
228
264
|
EVENT_PLATFORM: "event.platform",
|
|
229
265
|
STORAGE_UPDATE: "storage.update",
|
|
230
|
-
THEME_CHANGE: "theme.change"
|
|
266
|
+
THEME_CHANGE: "theme.change",
|
|
267
|
+
CONFIG_UPDATE: "config.update"
|
|
231
268
|
};
|
|
232
269
|
export {
|
|
233
270
|
ACTION_TYPES,
|
|
@@ -246,6 +283,8 @@ export {
|
|
|
246
283
|
lumioActionTypeSchema,
|
|
247
284
|
lumioEventTypeSchema,
|
|
248
285
|
lumioMessageSchema,
|
|
286
|
+
nodeConfigRequestMessageSchema,
|
|
287
|
+
nodeConfigUpdateMessageSchema,
|
|
249
288
|
readyMessageSchema,
|
|
250
289
|
storageScopeSchema,
|
|
251
290
|
storageUpdateMessageSchema,
|