@arbidocs/blocks 0.4.129 → 0.4.130
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/README.md +4 -3
- package/dist/agents/index.cjs +216 -216
- package/dist/agents/index.js +5 -5
- package/dist/calendar/CalendarPrint.d.ts +25 -0
- package/dist/calendar/booking-slots.d.ts +21 -0
- package/dist/calendar/index.cjs +381 -97
- package/dist/calendar/index.cjs.map +1 -1
- package/dist/calendar/index.d.ts +4 -0
- package/dist/calendar/index.js +277 -3
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/print-layout.d.ts +16 -0
- package/dist/calendar/printCalendar.d.ts +6 -0
- package/dist/calls/composite-canvas.d.ts +52 -0
- package/dist/calls/index.cjs +376 -3
- package/dist/calls/index.cjs.map +1 -1
- package/dist/calls/index.d.ts +3 -0
- package/dist/calls/index.js +360 -5
- package/dist/calls/index.js.map +1 -1
- package/dist/calls/ringtone.d.ts +16 -0
- package/dist/calls/voice-levels.d.ts +32 -0
- package/dist/chat/ThreadVisualizer.d.ts +28 -0
- package/dist/chat/index.cjs +93 -77
- package/dist/chat/index.d.ts +2 -0
- package/dist/chat/index.js +2 -2
- package/dist/chat/open-document.d.ts +5 -1
- package/dist/chat/thread-diagram.d.ts +26 -0
- package/dist/{chunk-DQCYCEDR.js → chunk-2Q7FDZAY.js} +3 -3
- package/dist/{chunk-DQCYCEDR.js.map → chunk-2Q7FDZAY.js.map} +1 -1
- package/dist/{chunk-S7PSMMRG.js → chunk-444XKG46.js} +3 -3
- package/dist/{chunk-S7PSMMRG.js.map → chunk-444XKG46.js.map} +1 -1
- package/dist/{chunk-7423V6RM.cjs → chunk-4QIIDXLF.cjs} +8 -8
- package/dist/{chunk-7423V6RM.cjs.map → chunk-4QIIDXLF.cjs.map} +1 -1
- package/dist/{chunk-OYMWV45N.js → chunk-4RLCRFZS.js} +63 -13
- package/dist/chunk-4RLCRFZS.js.map +1 -0
- package/dist/{chunk-DZYAAL4H.cjs → chunk-4S5IDT5F.cjs} +231 -2
- package/dist/chunk-4S5IDT5F.cjs.map +1 -0
- package/dist/{chunk-CJBN5HIS.js → chunk-4UMXQPNA.js} +20 -8
- package/dist/chunk-4UMXQPNA.js.map +1 -0
- package/dist/{chunk-IBZJYCYM.js → chunk-66TA5IBN.js} +17 -25
- package/dist/chunk-66TA5IBN.js.map +1 -0
- package/dist/{chunk-OR4CO743.cjs → chunk-AAFX64WD.cjs} +3 -3
- package/dist/{chunk-OR4CO743.cjs.map → chunk-AAFX64WD.cjs.map} +1 -1
- package/dist/{chunk-MUMH3Z6K.cjs → chunk-ARDHLU73.cjs} +61 -11
- package/dist/chunk-ARDHLU73.cjs.map +1 -0
- package/dist/{chunk-TGWTLNXW.cjs → chunk-BIXHB4LV.cjs} +3 -2
- package/dist/{chunk-TGWTLNXW.cjs.map → chunk-BIXHB4LV.cjs.map} +1 -1
- package/dist/chunk-C4WSHRR6.cjs +166 -0
- package/dist/chunk-C4WSHRR6.cjs.map +1 -0
- package/dist/{chunk-ZAVEMQ37.cjs → chunk-DWZXSPMB.cjs} +3 -3
- package/dist/{chunk-ZAVEMQ37.cjs.map → chunk-DWZXSPMB.cjs.map} +1 -1
- package/dist/{chunk-5HFPRI3W.js → chunk-FUTMU4FR.js} +3 -3
- package/dist/{chunk-5HFPRI3W.js.map → chunk-FUTMU4FR.js.map} +1 -1
- package/dist/{chunk-5Y7JRY7Y.js → chunk-GDBDHOI4.js} +3 -3
- package/dist/{chunk-5Y7JRY7Y.js.map → chunk-GDBDHOI4.js.map} +1 -1
- package/dist/{chunk-TGJNPKST.js → chunk-GTCC2VAR.js} +3 -3
- package/dist/{chunk-TGJNPKST.js.map → chunk-GTCC2VAR.js.map} +1 -1
- package/dist/{chunk-3BJLNKOB.cjs → chunk-GZPTWHP5.cjs} +22 -10
- package/dist/chunk-GZPTWHP5.cjs.map +1 -0
- package/dist/{chunk-OUW6G4O2.cjs → chunk-HFGXA5CL.cjs} +4 -4
- package/dist/{chunk-OUW6G4O2.cjs.map → chunk-HFGXA5CL.cjs.map} +1 -1
- package/dist/{chunk-SWQX6CTT.cjs → chunk-JKB7WT7L.cjs} +2 -2
- package/dist/chunk-JKB7WT7L.cjs.map +1 -0
- package/dist/{chunk-S6BOINC4.cjs → chunk-OGBXV326.cjs} +7 -7
- package/dist/{chunk-S6BOINC4.cjs.map → chunk-OGBXV326.cjs.map} +1 -1
- package/dist/{chunk-DJM7DLCT.cjs → chunk-OPTBQSCV.cjs} +3 -3
- package/dist/{chunk-DJM7DLCT.cjs.map → chunk-OPTBQSCV.cjs.map} +1 -1
- package/dist/{chunk-GFYGYME3.js → chunk-OQ7RUNOC.js} +3 -3
- package/dist/{chunk-GFYGYME3.js.map → chunk-OQ7RUNOC.js.map} +1 -1
- package/dist/{chunk-NYHGG2IA.cjs → chunk-QDEODGXE.cjs} +5 -5
- package/dist/{chunk-NYHGG2IA.cjs.map → chunk-QDEODGXE.cjs.map} +1 -1
- package/dist/{chunk-6BTCDKCK.js → chunk-QYTYW74G.js} +4 -4
- package/dist/{chunk-6BTCDKCK.js.map → chunk-QYTYW74G.js.map} +1 -1
- package/dist/{chunk-A7NCSZAP.cjs → chunk-QZTNTP75.cjs} +17 -25
- package/dist/chunk-QZTNTP75.cjs.map +1 -0
- package/dist/{chunk-OB5F4577.cjs → chunk-R26BK7YL.cjs} +4 -4
- package/dist/{chunk-OB5F4577.cjs.map → chunk-R26BK7YL.cjs.map} +1 -1
- package/dist/{chunk-A2YAC22G.js → chunk-RI6DZA5X.js} +3 -3
- package/dist/{chunk-A2YAC22G.js.map → chunk-RI6DZA5X.js.map} +1 -1
- package/dist/{chunk-H2KQ6OSU.js → chunk-SZX44LCT.js} +230 -5
- package/dist/chunk-SZX44LCT.js.map +1 -0
- package/dist/{chunk-7QDX2CO4.cjs → chunk-TP6PLDNM.cjs} +4 -4
- package/dist/{chunk-7QDX2CO4.cjs.map → chunk-TP6PLDNM.cjs.map} +1 -1
- package/dist/{chunk-JLTXVW25.cjs → chunk-TT6XV6WM.cjs} +17 -17
- package/dist/{chunk-JLTXVW25.cjs.map → chunk-TT6XV6WM.cjs.map} +1 -1
- package/dist/{chunk-HSFLEVZY.js → chunk-UMIY4SQS.js} +6 -6
- package/dist/{chunk-HSFLEVZY.js.map → chunk-UMIY4SQS.js.map} +1 -1
- package/dist/{chunk-ECERC6TI.js → chunk-VHJHY7TT.js} +3 -3
- package/dist/{chunk-ECERC6TI.js.map → chunk-VHJHY7TT.js.map} +1 -1
- package/dist/{chunk-D3N67Q4D.js → chunk-W3VYZXNS.js} +3 -3
- package/dist/{chunk-D3N67Q4D.js.map → chunk-W3VYZXNS.js.map} +1 -1
- package/dist/{chunk-JK45LSIH.cjs → chunk-WXYQ66KC.cjs} +5 -5
- package/dist/{chunk-JK45LSIH.cjs.map → chunk-WXYQ66KC.cjs.map} +1 -1
- package/dist/{chunk-ZCF2JJFA.js → chunk-Y3KA6X7B.js} +3 -3
- package/dist/{chunk-ZCF2JJFA.js.map → chunk-Y3KA6X7B.js.map} +1 -1
- package/dist/{chunk-GYCQ3FNL.js → chunk-YBLIKTJK.js} +2 -2
- package/dist/chunk-YBLIKTJK.js.map +1 -0
- package/dist/chunk-YNIBUKV5.js +163 -0
- package/dist/chunk-YNIBUKV5.js.map +1 -0
- package/dist/citations/index.cjs +12 -11
- package/dist/citations/index.js +3 -2
- package/dist/collaboration/index.cjs +42 -42
- package/dist/collaboration/index.js +2 -2
- package/dist/connect/docx.cjs +7 -5
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.js +6 -4
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +237 -194
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.js +190 -147
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedSettings.d.ts +46 -20
- package/dist/connection/ConnectionProvider.d.ts +5 -0
- package/dist/connection/mail/ConnectedMailComposer.d.ts +2 -3
- package/dist/connection/mail/ConnectedMailbox.d.ts +2 -3
- package/dist/connection/mail/MailComposerForm.d.ts +2 -3
- package/dist/connection/mail/index.d.ts +2 -2
- package/dist/connection/mail/mailbox.d.ts +1 -4
- package/dist/connection/mail/types.d.ts +0 -8
- package/dist/facts/fact-citations.d.ts +56 -0
- package/dist/facts/fact-table-column-resize.d.ts +18 -0
- package/dist/facts/index.cjs +197 -10
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.d.ts +2 -0
- package/dist/facts/index.js +182 -6
- package/dist/facts/index.js.map +1 -1
- package/dist/files/index.cjs +4 -4
- package/dist/files/index.js +3 -3
- package/dist/home/index.cjs +20 -19
- package/dist/home/index.cjs.map +1 -1
- package/dist/home/index.js +5 -4
- package/dist/home/index.js.map +1 -1
- package/dist/index.cjs +485 -469
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -13
- package/dist/provider/BlocksProvider.d.ts +39 -4
- package/dist/provider/dialogs.d.ts +31 -0
- package/dist/retrieval/index.cjs +5 -4
- package/dist/retrieval/index.js +3 -2
- package/dist/settings/MoreInfo.d.ts +25 -0
- package/dist/settings/PlanCard.d.ts +1 -1
- package/dist/settings/index.cjs +106 -252
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js +71 -216
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +48 -47
- package/dist/shell/index.js +4 -3
- package/dist/studio/index.cjs +15 -14
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +7 -6
- package/dist/studio/index.js.map +1 -1
- package/dist/workflow-canvas/index.cjs +14 -14
- package/dist/workflow-canvas/index.js +6 -6
- package/dist/workspaces/index.cjs +3 -3
- package/dist/workspaces/index.js +2 -2
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +9 -4
- package/dist/chunk-3BJLNKOB.cjs.map +0 -1
- package/dist/chunk-76JDDMSP.js +0 -31
- package/dist/chunk-76JDDMSP.js.map +0 -1
- package/dist/chunk-A7NCSZAP.cjs.map +0 -1
- package/dist/chunk-C54XEN5T.cjs +0 -34
- package/dist/chunk-C54XEN5T.cjs.map +0 -1
- package/dist/chunk-CJBN5HIS.js.map +0 -1
- package/dist/chunk-DZYAAL4H.cjs.map +0 -1
- package/dist/chunk-GYCQ3FNL.js.map +0 -1
- package/dist/chunk-H2KQ6OSU.js.map +0 -1
- package/dist/chunk-IBZJYCYM.js.map +0 -1
- package/dist/chunk-MUMH3Z6K.cjs.map +0 -1
- package/dist/chunk-OYMWV45N.js.map +0 -1
- package/dist/chunk-SWQX6CTT.cjs.map +0 -1
- package/dist/settings/FirmPool.d.ts +0 -82
|
@@ -3,27 +3,37 @@
|
|
|
3
3
|
* to its `@arbidocs/react` hook, so a host drops them in a `SettingsPanel` and owns only the
|
|
4
4
|
* layout (see the "Settings page recipe" in docs/design/blocks-package.md).
|
|
5
5
|
*
|
|
6
|
-
* Every section
|
|
7
|
-
* part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked
|
|
6
|
+
* Every section toasts and confirms through the blocks environment (`useBlocksEnvironment`) and
|
|
7
|
+
* renders the default test ids of its part. Anything the hooks cannot know (the recovery-key download, the billing link of a blocked
|
|
8
8
|
* deletion, the password policy) is a prop.
|
|
9
|
+
*
|
|
10
|
+
* The hooks talk to the account client in scope (`useAccountClient` from `@arbidocs/react`):
|
|
11
|
+
* `ConnectionProvider` provides one over the SDK; a host with its own session and API client
|
|
12
|
+
* mounts its own `AccountClientProvider` (as ARBI-frontend does), and these sections work alike.
|
|
9
13
|
*/
|
|
10
14
|
import { type ReactNode } from 'react';
|
|
15
|
+
import { type IdentityStatus } from '@arbidocs/react/ui';
|
|
11
16
|
import { type IdentityVerificationLabels } from '../settings/IdentityVerification';
|
|
12
17
|
import { type EmailNotificationCategoryDef } from '../settings/account-views';
|
|
13
|
-
export type SettingsNotify = (message: string, kind: 'success' | 'error') => void;
|
|
14
18
|
export interface ConnectedProfileCardProps {
|
|
15
|
-
notify?: SettingsNotify;
|
|
16
19
|
/** Section heading; default `Profile`. */
|
|
17
20
|
title?: ReactNode;
|
|
21
|
+
/** Classes of the initials avatar shown without a picture (e.g. the host's per-user colour). */
|
|
22
|
+
avatarClassName?: string;
|
|
23
|
+
/** More of the section under the card (e.g. `ConnectedIdentityVerification`). */
|
|
24
|
+
children?: ReactNode;
|
|
18
25
|
}
|
|
19
26
|
/** Avatar, editable name and email change of the signed-in user (`ProfileCard`). */
|
|
20
|
-
export declare function ConnectedProfileCard({
|
|
27
|
+
export declare function ConnectedProfileCard({ title, avatarClassName, children, }: ConnectedProfileCardProps): import("react").JSX.Element;
|
|
21
28
|
export interface ConnectedIdentityVerificationProps {
|
|
22
|
-
notify?: SettingsNotify;
|
|
23
29
|
labels?: Partial<IdentityVerificationLabels>;
|
|
30
|
+
/** Open the host's billing (card, plan) when the fee cannot be charged. */
|
|
31
|
+
onManageBilling?: () => void;
|
|
32
|
+
/** The host's price format; default `formatIdentityPrice`. */
|
|
33
|
+
formatPrice?: (status: IdentityStatus) => string;
|
|
24
34
|
}
|
|
25
|
-
/** The ID check card and its dialog, bound to the
|
|
26
|
-
export declare function ConnectedIdentityVerification({
|
|
35
|
+
/** The ID check card and its dialog, bound to the account. Renders nothing when not offered. */
|
|
36
|
+
export declare function ConnectedIdentityVerification({ labels, onManageBilling, formatPrice, }: ConnectedIdentityVerificationProps): import("react").JSX.Element;
|
|
27
37
|
export interface ConnectedRequireVerifiedProps {
|
|
28
38
|
children?: ReactNode;
|
|
29
39
|
labels?: Partial<IdentityVerificationLabels>;
|
|
@@ -32,15 +42,26 @@ export interface ConnectedRequireVerifiedProps {
|
|
|
32
42
|
export declare function ConnectedRequireVerified({ children, labels }: ConnectedRequireVerifiedProps): import("react").JSX.Element;
|
|
33
43
|
/** The default password policy: 8 characters, an uppercase letter or symbol, a digit. */
|
|
34
44
|
export declare function defaultUnmetPasswordRequirement(password: string): string | null;
|
|
45
|
+
export interface ConnectedPasswordChangeDialogProps {
|
|
46
|
+
open: boolean;
|
|
47
|
+
onClose: () => void;
|
|
48
|
+
/** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */
|
|
49
|
+
getUnmetRequirement?: (password: string) => string | null;
|
|
50
|
+
/** After signing in with a recovery key: set a new password, no current one asked for. */
|
|
51
|
+
recoveryMode?: boolean;
|
|
52
|
+
/** Recovery finished: continue into the app (recovery closes itself, with no success screen). */
|
|
53
|
+
onRecoveryComplete?: () => void;
|
|
54
|
+
}
|
|
55
|
+
/** Change (or, in recovery mode, set) the master password (`PasswordChangeDialog`). */
|
|
56
|
+
export declare function ConnectedPasswordChangeDialog({ open, onClose, getUnmetRequirement, recoveryMode, onRecoveryComplete, }: ConnectedPasswordChangeDialogProps): import("react").JSX.Element;
|
|
35
57
|
export interface ConnectedSecuritySectionProps {
|
|
36
|
-
notify?: SettingsNotify;
|
|
37
58
|
/** The host's password policy; default is {@link defaultUnmetPasswordRequirement}. */
|
|
38
59
|
getUnmetRequirement?: (password: string) => string | null;
|
|
39
60
|
/** Extra rows under "Change password" (e.g. "Save recovery key"). */
|
|
40
61
|
children?: ReactNode;
|
|
41
62
|
}
|
|
42
|
-
/** The Security card: "Change password" and the dialog behind it
|
|
43
|
-
export declare function ConnectedSecuritySection({
|
|
63
|
+
/** The Security card: "Change password" and the dialog behind it. */
|
|
64
|
+
export declare function ConnectedSecuritySection({ getUnmetRequirement, children, }: ConnectedSecuritySectionProps): import("react").JSX.Element;
|
|
44
65
|
export interface ConnectedNotificationPreferencesProps {
|
|
45
66
|
/** Categories to offer; default {@link EMAIL_NOTIFICATION_CATEGORIES}. */
|
|
46
67
|
categories?: readonly EmailNotificationCategoryDef[];
|
|
@@ -49,26 +70,31 @@ export interface ConnectedNotificationPreferencesProps {
|
|
|
49
70
|
/** The email-notification switches (`NotificationCategoryList`) over the user settings. */
|
|
50
71
|
export declare function ConnectedNotificationPreferences({ categories, title, }: ConnectedNotificationPreferencesProps): import("react").JSX.Element;
|
|
51
72
|
export interface ConnectedSessionsRowProps {
|
|
52
|
-
notify?: SettingsNotify;
|
|
53
|
-
/** Ask before ending a session; resolve `false` to cancel. Default: end at once. */
|
|
54
|
-
confirm?: (message: string) => Promise<boolean> | boolean;
|
|
55
73
|
/** Glyph per session status. */
|
|
56
74
|
renderSessionIcon?: (status: string) => ReactNode;
|
|
57
75
|
}
|
|
58
76
|
/** "Active sessions" row with the manage dialog (`ActiveSessionsDialog`); end any but this device. */
|
|
59
|
-
export declare function ConnectedSessionsRow({
|
|
77
|
+
export declare function ConnectedSessionsRow({ renderSessionIcon }: ConnectedSessionsRowProps): import("react").JSX.Element;
|
|
60
78
|
export interface ConnectedLogoutDialogProps {
|
|
61
79
|
open: boolean;
|
|
62
80
|
onClose: () => void;
|
|
63
|
-
|
|
81
|
+
/** Offer "All sessions"; default true (e.g. false for agent accounts). */
|
|
82
|
+
canLogoutAll?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Ask before signing out (e.g. unsent work kept only on this device); resolve `false` to stay
|
|
85
|
+
* signed in. Default: sign out at once.
|
|
86
|
+
*/
|
|
87
|
+
confirmSignOut?: () => Promise<boolean> | boolean;
|
|
64
88
|
renderSessionIcon?: (status: string) => ReactNode;
|
|
65
89
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Sign out of this device or all devices (`LogoutDialog`), listing the active sessions. "All
|
|
92
|
+
* sessions" must reach the server, so it is disabled offline; "This session" always works.
|
|
93
|
+
*/
|
|
94
|
+
export declare function ConnectedLogoutDialog({ open, onClose, canLogoutAll, confirmSignOut, renderSessionIcon, }: ConnectedLogoutDialogProps): import("react").JSX.Element;
|
|
68
95
|
export interface ConnectedDangerZoneProps {
|
|
69
|
-
notify?: SettingsNotify;
|
|
70
96
|
/** Link to the billing page for a deletion blocked by an active subscription. */
|
|
71
97
|
renderSubscriptionLink?: () => ReactNode;
|
|
72
98
|
}
|
|
73
99
|
/** "Delete your account": the collapsed danger zone and the two-step dialog (`DeleteAccountDialog`). */
|
|
74
|
-
export declare function ConnectedDangerZone({
|
|
100
|
+
export declare function ConnectedDangerZone({ renderSubscriptionLink }: ConnectedDangerZoneProps): import("react").JSX.Element;
|
|
@@ -11,6 +11,7 @@ interface ConnectionValue {
|
|
|
11
11
|
mode: ArbiMode;
|
|
12
12
|
status: ConnectionStatus;
|
|
13
13
|
user: ArbiUser | null;
|
|
14
|
+
/** The selected workspace: the session state's (`useArbiSessionState`), set by `setWorkspace`. */
|
|
14
15
|
workspaceId: string | null;
|
|
15
16
|
apiConfigured: boolean;
|
|
16
17
|
apiUrl: string;
|
|
@@ -48,6 +49,10 @@ interface ConnectionValue {
|
|
|
48
49
|
export declare const workspaceStorageKey: (apiUrl: string, userKey: string) => string;
|
|
49
50
|
/** Shown on the sign-in screen after the session could not be recovered. */
|
|
50
51
|
export declare const SESSION_EXPIRED_MESSAGE = "Your session expired. Sign in again.";
|
|
52
|
+
/**
|
|
53
|
+
* The connection, over the session state of the host (an `ArbiSessionStateProvider` above), else
|
|
54
|
+
* its own: the selected workspace lives there, so every block reads one value.
|
|
55
|
+
*/
|
|
51
56
|
export declare function ConnectionProvider({ config, children, }: {
|
|
52
57
|
config: ArbiConnectionConfig;
|
|
53
58
|
children: ReactNode;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type RefObject } from 'react';
|
|
9
9
|
import { type MailAccount, type MailCompose, type MailMessage } from '@arbidocs/react';
|
|
10
|
-
import type { MailDocumentSource,
|
|
10
|
+
import type { MailDocumentSource, MailOfflineSupport, MailWordEditor } from './types';
|
|
11
11
|
export interface ConnectedMailComposerProps {
|
|
12
12
|
/** Open this saved draft (from the account's Drafts) instead of a new message. */
|
|
13
13
|
draftId?: string;
|
|
@@ -35,7 +35,6 @@ export interface ConnectedMailComposerProps {
|
|
|
35
35
|
offline?: MailOfflineSupport;
|
|
36
36
|
/** Workspace documents to attach ("From workspace"). Absent: not offered. */
|
|
37
37
|
documents?: MailDocumentSource;
|
|
38
|
-
notify?: MailNotify;
|
|
39
38
|
/** A native draft's body in the Word editor (see {@link MailWordEditor}). Absent: the rich-text body. */
|
|
40
39
|
word?: MailWordEditor;
|
|
41
40
|
/** This compose session, stable across remounts (its Word room is kept for it). */
|
|
@@ -47,4 +46,4 @@ export interface ConnectedMailComposerProps {
|
|
|
47
46
|
/** The host's header for this message (a panel's title bar): who ARBI's work is billed to shows there. */
|
|
48
47
|
headerSlot?: HTMLElement | null;
|
|
49
48
|
}
|
|
50
|
-
export declare function ConnectedMailComposer({ draftId, initial, account: accountProp, mailbox, maxBytes: maxBytesProp, ready: readyProp, drafts: draftsProp,
|
|
49
|
+
export declare function ConnectedMailComposer({ draftId, initial, account: accountProp, mailbox, maxBytes: maxBytesProp, ready: readyProp, drafts: draftsProp, offline, replyTo, ...rest }: ConnectedMailComposerProps): import("react").JSX.Element;
|
|
@@ -12,7 +12,7 @@ import { type ReactNode } from 'react';
|
|
|
12
12
|
import type { GridState } from 'ag-grid-community';
|
|
13
13
|
import { type MailAddress, type MailAccount, type MailAttachment, type MailMessage } from '@arbidocs/react';
|
|
14
14
|
import { type MailAliasUser } from './ConnectedMailAccounts';
|
|
15
|
-
import type { MailDocumentSource,
|
|
15
|
+
import type { MailDocumentSource, MailOfflineSupport, MailPanelProps, MailSaveToWorkspace, MailWordEditor } from './types';
|
|
16
16
|
export interface ConnectedMailboxProps {
|
|
17
17
|
/** Which mailbox: an account id, or `'native'` for the user's own inbox. Default: the first. */
|
|
18
18
|
mailbox?: string;
|
|
@@ -64,6 +64,5 @@ export interface ConnectedMailboxProps {
|
|
|
64
64
|
onGridStateChange?: (state: GridState) => void;
|
|
65
65
|
/** The message opened first (e.g. restored after a redirect). */
|
|
66
66
|
initialMessageId?: string | null;
|
|
67
|
-
notify?: MailNotify;
|
|
68
67
|
}
|
|
69
|
-
export declare function ConnectedMailbox({ mailbox, draftId, onDraftOpened, folder: requestedFolder, onFolderOpened, composeAttachments, onComposeOpened, onOpenDocument, user, productName, oauthReturnPath, personLabel, offline, documents, saveToWorkspace, word, onReplyWithArbi, renderInvite, renderPanel, onViewerOpenChange, gridState, onGridStateChange, initialMessageId,
|
|
68
|
+
export declare function ConnectedMailbox({ mailbox, draftId, onDraftOpened, folder: requestedFolder, onFolderOpened, composeAttachments, onComposeOpened, onOpenDocument, user, productName, oauthReturnPath, personLabel, offline, documents, saveToWorkspace, word, onReplyWithArbi, renderInvite, renderPanel, onViewerOpenChange, gridState, onGridStateChange, initialMessageId, }: ConnectedMailboxProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
2
|
import { type MailAccount, type MailCompose, type MailMessage } from '@arbidocs/react';
|
|
3
|
-
import type { MailDocumentSource,
|
|
3
|
+
import type { MailDocumentSource, MailOfflineSupport, MailWordEditor } from './types';
|
|
4
4
|
export interface MailComposerFormProps {
|
|
5
5
|
account?: MailAccount;
|
|
6
6
|
initial: MailCompose;
|
|
@@ -21,7 +21,6 @@ export interface MailComposerFormProps {
|
|
|
21
21
|
localDraftId?: string;
|
|
22
22
|
offline?: MailOfflineSupport;
|
|
23
23
|
documents?: MailDocumentSource;
|
|
24
|
-
notify: MailNotify;
|
|
25
24
|
/** A native draft's body in the Word editor. Absent: the rich-text body. */
|
|
26
25
|
word?: MailWordEditor;
|
|
27
26
|
/** This compose session, stable across remounts (its Word room is kept for it). */
|
|
@@ -32,4 +31,4 @@ export interface MailComposerFormProps {
|
|
|
32
31
|
headerSlot?: HTMLElement | null;
|
|
33
32
|
}
|
|
34
33
|
/** Write, save and send one message. */
|
|
35
|
-
export declare function MailComposerForm({ account, initial, maxBytes, ready, drafts, onClose, onOpenDraft, onReload, onChange, embedded, closeRequestRef, localDraftId: initialLocalDraftId, offline, documents,
|
|
34
|
+
export declare function MailComposerForm({ account, initial, maxBytes, ready, drafts, onClose, onOpenDraft, onReload, onChange, embedded, closeRequestRef, localDraftId: initialLocalDraftId, offline, documents, word, sessionKey, roomId, headerSlot, }: MailComposerFormProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ConnectedMailbox, type ConnectedMailboxProps } from './ConnectedMailbox';
|
|
2
2
|
export { ConnectedMailComposer, type ConnectedMailComposerProps } from './ConnectedMailComposer';
|
|
3
3
|
export { ConnectedMailMessage, type ConnectedMailMessageProps } from './ConnectedMailMessage';
|
|
4
|
-
export {
|
|
4
|
+
export { resolveMailbox } from './mailbox';
|
|
5
5
|
export { ConnectedMailAccounts, type ConnectedMailAccountsProps, type MailAliasUser, } from './ConnectedMailAccounts';
|
|
6
6
|
export { ConnectedMailSetup } from './ConnectedMailSetup';
|
|
7
|
-
export type {
|
|
7
|
+
export type { MailLocalDraft, MailOutboxEntry, MailOutboxRequest, MailOfflineSupport, MailDocumentSource, MailSaveToWorkspace, MailPanelProps, MailWordEditor, } from './types';
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { MailNotify } from './types';
|
|
3
|
-
/** The default {@link MailNotify}: the shared toast and notification centre. */
|
|
4
|
-
export declare const defaultMailNotify: MailNotify;
|
|
1
|
+
import type { MailAccount } from '@arbidocs/react';
|
|
5
2
|
/** The account a `mailbox` choice names: an account id, or `'native'` for the user's own inbox. */
|
|
6
3
|
export declare function resolveMailbox(accounts: MailAccount[] | undefined, mailbox: string | undefined): MailAccount | undefined;
|
|
@@ -2,14 +2,6 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import type { MailAccount, MailAttachment, MailCompose } from '@arbidocs/react';
|
|
3
3
|
import type { MailAttachableDocument } from '../../collaboration/mail/MailDocumentPicker';
|
|
4
4
|
import type { NativeDocxAdapter } from '../../docx/NativeDocxEditor';
|
|
5
|
-
/** Tell the user how an action went (a toast). Default: `notify` from `@arbidocs/react`. */
|
|
6
|
-
export type MailNotify = (message: string, variant: 'success' | 'info' | 'error', options?: {
|
|
7
|
-
description?: string;
|
|
8
|
-
action?: {
|
|
9
|
-
label: string;
|
|
10
|
-
onClick: () => void;
|
|
11
|
-
};
|
|
12
|
-
}) => void;
|
|
13
5
|
/** A draft kept on this device (written offline), not yet in the server's Drafts. */
|
|
14
6
|
export interface MailLocalDraft {
|
|
15
7
|
id: string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** One cited passage — mirrors the backend `CitedChunk`. */
|
|
2
|
+
export interface FactCitedChunk {
|
|
3
|
+
chunk_id: string;
|
|
4
|
+
page?: number | null;
|
|
5
|
+
}
|
|
6
|
+
/** One cited document — mirrors the backend `CitedDocument`. */
|
|
7
|
+
export interface FactCitedDoc {
|
|
8
|
+
doc_ext_id: string;
|
|
9
|
+
/** The document version quoted; missing = its current version (the backend pins it on save). */
|
|
10
|
+
version?: number | null;
|
|
11
|
+
chunks: FactCitedChunk[];
|
|
12
|
+
}
|
|
13
|
+
export type FactCitations = FactCitedDoc[];
|
|
14
|
+
type MaybeCitations = FactCitations | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Adopt a server citation list as a local one. The generated `CitedDocument`
|
|
17
|
+
* leaves `chunks` optional (a whole-document source may omit it); everything in
|
|
18
|
+
* the UI wants it present, so it is filled in ONCE, here, where server facts
|
|
19
|
+
* enter the composer — rather than casting at every call site.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toFactCitations(citations: {
|
|
22
|
+
doc_ext_id: string;
|
|
23
|
+
version?: number | null;
|
|
24
|
+
chunks?: FactCitedChunk[] | null;
|
|
25
|
+
}[] | null | undefined): FactCitations | null;
|
|
26
|
+
/** A whole-document source: the picker ticked it without choosing passages. */
|
|
27
|
+
export declare function isWholeDoc(doc: FactCitedDoc): boolean;
|
|
28
|
+
export declare function docIdsOf(citations: MaybeCitations): string[];
|
|
29
|
+
export declare function chunkIdsOf(citations: MaybeCitations): string[];
|
|
30
|
+
export declare function hasChunk(citations: MaybeCitations, chunkId: string): boolean;
|
|
31
|
+
/** Cite a whole document. No-op when it is already a source. */
|
|
32
|
+
export declare function withDoc(citations: MaybeCitations, docExtId: string): FactCitations;
|
|
33
|
+
/** Drop a document and every passage cited from it. Null once nothing remains. */
|
|
34
|
+
export declare function withoutDoc(citations: MaybeCitations, docExtId: string): FactCitations | null;
|
|
35
|
+
/** Cite a passage; creates the document entry if needed. No-op on a duplicate. */
|
|
36
|
+
export declare function withChunk(citations: MaybeCitations, docExtId: string, chunk: FactCitedChunk): FactCitations;
|
|
37
|
+
/**
|
|
38
|
+
* Un-cite a passage. By default the document STAYS a source (as a whole-doc
|
|
39
|
+
* reference) when it loses its last passage — removing the source itself is a
|
|
40
|
+
* separate act (`withoutDoc`). Pass `keepDoc: false` to drop it too.
|
|
41
|
+
*/
|
|
42
|
+
export declare function withoutChunk(citations: MaybeCitations, chunkId: string, opts?: {
|
|
43
|
+
keepDoc?: boolean;
|
|
44
|
+
}): FactCitations | null;
|
|
45
|
+
/**
|
|
46
|
+
* Build a fact's clean text + citations from an assistant answer.
|
|
47
|
+
*
|
|
48
|
+
* @param content Answer markdown, WITH `[text](#cite-N)` markers.
|
|
49
|
+
* @param activeCitations `model_citations`: citation number → chunk_ids.
|
|
50
|
+
* @param citationData Retrieval chunks, keyed by file (holds the metadata).
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildFactCitations(content: string, activeCitations: Record<string, string[]> | null, citationData: Record<string, unknown>): {
|
|
53
|
+
text: string;
|
|
54
|
+
citations: FactCitations | null;
|
|
55
|
+
};
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drag-to-resize columns for the tables rendered inside the fact editor's
|
|
3
|
+
* MDXEditor.
|
|
4
|
+
*
|
|
5
|
+
* MDXEditor's table has no built-in column resizing, but it renders a
|
|
6
|
+
* `<colgroup>` of `<col>` elements — one per column plus the leading/trailing
|
|
7
|
+
* tool columns. Column widths are honoured by setting a width on those `<col>`
|
|
8
|
+
* elements and switching the table to `table-layout: fixed`. MDXEditor only
|
|
9
|
+
* manages each `<col>`'s `className` (alignment), so an inline `style.width`
|
|
10
|
+
* survives typing edits; it only resets when the column count changes (a new
|
|
11
|
+
* `<colgroup>` is rendered) — acceptable for an editing-time affordance, since
|
|
12
|
+
* markdown tables can't store widths anyway.
|
|
13
|
+
*
|
|
14
|
+
* Wiring: attach once to the editor container. Listeners are delegated, so
|
|
15
|
+
* they work for tables that appear/disappear as the user edits. Returns a
|
|
16
|
+
* cleanup that removes every listener and any lingering drag state.
|
|
17
|
+
*/
|
|
18
|
+
export declare function enableFactTableColumnResize(container: HTMLElement): () => void;
|
package/dist/facts/index.cjs
CHANGED
|
@@ -3,24 +3,26 @@
|
|
|
3
3
|
|
|
4
4
|
var chunk2WLXQGWC_cjs = require('../chunk-2WLXQGWC.cjs');
|
|
5
5
|
var chunk5FYU7ZIU_cjs = require('../chunk-5FYU7ZIU.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkHFGXA5CL_cjs = require('../chunk-HFGXA5CL.cjs');
|
|
7
7
|
var chunkVPPX5XUF_cjs = require('../chunk-VPPX5XUF.cjs');
|
|
8
8
|
var chunkRC25WMVB_cjs = require('../chunk-RC25WMVB.cjs');
|
|
9
9
|
var chunkV4ISCZJ7_cjs = require('../chunk-V4ISCZJ7.cjs');
|
|
10
10
|
var chunk2EI7NCUA_cjs = require('../chunk-2EI7NCUA.cjs');
|
|
11
11
|
var chunkC2CWWEHO_cjs = require('../chunk-C2CWWEHO.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkBIXHB4LV_cjs = require('../chunk-BIXHB4LV.cjs');
|
|
13
13
|
var chunk7RGLTF76_cjs = require('../chunk-7RGLTF76.cjs');
|
|
14
14
|
require('../chunk-FX3K6LNZ.cjs');
|
|
15
15
|
var chunkPPCATBOY_cjs = require('../chunk-PPCATBOY.cjs');
|
|
16
16
|
var chunkMHVNT4J3_cjs = require('../chunk-MHVNT4J3.cjs');
|
|
17
|
-
require('../chunk-
|
|
17
|
+
require('../chunk-C4WSHRR6.cjs');
|
|
18
|
+
require('../chunk-ULWRNGGE.cjs');
|
|
18
19
|
var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
|
|
19
20
|
require('../chunk-DES3K4SD.cjs');
|
|
20
21
|
var lucideReact = require('lucide-react');
|
|
21
22
|
var ui = require('@arbidocs/react/ui');
|
|
22
23
|
var jsxRuntime = require('react/jsx-runtime');
|
|
23
24
|
var react = require('react');
|
|
25
|
+
var artifacts = require('@arbidocs/react/artifacts');
|
|
24
26
|
|
|
25
27
|
var DEFAULT_FACT_COLUMN_LABELS = {
|
|
26
28
|
inChatHeaderTooltip: "Facts added to this chat are always in context for this chat",
|
|
@@ -804,7 +806,7 @@ function factDateSpanToFields(dateStart, dateEnd, timezone) {
|
|
|
804
806
|
}
|
|
805
807
|
function factDateFieldsToSpan(fields) {
|
|
806
808
|
if (!fields.date) return { date: null, date_end: null, timezone: null };
|
|
807
|
-
const tz = fields.timezone ||
|
|
809
|
+
const tz = fields.timezone || chunkBIXHB4LV_cjs.detectTimeZone();
|
|
808
810
|
const startIso = fields.time ? zonedPartsToIso(fields.date, fields.time, tz) : `${fields.date}T00:00:00.000Z`;
|
|
809
811
|
let endIso;
|
|
810
812
|
if (fields.endDate) {
|
|
@@ -989,7 +991,7 @@ function MonthCalendar({
|
|
|
989
991
|
function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
|
|
990
992
|
const l = { ...DEFAULT_FACT_DATE_INPUT_LABELS, ...labels };
|
|
991
993
|
const [open, setOpen] = react.useState(false);
|
|
992
|
-
const timezones = react.useMemo(() =>
|
|
994
|
+
const timezones = react.useMemo(() => chunkBIXHB4LV_cjs.listTimeZones(), []);
|
|
993
995
|
const timezoneListId = `${idPrefix}-timezone-options`;
|
|
994
996
|
const span = factDateFieldsToSpan(value);
|
|
995
997
|
const summary = value.time || value.endTime ? summarizeWithTimes(value) : chunkVPPX5XUF_cjs.formatSpan(span.date, span.date_end, span.timezone);
|
|
@@ -997,7 +999,7 @@ function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
|
|
|
997
999
|
const setStartTime = (time) => onChange({
|
|
998
1000
|
...value,
|
|
999
1001
|
time,
|
|
1000
|
-
timezone: time ? value.timezone ||
|
|
1002
|
+
timezone: time ? value.timezone || chunkBIXHB4LV_cjs.detectTimeZone() : "",
|
|
1001
1003
|
endTime: time ? value.endTime : ""
|
|
1002
1004
|
});
|
|
1003
1005
|
const setEndTime = (endTime) => onChange({
|
|
@@ -1062,7 +1064,7 @@ function FactDateInput({ value, onChange, idPrefix, labels, testIds }) {
|
|
|
1062
1064
|
list: timezoneListId,
|
|
1063
1065
|
value: value.timezone,
|
|
1064
1066
|
onChange: (e) => onChange({ ...value, timezone: e.target.value }),
|
|
1065
|
-
placeholder:
|
|
1067
|
+
placeholder: chunkBIXHB4LV_cjs.detectTimeZone(),
|
|
1066
1068
|
className: "h-8 text-xs",
|
|
1067
1069
|
"data-testid": `${idPrefix}-timezone`
|
|
1068
1070
|
}
|
|
@@ -1109,7 +1111,7 @@ var DEFAULT_FACT_SOURCE_GROUP_LABELS = {
|
|
|
1109
1111
|
};
|
|
1110
1112
|
function FactSourceGroup({
|
|
1111
1113
|
docId,
|
|
1112
|
-
document,
|
|
1114
|
+
document: document2,
|
|
1113
1115
|
isViewing,
|
|
1114
1116
|
onRemove,
|
|
1115
1117
|
children,
|
|
@@ -1127,7 +1129,7 @@ function FactSourceGroup({
|
|
|
1127
1129
|
"data-slot": "fact-source-group",
|
|
1128
1130
|
children: [
|
|
1129
1131
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 px-1 text-sm", children: [
|
|
1130
|
-
|
|
1132
|
+
document2,
|
|
1131
1133
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1" }),
|
|
1132
1134
|
onRemove && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1133
1135
|
"button",
|
|
@@ -2035,7 +2037,7 @@ function FactSearchResult({
|
|
|
2035
2037
|
}
|
|
2036
2038
|
),
|
|
2037
2039
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2038
|
-
|
|
2040
|
+
chunkHFGXA5CL_cjs.SearchHit,
|
|
2039
2041
|
{
|
|
2040
2042
|
className: "min-w-0 flex-1",
|
|
2041
2043
|
testId: chunkMHVNT4J3_cjs.testIdOr(testIds?.hit?.(id), { testId: `facts-smart-search-hit-${id}` }),
|
|
@@ -2113,6 +2115,180 @@ function FactSearchResult({
|
|
|
2113
2115
|
)
|
|
2114
2116
|
] });
|
|
2115
2117
|
}
|
|
2118
|
+
function toFactCitations(citations) {
|
|
2119
|
+
if (!citations) return null;
|
|
2120
|
+
return citations.map((d) => ({
|
|
2121
|
+
doc_ext_id: d.doc_ext_id,
|
|
2122
|
+
...d.version ? { version: d.version } : {},
|
|
2123
|
+
chunks: d.chunks ?? []
|
|
2124
|
+
}));
|
|
2125
|
+
}
|
|
2126
|
+
function isWholeDoc(doc) {
|
|
2127
|
+
return doc.chunks.length === 0;
|
|
2128
|
+
}
|
|
2129
|
+
function docIdsOf(citations) {
|
|
2130
|
+
return (citations ?? []).map((d) => d.doc_ext_id);
|
|
2131
|
+
}
|
|
2132
|
+
function chunkIdsOf(citations) {
|
|
2133
|
+
return (citations ?? []).flatMap((d) => d.chunks.map((c) => c.chunk_id));
|
|
2134
|
+
}
|
|
2135
|
+
function hasChunk(citations, chunkId) {
|
|
2136
|
+
return (citations ?? []).some((d) => d.chunks.some((c) => c.chunk_id === chunkId));
|
|
2137
|
+
}
|
|
2138
|
+
function withDoc(citations, docExtId) {
|
|
2139
|
+
const list = citations ?? [];
|
|
2140
|
+
if (list.some((d) => d.doc_ext_id === docExtId)) return list;
|
|
2141
|
+
return [...list, { doc_ext_id: docExtId, chunks: [] }];
|
|
2142
|
+
}
|
|
2143
|
+
function withoutDoc(citations, docExtId) {
|
|
2144
|
+
const remaining = (citations ?? []).filter((d) => d.doc_ext_id !== docExtId);
|
|
2145
|
+
return remaining.length ? remaining : null;
|
|
2146
|
+
}
|
|
2147
|
+
function withChunk(citations, docExtId, chunk) {
|
|
2148
|
+
const list = citations ?? [];
|
|
2149
|
+
const idx = list.findIndex((d) => d.doc_ext_id === docExtId);
|
|
2150
|
+
if (idx === -1) return [...list, { doc_ext_id: docExtId, chunks: [chunk] }];
|
|
2151
|
+
const doc = list[idx];
|
|
2152
|
+
if (doc.chunks.some((c) => c.chunk_id === chunk.chunk_id)) return list;
|
|
2153
|
+
const next = [...list];
|
|
2154
|
+
next[idx] = { ...doc, chunks: [...doc.chunks, chunk] };
|
|
2155
|
+
return next;
|
|
2156
|
+
}
|
|
2157
|
+
function withoutChunk(citations, chunkId, opts = {}) {
|
|
2158
|
+
const keepDoc = opts.keepDoc ?? true;
|
|
2159
|
+
const list = citations ?? [];
|
|
2160
|
+
if (!hasChunk(list, chunkId)) return citations ?? null;
|
|
2161
|
+
const next = [];
|
|
2162
|
+
for (const doc of list) {
|
|
2163
|
+
if (!doc.chunks.some((c) => c.chunk_id === chunkId)) {
|
|
2164
|
+
next.push(doc);
|
|
2165
|
+
continue;
|
|
2166
|
+
}
|
|
2167
|
+
const chunks = doc.chunks.filter((c) => c.chunk_id !== chunkId);
|
|
2168
|
+
if (chunks.length || keepDoc) next.push({ ...doc, chunks });
|
|
2169
|
+
}
|
|
2170
|
+
return next.length ? next : null;
|
|
2171
|
+
}
|
|
2172
|
+
function repairBoldFlanking(md) {
|
|
2173
|
+
return md.replace(/([.,;:!?"'’”)\]])(\*\*|__)(?=[A-Za-z0-9])/g, "$1$2 ");
|
|
2174
|
+
}
|
|
2175
|
+
var CHAT_LEAD_IN = /^(?:here(?:'s| is| are)|below (?:is|are)|sure|certainly)\b[^\n]*:[ \t]*(?:\n+|$)/i;
|
|
2176
|
+
function dropChatLeadIn(md) {
|
|
2177
|
+
const body = md.replace(CHAT_LEAD_IN, "");
|
|
2178
|
+
return body.trim() ? body : md;
|
|
2179
|
+
}
|
|
2180
|
+
function buildFactCitations(content, activeCitations, citationData) {
|
|
2181
|
+
const text = dropChatLeadIn(repairBoldFlanking(artifacts.unwrapCitationLinks(content)).trim()).trim();
|
|
2182
|
+
if (!activeCitations) return { text, citations: null };
|
|
2183
|
+
const chunkMeta = /* @__PURE__ */ new Map();
|
|
2184
|
+
for (const chunks of Object.values(citationData)) {
|
|
2185
|
+
if (!Array.isArray(chunks)) continue;
|
|
2186
|
+
for (const chunk of chunks) {
|
|
2187
|
+
const meta = {
|
|
2188
|
+
doc_ext_id: chunk.metadata?.doc_ext_id ?? null,
|
|
2189
|
+
page: chunk.metadata?.page_number ?? null
|
|
2190
|
+
};
|
|
2191
|
+
for (const key of [chunk.metadata?.chunk_ext_id, chunk.chunk_id]) {
|
|
2192
|
+
if (key && !chunkMeta.has(key)) chunkMeta.set(key, meta);
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
let citations = null;
|
|
2197
|
+
for (const chunkIds of Object.values(activeCitations)) {
|
|
2198
|
+
for (const chunkId of chunkIds) {
|
|
2199
|
+
const meta = chunkMeta.get(chunkId);
|
|
2200
|
+
if (!meta?.doc_ext_id) continue;
|
|
2201
|
+
citations = withChunk(citations, meta.doc_ext_id, { chunk_id: chunkId, page: meta.page });
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
return { text, citations };
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
// src/facts/fact-table-column-resize.ts
|
|
2208
|
+
var EDGE = 6;
|
|
2209
|
+
var MIN_WIDTH = 48;
|
|
2210
|
+
function enableFactTableColumnResize(container) {
|
|
2211
|
+
let drag = null;
|
|
2212
|
+
const cellFromEvent = (e) => {
|
|
2213
|
+
const el = e.target;
|
|
2214
|
+
const cell = el?.closest?.("td, th");
|
|
2215
|
+
if (!cell || cell.hasAttribute("data-tool-cell")) return null;
|
|
2216
|
+
if (!container.contains(cell)) return null;
|
|
2217
|
+
return cell;
|
|
2218
|
+
};
|
|
2219
|
+
const nearRightEdge = (cell, clientX) => {
|
|
2220
|
+
const rect = cell.getBoundingClientRect();
|
|
2221
|
+
return clientX >= rect.right - EDGE && clientX <= rect.right + 2;
|
|
2222
|
+
};
|
|
2223
|
+
const colForCell = (cell) => {
|
|
2224
|
+
const row = cell.parentElement;
|
|
2225
|
+
const table = cell.closest("table");
|
|
2226
|
+
const colgroup = table?.querySelector("colgroup");
|
|
2227
|
+
if (!row || !table || !colgroup) return null;
|
|
2228
|
+
const index = Array.prototype.indexOf.call(row.children, cell);
|
|
2229
|
+
return colgroup.children[index] ?? null;
|
|
2230
|
+
};
|
|
2231
|
+
const freezeWidths = (table) => {
|
|
2232
|
+
const colgroup = table.querySelector("colgroup");
|
|
2233
|
+
if (!colgroup) return;
|
|
2234
|
+
const ruler = table.querySelector("thead tr") ?? table.querySelector("tbody tr");
|
|
2235
|
+
const cells = ruler ? Array.from(ruler.children) : [];
|
|
2236
|
+
Array.from(colgroup.children).forEach((node, i) => {
|
|
2237
|
+
const col = node;
|
|
2238
|
+
const cell = cells[i];
|
|
2239
|
+
if (!col.style.width && cell) col.style.width = `${cell.getBoundingClientRect().width}px`;
|
|
2240
|
+
});
|
|
2241
|
+
table.style.tableLayout = "fixed";
|
|
2242
|
+
};
|
|
2243
|
+
const onPointerMove = (e) => {
|
|
2244
|
+
if (drag) {
|
|
2245
|
+
const next = Math.max(MIN_WIDTH, drag.startWidth + (e.clientX - drag.startX));
|
|
2246
|
+
drag.col.style.width = `${next}px`;
|
|
2247
|
+
e.preventDefault();
|
|
2248
|
+
return;
|
|
2249
|
+
}
|
|
2250
|
+
const cell = cellFromEvent(e);
|
|
2251
|
+
if (cell && nearRightEdge(cell, e.clientX)) {
|
|
2252
|
+
cell.style.cursor = "col-resize";
|
|
2253
|
+
} else if (cell) {
|
|
2254
|
+
cell.style.cursor = "";
|
|
2255
|
+
}
|
|
2256
|
+
};
|
|
2257
|
+
const endDrag = () => {
|
|
2258
|
+
if (!drag) return;
|
|
2259
|
+
drag = null;
|
|
2260
|
+
document.documentElement.classList.remove("fact-col-resizing");
|
|
2261
|
+
document.removeEventListener("pointermove", onPointerMove, true);
|
|
2262
|
+
document.removeEventListener("pointerup", endDrag, true);
|
|
2263
|
+
};
|
|
2264
|
+
const onPointerDown = (e) => {
|
|
2265
|
+
if (e.button !== 0) return;
|
|
2266
|
+
const cell = cellFromEvent(e);
|
|
2267
|
+
if (!cell || !nearRightEdge(cell, e.clientX)) return;
|
|
2268
|
+
const table = cell.closest("table");
|
|
2269
|
+
if (!table) return;
|
|
2270
|
+
freezeWidths(table);
|
|
2271
|
+
const col = colForCell(cell);
|
|
2272
|
+
if (!col) return;
|
|
2273
|
+
drag = {
|
|
2274
|
+
col,
|
|
2275
|
+
table,
|
|
2276
|
+
startX: e.clientX,
|
|
2277
|
+
startWidth: parseFloat(col.style.width) || cell.getBoundingClientRect().width
|
|
2278
|
+
};
|
|
2279
|
+
e.preventDefault();
|
|
2280
|
+
document.documentElement.classList.add("fact-col-resizing");
|
|
2281
|
+
document.addEventListener("pointermove", onPointerMove, true);
|
|
2282
|
+
document.addEventListener("pointerup", endDrag, true);
|
|
2283
|
+
};
|
|
2284
|
+
container.addEventListener("pointerdown", onPointerDown);
|
|
2285
|
+
container.addEventListener("pointermove", onPointerMove);
|
|
2286
|
+
return () => {
|
|
2287
|
+
endDrag();
|
|
2288
|
+
container.removeEventListener("pointerdown", onPointerDown);
|
|
2289
|
+
container.removeEventListener("pointermove", onPointerMove);
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2116
2292
|
|
|
2117
2293
|
Object.defineProperty(exports, "DEFAULT_FACT_PASSAGES_LABELS", {
|
|
2118
2294
|
enumerable: true,
|
|
@@ -2190,11 +2366,22 @@ exports.FactsTable = FactsTable;
|
|
|
2190
2366
|
exports.FactsToolbar = FactsToolbar;
|
|
2191
2367
|
exports.FactsViewToggle = FactsViewToggle;
|
|
2192
2368
|
exports.ISO_DATE_FILTER_PARAMS = ISO_DATE_FILTER_PARAMS;
|
|
2369
|
+
exports.buildFactCitations = buildFactCitations;
|
|
2370
|
+
exports.chunkIdsOf = chunkIdsOf;
|
|
2193
2371
|
exports.createFactColumns = createFactColumns;
|
|
2372
|
+
exports.docIdsOf = docIdsOf;
|
|
2373
|
+
exports.enableFactTableColumnResize = enableFactTableColumnResize;
|
|
2194
2374
|
exports.factDateFieldsToSpan = factDateFieldsToSpan;
|
|
2195
2375
|
exports.factDateSpanToFields = factDateSpanToFields;
|
|
2376
|
+
exports.hasChunk = hasChunk;
|
|
2377
|
+
exports.isWholeDoc = isWholeDoc;
|
|
2196
2378
|
exports.sourceDocCount = sourceDocCount;
|
|
2379
|
+
exports.toFactCitations = toFactCitations;
|
|
2197
2380
|
exports.toFactRow = toFactRow;
|
|
2198
2381
|
exports.toFactRows = toFactRows;
|
|
2382
|
+
exports.withChunk = withChunk;
|
|
2383
|
+
exports.withDoc = withDoc;
|
|
2384
|
+
exports.withoutChunk = withoutChunk;
|
|
2385
|
+
exports.withoutDoc = withoutDoc;
|
|
2199
2386
|
//# sourceMappingURL=index.cjs.map
|
|
2200
2387
|
//# sourceMappingURL=index.cjs.map
|