@pluv/react 0.6.0 → 0.6.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 +7 -6
- package/CHANGELOG.md +11 -0
- package/dist/index.d.mts +61 -0
- package/package.json +9 -10
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/react@0.6.
|
|
2
|
+
> @pluv/react@0.6.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
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v7.
|
|
7
|
+
[34mCLI[39m tsup v7.1.0
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[32mESM[39m [1mdist/index.mjs [22m[32m8.63 KB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 136ms
|
|
13
13
|
[32mCJS[39m [1mdist/index.js [22m[32m11.10 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 136ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 8645ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.47 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.47 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @pluv/react
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8fba48b: fix including incorrect dependency
|
|
8
|
+
- 8997c65: bumped dependencies
|
|
9
|
+
- Updated dependencies [8fba48b]
|
|
10
|
+
- Updated dependencies [8997c65]
|
|
11
|
+
- @pluv/client@0.9.1
|
|
12
|
+
- @pluv/types@0.2.2
|
|
13
|
+
|
|
3
14
|
## 0.6.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PluvRoomAddon, PluvRoomDebug, WebSocketConnection, UserInfo, AbstractRoom, InferYjsSharedTypeJson, MockedRoomEvents, PluvClient } from '@pluv/client';
|
|
2
|
+
export { AbstractType, ConnectionState, createClient, y } from '@pluv/client';
|
|
3
|
+
import * as _pluv_types from '@pluv/types';
|
|
4
|
+
import { IOLike, JsonObject, InputZodLike, InferIOInput, Id, InferIOOutput, IOEventMessage } from '@pluv/types';
|
|
5
|
+
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
6
|
+
import { FC, Dispatch, ReactNode } from 'react';
|
|
7
|
+
import { AbstractType } from 'yjs';
|
|
8
|
+
|
|
9
|
+
interface CreateRoomBundleOptions<TIO extends IOLike, TPresence extends JsonObject = {}, TStorage extends Record<string, AbstractType<any>> = {}> {
|
|
10
|
+
addons?: readonly PluvRoomAddon<TIO, TPresence, TStorage>[];
|
|
11
|
+
initialStorage?: () => TStorage;
|
|
12
|
+
presence?: InputZodLike<TPresence>;
|
|
13
|
+
}
|
|
14
|
+
type BaseRoomProviderProps<TPresence extends JsonObject, TStorage extends Record<string, AbstractType<any>>> = {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
initialStorage?: keyof TStorage extends never ? never : () => TStorage;
|
|
17
|
+
room: string;
|
|
18
|
+
} & (keyof TPresence extends never ? {
|
|
19
|
+
initialPresence?: never;
|
|
20
|
+
} : {
|
|
21
|
+
initialPresence: TPresence;
|
|
22
|
+
});
|
|
23
|
+
type MockedRoomProviderProps<TIO extends IOLike, TPresence extends JsonObject, TStorage extends Record<string, AbstractType<any>>> = BaseRoomProviderProps<TPresence, TStorage> & {
|
|
24
|
+
events?: MockedRoomEvents<TIO>;
|
|
25
|
+
};
|
|
26
|
+
type PluvRoomProviderProps<TIO extends IOLike, TPresence extends JsonObject, TStorage extends Record<string, AbstractType<any>>> = BaseRoomProviderProps<TPresence, TStorage> & {
|
|
27
|
+
debug?: boolean | PluvRoomDebug<TIO>;
|
|
28
|
+
onAuthorizationFail?: (error: Error) => void;
|
|
29
|
+
};
|
|
30
|
+
interface SubscriptionHookOptions<T extends unknown> {
|
|
31
|
+
isEqual?: (a: T, b: T) => boolean;
|
|
32
|
+
}
|
|
33
|
+
type UpdateMyPresenceAction<TPresence extends JsonObject> = Partial<TPresence> | ((oldPresence: TPresence | null) => Partial<TPresence>);
|
|
34
|
+
interface CreateRoomBundle<TIO extends IOLike, TPresence extends JsonObject, TStorage extends Record<string, AbstractType<any>>> {
|
|
35
|
+
MockedRoomProvider: FC<MockedRoomProviderProps<TIO, TPresence, TStorage>>;
|
|
36
|
+
PluvRoomProvider: FC<PluvRoomProviderProps<TIO, TPresence, TStorage>>;
|
|
37
|
+
usePluvBroadcast: () => <TEvent extends keyof InferIOInput<TIO>>(event: TEvent, data: Id<InferIOInput<TIO>[TEvent]>) => void;
|
|
38
|
+
usePluvConnection: <T extends unknown = WebSocketConnection>(selector: (connection: WebSocketConnection) => T, options?: SubscriptionHookOptions<Id<T>>) => Id<T>;
|
|
39
|
+
usePluvEvent: <TType extends keyof InferIOOutput<TIO>>(type: TType, callback: (data: Id<IOEventMessage<TIO, TType>>) => void) => void;
|
|
40
|
+
usePluvMyPresence: <T extends unknown = TPresence>(selector?: (myPresence: TPresence) => T, options?: SubscriptionHookOptions<Id<T> | null>) => [
|
|
41
|
+
myPresence: Id<T>,
|
|
42
|
+
updateMyPresence: Dispatch<UpdateMyPresenceAction<TPresence>>
|
|
43
|
+
];
|
|
44
|
+
usePluvMyself: <T extends unknown = UserInfo<TIO, TPresence>>(selector?: (myself: Id<UserInfo<TIO, TPresence>>) => T, options?: SubscriptionHookOptions<Id<T> | null>) => Id<T> | null;
|
|
45
|
+
usePluvOther: <T extends unknown = UserInfo<TIO, TPresence>>(connectionId: string, selector?: (other: UserInfo<TIO, TPresence>) => T, options?: SubscriptionHookOptions<Id<T> | null>) => Id<T> | null;
|
|
46
|
+
usePluvOthers: <T extends unknown = UserInfo<TIO, TPresence>>(selector?: (other: readonly Id<UserInfo<TIO, TPresence>>[]) => T[], options?: SubscriptionHookOptions<readonly Id<T>[]>) => readonly Id<T>[];
|
|
47
|
+
usePluvRoom: () => AbstractRoom<TIO, TPresence, TStorage>;
|
|
48
|
+
usePluvStorage: <TKey extends keyof TStorage, TData extends unknown = InferYjsSharedTypeJson<TStorage[TKey]>>(key: TKey, selector?: (data: InferYjsSharedTypeJson<TStorage[TKey]>) => TData, options?: SubscriptionHookOptions<TData | null>) => [data: TData | null, sharedType: TStorage[TKey] | null];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface PluvProviderProps {
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
}
|
|
54
|
+
interface CreateBundle<TIO extends IOLike> {
|
|
55
|
+
createRoomBundle: <TPresence extends JsonObject = {}, TStorage extends Record<string, AbstractType<any>> = {}>(options?: CreateRoomBundleOptions<TIO, TPresence, TStorage>) => CreateRoomBundle<TIO, TPresence, TStorage>;
|
|
56
|
+
PluvProvider: FC<PluvProviderProps>;
|
|
57
|
+
usePluvClient: () => PluvClient<TIO>;
|
|
58
|
+
}
|
|
59
|
+
declare const createBundle: <TIO extends IOLike<_pluv_types.IOAuthorize<any, any>, {}, {}, {}, {}>>(client: PluvClient<TIO>) => CreateBundle<TIO>;
|
|
60
|
+
|
|
61
|
+
export { CreateBundle, CreateRoomBundle, CreateRoomBundleOptions, PluvProviderProps, PluvRoomProviderProps, SubscriptionHookOptions, createBundle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "@pluv/client React.js bindings",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,25 +17,24 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@playwright/test": "^1.35.1",
|
|
21
20
|
"@types/use-sync-external-store": "^0.0.3",
|
|
22
21
|
"fast-deep-equal": "^3.1.3",
|
|
23
22
|
"use-sync-external-store": "^1.2.0",
|
|
24
|
-
"@pluv/client": "^0.9.
|
|
25
|
-
"@pluv/types": "^0.2.
|
|
23
|
+
"@pluv/client": "^0.9.1",
|
|
24
|
+
"@pluv/types": "^0.2.2"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
28
27
|
"react": "^17.0.0 || ^18.0.0",
|
|
29
28
|
"yjs": "^13.0.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@types/react": "18.2.
|
|
31
|
+
"@types/react": "18.2.15",
|
|
33
32
|
"react": "18.2.0",
|
|
34
|
-
"tsup": "^7.
|
|
35
|
-
"typescript": "^5.1.
|
|
36
|
-
"yjs": "^13.6.
|
|
37
|
-
"@pluv/tsconfig": "^0.1.
|
|
38
|
-
"eslint-config-pluv": "^0.1.
|
|
33
|
+
"tsup": "^7.1.0",
|
|
34
|
+
"typescript": "^5.1.6",
|
|
35
|
+
"yjs": "^13.6.6",
|
|
36
|
+
"@pluv/tsconfig": "^0.1.8",
|
|
37
|
+
"eslint-config-pluv": "^0.1.14"
|
|
39
38
|
},
|
|
40
39
|
"scripts": {
|
|
41
40
|
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|