@makinbakin/sdk 0.0.1-rc.26 → 0.0.1-rc.28
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/README.md +247 -3
- package/_internal/app/components/agent-avatar.d.ts +2 -1
- package/_internal/app/components/conversation/fold.d.ts +3 -129
- package/_internal/app/components/drawer.d.ts +29 -0
- package/_internal/app/components/ui/button.d.ts +2 -8
- package/_internal/app/components/ui/dialog.d.ts +2 -17
- package/_internal/app/components/ui/sheet.d.ts +2 -14
- package/_internal/app/core/conversation-turns.d.ts +83 -2
- package/_internal/app/core/tool-access.d.ts +42 -0
- package/_internal/app/hooks/use-history-back.d.ts +5 -1
- package/_internal/app/hooks/use-json-fetch.d.ts +13 -3
- package/_internal/app/hooks/use-nav-badge.d.ts +1 -1
- package/_internal/app/hooks/use-query-state.d.ts +3 -14
- package/_internal/core/adapters/runtime/channels.d.ts +231 -0
- package/_internal/core/adapters/runtime/concepts.d.ts +42 -167
- package/_internal/core/adapters/runtime/index.d.ts +2 -1
- package/_internal/core/adapters/runtime/skill-files.d.ts +12 -0
- package/_internal/core/adapters/shared.d.ts +11 -0
- package/_internal/core/delivery/bridge.d.ts +36 -0
- package/_internal/core/format.d.ts +12 -1
- package/_internal/core/plugin-types.d.ts +20 -1
- package/_internal/core/routing/define.d.ts +1 -0
- package/_internal/host/ui/action-status.d.ts +13 -0
- package/_internal/host/ui/modals.d.ts +5 -0
- package/_internal/ui/behaviors/clipboard.d.ts +10 -0
- package/_internal/ui/behaviors/selection-navigation.d.ts +5 -0
- package/_internal/ui/behaviors/use-persisted-leading-edge-resize.d.ts +29 -0
- package/_internal/ui/charts/area-chart.d.ts +27 -0
- package/_internal/ui/charts/axis.d.ts +13 -0
- package/_internal/ui/charts/bar-chart.d.ts +21 -0
- package/_internal/ui/charts/chart-data-table.d.ts +61 -0
- package/_internal/ui/charts/chart-explainer.d.ts +4 -0
- package/_internal/ui/charts/composition-bar.d.ts +41 -0
- package/_internal/ui/charts/index.d.ts +24 -0
- package/_internal/ui/charts/line-chart.d.ts +26 -0
- package/_internal/ui/charts/monotone-curve.d.ts +23 -0
- package/_internal/ui/charts/palette.d.ts +32 -0
- package/_internal/ui/charts/pie-chart.d.ts +80 -0
- package/_internal/ui/charts/ranked-bar-chart.d.ts +41 -0
- package/_internal/ui/charts/sparkline.d.ts +16 -0
- package/_internal/ui/charts/stacked-column-chart.d.ts +33 -0
- package/_internal/ui/content/code-block.d.ts +43 -0
- package/_internal/ui/content/index.d.ts +2 -0
- package/_internal/ui/conversation/activity-group.d.ts +27 -0
- package/_internal/ui/conversation/agent-turn.d.ts +47 -0
- package/_internal/ui/conversation/composer.d.ts +62 -0
- package/_internal/ui/conversation/context-meter.d.ts +37 -0
- package/_internal/ui/conversation/conversation-empty-state.d.ts +13 -0
- package/_internal/ui/conversation/conversation-header.d.ts +26 -0
- package/_internal/ui/conversation/conversation-panel.d.ts +59 -0
- package/_internal/ui/conversation/conversation.d.ts +35 -0
- package/_internal/ui/conversation/fold.d.ts +150 -0
- package/_internal/ui/conversation/glyphs.d.ts +30 -0
- package/_internal/ui/conversation/index.d.ts +31 -0
- package/_internal/ui/conversation/queued-message-list.d.ts +22 -0
- package/_internal/ui/conversation/relative-time.d.ts +8 -0
- package/_internal/ui/conversation/resize-handle.d.ts +13 -0
- package/_internal/ui/conversation/tool-call-drawer.d.ts +14 -0
- package/_internal/ui/conversation/turn-controls.d.ts +9 -0
- package/_internal/ui/conversation/turn-output.d.ts +42 -0
- package/_internal/ui/conversation/turn-usage.d.ts +16 -0
- package/_internal/ui/conversation/user-message.d.ts +13 -0
- package/_internal/ui/forms/field.d.ts +25 -0
- package/_internal/ui/forms/fieldset.d.ts +10 -0
- package/_internal/ui/forms/form.d.ts +19 -0
- package/_internal/ui/forms/index.d.ts +6 -0
- package/_internal/ui/index.d.ts +86 -0
- package/_internal/ui/layout/bounded-overflow.d.ts +42 -0
- package/_internal/ui/layout/disclosure-panel.d.ts +24 -0
- package/_internal/ui/layout/flow.d.ts +27 -0
- package/_internal/ui/layout/grid.d.ts +16 -0
- package/_internal/ui/layout/index.d.ts +14 -0
- package/_internal/ui/layout/page-shell.d.ts +11 -0
- package/_internal/ui/layout/panel.d.ts +28 -0
- package/_internal/ui/layout/section.d.ts +15 -0
- package/_internal/ui/layout/sticky-overflow-scrollbar.d.ts +11 -0
- package/_internal/ui/layout/utils.d.ts +1 -0
- package/_internal/ui/patterns/agent-filter.d.ts +20 -0
- package/_internal/ui/patterns/calendar-grid.d.ts +80 -0
- package/_internal/ui/patterns/calendar-item.d.ts +42 -0
- package/_internal/ui/patterns/calendar-nav.d.ts +21 -0
- package/_internal/ui/patterns/confirm-dialog.d.ts +29 -0
- package/_internal/ui/patterns/copy-button.d.ts +15 -0
- package/_internal/ui/patterns/danger-zone.d.ts +17 -0
- package/_internal/ui/patterns/data-table.d.ts +151 -0
- package/_internal/ui/patterns/drawer-section.d.ts +11 -0
- package/_internal/ui/patterns/facet-filter.d.ts +22 -0
- package/_internal/ui/patterns/index.d.ts +73 -0
- package/_internal/ui/patterns/inspector-panel.d.ts +39 -0
- package/_internal/ui/patterns/kanban.d.ts +70 -0
- package/_internal/ui/patterns/key-value.d.ts +35 -0
- package/_internal/ui/patterns/list-rows.d.ts +105 -0
- package/_internal/ui/patterns/nav-list.d.ts +41 -0
- package/_internal/ui/patterns/node-card.d.ts +37 -0
- package/_internal/ui/patterns/page-aside.d.ts +49 -0
- package/_internal/ui/patterns/page-body.d.ts +49 -0
- package/_internal/ui/patterns/page-canvas.d.ts +12 -0
- package/_internal/ui/patterns/page-composer.d.ts +8 -0
- package/_internal/ui/patterns/page-controls.d.ts +31 -0
- package/_internal/ui/patterns/page-header.d.ts +40 -0
- package/_internal/ui/patterns/page-timeline.d.ts +18 -0
- package/_internal/ui/patterns/page.d.ts +32 -0
- package/_internal/ui/patterns/pagination.d.ts +23 -0
- package/_internal/ui/patterns/save-bar.d.ts +21 -0
- package/_internal/ui/patterns/search-input.d.ts +20 -0
- package/_internal/ui/patterns/segmented-control.d.ts +22 -0
- package/_internal/ui/patterns/sortable-head.d.ts +13 -0
- package/_internal/ui/patterns/stat-group.d.ts +8 -0
- package/_internal/ui/patterns/stat-tile.d.ts +25 -0
- package/_internal/ui/patterns/status-badge.d.ts +15 -0
- package/_internal/ui/patterns/status-marker.d.ts +10 -0
- package/_internal/ui/patterns/timeline.d.ts +59 -0
- package/_internal/ui/patterns/unsaved-changes-dialog.d.ts +22 -0
- package/_internal/ui/patterns/workspace-page.d.ts +76 -0
- package/_internal/ui/primitives/alert.d.ts +17 -0
- package/_internal/ui/primitives/avatar.d.ts +13 -0
- package/_internal/ui/primitives/badge.d.ts +27 -0
- package/_internal/ui/primitives/button.d.ts +32 -0
- package/_internal/ui/primitives/card.d.ts +47 -0
- package/_internal/ui/primitives/checkbox.d.ts +3 -0
- package/_internal/ui/primitives/collapsible.d.ts +7 -0
- package/_internal/ui/primitives/color-input.d.ts +21 -0
- package/_internal/ui/primitives/command.d.ts +36 -0
- package/_internal/ui/primitives/dialog.d.ts +31 -0
- package/_internal/ui/primitives/dropdown-menu.d.ts +54 -0
- package/_internal/ui/primitives/file-input.d.ts +33 -0
- package/_internal/ui/primitives/input-group.d.ts +24 -0
- package/_internal/ui/primitives/input.d.ts +5 -0
- package/_internal/ui/primitives/interactive-surface.d.ts +24 -0
- package/_internal/ui/primitives/label.d.ts +3 -0
- package/_internal/ui/primitives/modal-context.d.ts +9 -0
- package/_internal/ui/primitives/option-list.d.ts +10 -0
- package/_internal/ui/primitives/popover.d.ts +18 -0
- package/_internal/ui/primitives/portal-ownership.d.ts +11 -0
- package/_internal/ui/primitives/progress.d.ts +38 -0
- package/_internal/ui/primitives/radio-group.d.ts +12 -0
- package/_internal/ui/primitives/select.d.ts +25 -0
- package/_internal/ui/primitives/separator.d.ts +7 -0
- package/_internal/ui/primitives/sheet.d.ts +34 -0
- package/_internal/ui/primitives/shimmer-text.d.ts +13 -0
- package/_internal/ui/primitives/skeleton.d.ts +6 -0
- package/_internal/ui/primitives/spinner.d.ts +31 -0
- package/_internal/ui/primitives/switch.d.ts +6 -0
- package/_internal/{app/components/ui → ui/primitives}/tabs.d.ts +1 -1
- package/_internal/ui/primitives/text.d.ts +43 -0
- package/_internal/ui/primitives/textarea.d.ts +3 -0
- package/_internal/ui/primitives/tooltip.d.ts +14 -0
- package/_internal/ui/private-ui-boundary-probe.d.ts +9 -0
- package/_internal/ui/states/banner.d.ts +15 -0
- package/_internal/ui/states/index.d.ts +6 -0
- package/_internal/ui/states/system-state.d.ts +88 -0
- package/_internal/ui/states/toast.d.ts +26 -0
- package/_internal/ui/utils.d.ts +14 -0
- package/bin/bakin-plugin-test-ui.js +6822 -0
- package/charts/index.d.ts +3 -0
- package/charts/index.js +2 -0
- package/content/index.d.ts +14 -0
- package/content/index.js +39 -0
- package/content/markdown-content.d.ts +16 -0
- package/content/markdown-editor.d.ts +35 -0
- package/conversation/index.d.ts +50 -0
- package/conversation/index.js +4 -0
- package/{_internal/app/components/conversation → conversation}/use-conversation-thread.d.ts +21 -3
- package/hooks/index.d.ts +9 -9
- package/hooks/index.js +1 -16243
- package/hooks/router.d.ts +4 -52
- package/index.d.ts +10 -3
- package/index.js +10 -14248
- package/internal/index.d.ts +18 -14
- package/internal/index.js +1 -408
- package/internal/lazy.d.ts +58 -0
- package/internal/plugin-ownership.d.ts +18 -0
- package/internal/private-ui-boundary-probe.d.ts +2 -0
- package/layout/index.d.ts +9 -0
- package/layout/index.js +2 -0
- package/metadata/index.js +1 -30
- package/navigation/history-back.d.ts +5 -0
- package/navigation/index.d.ts +23 -0
- package/navigation/index.js +2 -0
- package/navigation/plugin-link.d.ts +11 -0
- package/navigation/query-state.d.ts +7 -0
- package/navigation/router.d.ts +35 -0
- package/navigation/search-params.d.ts +7 -0
- package/navigation/unsaved-changes-guard.d.ts +35 -0
- package/package.json +54 -9
- package/patterns/agent-patterns.d.ts +79 -0
- package/patterns/asset-library-picker.d.ts +38 -0
- package/patterns/channel-patterns.d.ts +32 -0
- package/patterns/index.d.ts +40 -0
- package/patterns/index.js +47 -0
- package/patterns/picker-patterns.d.ts +96 -0
- package/patterns/plugin-settings-renderer.d.ts +41 -0
- package/patterns/presentation-color.d.ts +2 -0
- package/patterns/search-patterns.d.ts +51 -0
- package/routing/index.js +10 -14054
- package/slots/index.d.ts +4 -4
- package/slots/index.js +1 -276
- package/slots/registry.d.ts +45 -0
- package/styles.css +2 -0
- package/testing/index.d.ts +1 -1
- package/testing/index.js +56 -21837
- package/testing/ui/conformance/cli.d.ts +2 -0
- package/testing/ui/conformance/contracts.d.ts +73 -0
- package/testing/ui/conformance/index.d.ts +11 -0
- package/testing/ui/conformance/index.js +85 -0
- package/testing/ui/conformance/plugin-css.d.ts +37 -0
- package/testing/ui/conformance/plugin-id.d.ts +6 -0
- package/testing/ui/conformance/runner.d.ts +13 -0
- package/testing/ui/index.d.ts +24 -0
- package/testing/ui/index.js +2 -0
- package/testing/ui/plugin-ui-fixture-host.d.ts +36 -0
- package/testing/ui/runtime.d.ts +70 -0
- package/types/api-route.d.ts +89 -0
- package/types/context.d.ts +166 -0
- package/types/conversation-turns.d.ts +229 -0
- package/types/events.d.ts +10 -0
- package/types/health.d.ts +374 -0
- package/types/index.d.ts +10 -10
- package/types/index.js +1 -16
- package/types/manifest.d.ts +221 -0
- package/types/primitives.d.ts +33 -0
- package/types/registration.d.ts +281 -0
- package/types/runtime.d.ts +286 -0
- package/types/scheduled-events.d.ts +80 -0
- package/types/services.d.ts +570 -0
- package/ui/index.d.ts +70 -31
- package/ui/index.js +38 -28705
- package/utils/asset-id.d.ts +15 -0
- package/utils/index.d.ts +5 -10
- package/utils/index.js +4 -2228
- package/utils/plugin-fetch.d.ts +23 -0
- package/_internal/app/components/agent-filter.d.ts +0 -8
- package/_internal/app/components/agent-select.d.ts +0 -29
- package/_internal/app/components/agent-status.d.ts +0 -8
- package/_internal/app/components/asset-picker.d.ts +0 -25
- package/_internal/app/components/bakin-drawer.d.ts +0 -23
- package/_internal/app/components/charts/bar-chart.d.ts +0 -16
- package/_internal/app/components/charts/chart-data-table.d.ts +0 -31
- package/_internal/app/components/charts/chart-explainer.d.ts +0 -9
- package/_internal/app/components/charts/line-chart.d.ts +0 -13
- package/_internal/app/components/charts/palette.d.ts +0 -24
- package/_internal/app/components/charts/sparkline.d.ts +0 -12
- package/_internal/app/components/charts/stacked-column-chart.d.ts +0 -40
- package/_internal/app/components/color-picker.d.ts +0 -7
- package/_internal/app/components/confirm-dialog.d.ts +0 -54
- package/_internal/app/components/conversation/activity-group.d.ts +0 -15
- package/_internal/app/components/conversation/agent-turn.d.ts +0 -36
- package/_internal/app/components/conversation/composer.d.ts +0 -35
- package/_internal/app/components/conversation/conversation-empty-state.d.ts +0 -8
- package/_internal/app/components/conversation/conversation-panel.d.ts +0 -33
- package/_internal/app/components/conversation/conversation.d.ts +0 -14
- package/_internal/app/components/conversation/relative-time.d.ts +0 -8
- package/_internal/app/components/conversation/tool-call-drawer.d.ts +0 -7
- package/_internal/app/components/conversation/user-message.d.ts +0 -11
- package/_internal/app/components/danger-zone.d.ts +0 -28
- package/_internal/app/components/empty-state.d.ts +0 -22
- package/_internal/app/components/error-banner.d.ts +0 -6
- package/_internal/app/components/error-state.d.ts +0 -8
- package/_internal/app/components/facet-filter.d.ts +0 -17
- package/_internal/app/components/markdown-content.d.ts +0 -3
- package/_internal/app/components/markdown-editor.d.ts +0 -11
- package/_internal/app/components/model-select.d.ts +0 -9
- package/_internal/app/components/page-layout.d.ts +0 -9
- package/_internal/app/components/plugin-header.d.ts +0 -17
- package/_internal/app/components/plugin-settings-renderer.d.ts +0 -9
- package/_internal/app/components/save-bar.d.ts +0 -32
- package/_internal/app/components/score-overlay.d.ts +0 -33
- package/_internal/app/components/search-degraded-chip.d.ts +0 -4
- package/_internal/app/components/search-partial-chip.d.ts +0 -13
- package/_internal/app/components/search-unavailable.d.ts +0 -12
- package/_internal/app/components/section-card.d.ts +0 -22
- package/_internal/app/components/segmented-control.d.ts +0 -28
- package/_internal/app/components/sortable-head.d.ts +0 -13
- package/_internal/app/components/stat-tile.d.ts +0 -26
- package/_internal/app/components/status-badge.d.ts +0 -19
- package/_internal/app/components/turn-output-view.d.ts +0 -57
- package/_internal/app/components/ui/alert.d.ts +0 -10
- package/_internal/app/components/ui/avatar.d.ts +0 -11
- package/_internal/app/components/ui/badge.d.ts +0 -7
- package/_internal/app/components/ui/card.d.ts +0 -11
- package/_internal/app/components/ui/checkbox.d.ts +0 -3
- package/_internal/app/components/ui/collapsible.d.ts +0 -5
- package/_internal/app/components/ui/command.d.ts +0 -19
- package/_internal/app/components/ui/dropdown-menu.d.ts +0 -29
- package/_internal/app/components/ui/form.d.ts +0 -23
- package/_internal/app/components/ui/input-group.d.ts +0 -18
- package/_internal/app/components/ui/input.d.ts +0 -3
- package/_internal/app/components/ui/label.d.ts +0 -3
- package/_internal/app/components/ui/popover.d.ts +0 -9
- package/_internal/app/components/ui/progress.d.ts +0 -7
- package/_internal/app/components/ui/select.d.ts +0 -15
- package/_internal/app/components/ui/separator.d.ts +0 -3
- package/_internal/app/components/ui/skeleton.d.ts +0 -2
- package/_internal/app/components/ui/switch.d.ts +0 -5
- package/_internal/app/components/ui/textarea.d.ts +0 -3
- package/_internal/app/components/ui/tooltip.d.ts +0 -6
- package/_internal/app/components/underline-tabs.d.ts +0 -19
- package/_internal/app/components/unsaved-changes-guard.d.ts +0 -34
- package/_internal/app/lib/utils.d.ts +0 -2
- package/_internal/plugins/workflows/hooks/channel-icon.d.ts +0 -6
- package/components/index.d.ts +0 -140
- package/components/index.js +0 -71930
- /package/_internal/{app/components → ui}/charts/chart-tooltip.d.ts +0 -0
- /package/_internal/{app/components/ui → ui/primitives}/table.d.ts +0 -0
|
@@ -28,6 +28,8 @@ export interface ApprovalActor {
|
|
|
28
28
|
source: 'channel' | 'web' | 'system';
|
|
29
29
|
}
|
|
30
30
|
export interface StorageAdapter {
|
|
31
|
+
/** Absolute private root when backed by a local filesystem. Not browser assets. */
|
|
32
|
+
readonly localRoot?: string;
|
|
31
33
|
read(path: string): string | null;
|
|
32
34
|
write(path: string, content: string): void;
|
|
33
35
|
append(path: string, content: string): void;
|
|
@@ -99,6 +101,10 @@ export type { ExecToolResult } from '@makinbakin/sdk/types';
|
|
|
99
101
|
/** Definition for a registerable execution tool */
|
|
100
102
|
/** Context available to exec tool handlers — provides access to plugin services */
|
|
101
103
|
export interface PluginToolContext {
|
|
104
|
+
/** Set only by a verified transport, never from tool parameters. */
|
|
105
|
+
invocation?: {
|
|
106
|
+
agentId: string;
|
|
107
|
+
};
|
|
102
108
|
storage: StorageAdapter;
|
|
103
109
|
events: EventBus;
|
|
104
110
|
pluginId: string;
|
|
@@ -111,6 +117,8 @@ export interface PluginToolContext {
|
|
|
111
117
|
getSettings<T = Record<string, unknown>>(): T;
|
|
112
118
|
}
|
|
113
119
|
export interface ExecToolDefinition<Shape extends ZodRawShape = ZodRawShape> {
|
|
120
|
+
/** Reject unverified HTTP/MCP callers before invoking the handler. */
|
|
121
|
+
requiresVerifiedAgent?: boolean;
|
|
114
122
|
name: string;
|
|
115
123
|
description: string;
|
|
116
124
|
label?: string;
|
|
@@ -580,7 +588,16 @@ export interface ListSettingsField extends BaseSettingsField {
|
|
|
580
588
|
*/
|
|
581
589
|
uniqueField?: string;
|
|
582
590
|
}
|
|
583
|
-
|
|
591
|
+
/**
|
|
592
|
+
* Per-agent on/off grid. Renders every roster agent with its avatar and a
|
|
593
|
+
* toggle; the persisted value is the array of enabled agent ids. Reusable by
|
|
594
|
+
* any plugin that gates a feature per agent.
|
|
595
|
+
*/
|
|
596
|
+
export interface AgentTogglesSettingsField extends BaseSettingsField {
|
|
597
|
+
type: 'agent-toggles';
|
|
598
|
+
default?: string[];
|
|
599
|
+
}
|
|
600
|
+
export type SettingsField = StringSettingsField | NumberSettingsField | BooleanSettingsField | SelectSettingsField | ListSettingsField | AgentTogglesSettingsField;
|
|
584
601
|
export interface PluginSettingsSchema {
|
|
585
602
|
fields: SettingsField[];
|
|
586
603
|
}
|
|
@@ -608,6 +625,8 @@ export interface BakinPlugin {
|
|
|
608
625
|
* a half-removed state.
|
|
609
626
|
*/
|
|
610
627
|
onUninstall?(ctx: PluginContext): void | Promise<void>;
|
|
628
|
+
/** Preflight before destructive removal. A rejection aborts removal. */
|
|
629
|
+
beforeUninstall?(ctx: PluginContext): void | Promise<void>;
|
|
611
630
|
/** Declarative settings schema for auto-generated settings UI */
|
|
612
631
|
settingsSchema?: PluginSettingsSchema;
|
|
613
632
|
navItems?: NavItem[];
|
|
@@ -37,6 +37,7 @@ export interface DefinePluginInput {
|
|
|
37
37
|
onShutdown?(): void | Promise<void>;
|
|
38
38
|
onSettingsChange?(settings: Record<string, unknown>): void | Promise<void>;
|
|
39
39
|
onUninstall?(ctx: any): void | Promise<void>;
|
|
40
|
+
beforeUninstall?(ctx: any): void | Promise<void>;
|
|
40
41
|
settingsSchema?: PluginSettingsSchema;
|
|
41
42
|
navItems?: NavItem[];
|
|
42
43
|
contentFiles?: ContentFile[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy host bridge for root `src/components/ui/*` compatibility shims.
|
|
3
|
+
* Product and plugin consumers should use their existing supported imports;
|
|
4
|
+
* only the host package and SDK may reach the private implementation.
|
|
5
|
+
*/
|
|
6
|
+
export { Button, buttonVariants } from '../../ui/index';
|
|
7
|
+
export type { ButtonProps, ButtonSize, ButtonVariant, ButtonVariantOptions, LegacyButtonSize, LegacyButtonVariant, } from '../../ui/index';
|
|
8
|
+
export { Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, } from '../../ui/index';
|
|
9
|
+
export type { ProgressIndicatorProps, ProgressProps, ProgressSize, ProgressTone, ProgressTrackProps, } from '../../ui/index';
|
|
10
|
+
export { Alert, AlertAction, AlertDescription, AlertTitle, alertVariants } from '../../ui/index';
|
|
11
|
+
export type { AlertProps, AlertTone, AlertVariantOptions, LegacyAlertVariant, } from '../../ui/index';
|
|
12
|
+
export { Badge, badgeVariants } from '../../ui/index';
|
|
13
|
+
export type { BadgeProps, BadgeSize, BadgeTone, BadgeVariant, BadgeVariantOptions, LegacyBadgeVariant, } from '../../ui/index';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Legacy host bridge for the canonical modal and side-overlay primitives. */
|
|
2
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, } from '../../ui/index';
|
|
3
|
+
export { UnsavedChangesDialog } from '../../ui/patterns/unsaved-changes-dialog';
|
|
4
|
+
export type { UnsavedChangesDialogProps } from '../../ui/patterns/unsaved-changes-dialog';
|
|
5
|
+
export type { DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogHeaderProps, DialogOverlayProps, DialogPortalProps, DialogProps, DialogTitleProps, DialogTriggerProps, SheetCloseProps, SheetContentProps, SheetDescriptionProps, SheetFooterProps, SheetHeaderProps, SheetOverlayProps, SheetPortalProps, SheetProps, SheetSide, SheetTitleProps, SheetTriggerProps, } from '../../ui/index';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard write that works OUTSIDE secure contexts. Bakin is served over
|
|
3
|
+
* plain HTTP on the tailnet, where `navigator.clipboard` is UNDEFINED — the
|
|
4
|
+
* old `navigator.clipboard?.writeText(...)` pattern silently no-opped on
|
|
5
|
+
* every copy button (the 2026-07-25 chat copy bug). Async Clipboard API
|
|
6
|
+
* when available, legacy execCommand('copy') via an off-screen textarea
|
|
7
|
+
* otherwise. Returns whether the copy actually happened so UIs only show
|
|
8
|
+
* the success check for a real copy.
|
|
9
|
+
*/
|
|
10
|
+
export declare function copyToClipboard(text: string): Promise<boolean>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type HorizontalSelectionKey = 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End';
|
|
2
|
+
export type VerticalSelectionKey = 'ArrowUp' | 'ArrowDown' | 'Home' | 'End';
|
|
3
|
+
export declare function horizontalSelectionIndex(disabled: readonly boolean[], currentIndex: number, key: HorizontalSelectionKey): number | undefined;
|
|
4
|
+
/** Vertical twin of `horizontalSelectionIndex` — same wrap and disabled-skip rules. */
|
|
5
|
+
export declare function verticalSelectionIndex(disabled: readonly boolean[], currentIndex: number, key: VerticalSelectionKey): number | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type KeyboardEvent, type PointerEvent } from 'react';
|
|
2
|
+
type ResizeAxis = 'x' | 'y';
|
|
3
|
+
interface PersistedResizeOptions {
|
|
4
|
+
axis: ResizeAxis;
|
|
5
|
+
defaultSize: number;
|
|
6
|
+
minSize: number;
|
|
7
|
+
maxSize: number;
|
|
8
|
+
storageKey?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PersistedResizeHandleProps {
|
|
12
|
+
role: 'separator';
|
|
13
|
+
tabIndex: number;
|
|
14
|
+
'aria-orientation': 'horizontal' | 'vertical';
|
|
15
|
+
'aria-valuemin': number;
|
|
16
|
+
'aria-valuemax': number;
|
|
17
|
+
'aria-valuenow': number;
|
|
18
|
+
onPointerDown: (event: PointerEvent<HTMLDivElement>) => void;
|
|
19
|
+
onPointerMove: (event: PointerEvent<HTMLDivElement>) => void;
|
|
20
|
+
onPointerUp: (event: PointerEvent<HTMLDivElement>) => void;
|
|
21
|
+
onPointerCancel: (event: PointerEvent<HTMLDivElement>) => void;
|
|
22
|
+
onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
23
|
+
}
|
|
24
|
+
/** Private shared mechanics for a pane resized from its leading edge. */
|
|
25
|
+
export declare function usePersistedLeadingEdgeResize({ axis, defaultSize, minSize, maxSize, storageKey, disabled, }: PersistedResizeOptions): {
|
|
26
|
+
size: number;
|
|
27
|
+
handleProps: PersistedResizeHandleProps;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ChartDatum, type ChartSeries } from './chart-data-table';
|
|
2
|
+
export interface AreaChartProps {
|
|
3
|
+
data: readonly ChartDatum[];
|
|
4
|
+
series: readonly ChartSeries[];
|
|
5
|
+
/** Accessible name for the plot and basis for its exact-data caption. */
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
/** Stack non-negative series into cumulative bands instead of overlaying them. */
|
|
10
|
+
stacked?: boolean;
|
|
11
|
+
formatValue?: (value: number) => string;
|
|
12
|
+
emptyLabel?: string;
|
|
13
|
+
/** Disable only when an equivalent exact table is rendered beside the chart. */
|
|
14
|
+
showDataTable?: boolean;
|
|
15
|
+
/** Collapse the exact-data table behind its disclosure for space-tight contexts. */
|
|
16
|
+
compactData?: boolean;
|
|
17
|
+
/** When false, the exact-data table renders statically with no disclosure. */
|
|
18
|
+
dataTableExpandable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Dependency-free cumulative-magnitude trend chart sharing LineChart's exact
|
|
22
|
+
* data, missing-value, and focus-equivalence contract. A single-series gap
|
|
23
|
+
* breaks the fill; a stacked column cannot honestly show a mid-stack gap, so
|
|
24
|
+
* the missing series is omitted from that column's band boundaries and the
|
|
25
|
+
* omission is surfaced through the exact table's missing labels.
|
|
26
|
+
*/
|
|
27
|
+
export declare function AreaChart({ data, series, label, description, height, stacked, formatValue, emptyLabel, compactData, showDataTable, dataTableExpandable, }: AreaChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared axis and series-geometry helpers for the hand-rolled SVG chart kit.
|
|
3
|
+
* Chart-specific value semantics (stacked coercion, negative handling) stay
|
|
4
|
+
* local to the chart that owns them.
|
|
5
|
+
*/
|
|
6
|
+
/** Non-negative reported value; negative and non-finite readings are explicit gaps. */
|
|
7
|
+
export declare function reportedValue(value: number | undefined): number | null;
|
|
8
|
+
/** Thin dense x-axes to at most ~6 labels while always keeping the last one. */
|
|
9
|
+
export declare function shouldRenderXLabel(index: number, count: number): boolean;
|
|
10
|
+
/** Ellipsize long axis labels so dense axes stay legible. */
|
|
11
|
+
export declare function axisLabel(label: string): string;
|
|
12
|
+
/** Split a point series on gaps (nulls) into contiguous drawable runs. */
|
|
13
|
+
export declare function contiguousSegments<P>(points: readonly (P | null)[]): P[][];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ChartDatum, type ChartSeries } from './chart-data-table';
|
|
2
|
+
export interface BarChartProps {
|
|
3
|
+
data: readonly ChartDatum[];
|
|
4
|
+
series: readonly ChartSeries[];
|
|
5
|
+
/** Accessible name for the plot and basis for its exact-data caption. */
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
/** Stack non-negative series within each x-axis bucket instead of grouping them. */
|
|
10
|
+
stacked?: boolean;
|
|
11
|
+
formatValue?: (value: number) => string;
|
|
12
|
+
emptyLabel?: string;
|
|
13
|
+
/** Disable only when an equivalent exact table is rendered beside the chart. */
|
|
14
|
+
showDataTable?: boolean;
|
|
15
|
+
/** Collapse the exact-data table behind its disclosure for space-tight contexts. */
|
|
16
|
+
compactData?: boolean;
|
|
17
|
+
/** When false, the exact-data table renders statically with no disclosure. */
|
|
18
|
+
dataTableExpandable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Dependency-free grouped or stacked non-negative comparison chart with exact data. */
|
|
21
|
+
export declare function BarChart({ data, series, label, description, height, stacked, formatValue, emptyLabel, showDataTable, compactData, dataTableExpandable, }: BarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface ChartDatum {
|
|
3
|
+
/** Stable x-axis key. */
|
|
4
|
+
x: string;
|
|
5
|
+
/** Human-readable x-axis label; defaults to `x`. */
|
|
6
|
+
xLabel?: string;
|
|
7
|
+
/** Finite values keyed by `ChartSeries.key`. Omit a key when it is unknown. */
|
|
8
|
+
values: Record<string, number>;
|
|
9
|
+
/** Per-series labels for intentionally absent cells. */
|
|
10
|
+
missingLabels?: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface ChartSeries {
|
|
13
|
+
key: string;
|
|
14
|
+
label: string;
|
|
15
|
+
/** CSS color. Defaults to the matching fixed categorical token. */
|
|
16
|
+
color?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Everything the default exact table renders from, handed to `renderTable`. */
|
|
19
|
+
export interface ChartDataTableRenderContext {
|
|
20
|
+
caption: string;
|
|
21
|
+
data: readonly ChartDatum[];
|
|
22
|
+
series: readonly ChartSeries[];
|
|
23
|
+
formatValue: (value: number) => ReactNode;
|
|
24
|
+
missingValue: ReactNode;
|
|
25
|
+
emptyLabel: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export interface ChartDataTableProps {
|
|
28
|
+
data: readonly ChartDatum[];
|
|
29
|
+
series: readonly ChartSeries[];
|
|
30
|
+
/** Accessible table name and visible disclosure label. */
|
|
31
|
+
caption: string;
|
|
32
|
+
formatValue?: (value: number) => ReactNode;
|
|
33
|
+
/** Rendered when a series has no finite value; defaults to “Not reported”. */
|
|
34
|
+
missingValue?: ReactNode;
|
|
35
|
+
/** Rendered across the table body when there are no rows. */
|
|
36
|
+
emptyLabel?: ReactNode;
|
|
37
|
+
/** Starts the exact-data disclosure open. */
|
|
38
|
+
defaultOpen?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* When false, renders the table statically with no disclosure chrome —
|
|
41
|
+
* always visible, no collapse affordance. `defaultOpen` is ignored.
|
|
42
|
+
*/
|
|
43
|
+
expandable?: boolean;
|
|
44
|
+
/** Visually hide the exact table when the owning visual is intentionally compact. */
|
|
45
|
+
visuallyHidden?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Escape hatch: replaces the table region's markup when the default
|
|
48
|
+
* label-plus-series grid cannot express the dataset (derived columns, row
|
|
49
|
+
* ordering, per-row structure). The disclosure chrome, the `View {caption}`
|
|
50
|
+
* summary, and the keyboard-reachable overflow region stay kit-owned; the
|
|
51
|
+
* returned markup MUST render a table (or equivalent structure) named by
|
|
52
|
+
* `context.caption` and must not turn absent values into zeros.
|
|
53
|
+
*/
|
|
54
|
+
renderTable?: (context: ChartDataTableRenderContext) => ReactNode;
|
|
55
|
+
className?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Compatibility name retained for chart implementations migrating in T33b. */
|
|
58
|
+
export declare const CHART_TOKEN_COLORS: readonly ["var(--bakin-color-data-series-1)", "var(--bakin-color-data-series-2)", "var(--bakin-color-data-series-3)", "var(--bakin-color-data-series-4)", "var(--bakin-color-data-series-5)", "var(--bakin-color-data-series-6)", "var(--bakin-color-data-series-7)", "var(--bakin-color-data-series-8)"];
|
|
59
|
+
export declare function chartSeriesColor(series: ChartSeries, index: number): string;
|
|
60
|
+
/** Exact values for visual charts, either disclosed visibly or retained for compact summaries. */
|
|
61
|
+
export declare function ChartDataTable({ data, series, caption, formatValue, missingValue, emptyLabel, defaultOpen, expandable, visuallyHidden, renderTable, className, }: ChartDataTableProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type ChartExplainerProps = ComponentPropsWithoutRef<'p'>;
|
|
3
|
+
/** Plain-language context for what a chart means and when a user should act. */
|
|
4
|
+
export declare function ChartExplainer({ children, className, ...props }: ChartExplainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ChartTone } from './palette';
|
|
2
|
+
export interface CompositionBarSegment {
|
|
3
|
+
/** Stable entity key; palette slots are assigned against the sorted full key set. */
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
/** Non-negative share of the whole. Non-finite or negative values count as zero. */
|
|
7
|
+
value: number;
|
|
8
|
+
/** CSS color. Defaults to the fixed categorical slot for `key`. */
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CompositionBarProps {
|
|
12
|
+
data: readonly CompositionBarSegment[];
|
|
13
|
+
/** Accessible name for the strip and basis for its legend name. */
|
|
14
|
+
label: string;
|
|
15
|
+
/** `inline` fits inside a metric row; `default` leaves room for the legend. */
|
|
16
|
+
size?: 'inline' | 'default';
|
|
17
|
+
/**
|
|
18
|
+
* List legend with exact values below the strip. Defaults to true at size
|
|
19
|
+
* `default`; forced off at size `inline`, where the accessible summary
|
|
20
|
+
* carries the exact values instead.
|
|
21
|
+
*/
|
|
22
|
+
legend?: boolean;
|
|
23
|
+
formatValue?: (value: number) => string;
|
|
24
|
+
/** Accessible description when `data` is empty. */
|
|
25
|
+
emptyLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Opt-in status mode for outcome strips: maps segment key → tone, and every
|
|
28
|
+
* segment wears the validated status chart-fill step for its tone (a tone
|
|
29
|
+
* entry outranks the segment's `color`; an unmapped segment falls back
|
|
30
|
+
* explicitly to its `color`, then `neutral` — never a categorical slot).
|
|
31
|
+
* Omit for categorical strips; behavior without `tones` is unchanged.
|
|
32
|
+
*/
|
|
33
|
+
tones?: Readonly<Record<string, ChartTone>>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Single horizontal 100%-stacked strip for part-to-whole composition only.
|
|
37
|
+
* Zero-value segments are omitted from the strip but stay in the accessible
|
|
38
|
+
* summary and legend; the legend IS the exact data at this scale, so there is
|
|
39
|
+
* no separate exact-data table.
|
|
40
|
+
*/
|
|
41
|
+
export declare function CompositionBar({ data, label, size, legend, formatValue, emptyLabel, tones, }: CompositionBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { BarChart } from './bar-chart';
|
|
2
|
+
export type { BarChartProps } from './bar-chart';
|
|
3
|
+
export { PieChart } from './pie-chart';
|
|
4
|
+
export type { PieChartDatum, PieChartProps } from './pie-chart';
|
|
5
|
+
export { ChartDataTable, chartSeriesColor, CHART_TOKEN_COLORS } from './chart-data-table';
|
|
6
|
+
export type { ChartDataTableProps, ChartDataTableRenderContext, ChartDatum, ChartSeries } from './chart-data-table';
|
|
7
|
+
export { ChartExplainer } from './chart-explainer';
|
|
8
|
+
export type { ChartExplainerProps } from './chart-explainer';
|
|
9
|
+
export { CompositionBar } from './composition-bar';
|
|
10
|
+
export type { CompositionBarProps, CompositionBarSegment } from './composition-bar';
|
|
11
|
+
export { ChartTooltip } from './chart-tooltip';
|
|
12
|
+
export type { ChartTooltipProps } from './chart-tooltip';
|
|
13
|
+
export { LineChart } from './line-chart';
|
|
14
|
+
export type { LineChartProps } from './line-chart';
|
|
15
|
+
export { AreaChart } from './area-chart';
|
|
16
|
+
export type { AreaChartProps } from './area-chart';
|
|
17
|
+
export { RankedBarChart } from './ranked-bar-chart';
|
|
18
|
+
export type { RankedBarChartProps } from './ranked-bar-chart';
|
|
19
|
+
export { assignSeriesColors, CHART_MAX_SERIES, CHART_OTHER_COLOR, CHART_SERIES_COLORS, CHART_TONE_COLORS, chartToneColor, } from './palette';
|
|
20
|
+
export type { ChartTone } from './palette';
|
|
21
|
+
export { Sparkline } from './sparkline';
|
|
22
|
+
export type { SparklineProps } from './sparkline';
|
|
23
|
+
export { StackedColumnChart } from './stacked-column-chart';
|
|
24
|
+
export type { StackedColumnChartProps, StackedColumnDatum } from './stacked-column-chart';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ChartDatum, type ChartSeries } from './chart-data-table';
|
|
2
|
+
export interface LineChartProps {
|
|
3
|
+
data: readonly ChartDatum[];
|
|
4
|
+
series: readonly ChartSeries[];
|
|
5
|
+
/** Accessible name for the plot and basis for its exact-data caption. */
|
|
6
|
+
label: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
formatValue?: (value: number) => string;
|
|
10
|
+
emptyLabel?: string;
|
|
11
|
+
/** Disable only when an equivalent exact table is rendered beside the chart. */
|
|
12
|
+
showDataTable?: boolean;
|
|
13
|
+
/** Collapse the exact-data table behind its disclosure for space-tight contexts. */
|
|
14
|
+
compactData?: boolean;
|
|
15
|
+
/** When false, the exact-data table renders statically with no disclosure. */
|
|
16
|
+
dataTableExpandable?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Draw each contiguous segment as a monotone cubic (Fritsch–Carlson)
|
|
19
|
+
* instead of straight lines. The curve passes exactly through every data
|
|
20
|
+
* point and never overshoots, so it cannot imply values outside the data.
|
|
21
|
+
* Marks, tooltips, and the exact-data table are unaffected.
|
|
22
|
+
*/
|
|
23
|
+
smooth?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Dependency-free multi-series trend chart with exact data and focus-equivalent marks. */
|
|
26
|
+
export declare function LineChart({ data, series, label, description, height, formatValue, emptyLabel, compactData, showDataTable, dataTableExpandable, smooth, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monotone cubic interpolation (Fritsch–Carlson) for chart line paths.
|
|
3
|
+
*
|
|
4
|
+
* The smoothed curve passes exactly through every data point and never
|
|
5
|
+
* overshoots: within each segment the interpolant stays inside the y-range of
|
|
6
|
+
* its two endpoints, so a smoothed line can never imply a value outside the
|
|
7
|
+
* data. Pure math, no DOM — unit-tested directly.
|
|
8
|
+
*/
|
|
9
|
+
export interface CurvePoint {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fritsch–Carlson tangents: secant-averaged slopes limited so each cubic
|
|
15
|
+
* Hermite segment is monotone between its endpoints (no overshoot).
|
|
16
|
+
*/
|
|
17
|
+
export declare function monotoneTangents(points: readonly CurvePoint[]): number[];
|
|
18
|
+
/**
|
|
19
|
+
* SVG path for the monotone cubic through `points` as Hermite segments in
|
|
20
|
+
* cubic Bézier form. Fewer than two points yields an empty string; exactly two
|
|
21
|
+
* yields the straight segment the linear renderer would draw.
|
|
22
|
+
*/
|
|
23
|
+
export declare function monotonePathD(points: readonly CurvePoint[]): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed categorical order validated for adjacent color-vision-deficiency
|
|
3
|
+
* separation on Bakin's dark canvas. Labels and exact values still carry
|
|
4
|
+
* meaning; these colors are reinforcement, never the only distinction.
|
|
5
|
+
*/
|
|
6
|
+
export declare const CHART_SERIES_COLORS: readonly ["var(--bakin-color-data-series-1)", "var(--bakin-color-data-series-2)", "var(--bakin-color-data-series-3)", "var(--bakin-color-data-series-4)", "var(--bakin-color-data-series-5)", "var(--bakin-color-data-series-6)", "var(--bakin-color-data-series-7)", "var(--bakin-color-data-series-8)"];
|
|
7
|
+
/** Low-chroma slot for every entity folded into a visible “Other” group. */
|
|
8
|
+
export declare const CHART_OTHER_COLOR = "var(--bakin-color-data-other)";
|
|
9
|
+
/**
|
|
10
|
+
* Vocabulary for outcome-meaning series. A series that MEANS good/bad/warning
|
|
11
|
+
* wears a status step; a series that is merely “series 4” wears a categorical
|
|
12
|
+
* slot — never both in one chart. `neutral` is the honest step for outcome
|
|
13
|
+
* series that make no good-or-bad claim (canceled, unattributed remainder).
|
|
14
|
+
*/
|
|
15
|
+
export type ChartTone = 'success' | 'danger' | 'attention' | 'neutral';
|
|
16
|
+
/**
|
|
17
|
+
* Status chart-fill steps. The success/danger/attention trio is re-stepped in
|
|
18
|
+
* lightness from Bakin's status hues and frozen only after passing the dataviz
|
|
19
|
+
* palette validator on the dark chart surfaces (all-pairs CVD ΔE ≥ 8, normal
|
|
20
|
+
* ΔE ≥ 15, ≥ 3:1 contrast); the attention step is deliberately separated from
|
|
21
|
+
* the categorical amber slot. Changing any value requires re-validation — see
|
|
22
|
+
* tests/ui/charts/chart-status-tokens.test.ts.
|
|
23
|
+
*/
|
|
24
|
+
export declare const CHART_TONE_COLORS: Record<ChartTone, string>;
|
|
25
|
+
/** Resolve one tone to its frozen status chart-fill step. */
|
|
26
|
+
export declare function chartToneColor(tone: ChartTone): string;
|
|
27
|
+
export declare const CHART_MAX_SERIES: 8;
|
|
28
|
+
/**
|
|
29
|
+
* Assign the full entity set, not a filtered view. Sorting once against the
|
|
30
|
+
* complete set prevents surviving series from changing color across filters.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assignSeriesColors(keys: readonly string[]): Map<string, string>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type ChartTone } from './palette';
|
|
2
|
+
export interface PieChartDatum {
|
|
3
|
+
/** Stable entity key; the palette slot follows this key, never the value. */
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PieChartProps {
|
|
9
|
+
data: readonly PieChartDatum[];
|
|
10
|
+
/** Accessible name for the plot and basis for its exact-data caption. */
|
|
11
|
+
label: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
/** Ring variant with a generous inner radius. */
|
|
14
|
+
donut?: boolean;
|
|
15
|
+
formatValue?: (value: number) => string;
|
|
16
|
+
emptyLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Opt-in status mode for outcome charts: maps entity key → tone, and every
|
|
19
|
+
* slice wears the validated status chart-fill step for its tone instead of
|
|
20
|
+
* a categorical slot. A rendered key without an entry falls back explicitly
|
|
21
|
+
* to `neutral` — never to a categorical color and never to a status it did
|
|
22
|
+
* not claim. Omit for categorical charts; behavior without `tones` is
|
|
23
|
+
* unchanged. Status and categorical fills never mix in one ring.
|
|
24
|
+
*/
|
|
25
|
+
tones?: Readonly<Record<string, ChartTone>>;
|
|
26
|
+
/** Disable only when an equivalent exact table is rendered beside the chart. */
|
|
27
|
+
showDataTable?: boolean;
|
|
28
|
+
/** Collapse the exact-data table behind its disclosure for space-tight contexts. */
|
|
29
|
+
compactData?: boolean;
|
|
30
|
+
/** When false, the exact-data table renders statically with no disclosure. */
|
|
31
|
+
dataTableExpandable?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** A pie renders at most this many slices; later entities fold into Other. */
|
|
34
|
+
export declare const PIE_MAX_SLICES = 5;
|
|
35
|
+
/** Slices below this share rely on the legend and exact table instead of a direct label. */
|
|
36
|
+
export declare const PIE_DIRECT_LABEL_MIN_FRACTION = 0.12;
|
|
37
|
+
export interface PieSliceModel {
|
|
38
|
+
key: string;
|
|
39
|
+
label: string;
|
|
40
|
+
value: number;
|
|
41
|
+
color: string;
|
|
42
|
+
/** Share of the rendered whole, 0..1. */
|
|
43
|
+
fraction: number;
|
|
44
|
+
/** Turn fraction from 12 o'clock, clockwise. */
|
|
45
|
+
start: number;
|
|
46
|
+
end: number;
|
|
47
|
+
isOther: boolean;
|
|
48
|
+
/** Present on the Other slice: how many entities were folded. */
|
|
49
|
+
foldedCount?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface PieModel {
|
|
52
|
+
slices: PieSliceModel[];
|
|
53
|
+
/** Sum of every rendered value, including the Other fold. */
|
|
54
|
+
total: number;
|
|
55
|
+
/** Negative input is a programming error; nothing renders. */
|
|
56
|
+
hasNegative: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** Point on a circle at a clockwise turn fraction starting from 12 o'clock. */
|
|
59
|
+
export declare function polarPoint(cx: number, cy: number, radius: number, fraction: number): {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
};
|
|
63
|
+
/** Closed slice path; `innerRadius` 0 draws a pie wedge, greater an annulus segment. */
|
|
64
|
+
export declare function pieSlicePath(cx: number, cy: number, outerRadius: number, innerRadius: number, start: number, end: number): string;
|
|
65
|
+
/** Whole-percent share label that never rounds a real part to nothing or everything. */
|
|
66
|
+
export declare function formatPieShare(fraction: number): string;
|
|
67
|
+
/**
|
|
68
|
+
* Pure render model: zero and non-finite values are omitted from the ring
|
|
69
|
+
* (the exact table keeps them), any finite negative value invalidates the
|
|
70
|
+
* whole ring, colors come from the fixed palette assignment over the FULL
|
|
71
|
+
* entity set, and slices beyond the cap — the smallest by value, plus any
|
|
72
|
+
* entity beyond the palette's stable slots — fold into one Other slice.
|
|
73
|
+
* Rendered slices keep the caller's data order; they are never reordered
|
|
74
|
+
* by value. With `tones`, every slice wears its status chart-fill step
|
|
75
|
+
* (unmapped keys explicitly fall back to `neutral`) and the palette's
|
|
76
|
+
* stable-slot cap no longer forces a fold — the slice cap still does.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildPieModel(data: readonly PieChartDatum[], tones?: Readonly<Record<string, ChartTone>>): PieModel;
|
|
79
|
+
/** Part-to-whole share of at most five slices with fixed entity colors and an exact-data disclosure. */
|
|
80
|
+
export declare function PieChart({ data, label, description, donut, formatValue, emptyLabel, tones, showDataTable, compactData, dataTableExpandable, }: PieChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ChartDatum, type ChartSeries } from './chart-data-table';
|
|
2
|
+
import { type ChartTone } from './palette';
|
|
3
|
+
export interface RankedBarChartProps {
|
|
4
|
+
data: readonly ChartDatum[];
|
|
5
|
+
/** Ranked bars intentionally compare one unit at a time. */
|
|
6
|
+
series: ChartSeries;
|
|
7
|
+
/**
|
|
8
|
+
* Optional highlighted sub-segment of each bar (e.g. the failed portion of a
|
|
9
|
+
* call total). Its value is read from `datum.values[secondary.key]`, must
|
|
10
|
+
* share the primary unit, and renders as a full-opacity inset segment over a
|
|
11
|
+
* muted total; the legend, per-bar accessible label, and exact table carry
|
|
12
|
+
* both numbers. Color defaults to the second categorical slot.
|
|
13
|
+
*/
|
|
14
|
+
secondary?: ChartSeries;
|
|
15
|
+
/** Accessible name for the chart and basis for its exact-data caption. */
|
|
16
|
+
label: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Opt-in status coloring for outcome-meaning series: maps series key →
|
|
20
|
+
* tone, and that series wears the validated status chart-fill step (a tone
|
|
21
|
+
* entry outranks `ChartSeries.color`). Series without an entry keep their
|
|
22
|
+
* categorical default, so an identity bar can carry a status overlay (the
|
|
23
|
+
* failure-overlay pattern). Omit for purely categorical rankings; behavior
|
|
24
|
+
* without `tones` is unchanged.
|
|
25
|
+
*/
|
|
26
|
+
tones?: Readonly<Record<string, ChartTone>>;
|
|
27
|
+
formatValue?: (value: number) => string;
|
|
28
|
+
emptyLabel?: string;
|
|
29
|
+
/** Disable only when an equivalent exact table is rendered beside the chart. */
|
|
30
|
+
showDataTable?: boolean;
|
|
31
|
+
/** Collapse the exact-data table behind its disclosure for space-tight contexts. */
|
|
32
|
+
compactData?: boolean;
|
|
33
|
+
/** When false, the exact-data table renders statically with no disclosure. */
|
|
34
|
+
dataTableExpandable?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Ranked single-unit comparison with full labels, visible exact values, and
|
|
38
|
+
* an exact-data disclosure. Long entity names stay readable because they are
|
|
39
|
+
* never squeezed into an x-axis.
|
|
40
|
+
*/
|
|
41
|
+
export declare function RankedBarChart({ data, series, secondary, label, description, tones, formatValue, emptyLabel, showDataTable, compactData, dataTableExpandable, }: RankedBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SparklineProps {
|
|
2
|
+
/** Null and non-finite values are explicit gaps, never coerced to zero. */
|
|
3
|
+
values: readonly (number | null)[];
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
/** Accessible description, e.g. “input tokens over the last 10 runs”. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Optional human-readable labels corresponding to `values`. */
|
|
10
|
+
labels?: readonly string[];
|
|
11
|
+
formatValue?: (value: number) => string;
|
|
12
|
+
/** Soft same-color fill under each reported segment; gaps break the fill exactly like the line. */
|
|
13
|
+
area?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Compact exact trend summary; pair it with visible current value and direction copy. */
|
|
16
|
+
export declare function Sparkline({ values, width, height, stroke, label, labels, formatValue, area, }: SparklineProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ChartDatum, type ChartSeries } from './chart-data-table';
|
|
3
|
+
export type StackedColumnDatum = ChartDatum;
|
|
4
|
+
export interface StackedColumnChartProps {
|
|
5
|
+
data: readonly StackedColumnDatum[];
|
|
6
|
+
/** Full stable entity set; labels and explicit colors override key defaults. */
|
|
7
|
+
series?: readonly ChartSeries[];
|
|
8
|
+
/** Compatibility shorthand for a full set whose labels equal their keys. */
|
|
9
|
+
seriesKeys?: readonly string[];
|
|
10
|
+
/** Accessible name for the plot. */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** Accessible name for the exact-values disclosure. */
|
|
13
|
+
dataLabel?: string;
|
|
14
|
+
/** Bucket keys that are still accumulating data. */
|
|
15
|
+
partialKeys?: readonly string[];
|
|
16
|
+
/** Plot height in px, excluding legend and labels. */
|
|
17
|
+
height?: number;
|
|
18
|
+
formatValue?: (value: number) => string;
|
|
19
|
+
/** Exact-table label for an absent series value. */
|
|
20
|
+
missingValue?: ReactNode;
|
|
21
|
+
/** Plot/tooltip label for a bucket with no reported series values. */
|
|
22
|
+
missingBucketLabel?: string;
|
|
23
|
+
/** Shown when no buckets exist. */
|
|
24
|
+
emptyLabel?: string;
|
|
25
|
+
/** Disable only when an equivalent exact table is rendered beside the chart. */
|
|
26
|
+
showDataTable?: boolean;
|
|
27
|
+
/** Collapse the exact-data table behind its disclosure for space-tight contexts. */
|
|
28
|
+
compactData?: boolean;
|
|
29
|
+
/** When false, the exact-data table renders statically with no disclosure. */
|
|
30
|
+
dataTableExpandable?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Dense interactive stacked comparison with stable entities and an exact-data disclosure. */
|
|
33
|
+
export declare function StackedColumnChart({ data, series: declaredSeries, seriesKeys, label, dataLabel, partialKeys, height, formatValue, missingValue, missingBucketLabel, emptyLabel, compactData, showDataTable, dataTableExpandable, }: StackedColumnChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type CodeBlockLanguage = 'json' | 'text';
|
|
3
|
+
export interface CodeBlockProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
4
|
+
/** Exact source to render. Never truncated or reflowed by this component. */
|
|
5
|
+
code: string;
|
|
6
|
+
/**
|
|
7
|
+
* `json` tokenizes keys, strings, numbers, and keyword literals. Anything
|
|
8
|
+
* else renders verbatim in the mono frame — an unknown language is shown
|
|
9
|
+
* honestly rather than mis-highlighted.
|
|
10
|
+
*/
|
|
11
|
+
language?: CodeBlockLanguage;
|
|
12
|
+
/**
|
|
13
|
+
* Names the block. A scrollable block becomes a focusable group carrying
|
|
14
|
+
* this name; a wrapped block needs no name because it has no scroll region
|
|
15
|
+
* to reach. Also used for the copy action's label.
|
|
16
|
+
*/
|
|
17
|
+
label?: string;
|
|
18
|
+
/** Adds a copy action for the exact source. */
|
|
19
|
+
copyable?: boolean;
|
|
20
|
+
/** Wraps long lines instead of scrolling horizontally. */
|
|
21
|
+
wrap?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type TokenKind = 'key' | 'string' | 'number' | 'literal' | 'plain';
|
|
24
|
+
interface Token {
|
|
25
|
+
kind: TokenKind;
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Split JSON into display tokens. Returns a single plain token when the input
|
|
30
|
+
* is not parseable, so malformed payloads still render exactly as received
|
|
31
|
+
* rather than being silently mangled by a partial highlight.
|
|
32
|
+
*/
|
|
33
|
+
export declare function tokenizeJson(source: string): Token[];
|
|
34
|
+
/**
|
|
35
|
+
* The one surface for rendering code and structured data.
|
|
36
|
+
*
|
|
37
|
+
* Highlighting is a property of this component rather than something each
|
|
38
|
+
* consumer paints, so every code surface stays legible and consistent. Colors
|
|
39
|
+
* come from the syntax token family, which is contrast-validated as normal
|
|
40
|
+
* text — highlighting must never trade readability for decoration.
|
|
41
|
+
*/
|
|
42
|
+
export declare function CodeBlock({ className, code, copyable, label, language, wrap, ...props }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export {};
|