@arbidocs/react 0.4.130 → 0.4.131

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.
Files changed (37) hide show
  1. package/dist/artifacts/index.cjs +47 -46
  2. package/dist/artifacts/index.cjs.map +1 -1
  3. package/dist/artifacts/index.js +4 -2
  4. package/dist/artifacts/index.js.map +1 -1
  5. package/dist/{chunk-ZWFMFOGP.cjs → chunk-5DCRIWCA.cjs} +2 -68
  6. package/dist/chunk-5DCRIWCA.cjs.map +1 -0
  7. package/dist/{chunk-PPRKQK4P.js → chunk-6AWF4HFU.js} +11 -16
  8. package/dist/chunk-6AWF4HFU.js.map +1 -0
  9. package/dist/chunk-74UTKIWQ.js +62 -0
  10. package/dist/chunk-74UTKIWQ.js.map +1 -0
  11. package/dist/{chunk-6PPWZILQ.cjs → chunk-BOJHNPNJ.cjs} +11 -16
  12. package/dist/chunk-BOJHNPNJ.cjs.map +1 -0
  13. package/dist/{chunk-NNWMHMEC.js → chunk-G6FHNURH.js} +3 -60
  14. package/dist/chunk-G6FHNURH.js.map +1 -0
  15. package/dist/chunk-NUFEZBA5.cjs +72 -0
  16. package/dist/chunk-NUFEZBA5.cjs.map +1 -0
  17. package/dist/document-tools/index.cjs +5 -4
  18. package/dist/document-tools/index.cjs.map +1 -1
  19. package/dist/document-tools/index.js +2 -1
  20. package/dist/document-tools/index.js.map +1 -1
  21. package/dist/{index-D8NvRj3J.d.cts → index-C7OqcKY3.d.cts} +7 -16
  22. package/dist/{index-D8NvRj3J.d.ts → index-C7OqcKY3.d.ts} +7 -16
  23. package/dist/index.cjs +40 -125
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +18 -102
  26. package/dist/index.d.ts +18 -102
  27. package/dist/index.js +22 -101
  28. package/dist/index.js.map +1 -1
  29. package/dist/shell/index.cjs +6 -10
  30. package/dist/shell/index.d.cts +1 -1
  31. package/dist/shell/index.d.ts +1 -1
  32. package/dist/shell/index.js +1 -1
  33. package/package.json +3 -3
  34. package/dist/chunk-6PPWZILQ.cjs.map +0 -1
  35. package/dist/chunk-NNWMHMEC.js.map +0 -1
  36. package/dist/chunk-PPRKQK4P.js.map +0 -1
  37. package/dist/chunk-ZWFMFOGP.cjs.map +0 -1
@@ -27,28 +27,19 @@ interface AppNotification {
27
27
  source?: string;
28
28
  }
29
29
  interface NotifyOptions {
30
- /** Shown under the title in the toast; a string description is also recorded in the centre. */
31
- description?: ReactNode;
30
+ description?: string;
32
31
  /** Also record a persistent notification-centre entry (default true). */
33
32
  record?: boolean;
34
- /** Pop the transient toast (default true). False records the centre entry only, e.g. while
35
- * the user has muted toasts: the centre is the history they come back to. */
36
- toast?: boolean;
37
- /** Centre title for a rich (non-string) toast title. Default: the string title, else
38
- * "Notification". */
39
- recordTitle?: string;
40
33
  href?: string;
41
34
  duration?: number;
42
- /** A toast action button (sonner). Clicking the centre entry runs it too. */
35
+ /** A toast action button (sonner). */
43
36
  action?: {
44
37
  label: ReactNode;
45
38
  onClick: () => void;
46
39
  };
47
40
  /** Override the toast glyph (sonner). */
48
41
  icon?: ReactNode;
49
- /** Extra class on the toast (sonner). */
50
- className?: string;
51
- /** Record as routine session activity (see {@link AppNotification.ambient}): born read. */
42
+ /** Record as routine session activity (see {@link AppNotification.ambient}). */
52
43
  ambient?: boolean;
53
44
  }
54
45
  interface NotifyState {
@@ -69,10 +60,10 @@ interface NotifyState {
69
60
  }
70
61
  declare const useNotify: zustand.UseBoundStore<zustand.StoreApi<NotifyState>>;
71
62
  declare const notify: {
72
- success: (title: ReactNode, opts?: NotifyOptions) => string;
73
- error: (title: ReactNode, opts?: NotifyOptions) => string;
74
- info: (title: ReactNode, opts?: NotifyOptions) => string;
75
- warning: (title: ReactNode, opts?: NotifyOptions) => string;
63
+ success: (title: string, opts?: NotifyOptions) => string;
64
+ error: (title: string, opts?: NotifyOptions) => string;
65
+ info: (title: string, opts?: NotifyOptions) => string;
66
+ warning: (title: string, opts?: NotifyOptions) => string;
76
67
  };
77
68
  /** Replace the notification centre's history — inject a seed/initial set. */
78
69
  declare function seedNotifications(items: AppNotification[]): void;
package/dist/index.cjs CHANGED
@@ -2,9 +2,8 @@
2
2
 
3
3
  var chunkUN3AZUXX_cjs = require('./chunk-UN3AZUXX.cjs');
4
4
  var chunkS7J5SCTZ_cjs = require('./chunk-S7J5SCTZ.cjs');
5
- var chunkZWFMFOGP_cjs = require('./chunk-ZWFMFOGP.cjs');
6
- require('./chunk-VOFNX4P6.cjs');
7
- var chunk6PPWZILQ_cjs = require('./chunk-6PPWZILQ.cjs');
5
+ var chunk5DCRIWCA_cjs = require('./chunk-5DCRIWCA.cjs');
6
+ var chunkBOJHNPNJ_cjs = require('./chunk-BOJHNPNJ.cjs');
8
7
  var chunk65WT5PHA_cjs = require('./chunk-65WT5PHA.cjs');
9
8
  var chunkOC7F5SNA_cjs = require('./chunk-OC7F5SNA.cjs');
10
9
  var chunkWYZJLZ67_cjs = require('./chunk-WYZJLZ67.cjs');
@@ -5224,7 +5223,7 @@ function ConversationList({
5224
5223
  children: c.subtitle ?? preview
5225
5224
  }
5226
5225
  ),
5227
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: lastMessage ? chunk6PPWZILQ_cjs.formatRelativeTime(lastMessage.createdAt) : "" })
5226
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xs text-muted-foreground", children: lastMessage ? chunkBOJHNPNJ_cjs.formatRelativeTime(lastMessage.createdAt) : "" })
5228
5227
  ] })
5229
5228
  ] })
5230
5229
  ] });
@@ -5308,7 +5307,7 @@ function MessageBubble({
5308
5307
  isLastOfRun,
5309
5308
  senderName: message.isMine ? "You" : userDisplayName(message.sender),
5310
5309
  classNames,
5311
- formatTimestamp: chunk6PPWZILQ_cjs.formatRelativeTime
5310
+ formatTimestamp: chunkBOJHNPNJ_cjs.formatRelativeTime
5312
5311
  }
5313
5312
  );
5314
5313
  }
@@ -6175,89 +6174,12 @@ function CommandPaletteProvider({
6175
6174
  /* @__PURE__ */ jsxRuntime.jsx(CommandPalette, { open: isOpen, onOpenChange: setIsOpen, ...paletteProps })
6176
6175
  ] });
6177
6176
  }
6178
-
6179
- // src/session/store.ts
6180
- var EMPTY_SESSION_STATE = {
6181
- workspaceId: null,
6182
- conversationId: null,
6183
- viewingDocument: null,
6184
- selectedDocumentIds: [],
6185
- generating: {},
6186
- paMode: false,
6187
- conversationDocuments: {}
6188
- };
6189
- var selectViewingDocumentId = (state) => state.viewingDocument ? chunkZWFMFOGP_cjs.parseVersionRef(state.viewingDocument.id).docId : null;
6190
- var selectIsGenerating = (conversationId) => (state) => !!conversationId && !!state.generating[conversationId]?.isGenerating;
6191
- function nextViewingDocument(current, input) {
6192
- if (!input) return null;
6193
- const same = current?.id === input.id;
6194
- return {
6195
- id: input.id,
6196
- page: input.page !== void 0 ? input.page : same ? current?.page ?? null : null,
6197
- passageId: input.passageId !== void 0 ? input.passageId : current?.passageId ?? null
6198
- };
6199
- }
6200
- function createArbiSessionStore(initial = {}) {
6201
- let state = { ...EMPTY_SESSION_STATE, ...initial };
6202
- const listeners = /* @__PURE__ */ new Set();
6203
- const update = (patch) => {
6204
- state = { ...state, ...patch };
6205
- listeners.forEach((listener) => listener());
6206
- };
6207
- return {
6208
- getState: () => state,
6209
- subscribe: (listener) => {
6210
- listeners.add(listener);
6211
- return () => listeners.delete(listener);
6212
- },
6213
- setWorkspaceId: (workspaceId) => {
6214
- if (state.workspaceId !== workspaceId) update({ workspaceId });
6215
- },
6216
- setConversationId: (conversationId) => {
6217
- if (state.conversationId !== conversationId) update({ conversationId });
6218
- },
6219
- setViewingDocument: (input) => update({ viewingDocument: nextViewingDocument(state.viewingDocument, input) }),
6220
- setSelectedDocumentIds: (ids) => update({ selectedDocumentIds: ids }),
6221
- setConversationGenerating: (conversationId, isGenerating) => {
6222
- const current = state.generating[conversationId];
6223
- update({
6224
- generating: {
6225
- ...state.generating,
6226
- [conversationId]: {
6227
- isGenerating,
6228
- error: isGenerating ? null : current?.error ?? null,
6229
- startTime: isGenerating ? Date.now() : null
6230
- }
6231
- }
6232
- });
6233
- },
6234
- setPaMode: (paMode) => {
6235
- if (state.paMode !== paMode) update({ paMode });
6236
- },
6237
- setConversationDocuments: (conversationId, documents) => update({
6238
- conversationDocuments: { ...state.conversationDocuments, [conversationId]: documents }
6239
- })
6240
- };
6241
- }
6242
- var ArbiSessionStoreContext = React.createContext(null);
6243
- var moduleDefault = null;
6244
- var defaultStore = () => moduleDefault ??= createArbiSessionStore();
6245
- function ArbiSessionStateProvider({
6246
- store,
6247
- children
6248
- }) {
6249
- const enclosing = React.useContext(ArbiSessionStoreContext);
6250
- const [own] = React.useState(createArbiSessionStore);
6251
- return /* @__PURE__ */ jsxRuntime.jsx(ArbiSessionStoreContext.Provider, { value: store ?? enclosing ?? own, children });
6252
- }
6253
- function useArbiSessionStore() {
6254
- return React.useContext(ArbiSessionStoreContext) ?? defaultStore();
6255
- }
6256
- function useArbiSessionState(selector) {
6257
- const store = useArbiSessionStore();
6258
- const select = () => selector(store.getState());
6259
- return React.useSyncExternalStore(store.subscribe, select, select);
6260
- }
6177
+ var useArbiUiStore = zustand.create((set) => ({
6178
+ selectedDocIds: [],
6179
+ setSelectedDocIds: (ids) => set({ selectedDocIds: ids }),
6180
+ viewingDocId: null,
6181
+ setViewingDocId: (id) => set({ viewingDocId: id })
6182
+ }));
6261
6183
  agGridCommunity.ModuleRegistry.registerModules([agGridCommunity.AllCommunityModule]);
6262
6184
  function formatBytes(bytes) {
6263
6185
  if (bytes == null || Number.isNaN(bytes)) return "\u2014";
@@ -6302,19 +6224,19 @@ function DocumentTable({
6302
6224
  }
6303
6225
  return map;
6304
6226
  }, [tagsQuery.data]);
6305
- const session = useArbiSessionStore();
6306
- const storeSelected = useArbiSessionState((s) => s.selectedDocumentIds);
6307
- const storeSetSelected = session.setSelectedDocumentIds;
6308
- const viewingDocId = useArbiSessionState(selectViewingDocumentId);
6227
+ const storeSelected = useArbiUiStore((s) => s.selectedDocIds);
6228
+ const storeSetSelected = useArbiUiStore((s) => s.setSelectedDocIds);
6229
+ const viewingDocId = useArbiUiStore((s) => s.viewingDocId);
6230
+ const setViewingDocId = useArbiUiStore((s) => s.setViewingDocId);
6309
6231
  const effectiveSelected = selectedIds ?? storeSelected;
6310
6232
  const emitSelection = onSelectionChange ?? storeSetSelected;
6311
6233
  const gridApiRef = React__default.default.useRef(null);
6312
6234
  const openDocument = React__default.default.useCallback(
6313
6235
  (id) => {
6314
- session.setViewingDocument({ id });
6236
+ setViewingDocId(id);
6315
6237
  onOpenDocument?.(id);
6316
6238
  },
6317
- [onOpenDocument, session]
6239
+ [onOpenDocument, setViewingDocId]
6318
6240
  );
6319
6241
  const applySelection = React__default.default.useCallback(() => {
6320
6242
  const api = gridApiRef.current;
@@ -6591,10 +6513,10 @@ function DocumentGallery({
6591
6513
  );
6592
6514
  const thumbsQuery = chunkUN3AZUXX_cjs.useThumbnails(docIds);
6593
6515
  const thumbs = thumbsQuery.data ?? {};
6594
- const session = useArbiSessionStore();
6595
- const storeSelected = useArbiSessionState((s) => s.selectedDocumentIds);
6596
- const storeSetSelected = session.setSelectedDocumentIds;
6597
- const viewingDocId = useArbiSessionState(selectViewingDocumentId);
6516
+ const storeSelected = useArbiUiStore((s) => s.selectedDocIds);
6517
+ const storeSetSelected = useArbiUiStore((s) => s.setSelectedDocIds);
6518
+ const viewingDocId = useArbiUiStore((s) => s.viewingDocId);
6519
+ const setViewingDocId = useArbiUiStore((s) => s.setViewingDocId);
6598
6520
  const effectiveSelected = selectedIds ?? storeSelected;
6599
6521
  const emitSelection = onSelectionChange ?? storeSetSelected;
6600
6522
  const selectedSet = React__default.default.useMemo(() => new Set(effectiveSelected), [effectiveSelected]);
@@ -6609,10 +6531,10 @@ function DocumentGallery({
6609
6531
  );
6610
6532
  const openDocument = React__default.default.useCallback(
6611
6533
  (id) => {
6612
- session.setViewingDocument({ id });
6534
+ setViewingDocId(id);
6613
6535
  onOpenDocument?.(id);
6614
6536
  },
6615
- [onOpenDocument, session]
6537
+ [onOpenDocument, setViewingDocId]
6616
6538
  );
6617
6539
  const arbi = chunkXIDDXD5Y_cjs.useArbi();
6618
6540
  const queryClient = reactQuery.useQueryClient();
@@ -7355,71 +7277,71 @@ Object.defineProperty(exports, "useWorkspaces", {
7355
7277
  });
7356
7278
  Object.defineProperty(exports, "cleanDraftMarkdown", {
7357
7279
  enumerable: true,
7358
- get: function () { return chunkZWFMFOGP_cjs.cleanDraftMarkdown; }
7280
+ get: function () { return chunk5DCRIWCA_cjs.cleanDraftMarkdown; }
7359
7281
  });
7360
7282
  Object.defineProperty(exports, "cleanDraftWithReport", {
7361
7283
  enumerable: true,
7362
- get: function () { return chunkZWFMFOGP_cjs.cleanDraftWithReport; }
7284
+ get: function () { return chunk5DCRIWCA_cjs.cleanDraftWithReport; }
7363
7285
  });
7364
7286
  Object.defineProperty(exports, "promoteBoldTitle", {
7365
7287
  enumerable: true,
7366
- get: function () { return chunkZWFMFOGP_cjs.promoteBoldTitle; }
7288
+ get: function () { return chunk5DCRIWCA_cjs.promoteBoldTitle; }
7367
7289
  });
7368
7290
  Object.defineProperty(exports, "repairParsedStructure", {
7369
7291
  enumerable: true,
7370
- get: function () { return chunkZWFMFOGP_cjs.repairParsedStructure; }
7292
+ get: function () { return chunk5DCRIWCA_cjs.repairParsedStructure; }
7371
7293
  });
7372
7294
  Object.defineProperty(exports, "repairParsedTitle", {
7373
7295
  enumerable: true,
7374
- get: function () { return chunkZWFMFOGP_cjs.repairParsedTitle; }
7296
+ get: function () { return chunk5DCRIWCA_cjs.repairParsedTitle; }
7375
7297
  });
7376
7298
  Object.defineProperty(exports, "stripAgentPreamble", {
7377
7299
  enumerable: true,
7378
- get: function () { return chunkZWFMFOGP_cjs.stripAgentPreamble; }
7300
+ get: function () { return chunk5DCRIWCA_cjs.stripAgentPreamble; }
7379
7301
  });
7380
7302
  Object.defineProperty(exports, "unescapeMarkdown", {
7381
7303
  enumerable: true,
7382
- get: function () { return chunkZWFMFOGP_cjs.unescapeMarkdown; }
7304
+ get: function () { return chunk5DCRIWCA_cjs.unescapeMarkdown; }
7383
7305
  });
7384
7306
  Object.defineProperty(exports, "unwrapCitationLinks", {
7385
7307
  enumerable: true,
7386
- get: function () { return chunkZWFMFOGP_cjs.unwrapCitationLinks; }
7308
+ get: function () { return chunk5DCRIWCA_cjs.unwrapCitationLinks; }
7387
7309
  });
7388
7310
  Object.defineProperty(exports, "DEFAULT_NOTIFY_TONE", {
7389
7311
  enumerable: true,
7390
- get: function () { return chunk6PPWZILQ_cjs.DEFAULT_NOTIFY_TONE; }
7312
+ get: function () { return chunkBOJHNPNJ_cjs.DEFAULT_NOTIFY_TONE; }
7391
7313
  });
7392
7314
  Object.defineProperty(exports, "NotificationBell", {
7393
7315
  enumerable: true,
7394
- get: function () { return chunk6PPWZILQ_cjs.NotificationBell; }
7316
+ get: function () { return chunkBOJHNPNJ_cjs.NotificationBell; }
7395
7317
  });
7396
7318
  Object.defineProperty(exports, "Toaster", {
7397
7319
  enumerable: true,
7398
- get: function () { return chunk6PPWZILQ_cjs.Toaster; }
7320
+ get: function () { return chunkBOJHNPNJ_cjs.Toaster; }
7399
7321
  });
7400
7322
  Object.defineProperty(exports, "formatRelativeTime", {
7401
7323
  enumerable: true,
7402
- get: function () { return chunk6PPWZILQ_cjs.formatRelativeTime; }
7324
+ get: function () { return chunkBOJHNPNJ_cjs.formatRelativeTime; }
7403
7325
  });
7404
7326
  Object.defineProperty(exports, "notify", {
7405
7327
  enumerable: true,
7406
- get: function () { return chunk6PPWZILQ_cjs.notify; }
7328
+ get: function () { return chunkBOJHNPNJ_cjs.notify; }
7407
7329
  });
7408
7330
  Object.defineProperty(exports, "seedNotifications", {
7409
7331
  enumerable: true,
7410
- get: function () { return chunk6PPWZILQ_cjs.seedNotifications; }
7332
+ get: function () { return chunkBOJHNPNJ_cjs.seedNotifications; }
7411
7333
  });
7412
7334
  Object.defineProperty(exports, "selectUnread", {
7413
7335
  enumerable: true,
7414
- get: function () { return chunk6PPWZILQ_cjs.selectUnread; }
7336
+ get: function () { return chunkBOJHNPNJ_cjs.selectUnread; }
7415
7337
  });
7416
7338
  Object.defineProperty(exports, "toast", {
7417
7339
  enumerable: true,
7418
- get: function () { return chunk6PPWZILQ_cjs.toast; }
7340
+ get: function () { return chunkBOJHNPNJ_cjs.toast; }
7419
7341
  });
7420
7342
  Object.defineProperty(exports, "useNotify", {
7421
7343
  enumerable: true,
7422
- get: function () { return chunk6PPWZILQ_cjs.useNotify; }
7344
+ get: function () { return chunkBOJHNPNJ_cjs.useNotify; }
7423
7345
  });
7424
7346
  Object.defineProperty(exports, "AUDIO_MIME_PREFERENCE", {
7425
7347
  enumerable: true,
@@ -8207,7 +8129,6 @@ exports.AiActionCard = AiActionCard;
8207
8129
  exports.AiAnswer = AiAnswer;
8208
8130
  exports.AppleIcon = AppleIcon;
8209
8131
  exports.ArbiBotIcon = ArbiBotIcon;
8210
- exports.ArbiSessionStateProvider = ArbiSessionStateProvider;
8211
8132
  exports.ArbiWebSocketProvider = ArbiWebSocketProvider;
8212
8133
  exports.ArtifactCanvas = ArtifactCanvas;
8213
8134
  exports.ChatBubble = ChatBubble;
@@ -8230,7 +8151,6 @@ exports.DocumentGallery = DocumentGallery;
8230
8151
  exports.DocumentReview = DocumentReview;
8231
8152
  exports.DocumentTable = DocumentTable;
8232
8153
  exports.DraftTitleControls = DraftTitleControls;
8233
- exports.EMPTY_SESSION_STATE = EMPTY_SESSION_STATE;
8234
8154
  exports.FileIcon = FileIcon;
8235
8155
  exports.FireworksIcon = FireworksIcon;
8236
8156
  exports.GeminiIcon = GeminiIcon;
@@ -8262,7 +8182,6 @@ exports.announceMailDraftReplaced = announceMailDraftReplaced;
8262
8182
  exports.arbiAccountClient = arbiAccountClient;
8263
8183
  exports.arbiMailClient = arbiMailClient;
8264
8184
  exports.captureFrameAsBlob = captureFrameAsBlob;
8265
- exports.createArbiSessionStore = createArbiSessionStore;
8266
8185
  exports.createMailClient = createMailClient;
8267
8186
  exports.cropImage = cropImage;
8268
8187
  exports.dayKey = dayKey;
@@ -8285,14 +8204,11 @@ exports.mailJson = mailJson;
8285
8204
  exports.mailQueryKeys = mailQueryKeys;
8286
8205
  exports.mountDiditVerification = mountDiditVerification;
8287
8206
  exports.nextAliasSuggestion = nextAliasSuggestion;
8288
- exports.nextViewingDocument = nextViewingDocument;
8289
8207
  exports.parseActivityContent = parseActivityContent;
8290
8208
  exports.parseDeleteAccountBlockers = parseDeleteAccountBlockers;
8291
8209
  exports.pickRecentWorkspaces = pickRecentWorkspaces;
8292
8210
  exports.redlineStats = redlineStats;
8293
8211
  exports.resolveActiveWorkspace = resolveActiveWorkspace;
8294
- exports.selectIsGenerating = selectIsGenerating;
8295
- exports.selectViewingDocumentId = selectViewingDocumentId;
8296
8212
  exports.textToArtifact = textToArtifact;
8297
8213
  exports.titleFromQuestion = titleFromQuestion;
8298
8214
  exports.toChatCitations = toChatCitations;
@@ -8311,9 +8227,8 @@ exports.useAiTask = useAiTask;
8311
8227
  exports.useArbiChat = useArbiChat;
8312
8228
  exports.useArbiConnected = useArbiConnected;
8313
8229
  exports.useArbiDocumentSync = useArbiDocumentSync;
8314
- exports.useArbiSessionState = useArbiSessionState;
8315
- exports.useArbiSessionStore = useArbiSessionStore;
8316
8230
  exports.useArbiShellWorkspaces = useArbiShellWorkspaces;
8231
+ exports.useArbiUiStore = useArbiUiStore;
8317
8232
  exports.useArbiWebSocket = useArbiWebSocket;
8318
8233
  exports.useArbiWsContext = useArbiWsContext;
8319
8234
  exports.useArbiWsMessage = useArbiWsMessage;