@pstdio/ui 0.13.0 → 0.14.0

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.
Files changed (59) hide show
  1. package/dist/MermaidComponent-CatfVUxA.js +60 -0
  2. package/dist/MermaidComponent-CatfVUxA.js.map +1 -0
  3. package/dist/chat-ui.js +1220 -1144
  4. package/dist/chat-ui.js.map +1 -1
  5. package/dist/components/chat-ui/components/chat-input-attachments.d.ts +12 -0
  6. package/dist/components/chat-ui/components/chat-input.d.ts +3 -0
  7. package/dist/components/chat-ui/components/chat-panel.d.ts +2 -0
  8. package/dist/components/chat-ui/components/message-parts-renderer.d.ts +1 -1
  9. package/dist/components/chat-ui/components/message-types.d.ts +90 -3
  10. package/dist/components/chat-ui/index.d.ts +2 -2
  11. package/dist/components/chat-ui/mocks/library/index.d.ts +2 -2
  12. package/dist/components/chat-ui/performance/chat-performance-fixtures.d.ts +1 -1
  13. package/dist/components/chat-ui/performance/chat-performance-story-utils.d.ts +1 -1
  14. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +3 -3
  15. package/dist/components/chat-ui/tool-rendering/question-renderer.d.ts +1 -1
  16. package/dist/components/chat-ui/tool-rendering/shared.d.ts +2 -2
  17. package/dist/components/chat-ui/tool-rendering/todowrite-renderer.d.ts +1 -1
  18. package/dist/components/chat-ui/tool-rendering/types.d.ts +1 -1
  19. package/dist/components/data-renderer/data-renderer-board-column-header.d.ts +8 -0
  20. package/dist/components/data-renderer/data-renderer-board-group-section.d.ts +17 -0
  21. package/dist/components/data-renderer/data-renderer-board-move.d.ts +21 -0
  22. package/dist/components/data-renderer/data-renderer-board.d.ts +3 -2
  23. package/dist/components/data-renderer/data-renderer-content.d.ts +7 -2
  24. package/dist/components/data-renderer/data-renderer.d.ts +2 -2
  25. package/dist/components/diff-viewer/diff-card-body.d.ts +16 -0
  26. package/dist/components/diff-viewer/diff-card.d.ts +1 -0
  27. package/dist/components/diff-viewer/diff-size.d.ts +1 -1
  28. package/dist/components/mermaid-renderer/download-png.d.ts +7 -0
  29. package/dist/components/mermaid-renderer/index.d.ts +2 -0
  30. package/dist/components/mermaid-renderer/mermaid-error-state.d.ts +6 -0
  31. package/dist/components/mermaid-renderer/mermaid-fixtures.d.ts +9 -0
  32. package/dist/components/mermaid-renderer/mermaid-fullscreen.d.ts +10 -0
  33. package/dist/components/mermaid-renderer/mermaid-renderer.d.ts +8 -0
  34. package/dist/components/mermaid-renderer/mermaid-svg-view.d.ts +12 -0
  35. package/dist/components/mermaid-renderer/mermaid-toolbar.d.ts +12 -0
  36. package/dist/components/mermaid-renderer/mermaid-zoom.d.ts +6 -0
  37. package/dist/components/mermaid-renderer/svg-data-url.d.ts +6 -0
  38. package/dist/components/mermaid-renderer/use-mermaid-render.d.ts +5 -0
  39. package/dist/components/palette-shortcut.d.ts +8 -0
  40. package/dist/index.d.ts +3 -0
  41. package/dist/index.js +3393 -3221
  42. package/dist/index.js.map +1 -1
  43. package/dist/mermaid-renderer-DYEiYmYQ.js +411 -0
  44. package/dist/mermaid-renderer-DYEiYmYQ.js.map +1 -0
  45. package/dist/resource-badge-D33IFv74.js +188 -0
  46. package/dist/resource-badge-D33IFv74.js.map +1 -0
  47. package/dist/{rich-message-CEOSsdR2.js → rich-message-BFtvH9H7.js} +430 -518
  48. package/dist/rich-message-BFtvH9H7.js.map +1 -0
  49. package/dist/rich-text.js +3 -3
  50. package/dist/{theme-D2LYEa0j.js → theme-C5qHTCU9.js} +3 -3
  51. package/dist/{theme-D2LYEa0j.js.map → theme-C5qHTCU9.js.map} +1 -1
  52. package/dist/theme.js +1 -1
  53. package/package.json +3 -2
  54. package/dist/MermaidComponent-Cz_Iob5U.js +0 -127
  55. package/dist/MermaidComponent-Cz_Iob5U.js.map +0 -1
  56. package/dist/components/chat-ui/agent-types.d.ts +0 -220
  57. package/dist/get-file-type-icon-ufFb0IkR.js +0 -102
  58. package/dist/get-file-type-icon-ufFb0IkR.js.map +0 -1
  59. package/dist/rich-message-CEOSsdR2.js.map +0 -1
@@ -0,0 +1,12 @@
1
+ import { ClipboardEvent, DragEvent } from 'react';
2
+ export declare const DEFAULT_TEXT_ATTACHMENT_PASTE_LINE_THRESHOLD = 200;
3
+ export declare const shouldAttachPastedText: (text: string, lineThreshold?: number) => boolean;
4
+ export declare const createAttachmentEventHandlers: (input: {
5
+ onAttachFiles?: (files: File[]) => void;
6
+ onAttachText?: (text: string) => void;
7
+ textAttachmentPasteLineThreshold: number;
8
+ }) => {
9
+ onDragOver: (event: DragEvent<HTMLDivElement>) => void;
10
+ onDropCapture: (event: DragEvent<HTMLDivElement>) => void;
11
+ onPasteCapture: (event: ClipboardEvent<HTMLDivElement>) => void;
12
+ };
@@ -5,6 +5,9 @@ interface ChatInputProps {
5
5
  placeholder?: string;
6
6
  onSubmit?: (text: string, attachments: string[], questionResponse?: ChatInputQuestionResponse) => void;
7
7
  onInterrupt?: () => void;
8
+ onAttachFiles?: (files: File[]) => void;
9
+ onAttachText?: (text: string) => void;
10
+ textAttachmentPasteLineThreshold?: number;
8
11
  streaming?: boolean;
9
12
  attachedResources?: string[];
10
13
  onClearAttachments?: () => void;
@@ -16,6 +16,8 @@ interface ChatPanelProps {
16
16
  chatInputDefaultValue?: string;
17
17
  onSubmitMessage?: (text: string, attachments: string[], questionResponse?: ChatInputQuestionResponse) => void;
18
18
  onInterrupt?: () => void;
19
+ onAttachFiles?: (files: File[]) => void;
20
+ onAttachText?: (text: string) => void;
19
21
  onChatInputChange?: (text: string) => void;
20
22
  /** Extra controls rendered near the chat input. */
21
23
  actions?: ReactNode;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { SessionMessage } from '../agent-types';
2
+ import { SessionMessage } from './message-types';
3
3
  import { ToolInvocationTimelineProps } from './tool-invocation-timeline';
4
4
  type ToolInvocationTimelineComponent = (props: ToolInvocationTimelineProps) => ReactNode;
5
5
  export interface MessagePartsProps {
@@ -1,8 +1,95 @@
1
- import { SessionMessage, SessionMessagePart, ToolPart } from '../agent-types';
2
- export type { SessionMessage, SessionMessagePart, ToolPart };
1
+ export type SessionMessageRole = "user" | "assistant" | "tool" | "system" | "developer";
2
+ export type TextPart = {
3
+ type: "text";
4
+ text: string;
5
+ };
6
+ export type ReasoningPart = {
7
+ type: "reasoning";
8
+ text: string;
9
+ };
10
+ export type ToolPartActionType = "read" | "write" | "execute" | "network" | "other";
11
+ export type ToolPartStatus = "pending" | "running" | "completed" | "failed" | "denied";
12
+ export type ToolPart = {
13
+ type: "tool";
14
+ tool: string;
15
+ callId?: string;
16
+ actionType?: ToolPartActionType;
17
+ status?: ToolPartStatus;
18
+ state?: {
19
+ status?: string;
20
+ input?: unknown;
21
+ output?: unknown;
22
+ errorText?: string;
23
+ metadata?: unknown;
24
+ };
25
+ };
26
+ export type StepStartPart = {
27
+ type: "step-start";
28
+ snapshot?: string;
29
+ };
30
+ export type StepFinishPart = {
31
+ type: "step-finish";
32
+ reason?: string;
33
+ snapshot?: string;
34
+ cost?: number;
35
+ tokens?: unknown;
36
+ };
37
+ export type PatchPart = {
38
+ type: "patch";
39
+ hash?: string;
40
+ files?: unknown;
41
+ };
42
+ export type FilePart = {
43
+ type: "file";
44
+ fileId?: string;
45
+ mediaType?: string;
46
+ filename?: string;
47
+ size?: number;
48
+ url: string;
49
+ };
50
+ export type LoadingPart = {
51
+ type: "loading";
52
+ };
53
+ export type ErrorPart = {
54
+ type: "error";
55
+ errorType: "timeout" | "crash" | "permission" | "other";
56
+ message?: string;
57
+ };
58
+ export type TokenUsagePart = {
59
+ type: "token_usage";
60
+ inputTokens: number;
61
+ outputTokens: number;
62
+ cacheReadTokens?: number;
63
+ cacheWriteTokens?: number;
64
+ };
65
+ export type AlertPart = {
66
+ type: "alert";
67
+ status: "info" | "warning" | "error" | "success" | "loading";
68
+ title: string;
69
+ message?: string;
70
+ };
71
+ export type SessionMessagePart = TextPart | ReasoningPart | ToolPart | StepStartPart | StepFinishPart | PatchPart | FilePart | LoadingPart | ErrorPart | TokenUsagePart;
72
+ export type ChatMessagePart = SessionMessagePart | AlertPart;
73
+ export type SessionMessage = {
74
+ id: string;
75
+ role: SessionMessageRole;
76
+ parts: ChatMessagePart[];
77
+ index?: number;
78
+ createdAt?: number;
79
+ modelId?: string;
80
+ providerId?: string;
81
+ tokens?: {
82
+ input?: number;
83
+ output?: number;
84
+ reasoning?: number;
85
+ cache?: {
86
+ read?: number;
87
+ write?: number;
88
+ };
89
+ };
90
+ };
3
91
  export type MessageOrigin = "user" | "assistant" | "developer";
4
92
  export declare const getMessageOrigin: (role: string) => MessageOrigin;
5
- export declare const isReasoningToolOnlyMessage: (message: SessionMessage) => boolean;
6
93
  export declare const mergeReasoningToolOnlyMessages: (messages: SessionMessage[]) => SessionMessage[];
7
94
  export interface MessageGroup {
8
95
  userMessage: SessionMessage;
@@ -1,16 +1,16 @@
1
- export type { AlertPart } from '../chat-ui/agent-types';
2
1
  export type { ConversationContentProps, ConversationRootProps, ConversationScrollButtonProps, } from './components/ai-conversation';
3
2
  export { ChatPrimitives } from './components/ai-conversation';
4
3
  export type { MessageContentProps, MessageRootProps } from './components/ai-message';
5
4
  export { ChatMessage } from './components/ai-message';
6
5
  export { ApprovalPrompt } from './components/approval-prompt';
6
+ export { AttachmentList } from './components/attachment-list';
7
7
  export type { AutoScrollProps } from './components/auto-scroll';
8
8
  export { AutoScroll } from './components/auto-scroll';
9
9
  export { ChatInput } from './components/chat-input';
10
10
  export type { ChatInputQuestionPrompt, ChatInputQuestionResponse } from './components/chat-input-question-prompt';
11
11
  export { ChatPanel } from './components/chat-panel';
12
12
  export { ChatSkeleton } from './components/chat-skeleton';
13
- export type { SessionMessage, SessionMessagePart } from './components/message-types';
13
+ export type { AlertPart, ChatMessagePart, SessionMessage, SessionMessagePart, ToolPart, } from './components/message-types';
14
14
  export type { SendButtonProps } from './components/send-button';
15
15
  export { SendButton } from './components/send-button';
16
16
  export { ChatWorkspaceHub } from './components/workspace-hub';
@@ -1,7 +1,7 @@
1
- import { AgentId, SessionMessage } from '../../agent-types';
1
+ import { SessionMessage } from '../../components/message-types';
2
2
  export type ConversationFixture = {
3
3
  id: string;
4
- agent: AgentId;
4
+ agent: string;
5
5
  label: string;
6
6
  description: string;
7
7
  messages: SessionMessage[];
@@ -1,4 +1,4 @@
1
- import { SessionMessage } from '../agent-types';
1
+ import { SessionMessage } from '../components/message-types';
2
2
  export interface LargeChatConversationOptions {
3
3
  sessionId: string;
4
4
  turns: number;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { SessionMessage } from '../agent-types';
2
+ import { SessionMessage } from '../components/message-types';
3
3
  export declare const defaultChatPanelProps: {
4
4
  readonly emptyStateTitle: "No messages";
5
5
  readonly emptyStateDescription: "";
@@ -1,11 +1,11 @@
1
- import { ToolPart } from '../agent-types';
1
+ import { ToolPart } from '../components/message-types';
2
2
  import { Block, TitleSegment } from '../components/timeline';
3
3
  import { ToolRenderersMap, ToolTimelineBuilderOptions } from './types';
4
4
  export declare const buildTimelineDocFromInvocations: (invocations: ToolPart[], options?: ToolTimelineBuilderOptions) => {
5
5
  items: (import('../components/timeline').Item | {
6
6
  indicator: {
7
7
  readonly type: "icon";
8
- readonly icon: "search" | "dot" | "danger" | "file" | "shell" | "patch" | "ls" | "read_file" | "write_file" | "delete_file" | "upload_files" | "download_file" | "move_file" | "browser" | "question" | "todo" | "terminal";
8
+ readonly icon: "search" | "dot" | "danger" | "file" | "shell" | "ls" | "read_file" | "write_file" | "delete_file" | "patch" | "upload_files" | "download_file" | "move_file" | "browser" | "question" | "todo" | "terminal";
9
9
  };
10
10
  title: TitleSegment[];
11
11
  blocks: Block[];
@@ -15,7 +15,7 @@ export declare const createToolTimelineBuilder: (toolRenderers: ToolRenderersMap
15
15
  items: (import('../components/timeline').Item | {
16
16
  indicator: {
17
17
  readonly type: "icon";
18
- readonly icon: "search" | "dot" | "danger" | "file" | "shell" | "patch" | "ls" | "read_file" | "write_file" | "delete_file" | "upload_files" | "download_file" | "move_file" | "browser" | "question" | "todo" | "terminal";
18
+ readonly icon: "search" | "dot" | "danger" | "file" | "shell" | "ls" | "read_file" | "write_file" | "delete_file" | "patch" | "upload_files" | "download_file" | "move_file" | "browser" | "question" | "todo" | "terminal";
19
19
  };
20
20
  title: TitleSegment[];
21
21
  blocks: Block[];
@@ -1,4 +1,4 @@
1
- import { ToolPart } from '../agent-types';
1
+ import { ToolPart } from '../components/message-types';
2
2
  import { Block, Item, TitleSegment } from '../components/timeline';
3
3
  import { ToolRenderer } from './types';
4
4
  type QuestionRendererDependencies = {
@@ -1,4 +1,4 @@
1
- import { ToolPart } from '../agent-types';
1
+ import { ToolPart } from '../components/message-types';
2
2
  import { Block, TitleSegment } from '../components/timeline';
3
3
  export type ApplyPatchMetadataFile = {
4
4
  filePath: string;
@@ -15,7 +15,7 @@ export declare const getStateLabel: (invocation: ToolPart) => string | null;
15
15
  export declare const isErrorState: (invocation: ToolPart) => boolean;
16
16
  export declare const buildIndicator: (invocation: ToolPart) => {
17
17
  readonly type: "icon";
18
- readonly icon: "search" | "dot" | "danger" | "file" | "shell" | "patch" | "ls" | "read_file" | "write_file" | "delete_file" | "upload_files" | "download_file" | "move_file" | "browser" | "question" | "todo" | "terminal";
18
+ readonly icon: "search" | "dot" | "danger" | "file" | "shell" | "ls" | "read_file" | "write_file" | "delete_file" | "patch" | "upload_files" | "download_file" | "move_file" | "browser" | "question" | "todo" | "terminal";
19
19
  };
20
20
  export declare const buildBaseTitle: (invocation: ToolPart, detail?: string, labelOverride?: string) => TitleSegment[];
21
21
  export declare const getInputObject: (invocation: ToolPart) => Record<string, unknown> | null;
@@ -1,4 +1,4 @@
1
- import { ToolPart } from '../agent-types';
1
+ import { ToolPart } from '../components/message-types';
2
2
  import { Block, Item, TitleSegment } from '../components/timeline';
3
3
  import { ToolRenderer } from './types';
4
4
  type TodowriteRendererDependencies = {
@@ -1,4 +1,4 @@
1
- import { ToolPart } from '../agent-types';
1
+ import { ToolPart } from '../components/message-types';
2
2
  import { Item, TimelineDoc } from '../components/timeline';
3
3
  export type ToolRenderResult = Item;
4
4
  export type ToolRenderOptions = {
@@ -0,0 +1,8 @@
1
+ import { DataRendererBoardColumn } from './data-renderer-board';
2
+ interface ColumnHeaderProps {
3
+ column: DataRendererBoardColumn;
4
+ onCreateStart?: (columnId: string) => void;
5
+ onColumnAction?: (columnId: string, actionId: string) => Promise<void> | void;
6
+ }
7
+ export declare const ColumnHeader: (props: ColumnHeaderProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ import { DragEvent } from 'react';
2
+ import { DataRendererBoardGroup } from './data-renderer-board';
3
+ interface GroupSectionProps {
4
+ columnId: string;
5
+ group: DataRendererBoardGroup;
6
+ selectedItemId: string | null;
7
+ canDragIn: boolean;
8
+ canDragOut: boolean;
9
+ isDropTarget: boolean;
10
+ onDragStart: (itemId: string) => (event: DragEvent<HTMLDivElement>) => void;
11
+ onDragEnd: () => void;
12
+ onGroupDragOver: (event: DragEvent<HTMLDivElement>) => void;
13
+ onGroupDragLeave: (event: DragEvent<HTMLDivElement>) => void;
14
+ onGroupDrop: (event: DragEvent<HTMLDivElement>, beforeItemId?: string) => void;
15
+ }
16
+ export declare const GroupSection: (props: GroupSectionProps) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,21 @@
1
+ import { DataRendererSettings } from './types';
2
+ interface ApplyBoardMoveItemInput {
3
+ settings: Pick<DataRendererSettings, "columnGrouping" | "ordering" | "rowGrouping">;
4
+ rowId: string;
5
+ targetColumnId: string;
6
+ targetGroupKey?: string;
7
+ beforeItemId?: string;
8
+ onAttributeChange?: (rowId: string, attributeId: string, value: unknown) => Promise<void> | void;
9
+ onReorder?: (rowId: string, beforeRowId?: string) => Promise<void> | void;
10
+ }
11
+ interface ApplyBoardMoveToGroupInput {
12
+ settings: Pick<DataRendererSettings, "ordering" | "rowGrouping">;
13
+ rowId: string;
14
+ targetGroupKey: string;
15
+ beforeItemId?: string;
16
+ onAttributeChange?: (rowId: string, attributeId: string, value: unknown) => Promise<void> | void;
17
+ onReorder?: (rowId: string, beforeRowId?: string) => Promise<void> | void;
18
+ }
19
+ export declare const applyBoardMoveItem: (input: ApplyBoardMoveItemInput) => Promise<void>;
20
+ export declare const applyBoardMoveToGroup: (input: ApplyBoardMoveToGroupInput) => Promise<void>;
21
+ export {};
@@ -36,10 +36,11 @@ interface DataRendererBoardProps {
36
36
  selectedItemId?: string | null;
37
37
  onMoveItem?: (itemId: string, targetColumnId: string, context?: {
38
38
  beforeItemId?: string;
39
- }) => void;
39
+ targetGroupKey?: string;
40
+ }) => Promise<void> | void;
40
41
  onMoveToGroup?: (itemId: string, targetGroupKey: string, context?: {
41
42
  beforeItemId?: string;
42
- }) => void;
43
+ }) => Promise<void> | void;
43
44
  onCreateStart?: (columnId: string) => void;
44
45
  onColumnAction?: (columnId: string, actionId: string) => Promise<void> | void;
45
46
  }
@@ -11,8 +11,13 @@ interface DataRendererContentProps {
11
11
  emptyState?: ReactNode;
12
12
  emptyTitle: string;
13
13
  emptyDescription?: string;
14
- onBoardMoveItem: (rowId: string, targetColumnId: string) => void;
15
- onBoardMoveToGroup: (rowId: string, targetGroupKey: string) => void;
14
+ onBoardMoveItem: (rowId: string, targetColumnId: string, context?: {
15
+ beforeItemId?: string;
16
+ targetGroupKey?: string;
17
+ }) => Promise<void> | void;
18
+ onBoardMoveToGroup: (rowId: string, targetGroupKey: string, context?: {
19
+ beforeItemId?: string;
20
+ }) => Promise<void> | void;
16
21
  onCreateRow?: (columnId: string) => void;
17
22
  onColumnAction?: (columnId: string, actionId: string) => Promise<void> | void;
18
23
  onListExpandedGroupChange: (rowId: string, isExpanded: boolean) => void;
@@ -29,9 +29,9 @@ export interface DataRendererProps<TRow extends DataRendererRow = DataRendererRo
29
29
  toolbarLeading?: ReactNode;
30
30
  onRowClick?: (row: TRow) => void;
31
31
  /** Called when a row attribute changes through drag/drop, board movement, or inline controls. */
32
- onAttributeChange?: (rowId: string, attributeId: string, value: unknown) => void;
32
+ onAttributeChange?: (rowId: string, attributeId: string, value: unknown) => Promise<void> | void;
33
33
  /** Called for manual row ordering when a dragged row is dropped before another row. */
34
- onReorder?: (rowId: string, beforeRowId?: string) => void;
34
+ onReorder?: (rowId: string, beforeRowId?: string) => Promise<void> | void;
35
35
  onCreateRow?: (columnId: string) => void;
36
36
  onColumnAction?: (columnId: string, actionId: string) => Promise<void> | void;
37
37
  getBoardColumnConfig?: (groupKey: string) => BoardColumnConfig;
@@ -15,9 +15,21 @@ interface DiffCardBodyModelInput extends DiffCardBodyProps {
15
15
  buildViewData?: typeof buildDiffViewData;
16
16
  }
17
17
  export declare const createDiffCardBodyModel: (input: DiffCardBodyModelInput) => {
18
+ kind: "image";
19
+ filePath: string;
20
+ oldSrc: string;
21
+ newSrc: string;
22
+ isImage?: undefined;
23
+ renderedLineCount?: undefined;
24
+ onShowFullDiff?: undefined;
25
+ diffViewData?: undefined;
26
+ sideBySide?: undefined;
27
+ } | {
18
28
  kind: "binary";
19
29
  filePath: string;
20
30
  isImage: boolean;
31
+ oldSrc?: undefined;
32
+ newSrc?: undefined;
21
33
  renderedLineCount?: undefined;
22
34
  onShowFullDiff?: undefined;
23
35
  diffViewData?: undefined;
@@ -27,6 +39,8 @@ export declare const createDiffCardBodyModel: (input: DiffCardBodyModelInput) =>
27
39
  filePath: string;
28
40
  renderedLineCount: number;
29
41
  onShowFullDiff: (() => void) | undefined;
42
+ oldSrc?: undefined;
43
+ newSrc?: undefined;
30
44
  isImage?: undefined;
31
45
  diffViewData?: undefined;
32
46
  sideBySide?: undefined;
@@ -35,6 +49,8 @@ export declare const createDiffCardBodyModel: (input: DiffCardBodyModelInput) =>
35
49
  diffViewData: BuiltDiffViewData;
36
50
  sideBySide: boolean;
37
51
  filePath?: undefined;
52
+ oldSrc?: undefined;
53
+ newSrc?: undefined;
38
54
  isImage?: undefined;
39
55
  renderedLineCount?: undefined;
40
56
  onShowFullDiff?: undefined;
@@ -39,6 +39,7 @@ export declare const resolveRequestedDiffPath: (input: {
39
39
  filePath: string;
40
40
  hasDiffContent: boolean;
41
41
  }) => string | null;
42
+ export declare const shouldShowDiffStats: (filePath: string) => boolean;
42
43
  export declare const DiffCard: (props: DiffCardProps) => import("react/jsx-runtime").JSX.Element;
43
44
  export declare const DiffCardHeader: (props: DiffCardHeaderProps) => import("react/jsx-runtime").JSX.Element;
44
45
  export {};
@@ -13,4 +13,4 @@ export declare const isLargeDiffContent: (input: {
13
13
  }) => boolean;
14
14
  export declare const isGeneratedDiffPath: (path: string) => boolean;
15
15
  export declare const isBinaryDiffPath: (path: string) => boolean;
16
- export declare const isImageDiffPath: (path: string) => boolean;
16
+ export declare const isImageDiffPath: (filePath: string) => boolean;
@@ -0,0 +1,7 @@
1
+ interface DownloadMermaidPngOptions {
2
+ svg: string;
3
+ zoom: number;
4
+ filename?: string;
5
+ }
6
+ export declare const downloadMermaidPng: (options: DownloadMermaidPngOptions) => Promise<void>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ export type { MermaidRendererProps } from './mermaid-renderer';
2
+ export { MermaidRenderer } from './mermaid-renderer';
@@ -0,0 +1,6 @@
1
+ interface MermaidErrorStateProps {
2
+ code: string;
3
+ error: string;
4
+ }
5
+ export declare const MermaidErrorState: (props: MermaidErrorStateProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const mermaidFixtures: {
2
+ readonly ps81Flowchart: "flowchart LR\n Editor[\"Markdown document<br/>editor\"] -->|\"fenced mermaid block\"| Node[\"MermaidNode\"]\n Node -->|\"source code\"| Renderer[\"MermaidRenderer\"]\n Renderer -->|\"stable SVG preview\"| Preview[\"Readable inline preview\"]\n Preview -->|\"zoomed past 100 percent\"| Pan[\"Pannable viewport\"]\n Renderer -->|\"fullscreen inspect\"| Fullscreen[\"Fullscreen preview\"]\n Fullscreen -->|\"Download as PNG\"| Export[\"Raster export\"]";
3
+ readonly sequence: "sequenceDiagram\n participant User\n participant Editor\n participant Renderer\n User->>Editor: Open document\n Editor->>Renderer: Render mermaid source\n Renderer-->>Editor: SVG preview\n User->>Renderer: Zoom and inspect";
4
+ readonly state: "stateDiagram-v2\n [*] --> Preview\n Preview --> Editing: Edit\n Editing --> Preview: Preview\n Preview --> Fullscreen: Fullscreen\n Fullscreen --> Preview: Close";
5
+ readonly er: "erDiagram\n DOCUMENT ||--o{ MERMAID_BLOCK : contains\n MERMAID_BLOCK ||--|| SVG_PREVIEW : renders\n SVG_PREVIEW ||--o{ PNG_EXPORT : creates\n DOCUMENT {\n string id\n string title\n }\n MERMAID_BLOCK {\n string source\n }";
6
+ readonly class: "classDiagram\n class MermaidRenderer {\n +code\n +zoom()\n +fullscreen()\n }\n class MermaidNode {\n +getCode()\n +setCode()\n }\n MermaidNode --> MermaidRenderer";
7
+ readonly gantt: "gantt\n title Mermaid rendering workflow\n dateFormat YYYY-MM-DD\n section Preview\n Render SVG :done, render, 2026-06-01, 2d\n Inspect fullscreen :active, inspect, after render, 3d\n section Export\n Download PNG :export, after inspect, 1d";
8
+ readonly invalid: "flowchart TD\n A -->";
9
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ interface MermaidFullscreenProps {
3
+ children: ReactNode;
4
+ canDownload: boolean;
5
+ open: boolean;
6
+ onClose: () => void;
7
+ onDownload: () => void;
8
+ }
9
+ export declare const MermaidFullscreen: (props: MermaidFullscreenProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface MermaidRendererProps {
2
+ code: string;
3
+ initialFullscreenOpen?: boolean;
4
+ initialZoom?: number;
5
+ isEditable?: boolean;
6
+ onRequestEdit?: () => void;
7
+ }
8
+ export declare const MermaidRenderer: (props: MermaidRendererProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ interface MermaidSvgViewProps {
3
+ svg: string;
4
+ zoom: number;
5
+ allowPanAtDefaultZoom?: boolean;
6
+ maxHeight?: string;
7
+ minHeight?: string;
8
+ overlayActions?: ReactNode;
9
+ onZoomChange: (zoom: number) => void;
10
+ }
11
+ export declare const MermaidSvgView: (props: MermaidSvgViewProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ interface MermaidInlineToolbarProps {
2
+ isEditable: boolean;
3
+ onRequestEdit?: () => void;
4
+ onOpenFullscreen: () => void;
5
+ }
6
+ interface MermaidZoomControlsProps {
7
+ zoom: number;
8
+ onZoomChange: (zoom: number) => void;
9
+ }
10
+ export declare const MermaidInlineToolbar: (props: MermaidInlineToolbarProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const MermaidZoomControls: (props: MermaidZoomControlsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const MERMAID_MIN_ZOOM = 0.5;
2
+ export declare const MERMAID_MAX_ZOOM = 3;
3
+ export declare const MERMAID_ZOOM_STEP = 0.25;
4
+ export declare const clampMermaidZoom: (value: number) => number;
5
+ export declare const zoomIn: (zoom: number) => number;
6
+ export declare const zoomOut: (zoom: number) => number;
@@ -0,0 +1,6 @@
1
+ export declare const resolveSvgSize: (svg: string) => {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ export declare const normalizeSvgForImage: (svg: string) => string;
6
+ export declare const createSvgDataUrl: (svg: string) => string;
@@ -0,0 +1,5 @@
1
+ export declare const useMermaidRender: (code: string) => {
2
+ svg: string;
3
+ error: string;
4
+ isRendering: boolean;
5
+ };
@@ -1,4 +1,12 @@
1
+ import { LucideIcon } from 'lucide-react';
1
2
  export type PaletteShortcutBinding = string | string[];
3
+ type ShortcutPlatform = "linux" | "mac" | "win";
4
+ interface ShortcutDisplayPart {
5
+ label: string;
6
+ Icon?: LucideIcon;
7
+ }
8
+ export declare const resolveShortcutDisplayPart: (label: string, platform?: ShortcutPlatform) => ShortcutDisplayPart;
2
9
  export declare const PaletteShortcut: (props: {
3
10
  binding: PaletteShortcutBinding;
4
11
  }) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
package/dist/index.d.ts CHANGED
@@ -48,6 +48,8 @@ export type { ItemSectionProps } from './components/item-section';
48
48
  export { ItemSection } from './components/item-section';
49
49
  export { ListRow } from './components/list-row/list-row';
50
50
  export type { ListRowAction, ListRowActionContext, ListRowActionMenuItem, ListRowItem, ListRowNavigationIntent, } from './components/list-row/list-row.types';
51
+ export type { MermaidRendererProps } from './components/mermaid-renderer';
52
+ export { MermaidRenderer } from './components/mermaid-renderer';
51
53
  export type { OpenSourceNotice, OpenSourceNoticesScreenProps, } from './components/open-source-notices-screen';
52
54
  export { OpenSourceNoticesScreen } from './components/open-source-notices-screen';
53
55
  export type { FilterPaletteEntriesOptions, PaletteEntry, PaletteEscapeContext, PaletteMode, PaletteProps, PaletteSearchEntry, PaletteState, PaletteStateValue, } from './components/palette';
@@ -61,6 +63,7 @@ export { Radio, RadioGroup } from './components/radio';
61
63
  export type { RepoPickerDialogEntry, RepoPickerDialogProps } from './components/repo-picker-dialog';
62
64
  export { RepoPickerDialog } from './components/repo-picker-dialog';
63
65
  export { ResizableSplitLayout } from './components/resizable-split-layout';
66
+ export { ResourceBadge } from './components/resource-badge';
64
67
  export type { ResourceContextAction } from './components/resource-context-menu';
65
68
  export { ResourceContextMenu } from './components/resource-context-menu';
66
69
  export { ScrollArea } from './components/scroll-area';