@liveblocks/react 1.3.4 → 1.3.6
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/dist/index.d.mts +44 -20
- package/dist/index.d.ts +44 -20
- package/dist/index.js +278 -206
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +271 -199
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -438,7 +438,7 @@ declare type RoomContextBundleShared<TPresence extends JsonObject, TStorage exte
|
|
|
438
438
|
*
|
|
439
439
|
* @example
|
|
440
440
|
* const editThreadMetadata = useEditThreadMetadata();
|
|
441
|
-
* editThreadMetadata({ threadId: "th_xxx", metadata: {} }
|
|
441
|
+
* editThreadMetadata({ threadId: "th_xxx", metadata: {} })
|
|
442
442
|
*/
|
|
443
443
|
useEditThreadMetadata(): (options: EditThreadMetadataOptions<TThreadMetadata>) => void;
|
|
444
444
|
/**
|
|
@@ -448,7 +448,7 @@ declare type RoomContextBundleShared<TPresence extends JsonObject, TStorage exte
|
|
|
448
448
|
*
|
|
449
449
|
* @example
|
|
450
450
|
* const createComment = useCreateComment();
|
|
451
|
-
* createComment({ threadId: "th_xxx", body: {
|
|
451
|
+
* createComment({ threadId: "th_xxx", body: {} });
|
|
452
452
|
*/
|
|
453
453
|
useCreateComment(): (options: CreateCommentOptions) => CommentData;
|
|
454
454
|
/**
|
|
@@ -549,11 +549,15 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
549
549
|
* a re-render if the LiveList is updated, however it does not triggers
|
|
550
550
|
* a re-render if a nested CRDT is updated.
|
|
551
551
|
*
|
|
552
|
-
* @param key The storage key associated with the LiveList
|
|
553
|
-
* @returns null while
|
|
552
|
+
* @param key The top-level storage key associated with the LiveList
|
|
553
|
+
* @returns null while storage is still loading, otherwise, returns the LiveList instance at the storage key
|
|
554
554
|
*
|
|
555
555
|
* @example
|
|
556
|
-
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
|
|
556
|
+
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"] // ❌ No longer recommended
|
|
557
|
+
* const animals = useStorage((root) => root.animals); // ✅ Do this instead
|
|
558
|
+
*
|
|
559
|
+
* @deprecated We no longer recommend using `useList`. Prefer `useStorage`
|
|
560
|
+
* for reading and `useMutation` for writing.
|
|
557
561
|
*/
|
|
558
562
|
useList<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
559
563
|
/**
|
|
@@ -562,22 +566,30 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
562
566
|
* a re-render if the LiveMap is updated, however it does not triggers
|
|
563
567
|
* a re-render if a nested CRDT is updated.
|
|
564
568
|
*
|
|
565
|
-
* @param key The storage key associated with the LiveMap
|
|
566
|
-
* @returns null while
|
|
569
|
+
* @param key The top-level storage key associated with the LiveMap
|
|
570
|
+
* @returns null while storage is still loading, otherwise, returns the LiveMap instance at the storage key
|
|
567
571
|
*
|
|
568
572
|
* @example
|
|
569
|
-
* const shapesById = useMap("shapes");
|
|
573
|
+
* const shapesById = useMap("shapes"); // ❌ No longer recommended
|
|
574
|
+
* const shapesById = useStorage((root) => root.shapes); // ✅ Do this instead
|
|
575
|
+
*
|
|
576
|
+
* @deprecated We no longer recommend using `useMap`. Prefer `useStorage`
|
|
577
|
+
* for reading and `useMutation` for writing.
|
|
570
578
|
*/
|
|
571
579
|
useMap<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
572
580
|
/**
|
|
573
581
|
* Returns the LiveObject associated with the provided key.
|
|
574
582
|
* The hook triggers a re-render if the LiveObject is updated, however it does not triggers a re-render if a nested CRDT is updated.
|
|
575
583
|
*
|
|
576
|
-
* @param key The storage key associated with the LiveObject
|
|
577
|
-
* @returns null while
|
|
584
|
+
* @param key The top-level storage key associated with the LiveObject
|
|
585
|
+
* @returns null while storage is still loading, otherwise, returns the LiveObject instance at the storage key
|
|
578
586
|
*
|
|
579
587
|
* @example
|
|
580
|
-
* const object = useObject("obj");
|
|
588
|
+
* const object = useObject("obj"); // ❌ No longer recommended
|
|
589
|
+
* const object = useStorage((root) => root.obj); // ✅ Do this instead
|
|
590
|
+
*
|
|
591
|
+
* @deprecated We no longer recommend using `useObject`. Prefer `useStorage`
|
|
592
|
+
* for reading and `useMutation` for writing.
|
|
581
593
|
*/
|
|
582
594
|
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
583
595
|
suspense: Resolve<RoomContextBundleShared<TPresence, TStorage, TUserMeta, TRoomEvent, TThreadMetadata> & {
|
|
@@ -656,11 +668,15 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
656
668
|
* a re-render if the LiveList is updated, however it does not triggers
|
|
657
669
|
* a re-render if a nested CRDT is updated.
|
|
658
670
|
*
|
|
659
|
-
* @param key The storage key associated with the LiveList
|
|
660
|
-
* @returns
|
|
671
|
+
* @param key The top-level storage key associated with the LiveList
|
|
672
|
+
* @returns Returns the LiveList instance at the storage key
|
|
661
673
|
*
|
|
662
674
|
* @example
|
|
663
|
-
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
|
|
675
|
+
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"] // ❌ No longer recommended
|
|
676
|
+
* const animals = useStorage((root) => root.animals); // ✅ Do this instead
|
|
677
|
+
*
|
|
678
|
+
* @deprecated We no longer recommend using `useList`. Prefer `useStorage`
|
|
679
|
+
* for reading and `useMutation` for writing.
|
|
664
680
|
*/
|
|
665
681
|
useList<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
666
682
|
/**
|
|
@@ -669,22 +685,30 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
669
685
|
* a re-render if the LiveMap is updated, however it does not triggers
|
|
670
686
|
* a re-render if a nested CRDT is updated.
|
|
671
687
|
*
|
|
672
|
-
* @param key The storage key associated with the LiveMap
|
|
673
|
-
* @returns
|
|
688
|
+
* @param key The top-level storage key associated with the LiveMap
|
|
689
|
+
* @returns Returns the LiveMap instance at the storage key
|
|
674
690
|
*
|
|
675
691
|
* @example
|
|
676
|
-
* const shapesById = useMap("shapes");
|
|
692
|
+
* const shapesById = useMap("shapes"); // ❌ No longer recommended
|
|
693
|
+
* const shapesById = useStorage((root) => root.shapes); // ✅ Do this instead
|
|
694
|
+
*
|
|
695
|
+
* @deprecated We no longer recommend using `useMap`. Prefer `useStorage`
|
|
696
|
+
* for reading and `useMutation` for writing.
|
|
677
697
|
*/
|
|
678
698
|
useMap<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
679
699
|
/**
|
|
680
700
|
* Returns the LiveObject associated with the provided key.
|
|
681
701
|
* The hook triggers a re-render if the LiveObject is updated, however it does not triggers a re-render if a nested CRDT is updated.
|
|
682
702
|
*
|
|
683
|
-
* @param key The storage key associated with the LiveObject
|
|
684
|
-
* @returns
|
|
703
|
+
* @param key The top-level storage key associated with the LiveObject
|
|
704
|
+
* @returns Returns the LiveObject instance at the storage key
|
|
685
705
|
*
|
|
686
706
|
* @example
|
|
687
|
-
* const object = useObject("obj");
|
|
707
|
+
* const object = useObject("obj"); // ❌ No longer recommended
|
|
708
|
+
* const object = useStorage((root) => root.obj); // ✅ Do this instead
|
|
709
|
+
*
|
|
710
|
+
* @deprecated We no longer recommend using `useObject`. Prefer `useStorage`
|
|
711
|
+
* for reading and `useMutation` for writing.
|
|
688
712
|
*/
|
|
689
713
|
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
690
714
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -438,7 +438,7 @@ declare type RoomContextBundleShared<TPresence extends JsonObject, TStorage exte
|
|
|
438
438
|
*
|
|
439
439
|
* @example
|
|
440
440
|
* const editThreadMetadata = useEditThreadMetadata();
|
|
441
|
-
* editThreadMetadata({ threadId: "th_xxx", metadata: {} }
|
|
441
|
+
* editThreadMetadata({ threadId: "th_xxx", metadata: {} })
|
|
442
442
|
*/
|
|
443
443
|
useEditThreadMetadata(): (options: EditThreadMetadataOptions<TThreadMetadata>) => void;
|
|
444
444
|
/**
|
|
@@ -448,7 +448,7 @@ declare type RoomContextBundleShared<TPresence extends JsonObject, TStorage exte
|
|
|
448
448
|
*
|
|
449
449
|
* @example
|
|
450
450
|
* const createComment = useCreateComment();
|
|
451
|
-
* createComment({ threadId: "th_xxx", body: {
|
|
451
|
+
* createComment({ threadId: "th_xxx", body: {} });
|
|
452
452
|
*/
|
|
453
453
|
useCreateComment(): (options: CreateCommentOptions) => CommentData;
|
|
454
454
|
/**
|
|
@@ -549,11 +549,15 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
549
549
|
* a re-render if the LiveList is updated, however it does not triggers
|
|
550
550
|
* a re-render if a nested CRDT is updated.
|
|
551
551
|
*
|
|
552
|
-
* @param key The storage key associated with the LiveList
|
|
553
|
-
* @returns null while
|
|
552
|
+
* @param key The top-level storage key associated with the LiveList
|
|
553
|
+
* @returns null while storage is still loading, otherwise, returns the LiveList instance at the storage key
|
|
554
554
|
*
|
|
555
555
|
* @example
|
|
556
|
-
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
|
|
556
|
+
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"] // ❌ No longer recommended
|
|
557
|
+
* const animals = useStorage((root) => root.animals); // ✅ Do this instead
|
|
558
|
+
*
|
|
559
|
+
* @deprecated We no longer recommend using `useList`. Prefer `useStorage`
|
|
560
|
+
* for reading and `useMutation` for writing.
|
|
557
561
|
*/
|
|
558
562
|
useList<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
559
563
|
/**
|
|
@@ -562,22 +566,30 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
562
566
|
* a re-render if the LiveMap is updated, however it does not triggers
|
|
563
567
|
* a re-render if a nested CRDT is updated.
|
|
564
568
|
*
|
|
565
|
-
* @param key The storage key associated with the LiveMap
|
|
566
|
-
* @returns null while
|
|
569
|
+
* @param key The top-level storage key associated with the LiveMap
|
|
570
|
+
* @returns null while storage is still loading, otherwise, returns the LiveMap instance at the storage key
|
|
567
571
|
*
|
|
568
572
|
* @example
|
|
569
|
-
* const shapesById = useMap("shapes");
|
|
573
|
+
* const shapesById = useMap("shapes"); // ❌ No longer recommended
|
|
574
|
+
* const shapesById = useStorage((root) => root.shapes); // ✅ Do this instead
|
|
575
|
+
*
|
|
576
|
+
* @deprecated We no longer recommend using `useMap`. Prefer `useStorage`
|
|
577
|
+
* for reading and `useMutation` for writing.
|
|
570
578
|
*/
|
|
571
579
|
useMap<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
572
580
|
/**
|
|
573
581
|
* Returns the LiveObject associated with the provided key.
|
|
574
582
|
* The hook triggers a re-render if the LiveObject is updated, however it does not triggers a re-render if a nested CRDT is updated.
|
|
575
583
|
*
|
|
576
|
-
* @param key The storage key associated with the LiveObject
|
|
577
|
-
* @returns null while
|
|
584
|
+
* @param key The top-level storage key associated with the LiveObject
|
|
585
|
+
* @returns null while storage is still loading, otherwise, returns the LiveObject instance at the storage key
|
|
578
586
|
*
|
|
579
587
|
* @example
|
|
580
|
-
* const object = useObject("obj");
|
|
588
|
+
* const object = useObject("obj"); // ❌ No longer recommended
|
|
589
|
+
* const object = useStorage((root) => root.obj); // ✅ Do this instead
|
|
590
|
+
*
|
|
591
|
+
* @deprecated We no longer recommend using `useObject`. Prefer `useStorage`
|
|
592
|
+
* for reading and `useMutation` for writing.
|
|
581
593
|
*/
|
|
582
594
|
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey] | null;
|
|
583
595
|
suspense: Resolve<RoomContextBundleShared<TPresence, TStorage, TUserMeta, TRoomEvent, TThreadMetadata> & {
|
|
@@ -656,11 +668,15 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
656
668
|
* a re-render if the LiveList is updated, however it does not triggers
|
|
657
669
|
* a re-render if a nested CRDT is updated.
|
|
658
670
|
*
|
|
659
|
-
* @param key The storage key associated with the LiveList
|
|
660
|
-
* @returns
|
|
671
|
+
* @param key The top-level storage key associated with the LiveList
|
|
672
|
+
* @returns Returns the LiveList instance at the storage key
|
|
661
673
|
*
|
|
662
674
|
* @example
|
|
663
|
-
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"]
|
|
675
|
+
* const animals = useList("animals"); // e.g. [] or ["🦁", "🐍", "🦍"] // ❌ No longer recommended
|
|
676
|
+
* const animals = useStorage((root) => root.animals); // ✅ Do this instead
|
|
677
|
+
*
|
|
678
|
+
* @deprecated We no longer recommend using `useList`. Prefer `useStorage`
|
|
679
|
+
* for reading and `useMutation` for writing.
|
|
664
680
|
*/
|
|
665
681
|
useList<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
666
682
|
/**
|
|
@@ -669,22 +685,30 @@ declare type RoomContextBundle<TPresence extends JsonObject, TStorage extends Ls
|
|
|
669
685
|
* a re-render if the LiveMap is updated, however it does not triggers
|
|
670
686
|
* a re-render if a nested CRDT is updated.
|
|
671
687
|
*
|
|
672
|
-
* @param key The storage key associated with the LiveMap
|
|
673
|
-
* @returns
|
|
688
|
+
* @param key The top-level storage key associated with the LiveMap
|
|
689
|
+
* @returns Returns the LiveMap instance at the storage key
|
|
674
690
|
*
|
|
675
691
|
* @example
|
|
676
|
-
* const shapesById = useMap("shapes");
|
|
692
|
+
* const shapesById = useMap("shapes"); // ❌ No longer recommended
|
|
693
|
+
* const shapesById = useStorage((root) => root.shapes); // ✅ Do this instead
|
|
694
|
+
*
|
|
695
|
+
* @deprecated We no longer recommend using `useMap`. Prefer `useStorage`
|
|
696
|
+
* for reading and `useMutation` for writing.
|
|
677
697
|
*/
|
|
678
698
|
useMap<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
679
699
|
/**
|
|
680
700
|
* Returns the LiveObject associated with the provided key.
|
|
681
701
|
* The hook triggers a re-render if the LiveObject is updated, however it does not triggers a re-render if a nested CRDT is updated.
|
|
682
702
|
*
|
|
683
|
-
* @param key The storage key associated with the LiveObject
|
|
684
|
-
* @returns
|
|
703
|
+
* @param key The top-level storage key associated with the LiveObject
|
|
704
|
+
* @returns Returns the LiveObject instance at the storage key
|
|
685
705
|
*
|
|
686
706
|
* @example
|
|
687
|
-
* const object = useObject("obj");
|
|
707
|
+
* const object = useObject("obj"); // ❌ No longer recommended
|
|
708
|
+
* const object = useStorage((root) => root.obj); // ✅ Do this instead
|
|
709
|
+
*
|
|
710
|
+
* @deprecated We no longer recommend using `useObject`. Prefer `useStorage`
|
|
711
|
+
* for reading and `useMutation` for writing.
|
|
688
712
|
*/
|
|
689
713
|
useObject<TKey extends Extract<keyof TStorage, string>>(key: TKey): TStorage[TKey];
|
|
690
714
|
}>;
|