@deepseek-ai/dsh-client-ui-primitives 0.0.1-rc.1
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/LICENSE +28 -0
- package/README.i18n.yaml +6 -0
- package/README.md +50 -0
- package/README.zh.md +50 -0
- package/lib/index.js +5680 -0
- package/lib/invariant.js +24 -0
- package/lib/types/BrandWordmark.d.ts +9 -0
- package/lib/types/Button.d.ts +18 -0
- package/lib/types/ConnectionBanner.d.ts +12 -0
- package/lib/types/DiffBlock.d.ts +34 -0
- package/lib/types/DisclosureRow.d.ts +29 -0
- package/lib/types/FishLogo.d.ts +9 -0
- package/lib/types/HoverCard.d.ts +24 -0
- package/lib/types/Input.d.ts +11 -0
- package/lib/types/JsonTree.d.ts +50 -0
- package/lib/types/Menu.d.ts +72 -0
- package/lib/types/Modal.d.ts +31 -0
- package/lib/types/OnboardingSurface.d.ts +11 -0
- package/lib/types/Pill.d.ts +13 -0
- package/lib/types/ReadBlock.d.ts +35 -0
- package/lib/types/RiskConfirmation.d.ts +19 -0
- package/lib/types/SearchBlock.d.ts +58 -0
- package/lib/types/StateDot.d.ts +15 -0
- package/lib/types/TerminalBlock.d.ts +67 -0
- package/lib/types/Tooltip.d.ts +30 -0
- package/lib/types/WebBlock.d.ts +48 -0
- package/lib/types/ansi.d.ts +17 -0
- package/lib/types/clipboard.d.ts +9 -0
- package/lib/types/head-tail-cap.d.ts +23 -0
- package/lib/types/icons/index.d.ts +150 -0
- package/lib/types/icons/props.d.ts +9 -0
- package/lib/types/index.d.ts +47 -0
- package/lib/types/invariant.d.ts +16 -0
- package/lib/types/markdown/CodeBlock.d.ts +14 -0
- package/lib/types/markdown/JsonBlock.d.ts +8 -0
- package/lib/types/markdown/MarkdownText.d.ts +38 -0
- package/lib/types/markdown/MessageText.d.ts +4 -0
- package/lib/types/markdown/cjkFriendlyStrong.d.ts +9 -0
- package/lib/types/markdown/highlight.d.ts +75 -0
- package/lib/types/markdown/incremental.d.ts +69 -0
- package/lib/types/markdown/katex.d.ts +27 -0
- package/lib/types/markdown/mathCompatibility.d.ts +11 -0
- package/lib/types/markdown/parse.d.ts +25 -0
- package/lib/types/markdown/plain-text.d.ts +22 -0
- package/lib/types/markdown/render.d.ts +112 -0
- package/lib/types/pointer-grace.d.ts +22 -0
- package/lib/types/use-copy-feedback.d.ts +14 -0
- package/lib/types/useAnchoredMaxHeight.d.ts +11 -0
- package/package.json +66 -0
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-primitives`.
|
|
4
|
+
* @module @deepseek-ai/dsh-client-ui-primitives/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@deepseek-ai/dsh-client-ui-primitives";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "client-ui-primitives-invariant";
|
|
9
|
+
/** Service required before the companion can reserve package ownership. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: pure props-in React atoms with zero cordis surface —
|
|
13
|
+
* no events, no services, no mutable cross-plugin state; rendering contracts
|
|
14
|
+
* are asserted directly by this package's component specs.
|
|
15
|
+
*/
|
|
16
|
+
const install = () => {};
|
|
17
|
+
/**
|
|
18
|
+
* Register this package's invariant companion.
|
|
19
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
20
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
21
|
+
*/
|
|
22
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
23
|
+
//#endregion
|
|
24
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IconProps } from './icons/props.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render the full brand wordmark.
|
|
4
|
+
* @param props.size - height in px (default 24; width keeps the 182:24 ratio).
|
|
5
|
+
* @param props.className - extra class for layout placement.
|
|
6
|
+
* @returns the wordmark svg (aria-hidden decorative brand art).
|
|
7
|
+
*/
|
|
8
|
+
export declare function BrandWordmark({ size, className }: IconProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=BrandWordmark.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/** Visual variant, each backed by its --dsw-alias-button-* token family. */
|
|
3
|
+
export type ButtonVariant = 'primary' | 'ghost' | 'outline' | 'toolbar';
|
|
4
|
+
/**
|
|
5
|
+
* Render a button.
|
|
6
|
+
* @param props.variant - visual family (default 'ghost').
|
|
7
|
+
* @param props.size - 'md' 36px capsule (figma Button) or 'sm' 28px compact.
|
|
8
|
+
* @param props.icon - optional leading 16px icon node.
|
|
9
|
+
* @returns the button element; native button attributes pass through.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Button({ variant, size, icon, className, children, ...rest }: {
|
|
12
|
+
variant?: ButtonVariant;
|
|
13
|
+
size?: 'md' | 'sm';
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
className?: string | undefined;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render the reconnecting banner.
|
|
3
|
+
* @param props.reconnecting - true while the connection is in backoff/retry.
|
|
4
|
+
* @param props.label - banner text; the owner passes localized copy (this
|
|
5
|
+
* package is cordis-free, so copy arrives via props).
|
|
6
|
+
* @returns the banner, or null when connected.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ConnectionBanner({ reconnecting, label }: {
|
|
9
|
+
reconnecting: boolean;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}): import("react").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=ConnectionBanner.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output lines shown before the height cap collapses the middle. Matches
|
|
3
|
+
* {@link DEFAULT_TERMINAL_MAX_LINES} so a diff card and a terminal card cut a
|
|
4
|
+
* long body at the same place.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_DIFF_MAX_LINES = 16;
|
|
7
|
+
/**
|
|
8
|
+
* One file's change, in the shape {@link DiffBlock} draws. Structurally the
|
|
9
|
+
* render-intent contract's `FileDiff`, redeclared here so this primitive stays
|
|
10
|
+
* free of the tool contract (the terminal card's decoupling, applied to diffs).
|
|
11
|
+
*/
|
|
12
|
+
export interface DiffHunk {
|
|
13
|
+
/** The changed file's path, drawn verbatim as the hunk's header (the tool's model-facing path). */
|
|
14
|
+
path: string;
|
|
15
|
+
/** Prior content, or `null` for a new file / an overwrite (nothing on the removed side). */
|
|
16
|
+
oldText: string | null;
|
|
17
|
+
/** Content after the change (the added side). */
|
|
18
|
+
newText: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DiffBlockProps {
|
|
21
|
+
/** One entry per applied hunk, in file order; empty renders nothing. */
|
|
22
|
+
diffs: DiffHunk[];
|
|
23
|
+
/** Height cap in body lines before the middle collapses (default {@link DEFAULT_DIFF_MAX_LINES}). */
|
|
24
|
+
maxLines?: number | undefined;
|
|
25
|
+
/** Extra class merged onto the wrapper (callers position; this component draws). */
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render a file mutation as an inline diff surface.
|
|
30
|
+
* @param props - see {@link DiffBlockProps}.
|
|
31
|
+
* @returns the diff block element.
|
|
32
|
+
*/
|
|
33
|
+
export declare function DiffBlock({ diffs, maxLines, className }: DiffBlockProps): import("react").JSX.Element | null;
|
|
34
|
+
//# sourceMappingURL=DiffBlock.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** Shared 24px disclosure chrome for compact flow rows. */
|
|
3
|
+
export interface DisclosureRowProps {
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
title: string;
|
|
6
|
+
open: boolean;
|
|
7
|
+
expandable: boolean;
|
|
8
|
+
onToggle: () => void;
|
|
9
|
+
/** Makes the complete title row the disclosure target. */
|
|
10
|
+
expandOnRowClick?: boolean | undefined;
|
|
11
|
+
/** Replaces the collapsed icon with a chevron while the row is hovered. */
|
|
12
|
+
previewChevron?: boolean | undefined;
|
|
13
|
+
/** Keeps `collapsedContent` inline while open. */
|
|
14
|
+
keepContentWhenOpen?: boolean | undefined;
|
|
15
|
+
collapsedContent?: ReactNode;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
rowClassName?: string | undefined;
|
|
19
|
+
leadingClassName?: string | undefined;
|
|
20
|
+
chevronClassName?: string | undefined;
|
|
21
|
+
titleClassName?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Render one disclosure header and its controlled expanded content.
|
|
25
|
+
* @param props - Visual content, controlled state, and interaction policy.
|
|
26
|
+
* @returns the disclosure row.
|
|
27
|
+
*/
|
|
28
|
+
export declare function DisclosureRow({ icon, title, open, expandable, onToggle, expandOnRowClick, previewChevron, keepContentWhenOpen, collapsedContent, children, className, rowClassName, leadingClassName, chevronClassName, titleClassName, }: DisclosureRowProps): import("react").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=DisclosureRow.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IconProps } from './icons/props.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Render the fish logo.
|
|
4
|
+
* @param props.size - width in px (default 24; height keeps the 23.16:17.04 ratio).
|
|
5
|
+
* @param props.className - extra class for layout placement.
|
|
6
|
+
* @returns the logo svg (aria-hidden; pair with the wordmark for accessibility).
|
|
7
|
+
*/
|
|
8
|
+
export declare function FishLogo({ size, className }: IconProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=FishLogo.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Render an anchor with a hover-triggered preview card.
|
|
4
|
+
* @param props.anchor - the hover target (rendered in place inside a wrapper span).
|
|
5
|
+
* @param props.content - card content; the pointer may rest on it, so it is
|
|
6
|
+
* readable and selectable, but it carries no dismissal affordance of its own.
|
|
7
|
+
* @param props.openDelayMs - hover dwell before the card shows (default 500).
|
|
8
|
+
* @param props.disabled - suppress opening; turning true closes an open card.
|
|
9
|
+
* @param props.copyText - optional primary value copied by activation and
|
|
10
|
+
* included in the card's accessible name.
|
|
11
|
+
* @param props.copyLabel - accessible activation-label prefix (default "复制").
|
|
12
|
+
* @param props.copiedLabel - visible success label (default "复制成功").
|
|
13
|
+
* @returns anchor wrapper with the conditional portaled card.
|
|
14
|
+
*/
|
|
15
|
+
export declare function HoverCard({ anchor, content, openDelayMs, disabled, copyText, copyLabel, copiedLabel, }: {
|
|
16
|
+
anchor: ReactNode;
|
|
17
|
+
content: ReactNode;
|
|
18
|
+
openDelayMs?: number;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
copyText?: string | undefined;
|
|
21
|
+
copyLabel?: string | undefined;
|
|
22
|
+
copiedLabel?: string | undefined;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=HoverCard.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Render a text input with an optional leading icon.
|
|
4
|
+
* @param props.icon - optional 16px leading icon node.
|
|
5
|
+
* @returns wrapper span containing the native input; input attributes pass through.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Input({ icon, className, ...rest }: {
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
} & InputHTMLAttributes<HTMLInputElement>): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display copy for the tree's copy affordance; the owner passes localized
|
|
3
|
+
* labels (this package is cordis-free, so copy arrives via props). Every
|
|
4
|
+
* field defaults to the current built-in value, so existing consumers render
|
|
5
|
+
* unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export interface JsonTreeLabels {
|
|
8
|
+
/** Menu item: copy the raw primitive value. */
|
|
9
|
+
copyValue: string;
|
|
10
|
+
/** Menu item: copy the value as compact JSON (primitive rows). */
|
|
11
|
+
copyJson: string;
|
|
12
|
+
/** Menu item: copy the property path. */
|
|
13
|
+
copyPath: string;
|
|
14
|
+
/** Menu item: copy the value as pretty-printed JSON. */
|
|
15
|
+
copyPrettyJson: string;
|
|
16
|
+
/** Menu item: copy the value as compact JSON (object rows). */
|
|
17
|
+
copyCompactJson: string;
|
|
18
|
+
/** Copy-button state label after a successful copy. */
|
|
19
|
+
copied: string;
|
|
20
|
+
/** Copy-button state label after a failed copy. */
|
|
21
|
+
copyFailed: string;
|
|
22
|
+
/** Expander aria label while expanded. */
|
|
23
|
+
collapseNode: string;
|
|
24
|
+
/** Expander aria label while collapsed. */
|
|
25
|
+
expandNode: string;
|
|
26
|
+
/** Copy-button tooltip, given the current action label. */
|
|
27
|
+
copyButtonTitle: (action: string) => string;
|
|
28
|
+
}
|
|
29
|
+
/** Props for the read-only, token-themed JSON tree. */
|
|
30
|
+
export interface JsonTreeProps {
|
|
31
|
+
/** Parsed JSON object or array. */
|
|
32
|
+
data: object | unknown[];
|
|
33
|
+
/** Accessible label for the tree. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Optional positioning class owned by the caller. */
|
|
36
|
+
className?: string | undefined;
|
|
37
|
+
/** Whether JSON rows expose copy actions. */
|
|
38
|
+
copyable?: boolean;
|
|
39
|
+
/** Whether the top-level object or array is always expanded. */
|
|
40
|
+
expandTopLevel?: boolean;
|
|
41
|
+
/** Localized display copy; omitted fields keep the built-in defaults. */
|
|
42
|
+
labels?: Partial<JsonTreeLabels> | undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Render parsed JSON as a compact, keyboard-accessible inspector tree.
|
|
46
|
+
* @param props - Parsed data, accessible label, and display options.
|
|
47
|
+
* @returns A read-only JSON tree with an optionally fixed-open top level.
|
|
48
|
+
*/
|
|
49
|
+
export declare function JsonTree({ data, label, className, copyable, expandTopLevel, labels, }: JsonTreeProps): import("react").JSX.Element;
|
|
50
|
+
//# sourceMappingURL=JsonTree.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** Selectable row (optionally with a nested submenu). */
|
|
3
|
+
export interface MenuItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/** Leading icon (figma .Menu_cell gap 8). */
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
/** Destructive row: error-colored text/icon and danger hover fill. */
|
|
10
|
+
danger?: boolean;
|
|
11
|
+
/** Nested card opened to the right on hover/focus. */
|
|
12
|
+
submenu?: readonly MenuItem[];
|
|
13
|
+
}
|
|
14
|
+
/** Hairline between item groups (not selectable). */
|
|
15
|
+
export interface MenuSeparator {
|
|
16
|
+
type: 'separator';
|
|
17
|
+
id: string;
|
|
18
|
+
}
|
|
19
|
+
/** Non-interactive heading row above a group of items. */
|
|
20
|
+
export interface MenuLabel {
|
|
21
|
+
type: 'label';
|
|
22
|
+
id: string;
|
|
23
|
+
text: string;
|
|
24
|
+
}
|
|
25
|
+
/** One primary-menu entry: a row, a separator, or a heading label. */
|
|
26
|
+
export type MenuEntry = MenuItem | MenuSeparator | MenuLabel;
|
|
27
|
+
/**
|
|
28
|
+
* Render an anchored dropdown menu.
|
|
29
|
+
* @param props.open - whether the list is showing (owner-controlled).
|
|
30
|
+
* @param props.anchor - the trigger element (rendered in place).
|
|
31
|
+
* @param props.items - selectable rows and optional separators.
|
|
32
|
+
* @param props.selectedId - row shown as selected.
|
|
33
|
+
* @param props.onSelect - row click callback (not called for disabled rows or submenu parents that only open children).
|
|
34
|
+
* @param props.onClose - invoked on outside click or Escape.
|
|
35
|
+
* @param props.align - list alignment against the anchor (default 'start').
|
|
36
|
+
* @param props.side - open below (`bottom`, default) or above (`top`) the anchor.
|
|
37
|
+
* @param props.portal - render the list into document.body, fixed-positioned
|
|
38
|
+
* from the anchor rect (repositions on scroll/resize while open). Use when an
|
|
39
|
+
* ancestor's overflow clipping would crop the in-place list; default false
|
|
40
|
+
* keeps the pure-CSS in-place behavior.
|
|
41
|
+
* @param props.closeOnPointerLeave - close the list once the pointer has left
|
|
42
|
+
* both trigger and list for the pointer grace (default false keeps it open
|
|
43
|
+
* until outside click/Escape/selection). The grace makes the 4px trigger->list
|
|
44
|
+
* gap and a brief overshoot survivable; coming back cancels the close.
|
|
45
|
+
* @param props.compact - use reduced menu typography and spacing.
|
|
46
|
+
* @param props.getAnchorRect - portal mode only: supply the anchor rect
|
|
47
|
+
* directly (e.g. from a host-owned trigger button) instead of measuring the
|
|
48
|
+
* Menu's own wrapper span. Required when the wrapper isn't itself laid out at
|
|
49
|
+
* the trigger (render-prop anchors, effect-positioned proxies — measuring the
|
|
50
|
+
* wrapper there races the host's layout effects). Called on open and on every
|
|
51
|
+
* scroll/resize; return null to skip placement for that frame.
|
|
52
|
+
* @param props.footer - rows pinned below the scrolling items area, separated
|
|
53
|
+
* by a hairline; they stay visible while the items above scroll.
|
|
54
|
+
* @returns anchor wrapper with the conditional list.
|
|
55
|
+
*/
|
|
56
|
+
export declare function Menu({ open, anchor, items, selectedId, onSelect, onClose, align, side, portal, closeOnPointerLeave, compact, getAnchorRect, footer, className }: {
|
|
57
|
+
open: boolean;
|
|
58
|
+
anchor: ReactNode;
|
|
59
|
+
items: readonly MenuEntry[];
|
|
60
|
+
footer?: readonly MenuEntry[];
|
|
61
|
+
selectedId?: string | undefined;
|
|
62
|
+
onSelect: (id: string) => void;
|
|
63
|
+
onClose: () => void;
|
|
64
|
+
align?: 'start' | 'end';
|
|
65
|
+
side?: 'bottom' | 'top' | 'right';
|
|
66
|
+
portal?: boolean;
|
|
67
|
+
closeOnPointerLeave?: boolean;
|
|
68
|
+
compact?: boolean;
|
|
69
|
+
getAnchorRect?: () => DOMRect | null;
|
|
70
|
+
className?: string;
|
|
71
|
+
}): import("react").JSX.Element;
|
|
72
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Render a centered modal over a blurred page mask.
|
|
4
|
+
* @param props.open - whether the dialog is showing.
|
|
5
|
+
* @param props.onClose - Escape or mask click.
|
|
6
|
+
* @param props.title - dialog heading (aria-label in every mode).
|
|
7
|
+
* @param props.closeLabel - accessible close-button label.
|
|
8
|
+
* @param props.description - optional supporting sentence under the title.
|
|
9
|
+
* @param props.children - body (inputs, etc.).
|
|
10
|
+
* @param props.footer - action row (Cancel / Create).
|
|
11
|
+
* @param props.contentClassName - optional class for a scrollable content region.
|
|
12
|
+
* @param props.headless - render children directly in the card (no default
|
|
13
|
+
* header/close/body chrome) for dialogs whose figma frame owns its own
|
|
14
|
+
* header structure; mask, card, Escape, and aria-label remain.
|
|
15
|
+
* @param props.closeLabel - close-button aria label; the owner passes
|
|
16
|
+
* localized copy (this package is cordis-free, so copy arrives via props).
|
|
17
|
+
* @returns null when closed; otherwise the overlay tree.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Modal({ open, onClose, title, closeLabel, description, children, footer, className, contentClassName, headless, }: {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
title: string;
|
|
23
|
+
closeLabel?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
footer?: ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
contentClassName?: string;
|
|
29
|
+
headless?: boolean;
|
|
30
|
+
}): import("react").ReactPortal | null;
|
|
31
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Render the onboarding takeover chrome (mask + opaque stage) around one
|
|
4
|
+
* step's content and keep the application root inert while mounted.
|
|
5
|
+
* @param props.children - the step's page content, centered on the stage.
|
|
6
|
+
* @returns the body-portaled overlay tree.
|
|
7
|
+
*/
|
|
8
|
+
export declare function OnboardingSurface({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): import("react").ReactPortal;
|
|
11
|
+
//# sourceMappingURL=OnboardingSurface.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Render a pill chip. Interactive when onClick is supplied (renders a button);
|
|
4
|
+
* otherwise a static span.
|
|
5
|
+
* @param props.active - selected/active visual state.
|
|
6
|
+
* @returns pill element.
|
|
7
|
+
*/
|
|
8
|
+
export declare function Pill({ active, className, children, onClick, ...rest }: {
|
|
9
|
+
active?: boolean;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=Pill.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content lines shown before the height cap collapses the middle. Matches
|
|
3
|
+
* TerminalBlock's default so a long read and a long command output cut at the
|
|
4
|
+
* same place in the same flow.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_READ_MAX_LINES = 16;
|
|
7
|
+
/** One line of the read window: its file line number and its text (no trailing newline). */
|
|
8
|
+
export interface ReadBlockLine {
|
|
9
|
+
/** 1-based line number in the file (a window past an offset keeps the file's own numbering). */
|
|
10
|
+
number: number;
|
|
11
|
+
/** The line's text, already truncated to the read tool's per-line cap. */
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ReadBlockProps {
|
|
15
|
+
/** Banner label (the file path, or a tool-supplied replacement title); omitted draws no label. */
|
|
16
|
+
label?: string | undefined;
|
|
17
|
+
/** The returned window's lines, in file order, each keeping its file line number. */
|
|
18
|
+
lines: readonly ReadBlockLine[];
|
|
19
|
+
/** Exact total line count in the file, for the "showing N of M" note when the read is a window. */
|
|
20
|
+
totalLines: number;
|
|
21
|
+
/** Grammar hint (a file-extension-derived language id); unknown or absent = plain monospace. */
|
|
22
|
+
lang?: string | undefined;
|
|
23
|
+
/** Height cap in content lines before the middle collapses (default {@link DEFAULT_READ_MAX_LINES}). */
|
|
24
|
+
maxLines?: number | undefined;
|
|
25
|
+
/** Extra class merged onto the wrapper (callers position; this component draws). */
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Render a read tool result as a line-numbered, optionally syntax-highlighted
|
|
30
|
+
* file view.
|
|
31
|
+
* @param props - see {@link ReadBlockProps}.
|
|
32
|
+
* @returns the read block element.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ReadBlock({ label, lines, totalLines, lang, maxLines, className, }: ReadBlockProps): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=ReadBlock.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface RiskConfirmationProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
acknowledgeLabel: string;
|
|
6
|
+
cancelLabel: string;
|
|
7
|
+
confirmLabel: string;
|
|
8
|
+
acknowledged: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
onAcknowledgedChange: (acknowledged: boolean) => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
onConfirm: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Render one in-page confirmation whose primary action is unavailable until
|
|
16
|
+
* the caller-controlled acknowledgement is checked.
|
|
17
|
+
*/
|
|
18
|
+
export declare function RiskConfirmation({ open, title, description, acknowledgeLabel, cancelLabel, confirmLabel, acknowledged, disabled, onAcknowledgedChange, onCancel, onConfirm, }: RiskConfirmationProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=RiskConfirmation.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result rows shown before the height cap collapses the middle. Matches
|
|
3
|
+
* {@link DEFAULT_TERMINAL_MAX_LINES} so a search card and a terminal card cut a
|
|
4
|
+
* long result at the same place.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_SEARCH_MAX_LINES = 16;
|
|
7
|
+
/** One matched line inside a {@link SearchFileGroup}: its 1-based line number and text. */
|
|
8
|
+
export interface SearchBlockLineMatch {
|
|
9
|
+
/** 1-based line number of the match within its file. */
|
|
10
|
+
lineNumber: number;
|
|
11
|
+
/** The matched line text, as the tool surfaced it. */
|
|
12
|
+
line: string;
|
|
13
|
+
}
|
|
14
|
+
/** One file's grouped matches, in first-seen file order. */
|
|
15
|
+
export interface SearchFileGroup {
|
|
16
|
+
/** The file the matches belong to (the display path). */
|
|
17
|
+
path: string;
|
|
18
|
+
/** The file's matched lines, in output order. */
|
|
19
|
+
matches: SearchBlockLineMatch[];
|
|
20
|
+
}
|
|
21
|
+
/** Fields both search shapes carry (the render site positions; this component draws). */
|
|
22
|
+
interface SearchBlockCommon {
|
|
23
|
+
/**
|
|
24
|
+
* Whether the tool capped the inline result: the shape carries only the
|
|
25
|
+
* retained results, not every result the search found. The banner summary
|
|
26
|
+
* folds the pre-cap `total` in (`显示 X / 共 N …`) so the card never presents a
|
|
27
|
+
* capped result as complete.
|
|
28
|
+
*/
|
|
29
|
+
truncated: boolean;
|
|
30
|
+
/** Total results the search found before capping (equals the retained count when not `truncated`). */
|
|
31
|
+
total: number;
|
|
32
|
+
/** Height cap in rows before the middle collapses (default {@link DEFAULT_SEARCH_MAX_LINES}). */
|
|
33
|
+
maxLines?: number | undefined;
|
|
34
|
+
/** Extra class merged onto the wrapper. */
|
|
35
|
+
className?: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** Props for the grouped-matches (`grep`) shape. */
|
|
38
|
+
export interface SearchMatchesBlockProps extends SearchBlockCommon {
|
|
39
|
+
kind: 'matches';
|
|
40
|
+
/** Matched lines grouped by file, in first-seen file order. */
|
|
41
|
+
files: SearchFileGroup[];
|
|
42
|
+
}
|
|
43
|
+
/** Props for the flat-path (`glob`) shape. */
|
|
44
|
+
export interface SearchPathsBlockProps extends SearchBlockCommon {
|
|
45
|
+
kind: 'paths';
|
|
46
|
+
/** The discovered paths, in the tool's result order (the retained page when `truncated`). */
|
|
47
|
+
paths: string[];
|
|
48
|
+
}
|
|
49
|
+
/** {@link SearchBlock} props: one card, two `kind`-discriminated shapes. */
|
|
50
|
+
export type SearchBlockProps = SearchMatchesBlockProps | SearchPathsBlockProps;
|
|
51
|
+
/**
|
|
52
|
+
* Render a completed search as a grouped-matches or flat-path card.
|
|
53
|
+
* @param props - see {@link SearchBlockProps}.
|
|
54
|
+
* @returns the search block element.
|
|
55
|
+
*/
|
|
56
|
+
export declare function SearchBlock(props: SearchBlockProps): import("react").JSX.Element;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=SearchBlock.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Four-color state semantic (green done / amber user-attention / blue running ring / red error). */
|
|
2
|
+
export type StateDotState = 'done' | 'warning' | 'ongoing' | 'error';
|
|
3
|
+
/**
|
|
4
|
+
* Render a state dot.
|
|
5
|
+
* @param props.state - which of the four states to show.
|
|
6
|
+
* @param props.size - outer diameter in px (default 10, the figma size).
|
|
7
|
+
* @param props.className - extra class for layout placement.
|
|
8
|
+
* @returns the dot element (aria-hidden; pair with text for accessibility).
|
|
9
|
+
*/
|
|
10
|
+
export declare function StateDot({ state, size, className }: {
|
|
11
|
+
state: StateDotState;
|
|
12
|
+
size?: number | undefined;
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=StateDot.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output lines shown before the height cap collapses the middle. Matches the
|
|
3
|
+
* TUI transcript's default tool-output budget so both front ends cut a long
|
|
4
|
+
* command's output at the same place.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_TERMINAL_MAX_LINES = 16;
|
|
7
|
+
/**
|
|
8
|
+
* Display copy for the terminal surface; the owner passes localized labels
|
|
9
|
+
* (this package is cordis-free, so copy arrives via props). Every field
|
|
10
|
+
* defaults to the current built-in value, so existing consumers render
|
|
11
|
+
* unchanged.
|
|
12
|
+
*/
|
|
13
|
+
export interface TerminalBlockLabels {
|
|
14
|
+
/** Status pill text for a signal-terminated command. */
|
|
15
|
+
signal: (signal: string) => string;
|
|
16
|
+
/** Status pill text for a non-zero exit code. */
|
|
17
|
+
exitCode: (exitCode: number) => string;
|
|
18
|
+
/** Run-state text while the command is still running. */
|
|
19
|
+
running: string;
|
|
20
|
+
/** Run-state text for a signal or non-zero-exit settle. */
|
|
21
|
+
failed: string;
|
|
22
|
+
/** Run-state text for a clean settle. */
|
|
23
|
+
done: string;
|
|
24
|
+
/** Copy-button idle label. */
|
|
25
|
+
copy: string;
|
|
26
|
+
/** Copy-button label during the post-copy confirmation window. */
|
|
27
|
+
copied: string;
|
|
28
|
+
/** Placeholder when a settled command produced no visible output. */
|
|
29
|
+
noOutput: string;
|
|
30
|
+
/** Collapse-toggle aria label while expanded. */
|
|
31
|
+
collapseAria: string;
|
|
32
|
+
/** Collapse-toggle text while expanded. */
|
|
33
|
+
collapse: string;
|
|
34
|
+
/** Expand-toggle aria label while capped, given the hidden line count. */
|
|
35
|
+
expandAria: (hidden: number) => string;
|
|
36
|
+
/** Expand-toggle text while capped, given the hidden line count. */
|
|
37
|
+
expand: (hidden: number) => string;
|
|
38
|
+
}
|
|
39
|
+
export interface TerminalBlockProps {
|
|
40
|
+
/** The command line, rendered verbatim after the prompt label. */
|
|
41
|
+
command: string;
|
|
42
|
+
/** Working directory for the prompt label; absent renders a plain `$`. */
|
|
43
|
+
cwd?: string | undefined;
|
|
44
|
+
/** Absolute home directory, so a cwd equal to it collapses to `~`; absent disables that collapse. */
|
|
45
|
+
home?: string | undefined;
|
|
46
|
+
/** The command's output text; may contain ANSI escape sequences. */
|
|
47
|
+
output?: string | undefined;
|
|
48
|
+
/** Settled exit code; a non-zero value renders the status pill. */
|
|
49
|
+
exitCode?: number | undefined;
|
|
50
|
+
/** Settled terminating signal name; any value renders the status pill, taking precedence over the exit code. */
|
|
51
|
+
signal?: string | undefined;
|
|
52
|
+
/** The command is still running: the block shows the prompt line alone. */
|
|
53
|
+
running?: boolean | undefined;
|
|
54
|
+
/** Height cap in output lines before the middle collapses (default {@link DEFAULT_TERMINAL_MAX_LINES}); Infinity disables the cap. */
|
|
55
|
+
maxLines?: number | undefined;
|
|
56
|
+
/** Extra class merged onto the wrapper (callers position; this component draws). */
|
|
57
|
+
className?: string | undefined;
|
|
58
|
+
/** Localized display copy; omitted fields keep the built-in defaults. */
|
|
59
|
+
labels?: Partial<TerminalBlockLabels> | undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Render a shell command as a terminal surface.
|
|
63
|
+
* @param props - see {@link TerminalBlockProps}.
|
|
64
|
+
* @returns the terminal block element.
|
|
65
|
+
*/
|
|
66
|
+
export declare function TerminalBlock({ command, cwd, home, output, exitCode, signal, running, maxLines, className, labels, }: TerminalBlockProps): import("react").JSX.Element;
|
|
67
|
+
//# sourceMappingURL=TerminalBlock.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FocusEventHandler, MouseEventHandler, ReactElement, Ref } from 'react';
|
|
2
|
+
/** Bubble placement relative to the anchor. */
|
|
3
|
+
export type TooltipSide = 'right' | 'bottom' | 'top';
|
|
4
|
+
/** Props Tooltip injects into its anchor child; the child's own handlers are chained ahead of the tooltip's. */
|
|
5
|
+
interface AnchorProps {
|
|
6
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
7
|
+
onMouseEnter?: MouseEventHandler | undefined;
|
|
8
|
+
onMouseLeave?: MouseEventHandler | undefined;
|
|
9
|
+
onFocus?: FocusEventHandler | undefined;
|
|
10
|
+
onBlur?: FocusEventHandler | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Attach a hover/focus tooltip to an anchor element.
|
|
14
|
+
* @param props.label - bubble text.
|
|
15
|
+
* @param props.side - placement relative to the anchor (default 'right').
|
|
16
|
+
* @param props.delayMs - hover delay in milliseconds; keyboard focus remains immediate.
|
|
17
|
+
* @param props.disabled - suppress the bubble while true; the anchor renders identically so
|
|
18
|
+
* toggling never remounts it (which would cut its CSS transitions).
|
|
19
|
+
* @param props.children - a single anchor element; its own ref (callback or object) is forwarded alongside the tooltip's.
|
|
20
|
+
* @returns the cloned anchor plus a fixed-position bubble while hovered/focused.
|
|
21
|
+
*/
|
|
22
|
+
export declare function Tooltip({ label, side, delayMs, disabled, children }: {
|
|
23
|
+
label: string;
|
|
24
|
+
side?: TooltipSide;
|
|
25
|
+
delayMs?: number;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
children: ReactElement<AnchorProps>;
|
|
28
|
+
}): import("react").JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One citeable source drawn in a search card: the projection of the contract's
|
|
3
|
+
* `WebSource`, with the optional fields kept optional so a provider that
|
|
4
|
+
* returned only a URL still renders (its hostname becomes the label).
|
|
5
|
+
*/
|
|
6
|
+
export interface WebSourceView {
|
|
7
|
+
/** The source URL; becomes a safe external link when it is http(s). */
|
|
8
|
+
url: string;
|
|
9
|
+
/** The source title; when absent the URL's hostname labels the link. */
|
|
10
|
+
title?: string | undefined;
|
|
11
|
+
/** A short excerpt or summary shown under the link. */
|
|
12
|
+
snippet?: string | undefined;
|
|
13
|
+
/** Publication/crawl timestamp, a provider-supplied string shown under the link. */
|
|
14
|
+
publishedAt?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** A `web_search` card: an optional answer over a capped citation list. */
|
|
17
|
+
export interface WebSearchBlockProps {
|
|
18
|
+
kind: 'search';
|
|
19
|
+
/** The provider-generated answer, rendered as markdown above the sources. */
|
|
20
|
+
answer?: string | undefined;
|
|
21
|
+
/** The cited sources, in provider order. */
|
|
22
|
+
sources: WebSourceView[];
|
|
23
|
+
/** True when the tool cut the source list to its result cap. */
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
/** Extra class merged onto the wrapper (callers position; this component draws). */
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
/** A `web_fetch` card: the retrieval summary for one fetched URL. */
|
|
29
|
+
export interface WebFetchBlockProps {
|
|
30
|
+
kind: 'fetch';
|
|
31
|
+
/** The final URL after allowed redirects; becomes a safe external link when http(s). */
|
|
32
|
+
url: string;
|
|
33
|
+
/** HTTP status code of the fetched response. */
|
|
34
|
+
statusCode: number;
|
|
35
|
+
/** True when the provider or the output cap cut the fetched content. */
|
|
36
|
+
truncated: boolean;
|
|
37
|
+
/** Extra class merged onto the wrapper (callers position; this component draws). */
|
|
38
|
+
className?: string | undefined;
|
|
39
|
+
}
|
|
40
|
+
/** A completed web retrieval card, discriminated by `kind`. */
|
|
41
|
+
export type WebBlockProps = WebSearchBlockProps | WebFetchBlockProps;
|
|
42
|
+
/**
|
|
43
|
+
* Render a completed web retrieval as a structured card.
|
|
44
|
+
* @param props - see {@link WebBlockProps}; `kind` selects the search or fetch body.
|
|
45
|
+
* @returns the web card element.
|
|
46
|
+
*/
|
|
47
|
+
export declare function WebBlock(props: WebBlockProps): import("react").JSX.Element;
|
|
48
|
+
//# sourceMappingURL=WebBlock.d.ts.map
|