research-agent-ui 0.1.355 → 0.1.357
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/ArticleExtractPanel-CPSLgtSv.js +418 -0
- package/dist/ArticleExtractPanel-o2Nlh5bC.cjs +2 -0
- package/dist/ChatConversationThread-htav026P.cjs +17 -0
- package/dist/{ChatConversationThread-B70yZMw_.js → ChatConversationThread-o6M_njHK.js} +367 -395
- package/dist/components/ArticleReader/ArticleContent.d.ts +2 -0
- package/dist/components/ArticleReader/ArticleOutline.d.ts +7 -0
- package/dist/components/ArticleReader/ArticleSidebarTabs.d.ts +15 -0
- package/dist/components/ArticleReader/LexicalArticleViewer.d.ts +3 -0
- package/dist/components/ArticleReader/articleOutline.d.ts +29 -0
- package/dist/components/ArticleReader/index.d.ts +3 -0
- package/dist/components/SlashMenu/SlashMenu.d.ts +30 -0
- package/dist/components/SlashMenu/index.d.ts +11 -0
- package/dist/components/SlashMenu/slashCommands.d.ts +20 -0
- package/dist/components/SlashMenu/slashFiles.d.ts +27 -0
- package/dist/components/SlashMenu/slashKeyboard.d.ts +44 -0
- package/dist/components/SlashMenu/slashMatch.d.ts +78 -0
- package/dist/components/SlashMenu/slashTrigger.d.ts +43 -0
- package/dist/components/SlashMenu/types.d.ts +25 -0
- package/dist/components/SlashMenu/useLibraryDocuments.d.ts +11 -0
- package/dist/components/SlashMenu/useSlashMenu.d.ts +44 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{src-Cgy6IAES.js → src-BUCWu20J.js} +2183 -1474
- package/dist/src-StXM79lG.cjs +34 -0
- package/dist/workspace.cjs +1 -1
- package/dist/workspace.mjs +87 -87
- package/package.json +14 -12
- package/dist/ArticleExtractPanel-B6tyR_bs.js +0 -389
- package/dist/ArticleExtractPanel-YlXZ8P18.cjs +0 -2
- package/dist/ChatConversationThread-BDzlHmvK.cjs +0 -17
- package/dist/src-D7eu9lB9.cjs +0 -34
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Article } from '../../types/research';
|
|
3
|
+
import type { ArticleOutlineItem } from './articleOutline';
|
|
3
4
|
interface ArticleContentProps {
|
|
4
5
|
article: Article;
|
|
5
6
|
isHighlightMode: boolean;
|
|
6
7
|
fontScale?: number;
|
|
8
|
+
onOutlineChange?: (items: ArticleOutlineItem[]) => void;
|
|
7
9
|
}
|
|
8
10
|
declare const ArticleContent: React.FC<ArticleContentProps>;
|
|
9
11
|
export default ArticleContent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ArticleSidebarTab = 'questions' | 'outline';
|
|
3
|
+
/** Ids that tie a tab to its panel (`aria-controls` / `aria-labelledby`). */
|
|
4
|
+
export declare function articleTabIds(idBase: string, tab: ArticleSidebarTab): {
|
|
5
|
+
tab: string;
|
|
6
|
+
panel: string;
|
|
7
|
+
};
|
|
8
|
+
interface ArticleSidebarTabsProps {
|
|
9
|
+
value: ArticleSidebarTab;
|
|
10
|
+
onValueChange: (tab: ArticleSidebarTab) => void;
|
|
11
|
+
/** Unique per panel instance; feeds {@link articleTabIds}. */
|
|
12
|
+
idBase: string;
|
|
13
|
+
}
|
|
14
|
+
declare const ArticleSidebarTabs: React.FC<ArticleSidebarTabsProps>;
|
|
15
|
+
export default ArticleSidebarTabs;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type ArticleOutlineItem } from './articleOutline';
|
|
2
3
|
interface LexicalArticleViewerProps {
|
|
3
4
|
html: string;
|
|
4
5
|
isHighlightMode?: boolean;
|
|
5
6
|
/** Reading zoom multiplier applied to the article font size (1 = 100%). */
|
|
6
7
|
fontScale?: number;
|
|
8
|
+
/** Called with the article's H1–H3 headings each time the rendered HTML changes. */
|
|
9
|
+
onOutlineChange?: (items: ArticleOutlineItem[]) => void;
|
|
7
10
|
}
|
|
8
11
|
/**
|
|
9
12
|
* Renders extracted article HTML as sanitized, styled prose.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Reads the outline (H1–H3 headings) out of an article's HTML and
|
|
3
|
+
* gives every heading an `id`, so the outline can link to it and a scroll-spy
|
|
4
|
+
* can find it. Shape-compatible with Fumadocs' `TOCItemType`, which is what
|
|
5
|
+
* the outline renders.
|
|
6
|
+
*/
|
|
7
|
+
/** One heading in the outline. Same shape as Fumadocs' `TOCItemType`. */
|
|
8
|
+
export interface ArticleOutlineItem {
|
|
9
|
+
title: string;
|
|
10
|
+
/** `#id` of the heading element. */
|
|
11
|
+
url: string;
|
|
12
|
+
/** 1 for H1, 2 for H2, 3 for H3. */
|
|
13
|
+
depth: number;
|
|
14
|
+
}
|
|
15
|
+
/** Heading levels the outline lists. */
|
|
16
|
+
export declare const OUTLINE_HEADING_SELECTOR = "h1, h2, h3";
|
|
17
|
+
/**
|
|
18
|
+
* Finds every H1, H2 and H3 with text in `html`, in document order.
|
|
19
|
+
*
|
|
20
|
+
* A heading keeps its own `id` when it has a plain one that no earlier heading
|
|
21
|
+
* uses (footnote and in-page links may point at it); otherwise it gets
|
|
22
|
+
* `outline-<n>-<slug>`. The returned `html` is `html` with those ids applied —
|
|
23
|
+
* render that, so the outline's links resolve. Without headings, or outside a
|
|
24
|
+
* browser (no `DOMParser`), `html` comes back untouched with no items.
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractOutline(html: string): {
|
|
27
|
+
html: string;
|
|
28
|
+
items: ArticleOutlineItem[];
|
|
29
|
+
};
|
|
@@ -8,6 +8,9 @@ export { default as ArticlePromptInput } from "./ArticlePromptInput";
|
|
|
8
8
|
export { default as ArticleFollowupQuestions } from "./ArticleFollowupQuestions";
|
|
9
9
|
export { default as ArticleAIResponse } from "./ArticleAIResponse";
|
|
10
10
|
export { default as ArticleContent } from "./ArticleContent";
|
|
11
|
+
export { default as ArticleOutline } from "./ArticleOutline";
|
|
12
|
+
export { default as ArticleSidebarTabs, articleTabIds, type ArticleSidebarTab, } from "./ArticleSidebarTabs";
|
|
13
|
+
export { extractOutline, type ArticleOutlineItem } from "./articleOutline";
|
|
11
14
|
export { default as LexicalArticleViewer } from "./LexicalArticleViewer";
|
|
12
15
|
export { UnifiedMarkdown, type UnifiedMarkdownProps } from "./unified-markdown";
|
|
13
16
|
export * from "../../types/research";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The slash menu popup: a listbox of commands and files anchored
|
|
3
|
+
* just above the chat input.
|
|
4
|
+
*
|
|
5
|
+
* Built on the shared Radix popover so it escapes clipping and flips when
|
|
6
|
+
* there is no room above. Focus never leaves the textarea — the combobox
|
|
7
|
+
* attributes on the textarea (see {@link slashComboboxProps}) point at this
|
|
8
|
+
* listbox through `aria-activedescendant`.
|
|
9
|
+
*/
|
|
10
|
+
import { type RefObject } from 'react';
|
|
11
|
+
import type { SlashMenuState } from './useSlashMenu';
|
|
12
|
+
/** Attributes to spread on the textarea so assistive tech sees the combobox. */
|
|
13
|
+
export declare function slashComboboxProps(menu: Pick<SlashMenuState, 'open' | 'listboxId' | 'activeOptionId'>): {
|
|
14
|
+
role: 'combobox';
|
|
15
|
+
'aria-haspopup': 'listbox';
|
|
16
|
+
'aria-autocomplete': 'list';
|
|
17
|
+
'aria-expanded': boolean;
|
|
18
|
+
'aria-controls': string;
|
|
19
|
+
'aria-activedescendant': string;
|
|
20
|
+
};
|
|
21
|
+
interface SlashMenuProps {
|
|
22
|
+
menu: SlashMenuState;
|
|
23
|
+
/** Element the popup attaches to and matches the width of (the input card). */
|
|
24
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
25
|
+
/** Library documents are still being fetched. */
|
|
26
|
+
loadingFiles?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function SlashMenu({ menu, anchorRef, loadingFiles, className }: SlashMenuProps): import("react").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { SlashMenu, slashComboboxProps } from './SlashMenu';
|
|
2
|
+
export { useSlashMenu, useCaret } from './useSlashMenu';
|
|
3
|
+
export type { SlashMenuState, UseSlashMenuOptions } from './useSlashMenu';
|
|
4
|
+
export { buildSlashCommands } from './slashCommands';
|
|
5
|
+
export type { SlashCommandContext } from './slashCommands';
|
|
6
|
+
export { buildSlashFileItems, libraryDocumentToFile } from './slashFiles';
|
|
7
|
+
export type { LibraryDocument } from './slashFiles';
|
|
8
|
+
export { detectSlashTrigger, replaceSlashToken } from './slashTrigger';
|
|
9
|
+
export { fuzzyMatch, rankSlashItems, highlightSegments } from './slashMatch';
|
|
10
|
+
export { slashKeyAction } from './slashKeyboard';
|
|
11
|
+
export type { SlashItem, SlashItemKind } from './types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SlashItem } from './types';
|
|
2
|
+
/** What the composer lets slash commands do. */
|
|
3
|
+
export interface SlashCommandContext {
|
|
4
|
+
newChat: () => void;
|
|
5
|
+
/** Empty the input box and drop pending attachments. */
|
|
6
|
+
clearComposer: () => void;
|
|
7
|
+
openSettings: () => void;
|
|
8
|
+
openFilePicker: () => void;
|
|
9
|
+
incognito: boolean;
|
|
10
|
+
setIncognito: (value: boolean) => void;
|
|
11
|
+
focusMode: string;
|
|
12
|
+
setFocusMode: (key: string) => void;
|
|
13
|
+
/** Prompt inserted by `/summarize`. */
|
|
14
|
+
summarizePrompt: string;
|
|
15
|
+
/** Omit when the browser has no speech input; `/voice` is then hidden. */
|
|
16
|
+
toggleVoice?: () => void;
|
|
17
|
+
isListening?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Builds the command rows, in the order they show for an empty query. */
|
|
20
|
+
export declare function buildSlashCommands(ctx: SlashCommandContext): SlashItem[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ChatFile } from '../../types/chat';
|
|
2
|
+
import type { SlashItem } from './types';
|
|
3
|
+
/** The slice of an API document the menu reads. */
|
|
4
|
+
export interface LibraryDocument {
|
|
5
|
+
id?: number;
|
|
6
|
+
title?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
content?: string;
|
|
9
|
+
isFolder?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** One-line plain-text preview of a document body. */
|
|
12
|
+
export declare function previewContent(content: string | undefined): string;
|
|
13
|
+
/** Display name of a library document. */
|
|
14
|
+
export declare function documentName(doc: LibraryDocument): string;
|
|
15
|
+
/**
|
|
16
|
+
* Wraps a library document in a `File` the composer's upload path accepts
|
|
17
|
+
* (`.html` for markup, `.md` otherwise — both are server-extracted types).
|
|
18
|
+
*/
|
|
19
|
+
export declare function libraryDocumentToFile(doc: LibraryDocument): File;
|
|
20
|
+
export interface SlashFileSources {
|
|
21
|
+
documents: readonly LibraryDocument[];
|
|
22
|
+
attachedFiles: readonly ChatFile[];
|
|
23
|
+
/** Attach a library document as a composer attachment. */
|
|
24
|
+
attachDocument: (doc: LibraryDocument) => void;
|
|
25
|
+
}
|
|
26
|
+
/** Builds the file rows: files in this chat first, then the library. */
|
|
27
|
+
export declare function buildSlashFileItems(sources: SlashFileSources): SlashItem[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Keyboard handling for the slash menu, as a pure function.
|
|
3
|
+
*/
|
|
4
|
+
/** What the menu should do in response to a key press. */
|
|
5
|
+
export type SlashKeyAction = {
|
|
6
|
+
type: 'none';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'move';
|
|
9
|
+
index: number;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'select';
|
|
12
|
+
index: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: 'close';
|
|
15
|
+
};
|
|
16
|
+
export interface SlashKeyInput {
|
|
17
|
+
key: string;
|
|
18
|
+
shiftKey?: boolean;
|
|
19
|
+
ctrlKey?: boolean;
|
|
20
|
+
metaKey?: boolean;
|
|
21
|
+
altKey?: boolean;
|
|
22
|
+
/** True while an IME composition is in progress. */
|
|
23
|
+
isComposing?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Index after moving `delta` rows, wrapping at both ends. */
|
|
26
|
+
export declare function moveIndex(current: number, delta: number, count: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Maps a key press to a menu action.
|
|
29
|
+
*
|
|
30
|
+
* Returning `none` means the key belongs to the textarea: the caller must not
|
|
31
|
+
* `preventDefault`. Everything else is consumed, which is what stops Enter
|
|
32
|
+
* from submitting the chat message when it picks a menu row.
|
|
33
|
+
*
|
|
34
|
+
* - ArrowUp / ArrowDown move the selection, wrapping.
|
|
35
|
+
* - Enter or Tab select the highlighted row (not while Shift/Ctrl/Meta/Alt is
|
|
36
|
+
* held, so Shift+Enter still inserts a newline).
|
|
37
|
+
* - Escape closes.
|
|
38
|
+
* - Any key during IME composition is ignored.
|
|
39
|
+
* - With no rows, Enter and Tab pass through so they behave normally.
|
|
40
|
+
*/
|
|
41
|
+
export declare function slashKeyAction(input: SlashKeyInput, state: {
|
|
42
|
+
activeIndex: number;
|
|
43
|
+
count: number;
|
|
44
|
+
}): SlashKeyAction;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Fuzzy matching, ranking and highlighting for the slash menu.
|
|
3
|
+
*
|
|
4
|
+
* Subsequence matching ("gg" finds "debuGGing"), scored so contiguous runs,
|
|
5
|
+
* word starts and early matches rank first. Names outrank descriptions.
|
|
6
|
+
*/
|
|
7
|
+
export interface FuzzyResult {
|
|
8
|
+
/** Higher is better. */
|
|
9
|
+
score: number;
|
|
10
|
+
/** Indices in the text of the matched characters, ascending. */
|
|
11
|
+
indices: number[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Matches `query` as a case-insensitive subsequence of `text`.
|
|
15
|
+
*
|
|
16
|
+
* A forward pass finds the earliest end of a match and a backward pass
|
|
17
|
+
* tightens its start, so the highlighted letters hug each other instead of
|
|
18
|
+
* being scattered across the whole string.
|
|
19
|
+
*
|
|
20
|
+
* @param maxSpan - Reject matches whose first and last matched letters are
|
|
21
|
+
* further apart than this, which keeps long prose from matching on letters
|
|
22
|
+
* scattered across the whole sentence.
|
|
23
|
+
* @returns Score and matched indices, or `null` when the letters are not all
|
|
24
|
+
* present in order. An empty query matches everything with score 0.
|
|
25
|
+
*/
|
|
26
|
+
export declare function fuzzyMatch(query: string, text: string, maxSpan?: number): FuzzyResult | null;
|
|
27
|
+
/** Anything the menu can rank: a name plus optional secondary text. */
|
|
28
|
+
export interface SlashMatchable {
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Extra searchable text that is never shown (aliases, extensions). */
|
|
32
|
+
keywords?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SlashRanked<T extends SlashMatchable> {
|
|
35
|
+
item: T;
|
|
36
|
+
score: number;
|
|
37
|
+
/** Matched character positions in `item.name`. */
|
|
38
|
+
nameIndices: number[];
|
|
39
|
+
/** Matched character positions in `item.description`. */
|
|
40
|
+
descriptionIndices: number[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Filters and ranks `items` against `query`, best match first.
|
|
44
|
+
*
|
|
45
|
+
* An empty query returns everything in the given order. Ties keep the
|
|
46
|
+
* registry order (the sort is stable), so commands stay ahead of files that
|
|
47
|
+
* score the same.
|
|
48
|
+
*/
|
|
49
|
+
export declare function rankSlashItems<T extends SlashMatchable>(items: readonly T[], query: string): SlashRanked<T>[];
|
|
50
|
+
/** A run of text and whether it is a matched (highlighted) run. */
|
|
51
|
+
export interface HighlightSegment {
|
|
52
|
+
text: string;
|
|
53
|
+
match: boolean;
|
|
54
|
+
}
|
|
55
|
+
/** Splits `text` into alternating plain/matched runs for rendering. */
|
|
56
|
+
export declare function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[];
|
|
57
|
+
/**
|
|
58
|
+
* Trims a long description so its first match is visible in a one-line row,
|
|
59
|
+
* prefixing an ellipsis. Indices are shifted to stay aligned with the result.
|
|
60
|
+
*/
|
|
61
|
+
export declare function windowDescription(text: string, indices: readonly number[], lead?: number): {
|
|
62
|
+
text: string;
|
|
63
|
+
indices: number[];
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Splits ranked rows into one section per kind, so the menu can show group
|
|
67
|
+
* headings while keyboard order still matches what is on screen.
|
|
68
|
+
*
|
|
69
|
+
* Within a section rows keep their rank. Sections are ordered by their best
|
|
70
|
+
* row, so a query that mostly hits files lifts the Files section above
|
|
71
|
+
* Commands. Ties (and the empty query) put `order[0]` first.
|
|
72
|
+
*/
|
|
73
|
+
export declare function groupRanked<T extends SlashMatchable & {
|
|
74
|
+
kind: string;
|
|
75
|
+
}>(ranked: readonly SlashRanked<T>[], order: readonly string[]): {
|
|
76
|
+
kind: string;
|
|
77
|
+
rows: SlashRanked<T>[];
|
|
78
|
+
}[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Slash-menu trigger detection and text replacement.
|
|
3
|
+
*
|
|
4
|
+
* Pure string logic, kept apart from the React hook so the rules for "is the
|
|
5
|
+
* caret inside a slash token" are testable without a DOM.
|
|
6
|
+
*/
|
|
7
|
+
/** The slash token the caret currently sits in. */
|
|
8
|
+
export interface SlashTrigger {
|
|
9
|
+
/** Index of the `/` character. */
|
|
10
|
+
start: number;
|
|
11
|
+
/** Index just past the last character of the token (the caret). */
|
|
12
|
+
end: number;
|
|
13
|
+
/** Text typed after the slash, up to the caret. */
|
|
14
|
+
query: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Finds the slash token that ends at `caret`.
|
|
18
|
+
*
|
|
19
|
+
* A token opens on a `/` at the very start of the input or right after
|
|
20
|
+
* whitespace, and runs to the caret with no whitespace in between. That keeps
|
|
21
|
+
* it from firing inside URLs (`https://x`), relative paths (`a/b`) or
|
|
22
|
+
* fractions (`1/2`). A second `/` inside the token closes it again, so a
|
|
23
|
+
* pasted absolute path (`/usr/local/bin`) stops being treated as a command
|
|
24
|
+
* after its first segment.
|
|
25
|
+
*
|
|
26
|
+
* @param value - Full textarea value.
|
|
27
|
+
* @param caret - Caret offset (`selectionStart`) within `value`.
|
|
28
|
+
* @returns The active token, or `null` when the caret is not inside one.
|
|
29
|
+
*/
|
|
30
|
+
export declare function detectSlashTrigger(value: string, caret: number): SlashTrigger | null;
|
|
31
|
+
/**
|
|
32
|
+
* Replaces a slash token with `replacement`.
|
|
33
|
+
*
|
|
34
|
+
* The caret lands after the inserted text. When the replacement is empty the
|
|
35
|
+
* token is removed along with one adjoining space, so `"fix /new later"`
|
|
36
|
+
* becomes `"fix later"` rather than `"fix later"`.
|
|
37
|
+
*
|
|
38
|
+
* @returns The new value and where the caret should go.
|
|
39
|
+
*/
|
|
40
|
+
export declare function replaceSlashToken(value: string, trigger: SlashTrigger, replacement: string): {
|
|
41
|
+
value: string;
|
|
42
|
+
caret: number;
|
|
43
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared types for the slash menu.
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import type { SlashMatchable } from './slashMatch';
|
|
6
|
+
/** Which group a row belongs to. */
|
|
7
|
+
export type SlashItemKind = 'command' | 'file';
|
|
8
|
+
/**
|
|
9
|
+
* One selectable row.
|
|
10
|
+
*
|
|
11
|
+
* Choosing a row first replaces the typed `/query` token with `insertText`
|
|
12
|
+
* (an empty or missing value just removes the token), then calls `run`.
|
|
13
|
+
* Template commands and file mentions use `insertText`; commands that act
|
|
14
|
+
* immediately and attachments use `run`.
|
|
15
|
+
*/
|
|
16
|
+
export interface SlashItem extends SlashMatchable {
|
|
17
|
+
/** Stable and unique across kinds; used as the DOM id suffix. */
|
|
18
|
+
id: string;
|
|
19
|
+
kind: SlashItemKind;
|
|
20
|
+
icon: ReactNode;
|
|
21
|
+
/** Muted trailing text: the `/command` spelling, or a file extension. */
|
|
22
|
+
hint?: string;
|
|
23
|
+
insertText?: string;
|
|
24
|
+
run?: () => void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LibraryDocument } from './slashFiles';
|
|
2
|
+
/**
|
|
3
|
+
* Fetches the user's documents the first time `active` becomes true, and
|
|
4
|
+
* again on a later open once the cached list is older than a minute. Failures
|
|
5
|
+
* (signed out, offline, no backend) leave the list empty rather than
|
|
6
|
+
* surfacing an error: the menu just shows commands and attached files.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useLibraryDocuments(active: boolean): {
|
|
9
|
+
documents: LibraryDocument[];
|
|
10
|
+
loading: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
|
|
2
|
+
import { type SlashRanked } from './slashMatch';
|
|
3
|
+
import { type SlashTrigger } from './slashTrigger';
|
|
4
|
+
import type { SlashItem } from './types';
|
|
5
|
+
export interface UseSlashMenuOptions {
|
|
6
|
+
/** Controlled textarea value. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Caret offset, kept current by the caller (`selectionStart`). */
|
|
9
|
+
caret: number;
|
|
10
|
+
/** Rows to search, in registry order. */
|
|
11
|
+
items: readonly SlashItem[];
|
|
12
|
+
/** Applies the new text and caret after a row is chosen. */
|
|
13
|
+
onApply: (value: string, caret: number) => void;
|
|
14
|
+
/** Disable entirely (e.g. while a request is streaming). */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SlashMenuState {
|
|
18
|
+
open: boolean;
|
|
19
|
+
trigger: SlashTrigger | null;
|
|
20
|
+
/** Rows in display order (what the keyboard indexes into). */
|
|
21
|
+
results: SlashRanked<SlashItem>[];
|
|
22
|
+
/** The same rows, split into one section per kind. */
|
|
23
|
+
groups: {
|
|
24
|
+
kind: string;
|
|
25
|
+
rows: SlashRanked<SlashItem>[];
|
|
26
|
+
}[];
|
|
27
|
+
activeIndex: number;
|
|
28
|
+
setActiveIndex: (index: number) => void;
|
|
29
|
+
select: (index: number) => void;
|
|
30
|
+
close: () => void;
|
|
31
|
+
/** Returns true when the event was consumed (the caller should stop). */
|
|
32
|
+
handleKeyDown: (e: ReactKeyboardEvent) => boolean;
|
|
33
|
+
/** DOM id prefix for the listbox; options are `${listboxId}-option-${n}`. */
|
|
34
|
+
listboxId: string;
|
|
35
|
+
optionId: (index: number) => string;
|
|
36
|
+
activeOptionId: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
export declare function useSlashMenu({ value, caret, items, onApply, disabled, }: UseSlashMenuOptions): SlashMenuState;
|
|
39
|
+
/** Tracks the textarea caret across typing, clicks and arrow-key moves. */
|
|
40
|
+
export declare function useCaret(ref: React.RefObject<HTMLTextAreaElement | null>): {
|
|
41
|
+
caret: number;
|
|
42
|
+
sync: () => void;
|
|
43
|
+
place: (pos: number) => void;
|
|
44
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs"),t=require("./src-
|
|
1
|
+
"use client";"use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./config.cjs"),t=require("./src-StXM79lG.cjs"),n=require("./tooltip-DmUO6ZUz.cjs"),r=require("./dialog-7GDz0sWx.cjs");exports.ARTICLE_TOOLBAR_SHORTCUTS=t.j,exports.ArticleAIResponse=t.O,exports.ArticleActionButtons=t.M,exports.ArticleContent=t.T,exports.ArticleFollowupQuestions=t.k,exports.ArticleOutline=t.w,exports.ArticlePanelHeader=t.P,exports.ArticlePromptInput=t.A,exports.ArticleReaderMount=t.H,exports.ArticleSidebarTabs=t.S,exports.CategoryDock=t.c,exports.ChatInputBox=t.q,exports.ChatProvider=t.ot,exports.ChatWindow=t.V,exports.CookieConsent=t.s,exports.ExtractPanelProvider=n.i,exports.HistoryDialogs=t.W,exports.HistoryDropdown=t.U,exports.KokoroVoiceSelector=t.u,exports.LexicalArticleViewer=t.E,exports.MainViewProvider=t.y,exports.QWKSEARCH_DEFAULT_ORIGIN=t.F,exports.QwkSearchApp=t.n,exports.QwkSearchProviders=t.r,exports.SPOTLIGHT_LINKS=t.v,exports.SPOTLIGHT_PREFIXES=t.h,exports.SessionProvider=n.s,exports.SpotlightPalette=t.p,exports.UnifiedMarkdown=t.x,exports.VoiceSettingsPanel=t.l,exports.articleTabIds=t.C,exports.buildConnectStartUrl=t.I,exports.cn=r.o,exports.configureResearchAgentUI=e.configureResearchAgentUI,exports.createQwkSearchConnectAuthClient=t.L,exports.extractOutline=t.D,exports.formatMessageTime=r.s,exports.formatTimeDifference=r.c,exports.formatToolbarShortcut=t.N,exports.getQwkSearchApiKey=t.R,exports.isChunkLoadError=t.i,exports.isQwkSearchApiRequest=t.z,exports.matchSpotlight=t.g,exports.openSpotlight=t.m,exports.parsePrefix=t._,exports.reloadForChunkError=t.a,exports.researchAgentUIConfig=e.researchAgentUIConfig,exports.setQwkSearchApiKey=t.B,exports.useChat=n.u,exports.useChatState=t.st,exports.useChatTabs=t.t,exports.useChunkErrorReload=t.o,exports.useExtractPanel=n.a,exports.useHistoryState=t.K,exports.useKokoroTTS=t.f,exports.useMainView=t.b,exports.useOptionalExtractPanel=n.o,exports.useSession=n.c,exports.useTextToSpeech=t.d;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { configureResearchAgentUI as e, researchAgentUIConfig as t } from "./config.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
import { c as
|
|
7
|
-
export {
|
|
4
|
+
import { A as n, B as r, C as i, D as a, E as o, F as s, H as c, I as l, K as u, L as d, M as f, N as p, O as m, P as h, R as g, S as _, T as v, U as y, V as b, W as x, _ as S, a as C, b as w, c as T, d as E, f as D, g as O, h as k, i as A, j, k as M, l as N, m as P, n as F, o as I, ot as L, p as R, q as z, r as B, s as V, st as H, t as U, u as W, v as G, w as K, x as q, y as J, z as Y } from "./src-BUCWu20J.js";
|
|
5
|
+
import { a as X, c as Z, i as Q, o as $, s as ee, u as te } from "./tooltip-Bl3IdX-I.js";
|
|
6
|
+
import { c as ne, o as re, s as ie } from "./dialog-Cufn2u50.js";
|
|
7
|
+
export { j as ARTICLE_TOOLBAR_SHORTCUTS, m as ArticleAIResponse, f as ArticleActionButtons, v as ArticleContent, M as ArticleFollowupQuestions, K as ArticleOutline, h as ArticlePanelHeader, n as ArticlePromptInput, c as ArticleReaderMount, _ as ArticleSidebarTabs, T as CategoryDock, z as ChatInputBox, L as ChatProvider, b as ChatWindow, V as CookieConsent, Q as ExtractPanelProvider, x as HistoryDialogs, y as HistoryDropdown, W as KokoroVoiceSelector, o as LexicalArticleViewer, J as MainViewProvider, s as QWKSEARCH_DEFAULT_ORIGIN, F as QwkSearchApp, B as QwkSearchProviders, G as SPOTLIGHT_LINKS, k as SPOTLIGHT_PREFIXES, ee as SessionProvider, R as SpotlightPalette, q as UnifiedMarkdown, N as VoiceSettingsPanel, i as articleTabIds, l as buildConnectStartUrl, re as cn, e as configureResearchAgentUI, d as createQwkSearchConnectAuthClient, a as extractOutline, ie as formatMessageTime, ne as formatTimeDifference, p as formatToolbarShortcut, g as getQwkSearchApiKey, A as isChunkLoadError, Y as isQwkSearchApiRequest, O as matchSpotlight, P as openSpotlight, S as parsePrefix, C as reloadForChunkError, t as researchAgentUIConfig, r as setQwkSearchApiKey, te as useChat, H as useChatState, U as useChatTabs, I as useChunkErrorReload, X as useExtractPanel, u as useHistoryState, D as useKokoroTTS, w as useMainView, $ as useOptionalExtractPanel, Z as useSession, E as useTextToSpeech };
|