@cueplusplus/ui 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +195 -0
- package/README.md +109 -3
- package/dist/chrome/index.d.ts +2 -1
- package/dist/chrome/index.js +3 -2
- package/dist/chrome/inspector.d.ts +61 -0
- package/dist/chrome/inspector.js +121 -0
- package/dist/elements/scroll-anchor.js +4 -2
- package/dist/forms/input.d.ts +12 -0
- package/dist/forms/textarea.d.ts +12 -0
- package/dist/forms/toggle.d.ts +6 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +5 -2
- package/dist/instruments/code-block.d.ts +35 -0
- package/dist/instruments/code-block.js +173 -0
- package/dist/instruments/index.d.ts +2 -1
- package/dist/instruments/index.js +2 -1
- package/dist/layout/bento.js +1 -1
- package/dist/layout/index.d.ts +2 -1
- package/dist/layout/index.js +2 -1
- package/dist/layout/preview.d.ts +110 -0
- package/dist/layout/preview.js +459 -0
- package/dist/primitives/chip.d.ts +1 -1
- package/manifest/components/activity-graph.json +2 -1
- package/manifest/components/agent-card.json +2 -1
- package/manifest/components/agent-pile.json +2 -1
- package/manifest/components/background-inbox.json +2 -1
- package/manifest/components/breadcrumb.json +2 -1
- package/manifest/components/chart-tooltip-content.json +2 -1
- package/manifest/components/checkpoint-history.json +2 -1
- package/manifest/components/code-block.json +106 -0
- package/manifest/components/code-diff.json +2 -1
- package/manifest/components/combobox.json +2 -1
- package/manifest/components/comparison-card.json +2 -1
- package/manifest/components/composer-attachment-chip.json +2 -1
- package/manifest/components/composer-context.json +2 -1
- package/manifest/components/composer-model-item.json +2 -1
- package/manifest/components/composer-person-item.json +2 -1
- package/manifest/components/computer-use.json +2 -1
- package/manifest/components/confidence-marker.json +2 -1
- package/manifest/components/context-breakdown.json +2 -1
- package/manifest/components/context-usage.json +2 -1
- package/manifest/components/conversation-search.json +2 -1
- package/manifest/components/cost-meter.json +2 -1
- package/manifest/components/day-separator.json +2 -1
- package/manifest/components/document-reference.json +2 -1
- package/manifest/components/elements-command-palette.json +2 -1
- package/manifest/components/elements-timeline.json +2 -1
- package/manifest/components/elicitation-form.json +2 -1
- package/manifest/components/file-tree.json +2 -1
- package/manifest/components/flow-graph.json +4 -2
- package/manifest/components/frac.json +1 -1
- package/manifest/components/group-bar.json +2 -1
- package/manifest/components/inline-citation.json +2 -1
- package/manifest/components/input.json +20 -0
- package/manifest/components/inspector.json +199 -0
- package/manifest/components/job-progress.json +2 -1
- package/manifest/components/log-viewer.json +2 -1
- package/manifest/components/map-answer.json +2 -1
- package/manifest/components/math-block.json +1 -1
- package/manifest/components/mcp-server-panel.json +2 -1
- package/manifest/components/memory-chips.json +2 -1
- package/manifest/components/message-actions.json +2 -1
- package/manifest/components/message-attachments.json +2 -1
- package/manifest/components/message-queue.json +2 -1
- package/manifest/components/message-timing.json +2 -1
- package/manifest/components/meter.json +1 -1
- package/manifest/components/model-picker.json +2 -1
- package/manifest/components/multi-select.json +2 -1
- package/manifest/components/onboarding.json +2 -1
- package/manifest/components/password-input.json +20 -0
- package/manifest/components/preview.json +202 -0
- package/manifest/components/prompt-library.json +2 -1
- package/manifest/components/queue-dock.json +2 -1
- package/manifest/components/quote-reply.json +2 -1
- package/manifest/components/reasoning-effort.json +2 -1
- package/manifest/components/reasoning-panel.json +2 -1
- package/manifest/components/regenerate-menu.json +2 -1
- package/manifest/components/research-report.json +2 -1
- package/manifest/components/retrieval-chunks.json +2 -1
- package/manifest/components/reviewable-diff.json +2 -1
- package/manifest/components/schedule-card.json +2 -1
- package/manifest/components/score-breakdown.json +2 -1
- package/manifest/components/scroll-anchor.json +2 -1
- package/manifest/components/search-input.json +20 -0
- package/manifest/components/segmented-control.json +2 -1
- package/manifest/components/settings-panel.json +2 -1
- package/manifest/components/shared-conversation.json +2 -1
- package/manifest/components/sources.json +2 -1
- package/manifest/components/speaker-identity.json +2 -1
- package/manifest/components/spec-sheet.json +2 -1
- package/manifest/components/spectrum-visualizer.json +2 -1
- package/manifest/components/stepper.json +2 -1
- package/manifest/components/streaming-text.json +2 -1
- package/manifest/components/sub.json +1 -1
- package/manifest/components/subagent-list.json +4 -2
- package/manifest/components/sup.json +1 -1
- package/manifest/components/swap-label.json +2 -1
- package/manifest/components/textarea.json +20 -0
- package/manifest/components/thread-list.json +2 -1
- package/manifest/components/thread-search.json +2 -1
- package/manifest/components/todo-list.json +2 -1
- package/manifest/components/toggle.json +10 -0
- package/manifest/components/tool-group.json +2 -1
- package/manifest/components/trace-waterfall.json +2 -1
- package/manifest/components/tree.json +2 -1
- package/manifest/components/universe-grid.json +2 -1
- package/manifest/components/usage-chart.json +2 -1
- package/manifest/components/voice-conversation.json +2 -1
- package/manifest/components/web-search.json +2 -1
- package/manifest/fixtures.json +670 -0
- package/manifest/manifest.json +125 -86
- package/manifest/tokens.json +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { EmptyState, EmptyStateProps } from "./chrome/empty-state.js";
|
|
|
18
18
|
import { Eyebrow, EyebrowProps } from "./chrome/eyebrow.js";
|
|
19
19
|
import { Container, ContainerProps, ContainerWidth } from "./layout/container.js";
|
|
20
20
|
import { Footer, FooterProps } from "./chrome/footer.js";
|
|
21
|
+
import { Inspector, InspectorFooterProps, InspectorRootProps, InspectorRowProps, InspectorSectionProps } from "./chrome/inspector.js";
|
|
21
22
|
import { NavigationMenu, NavigationMenuContentProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuListProps, NavigationMenuRootProps, NavigationMenuTriggerProps, NavigationMenuViewportProps } from "./chrome/navigation-menu.js";
|
|
22
23
|
import { PageShell, PageShellProps, PageWidth } from "./chrome/page-shell.js";
|
|
23
24
|
import { Panel, PanelHeader, PanelHeaderProps, PanelProps } from "./chrome/panel.js";
|
|
@@ -69,6 +70,7 @@ import { AudienceIcon, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, CliT
|
|
|
69
70
|
import "./icons/index.js";
|
|
70
71
|
import { activateRowFromClick, activateRowFromKeyDown } from "./instruments/_data-row.js";
|
|
71
72
|
import { AppWindowFrame, AppWindowFrameProps } from "./instruments/app-window-frame.js";
|
|
73
|
+
import { CodeBlock, CodeBlockProps } from "./instruments/code-block.js";
|
|
72
74
|
import { Button, ButtonProps, buttonVariants } from "./primitives/button.js";
|
|
73
75
|
import { CopyButton, CopyButtonProps } from "./instruments/copy-button.js";
|
|
74
76
|
import { DataRow, DataRowDisclosure, DataRowRootProps, DataRowSlotProps } from "./instruments/data-row.js";
|
|
@@ -95,6 +97,7 @@ import { DescriptionList, DescriptionListDetailProps, DescriptionListLayout, Des
|
|
|
95
97
|
import { Grid, GridColumns, GridProps } from "./layout/grid.js";
|
|
96
98
|
import { Item, ItemProps, itemVariants } from "./layout/item.js";
|
|
97
99
|
import { Pagination, PaginationEntry, PaginationProps, paginationRange } from "./layout/pagination.js";
|
|
100
|
+
import { Preview, PreviewAxis, PreviewProps, PreviewResizeOptions } from "./layout/preview.js";
|
|
98
101
|
import { Stepper, StepperProps, StepperState, StepperStep } from "./layout/stepper.js";
|
|
99
102
|
import { StatusDot, StatusDotProps, StatusTone } from "./primitives/status-dot.js";
|
|
100
103
|
import { Timeline, TimelineContentProps, TimelineItemProps, TimelineMarkerProps, TimelineRootProps } from "./layout/timeline.js";
|
|
@@ -129,4 +132,4 @@ import { useDensities, useFonts, useThemes } from "./system/theme-registry.js";
|
|
|
129
132
|
import { ControlSize, useControlHeight, useDensity } from "./system/use-density.js";
|
|
130
133
|
import { useTheme } from "./system/use-theme.js";
|
|
131
134
|
import { DensityEntry, DensityLevel, FontEntry, FontName, Mode, ThemeManifest, ThemeName } from "./system/index.js";
|
|
132
|
-
export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, type AgentColorOptions, AgentPile, type AgentPileEntry, type AgentPileProps, type AgentPileSize, AlertDialog, type AlertDialogActionProps, type AlertDialogCancelProps, type AlertDialogContentProps, type AlertDialogDescriptionProps, type AlertDialogFooterProps, type AlertDialogRootProps, type AlertDialogTitleProps, type AlertDialogTriggerProps, AppBar, type AppBarActionsProps, type AppBarBrandProps, type AppBarLinkProps, type AppBarNavProps, type AppBarRegister, type AppBarRootProps, type AppBarSeparatorProps, AppShell, type AppShellAsideProps, type AppShellBarProps, type AppShellBodyProps, type AppShellContentProps, type AppShellNavTriggerProps, type AppShellRootProps, type AppShellScrollerProps, type AppShellSidebarProps, AppWindowFrame, type AppWindowFrameProps, type AskAnswer, AskBox, type AskBoxProps, type AskDanger, type AskKind, type AskOption, AudienceIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, type BarOverflow, Bento, type BentoColumns, type BentoMinHeight, type BentoRootProps, type BentoRowSpan, type BentoRows, type BentoSpan, type BentoTileProps, type BrandAssetProps, type BrandSize, type BrandTone, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupOrientation, type ButtonGroupProps, type ButtonProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, CliToolIcon, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, Composer, type ComposerProps, type ComposerSubmitKey, Container, type ContainerProps, type ContainerWidth, ContextMenu, type ContextMenuContentProps, type ContextMenuRootProps, type ContextMenuTriggerProps, type ControlSize, type ControlVariantProps, CopyButton, type CopyButtonProps, CueLogotype, type CueLogotypeProps, CueMark, type CueMarkProps, CuePortalFrame, type CuePortalFrameProps, DEFAULT_STORAGE_KEY, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, DelegationCard, type DelegationCardProps, type DelegationDirection, type DelegationStatus, Density, type DensityEntry, type DensityLevel, type DensityProps, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Dialog, type DialogCloseProps, type DialogContentProps, type DialogDescriptionProps, type DialogFooterProps, type DialogRootProps, type DialogTitleProps, type DialogTriggerProps, Disclosure, type DisclosureProps, Drawer, type DrawerCloseProps, type DrawerContentProps, type DrawerDescriptionProps, type DrawerFooterProps, type DrawerRootProps, type DrawerSwipeDirection, type DrawerTitleProps, type DrawerTriggerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRootProps, type DropdownMenuSeparatorProps, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, EnvVarInput, type EnvVarInputProps, Eyebrow, type EyebrowProps, Field, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorProps, type FieldIssue, FieldLabel, type FieldLabelProps, type FieldProps, type FilePartition, type FilePartitionOptions, type FileRejectReason, type FileRejection, FileUpload, type FileUploadProps, FolderIcon, type FontEntry, type FontFamilies, type FontName, Footer, type FooterProps, type FormControlSize, Grid, type GridColumns, type GridProps, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, HoverCard, type HoverCardContentProps, type HoverCardRootProps, type HoverCardTriggerProps, IconButton, type IconButtonProps, InfoTip, type InfoTipProps, Input, InputGroup, type InputGroupProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Link, type LinkProps, McpServerIcon, Menubar, type MenubarContentProps, type MenubarMenuProps, type MenubarRootProps, type MenubarTriggerProps, Message, MessageList, type MessageListProps, type MessageProps, type MessageRole, Meter, type MeterProps, type MeterProvenance, type MeterTone, type Mode, MultiSelect, type MultiSelectProps, NavigationMenu, type NavigationMenuContentProps, type NavigationMenuItemProps, type NavigationMenuLinkProps, type NavigationMenuListProps, type NavigationMenuRootProps, type NavigationMenuTriggerProps, type NavigationMenuViewportProps, NumberField, type NumberFieldProps, OTPField, type OTPFieldProps, OVERLAY_SIDE_OFFSET, PageShell, type PageShellProps, type PageWidth, Pagination, type PaginationEntry, type PaginationProps, Panel, PanelHeader, type PanelHeaderProps, type PanelProps, PasswordInput, type PasswordInputProps, type PersistedPreferences, Plussie, type PlussieExpression, type PlussieProps, Popover, type PopoverCloseProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverRootProps, type PopoverTitleProps, type PopoverTriggerProps, type PrepaintDefaults, type PrepaintOptions, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type RatingSize, type ResolvedMode, Row, type RowProps, ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps, type ScrollEdges, ScrollableTabsList, type ScrollableTabsListProps, ScrubInput, type ScrubInputProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, SeamList, type SeamListProps, SearchInput, type SearchInputProps, SectionHeader, type SectionHeaderProps, SegmentedControl, type SegmentedControlItem, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetCloseProps, type SheetContentProps, type SheetDescriptionProps, type SheetFooterProps, type SheetRootProps, type SheetTitleProps, type SheetTriggerProps, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, Skeleton, type SkeletonProps, SkillIcon, Slider, type SliderProps, type SpaceStep, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, type StackAlign, StackIcon, type StackJustify, type StackProps, StacksMatrixIcon, Stat, type StatProps, type StatTone, StatusBar, type StatusBarGroupProps, type StatusBarItemProps, type StatusBarProminence, type StatusBarProps, type StatusBarTone, StatusDot, type StatusDotProps, type StatusTone, Stepper, type StepperProps, type StepperState, type StepperStep, Switch, type SwitchProps, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, TagsInput, type TagsInputProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, Textarea, type TextareaProps, type ThemeContextValue, type ThemeManifest, type ThemeName, ThemeProvider, type ThemeProviderProps, type ThemeRegistry, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, TitleBar, type TitleBarProps, Toast, type ToastManager, type ToastOptions, type ToastProviderProps, type ToastTone, type ToastViewportProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, type TokenOverrides, Toolbar, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarRootProps, type ToolbarSeparatorProps, Tooltip, type TooltipContentProps, type TooltipProviderProps, type TooltipRootProps, type TooltipTriggerProps, Tree, type TreeGuide, type TreeItem, type TreeProps, type TreeRow, type TreeVisibility, TreeVisibilityToggle, type TreeVisibilityToggleProps, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, type UploadFile, type UploadStatus, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, isSafeTokenValue, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
|
|
135
|
+
export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, type AgentColorOptions, AgentPile, type AgentPileEntry, type AgentPileProps, type AgentPileSize, AlertDialog, type AlertDialogActionProps, type AlertDialogCancelProps, type AlertDialogContentProps, type AlertDialogDescriptionProps, type AlertDialogFooterProps, type AlertDialogRootProps, type AlertDialogTitleProps, type AlertDialogTriggerProps, AppBar, type AppBarActionsProps, type AppBarBrandProps, type AppBarLinkProps, type AppBarNavProps, type AppBarRegister, type AppBarRootProps, type AppBarSeparatorProps, AppShell, type AppShellAsideProps, type AppShellBarProps, type AppShellBodyProps, type AppShellContentProps, type AppShellNavTriggerProps, type AppShellRootProps, type AppShellScrollerProps, type AppShellSidebarProps, AppWindowFrame, type AppWindowFrameProps, type AskAnswer, AskBox, type AskBoxProps, type AskDanger, type AskKind, type AskOption, AudienceIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, type BarOverflow, Bento, type BentoColumns, type BentoMinHeight, type BentoRootProps, type BentoRowSpan, type BentoRows, type BentoSpan, type BentoTileProps, type BrandAssetProps, type BrandSize, type BrandTone, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupOrientation, type ButtonGroupProps, type ButtonProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, CliToolIcon, CodeBlock, type CodeBlockProps, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, Composer, type ComposerProps, type ComposerSubmitKey, Container, type ContainerProps, type ContainerWidth, ContextMenu, type ContextMenuContentProps, type ContextMenuRootProps, type ContextMenuTriggerProps, type ControlSize, type ControlVariantProps, CopyButton, type CopyButtonProps, CueLogotype, type CueLogotypeProps, CueMark, type CueMarkProps, CuePortalFrame, type CuePortalFrameProps, DEFAULT_STORAGE_KEY, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, DelegationCard, type DelegationCardProps, type DelegationDirection, type DelegationStatus, Density, type DensityEntry, type DensityLevel, type DensityProps, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Dialog, type DialogCloseProps, type DialogContentProps, type DialogDescriptionProps, type DialogFooterProps, type DialogRootProps, type DialogTitleProps, type DialogTriggerProps, Disclosure, type DisclosureProps, Drawer, type DrawerCloseProps, type DrawerContentProps, type DrawerDescriptionProps, type DrawerFooterProps, type DrawerRootProps, type DrawerSwipeDirection, type DrawerTitleProps, type DrawerTriggerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRootProps, type DropdownMenuSeparatorProps, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, EnvVarInput, type EnvVarInputProps, Eyebrow, type EyebrowProps, Field, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorProps, type FieldIssue, FieldLabel, type FieldLabelProps, type FieldProps, type FilePartition, type FilePartitionOptions, type FileRejectReason, type FileRejection, FileUpload, type FileUploadProps, FolderIcon, type FontEntry, type FontFamilies, type FontName, Footer, type FooterProps, type FormControlSize, Grid, type GridColumns, type GridProps, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, HoverCard, type HoverCardContentProps, type HoverCardRootProps, type HoverCardTriggerProps, IconButton, type IconButtonProps, InfoTip, type InfoTipProps, Input, InputGroup, type InputGroupProps, type InputProps, Inspector, type InspectorFooterProps, type InspectorRootProps, type InspectorRowProps, type InspectorSectionProps, Item, type ItemProps, Kbd, type KbdProps, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Link, type LinkProps, McpServerIcon, Menubar, type MenubarContentProps, type MenubarMenuProps, type MenubarRootProps, type MenubarTriggerProps, Message, MessageList, type MessageListProps, type MessageProps, type MessageRole, Meter, type MeterProps, type MeterProvenance, type MeterTone, type Mode, MultiSelect, type MultiSelectProps, NavigationMenu, type NavigationMenuContentProps, type NavigationMenuItemProps, type NavigationMenuLinkProps, type NavigationMenuListProps, type NavigationMenuRootProps, type NavigationMenuTriggerProps, type NavigationMenuViewportProps, NumberField, type NumberFieldProps, OTPField, type OTPFieldProps, OVERLAY_SIDE_OFFSET, PageShell, type PageShellProps, type PageWidth, Pagination, type PaginationEntry, type PaginationProps, Panel, PanelHeader, type PanelHeaderProps, type PanelProps, PasswordInput, type PasswordInputProps, type PersistedPreferences, Plussie, type PlussieExpression, type PlussieProps, Popover, type PopoverCloseProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverRootProps, type PopoverTitleProps, type PopoverTriggerProps, type PrepaintDefaults, type PrepaintOptions, Preview, type PreviewAxis, type PreviewProps, type PreviewResizeOptions, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type RatingSize, type ResolvedMode, Row, type RowProps, ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps, type ScrollEdges, ScrollableTabsList, type ScrollableTabsListProps, ScrubInput, type ScrubInputProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, SeamList, type SeamListProps, SearchInput, type SearchInputProps, SectionHeader, type SectionHeaderProps, SegmentedControl, type SegmentedControlItem, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetCloseProps, type SheetContentProps, type SheetDescriptionProps, type SheetFooterProps, type SheetRootProps, type SheetTitleProps, type SheetTriggerProps, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, Skeleton, type SkeletonProps, SkillIcon, Slider, type SliderProps, type SpaceStep, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, type StackAlign, StackIcon, type StackJustify, type StackProps, StacksMatrixIcon, Stat, type StatProps, type StatTone, StatusBar, type StatusBarGroupProps, type StatusBarItemProps, type StatusBarProminence, type StatusBarProps, type StatusBarTone, StatusDot, type StatusDotProps, type StatusTone, Stepper, type StepperProps, type StepperState, type StepperStep, Switch, type SwitchProps, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, TagsInput, type TagsInputProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, Textarea, type TextareaProps, type ThemeContextValue, type ThemeManifest, type ThemeName, ThemeProvider, type ThemeProviderProps, type ThemeRegistry, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, TitleBar, type TitleBarProps, Toast, type ToastManager, type ToastOptions, type ToastProviderProps, type ToastTone, type ToastViewportProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, type TokenOverrides, Toolbar, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarRootProps, type ToolbarSeparatorProps, Tooltip, type TooltipContentProps, type TooltipProviderProps, type TooltipRootProps, type TooltipTriggerProps, Tree, type TreeGuide, type TreeItem, type TreeProps, type TreeRow, type TreeVisibility, TreeVisibilityToggle, type TreeVisibilityToggleProps, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, type UploadFile, type UploadStatus, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, isSafeTokenValue, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
|
package/dist/index.js
CHANGED
|
@@ -37,12 +37,13 @@ import { EmptyState } from "./chrome/empty-state.js";
|
|
|
37
37
|
import { Eyebrow } from "./chrome/eyebrow.js";
|
|
38
38
|
import { Container } from "./layout/container.js";
|
|
39
39
|
import { Footer } from "./chrome/footer.js";
|
|
40
|
+
import { SectionHeader } from "./chrome/section-header.js";
|
|
41
|
+
import { Inspector } from "./chrome/inspector.js";
|
|
40
42
|
import { NavigationMenu } from "./chrome/navigation-menu.js";
|
|
41
43
|
import { PageShell } from "./chrome/page-shell.js";
|
|
42
44
|
import { Panel, PanelHeader } from "./chrome/panel.js";
|
|
43
45
|
import { Row, SeamList, rowVariants } from "./chrome/row.js";
|
|
44
46
|
import { ScrollArea } from "./chrome/scroll-area.js";
|
|
45
|
-
import { SectionHeader } from "./chrome/section-header.js";
|
|
46
47
|
import { SegmentedControl } from "./chrome/segmented-control.js";
|
|
47
48
|
import { StatusBar } from "./chrome/status-bar.js";
|
|
48
49
|
import { ScrollableTabsList, Tabs } from "./chrome/tabs.js";
|
|
@@ -72,6 +73,7 @@ import { AudienceIcon, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, CliT
|
|
|
72
73
|
import { activateRowFromClick, activateRowFromKeyDown } from "./instruments/_data-row.js";
|
|
73
74
|
import { AppWindowFrame } from "./instruments/app-window-frame.js";
|
|
74
75
|
import { CopyButton } from "./instruments/copy-button.js";
|
|
76
|
+
import { CodeBlock } from "./instruments/code-block.js";
|
|
75
77
|
import { DataRow } from "./instruments/data-row.js";
|
|
76
78
|
import { DataTree } from "./instruments/data-tree.js";
|
|
77
79
|
import { GroupBar } from "./instruments/group-bar.js";
|
|
@@ -95,6 +97,7 @@ import { DescriptionList } from "./layout/description-list.js";
|
|
|
95
97
|
import { Grid } from "./layout/grid.js";
|
|
96
98
|
import { Item, itemVariants } from "./layout/item.js";
|
|
97
99
|
import { Pagination, paginationRange } from "./layout/pagination.js";
|
|
100
|
+
import { Preview } from "./layout/preview.js";
|
|
98
101
|
import { Stepper } from "./layout/stepper.js";
|
|
99
102
|
import { StatusDot } from "./primitives/status-dot.js";
|
|
100
103
|
import { Timeline } from "./layout/timeline.js";
|
|
@@ -115,4 +118,4 @@ import { Kbd } from "./primitives/kbd.js";
|
|
|
115
118
|
import { Skeleton } from "./primitives/skeleton.js";
|
|
116
119
|
import { useControlHeight, useDensity } from "./system/use-density.js";
|
|
117
120
|
import { useTheme } from "./system/use-theme.js";
|
|
118
|
-
export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, AgentPile, AlertDialog, AppBar, AppShell, AppWindowFrame, AskBox, AudienceIcon, Autocomplete, Avatar, AvatarGroup, Bento, Breadcrumb, Button, ButtonGroup, Card, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, Chip, CliToolIcon, Collapsible, Combobox, CommandPalette, Composer, Container, ContextMenu, CopyButton, CueLogotype, CueMark, CuePortalFrame, DEFAULT_STORAGE_KEY, DataRow, DataTree, DelegationCard, Density, DescriptionList, Dialog, Disclosure, Drawer, DropdownMenu, EmptyState, EnvVarInput, Eyebrow, Field, FieldDescription, FieldError, FieldLabel, FileUpload, FolderIcon, Footer, Grid, GroupBar, HoverCard, IconButton, InfoTip, Input, InputGroup, Item, Kbd, Ledger, Link, McpServerIcon, Menubar, Message, MessageList, Meter, MultiSelect, NavigationMenu, NumberField, OTPField, OVERLAY_SIDE_OFFSET, PageShell, Pagination, Panel, PanelHeader, PasswordInput, Plussie, Popover, Progress, Radio, RadioGroup, Rating, Row, ScrollArea, ScrollableTabsList, ScrubInput, SeamCell, SeamGrid, SeamList, SearchInput, SectionHeader, SegmentedControl, Select, Separator, Sheet, Sidebar, Skeleton, SkillIcon, Slider, Sparkline, Spinner, Stack, StackIcon, StacksMatrixIcon, Stat, StatusBar, StatusDot, Stepper, Switch, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, TableScrollRegion, Tabs, TagsInput, TerminalFrame, Textarea, ThemeProvider, Timeline, TitleBar, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, Tree, TreeVisibilityToggle, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, isSafeTokenValue, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
|
|
121
|
+
export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, AgentPile, AlertDialog, AppBar, AppShell, AppWindowFrame, AskBox, AudienceIcon, Autocomplete, Avatar, AvatarGroup, Bento, Breadcrumb, Button, ButtonGroup, Card, CatalogueIcon, ChannelBetaIcon, ChannelReleasedIcon, Checkbox, CheckboxGroup, Chip, CliToolIcon, CodeBlock, Collapsible, Combobox, CommandPalette, Composer, Container, ContextMenu, CopyButton, CueLogotype, CueMark, CuePortalFrame, DEFAULT_STORAGE_KEY, DataRow, DataTree, DelegationCard, Density, DescriptionList, Dialog, Disclosure, Drawer, DropdownMenu, EmptyState, EnvVarInput, Eyebrow, Field, FieldDescription, FieldError, FieldLabel, FileUpload, FolderIcon, Footer, Grid, GroupBar, HoverCard, IconButton, InfoTip, Input, InputGroup, Inspector, Item, Kbd, Ledger, Link, McpServerIcon, Menubar, Message, MessageList, Meter, MultiSelect, NavigationMenu, NumberField, OTPField, OVERLAY_SIDE_OFFSET, PageShell, Pagination, Panel, PanelHeader, PasswordInput, Plussie, Popover, Preview, Progress, Radio, RadioGroup, Rating, Row, ScrollArea, ScrollableTabsList, ScrubInput, SeamCell, SeamGrid, SeamList, SearchInput, SectionHeader, SegmentedControl, Select, Separator, Sheet, Sidebar, Skeleton, SkillIcon, Slider, Sparkline, Spinner, Stack, StackIcon, StacksMatrixIcon, Stat, StatusBar, StatusDot, Stepper, Switch, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, TableScrollRegion, Tabs, TagsInput, TerminalFrame, Textarea, ThemeProvider, Timeline, TitleBar, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, Tree, TreeVisibilityToggle, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, isSafeTokenValue, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensities, useDensity, useFonts, useSidebar, useTheme, useThemes, useToast };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/instruments/code-block.d.ts
|
|
3
|
+
interface CodeBlockProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
4
|
+
/** The code. Printed verbatim, already dedented by whoever produced it; the copy button copies exactly this. */
|
|
5
|
+
code: string;
|
|
6
|
+
/** What the block is, in the caption strip: a filename, an example's title. Defaults to the language. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The fence language, on the `<pre>` as `data-language`. Defaults to `"tsx"`.
|
|
10
|
+
* `"jsx"` turns on emphasis: tag names, attribute names and punctuation in
|
|
11
|
+
* three inks the theme already has. Every other value prints plain.
|
|
12
|
+
*/
|
|
13
|
+
language?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A block of code with a copy button and no syntax-highlighter palette.
|
|
17
|
+
*
|
|
18
|
+
* Every colour a token-driven site paints has to come from the token layer, and
|
|
19
|
+
* a highlighter theme is a second palette that would need porting to every
|
|
20
|
+
* preset before it could sit beside them — so there is none. What `language="jsx"`
|
|
21
|
+
* adds is emphasis in three inks the theme already has: tag names in `--cue-fg`,
|
|
22
|
+
* attribute names in `--cue-fg-muted`, punctuation in `--cue-fg-subtle`. Mono
|
|
23
|
+
* type, the sunken ground every input uses, and a copy button that works.
|
|
24
|
+
*
|
|
25
|
+
* No directive: the copy button is the only client code, and a server page can
|
|
26
|
+
* draw the rest.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <CodeBlock label="install" code="pnpm add @cueplusplus/ui" language="sh" />
|
|
30
|
+
* @example
|
|
31
|
+
* <CodeBlock label="JSX" language="jsx" code={'<Button variant="primary">Take cue</Button>'} />
|
|
32
|
+
*/
|
|
33
|
+
declare const CodeBlock: React.ForwardRefExoticComponent<CodeBlockProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { CodeBlock, CodeBlockProps };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { Panel } from "../chrome/panel.js";
|
|
3
|
+
import { CopyButton } from "./copy-button.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/instruments/code-block.tsx
|
|
7
|
+
/** The three inks, and nothing else: a highlighter theme would be a second palette. */
|
|
8
|
+
const INK = {
|
|
9
|
+
tag: "text-fg",
|
|
10
|
+
attr: "text-fg-muted",
|
|
11
|
+
punct: "text-fg-subtle"
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The end of a `{…}` expression starting at `start`, braces balanced; the
|
|
15
|
+
* code's end if unclosed.
|
|
16
|
+
*
|
|
17
|
+
* A JS string literal inside the expression (`"…"`, `'…'`, `` `…` ``,
|
|
18
|
+
* backslash escapes honoured) is skipped whole rather than scanned for
|
|
19
|
+
* braces: `{"a { b"}` has a real `{` and a stray one sitting inside a string,
|
|
20
|
+
* and only the first is the expression's own. Treating the string as opaque
|
|
21
|
+
* is also what keeps `{"<b>hi</b>"}` a single span for the caller that uses
|
|
22
|
+
* this to find where a JSX child expression ends — the `<b>` inside never
|
|
23
|
+
* gets a chance to look like a tag.
|
|
24
|
+
*/
|
|
25
|
+
function expressionEnd(code, start) {
|
|
26
|
+
let depth = 0;
|
|
27
|
+
let index = start;
|
|
28
|
+
while (index < code.length) {
|
|
29
|
+
const ch = code[index];
|
|
30
|
+
if (ch === "\"" || ch === "'" || ch === "`") {
|
|
31
|
+
const quote = ch;
|
|
32
|
+
index += 1;
|
|
33
|
+
while (index < code.length && code[index] !== quote) index += code[index] === "\\" ? 2 : 1;
|
|
34
|
+
index += 1;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (ch === "{") depth += 1;
|
|
38
|
+
else if (ch === "}") {
|
|
39
|
+
depth -= 1;
|
|
40
|
+
if (depth === 0) return index + 1;
|
|
41
|
+
}
|
|
42
|
+
index += 1;
|
|
43
|
+
}
|
|
44
|
+
return code.length;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* JSX, cut into the four kinds this block paints.
|
|
48
|
+
*
|
|
49
|
+
* A tag opens at `<` or `</` followed by a letter — so `a < b` is text — and
|
|
50
|
+
* runs to `>` or `/>`. Inside it, a name is an attribute, `=` is punctuation,
|
|
51
|
+
* and a quoted string or a balanced `{…}` is text. Outside a tag everything is
|
|
52
|
+
* text, comments included — and a `{…}` expression child (`{"<b>hi</b>"}`, the
|
|
53
|
+
* shape `JSON.stringify` produces) stays opaque too, found with the same
|
|
54
|
+
* brace-and-string-aware scan as an attribute's expression value, so a `<`
|
|
55
|
+
* sitting inside its string can never be mistaken for a tag opening. The
|
|
56
|
+
* pieces concatenate back to the input exactly, which the suite asserts and
|
|
57
|
+
* the copy button depends on.
|
|
58
|
+
*/
|
|
59
|
+
function jsxTokens(code) {
|
|
60
|
+
const tokens = [];
|
|
61
|
+
const push = (kind, from, to) => {
|
|
62
|
+
if (to <= from) return;
|
|
63
|
+
const last = tokens.at(-1);
|
|
64
|
+
if (kind === "text" && last?.kind === "text") last.text += code.slice(from, to);
|
|
65
|
+
else tokens.push({
|
|
66
|
+
kind,
|
|
67
|
+
text: code.slice(from, to),
|
|
68
|
+
at: from
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
let index = 0;
|
|
72
|
+
while (index < code.length) {
|
|
73
|
+
const open = /^<\/?(?=[A-Za-z])/.exec(code.slice(index));
|
|
74
|
+
if (open === null) {
|
|
75
|
+
let cursor = code[index] === "{" ? expressionEnd(code, index) : index + 1;
|
|
76
|
+
while (cursor < code.length) {
|
|
77
|
+
const ch = code[cursor];
|
|
78
|
+
if (ch === "{") {
|
|
79
|
+
cursor = expressionEnd(code, cursor);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (ch === "<") break;
|
|
83
|
+
cursor += 1;
|
|
84
|
+
}
|
|
85
|
+
push("text", index, cursor);
|
|
86
|
+
index = cursor;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
push("punct", index, index + open[0].length);
|
|
90
|
+
index += open[0].length;
|
|
91
|
+
const name = /^[A-Za-z][\w.]*/.exec(code.slice(index))[0];
|
|
92
|
+
push("tag", index, index + name.length);
|
|
93
|
+
index += name.length;
|
|
94
|
+
while (index < code.length) {
|
|
95
|
+
const rest = code.slice(index);
|
|
96
|
+
const space = /^\s+/.exec(rest);
|
|
97
|
+
const close = /^\/?>/.exec(rest);
|
|
98
|
+
const attribute = /^[^\s=>/"{]+/.exec(rest);
|
|
99
|
+
if (space !== null) {
|
|
100
|
+
push("text", index, index + space[0].length);
|
|
101
|
+
index += space[0].length;
|
|
102
|
+
} else if (close !== null) {
|
|
103
|
+
push("punct", index, index + close[0].length);
|
|
104
|
+
index += close[0].length;
|
|
105
|
+
break;
|
|
106
|
+
} else if (rest.startsWith("=")) {
|
|
107
|
+
push("punct", index, index + 1);
|
|
108
|
+
index += 1;
|
|
109
|
+
} else if (rest.startsWith("\"")) {
|
|
110
|
+
const quote = code.indexOf("\"", index + 1);
|
|
111
|
+
const end = quote === -1 ? code.length : quote + 1;
|
|
112
|
+
push("text", index, end);
|
|
113
|
+
index = end;
|
|
114
|
+
} else if (rest.startsWith("{")) {
|
|
115
|
+
const end = expressionEnd(code, index);
|
|
116
|
+
push("text", index, end);
|
|
117
|
+
index = end;
|
|
118
|
+
} else if (attribute !== null) {
|
|
119
|
+
push("attr", index, index + attribute[0].length);
|
|
120
|
+
index += attribute[0].length;
|
|
121
|
+
} else {
|
|
122
|
+
push("text", index, index + 1);
|
|
123
|
+
index += 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return tokens;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* A block of code with a copy button and no syntax-highlighter palette.
|
|
131
|
+
*
|
|
132
|
+
* Every colour a token-driven site paints has to come from the token layer, and
|
|
133
|
+
* a highlighter theme is a second palette that would need porting to every
|
|
134
|
+
* preset before it could sit beside them — so there is none. What `language="jsx"`
|
|
135
|
+
* adds is emphasis in three inks the theme already has: tag names in `--cue-fg`,
|
|
136
|
+
* attribute names in `--cue-fg-muted`, punctuation in `--cue-fg-subtle`. Mono
|
|
137
|
+
* type, the sunken ground every input uses, and a copy button that works.
|
|
138
|
+
*
|
|
139
|
+
* No directive: the copy button is the only client code, and a server page can
|
|
140
|
+
* draw the rest.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* <CodeBlock label="install" code="pnpm add @cueplusplus/ui" language="sh" />
|
|
144
|
+
* @example
|
|
145
|
+
* <CodeBlock label="JSX" language="jsx" code={'<Button variant="primary">Take cue</Button>'} />
|
|
146
|
+
*/
|
|
147
|
+
const CodeBlock = React.forwardRef(function CodeBlock({ code, label, language = "tsx", className, ...elementProps }, ref) {
|
|
148
|
+
const body = language === "jsx" ? jsxTokens(code).map((token) => token.kind === "text" ? token.text : /* @__PURE__ */ jsx("span", {
|
|
149
|
+
"data-token": token.kind,
|
|
150
|
+
className: INK[token.kind],
|
|
151
|
+
children: token.text
|
|
152
|
+
}, token.at)) : code;
|
|
153
|
+
return /* @__PURE__ */ jsxs(Panel, {
|
|
154
|
+
...elementProps,
|
|
155
|
+
ref,
|
|
156
|
+
"data-slot": "code-block",
|
|
157
|
+
className: cn("bg-sunken", className),
|
|
158
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
159
|
+
className: "flex items-center justify-between gap-(--cue-space-4) border-b border-border px-(--cue-pad-row-x) py-(--cue-pad-row-y)",
|
|
160
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
161
|
+
"data-slot": "code-block-label",
|
|
162
|
+
className: "font-mono text-(length:--cue-text-micro) tracking-[0.15em] text-fg-subtle uppercase",
|
|
163
|
+
children: label ?? language
|
|
164
|
+
}), /* @__PURE__ */ jsx(CopyButton, { value: code })]
|
|
165
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
166
|
+
"data-language": language,
|
|
167
|
+
className: "overflow-x-auto p-(--cue-space-4) font-mono text-(length:--cue-text-ui) leading-relaxed text-fg",
|
|
168
|
+
children: /* @__PURE__ */ jsx("code", { children: body })
|
|
169
|
+
})]
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
//#endregion
|
|
173
|
+
export { CodeBlock };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { activateRowFromClick, activateRowFromKeyDown } from "./_data-row.js";
|
|
2
2
|
import { AppWindowFrame, AppWindowFrameProps } from "./app-window-frame.js";
|
|
3
|
+
import { CodeBlock, CodeBlockProps } from "./code-block.js";
|
|
3
4
|
import { CopyButton, CopyButtonProps } from "./copy-button.js";
|
|
4
5
|
import { DataRow, DataRowDisclosure, DataRowRootProps, DataRowSlotProps } from "./data-row.js";
|
|
5
6
|
import { DataTree, DataTreeItem, DataTreeProps, DataTreeRowState } from "./data-tree.js";
|
|
@@ -14,4 +15,4 @@ import { Table, TableCaptionProps, TableCellProps, TableGroupRowProps, TableHead
|
|
|
14
15
|
import { TerminalFrame, TerminalFrameLine, TerminalFrameProps, TerminalLine, TerminalLineTone, TerminalScript, TerminalStep } from "./terminal-frame.js";
|
|
15
16
|
import { TwoStepButton, TwoStepButtonProps, TwoStepTone } from "./two-step-button.js";
|
|
16
17
|
import { UsageChart, UsageChartPoint, UsageChartProps, UsageChartTone } from "./usage-chart.js";
|
|
17
|
-
export { AppWindowFrame, type AppWindowFrameProps, CopyButton, type CopyButtonProps, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Meter, type MeterProps, type MeterProvenance, type MeterTone, Progress, type ProgressProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, Sparkline, type SparklineProps, Stat, type StatProps, type StatTone, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown };
|
|
18
|
+
export { AppWindowFrame, type AppWindowFrameProps, CodeBlock, type CodeBlockProps, CopyButton, type CopyButtonProps, DataRow, type DataRowDisclosure, type DataRowRootProps, type DataRowSlotProps, DataTree, type DataTreeItem, type DataTreeProps, type DataTreeRowState, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, Ledger, type LedgerEmptyProps, type LedgerGroupProps, type LedgerRootProps, type LedgerTierProps, Meter, type MeterProps, type MeterProvenance, type MeterTone, Progress, type ProgressProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, Sparkline, type SparklineProps, Stat, type StatProps, type StatTone, Table, type TableCaptionProps, type TableCellProps, type TableGroupRowProps, type TableHeadProps, type TableRootProps, type TableRowProps, TableScrollRegion, type TableScrollRegionProps, type TableSectionProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, activateRowFromClick, activateRowFromKeyDown };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { activateRowFromClick, activateRowFromKeyDown } from "./_data-row.js";
|
|
2
2
|
import { AppWindowFrame } from "./app-window-frame.js";
|
|
3
3
|
import { CopyButton } from "./copy-button.js";
|
|
4
|
+
import { CodeBlock } from "./code-block.js";
|
|
4
5
|
import { DataRow } from "./data-row.js";
|
|
5
6
|
import { DataTree } from "./data-tree.js";
|
|
6
7
|
import { GroupBar } from "./group-bar.js";
|
|
@@ -14,4 +15,4 @@ import { Table, TableScrollRegion } from "./table.js";
|
|
|
14
15
|
import { TerminalFrame } from "./terminal-frame.js";
|
|
15
16
|
import { TwoStepButton } from "./two-step-button.js";
|
|
16
17
|
import { UsageChart } from "./usage-chart.js";
|
|
17
|
-
export { AppWindowFrame, CopyButton, DataRow, DataTree, GroupBar, Ledger, Meter, Progress, SeamCell, SeamGrid, Sparkline, Stat, Table, TableScrollRegion, TerminalFrame, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown };
|
|
18
|
+
export { AppWindowFrame, CodeBlock, CopyButton, DataRow, DataTree, GroupBar, Ledger, Meter, Progress, SeamCell, SeamGrid, Sparkline, Stat, Table, TableScrollRegion, TerminalFrame, TwoStepButton, UsageChart, activateRowFromClick, activateRowFromKeyDown };
|
package/dist/layout/bento.js
CHANGED
|
@@ -169,7 +169,7 @@ const BentoTile = React.forwardRef(function BentoTile(props, ref) {
|
|
|
169
169
|
className: "flex min-w-0 flex-col gap-(--cue-space-1)",
|
|
170
170
|
children: [eyebrow === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
171
171
|
"data-slot": "bento-tile-eyebrow",
|
|
172
|
-
className: "font-mono text-(length:--cue-text-meta) text-fg-muted",
|
|
172
|
+
className: "min-w-0 truncate font-mono text-(length:--cue-text-meta) text-fg-muted",
|
|
173
173
|
children: eyebrow
|
|
174
174
|
}), title === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
175
175
|
"data-slot": "bento-tile-title",
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { DescriptionList, DescriptionListDetailProps, DescriptionListLayout, Des
|
|
|
11
11
|
import { Grid, GridColumns, GridProps } from "./grid.js";
|
|
12
12
|
import { Item, ItemProps, itemVariants } from "./item.js";
|
|
13
13
|
import { Pagination, PaginationEntry, PaginationProps, paginationRange } from "./pagination.js";
|
|
14
|
+
import { Preview, PreviewAxis, PreviewProps, PreviewResizeOptions } from "./preview.js";
|
|
14
15
|
import { Stepper, StepperProps, StepperState, StepperStep } from "./stepper.js";
|
|
15
16
|
import { Timeline, TimelineContentProps, TimelineItemProps, TimelineMarkerProps, TimelineRootProps } from "./timeline.js";
|
|
16
|
-
export { Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, Bento, type BentoColumns, type BentoMinHeight, type BentoRootProps, type BentoRowSpan, type BentoRows, type BentoSpan, type BentoTileProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Container, type ContainerProps, type ContainerWidth, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Disclosure, type DisclosureProps, Grid, type GridColumns, type GridProps, Item, type ItemProps, Link, type LinkProps, Pagination, type PaginationEntry, type PaginationProps, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, type SpaceStep, Stack, type StackAlign, type StackJustify, type StackProps, Stepper, type StepperProps, type StepperState, type StepperStep, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, itemVariants, linkVariants, paginationRange, useSidebar };
|
|
17
|
+
export { Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, Bento, type BentoColumns, type BentoMinHeight, type BentoRootProps, type BentoRowSpan, type BentoRows, type BentoSpan, type BentoTileProps, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Container, type ContainerProps, type ContainerWidth, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Disclosure, type DisclosureProps, Grid, type GridColumns, type GridProps, Item, type ItemProps, Link, type LinkProps, Pagination, type PaginationEntry, type PaginationProps, Preview, type PreviewAxis, type PreviewProps, type PreviewResizeOptions, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, type SpaceStep, Stack, type StackAlign, type StackJustify, type StackProps, Stepper, type StepperProps, type StepperState, type StepperStep, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, itemVariants, linkVariants, paginationRange, useSidebar };
|
package/dist/layout/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { DescriptionList } from "./description-list.js";
|
|
|
11
11
|
import { Grid } from "./grid.js";
|
|
12
12
|
import { Item, itemVariants } from "./item.js";
|
|
13
13
|
import { Pagination, paginationRange } from "./pagination.js";
|
|
14
|
+
import { Preview } from "./preview.js";
|
|
14
15
|
import { Stepper } from "./stepper.js";
|
|
15
16
|
import { Timeline } from "./timeline.js";
|
|
16
|
-
export { Accordion, Bento, Breadcrumb, Card, Collapsible, Container, DescriptionList, Disclosure, Grid, Item, Link, Pagination, Sidebar, Stack, Stepper, Timeline, itemVariants, linkVariants, paginationRange, useSidebar };
|
|
17
|
+
export { Accordion, Bento, Breadcrumb, Card, Collapsible, Container, DescriptionList, Disclosure, Grid, Item, Link, Pagination, Preview, Sidebar, Stack, Stepper, Timeline, itemVariants, linkVariants, paginationRange, useSidebar };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Density, FontName, Mode, ThemeName } from "@cueplusplus/theme-base";
|
|
3
|
+
//#region src/layout/preview.d.ts
|
|
4
|
+
/** Which edges of the stage a reader may drag. */
|
|
5
|
+
type PreviewAxis = "x" | "y" | "both";
|
|
6
|
+
/** How far a resizable stage may go, in CSS pixels, and along which axes. */
|
|
7
|
+
interface PreviewResizeOptions {
|
|
8
|
+
/** Which axes resize. Defaults to `"both"`; `"x"` or `"y"` narrows it to one grip. */
|
|
9
|
+
axis?: PreviewAxis;
|
|
10
|
+
/** The narrowest the stage may be made, in px. Defaults to `160`. */
|
|
11
|
+
minWidth?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The widest the stage may be made, in px. Defaults to `1280`. The bound in
|
|
14
|
+
* force is the smaller of this and the frame's own width, measured live, so a
|
|
15
|
+
* stage never outgrows the frame — or the grid track — it sits in.
|
|
16
|
+
*/
|
|
17
|
+
maxWidth?: number;
|
|
18
|
+
/** The shortest the stage may be made, in px. Defaults to `96`. */
|
|
19
|
+
minHeight?: number;
|
|
20
|
+
/** The tallest the stage may be made, in px. Defaults to `960`. */
|
|
21
|
+
maxHeight?: number;
|
|
22
|
+
}
|
|
23
|
+
interface PreviewProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
24
|
+
/** The specimen. It renders on the stage, inside whatever scope the stage sets. */
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* The frame's accessible name — "Button preview". Required: a frame that holds
|
|
28
|
+
* controls and has no name is a group nobody can find.
|
|
29
|
+
*/
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* A theme for the stage only. Unset, the stage inherits — no attribute is
|
|
33
|
+
* emitted at all. **Naming a theme does not load it**: the stage is scoped to
|
|
34
|
+
* `[data-theme="<name>"]`, and that theme's stylesheet must already be on the
|
|
35
|
+
* page (`@cueplusplus/theme-<name>/theme.css`). The tools, the footer and
|
|
36
|
+
* anything they open stay in the page's theme. With no `mode`, the stage
|
|
37
|
+
* repeats the page's mode beside the theme — `"system"` included — so a light
|
|
38
|
+
* page's stage paints the theme's light block, not its dark one, and agrees
|
|
39
|
+
* with every overlay opened on it.
|
|
40
|
+
*/
|
|
41
|
+
theme?: ThemeName;
|
|
42
|
+
/**
|
|
43
|
+
* Dark, light or system, for the stage only. A theme's light block is the
|
|
44
|
+
* compound selector `[data-theme][data-mode]`, so with no `theme` the stage
|
|
45
|
+
* restates the page's theme beside the mode; outside any `ThemeProvider` there
|
|
46
|
+
* is no theme to restate and the mode alone changes nothing. A stage
|
|
47
|
+
* `"system"` is stamped as it is, so the stylesheet's `[data-mode="system"]`
|
|
48
|
+
* block follows the OS; `useTheme().resolvedMode` read on the stage reports
|
|
49
|
+
* the page's resolved mode.
|
|
50
|
+
*/
|
|
51
|
+
mode?: Mode;
|
|
52
|
+
/** A rung of the density ladder for the stage only, as a `<Density>` island would set it. */
|
|
53
|
+
density?: Density;
|
|
54
|
+
/** A font pairing for the stage only, as `data-font`. Portals still follow the root's pairing. */
|
|
55
|
+
font?: FontName;
|
|
56
|
+
/**
|
|
57
|
+
* Resize the stage by dragging or with the keyboard. `true` gives both axes
|
|
58
|
+
* inside the default bounds (160–1280 px wide, 96–960 px tall); an object
|
|
59
|
+
* narrows the axis or moves the bounds. The width never outgrows the frame:
|
|
60
|
+
* its bound in force is the smaller of `maxWidth` and the frame's own width,
|
|
61
|
+
* observed with a `ResizeObserver`, so a Preview in a grid track stays inside
|
|
62
|
+
* it as the viewport changes. The height is bounded by `maxHeight` alone, and
|
|
63
|
+
* a taller stage grows its frame. Unset, the stage is fixed: no grips, and
|
|
64
|
+
* nothing measured or observed.
|
|
65
|
+
*
|
|
66
|
+
* A resizable frame fills its container's width (`w-full`), because the room
|
|
67
|
+
* it measures has to be its container's. In a flex row or a centred column a
|
|
68
|
+
* frame sized by its content would measure its own stage, and a stage bounded
|
|
69
|
+
* by itself can only shrink, with each step lowering the ceiling. A fixed
|
|
70
|
+
* Preview keeps sizing to its content; `className` can still set a width.
|
|
71
|
+
*/
|
|
72
|
+
resizable?: boolean | PreviewResizeOptions;
|
|
73
|
+
/** The top-right slot — by convention a row of `IconButton`s. Drawn outside the stage. */
|
|
74
|
+
tools?: React.ReactNode;
|
|
75
|
+
/** The strip under the stage: the thin text and the way out. Drawn outside the stage. */
|
|
76
|
+
footer?: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A frame for one component: a stage that is its own theme island, a slot for
|
|
80
|
+
* tools at the top right, and a footer.
|
|
81
|
+
*
|
|
82
|
+
* **The stage is the island; the chrome is not.** `theme`, `mode`, `density`
|
|
83
|
+
* and `font` land on the stage element only, and the stage republishes the
|
|
84
|
+
* theme and density contexts so an overlay opened on it follows it. The tools,
|
|
85
|
+
* the footer, the grips and anything they open stay in the scope around the
|
|
86
|
+
* Preview — a `terminal` preview's own controls do not turn cyan. With none of
|
|
87
|
+
* the four set, the stage carries no attribute and costs what a `<div>` costs.
|
|
88
|
+
* A stage `theme` with no `mode` repeats the page's mode beside it.
|
|
89
|
+
*
|
|
90
|
+
* **`resizable` is handles of its own**, both axes by default: an edge grip per
|
|
91
|
+
* axis that is a keyboard-operable `separator` valued in pixels, and a corner
|
|
92
|
+
* grip for the pointer. Double-click resets an axis. The width never outgrows
|
|
93
|
+
* the frame: its bound in force is the frame's own width, observed live, when
|
|
94
|
+
* that is under `maxWidth`. Not `Resizable`, which is split panes on an
|
|
95
|
+
* optional peer.
|
|
96
|
+
*
|
|
97
|
+
* Props, not a compound: one stage and two slots, each saying what it is.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* <Preview label="Button preview" tools={<IconButton aria-label="Configure Button" icon={Wrench} />}>
|
|
101
|
+
* <Button variant="primary">Take cue</Button>
|
|
102
|
+
* </Preview>
|
|
103
|
+
* @example
|
|
104
|
+
* <Preview label="Chip preview" theme="terminal" density="compact" resizable>
|
|
105
|
+
* <Chip tone="accent">Standby</Chip>
|
|
106
|
+
* </Preview>
|
|
107
|
+
*/
|
|
108
|
+
declare const Preview: React.ForwardRefExoticComponent<PreviewProps & React.RefAttributes<HTMLDivElement>>;
|
|
109
|
+
//#endregion
|
|
110
|
+
export { Preview, PreviewAxis, PreviewProps, PreviewResizeOptions };
|