@liveblocks/react 2.19.0 → 2.21.0-emails1

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/_private.cjs CHANGED
@@ -23,8 +23,7 @@
23
23
 
24
24
 
25
25
 
26
-
27
- var _chunkEUXIW5LVcjs = require('./chunk-EUXIW5LV.cjs');
26
+ var _chunkC337YEKBcjs = require('./chunk-C337YEKB.cjs');
28
27
 
29
28
  // src/lib/use-layout-effect.ts
30
29
  var _react = require('react');
@@ -37,8 +36,8 @@ var MENTION_SUGGESTIONS_DEBOUNCE = 500;
37
36
  function useMentionSuggestions(roomId, search) {
38
37
  const [mentionSuggestions, setMentionSuggestions] = _react.useState.call(void 0, );
39
38
  const lastInvokedAt = _react.useRef.call(void 0, );
40
- const resolveMentionSuggestions = _chunkEUXIW5LVcjs.useResolveMentionSuggestions.call(void 0, );
41
- const mentionSuggestionsCache = _chunkEUXIW5LVcjs.useMentionSuggestionsCache.call(void 0, );
39
+ const resolveMentionSuggestions = _chunkC337YEKBcjs.useResolveMentionSuggestions.call(void 0, );
40
+ const mentionSuggestionsCache = _chunkC337YEKBcjs.useMentionSuggestionsCache.call(void 0, );
42
41
  _react.useEffect.call(void 0, () => {
43
42
  if (search === void 0 || !resolveMentionSuggestions) {
44
43
  return;
@@ -89,7 +88,7 @@ function useMentionSuggestions(roomId, search) {
89
88
 
90
89
 
91
90
  function useSyncSource() {
92
- const client = _chunkEUXIW5LVcjs.useClient.call(void 0, );
91
+ const client = _chunkC337YEKBcjs.useClient.call(void 0, );
93
92
  const createSyncSource = client[_core.kInternal].createSyncSource;
94
93
  const [syncSource, setSyncSource] = _react.useState.call(void 0, );
95
94
  _react.useEffect.call(void 0, () => {
@@ -126,6 +125,5 @@ function useSyncSource() {
126
125
 
127
126
 
128
127
 
129
-
130
- exports.getUmbrellaStoreForClient = _chunkEUXIW5LVcjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkEUXIW5LVcjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkEUXIW5LVcjs.useClientOrNull; exports.useCreateRoomComment = _chunkEUXIW5LVcjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkEUXIW5LVcjs.useCreateRoomThread; exports.useCreateTextMention = _chunkEUXIW5LVcjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkEUXIW5LVcjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkEUXIW5LVcjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkEUXIW5LVcjs.useDeleteTextMention; exports.useEditRoomComment = _chunkEUXIW5LVcjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkEUXIW5LVcjs.useEditRoomThreadMetadata; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkEUXIW5LVcjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkEUXIW5LVcjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkEUXIW5LVcjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkEUXIW5LVcjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkEUXIW5LVcjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkEUXIW5LVcjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkEUXIW5LVcjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkEUXIW5LVcjs.useRoomAttachmentUrl; exports.useRoomOrNull = _chunkEUXIW5LVcjs.useRoomOrNull; exports.useRoomPermissions = _chunkEUXIW5LVcjs.useRoomPermissions; exports.useSignal = _chunkEUXIW5LVcjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkEUXIW5LVcjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkEUXIW5LVcjs.useYjsProvider;
128
+ exports.getUmbrellaStoreForClient = _chunkC337YEKBcjs.getUmbrellaStoreForClient; exports.useAddRoomCommentReaction = _chunkC337YEKBcjs.useAddRoomCommentReaction; exports.useClientOrNull = _chunkC337YEKBcjs.useClientOrNull; exports.useCreateRoomComment = _chunkC337YEKBcjs.useCreateRoomComment; exports.useCreateRoomThread = _chunkC337YEKBcjs.useCreateRoomThread; exports.useCreateTextMention = _chunkC337YEKBcjs.useCreateTextMention; exports.useDeleteRoomComment = _chunkC337YEKBcjs.useDeleteRoomComment; exports.useDeleteRoomThread = _chunkC337YEKBcjs.useDeleteRoomThread; exports.useDeleteTextMention = _chunkC337YEKBcjs.useDeleteTextMention; exports.useEditRoomComment = _chunkC337YEKBcjs.useEditRoomComment; exports.useEditRoomThreadMetadata = _chunkC337YEKBcjs.useEditRoomThreadMetadata; exports.useLayoutEffect = useLayoutEffect; exports.useMarkRoomThreadAsRead = _chunkC337YEKBcjs.useMarkRoomThreadAsRead; exports.useMarkRoomThreadAsResolved = _chunkC337YEKBcjs.useMarkRoomThreadAsResolved; exports.useMarkRoomThreadAsUnresolved = _chunkC337YEKBcjs.useMarkRoomThreadAsUnresolved; exports.useMentionSuggestions = useMentionSuggestions; exports.useMentionSuggestionsCache = _chunkC337YEKBcjs.useMentionSuggestionsCache; exports.useRemoveRoomCommentReaction = _chunkC337YEKBcjs.useRemoveRoomCommentReaction; exports.useReportTextEditor = _chunkC337YEKBcjs.useReportTextEditor; exports.useResolveMentionSuggestions = _chunkC337YEKBcjs.useResolveMentionSuggestions; exports.useRoomAttachmentUrl = _chunkC337YEKBcjs.useRoomAttachmentUrl; exports.useRoomPermissions = _chunkC337YEKBcjs.useRoomPermissions; exports.useSignal = _chunkC337YEKBcjs.useSignal; exports.useSyncExternalStoreWithSelector = _chunkC337YEKBcjs.useSyncExternalStoreWithSelector; exports.useSyncSource = useSyncSource; exports.useYjsProvider = _chunkC337YEKBcjs.useYjsProvider;
131
129
  //# sourceMappingURL=_private.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/_private.cjs","../src/lib/use-layout-effect.ts","../src/use-mention-suggestions.ts","../src/use-sync-source.ts"],"names":["useEffect","mentionSuggestions","useState"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;AC1BA,8BAAsE;AAI/D,IAAM,gBAAA,EACX,OAAO,OAAA,IAAW,YAAA,EAAc,uBAAA,EAA0B,gBAAA;ADwB5D;AACA;AEhCA,wCAAgC;AAChC;AAOA,IAAM,6BAAA,EAA+B,GAAA;AAQ9B,SAAS,qBAAA,CAAsB,MAAA,EAAgB,MAAA,EAAiB;AACrE,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,EAAA,EAAI,6BAAA,CAAmB;AACvE,EAAA,MAAM,cAAA,EAAgB,2BAAA,CAAe;AAErC,EAAA,MAAM,0BAAA,EAA4B,4DAAA,CAA6B;AAC/D,EAAA,MAAM,wBAAA,EAA0B,0DAAA,CAA2B;AAE3D,EAAAA,8BAAAA,CAAU,EAAA,GAAM;AACd,IAAA,GAAA,CAAI,OAAA,IAAW,KAAA,EAAA,GAAa,CAAC,yBAAA,EAA2B;AACtD,MAAA,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,8BAAA,EAAgC,EAAE,IAAA,EAAM,MAAA,EAAQ,OAAO,CAAA;AAC7D,IAAA,MAAM,2BAAA,EAA6B,mCAAA;AAAA,MACjC;AAAA,IACF,CAAA;AACA,IAAA,IAAI,eAAA;AACJ,IAAA,IAAI,WAAA,EAAa,KAAA;AAEjB,IAAA,MAAM,sBAAA,EAAwB,MAAA,CAAA,EAAA,GAAY;AACxC,MAAA,IAAI;AACF,QAAA,aAAA,CAAc,QAAA,EAAU,WAAA,CAAY,GAAA,CAAI,CAAA;AACxC,QAAA,MAAMC,oBAAAA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EAAS,yCAAA,CAAU;AACzB,EAAA,MAAM,iBAAA,EAAmB,MAAA,CAAO,eAAS,CAAA,CAAE,gBAAA;AAC3C,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,EAAA,EAAIC,6BAAAA,CAAiC;AAErE,EAAAF,8BAAAA,CAAU,EAAA,GAAM;AAEd,IAAA,MAAM,cAAA,EAAgB,gBAAA,CAAiB,CAAA;AACvC,IAAA,aAAA,CAAc,aAAa,CAAA;AAC3B,IAAA,OAAO,CAAA,EAAA,GAAM,aAAA,CAAc,OAAA,CAAQ,CAAA;AAAA,EACrC,CAAA,EAAG,CAAC,gBAAgB,CAAC,CAAA;AAErB,EAAA,OAAO,UAAA;AACT;AH+EA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,g3DAAC","file":"/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/_private.cjs","sourcesContent":[null,"/* eslint-disable no-restricted-syntax */\n\nimport { useEffect, useLayoutEffect as useOriginalLayoutEffect } from \"react\";\n\n// On React 18.2.0 and earlier, useLayoutEffect triggers a warning when\n// executed on the server, so this workaround should be used instead.\nexport const useLayoutEffect =\n typeof window !== \"undefined\" ? useOriginalLayoutEffect : useEffect;\n","import { stableStringify } from \"@liveblocks/core\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n useMentionSuggestionsCache,\n useResolveMentionSuggestions,\n} from \"./room\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(roomId: string, search?: string) {\n const [mentionSuggestions, setMentionSuggestions] = useState<string[]>();\n const lastInvokedAt = useRef<number>();\n\n const resolveMentionSuggestions = useResolveMentionSuggestions();\n const mentionSuggestionsCache = useMentionSuggestionsCache();\n\n useEffect(() => {\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId };\n const mentionSuggestionsCacheKey = stableStringify(\n resolveMentionSuggestionsArgs\n );\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [search, roomId, resolveMentionSuggestions, mentionSuggestionsCache]);\n\n return mentionSuggestions;\n}\n","import type { SyncSource } from \"@liveblocks/core\";\nimport { kInternal } from \"@liveblocks/core\";\nimport { useEffect, useState } from \"react\";\n\nimport { useClient } from \"./liveblocks\";\n\n/**\n * @private For internal use only. Do not rely on this hook.\n */\nexport function useSyncSource(): SyncSource | undefined {\n const client = useClient();\n const createSyncSource = client[kInternal].createSyncSource;\n const [syncSource, setSyncSource] = useState<SyncSource | undefined>();\n\n useEffect(() => {\n // Create new sync source on mount\n const newSyncSource = createSyncSource();\n setSyncSource(newSyncSource);\n return () => newSyncSource.destroy();\n }, [createSyncSource]);\n\n return syncSource;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/_private.cjs","../src/lib/use-layout-effect.ts","../src/use-mention-suggestions.ts","../src/use-sync-source.ts"],"names":["useEffect","mentionSuggestions","useState"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACzBA,8BAAsE;AAI/D,IAAM,gBAAA,EACX,OAAO,OAAA,IAAW,YAAA,EAAc,uBAAA,EAA0B,gBAAA;ADuB5D;AACA;AE/BA,wCAAgC;AAChC;AAOA,IAAM,6BAAA,EAA+B,GAAA;AAQ9B,SAAS,qBAAA,CAAsB,MAAA,EAAgB,MAAA,EAAiB;AACrE,EAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,EAAA,EAAI,6BAAA,CAAmB;AACvE,EAAA,MAAM,cAAA,EAAgB,2BAAA,CAAe;AAErC,EAAA,MAAM,0BAAA,EAA4B,4DAAA,CAA6B;AAC/D,EAAA,MAAM,wBAAA,EAA0B,0DAAA,CAA2B;AAE3D,EAAAA,8BAAAA,CAAU,EAAA,GAAM;AACd,IAAA,GAAA,CAAI,OAAA,IAAW,KAAA,EAAA,GAAa,CAAC,yBAAA,EAA2B;AACtD,MAAA,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,8BAAA,EAAgC,EAAE,IAAA,EAAM,MAAA,EAAQ,OAAO,CAAA;AAC7D,IAAA,MAAM,2BAAA,EAA6B,mCAAA;AAAA,MACjC;AAAA,IACF,CAAA;AACA,IAAA,IAAI,eAAA;AACJ,IAAA,IAAI,WAAA,EAAa,KAAA;AAEjB,IAAA,MAAM,sBAAA,EAAwB,MAAA,CAAA,EAAA,G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AAA;AAEvE,EAAA,OAAO,kBAAA;AACT;AFIA;AACA;AGrFA;AACA;AAOO,SAAS,aAAA,CAAA,EAAwC;AACtD,EAAA,MAAM,OAAA,EAAS,yCAAA,CAAU;AACzB,EAAA,MAAM,iBAAA,EAAmB,MAAA,CAAO,eAAS,CAAA,CAAE,gBAAA;AAC3C,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,EAAA,EAAIC,6BAAAA,CAAiC;AAErE,EAAAF,8BAAAA,CAAU,EAAA,GAAM;AAEd,IAAA,MAAM,cAAA,EAAgB,gBAAA,CAAiB,CAAA;AACvC,IAAA,aAAA,CAAc,aAAa,CAAA;AAC3B,IAAA,OAAO,CAAA,EAAA,GAAM,aAAA,CAAc,OAAA,CAAQ,CAAA;AAAA,EACrC,CAAA,EAAG,CAAC,gBAAgB,CAAC,CAAA;AAErB,EAAA,OAAO,UAAA;AACT;AH8EA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,uzDAAC","file":"/home/runner/work/liveblocks/liveblocks/packages/liveblocks-react/dist/_private.cjs","sourcesContent":[null,"/* eslint-disable no-restricted-syntax */\n\nimport { useEffect, useLayoutEffect as useOriginalLayoutEffect } from \"react\";\n\n// On React 18.2.0 and earlier, useLayoutEffect triggers a warning when\n// executed on the server, so this workaround should be used instead.\nexport const useLayoutEffect =\n typeof window !== \"undefined\" ? useOriginalLayoutEffect : useEffect;\n","import { stableStringify } from \"@liveblocks/core\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n useMentionSuggestionsCache,\n useResolveMentionSuggestions,\n} from \"./room\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(roomId: string, search?: string) {\n const [mentionSuggestions, setMentionSuggestions] = useState<string[]>();\n const lastInvokedAt = useRef<number>();\n\n const resolveMentionSuggestions = useResolveMentionSuggestions();\n const mentionSuggestionsCache = useMentionSuggestionsCache();\n\n useEffect(() => {\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId };\n const mentionSuggestionsCacheKey = stableStringify(\n resolveMentionSuggestionsArgs\n );\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [search, roomId, resolveMentionSuggestions, mentionSuggestionsCache]);\n\n return mentionSuggestions;\n}\n","import type { SyncSource } from \"@liveblocks/core\";\nimport { kInternal } from \"@liveblocks/core\";\nimport { useEffect, useState } from \"react\";\n\nimport { useClient } from \"./liveblocks\";\n\n/**\n * @private For internal use only. Do not rely on this hook.\n */\nexport function useSyncSource(): SyncSource | undefined {\n const client = useClient();\n const createSyncSource = client[kInternal].createSyncSource;\n const [syncSource, setSyncSource] = useState<SyncSource | undefined>();\n\n useEffect(() => {\n // Create new sync source on mount\n const newSyncSource = createSyncSource();\n setSyncSource(newSyncSource);\n return () => newSyncSource.destroy();\n }, [createSyncSource]);\n\n return syncSource;\n}\n"]}
@@ -1,8 +1,8 @@
1
- export { g as getUmbrellaStoreForClient, b as useAddRoomCommentReaction, a as useClientOrNull, c as useCreateRoomComment, d as useCreateRoomThread, e as useCreateTextMention, f as useDeleteRoomComment, h as useDeleteRoomThread, i as useDeleteTextMention, j as useEditRoomComment, k as useEditRoomThreadMetadata, l as useMarkRoomThreadAsRead, m as useMarkRoomThreadAsResolved, n as useMarkRoomThreadAsUnresolved, o as useMentionSuggestionsCache, p as useRemoveRoomCommentReaction, q as useReportTextEditor, r as useResolveMentionSuggestions, s as useRoomAttachmentUrl, u as useRoomOrNull, t as useRoomPermissions, v as useYjsProvider } from './room-Bf3S78LF.cjs';
2
1
  import { useLayoutEffect as useLayoutEffect$1 } from 'react';
2
+ export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useYjsProvider } from './room-CqmA66N2.cjs';
3
3
  import { ISignal, SyncSource } from '@liveblocks/core';
4
- import '@liveblocks/client';
5
4
  import 'react/jsx-runtime';
5
+ import '@liveblocks/client';
6
6
 
7
7
  declare const useLayoutEffect: typeof useLayoutEffect$1;
8
8
 
@@ -1,8 +1,8 @@
1
- export { g as getUmbrellaStoreForClient, b as useAddRoomCommentReaction, a as useClientOrNull, c as useCreateRoomComment, d as useCreateRoomThread, e as useCreateTextMention, f as useDeleteRoomComment, h as useDeleteRoomThread, i as useDeleteTextMention, j as useEditRoomComment, k as useEditRoomThreadMetadata, l as useMarkRoomThreadAsRead, m as useMarkRoomThreadAsResolved, n as useMarkRoomThreadAsUnresolved, o as useMentionSuggestionsCache, p as useRemoveRoomCommentReaction, q as useReportTextEditor, r as useResolveMentionSuggestions, s as useRoomAttachmentUrl, u as useRoomOrNull, t as useRoomPermissions, v as useYjsProvider } from './room-Bf3S78LF.js';
2
1
  import { useLayoutEffect as useLayoutEffect$1 } from 'react';
2
+ export { g as getUmbrellaStoreForClient, a as useAddRoomCommentReaction, u as useClientOrNull, b as useCreateRoomComment, c as useCreateRoomThread, d as useCreateTextMention, e as useDeleteRoomComment, f as useDeleteRoomThread, h as useDeleteTextMention, i as useEditRoomComment, j as useEditRoomThreadMetadata, k as useMarkRoomThreadAsRead, l as useMarkRoomThreadAsResolved, m as useMarkRoomThreadAsUnresolved, n as useMentionSuggestionsCache, o as useRemoveRoomCommentReaction, p as useReportTextEditor, q as useResolveMentionSuggestions, r as useRoomAttachmentUrl, s as useRoomPermissions, t as useYjsProvider } from './room-CqmA66N2.js';
3
3
  import { ISignal, SyncSource } from '@liveblocks/core';
4
- import '@liveblocks/client';
5
4
  import 'react/jsx-runtime';
5
+ import '@liveblocks/client';
6
6
 
7
7
  declare const useLayoutEffect: typeof useLayoutEffect$1;
8
8
 
package/dist/_private.js CHANGED
@@ -19,12 +19,11 @@ import {
19
19
  useReportTextEditor,
20
20
  useResolveMentionSuggestions,
21
21
  useRoomAttachmentUrl,
22
- useRoomOrNull,
23
22
  useRoomPermissions,
24
23
  useSignal,
25
24
  useSyncExternalStoreWithSelector,
26
25
  useYjsProvider
27
- } from "./chunk-5RVW253W.js";
26
+ } from "./chunk-URVBSXYW.js";
28
27
 
29
28
  // src/lib/use-layout-effect.ts
30
29
  import { useEffect, useLayoutEffect as useOriginalLayoutEffect } from "react";
@@ -121,7 +120,6 @@ export {
121
120
  useReportTextEditor,
122
121
  useResolveMentionSuggestions,
123
122
  useRoomAttachmentUrl,
124
- useRoomOrNull,
125
123
  useRoomPermissions,
126
124
  useSignal,
127
125
  useSyncExternalStoreWithSelector,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/use-layout-effect.ts","../src/use-mention-suggestions.ts","../src/use-sync-source.ts"],"sourcesContent":["/* eslint-disable no-restricted-syntax */\n\nimport { useEffect, useLayoutEffect as useOriginalLayoutEffect } from \"react\";\n\n// On React 18.2.0 and earlier, useLayoutEffect triggers a warning when\n// executed on the server, so this workaround should be used instead.\nexport const useLayoutEffect =\n typeof window !== \"undefined\" ? useOriginalLayoutEffect : useEffect;\n","import { stableStringify } from \"@liveblocks/core\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n useMentionSuggestionsCache,\n useResolveMentionSuggestions,\n} from \"./room\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(roomId: string, search?: string) {\n const [mentionSuggestions, setMentionSuggestions] = useState<string[]>();\n const lastInvokedAt = useRef<number>();\n\n const resolveMentionSuggestions = useResolveMentionSuggestions();\n const mentionSuggestionsCache = useMentionSuggestionsCache();\n\n useEffect(() => {\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId };\n const mentionSuggestionsCacheKey = stableStringify(\n resolveMentionSuggestionsArgs\n );\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [search, roomId, resolveMentionSuggestions, mentionSuggestionsCache]);\n\n return mentionSuggestions;\n}\n","import type { SyncSource } from \"@liveblocks/core\";\nimport { kInternal } from \"@liveblocks/core\";\nimport { useEffect, useState } from \"react\";\n\nimport { useClient } from \"./liveblocks\";\n\n/**\n * @private For internal use only. Do not rely on this hook.\n */\nexport function useSyncSource(): SyncSource | undefined {\n const client = useClient();\n const createSyncSource = client[kInternal].createSyncSource;\n const [syncSource, setSyncSource] = useState<SyncSource | undefined>();\n\n useEffect(() => {\n // Create new sync source on mount\n const newSyncSource = createSyncSource();\n setSyncSource(newSyncSource);\n return () => newSyncSource.destroy();\n }, [createSyncSource]);\n\n return syncSource;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,WAAW,mBAAmB,+BAA+B;AAI/D,IAAM,kBACX,OAAO,WAAW,cAAc,0BAA0B;;;ACP5D,SAAS,uBAAuB;AAChC,SAAS,aAAAA,YAAW,QAAQ,gBAAgB;AAO5C,IAAM,+BAA+B;AAQ9B,SAAS,sBAAsB,QAAgB,QAAiB;AACrE,QAAM,CAAC,oBAAoB,qBAAqB,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AY,aAAa,IAAIC,UAAiC;AAErE,EAAAC,WAAU,MAAM;AAEd,UAAM,gBAAgB,iBAAiB;AACvC,kBAAc,aAAa;AAC3B,WAAO,MAAM,cAAc,QAAQ;AAAA,EACrC,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO;AACT;","names":["useEffect","useEffect","mentionSuggestions","useEffect","useState","useState","useEffect"]}
1
+ {"version":3,"sources":["../src/lib/use-layout-effect.ts","../src/use-mention-suggestions.ts","../src/use-sync-source.ts"],"sourcesContent":["/* eslint-disable no-restricted-syntax */\n\nimport { useEffect, useLayoutEffect as useOriginalLayoutEffect } from \"react\";\n\n// On React 18.2.0 and earlier, useLayoutEffect triggers a warning when\n// executed on the server, so this workaround should be used instead.\nexport const useLayoutEffect =\n typeof window !== \"undefined\" ? useOriginalLayoutEffect : useEffect;\n","import { stableStringify } from \"@liveblocks/core\";\nimport { useEffect, useRef, useState } from \"react\";\n\nimport {\n useMentionSuggestionsCache,\n useResolveMentionSuggestions,\n} from \"./room\";\n\nconst MENTION_SUGGESTIONS_DEBOUNCE = 500;\n\n/**\n * @private For internal use only. Do not rely on this hook.\n *\n * Simplistic debounced search, we don't need to worry too much about deduping\n * and race conditions as there can only be one search at a time.\n */\nexport function useMentionSuggestions(roomId: string, search?: string) {\n const [mentionSuggestions, setMentionSuggestions] = useState<string[]>();\n const lastInvokedAt = useRef<number>();\n\n const resolveMentionSuggestions = useResolveMentionSuggestions();\n const mentionSuggestionsCache = useMentionSuggestionsCache();\n\n useEffect(() => {\n if (search === undefined || !resolveMentionSuggestions) {\n return;\n }\n\n const resolveMentionSuggestionsArgs = { text: search, roomId };\n const mentionSuggestionsCacheKey = stableStringify(\n resolveMentionSuggestionsArgs\n );\n let debounceTimeout: number | undefined;\n let isCanceled = false;\n\n const getMentionSuggestions = async () => {\n try {\n lastInvokedAt.current = performance.now();\n const mentionSuggestions = await resolveMentionSuggestions(\n resolveMentionSuggestionsArgs\n );\n\n if (!isCanceled) {\n setMentionSuggestions(mentionSuggestions);\n mentionSuggestionsCache.set(\n mentionSuggestionsCacheKey,\n mentionSuggestions\n );\n }\n } catch (error) {\n console.error((error as Error)?.message);\n }\n };\n\n if (mentionSuggestionsCache.has(mentionSuggestionsCacheKey)) {\n // If there are already cached mention suggestions, use them immediately.\n setMentionSuggestions(\n mentionSuggestionsCache.get(mentionSuggestionsCacheKey)\n );\n } else if (\n !lastInvokedAt.current ||\n Math.abs(performance.now() - lastInvokedAt.current) >\n MENTION_SUGGESTIONS_DEBOUNCE\n ) {\n // If on the debounce's leading edge (either because it's the first invokation or enough\n // time has passed since the last debounce), get mention suggestions immediately.\n void getMentionSuggestions();\n } else {\n // Otherwise, wait for the debounce delay.\n debounceTimeout = window.setTimeout(() => {\n void getMentionSuggestions();\n }, MENTION_SUGGESTIONS_DEBOUNCE);\n }\n\n return () => {\n isCanceled = true;\n window.clearTimeout(debounceTimeout);\n };\n }, [search, roomId, resolveMentionSuggestions, mentionSuggestionsCache]);\n\n return mentionSuggestions;\n}\n","import type { SyncSource } from \"@liveblocks/core\";\nimport { kInternal } from \"@liveblocks/core\";\nimport { useEffect, useState } from \"react\";\n\nimport { useClient } from \"./liveblocks\";\n\n/**\n * @private For internal use only. Do not rely on this hook.\n */\nexport function useSyncSource(): SyncSource | undefined {\n const client = useClient();\n const createSyncSource = client[kInternal].createSyncSource;\n const [syncSource, setSyncSource] = useState<SyncSource | undefined>();\n\n useEffect(() => {\n // Create new sync source on mount\n const newSyncSource = createSyncSource();\n setSyncSource(newSyncSource);\n return () => newSyncSource.destroy();\n }, [createSyncSource]);\n\n return syncSource;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,WAAW,mBAAmB,+BAA+B;AAI/D,IAAM,kBACX,OAAO,WAAW,cAAc,0BAA0B;;;ACP5D,SAAS,uBAAuB;AAChC,SAAS,aAAAA,YAAW,QAAQ,gBAAgB;AAO5C,IAAM,+BAA+B;AAQ9B,SAAS,sBAAsB,QAAgB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mB,OAAO,SAAS,EAAE;AAC3C,QAAM,CAAC,YAAY,aAAa,IAAIC,UAAiC;AAErE,EAAAC,WAAU,MAAM;AAEd,UAAM,gBAAgB,iBAAiB;AACvC,kBAAc,aAAa;AAC3B,WAAO,MAAM,cAAc,QAAQ;AAAA,EACrC,GAAG,CAAC,gBAAgB,CAAC;AAErB,SAAO;AACT;","names":["useEffect","useEffect","mentionSuggestions","useEffect","useState","useState","useEffect"]}
@@ -258,7 +258,7 @@ function autobind(self) {
258
258
  for (const key of Reflect.ownKeys(obj)) {
259
259
  if (seen.has(key)) continue;
260
260
  const descriptor = Reflect.getOwnPropertyDescriptor(obj, key);
261
- if (typeof _optionalChain([descriptor, 'optionalAccess', _2 => _2.value]) === "function") {
261
+ if (typeof _optionalChain([descriptor, 'optionalAccess', _ => _.value]) === "function") {
262
262
  seen.add(key);
263
263
  self[key] = self[key].bind(self);
264
264
  }
@@ -358,7 +358,7 @@ var ThreadDB = class _ThreadDB {
358
358
  /** Returns an existing thread by ID. Will never return a deleted thread. */
359
359
  get(threadId) {
360
360
  const thread = this.getEvenIfDeleted(threadId);
361
- return _optionalChain([thread, 'optionalAccess', _3 => _3.deletedAt]) ? void 0 : thread;
361
+ return _optionalChain([thread, 'optionalAccess', _2 => _2.deletedAt]) ? void 0 : thread;
362
362
  }
363
363
  /** Returns the (possibly deleted) thread by ID. */
364
364
  getEvenIfDeleted(threadId) {
@@ -484,7 +484,7 @@ var PaginatedResource = class {
484
484
  }
485
485
  async #fetchMore() {
486
486
  const state = this.#signal.get();
487
- if (!_optionalChain([state, 'access', _4 => _4.data, 'optionalAccess', _5 => _5.cursor]) || state.data.isFetchingMore) {
487
+ if (!_optionalChain([state, 'access', _3 => _3.data, 'optionalAccess', _4 => _4.cursor]) || state.data.isFetchingMore) {
488
488
  return;
489
489
  }
490
490
  this.#patch({ isFetchingMore: true });
@@ -505,7 +505,7 @@ var PaginatedResource = class {
505
505
  }
506
506
  fetchMore() {
507
507
  const state = this.#signal.get();
508
- if (!_optionalChain([state, 'access', _6 => _6.data, 'optionalAccess', _7 => _7.cursor])) return noop2;
508
+ if (!_optionalChain([state, 'access', _5 => _5.data, 'optionalAccess', _6 => _6.cursor])) return noop2;
509
509
  if (!this.#pendingFetchMore) {
510
510
  this.#pendingFetchMore = this.#fetchMore().finally(() => {
511
511
  this.#pendingFetchMore = null;
@@ -731,14 +731,11 @@ function createStore_forPermissionHints() {
731
731
  };
732
732
  }
733
733
  function createStore_forUserNotificationSettings(updates) {
734
- const signal = new (0, _core.Signal)({});
734
+ const signal = new (0, _core.Signal)(
735
+ _core.createUserNotificationSettings.call(void 0, {})
736
+ );
735
737
  function update(settings) {
736
- signal.set((prevSettings) => {
737
- return {
738
- ...prevSettings,
739
- ...settings
740
- };
741
- });
738
+ signal.set(settings);
742
739
  }
743
740
  return {
744
741
  signal: _core.DerivedSignal.from(
@@ -1499,32 +1496,14 @@ function applyOptimisticUpdates_forSettings(settingsLUT, optimisticUpdates) {
1499
1496
  }
1500
1497
  return settingsByRoomId;
1501
1498
  }
1502
- function applyOptimisticUpdates_forUserNotificationSettings(baseSettings, optimisticUpdates) {
1503
- const outcomingSettings = { ...baseSettings };
1504
- for (const optimisticUpdate of optimisticUpdates) {
1505
- switch (optimisticUpdate.type) {
1506
- case "update-user-notification-settings": {
1507
- const incomingSettings = optimisticUpdate.settings;
1508
- for (const channelKey of _core.keys.call(void 0, incomingSettings)) {
1509
- const key = channelKey;
1510
- const channelUpdates = incomingSettings[key];
1511
- if (channelUpdates) {
1512
- const realChannelUpdates = Object.fromEntries(
1513
- _core.entries.call(void 0, channelUpdates).filter(
1514
- ([_, value]) => value !== void 0
1515
- )
1516
- );
1517
- outcomingSettings[key] = {
1518
- ...outcomingSettings[key],
1519
- ...realChannelUpdates
1520
- };
1521
- }
1522
- }
1523
- break;
1524
- }
1499
+ function applyOptimisticUpdates_forUserNotificationSettings(settings, optimisticUpdates) {
1500
+ let outcoming = settings;
1501
+ for (const update of optimisticUpdates) {
1502
+ if (update.type === "update-user-notification-settings") {
1503
+ outcoming = _core.patchUserNotificationSettings.call(void 0, outcoming, update.settings);
1525
1504
  }
1526
1505
  }
1527
- return outcomingSettings;
1506
+ return outcoming;
1528
1507
  }
1529
1508
  function compareInboxNotifications(inboxNotificationA, inboxNotificationB) {
1530
1509
  if (inboxNotificationA.notifiedAt > inboxNotificationB.notifiedAt) {
@@ -1575,7 +1554,7 @@ function applyUpsertComment(thread, comment) {
1575
1554
  updatedAt: new Date(
1576
1555
  Math.max(
1577
1556
  thread.updatedAt.getTime(),
1578
- _optionalChain([comment, 'access', _8 => _8.editedAt, 'optionalAccess', _9 => _9.getTime, 'call', _10 => _10()]) || comment.createdAt.getTime()
1557
+ _optionalChain([comment, 'access', _7 => _7.editedAt, 'optionalAccess', _8 => _8.getTime, 'call', _9 => _9()]) || comment.createdAt.getTime()
1579
1558
  )
1580
1559
  ),
1581
1560
  comments: updatedComments
@@ -1734,7 +1713,7 @@ function selectorFor_useUnreadInboxNotificationsCount(result) {
1734
1713
  );
1735
1714
  }
1736
1715
  function selectorFor_useUser(state, userId) {
1737
- if (state === void 0 || _optionalChain([state, 'optionalAccess', _11 => _11.isLoading])) {
1716
+ if (state === void 0 || _optionalChain([state, 'optionalAccess', _10 => _10.isLoading])) {
1738
1717
  return _nullishCoalesce(state, () => ( { isLoading: true }));
1739
1718
  }
1740
1719
  if (state.error) {
@@ -1752,7 +1731,7 @@ function selectorFor_useUser(state, userId) {
1752
1731
  };
1753
1732
  }
1754
1733
  function selectorFor_useRoomInfo(state, roomId) {
1755
- if (state === void 0 || _optionalChain([state, 'optionalAccess', _12 => _12.isLoading])) {
1734
+ if (state === void 0 || _optionalChain([state, 'optionalAccess', _11 => _11.isLoading])) {
1756
1735
  return _nullishCoalesce(state, () => ( { isLoading: true }));
1757
1736
  }
1758
1737
  if (state.error) {
@@ -2079,7 +2058,7 @@ function useUpdateNotificationSettings_withClient(client) {
2079
2058
  store.optimisticUpdates.remove(optimisticUpdateId);
2080
2059
  if (err instanceof _core.HttpError) {
2081
2060
  if (err.status === 422) {
2082
- const msg = [_optionalChain([err, 'access', _13 => _13.details, 'optionalAccess', _14 => _14.error]), _optionalChain([err, 'access', _15 => _15.details, 'optionalAccess', _16 => _16.reason])].filter(Boolean).join("\n");
2061
+ const msg = [_optionalChain([err, 'access', _12 => _12.details, 'optionalAccess', _13 => _13.error]), _optionalChain([err, 'access', _14 => _14.details, 'optionalAccess', _15 => _15.reason])].filter(Boolean).join("\n");
2083
2062
  console.error(msg);
2084
2063
  }
2085
2064
  client[_core.kInternal].emitError(
@@ -2275,7 +2254,7 @@ function createSharedContext(client) {
2275
2254
  }
2276
2255
  function useEnsureNoLiveblocksProvider(options) {
2277
2256
  const existing = useClientOrNull();
2278
- if (!_optionalChain([options, 'optionalAccess', _17 => _17.allowNesting]) && existing !== null) {
2257
+ if (!_optionalChain([options, 'optionalAccess', _16 => _16.allowNesting]) && existing !== null) {
2279
2258
  throw new Error(
2280
2259
  "You cannot nest multiple LiveblocksProvider instances in the same React tree."
2281
2260
  );
@@ -2420,7 +2399,7 @@ var _useUserSuspense = useUserSuspense;
2420
2399
  var _useUserThreads_experimental = useUserThreads_experimental;
2421
2400
  var _useUserThreadsSuspense_experimental = useUserThreadsSuspense_experimental;
2422
2401
  function useSyncStatus_withClient(client, options) {
2423
- const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _18 => _18.smooth]), () => ( false)));
2402
+ const smooth = useInitial(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _17 => _17.smooth]), () => ( false)));
2424
2403
  if (smooth) {
2425
2404
  return useSyncStatusSmooth_withClient(client);
2426
2405
  } else {
@@ -2598,8 +2577,8 @@ function makeRoomExtrasForClient(client) {
2598
2577
  if (innerError.status === 403) {
2599
2578
  const detailedMessage = [
2600
2579
  innerError.message,
2601
- _optionalChain([innerError, 'access', _19 => _19.details, 'optionalAccess', _20 => _20.suggestion]),
2602
- _optionalChain([innerError, 'access', _21 => _21.details, 'optionalAccess', _22 => _22.docs])
2580
+ _optionalChain([innerError, 'access', _18 => _18.details, 'optionalAccess', _19 => _19.suggestion]),
2581
+ _optionalChain([innerError, 'access', _20 => _20.details, 'optionalAccess', _21 => _21.docs])
2603
2582
  ].filter(Boolean).join("\n");
2604
2583
  _core.console.error(detailedMessage);
2605
2584
  }
@@ -2876,9 +2855,9 @@ function RoomProviderInner(props) {
2876
2855
  }, [roomId, frozenProps, stableEnterRoom]);
2877
2856
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RoomContext.Provider, { value: room, children: props.children });
2878
2857
  }
2879
- function useRoom() {
2858
+ function useRoom(options) {
2880
2859
  const room = useRoomOrNull();
2881
- if (room === null) {
2860
+ if (room === null && !_optionalChain([options, 'optionalAccess', _22 => _22.allowOutsideRoom])) {
2882
2861
  throw new Error("RoomProvider is missing from the React tree.");
2883
2862
  }
2884
2863
  return room;
@@ -4132,6 +4111,5 @@ var _useUpdateMyPresence = useUpdateMyPresence;
4132
4111
 
4133
4112
 
4134
4113
 
4135
-
4136
- exports.RoomContext = RoomContext; exports.useRoomOrNull = useRoomOrNull; exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; exports.useSignal = useSignal; exports.ClientContext = ClientContext; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; exports.LiveblocksProvider = LiveblocksProvider; exports.createLiveblocksContext = createLiveblocksContext; exports.useInboxNotifications = useInboxNotifications; exports.useInboxNotificationsSuspense = useInboxNotificationsSuspense; exports.useMarkAllInboxNotificationsAsRead = useMarkAllInboxNotificationsAsRead; exports.useMarkInboxNotificationAsRead = useMarkInboxNotificationAsRead; exports.useDeleteAllInboxNotifications = useDeleteAllInboxNotifications; exports.useDeleteInboxNotification = useDeleteInboxNotification; exports.useUnreadInboxNotificationsCount = useUnreadInboxNotificationsCount; exports.useUnreadInboxNotificationsCountSuspense = useUnreadInboxNotificationsCountSuspense; exports.useNotificationSettings = useNotificationSettings; exports.useNotificationSettingsSuspense = useNotificationSettingsSuspense; exports.useUpdateNotificationSettings = useUpdateNotificationSettings; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports.useSyncStatus = useSyncStatus; exports.useErrorListener = useErrorListener; exports.useStatus = useStatus; exports.useReportTextEditor = useReportTextEditor; exports.useYjsProvider = useYjsProvider; exports.useCreateTextMention = useCreateTextMention; exports.useDeleteTextMention = useDeleteTextMention; exports.useResolveMentionSuggestions = useResolveMentionSuggestions; exports.useMentionSuggestionsCache = useMentionSuggestionsCache; exports.useStorageStatus = useStorageStatus; exports.useBatch = useBatch; exports.useLostConnectionListener = useLostConnectionListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCreateRoomThread = useCreateRoomThread; exports.useDeleteRoomThread = useDeleteRoomThread; exports.useEditRoomThreadMetadata = useEditRoomThreadMetadata; exports.useCreateComment = useCreateComment; exports.useCreateRoomComment = useCreateRoomComment; exports.useEditComment = useEditComment; exports.useEditRoomComment = useEditRoomComment; exports.useDeleteComment = useDeleteComment; exports.useDeleteRoomComment = useDeleteRoomComment; exports.useAddRoomCommentReaction = useAddRoomCommentReaction; exports.useRemoveReaction = useRemoveReaction; exports.useRemoveRoomCommentReaction = useRemoveRoomCommentReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkRoomThreadAsRead = useMarkRoomThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkRoomThreadAsResolved = useMarkRoomThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useMarkRoomThreadAsUnresolved = useMarkRoomThreadAsUnresolved; exports.useThreadSubscription = useThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useStorageStatusSuspense = useStorageStatusSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useRoomAttachmentUrl = useRoomAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.useRoomPermissions = useRoomPermissions; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useThreadsSuspense = _useThreadsSuspense; exports._useRoomNotificationSettings = _useRoomNotificationSettings; exports._useRoomNotificationSettingsSuspense = _useRoomNotificationSettingsSuspense; exports._useHistoryVersions = _useHistoryVersions; exports._useHistoryVersionsSuspense = _useHistoryVersionsSuspense; exports._useOther = _useOther; exports._useOthers = _useOthers; exports._useOtherSuspense = _useOtherSuspense; exports._useOthersSuspense = _useOthersSuspense; exports._useStorage = _useStorage; exports._useStorageSuspense = _useStorageSuspense; exports._useSelf = _useSelf; exports._useSelfSuspense = _useSelfSuspense; exports._useStorageRoot = _useStorageRoot; exports._useUpdateMyPresence = _useUpdateMyPresence;
4137
- //# sourceMappingURL=chunk-EUXIW5LV.cjs.map
4114
+ exports.RoomContext = RoomContext; exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; exports.useSignal = useSignal; exports.ClientContext = ClientContext; exports.getUmbrellaStoreForClient = getUmbrellaStoreForClient; exports.useClientOrNull = useClientOrNull; exports.useClient = useClient; exports.LiveblocksProvider = LiveblocksProvider; exports.createLiveblocksContext = createLiveblocksContext; exports.useInboxNotifications = useInboxNotifications; exports.useInboxNotificationsSuspense = useInboxNotificationsSuspense; exports.useMarkAllInboxNotificationsAsRead = useMarkAllInboxNotificationsAsRead; exports.useMarkInboxNotificationAsRead = useMarkInboxNotificationAsRead; exports.useDeleteAllInboxNotifications = useDeleteAllInboxNotifications; exports.useDeleteInboxNotification = useDeleteInboxNotification; exports.useUnreadInboxNotificationsCount = useUnreadInboxNotificationsCount; exports.useUnreadInboxNotificationsCountSuspense = useUnreadInboxNotificationsCountSuspense; exports.useNotificationSettings = useNotificationSettings; exports.useNotificationSettingsSuspense = useNotificationSettingsSuspense; exports.useUpdateNotificationSettings = useUpdateNotificationSettings; exports.useRoomInfo = useRoomInfo; exports.useRoomInfoSuspense = useRoomInfoSuspense; exports._useInboxNotificationThread = _useInboxNotificationThread; exports._useUser = _useUser; exports._useUserSuspense = _useUserSuspense; exports._useUserThreads_experimental = _useUserThreads_experimental; exports._useUserThreadsSuspense_experimental = _useUserThreadsSuspense_experimental; exports.useSyncStatus = useSyncStatus; exports.useErrorListener = useErrorListener; exports.useStatus = useStatus; exports.useReportTextEditor = useReportTextEditor; exports.useYjsProvider = useYjsProvider; exports.useCreateTextMention = useCreateTextMention; exports.useDeleteTextMention = useDeleteTextMention; exports.useResolveMentionSuggestions = useResolveMentionSuggestions; exports.useMentionSuggestionsCache = useMentionSuggestionsCache; exports.useStorageStatus = useStorageStatus; exports.useBatch = useBatch; exports.useLostConnectionListener = useLostConnectionListener; exports.useHistory = useHistory; exports.useUndo = useUndo; exports.useRedo = useRedo; exports.useCanUndo = useCanUndo; exports.useCanRedo = useCanRedo; exports.useOthersConnectionIds = useOthersConnectionIds; exports.useCreateRoomThread = useCreateRoomThread; exports.useDeleteRoomThread = useDeleteRoomThread; exports.useEditRoomThreadMetadata = useEditRoomThreadMetadata; exports.useCreateComment = useCreateComment; exports.useCreateRoomComment = useCreateRoomComment; exports.useEditComment = useEditComment; exports.useEditRoomComment = useEditRoomComment; exports.useDeleteComment = useDeleteComment; exports.useDeleteRoomComment = useDeleteRoomComment; exports.useAddRoomCommentReaction = useAddRoomCommentReaction; exports.useRemoveReaction = useRemoveReaction; exports.useRemoveRoomCommentReaction = useRemoveRoomCommentReaction; exports.useMarkThreadAsRead = useMarkThreadAsRead; exports.useMarkRoomThreadAsRead = useMarkRoomThreadAsRead; exports.useMarkThreadAsResolved = useMarkThreadAsResolved; exports.useMarkRoomThreadAsResolved = useMarkRoomThreadAsResolved; exports.useMarkThreadAsUnresolved = useMarkThreadAsUnresolved; exports.useMarkRoomThreadAsUnresolved = useMarkRoomThreadAsUnresolved; exports.useThreadSubscription = useThreadSubscription; exports.useHistoryVersionData = useHistoryVersionData; exports.useUpdateRoomNotificationSettings = useUpdateRoomNotificationSettings; exports.useOthersConnectionIdsSuspense = useOthersConnectionIdsSuspense; exports.useStorageStatusSuspense = useStorageStatusSuspense; exports.useAttachmentUrl = useAttachmentUrl; exports.useRoomAttachmentUrl = useRoomAttachmentUrl; exports.useAttachmentUrlSuspense = useAttachmentUrlSuspense; exports.useRoomPermissions = useRoomPermissions; exports.createRoomContext = createRoomContext; exports._RoomProvider = _RoomProvider; exports._useBroadcastEvent = _useBroadcastEvent; exports._useOthersListener = _useOthersListener; exports._useRoom = _useRoom; exports._useIsInsideRoom = _useIsInsideRoom; exports._useAddReaction = _useAddReaction; exports._useMutation = _useMutation; exports._useCreateThread = _useCreateThread; exports._useDeleteThread = _useDeleteThread; exports._useEditThreadMetadata = _useEditThreadMetadata; exports._useEventListener = _useEventListener; exports._useMyPresence = _useMyPresence; exports._useOthersMapped = _useOthersMapped; exports._useOthersMappedSuspense = _useOthersMappedSuspense; exports._useThreads = _useThreads; exports._useThreadsSuspense = _useThreadsSuspense; exports._useRoomNotificationSettings = _useRoomNotificationSettings; exports._useRoomNotificationSettingsSuspense = _useRoomNotificationSettingsSuspense; exports._useHistoryVersions = _useHistoryVersions; exports._useHistoryVersionsSuspense = _useHistoryVersionsSuspense; exports._useOther = _useOther; exports._useOthers = _useOthers; exports._useOtherSuspense = _useOtherSuspense; exports._useOthersSuspense = _useOthersSuspense; exports._useStorage = _useStorage; exports._useStorageSuspense = _useStorageSuspense; exports._useSelf = _useSelf; exports._useSelfSuspense = _useSelfSuspense; exports._useStorageRoot = _useStorageRoot; exports._useUpdateMyPresence = _useUpdateMyPresence;
4115
+ //# sourceMappingURL=chunk-C337YEKB.cjs.map