@arbidocs/react 0.5.161 → 0.5.162
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/artifacts/index.cjs +2 -2
- package/dist/calls/livekit/index.cjs +41 -41
- package/dist/chat/workflow-run-titles.js +6 -1
- package/dist/chat/workflow-run-titles.js.map +2 -2
- package/dist/{chunk-GVU3KYP3.cjs → chunk-42X5ZO7Y.cjs} +11 -82
- package/dist/chunk-42X5ZO7Y.cjs.map +1 -0
- package/dist/{chunk-2MGJXBBJ.cjs → chunk-SUMXDNYG.cjs} +157 -6
- package/dist/chunk-SUMXDNYG.cjs.map +1 -0
- package/dist/conversation-list.js +32 -4
- package/dist/conversation-list.js.map +2 -2
- package/dist/directmessages/chat-cache.js +5 -0
- package/dist/directmessages/chat-cache.js.map +2 -2
- package/dist/hooks.js +7 -1
- package/dist/hooks.js.map +2 -2
- package/dist/index.cjs +625 -603
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +208 -1024
- package/dist/session/conversation-panels.js +41 -0
- package/dist/session/conversation-panels.js.map +7 -0
- package/dist/session/index.js +2 -0
- package/dist/session/index.js.map +2 -2
- package/dist/session/layout.js +7 -3
- package/dist/session/layout.js.map +2 -2
- package/dist/workspaces/switch.js +7 -4
- package/dist/workspaces/switch.js.map +2 -2
- package/package.json +3 -3
- package/dist/chunk-2MGJXBBJ.cjs.map +0 -1
- package/dist/chunk-GVU3KYP3.cjs.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isPanelOpen } from "./layout.js";
|
|
2
|
+
function createConversationPanels(source, options) {
|
|
3
|
+
const getLayout = () => typeof source === "function" ? source() : source;
|
|
4
|
+
const { conversationPanel, agentGalleryPanel, mainAreaPanels, defaultModes } = options;
|
|
5
|
+
const showPanel = (panelId, show = true) => {
|
|
6
|
+
const layout = getLayout();
|
|
7
|
+
if (!show) {
|
|
8
|
+
layout.closePanel(panelId);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const mode = defaultModes[panelId] ?? "docked";
|
|
12
|
+
const state = layout.getLayout();
|
|
13
|
+
const preserveDocked = mode === "overlay" && state.shell.panels.docked === conversationPanel && state.tabs.activeDm?.startsWith("agt-");
|
|
14
|
+
if (preserveDocked) layout.openPanel(panelId, mode, { preserveDocked: true });
|
|
15
|
+
else layout.openPanel(panelId, mode);
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
showPanel,
|
|
19
|
+
closeMainAreaPanels() {
|
|
20
|
+
const layout = getLayout();
|
|
21
|
+
const state = layout.getLayout();
|
|
22
|
+
const { main } = state.shell.panels;
|
|
23
|
+
if (main === conversationPanel && state.tabs.activeDm?.startsWith("agt-"))
|
|
24
|
+
layout.openPanel(conversationPanel, "docked");
|
|
25
|
+
else if (main && mainAreaPanels.includes(main)) showPanel(main, false);
|
|
26
|
+
},
|
|
27
|
+
openDmTab(recipientId, messageId) {
|
|
28
|
+
const layout = getLayout();
|
|
29
|
+
layout.openDmTab(recipientId ?? null, messageId);
|
|
30
|
+
if (recipientId?.startsWith("agt-")) {
|
|
31
|
+
showPanel(agentGalleryPanel, false);
|
|
32
|
+
layout.openPanel(conversationPanel, "docked");
|
|
33
|
+
} else if (!isPanelOpen(layout.getLayout(), conversationPanel)) showPanel(conversationPanel);
|
|
34
|
+
layout.setFocusedArea(conversationPanel);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
createConversationPanels
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=conversation-panels.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/session/conversation-panels.ts"],
|
|
4
|
+
"sourcesContent": ["/** Compose a retained native agent conversation with a site's panel ids and default placements. */\nimport { isPanelOpen, type ArbiLayoutStore, type ArbiPanelMode } from './layout'\n\ntype Layout = Pick<\n ArbiLayoutStore,\n 'getLayout' | 'openPanel' | 'closePanel' | 'openDmTab' | 'setFocusedArea'\n>\ninterface ConversationPanels {\n conversationPanel: string\n agentGalleryPanel: string\n mainAreaPanels: readonly string[]\n defaultModes: Readonly<Record<string, ArbiPanelMode>>\n}\n\nexport function createConversationPanels(\n source: Layout | (() => Layout),\n options: ConversationPanels\n) {\n const getLayout = () => (typeof source === 'function' ? source() : source)\n const { conversationPanel, agentGalleryPanel, mainAreaPanels, defaultModes } = options\n const showPanel = (panelId: string, show = true) => {\n const layout = getLayout()\n if (!show) {\n layout.closePanel(panelId)\n return\n }\n const mode = defaultModes[panelId] ?? 'docked'\n const state = layout.getLayout()\n const preserveDocked =\n mode === 'overlay' &&\n state.shell.panels.docked === conversationPanel &&\n state.tabs.activeDm?.startsWith('agt-')\n if (preserveDocked) layout.openPanel(panelId, mode, { preserveDocked: true })\n else layout.openPanel(panelId, mode)\n }\n return {\n showPanel,\n closeMainAreaPanels() {\n const layout = getLayout()\n const state = layout.getLayout()\n const { main } = state.shell.panels\n if (main === conversationPanel && state.tabs.activeDm?.startsWith('agt-'))\n layout.openPanel(conversationPanel, 'docked')\n else if (main && mainAreaPanels.includes(main)) showPanel(main, false)\n },\n openDmTab(recipientId?: string | null, messageId?: string) {\n const layout = getLayout()\n layout.openDmTab(recipientId ?? null, messageId)\n if (recipientId?.startsWith('agt-')) {\n showPanel(agentGalleryPanel, false)\n layout.openPanel(conversationPanel, 'docked')\n } else if (!isPanelOpen(layout.getLayout(), conversationPanel)) showPanel(conversationPanel)\n layout.setFocusedArea(conversationPanel)\n },\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,mBAA6D;AAa/D,SAAS,yBACd,QACA,SACA;AACA,QAAM,YAAY,MAAO,OAAO,WAAW,aAAa,OAAO,IAAI;AACnE,QAAM,EAAE,mBAAmB,mBAAmB,gBAAgB,aAAa,IAAI;AAC/E,QAAM,YAAY,CAAC,SAAiB,OAAO,SAAS;AAClD,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,MAAM;AACT,aAAO,WAAW,OAAO;AACzB;AAAA,IACF;AACA,UAAM,OAAO,aAAa,OAAO,KAAK;AACtC,UAAM,QAAQ,OAAO,UAAU;AAC/B,UAAM,iBACJ,SAAS,aACT,MAAM,MAAM,OAAO,WAAW,qBAC9B,MAAM,KAAK,UAAU,WAAW,MAAM;AACxC,QAAI,eAAgB,QAAO,UAAU,SAAS,MAAM,EAAE,gBAAgB,KAAK,CAAC;AAAA,QACvE,QAAO,UAAU,SAAS,IAAI;AAAA,EACrC;AACA,SAAO;AAAA,IACL;AAAA,IACA,sBAAsB;AACpB,YAAM,SAAS,UAAU;AACzB,YAAM,QAAQ,OAAO,UAAU;AAC/B,YAAM,EAAE,KAAK,IAAI,MAAM,MAAM;AAC7B,UAAI,SAAS,qBAAqB,MAAM,KAAK,UAAU,WAAW,MAAM;AACtE,eAAO,UAAU,mBAAmB,QAAQ;AAAA,eACrC,QAAQ,eAAe,SAAS,IAAI,EAAG,WAAU,MAAM,KAAK;AAAA,IACvE;AAAA,IACA,UAAU,aAA6B,WAAoB;AACzD,YAAM,SAAS,UAAU;AACzB,aAAO,UAAU,eAAe,MAAM,SAAS;AAC/C,UAAI,aAAa,WAAW,MAAM,GAAG;AACnC,kBAAU,mBAAmB,KAAK;AAClC,eAAO,UAAU,mBAAmB,QAAQ;AAAA,MAC9C,WAAW,CAAC,YAAY,OAAO,UAAU,GAAG,iBAAiB,EAAG,WAAU,iBAAiB;AAC3F,aAAO,eAAe,iBAAiB;AAAA,IACzC;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/session/index.js
CHANGED
|
@@ -69,6 +69,7 @@ import {
|
|
|
69
69
|
} from "./drafts.js";
|
|
70
70
|
import { createUiStateStorage } from "./ui-state-storage.js";
|
|
71
71
|
import { createBrowserStateStorage } from "./browser-storage.js";
|
|
72
|
+
import { createConversationPanels } from "./conversation-panels.js";
|
|
72
73
|
export {
|
|
73
74
|
DEFAULT_DOCUMENT_VIEWER_STATE,
|
|
74
75
|
DOCUMENT_VIEWER_PANEL,
|
|
@@ -89,6 +90,7 @@ export {
|
|
|
89
90
|
createArbiSessionStore,
|
|
90
91
|
createArbiWorkspaceStore,
|
|
91
92
|
createBrowserStateStorage,
|
|
93
|
+
createConversationPanels,
|
|
92
94
|
createDebouncedWriter,
|
|
93
95
|
createSealedDraftStorage,
|
|
94
96
|
createStoragePersist,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/session/index.ts"],
|
|
4
|
-
"sourcesContent": ["export {\n useArbiSessionState,\n useArbiSessionStore,\n useSessionView,\n useSessionPageTab,\n useTransientView,\n} from './session-hooks'\nexport {\n useArbiSession,\n useSignedInSession,\n type ArbiSessionStatus,\n type ArbiSignedInSession,\n} from './signed-in'\nexport {\n createArbiSessionStore,\n composeArbiSessionStore,\n conversationKey,\n selectDraft,\n selectIsGenerating,\n selectViewingDocumentId,\n EMPTY_SESSION_STATE,\n type ArbiSessionParts,\n type ArbiSessionState,\n type ArbiSessionStore,\n type ArbiSessionStoreOptions,\n type ArbiWorkspaceStatus,\n layoutActionsOf,\n} from './store'\nexport {\n createArbiDocumentSessionStore,\n nextViewingDocument,\n parseSavedDocuments,\n restoreSavedDocuments,\n savedDocumentsOf,\n DEFAULT_DOCUMENT_VIEWER_STATE,\n EMPTY_DOCUMENT_STATE,\n type ArbiDocumentCommentTarget,\n type ArbiDocumentSessionActions,\n type ArbiDocumentSessionState,\n type ArbiDocumentSessionStore,\n type ArbiDocumentSessionStoreOptions,\n type ArbiDocumentsPersist,\n type ArbiDocumentViewerState,\n type ArbiDraftDocument,\n type ArbiDraftKind,\n type ArbiPassageCitationState,\n type ArbiPickedPassage,\n type ArbiSavedDocuments,\n type ArbiViewerTab,\n type ArbiViewingDocument,\n type ArbiViewingDocumentInput,\n} from './documents'\nexport {\n createArbiChatStore,\n parseSavedChat,\n savedChatOf,\n EMPTY_CHAT_STATE,\n type ArbiChatActions,\n type ArbiChatState,\n type ArbiChatStore,\n type ArbiChatStoreOptions,\n type ArbiConversationDocument,\n type ArbiConversationGeneration,\n type ArbiMessageTimer,\n type ArbiSavedChat,\n type TurnTools,\n} from './chat'\nexport {\n createArbiLayoutStore,\n closePanelIn,\n defaultLayoutState,\n DOCUMENT_VIEWER_PANEL,\n dmTabId,\n isPanelOpen,\n openPanelIn,\n panelPlace,\n parseSavedLayout,\n restoreLayout,\n savedLayoutOf,\n type ArbiDmTab,\n type ArbiGridLayoutState,\n type ArbiLayoutActions,\n type ArbiLayoutState,\n type ArbiLayoutStore,\n type ArbiLayoutStoreOptions,\n type ArbiPanelMode,\n type ArbiPanelsState,\n type ArbiSavedLayout,\n type ArbiShellState,\n type ArbiSidebarState,\n type ArbiTabsState,\n type ArbiThreadTabsController,\n type ArbiViewsState,\n} from './layout'\nexport {\n threadTabId,\n MAX_THREAD_TABS,\n type ArbiThreadComposer,\n type ArbiThreadTab,\n type ArbiThreadTabShow,\n type ArbiThreadTabView,\n type ArbiThreadTabsState,\n} from './thread-tabs'\nexport {\n createDebouncedWriter,\n createStoragePersist,\n flushOnPageExit,\n type ArbiKeyValueStorage,\n type ArbiSessionPersist,\n type DebouncedWriter,\n type DebouncedWriterOptions,\n type StoragePersistOptions,\n} from './persist'\nexport {\n createArbiWorkspaceStore,\n browserWorkspaceStorage,\n readWorkspaceLastOpened,\n WORKSPACE_STORAGE_KEY,\n WORKSPACE_LAST_OPENED_KEY,\n type ArbiWorkspaceState,\n type ArbiWorkspaceStorage,\n type ArbiWorkspaceStore,\n type ArbiWorkspaceStoreOptions,\n type BrowserWorkspaceStorageOptions,\n} from './workspace'\nexport {\n clearSealedDrafts,\n createSealedDraftStorage,\n type ArbiDraftStorage,\n type DraftKeyValueStore,\n type SealedDraftStorageOptions,\n} from './drafts'\n\nexport { createUiStateStorage, type UiStateStorage } from './ui-state-storage'\n\nexport { createBrowserStateStorage } from './browser-storage'\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAMA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAUK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAeK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,4BAAiD;AAE1D,SAAS,iCAAiC;",
|
|
4
|
+
"sourcesContent": ["export {\n useArbiSessionState,\n useArbiSessionStore,\n useSessionView,\n useSessionPageTab,\n useTransientView,\n} from './session-hooks'\nexport {\n useArbiSession,\n useSignedInSession,\n type ArbiSessionStatus,\n type ArbiSignedInSession,\n} from './signed-in'\nexport {\n createArbiSessionStore,\n composeArbiSessionStore,\n conversationKey,\n selectDraft,\n selectIsGenerating,\n selectViewingDocumentId,\n EMPTY_SESSION_STATE,\n type ArbiSessionParts,\n type ArbiSessionState,\n type ArbiSessionStore,\n type ArbiSessionStoreOptions,\n type ArbiWorkspaceStatus,\n layoutActionsOf,\n} from './store'\nexport {\n createArbiDocumentSessionStore,\n nextViewingDocument,\n parseSavedDocuments,\n restoreSavedDocuments,\n savedDocumentsOf,\n DEFAULT_DOCUMENT_VIEWER_STATE,\n EMPTY_DOCUMENT_STATE,\n type ArbiDocumentCommentTarget,\n type ArbiDocumentSessionActions,\n type ArbiDocumentSessionState,\n type ArbiDocumentSessionStore,\n type ArbiDocumentSessionStoreOptions,\n type ArbiDocumentsPersist,\n type ArbiDocumentViewerState,\n type ArbiDraftDocument,\n type ArbiDraftKind,\n type ArbiPassageCitationState,\n type ArbiPickedPassage,\n type ArbiSavedDocuments,\n type ArbiViewerTab,\n type ArbiViewingDocument,\n type ArbiViewingDocumentInput,\n} from './documents'\nexport {\n createArbiChatStore,\n parseSavedChat,\n savedChatOf,\n EMPTY_CHAT_STATE,\n type ArbiChatActions,\n type ArbiChatState,\n type ArbiChatStore,\n type ArbiChatStoreOptions,\n type ArbiConversationDocument,\n type ArbiConversationGeneration,\n type ArbiMessageTimer,\n type ArbiSavedChat,\n type TurnTools,\n} from './chat'\nexport {\n createArbiLayoutStore,\n closePanelIn,\n defaultLayoutState,\n DOCUMENT_VIEWER_PANEL,\n dmTabId,\n isPanelOpen,\n openPanelIn,\n panelPlace,\n parseSavedLayout,\n restoreLayout,\n savedLayoutOf,\n type ArbiDmTab,\n type ArbiGridLayoutState,\n type ArbiLayoutActions,\n type ArbiLayoutState,\n type ArbiLayoutStore,\n type ArbiLayoutStoreOptions,\n type ArbiPanelMode,\n type ArbiPanelsState,\n type ArbiSavedLayout,\n type ArbiShellState,\n type ArbiSidebarState,\n type ArbiTabsState,\n type ArbiThreadTabsController,\n type ArbiViewsState,\n} from './layout'\nexport {\n threadTabId,\n MAX_THREAD_TABS,\n type ArbiThreadComposer,\n type ArbiThreadTab,\n type ArbiThreadTabShow,\n type ArbiThreadTabView,\n type ArbiThreadTabsState,\n} from './thread-tabs'\nexport {\n createDebouncedWriter,\n createStoragePersist,\n flushOnPageExit,\n type ArbiKeyValueStorage,\n type ArbiSessionPersist,\n type DebouncedWriter,\n type DebouncedWriterOptions,\n type StoragePersistOptions,\n} from './persist'\nexport {\n createArbiWorkspaceStore,\n browserWorkspaceStorage,\n readWorkspaceLastOpened,\n WORKSPACE_STORAGE_KEY,\n WORKSPACE_LAST_OPENED_KEY,\n type ArbiWorkspaceState,\n type ArbiWorkspaceStorage,\n type ArbiWorkspaceStore,\n type ArbiWorkspaceStoreOptions,\n type BrowserWorkspaceStorageOptions,\n} from './workspace'\nexport {\n clearSealedDrafts,\n createSealedDraftStorage,\n type ArbiDraftStorage,\n type DraftKeyValueStore,\n type SealedDraftStorageOptions,\n} from './drafts'\n\nexport { createUiStateStorage, type UiStateStorage } from './ui-state-storage'\n\nexport { createBrowserStateStorage } from './browser-storage'\n\nexport { createConversationPanels } from './conversation-panels'\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAMA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAgBK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAUK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAeK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAEP,SAAS,4BAAiD;AAE1D,SAAS,iCAAiC;AAE1C,SAAS,gCAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/session/layout.js
CHANGED
|
@@ -110,7 +110,7 @@ function restoreLayout(current, saved) {
|
|
|
110
110
|
grid: saved.grid
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
function openPanelIn(panels, panelId, mode) {
|
|
113
|
+
function openPanelIn(panels, panelId, mode, options) {
|
|
114
114
|
const leave = (slot) => slot === panelId ? null : slot;
|
|
115
115
|
const next = {
|
|
116
116
|
...panels,
|
|
@@ -121,7 +121,8 @@ function openPanelIn(panels, panelId, mode) {
|
|
|
121
121
|
modes: { ...panels.modes, [panelId]: mode }
|
|
122
122
|
};
|
|
123
123
|
if (mode === "docked") return { ...next, docked: panelId, overlay: null };
|
|
124
|
-
if (mode === "overlay")
|
|
124
|
+
if (mode === "overlay")
|
|
125
|
+
return { ...next, overlay: panelId, docked: options?.preserveDocked ? next.docked : null };
|
|
125
126
|
return { ...next, [mode]: panelId };
|
|
126
127
|
}
|
|
127
128
|
function closePanelIn(panels, panelId) {
|
|
@@ -227,7 +228,10 @@ function createArbiLayoutStore({
|
|
|
227
228
|
if (sidebar.pinned !== current.pinned || sidebar.hovering !== current.hovering || sidebar.drawerOpen !== current.drawerOpen)
|
|
228
229
|
shell({ sidebar });
|
|
229
230
|
},
|
|
230
|
-
openPanel: (panelId, mode) => shell({
|
|
231
|
+
openPanel: (panelId, mode, options) => shell({
|
|
232
|
+
panels: openPanelIn(layout.shell.panels, panelId, mode, options),
|
|
233
|
+
focusedArea: panelId
|
|
234
|
+
}),
|
|
231
235
|
closePanel: (panelId) => shell({ panels: closePanelIn(layout.shell.panels, panelId), focusedArea: "main" }),
|
|
232
236
|
setPanelMode: (panelId, mode) => {
|
|
233
237
|
const panels = layout.shell.panels;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/session/layout.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The layout part of the session state: the shell (the page on screen, the sidebar, the panels and\n * where each one shows, the area with focus), the open tabs (threads, direct messages, projects),\n * each page's view (its tab, its filters, other view settings) and the grids' saved state. Kits and\n * the host read and change it through the session store; the parts a person arranges (the page, the\n * pinned sidebar, the panels, the thread tabs, the views, the grids) are kept across reloads by the\n * host's {@link ArbiSessionPersist}.\n */\n\nimport type { ArbiSessionPersist } from './persist'\nimport {\n closeThreadTabIn,\n openThreadTabIn,\n parseSavedThreadTabs,\n renameThreadTabIn,\n savedThreadTabs,\n selectThreadTabIn,\n showThreadListIn,\n type ArbiThreadComposer,\n type ArbiThreadTabShow,\n type ArbiThreadTabsState,\n} from './thread-tabs'\n\n/** Where a panel shows: the page's area, docked beside it, over it, or in its own window. */\nexport type ArbiPanelMode = 'main' | 'docked' | 'overlay' | 'popout'\n\nexport interface ArbiPanelsState {\n /** The panel in each place (one each): filling the page, docked, over the page, popped out. */\n main: string | null\n docked: string | null\n overlay: string | null\n popout: string | null\n /** Where each panel last showed (it opens there again). */\n modes: Readonly<Record<string, ArbiPanelMode>>\n /** A floating panel's size. */\n sizes: Readonly<Record<string, { width: number; height: number }>>\n}\n\nexport interface ArbiSidebarState {\n /** Pinned open (on wide screens; phones show a drawer). */\n pinned: boolean\n /** The rail is expanded under the pointer. */\n hovering: boolean\n /** The phone drawer is open. */\n drawerOpen: boolean\n}\n\nexport interface ArbiShellState {\n /** The page on screen (a host's page id). */\n page: string\n sidebar: ArbiSidebarState\n panels: ArbiPanelsState\n /** The area with focus: `main` or a panel id. */\n focusedArea: string\n}\n\n/** A direct-message tab: a person's or agent's id, a group chat's id, or null (a new message). */\nexport interface ArbiDmTab {\n recipientId: string | null\n}\n\nexport interface ArbiTabsState extends ArbiThreadTabsState {\n dm: readonly ArbiDmTab[]\n activeDm: string | null\n /** The message a direct-message tab scrolls to once open. */\n dmMessageId: string | null\n projects: readonly string[]\n activeProject: string | null\n}\n\nexport interface ArbiViewsState {\n /** Each page's tab, by page. */\n tabs: Readonly<Record<string, string>>\n /** Each list's quick filters, by list. */\n filters: Readonly<Record<string, unknown>>\n /** Other view settings, by key (a page's view mode, a zoom, a filter box's text). */\n values: Readonly<Record<string, unknown>>\n /** View state kept for this session only, by key (a search's results); not saved. */\n transient: Readonly<Record<string, unknown>>\n}\n\nexport interface ArbiGridLayoutState {\n /** Each grid's saved state (columns, widths, sort), by grid id. */\n states: Readonly<Record<string, unknown>>\n /** Each grid's row height. */\n rowHeights: Readonly<Record<string, number>>\n /** Each timeline's label column width. */\n labelWidths: Readonly<Record<string, number>>\n /** Views an earlier build saved on this device, by grid id (moved to user settings once). */\n savedViews: Readonly<Record<string, readonly unknown[]>>\n}\n\nexport interface ArbiLayoutState {\n shell: ArbiShellState\n tabs: ArbiTabsState\n views: ArbiViewsState\n grid: ArbiGridLayoutState\n}\n\n/** What is kept across reloads. */\nexport interface ArbiSavedLayout {\n version: 1\n /** The pieces an earlier build's own saved state was brought in for (the host's migration). */\n migrated: string[]\n shell: {\n page: string\n sidebarPinned: boolean\n panels: { main: string | null; docked: string | null } & Pick<\n ArbiPanelsState,\n 'modes' | 'sizes'\n >\n }\n /** The open thread tabs (without what was typed in them) and the one on screen. */\n tabs: Pick<ArbiThreadTabsState, 'threads' | 'activeThread'>\n views: Omit<ArbiViewsState, 'transient'>\n grid: ArbiGridLayoutState\n}\n\nconst PANEL_MODES: readonly ArbiPanelMode[] = ['main', 'docked', 'overlay', 'popout']\n\n/** Phones start with the sidebar as a drawer, wider screens pinned. */\nconst defaultPinned = () => typeof window === 'undefined' || window.innerWidth >= 640\n\nexport function defaultLayoutState(): ArbiLayoutState {\n return {\n shell: {\n page: 'home',\n sidebar: { pinned: defaultPinned(), hovering: false, drawerOpen: false },\n panels: { main: null, docked: null, overlay: null, popout: null, modes: {}, sizes: {} },\n focusedArea: 'main',\n },\n tabs: {\n threads: [],\n activeThread: null,\n threadScrollRestore: null,\n dm: [],\n activeDm: null,\n dmMessageId: null,\n projects: [],\n activeProject: null,\n },\n views: { tabs: {}, filters: {}, values: {}, transient: {} },\n grid: { states: {}, rowHeights: {}, labelWidths: {}, savedViews: {} },\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst recordOf = <T>(value: unknown, keep: (entry: unknown) => entry is T): Record<string, T> =>\n isRecord(value)\n ? (Object.fromEntries(Object.entries(value).filter(([, v]) => keep(v))) as Record<string, T>)\n : {}\n\nconst isString = (v: unknown): v is string => typeof v === 'string'\nconst isNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v)\nconst isAny = (v: unknown): v is unknown => v !== undefined\nconst isMode = (v: unknown): v is ArbiPanelMode => PANEL_MODES.includes(v as ArbiPanelMode)\nconst isSize = (v: unknown): v is { width: number; height: number } =>\n isRecord(v) && isNumber(v.width) && isNumber(v.height)\nconst isList = (v: unknown): v is unknown[] => Array.isArray(v)\nconst stringOrNull = (v: unknown): string | null => (isString(v) ? v : null)\n\n/**\n * A saved layout as this build reads it: whatever an earlier or a broken save left is dropped\n * rather than read. Never throws; null when there is nothing usable.\n */\nexport function parseSavedLayout(saved: unknown): ArbiSavedLayout | null {\n if (!isRecord(saved) || saved.version !== 1) return null\n const shell = isRecord(saved.shell) ? saved.shell : {}\n const panels = isRecord(shell.panels) ? shell.panels : {}\n const tabs = isRecord(saved.tabs) ? saved.tabs : {}\n const views = isRecord(saved.views) ? saved.views : {}\n const grid = isRecord(saved.grid) ? saved.grid : {}\n const defaults = defaultLayoutState()\n return {\n version: 1,\n migrated: isList(saved.migrated) ? saved.migrated.filter(isString) : [],\n shell: {\n page: isString(shell.page) ? shell.page : defaults.shell.page,\n sidebarPinned:\n typeof shell.sidebarPinned === 'boolean'\n ? shell.sidebarPinned\n : defaults.shell.sidebar.pinned,\n panels: {\n main: stringOrNull(panels.main),\n docked: stringOrNull(panels.docked),\n modes: recordOf(panels.modes, isMode),\n sizes: recordOf(panels.sizes, isSize),\n },\n },\n tabs: parseSavedThreadTabs(tabs.threads, tabs.activeThread),\n views: {\n tabs: recordOf(views.tabs, isString),\n filters: recordOf(views.filters, isAny),\n values: recordOf(views.values, isAny),\n },\n grid: {\n states: recordOf(grid.states, isRecord),\n rowHeights: recordOf(grid.rowHeights, isNumber),\n labelWidths: recordOf(grid.labelWidths, isNumber),\n savedViews: recordOf(grid.savedViews, isList),\n },\n }\n}\n\n/** What of a layout is saved. */\nexport function savedLayoutOf(layout: ArbiLayoutState, migrated: string[]): ArbiSavedLayout {\n const { shell, tabs, views, grid } = layout\n return {\n version: 1,\n migrated,\n shell: {\n page: shell.page,\n sidebarPinned: shell.sidebar.pinned,\n // A panel over the page or in its own window does not come back after a reload.\n panels: {\n main: shell.panels.main,\n docked: shell.panels.docked,\n modes: shell.panels.modes,\n sizes: shell.panels.sizes,\n },\n },\n tabs: { threads: savedThreadTabs(tabs.threads), activeThread: tabs.activeThread },\n views: { tabs: views.tabs, filters: views.filters, values: views.values },\n grid,\n }\n}\n\n/** The layout a saved one restores (the parts not saved keep their current values). */\nexport function restoreLayout(current: ArbiLayoutState, saved: ArbiSavedLayout): ArbiLayoutState {\n return {\n ...current,\n shell: {\n ...current.shell,\n page: saved.shell.page,\n sidebar: { ...current.shell.sidebar, pinned: saved.shell.sidebarPinned },\n panels: { ...current.shell.panels, ...saved.shell.panels },\n },\n tabs: { ...current.tabs, ...saved.tabs },\n views: { ...saved.views, transient: current.views.transient },\n grid: saved.grid,\n }\n}\n\n// \u2500\u2500 Changes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Show a panel in a place: it leaves the place it was in, and what was in that place closes. */\nexport function openPanelIn(\n panels: ArbiPanelsState,\n panelId: string,\n mode: ArbiPanelMode\n): ArbiPanelsState {\n const leave = (slot: string | null) => (slot === panelId ? null : slot)\n const next: ArbiPanelsState = {\n ...panels,\n main: leave(panels.main),\n docked: leave(panels.docked),\n overlay: leave(panels.overlay),\n popout: leave(panels.popout),\n modes: { ...panels.modes, [panelId]: mode },\n }\n // Docked and over the page are both the secondary surface beside the page: one at a time.\n if (mode === 'docked') return { ...next, docked: panelId, overlay: null }\n if (mode === 'overlay') return { ...next, overlay: panelId, docked: null }\n return { ...next, [mode]: panelId }\n}\n\nexport function closePanelIn(panels: ArbiPanelsState, panelId: string): ArbiPanelsState {\n const leave = (slot: string | null) => (slot === panelId ? null : slot)\n return {\n ...panels,\n main: leave(panels.main),\n docked: leave(panels.docked),\n overlay: leave(panels.overlay),\n popout: leave(panels.popout),\n }\n}\n\n/** Where a panel shows now, or null while it is closed. */\nexport function panelPlace(panels: ArbiPanelsState, panelId: string): ArbiPanelMode | null {\n return PANEL_MODES.find((mode) => panels[mode] === panelId) ?? null\n}\n\n/**\n * The panel that shows the session's `viewingDocument` (a host that shows documents in a panel\n * gives it this id): kits open a document with the environment's `openDocument` and close it here.\n */\nexport const DOCUMENT_VIEWER_PANEL = 'document-viewer'\n\n/** Whether a panel is open (anywhere). */\nexport const isPanelOpen = (state: { shell: ArbiShellState }, panelId: string): boolean =>\n panelPlace(state.shell.panels, panelId) !== null\n\nexport const dmTabId = (tab: ArbiDmTab): string => tab.recipientId ?? 'new'\n\n/** The actions on the layout (part of {@link ArbiSessionStore}). */\nexport interface ArbiLayoutActions {\n /** Show a page; the focus goes to the page area. */\n setPage(page: string): void\n setSidebar(change: Partial<ArbiSidebarState>): void\n /** Show a panel in a place (`mode`), focused. */\n openPanel(panelId: string, mode: ArbiPanelMode): void\n closePanel(panelId: string): void\n /** Where a panel shows: an open one moves there, a closed one opens there next time. */\n setPanelMode(panelId: string, mode: ArbiPanelMode): void\n setPanelSize(panelId: string, size: { width: number; height: number }): void\n setFocusedArea(area: string): void\n /** Open (or show) a direct-message tab, optionally scrolled to a message. */\n openDmTab(recipientId: string | null, messageId?: string): void\n closeDmTab(tabId: string): void\n /** null: no direct-message tab (the panel's own). */\n selectDmTab(tabId: string | null): void\n clearDmTabs(): void\n setDmMessageId(messageId: string | null): void\n openProjectTab(projectId: string): void\n closeProjectTab(projectId: string): void\n /** null: the projects list. */\n selectProjectTab(projectId: string | null): void\n setPageTab(page: string, tab: string): void\n setViewFilter(key: string, value: unknown): void\n setViewValue(key: string, value: unknown): void\n /** Set (or with `undefined`, drop) view state kept for this session only. */\n setTransientView(key: string, value: unknown): void\n setGridState(gridId: string, state: unknown): void\n clearGridState(gridId: string): void\n setGridRowHeight(gridId: string, height: number): void\n setGridLabelWidth(gridId: string, width: number): void\n setGridSavedViews(gridId: string, views: readonly unknown[]): void\n /**\n * Start over: a sign-in shows the home page with the sidebar at its default and no panel, tab\n * or page tab open; a sign-out also forgets the grids.\n */\n resetLayout(variant: 'login' | 'logout'): void\n}\n\n/**\n * The thread tabs' changes on a layout store. Each takes the composer being left (saved into the tab\n * on screen) and says what the composer shows next; the session store applies that to whatever\n * holds the composer (`ArbiSessionStore.openThreadTab` and the like are built on these).\n */\nexport interface ArbiThreadTabsController {\n open(\n conversationId: string | null,\n leaving: ArbiThreadComposer\n ): { tabId: string; show: ArbiThreadTabShow }\n close(tabId: string): ArbiThreadTabShow\n select(tabId: string, leaving: ArbiThreadComposer): ArbiThreadTabShow\n showList(leaving: ArbiThreadComposer): void\n /** The tab of `fromId` is now `toId`'s (a new chat got its id). */\n rename(fromId: string, toId: string): void\n clear(): void\n /** The scroll position the last tab switch brought back (once; null after). */\n consumeScrollRestore(): number | null\n}\n\n/** A store of the layout alone; the session stores are built on it. */\nexport interface ArbiLayoutStore extends ArbiLayoutActions {\n getLayout(): ArbiLayoutState\n /** Back to the defaults, everything (unit tests; a reset from an error screen). */\n reset(): void\n subscribe(listener: () => void): () => void\n /** Resolves once the saved layout has been read (at once without a `persist`). */\n hydrated(): Promise<void>\n isHydrated(): boolean\n /** The thread tabs' changes (not session actions: the session store's apply them). */\n threads: ArbiThreadTabsController\n}\n\nexport interface ArbiLayoutStoreOptions {\n persist?: ArbiSessionPersist<ArbiSavedLayout>\n /** The layout to start from (unit tests, a host's initial state); a saved one replaces it. */\n initial?: Partial<ArbiLayoutState>\n}\n\nexport function createArbiLayoutStore({\n persist,\n initial,\n}: ArbiLayoutStoreOptions = {}): ArbiLayoutStore {\n let layout: ArbiLayoutState = { ...defaultLayoutState(), ...initial }\n let migrated: string[] = []\n let isHydrated = !persist\n const listeners = new Set<() => void>()\n const save = () => {\n // Nothing is saved before the saved layout is read: it would overwrite it with the defaults.\n if (persist && isHydrated) persist.save(savedLayoutOf(layout, migrated))\n }\n const update = (next: ArbiLayoutState) => {\n if (next === layout) return\n const persisted =\n next.tabs.threads !== layout.tabs.threads ||\n next.tabs.activeThread !== layout.tabs.activeThread ||\n next.views.tabs !== layout.views.tabs ||\n next.views.filters !== layout.views.filters ||\n next.views.values !== layout.views.values ||\n next.grid !== layout.grid ||\n next.shell.page !== layout.shell.page ||\n next.shell.sidebar.pinned !== layout.shell.sidebar.pinned ||\n next.shell.panels !== layout.shell.panels\n layout = next\n listeners.forEach((listener) => listener())\n if (persisted) save()\n }\n const shell = (change: Partial<ArbiShellState>) =>\n update({ ...layout, shell: { ...layout.shell, ...change } })\n const tabs = (change: Partial<ArbiTabsState>) =>\n update({ ...layout, tabs: { ...layout.tabs, ...change } })\n const views = (change: Partial<ArbiViewsState>) =>\n update({ ...layout, views: { ...layout.views, ...change } })\n const grid = (change: Partial<ArbiGridLayoutState>) =>\n update({ ...layout, grid: { ...layout.grid, ...change } })\n\n const hydration: Promise<void> = persist\n ? persist.load().then(\n (saved) => {\n const parsed = parseSavedLayout(saved)\n if (parsed) {\n migrated = parsed.migrated\n layout = restoreLayout(layout, parsed)\n }\n isHydrated = true\n listeners.forEach((listener) => listener())\n },\n () => {\n isHydrated = true\n listeners.forEach((listener) => listener())\n }\n )\n : Promise.resolve()\n\n return {\n getLayout: () => layout,\n reset: () => update(defaultLayoutState()),\n subscribe: (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n hydrated: () => hydration,\n isHydrated: () => isHydrated,\n threads: {\n open: (conversationId, leaving) => {\n const change = openThreadTabIn(layout.tabs, conversationId, leaving)\n tabs(change.tabs)\n return { tabId: change.tabId, show: change.show }\n },\n close: (tabId) => {\n const change = closeThreadTabIn(layout.tabs, tabId)\n tabs(change.tabs)\n return change.show\n },\n select: (tabId, leaving) => {\n const change = selectThreadTabIn(layout.tabs, tabId, leaving)\n if (change.tabs !== layout.tabs) tabs(change.tabs)\n return change.show\n },\n showList: (leaving) => tabs(showThreadListIn(layout.tabs, leaving)),\n rename: (fromId, toId) => {\n const next = renameThreadTabIn(layout.tabs, fromId, toId)\n if (next !== layout.tabs) tabs(next)\n },\n clear: () => {\n if (layout.tabs.threads.length > 0 || layout.tabs.activeThread !== null)\n tabs({ threads: [], activeThread: null })\n },\n consumeScrollRestore: () => {\n const value = layout.tabs.threadScrollRestore\n if (value !== null) tabs({ threadScrollRestore: null })\n return value\n },\n },\n setPage: (page) => {\n if (layout.shell.page !== page || layout.shell.focusedArea !== 'main')\n shell({ page, focusedArea: 'main' })\n },\n setSidebar: (change) => {\n const sidebar = { ...layout.shell.sidebar, ...change }\n const current = layout.shell.sidebar\n if (\n sidebar.pinned !== current.pinned ||\n sidebar.hovering !== current.hovering ||\n sidebar.drawerOpen !== current.drawerOpen\n )\n shell({ sidebar })\n },\n openPanel: (panelId, mode) =>\n shell({ panels: openPanelIn(layout.shell.panels, panelId, mode), focusedArea: panelId }),\n closePanel: (panelId) =>\n shell({ panels: closePanelIn(layout.shell.panels, panelId), focusedArea: 'main' }),\n setPanelMode: (panelId, mode) => {\n const panels = layout.shell.panels\n if (panelPlace(panels, panelId) !== null)\n shell({ panels: openPanelIn(panels, panelId, mode), focusedArea: panelId })\n else if (panels.modes[panelId] !== mode)\n shell({ panels: { ...panels, modes: { ...panels.modes, [panelId]: mode } } })\n },\n setPanelSize: (panelId, size) => {\n const panels = layout.shell.panels\n shell({ panels: { ...panels, sizes: { ...panels.sizes, [panelId]: size } } })\n },\n setFocusedArea: (focusedArea) => {\n if (layout.shell.focusedArea !== focusedArea) shell({ focusedArea })\n },\n openDmTab: (recipientId, messageId) => {\n const id = recipientId ?? 'new'\n const dm = layout.tabs.dm.some((tab) => dmTabId(tab) === id)\n ? layout.tabs.dm\n : [...layout.tabs.dm, { recipientId }]\n tabs({ dm, activeDm: id, ...(messageId ? { dmMessageId: messageId } : {}) })\n },\n closeDmTab: (tabId) => {\n const dm = layout.tabs.dm.filter((tab) => dmTabId(tab) !== tabId)\n if (dm.length === layout.tabs.dm.length) return\n if (dm.length === 0) return tabs({ dm, activeDm: null })\n if (layout.tabs.activeDm !== tabId) return tabs({ dm })\n // The tab beside the closed one shows.\n const index = layout.tabs.dm.findIndex((tab) => dmTabId(tab) === tabId)\n tabs({ dm, activeDm: dmTabId(dm[Math.min(index, dm.length - 1)]) })\n },\n selectDmTab: (activeDm) => {\n if (layout.tabs.activeDm !== activeDm) tabs({ activeDm })\n },\n clearDmTabs: () => tabs({ dm: [], activeDm: null }),\n setDmMessageId: (dmMessageId) => {\n if (layout.tabs.dmMessageId !== dmMessageId) tabs({ dmMessageId })\n },\n openProjectTab: (projectId) =>\n tabs({\n projects: layout.tabs.projects.includes(projectId)\n ? layout.tabs.projects\n : [...layout.tabs.projects, projectId],\n activeProject: projectId,\n }),\n closeProjectTab: (projectId) => {\n const projects = layout.tabs.projects.filter((id) => id !== projectId)\n if (projects.length === layout.tabs.projects.length) return\n if (layout.tabs.activeProject !== projectId) return tabs({ projects })\n const index = layout.tabs.projects.indexOf(projectId)\n tabs({\n projects,\n activeProject: projects.length ? projects[Math.min(index, projects.length - 1)] : null,\n })\n },\n selectProjectTab: (activeProject) => {\n if (layout.tabs.activeProject !== activeProject) tabs({ activeProject })\n },\n setPageTab: (page, tab) => {\n if (layout.views.tabs[page] !== tab) views({ tabs: { ...layout.views.tabs, [page]: tab } })\n },\n setViewFilter: (key, value) => views({ filters: { ...layout.views.filters, [key]: value } }),\n setViewValue: (key, value) => {\n if (layout.views.values[key] !== value)\n views({ values: { ...layout.views.values, [key]: value } })\n },\n setTransientView: (key, value) => {\n if (layout.views.transient[key] === value) return\n const transient = { ...layout.views.transient }\n if (value === undefined) delete transient[key]\n else transient[key] = value\n views({ transient })\n },\n setGridState: (gridId, state) => grid({ states: { ...layout.grid.states, [gridId]: state } }),\n clearGridState: (gridId) => {\n if (!(gridId in layout.grid.states)) return\n const states = { ...layout.grid.states }\n delete states[gridId]\n grid({ states })\n },\n setGridRowHeight: (gridId, height) =>\n grid({ rowHeights: { ...layout.grid.rowHeights, [gridId]: height } }),\n setGridLabelWidth: (gridId, width) =>\n grid({ labelWidths: { ...layout.grid.labelWidths, [gridId]: width } }),\n setGridSavedViews: (gridId, saved) =>\n grid({ savedViews: { ...layout.grid.savedViews, [gridId]: saved } }),\n resetLayout: (variant) => {\n const fresh = defaultLayoutState()\n update({\n shell: {\n ...fresh.shell,\n panels: {\n ...fresh.shell.panels,\n modes: layout.shell.panels.modes,\n sizes: layout.shell.panels.sizes,\n },\n },\n tabs: fresh.tabs,\n views: { ...layout.views, tabs: {}, transient: {} },\n grid: variant === 'logout' ? { ...layout.grid, states: {} } : layout.grid,\n })\n },\n }\n}\n"],
|
|
5
|
-
"mappings": "AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAiGP,MAAM,cAAwC,CAAC,QAAQ,UAAU,WAAW,QAAQ;AAGpF,MAAM,gBAAgB,MAAM,OAAO,WAAW,eAAe,OAAO,cAAc;AAE3E,S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QACA,MAAM,MAAM;AAAA,QACZ,OAAO,EAAE,GAAG,OAAO,OAAO,MAAM,CAAC,GAAG,WAAW,CAAC,EAAE;AAAA,QAClD,MAAM,YAAY,WAAW,EAAE,GAAG,OAAO,MAAM,QAAQ,CAAC,EAAE,IAAI,OAAO;AAAA,MACvE,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
|
|
4
|
+
"sourcesContent": ["/**\n * The layout part of the session state: the shell (the page on screen, the sidebar, the panels and\n * where each one shows, the area with focus), the open tabs (threads, direct messages, projects),\n * each page's view (its tab, its filters, other view settings) and the grids' saved state. Kits and\n * the host read and change it through the session store; the parts a person arranges (the page, the\n * pinned sidebar, the panels, the thread tabs, the views, the grids) are kept across reloads by the\n * host's {@link ArbiSessionPersist}.\n */\n\nimport type { ArbiSessionPersist } from './persist'\nimport {\n closeThreadTabIn,\n openThreadTabIn,\n parseSavedThreadTabs,\n renameThreadTabIn,\n savedThreadTabs,\n selectThreadTabIn,\n showThreadListIn,\n type ArbiThreadComposer,\n type ArbiThreadTabShow,\n type ArbiThreadTabsState,\n} from './thread-tabs'\n\n/** Where a panel shows: the page's area, docked beside it, over it, or in its own window. */\nexport type ArbiPanelMode = 'main' | 'docked' | 'overlay' | 'popout'\n\nexport interface ArbiPanelsState {\n /** The panel in each place (one each): filling the page, docked, over the page, popped out. */\n main: string | null\n docked: string | null\n overlay: string | null\n popout: string | null\n /** Where each panel last showed (it opens there again). */\n modes: Readonly<Record<string, ArbiPanelMode>>\n /** A floating panel's size. */\n sizes: Readonly<Record<string, { width: number; height: number }>>\n}\n\nexport interface ArbiSidebarState {\n /** Pinned open (on wide screens; phones show a drawer). */\n pinned: boolean\n /** The rail is expanded under the pointer. */\n hovering: boolean\n /** The phone drawer is open. */\n drawerOpen: boolean\n}\n\nexport interface ArbiShellState {\n /** The page on screen (a host's page id). */\n page: string\n sidebar: ArbiSidebarState\n panels: ArbiPanelsState\n /** The area with focus: `main` or a panel id. */\n focusedArea: string\n}\n\n/** A direct-message tab: a person's or agent's id, a group chat's id, or null (a new message). */\nexport interface ArbiDmTab {\n recipientId: string | null\n}\n\nexport interface ArbiTabsState extends ArbiThreadTabsState {\n dm: readonly ArbiDmTab[]\n activeDm: string | null\n /** The message a direct-message tab scrolls to once open. */\n dmMessageId: string | null\n projects: readonly string[]\n activeProject: string | null\n}\n\nexport interface ArbiViewsState {\n /** Each page's tab, by page. */\n tabs: Readonly<Record<string, string>>\n /** Each list's quick filters, by list. */\n filters: Readonly<Record<string, unknown>>\n /** Other view settings, by key (a page's view mode, a zoom, a filter box's text). */\n values: Readonly<Record<string, unknown>>\n /** View state kept for this session only, by key (a search's results); not saved. */\n transient: Readonly<Record<string, unknown>>\n}\n\nexport interface ArbiGridLayoutState {\n /** Each grid's saved state (columns, widths, sort), by grid id. */\n states: Readonly<Record<string, unknown>>\n /** Each grid's row height. */\n rowHeights: Readonly<Record<string, number>>\n /** Each timeline's label column width. */\n labelWidths: Readonly<Record<string, number>>\n /** Views an earlier build saved on this device, by grid id (moved to user settings once). */\n savedViews: Readonly<Record<string, readonly unknown[]>>\n}\n\nexport interface ArbiLayoutState {\n shell: ArbiShellState\n tabs: ArbiTabsState\n views: ArbiViewsState\n grid: ArbiGridLayoutState\n}\n\n/** What is kept across reloads. */\nexport interface ArbiSavedLayout {\n version: 1\n /** The pieces an earlier build's own saved state was brought in for (the host's migration). */\n migrated: string[]\n shell: {\n page: string\n sidebarPinned: boolean\n panels: { main: string | null; docked: string | null } & Pick<\n ArbiPanelsState,\n 'modes' | 'sizes'\n >\n }\n /** The open thread tabs (without what was typed in them) and the one on screen. */\n tabs: Pick<ArbiThreadTabsState, 'threads' | 'activeThread'>\n views: Omit<ArbiViewsState, 'transient'>\n grid: ArbiGridLayoutState\n}\n\nconst PANEL_MODES: readonly ArbiPanelMode[] = ['main', 'docked', 'overlay', 'popout']\n\n/** Phones start with the sidebar as a drawer, wider screens pinned. */\nconst defaultPinned = () => typeof window === 'undefined' || window.innerWidth >= 640\n\nexport function defaultLayoutState(): ArbiLayoutState {\n return {\n shell: {\n page: 'home',\n sidebar: { pinned: defaultPinned(), hovering: false, drawerOpen: false },\n panels: { main: null, docked: null, overlay: null, popout: null, modes: {}, sizes: {} },\n focusedArea: 'main',\n },\n tabs: {\n threads: [],\n activeThread: null,\n threadScrollRestore: null,\n dm: [],\n activeDm: null,\n dmMessageId: null,\n projects: [],\n activeProject: null,\n },\n views: { tabs: {}, filters: {}, values: {}, transient: {} },\n grid: { states: {}, rowHeights: {}, labelWidths: {}, savedViews: {} },\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst recordOf = <T>(value: unknown, keep: (entry: unknown) => entry is T): Record<string, T> =>\n isRecord(value)\n ? (Object.fromEntries(Object.entries(value).filter(([, v]) => keep(v))) as Record<string, T>)\n : {}\n\nconst isString = (v: unknown): v is string => typeof v === 'string'\nconst isNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v)\nconst isAny = (v: unknown): v is unknown => v !== undefined\nconst isMode = (v: unknown): v is ArbiPanelMode => PANEL_MODES.includes(v as ArbiPanelMode)\nconst isSize = (v: unknown): v is { width: number; height: number } =>\n isRecord(v) && isNumber(v.width) && isNumber(v.height)\nconst isList = (v: unknown): v is unknown[] => Array.isArray(v)\nconst stringOrNull = (v: unknown): string | null => (isString(v) ? v : null)\n\n/**\n * A saved layout as this build reads it: whatever an earlier or a broken save left is dropped\n * rather than read. Never throws; null when there is nothing usable.\n */\nexport function parseSavedLayout(saved: unknown): ArbiSavedLayout | null {\n if (!isRecord(saved) || saved.version !== 1) return null\n const shell = isRecord(saved.shell) ? saved.shell : {}\n const panels = isRecord(shell.panels) ? shell.panels : {}\n const tabs = isRecord(saved.tabs) ? saved.tabs : {}\n const views = isRecord(saved.views) ? saved.views : {}\n const grid = isRecord(saved.grid) ? saved.grid : {}\n const defaults = defaultLayoutState()\n return {\n version: 1,\n migrated: isList(saved.migrated) ? saved.migrated.filter(isString) : [],\n shell: {\n page: isString(shell.page) ? shell.page : defaults.shell.page,\n sidebarPinned:\n typeof shell.sidebarPinned === 'boolean'\n ? shell.sidebarPinned\n : defaults.shell.sidebar.pinned,\n panels: {\n main: stringOrNull(panels.main),\n docked: stringOrNull(panels.docked),\n modes: recordOf(panels.modes, isMode),\n sizes: recordOf(panels.sizes, isSize),\n },\n },\n tabs: parseSavedThreadTabs(tabs.threads, tabs.activeThread),\n views: {\n tabs: recordOf(views.tabs, isString),\n filters: recordOf(views.filters, isAny),\n values: recordOf(views.values, isAny),\n },\n grid: {\n states: recordOf(grid.states, isRecord),\n rowHeights: recordOf(grid.rowHeights, isNumber),\n labelWidths: recordOf(grid.labelWidths, isNumber),\n savedViews: recordOf(grid.savedViews, isList),\n },\n }\n}\n\n/** What of a layout is saved. */\nexport function savedLayoutOf(layout: ArbiLayoutState, migrated: string[]): ArbiSavedLayout {\n const { shell, tabs, views, grid } = layout\n return {\n version: 1,\n migrated,\n shell: {\n page: shell.page,\n sidebarPinned: shell.sidebar.pinned,\n // A panel over the page or in its own window does not come back after a reload.\n panels: {\n main: shell.panels.main,\n docked: shell.panels.docked,\n modes: shell.panels.modes,\n sizes: shell.panels.sizes,\n },\n },\n tabs: { threads: savedThreadTabs(tabs.threads), activeThread: tabs.activeThread },\n views: { tabs: views.tabs, filters: views.filters, values: views.values },\n grid,\n }\n}\n\n/** The layout a saved one restores (the parts not saved keep their current values). */\nexport function restoreLayout(current: ArbiLayoutState, saved: ArbiSavedLayout): ArbiLayoutState {\n return {\n ...current,\n shell: {\n ...current.shell,\n page: saved.shell.page,\n sidebar: { ...current.shell.sidebar, pinned: saved.shell.sidebarPinned },\n panels: { ...current.shell.panels, ...saved.shell.panels },\n },\n tabs: { ...current.tabs, ...saved.tabs },\n views: { ...saved.views, transient: current.views.transient },\n grid: saved.grid,\n }\n}\n\n// \u2500\u2500 Changes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Show a panel in a place: it leaves the place it was in, and what was in that place closes. */\nexport function openPanelIn(\n panels: ArbiPanelsState,\n panelId: string,\n mode: ArbiPanelMode,\n options?: { preserveDocked?: boolean }\n): ArbiPanelsState {\n const leave = (slot: string | null) => (slot === panelId ? null : slot)\n const next: ArbiPanelsState = {\n ...panels,\n main: leave(panels.main),\n docked: leave(panels.docked),\n overlay: leave(panels.overlay),\n popout: leave(panels.popout),\n modes: { ...panels.modes, [panelId]: mode },\n }\n // Normally one secondary surface; a temporary overlay may explicitly retain the working dock.\n if (mode === 'docked') return { ...next, docked: panelId, overlay: null }\n if (mode === 'overlay')\n return { ...next, overlay: panelId, docked: options?.preserveDocked ? next.docked : null }\n return { ...next, [mode]: panelId }\n}\n\nexport function closePanelIn(panels: ArbiPanelsState, panelId: string): ArbiPanelsState {\n const leave = (slot: string | null) => (slot === panelId ? null : slot)\n return {\n ...panels,\n main: leave(panels.main),\n docked: leave(panels.docked),\n overlay: leave(panels.overlay),\n popout: leave(panels.popout),\n }\n}\n\n/** Where a panel shows now, or null while it is closed. */\nexport function panelPlace(panels: ArbiPanelsState, panelId: string): ArbiPanelMode | null {\n return PANEL_MODES.find((mode) => panels[mode] === panelId) ?? null\n}\n\n/**\n * The panel that shows the session's `viewingDocument` (a host that shows documents in a panel\n * gives it this id): kits open a document with the environment's `openDocument` and close it here.\n */\nexport const DOCUMENT_VIEWER_PANEL = 'document-viewer'\n\n/** Whether a panel is open (anywhere). */\nexport const isPanelOpen = (state: { shell: ArbiShellState }, panelId: string): boolean =>\n panelPlace(state.shell.panels, panelId) !== null\n\nexport const dmTabId = (tab: ArbiDmTab): string => tab.recipientId ?? 'new'\n\n/** The actions on the layout (part of {@link ArbiSessionStore}). */\nexport interface ArbiLayoutActions {\n /** Show a page; the focus goes to the page area. */\n setPage(page: string): void\n setSidebar(change: Partial<ArbiSidebarState>): void\n /** Show a panel in a place (`mode`), focused. */\n openPanel(panelId: string, mode: ArbiPanelMode, options?: { preserveDocked?: boolean }): void\n closePanel(panelId: string): void\n /** Where a panel shows: an open one moves there, a closed one opens there next time. */\n setPanelMode(panelId: string, mode: ArbiPanelMode): void\n setPanelSize(panelId: string, size: { width: number; height: number }): void\n setFocusedArea(area: string): void\n /** Open (or show) a direct-message tab, optionally scrolled to a message. */\n openDmTab(recipientId: string | null, messageId?: string): void\n closeDmTab(tabId: string): void\n /** null: no direct-message tab (the panel's own). */\n selectDmTab(tabId: string | null): void\n clearDmTabs(): void\n setDmMessageId(messageId: string | null): void\n openProjectTab(projectId: string): void\n closeProjectTab(projectId: string): void\n /** null: the projects list. */\n selectProjectTab(projectId: string | null): void\n setPageTab(page: string, tab: string): void\n setViewFilter(key: string, value: unknown): void\n setViewValue(key: string, value: unknown): void\n /** Set (or with `undefined`, drop) view state kept for this session only. */\n setTransientView(key: string, value: unknown): void\n setGridState(gridId: string, state: unknown): void\n clearGridState(gridId: string): void\n setGridRowHeight(gridId: string, height: number): void\n setGridLabelWidth(gridId: string, width: number): void\n setGridSavedViews(gridId: string, views: readonly unknown[]): void\n /**\n * Start over: a sign-in shows the home page with the sidebar at its default and no panel, tab\n * or page tab open; a sign-out also forgets the grids.\n */\n resetLayout(variant: 'login' | 'logout'): void\n}\n\n/**\n * The thread tabs' changes on a layout store. Each takes the composer being left (saved into the tab\n * on screen) and says what the composer shows next; the session store applies that to whatever\n * holds the composer (`ArbiSessionStore.openThreadTab` and the like are built on these).\n */\nexport interface ArbiThreadTabsController {\n open(\n conversationId: string | null,\n leaving: ArbiThreadComposer\n ): { tabId: string; show: ArbiThreadTabShow }\n close(tabId: string): ArbiThreadTabShow\n select(tabId: string, leaving: ArbiThreadComposer): ArbiThreadTabShow\n showList(leaving: ArbiThreadComposer): void\n /** The tab of `fromId` is now `toId`'s (a new chat got its id). */\n rename(fromId: string, toId: string): void\n clear(): void\n /** The scroll position the last tab switch brought back (once; null after). */\n consumeScrollRestore(): number | null\n}\n\n/** A store of the layout alone; the session stores are built on it. */\nexport interface ArbiLayoutStore extends ArbiLayoutActions {\n getLayout(): ArbiLayoutState\n /** Back to the defaults, everything (unit tests; a reset from an error screen). */\n reset(): void\n subscribe(listener: () => void): () => void\n /** Resolves once the saved layout has been read (at once without a `persist`). */\n hydrated(): Promise<void>\n isHydrated(): boolean\n /** The thread tabs' changes (not session actions: the session store's apply them). */\n threads: ArbiThreadTabsController\n}\n\nexport interface ArbiLayoutStoreOptions {\n persist?: ArbiSessionPersist<ArbiSavedLayout>\n /** The layout to start from (unit tests, a host's initial state); a saved one replaces it. */\n initial?: Partial<ArbiLayoutState>\n}\n\nexport function createArbiLayoutStore({\n persist,\n initial,\n}: ArbiLayoutStoreOptions = {}): ArbiLayoutStore {\n let layout: ArbiLayoutState = { ...defaultLayoutState(), ...initial }\n let migrated: string[] = []\n let isHydrated = !persist\n const listeners = new Set<() => void>()\n const save = () => {\n // Nothing is saved before the saved layout is read: it would overwrite it with the defaults.\n if (persist && isHydrated) persist.save(savedLayoutOf(layout, migrated))\n }\n const update = (next: ArbiLayoutState) => {\n if (next === layout) return\n const persisted =\n next.tabs.threads !== layout.tabs.threads ||\n next.tabs.activeThread !== layout.tabs.activeThread ||\n next.views.tabs !== layout.views.tabs ||\n next.views.filters !== layout.views.filters ||\n next.views.values !== layout.views.values ||\n next.grid !== layout.grid ||\n next.shell.page !== layout.shell.page ||\n next.shell.sidebar.pinned !== layout.shell.sidebar.pinned ||\n next.shell.panels !== layout.shell.panels\n layout = next\n listeners.forEach((listener) => listener())\n if (persisted) save()\n }\n const shell = (change: Partial<ArbiShellState>) =>\n update({ ...layout, shell: { ...layout.shell, ...change } })\n const tabs = (change: Partial<ArbiTabsState>) =>\n update({ ...layout, tabs: { ...layout.tabs, ...change } })\n const views = (change: Partial<ArbiViewsState>) =>\n update({ ...layout, views: { ...layout.views, ...change } })\n const grid = (change: Partial<ArbiGridLayoutState>) =>\n update({ ...layout, grid: { ...layout.grid, ...change } })\n\n const hydration: Promise<void> = persist\n ? persist.load().then(\n (saved) => {\n const parsed = parseSavedLayout(saved)\n if (parsed) {\n migrated = parsed.migrated\n layout = restoreLayout(layout, parsed)\n }\n isHydrated = true\n listeners.forEach((listener) => listener())\n },\n () => {\n isHydrated = true\n listeners.forEach((listener) => listener())\n }\n )\n : Promise.resolve()\n\n return {\n getLayout: () => layout,\n reset: () => update(defaultLayoutState()),\n subscribe: (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n hydrated: () => hydration,\n isHydrated: () => isHydrated,\n threads: {\n open: (conversationId, leaving) => {\n const change = openThreadTabIn(layout.tabs, conversationId, leaving)\n tabs(change.tabs)\n return { tabId: change.tabId, show: change.show }\n },\n close: (tabId) => {\n const change = closeThreadTabIn(layout.tabs, tabId)\n tabs(change.tabs)\n return change.show\n },\n select: (tabId, leaving) => {\n const change = selectThreadTabIn(layout.tabs, tabId, leaving)\n if (change.tabs !== layout.tabs) tabs(change.tabs)\n return change.show\n },\n showList: (leaving) => tabs(showThreadListIn(layout.tabs, leaving)),\n rename: (fromId, toId) => {\n const next = renameThreadTabIn(layout.tabs, fromId, toId)\n if (next !== layout.tabs) tabs(next)\n },\n clear: () => {\n if (layout.tabs.threads.length > 0 || layout.tabs.activeThread !== null)\n tabs({ threads: [], activeThread: null })\n },\n consumeScrollRestore: () => {\n const value = layout.tabs.threadScrollRestore\n if (value !== null) tabs({ threadScrollRestore: null })\n return value\n },\n },\n setPage: (page) => {\n if (layout.shell.page !== page || layout.shell.focusedArea !== 'main')\n shell({ page, focusedArea: 'main' })\n },\n setSidebar: (change) => {\n const sidebar = { ...layout.shell.sidebar, ...change }\n const current = layout.shell.sidebar\n if (\n sidebar.pinned !== current.pinned ||\n sidebar.hovering !== current.hovering ||\n sidebar.drawerOpen !== current.drawerOpen\n )\n shell({ sidebar })\n },\n openPanel: (panelId, mode, options) =>\n shell({\n panels: openPanelIn(layout.shell.panels, panelId, mode, options),\n focusedArea: panelId,\n }),\n closePanel: (panelId) =>\n shell({ panels: closePanelIn(layout.shell.panels, panelId), focusedArea: 'main' }),\n setPanelMode: (panelId, mode) => {\n const panels = layout.shell.panels\n if (panelPlace(panels, panelId) !== null)\n shell({ panels: openPanelIn(panels, panelId, mode), focusedArea: panelId })\n else if (panels.modes[panelId] !== mode)\n shell({ panels: { ...panels, modes: { ...panels.modes, [panelId]: mode } } })\n },\n setPanelSize: (panelId, size) => {\n const panels = layout.shell.panels\n shell({ panels: { ...panels, sizes: { ...panels.sizes, [panelId]: size } } })\n },\n setFocusedArea: (focusedArea) => {\n if (layout.shell.focusedArea !== focusedArea) shell({ focusedArea })\n },\n openDmTab: (recipientId, messageId) => {\n const id = recipientId ?? 'new'\n const dm = layout.tabs.dm.some((tab) => dmTabId(tab) === id)\n ? layout.tabs.dm\n : [...layout.tabs.dm, { recipientId }]\n tabs({ dm, activeDm: id, ...(messageId ? { dmMessageId: messageId } : {}) })\n },\n closeDmTab: (tabId) => {\n const dm = layout.tabs.dm.filter((tab) => dmTabId(tab) !== tabId)\n if (dm.length === layout.tabs.dm.length) return\n if (dm.length === 0) return tabs({ dm, activeDm: null })\n if (layout.tabs.activeDm !== tabId) return tabs({ dm })\n // The tab beside the closed one shows.\n const index = layout.tabs.dm.findIndex((tab) => dmTabId(tab) === tabId)\n tabs({ dm, activeDm: dmTabId(dm[Math.min(index, dm.length - 1)]) })\n },\n selectDmTab: (activeDm) => {\n if (layout.tabs.activeDm !== activeDm) tabs({ activeDm })\n },\n clearDmTabs: () => tabs({ dm: [], activeDm: null }),\n setDmMessageId: (dmMessageId) => {\n if (layout.tabs.dmMessageId !== dmMessageId) tabs({ dmMessageId })\n },\n openProjectTab: (projectId) =>\n tabs({\n projects: layout.tabs.projects.includes(projectId)\n ? layout.tabs.projects\n : [...layout.tabs.projects, projectId],\n activeProject: projectId,\n }),\n closeProjectTab: (projectId) => {\n const projects = layout.tabs.projects.filter((id) => id !== projectId)\n if (projects.length === layout.tabs.projects.length) return\n if (layout.tabs.activeProject !== projectId) return tabs({ projects })\n const index = layout.tabs.projects.indexOf(projectId)\n tabs({\n projects,\n activeProject: projects.length ? projects[Math.min(index, projects.length - 1)] : null,\n })\n },\n selectProjectTab: (activeProject) => {\n if (layout.tabs.activeProject !== activeProject) tabs({ activeProject })\n },\n setPageTab: (page, tab) => {\n if (layout.views.tabs[page] !== tab) views({ tabs: { ...layout.views.tabs, [page]: tab } })\n },\n setViewFilter: (key, value) => views({ filters: { ...layout.views.filters, [key]: value } }),\n setViewValue: (key, value) => {\n if (layout.views.values[key] !== value)\n views({ values: { ...layout.views.values, [key]: value } })\n },\n setTransientView: (key, value) => {\n if (layout.views.transient[key] === value) return\n const transient = { ...layout.views.transient }\n if (value === undefined) delete transient[key]\n else transient[key] = value\n views({ transient })\n },\n setGridState: (gridId, state) => grid({ states: { ...layout.grid.states, [gridId]: state } }),\n clearGridState: (gridId) => {\n if (!(gridId in layout.grid.states)) return\n const states = { ...layout.grid.states }\n delete states[gridId]\n grid({ states })\n },\n setGridRowHeight: (gridId, height) =>\n grid({ rowHeights: { ...layout.grid.rowHeights, [gridId]: height } }),\n setGridLabelWidth: (gridId, width) =>\n grid({ labelWidths: { ...layout.grid.labelWidths, [gridId]: width } }),\n setGridSavedViews: (gridId, saved) =>\n grid({ savedViews: { ...layout.grid.savedViews, [gridId]: saved } }),\n resetLayout: (variant) => {\n const fresh = defaultLayoutState()\n update({\n shell: {\n ...fresh.shell,\n panels: {\n ...fresh.shell.panels,\n modes: layout.shell.panels.modes,\n sizes: layout.shell.panels.sizes,\n },\n },\n tabs: fresh.tabs,\n views: { ...layout.views, tabs: {}, transient: {} },\n grid: variant === 'logout' ? { ...layout.grid, states: {} } : layout.grid,\n })\n },\n }\n}\n"],
|
|
5
|
+
"mappings": "AAUA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAiGP,MAAM,cAAwC,CAAC,QAAQ,UAAU,WAAW,QAAQ;AAGpF,MAAM,gBAAgB,MAAM,OAAO,WAAW,eAAe,OAAO,cAAc;AAE3E,SAAS,qBAAsC;AACpD,SAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,EAAE,QAAQ,cAAc,GAAG,UAAU,OAAO,YAAY,MAAM;AAAA,MACvE,QAAQ,EAAE,MAAM,MAAM,QAAQ,MAAM,SAAS,MAAM,QAAQ,MAAM,OAAO,CAAC,GAAG,OAAO,CAAC,EAAE;AAAA,MACtF,aAAa;AAAA,IACf;AAAA,IACA,MAAM;AAAA,MACJ,SAAS,CAAC;AAAA,MACV,cAAc;AAAA,MACd,qBAAqB;AAAA,MACrB,IAAI,CAAC;AAAA,MACL,UAAU;AAAA,MACV,aAAa;AAAA,MACb,UAAU,CAAC;AAAA,MACX,eAAe;AAAA,IACjB;AAAA,IACA,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,GAAG,QAAQ,CAAC,GAAG,WAAW,CAAC,EAAE;AAAA,IAC1D,MAAM,EAAE,QAAQ,CAAC,GAAG,YAAY,CAAC,GAAG,aAAa,CAAC,GAAG,YAAY,CAAC,EAAE;AAAA,EACtE;AACF;AAEA,MAAM,WAAW,CAAC,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,WAAW,CAAI,OAAgB,SACnC,SAAS,KAAK,IACT,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC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KAAK,aAAa,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;AAAA,IACvE,mBAAmB,CAAC,QAAQ,UAC1B,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,KAAK,YAAY,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;AAAA,IACrE,aAAa,CAAC,YAAY;AACxB,YAAM,QAAQ,mBAAmB;AACjC,aAAO;AAAA,QACL,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,QAAQ;AAAA,YACN,GAAG,MAAM,MAAM;AAAA,YACf,OAAO,OAAO,MAAM,OAAO;AAAA,YAC3B,OAAO,OAAO,MAAM,OAAO;AAAA,UAC7B;AAAA,QACF;AAAA,QACA,MAAM,MAAM;AAAA,QACZ,OAAO,EAAE,GAAG,OAAO,OAAO,MAAM,CAAC,GAAG,WAAW,CAAC,EAAE;AAAA,QAClD,MAAM,YAAY,WAAW,EAAE,GAAG,OAAO,MAAM,QAAQ,CAAC,EAAE,IAAI,OAAO;AAAA,MACvE,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import { isAbortError } from "@arbidocs/client";
|
|
7
7
|
import { useArbi } from "../useArbi.js";
|
|
8
8
|
import { arbiQueryKeys, useWorkspaces } from "../hooks.js";
|
|
9
|
+
import { seedConversationList } from "../conversation-list.js";
|
|
9
10
|
import { useArbiSessionState, useArbiSessionStore } from "../session/index.js";
|
|
10
11
|
import { notify } from "../notifications/notify-store.js";
|
|
11
12
|
import { getEntityLabel } from "../entities/registry.js";
|
|
@@ -23,9 +24,9 @@ function drainWorkspaceQueries(queryClient) {
|
|
|
23
24
|
queryClient.removeQueries({ queryKey });
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
|
-
function seedOpenedWorkspace(queryClient, workspaceId, opened) {
|
|
27
|
+
function seedOpenedWorkspace(queryClient, workspaceId, opened, requestedAt) {
|
|
27
28
|
if (opened.conversations)
|
|
28
|
-
queryClient
|
|
29
|
+
seedConversationList(queryClient, workspaceId, opened.conversations, requestedAt);
|
|
29
30
|
if (opened.tags) queryClient.setQueryData(arbiQueryKeys.tags(workspaceId), opened.tags);
|
|
30
31
|
}
|
|
31
32
|
function isWorkspaceArchivedError(error) {
|
|
@@ -96,6 +97,7 @@ function createWorkspaceSwitch({
|
|
|
96
97
|
session.setWorkspaceStatus("opening");
|
|
97
98
|
performance.mark("arbi:workspace-open:start");
|
|
98
99
|
let opened;
|
|
100
|
+
const requestedAt = Date.now();
|
|
99
101
|
try {
|
|
100
102
|
opened = await arbi().selectWorkspace(target.id);
|
|
101
103
|
} catch (error) {
|
|
@@ -118,7 +120,7 @@ function createWorkspaceSwitch({
|
|
|
118
120
|
return false;
|
|
119
121
|
}
|
|
120
122
|
if (epoch !== switchEpoch) return false;
|
|
121
|
-
seedOpenedWorkspace(queryClient, target.id, opened);
|
|
123
|
+
seedOpenedWorkspace(queryClient, target.id, opened, requestedAt);
|
|
122
124
|
performance.mark("arbi:workspace-open:response");
|
|
123
125
|
session.setWorkspaceId(target.id);
|
|
124
126
|
session.setWorkspaceStatus("open");
|
|
@@ -141,6 +143,7 @@ function createWorkspaceSwitch({
|
|
|
141
143
|
if (epoch !== switchEpoch || session.getState().workspaceId !== workspaceId) return false;
|
|
142
144
|
performance.mark("arbi:workspace-open:start");
|
|
143
145
|
let opened;
|
|
146
|
+
const requestedAt = Date.now();
|
|
144
147
|
try {
|
|
145
148
|
opened = await arbi().selectWorkspace(workspaceId);
|
|
146
149
|
} catch (error) {
|
|
@@ -150,7 +153,7 @@ function createWorkspaceSwitch({
|
|
|
150
153
|
return false;
|
|
151
154
|
}
|
|
152
155
|
if (epoch !== switchEpoch || session.getState().workspaceId !== workspaceId) return false;
|
|
153
|
-
seedOpenedWorkspace(queryClient, workspaceId, opened);
|
|
156
|
+
seedOpenedWorkspace(queryClient, workspaceId, opened, requestedAt);
|
|
154
157
|
performance.mark("arbi:workspace-open:response");
|
|
155
158
|
session.setWorkspaceStatus("open");
|
|
156
159
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/workspaces/switch.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Switching the workspace the app is in: the one coordinator for \"the user is now in workspace X\".\n *\n * The server keeps the active workspace in the session, so every workspace-scoped GET reads the\n * workspace currently open for the session. A naive switch (set the id, `/open` in the background)\n * races every observer that refetches when the id changes: those requests reach a server still in\n * the previous workspace and seed the cache with its data. `switchWorkspace` keeps the order:\n *\n * 1. leave the workspace: its session state (`leaveWorkspace`) and its cached queries go, so\n * nothing shows or refetches the old workspace's data;\n * 2. the selection is cleared, so queries gated on it stop during the round trip;\n * 3. `arbi.selectWorkspace(target)`: the server session is now in the target;\n * 4. the conversations and tags `/open` returned seed their lists, then the selection is\n * committed (`workspaceId`, `workspaceStatus: 'open'`).\n *\n * Concurrent switches (A, then B, then C in quick succession): only the last one commits, and the\n * SDK runs the opens one at a time with the latest request winning, so the server session ends in\n * the last one too. `settled` waits out the switches in flight.\n *\n * A sign-out (`arbi.onSigningOut`, before the server revokes the token) overtakes every switch and\n * open in flight and cancels the queries in flight: the SDK has already stopped new requests and\n * aborts the ones in flight, so none comes back 401 or is reported as a failure.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { onlineManager, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport {\n ArbiWorkspaceSupersededError,\n type Arbi,\n type WorkspaceOpenResponse,\n} from '@arbidocs/sdk/browser'\nimport { isAbortError } from '@arbidocs/client'\nimport { useArbi } from '../useArbi'\nimport { arbiQueryKeys, useWorkspaces } from '../hooks'\nimport { useArbiSessionState, useArbiSessionStore, type ArbiSessionStore } from '../session'\nimport { notify } from '../notifications/notify-store'\nimport { getEntityLabel } from '../entities/registry'\n\n/**\n * What depends on the session's open workspace: dropped on a switch, so nothing of the workspace\n * left shows in the next, and a return reads it afresh.\n */\nconst WORKSPACE_SCOPED_PACKAGE_KEYS = [\n arbiQueryKeys.allDocuments(),\n arbiQueryKeys.allSimilarDocuments(),\n arbiQueryKeys.allWorkspaceUsers(),\n arbiQueryKeys.documentSignatures(),\n arbiQueryKeys.signatureRequests(),\n arbiQueryKeys.databases(),\n]\n\n/** Cancel (so nothing in flight lands afterwards) and drop every workspace-scoped query. */\nfunction drainWorkspaceQueries(queryClient: QueryClient): void {\n for (const queryKey of WORKSPACE_SCOPED_PACKAGE_KEYS) {\n void queryClient.cancelQueries({ queryKey })\n queryClient.removeQueries({ queryKey })\n }\n}\n\n/** The conversations and tags `/open` returned seed their lists (patched in place from then on). */\nfunction seedOpenedWorkspace(\n queryClient: QueryClient,\n workspaceId: string,\n opened: WorkspaceOpenResponse\n): void {\n if (opened.conversations)\n queryClient.setQueryData(arbiQueryKeys.conversations(workspaceId), opened.conversations)\n if (opened.tags) queryClient.setQueryData(arbiQueryKeys.tags(workspaceId), opened.tags)\n}\n\n/** The server refused to open an archived workspace (423 `workspace_archived`). */\nexport function isWorkspaceArchivedError(error: unknown): boolean {\n const body = (error as { apiError?: unknown } | null | undefined)?.apiError ?? error\n const detail = (body as { detail?: unknown } | null | undefined)?.detail\n return (\n !!detail &&\n typeof detail === 'object' &&\n (detail as { code?: unknown }).code === 'workspace_archived'\n )\n}\n\n/** What to tell someone who tried to open an archived workspace. */\nexport const archivedWorkspaceMessage = (name: string) =>\n `\"${name}\" is archived. Its owner can unarchive it from the workspace list.`\n\ninterface ListedWorkspace {\n external_id: string\n name: string\n archive?: unknown\n}\n\nconst listedWorkspace = (queryClient: QueryClient, workspaceId: string) =>\n queryClient\n .getQueryData<ListedWorkspace[]>(arbiQueryKeys.workspaces())\n ?.find((w) => w.external_id === workspaceId)\n\n// One sequence for every hook instance, so a newer switch anywhere wins.\nlet switchEpoch = 0\n// The switches not yet settled (opened, refused or overtaken).\nconst switching = new Set<Promise<boolean>>()\n\n/** Exported for tests. */\nexport const resetSwitchEpochForTests = () => {\n switchEpoch = 0\n switching.clear()\n}\n\n/** How long a switch waits for the signed-in session to reach its `Arbi` (see `signedIn`). */\nconst SIGNED_IN_WAIT_MS = 10_000\nconst SIGNED_IN_POLL_MS = 50\n\n/**\n * Wait until the `Arbi` in scope holds the login. Right after a sign-in (or a reload) the session\n * is signed in before the host's `Arbi` has its keys (a host reads them from the device and then\n * renews its `Arbi`): an open asked for in that window would fail with \"Not logged in\". Resolves\n * at once when it holds them, or when the session is not signed in at all (nothing to wait for).\n */\nasync function signedIn(arbi: () => Arbi, timeoutMs = SIGNED_IN_WAIT_MS): Promise<void> {\n const deadline = Date.now() + timeoutMs\n while (\n !arbi().isLoggedIn &&\n arbi().session?.getState().signedIn === true &&\n Date.now() < deadline\n ) {\n await new Promise((resolve) => setTimeout(resolve, SIGNED_IN_POLL_MS))\n }\n}\n\n/** Resolves once no workspace switch is in flight (including any started while waiting). */\nasync function switchesSettled(): Promise<void> {\n while (switching.size > 0) await Promise.allSettled([...switching])\n}\n\nexport interface SwitchWorkspaceTarget {\n id: string\n /** For the notices; default: the name in the workspace list. */\n name?: string\n}\n\nexport interface UseSwitchWorkspaceResult {\n /**\n * Make `target` the workspace the app is in. True once it is open (at once when it already\n * is); false when it could not be (archived, offline, refused: the user was told), or when a\n * newer switch overtook it.\n */\n switchWorkspace: (target: SwitchWorkspaceTarget) => Promise<boolean>\n /** Leave the workspace for none (after deleting or leaving it), with the same clean-up. */\n clearWorkspace: () => void\n /**\n * Open the selected workspace on the server session as it is, without leaving anything or a\n * notice: after a sign-in or a reload (a new server session), or to re-assert it before a write.\n * False when there is none, it could not be opened, or a switch overtook it.\n */\n openSelectedWorkspace: () => Promise<boolean>\n /**\n * Resolves once no switch is in flight: the selection is then committed (or back to where it\n * was), so reading it says which workspace the session is in.\n */\n settled: () => Promise<void>\n}\n\n/** What a workspace switch runs on. */\nexport interface WorkspaceSwitchContext {\n /** The `Arbi` on the signed-in session, as of the switch. */\n arbi: () => Arbi\n session: ArbiSessionStore\n queryClient: QueryClient\n}\n\n/**\n * The workspace switch over a host's session, for code that runs outside `<ArbiHost>` (a host's\n * own environment, built before its host). Inside, use `useSwitchWorkspace`.\n */\nexport function createWorkspaceSwitch({\n arbi,\n session,\n queryClient,\n}: WorkspaceSwitchContext): UseSwitchWorkspaceResult {\n const switchWorkspace = (target: SwitchWorkspaceTarget): Promise<boolean> => {\n const run = runSwitch(target)\n switching.add(run)\n void run.finally(() => switching.delete(run))\n return run\n }\n\n const runSwitch = async (target: SwitchWorkspaceTarget): Promise<boolean> => {\n const { workspaceId: previousId, workspaceStatus } = session.getState()\n const isSame = previousId === target.id\n if (isSame && workspaceStatus === 'open') return true\n\n const listed = listedWorkspace(queryClient, target.id)\n const name = target.name || listed?.name || ''\n const noun = getEntityLabel('WORKSPACE')\n // An archived workspace cannot be opened: say so before leaving the current one.\n if (listed?.archive) {\n notify.info(archivedWorkspaceMessage(name))\n return false\n }\n // Offline, the user stays in the workspace they are in: another one's lists cannot load.\n if (!isSame && !onlineManager.isOnline()) {\n notify.info(\n `You're offline \u2014 you can only use the ${noun} you're already in. Reconnect to switch.`\n )\n return false\n }\n\n const epoch = ++switchEpoch\n const opening = notify.info(`Opening \"${name}\" ${noun}\u2026`, {\n workspaceId: target.id,\n duration: 2000,\n })\n try {\n // Signed in, but the keys not on this `Arbi` yet: the open waits for them, not fails.\n await signedIn(arbi)\n if (epoch !== switchEpoch) return false\n // Not yet open (a reload): nothing to leave, it only needs `/open`.\n if (!isSame) {\n session.leaveWorkspace()\n drainWorkspaceQueries(queryClient)\n session.setWorkspaceId(null)\n }\n session.setWorkspaceStatus('opening')\n\n performance.mark('arbi:workspace-open:start')\n let opened: WorkspaceOpenResponse\n try {\n opened = await arbi().selectWorkspace(target.id)\n } catch (error) {\n // A sign-out stopped it: the session is going, nothing to restore or report.\n if (isAbortError(error)) return false\n const superseded = error instanceof ArbiWorkspaceSupersededError\n if (!superseded) console.error('[switchWorkspace] /open failed:', error)\n // Overtaken before its turn by a newer switch: that one commits. By an open from elsewhere\n // (no newer switch): back to the previous selection, closed, as for a failure.\n if (superseded && epoch === switchEpoch) {\n if (previousId) session.setWorkspaceId(previousId)\n session.setWorkspaceStatus('closed')\n } else if (epoch === switchEpoch) {\n // Back to the previous selection, closed: `useOpenSelectedWorkspace` opens it again.\n if (previousId) session.setWorkspaceId(previousId)\n session.setWorkspaceStatus('closed')\n if (isWorkspaceArchivedError(error)) {\n // Archived since the list was read: refresh it so it shows as archived.\n notify.info(archivedWorkspaceMessage(name))\n void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n } else {\n notify.error(`Failed to open \"${name}\" ${noun}`)\n }\n }\n return false\n }\n // A newer switch started meanwhile: it commits, not this one.\n if (epoch !== switchEpoch) return false\n\n seedOpenedWorkspace(queryClient, target.id, opened)\n performance.mark('arbi:workspace-open:response')\n session.setWorkspaceId(target.id)\n session.setWorkspaceStatus('open')\n return true\n } finally {\n // The open is over (open, failed or overtaken): its progress toast goes with it.\n notify.dismiss(opening)\n }\n }\n\n const clearWorkspace = () => {\n ++switchEpoch\n session.leaveWorkspace()\n drainWorkspaceQueries(queryClient)\n session.setWorkspaceId(null)\n }\n\n const openSelectedWorkspace = async (): Promise<boolean> => {\n const workspaceId = session.getState().workspaceId\n if (!workspaceId) return false\n const epoch = switchEpoch\n await signedIn(arbi)\n if (epoch !== switchEpoch || session.getState().workspaceId !== workspaceId) return false\n performance.mark('arbi:workspace-open:start')\n let opened: WorkspaceOpenResponse\n try {\n opened = await arbi().selectWorkspace(workspaceId)\n } catch (error) {\n // Overtaken by a newer open, or stopped by a sign-out: nothing to report.\n if (!(error instanceof ArbiWorkspaceSupersededError) && !isAbortError(error)) {\n console.error('[openSelectedWorkspace] /open failed:', error)\n }\n return false\n }\n // A switch started meanwhile: it commits its own workspace.\n if (epoch !== switchEpoch || session.getState().workspaceId !== workspaceId) return false\n seedOpenedWorkspace(queryClient, workspaceId, opened)\n performance.mark('arbi:workspace-open:response')\n session.setWorkspaceStatus('open')\n return true\n }\n\n return { switchWorkspace, clearWorkspace, openSelectedWorkspace, settled: switchesSettled }\n}\n\n/** The workspace switch of the `<ArbiHost>` in scope (its `Arbi`, its session state). */\nexport function useSwitchWorkspace(): UseSwitchWorkspaceResult {\n const arbi = useArbi()\n const arbiRef = useRef(arbi)\n arbiRef.current = arbi\n const session = useArbiSessionStore()\n const queryClient = useQueryClient()\n // Signing out: the switches and opens in flight are overtaken, the queries in flight cancelled.\n useEffect(\n () =>\n arbi.onSigningOut?.(() => {\n ++switchEpoch\n void queryClient.cancelQueries()\n }),\n [arbi, queryClient]\n )\n return useMemo(\n () => createWorkspaceSwitch({ arbi: () => arbiRef.current, session, queryClient }),\n [session, queryClient]\n )\n}\n\n/**\n * Keep the selected workspace open on the server session: open it once signed in (after a\n * sign-in or a reload, when the selection was kept but the server session is new), and drop it\n * when the workspace list says it was archived since (by its owner, perhaps on another device),\n * or that it is gone (deleted, or the person left or was removed): the app is then on the\n * workspace list. Mounted once, by the signed-in app.\n */\nexport function useOpenSelectedWorkspace(): void {\n const arbi = useArbi()\n const { clearWorkspace, openSelectedWorkspace } = useSwitchWorkspace()\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const status = useArbiSessionState((s) => s.workspaceStatus)\n const session = useArbiSessionStore()\n const queryClient = useQueryClient()\n const { data: workspaces, isLoading: listing, isFetching } = useWorkspaces()\n const listed = workspaces as ListedWorkspace[] | undefined\n const archived = listed?.find((w) => w.external_id === workspaceId && w.archive)\n // The open workspace is gone (deleted, or the person left or was removed) once a list read after\n // it was opened no longer has it: one read before (access granted since) may not have it yet.\n // (Counted, not timed: a read can land in the same millisecond.)\n const reads = queryClient.getQueryState(arbiQueryKeys.workspaces())?.dataUpdateCount ?? 0\n const opened = useRef<{ id: string | null; reads: number }>({ id: null, reads: 0 })\n const openId = status === 'open' ? workspaceId : null\n if (opened.current.id !== openId) opened.current = { id: openId, reads }\n const gone =\n !!openId &&\n !!listed &&\n !isFetching &&\n reads > opened.current.reads &&\n !listed.some((w) => w.external_id === openId)\n\n useEffect(() => {\n if (!archived) return\n notify.info(archivedWorkspaceMessage(archived.name))\n clearWorkspace()\n }, [archived, clearWorkspace])\n\n useEffect(() => {\n if (gone) clearWorkspace()\n }, [gone, clearWorkspace])\n\n // One open at a time; a failed one is tried again when the session or selection changes.\n const opening = useRef(false)\n const signedIn = arbi.isLoggedIn\n useEffect(() => {\n // After the workspace list: it says whether the workspace was archived, and it holds the key\n // the open needs (no list of the open's own).\n if (\n !workspaceId ||\n archived ||\n gone ||\n listing ||\n status !== 'closed' ||\n !signedIn ||\n opening.current\n )\n return\n opening.current = true\n void openSelectedWorkspace()\n .then(async (ok) => {\n if (ok) return\n // Refused: deleted, or left, since (the kept selection of a reload)? The list read now\n // says. (Not the list a reload restores: it may predate a workspace created since.)\n const fresh = await queryClient\n .fetchQuery({\n queryKey: arbiQueryKeys.workspaces(),\n queryFn: () => arbi.workspaces.list(),\n staleTime: 0,\n })\n .catch(() => null)\n if (\n fresh &&\n session.getState().workspaceId === workspaceId &&\n !(fresh as ListedWorkspace[]).some((w) => w.external_id === workspaceId)\n )\n clearWorkspace()\n })\n .finally(() => {\n opening.current = false\n })\n }, [\n arbi,\n session,\n clearWorkspace,\n openSelectedWorkspace,\n queryClient,\n workspaceId,\n archived,\n gone,\n listing,\n status,\n signedIn,\n ])\n}\n"],
|
|
5
|
-
"mappings": "AAwBA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,eAAe,sBAAwC;AAChE;AAAA,EACE;AAAA,OAGK;AACP,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,eAAe,qBAAqB;AAC7C,SAAS,qBAAqB,2BAAkD;AAChF,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAM/B,MAAM,gCAAgC;AAAA,EACpC,cAAc,aAAa;AAAA,EAC3B,cAAc,oBAAoB;AAAA,EAClC,cAAc,kBAAkB;AAAA,EAChC,cAAc,mBAAmB;AAAA,EACjC,cAAc,kBAAkB;AAAA,EAChC,cAAc,UAAU;AAC1B;AAGA,SAAS,sBAAsB,aAAgC;AAC7D,aAAW,YAAY,+BAA+B;AACpD,SAAK,YAAY,cAAc,EAAE,SAAS,CAAC;AAC3C,gBAAY,cAAc,EAAE,SAAS,CAAC;AAAA,EACxC;AACF;AAGA,SAAS,oBACP,aACA,aACA,
|
|
4
|
+
"sourcesContent": ["/**\n * Switching the workspace the app is in: the one coordinator for \"the user is now in workspace X\".\n *\n * The server keeps the active workspace in the session, so every workspace-scoped GET reads the\n * workspace currently open for the session. A naive switch (set the id, `/open` in the background)\n * races every observer that refetches when the id changes: those requests reach a server still in\n * the previous workspace and seed the cache with its data. `switchWorkspace` keeps the order:\n *\n * 1. leave the workspace: its session state (`leaveWorkspace`) and its cached queries go, so\n * nothing shows or refetches the old workspace's data;\n * 2. the selection is cleared, so queries gated on it stop during the round trip;\n * 3. `arbi.selectWorkspace(target)`: the server session is now in the target;\n * 4. the conversations and tags `/open` returned seed their lists, then the selection is\n * committed (`workspaceId`, `workspaceStatus: 'open'`).\n *\n * Concurrent switches (A, then B, then C in quick succession): only the last one commits, and the\n * SDK runs the opens one at a time with the latest request winning, so the server session ends in\n * the last one too. `settled` waits out the switches in flight.\n *\n * A sign-out (`arbi.onSigningOut`, before the server revokes the token) overtakes every switch and\n * open in flight and cancels the queries in flight: the SDK has already stopped new requests and\n * aborts the ones in flight, so none comes back 401 or is reported as a failure.\n */\n\nimport { useEffect, useMemo, useRef } from 'react'\nimport { onlineManager, useQueryClient, type QueryClient } from '@tanstack/react-query'\nimport {\n ArbiWorkspaceSupersededError,\n type Arbi,\n type WorkspaceOpenResponse,\n} from '@arbidocs/sdk/browser'\nimport { isAbortError } from '@arbidocs/client'\nimport { useArbi } from '../useArbi'\nimport { arbiQueryKeys, useWorkspaces } from '../hooks'\nimport { seedConversationList } from '../conversation-list'\nimport { useArbiSessionState, useArbiSessionStore, type ArbiSessionStore } from '../session'\nimport { notify } from '../notifications/notify-store'\nimport { getEntityLabel } from '../entities/registry'\n\n/**\n * What depends on the session's open workspace: dropped on a switch, so nothing of the workspace\n * left shows in the next, and a return reads it afresh.\n */\nconst WORKSPACE_SCOPED_PACKAGE_KEYS = [\n arbiQueryKeys.allDocuments(),\n arbiQueryKeys.allSimilarDocuments(),\n arbiQueryKeys.allWorkspaceUsers(),\n arbiQueryKeys.documentSignatures(),\n arbiQueryKeys.signatureRequests(),\n arbiQueryKeys.databases(),\n]\n\n/** Cancel (so nothing in flight lands afterwards) and drop every workspace-scoped query. */\nfunction drainWorkspaceQueries(queryClient: QueryClient): void {\n for (const queryKey of WORKSPACE_SCOPED_PACKAGE_KEYS) {\n void queryClient.cancelQueries({ queryKey })\n queryClient.removeQueries({ queryKey })\n }\n}\n\n/** The conversations and tags `/open` returned seed their lists (local writes since it was sent kept). */\nfunction seedOpenedWorkspace(\n queryClient: QueryClient,\n workspaceId: string,\n opened: WorkspaceOpenResponse,\n requestedAt: number\n): void {\n if (opened.conversations)\n seedConversationList(queryClient, workspaceId, opened.conversations, requestedAt)\n if (opened.tags) queryClient.setQueryData(arbiQueryKeys.tags(workspaceId), opened.tags)\n}\n\n/** The server refused to open an archived workspace (423 `workspace_archived`). */\nexport function isWorkspaceArchivedError(error: unknown): boolean {\n const body = (error as { apiError?: unknown } | null | undefined)?.apiError ?? error\n const detail = (body as { detail?: unknown } | null | undefined)?.detail\n return (\n !!detail &&\n typeof detail === 'object' &&\n (detail as { code?: unknown }).code === 'workspace_archived'\n )\n}\n\n/** What to tell someone who tried to open an archived workspace. */\nexport const archivedWorkspaceMessage = (name: string) =>\n `\"${name}\" is archived. Its owner can unarchive it from the workspace list.`\n\ninterface ListedWorkspace {\n external_id: string\n name: string\n archive?: unknown\n}\n\nconst listedWorkspace = (queryClient: QueryClient, workspaceId: string) =>\n queryClient\n .getQueryData<ListedWorkspace[]>(arbiQueryKeys.workspaces())\n ?.find((w) => w.external_id === workspaceId)\n\n// One sequence for every hook instance, so a newer switch anywhere wins.\nlet switchEpoch = 0\n// The switches not yet settled (opened, refused or overtaken).\nconst switching = new Set<Promise<boolean>>()\n\n/** Exported for tests. */\nexport const resetSwitchEpochForTests = () => {\n switchEpoch = 0\n switching.clear()\n}\n\n/** How long a switch waits for the signed-in session to reach its `Arbi` (see `signedIn`). */\nconst SIGNED_IN_WAIT_MS = 10_000\nconst SIGNED_IN_POLL_MS = 50\n\n/**\n * Wait until the `Arbi` in scope holds the login. Right after a sign-in (or a reload) the session\n * is signed in before the host's `Arbi` has its keys (a host reads them from the device and then\n * renews its `Arbi`): an open asked for in that window would fail with \"Not logged in\". Resolves\n * at once when it holds them, or when the session is not signed in at all (nothing to wait for).\n */\nasync function signedIn(arbi: () => Arbi, timeoutMs = SIGNED_IN_WAIT_MS): Promise<void> {\n const deadline = Date.now() + timeoutMs\n while (\n !arbi().isLoggedIn &&\n arbi().session?.getState().signedIn === true &&\n Date.now() < deadline\n ) {\n await new Promise((resolve) => setTimeout(resolve, SIGNED_IN_POLL_MS))\n }\n}\n\n/** Resolves once no workspace switch is in flight (including any started while waiting). */\nasync function switchesSettled(): Promise<void> {\n while (switching.size > 0) await Promise.allSettled([...switching])\n}\n\nexport interface SwitchWorkspaceTarget {\n id: string\n /** For the notices; default: the name in the workspace list. */\n name?: string\n}\n\nexport interface UseSwitchWorkspaceResult {\n /**\n * Make `target` the workspace the app is in. True once it is open (at once when it already\n * is); false when it could not be (archived, offline, refused: the user was told), or when a\n * newer switch overtook it.\n */\n switchWorkspace: (target: SwitchWorkspaceTarget) => Promise<boolean>\n /** Leave the workspace for none (after deleting or leaving it), with the same clean-up. */\n clearWorkspace: () => void\n /**\n * Open the selected workspace on the server session as it is, without leaving anything or a\n * notice: after a sign-in or a reload (a new server session), or to re-assert it before a write.\n * False when there is none, it could not be opened, or a switch overtook it.\n */\n openSelectedWorkspace: () => Promise<boolean>\n /**\n * Resolves once no switch is in flight: the selection is then committed (or back to where it\n * was), so reading it says which workspace the session is in.\n */\n settled: () => Promise<void>\n}\n\n/** What a workspace switch runs on. */\nexport interface WorkspaceSwitchContext {\n /** The `Arbi` on the signed-in session, as of the switch. */\n arbi: () => Arbi\n session: ArbiSessionStore\n queryClient: QueryClient\n}\n\n/**\n * The workspace switch over a host's session, for code that runs outside `<ArbiHost>` (a host's\n * own environment, built before its host). Inside, use `useSwitchWorkspace`.\n */\nexport function createWorkspaceSwitch({\n arbi,\n session,\n queryClient,\n}: WorkspaceSwitchContext): UseSwitchWorkspaceResult {\n const switchWorkspace = (target: SwitchWorkspaceTarget): Promise<boolean> => {\n const run = runSwitch(target)\n switching.add(run)\n void run.finally(() => switching.delete(run))\n return run\n }\n\n const runSwitch = async (target: SwitchWorkspaceTarget): Promise<boolean> => {\n const { workspaceId: previousId, workspaceStatus } = session.getState()\n const isSame = previousId === target.id\n if (isSame && workspaceStatus === 'open') return true\n\n const listed = listedWorkspace(queryClient, target.id)\n const name = target.name || listed?.name || ''\n const noun = getEntityLabel('WORKSPACE')\n // An archived workspace cannot be opened: say so before leaving the current one.\n if (listed?.archive) {\n notify.info(archivedWorkspaceMessage(name))\n return false\n }\n // Offline, the user stays in the workspace they are in: another one's lists cannot load.\n if (!isSame && !onlineManager.isOnline()) {\n notify.info(\n `You're offline \u2014 you can only use the ${noun} you're already in. Reconnect to switch.`\n )\n return false\n }\n\n const epoch = ++switchEpoch\n const opening = notify.info(`Opening \"${name}\" ${noun}\u2026`, {\n workspaceId: target.id,\n duration: 2000,\n })\n try {\n // Signed in, but the keys not on this `Arbi` yet: the open waits for them, not fails.\n await signedIn(arbi)\n if (epoch !== switchEpoch) return false\n // Not yet open (a reload): nothing to leave, it only needs `/open`.\n if (!isSame) {\n session.leaveWorkspace()\n drainWorkspaceQueries(queryClient)\n session.setWorkspaceId(null)\n }\n session.setWorkspaceStatus('opening')\n\n performance.mark('arbi:workspace-open:start')\n let opened: WorkspaceOpenResponse\n const requestedAt = Date.now()\n try {\n opened = await arbi().selectWorkspace(target.id)\n } catch (error) {\n // A sign-out stopped it: the session is going, nothing to restore or report.\n if (isAbortError(error)) return false\n const superseded = error instanceof ArbiWorkspaceSupersededError\n if (!superseded) console.error('[switchWorkspace] /open failed:', error)\n // Overtaken before its turn by a newer switch: that one commits. By an open from elsewhere\n // (no newer switch): back to the previous selection, closed, as for a failure.\n if (superseded && epoch === switchEpoch) {\n if (previousId) session.setWorkspaceId(previousId)\n session.setWorkspaceStatus('closed')\n } else if (epoch === switchEpoch) {\n // Back to the previous selection, closed: `useOpenSelectedWorkspace` opens it again.\n if (previousId) session.setWorkspaceId(previousId)\n session.setWorkspaceStatus('closed')\n if (isWorkspaceArchivedError(error)) {\n // Archived since the list was read: refresh it so it shows as archived.\n notify.info(archivedWorkspaceMessage(name))\n void queryClient.invalidateQueries({ queryKey: arbiQueryKeys.workspaces() })\n } else {\n notify.error(`Failed to open \"${name}\" ${noun}`)\n }\n }\n return false\n }\n // A newer switch started meanwhile: it commits, not this one.\n if (epoch !== switchEpoch) return false\n\n seedOpenedWorkspace(queryClient, target.id, opened, requestedAt)\n performance.mark('arbi:workspace-open:response')\n session.setWorkspaceId(target.id)\n session.setWorkspaceStatus('open')\n return true\n } finally {\n // The open is over (open, failed or overtaken): its progress toast goes with it.\n notify.dismiss(opening)\n }\n }\n\n const clearWorkspace = () => {\n ++switchEpoch\n session.leaveWorkspace()\n drainWorkspaceQueries(queryClient)\n session.setWorkspaceId(null)\n }\n\n const openSelectedWorkspace = async (): Promise<boolean> => {\n const workspaceId = session.getState().workspaceId\n if (!workspaceId) return false\n const epoch = switchEpoch\n await signedIn(arbi)\n if (epoch !== switchEpoch || session.getState().workspaceId !== workspaceId) return false\n performance.mark('arbi:workspace-open:start')\n let opened: WorkspaceOpenResponse\n const requestedAt = Date.now()\n try {\n opened = await arbi().selectWorkspace(workspaceId)\n } catch (error) {\n // Overtaken by a newer open, or stopped by a sign-out: nothing to report.\n if (!(error instanceof ArbiWorkspaceSupersededError) && !isAbortError(error)) {\n console.error('[openSelectedWorkspace] /open failed:', error)\n }\n return false\n }\n // A switch started meanwhile: it commits its own workspace.\n if (epoch !== switchEpoch || session.getState().workspaceId !== workspaceId) return false\n seedOpenedWorkspace(queryClient, workspaceId, opened, requestedAt)\n performance.mark('arbi:workspace-open:response')\n session.setWorkspaceStatus('open')\n return true\n }\n\n return { switchWorkspace, clearWorkspace, openSelectedWorkspace, settled: switchesSettled }\n}\n\n/** The workspace switch of the `<ArbiHost>` in scope (its `Arbi`, its session state). */\nexport function useSwitchWorkspace(): UseSwitchWorkspaceResult {\n const arbi = useArbi()\n const arbiRef = useRef(arbi)\n arbiRef.current = arbi\n const session = useArbiSessionStore()\n const queryClient = useQueryClient()\n // Signing out: the switches and opens in flight are overtaken, the queries in flight cancelled.\n useEffect(\n () =>\n arbi.onSigningOut?.(() => {\n ++switchEpoch\n void queryClient.cancelQueries()\n }),\n [arbi, queryClient]\n )\n return useMemo(\n () => createWorkspaceSwitch({ arbi: () => arbiRef.current, session, queryClient }),\n [session, queryClient]\n )\n}\n\n/**\n * Keep the selected workspace open on the server session: open it once signed in (after a\n * sign-in or a reload, when the selection was kept but the server session is new), and drop it\n * when the workspace list says it was archived since (by its owner, perhaps on another device),\n * or that it is gone (deleted, or the person left or was removed): the app is then on the\n * workspace list. Mounted once, by the signed-in app.\n */\nexport function useOpenSelectedWorkspace(): void {\n const arbi = useArbi()\n const { clearWorkspace, openSelectedWorkspace } = useSwitchWorkspace()\n const workspaceId = useArbiSessionState((s) => s.workspaceId)\n const status = useArbiSessionState((s) => s.workspaceStatus)\n const session = useArbiSessionStore()\n const queryClient = useQueryClient()\n const { data: workspaces, isLoading: listing, isFetching } = useWorkspaces()\n const listed = workspaces as ListedWorkspace[] | undefined\n const archived = listed?.find((w) => w.external_id === workspaceId && w.archive)\n // The open workspace is gone (deleted, or the person left or was removed) once a list read after\n // it was opened no longer has it: one read before (access granted since) may not have it yet.\n // (Counted, not timed: a read can land in the same millisecond.)\n const reads = queryClient.getQueryState(arbiQueryKeys.workspaces())?.dataUpdateCount ?? 0\n const opened = useRef<{ id: string | null; reads: number }>({ id: null, reads: 0 })\n const openId = status === 'open' ? workspaceId : null\n if (opened.current.id !== openId) opened.current = { id: openId, reads }\n const gone =\n !!openId &&\n !!listed &&\n !isFetching &&\n reads > opened.current.reads &&\n !listed.some((w) => w.external_id === openId)\n\n useEffect(() => {\n if (!archived) return\n notify.info(archivedWorkspaceMessage(archived.name))\n clearWorkspace()\n }, [archived, clearWorkspace])\n\n useEffect(() => {\n if (gone) clearWorkspace()\n }, [gone, clearWorkspace])\n\n // One open at a time; a failed one is tried again when the session or selection changes.\n const opening = useRef(false)\n const signedIn = arbi.isLoggedIn\n useEffect(() => {\n // After the workspace list: it says whether the workspace was archived, and it holds the key\n // the open needs (no list of the open's own).\n if (\n !workspaceId ||\n archived ||\n gone ||\n listing ||\n status !== 'closed' ||\n !signedIn ||\n opening.current\n )\n return\n opening.current = true\n void openSelectedWorkspace()\n .then(async (ok) => {\n if (ok) return\n // Refused: deleted, or left, since (the kept selection of a reload)? The list read now\n // says. (Not the list a reload restores: it may predate a workspace created since.)\n const fresh = await queryClient\n .fetchQuery({\n queryKey: arbiQueryKeys.workspaces(),\n queryFn: () => arbi.workspaces.list(),\n staleTime: 0,\n })\n .catch(() => null)\n if (\n fresh &&\n session.getState().workspaceId === workspaceId &&\n !(fresh as ListedWorkspace[]).some((w) => w.external_id === workspaceId)\n )\n clearWorkspace()\n })\n .finally(() => {\n opening.current = false\n })\n }, [\n arbi,\n session,\n clearWorkspace,\n openSelectedWorkspace,\n queryClient,\n workspaceId,\n archived,\n gone,\n listing,\n status,\n signedIn,\n ])\n}\n"],
|
|
5
|
+
"mappings": "AAwBA,SAAS,WAAW,SAAS,cAAc;AAC3C,SAAS,eAAe,sBAAwC;AAChE;AAAA,EACE;AAAA,OAGK;AACP,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,eAAe,qBAAqB;AAC7C,SAAS,4BAA4B;AACrC,SAAS,qBAAqB,2BAAkD;AAChF,SAAS,cAA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,WAAW;AAEvE,uBAAe;AAAA,IACnB,CAAC,EACA,QAAQ,MAAM;AACb,cAAQ,UAAU;AAAA,IACpB,CAAC;AAAA,EACL,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAA;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": ["signedIn"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.162",
|
|
4
4
|
"description": "React hooks and provider for the ARBI SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -117,8 +117,8 @@
|
|
|
117
117
|
"build-storybook": "storybook build"
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
|
-
"@arbidocs/client": "0.5.
|
|
121
|
-
"@arbidocs/sdk": "0.5.
|
|
120
|
+
"@arbidocs/client": "0.5.162",
|
|
121
|
+
"@arbidocs/sdk": "0.5.162",
|
|
122
122
|
"@didit-protocol/sdk-web": "0.4.0",
|
|
123
123
|
"@livekit/components-react": "2.9.24",
|
|
124
124
|
"@radix-ui/react-avatar": "^1.2.0",
|