@tangle-network/ui 11.11.7 → 11.12.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.
- package/CHANGELOG.md +13 -0
- package/dist/{chat-8WnrR5AQ.js → chat-DDvF2oGQ.js} +3 -3
- package/dist/chat.js +1 -1
- package/dist/{document-editor-pane-DHM8DDhb.d.ts → document-editor-pane-BilJfiCo.d.ts} +3 -1
- package/dist/{document-editor-pane-DrjsLZ3a.js → document-editor-pane-POsq5Q0o.js} +3 -3
- package/dist/editor.d.ts +1 -1
- package/dist/editor.js +1 -1
- package/dist/{files-DDpeW_nO.js → files-hywocVZz.js} +3 -2
- package/dist/files.d.ts +1 -1
- package/dist/files.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{index-CyGSLGVF.d.ts → index-CJ8wRfiC.d.ts} +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/{markdown-PywkQXWk.js → markdown-Db08KAYF.js} +1 -1
- package/dist/markdown.js +1 -1
- package/dist/{openui-artifact-renderer-DjLPuaP9.js → openui-artifact-renderer-DG_i2lOR.js} +1 -1
- package/dist/openui.js +1 -1
- package/dist/{primitives-Cb8GGVKr.js → primitives-Bx59fT-U.js} +1 -1
- package/dist/primitives.js +1 -1
- package/dist/{run-group-COUIsZ_x.js → run-group-BWGeesgs.js} +2 -2
- package/dist/run.js +2 -2
- package/dist/sdk-hooks.js +1 -1
- package/dist/{tool-call-feed-DNADpFyJ.js → tool-call-feed-BpmMLpPX.js} +1 -1
- package/dist/{use-sse-stream-OOPpkt_E.js → use-sse-stream-DjqRuDft.js} +1 -1
- package/package.json +2 -2
- package/src/editor/document-editor-pane.tsx +4 -1
- package/src/files/file-artifact-pane.test.tsx +23 -0
- package/src/files/file-artifact-pane.tsx +3 -0
- package/src/markdown/markdown.test.tsx +3 -2
- package/src/markdown/markdown.tsx +2 -1
- package/src/primitives/code-block.tsx +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @tangle-network/ui
|
|
2
2
|
|
|
3
|
+
## 11.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c7953d8: Allow document and file editors to compare controlled drafts against a separate persisted baseline.
|
|
8
|
+
This preserves unsaved changes when a host switches between Source and Rich views.
|
|
9
|
+
|
|
10
|
+
## 11.11.8
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- dc29f33: Use semantic theme colors for inline code in Markdown and the InlineCode primitive.
|
|
15
|
+
|
|
3
16
|
## 11.11.7
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -3,9 +3,9 @@ import { t as cn } from "./utils-C_uf36nf.js";
|
|
|
3
3
|
import { r as getToolDisplayMetadata } from "./tool-display-BAuAVa43.js";
|
|
4
4
|
import { n as useRunCollapseState, r as useRunGroups, t as useAutoScroll } from "./use-auto-scroll-C5Pjeqon.js";
|
|
5
5
|
import { n as ToolCallStep, t as ToolCallGroup } from "./tool-call-step-DNebqhmX.js";
|
|
6
|
-
import { t as Markdown } from "./markdown-
|
|
7
|
-
import { n as InlineThinkingItem, t as RunGroup } from "./run-group-
|
|
8
|
-
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-
|
|
6
|
+
import { t as Markdown } from "./markdown-Db08KAYF.js";
|
|
7
|
+
import { n as InlineThinkingItem, t as RunGroup } from "./run-group-BWGeesgs.js";
|
|
8
|
+
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-DG_i2lOR.js";
|
|
9
9
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { AlertTriangle, ArrowDown, CheckCircle2, CircleDot, FileText, Info } from "lucide-react";
|
package/dist/chat.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MessageList, i as ThinkingIndicator, n as ChatContainer, o as UserMessage, r as AgentTimeline, t as ChatMessage } from "./chat-
|
|
1
|
+
import { a as MessageList, i as ThinkingIndicator, n as ChatContainer, o as UserMessage, r as AgentTimeline, t as ChatMessage } from "./chat-DDvF2oGQ.js";
|
|
2
2
|
export { AgentTimeline, ChatContainer, ChatMessage, MessageList, ThinkingIndicator, UserMessage };
|
|
@@ -108,6 +108,8 @@ interface DocumentEditorPaneProps extends Omit<ArtifactPaneProps, "children" | "
|
|
|
108
108
|
tabs?: ArtifactPaneProps["tabs"];
|
|
109
109
|
toolbar?: ReactNode;
|
|
110
110
|
markdown?: string;
|
|
111
|
+
/** Persisted baseline when the host controls the current markdown draft. */
|
|
112
|
+
savedMarkdown?: string;
|
|
111
113
|
/** Transform Markdown links and images through the shared URL policy. */
|
|
112
114
|
urlTransform?: UrlTransform;
|
|
113
115
|
mode?: DocumentEditorMode;
|
|
@@ -129,6 +131,6 @@ interface DocumentEditorPaneProps extends Omit<ArtifactPaneProps, "children" | "
|
|
|
129
131
|
* DocumentEditorPane — reusable markdown document surface with preview/edit
|
|
130
132
|
* modes and optional collaborative editing backed by Yjs/Hocuspocus.
|
|
131
133
|
*/
|
|
132
|
-
declare function DocumentEditorPane({ eyebrow, title, subtitle, meta, headerActions, footer, className, contentClassName, headerClassName, hideTitleBlock, tabs, toolbar, markdown, urlTransform, mode, defaultMode, onModeChange, backend, placeholder, autoFocus, readOnly, onChange, onSave, saving, saveLabel, previewClassName, editorClassName, collaboration }: DocumentEditorPaneProps): import("react").JSX.Element;
|
|
134
|
+
declare function DocumentEditorPane({ eyebrow, title, subtitle, meta, headerActions, footer, className, contentClassName, headerClassName, hideTitleBlock, tabs, toolbar, markdown, savedMarkdown, urlTransform, mode, defaultMode, onModeChange, backend, placeholder, autoFocus, readOnly, onChange, onSave, saving, saveLabel, previewClassName, editorClassName, collaboration }: DocumentEditorPaneProps): import("react").JSX.Element;
|
|
133
135
|
//#endregion
|
|
134
136
|
export { DocumentEditorPaneProps as a, EditorContextValue as c, EditorTokenRefreshResult as d, EditorUser as f, DocumentEditorPaneCollaborationConfig as i, EditorProvider as l, DocumentEditorMode as n, Collaborator as o, useEditorContext as p, DocumentEditorPane as r, ConnectionState as s, DocumentEditorBackend as t, EditorProviderProps as u };
|
|
@@ -3,7 +3,7 @@ import { i as focusRing } from "./focus-BcE_SHqz.js";
|
|
|
3
3
|
import { t as cn } from "./utils-C_uf36nf.js";
|
|
4
4
|
import { i as TabsTrigger, n as TabsContent, r as TabsList, t as Tabs } from "./tabs-BVHR6NkO.js";
|
|
5
5
|
import { t as ArtifactPane } from "./artifact-pane-DMXT9a8U.js";
|
|
6
|
-
import { t as Markdown } from "./markdown-
|
|
6
|
+
import { t as Markdown } from "./markdown-Db08KAYF.js";
|
|
7
7
|
import { Suspense, createContext, lazy, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { PencilLine, Save, Users, Wifi, WifiOff } from "lucide-react";
|
|
@@ -1159,12 +1159,12 @@ function CollaborativeDocumentSurface({ markdown, placeholder, autoFocus, readOn
|
|
|
1159
1159
|
* DocumentEditorPane — reusable markdown document surface with preview/edit
|
|
1160
1160
|
* modes and optional collaborative editing backed by Yjs/Hocuspocus.
|
|
1161
1161
|
*/
|
|
1162
|
-
function DocumentEditorPane({ eyebrow, title, subtitle, meta, headerActions, footer, className, contentClassName, headerClassName, hideTitleBlock, tabs, toolbar, markdown = "", urlTransform, mode, defaultMode = "preview", onModeChange, backend = "local", placeholder = "Start writing...", autoFocus = false, readOnly = false, onChange, onSave, saving = false, saveLabel = "Save changes", previewClassName, editorClassName, collaboration }) {
|
|
1162
|
+
function DocumentEditorPane({ eyebrow, title, subtitle, meta, headerActions, footer, className, contentClassName, headerClassName, hideTitleBlock, tabs, toolbar, markdown = "", savedMarkdown, urlTransform, mode, defaultMode = "preview", onModeChange, backend = "local", placeholder = "Start writing...", autoFocus = false, readOnly = false, onChange, onSave, saving = false, saveLabel = "Save changes", previewClassName, editorClassName, collaboration }) {
|
|
1163
1163
|
const [draft, setDraft] = useState(markdown);
|
|
1164
1164
|
const [uncontrolledMode, setUncontrolledMode] = useState(defaultMode);
|
|
1165
1165
|
const activeMode = mode ?? uncontrolledMode;
|
|
1166
1166
|
const isCollaborative = backend === "collaborative" && Boolean(collaboration);
|
|
1167
|
-
const isDirty = normalizeMarkdown(draft) !== normalizeMarkdown(markdown);
|
|
1167
|
+
const isDirty = normalizeMarkdown(draft) !== normalizeMarkdown(savedMarkdown ?? markdown);
|
|
1168
1168
|
const saveStateLabel = readOnly ? "Read only" : isCollaborative ? isDirty ? "Snapshot pending" : "Live document current" : isDirty ? "Unsaved changes" : "Saved";
|
|
1169
1169
|
useEffect(() => {
|
|
1170
1170
|
setDraft(markdown);
|
package/dist/editor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DocumentEditorPaneProps, c as EditorContextValue, d as EditorTokenRefreshResult, f as EditorUser, i as DocumentEditorPaneCollaborationConfig, l as EditorProvider, n as DocumentEditorMode, o as Collaborator, p as useEditorContext, r as DocumentEditorPane, s as ConnectionState, t as DocumentEditorBackend, u as EditorProviderProps } from "./document-editor-pane-
|
|
1
|
+
import { a as DocumentEditorPaneProps, c as EditorContextValue, d as EditorTokenRefreshResult, f as EditorUser, i as DocumentEditorPaneCollaborationConfig, l as EditorProvider, n as DocumentEditorMode, o as Collaborator, p as useEditorContext, r as DocumentEditorPane, s as ConnectionState, t as DocumentEditorBackend, u as EditorProviderProps } from "./document-editor-pane-BilJfiCo.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import { HocuspocusProvider } from "@hocuspocus/provider";
|
|
4
4
|
import { Editor } from "@tiptap/react";
|
package/dist/editor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as useCollaborators, c as useYjsState, d as EditorToolbar, f as EditorProvider, i as useCollaboratorPresence, l as CollaboratorsList, o as useDocumentChanges, p as useEditorContext, r as useAwareness, s as useEditorConnection, t as DocumentEditorPane, u as TiptapEditor } from "./document-editor-pane-
|
|
1
|
+
import { a as useCollaborators, c as useYjsState, d as EditorToolbar, f as EditorProvider, i as useCollaboratorPresence, l as CollaboratorsList, o as useDocumentChanges, p as useEditorContext, r as useAwareness, s as useEditorConnection, t as DocumentEditorPane, u as TiptapEditor } from "./document-editor-pane-POsq5Q0o.js";
|
|
2
2
|
export { CollaboratorsList, DocumentEditorPane, EditorProvider, EditorToolbar, TiptapEditor, useAwareness, useCollaboratorPresence, useCollaborators, useDocumentChanges, useEditorConnection, useEditorContext, useYjsState };
|
|
@@ -5,7 +5,7 @@ import { t as ArtifactPane } from "./artifact-pane-DMXT9a8U.js";
|
|
|
5
5
|
import { n as CopyButton, t as CodeBlock } from "./code-block-B36KVUSN.js";
|
|
6
6
|
import { t as formatBytes } from "./format-DfcLWqMa.js";
|
|
7
7
|
import { i as getFormatLabel, n as fileExtension, o as resolveFilePreviewKind, r as getCodeLanguage, t as detectFileFormat } from "./file-format-BgXbr-Ib.js";
|
|
8
|
-
import { t as Markdown } from "./markdown-
|
|
8
|
+
import { t as Markdown } from "./markdown-Db08KAYF.js";
|
|
9
9
|
import { Suspense, lazy, useEffect, useMemo, useState } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { ChevronRight, Download, File, FileCode, FileImage, FileJson, FileSpreadsheet, FileText, Folder, FolderOpen, Music, X } from "lucide-react";
|
|
@@ -647,7 +647,7 @@ function FileTabs({ tabs, activeId, onSelect, onClose, className }) {
|
|
|
647
647
|
//#endregion
|
|
648
648
|
//#region src/files/file-artifact-pane.tsx
|
|
649
649
|
const LazyDocumentEditorPane = lazy(async () => {
|
|
650
|
-
return { default: (await import("./document-editor-pane-
|
|
650
|
+
return { default: (await import("./document-editor-pane-POsq5Q0o.js").then((n) => n.n)).DocumentEditorPane };
|
|
651
651
|
});
|
|
652
652
|
/**
|
|
653
653
|
* FileArtifactPane — opinionated artifact frame for file previews with tabs and
|
|
@@ -707,6 +707,7 @@ function FileArtifactPane({ filename, content, blobUrl, mimeType, size, onClose,
|
|
|
707
707
|
headerClassName,
|
|
708
708
|
hideTitleBlock,
|
|
709
709
|
markdown: content ?? "",
|
|
710
|
+
savedMarkdown: editor.savedContent,
|
|
710
711
|
urlTransform,
|
|
711
712
|
mode: editor.mode,
|
|
712
713
|
defaultMode: editor.defaultMode,
|
package/dist/files.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as FileNode, D as filterFileTree, E as FileTreeVisibilityOptions, S as RichFileTreeThemeVars, T as FileTreeProps, _ as parseCsv, a as getCodeLanguage, b as RichFileTreeGitStatus, c as resolveFilePreviewKind, d as FileTabData, f as FileTabs, g as FilePreviewProps, h as FilePreview, i as fileExtension, l as FileArtifactPane, m as CSV_PREVIEW_ROW_LIMIT, n as FilePreviewKind, o as getFormatLabel, p as FileTabsProps, r as detectFileFormat, s as getSyntaxLanguage, t as FileFormat, u as FileArtifactPaneProps, v as RichFileTree, w as FileTree, x as RichFileTreeProps, y as RichFileTreeGitEntry } from "./index-
|
|
1
|
+
import { C as FileNode, D as filterFileTree, E as FileTreeVisibilityOptions, S as RichFileTreeThemeVars, T as FileTreeProps, _ as parseCsv, a as getCodeLanguage, b as RichFileTreeGitStatus, c as resolveFilePreviewKind, d as FileTabData, f as FileTabs, g as FilePreviewProps, h as FilePreview, i as fileExtension, l as FileArtifactPane, m as CSV_PREVIEW_ROW_LIMIT, n as FilePreviewKind, o as getFormatLabel, p as FileTabsProps, r as detectFileFormat, s as getSyntaxLanguage, t as FileFormat, u as FileArtifactPaneProps, v as RichFileTree, w as FileTree, x as RichFileTreeProps, y as RichFileTreeGitEntry } from "./index-CJ8wRfiC.js";
|
|
2
2
|
export { CSV_PREVIEW_ROW_LIMIT, FileArtifactPane, type FileArtifactPaneProps, type FileFormat, type FileNode, FilePreview, type FilePreviewKind, type FilePreviewProps, type FileTabData, FileTabs, type FileTabsProps, FileTree, type FileTreeProps, type FileTreeVisibilityOptions, RichFileTree, type RichFileTreeGitEntry, type RichFileTreeGitStatus, type RichFileTreeProps, type RichFileTreeThemeVars, detectFileFormat, fileExtension, filterFileTree, getCodeLanguage, getFormatLabel, getSyntaxLanguage, parseCsv, resolveFilePreviewKind };
|
package/dist/files.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as getSyntaxLanguage, i as getFormatLabel, n as fileExtension, o as resolveFilePreviewKind, r as getCodeLanguage, t as detectFileFormat } from "./file-format-BgXbr-Ib.js";
|
|
2
|
-
import { a as parseCsv, c as filterFileTree, i as FilePreview, n as FileTabs, o as RichFileTree, r as CSV_PREVIEW_ROW_LIMIT, s as FileTree, t as FileArtifactPane } from "./files-
|
|
2
|
+
import { a as parseCsv, c as filterFileTree, i as FilePreview, n as FileTabs, o as RichFileTree, r as CSV_PREVIEW_ROW_LIMIT, s as FileTree, t as FileArtifactPane } from "./files-hywocVZz.js";
|
|
3
3
|
export { CSV_PREVIEW_ROW_LIMIT, FileArtifactPane, FilePreview, FileTabs, FileTree, RichFileTree, detectFileFormat, fileExtension, filterFileTree, getCodeLanguage, getFormatLabel, getSyntaxLanguage, parseCsv, resolveFilePreviewKind };
|
package/dist/hooks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as useRunCollapseState, r as useRunGroups, t as useAutoScroll } from "./use-auto-scroll-C5Pjeqon.js";
|
|
2
|
-
import { a as useToolCallStream, i as useRealtimeSession, n as useSdkSession, o as useDropdownMenu, r as RealtimeSessionRegistry, t as useSSEStream } from "./use-sse-stream-
|
|
2
|
+
import { a as useToolCallStream, i as useRealtimeSession, n as useSdkSession, o as useDropdownMenu, r as RealtimeSessionRegistry, t as useSSEStream } from "./use-sse-stream-DjqRuDft.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
//#region src/hooks/use-live-time.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as DocumentEditorPaneCollaborationConfig, n as DocumentEditorMode, t as DocumentEditorBackend } from "./document-editor-pane-
|
|
1
|
+
import { i as DocumentEditorPaneCollaborationConfig, n as DocumentEditorMode, t as DocumentEditorBackend } from "./document-editor-pane-BilJfiCo.js";
|
|
2
2
|
import { n as ArtifactPaneProps } from "./artifact-pane-BL_DFWNl.js";
|
|
3
3
|
import { CSSProperties, ReactNode } from "react";
|
|
4
4
|
import { UrlTransform } from "react-markdown";
|
|
@@ -142,6 +142,8 @@ declare function FileTabs({ tabs, activeId, onSelect, onClose, className }: File
|
|
|
142
142
|
//#region src/files/file-artifact-pane.d.ts
|
|
143
143
|
interface FileArtifactPaneEditorOptions {
|
|
144
144
|
enabled?: boolean;
|
|
145
|
+
/** Persisted baseline when content is the current draft. */
|
|
146
|
+
savedContent?: string;
|
|
145
147
|
mode?: DocumentEditorMode;
|
|
146
148
|
defaultMode?: DocumentEditorMode;
|
|
147
149
|
onModeChange?: (mode: DocumentEditorMode) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { _ as OpenUITableNode, a as OpenUIBadgeNode, c as OpenUIComponentNode, d
|
|
|
10
10
|
import { _ as UserMessageProps, a as AgentTimelineMessageItem, b as ChatContainer, c as AgentTimelineTone, d as ThinkingIndicator, f as ThinkingIndicatorProps, g as UserMessage, h as MessageRole, i as AgentTimelineItem, l as AgentTimelineToolGroupItem, m as ChatMessageProps, n as AgentTimelineArtifactItem, o as AgentTimelineProps, p as ChatMessage, r as AgentTimelineCustomItem, s as AgentTimelineStatusItem, t as AgentTimeline, u as AgentTimelineToolItem, v as MessageList, x as ChatContainerProps, y as MessageListProps } from "./index-Cs7j8V7l.js";
|
|
11
11
|
import { a as parseToolEvent, i as ToolCallFeedProps, n as ToolCallData, o as ToolCallStatus, r as ToolCallFeed, s as ToolCallType, t as FeedSegment } from "./tool-call-feed-BeB1_4pX.js";
|
|
12
12
|
import { n as ArtifactPaneProps, t as ArtifactPane } from "./artifact-pane-BL_DFWNl.js";
|
|
13
|
-
import { C as FileNode, D as filterFileTree, E as FileTreeVisibilityOptions, S as RichFileTreeThemeVars, T as FileTreeProps, _ as parseCsv, a as getCodeLanguage, b as RichFileTreeGitStatus, c as resolveFilePreviewKind, d as FileTabData, f as FileTabs, g as FilePreviewProps, h as FilePreview, i as fileExtension, l as FileArtifactPane, m as CSV_PREVIEW_ROW_LIMIT, n as FilePreviewKind, o as getFormatLabel, p as FileTabsProps, r as detectFileFormat, s as getSyntaxLanguage, t as FileFormat, u as FileArtifactPaneProps, v as RichFileTree, w as FileTree, x as RichFileTreeProps, y as RichFileTreeGitEntry } from "./index-
|
|
13
|
+
import { C as FileNode, D as filterFileTree, E as FileTreeVisibilityOptions, S as RichFileTreeThemeVars, T as FileTreeProps, _ as parseCsv, a as getCodeLanguage, b as RichFileTreeGitStatus, c as resolveFilePreviewKind, d as FileTabData, f as FileTabs, g as FilePreviewProps, h as FilePreview, i as fileExtension, l as FileArtifactPane, m as CSV_PREVIEW_ROW_LIMIT, n as FilePreviewKind, o as getFormatLabel, p as FileTabsProps, r as detectFileFormat, s as getSyntaxLanguage, t as FileFormat, u as FileArtifactPaneProps, v as RichFileTree, w as FileTree, x as RichFileTreeProps, y as RichFileTreeGitEntry } from "./index-CJ8wRfiC.js";
|
|
14
14
|
import { A as useRunGroups, C as SdkSessionSeed, D as UseToolCallStreamReturn, E as useSdkSession, M as useDropdownMenu, N as useAutoScroll, O as useToolCallStream, S as SdkSessionEvent, T as UseSdkSessionReturn, _ as AppendUserMessageOptions, a as SSEEvent, b as CompleteAssistantMessageOptions, c as UseSSEStreamOptions, d as RealtimeSessionOptions, f as RealtimeSessionRegistry, g as useRealtimeSession, h as RealtimeSessionTarget, i as ConnectionState, j as useRunCollapseState, k as UseRunGroupsOptions, l as UseSSEStreamResult, m as RealtimeSessionState, n as AutomationStreamEvent, o as TaskStreamEvent, p as RealtimeSessionRegistryProps, r as BotStreamEvent, s as TerminalStreamEvent, t as AgentStreamEvent, u as useSSEStream, v as ApplySdkEventOptions, w as UseSdkSessionOptions, x as SdkSessionAttachment, y as BeginAssistantMessageOptions } from "./use-sse-stream-Dm6R5YWz.js";
|
|
15
15
|
import { A as updateActiveSessionMeta, C as resetActiveSessions, D as setActiveSessionRunning, E as setActiveSessionError, F as useNavbarSessions, I as useProjectActivity, L as useProjectSessions, M as useActiveSessions, N as useActiveSessionsState, O as setForegroundActiveSession, P as useHasBackgroundRunningSessions, R as useSessionsByActivity, S as registerActiveSession, T as setActiveSessionConnection, _ as getSessionsByActivity, a as ActiveSessionReconnectState, b as getTotalRunningSessionCount, c as ActiveSessionTransportMode, d as SessionProjectKey, f as activeSessionsAtom, g as getAllProjectActivity, h as getAllActiveSessions, i as ActiveSessionConnectionState, j as useActiveSession, k as unregisterActiveSession, l as ActiveSessionsState, m as getActiveSession, n as ActiveSessionActivityOptions, o as ActiveSessionRecord, p as bumpActiveSessionActivity, r as ActiveSessionConnectionOptions, s as ActiveSessionStatus, t as ActiveProjectActivity, u as RegisterActiveSessionOptions, v as getSessionsForNavbar, w as setActiveSessionAttention, x as hasBackgroundRunningSessions, y as getSessionsForProject, z as useTotalRunningSessions } from "./active-sessions-store-nl70ZnMC.js";
|
|
16
16
|
import { AuthUser, UseAuthOptions, UseAuthResult, createAuthFetcher, useApiKey, useAuth, useLiveTime } from "./hooks.js";
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { a as focusRingInset, i as focusRing, n as focusFieldInvalid, r as focus
|
|
|
3
3
|
import { t as cn } from "./utils-C_uf36nf.js";
|
|
4
4
|
import { n as buttonVariants, t as Button } from "./button-C87nEe2R.js";
|
|
5
5
|
import { a as TableFooter, c as TableRow, d as Card, f as CardContent, g as CardTitle, h as CardHeader, i as TableCell, l as Badge, m as CardFooter, n as TableBody, o as TableHead, p as CardDescription, r as TableCaption, s as TableHeader, t as Table, u as badgeVariants } from "./table-Bss73DhB.js";
|
|
6
|
-
import { A as SegmentedControl, B as SelectValue, C as ToastProvider, D as SkeletonTable, E as SkeletonCard, F as SelectLabel, G as DialogContent, H as Textarea, I as SelectScrollDownButton, J as DialogHeader, K as DialogDescription, L as SelectScrollUpButton, M as SelectContent, N as SelectGroup, O as Switch, P as SelectItem, Q as DialogTrigger, R as SelectSeparator, S as ToastContainer, T as Skeleton, U as Dialog, V as Input, W as DialogClose, X as DialogPortal, Y as DialogOverlay, Z as DialogTitle, _ as TerminalInput, a as Metric, b as EmptyState, c as PageHeader, d as InlineCode, f as SidebarDropZone, g as TerminalDisplay, h as TerminalCursor, i as Toolbar, j as Select, k as Progress, l as ThemeToggle, m as DropZone, n as TangleKnot, o as MetricStrip, p as UploadProgress, q as DialogFooter, r as FilterField, s as StatusPill, t as Logo, u as useTheme, v as TerminalLine, w as useToast, x as Label, y as StatCard, z as SelectTrigger } from "./primitives-
|
|
6
|
+
import { A as SegmentedControl, B as SelectValue, C as ToastProvider, D as SkeletonTable, E as SkeletonCard, F as SelectLabel, G as DialogContent, H as Textarea, I as SelectScrollDownButton, J as DialogHeader, K as DialogDescription, L as SelectScrollUpButton, M as SelectContent, N as SelectGroup, O as Switch, P as SelectItem, Q as DialogTrigger, R as SelectSeparator, S as ToastContainer, T as Skeleton, U as Dialog, V as Input, W as DialogClose, X as DialogPortal, Y as DialogOverlay, Z as DialogTitle, _ as TerminalInput, a as Metric, b as EmptyState, c as PageHeader, d as InlineCode, f as SidebarDropZone, g as TerminalDisplay, h as TerminalCursor, i as Toolbar, j as Select, k as Progress, l as ThemeToggle, m as DropZone, n as TangleKnot, o as MetricStrip, p as UploadProgress, q as DialogFooter, r as FilterField, s as StatusPill, t as Logo, u as useTheme, v as TerminalLine, w as useToast, x as Label, y as StatCard, z as SelectTrigger } from "./primitives-Bx59fT-U.js";
|
|
7
7
|
import { _ as AvatarFallback, a as DropdownMenuItem, c as DropdownMenuRadioGroup, d as DropdownMenuShortcut, f as DropdownMenuSub, g as Avatar, h as DropdownMenuTrigger, i as DropdownMenuGroup, l as DropdownMenuRadioItem, m as DropdownMenuSubTrigger, n as DropdownMenuCheckboxItem, o as DropdownMenuLabel, p as DropdownMenuSubContent, r as DropdownMenuContent, s as DropdownMenuPortal, t as DropdownMenu, u as DropdownMenuSeparator, v as AvatarImage } from "./dropdown-menu-BpcLa5vF.js";
|
|
8
8
|
import { i as TabsTrigger, n as TabsContent, r as TabsList, t as Tabs } from "./tabs-BVHR6NkO.js";
|
|
9
9
|
import { t as TextShimmer } from "./text-shimmer-BUUo6I-g.js";
|
|
@@ -15,17 +15,17 @@ import { i as truncateText, n as formatDuration, r as formatUptime, t as formatB
|
|
|
15
15
|
import { a as GrepResultsPreview, i as GlobResultsPreview, n as QuestionPreview, o as WriteFilePreview, r as WebSearchPreview, s as CommandPreview, t as DiffPreview } from "./diff-preview-BcK3nRXb.js";
|
|
16
16
|
import { a as getSyntaxLanguage, i as getFormatLabel, n as fileExtension, o as resolveFilePreviewKind, r as getCodeLanguage, t as detectFileFormat } from "./file-format-BgXbr-Ib.js";
|
|
17
17
|
import { a as RunRowStatusDot, i as RunRowShell, o as ExpandedToolDetail, r as InlineToolItem } from "./tool-call-step-DNebqhmX.js";
|
|
18
|
-
import { n as getSanitizedMarkdownHeadingIdFromRawFragment, t as Markdown } from "./markdown-
|
|
19
|
-
import { n as InlineThinkingItem, t as RunGroup } from "./run-group-
|
|
20
|
-
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-
|
|
21
|
-
import { a as MessageList, i as ThinkingIndicator, n as ChatContainer, o as UserMessage, r as AgentTimeline, t as ChatMessage } from "./chat-
|
|
18
|
+
import { n as getSanitizedMarkdownHeadingIdFromRawFragment, t as Markdown } from "./markdown-Db08KAYF.js";
|
|
19
|
+
import { n as InlineThinkingItem, t as RunGroup } from "./run-group-BWGeesgs.js";
|
|
20
|
+
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-DG_i2lOR.js";
|
|
21
|
+
import { a as MessageList, i as ThinkingIndicator, n as ChatContainer, o as UserMessage, r as AgentTimeline, t as ChatMessage } from "./chat-DDvF2oGQ.js";
|
|
22
22
|
import { t as LiveDuration } from "./run-ZsIKPA6J.js";
|
|
23
|
-
import { n as parseToolEvent, t as ToolCallFeed } from "./tool-call-feed-
|
|
23
|
+
import { n as parseToolEvent, t as ToolCallFeed } from "./tool-call-feed-BpmMLpPX.js";
|
|
24
24
|
import "./openui.js";
|
|
25
|
-
import { a as parseCsv, c as filterFileTree, i as FilePreview, n as FileTabs, o as RichFileTree, r as CSV_PREVIEW_ROW_LIMIT, s as FileTree, t as FileArtifactPane } from "./files-
|
|
25
|
+
import { a as parseCsv, c as filterFileTree, i as FilePreview, n as FileTabs, o as RichFileTree, r as CSV_PREVIEW_ROW_LIMIT, s as FileTree, t as FileArtifactPane } from "./files-hywocVZz.js";
|
|
26
26
|
import "./markdown.js";
|
|
27
27
|
import { i as UserMenu, n as AuthHeader, r as GitHubLoginButton, t as LoginLayout } from "./auth-DOETfnd9.js";
|
|
28
|
-
import { a as useToolCallStream, i as useRealtimeSession, n as useSdkSession, o as useDropdownMenu, r as RealtimeSessionRegistry, t as useSSEStream } from "./use-sse-stream-
|
|
28
|
+
import { a as useToolCallStream, i as useRealtimeSession, n as useSdkSession, o as useDropdownMenu, r as RealtimeSessionRegistry, t as useSSEStream } from "./use-sse-stream-DjqRuDft.js";
|
|
29
29
|
import { C as useHasBackgroundRunningSessions, D as useSessionsByActivity, E as useProjectSessions, O as useTotalRunningSessions, S as useActiveSessionsState, T as useProjectActivity, _ as setForegroundActiveSession, a as getAllProjectActivity, b as useActiveSession, c as getSessionsForProject, d as registerActiveSession, f as resetActiveSessions, g as setActiveSessionRunning, h as setActiveSessionError, i as getAllActiveSessions, l as getTotalRunningSessionCount, m as setActiveSessionConnection, n as bumpActiveSessionActivity, o as getSessionsByActivity, p as setActiveSessionAttention, r as getActiveSession, s as getSessionsForNavbar, t as activeSessionsAtom, u as hasBackgroundRunningSessions, v as unregisterActiveSession, w as useNavbarSessions, x as useActiveSessions, y as updateActiveSessionMeta } from "./active-sessions-store-Gt1R0rFG.js";
|
|
30
30
|
import { createAuthFetcher, useApiKey, useAuth, useLiveTime } from "./hooks.js";
|
|
31
31
|
import { addMessage, addParts, clearChat, isStreamingAtom, messagesAtom, partMapAtom, updatePart } from "./stores.js";
|
|
@@ -46,7 +46,7 @@ const Markdown = memo(({ children, className, urlTransform }) => {
|
|
|
46
46
|
const language = /language-(\w+)/.exec(codeClass || "")?.[1];
|
|
47
47
|
const code = String(codeChildren).replace(/\n$/, "");
|
|
48
48
|
if (!language && !code.includes("\n")) return /* @__PURE__ */ jsx("code", {
|
|
49
|
-
className: cn("px-1.5 py-0.5 rounded border border-border bg-
|
|
49
|
+
className: cn("px-1.5 py-0.5 rounded border border-border bg-muted text-foreground text-[0.85em] font-mono", codeClass),
|
|
50
50
|
...rest,
|
|
51
51
|
children: codeChildren
|
|
52
52
|
});
|
package/dist/markdown.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as CopyButton, t as CodeBlock } from "./code-block-B36KVUSN.js";
|
|
2
|
-
import { n as getSanitizedMarkdownHeadingIdFromRawFragment, t as Markdown } from "./markdown-
|
|
2
|
+
import { n as getSanitizedMarkdownHeadingIdFromRawFragment, t as Markdown } from "./markdown-Db08KAYF.js";
|
|
3
3
|
export { CodeBlock, CopyButton, Markdown, getSanitizedMarkdownHeadingIdFromRawFragment };
|
|
@@ -3,7 +3,7 @@ import { t as cn } from "./utils-C_uf36nf.js";
|
|
|
3
3
|
import { t as Button } from "./button-C87nEe2R.js";
|
|
4
4
|
import { c as TableRow, d as Card, f as CardContent, g as CardTitle, h as CardHeader, i as TableCell, l as Badge, n as TableBody, o as TableHead, p as CardDescription, s as TableHeader, t as Table } from "./table-Bss73DhB.js";
|
|
5
5
|
import { t as CodeBlock } from "./code-block-B36KVUSN.js";
|
|
6
|
-
import { t as Markdown } from "./markdown-
|
|
6
|
+
import { t as Markdown } from "./markdown-Db08KAYF.js";
|
|
7
7
|
import { Fragment } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Minus } from "lucide-react";
|
package/dist/openui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as OPENUI_NODE_TYPES, i as OPENUI_NODE_JSON_SCHEMA, n as validateOpenUIJsonArtifact, r as validateOpenUIJsonNode, t as findUnsupportedOpenUINode } from "./schema-BpW9rSSG.js";
|
|
2
|
-
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-
|
|
2
|
+
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-DG_i2lOR.js";
|
|
3
3
|
export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, OpenUIArtifactRenderer, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
|
|
@@ -929,7 +929,7 @@ function SidebarDropZone({ onDrop, accept, disabled, title = "Drop files here",
|
|
|
929
929
|
//#region src/primitives/code-block.tsx
|
|
930
930
|
function InlineCode({ className, children, ...props }) {
|
|
931
931
|
return /* @__PURE__ */ jsx("code", {
|
|
932
|
-
className: cn("rounded border border-border bg-
|
|
932
|
+
className: cn("rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground", className),
|
|
933
933
|
...props,
|
|
934
934
|
children
|
|
935
935
|
});
|
package/dist/primitives.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as buttonVariants, t as Button } from "./button-C87nEe2R.js";
|
|
2
2
|
import { a as TableFooter, c as TableRow, d as Card, f as CardContent, g as CardTitle, h as CardHeader, i as TableCell, l as Badge, m as CardFooter, n as TableBody, o as TableHead, p as CardDescription, r as TableCaption, s as TableHeader, t as Table, u as badgeVariants } from "./table-Bss73DhB.js";
|
|
3
|
-
import { A as SegmentedControl, B as SelectValue, C as ToastProvider, D as SkeletonTable, E as SkeletonCard, F as SelectLabel, G as DialogContent, H as Textarea, I as SelectScrollDownButton, J as DialogHeader, K as DialogDescription, L as SelectScrollUpButton, M as SelectContent, N as SelectGroup, O as Switch, P as SelectItem, Q as DialogTrigger, R as SelectSeparator, S as ToastContainer, T as Skeleton, U as Dialog, V as Input, W as DialogClose, X as DialogPortal, Y as DialogOverlay, Z as DialogTitle, _ as TerminalInput, a as Metric, b as EmptyState, c as PageHeader, d as InlineCode, f as SidebarDropZone, g as TerminalDisplay, h as TerminalCursor, i as Toolbar, j as Select, k as Progress, l as ThemeToggle, m as DropZone, n as TangleKnot, o as MetricStrip, p as UploadProgress, q as DialogFooter, r as FilterField, s as StatusPill, t as Logo, u as useTheme, v as TerminalLine, w as useToast, x as Label, y as StatCard, z as SelectTrigger } from "./primitives-
|
|
3
|
+
import { A as SegmentedControl, B as SelectValue, C as ToastProvider, D as SkeletonTable, E as SkeletonCard, F as SelectLabel, G as DialogContent, H as Textarea, I as SelectScrollDownButton, J as DialogHeader, K as DialogDescription, L as SelectScrollUpButton, M as SelectContent, N as SelectGroup, O as Switch, P as SelectItem, Q as DialogTrigger, R as SelectSeparator, S as ToastContainer, T as Skeleton, U as Dialog, V as Input, W as DialogClose, X as DialogPortal, Y as DialogOverlay, Z as DialogTitle, _ as TerminalInput, a as Metric, b as EmptyState, c as PageHeader, d as InlineCode, f as SidebarDropZone, g as TerminalDisplay, h as TerminalCursor, i as Toolbar, j as Select, k as Progress, l as ThemeToggle, m as DropZone, n as TangleKnot, o as MetricStrip, p as UploadProgress, q as DialogFooter, r as FilterField, s as StatusPill, t as Logo, u as useTheme, v as TerminalLine, w as useToast, x as Label, y as StatCard, z as SelectTrigger } from "./primitives-Bx59fT-U.js";
|
|
4
4
|
import { _ as AvatarFallback, a as DropdownMenuItem, c as DropdownMenuRadioGroup, d as DropdownMenuShortcut, f as DropdownMenuSub, g as Avatar, h as DropdownMenuTrigger, i as DropdownMenuGroup, l as DropdownMenuRadioItem, m as DropdownMenuSubTrigger, n as DropdownMenuCheckboxItem, o as DropdownMenuLabel, p as DropdownMenuSubContent, r as DropdownMenuContent, s as DropdownMenuPortal, t as DropdownMenu, u as DropdownMenuSeparator, v as AvatarImage } from "./dropdown-menu-BpcLa5vF.js";
|
|
5
5
|
import { i as TabsTrigger, n as TabsContent, r as TabsList, t as Tabs } from "./tabs-BVHR6NkO.js";
|
|
6
6
|
import { t as TextShimmer } from "./text-shimmer-BUUo6I-g.js";
|
|
@@ -2,8 +2,8 @@ import { t as cn } from "./utils-C_uf36nf.js";
|
|
|
2
2
|
import { t as TextShimmer } from "./text-shimmer-BUUo6I-g.js";
|
|
3
3
|
import { i as truncateText, n as formatDuration } from "./format-DfcLWqMa.js";
|
|
4
4
|
import { i as RunRowShell, r as InlineToolItem, s as ExpandableContent } from "./tool-call-step-DNebqhmX.js";
|
|
5
|
-
import { t as Markdown } from "./markdown-
|
|
6
|
-
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-
|
|
5
|
+
import { t as Markdown } from "./markdown-Db08KAYF.js";
|
|
6
|
+
import { t as OpenUIArtifactRenderer } from "./openui-artifact-renderer-DG_i2lOR.js";
|
|
7
7
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Bot, Brain, ChevronDown, ChevronRight, ClipboardList, FileEdit, FileSearch, Globe, Loader2, PencilLine, Search, Settings, Sparkles, Terminal } from "lucide-react";
|
package/dist/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as RunRowStatusDot, i as RunRowShell, o as ExpandedToolDetail, r as InlineToolItem } from "./tool-call-step-DNebqhmX.js";
|
|
2
|
-
import { n as InlineThinkingItem, t as RunGroup } from "./run-group-
|
|
2
|
+
import { n as InlineThinkingItem, t as RunGroup } from "./run-group-BWGeesgs.js";
|
|
3
3
|
import { t as LiveDuration } from "./run-ZsIKPA6J.js";
|
|
4
|
-
import { n as parseToolEvent, t as ToolCallFeed } from "./tool-call-feed-
|
|
4
|
+
import { n as parseToolEvent, t as ToolCallFeed } from "./tool-call-feed-BpmMLpPX.js";
|
|
5
5
|
export { ExpandedToolDetail, InlineThinkingItem, InlineToolItem, LiveDuration, RunGroup, RunRowShell, RunRowStatusDot, ToolCallFeed, parseToolEvent };
|
package/dist/sdk-hooks.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as useRunCollapseState, r as useRunGroups, t as useAutoScroll } from "./use-auto-scroll-C5Pjeqon.js";
|
|
2
|
-
import { a as useToolCallStream, i as useRealtimeSession, n as useSdkSession, o as useDropdownMenu, r as RealtimeSessionRegistry, t as useSSEStream } from "./use-sse-stream-
|
|
2
|
+
import { a as useToolCallStream, i as useRealtimeSession, n as useSdkSession, o as useDropdownMenu, r as RealtimeSessionRegistry, t as useSSEStream } from "./use-sse-stream-DjqRuDft.js";
|
|
3
3
|
export { RealtimeSessionRegistry, useAutoScroll, useDropdownMenu, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useToolCallStream };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as cn } from "./utils-C_uf36nf.js";
|
|
2
2
|
import { n as ToolCallStep, t as ToolCallGroup } from "./tool-call-step-DNebqhmX.js";
|
|
3
|
-
import { t as Markdown } from "./markdown-
|
|
3
|
+
import { t as Markdown } from "./markdown-Db08KAYF.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/run/tool-call-feed.tsx
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as parseToolEvent } from "./tool-call-feed-
|
|
1
|
+
import { n as parseToolEvent } from "./tool-call-feed-BpmMLpPX.js";
|
|
2
2
|
import { _ as setForegroundActiveSession, d as registerActiveSession, g as setActiveSessionRunning, h as setActiveSessionError, m as setActiveSessionConnection, n as bumpActiveSessionActivity, p as setActiveSessionAttention, v as unregisterActiveSession, y as updateActiveSessionMeta } from "./active-sessions-store-Gt1R0rFG.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/ui",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.12.0",
|
|
4
4
|
"description": "Generic React UI components for Tangle products — primitives, chat, run, files, editor, markdown.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"peerDependencies": {
|
|
143
143
|
"@hocuspocus/provider": ">=2.15.0 <5.0.0",
|
|
144
144
|
"@nanostores/react": ">=0.8.4 <3.0.0",
|
|
145
|
-
"@tangle-network/brand": "^1.9.
|
|
145
|
+
"@tangle-network/brand": "^1.9.1",
|
|
146
146
|
"@tiptap/core": ">=3.20.4 <4.0.0",
|
|
147
147
|
"@tiptap/extension-collaboration": ">=3.20.4 <4.0.0",
|
|
148
148
|
"@tiptap/extension-collaboration-caret": ">=3.7.0 <4.0.0",
|
|
@@ -37,6 +37,8 @@ export interface DocumentEditorPaneProps
|
|
|
37
37
|
tabs?: ArtifactPaneProps["tabs"];
|
|
38
38
|
toolbar?: ReactNode;
|
|
39
39
|
markdown?: string;
|
|
40
|
+
/** Persisted baseline when the host controls the current markdown draft. */
|
|
41
|
+
savedMarkdown?: string;
|
|
40
42
|
/** Transform Markdown links and images through the shared URL policy. */
|
|
41
43
|
urlTransform?: UrlTransform;
|
|
42
44
|
mode?: DocumentEditorMode;
|
|
@@ -191,6 +193,7 @@ export function DocumentEditorPane({
|
|
|
191
193
|
tabs,
|
|
192
194
|
toolbar,
|
|
193
195
|
markdown = "",
|
|
196
|
+
savedMarkdown,
|
|
194
197
|
urlTransform,
|
|
195
198
|
mode,
|
|
196
199
|
defaultMode = "preview",
|
|
@@ -212,7 +215,7 @@ export function DocumentEditorPane({
|
|
|
212
215
|
useState<DocumentEditorMode>(defaultMode);
|
|
213
216
|
const activeMode = mode ?? uncontrolledMode;
|
|
214
217
|
const isCollaborative = backend === "collaborative" && Boolean(collaboration);
|
|
215
|
-
const isDirty = normalizeMarkdown(draft) !== normalizeMarkdown(markdown);
|
|
218
|
+
const isDirty = normalizeMarkdown(draft) !== normalizeMarkdown(savedMarkdown ?? markdown);
|
|
216
219
|
const saveStateLabel = readOnly
|
|
217
220
|
? "Read only"
|
|
218
221
|
: isCollaborative
|
|
@@ -231,3 +231,26 @@ describe("parseCsv", () => {
|
|
|
231
231
|
expect(parseCsv("\n\n")).toEqual([]);
|
|
232
232
|
});
|
|
233
233
|
});
|
|
234
|
+
|
|
235
|
+
describe("FileArtifactPane controlled drafts", () => {
|
|
236
|
+
it("retains a host draft and saves it against the persisted baseline", async () => {
|
|
237
|
+
const onSave = vi.fn();
|
|
238
|
+
const draft = "# Unsaved source draft";
|
|
239
|
+
const props = {
|
|
240
|
+
filename: "notes.md",
|
|
241
|
+
content: draft,
|
|
242
|
+
editor: { enabled: true, savedContent: "# Saved notes", onSave },
|
|
243
|
+
};
|
|
244
|
+
const view = render(<FileArtifactPane {...props} />);
|
|
245
|
+
const save = await screen.findByRole("button", { name: "Save changes" });
|
|
246
|
+
expect(screen.getByRole("heading", { name: "Unsaved source draft" })).toBeVisible();
|
|
247
|
+
expect(screen.getByText("Unsaved changes")).toBeVisible();
|
|
248
|
+
expect(save).toBeEnabled();
|
|
249
|
+
fireEvent.click(save);
|
|
250
|
+
expect(onSave).toHaveBeenCalledWith(draft);
|
|
251
|
+
|
|
252
|
+
view.rerender(<FileArtifactPane {...props} editor={{ ...props.editor, savedContent: draft }} />);
|
|
253
|
+
expect(screen.getByText("Saved")).toBeVisible();
|
|
254
|
+
expect(save).toBeDisabled();
|
|
255
|
+
});
|
|
256
|
+
});
|
|
@@ -18,6 +18,8 @@ const LazyDocumentEditorPane = lazy(async () => {
|
|
|
18
18
|
|
|
19
19
|
export interface FileArtifactPaneEditorOptions {
|
|
20
20
|
enabled?: boolean;
|
|
21
|
+
/** Persisted baseline when content is the current draft. */
|
|
22
|
+
savedContent?: string;
|
|
21
23
|
mode?: DocumentEditorMode;
|
|
22
24
|
defaultMode?: DocumentEditorMode;
|
|
23
25
|
onModeChange?: (mode: DocumentEditorMode) => void;
|
|
@@ -155,6 +157,7 @@ export function FileArtifactPane({
|
|
|
155
157
|
headerClassName={headerClassName}
|
|
156
158
|
hideTitleBlock={hideTitleBlock}
|
|
157
159
|
markdown={content ?? ""}
|
|
160
|
+
savedMarkdown={editor.savedContent}
|
|
158
161
|
urlTransform={urlTransform}
|
|
159
162
|
mode={editor.mode}
|
|
160
163
|
defaultMode={editor.defaultMode}
|
|
@@ -73,8 +73,8 @@ describe("Markdown", () => {
|
|
|
73
73
|
const inlineCode = container.querySelector("code");
|
|
74
74
|
|
|
75
75
|
expect(inlineCode).toHaveClass("border-border");
|
|
76
|
-
expect(inlineCode).toHaveClass("bg-
|
|
77
|
-
expect(inlineCode).toHaveClass("text-
|
|
76
|
+
expect(inlineCode).toHaveClass("bg-muted");
|
|
77
|
+
expect(inlineCode).toHaveClass("text-foreground");
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it("passes parsed URLs through the typed transform hook", () => {
|
|
@@ -101,3 +101,4 @@ describe("Markdown", () => {
|
|
|
101
101
|
);
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
|
+
|
|
@@ -75,7 +75,7 @@ export const Markdown = memo(({ children, className, urlTransform }: MarkdownPro
|
|
|
75
75
|
return (
|
|
76
76
|
<code
|
|
77
77
|
className={cn(
|
|
78
|
-
"px-1.5 py-0.5 rounded border border-border bg-
|
|
78
|
+
"px-1.5 py-0.5 rounded border border-border bg-muted text-foreground text-[0.85em] font-mono",
|
|
79
79
|
codeClass,
|
|
80
80
|
)}
|
|
81
81
|
{...rest}
|
|
@@ -99,3 +99,4 @@ export const Markdown = memo(({ children, className, urlTransform }: MarkdownPro
|
|
|
99
99
|
);
|
|
100
100
|
});
|
|
101
101
|
Markdown.displayName = "Markdown";
|
|
102
|
+
|
|
@@ -11,7 +11,7 @@ export function InlineCode({ className, children, ...props }: InlineCodeProps) {
|
|
|
11
11
|
return (
|
|
12
12
|
<code
|
|
13
13
|
className={cn(
|
|
14
|
-
"rounded border border-border bg-
|
|
14
|
+
"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground",
|
|
15
15
|
className,
|
|
16
16
|
)}
|
|
17
17
|
{...props}
|
|
@@ -20,3 +20,4 @@ export function InlineCode({ className, children, ...props }: InlineCodeProps) {
|
|
|
20
20
|
</code>
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
|
+
|