@tangle-network/ui 11.40.2 → 11.42.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 +16 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/lib/series.d.ts +74 -0
- package/dist/lib/series.js +100 -0
- package/dist/presentation.d.ts +13 -0
- package/dist/presentation.js +14 -1
- package/dist/primitives/breadcrumb.d.ts +32 -0
- package/dist/primitives/breadcrumb.js +87 -0
- package/dist/primitives/hover-card.d.ts +16 -0
- package/dist/primitives/hover-card.js +63 -0
- package/dist/primitives/metric-chart.d.ts +47 -0
- package/dist/primitives/metric-chart.js +155 -0
- package/dist/primitives/series-sparkline.d.ts +16 -0
- package/dist/primitives/series-sparkline.js +53 -0
- package/dist/primitives.d.ts +6 -1
- package/dist/primitives.js +6 -1
- package/package.json +3 -2
- package/src/lib/series.test.ts +172 -0
- package/src/lib/series.ts +174 -0
- package/src/presentation.ts +14 -0
- package/src/primitives/breadcrumb.tsx +126 -0
- package/src/primitives/hover-card-breadcrumb.test.tsx +92 -0
- package/src/primitives/hover-card.tsx +89 -0
- package/src/primitives/index.ts +24 -0
- package/src/primitives/metric-chart.stories.tsx +55 -0
- package/src/primitives/metric-chart.test.tsx +118 -0
- package/src/primitives/metric-chart.tsx +246 -0
- package/src/primitives/series-sparkline.stories.tsx +38 -0
- package/src/primitives/series-sparkline.test.tsx +56 -0
- package/src/primitives/series-sparkline.tsx +69 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @tangle-network/ui
|
|
2
2
|
|
|
3
|
+
## 11.42.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1160d59: Add hand-rolled SVG chart primitives. `SeriesSparkline` and `MetricChart` (exported from `@tangle-network/ui/primitives`) draw viewBox-scaled line charts with `currentColor` against theme token classes — no chart dependency, no hardcoded hues, dark-mode correct. `MetricChart` adds y gridlines, x date ticks, dual-series (`value2`) support and dashed reference lines. The React-free series math (`normalizeSeries`, `seriesExtent`, `seriesScale`, `periodDelta`, `seriesMean`, path builders) lives in `src/lib/series.ts` and is re-exported from primitives; `chartPresentation` joins the shared presentation map. Period deltas are measured relative to the latest measurement, never the wall clock. Named `SeriesSparkline` to stay distinct from the sample-index `Sparkline` already exported by `@tangle-network/charts`.
|
|
8
|
+
|
|
9
|
+
## 11.41.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 13f5880: HoverCard and Breadcrumb: two high-value shadcn-convention components our products needed.
|
|
14
|
+
|
|
15
|
+
HoverCard: a rich hover preview (person, product, record) on the L4 overlay surface, lazy-mounted, Radix-backed. The face of every @mention, vendor name, and staff reference in a chat thread.
|
|
16
|
+
|
|
17
|
+
Breadcrumb: workspace navigation depth as one scrollable line — each crumb is a link except the last, which is the page. Fade-masked on narrow viewports, not wrapped.
|
|
18
|
+
|
|
3
19
|
## 11.40.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -99,7 +99,12 @@ import { StatusPill, StatusPillProps, StatusTone } from "./primitives/status-pil
|
|
|
99
99
|
import { Tag, TagProps } from "./primitives/tag.js";
|
|
100
100
|
import { Chip, ChipProps } from "./primitives/chip.js";
|
|
101
101
|
import { Wizard, WizardProps, WizardStep, WizardStepProps } from "./primitives/wizard.js";
|
|
102
|
+
import { HoverCard, HoverCardContent, HoverCardDescription, HoverCardHeader, HoverCardTitle, HoverCardTrigger } from "./primitives/hover-card.js";
|
|
103
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./primitives/breadcrumb.js";
|
|
102
104
|
import { Metric, MetricProps, MetricStrip, MetricStripProps } from "./primitives/metric-strip.js";
|
|
105
|
+
import { PeriodDelta, SeriesExtent, SeriesPoint, SeriesPointInput, SeriesScale, normalizeSeries, periodDelta, seriesAreaPath, seriesExtent, seriesLinePath, seriesMean, seriesScale } from "./lib/series.js";
|
|
106
|
+
import { SeriesSparkline, SeriesSparklineProps } from "./primitives/series-sparkline.js";
|
|
107
|
+
import { ChartReferenceLine, MetricChart, MetricChartProps } from "./primitives/metric-chart.js";
|
|
103
108
|
import { FilterField, FilterFieldProps, Toolbar, ToolbarProps } from "./primitives/toolbar.js";
|
|
104
109
|
import { Logo, LogoProps, TangleKnot } from "./primitives.js";
|
|
105
110
|
import { RunGroup, RunGroupProps } from "./run/run-group.js";
|
|
@@ -137,4 +142,4 @@ import { QuestionPreview, QuestionPreviewProps } from "./tool-previews/question-
|
|
|
137
142
|
import { DiffPreview, DiffPreviewProps } from "./tool-previews/diff-preview.js";
|
|
138
143
|
import { RedactedDocSegment, RedactedDocument, RedactedDocumentData, RedactedDocumentProps, RevealResult } from "./redaction/redacted-document.js";
|
|
139
144
|
import "./redaction.js";
|
|
140
|
-
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, type AvatarProps, 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, Field, type FieldProps, 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, SettingsList, type SettingsListAction, type SettingsListColumns, SettingsListItem, type SettingsListItemProps, type SettingsListMenuItem, type SettingsListProps, SettingsRow, type SettingsRowLayout, type SettingsRowProps, SettingsSection, type SettingsSectionProps, 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, Wizard, type WizardProps, WizardStep, type WizardStepProps, WriteFilePreview, type WriteFilePreviewProps, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fieldMessageId, 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 };
|
|
145
|
+
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, type AvatarProps, Badge, type BadgeProps, BeginAssistantMessageOptions, BotStreamEvent, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, CATEGORY_TONES, CSV_PREVIEW_ROW_LIMIT, Calendar, type CalendarDate, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CardTitleProps, type CategoryTone, type ChartReferenceLine, 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, Field, type FieldProps, 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, HoverCard, HoverCardContent, HoverCardDescription, HoverCardHeader, HoverCardTitle, HoverCardTrigger, 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, MetricChart, type MetricChartProps, 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, type PeriodDelta, 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, type SeriesExtent, type SeriesPoint, type SeriesPointInput, type SeriesScale, SeriesSparkline, type SeriesSparklineProps, SessionMessage, SessionPart, SessionProjectKey, type SessionUser, SettingsList, type SettingsListAction, type SettingsListColumns, SettingsListItem, type SettingsListItemProps, type SettingsListMenuItem, type SettingsListProps, SettingsRow, type SettingsRowLayout, type SettingsRowProps, SettingsSection, type SettingsSectionProps, 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, Wizard, type WizardProps, WizardStep, type WizardStepProps, WriteFilePreview, type WriteFilePreviewProps, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fieldMessageId, 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, normalizeSeries, numericColumns, parseCalendarDate, parseCsv, parseToolEvent, partMapAtom, periodDelta, plainTextFromMarkdown, registerActiveSession, resetActiveSessions, resolveFilePreviewKind, seriesAreaPath, seriesExtent, seriesLinePath, seriesMean, seriesScale, 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
|
@@ -56,8 +56,13 @@ import { CATEGORY_TONES, TONE_CLASSES, toneFor } from "./primitives/tone.js";
|
|
|
56
56
|
import { Tag } from "./primitives/tag.js";
|
|
57
57
|
import { Chip } from "./primitives/chip.js";
|
|
58
58
|
import { Wizard, WizardStep } from "./primitives/wizard.js";
|
|
59
|
+
import { HoverCard, HoverCardContent, HoverCardDescription, HoverCardHeader, HoverCardTitle, HoverCardTrigger } from "./primitives/hover-card.js";
|
|
60
|
+
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./primitives/breadcrumb.js";
|
|
59
61
|
import { IconTile, initialsOf } from "./primitives/icon-tile.js";
|
|
60
62
|
import { Metric, MetricStrip } from "./primitives/metric-strip.js";
|
|
63
|
+
import { normalizeSeries, periodDelta, seriesAreaPath, seriesExtent, seriesLinePath, seriesMean, seriesScale } from "./lib/series.js";
|
|
64
|
+
import { SeriesSparkline } from "./primitives/series-sparkline.js";
|
|
65
|
+
import { MetricChart } from "./primitives/metric-chart.js";
|
|
61
66
|
import { FilterField, Toolbar } from "./primitives/toolbar.js";
|
|
62
67
|
import { Logo, TangleKnot } from "./primitives.js";
|
|
63
68
|
import { TOOL_CATEGORY_ICONS, getToolCategory, getToolDisplayMetadata, getToolErrorText } from "./utils/tool-display.js";
|
|
@@ -121,4 +126,4 @@ import { addMessage, addParts, clearChat, isStreamingAtom, messagesAtom, partMap
|
|
|
121
126
|
import { copyText } from "./utils/copy-text.js";
|
|
122
127
|
import { timeAgo } from "./utils/time-ago.js";
|
|
123
128
|
import { RedactedDocument } from "./redaction/redacted-document.js";
|
|
124
|
-
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, Field, 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, SettingsList, SettingsListItem, SettingsRow, SettingsSection, 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, Wizard, WizardStep, WriteFilePreview, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fieldMessageId, 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 };
|
|
129
|
+
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, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, 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, Field, FileArtifactPane, FileCard, FileList, FilePreview, FileTabs, FileTree, FilterField, GitHubLoginButton, GlobResultsPreview, GrepResultsPreview, Heading, HelpText, HoverCard, HoverCardContent, HoverCardDescription, HoverCardHeader, HoverCardTitle, HoverCardTrigger, IconTile, InlineCode, InlineThinkingItem, InlineToolItem, Input, Label, LiveDuration, LoginLayout, Logo, Markdown, MessageAuthor, MessageList, Metric, MetricChart, 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, SeriesSparkline, SettingsList, SettingsListItem, SettingsRow, SettingsSection, 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, Wizard, WizardStep, WriteFilePreview, activeSessionsAtom, addMessage, addParts, badgeVariants, bumpActiveSessionActivity, buttonVariants, clearChat, cn, codeBlockGrammar, configurePdfViewer, copyText, createAuthFetcher, detectFileFormat, fenceInfo, fieldMessageId, 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, normalizeSeries, numericColumns, parseCalendarDate, parseCsv, parseToolEvent, partMapAtom, periodDelta, plainTextFromMarkdown, registerActiveSession, resetActiveSessions, resolveFilePreviewKind, seriesAreaPath, seriesExtent, seriesLinePath, seriesMean, seriesScale, 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,74 @@
|
|
|
1
|
+
//#region src/lib/series.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* src/lib/series.ts — pure time-series math shared by the chart primitives.
|
|
4
|
+
* No React, no DOM: unit-tested directly. All periods are relative to the
|
|
5
|
+
* LATEST measurement in the series, never to the wall clock, so a seeded
|
|
6
|
+
* demo or a backfilled import never goes stale.
|
|
7
|
+
*/
|
|
8
|
+
/** A point as callers supply it: `at` accepts epoch ms, ISO text or a Date. */
|
|
9
|
+
export interface SeriesPointInput {
|
|
10
|
+
at: number | string | Date;
|
|
11
|
+
value: number;
|
|
12
|
+
/** Second reading for dual series (diastolic next to systolic). */
|
|
13
|
+
value2?: number;
|
|
14
|
+
}
|
|
15
|
+
/** A normalized point: finite numbers, epoch-ms time, ascending order. */
|
|
16
|
+
export interface SeriesPoint {
|
|
17
|
+
at: number;
|
|
18
|
+
value: number;
|
|
19
|
+
value2?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Drop non-finite readings and sort by measurement time. */
|
|
22
|
+
export declare function normalizeSeries(points: readonly SeriesPointInput[]): SeriesPoint[];
|
|
23
|
+
export interface SeriesExtent {
|
|
24
|
+
/** Padded value domain. */
|
|
25
|
+
lo: number;
|
|
26
|
+
hi: number;
|
|
27
|
+
/** Time domain, never degenerate. */
|
|
28
|
+
tLo: number;
|
|
29
|
+
tHi: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Value and time extents across both readings of every point. The value
|
|
33
|
+
* domain is padded by `padding` (fraction of the span, default 0.12) and
|
|
34
|
+
* widened to cover `include`d values (reference lines). Degenerate spans
|
|
35
|
+
* open up so a flat or single-reading series still centres.
|
|
36
|
+
*/
|
|
37
|
+
export declare function seriesExtent(points: readonly SeriesPoint[], options?: {
|
|
38
|
+
padding?: number;
|
|
39
|
+
include?: readonly number[];
|
|
40
|
+
}): SeriesExtent;
|
|
41
|
+
export interface SeriesScale {
|
|
42
|
+
x: (at: number) => number;
|
|
43
|
+
y: (value: number) => number;
|
|
44
|
+
extent: SeriesExtent;
|
|
45
|
+
}
|
|
46
|
+
/** Project an extent into a `width` × `height` box with `pad` inset. */
|
|
47
|
+
export declare function seriesScale(extent: SeriesExtent, width: number, height: number, pad: number): SeriesScale;
|
|
48
|
+
export interface PeriodDelta {
|
|
49
|
+
/** Mean of the latest `windowMs` of data, ending at the last measurement. */
|
|
50
|
+
current: number;
|
|
51
|
+
/** Mean of the window before that, when such data exists. */
|
|
52
|
+
previous: number | null;
|
|
53
|
+
/** `current - previous`, or null without a populated prior window. */
|
|
54
|
+
delta: number | null;
|
|
55
|
+
}
|
|
56
|
+
/** Mean of finite values, or null when there is nothing to average. */
|
|
57
|
+
export declare function seriesMean(values: readonly number[]): number | null;
|
|
58
|
+
/**
|
|
59
|
+
* Compare the latest `windowMs` of primary readings against the window
|
|
60
|
+
* before it. Both windows end at the LATEST measurement, never the wall
|
|
61
|
+
* clock. Returns null for an empty series.
|
|
62
|
+
*/
|
|
63
|
+
export declare function periodDelta(points: readonly SeriesPoint[], windowMs: number): PeriodDelta | null;
|
|
64
|
+
/** Polyline path data for already-projected points. */
|
|
65
|
+
export declare function seriesLinePath(points: ReadonlyArray<{
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
}>): string;
|
|
69
|
+
/** Closed area path down to `baseline`, empty for fewer than two points. */
|
|
70
|
+
export declare function seriesAreaPath(points: ReadonlyArray<{
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
}>, baseline: number): string;
|
|
74
|
+
//#endregion
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/lib/series.ts
|
|
2
|
+
const asTime = (at) => {
|
|
3
|
+
const time = at instanceof Date ? at.getTime() : typeof at === "number" ? at : Date.parse(at);
|
|
4
|
+
return Number.isFinite(time) ? time : null;
|
|
5
|
+
};
|
|
6
|
+
/** Drop non-finite readings and sort by measurement time. */
|
|
7
|
+
function normalizeSeries(points) {
|
|
8
|
+
const normalized = [];
|
|
9
|
+
for (const point of points) {
|
|
10
|
+
const at = asTime(point.at);
|
|
11
|
+
if (at === null || !Number.isFinite(point.value)) continue;
|
|
12
|
+
const { value2 } = point;
|
|
13
|
+
normalized.push(value2 !== void 0 && Number.isFinite(value2) ? {
|
|
14
|
+
at,
|
|
15
|
+
value: point.value,
|
|
16
|
+
value2
|
|
17
|
+
} : {
|
|
18
|
+
at,
|
|
19
|
+
value: point.value
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return normalized.sort((a, b) => a.at - b.at);
|
|
23
|
+
}
|
|
24
|
+
const TWELVE_HOURS_MS = 432e5;
|
|
25
|
+
/**
|
|
26
|
+
* Value and time extents across both readings of every point. The value
|
|
27
|
+
* domain is padded by `padding` (fraction of the span, default 0.12) and
|
|
28
|
+
* widened to cover `include`d values (reference lines). Degenerate spans
|
|
29
|
+
* open up so a flat or single-reading series still centres.
|
|
30
|
+
*/
|
|
31
|
+
function seriesExtent(points, options = {}) {
|
|
32
|
+
const values = [...points.flatMap((point) => point.value2 === void 0 ? [point.value] : [point.value, point.value2]), ...options.include ?? []];
|
|
33
|
+
let lo = values.length > 0 ? Math.min(...values) : 0;
|
|
34
|
+
let hi = values.length > 0 ? Math.max(...values) : 1;
|
|
35
|
+
if (lo === hi) {
|
|
36
|
+
lo -= 1;
|
|
37
|
+
hi += 1;
|
|
38
|
+
}
|
|
39
|
+
const pad = (hi - lo) * (options.padding ?? .12);
|
|
40
|
+
lo -= pad;
|
|
41
|
+
hi += pad;
|
|
42
|
+
let tLo = points.length > 0 ? points[0].at : 0;
|
|
43
|
+
let tHi = points.length > 0 ? points[points.length - 1].at : 1;
|
|
44
|
+
if (tLo === tHi) {
|
|
45
|
+
tLo -= TWELVE_HOURS_MS;
|
|
46
|
+
tHi += TWELVE_HOURS_MS;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
lo,
|
|
50
|
+
hi,
|
|
51
|
+
tLo,
|
|
52
|
+
tHi
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Project an extent into a `width` × `height` box with `pad` inset. */
|
|
56
|
+
function seriesScale(extent, width, height, pad) {
|
|
57
|
+
const { lo, hi, tLo, tHi } = extent;
|
|
58
|
+
return {
|
|
59
|
+
extent,
|
|
60
|
+
x: (at) => pad + (at - tLo) / (tHi - tLo) * (width - 2 * pad),
|
|
61
|
+
y: (value) => height - pad - (value - lo) / (hi - lo) * (height - 2 * pad)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Mean of finite values, or null when there is nothing to average. */
|
|
65
|
+
function seriesMean(values) {
|
|
66
|
+
const finite = values.filter((value) => Number.isFinite(value));
|
|
67
|
+
if (finite.length === 0) return null;
|
|
68
|
+
return finite.reduce((sum, value) => sum + value, 0) / finite.length;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Compare the latest `windowMs` of primary readings against the window
|
|
72
|
+
* before it. Both windows end at the LATEST measurement, never the wall
|
|
73
|
+
* clock. Returns null for an empty series.
|
|
74
|
+
*/
|
|
75
|
+
function periodDelta(points, windowMs) {
|
|
76
|
+
if (points.length === 0) return null;
|
|
77
|
+
const latest = points[points.length - 1].at;
|
|
78
|
+
const recentStart = latest - windowMs;
|
|
79
|
+
const previousStart = latest - 2 * windowMs;
|
|
80
|
+
const recent = points.filter((point) => point.at > recentStart).map((point) => point.value);
|
|
81
|
+
const previous = points.filter((point) => point.at > previousStart && point.at <= recentStart).map((point) => point.value);
|
|
82
|
+
const current = seriesMean(recent);
|
|
83
|
+
const previousMean = seriesMean(previous);
|
|
84
|
+
return {
|
|
85
|
+
current,
|
|
86
|
+
previous: previousMean,
|
|
87
|
+
delta: previousMean !== null ? current - previousMean : null
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/** Polyline path data for already-projected points. */
|
|
91
|
+
function seriesLinePath(points) {
|
|
92
|
+
return points.map((point, index) => `${index === 0 ? "M" : "L"}${point.x.toFixed(2)},${point.y.toFixed(2)}`).join(" ");
|
|
93
|
+
}
|
|
94
|
+
/** Closed area path down to `baseline`, empty for fewer than two points. */
|
|
95
|
+
function seriesAreaPath(points, baseline) {
|
|
96
|
+
if (points.length < 2) return "";
|
|
97
|
+
return `${seriesLinePath(points)}L${points[points.length - 1].x.toFixed(2)},${baseline}L${points[0].x.toFixed(2)},${baseline}Z`;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { normalizeSeries, periodDelta, seriesAreaPath, seriesExtent, seriesLinePath, seriesMean, seriesScale };
|
package/dist/presentation.d.ts
CHANGED
|
@@ -42,6 +42,19 @@ export declare const metricLayouts: {
|
|
|
42
42
|
readonly 5: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 max-sm:[&>div:not(:nth-child(2n+1))]:border-l sm:max-lg:[&>div:not(:nth-child(3n+1))]:border-l lg:[&>div:not(:nth-child(5n+1))]:border-l";
|
|
43
43
|
readonly 6: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 max-sm:[&>div:not(:nth-child(2n+1))]:border-l sm:max-lg:[&>div:not(:nth-child(3n+1))]:border-l lg:[&>div:not(:nth-child(6n+1))]:border-l";
|
|
44
44
|
};
|
|
45
|
+
/** Hand-rolled SVG charts: every stroke and fill is currentColor against a
|
|
46
|
+
* token class, so ink stays theme-aware with no hardcoded hues. Charts draw
|
|
47
|
+
* lines and text only; the grouping plane (border, surface) is caller-owned. */
|
|
48
|
+
export declare const chartPresentation: {
|
|
49
|
+
readonly sparkline: "h-9 w-full text-primary";
|
|
50
|
+
readonly root: "h-auto w-full";
|
|
51
|
+
readonly axis: "text-muted-foreground";
|
|
52
|
+
readonly gridLine: "opacity-20";
|
|
53
|
+
readonly referenceLine: "opacity-60";
|
|
54
|
+
readonly primarySeries: "text-primary";
|
|
55
|
+
readonly secondarySeries: "text-muted-foreground";
|
|
56
|
+
readonly area: "opacity-10";
|
|
57
|
+
};
|
|
45
58
|
export declare const dialogPresentation: {
|
|
46
59
|
readonly overlay: "fixed inset-0 z-50 bg-black/40";
|
|
47
60
|
readonly transition: "data-[state=open]:[animation:tangle-surface-present_var(--motion-surface)_both] data-[state=delayed-open]:[animation:tangle-surface-present_var(--motion-surface)_both] data-[state=instant-open]:[animation:tangle-surface-present_var(--motion-surface)_both] data-[state=closed]:[animation:tangle-surface-absent_var(--motion-dismiss)_both] motion-reduce:animate-none!";
|
package/dist/presentation.js
CHANGED
|
@@ -89,6 +89,19 @@ const metricLayouts = {
|
|
|
89
89
|
5: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 max-sm:[&>div:not(:nth-child(2n+1))]:border-l sm:max-lg:[&>div:not(:nth-child(3n+1))]:border-l lg:[&>div:not(:nth-child(5n+1))]:border-l",
|
|
90
90
|
6: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 max-sm:[&>div:not(:nth-child(2n+1))]:border-l sm:max-lg:[&>div:not(:nth-child(3n+1))]:border-l lg:[&>div:not(:nth-child(6n+1))]:border-l"
|
|
91
91
|
};
|
|
92
|
+
/** Hand-rolled SVG charts: every stroke and fill is currentColor against a
|
|
93
|
+
* token class, so ink stays theme-aware with no hardcoded hues. Charts draw
|
|
94
|
+
* lines and text only; the grouping plane (border, surface) is caller-owned. */
|
|
95
|
+
const chartPresentation = {
|
|
96
|
+
sparkline: "h-9 w-full text-primary",
|
|
97
|
+
root: "h-auto w-full",
|
|
98
|
+
axis: "text-muted-foreground",
|
|
99
|
+
gridLine: "opacity-20",
|
|
100
|
+
referenceLine: "opacity-60",
|
|
101
|
+
primarySeries: "text-primary",
|
|
102
|
+
secondarySeries: "text-muted-foreground",
|
|
103
|
+
area: "opacity-10"
|
|
104
|
+
};
|
|
92
105
|
const dialogPresentation = {
|
|
93
106
|
overlay: "fixed inset-0 z-50 bg-black/40",
|
|
94
107
|
transition: surfaceMotion,
|
|
@@ -181,4 +194,4 @@ const tabsPresentation = {
|
|
|
181
194
|
}
|
|
182
195
|
};
|
|
183
196
|
//#endregion
|
|
184
|
-
export { bindDialog, buttonVariants, cardPresentation, controlHeight, controlMotion, controlRadius, controlSizes, controlText, dialogPresentation, emptyStatePresentation, fieldPresentation, fieldSizes, fieldTouchText, helpPresentation, inputVariants, ixControlSoft, ixSelected, ixTabUnderline, labelVariants, metricLayouts, metricPresentation, tablePresentation, tabsPresentation };
|
|
197
|
+
export { bindDialog, buttonVariants, cardPresentation, chartPresentation, controlHeight, controlMotion, controlRadius, controlSizes, controlText, dialogPresentation, emptyStatePresentation, fieldPresentation, fieldSizes, fieldTouchText, helpPresentation, inputVariants, ixControlSoft, ixSelected, ixTabUnderline, labelVariants, metricLayouts, metricPresentation, tablePresentation, tabsPresentation };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/primitives/breadcrumb.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Where you are inside a nested surface — the workspace, its settings, the
|
|
5
|
+
* section you're in. Each crumb is a link except the last, which is the page.
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Breadcrumb>
|
|
9
|
+
* <BreadcrumbList>
|
|
10
|
+
* <BreadcrumbItem><BreadcrumbLink href="/workspaces/ws-1">Recenter demo</BreadcrumbLink></BreadcrumbItem>
|
|
11
|
+
* <BreadcrumbSeparator />
|
|
12
|
+
* <BreadcrumbItem><BreadcrumbLink href="/workspaces/ws-1/settings">Settings</BreadcrumbLink></BreadcrumbItem>
|
|
13
|
+
* <BreadcrumbSeparator />
|
|
14
|
+
* <BreadcrumbItem><BreadcrumbPage>Connections</BreadcrumbPage></BreadcrumbItem>
|
|
15
|
+
* </BreadcrumbList>
|
|
16
|
+
* </Breadcrumb>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* On narrow viewports the list scrolls horizontally with a fade mask rather
|
|
20
|
+
* than wrapping — a crumb trail reads as one line, not a paragraph.
|
|
21
|
+
*/
|
|
22
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
23
|
+
separator?: React.ReactNode;
|
|
24
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<React.OlHTMLAttributes<HTMLOListElement> & React.RefAttributes<HTMLOListElement>>;
|
|
26
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<React.LiHTMLAttributes<HTMLLIElement> & React.RefAttributes<HTMLLIElement>>;
|
|
27
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
|
|
28
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
29
|
+
declare const BreadcrumbSeparator: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
30
|
+
declare const BreadcrumbEllipsis: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & React.RefAttributes<HTMLSpanElement>>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
//#region src/primitives/breadcrumb.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Where you are inside a nested surface — the workspace, its settings, the
|
|
8
|
+
* section you're in. Each crumb is a link except the last, which is the page.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Breadcrumb>
|
|
12
|
+
* <BreadcrumbList>
|
|
13
|
+
* <BreadcrumbItem><BreadcrumbLink href="/workspaces/ws-1">Recenter demo</BreadcrumbLink></BreadcrumbItem>
|
|
14
|
+
* <BreadcrumbSeparator />
|
|
15
|
+
* <BreadcrumbItem><BreadcrumbLink href="/workspaces/ws-1/settings">Settings</BreadcrumbLink></BreadcrumbItem>
|
|
16
|
+
* <BreadcrumbSeparator />
|
|
17
|
+
* <BreadcrumbItem><BreadcrumbPage>Connections</BreadcrumbPage></BreadcrumbItem>
|
|
18
|
+
* </BreadcrumbList>
|
|
19
|
+
* </Breadcrumb>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* On narrow viewports the list scrolls horizontally with a fade mask rather
|
|
23
|
+
* than wrapping — a crumb trail reads as one line, not a paragraph.
|
|
24
|
+
*/
|
|
25
|
+
const Breadcrumb = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("nav", {
|
|
26
|
+
ref,
|
|
27
|
+
"aria-label": "Breadcrumb",
|
|
28
|
+
className: cn("relative", className),
|
|
29
|
+
...props
|
|
30
|
+
}));
|
|
31
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
32
|
+
const BreadcrumbList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("ol", {
|
|
33
|
+
ref,
|
|
34
|
+
className: cn("flex items-center gap-1.5 text-sm text-muted-foreground overflow-x-auto", "[mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-16px),transparent)]", "[-webkit-mask-image:linear-gradient(to_right,transparent,black_16px,black_calc(100%-16px),transparent)]", "scrollbar-none", className),
|
|
35
|
+
...props
|
|
36
|
+
}));
|
|
37
|
+
BreadcrumbList.displayName = "BreadcrumbList";
|
|
38
|
+
const BreadcrumbItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("li", {
|
|
39
|
+
ref,
|
|
40
|
+
className: cn("inline-flex items-center gap-1.5 shrink-0", className),
|
|
41
|
+
...props
|
|
42
|
+
}));
|
|
43
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
44
|
+
const BreadcrumbLink = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("a", {
|
|
45
|
+
ref,
|
|
46
|
+
className: cn("transition-colors hover:text-foreground", className),
|
|
47
|
+
...props
|
|
48
|
+
}));
|
|
49
|
+
BreadcrumbLink.displayName = "BreadcrumbLink";
|
|
50
|
+
const BreadcrumbPage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("span", {
|
|
51
|
+
ref,
|
|
52
|
+
role: "link",
|
|
53
|
+
"aria-disabled": "true",
|
|
54
|
+
"aria-current": "page",
|
|
55
|
+
className: cn("font-normal text-foreground", className),
|
|
56
|
+
...props
|
|
57
|
+
}));
|
|
58
|
+
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
59
|
+
const BreadcrumbSeparator = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("span", {
|
|
60
|
+
ref,
|
|
61
|
+
role: "presentation",
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
className: cn("shrink-0 text-muted-foreground/60", className),
|
|
64
|
+
...props,
|
|
65
|
+
children: children ?? /* @__PURE__ */ jsx(ChevronRight, {
|
|
66
|
+
className: "size-3.5",
|
|
67
|
+
"aria-hidden": true
|
|
68
|
+
})
|
|
69
|
+
}));
|
|
70
|
+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
71
|
+
const BreadcrumbEllipsis = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs("span", {
|
|
72
|
+
ref,
|
|
73
|
+
role: "presentation",
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
className: cn("flex size-6 items-center justify-center", className),
|
|
76
|
+
...props,
|
|
77
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "text-muted-foreground",
|
|
79
|
+
children: "…"
|
|
80
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
81
|
+
className: "sr-only",
|
|
82
|
+
children: "More"
|
|
83
|
+
})]
|
|
84
|
+
}));
|
|
85
|
+
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
86
|
+
//#endregion
|
|
87
|
+
export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
3
|
+
//#region src/primitives/hover-card.d.ts
|
|
4
|
+
declare const HoverCard: React.FC<HoverCardPrimitive.HoverCardProps>;
|
|
5
|
+
declare const HoverCardTrigger: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
|
|
6
|
+
declare const HoverCardContent: React.ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
7
|
+
/** Which edge the card prefers. Defaults to bottom. */
|
|
8
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
9
|
+
/** Pixel gap from the trigger. Defaults to 6. */
|
|
10
|
+
alignOffset?: number;
|
|
11
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare function HoverCardHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
13
|
+
declare function HoverCardTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): React.JSX.Element;
|
|
14
|
+
declare function HoverCardDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { HoverCard, HoverCardContent, HoverCardDescription, HoverCardHeader, HoverCardTitle, HoverCardTrigger };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
5
|
+
//#region src/primitives/hover-card.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A rich hover preview: the face of a person, product, or record that appears
|
|
8
|
+
* when you pause on its trigger. Radix HoverCard under the hood, styled on the
|
|
9
|
+
* md3 surface ladder — the card sits on `--md3-surface-container-highest`
|
|
10
|
+
* (L4, the overlay plane) so it reads as a floating layer above the page.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <HoverCard>
|
|
14
|
+
* <HoverCardTrigger>@noa</HoverCardTrigger>
|
|
15
|
+
* <HoverCardContent>
|
|
16
|
+
* <HoverCardHeader>
|
|
17
|
+
* <HoverCardTitle>Noa</HoverCardTitle>
|
|
18
|
+
* <HoverCardDescription>Housekeeping · es</HoverCardDescription>
|
|
19
|
+
* </HoverCardHeader>
|
|
20
|
+
* <p>3 rooms today · 1 pending</p>
|
|
21
|
+
* </HoverCardContent>
|
|
22
|
+
* </HoverCard>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* The content is **lazy** — it mounts only when hovered, so a page of 50
|
|
26
|
+
* triggers costs nothing until the person pauses on one.
|
|
27
|
+
*/
|
|
28
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
29
|
+
const HoverCardTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(HoverCardPrimitive.Trigger, {
|
|
30
|
+
ref,
|
|
31
|
+
className: cn("cursor-pointer underline-offset-4 hover:underline", className),
|
|
32
|
+
...props
|
|
33
|
+
}));
|
|
34
|
+
HoverCardTrigger.displayName = HoverCardPrimitive.Trigger.displayName;
|
|
35
|
+
const HoverCardContent = React.forwardRef(({ className, side = "bottom", alignOffset = 6, ...props }, ref) => /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(HoverCardPrimitive.Content, {
|
|
36
|
+
ref,
|
|
37
|
+
side,
|
|
38
|
+
alignOffset,
|
|
39
|
+
sideOffset: 6,
|
|
40
|
+
className: cn("z-50 w-64 rounded-lg border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", className),
|
|
41
|
+
...props
|
|
42
|
+
}) }));
|
|
43
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
44
|
+
function HoverCardHeader({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: cn("flex flex-col gap-1 pb-2", className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function HoverCardTitle({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx("h4", {
|
|
52
|
+
className: cn("text-sm font-semibold leading-none", className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function HoverCardDescription({ className, ...props }) {
|
|
57
|
+
return /* @__PURE__ */ jsx("p", {
|
|
58
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { HoverCard, HoverCardContent, HoverCardDescription, HoverCardHeader, HoverCardTitle, HoverCardTrigger };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SeriesPointInput } from "../lib/series.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/primitives/metric-chart.d.ts
|
|
4
|
+
export interface ChartReferenceLine {
|
|
5
|
+
value: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Which reading the line applies to for a dual series. A secondary line
|
|
8
|
+
* on a single-reading series is not drawn. */
|
|
9
|
+
series?: "primary" | "secondary";
|
|
10
|
+
}
|
|
11
|
+
export type MetricChartProps = Omit<React.SVGAttributes<SVGSVGElement>, "points"> & {
|
|
12
|
+
points: SeriesPointInput[];
|
|
13
|
+
/** Accessible name; also rendered as the svg title. */
|
|
14
|
+
title: string;
|
|
15
|
+
/** Unit noun for the generated description ("bpm", "ms"). */
|
|
16
|
+
unit?: string;
|
|
17
|
+
/** Fraction digits for tick labels and the description. Defaults to a
|
|
18
|
+
* maximum of two. */
|
|
19
|
+
decimals?: number;
|
|
20
|
+
referenceLines?: ChartReferenceLine[];
|
|
21
|
+
/** Overrides the generated <desc> summary. */
|
|
22
|
+
description?: string;
|
|
23
|
+
formatValue?: (value: number) => string;
|
|
24
|
+
formatTime?: (at: number) => string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A labelled line chart: y gridlines, x date ticks, optional dashed
|
|
28
|
+
* reference lines and a dotted secondary series for dual readings
|
|
29
|
+
* (`value2`). Hand-rolled SVG, viewBox-scaled, currentColor throughout.
|
|
30
|
+
*/
|
|
31
|
+
declare const MetricChart: React.ForwardRefExoticComponent<Omit<React.SVGAttributes<SVGSVGElement>, "points"> & {
|
|
32
|
+
points: SeriesPointInput[];
|
|
33
|
+
/** Accessible name; also rendered as the svg title. */
|
|
34
|
+
title: string;
|
|
35
|
+
/** Unit noun for the generated description ("bpm", "ms"). */
|
|
36
|
+
unit?: string;
|
|
37
|
+
/** Fraction digits for tick labels and the description. Defaults to a
|
|
38
|
+
* maximum of two. */
|
|
39
|
+
decimals?: number;
|
|
40
|
+
referenceLines?: ChartReferenceLine[];
|
|
41
|
+
/** Overrides the generated <desc> summary. */
|
|
42
|
+
description?: string;
|
|
43
|
+
formatValue?: (value: number) => string;
|
|
44
|
+
formatTime?: (at: number) => string;
|
|
45
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { MetricChart };
|