@arbidocs/react 0.4.147 → 0.4.150
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 +17 -7
- package/dist/artifacts/index.cjs.map +1 -1
- package/dist/artifacts/index.d.cts +7 -1
- package/dist/artifacts/index.d.ts +7 -1
- package/dist/artifacts/index.js +11 -2
- package/dist/artifacts/index.js.map +1 -1
- package/dist/{chunk-MFMJHBJR.js → chunk-3XYIQZTH.js} +52 -3
- package/dist/chunk-3XYIQZTH.js.map +1 -0
- package/dist/{chunk-YIFUMQGA.cjs → chunk-IQIDM3KM.cjs} +10 -16
- package/dist/chunk-IQIDM3KM.cjs.map +1 -0
- package/dist/{chunk-KLPY2HUC.cjs → chunk-JFKWH6EP.cjs} +57 -2
- package/dist/chunk-JFKWH6EP.cjs.map +1 -0
- package/dist/{chunk-7AFGROHZ.js → chunk-JQ7Y723H.js} +11 -16
- package/dist/{chunk-7AFGROHZ.js.map → chunk-JQ7Y723H.js.map} +1 -1
- package/dist/{chunk-J3BYHBKW.js → chunk-KD7CKXWQ.js} +1721 -1427
- package/dist/chunk-KD7CKXWQ.js.map +1 -0
- package/dist/{chunk-65WT5PHA.cjs → chunk-L66ZJ2UI.cjs} +1733 -1425
- package/dist/chunk-L66ZJ2UI.cjs.map +1 -0
- package/dist/document-tools/index.cjs +31 -0
- package/dist/document-tools/index.cjs.map +1 -1
- package/dist/document-tools/index.d.cts +19 -1
- package/dist/document-tools/index.d.ts +19 -1
- package/dist/document-tools/index.js +30 -1
- package/dist/document-tools/index.js.map +1 -1
- package/dist/{index-2Y2MVegs.d.ts → index-BV7pBlgY.d.cts} +119 -6
- package/dist/{index-2Y2MVegs.d.cts → index-BV7pBlgY.d.ts} +119 -6
- package/dist/{index-3E0neHf_.d.cts → index-DyFzmDZ2.d.cts} +46 -1
- package/dist/{index-3E0neHf_.d.ts → index-DyFzmDZ2.d.ts} +46 -1
- package/dist/index.cjs +1394 -1223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1355 -339
- package/dist/index.d.ts +1355 -339
- package/dist/index.js +581 -505
- package/dist/index.js.map +1 -1
- package/dist/shell/index.cjs +33 -9
- package/dist/shell/index.d.cts +3 -1
- package/dist/shell/index.d.ts +3 -1
- package/dist/shell/index.js +1 -1
- package/dist/ui/index.cjs +174 -118
- package/dist/ui/index.d.cts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-65WT5PHA.cjs.map +0 -1
- package/dist/chunk-J3BYHBKW.js.map +0 -1
- package/dist/chunk-KLPY2HUC.cjs.map +0 -1
- package/dist/chunk-MFMJHBJR.js.map +0 -1
- package/dist/chunk-YIFUMQGA.cjs.map +0 -1
|
@@ -171,7 +171,7 @@ declare function IconToggle({ icon: Icon, isActive, onToggle, colors, inactiveCo
|
|
|
171
171
|
* Toggle for private/shared visibility state, the one control every shareable thing in the app uses
|
|
172
172
|
* (documents, conversations, tags, facts, tasks). Supports single items and bulk operations. It takes
|
|
173
173
|
* the items (with a shared field) and `onToggle` because the mutation differs by context. The name the
|
|
174
|
-
* app gives a workspace
|
|
174
|
+
* app gives a workspace (the entity registry's, or `workspaceLabel`) appears in its tooltips.
|
|
175
175
|
*/
|
|
176
176
|
interface SharedItem {
|
|
177
177
|
shared?: boolean | null;
|
|
@@ -196,12 +196,39 @@ interface VisibilityToggleProps {
|
|
|
196
196
|
tooltipMixed?: string;
|
|
197
197
|
/** The visible label (when `showLabel`); defaults to "Visibility". */
|
|
198
198
|
label?: string;
|
|
199
|
-
/** What the app calls a workspace, for the default tooltips. */
|
|
199
|
+
/** What the app calls a workspace, for the default tooltips (default: the entity registry's). */
|
|
200
200
|
workspaceLabel?: string;
|
|
201
201
|
'data-testid'?: string;
|
|
202
202
|
}
|
|
203
203
|
declare function VisibilityToggle({ items, presentation, onToggle, disabled, disabledTooltip, disablePrivate, showLabel, showTooltip, tooltipActive, tooltipInactive, tooltipMixed, label, workspaceLabel, 'data-testid': dataTestId, }: VisibilityToggleProps): React$1.JSX.Element;
|
|
204
204
|
|
|
205
|
+
/**
|
|
206
|
+
* VerifiedToggle Component
|
|
207
|
+
*
|
|
208
|
+
* Switch-style toggle for a fact's human-verified (`confirmed`) state — the
|
|
209
|
+
* same IconToggle affordance the VisibilityToggle uses for sharing, so
|
|
210
|
+
* "Verified" reads as a toggle in the facts table rather than a radio/checkbox.
|
|
211
|
+
*/
|
|
212
|
+
interface VerifiedToggleProps {
|
|
213
|
+
verified: boolean;
|
|
214
|
+
/** Called with the desired next state (true = verify, false = unverify). */
|
|
215
|
+
onToggle: (shouldVerify: boolean) => void;
|
|
216
|
+
disabled?: boolean;
|
|
217
|
+
showLabel?: boolean;
|
|
218
|
+
/** Set to false to disable the tooltip (e.g. when nested in another tooltip). */
|
|
219
|
+
showTooltip?: boolean;
|
|
220
|
+
tooltipActive?: string;
|
|
221
|
+
tooltipInactive?: string;
|
|
222
|
+
'data-testid'?: string;
|
|
223
|
+
}
|
|
224
|
+
declare function VerifiedToggle({ verified, onToggle, disabled, showLabel, showTooltip, tooltipActive, tooltipInactive, 'data-testid': dataTestId, }: VerifiedToggleProps): React$1.JSX.Element;
|
|
225
|
+
|
|
226
|
+
/** A timestamp as people read it: "Today, 14:05", "Yesterday", "Aug 18" (with the year once it is not this one). */
|
|
227
|
+
/**
|
|
228
|
+
* Format a date string for friendly display with Today/Yesterday context
|
|
229
|
+
*/
|
|
230
|
+
declare function formatFriendlyDate(dateString: string, includeTime?: boolean): string;
|
|
231
|
+
|
|
205
232
|
/**
|
|
206
233
|
* DebouncedInput Component
|
|
207
234
|
*
|
|
@@ -253,6 +280,7 @@ interface DictateContextValue {
|
|
|
253
280
|
declare function DictateProvider({ transcribe, onError, children, }: DictateContextValue & {
|
|
254
281
|
children: React.ReactNode;
|
|
255
282
|
}): React$1.JSX.Element;
|
|
283
|
+
declare function useDictateContext(): DictateContextValue | null;
|
|
256
284
|
|
|
257
285
|
/**
|
|
258
286
|
* Where the overlays below this point (dialogs, menus, popovers, selects) portal to. Without it they
|
|
@@ -749,8 +777,7 @@ declare const markdownBaseComponents: Partial<Components>;
|
|
|
749
777
|
* PassageCard — the card ("bubble") a single retrieved passage is rendered as.
|
|
750
778
|
*
|
|
751
779
|
* One presentation shared by every surface that lists retrieval hits: the
|
|
752
|
-
*
|
|
753
|
-
* results. Those had drifted into two different looks for the same object; this
|
|
780
|
+
* blocks search page (`SearchHit`) and the conversation search. Those had drifted into two different looks for the same object; this
|
|
754
781
|
* is the single one.
|
|
755
782
|
*
|
|
756
783
|
* The card owns the chrome only — the rounded border, the AI-accent hover /
|
|
@@ -886,6 +913,15 @@ interface DocumentLike {
|
|
|
886
913
|
title?: string | null;
|
|
887
914
|
} | null;
|
|
888
915
|
}
|
|
916
|
+
/** Title of a document: `doc_metadata.title`, falling back to `file_name`. */
|
|
917
|
+
declare function getDocumentTitle(document: DocumentLike | null | undefined, defaultValue?: string): string;
|
|
918
|
+
/**
|
|
919
|
+
* Whether a document is an image (upload or AI-generated): pages and tokens are text-document
|
|
920
|
+
* concepts, never meaningful for an image, whatever the stored value.
|
|
921
|
+
*/
|
|
922
|
+
declare function isImageDocument(document: {
|
|
923
|
+
file_type?: string | null;
|
|
924
|
+
} | null | undefined): boolean;
|
|
889
925
|
/**
|
|
890
926
|
* The file-type glyph for a document, by extension.
|
|
891
927
|
*
|
|
@@ -993,6 +1029,32 @@ declare function getTagTypeIcon(type?: string | null): typeof StickyNote;
|
|
|
993
1029
|
/** Resolve the human-readable label for a tag type, falling back to the raw type. */
|
|
994
1030
|
declare function getTagTypeLabel(type?: string | null): string;
|
|
995
1031
|
|
|
1032
|
+
/**
|
|
1033
|
+
* What each tag kind is called, from the entity registry (so a deployment that renames an entity —
|
|
1034
|
+
* an issue to "Point", say — renames it everywhere): `tagKindTitle('person', { plural: true })` is
|
|
1035
|
+
* "People", `tagKindNouns('label').singular` is "label".
|
|
1036
|
+
*/
|
|
1037
|
+
/** The entity-label registry entry that names each kind (the SDK's `TagKind`s). */
|
|
1038
|
+
declare const KIND_ENTITY: {
|
|
1039
|
+
readonly label: "LABEL";
|
|
1040
|
+
readonly annotation: "ANNOTATION";
|
|
1041
|
+
readonly search: "SAVED_SEARCH";
|
|
1042
|
+
readonly issue: "ISSUE";
|
|
1043
|
+
readonly person: "PERSON";
|
|
1044
|
+
readonly organisation: "ORGANISATION";
|
|
1045
|
+
};
|
|
1046
|
+
/** What a tag is: a label, annotation, search, issue, person or organisation. */
|
|
1047
|
+
type TagKind = keyof typeof KIND_ENTITY;
|
|
1048
|
+
/** A kind's name as a heading or option ("Label", "Organisation", plural "People"). */
|
|
1049
|
+
declare function tagKindTitle(kind: TagKind, { plural }?: {
|
|
1050
|
+
plural?: boolean | undefined;
|
|
1051
|
+
}): string;
|
|
1052
|
+
/** Singular / plural nouns for a kind, for running text ("New label", "2 annotations"). */
|
|
1053
|
+
declare function tagKindNouns(kind: TagKind): {
|
|
1054
|
+
singular: string;
|
|
1055
|
+
plural: string;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
996
1058
|
/**
|
|
997
1059
|
* ProjectEntity Component
|
|
998
1060
|
*
|
|
@@ -1321,7 +1383,7 @@ declare const ENTITY_MAPPINGS: {
|
|
|
1321
1383
|
DEFAULT: React__default.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
1322
1384
|
};
|
|
1323
1385
|
};
|
|
1324
|
-
|
|
1386
|
+
FACT: {
|
|
1325
1387
|
NAMES: {
|
|
1326
1388
|
SINGULAR: string;
|
|
1327
1389
|
PLURAL: string;
|
|
@@ -1568,6 +1630,57 @@ declare const ShieldIcon: React__default.FC<ShieldIconProps>;
|
|
|
1568
1630
|
*/
|
|
1569
1631
|
declare function agentAvatarColors(bgColorClass: string): CSSProperties;
|
|
1570
1632
|
|
|
1633
|
+
/**
|
|
1634
|
+
* Document media-type helpers.
|
|
1635
|
+
*
|
|
1636
|
+
* Single source of truth for "is this an image / video / audio file", shared by
|
|
1637
|
+
* the viewer (which renders the original bytes for media but the generated PDF
|
|
1638
|
+
* for everything else) and the offline cache (which must fetch the same bytes
|
|
1639
|
+
* the viewer would). Keeps the extension lists from drifting between the two.
|
|
1640
|
+
*/
|
|
1641
|
+
declare function isImageFile(fileName: string | null | undefined): boolean;
|
|
1642
|
+
declare function isVideoFile(fileName: string | null | undefined): boolean;
|
|
1643
|
+
declare function isAudioFile(fileName: string | null | undefined): boolean;
|
|
1644
|
+
declare function isMediaFile(fileName: string | null | undefined): boolean;
|
|
1645
|
+
/**
|
|
1646
|
+
* Whether the viewer renders the file's *original* bytes (true for media, which
|
|
1647
|
+
* we serve via `/download`) rather than the server-generated PDF preview (served
|
|
1648
|
+
* via `/view`). Drives both the viewer's endpoint choice and the offline cache.
|
|
1649
|
+
*/
|
|
1650
|
+
declare function usesOriginalBytesForViewer(fileName: string | null | undefined): boolean;
|
|
1651
|
+
/** Archives, executables and design files: no preview and no PDF version, only a download. */
|
|
1652
|
+
declare function isDownloadOnlyFile(fileName: string | null | undefined): boolean;
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* Friendly file-type label.
|
|
1656
|
+
*
|
|
1657
|
+
* `Doc.file_type` is populated from two unrelated upload paths in the
|
|
1658
|
+
* backend: sometimes it's a bare extension (``"pdf"``, ``"docx"``,
|
|
1659
|
+
* ``"html"``), sometimes it's a MIME type (``"application/pdf"``,
|
|
1660
|
+
* ``"image/jpeg"``). Showing the raw value as-is gives the grid a
|
|
1661
|
+
* mix of ``PDF`` and ``APPLICATION/PDF`` in the same column.
|
|
1662
|
+
*
|
|
1663
|
+
* This util normalises both shapes to a single short, capitalised
|
|
1664
|
+
* label. The classification is keyed off the MIME subtype (or the bare
|
|
1665
|
+
* extension) so adding a new entry only ever requires touching the
|
|
1666
|
+
* tables below.
|
|
1667
|
+
*
|
|
1668
|
+
* Falls back to the file name's extension when ``file_type`` is
|
|
1669
|
+
* missing or unrecognised, and finally to ``Other`` so the cell never
|
|
1670
|
+
* renders empty.
|
|
1671
|
+
*/
|
|
1672
|
+
/**
|
|
1673
|
+
* Map a backend ``file_type`` value (extension OR MIME type) plus an
|
|
1674
|
+
* optional file name to a single short label suitable for a grid cell.
|
|
1675
|
+
*
|
|
1676
|
+
* Order:
|
|
1677
|
+
* 1. ``file_type`` looks like a MIME ("a/b") → MIME tables.
|
|
1678
|
+
* 2. ``file_type`` looks like a bare extension → extension table.
|
|
1679
|
+
* 3. ``file_name`` extension as a last-resort fallback.
|
|
1680
|
+
* 4. ``"Other"``.
|
|
1681
|
+
*/
|
|
1682
|
+
declare function friendlyFileType(fileType?: string | null, fileName?: string | null): string;
|
|
1683
|
+
|
|
1571
1684
|
interface UserMenuItem {
|
|
1572
1685
|
label: string;
|
|
1573
1686
|
icon?: ComponentType<{
|
|
@@ -1673,4 +1786,4 @@ declare function DocumentCard({ doc, thumbnailUrl, status, selected, onToggleSel
|
|
|
1673
1786
|
|
|
1674
1787
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1675
1788
|
|
|
1676
|
-
export { DropdownMenuContent as $, AgentBadge as A, BASE_COLORS as B, Card as C, CommandSeparator as D, CommandShortcut as E, DebouncedInput as F, type DebouncedInputProps as G, Dialog as H, DialogClose as I, DialogContent as J, DialogDescription as K, DialogFooter as L, DialogHeader as M, DialogOverlay as N, DialogPortal as O, type DialogPresentation as P, DialogTitle as Q, DialogTrigger as R, type DictateContextValue as S, DictateProvider as T, DocumentCard as U, type DocumentCardProps as V, DocumentEntity as W, type DocumentEntityProps as X, type DocumentLike as Y, DropdownMenu as Z, DropdownMenuCheckboxItem as _, AiMarkdown as a, ScrollBar as a$, DropdownMenuGroup as a0, DropdownMenuItem as a1, DropdownMenuLabel as a2, DropdownMenuPortal as a3, DropdownMenuRadioGroup as a4, DropdownMenuRadioItem as a5, DropdownMenuSeparator as a6, DropdownMenuShortcut as a7, DropdownMenuSub as a8, DropdownMenuSubContent as a9, MarkdownCode as aA, MarkdownLink as aB, MarkdownRenderer as aC, type MarkdownRendererProps as aD, MarkdownStreamingContext as aE, NEUTRAL_GRAY as aF, PLACEHOLDER_COLOR as aG, PassageCard as aH, type PassageCardProps as aI, Popover as aJ, PopoverAnchor as aK, PopoverClose as aL, PopoverContent as aM, PopoverTrigger as aN, PortalContainerProvider as aO, type PresenceDisplayStatus as aP, PresenceLabel as aQ, Progress as aR, ProjectEntity as aS, type ProjectEntityProps as aT, type ProjectRelation as aU, RadioGroup as aV, RadioGroupItem as aW, type Rag as aX, RagDot as aY, RelevanceDot as aZ, ScrollArea as a_, DropdownMenuSubTrigger as aa, DropdownMenuTrigger as ab, ENTITY_MAPPINGS as ac, EntityIcon as ad, type EntityIconComponent as ae, EntityPill as af, type EntityRegistryOverride as ag, type EntityType as ah, HoverCard as ai, HoverCardContent as aj, HoverCardTrigger as ak, IconToggle as al, type IconToggleProps as am, type IdentityBusy as an, type IdentityProblem as ao, type IdentityPurchase as ap, type IdentityState as aq, type IdentityStatus as ar, type IdentityStep as as, type IdentityVerificationFlow as at, Input as au, type InputProps as av, Label as aw, MarkMenu as ax, type MarkMenuItem as ay, type MarkMenuProps as az, ArbiIcon as b,
|
|
1789
|
+
export { DropdownMenuContent as $, AgentBadge as A, BASE_COLORS as B, Card as C, CommandSeparator as D, CommandShortcut as E, DebouncedInput as F, type DebouncedInputProps as G, Dialog as H, DialogClose as I, DialogContent as J, DialogDescription as K, DialogFooter as L, DialogHeader as M, DialogOverlay as N, DialogPortal as O, type DialogPresentation as P, DialogTitle as Q, DialogTrigger as R, type DictateContextValue as S, DictateProvider as T, DocumentCard as U, type DocumentCardProps as V, DocumentEntity as W, type DocumentEntityProps as X, type DocumentLike as Y, DropdownMenu as Z, DropdownMenuCheckboxItem as _, AiMarkdown as a, ScrollBar as a$, DropdownMenuGroup as a0, DropdownMenuItem as a1, DropdownMenuLabel as a2, DropdownMenuPortal as a3, DropdownMenuRadioGroup as a4, DropdownMenuRadioItem as a5, DropdownMenuSeparator as a6, DropdownMenuShortcut as a7, DropdownMenuSub as a8, DropdownMenuSubContent as a9, MarkdownCode as aA, MarkdownLink as aB, MarkdownRenderer as aC, type MarkdownRendererProps as aD, MarkdownStreamingContext as aE, NEUTRAL_GRAY as aF, PLACEHOLDER_COLOR as aG, PassageCard as aH, type PassageCardProps as aI, Popover as aJ, PopoverAnchor as aK, PopoverClose as aL, PopoverContent as aM, PopoverTrigger as aN, PortalContainerProvider as aO, type PresenceDisplayStatus as aP, PresenceLabel as aQ, Progress as aR, ProjectEntity as aS, type ProjectEntityProps as aT, type ProjectRelation as aU, RadioGroup as aV, RadioGroupItem as aW, type Rag as aX, RagDot as aY, RelevanceDot as aZ, ScrollArea as a_, DropdownMenuSubTrigger as aa, DropdownMenuTrigger as ab, ENTITY_MAPPINGS as ac, EntityIcon as ad, type EntityIconComponent as ae, EntityPill as af, type EntityRegistryOverride as ag, type EntityType as ah, HoverCard as ai, HoverCardContent as aj, HoverCardTrigger as ak, IconToggle as al, type IconToggleProps as am, type IdentityBusy as an, type IdentityProblem as ao, type IdentityPurchase as ap, type IdentityState as aq, type IdentityStatus as ar, type IdentityStep as as, type IdentityVerificationFlow as at, Input as au, type InputProps as av, Label as aw, MarkMenu as ax, type MarkMenuItem as ay, type MarkMenuProps as az, ArbiIcon as b, cardVariants as b$, Select as b0, SelectContent as b1, SelectGroup as b2, SelectItem as b3, SelectLabel as b4, SelectScrollDownButton as b5, SelectScrollUpButton as b6, SelectSeparator as b7, SelectTrigger as b8, SelectValue as b9, type TagLike as bA, Textarea as bB, type TextareaProps as bC, ThreadVisibilityIcon as bD, Toggle as bE, ToggleGroup as bF, ToggleGroupItem as bG, Tooltip as bH, TooltipContent as bI, TooltipProvider as bJ, TooltipTrigger as bK, UserEntity as bL, type UserEntityProps as bM, UserMenu as bN, type UserMenuItem as bO, type UserMenuProps as bP, type UserMenuStatus as bQ, VISIBILITY_ICONS as bR, VerifiedBadge as bS, type VerifiedBadgeProps as bT, VerifiedToggle as bU, VisibilityIcon as bV, VisibilityToggle as bW, type VisibilityToggleProps as bX, agentAvatarColors as bY, badgeVariants as bZ, buttonVariants as b_, Separator as ba, ShieldIcon as bb, type ShieldIconProps as bc, Slider as bd, type StatusBadgeComponent as be, type StatusBadgeProps as bf, StatusPill as bg, type StatusPillProps as bh, type StatusVariant as bi, Switch as bj, TAG_TYPE_ICONS as bk, TAG_TYPE_LABELS as bl, Table as bm, TableBody as bn, TableCaption as bo, TableCell as bp, TableFooter as bq, TableHead as br, TableHeader as bs, TableRow as bt, Tabs as bu, TabsContent as bv, TabsList as bw, TabsTrigger as bx, TagEntity as by, type TagEntityProps as bz, Avatar as c, closeOpenEmphasis as c0, cn as c1, configureEntityRegistry as c2, configureRagLabels as c3, configureStatusRegistry as c4, formatFriendlyDate as c5, friendlyFileType as c6, getDocIcon as c7, getDocumentTitle as c8, getEntityColor as c9, getEntityColorStyles as ca, getEntityIcon as cb, getEntityLabel as cc, getStatusVariant as cd, getTagTypeIcon as ce, getTagTypeLabel as cf, getWorkspaceColor as cg, isAudioFile as ch, isDownloadOnlyFile as ci, isImageDocument as cj, isImageFile as ck, isMediaFile as cl, isVideoFile as cm, markdownBaseComponents as cn, markdownSanitizeSchema as co, normalizeCitationMarkup as cp, splitMarkdownBlocks as cq, tagKindNouns as cr, tagKindTitle as cs, toggleVariants as ct, trimOpenCitation as cu, useDictateContext as cv, usePortalContainer as cw, usesOriginalBytesForViewer as cx, AvatarFallback as d, AvatarImage as e, Badge as f, type BadgeProps as g, Button as h, type ButtonProps as i, CardContent as j, CardDescription as k, CardFooter as l, CardHeader as m, type CardProps as n, CardTitle as o, Checkbox as p, Collapsible as q, CollapsibleContent as r, CollapsibleTrigger as s, Command as t, CommandDialog as u, CommandEmpty as v, CommandGroup as w, CommandInput as x, CommandItem as y, CommandList as z };
|
|
@@ -171,7 +171,7 @@ declare function IconToggle({ icon: Icon, isActive, onToggle, colors, inactiveCo
|
|
|
171
171
|
* Toggle for private/shared visibility state, the one control every shareable thing in the app uses
|
|
172
172
|
* (documents, conversations, tags, facts, tasks). Supports single items and bulk operations. It takes
|
|
173
173
|
* the items (with a shared field) and `onToggle` because the mutation differs by context. The name the
|
|
174
|
-
* app gives a workspace
|
|
174
|
+
* app gives a workspace (the entity registry's, or `workspaceLabel`) appears in its tooltips.
|
|
175
175
|
*/
|
|
176
176
|
interface SharedItem {
|
|
177
177
|
shared?: boolean | null;
|
|
@@ -196,12 +196,39 @@ interface VisibilityToggleProps {
|
|
|
196
196
|
tooltipMixed?: string;
|
|
197
197
|
/** The visible label (when `showLabel`); defaults to "Visibility". */
|
|
198
198
|
label?: string;
|
|
199
|
-
/** What the app calls a workspace, for the default tooltips. */
|
|
199
|
+
/** What the app calls a workspace, for the default tooltips (default: the entity registry's). */
|
|
200
200
|
workspaceLabel?: string;
|
|
201
201
|
'data-testid'?: string;
|
|
202
202
|
}
|
|
203
203
|
declare function VisibilityToggle({ items, presentation, onToggle, disabled, disabledTooltip, disablePrivate, showLabel, showTooltip, tooltipActive, tooltipInactive, tooltipMixed, label, workspaceLabel, 'data-testid': dataTestId, }: VisibilityToggleProps): React$1.JSX.Element;
|
|
204
204
|
|
|
205
|
+
/**
|
|
206
|
+
* VerifiedToggle Component
|
|
207
|
+
*
|
|
208
|
+
* Switch-style toggle for a fact's human-verified (`confirmed`) state — the
|
|
209
|
+
* same IconToggle affordance the VisibilityToggle uses for sharing, so
|
|
210
|
+
* "Verified" reads as a toggle in the facts table rather than a radio/checkbox.
|
|
211
|
+
*/
|
|
212
|
+
interface VerifiedToggleProps {
|
|
213
|
+
verified: boolean;
|
|
214
|
+
/** Called with the desired next state (true = verify, false = unverify). */
|
|
215
|
+
onToggle: (shouldVerify: boolean) => void;
|
|
216
|
+
disabled?: boolean;
|
|
217
|
+
showLabel?: boolean;
|
|
218
|
+
/** Set to false to disable the tooltip (e.g. when nested in another tooltip). */
|
|
219
|
+
showTooltip?: boolean;
|
|
220
|
+
tooltipActive?: string;
|
|
221
|
+
tooltipInactive?: string;
|
|
222
|
+
'data-testid'?: string;
|
|
223
|
+
}
|
|
224
|
+
declare function VerifiedToggle({ verified, onToggle, disabled, showLabel, showTooltip, tooltipActive, tooltipInactive, 'data-testid': dataTestId, }: VerifiedToggleProps): React$1.JSX.Element;
|
|
225
|
+
|
|
226
|
+
/** A timestamp as people read it: "Today, 14:05", "Yesterday", "Aug 18" (with the year once it is not this one). */
|
|
227
|
+
/**
|
|
228
|
+
* Format a date string for friendly display with Today/Yesterday context
|
|
229
|
+
*/
|
|
230
|
+
declare function formatFriendlyDate(dateString: string, includeTime?: boolean): string;
|
|
231
|
+
|
|
205
232
|
/**
|
|
206
233
|
* DebouncedInput Component
|
|
207
234
|
*
|
|
@@ -253,6 +280,7 @@ interface DictateContextValue {
|
|
|
253
280
|
declare function DictateProvider({ transcribe, onError, children, }: DictateContextValue & {
|
|
254
281
|
children: React.ReactNode;
|
|
255
282
|
}): React$1.JSX.Element;
|
|
283
|
+
declare function useDictateContext(): DictateContextValue | null;
|
|
256
284
|
|
|
257
285
|
/**
|
|
258
286
|
* Where the overlays below this point (dialogs, menus, popovers, selects) portal to. Without it they
|
|
@@ -749,8 +777,7 @@ declare const markdownBaseComponents: Partial<Components>;
|
|
|
749
777
|
* PassageCard — the card ("bubble") a single retrieved passage is rendered as.
|
|
750
778
|
*
|
|
751
779
|
* One presentation shared by every surface that lists retrieval hits: the
|
|
752
|
-
*
|
|
753
|
-
* results. Those had drifted into two different looks for the same object; this
|
|
780
|
+
* blocks search page (`SearchHit`) and the conversation search. Those had drifted into two different looks for the same object; this
|
|
754
781
|
* is the single one.
|
|
755
782
|
*
|
|
756
783
|
* The card owns the chrome only — the rounded border, the AI-accent hover /
|
|
@@ -886,6 +913,15 @@ interface DocumentLike {
|
|
|
886
913
|
title?: string | null;
|
|
887
914
|
} | null;
|
|
888
915
|
}
|
|
916
|
+
/** Title of a document: `doc_metadata.title`, falling back to `file_name`. */
|
|
917
|
+
declare function getDocumentTitle(document: DocumentLike | null | undefined, defaultValue?: string): string;
|
|
918
|
+
/**
|
|
919
|
+
* Whether a document is an image (upload or AI-generated): pages and tokens are text-document
|
|
920
|
+
* concepts, never meaningful for an image, whatever the stored value.
|
|
921
|
+
*/
|
|
922
|
+
declare function isImageDocument(document: {
|
|
923
|
+
file_type?: string | null;
|
|
924
|
+
} | null | undefined): boolean;
|
|
889
925
|
/**
|
|
890
926
|
* The file-type glyph for a document, by extension.
|
|
891
927
|
*
|
|
@@ -993,6 +1029,32 @@ declare function getTagTypeIcon(type?: string | null): typeof StickyNote;
|
|
|
993
1029
|
/** Resolve the human-readable label for a tag type, falling back to the raw type. */
|
|
994
1030
|
declare function getTagTypeLabel(type?: string | null): string;
|
|
995
1031
|
|
|
1032
|
+
/**
|
|
1033
|
+
* What each tag kind is called, from the entity registry (so a deployment that renames an entity —
|
|
1034
|
+
* an issue to "Point", say — renames it everywhere): `tagKindTitle('person', { plural: true })` is
|
|
1035
|
+
* "People", `tagKindNouns('label').singular` is "label".
|
|
1036
|
+
*/
|
|
1037
|
+
/** The entity-label registry entry that names each kind (the SDK's `TagKind`s). */
|
|
1038
|
+
declare const KIND_ENTITY: {
|
|
1039
|
+
readonly label: "LABEL";
|
|
1040
|
+
readonly annotation: "ANNOTATION";
|
|
1041
|
+
readonly search: "SAVED_SEARCH";
|
|
1042
|
+
readonly issue: "ISSUE";
|
|
1043
|
+
readonly person: "PERSON";
|
|
1044
|
+
readonly organisation: "ORGANISATION";
|
|
1045
|
+
};
|
|
1046
|
+
/** What a tag is: a label, annotation, search, issue, person or organisation. */
|
|
1047
|
+
type TagKind = keyof typeof KIND_ENTITY;
|
|
1048
|
+
/** A kind's name as a heading or option ("Label", "Organisation", plural "People"). */
|
|
1049
|
+
declare function tagKindTitle(kind: TagKind, { plural }?: {
|
|
1050
|
+
plural?: boolean | undefined;
|
|
1051
|
+
}): string;
|
|
1052
|
+
/** Singular / plural nouns for a kind, for running text ("New label", "2 annotations"). */
|
|
1053
|
+
declare function tagKindNouns(kind: TagKind): {
|
|
1054
|
+
singular: string;
|
|
1055
|
+
plural: string;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
996
1058
|
/**
|
|
997
1059
|
* ProjectEntity Component
|
|
998
1060
|
*
|
|
@@ -1321,7 +1383,7 @@ declare const ENTITY_MAPPINGS: {
|
|
|
1321
1383
|
DEFAULT: React__default.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & React__default.RefAttributes<SVGSVGElement>>;
|
|
1322
1384
|
};
|
|
1323
1385
|
};
|
|
1324
|
-
|
|
1386
|
+
FACT: {
|
|
1325
1387
|
NAMES: {
|
|
1326
1388
|
SINGULAR: string;
|
|
1327
1389
|
PLURAL: string;
|
|
@@ -1568,6 +1630,57 @@ declare const ShieldIcon: React__default.FC<ShieldIconProps>;
|
|
|
1568
1630
|
*/
|
|
1569
1631
|
declare function agentAvatarColors(bgColorClass: string): CSSProperties;
|
|
1570
1632
|
|
|
1633
|
+
/**
|
|
1634
|
+
* Document media-type helpers.
|
|
1635
|
+
*
|
|
1636
|
+
* Single source of truth for "is this an image / video / audio file", shared by
|
|
1637
|
+
* the viewer (which renders the original bytes for media but the generated PDF
|
|
1638
|
+
* for everything else) and the offline cache (which must fetch the same bytes
|
|
1639
|
+
* the viewer would). Keeps the extension lists from drifting between the two.
|
|
1640
|
+
*/
|
|
1641
|
+
declare function isImageFile(fileName: string | null | undefined): boolean;
|
|
1642
|
+
declare function isVideoFile(fileName: string | null | undefined): boolean;
|
|
1643
|
+
declare function isAudioFile(fileName: string | null | undefined): boolean;
|
|
1644
|
+
declare function isMediaFile(fileName: string | null | undefined): boolean;
|
|
1645
|
+
/**
|
|
1646
|
+
* Whether the viewer renders the file's *original* bytes (true for media, which
|
|
1647
|
+
* we serve via `/download`) rather than the server-generated PDF preview (served
|
|
1648
|
+
* via `/view`). Drives both the viewer's endpoint choice and the offline cache.
|
|
1649
|
+
*/
|
|
1650
|
+
declare function usesOriginalBytesForViewer(fileName: string | null | undefined): boolean;
|
|
1651
|
+
/** Archives, executables and design files: no preview and no PDF version, only a download. */
|
|
1652
|
+
declare function isDownloadOnlyFile(fileName: string | null | undefined): boolean;
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* Friendly file-type label.
|
|
1656
|
+
*
|
|
1657
|
+
* `Doc.file_type` is populated from two unrelated upload paths in the
|
|
1658
|
+
* backend: sometimes it's a bare extension (``"pdf"``, ``"docx"``,
|
|
1659
|
+
* ``"html"``), sometimes it's a MIME type (``"application/pdf"``,
|
|
1660
|
+
* ``"image/jpeg"``). Showing the raw value as-is gives the grid a
|
|
1661
|
+
* mix of ``PDF`` and ``APPLICATION/PDF`` in the same column.
|
|
1662
|
+
*
|
|
1663
|
+
* This util normalises both shapes to a single short, capitalised
|
|
1664
|
+
* label. The classification is keyed off the MIME subtype (or the bare
|
|
1665
|
+
* extension) so adding a new entry only ever requires touching the
|
|
1666
|
+
* tables below.
|
|
1667
|
+
*
|
|
1668
|
+
* Falls back to the file name's extension when ``file_type`` is
|
|
1669
|
+
* missing or unrecognised, and finally to ``Other`` so the cell never
|
|
1670
|
+
* renders empty.
|
|
1671
|
+
*/
|
|
1672
|
+
/**
|
|
1673
|
+
* Map a backend ``file_type`` value (extension OR MIME type) plus an
|
|
1674
|
+
* optional file name to a single short label suitable for a grid cell.
|
|
1675
|
+
*
|
|
1676
|
+
* Order:
|
|
1677
|
+
* 1. ``file_type`` looks like a MIME ("a/b") → MIME tables.
|
|
1678
|
+
* 2. ``file_type`` looks like a bare extension → extension table.
|
|
1679
|
+
* 3. ``file_name`` extension as a last-resort fallback.
|
|
1680
|
+
* 4. ``"Other"``.
|
|
1681
|
+
*/
|
|
1682
|
+
declare function friendlyFileType(fileType?: string | null, fileName?: string | null): string;
|
|
1683
|
+
|
|
1571
1684
|
interface UserMenuItem {
|
|
1572
1685
|
label: string;
|
|
1573
1686
|
icon?: ComponentType<{
|
|
@@ -1673,4 +1786,4 @@ declare function DocumentCard({ doc, thumbnailUrl, status, selected, onToggleSel
|
|
|
1673
1786
|
|
|
1674
1787
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1675
1788
|
|
|
1676
|
-
export { DropdownMenuContent as $, AgentBadge as A, BASE_COLORS as B, Card as C, CommandSeparator as D, CommandShortcut as E, DebouncedInput as F, type DebouncedInputProps as G, Dialog as H, DialogClose as I, DialogContent as J, DialogDescription as K, DialogFooter as L, DialogHeader as M, DialogOverlay as N, DialogPortal as O, type DialogPresentation as P, DialogTitle as Q, DialogTrigger as R, type DictateContextValue as S, DictateProvider as T, DocumentCard as U, type DocumentCardProps as V, DocumentEntity as W, type DocumentEntityProps as X, type DocumentLike as Y, DropdownMenu as Z, DropdownMenuCheckboxItem as _, AiMarkdown as a, ScrollBar as a$, DropdownMenuGroup as a0, DropdownMenuItem as a1, DropdownMenuLabel as a2, DropdownMenuPortal as a3, DropdownMenuRadioGroup as a4, DropdownMenuRadioItem as a5, DropdownMenuSeparator as a6, DropdownMenuShortcut as a7, DropdownMenuSub as a8, DropdownMenuSubContent as a9, MarkdownCode as aA, MarkdownLink as aB, MarkdownRenderer as aC, type MarkdownRendererProps as aD, MarkdownStreamingContext as aE, NEUTRAL_GRAY as aF, PLACEHOLDER_COLOR as aG, PassageCard as aH, type PassageCardProps as aI, Popover as aJ, PopoverAnchor as aK, PopoverClose as aL, PopoverContent as aM, PopoverTrigger as aN, PortalContainerProvider as aO, type PresenceDisplayStatus as aP, PresenceLabel as aQ, Progress as aR, ProjectEntity as aS, type ProjectEntityProps as aT, type ProjectRelation as aU, RadioGroup as aV, RadioGroupItem as aW, type Rag as aX, RagDot as aY, RelevanceDot as aZ, ScrollArea as a_, DropdownMenuSubTrigger as aa, DropdownMenuTrigger as ab, ENTITY_MAPPINGS as ac, EntityIcon as ad, type EntityIconComponent as ae, EntityPill as af, type EntityRegistryOverride as ag, type EntityType as ah, HoverCard as ai, HoverCardContent as aj, HoverCardTrigger as ak, IconToggle as al, type IconToggleProps as am, type IdentityBusy as an, type IdentityProblem as ao, type IdentityPurchase as ap, type IdentityState as aq, type IdentityStatus as ar, type IdentityStep as as, type IdentityVerificationFlow as at, Input as au, type InputProps as av, Label as aw, MarkMenu as ax, type MarkMenuItem as ay, type MarkMenuProps as az, ArbiIcon as b,
|
|
1789
|
+
export { DropdownMenuContent as $, AgentBadge as A, BASE_COLORS as B, Card as C, CommandSeparator as D, CommandShortcut as E, DebouncedInput as F, type DebouncedInputProps as G, Dialog as H, DialogClose as I, DialogContent as J, DialogDescription as K, DialogFooter as L, DialogHeader as M, DialogOverlay as N, DialogPortal as O, type DialogPresentation as P, DialogTitle as Q, DialogTrigger as R, type DictateContextValue as S, DictateProvider as T, DocumentCard as U, type DocumentCardProps as V, DocumentEntity as W, type DocumentEntityProps as X, type DocumentLike as Y, DropdownMenu as Z, DropdownMenuCheckboxItem as _, AiMarkdown as a, ScrollBar as a$, DropdownMenuGroup as a0, DropdownMenuItem as a1, DropdownMenuLabel as a2, DropdownMenuPortal as a3, DropdownMenuRadioGroup as a4, DropdownMenuRadioItem as a5, DropdownMenuSeparator as a6, DropdownMenuShortcut as a7, DropdownMenuSub as a8, DropdownMenuSubContent as a9, MarkdownCode as aA, MarkdownLink as aB, MarkdownRenderer as aC, type MarkdownRendererProps as aD, MarkdownStreamingContext as aE, NEUTRAL_GRAY as aF, PLACEHOLDER_COLOR as aG, PassageCard as aH, type PassageCardProps as aI, Popover as aJ, PopoverAnchor as aK, PopoverClose as aL, PopoverContent as aM, PopoverTrigger as aN, PortalContainerProvider as aO, type PresenceDisplayStatus as aP, PresenceLabel as aQ, Progress as aR, ProjectEntity as aS, type ProjectEntityProps as aT, type ProjectRelation as aU, RadioGroup as aV, RadioGroupItem as aW, type Rag as aX, RagDot as aY, RelevanceDot as aZ, ScrollArea as a_, DropdownMenuSubTrigger as aa, DropdownMenuTrigger as ab, ENTITY_MAPPINGS as ac, EntityIcon as ad, type EntityIconComponent as ae, EntityPill as af, type EntityRegistryOverride as ag, type EntityType as ah, HoverCard as ai, HoverCardContent as aj, HoverCardTrigger as ak, IconToggle as al, type IconToggleProps as am, type IdentityBusy as an, type IdentityProblem as ao, type IdentityPurchase as ap, type IdentityState as aq, type IdentityStatus as ar, type IdentityStep as as, type IdentityVerificationFlow as at, Input as au, type InputProps as av, Label as aw, MarkMenu as ax, type MarkMenuItem as ay, type MarkMenuProps as az, ArbiIcon as b, cardVariants as b$, Select as b0, SelectContent as b1, SelectGroup as b2, SelectItem as b3, SelectLabel as b4, SelectScrollDownButton as b5, SelectScrollUpButton as b6, SelectSeparator as b7, SelectTrigger as b8, SelectValue as b9, type TagLike as bA, Textarea as bB, type TextareaProps as bC, ThreadVisibilityIcon as bD, Toggle as bE, ToggleGroup as bF, ToggleGroupItem as bG, Tooltip as bH, TooltipContent as bI, TooltipProvider as bJ, TooltipTrigger as bK, UserEntity as bL, type UserEntityProps as bM, UserMenu as bN, type UserMenuItem as bO, type UserMenuProps as bP, type UserMenuStatus as bQ, VISIBILITY_ICONS as bR, VerifiedBadge as bS, type VerifiedBadgeProps as bT, VerifiedToggle as bU, VisibilityIcon as bV, VisibilityToggle as bW, type VisibilityToggleProps as bX, agentAvatarColors as bY, badgeVariants as bZ, buttonVariants as b_, Separator as ba, ShieldIcon as bb, type ShieldIconProps as bc, Slider as bd, type StatusBadgeComponent as be, type StatusBadgeProps as bf, StatusPill as bg, type StatusPillProps as bh, type StatusVariant as bi, Switch as bj, TAG_TYPE_ICONS as bk, TAG_TYPE_LABELS as bl, Table as bm, TableBody as bn, TableCaption as bo, TableCell as bp, TableFooter as bq, TableHead as br, TableHeader as bs, TableRow as bt, Tabs as bu, TabsContent as bv, TabsList as bw, TabsTrigger as bx, TagEntity as by, type TagEntityProps as bz, Avatar as c, closeOpenEmphasis as c0, cn as c1, configureEntityRegistry as c2, configureRagLabels as c3, configureStatusRegistry as c4, formatFriendlyDate as c5, friendlyFileType as c6, getDocIcon as c7, getDocumentTitle as c8, getEntityColor as c9, getEntityColorStyles as ca, getEntityIcon as cb, getEntityLabel as cc, getStatusVariant as cd, getTagTypeIcon as ce, getTagTypeLabel as cf, getWorkspaceColor as cg, isAudioFile as ch, isDownloadOnlyFile as ci, isImageDocument as cj, isImageFile as ck, isMediaFile as cl, isVideoFile as cm, markdownBaseComponents as cn, markdownSanitizeSchema as co, normalizeCitationMarkup as cp, splitMarkdownBlocks as cq, tagKindNouns as cr, tagKindTitle as cs, toggleVariants as ct, trimOpenCitation as cu, useDictateContext as cv, usePortalContainer as cw, usesOriginalBytesForViewer as cx, AvatarFallback as d, AvatarImage as e, Badge as f, type BadgeProps as g, Button as h, type ButtonProps as i, CardContent as j, CardDescription as k, CardFooter as l, CardHeader as m, type CardProps as n, CardTitle as o, Checkbox as p, Collapsible as q, CollapsibleContent as r, CollapsibleTrigger as s, Command as t, CommandDialog as u, CommandEmpty as v, CommandGroup as w, CommandInput as x, CommandItem as y, CommandList as z };
|
|
@@ -1,8 +1,53 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ReactNode, ReactElement } from 'react';
|
|
4
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
5
|
+
import { SearchChunk } from '@arbidocs/sdk/browser';
|
|
4
6
|
import { ToasterProps } from 'sonner';
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A search's state outside any component: the query last searched, its passages, and whether it
|
|
10
|
+
* is running. A page that shows the shared session (`sharedSearchSession`) keeps its results when
|
|
11
|
+
* it is left and opened again, another surface can hand it a query to run on arrival
|
|
12
|
+
* ({@link requestSearch}), and {@link persistSearchSession} keeps the last query across reloads.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type SearchStatus = 'idle' | 'running' | 'done' | 'error';
|
|
16
|
+
interface SearchSessionState {
|
|
17
|
+
/** The workspace the query and results belong to. */
|
|
18
|
+
workspaceId: string | null;
|
|
19
|
+
/** The query last searched, or handed over to run. */
|
|
20
|
+
query: string;
|
|
21
|
+
/** The last search's passages, best first. */
|
|
22
|
+
results: SearchChunk[];
|
|
23
|
+
/** A search has finished with results to show (cleared by {@link clearSearchSession}). */
|
|
24
|
+
searched: boolean;
|
|
25
|
+
status: SearchStatus;
|
|
26
|
+
error: string | null;
|
|
27
|
+
/** A query handed over by {@link requestSearch}, run once by the page that shows the session. */
|
|
28
|
+
pending: string | null;
|
|
29
|
+
/** Counts searches, so the reply to an older one never overwrites a newer one. */
|
|
30
|
+
run: number;
|
|
31
|
+
}
|
|
32
|
+
type SearchSession = StoreApi<SearchSessionState>;
|
|
33
|
+
declare function createSearchSession(): SearchSession;
|
|
34
|
+
/** The session a host's search page shows. */
|
|
35
|
+
declare const sharedSearchSession: SearchSession;
|
|
36
|
+
/** Back to nothing searched (in `workspaceId` when given); a running search's reply is dropped. */
|
|
37
|
+
declare function clearSearchSession(workspaceId?: string | null, session?: SearchSession): void;
|
|
38
|
+
/**
|
|
39
|
+
* Hand a query to the search page, which runs it when it shows the session (the user already
|
|
40
|
+
* asked once; the page must not wait for a second Enter).
|
|
41
|
+
*/
|
|
42
|
+
declare function requestSearch(query: string, workspaceId: string | null, session?: SearchSession): void;
|
|
43
|
+
/** The handed-over query, once: the next call returns null. */
|
|
44
|
+
declare function takePendingSearch(session?: SearchSession): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Keep the last query (and its workspace) in `storage` under `key`, so the search box shows it
|
|
47
|
+
* after a reload. Results are not kept. Returns the unsubscribe.
|
|
48
|
+
*/
|
|
49
|
+
declare function persistSearchSession(key: string, storage?: Pick<Storage, 'getItem' | 'setItem'> | undefined, session?: SearchSession): () => void;
|
|
50
|
+
|
|
6
51
|
type NotifyVariant = 'success' | 'error' | 'info' | 'warning';
|
|
7
52
|
interface AppNotification {
|
|
8
53
|
id: string;
|
|
@@ -160,4 +205,4 @@ declare function NotificationBell({ renderTrigger, onNavigate, onSelectNotificat
|
|
|
160
205
|
|
|
161
206
|
declare function Toaster({ toastOptions, ...props }: ToasterProps): React.JSX.Element;
|
|
162
207
|
|
|
163
|
-
export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, Toaster as T, type NotificationBellProps as a, type NotificationBellTriggerState as b, type NotifyConfig as c, type NotifyOptions as d, type NotifyVariant as e,
|
|
208
|
+
export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, type SearchSession as S, Toaster as T, type NotificationBellProps as a, type NotificationBellTriggerState as b, type NotifyConfig as c, type NotifyOptions as d, type NotifyVariant as e, type SearchSessionState as f, type SearchStatus as g, clearSearchSession as h, configureNotify as i, createSearchSession as j, persistSearchSession as k, selectUnread as l, sharedSearchSession as m, notify as n, persistNotifyHistory as p, requestSearch as r, seedNotifications as s, takePendingSearch as t, useNotify as u };
|
|
@@ -1,8 +1,53 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ReactNode, ReactElement } from 'react';
|
|
4
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
5
|
+
import { SearchChunk } from '@arbidocs/sdk/browser';
|
|
4
6
|
import { ToasterProps } from 'sonner';
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A search's state outside any component: the query last searched, its passages, and whether it
|
|
10
|
+
* is running. A page that shows the shared session (`sharedSearchSession`) keeps its results when
|
|
11
|
+
* it is left and opened again, another surface can hand it a query to run on arrival
|
|
12
|
+
* ({@link requestSearch}), and {@link persistSearchSession} keeps the last query across reloads.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
type SearchStatus = 'idle' | 'running' | 'done' | 'error';
|
|
16
|
+
interface SearchSessionState {
|
|
17
|
+
/** The workspace the query and results belong to. */
|
|
18
|
+
workspaceId: string | null;
|
|
19
|
+
/** The query last searched, or handed over to run. */
|
|
20
|
+
query: string;
|
|
21
|
+
/** The last search's passages, best first. */
|
|
22
|
+
results: SearchChunk[];
|
|
23
|
+
/** A search has finished with results to show (cleared by {@link clearSearchSession}). */
|
|
24
|
+
searched: boolean;
|
|
25
|
+
status: SearchStatus;
|
|
26
|
+
error: string | null;
|
|
27
|
+
/** A query handed over by {@link requestSearch}, run once by the page that shows the session. */
|
|
28
|
+
pending: string | null;
|
|
29
|
+
/** Counts searches, so the reply to an older one never overwrites a newer one. */
|
|
30
|
+
run: number;
|
|
31
|
+
}
|
|
32
|
+
type SearchSession = StoreApi<SearchSessionState>;
|
|
33
|
+
declare function createSearchSession(): SearchSession;
|
|
34
|
+
/** The session a host's search page shows. */
|
|
35
|
+
declare const sharedSearchSession: SearchSession;
|
|
36
|
+
/** Back to nothing searched (in `workspaceId` when given); a running search's reply is dropped. */
|
|
37
|
+
declare function clearSearchSession(workspaceId?: string | null, session?: SearchSession): void;
|
|
38
|
+
/**
|
|
39
|
+
* Hand a query to the search page, which runs it when it shows the session (the user already
|
|
40
|
+
* asked once; the page must not wait for a second Enter).
|
|
41
|
+
*/
|
|
42
|
+
declare function requestSearch(query: string, workspaceId: string | null, session?: SearchSession): void;
|
|
43
|
+
/** The handed-over query, once: the next call returns null. */
|
|
44
|
+
declare function takePendingSearch(session?: SearchSession): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Keep the last query (and its workspace) in `storage` under `key`, so the search box shows it
|
|
47
|
+
* after a reload. Results are not kept. Returns the unsubscribe.
|
|
48
|
+
*/
|
|
49
|
+
declare function persistSearchSession(key: string, storage?: Pick<Storage, 'getItem' | 'setItem'> | undefined, session?: SearchSession): () => void;
|
|
50
|
+
|
|
6
51
|
type NotifyVariant = 'success' | 'error' | 'info' | 'warning';
|
|
7
52
|
interface AppNotification {
|
|
8
53
|
id: string;
|
|
@@ -160,4 +205,4 @@ declare function NotificationBell({ renderTrigger, onNavigate, onSelectNotificat
|
|
|
160
205
|
|
|
161
206
|
declare function Toaster({ toastOptions, ...props }: ToasterProps): React.JSX.Element;
|
|
162
207
|
|
|
163
|
-
export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, Toaster as T, type NotificationBellProps as a, type NotificationBellTriggerState as b, type NotifyConfig as c, type NotifyOptions as d, type NotifyVariant as e,
|
|
208
|
+
export { type AppNotification as A, DEFAULT_NOTIFY_TONE as D, MAX_SESSION_NOTIFICATIONS as M, NotificationBell as N, type SearchSession as S, Toaster as T, type NotificationBellProps as a, type NotificationBellTriggerState as b, type NotifyConfig as c, type NotifyOptions as d, type NotifyVariant as e, type SearchSessionState as f, type SearchStatus as g, clearSearchSession as h, configureNotify as i, createSearchSession as j, persistSearchSession as k, selectUnread as l, sharedSearchSession as m, notify as n, persistNotifyHistory as p, requestSearch as r, seedNotifications as s, takePendingSearch as t, useNotify as u };
|