@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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
/** One run of terminal text; `style` is undefined for text that carries no SGR state. */
|
|
3
|
+
export interface AnsiSpan {
|
|
4
|
+
/** The run's plain text, free of escape sequences and newlines. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Resolved inline style, or undefined when the run needs no wrapper. */
|
|
7
|
+
style: CSSProperties | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** The spans of one output line, in order. */
|
|
10
|
+
export type AnsiLine = readonly AnsiSpan[];
|
|
11
|
+
/**
|
|
12
|
+
* Parse command output into styled spans grouped by line.
|
|
13
|
+
* @param text - raw output text, which may contain ANSI escape sequences.
|
|
14
|
+
* @returns one entry per output line (always at least one, possibly empty).
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseAnsiLines(text: string): AnsiLine[];
|
|
17
|
+
//# sourceMappingURL=ansi.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write text to the host clipboard, preferring the async Clipboard API and
|
|
3
|
+
* falling back to `execCommand('copy')` on hosts (jsdom, insecure contexts)
|
|
4
|
+
* that omit it.
|
|
5
|
+
* @param text - the exact text to place on the clipboard.
|
|
6
|
+
* @returns true only when the host accepted the write.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeClipboard(text: string): Promise<boolean>;
|
|
9
|
+
//# sourceMappingURL=clipboard.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** The head/tail split metrics for a capped list. */
|
|
2
|
+
export interface HeadTailCap {
|
|
3
|
+
/** Rows beyond the cap (list length − maxLines); ≤ 0 means nothing is hidden. */
|
|
4
|
+
hidden: number;
|
|
5
|
+
/** Whether the list is over the cap and not expanded, so it shows a head/tail slice. */
|
|
6
|
+
capped: boolean;
|
|
7
|
+
/** Head-slice row count: `ceil(maxLines / 2)`. */
|
|
8
|
+
headLines: number;
|
|
9
|
+
/** Tail-slice row count: the remainder after the head. */
|
|
10
|
+
tailLines: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Compute the head/tail cap metrics for a list of `total` rows against `maxLines`,
|
|
14
|
+
* given whether the surface is expanded. Pure arithmetic; the caller slices its
|
|
15
|
+
* own rows with `headLines`/`tailLines` so a block can layer its own concerns
|
|
16
|
+
* (SearchBlock restores a tail file header) on top.
|
|
17
|
+
* @param total - the list's row count.
|
|
18
|
+
* @param maxLines - the collapsed-height cap in rows.
|
|
19
|
+
* @param expanded - whether the surface is expanded (uncaps the list).
|
|
20
|
+
* @returns the split metrics.
|
|
21
|
+
*/
|
|
22
|
+
export declare function headTailCap(total: number, maxLines: number, expanded: boolean): HeadTailCap;
|
|
23
|
+
//# sourceMappingURL=head-tail-cap.d.ts.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ic_ds_* icon set for the dsh web UI. All glyphs render fill="currentColor"
|
|
3
|
+
* and take {size, className}. Batch A mirrors the deepsuite icon library
|
|
4
|
+
* (same figma source); batch B glyphs are harness-only figma extracts.
|
|
5
|
+
*/
|
|
6
|
+
import type { IconProps } from './props.ts';
|
|
7
|
+
export type { IconProps } from './props.ts';
|
|
8
|
+
/** ic_ds_new_chat_outline_16 */
|
|
9
|
+
export declare const IconNewChatOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
10
|
+
/** ic_ds_search_outline_16 */
|
|
11
|
+
export declare const IconSearchOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
12
|
+
/** ic_ds_settings_outline_14 */
|
|
13
|
+
export declare const IconSettingsOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
14
|
+
/** ic_ds_settings_outline_16 */
|
|
15
|
+
export declare const IconSettingsOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
16
|
+
/** ic_ds_panel_left_outline_16 */
|
|
17
|
+
export declare const IconPanelLeftOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
18
|
+
/** ic_ds_ellipsis_outline_16 */
|
|
19
|
+
export declare const IconEllipsisOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
20
|
+
/** ic_ds_plus_outline_16 */
|
|
21
|
+
export declare const IconPlusOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
22
|
+
/** ic_ds_check_outline_16 */
|
|
23
|
+
export declare const IconCheckOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
24
|
+
/** ic_ds_check_outline_14 */
|
|
25
|
+
export declare const IconCheckOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
26
|
+
/** ic_ds_branch_outline_16 */
|
|
27
|
+
export declare const IconBranchOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
28
|
+
/** ic_ds_chevron_down_outline_14 */
|
|
29
|
+
export declare const IconChevronDownOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
30
|
+
/** ic_ds_chevron_left_outline_14 */
|
|
31
|
+
export declare const IconChevronLeftOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
32
|
+
/** ic_ds_chevron_right_outline_14 */
|
|
33
|
+
export declare const IconChevronRightOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
34
|
+
/** ic_ds_triangle_right_fill_14 — tree expand arrow; points right, consumers rotate it 90° for the open state. */
|
|
35
|
+
export declare const IconTriangleRightFill14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
36
|
+
/** ic_ds_chevron_up_outline_14 */
|
|
37
|
+
export declare const IconChevronUpOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
38
|
+
/** ic_ds_close_outline_16 */
|
|
39
|
+
export declare const IconCloseOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
40
|
+
/** ic_ds_close_fill_14 */
|
|
41
|
+
export declare const IconCloseFill14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
42
|
+
/** ic_ds_copy_outline_16 */
|
|
43
|
+
export declare const IconCopyOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
44
|
+
/** ic_ds_refresh_outline_16 */
|
|
45
|
+
export declare const IconRefreshOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
46
|
+
/** ic_ds_refresh_outline_14 */
|
|
47
|
+
export declare const IconRefreshOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
48
|
+
/** ic_ds_like_outline_16 */
|
|
49
|
+
export declare const IconLikeOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
50
|
+
/** ic_ds_like_fill_16 */
|
|
51
|
+
export declare const IconLikeFill16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
52
|
+
/** ic_ds_dislike_outline_16 */
|
|
53
|
+
export declare const IconDislikeOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
54
|
+
/** ic_ds_dislike_fill_16 */
|
|
55
|
+
export declare const IconDislikeFill16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
56
|
+
/** ic_ds_share_outline_16 */
|
|
57
|
+
export declare const IconShareOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
58
|
+
/** ic_ds_edit_outline_16 */
|
|
59
|
+
export declare const IconEditOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
60
|
+
/** ic_ds_think_outline_14 */
|
|
61
|
+
export declare const IconThinkOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
62
|
+
/** ic_ds_think_outline_16 */
|
|
63
|
+
export declare const IconThinkOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
64
|
+
/** ic_ds_browse_outline_16 */
|
|
65
|
+
export declare const IconBrowseOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
66
|
+
/** ic_ds_link_outline_14 */
|
|
67
|
+
export declare const IconLinkOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
68
|
+
/** ic_ds_link_outline_16 */
|
|
69
|
+
export declare const IconLinkOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
70
|
+
/** ic_ds_right_up_outline_14 */
|
|
71
|
+
export declare const IconRightUpOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
72
|
+
/** ic_ds_right_up_outline_16 */
|
|
73
|
+
export declare const IconRightUpOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
74
|
+
/** ic_ds_enhance_outline_16 */
|
|
75
|
+
export declare const IconEnhanceOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
76
|
+
/** ic_ds_trash_outline_16 */
|
|
77
|
+
export declare const IconTrashOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
78
|
+
/** ic_ds_warning_outline_16 */
|
|
79
|
+
export declare const IconWarningOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
80
|
+
/** ic_ds_user_outline_16 */
|
|
81
|
+
export declare const IconUserOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
82
|
+
/** ic_ds_send_outline_16 */
|
|
83
|
+
export declare const IconSendOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
84
|
+
/** ic_ds_stop_fill_16 */
|
|
85
|
+
export declare const IconStopFill16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
86
|
+
/** ic_ds_paperclip_outline_16 */
|
|
87
|
+
export declare const IconPaperclipOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
88
|
+
/** ic_ds_loading_outline_16 */
|
|
89
|
+
export declare const IconLoadingOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
90
|
+
/** ic_ds_download_outline_16 */
|
|
91
|
+
export declare const IconDownloadOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
92
|
+
/** ic_ds_play_outline_16 */
|
|
93
|
+
export declare const IconPlayOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
94
|
+
/** ic_ds_pause_outline_16 */
|
|
95
|
+
export declare const IconPauseOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
96
|
+
/** ic_ds_fullscreen_outline_16 */
|
|
97
|
+
export declare const IconFullscreenOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
98
|
+
/** ic_ds_code_outline_16 */
|
|
99
|
+
export declare const IconCodeOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
100
|
+
/** ic_ds_api_outline (figma extract) */
|
|
101
|
+
export declare const IconApiOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
102
|
+
/** ic_ds_personalization_outline_16 (figma extract) */
|
|
103
|
+
export declare const IconPersonalizationOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
104
|
+
/** ic_ds_project_add_outline_16 (figma extract) */
|
|
105
|
+
export declare const IconProjectAddOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
106
|
+
/**
|
|
107
|
+
* folder_open_16, outline layer only: the duotone original above reads a rung
|
|
108
|
+
* heavier than the …Outline16 family, so an icon-button row mixing them looks
|
|
109
|
+
* mismatched — this is the same geometry without the 20%-opacity inner fill.
|
|
110
|
+
*/
|
|
111
|
+
export declare const IconFolderOpenOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
112
|
+
/** folder_open_16 (figma extract): outline at full ink + 20%-opacity inner fill riding the same currentColor. */
|
|
113
|
+
export declare const IconFolderOpen16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
114
|
+
/** folder_close_16 (figma extract) */
|
|
115
|
+
export declare const IconFolderClose16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
116
|
+
/** tree_corner_8x10 (figma extract; session-tree "L" connector, stroke geometry pre-expanded) */
|
|
117
|
+
export declare const IconTreeCorner8x10: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
118
|
+
/** ic_ds_light_outline_16 */
|
|
119
|
+
export declare const IconLightOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
120
|
+
/** ic_ds_dark_outline_16 */
|
|
121
|
+
export declare const IconDarkOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
122
|
+
/** ic_ds_followsystem_outline_16 */
|
|
123
|
+
export declare const IconFollowsystemOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
124
|
+
/** ic_ds_data_outline_16 */
|
|
125
|
+
export declare const IconDataOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
126
|
+
/** ic_send_outline_14 (figma extract): thin-stroke upward send arrow. */
|
|
127
|
+
export declare const IconSendOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
128
|
+
/** ic_queue_outline_14 (figma extract): open chat bubble with two queued lines. */
|
|
129
|
+
export declare const IconQueueOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
130
|
+
/** ic_checklist_outline_14 (figma extract): two rings + two list bars. */
|
|
131
|
+
export declare const IconChecklistOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
132
|
+
/** ic_ds_List_Pen_outline_16 */
|
|
133
|
+
export declare const IconListPenOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
134
|
+
/** ic_ds_goal_outline_16 (goal strip leading glyph: dartboard with a landed arrow) */
|
|
135
|
+
export declare const IconGoalOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
136
|
+
/** sparkle_16 (Others tool-row leading glyph; hand-authored three-star
|
|
137
|
+
* approximation — the figma 43:31850 glyph is an SF Symbols "sparkles" text glyph,
|
|
138
|
+
* not extractable as vector data) */
|
|
139
|
+
export declare const IconSparkle16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
140
|
+
/** inspect_outline_12 (shared tool-row trajectory affordance glyph) */
|
|
141
|
+
export declare const IconInspectOutline12: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
142
|
+
/** skill_outline_16 (skill tool-row glyph; document instructions + sparkle) */
|
|
143
|
+
export declare const IconSkillOutline16: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
144
|
+
/** ic_ds_question_outline_14 (figma extract): ring + question glyph. */
|
|
145
|
+
export declare const IconQuestionOutline14: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
146
|
+
/** ic_ds_archive_outline_20 (figma extract): lidded box + label slot. The export's
|
|
147
|
+
* 0.11px stroke ring around the box contour is dropped — it restates the same
|
|
148
|
+
* contour in the same ink, which currentColor already carries. */
|
|
149
|
+
export declare const IconArchiveOutline20: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
150
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Shared props for every ic_ds_* icon component. */
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
/** Square edge in px; defaults to the glyph's own drawn size. */
|
|
4
|
+
size?: number | undefined;
|
|
5
|
+
/** Extra class for layout placement; color rides currentColor.
|
|
6
|
+
* (`| undefined` for exactOptionalPropertyTypes: callers forward their own optional prop.) */
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cordis-free React primitives styled only through `--dsw-*` tokens.
|
|
3
|
+
*/
|
|
4
|
+
export { StateDot } from './StateDot.tsx';
|
|
5
|
+
export type { StateDotState } from './StateDot.tsx';
|
|
6
|
+
export { DisclosureRow } from './DisclosureRow.tsx';
|
|
7
|
+
export type { DisclosureRowProps } from './DisclosureRow.tsx';
|
|
8
|
+
export { Button } from './Button.tsx';
|
|
9
|
+
export type { ButtonVariant } from './Button.tsx';
|
|
10
|
+
export { Pill } from './Pill.tsx';
|
|
11
|
+
export { Input } from './Input.tsx';
|
|
12
|
+
export { Menu } from './Menu.tsx';
|
|
13
|
+
export type { MenuEntry, MenuItem, MenuSeparator, MenuLabel } from './Menu.tsx';
|
|
14
|
+
export { useAnchoredMaxHeight } from './useAnchoredMaxHeight.ts';
|
|
15
|
+
export { HoverCard } from './HoverCard.tsx';
|
|
16
|
+
export { Modal } from './Modal.tsx';
|
|
17
|
+
export { OnboardingSurface } from './OnboardingSurface.tsx';
|
|
18
|
+
export { RiskConfirmation } from './RiskConfirmation.tsx';
|
|
19
|
+
export type { RiskConfirmationProps } from './RiskConfirmation.tsx';
|
|
20
|
+
export { ConnectionBanner } from './ConnectionBanner.tsx';
|
|
21
|
+
export { FishLogo } from './FishLogo.tsx';
|
|
22
|
+
export { BrandWordmark } from './BrandWordmark.tsx';
|
|
23
|
+
export { Tooltip } from './Tooltip.tsx';
|
|
24
|
+
export type { TooltipSide } from './Tooltip.tsx';
|
|
25
|
+
export { writeClipboard } from './clipboard.ts';
|
|
26
|
+
export { JsonTree } from './JsonTree.tsx';
|
|
27
|
+
export type { JsonTreeProps, JsonTreeLabels } from './JsonTree.tsx';
|
|
28
|
+
export { TerminalBlock, DEFAULT_TERMINAL_MAX_LINES } from './TerminalBlock.tsx';
|
|
29
|
+
export type { TerminalBlockProps, TerminalBlockLabels } from './TerminalBlock.tsx';
|
|
30
|
+
export { ReadBlock, DEFAULT_READ_MAX_LINES } from './ReadBlock.tsx';
|
|
31
|
+
export type { ReadBlockProps, ReadBlockLine } from './ReadBlock.tsx';
|
|
32
|
+
export { DiffBlock, DEFAULT_DIFF_MAX_LINES } from './DiffBlock.tsx';
|
|
33
|
+
export type { DiffBlockProps, DiffHunk } from './DiffBlock.tsx';
|
|
34
|
+
export { SearchBlock, DEFAULT_SEARCH_MAX_LINES } from './SearchBlock.tsx';
|
|
35
|
+
export type { SearchBlockProps, SearchMatchesBlockProps, SearchPathsBlockProps, SearchFileGroup, SearchBlockLineMatch, } from './SearchBlock.tsx';
|
|
36
|
+
export { WebBlock } from './WebBlock.tsx';
|
|
37
|
+
export type { WebBlockProps, WebSearchBlockProps, WebFetchBlockProps, WebSourceView } from './WebBlock.tsx';
|
|
38
|
+
export { CodeBlock } from './markdown/CodeBlock.tsx';
|
|
39
|
+
export type { CodeBlockProps } from './markdown/CodeBlock.tsx';
|
|
40
|
+
export { JsonBlock } from './markdown/JsonBlock.tsx';
|
|
41
|
+
export { MarkdownText } from './markdown/MarkdownText.tsx';
|
|
42
|
+
export type { MarkdownCodeLabels, MarkdownFileMentions } from './markdown/MarkdownText.tsx';
|
|
43
|
+
export { MessageText } from './markdown/MessageText.tsx';
|
|
44
|
+
export { extractMarkdownPlainText } from './markdown/plain-text.ts';
|
|
45
|
+
export type { MarkdownPlainTextMode, MarkdownPlainTextOptions } from './markdown/plain-text.ts';
|
|
46
|
+
export * from './icons/index.tsx';
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@deepseek-ai/dsh-client-ui-primitives`.
|
|
3
|
+
* @module @deepseek-ai/dsh-client-ui-primitives/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "client-ui-primitives-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CodeBlockProps {
|
|
2
|
+
/** The source text, rendered verbatim (trailing newline trimmed for display). */
|
|
3
|
+
code: string;
|
|
4
|
+
/** Grammar hint (markdown fence info string or a fixed caller id); unknown = plain. */
|
|
5
|
+
lang?: string | undefined;
|
|
6
|
+
/** Extra class merged onto the wrapper (callers position; this component draws). */
|
|
7
|
+
className?: string | undefined;
|
|
8
|
+
/** Copy-button idle label; the owner passes localized copy (this package is cordis-free, so copy arrives via props). */
|
|
9
|
+
copyLabel?: string | undefined;
|
|
10
|
+
/** Copy-button label during the post-copy confirmation window. */
|
|
11
|
+
copiedLabel?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function CodeBlock({ code, lang, className, copyLabel, copiedLabel }: CodeBlockProps): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=CodeBlock.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function JsonBlock({ label, payload, defaultOpen, truncatedLabel }: {
|
|
2
|
+
label: string;
|
|
3
|
+
payload: unknown;
|
|
4
|
+
defaultOpen?: boolean;
|
|
5
|
+
/** Footer appended when the body exceeds the char cap, given the full length (this package is cordis-free, so copy arrives via props). */
|
|
6
|
+
truncatedLabel?: ((total: number) => string) | undefined;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=JsonBlock.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Untrusted assistant-Markdown renderer over the direct mdast pipeline:
|
|
3
|
+
* `parse.ts` grammars, the incremental streaming parser, and `render.tsx`.
|
|
4
|
+
* While a message streams, all but the trailing two blocks freeze as cached
|
|
5
|
+
* React elements and only the source tail behind them re-parses per chunk,
|
|
6
|
+
* so per-chunk work tracks the tail size instead of the whole reply. Frozen
|
|
7
|
+
* blocks keep their source-offset keys when they cross the freeze boundary,
|
|
8
|
+
* so React reconciles instead of remounting. Known deviation while
|
|
9
|
+
* streaming: a reference-style link or footnote whose definition sits on the
|
|
10
|
+
* other side of the freeze boundary renders literally until the settled
|
|
11
|
+
* full parse self-heals it.
|
|
12
|
+
*/
|
|
13
|
+
import type { MarkdownCodeLabels, MarkdownFileMentions } from './render.tsx';
|
|
14
|
+
import 'katex/dist/katex.min.css';
|
|
15
|
+
export type { MarkdownCodeLabels, MarkdownFileMentions } from './render.tsx';
|
|
16
|
+
/**
|
|
17
|
+
* Render untrusted assistant-authored Markdown as semantic React elements.
|
|
18
|
+
* @param props - Markdown source text preserved by the session projection;
|
|
19
|
+
* `streaming` renders fences and TeX plain (highlighting and KaTeX land on
|
|
20
|
+
* the finalize swap) and parses incrementally across chunks; `codeLabels`
|
|
21
|
+
* forwards localized copy-button labels to fence CodeBlocks — pass a
|
|
22
|
+
* reference-stable object (memoized per locale revision), because a new
|
|
23
|
+
* identity discards the streaming render cache mid-message. `fileMentions`
|
|
24
|
+
* links inline-code tokens its resolver recognizes as real files; this is
|
|
25
|
+
* the single streaming gate — it applies to settled renders only, because a
|
|
26
|
+
* streaming message's vocabulary is not final and frozen cached elements
|
|
27
|
+
* must not bake in handlers that could go stale.
|
|
28
|
+
* @returns A GFM document with TeX math rendered through KaTeX; raw HTML,
|
|
29
|
+
* relative links, and unsafe protocols are disabled, while absolute HTTP(S)
|
|
30
|
+
* images render directly.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MarkdownText: import("react").MemoExoticComponent<({ text, streaming, codeLabels, fileMentions }: {
|
|
33
|
+
text: string;
|
|
34
|
+
streaming?: boolean;
|
|
35
|
+
codeLabels?: MarkdownCodeLabels | undefined;
|
|
36
|
+
fileMentions?: MarkdownFileMentions | undefined;
|
|
37
|
+
}) => import("react").JSX.Element>;
|
|
38
|
+
//# sourceMappingURL=MarkdownText.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Let asterisk strong emphasis close after punctuation when CJK prose continues without whitespace. */
|
|
2
|
+
import type { Extension } from 'micromark-util-types';
|
|
3
|
+
/**
|
|
4
|
+
* Extend CommonMark asterisk strong emphasis for punctuation-delimited CJK
|
|
5
|
+
* prose, as a micromark syntax extension for `fromMarkdown`.
|
|
6
|
+
* @returns The micromark syntax extension.
|
|
7
|
+
*/
|
|
8
|
+
export declare function cjkFriendlyStrong(): Extension;
|
|
9
|
+
//# sourceMappingURL=cjkFriendlyStrong.d.ts.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client's ONE syntax highlighter: a synchronous fine-grained shiki core
|
|
3
|
+
* (JavaScript regex engine — no oniguruma WASM, bundle-friendly) with an
|
|
4
|
+
* explicit grammar allowlist and a CSS-variables theme. Colors live in the
|
|
5
|
+
* theme package's token sheets as `--shiki-*` custom properties (light and
|
|
6
|
+
* dark blocks), never here — the repo's tokens-only styling rule.
|
|
7
|
+
*
|
|
8
|
+
* Only the three markdown-fence and `run_code` grammars (TypeScript, shell,
|
|
9
|
+
* JSON) load into the singleton at boot — the set every session renders. The
|
|
10
|
+
* read card's wider extension set (the file-extension language hints the read
|
|
11
|
+
* tool's `langFromPath` emits — `packages/fs/tool-fs`: python, rust, yaml,
|
|
12
|
+
* markup, …) is imported lazily and registered the first time such a language
|
|
13
|
+
* is requested, so a session that never opens a read card in one of those
|
|
14
|
+
* languages pays neither the ~1.6 MB of grammar modules nor their synchronous
|
|
15
|
+
* init. The first render of a lazy language falls back to plain text while its
|
|
16
|
+
* grammar loads, then {@link onGrammarLoaded} notifies subscribers to re-render
|
|
17
|
+
* with highlighting. An unknown or absent language falls back to plain text (no
|
|
18
|
+
* highlighting, still monospace) — never an error.
|
|
19
|
+
*/
|
|
20
|
+
import type { CSSProperties } from 'react';
|
|
21
|
+
/**
|
|
22
|
+
* Subscribe to lazy-grammar load completions; `listener` fires after a
|
|
23
|
+
* {@link LAZY_GRAMMARS} grammar finishes registering on the singleton, so a
|
|
24
|
+
* caller that rendered its plain fallback while the grammar loaded can
|
|
25
|
+
* re-highlight. Uses the `useSyncExternalStore` subscribe signature; pair it with
|
|
26
|
+
* {@link grammarLoadCount} as the snapshot. Returns an unsubscribe function.
|
|
27
|
+
* @param listener - invoked (no args) on each grammar-load completion.
|
|
28
|
+
* @returns a disposer that removes the listener.
|
|
29
|
+
*/
|
|
30
|
+
export declare function subscribeGrammarLoaded(listener: () => void): () => void;
|
|
31
|
+
/**
|
|
32
|
+
* The lazy-grammar load counter — a value that changes on every load, so a
|
|
33
|
+
* `useSyncExternalStore` snapshot re-renders the subscriber when a grammar
|
|
34
|
+
* registers. Opaque: only its identity across renders matters.
|
|
35
|
+
* @returns the current load count.
|
|
36
|
+
*/
|
|
37
|
+
export declare function grammarLoadCount(): number;
|
|
38
|
+
/**
|
|
39
|
+
* Highlight `code` into shiki's HTML (a single `<pre class="shiki">` tree)
|
|
40
|
+
* when `lang` maps to a registered grammar; `undefined` means the caller
|
|
41
|
+
* renders its plain fallback. A lazy grammar not yet loaded returns `undefined`
|
|
42
|
+
* for this call and loads in the background; subscribe with
|
|
43
|
+
* {@link onGrammarLoaded} to re-highlight once it registers.
|
|
44
|
+
* @param code - the source text.
|
|
45
|
+
* @param lang - the language hint (a markdown fence info string or a fixed caller id).
|
|
46
|
+
* @returns the highlighted HTML, or `undefined` for unknown or not-yet-loaded languages.
|
|
47
|
+
*/
|
|
48
|
+
export declare function highlightToHtml(code: string, lang: string | undefined): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* One highlighted run of a line: the text and the inline style shiki assigned
|
|
51
|
+
* it. The css-variables theme colors every run through a `--shiki-*` custom
|
|
52
|
+
* property, so `style.color` is always present; it is held as a style object
|
|
53
|
+
* rather than a bare color so a run spreads onto a `<span style>` uniformly.
|
|
54
|
+
*/
|
|
55
|
+
export interface HighlightSpan {
|
|
56
|
+
text: string;
|
|
57
|
+
style: CSSProperties;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Tokenize `code` into per-line highlighted runs when `lang` maps to a
|
|
61
|
+
* registered grammar; `undefined` means the caller renders its plain fallback.
|
|
62
|
+
* A line-numbered view needs the token runs split per line (one gutter number
|
|
63
|
+
* per line), which the single-`<pre>` {@link highlightToHtml} does not expose,
|
|
64
|
+
* so this returns shiki's own 2D line/token structure narrowed to what a run
|
|
65
|
+
* renders. Each run's color is a `--shiki-*` custom property, keeping token
|
|
66
|
+
* colors on the theme package's sheets exactly as the HTML path does; the
|
|
67
|
+
* css-variables theme carries no font-style bits, matching that path's
|
|
68
|
+
* color-only output. The trailing newline shiki appends as a final empty line
|
|
69
|
+
* is dropped so the run count matches the caller's own line array.
|
|
70
|
+
* @param code - the source text.
|
|
71
|
+
* @param lang - the language hint (a file-extension-derived language id).
|
|
72
|
+
* @returns one entry per source line (each an array of runs), or `undefined` for unknown or not-yet-loaded languages.
|
|
73
|
+
*/
|
|
74
|
+
export declare function highlightLines(code: string, lang: string | undefined): HighlightSpan[][] | undefined;
|
|
75
|
+
//# sourceMappingURL=highlight.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Incremental block-level markdown parsing for an append-only text stream.
|
|
3
|
+
*
|
|
4
|
+
* Re-parsing the whole accumulated document on every streaming chunk is
|
|
5
|
+
* quadratic in the final reply length. CommonMark block parsing is line-based
|
|
6
|
+
* and appended text can only reshape the parse frontier — the last top-level
|
|
7
|
+
* block (a paragraph becoming a setext heading or a table, a list continuing
|
|
8
|
+
* after a blank line, an unclosed fence swallowing lines) — so earlier blocks
|
|
9
|
+
* are final. This parser therefore freezes all but the trailing
|
|
10
|
+
* {@link UNSTABLE_TAIL_BLOCKS} blocks and re-parses only the source tail
|
|
11
|
+
* behind them: each source region is parsed O(1) times over the stream
|
|
12
|
+
* instead of once per chunk.
|
|
13
|
+
*
|
|
14
|
+
* The freeze boundary comes from the parser's own `position` offsets, never
|
|
15
|
+
* from custom source scanning. The cut sits at the *end offset* of the last
|
|
16
|
+
* frozen block (not the next block's start): a following block's start offset
|
|
17
|
+
* excludes up to three spaces of insignificant leading indentation, which is
|
|
18
|
+
* harmless to drop, but cutting at the previous end also keeps the
|
|
19
|
+
* inter-block blank lines in the tail so the sliced source stays verbatim.
|
|
20
|
+
*
|
|
21
|
+
* Known deviation, shared with any prefix-freeze scheme: micromark resolves
|
|
22
|
+
* reference-style links and footnotes document-wide at parse time, so a
|
|
23
|
+
* reference whose definition lands on the other side of the freeze boundary
|
|
24
|
+
* renders literally until the settled full parse self-heals it.
|
|
25
|
+
*/
|
|
26
|
+
import type { Root, RootContent } from 'mdast';
|
|
27
|
+
/** A top-level mdast block plus a render key that is stable across chunks. */
|
|
28
|
+
export interface PositionedBlock {
|
|
29
|
+
/** The parsed block. Positions inside it are relative to its parse slice. */
|
|
30
|
+
readonly node: RootContent;
|
|
31
|
+
/**
|
|
32
|
+
* The block's start offset in the full source text. Stable from the frame
|
|
33
|
+
* a block first appears through freezing, so React reconciles rather than
|
|
34
|
+
* remounts when a block crosses the freeze boundary.
|
|
35
|
+
*/
|
|
36
|
+
readonly key: number;
|
|
37
|
+
}
|
|
38
|
+
/** One {@link IncrementalMarkdownParser.update} result. */
|
|
39
|
+
export interface IncrementalBlocks {
|
|
40
|
+
/** Blocks that can no longer change; grows monotonically per generation. */
|
|
41
|
+
readonly frozen: readonly PositionedBlock[];
|
|
42
|
+
/** The re-parsed unstable tail (at most {@link UNSTABLE_TAIL_BLOCKS} blocks plus growth). */
|
|
43
|
+
readonly tail: readonly PositionedBlock[];
|
|
44
|
+
/** Bumped whenever non-append input discards the frozen prefix; callers drop caches keyed on it. */
|
|
45
|
+
readonly generation: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Append-only incremental parser over a caller-supplied grammar. One instance
|
|
49
|
+
* accumulates one streaming document; non-append input resets it.
|
|
50
|
+
*/
|
|
51
|
+
export declare class IncrementalMarkdownParser {
|
|
52
|
+
private readonly parse;
|
|
53
|
+
private prevText;
|
|
54
|
+
private tailStart;
|
|
55
|
+
private frozen;
|
|
56
|
+
private generation;
|
|
57
|
+
private cached;
|
|
58
|
+
/** @param parse - Grammar shared with whatever renders the blocks, so boundaries agree. */
|
|
59
|
+
constructor(parse: (text: string) => Root);
|
|
60
|
+
/**
|
|
61
|
+
* Fold the current accumulated text and return the frozen/tail split.
|
|
62
|
+
* Idempotent for identical input (the previous result is returned as-is),
|
|
63
|
+
* so callers may invoke it from render paths that re-execute.
|
|
64
|
+
* @param text - The full accumulated markdown source.
|
|
65
|
+
* @returns Frozen and tail blocks with stream-stable render keys.
|
|
66
|
+
*/
|
|
67
|
+
update(text: string): IncrementalBlocks;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=incremental.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TeX-to-React via KaTeX, replicating the rehype-katex pipeline this renderer
|
|
3
|
+
* replaced: the same three-arm error chain (strict render, `strict: 'ignore'`
|
|
4
|
+
* retry, error span) and a DOM-identical element tree, so settled math keeps
|
|
5
|
+
* its exact markup. KaTeX emits an HTML string; the browser's own HTML parser
|
|
6
|
+
* (`DOMParser`, applying the spec's SVG/MathML foreign-content attribute
|
|
7
|
+
* adjustments KaTeX output relies on) turns it into a tree this module maps
|
|
8
|
+
* onto React elements — KaTeX output is a static span/MathML/SVG vocabulary
|
|
9
|
+
* with no raw user HTML, the same trust shiki's tree gets in CodeBlock.
|
|
10
|
+
*
|
|
11
|
+
* React 18 has no MathML support, so the `.katex-mathml` subtree's elements
|
|
12
|
+
* land in the HTML namespace — exactly as they did under the replaced
|
|
13
|
+
* hast-util-to-jsx-runtime pipeline. The visual arm is the `.katex-html`
|
|
14
|
+
* span tree; the MathML arm serves assistive technology, which reads it by
|
|
15
|
+
* tag name regardless of namespace.
|
|
16
|
+
*/
|
|
17
|
+
import type { ReactNode } from 'react';
|
|
18
|
+
/**
|
|
19
|
+
* Render TeX source to React elements through KaTeX.
|
|
20
|
+
* @param value - The TeX source (math node value; fenced `math` blocks append
|
|
21
|
+
* their trailing newline to match the replaced pipeline's text extraction).
|
|
22
|
+
* @param displayMode - Display (block) versus inline rendering.
|
|
23
|
+
* @returns KaTeX's element tree, or the error span when the source does not
|
|
24
|
+
* parse (colored with KaTeX's stock `errorColor`, matching rehype-katex).
|
|
25
|
+
*/
|
|
26
|
+
export declare function renderTexToReact(value: string, displayMode: boolean): ReactNode;
|
|
27
|
+
//# sourceMappingURL=katex.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Extend upstream dollar-only math syntax with TeX delimiters while reusing its token vocabulary. */
|
|
2
|
+
import type { Extension } from 'micromark-util-types';
|
|
3
|
+
/**
|
|
4
|
+
* TeX backslash delimiters and same-line display-dollar blocks as a micromark
|
|
5
|
+
* syntax extension reusing `micromark-extension-math`'s token vocabulary; the
|
|
6
|
+
* caller must also register `math()` on the same parse so the emitted tokens
|
|
7
|
+
* compile to standard math nodes.
|
|
8
|
+
* @returns The micromark syntax extension.
|
|
9
|
+
*/
|
|
10
|
+
export declare function mathCompatibility(): Extension;
|
|
11
|
+
//# sourceMappingURL=mathCompatibility.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The markdown renderer's two mdast grammars, one per rendering arm. Each
|
|
3
|
+
* arm is internally consistent — the incremental tail parses, the one-shot
|
|
4
|
+
* parses, and the plain-text projection of a given grammar always agree on
|
|
5
|
+
* where blocks start and end — and the settled grammar is the streaming one
|
|
6
|
+
* plus the math extensions, so the arms differ only where TeX delimiters
|
|
7
|
+
* begin a math construct (a `$$` block is a paragraph while streaming and a
|
|
8
|
+
* math block once settled, by design).
|
|
9
|
+
*/
|
|
10
|
+
import type { Root } from 'mdast';
|
|
11
|
+
/**
|
|
12
|
+
* Parse GFM markdown (the streaming arm's grammar: no math, so incomplete
|
|
13
|
+
* TeX never flashes KaTeX errors mid-stream).
|
|
14
|
+
* @param text - Markdown source.
|
|
15
|
+
* @returns The mdast root.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseGfm(text: string): Root;
|
|
18
|
+
/**
|
|
19
|
+
* Parse GFM markdown plus TeX math with the compatibility delimiters
|
|
20
|
+
* (the settled arm's grammar).
|
|
21
|
+
* @param text - Markdown source.
|
|
22
|
+
* @returns The mdast root.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseGfmWithMath(text: string): Root;
|
|
25
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown-to-plain-text projection for compact summaries and labels.
|
|
3
|
+
* Parsing shares the renderer's streaming GFM grammar ({@link parseGfm}), so
|
|
4
|
+
* the projection strips exactly the markup the renderer would draw; raw HTML
|
|
5
|
+
* stays literal, links keep their labels, images keep alt text, and code
|
|
6
|
+
* keeps its source text.
|
|
7
|
+
*/
|
|
8
|
+
/** Amount of parsed Markdown content returned by the extractor. */
|
|
9
|
+
export type MarkdownPlainTextMode = 'all' | 'first-line' | 'first-paragraph';
|
|
10
|
+
/** Options for {@link extractMarkdownPlainText}. */
|
|
11
|
+
export interface MarkdownPlainTextOptions {
|
|
12
|
+
/** Projection boundary; defaults to the complete document. */
|
|
13
|
+
mode?: MarkdownPlainTextMode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Parse GFM Markdown, remove its presentation markup, and preserve raw HTML literally.
|
|
17
|
+
* @param markdown - Markdown source.
|
|
18
|
+
* @param options - Optional extraction boundary.
|
|
19
|
+
* @returns Plain text for the whole document, first visible line, or first semantic paragraph.
|
|
20
|
+
*/
|
|
21
|
+
export declare function extractMarkdownPlainText(markdown: string, options?: MarkdownPlainTextOptions): string;
|
|
22
|
+
//# sourceMappingURL=plain-text.d.ts.map
|