@tangle-network/ui 11.36.0 → 11.37.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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @tangle-network/ui
2
2
 
3
+ ## 11.37.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c01503e: Share canonical syntax highlighting, exact-copy feedback and accessible code-tab behavior with Hono. Extend CodeBlock with language examples and request/response/error metadata; add API schema presentation without API-specific data.
8
+
9
+ ### Patch Changes
10
+
11
+ - 6087148: Pin the shared surface motion runtime to the compatible maintained dependency chain so consumers can retain their existing package-age policies.
12
+
13
+ Route Popover through the shared interruptible surface owner and apply the shared control transition to bare buttons.
14
+
15
+ Restore native copy announcements on binding cleanup and omit orphaned tab relationships for a single example.
16
+
3
17
  ## 11.36.0
4
18
 
5
19
  ### Minor Changes
@@ -0,0 +1,2 @@
1
+ import { ApiField, ApiMetadata, CodeExample, CopyFeedback, InteractionBudgets, TokenStyle, apiMetadataText, bindCodeTabs, bindCopyButton, codeBlockGrammar, codePreStyle, codePresentation, codeTextStyle, createCopyFeedback, highlightCode, interactionBudgets, schemaRows, writeClipboard } from "./lib/code-presentation.js";
2
+ export { type ApiField, type ApiMetadata, type CodeExample, type CopyFeedback, type InteractionBudgets, type TokenStyle, apiMetadataText, bindCodeTabs, bindCopyButton, codeBlockGrammar, codePreStyle, codePresentation, codeTextStyle, createCopyFeedback, highlightCode, interactionBudgets, schemaRows, writeClipboard };
@@ -0,0 +1,2 @@
1
+ import { apiMetadataText, bindCodeTabs, bindCopyButton, codeBlockGrammar, codePreStyle, codePresentation, codeTextStyle, createCopyFeedback, highlightCode, interactionBudgets, schemaRows, writeClipboard } from "./lib/code-presentation.js";
2
+ export { apiMetadataText, bindCodeTabs, bindCopyButton, codeBlockGrammar, codePreStyle, codePresentation, codeTextStyle, createCopyFeedback, highlightCode, interactionBudgets, schemaRows, writeClipboard };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ import { FeedSegment, ToolCallData, ToolCallFeed, ToolCallFeedProps, parseToolEv
22
22
  import { AgentTimeline, AgentTimelineArtifactItem, AgentTimelineCustomItem, AgentTimelineItem, AgentTimelineMessageItem, AgentTimelineProps, AgentTimelineStatusItem, AgentTimelineTone, AgentTimelineToolGroupItem, AgentTimelineToolItem } from "./chat/agent-timeline.js";
23
23
  import { TRANSCRIPT_TEXT } from "./chat/transcript-text.js";
24
24
  import "./chat.js";
25
+ import { codeBlockGrammar } from "./lib/code-presentation.js";
25
26
  import { ArtifactPane, ArtifactPaneProps } from "./primitives/artifact-pane.js";
26
27
  import { FileNode, FileTree, FileTreeProps, FileTreeVisibilityOptions, filterFileTree } from "./files/file-tree.js";
27
28
  import { RichFileTree, RichFileTreeGitEntry, RichFileTreeGitStatus, RichFileTreeProps, RichFileTreeThemeVars } from "./files/rich-file-tree.js";
@@ -84,7 +85,7 @@ import { TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine } from "./
84
85
  import { DropZone, DropZoneProps } from "./primitives/drop-zone.js";
85
86
  import { UploadFile, UploadProgress, UploadProgressProps } from "./primitives/upload-progress.js";
86
87
  import { SidebarDropZone, SidebarDropZoneProps } from "./primitives/sidebar-drop-zone.js";
87
- import { CodeBlock, CodeBlockProps, CopyButton, codeBlockGrammar } from "./markdown/code-block.js";
88
+ import { CodeBlock, CodeBlockProps, CopyButton, CopyButtonProps } from "./markdown/code-block.js";
88
89
  import { InlineCode, InlineCodeProps } from "./primitives/code-block.js";
89
90
  import { ThemeToggle, useTheme } from "./primitives/theme-toggle.js";
90
91
  import { Heading, HeadingProps, HeadingVariant } from "./primitives/heading.js";
@@ -113,6 +114,7 @@ import { OpenUISchemaIssue, OpenUISchemaValidation, findUnsupportedOpenUINode, v
113
114
  import "./openui.js";
114
115
  import { fenceInfo } from "./markdown/code-meta.js";
115
116
  import { numericColumns, tableCsv } from "./markdown/markdown-table.js";
117
+ import { ApiSchema, ApiSchemaProps } from "./markdown/api-schema.js";
116
118
  import "./markdown.js";
117
119
  import { addMessage, addParts, clearChat, isStreamingAtom, messagesAtom, partMapAtom, updatePart } from "./stores/chat-store.js";
118
120
  import "./types.js";
@@ -132,4 +134,4 @@ import { QuestionPreview, QuestionPreviewProps } from "./tool-previews/question-
132
134
  import { DiffPreview, DiffPreviewProps } from "./tool-previews/diff-preview.js";
133
135
  import { RedactedDocSegment, RedactedDocument, RedactedDocumentData, RedactedDocumentProps, RevealResult } from "./redaction/redacted-document.js";
134
136
  import "./redaction.js";
135
- export { ActiveProjectActivity, ActiveSessionActivityOptions, ActiveSessionConnectionOptions, ActiveSessionConnectionState, ActiveSessionReconnectState, ActiveSessionRecord, ActiveSessionStatus, ActiveSessionTransportMode, ActiveSessionsState, AgentBranding, AgentStreamEvent, AgentTimeline, type AgentTimelineArtifactItem, type AgentTimelineCustomItem, type AgentTimelineItem, type AgentTimelineMessageItem, type AgentTimelineProps, type AgentTimelineStatusItem, type AgentTimelineTone, type AgentTimelineToolGroupItem, type AgentTimelineToolItem, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTone, AppendUserMessageOptions, ApplySdkEventOptions, ApprovalCard, type ApprovalCardProps, type ApprovalDiffFile, ApprovalDiffSummary, type ApprovalPlanStep, ArtifactPane, type ArtifactPaneProps, AuthHeader, type AuthHeaderProps, AuthUser, AutomationStreamEvent, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, BeginAssistantMessageOptions, BotStreamEvent, Button, type ButtonProps, CATEGORY_TONES, CSV_PREVIEW_ROW_LIMIT, Calendar, type CalendarDate, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardTitleProps, type CategoryTone, ChatAuthor, ChatContainer, type ChatContainerProps, ChatMessage, type ChatMessageProps, Checkbox, Chip, type ChipProps, CodeBlock, type CodeBlockProps, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandPreview, type CommandPreviewProps, CompleteAssistantMessageOptions, ConnectionState, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, CustomToolRenderer, DatePicker, type DatePickerProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffPreview, type DiffPreviewProps, DisplayVariant, DropZone, type DropZoneProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ExpandedToolDetail, type ExpandedToolDetailProps, type FeedSegment, FileArtifactPane, type FileArtifactPaneProps, FileCard, type FileCardProps, type FileDetails, type FileFormat, FileList, type FileListItem, type FileListProps, type FileNode, FilePreview, type FilePreviewKind, type FilePreviewProps, type FileTabData, FileTabs, type FileTabsProps, FileTree, type FileTreeProps, type FileTreeVisibilityOptions, type FileUploader, FilterField, type FilterFieldProps, FinalTextPart, GitHubLoginButton, type GitHubLoginButtonProps, GlobResultsPreview, type GlobResultsPreviewProps, GrepResultsPreview, type GrepResultsPreviewProps, GroupedMessage, Heading, type HeadingProps, type HeadingVariant, HelpText, type HelpTextProps, IconTile, type IconTileProps, InlineCode, type InlineCodeProps, InlineThinkingItem, type InlineThinkingItemProps, InlineToolItem, type InlineToolItemProps, Input, type InputProps, Label, LiveDuration, LoginLayout, type LoginLayoutProps, Logo, type LogoProps, Markdown, type MarkdownLinkChip, type MarkdownLinkChipResolver, type MarkdownProps, MessageAuthor, type MessageAuthorProps, MessageList, type MessageListProps, type MessageRole, MessageRun, MessageUser, Metric, type MetricProps, MetricStrip, type MetricStripProps, OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, type OpenUIAction, type OpenUIActionsNode, OpenUIArtifactRenderer, type OpenUIArtifactRendererProps, type OpenUIBadgeNode, type OpenUICardNode, type OpenUICodeNode, type OpenUIComponentNode, type OpenUIGridNode, type OpenUIHeadingNode, type OpenUIKeyValueNode, type OpenUIMarkdownNode, type OpenUIPrimitive, type OpenUISchemaIssue, type OpenUISchemaValidation, type OpenUISeparatorNode, type OpenUIStackNode, type OpenUIStatNode, type OpenUITableNode, type OpenUITextNode, PageHeader, type PageHeaderProps, PageShell, type PageShellProps, Pagination, type PaginationProps, PdfViewer, type PdfViewerConfig, type PdfViewerProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, QuestionPreview, type QuestionPreviewProps, RadioGroup, RadioGroupItem, RealtimeSessionOptions, RealtimeSessionRegistry, RealtimeSessionRegistryProps, RealtimeSessionState, RealtimeSessionTarget, ReasoningPart, type RedactedDocSegment, RedactedDocument, type RedactedDocumentData, type RedactedDocumentProps, RegisterActiveSessionOptions, type RevealResult, RichFileTree, type RichFileTreeGitEntry, type RichFileTreeGitStatus, type RichFileTreeProps, type RichFileTreeThemeVars, Run, RunGroup, type RunGroupProps, type RunPhase, RunPhaseList, RunRowShell, type RunRowShellProps, type RunRowStatus, RunRowStatusDot, RunStats, SSEEvent, SdkSessionAttachment, SdkSessionEvent, SdkSessionSeed, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SessionMessage, SessionPart, SessionProjectKey, type SessionUser, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarDropZone, type SidebarDropZoneProps, Skeleton, SkeletonCard, SkeletonTable, Slider, StatCard, type StatCardProps, StatusPill, type StatusPillProps, type StatusTone, Switch, TONE_CLASSES, TOOL_CATEGORY_ICONS, TRANSCRIPT_TEXT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, type TagProps, TangleKnot, TaskList, type TaskListItem, type TaskListProps, type TaskStatus, TaskStreamEvent, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, TerminalStreamEvent, TextPart, TextShimmer, type TextShimmerProps, Textarea, type TextareaProps, ThemeToggle, ThinkingIndicator, type ThinkingIndicatorProps, TimeSelect, type TimeSelectProps, type Toast, ToastContainer, ToastProvider, type Tone, type ToneClasses, type ToolCallData, ToolCallFeed, type ToolCallFeedProps, type ToolCallStatus, type ToolCallType, ToolCategory, ToolDisplayMetadata, ToolPart, ToolState, ToolStatus, ToolTime, Toolbar, type ToolbarProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UploadFile, UploadProgress, type UploadProgressProps, UseAuthOptions, UseAuthResult, UseRunGroupsOptions, UseSSEStreamOptions, UseSSEStreamResult, UseSdkSessionOptions, UseSdkSessionReturn, UseToolCallStreamReturn, UserMenu, type UserMenuProps, UserMessage, type UserMessageProps, WebSearchPreview, type WebSearchPreviewProps, WriteFilePreview, type WriteFilePreviewProps, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fileExtension, filterFileTree, findUnsupportedOpenUINode, focusField, focusFieldInvalid, focusFieldWithin, focusRing, focusRingInset, formatBytes, formatCalendarDate, formatDuration, formatUptime, getActiveSession, getAllActiveSessions, getAllProjectActivity, getCodeLanguage, getFormatLabel, getSanitizedMarkdownHeadingIdFromRawFragment, getSessionsByActivity, getSessionsForNavbar, getSessionsForProject, getSyntaxLanguage, getToolCategory, getToolDisplayMetadata, getToolErrorText, getTotalRunningSessionCount, hasBackgroundRunningSessions, initialsOf, isStreamingAtom, isViewerMessage, ixControl, ixControlAfter, ixControlSoft, ixField, ixRow, ixSelected, ixTabUnderline, localToday, messagesAtom, numericColumns, parseCalendarDate, parseCsv, parseToolEvent, partMapAtom, plainTextFromMarkdown, registerActiveSession, resetActiveSessions, resolveFilePreviewKind, setActiveSessionAttention, setActiveSessionConnection, setActiveSessionError, setActiveSessionRunning, setForegroundActiveSession, showsTaskPriority, tableCsv, taskProgress, taskStatus, timeAgo, toneFor, truncateText, unregisterActiveSession, updateActiveSessionMeta, updatePart, useActiveSession, useActiveSessions, useActiveSessionsState, useApiKey, useAuth, useAutoScroll, useDropdownMenu, useHasBackgroundRunningSessions, useLiveTime, useNavbarSessions, useProjectActivity, useProjectSessions, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useSessionsByActivity, useTheme, useToast, useToolCallStream, useTotalRunningSessions, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
137
+ export { ActiveProjectActivity, ActiveSessionActivityOptions, ActiveSessionConnectionOptions, ActiveSessionConnectionState, ActiveSessionReconnectState, ActiveSessionRecord, ActiveSessionStatus, ActiveSessionTransportMode, ActiveSessionsState, AgentBranding, AgentStreamEvent, AgentTimeline, type AgentTimelineArtifactItem, type AgentTimelineCustomItem, type AgentTimelineItem, type AgentTimelineMessageItem, type AgentTimelineProps, type AgentTimelineStatusItem, type AgentTimelineTone, type AgentTimelineToolGroupItem, type AgentTimelineToolItem, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AlertProps, AlertTitle, type AlertTone, ApiSchema, type ApiSchemaProps, AppendUserMessageOptions, ApplySdkEventOptions, ApprovalCard, type ApprovalCardProps, type ApprovalDiffFile, ApprovalDiffSummary, type ApprovalPlanStep, ArtifactPane, type ArtifactPaneProps, AuthHeader, type AuthHeaderProps, AuthUser, AutomationStreamEvent, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, BeginAssistantMessageOptions, BotStreamEvent, Button, type ButtonProps, CATEGORY_TONES, CSV_PREVIEW_ROW_LIMIT, Calendar, type CalendarDate, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardTitleProps, type CategoryTone, ChatAuthor, ChatContainer, type ChatContainerProps, ChatMessage, type ChatMessageProps, Checkbox, Chip, type ChipProps, CodeBlock, type CodeBlockProps, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandPreview, type CommandPreviewProps, CompleteAssistantMessageOptions, ConnectionState, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, type CopyButtonProps, CustomToolRenderer, DatePicker, type DatePickerProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffPreview, type DiffPreviewProps, DisplayVariant, DropZone, type DropZoneProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ExpandedToolDetail, type ExpandedToolDetailProps, type FeedSegment, FileArtifactPane, type FileArtifactPaneProps, FileCard, type FileCardProps, type FileDetails, type FileFormat, FileList, type FileListItem, type FileListProps, type FileNode, FilePreview, type FilePreviewKind, type FilePreviewProps, type FileTabData, FileTabs, type FileTabsProps, FileTree, type FileTreeProps, type FileTreeVisibilityOptions, type FileUploader, FilterField, type FilterFieldProps, FinalTextPart, GitHubLoginButton, type GitHubLoginButtonProps, GlobResultsPreview, type GlobResultsPreviewProps, GrepResultsPreview, type GrepResultsPreviewProps, GroupedMessage, Heading, type HeadingProps, type HeadingVariant, HelpText, type HelpTextProps, IconTile, type IconTileProps, InlineCode, type InlineCodeProps, InlineThinkingItem, type InlineThinkingItemProps, InlineToolItem, type InlineToolItemProps, Input, type InputProps, Label, LiveDuration, LoginLayout, type LoginLayoutProps, Logo, type LogoProps, Markdown, type MarkdownLinkChip, type MarkdownLinkChipResolver, type MarkdownProps, MessageAuthor, type MessageAuthorProps, MessageList, type MessageListProps, type MessageRole, MessageRun, MessageUser, Metric, type MetricProps, MetricStrip, type MetricStripProps, OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, type OpenUIAction, type OpenUIActionsNode, OpenUIArtifactRenderer, type OpenUIArtifactRendererProps, type OpenUIBadgeNode, type OpenUICardNode, type OpenUICodeNode, type OpenUIComponentNode, type OpenUIGridNode, type OpenUIHeadingNode, type OpenUIKeyValueNode, type OpenUIMarkdownNode, type OpenUIPrimitive, type OpenUISchemaIssue, type OpenUISchemaValidation, type OpenUISeparatorNode, type OpenUIStackNode, type OpenUIStatNode, type OpenUITableNode, type OpenUITextNode, PageHeader, type PageHeaderProps, PageShell, type PageShellProps, Pagination, type PaginationProps, PdfViewer, type PdfViewerConfig, type PdfViewerProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, QuestionPreview, type QuestionPreviewProps, RadioGroup, RadioGroupItem, RealtimeSessionOptions, RealtimeSessionRegistry, RealtimeSessionRegistryProps, RealtimeSessionState, RealtimeSessionTarget, ReasoningPart, type RedactedDocSegment, RedactedDocument, type RedactedDocumentData, type RedactedDocumentProps, RegisterActiveSessionOptions, type RevealResult, RichFileTree, type RichFileTreeGitEntry, type RichFileTreeGitStatus, type RichFileTreeProps, type RichFileTreeThemeVars, Run, RunGroup, type RunGroupProps, type RunPhase, RunPhaseList, RunRowShell, type RunRowShellProps, type RunRowStatus, RunRowStatusDot, RunStats, SSEEvent, SdkSessionAttachment, SdkSessionEvent, SdkSessionSeed, SegmentedControl, type SegmentedControlOption, type SegmentedControlProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, SessionMessage, SessionPart, SessionProjectKey, type SessionUser, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarDropZone, type SidebarDropZoneProps, Skeleton, SkeletonCard, SkeletonTable, Slider, StatCard, type StatCardProps, StatusPill, type StatusPillProps, type StatusTone, Switch, TONE_CLASSES, TOOL_CATEGORY_ICONS, TRANSCRIPT_TEXT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, type TableProps, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, type TagProps, TangleKnot, TaskList, type TaskListItem, type TaskListProps, type TaskStatus, TaskStreamEvent, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, TerminalStreamEvent, TextPart, TextShimmer, type TextShimmerProps, Textarea, type TextareaProps, ThemeToggle, ThinkingIndicator, type ThinkingIndicatorProps, TimeSelect, type TimeSelectProps, type Toast, ToastContainer, ToastProvider, type Tone, type ToneClasses, type ToolCallData, ToolCallFeed, type ToolCallFeedProps, type ToolCallStatus, type ToolCallType, ToolCategory, ToolDisplayMetadata, ToolPart, ToolState, ToolStatus, ToolTime, Toolbar, type ToolbarProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UploadFile, UploadProgress, type UploadProgressProps, UseAuthOptions, UseAuthResult, UseRunGroupsOptions, UseSSEStreamOptions, UseSSEStreamResult, UseSdkSessionOptions, UseSdkSessionReturn, UseToolCallStreamReturn, UserMenu, type UserMenuProps, UserMessage, type UserMessageProps, WebSearchPreview, type WebSearchPreviewProps, WriteFilePreview, type WriteFilePreviewProps, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fileExtension, filterFileTree, findUnsupportedOpenUINode, focusField, focusFieldInvalid, focusFieldWithin, focusRing, focusRingInset, formatBytes, formatCalendarDate, formatDuration, formatUptime, getActiveSession, getAllActiveSessions, getAllProjectActivity, getCodeLanguage, getFormatLabel, getSanitizedMarkdownHeadingIdFromRawFragment, getSessionsByActivity, getSessionsForNavbar, getSessionsForProject, getSyntaxLanguage, getToolCategory, getToolDisplayMetadata, getToolErrorText, getTotalRunningSessionCount, hasBackgroundRunningSessions, initialsOf, isStreamingAtom, isViewerMessage, ixControl, ixControlAfter, ixControlSoft, ixField, ixRow, ixSelected, ixTabUnderline, localToday, messagesAtom, numericColumns, parseCalendarDate, parseCsv, parseToolEvent, partMapAtom, plainTextFromMarkdown, registerActiveSession, resetActiveSessions, resolveFilePreviewKind, setActiveSessionAttention, setActiveSessionConnection, setActiveSessionError, setActiveSessionRunning, setForegroundActiveSession, showsTaskPriority, tableCsv, taskProgress, taskStatus, timeAgo, toneFor, truncateText, unregisterActiveSession, updateActiveSessionMeta, updatePart, useActiveSession, useActiveSessions, useActiveSessionsState, useApiKey, useAuth, useAutoScroll, useDropdownMenu, useHasBackgroundRunningSessions, useLiveTime, useNavbarSessions, useProjectActivity, useProjectSessions, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useSessionsByActivity, useTheme, useToast, useToolCallStream, useTotalRunningSessions, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
package/dist/index.js CHANGED
@@ -41,7 +41,8 @@ import { DropZone } from "./primitives/drop-zone.js";
41
41
  import { UploadProgress } from "./primitives/upload-progress.js";
42
42
  import { SidebarDropZone } from "./primitives/sidebar-drop-zone.js";
43
43
  import { ArtifactPane } from "./primitives/artifact-pane.js";
44
- import { CodeBlock, CopyButton, codeBlockGrammar } from "./markdown/code-block.js";
44
+ import { codeBlockGrammar } from "./lib/code-presentation.js";
45
+ import { CodeBlock, CopyButton } from "./markdown/code-block.js";
45
46
  import { InlineCode } from "./primitives/code-block.js";
46
47
  import { ThemeToggle, useTheme } from "./primitives/theme-toggle.js";
47
48
  import { PageShell } from "./primitives/page-shell.js";
@@ -102,6 +103,7 @@ import { CSV_PREVIEW_ROW_LIMIT, FilePreview, parseCsv } from "./files/file-previ
102
103
  import { FileList } from "./files/file-list.js";
103
104
  import { FileTabs } from "./files/file-tabs.js";
104
105
  import { FileArtifactPane } from "./files/file-artifact-pane.js";
106
+ import { ApiSchema } from "./markdown/api-schema.js";
105
107
  import { AuthHeader, GitHubLoginButton, UserMenu } from "./auth/auth.js";
106
108
  import { LoginLayout } from "./auth/login-layout.js";
107
109
  import { useDropdownMenu } from "./hooks/use-dropdown-menu.js";
@@ -116,4 +118,4 @@ import { addMessage, addParts, clearChat, isStreamingAtom, messagesAtom, partMap
116
118
  import { copyText } from "./utils/copy-text.js";
117
119
  import { timeAgo } from "./utils/time-ago.js";
118
120
  import { RedactedDocument } from "./redaction/redacted-document.js";
119
- export { AgentTimeline, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, ApprovalCard, ApprovalDiffSummary, ArtifactPane, AuthHeader, Avatar, AvatarFallback, AvatarImage, Badge, Button, CATEGORY_TONES, CSV_PREVIEW_ROW_LIMIT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatContainer, ChatMessage, Checkbox, Chip, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandPreview, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffPreview, DropZone, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ExpandedToolDetail, FileArtifactPane, FileCard, FileList, FilePreview, FileTabs, FileTree, FilterField, GitHubLoginButton, GlobResultsPreview, GrepResultsPreview, Heading, HelpText, IconTile, InlineCode, InlineThinkingItem, InlineToolItem, Input, Label, LiveDuration, LoginLayout, Logo, Markdown, MessageAuthor, MessageList, Metric, MetricStrip, OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, OpenUIArtifactRenderer, PageHeader, PageShell, Pagination, PdfViewer, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, QuestionPreview, RadioGroup, RadioGroupItem, RealtimeSessionRegistry, RedactedDocument, RichFileTree, RunGroup, RunPhaseList, RunRowShell, RunRowStatusDot, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarDropZone, Skeleton, SkeletonCard, SkeletonTable, Slider, StatCard, StatusPill, Switch, TONE_CLASSES, TOOL_CATEGORY_ICONS, TRANSCRIPT_TEXT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TangleKnot, TaskList, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, TextShimmer, Textarea, ThemeToggle, ThinkingIndicator, TimeSelect, ToastContainer, ToastProvider, ToolCallFeed, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UploadProgress, UserMenu, UserMessage, WebSearchPreview, WriteFilePreview, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fileExtension, filterFileTree, findUnsupportedOpenUINode, focusField, focusFieldInvalid, focusFieldWithin, focusRing, focusRingInset, formatBytes, formatCalendarDate, formatDuration, formatUptime, getActiveSession, getAllActiveSessions, getAllProjectActivity, getCodeLanguage, getFormatLabel, getSanitizedMarkdownHeadingIdFromRawFragment, getSessionsByActivity, getSessionsForNavbar, getSessionsForProject, getSyntaxLanguage, getToolCategory, getToolDisplayMetadata, getToolErrorText, getTotalRunningSessionCount, hasBackgroundRunningSessions, initialsOf, isStreamingAtom, isViewerMessage, ixControl, ixControlAfter, ixControlSoft, ixField, ixRow, ixSelected, ixTabUnderline, localToday, messagesAtom, numericColumns, parseCalendarDate, parseCsv, parseToolEvent, partMapAtom, plainTextFromMarkdown, registerActiveSession, resetActiveSessions, resolveFilePreviewKind, setActiveSessionAttention, setActiveSessionConnection, setActiveSessionError, setActiveSessionRunning, setForegroundActiveSession, showsTaskPriority, tableCsv, taskProgress, taskStatus, timeAgo, toneFor, truncateText, unregisterActiveSession, updateActiveSessionMeta, updatePart, useActiveSession, useActiveSessions, useActiveSessionsState, useApiKey, useAuth, useAutoScroll, useDropdownMenu, useHasBackgroundRunningSessions, useLiveTime, useNavbarSessions, useProjectActivity, useProjectSessions, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useSessionsByActivity, useTheme, useToast, useToolCallStream, useTotalRunningSessions, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
121
+ export { AgentTimeline, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, ApiSchema, ApprovalCard, ApprovalDiffSummary, ArtifactPane, AuthHeader, Avatar, AvatarFallback, AvatarImage, Badge, Button, CATEGORY_TONES, CSV_PREVIEW_ROW_LIMIT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatContainer, ChatMessage, Checkbox, Chip, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, CommandPreview, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyButton, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiffPreview, DropZone, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ExpandedToolDetail, FileArtifactPane, FileCard, FileList, FilePreview, FileTabs, FileTree, FilterField, GitHubLoginButton, GlobResultsPreview, GrepResultsPreview, Heading, HelpText, IconTile, InlineCode, InlineThinkingItem, InlineToolItem, Input, Label, LiveDuration, LoginLayout, Logo, Markdown, MessageAuthor, MessageList, Metric, MetricStrip, OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, OpenUIArtifactRenderer, PageHeader, PageShell, Pagination, PdfViewer, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, QuestionPreview, RadioGroup, RadioGroupItem, RealtimeSessionRegistry, RedactedDocument, RichFileTree, RunGroup, RunPhaseList, RunRowShell, RunRowStatusDot, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, SidebarDropZone, Skeleton, SkeletonCard, SkeletonTable, Slider, StatCard, StatusPill, Switch, TONE_CLASSES, TOOL_CATEGORY_ICONS, TRANSCRIPT_TEXT, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TangleKnot, TaskList, TerminalCursor, TerminalDisplay, TerminalInput, TerminalLine, TextShimmer, Textarea, ThemeToggle, ThinkingIndicator, TimeSelect, ToastContainer, ToastProvider, ToolCallFeed, Toolbar, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UploadProgress, UserMenu, UserMessage, WebSearchPreview, WriteFilePreview, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fileExtension, filterFileTree, findUnsupportedOpenUINode, focusField, focusFieldInvalid, focusFieldWithin, focusRing, focusRingInset, formatBytes, formatCalendarDate, formatDuration, formatUptime, getActiveSession, getAllActiveSessions, getAllProjectActivity, getCodeLanguage, getFormatLabel, getSanitizedMarkdownHeadingIdFromRawFragment, getSessionsByActivity, getSessionsForNavbar, getSessionsForProject, getSyntaxLanguage, getToolCategory, getToolDisplayMetadata, getToolErrorText, getTotalRunningSessionCount, hasBackgroundRunningSessions, initialsOf, isStreamingAtom, isViewerMessage, ixControl, ixControlAfter, ixControlSoft, ixField, ixRow, ixSelected, ixTabUnderline, localToday, messagesAtom, numericColumns, parseCalendarDate, parseCsv, parseToolEvent, partMapAtom, plainTextFromMarkdown, registerActiveSession, resetActiveSessions, resolveFilePreviewKind, setActiveSessionAttention, setActiveSessionConnection, setActiveSessionError, setActiveSessionRunning, setForegroundActiveSession, showsTaskPriority, tableCsv, taskProgress, taskStatus, timeAgo, toneFor, truncateText, unregisterActiveSession, updateActiveSessionMeta, updatePart, useActiveSession, useActiveSessions, useActiveSessionsState, useApiKey, useAuth, useAutoScroll, useDropdownMenu, useHasBackgroundRunningSessions, useLiveTime, useNavbarSessions, useProjectActivity, useProjectSessions, useRealtimeSession, useRunCollapseState, useRunGroups, useSSEStream, useSdkSession, useSessionsByActivity, useTheme, useToast, useToolCallStream, useTotalRunningSessions, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
@@ -0,0 +1,92 @@
1
+ import "shiki/core";
2
+ //#region src/lib/code-presentation.d.ts
3
+ export declare function codeBlockGrammar(language: string | undefined): string | undefined;
4
+ export interface TokenStyle {
5
+ color?: string;
6
+ fontStyle?: "italic";
7
+ fontWeight?: "bold";
8
+ textDecoration?: "underline";
9
+ }
10
+ export declare const codePreStyle: {
11
+ readonly margin: 0;
12
+ readonly padding: "var(--code-padding-y, 0.625rem) var(--code-padding-x, 0.75rem)";
13
+ readonly background: "transparent";
14
+ readonly color: "var(--syntax-foreground, currentColor)";
15
+ readonly fontSize: "var(--code-font-size, 0.8125rem)";
16
+ readonly lineHeight: "var(--code-line-height, 1.5)";
17
+ readonly overflowX: "auto";
18
+ };
19
+ export declare const codeTextStyle: {
20
+ readonly fontFamily: "var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)";
21
+ readonly whiteSpace: "pre";
22
+ };
23
+ export declare const codePresentation: {
24
+ tabs: string;
25
+ tab: "inline-flex items-center justify-center whitespace-nowrap rounded-t-md pb-3 text-sm font-medium [transition:color_var(--motion-control),background-color_var(--motion-control),border-color_var(--motion-control),box-shadow_var(--motion-control),transform_var(--motion-control),scale_var(--motion-control),opacity_var(--motion-control)] motion-reduce:transition-none focus-visible:outline-1 focus-visible:outline-[var(--focus-border)] focus-visible:ring-4 focus-visible:ring-[var(--focus-halo)] focus-visible:outline-offset-0 disabled:pointer-events-none disabled:opacity-50 border-b-2 border-transparent data-[state=inactive]:text-muted-foreground hover:shadow-[inset_0_-2px_0_hsl(var(--hsl-ring)/0.4)] data-[state=active]:bg-[hsl(var(--hsl-ring)/0.07)] data-[state=active]:text-[var(--accent-text)] data-[state=active]:shadow-[inset_0_-2px_0_var(--ix-sel-ring)] aria-checked:bg-[hsl(var(--hsl-ring)/0.07)] aria-checked:text-[var(--accent-text)] aria-checked:shadow-[inset_0_-2px_0_var(--ix-sel-ring)]";
26
+ root: string;
27
+ header: string;
28
+ copy: string;
29
+ copyStatus: string;
30
+ };
31
+ export interface CodeExample {
32
+ label: string;
33
+ code: string;
34
+ language?: string;
35
+ filename?: string;
36
+ }
37
+ export interface ApiMetadata {
38
+ kind: "request" | "response" | "error";
39
+ method?: string;
40
+ status?: number;
41
+ contentType?: string;
42
+ }
43
+ export declare const apiMetadataText: (meta: ApiMetadata) => string;
44
+ /** Same lazy grammar/token model for React, Hono SSR and static renderers. */
45
+ export declare function highlightCode(code: string, language?: string): Promise<{
46
+ content: string;
47
+ style: TokenStyle | undefined;
48
+ }[][]>;
49
+ /** Legacy fallback is used only when the modern clipboard API is absent. */
50
+ export declare function writeClipboard(text: string): Promise<void>;
51
+ export interface InteractionBudgets {
52
+ feedback?: number;
53
+ pending?: number;
54
+ longWork?: number;
55
+ mutation?: number;
56
+ }
57
+ /** Resolve scoped Brand times, including calc(), without duplicating token values. */
58
+ export declare function interactionBudgets(scope: HTMLElement): InteractionBudgets;
59
+ export interface CopyFeedback {
60
+ copied: boolean;
61
+ status: string;
62
+ pending: boolean;
63
+ loading?: boolean;
64
+ longRunning?: boolean;
65
+ elapsedMs?: number;
66
+ measurement?: {
67
+ elapsedMs: number;
68
+ feedbackMs: number;
69
+ budgets: InteractionBudgets;
70
+ mutationBudgetExceeded: boolean | undefined;
71
+ };
72
+ }
73
+ /** Owns one accepted write, scoped delays and cleanup for both renderers. */
74
+ export declare function createCopyFeedback(change: (state: CopyFeedback) => void, write?: (text: string) => Promise<void>, scope?: HTMLElement): {
75
+ copy(text: string): Promise<void>;
76
+ dispose(): void;
77
+ };
78
+ export declare function bindCopyButton(button: HTMLButtonElement, status: HTMLElement, text: () => string): () => void;
79
+ /** Native tabs adapter. The consumer owns labels, IDs and escaped panel content. */
80
+ export declare function bindCodeTabs(list: HTMLElement, onSelect?: (index: number) => void): () => void;
81
+ export interface ApiField {
82
+ name: string;
83
+ type: string;
84
+ description?: string;
85
+ required?: boolean;
86
+ children?: readonly ApiField[];
87
+ }
88
+ export declare function schemaRows(fields: readonly ApiField[], parent?: string, depth?: number): Array<ApiField & {
89
+ path: string;
90
+ depth: number;
91
+ }>;
92
+ //#endregion
@@ -0,0 +1,437 @@
1
+ import { tabsPresentation } from "../presentation.js";
2
+ //#region src/lib/code-presentation.ts
3
+ const SYNTAX = {
4
+ comment: "var(--syntax-comment, currentColor)",
5
+ keyword: "var(--syntax-keyword, currentColor)",
6
+ string: "var(--syntax-string, currentColor)",
7
+ function: "var(--syntax-function, currentColor)",
8
+ number: "var(--syntax-number, currentColor)",
9
+ variable: "var(--syntax-variable, currentColor)",
10
+ foreground: "var(--syntax-foreground, currentColor)"
11
+ };
12
+ const SHIKI_THEME = "tangle-syntax";
13
+ const BRAND_COLOR_FOR_SHIKI = {
14
+ "var(--shiki-foreground)": SYNTAX.foreground,
15
+ "var(--shiki-token-comment)": SYNTAX.comment,
16
+ "var(--shiki-token-keyword)": SYNTAX.keyword,
17
+ "var(--shiki-token-string)": SYNTAX.string,
18
+ "var(--shiki-token-string-expression)": SYNTAX.string,
19
+ "var(--shiki-token-function)": SYNTAX.function,
20
+ "var(--shiki-token-constant)": SYNTAX.number,
21
+ "var(--shiki-token-link)": SYNTAX.number,
22
+ "var(--shiki-token-parameter)": SYNTAX.variable,
23
+ "var(--shiki-token-punctuation)": SYNTAX.foreground
24
+ };
25
+ const GRAMMARS = {
26
+ typescript: () => import("shiki/langs/typescript.mjs"),
27
+ tsx: () => import("shiki/langs/tsx.mjs"),
28
+ javascript: () => import("shiki/langs/javascript.mjs"),
29
+ jsx: () => import("shiki/langs/jsx.mjs"),
30
+ json: () => import("shiki/langs/json.mjs"),
31
+ jsonc: () => import("shiki/langs/jsonc.mjs"),
32
+ bash: () => import("shiki/langs/bash.mjs"),
33
+ python: () => import("shiki/langs/python.mjs"),
34
+ html: () => import("shiki/langs/html.mjs"),
35
+ css: () => import("shiki/langs/css.mjs"),
36
+ scss: () => import("shiki/langs/scss.mjs"),
37
+ markdown: () => import("shiki/langs/markdown.mjs"),
38
+ mdx: () => import("shiki/langs/mdx.mjs"),
39
+ yaml: () => import("shiki/langs/yaml.mjs"),
40
+ toml: () => import("shiki/langs/toml.mjs"),
41
+ sql: () => import("shiki/langs/sql.mjs"),
42
+ diff: () => import("shiki/langs/diff.mjs"),
43
+ go: () => import("shiki/langs/go.mjs"),
44
+ rust: () => import("shiki/langs/rust.mjs"),
45
+ solidity: () => import("shiki/langs/solidity.mjs"),
46
+ ruby: () => import("shiki/langs/ruby.mjs"),
47
+ java: () => import("shiki/langs/java.mjs"),
48
+ kotlin: () => import("shiki/langs/kotlin.mjs"),
49
+ swift: () => import("shiki/langs/swift.mjs"),
50
+ php: () => import("shiki/langs/php.mjs"),
51
+ c: () => import("shiki/langs/c.mjs"),
52
+ cpp: () => import("shiki/langs/cpp.mjs"),
53
+ csharp: () => import("shiki/langs/csharp.mjs"),
54
+ graphql: () => import("shiki/langs/graphql.mjs"),
55
+ xml: () => import("shiki/langs/xml.mjs"),
56
+ dockerfile: () => import("shiki/langs/dockerfile.mjs")
57
+ };
58
+ const LANGUAGE_ALIASES = {
59
+ ts: "typescript",
60
+ mts: "typescript",
61
+ cts: "typescript",
62
+ js: "javascript",
63
+ mjs: "javascript",
64
+ cjs: "javascript",
65
+ node: "javascript",
66
+ sh: "bash",
67
+ shell: "bash",
68
+ zsh: "bash",
69
+ console: "bash",
70
+ shellscript: "bash",
71
+ py: "python",
72
+ python3: "python",
73
+ yml: "yaml",
74
+ md: "markdown",
75
+ rs: "rust",
76
+ sol: "solidity",
77
+ rb: "ruby",
78
+ kt: "kotlin",
79
+ cs: "csharp",
80
+ "c#": "csharp",
81
+ "c++": "cpp",
82
+ gql: "graphql",
83
+ svg: "xml",
84
+ docker: "dockerfile",
85
+ patch: "diff",
86
+ htm: "html"
87
+ };
88
+ const LANGUAGE_NAMES = {
89
+ typescript: "TypeScript",
90
+ tsx: "TSX",
91
+ javascript: "JavaScript",
92
+ jsx: "JSX",
93
+ json: "JSON",
94
+ jsonc: "JSONC",
95
+ bash: "Bash",
96
+ python: "Python",
97
+ html: "HTML",
98
+ css: "CSS",
99
+ scss: "SCSS",
100
+ markdown: "Markdown",
101
+ mdx: "MDX",
102
+ yaml: "YAML",
103
+ toml: "TOML",
104
+ sql: "SQL",
105
+ diff: "Diff",
106
+ go: "Go",
107
+ rust: "Rust",
108
+ solidity: "Solidity",
109
+ ruby: "Ruby",
110
+ java: "Java",
111
+ kotlin: "Kotlin",
112
+ swift: "Swift",
113
+ php: "PHP",
114
+ c: "C",
115
+ cpp: "C++",
116
+ csharp: "C#",
117
+ graphql: "GraphQL",
118
+ xml: "XML",
119
+ dockerfile: "Dockerfile"
120
+ };
121
+ /** The Shiki grammar for a fence language, or undefined for plain text. */
122
+ const PLAIN_TEXT = /* @__PURE__ */ new Set([
123
+ "text",
124
+ "txt",
125
+ "plain",
126
+ "plaintext"
127
+ ]);
128
+ function codeBlockGrammar(language) {
129
+ if (!language) return void 0;
130
+ const id = language.toLowerCase();
131
+ const resolved = LANGUAGE_ALIASES[id] ?? id;
132
+ return GRAMMARS[resolved] ? resolved : void 0;
133
+ }
134
+ let highlighterPromise;
135
+ const grammarLoads = /* @__PURE__ */ new Map();
136
+ function loadHighlighter() {
137
+ return highlighterPromise ??= Promise.all([import("shiki/core"), import("shiki/engine/javascript")]).then(([core, engine]) => core.createHighlighterCore({
138
+ themes: [core.createCssVariablesTheme({
139
+ name: SHIKI_THEME,
140
+ variablePrefix: "--shiki-",
141
+ fontStyle: true
142
+ })],
143
+ langs: [],
144
+ engine: engine.createJavaScriptRegexEngine()
145
+ })).catch((error) => {
146
+ highlighterPromise = void 0;
147
+ throw error;
148
+ });
149
+ }
150
+ async function tokenize(code, grammar) {
151
+ const highlighter = await loadHighlighter();
152
+ let load = grammarLoads.get(grammar);
153
+ if (!load) {
154
+ load = GRAMMARS[grammar]().then((module) => highlighter.loadLanguage(module.default));
155
+ load.catch(() => grammarLoads.delete(grammar));
156
+ grammarLoads.set(grammar, load);
157
+ }
158
+ await load;
159
+ return highlighter.codeToTokensBase(code, {
160
+ lang: grammar,
161
+ theme: SHIKI_THEME
162
+ });
163
+ }
164
+ function tokenStyle(token) {
165
+ const color = token.color ? BRAND_COLOR_FOR_SHIKI[token.color] ?? SYNTAX.foreground : void 0;
166
+ const style = token.fontStyle ?? 0;
167
+ if (!color && !style) return void 0;
168
+ return {
169
+ ...color ? { color } : {},
170
+ ...style & 1 ? { fontStyle: "italic" } : {},
171
+ ...style & 2 ? { fontWeight: "bold" } : {},
172
+ ...style & 4 ? { textDecoration: "underline" } : {}
173
+ };
174
+ }
175
+ const codePreStyle = {
176
+ margin: 0,
177
+ padding: "var(--code-padding-y, 0.625rem) var(--code-padding-x, 0.75rem)",
178
+ background: "transparent",
179
+ color: SYNTAX.foreground,
180
+ fontSize: "var(--code-font-size, 0.8125rem)",
181
+ lineHeight: "var(--code-line-height, 1.5)",
182
+ overflowX: "auto"
183
+ };
184
+ const codeTextStyle = {
185
+ fontFamily: "var(--font-mono, 'JetBrains Mono', ui-monospace, monospace)",
186
+ whiteSpace: "pre"
187
+ };
188
+ const codePresentation = {
189
+ tabs: `tangle-code-tabs ${tabsPresentation.list.underline}`,
190
+ tab: tabsPresentation.trigger.underline,
191
+ root: "group relative min-w-0 overflow-hidden rounded-lg border font-mono bg-card border-border",
192
+ header: "flex flex-wrap items-center justify-between gap-3 border-b border-border px-3 py-1.5 bg-[var(--code-header-bg,hsl(var(--background)))]",
193
+ copy: "flex items-center justify-center min-w-8 min-h-8 pointer-coarse:min-w-11 pointer-coarse:min-h-11 rounded-md bg-muted border border-border hover:border-[var(--border-strong)] transition-colors data-[copy-loading=true]:after:content-['…'] data-[copy-loading=true]:gap-1",
194
+ copyStatus: "sr-only data-[copy-long-work=true]:not-sr-only data-[copy-long-work=true]:text-xs data-[copy-long-work=true]:text-muted-foreground"
195
+ };
196
+ const apiMetadataText = (meta) => [
197
+ meta.kind,
198
+ meta.method,
199
+ meta.status,
200
+ meta.contentType
201
+ ].filter((v) => v !== void 0).join(" · ");
202
+ /** Same lazy grammar/token model for React, Hono SSR and static renderers. */
203
+ async function highlightCode(code, language) {
204
+ const grammar = codeBlockGrammar(language);
205
+ if (!grammar) return code.split("\n").map((content) => [{
206
+ content,
207
+ style: void 0
208
+ }]);
209
+ return (await tokenize(code, grammar)).map((line) => line.map((token) => ({
210
+ content: token.content,
211
+ style: tokenStyle(token)
212
+ })));
213
+ }
214
+ /** Legacy fallback is used only when the modern clipboard API is absent. */
215
+ async function writeClipboard(text) {
216
+ if (navigator.clipboard?.writeText) {
217
+ await navigator.clipboard.writeText(text);
218
+ return;
219
+ }
220
+ const active = document.activeElement, selection = document.getSelection();
221
+ const ranges = selection ? Array.from({ length: selection.rangeCount }, (_, i) => selection.getRangeAt(i).cloneRange()) : [];
222
+ const field = document.createElement("textarea");
223
+ field.value = text;
224
+ field.readOnly = true;
225
+ field.tabIndex = -1;
226
+ field.setAttribute("aria-hidden", "true");
227
+ field.style.position = "fixed";
228
+ field.style.left = "-9999px";
229
+ document.body.append(field);
230
+ try {
231
+ field.select();
232
+ if (!document.execCommand?.("copy")) throw Error("Clipboard unavailable");
233
+ } finally {
234
+ field.remove();
235
+ active?.focus({ preventScroll: true });
236
+ if (selection) {
237
+ selection.removeAllRanges();
238
+ for (const range of ranges) selection.addRange(range);
239
+ }
240
+ }
241
+ }
242
+ const COPY_FEEDBACK_MS = 2e3;
243
+ /** Resolve scoped Brand times, including calc(), without duplicating token values. */
244
+ function interactionBudgets(scope) {
245
+ const view = scope.ownerDocument.defaultView;
246
+ if (!view) return {};
247
+ const probe = scope.ownerDocument.createElement("i");
248
+ probe.hidden = true;
249
+ scope.append(probe);
250
+ const read = (role) => {
251
+ const name = `--interaction-${role}`;
252
+ if (!view.getComputedStyle(scope).getPropertyValue(name).trim()) return void 0;
253
+ probe.style.animationDuration = `var(${name})`;
254
+ const time = /^(\d+(?:\.\d+)?)(ms|s)$/.exec(view.getComputedStyle(probe).animationDuration);
255
+ return time ? Number(time[1]) * (time[2] === "s" ? 1e3 : 1) : void 0;
256
+ };
257
+ try {
258
+ return {
259
+ feedback: read("feedback-budget"),
260
+ pending: read("pending-delay"),
261
+ longWork: read("long-work-delay"),
262
+ mutation: read("mutation-budget")
263
+ };
264
+ } finally {
265
+ probe.remove();
266
+ }
267
+ }
268
+ /** Owns one accepted write, scoped delays and cleanup for both renderers. */
269
+ function createCopyFeedback(change, write = writeClipboard, scope) {
270
+ let disposed = false, pending = false, timer;
271
+ let delays = [], elapsed;
272
+ const clearPending = () => {
273
+ for (const delay of delays) clearTimeout(delay);
274
+ delays = [];
275
+ if (elapsed) clearInterval(elapsed);
276
+ elapsed = void 0;
277
+ };
278
+ return {
279
+ async copy(text) {
280
+ if (disposed || pending) return;
281
+ const started = performance.now(), budgets = scope ? interactionBudgets(scope) : {};
282
+ pending = true;
283
+ if (timer) clearTimeout(timer);
284
+ let loading = budgets.pending === void 0, longRunning = false;
285
+ const announce = () => {
286
+ const elapsedMs = performance.now() - started;
287
+ change({
288
+ copied: false,
289
+ pending: true,
290
+ loading,
291
+ longRunning,
292
+ elapsedMs,
293
+ status: longRunning ? `Copying · ${Math.floor(elapsedMs / 1e3)}s elapsed. Time remaining unknown. Cannot cancel this clipboard write; waiting for confirmation.` : "Copying to clipboard"
294
+ });
295
+ };
296
+ announce();
297
+ const feedbackMs = performance.now() - started;
298
+ if (budgets.pending !== void 0) delays.push(setTimeout(() => {
299
+ loading = true;
300
+ announce();
301
+ }, budgets.pending));
302
+ if (budgets.longWork !== void 0) delays.push(setTimeout(() => {
303
+ longRunning = true;
304
+ announce();
305
+ elapsed = setInterval(announce, 1e3);
306
+ }, budgets.longWork));
307
+ let copied;
308
+ try {
309
+ await write(text);
310
+ copied = true;
311
+ } catch {
312
+ copied = false;
313
+ }
314
+ pending = false;
315
+ clearPending();
316
+ if (disposed) return;
317
+ const elapsedMs = performance.now() - started;
318
+ change({
319
+ copied,
320
+ status: copied ? "Copied to clipboard" : "Copy failed",
321
+ pending: false,
322
+ measurement: {
323
+ elapsedMs,
324
+ feedbackMs,
325
+ budgets,
326
+ mutationBudgetExceeded: budgets.mutation === void 0 ? void 0 : elapsedMs > budgets.mutation
327
+ }
328
+ });
329
+ timer = setTimeout(() => {
330
+ if (!disposed) change({
331
+ copied: false,
332
+ status: "",
333
+ pending: false
334
+ });
335
+ }, COPY_FEEDBACK_MS);
336
+ },
337
+ dispose() {
338
+ disposed = true;
339
+ clearPending();
340
+ if (timer) clearTimeout(timer);
341
+ }
342
+ };
343
+ }
344
+ function bindCopyButton(button, status, text) {
345
+ const previous = {
346
+ label: button.getAttribute("aria-label"),
347
+ status: status.textContent,
348
+ disabled: button.getAttribute("aria-disabled"),
349
+ busy: button.getAttribute("aria-busy"),
350
+ loading: button.getAttribute("data-copy-loading"),
351
+ long: status.getAttribute("data-copy-long-work")
352
+ };
353
+ const restore = (element, name, value) => {
354
+ if (value === null) element.removeAttribute(name);
355
+ else element.setAttribute(name, value);
356
+ };
357
+ const feedback = createCopyFeedback((state) => {
358
+ status.textContent = state.status;
359
+ status.setAttribute("data-copy-long-work", String(!!state.longRunning));
360
+ button.setAttribute("data-copy-loading", String(!!state.loading));
361
+ button.setAttribute("aria-label", state.pending ? "Copying to clipboard" : state.copied ? "Copied" : "Copy to clipboard");
362
+ if (state.pending) {
363
+ button.setAttribute("aria-disabled", "true");
364
+ button.setAttribute("aria-busy", "true");
365
+ } else {
366
+ restore(button, "aria-disabled", previous.disabled);
367
+ restore(button, "aria-busy", previous.busy);
368
+ }
369
+ }, writeClipboard, button);
370
+ const click = () => {
371
+ if (!button.disabled && button.getAttribute("aria-disabled") !== "true") feedback.copy(text());
372
+ };
373
+ button.addEventListener("click", click);
374
+ return () => {
375
+ button.removeEventListener("click", click);
376
+ feedback.dispose();
377
+ restore(button, "aria-label", previous.label);
378
+ status.textContent = previous.status;
379
+ restore(button, "aria-disabled", previous.disabled);
380
+ restore(button, "aria-busy", previous.busy);
381
+ restore(button, "data-copy-loading", previous.loading);
382
+ restore(status, "data-copy-long-work", previous.long);
383
+ };
384
+ }
385
+ /** Native tabs adapter. The consumer owns labels, IDs and escaped panel content. */
386
+ function bindCodeTabs(list, onSelect) {
387
+ const buttons = () => [...list.querySelectorAll("[role=\"tab\"]")];
388
+ const select = (index, focus) => {
389
+ const tabs = buttons(), tab = tabs[index];
390
+ if (!tab) return;
391
+ for (const panel of new Set(tabs.map((t) => document.getElementById(t.getAttribute("aria-controls") ?? "")))) if (panel) panel.hidden = true;
392
+ tabs.forEach((t, i) => {
393
+ t.setAttribute("aria-selected", String(i === index));
394
+ t.dataset.state = i === index ? "active" : "inactive";
395
+ t.tabIndex = i === index ? 0 : -1;
396
+ });
397
+ const panel = document.getElementById(tab.getAttribute("aria-controls") ?? "");
398
+ if (panel) {
399
+ panel.hidden = false;
400
+ panel.setAttribute("aria-labelledby", tab.id);
401
+ }
402
+ if (focus) tab.focus();
403
+ onSelect?.(index);
404
+ };
405
+ const click = (event) => {
406
+ const tab = event.target.closest("[role=\"tab\"]");
407
+ const index = buttons().findIndex((t) => t === tab);
408
+ if (index >= 0) select(index, false);
409
+ };
410
+ const key = (event) => {
411
+ const tabs = buttons(), current = tabs.findIndex((t) => t === document.activeElement);
412
+ if (current < 0) return;
413
+ const next = event.key === "Home" ? 0 : event.key === "End" ? tabs.length - 1 : event.key === "ArrowRight" ? (current + 1) % tabs.length : event.key === "ArrowLeft" ? (current + tabs.length - 1) % tabs.length : void 0;
414
+ if (next !== void 0) {
415
+ event.preventDefault();
416
+ select(next, true);
417
+ }
418
+ };
419
+ list.addEventListener("click", click);
420
+ list.addEventListener("keydown", key);
421
+ return () => {
422
+ list.removeEventListener("click", click);
423
+ list.removeEventListener("keydown", key);
424
+ };
425
+ }
426
+ function schemaRows(fields, parent = "", depth = 0) {
427
+ return fields.flatMap((field) => {
428
+ const path = parent ? `${parent}.${field.name}` : field.name;
429
+ return [{
430
+ ...field,
431
+ path,
432
+ depth
433
+ }, ...schemaRows(field.children ?? [], path, depth + 1)];
434
+ });
435
+ }
436
+ //#endregion
437
+ export { LANGUAGE_NAMES, PLAIN_TEXT, SYNTAX, apiMetadataText, bindCodeTabs, bindCopyButton, codeBlockGrammar, codePreStyle, codePresentation, codeTextStyle, createCopyFeedback, highlightCode, interactionBudgets, schemaRows, tokenStyle, tokenize, writeClipboard };