@treyorr/voca-svelte 0.2.1 → 0.4.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 +7 -1
- package/dist/index.svelte.d.ts +3 -2
- package/dist/index.svelte.js +12 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,11 +43,16 @@ This package provides **reactive Svelte 5 state** around the core `@treyorr/voca
|
|
|
43
43
|
const client = await VocaClient.createRoom({
|
|
44
44
|
serverUrl: SERVER_URL,
|
|
45
45
|
apiKey: API_KEY,
|
|
46
|
+
password: 'secret123', // Optional: protect room with password
|
|
46
47
|
});
|
|
47
48
|
roomId = client.roomId;
|
|
48
49
|
|
|
49
50
|
// Step 2: Create reactive VocaRoom and connect
|
|
50
|
-
room = new VocaRoom(roomId, {
|
|
51
|
+
room = new VocaRoom(roomId, {
|
|
52
|
+
serverUrl: SERVER_URL,
|
|
53
|
+
apiKey: API_KEY,
|
|
54
|
+
password: 'secret123', // Must match the password used to create room
|
|
55
|
+
});
|
|
51
56
|
await room.connect();
|
|
52
57
|
}
|
|
53
58
|
|
|
@@ -78,6 +83,7 @@ This package provides **reactive Svelte 5 state** around the core `@treyorr/voca
|
|
|
78
83
|
const room = new VocaRoom(roomId, {
|
|
79
84
|
serverUrl: 'https://voca.vc',
|
|
80
85
|
apiKey: 'T8izjz8JpcWa3mtuhOFwprVk77uZKIzn',
|
|
86
|
+
password: 'secret123', // Required if room is password-protected
|
|
81
87
|
});
|
|
82
88
|
|
|
83
89
|
onMount(() => room.connect());
|
package/dist/index.svelte.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Svelte 5 runes-based wrapper around @treyorr/voca-client SDK.
|
|
5
5
|
*/
|
|
6
|
-
import { VocaClient, type ConnectionStatus, type Peer, type VocaConfig } from '@treyorr/voca-client';
|
|
7
|
-
export { VocaClient };
|
|
6
|
+
import { VocaClient, validatePassword, type ConnectionStatus, type Peer, type VocaConfig } from '@treyorr/voca-client';
|
|
7
|
+
export { VocaClient, validatePassword };
|
|
8
8
|
export type { ConnectionStatus, Peer, VocaConfig };
|
|
9
9
|
export declare class VocaRoom {
|
|
10
10
|
peers: Map<string, Peer>;
|
|
@@ -24,6 +24,7 @@ export declare class VocaRoom {
|
|
|
24
24
|
connect(): Promise<void>;
|
|
25
25
|
disconnect(): void;
|
|
26
26
|
toggleMute(): void;
|
|
27
|
+
togglePeerMute(peerId: string): void;
|
|
27
28
|
getPulseStyle(level: number): string;
|
|
28
29
|
getStatusLabel(): string;
|
|
29
30
|
}
|
package/dist/index.svelte.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Svelte 5 runes-based wrapper around @treyorr/voca-client SDK.
|
|
5
5
|
*/
|
|
6
|
-
import { VocaClient } from '@treyorr/voca-client';
|
|
7
|
-
export { VocaClient };
|
|
6
|
+
import { VocaClient, validatePassword } from '@treyorr/voca-client';
|
|
7
|
+
export { VocaClient, validatePassword };
|
|
8
8
|
export class VocaRoom {
|
|
9
9
|
constructor(roomId, config = {}) {
|
|
10
10
|
// Reactive state
|
|
@@ -42,6 +42,12 @@ export class VocaRoom {
|
|
|
42
42
|
this.client.on('local-audio-level', (level) => {
|
|
43
43
|
this.localAudioLevel = level;
|
|
44
44
|
});
|
|
45
|
+
this.client.on('peer-mute', () => {
|
|
46
|
+
this.peers = new Map(this.client.peers);
|
|
47
|
+
});
|
|
48
|
+
this.client.on('peer-local-mute', () => {
|
|
49
|
+
this.peers = new Map(this.client.peers);
|
|
50
|
+
});
|
|
45
51
|
}
|
|
46
52
|
updatePeers() {
|
|
47
53
|
this.peers = new Map(this.client.peers);
|
|
@@ -66,6 +72,10 @@ export class VocaRoom {
|
|
|
66
72
|
toggleMute() {
|
|
67
73
|
this.isMuted = this.client.toggleMute();
|
|
68
74
|
}
|
|
75
|
+
togglePeerMute(peerId) {
|
|
76
|
+
this.client.togglePeerMute(peerId);
|
|
77
|
+
// Reactivity is handled by the 'peer-local-mute' listener
|
|
78
|
+
}
|
|
69
79
|
getPulseStyle(level) {
|
|
70
80
|
return `--pulse: ${1 + Math.round(level * 7)}px`;
|
|
71
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treyorr/voca-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Svelte 5 Runes wrapper for Voca Client SDK",
|
|
5
5
|
"svelte": "./dist/index.svelte.js",
|
|
6
6
|
"types": "./dist/index.svelte.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@treyorr/voca-client": "^0.
|
|
40
|
+
"@treyorr/voca-client": "^0.4.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@sveltejs/package": "^2.3.7",
|