@liveblocks/react 2.9.3-experimental1 → 2.10.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.
@@ -1,30 +1,6 @@
1
- import { JsonObject, LsonObject, BaseUserMeta, LiveObject, User, RoomNotificationSettings, Json, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, Client as Client$1, ClientOptions, StorageStatus as StorageStatus$1, CommentData as CommentData$1 } from '@liveblocks/client';
2
- import * as React$1 from 'react';
3
- import React__default, { ReactNode, PropsWithChildren } from 'react';
4
- import { BaseMetadata, CommentBody, Patchable, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, CommentAttachment, InboxNotificationData, Resolve, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, RoomEventMessage, CommentData, PartialUnless, ThreadDataWithDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, OpaqueClient, CommentUserReaction, ThreadDeleteInfo, InboxNotificationDeleteInfo, DistributiveOmit, DU, DM, OpaqueRoom, DP, DS, DE } from '@liveblocks/core';
5
-
6
- declare type Props = {
7
- fallback: ReactNode;
8
- children: (() => ReactNode | undefined) | ReactNode | undefined;
9
- };
10
- /**
11
- * Almost like a normal <Suspense> component, except that for server-side
12
- * renders, the fallback will be used.
13
- *
14
- * The child props will have to be provided in a function, i.e. change:
15
- *
16
- * <Suspense fallback={<Loading />}>
17
- * <MyRealComponent a={1} />
18
- * </Suspense>
19
- *
20
- * To:
21
- *
22
- * <ClientSideSuspense fallback={<Loading />}>
23
- * <MyRealComponent a={1} />
24
- * </ClientSideSuspense>
25
- *
26
- */
27
- declare function ClientSideSuspense(props: Props): React$1.JSX.Element;
1
+ import { JsonObject, LsonObject, BaseUserMeta, LiveObject, User, RoomNotificationSettings, Json, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, Client as Client$1, ClientOptions } from '@liveblocks/client';
2
+ import { BaseMetadata, CommentBody, Patchable, StorageStatus, QueryMetadata, AsyncResult, DRI, AsyncSuccess, CommentAttachment, InboxNotificationData, Resolve, ToImmutable, AsyncLoading, AsyncError, ThreadData, HistoryVersion, Client, LiveblocksError, RoomEventMessage, CommentData, PartialUnless, ThreadDataWithDeleteInfo, RoomNotificationSettings as RoomNotificationSettings$1, OpaqueClient, CommentUserReaction, ThreadDeleteInfo, InboxNotificationDeleteInfo, DistributiveOmit, DU, DM } from '@liveblocks/core';
3
+ import React__default, { PropsWithChildren } from 'react';
28
4
 
29
5
  /**
30
6
  * @private Internal API, do not rely on it.
@@ -1479,7 +1455,7 @@ declare function useRoomInfo(roomId: string): RoomInfoAsyncResult;
1479
1455
  * const { info } = useRoomInfo("room-id");
1480
1456
  */
1481
1457
  declare function useRoomInfoSuspense(roomId: string): RoomInfoAsyncSuccess;
1482
- declare type TypedBundle$1 = LiveblocksContextBundle<DU, DM>;
1458
+ declare type TypedBundle = LiveblocksContextBundle<DU, DM>;
1483
1459
  /**
1484
1460
  * Returns the thread associated with a `"thread"` inbox notification.
1485
1461
  *
@@ -1495,21 +1471,21 @@ declare type TypedBundle$1 = LiveblocksContextBundle<DU, DM>;
1495
1471
  * @example
1496
1472
  * const thread = useInboxNotificationThread("in_xxx");
1497
1473
  */
1498
- declare const _useInboxNotificationThread: TypedBundle$1["useInboxNotificationThread"];
1474
+ declare const _useInboxNotificationThread: TypedBundle["useInboxNotificationThread"];
1499
1475
  /**
1500
1476
  * Returns user info from a given user ID.
1501
1477
  *
1502
1478
  * @example
1503
1479
  * const { user, error, isLoading } = useUser("user-id");
1504
1480
  */
1505
- declare const _useUser: TypedBundle$1["useUser"];
1481
+ declare const _useUser: TypedBundle["useUser"];
1506
1482
  /**
1507
1483
  * Returns user info from a given user ID.
1508
1484
  *
1509
1485
  * @example
1510
1486
  * const { user } = useUser("user-id");
1511
1487
  */
1512
- declare const _useUserSuspense: TypedBundle$1["suspense"]["useUser"];
1488
+ declare const _useUserSuspense: TypedBundle["suspense"]["useUser"];
1513
1489
  /**
1514
1490
  * @experimental
1515
1491
  *
@@ -1525,7 +1501,7 @@ declare const _useUserSuspense: TypedBundle$1["suspense"]["useUser"];
1525
1501
  * specify the sort order to be by most recently updated first somehow.
1526
1502
  * The final API for that is still TBD.
1527
1503
  */
1528
- declare const _useUserThreads_experimental: TypedBundle$1["useUserThreads_experimental"];
1504
+ declare const _useUserThreads_experimental: TypedBundle["useUserThreads_experimental"];
1529
1505
  /**
1530
1506
  * @experimental
1531
1507
  *
@@ -1541,697 +1517,6 @@ declare const _useUserThreads_experimental: TypedBundle$1["useUserThreads_experi
1541
1517
  * specify the sort order to be by most recently updated first somehow.
1542
1518
  * The final API for that is still TBD.
1543
1519
  */
1544
- declare const _useUserThreadsSuspense_experimental: TypedBundle$1["suspense"]["useUserThreads_experimental"];
1545
-
1546
- /**
1547
- * Raw access to the React context where the RoomProvider stores the current
1548
- * room. Exposed for advanced use cases only.
1549
- *
1550
- * @private This is a private/advanced API. Do not rely on it.
1551
- */
1552
- declare const RoomContext: React$1.Context<OpaqueRoom | null>;
1553
-
1554
- /**
1555
- * Returns the current connection status for the Room, and triggers
1556
- * a re-render whenever it changes. Can be used to render a status badge.
1557
- */
1558
- declare function useStatus(): Status;
1559
- /**
1560
- * Returns the current storage status for the Room, and triggers
1561
- * a re-render whenever it changes. Can be used to render a "Saving..."
1562
- * indicator.
1563
- */
1564
- declare function useStorageStatus(options?: UseStorageStatusOptions): StorageStatus$1;
1565
- /**
1566
- * @deprecated It's recommended to use `useMutation` for writing to Storage,
1567
- * which will automatically batch all mutations.
1568
- *
1569
- * Returns a function that batches modifications made during the given function.
1570
- * All the modifications are sent to other clients in a single message.
1571
- * All the modifications are merged in a single history item (undo/redo).
1572
- * All the subscribers are called only after the batch is over.
1573
- */
1574
- declare function useBatch<T>(): (callback: () => T) => T;
1575
- /**
1576
- * Get informed when reconnecting to the Liveblocks servers is taking
1577
- * longer than usual. This typically is a sign of a client that has lost
1578
- * internet connectivity.
1579
- *
1580
- * This isn't problematic (because the Liveblocks client is still trying to
1581
- * reconnect), but it's typically a good idea to inform users about it if
1582
- * the connection takes too long to recover.
1583
- *
1584
- * @example
1585
- * useLostConnectionListener(event => {
1586
- * if (event === 'lost') {
1587
- * toast.warn('Reconnecting to the Liveblocks servers is taking longer than usual...')
1588
- * } else if (event === 'failed') {
1589
- * toast.warn('Reconnecting to the Liveblocks servers failed.')
1590
- * } else if (event === 'restored') {
1591
- * toast.clear();
1592
- * }
1593
- * })
1594
- */
1595
- declare function useLostConnectionListener(callback: (event: LostConnectionEvent) => void): void;
1596
- /**
1597
- * useErrorListener is a React hook that allows you to respond to potential room
1598
- * connection errors.
1599
- *
1600
- * @example
1601
- * useErrorListener(er => {
1602
- * console.error(er);
1603
- * })
1604
- */
1605
- declare function useErrorListener(callback: (err: LiveblocksError) => void): void;
1606
- /**
1607
- * Returns the room.history
1608
- */
1609
- declare function useHistory(): History;
1610
- /**
1611
- * Returns a function that undoes the last operation executed by the current
1612
- * client. It does not impact operations made by other clients.
1613
- */
1614
- declare function useUndo(): () => void;
1615
- /**
1616
- * Returns a function that redoes the last operation executed by the current
1617
- * client. It does not impact operations made by other clients.
1618
- */
1619
- declare function useRedo(): () => void;
1620
- /**
1621
- * Returns whether there are any operations to undo.
1622
- */
1623
- declare function useCanUndo(): boolean;
1624
- /**
1625
- * Returns whether there are any operations to redo.
1626
- */
1627
- declare function useCanRedo(): boolean;
1628
- /**
1629
- * Returns an array of connection IDs. This matches the values you'll get by
1630
- * using the `useOthers()` hook.
1631
- *
1632
- * Roughly equivalent to:
1633
- * useOthers((others) => others.map(other => other.connectionId), shallow)
1634
- *
1635
- * This is useful in particular to implement efficiently rendering components
1636
- * for each user in the room, e.g. cursors.
1637
- *
1638
- * @example
1639
- * const ids = useOthersConnectionIds();
1640
- * // [2, 4, 7]
1641
- */
1642
- declare function useOthersConnectionIds(): readonly number[];
1643
- /**
1644
- * @private Internal API, do not rely on it.
1645
- */
1646
- declare function useCommentsErrorListener<M extends BaseMetadata$1>(callback: (error: CommentsError<M>) => void): void;
1647
- /**
1648
- * Returns a function that adds a comment to a thread.
1649
- *
1650
- * @example
1651
- * const createComment = useCreateComment();
1652
- * createComment({ threadId: "th_xxx", body: {} });
1653
- */
1654
- declare function useCreateComment(): (options: CreateCommentOptions) => CommentData$1;
1655
- /**
1656
- * Returns a function that edits a comment's body.
1657
- *
1658
- * @example
1659
- * const editComment = useEditComment()
1660
- * editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
1661
- */
1662
- declare function useEditComment(): (options: EditCommentOptions) => void;
1663
- /**
1664
- * Returns a function that deletes a comment.
1665
- * If it is the last non-deleted comment, the thread also gets deleted.
1666
- *
1667
- * @example
1668
- * const deleteComment = useDeleteComment();
1669
- * deleteComment({ threadId: "th_xxx", commentId: "cm_xxx" })
1670
- */
1671
- declare function useDeleteComment(): ({ threadId, commentId }: DeleteCommentOptions) => void;
1672
- /**
1673
- * Returns a function that removes a reaction on a comment.
1674
- *
1675
- * @example
1676
- * const removeReaction = useRemoveReaction();
1677
- * removeReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
1678
- */
1679
- declare function useRemoveReaction(): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
1680
- /**
1681
- * Returns a function that marks a thread as read.
1682
- *
1683
- * @example
1684
- * const markThreadAsRead = useMarkThreadAsRead();
1685
- * markThreadAsRead("th_xxx");
1686
- */
1687
- declare function useMarkThreadAsRead(): (threadId: string) => void;
1688
- /**
1689
- * Returns a function that marks a thread as resolved.
1690
- *
1691
- * @example
1692
- * const markThreadAsResolved = useMarkThreadAsResolved();
1693
- * markThreadAsResolved("th_xxx");
1694
- */
1695
- declare function useMarkThreadAsResolved(): (threadId: string) => void;
1696
- /**
1697
- * Returns a function that marks a thread as unresolved.
1698
- *
1699
- * @example
1700
- * const markThreadAsUnresolved = useMarkThreadAsUnresolved();
1701
- * markThreadAsUnresolved("th_xxx");
1702
- */
1703
- declare function useMarkThreadAsUnresolved(): (threadId: string) => void;
1704
- /**
1705
- * Returns the subscription status of a thread.
1706
- *
1707
- * @example
1708
- * const { status, unreadSince } = useThreadSubscription("th_xxx");
1709
- */
1710
- declare function useThreadSubscription(threadId: string): ThreadSubscription;
1711
- /**
1712
- * Returns the user's notification settings for the current room
1713
- * and a function to update them.
1714
- *
1715
- * @example
1716
- * const [{ settings }, updateSettings] = useRoomNotificationSettings();
1717
- */
1718
- declare function useRoomNotificationSettings(): [
1719
- RoomNotificationSettingsAsyncResult,
1720
- (settings: Partial<RoomNotificationSettings>) => void
1721
- ];
1722
- /**
1723
- * Returns the version data bianry for a given version
1724
- *
1725
- * @example
1726
- * const {data} = useHistoryVersionData(versionId);
1727
- */
1728
- declare function useHistoryVersionData(versionId: string): HistoryVersionDataAsyncResult;
1729
- /**
1730
- * Returns a function that updates the user's notification settings
1731
- * for the current room.
1732
- *
1733
- * @example
1734
- * const updateRoomNotificationSettings = useUpdateRoomNotificationSettings();
1735
- * updateRoomNotificationSettings({ threads: "all" });
1736
- */
1737
- declare function useUpdateRoomNotificationSettings(): (settings: Partial<RoomNotificationSettings>) => void;
1738
- /**
1739
- * Returns an array of connection IDs. This matches the values you'll get by
1740
- * using the `useOthers()` hook.
1741
- *
1742
- * Roughly equivalent to:
1743
- * useOthers((others) => others.map(other => other.connectionId), shallow)
1744
- *
1745
- * This is useful in particular to implement efficiently rendering components
1746
- * for each user in the room, e.g. cursors.
1747
- *
1748
- * @example
1749
- * const ids = useOthersConnectionIds();
1750
- * // [2, 4, 7]
1751
- */
1752
- declare function useOthersConnectionIdsSuspense(): readonly number[];
1753
- /**
1754
- * Returns the current storage status for the Room, and triggers
1755
- * a re-render whenever it changes. Can be used to render a "Saving..."
1756
- * indicator.
1757
- */
1758
- declare function useStorageStatusSuspense(options?: UseStorageStatusOptions): StorageStatusSuccess;
1759
- /**
1760
- * Returns a presigned URL for an attachment by its ID.
1761
- *
1762
- * @example
1763
- * const { url, error, isLoading } = useAttachmentUrl("at_xxx");
1764
- */
1765
- declare function useAttachmentUrl(attachmentId: string): AttachmentUrlAsyncResult;
1766
- /**
1767
- * Returns a presigned URL for an attachment by its ID.
1768
- *
1769
- * @example
1770
- * const { url } = useAttachmentUrl("at_xxx");
1771
- */
1772
- declare function useAttachmentUrlSuspense(attachmentId: string): {
1773
- readonly isLoading: false;
1774
- readonly url: string;
1775
- readonly error: undefined;
1776
- };
1777
- /**
1778
- * Creates a RoomProvider and a set of typed hooks to use in your app. Note
1779
- * that any RoomProvider created in this way does not need to be nested in
1780
- * LiveblocksProvider, as it already has access to the client.
1781
- */
1782
- declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata$1 = DM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, M>;
1783
- declare type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
1784
- /**
1785
- * Makes a Room available in the component hierarchy below.
1786
- * Joins the room when the component is mounted, and automatically leaves
1787
- * the room when the component is unmounted.
1788
- */
1789
- declare const _RoomProvider: TypedBundle["RoomProvider"];
1790
- /**
1791
- * Returns a callback that lets you broadcast custom events to other users in the room
1792
- *
1793
- * @example
1794
- * const broadcast = useBroadcastEvent();
1795
- *
1796
- * broadcast({ type: "CUSTOM_EVENT", data: { x: 0, y: 0 } });
1797
- */
1798
- declare const _useBroadcastEvent: TypedBundle["useBroadcastEvent"];
1799
- /**
1800
- * Get informed when users enter or leave the room, as an event.
1801
- *
1802
- * @example
1803
- * useOthersListener({ type, user, others }) => {
1804
- * if (type === 'enter') {
1805
- * // `user` has joined the room
1806
- * } else if (type === 'leave') {
1807
- * // `user` has left the room
1808
- * }
1809
- * })
1810
- */
1811
- declare const _useOthersListener: TypedBundle["useOthersListener"];
1812
- /**
1813
- * Returns the Room of the nearest RoomProvider above in the React component
1814
- * tree.
1815
- */
1816
- declare const _useRoom: TypedBundle["useRoom"];
1817
- /**
1818
- * Returns whether the hook is called within a RoomProvider context.
1819
- *
1820
- * @example
1821
- * const isInsideRoom = useIsInsideRoom();
1822
- */
1823
- declare const _useIsInsideRoom: TypedBundle["useIsInsideRoom"];
1824
- /**
1825
- * Returns a function that adds a reaction from a comment.
1826
- *
1827
- * @example
1828
- * const addReaction = useAddReaction();
1829
- * addReaction({ threadId: "th_xxx", commentId: "cm_xxx", emoji: "👍" })
1830
- */
1831
- declare const _useAddReaction: TypedBundle["useAddReaction"];
1832
- /**
1833
- * Create a callback function that lets you mutate Liveblocks state.
1834
- *
1835
- * The first argument that gets passed into your callback will be
1836
- * a "mutation context", which exposes the following:
1837
- *
1838
- * - `storage` - The mutable Storage root.
1839
- * You can mutate any Live structures with this, for example:
1840
- * `storage.get('layers').get('layer1').set('fill', 'red')`
1841
- *
1842
- * - `setMyPresence` - Call this with a new (partial) Presence value.
1843
- *
1844
- * - `self` - A read-only version of the latest self, if you need it to
1845
- * compute the next state.
1846
- *
1847
- * - `others` - A read-only version of the latest others list, if you
1848
- * need it to compute the next state.
1849
- *
1850
- * useMutation is like React's useCallback, except that the first argument
1851
- * that gets passed into your callback will be a "mutation context".
1852
- *
1853
- * If you want get access to the immutable root somewhere in your mutation,
1854
- * you can use `storage.ToImmutable()`.
1855
- *
1856
- * @example
1857
- * const fillLayers = useMutation(
1858
- * ({ storage }, color: Color) => {
1859
- * ...
1860
- * },
1861
- * [],
1862
- * );
1863
- *
1864
- * fillLayers('red');
1865
- *
1866
- * const deleteLayers = useMutation(
1867
- * ({ storage }) => {
1868
- * ...
1869
- * },
1870
- * [],
1871
- * );
1872
- *
1873
- * deleteLayers();
1874
- */
1875
- declare const _useMutation: TypedBundle["useMutation"];
1876
- /**
1877
- * Returns a function that creates a thread with an initial comment, and optionally some metadata.
1878
- *
1879
- * @example
1880
- * const createThread = useCreateThread();
1881
- * createThread({ body: {}, metadata: {} });
1882
- */
1883
- declare const _useCreateThread: TypedBundle["useCreateThread"];
1884
- /**
1885
- * Returns a function that deletes a thread and its associated comments.
1886
- * Only the thread creator can delete a thread, it will throw otherwise.
1887
- *
1888
- * @example
1889
- * const deleteThread = useDeleteThread();
1890
- * deleteThread("th_xxx");
1891
- */
1892
- declare const _useDeleteThread: TypedBundle["useDeleteThread"];
1893
- /**
1894
- * Returns a function that edits a thread's metadata.
1895
- * To delete an existing metadata property, set its value to `null`.
1896
- *
1897
- * @example
1898
- * const editThreadMetadata = useEditThreadMetadata();
1899
- * editThreadMetadata({ threadId: "th_xxx", metadata: {} })
1900
- */
1901
- declare const _useEditThreadMetadata: TypedBundle["useEditThreadMetadata"];
1902
- /**
1903
- * useEventListener is a React hook that allows you to respond to events broadcast
1904
- * by other users in the room.
1905
- *
1906
- * The `user` argument will indicate which `User` instance sent the message.
1907
- * This will be equal to one of the others in the room, but it can be `null`
1908
- * in case this event was broadcasted from the server.
1909
- *
1910
- * @example
1911
- * useEventListener(({ event, user, connectionId }) => {
1912
- * // ^^^^ Will be Client A
1913
- * if (event.type === "CUSTOM_EVENT") {
1914
- * // Do something
1915
- * }
1916
- * });
1917
- */
1918
- declare const _useEventListener: TypedBundle["useEventListener"];
1919
- /**
1920
- * Returns the presence of the current user of the current room, and a function to update it.
1921
- * It is different from the setState function returned by the useState hook from React.
1922
- * You don't need to pass the full presence object to update it.
1923
- *
1924
- * @example
1925
- * const [myPresence, updateMyPresence] = useMyPresence();
1926
- * updateMyPresence({ x: 0 });
1927
- * updateMyPresence({ y: 0 });
1928
- *
1929
- * // At the next render, "myPresence" will be equal to "{ x: 0, y: 0 }"
1930
- */
1931
- declare const _useMyPresence: TypedBundle["useMyPresence"];
1932
- /**
1933
- * Related to useOthers(), but optimized for selecting only "subsets" of
1934
- * others. This is useful for performance reasons in particular, because
1935
- * selecting only a subset of users also means limiting the number of
1936
- * re-renders that will be triggered.
1937
- *
1938
- * @example
1939
- * const avatars = useOthersMapped(user => user.info.avatar);
1940
- * // ^^^^^^^
1941
- * // { connectionId: number; data: string }[]
1942
- *
1943
- * The selector function you pass to useOthersMapped() is called an "item
1944
- * selector", and operates on a single user at a time. If you provide an
1945
- * (optional) "item comparison" function, it will be used to compare each
1946
- * item pairwise.
1947
- *
1948
- * For example, to select multiple properties:
1949
- *
1950
- * @example
1951
- * const avatarsAndCursors = useOthersMapped(
1952
- * user => [u.info.avatar, u.presence.cursor],
1953
- * shallow, // 👈
1954
- * );
1955
- */
1956
- declare const _useOthersMapped: TypedBundle["useOthersMapped"];
1957
- /**
1958
- * Related to useOthers(), but optimized for selecting only "subsets" of
1959
- * others. This is useful for performance reasons in particular, because
1960
- * selecting only a subset of users also means limiting the number of
1961
- * re-renders that will be triggered.
1962
- *
1963
- * @example
1964
- * const avatars = useOthersMapped(user => user.info.avatar);
1965
- * // ^^^^^^^
1966
- * // { connectionId: number; data: string }[]
1967
- *
1968
- * The selector function you pass to useOthersMapped() is called an "item
1969
- * selector", and operates on a single user at a time. If you provide an
1970
- * (optional) "item comparison" function, it will be used to compare each
1971
- * item pairwise.
1972
- *
1973
- * For example, to select multiple properties:
1974
- *
1975
- * @example
1976
- * const avatarsAndCursors = useOthersMapped(
1977
- * user => [u.info.avatar, u.presence.cursor],
1978
- * shallow, // 👈
1979
- * );
1980
- */
1981
- declare const _useOthersMappedSuspense: TypedBundle["suspense"]["useOthersMapped"];
1982
- /**
1983
- * Returns the threads within the current room.
1984
- *
1985
- * @example
1986
- * const { threads, error, isLoading } = useThreads();
1987
- */
1988
- declare const _useThreads: TypedBundle["useThreads"];
1989
- /**
1990
- * Returns the threads within the current room.
1991
- *
1992
- * @example
1993
- * const { threads } = useThreads();
1994
- */
1995
- declare const _useThreadsSuspense: TypedBundle["suspense"]["useThreads"];
1996
- /**
1997
- * (Private beta) Returns a history of versions of the current room.
1998
- *
1999
- * @example
2000
- * const { versions, error, isLoading } = useHistoryVersions();
2001
- */
2002
- declare const _useHistoryVersions: TypedBundle["useHistoryVersions"];
2003
- /**
2004
- * (Private beta) Returns a history of versions of the current room.
2005
- *
2006
- * @example
2007
- * const { versions } = useHistoryVersions();
2008
- */
2009
- declare const _useHistoryVersionsSuspense: TypedBundle["suspense"]["useHistoryVersions"];
2010
- /**
2011
- * Given a connection ID (as obtained by using `useOthersConnectionIds`), you
2012
- * can call this selector deep down in your component stack to only have the
2013
- * component re-render if properties for this particular user change.
2014
- *
2015
- * @example
2016
- * // Returns only the selected values re-renders whenever that selection changes)
2017
- * const { x, y } = useOther(2, user => user.presence.cursor);
2018
- */
2019
- declare const _useOther: TypedBundle["useOther"];
2020
- /**
2021
- * Returns an array with information about all the users currently connected in
2022
- * the room (except yourself).
2023
- *
2024
- * @example
2025
- * const others = useOthers();
2026
- *
2027
- * // Example to map all cursors in JSX
2028
- * return (
2029
- * <>
2030
- * {others.map((user) => {
2031
- * if (user.presence.cursor == null) {
2032
- * return null;
2033
- * }
2034
- * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
2035
- * })}
2036
- * </>
2037
- * )
2038
- */
2039
- declare function _useOthers(): readonly User<DP, DU>[];
2040
- /**
2041
- * Extract arbitrary data based on all the users currently connected in the
2042
- * room (except yourself).
2043
- *
2044
- * The selector function will get re-evaluated any time a user enters or
2045
- * leaves the room, as well as whenever their presence data changes.
2046
- *
2047
- * The component that uses this hook will automatically re-render if your
2048
- * selector function returns a different value from its previous run.
2049
- *
2050
- * By default `useOthers()` uses strict `===` to check for equality. Take
2051
- * extra care when returning a computed object or list, for example when you
2052
- * return the result of a .map() or .filter() call from the selector. In
2053
- * those cases, you'll probably want to use a `shallow` comparison check.
2054
- *
2055
- * @example
2056
- * const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
2057
- * const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
2058
- * const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
2059
- *
2060
- */
2061
- declare function _useOthers<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
2062
- /**
2063
- * Given a connection ID (as obtained by using `useOthersConnectionIds`), you
2064
- * can call this selector deep down in your component stack to only have the
2065
- * component re-render if properties for this particular user change.
2066
- *
2067
- * @example
2068
- * // Returns only the selected values re-renders whenever that selection changes)
2069
- * const { x, y } = useOther(2, user => user.presence.cursor);
2070
- */
2071
- declare const _useOtherSuspense: TypedBundle["suspense"]["useOther"];
2072
- /**
2073
- * Returns an array with information about all the users currently connected in
2074
- * the room (except yourself).
2075
- *
2076
- * @example
2077
- * const others = useOthers();
2078
- *
2079
- * // Example to map all cursors in JSX
2080
- * return (
2081
- * <>
2082
- * {others.map((user) => {
2083
- * if (user.presence.cursor == null) {
2084
- * return null;
2085
- * }
2086
- * return <Cursor key={user.connectionId} cursor={user.presence.cursor} />
2087
- * })}
2088
- * </>
2089
- * )
2090
- */
2091
- declare function _useOthersSuspense(): readonly User<DP, DU>[];
2092
- /**
2093
- * Extract arbitrary data based on all the users currently connected in the
2094
- * room (except yourself).
2095
- *
2096
- * The selector function will get re-evaluated any time a user enters or
2097
- * leaves the room, as well as whenever their presence data changes.
2098
- *
2099
- * The component that uses this hook will automatically re-render if your
2100
- * selector function returns a different value from its previous run.
2101
- *
2102
- * By default `useOthers()` uses strict `===` to check for equality. Take
2103
- * extra care when returning a computed object or list, for example when you
2104
- * return the result of a .map() or .filter() call from the selector. In
2105
- * those cases, you'll probably want to use a `shallow` comparison check.
2106
- *
2107
- * @example
2108
- * const avatars = useOthers(users => users.map(u => u.info.avatar), shallow);
2109
- * const cursors = useOthers(users => users.map(u => u.presence.cursor), shallow);
2110
- * const someoneIsTyping = useOthers(users => users.some(u => u.presence.isTyping));
2111
- *
2112
- */
2113
- declare function _useOthersSuspense<T>(selector: (others: readonly User<DP, DU>[]) => T, isEqual?: (prev: T, curr: T) => boolean): T;
2114
- /**
2115
- * Extract arbitrary data from the Liveblocks Storage state, using an
2116
- * arbitrary selector function.
2117
- *
2118
- * The selector function will get re-evaluated any time something changes in
2119
- * Storage. The value returned by your selector function will also be the
2120
- * value returned by the hook.
2121
- *
2122
- * The `root` value that gets passed to your selector function is
2123
- * a immutable/readonly version of your Liveblocks storage root.
2124
- *
2125
- * The component that uses this hook will automatically re-render if the
2126
- * returned value changes.
2127
- *
2128
- * By default `useStorage()` uses strict `===` to check for equality. Take
2129
- * extra care when returning a computed object or list, for example when you
2130
- * return the result of a .map() or .filter() call from the selector. In
2131
- * those cases, you'll probably want to use a `shallow` comparison check.
2132
- */
2133
- declare const _useStorage: TypedBundle["useStorage"];
2134
- /**
2135
- * Extract arbitrary data from the Liveblocks Storage state, using an
2136
- * arbitrary selector function.
2137
- *
2138
- * The selector function will get re-evaluated any time something changes in
2139
- * Storage. The value returned by your selector function will also be the
2140
- * value returned by the hook.
2141
- *
2142
- * The `root` value that gets passed to your selector function is
2143
- * a immutable/readonly version of your Liveblocks storage root.
2144
- *
2145
- * The component that uses this hook will automatically re-render if the
2146
- * returned value changes.
2147
- *
2148
- * By default `useStorage()` uses strict `===` to check for equality. Take
2149
- * extra care when returning a computed object or list, for example when you
2150
- * return the result of a .map() or .filter() call from the selector. In
2151
- * those cases, you'll probably want to use a `shallow` comparison check.
2152
- */
2153
- declare const _useStorageSuspense: TypedBundle["suspense"]["useStorage"];
2154
- /**
2155
- * Gets the current user once it is connected to the room.
2156
- *
2157
- * @example
2158
- * const me = useSelf();
2159
- * if (me !== null) {
2160
- * const { x, y } = me.presence.cursor;
2161
- * }
2162
- */
2163
- declare function _useSelf(): User<DP, DU> | null;
2164
- /**
2165
- * Extract arbitrary data based on the current user.
2166
- *
2167
- * The selector function will get re-evaluated any time your presence data
2168
- * changes.
2169
- *
2170
- * The component that uses this hook will automatically re-render if your
2171
- * selector function returns a different value from its previous run.
2172
- *
2173
- * By default `useSelf()` uses strict `===` to check for equality. Take extra
2174
- * care when returning a computed object or list, for example when you return
2175
- * the result of a .map() or .filter() call from the selector. In those
2176
- * cases, you'll probably want to use a `shallow` comparison check.
2177
- *
2178
- * Will return `null` while Liveblocks isn't connected to a room yet.
2179
- *
2180
- * @example
2181
- * const cursor = useSelf(me => me.presence.cursor);
2182
- * if (cursor !== null) {
2183
- * const { x, y } = cursor;
2184
- * }
2185
- *
2186
- */
2187
- declare function _useSelf<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T | null;
2188
- /**
2189
- * Gets the current user once it is connected to the room.
2190
- *
2191
- * @example
2192
- * const me = useSelf();
2193
- * const { x, y } = me.presence.cursor;
2194
- */
2195
- declare function _useSelfSuspense(): User<DP, DU>;
2196
- /**
2197
- * Extract arbitrary data based on the current user.
2198
- *
2199
- * The selector function will get re-evaluated any time your presence data
2200
- * changes.
2201
- *
2202
- * The component that uses this hook will automatically re-render if your
2203
- * selector function returns a different value from its previous run.
2204
- *
2205
- * By default `useSelf()` uses strict `===` to check for equality. Take extra
2206
- * care when returning a computed object or list, for example when you return
2207
- * the result of a .map() or .filter() call from the selector. In those
2208
- * cases, you'll probably want to use a `shallow` comparison check.
2209
- *
2210
- * @example
2211
- * const cursor = useSelf(me => me.presence.cursor);
2212
- * const { x, y } = cursor;
2213
- *
2214
- */
2215
- declare function _useSelfSuspense<T>(selector: (me: User<DP, DU>) => T, isEqual?: (prev: T, curr: T) => boolean): T;
2216
- /**
2217
- * Returns the mutable (!) Storage root. This hook exists for
2218
- * backward-compatible reasons.
2219
- *
2220
- * @example
2221
- * const [root] = useStorageRoot();
2222
- */
2223
- declare const _useStorageRoot: TypedBundle["useStorageRoot"];
2224
- /**
2225
- * useUpdateMyPresence is similar to useMyPresence but it only returns the function to update the current user presence.
2226
- * If you don't use the current user presence in your component, but you need to update it (e.g. live cursor), it's better to use useUpdateMyPresence to avoid unnecessary renders.
2227
- *
2228
- * @example
2229
- * const updateMyPresence = useUpdateMyPresence();
2230
- * updateMyPresence({ x: 0 });
2231
- * updateMyPresence({ y: 0 });
2232
- *
2233
- * // At the next render, the presence of the current user will be equal to "{ x: 0, y: 0 }"
2234
- */
2235
- declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
1520
+ declare const _useUserThreadsSuspense_experimental: TypedBundle["suspense"]["useUserThreads_experimental"];
2236
1521
 
2237
- export { useOthersConnectionIds as $, _useIsInsideRoom as A, useLostConnectionListener as B, ClientSideSuspense as C, useMarkThreadAsRead as D, _useMutation as E, _useMyPresence as F, _useOthersListener as G, useRedo as H, useRemoveReaction as I, _useRoom as J, useRoomNotificationSettings as K, LiveblocksProvider as L, type MutationContext as M, useStatus as N, _useStorageRoot as O, useThreadSubscription as P, useUndo as Q, RoomContext as R, _useUpdateMyPresence as S, useUpdateRoomNotificationSettings as T, type UseStorageStatusOptions as U, useHistoryVersionData as V, useCommentsErrorListener as W, CreateThreadError as X, _useOther as Y, _useOthers as Z, _useInboxNotificationThread as _, type UseThreadsOptions as a, _useOthersMapped as a0, _useSelf as a1, _useStorage as a2, useStorageStatus as a3, _useThreads as a4, useAttachmentUrl as a5, _useHistoryVersions as a6, useInboxNotifications as a7, _useUserThreads_experimental as a8, useRoomInfo as a9, useUnreadInboxNotificationsCount as aa, _useUser as ab, getUmbrellaStoreForClient as ac, selectThreads as ad, _useOtherSuspense as ae, _useOthersSuspense as af, useOthersConnectionIdsSuspense as ag, _useOthersMappedSuspense as ah, _useSelfSuspense as ai, _useStorageSuspense as aj, useStorageStatusSuspense as ak, _useThreadsSuspense as al, useAttachmentUrlSuspense as am, _useHistoryVersionsSuspense as an, useInboxNotificationsSuspense as ao, useRoomInfoSuspense as ap, useUnreadInboxNotificationsCountSuspense as aq, _useUserSuspense as ar, _useUserThreadsSuspense_experimental as as, ClientContext as b, createLiveblocksContext as c, useMarkAllInboxNotificationsAsRead as d, useMarkInboxNotificationAsRead as e, useDeleteAllInboxNotifications as f, useDeleteInboxNotification as g, createRoomContext as h, _RoomProvider as i, _useAddReaction as j, useBatch as k, _useBroadcastEvent as l, useCanRedo as m, useCanUndo as n, useCreateComment as o, _useCreateThread as p, useDeleteComment as q, _useDeleteThread as r, useEditComment as s, _useEditThreadMetadata as t, useClient as u, useMarkThreadAsResolved as v, useMarkThreadAsUnresolved as w, useErrorListener as x, _useEventListener as y, useHistory as z };
1522
+ export { type AttachmentUrlAsyncResult as A, CreateThreadError as C, type DeleteCommentOptions as D, type EditCommentOptions as E, type HistoryVersionDataAsyncResult as H, LiveblocksProvider as L, type MutationContext as M, type RoomNotificationSettingsAsyncResult as R, type StorageStatusSuccess as S, type ThreadSubscription as T, type UseStorageStatusOptions as U, _useInboxNotificationThread as _, type CommentsError as a, type CreateCommentOptions as b, type CommentReactionOptions as c, type RoomContextBundle as d, type UseThreadsOptions as e, ClientContext as f, getUmbrellaStoreForClient as g, createLiveblocksContext as h, useMarkAllInboxNotificationsAsRead as i, useMarkInboxNotificationAsRead as j, useDeleteAllInboxNotifications as k, useDeleteInboxNotification as l, useInboxNotifications as m, _useUserThreads_experimental as n, useRoomInfo as o, useUnreadInboxNotificationsCount as p, _useUser as q, useInboxNotificationsSuspense as r, selectThreads as s, useRoomInfoSuspense as t, useClient as u, useUnreadInboxNotificationsCountSuspense as v, _useUserSuspense as w, _useUserThreadsSuspense_experimental as x };