@pluv/react 0.12.0 → 0.12.2
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 +9 -9
- package/CHANGELOG.md +17 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -3
- package/dist/index.mjs +2 -3
- package/package.json +11 -11
- package/src/createRoomBundle.tsx +8 -8
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/react@0.12.
|
|
2
|
+
> @pluv/react@0.12.2 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
|
|
7
|
+
[34mCLI[39m tsup v8.0.1
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m12.46 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 90ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m9.88 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 112ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4361ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.74 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.74 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @pluv/react
|
|
2
2
|
|
|
3
|
+
## 0.12.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 259a7da: Bumped dependencies
|
|
8
|
+
|
|
9
|
+
## 0.12.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- cae08aa: Updated storage from `getStorage` to never return null
|
|
14
|
+
- Updated dependencies [cae08aa]
|
|
15
|
+
- @pluv/client@0.12.1
|
|
16
|
+
- @pluv/types@0.12.1
|
|
17
|
+
|
|
3
18
|
## 0.12.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -217,12 +232,12 @@
|
|
|
217
232
|
const transact = usePluvTransact();
|
|
218
233
|
|
|
219
234
|
transact(() => {
|
|
220
|
-
sharedType
|
|
235
|
+
sharedType.push(["hello world!"]);
|
|
221
236
|
});
|
|
222
237
|
|
|
223
238
|
// This will also be undoable because `"user-123"` is a tracked origin.
|
|
224
239
|
transact(() => {
|
|
225
|
-
sharedType
|
|
240
|
+
sharedType.push(["hello world!"]);
|
|
226
241
|
}, "user-123");
|
|
227
242
|
|
|
228
243
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -48,7 +48,7 @@ interface CreateRoomBundle<TIO extends IOLike, TPresence extends JsonObject, TSt
|
|
|
48
48
|
usePluvOthers: <T extends unknown = UserInfo<TIO, TPresence>>(selector?: (other: readonly Id<UserInfo<TIO, TPresence>>[]) => T[], options?: SubscriptionHookOptions<readonly Id<T>[]>) => readonly Id<T>[];
|
|
49
49
|
usePluvRedo: () => () => void;
|
|
50
50
|
usePluvRoom: () => AbstractRoom<TIO, TPresence, TStorage>;
|
|
51
|
-
usePluvStorage: <TKey extends keyof TStorage, TData extends unknown = InferYjsSharedTypeJson<TStorage[TKey]>>(key: TKey, selector?: (data: InferYjsSharedTypeJson<TStorage[TKey]>) => TData, options?: SubscriptionHookOptions<TData
|
|
51
|
+
usePluvStorage: <TKey extends keyof TStorage, TData extends unknown = InferYjsSharedTypeJson<TStorage[TKey]>>(key: TKey, selector?: (data: InferYjsSharedTypeJson<TStorage[TKey]>) => TData, options?: SubscriptionHookOptions<TData>) => [data: TData, sharedType: TStorage[TKey]];
|
|
52
52
|
usePluvTransact: () => (fn: (storage: TStorage) => void, origin?: string) => void;
|
|
53
53
|
usePluvUndo: () => () => void;
|
|
54
54
|
}
|
|
@@ -63,4 +63,4 @@ interface CreateBundle<TIO extends IOLike> {
|
|
|
63
63
|
}
|
|
64
64
|
declare const createBundle: <TIO extends IOLike<_pluv_types.IOAuthorize<any, any>, {}, {}, {}, {}>>(client: PluvClient<TIO>) => CreateBundle<TIO>;
|
|
65
65
|
|
|
66
|
-
export { CreateBundle, CreateRoomBundle, CreateRoomBundleOptions, PluvProviderProps, PluvRoomProviderProps, SubscriptionHookOptions, createBundle };
|
|
66
|
+
export { type CreateBundle, type CreateRoomBundle, type CreateRoomBundleOptions, type PluvProviderProps, type PluvRoomProviderProps, type SubscriptionHookOptions, createBundle };
|
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface CreateRoomBundle<TIO extends IOLike, TPresence extends JsonObject, TSt
|
|
|
48
48
|
usePluvOthers: <T extends unknown = UserInfo<TIO, TPresence>>(selector?: (other: readonly Id<UserInfo<TIO, TPresence>>[]) => T[], options?: SubscriptionHookOptions<readonly Id<T>[]>) => readonly Id<T>[];
|
|
49
49
|
usePluvRedo: () => () => void;
|
|
50
50
|
usePluvRoom: () => AbstractRoom<TIO, TPresence, TStorage>;
|
|
51
|
-
usePluvStorage: <TKey extends keyof TStorage, TData extends unknown = InferYjsSharedTypeJson<TStorage[TKey]>>(key: TKey, selector?: (data: InferYjsSharedTypeJson<TStorage[TKey]>) => TData, options?: SubscriptionHookOptions<TData
|
|
51
|
+
usePluvStorage: <TKey extends keyof TStorage, TData extends unknown = InferYjsSharedTypeJson<TStorage[TKey]>>(key: TKey, selector?: (data: InferYjsSharedTypeJson<TStorage[TKey]>) => TData, options?: SubscriptionHookOptions<TData>) => [data: TData, sharedType: TStorage[TKey]];
|
|
52
52
|
usePluvTransact: () => (fn: (storage: TStorage) => void, origin?: string) => void;
|
|
53
53
|
usePluvUndo: () => () => void;
|
|
54
54
|
}
|
|
@@ -63,4 +63,4 @@ interface CreateBundle<TIO extends IOLike> {
|
|
|
63
63
|
}
|
|
64
64
|
declare const createBundle: <TIO extends IOLike<_pluv_types.IOAuthorize<any, any>, {}, {}, {}, {}>>(client: PluvClient<TIO>) => CreateBundle<TIO>;
|
|
65
65
|
|
|
66
|
-
export { CreateBundle, CreateRoomBundle, CreateRoomBundleOptions, PluvProviderProps, PluvRoomProviderProps, SubscriptionHookOptions, createBundle };
|
|
66
|
+
export { type CreateBundle, type CreateRoomBundle, type CreateRoomBundleOptions, type PluvProviderProps, type PluvRoomProviderProps, type SubscriptionHookOptions, createBundle };
|
package/dist/index.js
CHANGED
|
@@ -315,12 +315,11 @@ var createRoomBundle = (client, options = {}) => {
|
|
|
315
315
|
[key, room]
|
|
316
316
|
);
|
|
317
317
|
const getSnapshot = (0, import_react2.useCallback)(() => {
|
|
318
|
-
|
|
319
|
-
return (_b = (_a2 = room.getStorage(key)) == null ? void 0 : _a2.toJSON()) != null ? _b : null;
|
|
318
|
+
return room.getStorage(key).toJSON();
|
|
320
319
|
}, [key, room]);
|
|
321
320
|
const _selector = (0, import_react2.useCallback)(
|
|
322
321
|
(snapshot) => {
|
|
323
|
-
return
|
|
322
|
+
return selector(snapshot);
|
|
324
323
|
},
|
|
325
324
|
[selector]
|
|
326
325
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -285,12 +285,11 @@ var createRoomBundle = (client, options = {}) => {
|
|
|
285
285
|
[key, room]
|
|
286
286
|
);
|
|
287
287
|
const getSnapshot = useCallback2(() => {
|
|
288
|
-
|
|
289
|
-
return (_b = (_a2 = room.getStorage(key)) == null ? void 0 : _a2.toJSON()) != null ? _b : null;
|
|
288
|
+
return room.getStorage(key).toJSON();
|
|
290
289
|
}, [key, room]);
|
|
291
290
|
const _selector = useCallback2(
|
|
292
291
|
(snapshot) => {
|
|
293
|
-
return
|
|
292
|
+
return selector(snapshot);
|
|
294
293
|
},
|
|
295
294
|
[selector]
|
|
296
295
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/react",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "@pluv/client React.js bindings",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,25 +17,25 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/react": "18.2.
|
|
21
|
-
"@types/use-sync-external-store": "^0.0.
|
|
20
|
+
"@types/react": "^18.2.38",
|
|
21
|
+
"@types/use-sync-external-store": "^0.0.6",
|
|
22
22
|
"fast-deep-equal": "^3.1.3",
|
|
23
23
|
"use-sync-external-store": "^1.2.0",
|
|
24
|
-
"@pluv/client": "^0.12.
|
|
25
|
-
"@pluv/types": "^0.12.
|
|
24
|
+
"@pluv/client": "^0.12.2",
|
|
25
|
+
"@pluv/types": "^0.12.2"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^17.0.0 || ^18.0.0",
|
|
29
29
|
"yjs": "^13.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"eslint": "^8.
|
|
33
|
-
"react": "18.2.0",
|
|
34
|
-
"tsup": "^
|
|
32
|
+
"eslint": "^8.54.0",
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"tsup": "^8.0.1",
|
|
35
35
|
"typescript": "^5.2.2",
|
|
36
|
-
"yjs": "^13.6.
|
|
37
|
-
"@pluv/tsconfig": "^0.12.
|
|
38
|
-
"eslint-config-pluv": "^0.12.
|
|
36
|
+
"yjs": "^13.6.10",
|
|
37
|
+
"@pluv/tsconfig": "^0.12.2",
|
|
38
|
+
"eslint-config-pluv": "^0.12.2"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|
package/src/createRoomBundle.tsx
CHANGED
|
@@ -136,8 +136,8 @@ export interface CreateRoomBundle<
|
|
|
136
136
|
>(
|
|
137
137
|
key: TKey,
|
|
138
138
|
selector?: (data: InferYjsSharedTypeJson<TStorage[TKey]>) => TData,
|
|
139
|
-
options?: SubscriptionHookOptions<TData
|
|
140
|
-
) => [data: TData
|
|
139
|
+
options?: SubscriptionHookOptions<TData>,
|
|
140
|
+
) => [data: TData, sharedType: TStorage[TKey]];
|
|
141
141
|
usePluvTransact: () => (
|
|
142
142
|
fn: (storage: TStorage) => void,
|
|
143
143
|
origin?: string,
|
|
@@ -517,8 +517,8 @@ export const createRoomBundle = <
|
|
|
517
517
|
selector = identity as (
|
|
518
518
|
data: InferYjsSharedTypeJson<TStorage[TKey]>,
|
|
519
519
|
) => TData,
|
|
520
|
-
options?: SubscriptionHookOptions<TData
|
|
521
|
-
): [data: TData
|
|
520
|
+
options?: SubscriptionHookOptions<TData>,
|
|
521
|
+
): [data: TData, sharedType: TStorage[TKey]] => {
|
|
522
522
|
const room = usePluvRoom();
|
|
523
523
|
|
|
524
524
|
const subscribe = useCallback(
|
|
@@ -528,13 +528,13 @@ export const createRoomBundle = <
|
|
|
528
528
|
|
|
529
529
|
const getSnapshot = useCallback((): InferYjsSharedTypeJson<
|
|
530
530
|
TStorage[TKey]
|
|
531
|
-
>
|
|
532
|
-
return room.getStorage(key)
|
|
531
|
+
> => {
|
|
532
|
+
return room.getStorage(key).toJSON();
|
|
533
533
|
}, [key, room]);
|
|
534
534
|
|
|
535
535
|
const _selector = useCallback(
|
|
536
|
-
(snapshot: InferYjsSharedTypeJson<TStorage[TKey]>
|
|
537
|
-
return
|
|
536
|
+
(snapshot: InferYjsSharedTypeJson<TStorage[TKey]>) => {
|
|
537
|
+
return selector(snapshot);
|
|
538
538
|
},
|
|
539
539
|
[selector],
|
|
540
540
|
);
|