@liveblocks/zustand 0.17.0-test1 → 0.17.1

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 (2) hide show
  1. package/index.d.ts +22 -10
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,11 +1,21 @@
1
- import { JsonObject, LsonObject, Room, User, Client } from "@liveblocks/client";
1
+ import {
2
+ JsonObject,
3
+ LsonObject,
4
+ BaseUserMeta,
5
+ Json,
6
+ Room,
7
+ User,
8
+ Client,
9
+ } from "@liveblocks/client";
2
10
  import { StateCreator, SetState, GetState, StoreApi } from "zustand";
3
11
 
4
12
  declare type ZustandState = Record<string, unknown>;
5
13
  declare type LiveblocksState<
6
14
  TState extends ZustandState,
7
15
  TPresence extends JsonObject,
8
- TStorage extends LsonObject
16
+ TStorage extends LsonObject,
17
+ TUserMeta extends BaseUserMeta,
18
+ TRoomEvent extends Json
9
19
  > = TState & {
10
20
  /**
11
21
  * Liveblocks extra state attached by the middleware
@@ -25,11 +35,11 @@ declare type LiveblocksState<
25
35
  /**
26
36
  * The room currently synced to your zustand state.
27
37
  */
28
- readonly room: Room<TPresence, TStorage> | null;
38
+ readonly room: Room<TPresence, TStorage, TUserMeta, TRoomEvent> | null;
29
39
  /**
30
40
  * Other users in the room. Empty no room is currently synced
31
41
  */
32
- readonly others: Array<User<TPresence>>;
42
+ readonly others: Array<User<TPresence, TStorage>>;
33
43
  /**
34
44
  * Whether or not the room storage is currently loading
35
45
  */
@@ -66,20 +76,22 @@ declare type Options<T> = {
66
76
  declare function middleware<
67
77
  T extends ZustandState,
68
78
  TPresence extends JsonObject,
69
- TStorage extends LsonObject
79
+ TStorage extends LsonObject,
80
+ TUserMeta extends BaseUserMeta,
81
+ TRoomEvent extends Json
70
82
  >(
71
83
  config: StateCreator<
72
84
  T,
73
85
  SetState<T>,
74
- GetState<LiveblocksState<T, TPresence, TStorage>>,
86
+ GetState<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>,
75
87
  StoreApi<T>
76
88
  >,
77
89
  options: Options<T>
78
90
  ): StateCreator<
79
- LiveblocksState<T, TPresence, TStorage>,
80
- SetState<LiveblocksState<T, TPresence, TStorage>>,
81
- GetState<LiveblocksState<T, TPresence, TStorage>>,
82
- StoreApi<LiveblocksState<T, TPresence, TStorage>>
91
+ LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>,
92
+ SetState<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>,
93
+ GetState<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>,
94
+ StoreApi<LiveblocksState<T, TPresence, TStorage, TUserMeta, TRoomEvent>>
83
95
  >;
84
96
 
85
97
  export { LiveblocksState, Mapping, ZustandState, middleware };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/zustand",
3
- "version": "0.17.0-test1",
3
+ "version": "0.17.1",
4
4
  "description": "A middleware to integrate Liveblocks into Zustand stores.",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -31,7 +31,7 @@
31
31
  "directory": "packages/liveblocks-zustand"
32
32
  },
33
33
  "peerDependencies": {
34
- "@liveblocks/client": "0.17.0-test1",
34
+ "@liveblocks/client": "0.17.1",
35
35
  "zustand": "^3"
36
36
  },
37
37
  "devDependencies": {