@liveblocks/react 2.12.1-emails1 → 2.12.1-test2

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