@kuncat/avoidant 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.
Files changed (49) hide show
  1. package/README.md +43 -3
  2. package/dist/assets/favicon.svg +1 -1
  3. package/dist/assets/fonts/NOTO-SANS-SYMBOLS-LICENSE.txt +93 -0
  4. package/dist/assets/fonts/noto-sans-symbols-arrows.woff2 +0 -0
  5. package/dist/components/AvoidantGame.svelte +98 -44
  6. package/dist/components/AvoidantGame.svelte.d.ts +11 -0
  7. package/dist/components/GameHistory.svelte +1 -1
  8. package/dist/components/MapControls.svelte +27 -1
  9. package/dist/components/MapControls.svelte.d.ts +2 -0
  10. package/dist/components/MatchResults.svelte +1 -2
  11. package/dist/components/MatchResults.svelte.d.ts +0 -1
  12. package/dist/components/MultiplayerGame.svelte +73 -14
  13. package/dist/components/MultiplayerGame.svelte.d.ts +3 -1
  14. package/dist/index.d.ts +3 -0
  15. package/dist/index.js +2 -0
  16. package/dist/multiplayer/client.d.ts +5 -2
  17. package/dist/multiplayer/client.js +22 -6
  18. package/dist/multiplayer/current-match.d.ts +3 -0
  19. package/dist/multiplayer/current-match.js +37 -0
  20. package/dist/multiplayer/invitations.d.ts +2 -0
  21. package/dist/multiplayer/invitations.js +23 -0
  22. package/dist/multiplayer/types.d.ts +10 -0
  23. package/dist/paraglide/messages/_index.d.ts +8 -1
  24. package/dist/paraglide/messages/_index.js +8 -1
  25. package/dist/paraglide/messages/{field_relay_servers.d.ts → action_see_plans.d.ts} +5 -5
  26. package/dist/paraglide/messages/action_see_plans.js +29 -0
  27. package/dist/paraglide/messages/error_tv_pairing.d.ts +16 -0
  28. package/dist/paraglide/messages/error_tv_pairing.js +29 -0
  29. package/dist/paraglide/messages/field_public_game.d.ts +16 -0
  30. package/dist/paraglide/messages/field_public_game.js +29 -0
  31. package/dist/paraglide/messages/help_public_game.d.ts +16 -0
  32. package/dist/paraglide/messages/help_public_game.js +29 -0
  33. package/dist/paraglide/messages/share_watch_help.d.ts +16 -0
  34. package/dist/paraglide/messages/share_watch_help.js +29 -0
  35. package/dist/paraglide/messages/status_public_unlisted.d.ts +16 -0
  36. package/dist/paraglide/messages/status_public_unlisted.js +29 -0
  37. package/dist/paraglide/messages/status_tv_showing.d.ts +16 -0
  38. package/dist/paraglide/messages/status_tv_showing.js +29 -0
  39. package/dist/paraglide/messages/text_multiplayer_subscription.d.ts +16 -0
  40. package/dist/paraglide/messages/text_multiplayer_subscription.js +29 -0
  41. package/dist/paraglide/messages/text_waiting_lobby.d.ts +1 -1
  42. package/dist/paraglide/messages/text_waiting_lobby.js +2 -2
  43. package/dist/styles/global.css +13 -0
  44. package/dist/wasm/avoidant_wasm.d.ts +3 -208
  45. package/dist/wasm/avoidant_wasm.js +20 -1101
  46. package/dist/wasm/avoidant_wasm_bg.wasm +0 -0
  47. package/dist/wasm/avoidant_wasm_bg.wasm.d.ts +3 -65
  48. package/package.json +1 -1
  49. package/dist/paraglide/messages/field_relay_servers.js +0 -29
@@ -1,12 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * The `ReadableStreamType` enum.
5
- *
6
- * *This API requires the following crate features to be activated: `ReadableStreamType`*
7
- */
8
-
9
- export type ReadableStreamType = "bytes";
10
3
 
11
4
  import type { Readable } from "svelte/store";
12
5
 
@@ -61,10 +54,6 @@ export interface CellMetadataEntry {
61
54
  export interface GameOptions {
62
55
  numCells: number;
63
56
  rngSeed: number;
64
- /**
65
- * Iroh relay server URLs to use for peer discovery and transport.
66
- */
67
- relayUrls?: string[];
68
57
  /**
69
58
  * Map surface shape. Defaults to Icosahedron { radius: 50.0 }.
70
59
  */
@@ -115,24 +104,6 @@ export interface MapCell {
115
104
  normal: [number, number, number];
116
105
  }
117
106
 
118
- export interface NetworkPeerStatus {
119
- endpointId: string;
120
- nickname?: string;
121
- lastSeenMs?: number;
122
- isConnected: boolean;
123
- }
124
-
125
- export interface NetworkSnapshot {
126
- hasNode: boolean;
127
- listenerStarted: boolean;
128
- endpointId?: string;
129
- topicId?: string;
130
- peers: NetworkPeerStatus[];
131
- lastInboundMutationMs?: number;
132
- lastOutboundMutationMs?: number;
133
- sampledAtMs: number;
134
- }
135
-
136
107
  export interface ScoreState {
137
108
  /**
138
109
  * Risk-balanced point total. May be negative.
@@ -177,25 +148,6 @@ export interface ScoreState {
177
148
  }
178
149
 
179
150
 
180
- export class Channel {
181
- private constructor();
182
- free(): void;
183
- [Symbol.dispose](): void;
184
- id(): string;
185
- neighbors(): string[];
186
- ticket(opts: any): string;
187
- readonly receiver: ReadableStream;
188
- readonly sender: ChannelSender;
189
- }
190
-
191
- export class ChannelSender {
192
- private constructor();
193
- free(): void;
194
- [Symbol.dispose](): void;
195
- broadcast(text: string): Promise<void>;
196
- set_nickame(nickname: string): void;
197
- }
198
-
199
151
  export class GameState {
200
152
  free(): void;
201
153
  [Symbol.dispose](): void;
@@ -206,112 +158,19 @@ export class GameState {
206
158
  */
207
159
  applyMapCells(cells: MapCell[]): MapCell[];
208
160
  exploreCell(index: number, x: number, y: number, z: number): void;
209
- invite(nickname: string): Promise<string>;
210
- /**
211
- * Spawn a network node and join the gossip topic described by `ticket`.
212
- *
213
- * The caller is responsible for having populated the map cells (typically
214
- * via [`GameState::apply_map_cells`]) before invoking this; the function
215
- * waits for an authoritative snapshot before allowing gameplay.
216
- */
217
- joinAsPeer(ticket: string, nickname: string): Promise<void>;
218
161
  constructor(options: GameOptions);
219
- static optionsFromTicket(ticket: string): GameOptions;
220
162
  queueExplorePulse(index: number, x: number, y: number, z: number): void;
221
163
  readonly cellMetadata: Readable<Array<CellMetadataEntry>>;
222
164
  readonly cells: Readable<Array<MapCell>>;
223
165
  readonly elevationMax: number;
224
166
  readonly elevationMin: number;
225
- readonly endpointId: string | undefined;
226
- readonly hasNetworkNode: boolean;
227
- readonly lastInboundMutationMs: number | undefined;
228
- readonly lastOutboundMutationMs: number | undefined;
229
- readonly networkListenerStarted: boolean;
230
- readonly networkPeers: NetworkPeerStatus[];
231
- readonly networkSnapshot: Readable<NetworkSnapshot>;
232
167
  /**
233
168
  * Canonical score, synchronized from the host independently of reveal animations.
234
169
  */
235
170
  readonly score: Readable<ScoreState>;
236
- readonly topicId: string | undefined;
237
171
  readonly uiState: UiState;
238
172
  }
239
173
 
240
- export class IntoUnderlyingByteSource {
241
- private constructor();
242
- free(): void;
243
- [Symbol.dispose](): void;
244
- cancel(): void;
245
- pull(controller: ReadableByteStreamController): Promise<any>;
246
- start(controller: ReadableByteStreamController): void;
247
- readonly autoAllocateChunkSize: number;
248
- readonly type: ReadableStreamType;
249
- }
250
-
251
- declare class IntoUnderlyingByteSource2 {
252
- private constructor();
253
- free(): void;
254
- [Symbol.dispose](): void;
255
- cancel(): void;
256
- pull(controller: ReadableByteStreamController): Promise<any>;
257
- start(controller: ReadableByteStreamController): void;
258
- readonly autoAllocateChunkSize: number;
259
- readonly type: ReadableStreamType;
260
- }
261
- export type { IntoUnderlyingByteSource2 };
262
-
263
- export class IntoUnderlyingSink {
264
- private constructor();
265
- free(): void;
266
- [Symbol.dispose](): void;
267
- abort(reason: any): Promise<any>;
268
- close(): Promise<any>;
269
- write(chunk: any): Promise<any>;
270
- }
271
-
272
- declare class IntoUnderlyingSink2 {
273
- private constructor();
274
- free(): void;
275
- [Symbol.dispose](): void;
276
- abort(reason: any): Promise<any>;
277
- close(): Promise<any>;
278
- write(chunk: any): Promise<any>;
279
- }
280
- export type { IntoUnderlyingSink2 };
281
-
282
- export class IntoUnderlyingSource {
283
- private constructor();
284
- free(): void;
285
- [Symbol.dispose](): void;
286
- cancel(): void;
287
- pull(controller: ReadableStreamDefaultController): Promise<any>;
288
- }
289
-
290
- declare class IntoUnderlyingSource2 {
291
- private constructor();
292
- free(): void;
293
- [Symbol.dispose](): void;
294
- cancel(): void;
295
- pull(controller: ReadableStreamDefaultController): Promise<any>;
296
- }
297
- export type { IntoUnderlyingSource2 };
298
-
299
- export class NetworkNode {
300
- private constructor();
301
- free(): void;
302
- [Symbol.dispose](): void;
303
- create(nickname: string): Promise<Channel>;
304
- /**
305
- * Returns the endpoint id of this node.
306
- */
307
- endpointId(): string;
308
- join(ticket: string, nickname: string): Promise<Channel>;
309
- /**
310
- * Spawns a gossip node.
311
- */
312
- static spawn(): Promise<NetworkNode>;
313
- }
314
-
315
174
  export class Pulse {
316
175
  private constructor();
317
176
  free(): void;
@@ -338,77 +197,24 @@ export class UiState {
338
197
  */
339
198
  export function generateMapData(options: GameOptions): MapData;
340
199
 
341
- export function start(): void;
342
-
343
200
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
344
201
 
345
202
  export interface InitOutput {
346
203
  readonly memory: WebAssembly.Memory;
347
- readonly __wbg_channel_free: (a: number, b: number) => void;
348
- readonly __wbg_channelsender_free: (a: number, b: number) => void;
349
204
  readonly __wbg_gamestate_free: (a: number, b: number) => void;
350
- readonly __wbg_intounderlyingbytesource2_free: (a: number, b: number) => void;
351
- readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
352
- readonly __wbg_intounderlyingsink2_free: (a: number, b: number) => void;
353
- readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
354
- readonly __wbg_intounderlyingsource2_free: (a: number, b: number) => void;
355
- readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
356
- readonly __wbg_networknode_free: (a: number, b: number) => void;
357
205
  readonly __wbg_pulse_free: (a: number, b: number) => void;
358
206
  readonly __wbg_uistate_free: (a: number, b: number) => void;
359
- readonly channel_id: (a: number) => [number, number];
360
- readonly channel_neighbors: (a: number) => [number, number];
361
- readonly channel_receiver: (a: number) => any;
362
- readonly channel_sender: (a: number) => number;
363
- readonly channel_ticket: (a: number, b: any) => [number, number, number, number];
364
- readonly channelsender_broadcast: (a: number, b: number, c: number) => any;
365
- readonly channelsender_set_nickame: (a: number, b: number, c: number) => void;
366
207
  readonly gamestate_applyMapCells: (a: number, b: any) => [number, number, number];
367
208
  readonly gamestate_cellMetadata: (a: number) => any;
368
209
  readonly gamestate_cells: (a: number) => any;
369
210
  readonly gamestate_elevationMax: (a: number) => number;
370
211
  readonly gamestate_elevationMin: (a: number) => number;
371
- readonly gamestate_endpointId: (a: number) => [number, number];
372
212
  readonly gamestate_exploreCell: (a: number, b: number, c: number, d: number, e: number) => [number, number];
373
- readonly gamestate_hasNetworkNode: (a: number) => number;
374
- readonly gamestate_invite: (a: number, b: number, c: number) => any;
375
- readonly gamestate_joinAsPeer: (a: number, b: number, c: number, d: number, e: number) => any;
376
- readonly gamestate_lastInboundMutationMs: (a: number) => [number, number];
377
- readonly gamestate_lastOutboundMutationMs: (a: number) => [number, number];
378
- readonly gamestate_networkListenerStarted: (a: number) => number;
379
- readonly gamestate_networkPeers: (a: number) => [number, number, number, number];
380
- readonly gamestate_networkSnapshot: (a: number) => any;
381
213
  readonly gamestate_new: (a: any) => [number, number, number];
382
- readonly gamestate_optionsFromTicket: (a: number, b: number) => [number, number, number];
383
214
  readonly gamestate_queueExplorePulse: (a: number, b: number, c: number, d: number, e: number) => [number, number];
384
215
  readonly gamestate_score: (a: number) => any;
385
- readonly gamestate_topicId: (a: number) => [number, number];
386
216
  readonly gamestate_uiState: (a: number) => number;
387
217
  readonly generateMapData: (a: any) => [number, number, number];
388
- readonly intounderlyingbytesource2_autoAllocateChunkSize: (a: number) => number;
389
- readonly intounderlyingbytesource2_cancel: (a: number) => void;
390
- readonly intounderlyingbytesource2_pull: (a: number, b: any) => any;
391
- readonly intounderlyingbytesource2_start: (a: number, b: any) => void;
392
- readonly intounderlyingbytesource2_type: (a: number) => number;
393
- readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
394
- readonly intounderlyingbytesource_cancel: (a: number) => void;
395
- readonly intounderlyingbytesource_pull: (a: number, b: any) => any;
396
- readonly intounderlyingbytesource_start: (a: number, b: any) => void;
397
- readonly intounderlyingbytesource_type: (a: number) => number;
398
- readonly intounderlyingsink2_abort: (a: number, b: any) => any;
399
- readonly intounderlyingsink2_close: (a: number) => any;
400
- readonly intounderlyingsink2_write: (a: number, b: any) => any;
401
- readonly intounderlyingsink_abort: (a: number, b: any) => any;
402
- readonly intounderlyingsink_close: (a: number) => any;
403
- readonly intounderlyingsink_write: (a: number, b: any) => any;
404
- readonly intounderlyingsource2_cancel: (a: number) => void;
405
- readonly intounderlyingsource2_pull: (a: number, b: any) => any;
406
- readonly intounderlyingsource_cancel: (a: number) => void;
407
- readonly intounderlyingsource_pull: (a: number, b: any) => any;
408
- readonly networknode_create: (a: number, b: number, c: number) => any;
409
- readonly networknode_endpointId: (a: number) => [number, number];
410
- readonly networknode_join: (a: number, b: number, c: number, d: number, e: number) => any;
411
- readonly networknode_spawn: () => any;
412
218
  readonly pulse_createdAtMs: (a: number) => number;
413
219
  readonly pulse_durationMs: (a: number) => number;
414
220
  readonly pulse_id: (a: number) => number;
@@ -417,26 +223,15 @@ export interface InitOutput {
417
223
  readonly pulse_nullPulse: () => number;
418
224
  readonly pulse_originCell: (a: number) => number;
419
225
  readonly pulse_position: (a: number) => [number, number];
420
- readonly start: () => void;
421
226
  readonly uistate_pulses: (a: number) => any;
422
- readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
423
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___js_sys_6ba22b8ede95807b___Function_fn_wasm_bindgen_9272b6ef9ea7104a___JsValue_____wasm_bindgen_9272b6ef9ea7104a___sys__Undefined___js_sys_6ba22b8ede95807b___Function_fn_wasm_bindgen_9272b6ef9ea7104a___JsValue_____wasm_bindgen_9272b6ef9ea7104a___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
424
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___wasm_bindgen_9272b6ef9ea7104a___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_9272b6ef9ea7104a___JsError___true_: (a: number, b: number, c: any) => [number, number];
425
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___wasm_bindgen_9272b6ef9ea7104a___JsValue__wasm_bindgen_9272b6ef9ea7104a___JsValue__true_: (a: number, b: number, c: any) => any;
426
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___wasm_bindgen_9272b6ef9ea7104a___JsValue______true_: (a: number, b: number, c: any) => void;
427
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___wasm_bindgen_9272b6ef9ea7104a___JsValue______true__1_: (a: number, b: number, c: any) => void;
428
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___web_sys_31ae0d517edde2d8___features__gen_CloseEvent__CloseEvent______true_: (a: number, b: number, c: any) => void;
429
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke___web_sys_31ae0d517edde2d8___features__gen_MessageEvent__MessageEvent______true_: (a: number, b: number, c: any) => void;
430
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke_______true_: (a: number, b: number) => void;
431
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke_______true__1_: (a: number, b: number) => void;
432
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke_______true__2_: (a: number, b: number) => void;
433
- readonly wasm_bindgen_9272b6ef9ea7104a___convert__closures_____invoke_______true__3_: (a: number, b: number) => void;
227
+ readonly wasm_bindgen_3d4e917297a2f4dc___convert__closures_____invoke___wasm_bindgen_3d4e917297a2f4dc___JsValue__core_d941ad8722425d2e___result__Result_____wasm_bindgen_3d4e917297a2f4dc___JsError___true_: (a: number, b: number, c: any) => [number, number];
228
+ readonly wasm_bindgen_3d4e917297a2f4dc___convert__closures_____invoke___wasm_bindgen_3d4e917297a2f4dc___JsValue__wasm_bindgen_3d4e917297a2f4dc___JsValue__true_: (a: number, b: number, c: any) => any;
229
+ readonly wasm_bindgen_3d4e917297a2f4dc___convert__closures_____invoke_______true_: (a: number, b: number) => void;
434
230
  readonly __wbindgen_malloc: (a: number, b: number) => number;
435
231
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
436
232
  readonly __wbindgen_exn_store: (a: number) => void;
437
233
  readonly __externref_table_alloc: () => number;
438
234
  readonly __wbindgen_externrefs: WebAssembly.Table;
439
- readonly __externref_drop_slice: (a: number, b: number) => void;
440
235
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
441
236
  readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
442
237
  readonly __externref_table_dealloc: (a: number) => void;