@pluv/react 3.0.0 → 3.1.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.
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +17 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/package.json +6 -6
- package/src/createBundle.tsx +6 -12
- package/src/types.ts +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/react@3.
|
|
2
|
+
> @pluv/react@3.1.1 build /home/runner/work/pluv/pluv/packages/react
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts --external react
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m17.26 KB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in 121ms
|
|
13
11
|
[32mCJS[39m [1mdist/index.js [22m[32m19.65 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 95ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m17.26 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 99ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 5706ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m6.00 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m6.00 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @pluv/react
|
|
2
2
|
|
|
3
|
+
## 3.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/client@3.1.1
|
|
8
|
+
- @pluv/crdt@3.1.1
|
|
9
|
+
- @pluv/types@3.1.1
|
|
10
|
+
|
|
11
|
+
## 3.1.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [022857d]
|
|
16
|
+
- @pluv/client@3.1.0
|
|
17
|
+
- @pluv/crdt@3.1.0
|
|
18
|
+
- @pluv/types@3.1.0
|
|
19
|
+
|
|
3
20
|
## 3.0.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluvRouterEventConfig, MockedRoomEvents, MergeEvents, PluvRoomDebug, PluvClient, WebSocketConnection, UserInfo, PluvRoomAddon, PluvRouter } from '@pluv/client';
|
|
2
|
-
import {
|
|
3
|
-
import { IOLike, JsonObject, MaybePromise, InferIOOutput, Id, IOEventMessage, InferIOInput, CrdtDocLike, UpdateMyPresenceAction, RoomLike } from '@pluv/types';
|
|
2
|
+
import { InferStorage, AbstractCrdtDocFactory, InferInitialStorageFn, InferDoc, InferCrdtJson } from '@pluv/crdt';
|
|
3
|
+
import { IOLike, JsonObject, InferIOCrdtKind, MaybePromise, InferIOOutput, Id, IOEventMessage, InferIOInput, CrdtDocLike, UpdateMyPresenceAction, RoomLike } from '@pluv/types';
|
|
4
4
|
import { FC, ReactNode, Dispatch } from 'react';
|
|
5
5
|
|
|
6
6
|
interface PluvProviderProps {
|
|
@@ -27,7 +27,7 @@ type EventProxy<TIO extends IOLike> = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
type MetadataGetter<TMetadata extends JsonObject> = TMetadata | (() => MaybePromise<TMetadata>);
|
|
30
|
-
type PluvRoomProviderProps<TIO extends IOLike<any, any>, TMetadata extends JsonObject, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>> = BaseRoomProviderProps<TPresence, TCrdt> & {
|
|
30
|
+
type PluvRoomProviderProps<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>> = BaseRoomProviderProps<TPresence, TCrdt> & {
|
|
31
31
|
connect?: boolean;
|
|
32
32
|
debug?: boolean | PluvRoomDebug<TIO>;
|
|
33
33
|
onAuthorizationFail?: (error: Error) => void;
|
|
@@ -39,7 +39,7 @@ type PluvRoomProviderProps<TIO extends IOLike<any, any>, TMetadata extends JsonO
|
|
|
39
39
|
interface SubscriptionHookOptions<T extends unknown> {
|
|
40
40
|
isEqual?: (a: T, b: T) => boolean;
|
|
41
41
|
}
|
|
42
|
-
interface CreateBundle<TIO extends IOLike<any>, TMetadata extends JsonObject, TPresence extends Record<string, any> = {}, TCrdt extends
|
|
42
|
+
interface CreateBundle<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject, TPresence extends Record<string, any> = {}, TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> {
|
|
43
43
|
MockedRoomProvider: FC<MockedRoomProviderProps<TIO, TPresence, TCrdt>>;
|
|
44
44
|
PluvProvider: FC<PluvProviderProps>;
|
|
45
45
|
PluvRoomProvider: FC<PluvRoomProviderProps<TIO, TMetadata, TPresence, TCrdt>>;
|
|
@@ -63,10 +63,10 @@ interface CreateBundle<TIO extends IOLike<any>, TMetadata extends JsonObject, TP
|
|
|
63
63
|
}
|
|
64
64
|
type InferBundleRoom<TBundle extends CreateBundle<any, any, any, any, any>> = TBundle extends CreateBundle<infer IIO, any, infer IPresence, infer ICrdt, infer IEvents> ? RoomLike<IIO, InferDoc<ICrdt>, IPresence, InferStorage<ICrdt>, IEvents> : never;
|
|
65
65
|
|
|
66
|
-
type CreateBundleOptions<TIO extends IOLike<any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends
|
|
66
|
+
type CreateBundleOptions<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> = {
|
|
67
67
|
addons?: readonly PluvRoomAddon<TIO, TMetadata, TPresence, TCrdt>[];
|
|
68
68
|
router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
69
69
|
};
|
|
70
|
-
declare const createBundle: <TIO extends IOLike<any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends
|
|
70
|
+
declare const createBundle: <TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}>(client: PluvClient<TIO, TPresence, TCrdt, TMetadata>, options?: CreateBundleOptions<TIO, TMetadata, TPresence, TCrdt, TEvents>) => CreateBundle<TIO, TMetadata, TPresence, TCrdt, TEvents>;
|
|
71
71
|
|
|
72
72
|
export { type CreateBundle, type EventProxy, type InferBundleRoom, type PluvProviderProps, type PluvRoomProviderProps, type SubscriptionHookOptions, createBundle };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PluvRouterEventConfig, MockedRoomEvents, MergeEvents, PluvRoomDebug, PluvClient, WebSocketConnection, UserInfo, PluvRoomAddon, PluvRouter } from '@pluv/client';
|
|
2
|
-
import {
|
|
3
|
-
import { IOLike, JsonObject, MaybePromise, InferIOOutput, Id, IOEventMessage, InferIOInput, CrdtDocLike, UpdateMyPresenceAction, RoomLike } from '@pluv/types';
|
|
2
|
+
import { InferStorage, AbstractCrdtDocFactory, InferInitialStorageFn, InferDoc, InferCrdtJson } from '@pluv/crdt';
|
|
3
|
+
import { IOLike, JsonObject, InferIOCrdtKind, MaybePromise, InferIOOutput, Id, IOEventMessage, InferIOInput, CrdtDocLike, UpdateMyPresenceAction, RoomLike } from '@pluv/types';
|
|
4
4
|
import { FC, ReactNode, Dispatch } from 'react';
|
|
5
5
|
|
|
6
6
|
interface PluvProviderProps {
|
|
@@ -27,7 +27,7 @@ type EventProxy<TIO extends IOLike> = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
type MetadataGetter<TMetadata extends JsonObject> = TMetadata | (() => MaybePromise<TMetadata>);
|
|
30
|
-
type PluvRoomProviderProps<TIO extends IOLike<any, any>, TMetadata extends JsonObject, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>> = BaseRoomProviderProps<TPresence, TCrdt> & {
|
|
30
|
+
type PluvRoomProviderProps<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>> = BaseRoomProviderProps<TPresence, TCrdt> & {
|
|
31
31
|
connect?: boolean;
|
|
32
32
|
debug?: boolean | PluvRoomDebug<TIO>;
|
|
33
33
|
onAuthorizationFail?: (error: Error) => void;
|
|
@@ -39,7 +39,7 @@ type PluvRoomProviderProps<TIO extends IOLike<any, any>, TMetadata extends JsonO
|
|
|
39
39
|
interface SubscriptionHookOptions<T extends unknown> {
|
|
40
40
|
isEqual?: (a: T, b: T) => boolean;
|
|
41
41
|
}
|
|
42
|
-
interface CreateBundle<TIO extends IOLike<any>, TMetadata extends JsonObject, TPresence extends Record<string, any> = {}, TCrdt extends
|
|
42
|
+
interface CreateBundle<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject, TPresence extends Record<string, any> = {}, TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> {
|
|
43
43
|
MockedRoomProvider: FC<MockedRoomProviderProps<TIO, TPresence, TCrdt>>;
|
|
44
44
|
PluvProvider: FC<PluvProviderProps>;
|
|
45
45
|
PluvRoomProvider: FC<PluvRoomProviderProps<TIO, TMetadata, TPresence, TCrdt>>;
|
|
@@ -63,10 +63,10 @@ interface CreateBundle<TIO extends IOLike<any>, TMetadata extends JsonObject, TP
|
|
|
63
63
|
}
|
|
64
64
|
type InferBundleRoom<TBundle extends CreateBundle<any, any, any, any, any>> = TBundle extends CreateBundle<infer IIO, any, infer IPresence, infer ICrdt, infer IEvents> ? RoomLike<IIO, InferDoc<ICrdt>, IPresence, InferStorage<ICrdt>, IEvents> : never;
|
|
65
65
|
|
|
66
|
-
type CreateBundleOptions<TIO extends IOLike<any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends
|
|
66
|
+
type CreateBundleOptions<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> = {
|
|
67
67
|
addons?: readonly PluvRoomAddon<TIO, TMetadata, TPresence, TCrdt>[];
|
|
68
68
|
router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
69
69
|
};
|
|
70
|
-
declare const createBundle: <TIO extends IOLike<any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends
|
|
70
|
+
declare const createBundle: <TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}>(client: PluvClient<TIO, TPresence, TCrdt, TMetadata>, options?: CreateBundleOptions<TIO, TMetadata, TPresence, TCrdt, TEvents>) => CreateBundle<TIO, TMetadata, TPresence, TCrdt, TEvents>;
|
|
71
71
|
|
|
72
72
|
export { type CreateBundle, type EventProxy, type InferBundleRoom, type PluvProviderProps, type PluvRoomProviderProps, type SubscriptionHookOptions, createBundle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "@pluv/client React.js bindings",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"fast-deep-equal": "^3.1.3",
|
|
21
|
-
"@pluv/client": "^3.
|
|
22
|
-
"@pluv/crdt": "^3.
|
|
23
|
-
"@pluv/types": "^3.
|
|
21
|
+
"@pluv/client": "^3.1.1",
|
|
22
|
+
"@pluv/crdt": "^3.1.1",
|
|
23
|
+
"@pluv/types": "^3.1.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"react": "^19.1.0",
|
|
33
33
|
"tsup": "^8.5.0",
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
|
-
"@pluv/tsconfig": "^3.
|
|
36
|
-
"eslint-config-pluv": "^3.
|
|
35
|
+
"@pluv/tsconfig": "^3.1.1",
|
|
36
|
+
"eslint-config-pluv": "^3.1.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|
package/src/createBundle.tsx
CHANGED
|
@@ -11,15 +11,10 @@ import type {
|
|
|
11
11
|
WebSocketConnection,
|
|
12
12
|
} from "@pluv/client";
|
|
13
13
|
import { MockedRoom } from "@pluv/client";
|
|
14
|
-
import type {
|
|
15
|
-
AbstractCrdtDocFactory,
|
|
16
|
-
InferCrdtJson,
|
|
17
|
-
InferDoc,
|
|
18
|
-
InferStorage,
|
|
19
|
-
NoopCrdtDocFactory,
|
|
20
|
-
} from "@pluv/crdt";
|
|
14
|
+
import type { InferCrdtJson, InferDoc, InferStorage } from "@pluv/crdt";
|
|
21
15
|
import type {
|
|
22
16
|
Id,
|
|
17
|
+
InferIOCrdtKind,
|
|
23
18
|
InferIOInput,
|
|
24
19
|
InferIOOutput,
|
|
25
20
|
IOEventMessage,
|
|
@@ -59,10 +54,10 @@ import type {
|
|
|
59
54
|
} from "./types";
|
|
60
55
|
|
|
61
56
|
export type CreateBundleOptions<
|
|
62
|
-
TIO extends IOLike<any>,
|
|
57
|
+
TIO extends IOLike<any, any, any>,
|
|
63
58
|
TMetadata extends JsonObject = {},
|
|
64
59
|
TPresence extends Record<string, any> = {},
|
|
65
|
-
TCrdt extends
|
|
60
|
+
TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>,
|
|
66
61
|
TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {},
|
|
67
62
|
> = {
|
|
68
63
|
addons?: readonly PluvRoomAddon<TIO, TMetadata, TPresence, TCrdt>[];
|
|
@@ -70,10 +65,10 @@ export type CreateBundleOptions<
|
|
|
70
65
|
};
|
|
71
66
|
|
|
72
67
|
export const createBundle = <
|
|
73
|
-
TIO extends IOLike<any, any>,
|
|
68
|
+
TIO extends IOLike<any, any, any>,
|
|
74
69
|
TMetadata extends JsonObject = {},
|
|
75
70
|
TPresence extends Record<string, any> = {},
|
|
76
|
-
TCrdt extends
|
|
71
|
+
TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>,
|
|
77
72
|
TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {},
|
|
78
73
|
>(
|
|
79
74
|
client: PluvClient<TIO, TPresence, TCrdt, TMetadata>,
|
|
@@ -178,7 +173,6 @@ export const createBundle = <
|
|
|
178
173
|
|
|
179
174
|
useEffect(() => {
|
|
180
175
|
if (room.id === _room) return;
|
|
181
|
-
|
|
182
176
|
setRoom(createRoom());
|
|
183
177
|
}, [_room, createRoom, room]);
|
|
184
178
|
|
package/src/types.ts
CHANGED
|
@@ -13,11 +13,11 @@ import type {
|
|
|
13
13
|
InferDoc,
|
|
14
14
|
InferInitialStorageFn,
|
|
15
15
|
InferStorage,
|
|
16
|
-
NoopCrdtDocFactory,
|
|
17
16
|
} from "@pluv/crdt";
|
|
18
17
|
import type {
|
|
19
18
|
CrdtDocLike,
|
|
20
19
|
Id,
|
|
20
|
+
InferIOCrdtKind,
|
|
21
21
|
InferIOInput,
|
|
22
22
|
InferIOOutput,
|
|
23
23
|
IOEventMessage,
|
|
@@ -69,7 +69,7 @@ export type MetadataGetter<TMetadata extends JsonObject> =
|
|
|
69
69
|
| (() => MaybePromise<TMetadata>);
|
|
70
70
|
|
|
71
71
|
export type PluvRoomProviderProps<
|
|
72
|
-
TIO extends IOLike<any, any>,
|
|
72
|
+
TIO extends IOLike<any, any, any>,
|
|
73
73
|
TMetadata extends JsonObject,
|
|
74
74
|
TPresence extends Record<string, any>,
|
|
75
75
|
TCrdt extends AbstractCrdtDocFactory<any, any>,
|
|
@@ -86,10 +86,10 @@ export interface SubscriptionHookOptions<T extends unknown> {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export interface CreateBundle<
|
|
89
|
-
TIO extends IOLike<any>,
|
|
89
|
+
TIO extends IOLike<any, any, any>,
|
|
90
90
|
TMetadata extends JsonObject,
|
|
91
91
|
TPresence extends Record<string, any> = {},
|
|
92
|
-
TCrdt extends
|
|
92
|
+
TCrdt extends InferIOCrdtKind<TIO> = InferIOCrdtKind<TIO>,
|
|
93
93
|
TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {},
|
|
94
94
|
> {
|
|
95
95
|
// components
|