@caisual/kit 0.3.0 → 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/dist/kit.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { DeviceReport } from '@caisual/contracts';
2
+ export type { DeviceReport } from '@caisual/contracts';
1
3
  export type JsonValue = null | boolean | number | string | JsonValue[] | {
2
4
  [key: string]: JsonValue;
3
5
  };
@@ -50,6 +52,7 @@ export type VoiceMode = 'none' | 'room' | 'team' | 'proximity';
50
52
  export type VoiceState = 'off' | 'joining' | 'on' | 'reconnecting';
51
53
  export interface VoicePeer {
52
54
  id: string;
55
+ mic: boolean;
53
56
  muted: boolean;
54
57
  speaking: boolean;
55
58
  volume: number;
@@ -58,10 +61,13 @@ export interface VoicePeer {
58
61
  export interface Voice {
59
62
  readonly mode: VoiceMode;
60
63
  readonly state: VoiceState;
64
+ readonly mic: boolean;
61
65
  readonly muted: boolean;
62
66
  readonly speaking: boolean;
63
67
  readonly peers: readonly VoicePeer[];
64
- join(): Promise<void>;
68
+ join(options?: {
69
+ mic?: boolean;
70
+ }): Promise<void>;
65
71
  leave(): void;
66
72
  mute(muted?: boolean): void;
67
73
  setVolume(playerId: string, volume: number): void;
@@ -75,6 +81,7 @@ export interface RoomInvite {
75
81
  export interface Room {
76
82
  readonly state: JsonValue;
77
83
  readonly tick: number;
84
+ readonly seed: number;
78
85
  readonly status: RoomStatus;
79
86
  readonly players: readonly RoomPlayer[];
80
87
  readonly you: string;
@@ -95,15 +102,27 @@ export interface Room {
95
102
  leave(): void;
96
103
  serverTime(): number;
97
104
  }
105
+ export interface MatchOptions {
106
+ mode: string;
107
+ key: Record<string, string | number>;
108
+ signal?: AbortSignal;
109
+ onWaiting?(waiting: {
110
+ players: number;
111
+ min: number;
112
+ max: number;
113
+ }): void;
114
+ }
98
115
  export interface Rooms {
99
116
  readonly invited: string | null;
100
117
  create(options: {
101
118
  mode: string | null;
102
119
  }): Promise<Room>;
103
120
  join(code?: string): Promise<Room>;
121
+ match(options: MatchOptions): Promise<Room>;
104
122
  }
105
123
  export interface CaisualConnection {
106
124
  connected: boolean;
125
+ device: DeviceReport;
107
126
  player: Player;
108
127
  daily: {
109
128
  day: string;