@cueplusplus/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts/_token.js +39 -0
- package/dist/charts/container.d.ts +58 -0
- package/dist/charts/container.js +77 -0
- package/dist/charts/index.d.ts +5 -0
- package/dist/charts/index.js +5 -0
- package/dist/charts/ramps.d.ts +140 -0
- package/dist/charts/ramps.js +615 -0
- package/dist/charts/theme.d.ts +112 -0
- package/dist/charts/theme.js +165 -0
- package/dist/charts/tones.d.ts +111 -0
- package/dist/charts/tones.js +127 -0
- package/dist/chat/_glyphs.js +55 -0
- package/dist/chat/agent-color.d.ts +84 -0
- package/dist/chat/agent-color.js +101 -0
- package/dist/chat/agent-pile.d.ts +55 -0
- package/dist/chat/agent-pile.js +121 -0
- package/dist/chat/ask-box.d.ts +88 -0
- package/dist/chat/ask-box.js +341 -0
- package/dist/chat/composer.d.ts +66 -0
- package/dist/chat/composer.js +144 -0
- package/dist/chat/delegation-card.d.ts +60 -0
- package/dist/chat/delegation-card.js +129 -0
- package/dist/chat/index.d.ts +8 -0
- package/dist/chat/index.js +8 -0
- package/dist/chat/message-list.d.ts +39 -0
- package/dist/chat/message-list.js +105 -0
- package/dist/chat/message.d.ts +47 -0
- package/dist/chat/message.js +108 -0
- package/dist/chrome/_glyphs.js +101 -0
- package/dist/chrome/_tabs-scroll.d.ts +62 -0
- package/dist/chrome/_tabs-scroll.js +68 -0
- package/dist/chrome/_tree.d.ts +75 -0
- package/dist/chrome/_tree.js +49 -0
- package/dist/chrome/empty-state.d.ts +37 -0
- package/dist/chrome/empty-state.js +57 -0
- package/dist/chrome/eyebrow.d.ts +29 -0
- package/dist/chrome/eyebrow.js +36 -0
- package/dist/chrome/index.d.ts +17 -0
- package/dist/chrome/index.js +17 -0
- package/dist/chrome/navigation-menu.d.ts +80 -0
- package/dist/chrome/navigation-menu.js +121 -0
- package/dist/chrome/page-shell.d.ts +38 -0
- package/dist/chrome/page-shell.js +66 -0
- package/dist/chrome/panel.d.ts +55 -0
- package/dist/chrome/panel.js +67 -0
- package/dist/chrome/row.d.ts +82 -0
- package/dist/chrome/row.js +106 -0
- package/dist/chrome/scroll-area.d.ts +39 -0
- package/dist/chrome/scroll-area.js +70 -0
- package/dist/chrome/section-header.d.ts +42 -0
- package/dist/chrome/section-header.js +79 -0
- package/dist/chrome/segmented-control.d.ts +58 -0
- package/dist/chrome/segmented-control.js +76 -0
- package/dist/chrome/status-bar.d.ts +46 -0
- package/dist/chrome/status-bar.js +56 -0
- package/dist/chrome/tabs.d.ts +80 -0
- package/dist/chrome/tabs.js +176 -0
- package/dist/chrome/title-bar.d.ts +37 -0
- package/dist/chrome/title-bar.js +45 -0
- package/dist/chrome/toolbar.d.ts +46 -0
- package/dist/chrome/toolbar.js +62 -0
- package/dist/chrome/tree.d.ts +98 -0
- package/dist/chrome/tree.js +248 -0
- package/dist/color/_checker.js +14 -0
- package/dist/color/_convert.d.ts +52 -0
- package/dist/color/_convert.js +66 -0
- package/dist/color/_glyphs.js +28 -0
- package/dist/color/_thumb.js +15 -0
- package/dist/color/_value.js +28 -0
- package/dist/color/color-area.d.ts +27 -0
- package/dist/color/color-area.js +40 -0
- package/dist/color/color-field.d.ts +32 -0
- package/dist/color/color-field.js +43 -0
- package/dist/color/color-picker.d.ts +71 -0
- package/dist/color/color-picker.js +178 -0
- package/dist/color/color-slider.d.ts +31 -0
- package/dist/color/color-slider.js +51 -0
- package/dist/color/color-swatch.d.ts +32 -0
- package/dist/color/color-swatch.js +44 -0
- package/dist/color/index.d.ts +7 -0
- package/dist/color/index.js +7 -0
- package/dist/configurator/_export.d.ts +78 -0
- package/dist/configurator/_export.js +261 -0
- package/dist/configurator/_glyphs.js +92 -0
- package/dist/configurator/_overrides.d.ts +247 -0
- package/dist/configurator/_overrides.js +514 -0
- package/dist/configurator/configurator.d.ts +71 -0
- package/dist/configurator/configurator.js +279 -0
- package/dist/configurator/export-dialog.d.ts +30 -0
- package/dist/configurator/export-dialog.js +121 -0
- package/dist/configurator/index.d.ts +8 -0
- package/dist/configurator/index.js +8 -0
- package/dist/configurator/panel-sections.d.ts +86 -0
- package/dist/configurator/panel-sections.js +316 -0
- package/dist/configurator/token-editor.d.ts +74 -0
- package/dist/configurator/token-editor.js +149 -0
- package/dist/configurator/use-zoom.d.ts +87 -0
- package/dist/configurator/use-zoom.js +113 -0
- package/dist/date/_glyphs.js +34 -0
- package/dist/date/_segments.js +55 -0
- package/dist/date/_trigger.js +31 -0
- package/dist/date/calendar.d.ts +25 -0
- package/dist/date/calendar.js +125 -0
- package/dist/date/date-field.d.ts +34 -0
- package/dist/date/date-field.js +41 -0
- package/dist/date/date-picker.d.ts +69 -0
- package/dist/date/date-picker.js +89 -0
- package/dist/date/date-range-picker.d.ts +65 -0
- package/dist/date/date-range-picker.js +92 -0
- package/dist/date/index.d.ts +6 -0
- package/dist/date/index.js +6 -0
- package/dist/date/time-field.d.ts +29 -0
- package/dist/date/time-field.js +36 -0
- package/dist/dmx/_ramp.d.ts +77 -0
- package/dist/dmx/_ramp.js +169 -0
- package/dist/dmx/_readout.js +53 -0
- package/dist/dmx/_universe.d.ts +105 -0
- package/dist/dmx/_universe.js +112 -0
- package/dist/dmx/channel-matrix.d.ts +81 -0
- package/dist/dmx/channel-matrix.js +285 -0
- package/dist/dmx/dmx-bar.d.ts +50 -0
- package/dist/dmx/dmx-bar.js +107 -0
- package/dist/dmx/dmx-strip.d.ts +41 -0
- package/dist/dmx/dmx-strip.js +196 -0
- package/dist/dmx/index.d.ts +7 -0
- package/dist/dmx/index.js +7 -0
- package/dist/dmx/universe-grid.d.ts +61 -0
- package/dist/dmx/universe-grid.js +182 -0
- package/dist/flow/_frame.d.ts +52 -0
- package/dist/flow/_frame.js +38 -0
- package/dist/flow/controls.d.ts +41 -0
- package/dist/flow/controls.js +53 -0
- package/dist/flow/flow.css +121 -0
- package/dist/flow/handles.d.ts +40 -0
- package/dist/flow/handles.js +61 -0
- package/dist/flow/index.d.ts +7 -0
- package/dist/flow/index.js +7 -0
- package/dist/flow/node-card.d.ts +71 -0
- package/dist/flow/node-card.js +102 -0
- package/dist/flow/signal-edge.d.ts +60 -0
- package/dist/flow/signal-edge.js +108 -0
- package/dist/flow/use-flow-theme.d.ts +69 -0
- package/dist/flow/use-flow-theme.js +109 -0
- package/dist/forms/_chassis.d.ts +64 -0
- package/dist/forms/_chassis.js +59 -0
- package/dist/forms/_glyphs.js +143 -0
- package/dist/forms/_listbox.js +55 -0
- package/dist/forms/autocomplete.d.ts +61 -0
- package/dist/forms/autocomplete.js +88 -0
- package/dist/forms/button-group.d.ts +47 -0
- package/dist/forms/button-group.js +52 -0
- package/dist/forms/checkbox.d.ts +51 -0
- package/dist/forms/checkbox.js +98 -0
- package/dist/forms/combobox.d.ts +73 -0
- package/dist/forms/combobox.js +108 -0
- package/dist/forms/env-var-input.d.ts +74 -0
- package/dist/forms/env-var-input.js +116 -0
- package/dist/forms/field.d.ts +89 -0
- package/dist/forms/field.js +102 -0
- package/dist/forms/file-upload.d.ts +113 -0
- package/dist/forms/file-upload.js +232 -0
- package/dist/forms/index.d.ts +26 -0
- package/dist/forms/index.js +26 -0
- package/dist/forms/input-group.d.ts +31 -0
- package/dist/forms/input-group.js +54 -0
- package/dist/forms/input.d.ts +33 -0
- package/dist/forms/input.js +36 -0
- package/dist/forms/multi-select.d.ts +62 -0
- package/dist/forms/multi-select.js +107 -0
- package/dist/forms/number-field.d.ts +38 -0
- package/dist/forms/number-field.js +64 -0
- package/dist/forms/otp-field.d.ts +54 -0
- package/dist/forms/otp-field.js +59 -0
- package/dist/forms/password-input.d.ts +46 -0
- package/dist/forms/password-input.js +62 -0
- package/dist/forms/radio-group.d.ts +50 -0
- package/dist/forms/radio-group.js +64 -0
- package/dist/forms/rating.d.ts +69 -0
- package/dist/forms/rating.js +103 -0
- package/dist/forms/scrub-input.d.ts +81 -0
- package/dist/forms/scrub-input.js +249 -0
- package/dist/forms/search-input.d.ts +54 -0
- package/dist/forms/search-input.js +112 -0
- package/dist/forms/select.d.ts +75 -0
- package/dist/forms/select.js +91 -0
- package/dist/forms/slider.d.ts +44 -0
- package/dist/forms/slider.js +65 -0
- package/dist/forms/switch.d.ts +36 -0
- package/dist/forms/switch.js +71 -0
- package/dist/forms/tags-input.d.ts +69 -0
- package/dist/forms/tags-input.js +148 -0
- package/dist/forms/textarea.d.ts +27 -0
- package/dist/forms/textarea.js +37 -0
- package/dist/forms/toggle-group.d.ts +41 -0
- package/dist/forms/toggle-group.js +56 -0
- package/dist/forms/toggle.d.ts +41 -0
- package/dist/forms/toggle.js +100 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +104 -0
- package/dist/instruments/_ansi.js +116 -0
- package/dist/instruments/_glyphs.js +90 -0
- package/dist/instruments/_motion.js +56 -0
- package/dist/instruments/_rem.js +21 -0
- package/dist/instruments/app-window-frame.d.ts +48 -0
- package/dist/instruments/app-window-frame.js +76 -0
- package/dist/instruments/copy-button.d.ts +41 -0
- package/dist/instruments/copy-button.js +112 -0
- package/dist/instruments/data-table.d.ts +168 -0
- package/dist/instruments/data-table.js +212 -0
- package/dist/instruments/group-bar.d.ts +63 -0
- package/dist/instruments/group-bar.js +122 -0
- package/dist/instruments/index.d.ts +13 -0
- package/dist/instruments/index.js +13 -0
- package/dist/instruments/log-viewer.d.ts +74 -0
- package/dist/instruments/log-viewer.js +215 -0
- package/dist/instruments/meter.d.ts +77 -0
- package/dist/instruments/meter.js +96 -0
- package/dist/instruments/progress.d.ts +45 -0
- package/dist/instruments/progress.js +61 -0
- package/dist/instruments/seam-grid.d.ts +66 -0
- package/dist/instruments/seam-grid.js +78 -0
- package/dist/instruments/sparkline.d.ts +39 -0
- package/dist/instruments/sparkline.js +85 -0
- package/dist/instruments/stat.d.ts +35 -0
- package/dist/instruments/stat.js +59 -0
- package/dist/instruments/table.d.ts +51 -0
- package/dist/instruments/table.js +92 -0
- package/dist/instruments/terminal-frame.d.ts +89 -0
- package/dist/instruments/terminal-frame.js +256 -0
- package/dist/instruments/two-step-button.d.ts +47 -0
- package/dist/instruments/two-step-button.js +147 -0
- package/dist/instruments/usage-chart.d.ts +55 -0
- package/dist/instruments/usage-chart.js +235 -0
- package/dist/layout/_collapse.js +46 -0
- package/dist/layout/_glyphs.js +45 -0
- package/dist/layout/accordion.d.ts +52 -0
- package/dist/layout/accordion.js +81 -0
- package/dist/layout/breadcrumb.d.ts +35 -0
- package/dist/layout/breadcrumb.js +67 -0
- package/dist/layout/card.d.ts +51 -0
- package/dist/layout/card.js +76 -0
- package/dist/layout/carousel.d.ts +96 -0
- package/dist/layout/carousel.js +211 -0
- package/dist/layout/collapsible.d.ts +74 -0
- package/dist/layout/collapsible.js +126 -0
- package/dist/layout/container.d.ts +27 -0
- package/dist/layout/container.js +40 -0
- package/dist/layout/description-list.d.ts +24 -0
- package/dist/layout/description-list.js +37 -0
- package/dist/layout/grid.d.ts +40 -0
- package/dist/layout/grid.js +48 -0
- package/dist/layout/index.d.ts +15 -0
- package/dist/layout/index.js +15 -0
- package/dist/layout/item.d.ts +65 -0
- package/dist/layout/item.js +100 -0
- package/dist/layout/link.d.ts +48 -0
- package/dist/layout/link.js +63 -0
- package/dist/layout/pagination.d.ts +54 -0
- package/dist/layout/pagination.js +121 -0
- package/dist/layout/resizable.d.ts +38 -0
- package/dist/layout/resizable.js +68 -0
- package/dist/layout/sidebar.d.ts +67 -0
- package/dist/layout/sidebar.js +129 -0
- package/dist/layout/stack.d.ts +46 -0
- package/dist/layout/stack.js +62 -0
- package/dist/layout/stepper.d.ts +49 -0
- package/dist/layout/stepper.js +81 -0
- package/dist/layout/timeline.d.ts +43 -0
- package/dist/layout/timeline.js +63 -0
- package/dist/lib/aria-class.js +24 -0
- package/dist/lib/cn.js +18 -0
- package/dist/lib/compose.js +38 -0
- package/dist/lib/cva.d.ts +18 -0
- package/dist/lib/cva.js +65 -0
- package/dist/midi/_notes.d.ts +101 -0
- package/dist/midi/_notes.js +183 -0
- package/dist/midi/_ruler.d.ts +100 -0
- package/dist/midi/_ruler.js +105 -0
- package/dist/midi/_time.d.ts +107 -0
- package/dist/midi/_time.js +130 -0
- package/dist/midi/index.d.ts +9 -0
- package/dist/midi/index.js +9 -0
- package/dist/midi/musical-time-input.d.ts +48 -0
- package/dist/midi/musical-time-input.js +154 -0
- package/dist/midi/piano-keyboard.d.ts +50 -0
- package/dist/midi/piano-keyboard.js +193 -0
- package/dist/midi/spectrum-visualizer.d.ts +65 -0
- package/dist/midi/spectrum-visualizer.js +213 -0
- package/dist/midi/threshold-rail.d.ts +72 -0
- package/dist/midi/threshold-rail.js +214 -0
- package/dist/midi/timeline-ruler.d.ts +83 -0
- package/dist/midi/timeline-ruler.js +152 -0
- package/dist/overlays/_debounce.js +34 -0
- package/dist/overlays/_glyphs.js +59 -0
- package/dist/overlays/_surface.d.ts +70 -0
- package/dist/overlays/_surface.js +70 -0
- package/dist/overlays/_wheel.js +42 -0
- package/dist/overlays/alert-dialog.d.ts +67 -0
- package/dist/overlays/alert-dialog.js +117 -0
- package/dist/overlays/command-palette.d.ts +93 -0
- package/dist/overlays/command-palette.js +193 -0
- package/dist/overlays/context-menu.d.ts +64 -0
- package/dist/overlays/context-menu.js +78 -0
- package/dist/overlays/dialog.d.ts +72 -0
- package/dist/overlays/dialog.js +124 -0
- package/dist/overlays/drawer.d.ts +75 -0
- package/dist/overlays/drawer.js +151 -0
- package/dist/overlays/dropdown-menu.d.ts +79 -0
- package/dist/overlays/dropdown-menu.js +156 -0
- package/dist/overlays/hover-card.d.ts +58 -0
- package/dist/overlays/hover-card.js +91 -0
- package/dist/overlays/index.d.ts +15 -0
- package/dist/overlays/index.js +15 -0
- package/dist/overlays/info-tip.d.ts +41 -0
- package/dist/overlays/info-tip.js +45 -0
- package/dist/overlays/menubar.d.ts +72 -0
- package/dist/overlays/menubar.js +100 -0
- package/dist/overlays/popover.d.ts +66 -0
- package/dist/overlays/popover.js +114 -0
- package/dist/overlays/sheet.d.ts +78 -0
- package/dist/overlays/sheet.js +131 -0
- package/dist/overlays/toast.d.ts +106 -0
- package/dist/overlays/toast.js +146 -0
- package/dist/overlays/tooltip.d.ts +57 -0
- package/dist/overlays/tooltip.js +95 -0
- package/dist/primitives/avatar.d.ts +51 -0
- package/dist/primitives/avatar.js +93 -0
- package/dist/primitives/button.d.ts +46 -0
- package/dist/primitives/button.js +94 -0
- package/dist/primitives/chip.d.ts +47 -0
- package/dist/primitives/chip.js +152 -0
- package/dist/primitives/icon-button.d.ts +41 -0
- package/dist/primitives/icon-button.js +59 -0
- package/dist/primitives/index.d.ts +10 -0
- package/dist/primitives/index.js +10 -0
- package/dist/primitives/kbd.d.ts +17 -0
- package/dist/primitives/kbd.js +24 -0
- package/dist/primitives/separator.d.ts +25 -0
- package/dist/primitives/separator.js +30 -0
- package/dist/primitives/skeleton.d.ts +20 -0
- package/dist/primitives/skeleton.js +27 -0
- package/dist/primitives/spinner.d.ts +26 -0
- package/dist/primitives/spinner.js +31 -0
- package/dist/primitives/status-dot.d.ts +44 -0
- package/dist/primitives/status-dot.js +50 -0
- package/dist/styles.css +19 -0
- package/dist/system/density.d.ts +33 -0
- package/dist/system/density.js +49 -0
- package/dist/system/index.d.ts +8 -0
- package/dist/system/index.js +7 -0
- package/dist/system/portal.d.ts +51 -0
- package/dist/system/portal.js +122 -0
- package/dist/system/prepaint.d.ts +38 -0
- package/dist/system/prepaint.js +37 -0
- package/dist/system/theme-provider.d.ts +72 -0
- package/dist/system/theme-provider.js +252 -0
- package/dist/system/use-density.d.ts +33 -0
- package/dist/system/use-density.js +84 -0
- package/dist/system/use-isomorphic-layout-effect.js +15 -0
- package/dist/system/use-theme.d.ts +19 -0
- package/dist/system/use-theme.js +25 -0
- package/dist/theming/_presets.d.ts +11 -0
- package/dist/theming/_presets.js +487 -0
- package/dist/theming/contrast.d.ts +110 -0
- package/dist/theming/contrast.js +167 -0
- package/dist/theming/create-theme.d.ts +165 -0
- package/dist/theming/create-theme.js +442 -0
- package/dist/theming/index.d.ts +5 -0
- package/dist/theming/index.js +5 -0
- package/dist/theming/serialize.d.ts +145 -0
- package/dist/theming/serialize.js +165 -0
- package/package.json +216 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/instruments/sparkline.d.ts
|
|
3
|
+
interface SparklineProps extends Omit<React.SVGProps<SVGSVGElement>, "values" | "width" | "height" | "children" | "ref"> {
|
|
4
|
+
/** The series, as percentages. Clamped to 0–100; never rescaled. */
|
|
5
|
+
values: readonly number[];
|
|
6
|
+
/** Box width in px at the 16px root, emitted as `rem`. Defaults to `72`. */
|
|
7
|
+
width?: number;
|
|
8
|
+
/** Box height in px at the 16px root, emitted as `rem`. Defaults to `14`. */
|
|
9
|
+
height?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The accessible name. Defaults to a sentence naming the latest value, which
|
|
12
|
+
* is the only number a trace this small can honestly report.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A tiny unlabelled trace: "is this climbing, or did it just reset?".
|
|
18
|
+
*
|
|
19
|
+
* Deliberately answers nothing else — the numbers belong to the `Stat` or the
|
|
20
|
+
* row above it. Two rules make it trustworthy at 72×14:
|
|
21
|
+
*
|
|
22
|
+
* 1. **The scale is always 0–100.** A trace auto-scaled to its own range makes
|
|
23
|
+
* a flat 3% look identical to a flat 95%, which is the exact misreading a
|
|
24
|
+
* sparkline is supposed to prevent.
|
|
25
|
+
* 2. **The stroke tone comes from the last value**, not from the shape, so the
|
|
26
|
+
* colour agrees with the `Chip` or `Meter` sitting next to it.
|
|
27
|
+
*
|
|
28
|
+
* Under two points there is no line to draw, so it renders an empty box of the
|
|
29
|
+
* same size rather than nothing: a row of sparklines keeps its column even
|
|
30
|
+
* while some series are still filling up.
|
|
31
|
+
*
|
|
32
|
+
* Static markup — no `"use client"`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <Sparkline values={[12, 18, 30, 44, 61, 58, 72]} />
|
|
36
|
+
*/
|
|
37
|
+
declare const Sparkline: React.ForwardRefExoticComponent<SparklineProps & React.RefAttributes<SVGSVGElement>>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { Sparkline, SparklineProps };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { toRem } from "./_rem.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/instruments/sparkline.tsx
|
|
6
|
+
const TONE_CLASSES = {
|
|
7
|
+
accent: "text-accent",
|
|
8
|
+
warn: "text-warn",
|
|
9
|
+
danger: "text-danger"
|
|
10
|
+
};
|
|
11
|
+
/** Thresholds on the *last* value — the only point a glance actually lands on. */
|
|
12
|
+
function toneFor(last) {
|
|
13
|
+
if (last >= 80) return "danger";
|
|
14
|
+
if (last >= 50) return "warn";
|
|
15
|
+
return "accent";
|
|
16
|
+
}
|
|
17
|
+
/** Default box in px at the 16px root: wide enough for a week, short enough to inline. */
|
|
18
|
+
const DEFAULT_WIDTH_PX = 72;
|
|
19
|
+
const DEFAULT_HEIGHT_PX = 14;
|
|
20
|
+
/**
|
|
21
|
+
* A tiny unlabelled trace: "is this climbing, or did it just reset?".
|
|
22
|
+
*
|
|
23
|
+
* Deliberately answers nothing else — the numbers belong to the `Stat` or the
|
|
24
|
+
* row above it. Two rules make it trustworthy at 72×14:
|
|
25
|
+
*
|
|
26
|
+
* 1. **The scale is always 0–100.** A trace auto-scaled to its own range makes
|
|
27
|
+
* a flat 3% look identical to a flat 95%, which is the exact misreading a
|
|
28
|
+
* sparkline is supposed to prevent.
|
|
29
|
+
* 2. **The stroke tone comes from the last value**, not from the shape, so the
|
|
30
|
+
* colour agrees with the `Chip` or `Meter` sitting next to it.
|
|
31
|
+
*
|
|
32
|
+
* Under two points there is no line to draw, so it renders an empty box of the
|
|
33
|
+
* same size rather than nothing: a row of sparklines keeps its column even
|
|
34
|
+
* while some series are still filling up.
|
|
35
|
+
*
|
|
36
|
+
* Static markup — no `"use client"`.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <Sparkline values={[12, 18, 30, 44, 61, 58, 72]} />
|
|
40
|
+
*/
|
|
41
|
+
const Sparkline = React.forwardRef(function Sparkline({ className, values, width = DEFAULT_WIDTH_PX, height = DEFAULT_HEIGHT_PX, label, style, ...elementProps }, ref) {
|
|
42
|
+
const box = {
|
|
43
|
+
width: toRem(width),
|
|
44
|
+
height: toRem(height),
|
|
45
|
+
overflow: "visible",
|
|
46
|
+
...style
|
|
47
|
+
};
|
|
48
|
+
if (values.length < 2) return /* @__PURE__ */ jsx("svg", {
|
|
49
|
+
ref,
|
|
50
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
"data-slot": "sparkline",
|
|
53
|
+
"data-empty": "true",
|
|
54
|
+
className: cn("block shrink-0", className),
|
|
55
|
+
style: box,
|
|
56
|
+
...elementProps
|
|
57
|
+
});
|
|
58
|
+
const step = width / (values.length - 1);
|
|
59
|
+
const y = (value) => height - Math.min(100, Math.max(0, value)) / 100 * height;
|
|
60
|
+
const d = values.map((value, index) => `${index === 0 ? "M" : "L"}${(index * step).toFixed(1)},${y(value).toFixed(1)}`).join(" ");
|
|
61
|
+
const last = values[values.length - 1] ?? 0;
|
|
62
|
+
const tone = toneFor(last);
|
|
63
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
64
|
+
ref,
|
|
65
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
66
|
+
role: "img",
|
|
67
|
+
"aria-label": label ?? `Trend, currently ${Math.round(last)} percent`,
|
|
68
|
+
"data-slot": "sparkline",
|
|
69
|
+
"data-tone": tone,
|
|
70
|
+
className: cn("block shrink-0", TONE_CLASSES[tone], className),
|
|
71
|
+
style: box,
|
|
72
|
+
...elementProps,
|
|
73
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
74
|
+
d,
|
|
75
|
+
fill: "none",
|
|
76
|
+
stroke: "currentColor",
|
|
77
|
+
strokeWidth: "1",
|
|
78
|
+
strokeLinecap: "round",
|
|
79
|
+
strokeLinejoin: "round",
|
|
80
|
+
vectorEffect: "non-scaling-stroke"
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
//#endregion
|
|
85
|
+
export { Sparkline };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/instruments/stat.d.ts
|
|
3
|
+
/** The shared status vocabulary, plus the two non-status readings. */
|
|
4
|
+
type StatTone = "neutral" | "accent" | "ok" | "busy" | "warn" | "danger" | "info";
|
|
5
|
+
interface StatProps extends Omit<React.ComponentPropsWithoutRef<"div">, "children"> {
|
|
6
|
+
/** What is being measured. Rendered as a micro uppercase caption. */
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
/** The reading itself — the one thing the eye should land on. */
|
|
9
|
+
value: React.ReactNode;
|
|
10
|
+
/** Optional second line: a delta, a window, a unit. */
|
|
11
|
+
detail?: React.ReactNode;
|
|
12
|
+
/** Tints the value only. Defaults to `"neutral"`. */
|
|
13
|
+
tone?: StatTone;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* One number, named: the console's KPI tile.
|
|
17
|
+
*
|
|
18
|
+
* Reads label-first (micro, uppercase, tracked) so a row of tiles scans as a
|
|
19
|
+
* list of captions with the readings underneath, and the value is set in
|
|
20
|
+
* `tabular-nums` mono so a changing number does not shuffle the layout under
|
|
21
|
+
* the reader.
|
|
22
|
+
*
|
|
23
|
+
* Only the value takes the tone. Tinting the caption too would make a red tile
|
|
24
|
+
* where the intent is a red *number* — the label is not the alarm.
|
|
25
|
+
*
|
|
26
|
+
* Static markup — no `"use client"`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <Stat label="Universes" value="512" />
|
|
30
|
+
* @example
|
|
31
|
+
* <Stat label="Dropped frames" value="12" detail="last hour" tone="danger" />
|
|
32
|
+
*/
|
|
33
|
+
declare const Stat: React.ForwardRefExoticComponent<StatProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Stat, StatProps, StatTone };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/instruments/stat.tsx
|
|
5
|
+
const VALUE_TONE_CLASSES = {
|
|
6
|
+
neutral: "text-fg",
|
|
7
|
+
accent: "text-accent",
|
|
8
|
+
ok: "text-ok",
|
|
9
|
+
busy: "text-busy",
|
|
10
|
+
warn: "text-warn",
|
|
11
|
+
danger: "text-danger",
|
|
12
|
+
info: "text-info"
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* One number, named: the console's KPI tile.
|
|
16
|
+
*
|
|
17
|
+
* Reads label-first (micro, uppercase, tracked) so a row of tiles scans as a
|
|
18
|
+
* list of captions with the readings underneath, and the value is set in
|
|
19
|
+
* `tabular-nums` mono so a changing number does not shuffle the layout under
|
|
20
|
+
* the reader.
|
|
21
|
+
*
|
|
22
|
+
* Only the value takes the tone. Tinting the caption too would make a red tile
|
|
23
|
+
* where the intent is a red *number* — the label is not the alarm.
|
|
24
|
+
*
|
|
25
|
+
* Static markup — no `"use client"`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <Stat label="Universes" value="512" />
|
|
29
|
+
* @example
|
|
30
|
+
* <Stat label="Dropped frames" value="12" detail="last hour" tone="danger" />
|
|
31
|
+
*/
|
|
32
|
+
const Stat = React.forwardRef(function Stat({ className, label, value, detail, tone = "neutral", ...elementProps }, ref) {
|
|
33
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
34
|
+
ref,
|
|
35
|
+
"data-slot": "stat",
|
|
36
|
+
"data-tone": tone,
|
|
37
|
+
className: cn("flex min-w-0 flex-col gap-(--cue-space-2)", className),
|
|
38
|
+
...elementProps,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx("span", {
|
|
41
|
+
"data-slot": "stat-label",
|
|
42
|
+
className: "truncate font-mono text-(length:--cue-text-micro) tracking-[0.15em] text-fg-subtle uppercase",
|
|
43
|
+
children: label
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("span", {
|
|
46
|
+
"data-slot": "stat-value",
|
|
47
|
+
className: cn("truncate font-mono text-(length:--cue-text-title) leading-none tabular-nums", VALUE_TONE_CLASSES[tone]),
|
|
48
|
+
children: value
|
|
49
|
+
}),
|
|
50
|
+
detail === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
51
|
+
"data-slot": "stat-detail",
|
|
52
|
+
className: "truncate font-mono text-(length:--cue-text-label) text-fg-muted",
|
|
53
|
+
children: detail
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Stat };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/instruments/table.d.ts
|
|
3
|
+
interface TableRootProps extends React.ComponentPropsWithoutRef<"table"> {}
|
|
4
|
+
interface TableSectionProps extends React.ComponentPropsWithoutRef<"tbody"> {}
|
|
5
|
+
interface TableRowProps extends React.ComponentPropsWithoutRef<"tr"> {}
|
|
6
|
+
interface TableHeadProps extends React.ComponentPropsWithoutRef<"th"> {
|
|
7
|
+
/** Right-align this column and set it in tabular figures. */
|
|
8
|
+
numeric?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface TableCellProps extends React.ComponentPropsWithoutRef<"td"> {
|
|
11
|
+
/** Right-align this cell and set it in tabular figures. */
|
|
12
|
+
numeric?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface TableCaptionProps extends React.ComponentPropsWithoutRef<"caption"> {}
|
|
15
|
+
/**
|
|
16
|
+
* The canonical console table: hairlines, mono figures, no zebra striping.
|
|
17
|
+
*
|
|
18
|
+
* Semantic `<table>` markup throughout — a grid of divs loses row/column
|
|
19
|
+
* announcement, and a console table is exactly the place a screen reader user
|
|
20
|
+
* needs it. Zebra rows are deliberately absent: at console density the stripes
|
|
21
|
+
* are thicker than the data.
|
|
22
|
+
*
|
|
23
|
+
* Static markup — no `"use client"`. Compose it with `Panel` for the rim.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <Table.Root>
|
|
27
|
+
* <Table.Header>
|
|
28
|
+
* <Table.Row>
|
|
29
|
+
* <Table.Head>Fixture</Table.Head>
|
|
30
|
+
* <Table.Head numeric>Address</Table.Head>
|
|
31
|
+
* </Table.Row>
|
|
32
|
+
* </Table.Header>
|
|
33
|
+
* <Table.Body>
|
|
34
|
+
* <Table.Row>
|
|
35
|
+
* <Table.Cell>Par 64</Table.Cell>
|
|
36
|
+
* <Table.Cell numeric>001</Table.Cell>
|
|
37
|
+
* </Table.Row>
|
|
38
|
+
* </Table.Body>
|
|
39
|
+
* </Table.Root>
|
|
40
|
+
*/
|
|
41
|
+
declare const Table: {
|
|
42
|
+
Root: React.ForwardRefExoticComponent<TableRootProps & React.RefAttributes<HTMLTableElement>>;
|
|
43
|
+
Header: React.ForwardRefExoticComponent<TableSectionProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
44
|
+
Body: React.ForwardRefExoticComponent<TableSectionProps & React.RefAttributes<HTMLTableSectionElement>>;
|
|
45
|
+
Row: React.ForwardRefExoticComponent<TableRowProps & React.RefAttributes<HTMLTableRowElement>>;
|
|
46
|
+
Head: React.ForwardRefExoticComponent<TableHeadProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
47
|
+
Cell: React.ForwardRefExoticComponent<TableCellProps & React.RefAttributes<HTMLTableCellElement>>;
|
|
48
|
+
Caption: React.ForwardRefExoticComponent<TableCaptionProps & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Table, TableCaptionProps, TableCellProps, TableHeadProps, TableRootProps, TableRowProps, TableSectionProps };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* The canonical console table: hairlines, mono figures, no zebra striping.
|
|
6
|
+
*
|
|
7
|
+
* Semantic `<table>` markup throughout — a grid of divs loses row/column
|
|
8
|
+
* announcement, and a console table is exactly the place a screen reader user
|
|
9
|
+
* needs it. Zebra rows are deliberately absent: at console density the stripes
|
|
10
|
+
* are thicker than the data.
|
|
11
|
+
*
|
|
12
|
+
* Static markup — no `"use client"`. Compose it with `Panel` for the rim.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <Table.Root>
|
|
16
|
+
* <Table.Header>
|
|
17
|
+
* <Table.Row>
|
|
18
|
+
* <Table.Head>Fixture</Table.Head>
|
|
19
|
+
* <Table.Head numeric>Address</Table.Head>
|
|
20
|
+
* </Table.Row>
|
|
21
|
+
* </Table.Header>
|
|
22
|
+
* <Table.Body>
|
|
23
|
+
* <Table.Row>
|
|
24
|
+
* <Table.Cell>Par 64</Table.Cell>
|
|
25
|
+
* <Table.Cell numeric>001</Table.Cell>
|
|
26
|
+
* </Table.Row>
|
|
27
|
+
* </Table.Body>
|
|
28
|
+
* </Table.Root>
|
|
29
|
+
*/
|
|
30
|
+
const Table = {
|
|
31
|
+
Root: React.forwardRef(function TableRoot({ className, ...elementProps }, ref) {
|
|
32
|
+
return /* @__PURE__ */ jsx("table", {
|
|
33
|
+
ref,
|
|
34
|
+
"data-slot": "table",
|
|
35
|
+
className: cn("w-full border-collapse font-mono text-(length:--cue-text-ui) text-fg", "[&_[data-numeric]]:text-right [&_[data-numeric]]:tabular-nums", className),
|
|
36
|
+
...elementProps
|
|
37
|
+
});
|
|
38
|
+
}),
|
|
39
|
+
Header: React.forwardRef(function TableHeader({ className, ...elementProps }, ref) {
|
|
40
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
41
|
+
ref,
|
|
42
|
+
"data-slot": "table-header",
|
|
43
|
+
className,
|
|
44
|
+
...elementProps
|
|
45
|
+
});
|
|
46
|
+
}),
|
|
47
|
+
Body: React.forwardRef(function TableBody({ className, ...elementProps }, ref) {
|
|
48
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
49
|
+
ref,
|
|
50
|
+
"data-slot": "table-body",
|
|
51
|
+
className,
|
|
52
|
+
...elementProps
|
|
53
|
+
});
|
|
54
|
+
}),
|
|
55
|
+
Row: React.forwardRef(function TableRow({ className, ...elementProps }, ref) {
|
|
56
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
57
|
+
ref,
|
|
58
|
+
"data-slot": "table-row",
|
|
59
|
+
className: cn("border-b border-border last:border-b-0", className),
|
|
60
|
+
...elementProps
|
|
61
|
+
});
|
|
62
|
+
}),
|
|
63
|
+
Head: React.forwardRef(function TableHead({ className, numeric = false, scope = "col", ...elementProps }, ref) {
|
|
64
|
+
return /* @__PURE__ */ jsx("th", {
|
|
65
|
+
ref,
|
|
66
|
+
scope,
|
|
67
|
+
"data-slot": "table-head",
|
|
68
|
+
"data-numeric": numeric ? "" : void 0,
|
|
69
|
+
className: cn("border-b border-border bg-surface-1 px-(--cue-pad-row-x) py-(--cue-pad-row-y) text-left font-mono text-(length:--cue-text-label) font-normal tracking-[0.15em] whitespace-nowrap text-fg-subtle uppercase", className),
|
|
70
|
+
...elementProps
|
|
71
|
+
});
|
|
72
|
+
}),
|
|
73
|
+
Cell: React.forwardRef(function TableCell({ className, numeric = false, ...elementProps }, ref) {
|
|
74
|
+
return /* @__PURE__ */ jsx("td", {
|
|
75
|
+
ref,
|
|
76
|
+
"data-slot": "table-cell",
|
|
77
|
+
"data-numeric": numeric ? "" : void 0,
|
|
78
|
+
className: cn("px-(--cue-pad-row-x) py-(--cue-pad-row-y) align-middle", className),
|
|
79
|
+
...elementProps
|
|
80
|
+
});
|
|
81
|
+
}),
|
|
82
|
+
Caption: React.forwardRef(function TableCaption({ className, ...elementProps }, ref) {
|
|
83
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
84
|
+
ref,
|
|
85
|
+
"data-slot": "table-caption",
|
|
86
|
+
className: cn("caption-bottom pt-(--cue-space-3) text-left font-mono text-(length:--cue-text-label) text-fg-subtle", className),
|
|
87
|
+
...elementProps
|
|
88
|
+
});
|
|
89
|
+
})
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
export { Table };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/instruments/terminal-frame.d.ts
|
|
3
|
+
/** Ink for one transcript line, in the shared status vocabulary. */
|
|
4
|
+
type TerminalLineTone = "neutral" | "accent" | "ok" | "warn" | "danger" | "info";
|
|
5
|
+
/** One line of a transcript. A bare string is output; `command` makes it a prompt line. */
|
|
6
|
+
interface TerminalLine {
|
|
7
|
+
/** The text of the line, verbatim. */
|
|
8
|
+
text: string;
|
|
9
|
+
/** Prefix it with the prompt glyph — this line is something the user typed. */
|
|
10
|
+
command?: boolean;
|
|
11
|
+
/** Ink for the line. Defaults to `"neutral"`. */
|
|
12
|
+
tone?: TerminalLineTone;
|
|
13
|
+
}
|
|
14
|
+
/** Shorthand: a bare string is an output line with no tone. */
|
|
15
|
+
type TerminalFrameLine = string | TerminalLine;
|
|
16
|
+
/** One beat of a simulated session: type a command, spin, print the result. */
|
|
17
|
+
interface TerminalStep {
|
|
18
|
+
/** Typed one character at a time at the prompt. */
|
|
19
|
+
command?: string;
|
|
20
|
+
/** Label shown next to a spinner once the command "runs". */
|
|
21
|
+
pending?: string;
|
|
22
|
+
/** How long the spinner runs, in ms. Defaults to `900`. */
|
|
23
|
+
pendingMs?: number;
|
|
24
|
+
/** Printed all at once when the step finishes. */
|
|
25
|
+
output?: readonly TerminalFrameLine[];
|
|
26
|
+
}
|
|
27
|
+
/** A scripted session for {@link TerminalFrameProps.simulate}. */
|
|
28
|
+
interface TerminalScript {
|
|
29
|
+
/** The beats, in order. */
|
|
30
|
+
steps: readonly TerminalStep[];
|
|
31
|
+
/** Nominal ms per keystroke, jittered 0.6×–1.6×. Defaults to `55`. */
|
|
32
|
+
keystrokeMs?: number;
|
|
33
|
+
/** Seed for the keystroke jitter. The same seed always plays the same way. Defaults to `1`. */
|
|
34
|
+
seed?: number;
|
|
35
|
+
/** Pause after a command lands and after its output prints, in ms. Defaults to `600`. */
|
|
36
|
+
holdMs?: number;
|
|
37
|
+
}
|
|
38
|
+
interface TerminalFrameProps extends Omit<React.ComponentPropsWithoutRef<"div">, "title" | "children"> {
|
|
39
|
+
/** Name above the transcript — a log file, a host, a task. */
|
|
40
|
+
title?: React.ReactNode;
|
|
41
|
+
/** Static transcript. Rendered as a preamble when `simulate` is also set. */
|
|
42
|
+
lines?: readonly TerminalFrameLine[];
|
|
43
|
+
/** The prompt glyph in front of a command line. Defaults to `"$"`. */
|
|
44
|
+
prompt?: string;
|
|
45
|
+
/** Show a `CopyButton` in the title bar for the commands in the transcript. */
|
|
46
|
+
copy?: boolean;
|
|
47
|
+
/** What the copy button puts on the clipboard. Defaults to the command lines, one per line. */
|
|
48
|
+
copyValue?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Play the transcript out as a typed session.
|
|
51
|
+
*
|
|
52
|
+
* Pass a stable reference (a module constant, or memoised) — the player
|
|
53
|
+
* restarts whenever this prop changes identity. Under
|
|
54
|
+
* `prefers-reduced-motion` the finished transcript renders instantly and no
|
|
55
|
+
* timer is ever scheduled.
|
|
56
|
+
*/
|
|
57
|
+
simulate?: TerminalScript;
|
|
58
|
+
/** Fixed body height in px at the 16px root. Leave unset to grow with the content. */
|
|
59
|
+
height?: number;
|
|
60
|
+
/** Extra content under the transcript — an input row, a hint strip. */
|
|
61
|
+
children?: React.ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A recessed terminal: mono, `$`-prefixed commands, optional typed playback.
|
|
65
|
+
*
|
|
66
|
+
* Recessed rather than raised — `bg-sunken` sits the transcript *into* the page
|
|
67
|
+
* the way a real console does (the snuffle convention, where the terminal
|
|
68
|
+
* surface is the only thing darker than the background).
|
|
69
|
+
*
|
|
70
|
+
* The `simulate` player is deliberately not a GIF or a video: it is text, so it
|
|
71
|
+
* copies, it scales with the type ramp, it re-themes, and it costs nothing to
|
|
72
|
+
* load. Keystrokes are jittered from a seed so a marketing screenshot is
|
|
73
|
+
* reproducible, and the whole animation is replaced by its final frame under
|
|
74
|
+
* `prefers-reduced-motion` — with no timers scheduled at all, rather than an
|
|
75
|
+
* animation that runs invisibly.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* <TerminalFrame
|
|
79
|
+
* title="install"
|
|
80
|
+
* copy
|
|
81
|
+
* lines={[{ text: "pnpm add @cueplusplus/ui", command: true }, "+ 1 package"]}
|
|
82
|
+
* />
|
|
83
|
+
* @example
|
|
84
|
+
* const SCRIPT = { steps: [{ command: "cue build", pending: "compiling", output: ["12 cues"] }] };
|
|
85
|
+
* <TerminalFrame simulate={SCRIPT} />
|
|
86
|
+
*/
|
|
87
|
+
declare const TerminalFrame: React.ForwardRefExoticComponent<TerminalFrameProps & React.RefAttributes<HTMLDivElement>>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { TerminalFrame, TerminalFrameLine, TerminalFrameProps, TerminalLine, TerminalLineTone, TerminalScript, TerminalStep };
|