@pluv/react 2.0.2 → 2.1.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.
- package/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +19 -0
- package/dist/index.js +11 -13
- package/dist/index.mjs +11 -13
- package/package.json +7 -8
- package/src/createBundle.tsx +11 -13
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/react@2.0
|
|
2
|
+
> @pluv/react@2.1.0 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[32m16.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m16.72 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 105ms
|
|
13
13
|
[32mCJS[39m [1mdist/index.js [22m[32m19.10 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 101ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 6294ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m5.70 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m5.70 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @pluv/react
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8931f7b: Moved `@pluv/client` from `peerDependencies` to `dependencies` due to an unfortunate [changesets design decision](https://github.com/changesets/changesets/issues/1011).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- e8d8fbc: Updated the internals of various hooks to use the new `PluvRoom.subscribe` object.
|
|
12
|
+
- Updated dependencies [e8d8fbc]
|
|
13
|
+
- Updated dependencies [a86ff5e]
|
|
14
|
+
- Updated dependencies [d5ac29e]
|
|
15
|
+
- Updated dependencies [5ca5cb6]
|
|
16
|
+
- Updated dependencies [4acbe1e]
|
|
17
|
+
- Updated dependencies [e8d8fbc]
|
|
18
|
+
- @pluv/client@2.1.0
|
|
19
|
+
- @pluv/crdt@2.1.0
|
|
20
|
+
- @pluv/types@2.1.0
|
|
21
|
+
|
|
3
22
|
## 2.0.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -278,7 +278,7 @@ var createBundle = (client, options = {}) => {
|
|
|
278
278
|
});
|
|
279
279
|
});
|
|
280
280
|
(0, import_react6.useEffect)(() => {
|
|
281
|
-
const unsubscribe = room.subscribe
|
|
281
|
+
const unsubscribe = room.subscribe.connection(() => {
|
|
282
282
|
rerender();
|
|
283
283
|
});
|
|
284
284
|
return () => {
|
|
@@ -351,7 +351,7 @@ var createBundle = (client, options = {}) => {
|
|
|
351
351
|
const useCanRedo = () => {
|
|
352
352
|
const room = useRoom();
|
|
353
353
|
const subscribe = (0, import_react6.useCallback)(
|
|
354
|
-
(onStoreChange) => room.
|
|
354
|
+
(onStoreChange) => room.subscribe.storage(onStoreChange),
|
|
355
355
|
[room]
|
|
356
356
|
);
|
|
357
357
|
const getSnapshot = (0, import_react6.useCallback)(() => room.canRedo(), [room]);
|
|
@@ -366,7 +366,7 @@ var createBundle = (client, options = {}) => {
|
|
|
366
366
|
const useCanUndo = () => {
|
|
367
367
|
const room = useRoom();
|
|
368
368
|
const subscribe = (0, import_react6.useCallback)(
|
|
369
|
-
(onStoreChange) => room.
|
|
369
|
+
(onStoreChange) => room.subscribe.storage(onStoreChange),
|
|
370
370
|
[room]
|
|
371
371
|
);
|
|
372
372
|
const getSnapshot = (0, import_react6.useCallback)(() => room.canUndo(), [room]);
|
|
@@ -383,7 +383,7 @@ var createBundle = (client, options = {}) => {
|
|
|
383
383
|
const room = useRoom();
|
|
384
384
|
const subscribe = (0, import_react6.useCallback)(
|
|
385
385
|
(onStoreChange) => {
|
|
386
|
-
return room.subscribe(
|
|
386
|
+
return room.subscribe.connection(onStoreChange);
|
|
387
387
|
},
|
|
388
388
|
[room]
|
|
389
389
|
);
|
|
@@ -407,7 +407,7 @@ var createBundle = (client, options = {}) => {
|
|
|
407
407
|
const useEvent = (type, callback) => {
|
|
408
408
|
const room = useRoom();
|
|
409
409
|
(0, import_react6.useEffect)(() => {
|
|
410
|
-
const unsubscribe = room.event(type, callback);
|
|
410
|
+
const unsubscribe = room.subscribe.event(type, callback);
|
|
411
411
|
return () => {
|
|
412
412
|
unsubscribe();
|
|
413
413
|
};
|
|
@@ -432,7 +432,7 @@ var createBundle = (client, options = {}) => {
|
|
|
432
432
|
const room = useRoom();
|
|
433
433
|
const subscribe = (0, import_react6.useCallback)(
|
|
434
434
|
(onStoreChange) => {
|
|
435
|
-
return room.subscribe(
|
|
435
|
+
return room.subscribe.myPresence(onStoreChange);
|
|
436
436
|
},
|
|
437
437
|
[room]
|
|
438
438
|
);
|
|
@@ -455,7 +455,7 @@ var createBundle = (client, options = {}) => {
|
|
|
455
455
|
const room = useRoom();
|
|
456
456
|
const subscribe = (0, import_react6.useCallback)(
|
|
457
457
|
(onStoreChange) => {
|
|
458
|
-
return room.subscribe(
|
|
458
|
+
return room.subscribe.myself(onStoreChange);
|
|
459
459
|
},
|
|
460
460
|
[room]
|
|
461
461
|
);
|
|
@@ -478,9 +478,7 @@ var createBundle = (client, options = {}) => {
|
|
|
478
478
|
var _a;
|
|
479
479
|
const room = useRoom();
|
|
480
480
|
const subscribe = (0, import_react6.useCallback)(
|
|
481
|
-
(onStoreChange) =>
|
|
482
|
-
return room.other(connectionId, onStoreChange);
|
|
483
|
-
},
|
|
481
|
+
(onStoreChange) => room.subscribe.other(connectionId, onStoreChange),
|
|
484
482
|
[room, connectionId]
|
|
485
483
|
);
|
|
486
484
|
const getSnapshot = (0, import_react6.useCallback)(() => room.getOther(connectionId), [room, connectionId]);
|
|
@@ -503,7 +501,7 @@ var createBundle = (client, options = {}) => {
|
|
|
503
501
|
const room = useRoom();
|
|
504
502
|
const subscribe = (0, import_react6.useCallback)(
|
|
505
503
|
(onStoreChange) => {
|
|
506
|
-
return room.subscribe(
|
|
504
|
+
return room.subscribe.others(onStoreChange);
|
|
507
505
|
},
|
|
508
506
|
[room]
|
|
509
507
|
);
|
|
@@ -529,11 +527,11 @@ var createBundle = (client, options = {}) => {
|
|
|
529
527
|
var _a, _b;
|
|
530
528
|
const room = useRoom();
|
|
531
529
|
const rerender = useRerender();
|
|
532
|
-
room.subscribe(
|
|
530
|
+
room.subscribe.storageLoaded(() => {
|
|
533
531
|
rerender();
|
|
534
532
|
});
|
|
535
533
|
const subscribe = (0, import_react6.useCallback)(
|
|
536
|
-
(onStoreChange) => room.storage(key, onStoreChange),
|
|
534
|
+
(onStoreChange) => room.subscribe.storage(key, onStoreChange),
|
|
537
535
|
[key, room]
|
|
538
536
|
);
|
|
539
537
|
const getSnapshot = (0, import_react6.useCallback)(() => {
|
package/dist/index.mjs
CHANGED
|
@@ -245,7 +245,7 @@ var createBundle = (client, options = {}) => {
|
|
|
245
245
|
});
|
|
246
246
|
});
|
|
247
247
|
useEffect3(() => {
|
|
248
|
-
const unsubscribe = room.subscribe
|
|
248
|
+
const unsubscribe = room.subscribe.connection(() => {
|
|
249
249
|
rerender();
|
|
250
250
|
});
|
|
251
251
|
return () => {
|
|
@@ -318,7 +318,7 @@ var createBundle = (client, options = {}) => {
|
|
|
318
318
|
const useCanRedo = () => {
|
|
319
319
|
const room = useRoom();
|
|
320
320
|
const subscribe = useCallback4(
|
|
321
|
-
(onStoreChange) => room.
|
|
321
|
+
(onStoreChange) => room.subscribe.storage(onStoreChange),
|
|
322
322
|
[room]
|
|
323
323
|
);
|
|
324
324
|
const getSnapshot = useCallback4(() => room.canRedo(), [room]);
|
|
@@ -333,7 +333,7 @@ var createBundle = (client, options = {}) => {
|
|
|
333
333
|
const useCanUndo = () => {
|
|
334
334
|
const room = useRoom();
|
|
335
335
|
const subscribe = useCallback4(
|
|
336
|
-
(onStoreChange) => room.
|
|
336
|
+
(onStoreChange) => room.subscribe.storage(onStoreChange),
|
|
337
337
|
[room]
|
|
338
338
|
);
|
|
339
339
|
const getSnapshot = useCallback4(() => room.canUndo(), [room]);
|
|
@@ -350,7 +350,7 @@ var createBundle = (client, options = {}) => {
|
|
|
350
350
|
const room = useRoom();
|
|
351
351
|
const subscribe = useCallback4(
|
|
352
352
|
(onStoreChange) => {
|
|
353
|
-
return room.subscribe(
|
|
353
|
+
return room.subscribe.connection(onStoreChange);
|
|
354
354
|
},
|
|
355
355
|
[room]
|
|
356
356
|
);
|
|
@@ -374,7 +374,7 @@ var createBundle = (client, options = {}) => {
|
|
|
374
374
|
const useEvent = (type, callback) => {
|
|
375
375
|
const room = useRoom();
|
|
376
376
|
useEffect3(() => {
|
|
377
|
-
const unsubscribe = room.event(type, callback);
|
|
377
|
+
const unsubscribe = room.subscribe.event(type, callback);
|
|
378
378
|
return () => {
|
|
379
379
|
unsubscribe();
|
|
380
380
|
};
|
|
@@ -399,7 +399,7 @@ var createBundle = (client, options = {}) => {
|
|
|
399
399
|
const room = useRoom();
|
|
400
400
|
const subscribe = useCallback4(
|
|
401
401
|
(onStoreChange) => {
|
|
402
|
-
return room.subscribe(
|
|
402
|
+
return room.subscribe.myPresence(onStoreChange);
|
|
403
403
|
},
|
|
404
404
|
[room]
|
|
405
405
|
);
|
|
@@ -422,7 +422,7 @@ var createBundle = (client, options = {}) => {
|
|
|
422
422
|
const room = useRoom();
|
|
423
423
|
const subscribe = useCallback4(
|
|
424
424
|
(onStoreChange) => {
|
|
425
|
-
return room.subscribe(
|
|
425
|
+
return room.subscribe.myself(onStoreChange);
|
|
426
426
|
},
|
|
427
427
|
[room]
|
|
428
428
|
);
|
|
@@ -445,9 +445,7 @@ var createBundle = (client, options = {}) => {
|
|
|
445
445
|
var _a;
|
|
446
446
|
const room = useRoom();
|
|
447
447
|
const subscribe = useCallback4(
|
|
448
|
-
(onStoreChange) =>
|
|
449
|
-
return room.other(connectionId, onStoreChange);
|
|
450
|
-
},
|
|
448
|
+
(onStoreChange) => room.subscribe.other(connectionId, onStoreChange),
|
|
451
449
|
[room, connectionId]
|
|
452
450
|
);
|
|
453
451
|
const getSnapshot = useCallback4(() => room.getOther(connectionId), [room, connectionId]);
|
|
@@ -470,7 +468,7 @@ var createBundle = (client, options = {}) => {
|
|
|
470
468
|
const room = useRoom();
|
|
471
469
|
const subscribe = useCallback4(
|
|
472
470
|
(onStoreChange) => {
|
|
473
|
-
return room.subscribe(
|
|
471
|
+
return room.subscribe.others(onStoreChange);
|
|
474
472
|
},
|
|
475
473
|
[room]
|
|
476
474
|
);
|
|
@@ -496,11 +494,11 @@ var createBundle = (client, options = {}) => {
|
|
|
496
494
|
var _a, _b;
|
|
497
495
|
const room = useRoom();
|
|
498
496
|
const rerender = useRerender();
|
|
499
|
-
room.subscribe(
|
|
497
|
+
room.subscribe.storageLoaded(() => {
|
|
500
498
|
rerender();
|
|
501
499
|
});
|
|
502
500
|
const subscribe = useCallback4(
|
|
503
|
-
(onStoreChange) => room.storage(key, onStoreChange),
|
|
501
|
+
(onStoreChange) => room.subscribe.storage(key, onStoreChange),
|
|
504
502
|
[key, room]
|
|
505
503
|
);
|
|
506
504
|
const getSnapshot = useCallback4(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/react",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "@pluv/client React.js bindings",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"fast-deep-equal": "^3.1.3",
|
|
21
|
-
"@pluv/
|
|
22
|
-
"@pluv/
|
|
21
|
+
"@pluv/client": "^2.1.0",
|
|
22
|
+
"@pluv/crdt": "^2.1.0",
|
|
23
|
+
"@pluv/types": "^2.1.0"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@types/react": "^18.0.0 || ^19.0.0",
|
|
26
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
27
|
-
"@pluv/client": "^2.0.2"
|
|
27
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/react": "^19.1.3",
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"react": "^19.1.0",
|
|
33
33
|
"tsup": "^8.4.0",
|
|
34
34
|
"typescript": "^5.8.3",
|
|
35
|
-
"@pluv/
|
|
36
|
-
"
|
|
37
|
-
"eslint-config-pluv": "^2.0.2"
|
|
35
|
+
"@pluv/tsconfig": "^2.1.0",
|
|
36
|
+
"eslint-config-pluv": "^2.1.0"
|
|
38
37
|
},
|
|
39
38
|
"scripts": {
|
|
40
39
|
"build": "tsup src/index.ts --format esm,cjs --dts --external react",
|
package/src/createBundle.tsx
CHANGED
|
@@ -269,7 +269,7 @@ export const createBundle = <
|
|
|
269
269
|
});
|
|
270
270
|
|
|
271
271
|
useEffect(() => {
|
|
272
|
-
const unsubscribe = room.subscribe
|
|
272
|
+
const unsubscribe = room.subscribe.connection(() => {
|
|
273
273
|
rerender();
|
|
274
274
|
});
|
|
275
275
|
|
|
@@ -378,7 +378,7 @@ export const createBundle = <
|
|
|
378
378
|
const room = useRoom();
|
|
379
379
|
|
|
380
380
|
const subscribe = useCallback(
|
|
381
|
-
(onStoreChange: () => void) => room.
|
|
381
|
+
(onStoreChange: () => void) => room.subscribe.storage(onStoreChange),
|
|
382
382
|
[room],
|
|
383
383
|
);
|
|
384
384
|
|
|
@@ -398,7 +398,7 @@ export const createBundle = <
|
|
|
398
398
|
const room = useRoom();
|
|
399
399
|
|
|
400
400
|
const subscribe = useCallback(
|
|
401
|
-
(onStoreChange: () => void) => room.
|
|
401
|
+
(onStoreChange: () => void) => room.subscribe.storage(onStoreChange),
|
|
402
402
|
[room],
|
|
403
403
|
);
|
|
404
404
|
|
|
@@ -422,7 +422,7 @@ export const createBundle = <
|
|
|
422
422
|
|
|
423
423
|
const subscribe = useCallback(
|
|
424
424
|
(onStoreChange: () => void) => {
|
|
425
|
-
return room.subscribe(
|
|
425
|
+
return room.subscribe.connection(onStoreChange);
|
|
426
426
|
},
|
|
427
427
|
[room],
|
|
428
428
|
);
|
|
@@ -456,7 +456,7 @@ export const createBundle = <
|
|
|
456
456
|
const room = useRoom();
|
|
457
457
|
|
|
458
458
|
useEffect(() => {
|
|
459
|
-
const unsubscribe = room.event(type, callback);
|
|
459
|
+
const unsubscribe = room.subscribe.event(type, callback);
|
|
460
460
|
|
|
461
461
|
return () => {
|
|
462
462
|
unsubscribe();
|
|
@@ -497,7 +497,7 @@ export const createBundle = <
|
|
|
497
497
|
|
|
498
498
|
const subscribe = useCallback(
|
|
499
499
|
(onStoreChange: () => void) => {
|
|
500
|
-
return room.subscribe(
|
|
500
|
+
return room.subscribe.myPresence(onStoreChange);
|
|
501
501
|
},
|
|
502
502
|
[room],
|
|
503
503
|
);
|
|
@@ -528,7 +528,7 @@ export const createBundle = <
|
|
|
528
528
|
|
|
529
529
|
const subscribe = useCallback(
|
|
530
530
|
(onStoreChange: () => void) => {
|
|
531
|
-
return room.subscribe(
|
|
531
|
+
return room.subscribe.myself(onStoreChange);
|
|
532
532
|
},
|
|
533
533
|
[room],
|
|
534
534
|
);
|
|
@@ -559,9 +559,7 @@ export const createBundle = <
|
|
|
559
559
|
const room = useRoom();
|
|
560
560
|
|
|
561
561
|
const subscribe = useCallback(
|
|
562
|
-
(onStoreChange: () => void) =>
|
|
563
|
-
return room.other(connectionId, onStoreChange);
|
|
564
|
-
},
|
|
562
|
+
(onStoreChange: () => void) => room.subscribe.other(connectionId, onStoreChange),
|
|
565
563
|
[room, connectionId],
|
|
566
564
|
);
|
|
567
565
|
|
|
@@ -591,7 +589,7 @@ export const createBundle = <
|
|
|
591
589
|
|
|
592
590
|
const subscribe = useCallback(
|
|
593
591
|
(onStoreChange: () => void) => {
|
|
594
|
-
return room.subscribe(
|
|
592
|
+
return room.subscribe.others(onStoreChange);
|
|
595
593
|
},
|
|
596
594
|
[room],
|
|
597
595
|
);
|
|
@@ -639,12 +637,12 @@ export const createBundle = <
|
|
|
639
637
|
const room = useRoom();
|
|
640
638
|
const rerender = useRerender();
|
|
641
639
|
|
|
642
|
-
room.subscribe(
|
|
640
|
+
room.subscribe.storageLoaded(() => {
|
|
643
641
|
rerender();
|
|
644
642
|
});
|
|
645
643
|
|
|
646
644
|
const subscribe = useCallback(
|
|
647
|
-
(onStoreChange: () => void) => room.storage(key, onStoreChange),
|
|
645
|
+
(onStoreChange: () => void) => room.subscribe.storage(key, onStoreChange),
|
|
648
646
|
[key, room],
|
|
649
647
|
);
|
|
650
648
|
|