@liveblocks/react 3.7.1-tiptap3 → 3.8.0-next1
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 +7 -7
- package/dist/_private.d.cts +2 -2
- package/dist/_private.d.ts +2 -2
- package/dist/_private.js +1 -1
- package/dist/{chunk-W2H56LB3.cjs → chunk-45BFK66K.cjs} +101 -46
- package/dist/chunk-45BFK66K.cjs.map +1 -0
- package/dist/{chunk-WGUV4Z4E.js → chunk-GXPZZIB2.js} +73 -18
- package/dist/chunk-GXPZZIB2.js.map +1 -0
- package/dist/{chunk-6ZXBTPII.js → chunk-TMNECRRU.js} +2 -2
- package/dist/{chunk-BKAKZTP4.cjs → chunk-X3KI55GF.cjs} +2 -2
- package/dist/{chunk-BKAKZTP4.cjs.map → chunk-X3KI55GF.cjs.map} +1 -1
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{room-mUz5TTmo.d.cts → room-DSJuooXd.d.cts} +65 -6
- package/dist/{room-mUz5TTmo.d.ts → room-DSJuooXd.d.ts} +65 -6
- package/dist/suspense.cjs +6 -4
- package/dist/suspense.cjs.map +1 -1
- package/dist/suspense.d.cts +1 -1
- package/dist/suspense.d.ts +1 -1
- package/dist/suspense.js +4 -2
- package/dist/suspense.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-W2H56LB3.cjs.map +0 -1
- package/dist/chunk-WGUV4Z4E.js.map +0 -1
- /package/dist/{chunk-6ZXBTPII.js.map → chunk-TMNECRRU.js.map} +0 -0
|
@@ -324,15 +324,12 @@ function autobind(self) {
|
|
|
324
324
|
} while ((obj = Reflect.getPrototypeOf(obj)) && obj !== Object.prototype);
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
// src/ThreadDB.ts
|
|
328
|
-
import { batch, MutableSignal as MutableSignal2, SortedList } from "@liveblocks/core";
|
|
329
|
-
|
|
330
327
|
// src/lib/querying.ts
|
|
331
328
|
import { isStartsWithOperator } from "@liveblocks/core";
|
|
332
329
|
function makeThreadsFilter(query) {
|
|
333
|
-
return (thread) =>
|
|
330
|
+
return (thread) => matchesThreadsQuery(thread, query) && matchesMetadata(thread, query);
|
|
334
331
|
}
|
|
335
|
-
function
|
|
332
|
+
function matchesThreadsQuery(thread, q) {
|
|
336
333
|
return q.resolved === void 0 || thread.resolved === q.resolved;
|
|
337
334
|
}
|
|
338
335
|
function matchesMetadata(thread, q) {
|
|
@@ -354,8 +351,15 @@ function matchesOperator(value, op) {
|
|
|
354
351
|
return value === op;
|
|
355
352
|
}
|
|
356
353
|
}
|
|
354
|
+
function makeInboxNotificationsFilter(query) {
|
|
355
|
+
return (inboxNotification) => matchesInboxNotificationsQuery(inboxNotification, query);
|
|
356
|
+
}
|
|
357
|
+
function matchesInboxNotificationsQuery(inboxNotification, q) {
|
|
358
|
+
return (q.roomId === void 0 || q.roomId === inboxNotification.roomId) && (q.kind === void 0 || q.kind === inboxNotification.kind);
|
|
359
|
+
}
|
|
357
360
|
|
|
358
361
|
// src/ThreadDB.ts
|
|
362
|
+
import { batch, MutableSignal as MutableSignal2, SortedList } from "@liveblocks/core";
|
|
359
363
|
function sanitizeThread(thread) {
|
|
360
364
|
if (thread.deletedAt) {
|
|
361
365
|
if (thread.comments.length > 0) {
|
|
@@ -1087,10 +1091,17 @@ var UmbrellaStore = class {
|
|
|
1087
1091
|
if (result.isLoading || result.error) {
|
|
1088
1092
|
return result;
|
|
1089
1093
|
}
|
|
1094
|
+
const crit = [];
|
|
1095
|
+
if (query !== void 0) {
|
|
1096
|
+
crit.push(makeInboxNotificationsFilter(query));
|
|
1097
|
+
}
|
|
1098
|
+
const inboxNotifications = this.outputs.notifications.get().sortedNotifications.filter(
|
|
1099
|
+
(inboxNotification) => crit.every((pred) => pred(inboxNotification))
|
|
1100
|
+
);
|
|
1090
1101
|
const page = result.data;
|
|
1091
1102
|
return {
|
|
1092
1103
|
isLoading: false,
|
|
1093
|
-
inboxNotifications
|
|
1104
|
+
inboxNotifications,
|
|
1094
1105
|
hasFetchedAll: page.hasFetchedAll,
|
|
1095
1106
|
isFetchingMore: page.isFetchingMore,
|
|
1096
1107
|
fetchMoreError: page.fetchMoreError,
|
|
@@ -2128,7 +2139,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2128
2139
|
const bundle = {
|
|
2129
2140
|
LiveblocksProvider: LiveblocksProvider2,
|
|
2130
2141
|
useInboxNotifications: (options) => useInboxNotifications_withClient(client, identity2, shallow3, options),
|
|
2131
|
-
useUnreadInboxNotificationsCount: () => useUnreadInboxNotificationsCount_withClient(client),
|
|
2142
|
+
useUnreadInboxNotificationsCount: (options) => useUnreadInboxNotificationsCount_withClient(client, options),
|
|
2132
2143
|
useMarkInboxNotificationAsRead: useMarkInboxNotificationAsRead2,
|
|
2133
2144
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
2134
2145
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
@@ -2140,6 +2151,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2140
2151
|
useAiChats,
|
|
2141
2152
|
useAiChat,
|
|
2142
2153
|
useAiChatMessages,
|
|
2154
|
+
useAiChatStatus,
|
|
2143
2155
|
useCreateAiChat,
|
|
2144
2156
|
useDeleteAiChat,
|
|
2145
2157
|
useSendAiMessage,
|
|
@@ -2147,7 +2159,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2147
2159
|
suspense: {
|
|
2148
2160
|
LiveblocksProvider: LiveblocksProvider2,
|
|
2149
2161
|
useInboxNotifications: (options) => useInboxNotificationsSuspense_withClient(client, options),
|
|
2150
|
-
useUnreadInboxNotificationsCount: () => useUnreadInboxNotificationsCountSuspense_withClient(client),
|
|
2162
|
+
useUnreadInboxNotificationsCount: (options) => useUnreadInboxNotificationsCountSuspense_withClient(client, options),
|
|
2151
2163
|
useMarkInboxNotificationAsRead: useMarkInboxNotificationAsRead2,
|
|
2152
2164
|
useMarkAllInboxNotificationsAsRead: useMarkAllInboxNotificationsAsRead2,
|
|
2153
2165
|
useDeleteInboxNotification: useDeleteInboxNotification2,
|
|
@@ -2159,6 +2171,7 @@ function makeLiveblocksContextBundle(client) {
|
|
|
2159
2171
|
useAiChats: useAiChatsSuspense,
|
|
2160
2172
|
useAiChat: useAiChatSuspense,
|
|
2161
2173
|
useAiChatMessages: useAiChatMessagesSuspense,
|
|
2174
|
+
useAiChatStatus,
|
|
2162
2175
|
useCreateAiChat,
|
|
2163
2176
|
useDeleteAiChat,
|
|
2164
2177
|
useSendAiMessage,
|
|
@@ -2211,21 +2224,22 @@ function useInboxNotificationsSuspense_withClient(client, options) {
|
|
|
2211
2224
|
assert(!result.isLoading, "Did not expect loading");
|
|
2212
2225
|
return result;
|
|
2213
2226
|
}
|
|
2214
|
-
function useUnreadInboxNotificationsCount_withClient(client) {
|
|
2227
|
+
function useUnreadInboxNotificationsCount_withClient(client, options) {
|
|
2215
2228
|
return useInboxNotifications_withClient(
|
|
2216
2229
|
client,
|
|
2217
2230
|
selectorFor_useUnreadInboxNotificationsCount,
|
|
2218
|
-
shallow3
|
|
2231
|
+
shallow3,
|
|
2232
|
+
options
|
|
2219
2233
|
);
|
|
2220
2234
|
}
|
|
2221
|
-
function useUnreadInboxNotificationsCountSuspense_withClient(client) {
|
|
2235
|
+
function useUnreadInboxNotificationsCountSuspense_withClient(client, options) {
|
|
2222
2236
|
ensureNotServerSide();
|
|
2223
2237
|
const store = getLiveblocksExtrasForClient(client).store;
|
|
2224
|
-
const queryKey = makeInboxNotificationsQueryKey(
|
|
2238
|
+
const queryKey = makeInboxNotificationsQueryKey(options?.query);
|
|
2225
2239
|
use(
|
|
2226
2240
|
store.outputs.loadingNotifications.getOrCreate(queryKey).waitUntilLoaded()
|
|
2227
2241
|
);
|
|
2228
|
-
const result = useUnreadInboxNotificationsCount_withClient(client);
|
|
2242
|
+
const result = useUnreadInboxNotificationsCount_withClient(client, options);
|
|
2229
2243
|
assert(!result.isLoading, "Did not expect loading");
|
|
2230
2244
|
assert(!result.error, "Did not expect error");
|
|
2231
2245
|
return result;
|
|
@@ -2734,6 +2748,43 @@ function useDeleteAiChat() {
|
|
|
2734
2748
|
[client]
|
|
2735
2749
|
);
|
|
2736
2750
|
}
|
|
2751
|
+
var LOADING = Object.freeze({ status: "loading" });
|
|
2752
|
+
var IDLE = Object.freeze({ status: "idle" });
|
|
2753
|
+
function useAiChatStatus(chatId, branchId) {
|
|
2754
|
+
const client = useClient();
|
|
2755
|
+
const store = getUmbrellaStoreForClient(client);
|
|
2756
|
+
useEnsureAiConnection(client);
|
|
2757
|
+
useEffect4(
|
|
2758
|
+
() => void store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(branchId ?? null).waitUntilLoaded()
|
|
2759
|
+
);
|
|
2760
|
+
return useSignal(
|
|
2761
|
+
// Signal
|
|
2762
|
+
store.outputs.messagesByChatId.getOrCreate(chatId).getOrCreate(branchId ?? null).signal,
|
|
2763
|
+
// Selector
|
|
2764
|
+
(result) => {
|
|
2765
|
+
if (result.isLoading) return LOADING;
|
|
2766
|
+
if (result.error) return IDLE;
|
|
2767
|
+
const messages = result.messages;
|
|
2768
|
+
const lastMessage = messages[messages.length - 1];
|
|
2769
|
+
if (lastMessage?.role !== "assistant") return IDLE;
|
|
2770
|
+
if (lastMessage.status !== "generating" && lastMessage.status !== "awaiting-tool")
|
|
2771
|
+
return IDLE;
|
|
2772
|
+
const contentSoFar = lastMessage.contentSoFar;
|
|
2773
|
+
const lastPart = contentSoFar[contentSoFar.length - 1];
|
|
2774
|
+
if (lastPart?.type === "tool-invocation") {
|
|
2775
|
+
return {
|
|
2776
|
+
status: "generating",
|
|
2777
|
+
partType: "tool-invocation",
|
|
2778
|
+
toolName: lastPart.name
|
|
2779
|
+
};
|
|
2780
|
+
} else {
|
|
2781
|
+
return { status: "generating", partType: lastPart?.type };
|
|
2782
|
+
}
|
|
2783
|
+
},
|
|
2784
|
+
// Consider { status: "generating", partType: "text" } and { status: "generating", partType: "text" } equal
|
|
2785
|
+
shallow3
|
|
2786
|
+
);
|
|
2787
|
+
}
|
|
2737
2788
|
function useSendAiMessage(chatId, options) {
|
|
2738
2789
|
const client = useClient();
|
|
2739
2790
|
return useCallback2(
|
|
@@ -2947,11 +2998,14 @@ function useDeleteAllInboxNotifications() {
|
|
|
2947
2998
|
function useDeleteInboxNotification() {
|
|
2948
2999
|
return useDeleteInboxNotification_withClient(useClient());
|
|
2949
3000
|
}
|
|
2950
|
-
function useUnreadInboxNotificationsCount() {
|
|
2951
|
-
return useUnreadInboxNotificationsCount_withClient(useClient());
|
|
3001
|
+
function useUnreadInboxNotificationsCount(options) {
|
|
3002
|
+
return useUnreadInboxNotificationsCount_withClient(useClient(), options);
|
|
2952
3003
|
}
|
|
2953
|
-
function useUnreadInboxNotificationsCountSuspense() {
|
|
2954
|
-
return useUnreadInboxNotificationsCountSuspense_withClient(
|
|
3004
|
+
function useUnreadInboxNotificationsCountSuspense(options) {
|
|
3005
|
+
return useUnreadInboxNotificationsCountSuspense_withClient(
|
|
3006
|
+
useClient(),
|
|
3007
|
+
options
|
|
3008
|
+
);
|
|
2955
3009
|
}
|
|
2956
3010
|
function useNotificationSettings() {
|
|
2957
3011
|
return useNotificationSettings_withClient(useClient());
|
|
@@ -4677,6 +4731,7 @@ export {
|
|
|
4677
4731
|
getUmbrellaStoreForClient,
|
|
4678
4732
|
useCreateAiChat,
|
|
4679
4733
|
useDeleteAiChat,
|
|
4734
|
+
useAiChatStatus,
|
|
4680
4735
|
useSendAiMessage,
|
|
4681
4736
|
LiveblocksProvider,
|
|
4682
4737
|
createLiveblocksContext,
|
|
@@ -4783,4 +4838,4 @@ export {
|
|
|
4783
4838
|
_useStorageRoot,
|
|
4784
4839
|
_useUpdateMyPresence
|
|
4785
4840
|
};
|
|
4786
|
-
//# sourceMappingURL=chunk-
|
|
4841
|
+
//# sourceMappingURL=chunk-GXPZZIB2.js.map
|