@sdeck/veadotube 0.0.0-stage → 1.0.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/README.md CHANGED
@@ -1,3 +1,19 @@
1
- # Temporary Holding Version
1
+ # Veadotube
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Control your [veadotube](https://veado.tube) avatar from [sdeck](https://github.com/ivanoliverfabra/sdeck).
4
+ Works with veadotube mini and veadotube.
5
+
6
+ - **Avatar state**: a key with the state's picture. Switch to it, toggle it, or show it while held.
7
+ - **Next, previous or random state**
8
+ - **Push to talk**: hold or toggle the microphone, or any websocket switch of veadotube.
9
+ - **Change a number**: a websocket number node of veadotube.
10
+ - A trigger for when the state changes, and live values such as `veadotube.state` and
11
+ `veadotube.talking`.
12
+
13
+ ## Setting up
14
+
15
+ 1. Turn on the websocket server in veadotube's program settings.
16
+ 2. For **Push to talk**, also turn on **use websocket** in the push-to-talk settings.
17
+
18
+ veadotube is found automatically. It writes its address into your user folder, which is why the
19
+ plugin asks for files. Without that, or for another computer, enter the address in the settings.
@@ -0,0 +1,44 @@
1
+ import { type Link } from "@sdeck/plugin";
2
+ /** Something veadotube lets others control. veadotube mini has two: its state and push-to-talk. */
3
+ export interface VeadoNode {
4
+ type: string;
5
+ id: string;
6
+ name: string;
7
+ }
8
+ export interface AvatarState {
9
+ id: string;
10
+ name: string;
11
+ /** Changes with the picture. Missing in old versions, which have no thumbnails. */
12
+ thumbHash?: string;
13
+ }
14
+ export interface NumberValue {
15
+ value: number;
16
+ min?: number;
17
+ max?: number;
18
+ }
19
+ /** What is known of the running veadotube. Replaced, never changed, so it can be compared. */
20
+ export interface Snapshot {
21
+ app: string;
22
+ nodes: readonly VeadoNode[];
23
+ /** By the node's id, for `stateEvents` nodes. */
24
+ states: Readonly<Record<string, readonly AvatarState[]>>;
25
+ current: Readonly<Record<string, string>>;
26
+ switches: Readonly<Record<string, boolean>>;
27
+ numbers: Readonly<Record<string, NumberValue>>;
28
+ /** `data:` URIs by `thumbHash`, for the states that were asked for. */
29
+ thumbs: Readonly<Record<string, string>>;
30
+ }
31
+ export interface Veado {
32
+ snapshot(): Snapshot;
33
+ /** Sends a payload to a node. */
34
+ send(type: string, id: string, payload: Record<string, unknown>): void;
35
+ /** Asks for a state's picture, once. It arrives in the snapshot. */
36
+ wantThumb(node: string, state: AvatarState): void;
37
+ }
38
+ /** The address of the veadotube that was opened first. It gets another port every time it starts. */
39
+ export declare function findAddress(dir?: string, now?: number): Promise<string>;
40
+ /** `localhost:1234`, with or without `ws://`, as the address to connect to. */
41
+ export declare function socketUrl(address: string): string;
42
+ /** Connects, and resolves once the nodes have told their values. */
43
+ export declare function connectVeado(url: string, onChange: (snapshot: Snapshot) => void, lost: (error: Error) => void, signal: AbortSignal): Promise<Link<Veado>>;
44
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAkB,MAAM,eAAe,CAAC;AAE1D,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,8FAA8F;AAC9F,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IAC5B,iD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. It is open while something needs it. */
2
+ import { type PluginContext } from "@sdeck/plugin";
3
+ import { type Snapshot, type Veado } from "./client.ts";
4
+ /** What veadotube is doing, or `undefined` while it is not connected. */
5
+ export declare const current: () => Snapshot | undefined;
6
+ export declare const withVeado: <T>(use: (veado: Veado) => T | Promise<T>) => Promise<T>;
7
+ /** Hears every change, and keeps the connection open meanwhile. */
8
+ export declare function follow(listener: () => void): () => void;
9
+ /** For components: draws again whenever something changes. */
10
+ export declare const useVeado: () => Snapshot | undefined;
11
+ /** The picture of a state, once it is there. */
12
+ export declare function useThumb(node: string | undefined, id: string): string | undefined;
13
+ export declare function start(activated: PluginContext): () => void;
14
+ /** Opens the connection again, and fails with the reason if that does not work. */
15
+ export declare function test(): Promise<void>;
16
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtF,OAAO,EAA6B,KAAK,QAAQ,EAAa,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AAY9F,yEAAyE;AACzE,eAAO,MAAM,OAAO,4BAAiB,CAAC;AA8CtC,eAAO,MAAM,SAAS,GAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,eAAyB,CAAC;AAE5F,mEAAmE;AACnE,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAOvD;AAED,8DAA8D;AAC9D,eAAO,MAAM,QAAQ,4BAAuD,CAAC;AAE7E,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CASjF;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,IAAI,CAe1D;AAED,mFAAmF;AACnF,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAG1C"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import("@sdeck/plugin").PluginDef;
2
+ export default _default;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":""}