@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,41 @@
|
|
|
1
|
+
import { FormControlSize } from "./_chassis.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
4
|
+
//#region src/forms/toggle-group.d.ts
|
|
5
|
+
interface ToggleGroupProps extends Omit<ToggleGroup.Props, "className" | "value" | "defaultValue" | "onValueChange" | "children"> {
|
|
6
|
+
/** The pressed values when controlled. Pass with `onValueChange`. */
|
|
7
|
+
value?: readonly string[];
|
|
8
|
+
/** The initially pressed values when uncontrolled. */
|
|
9
|
+
defaultValue?: readonly string[];
|
|
10
|
+
/** Called with every pressed value, in the order the toggles are declared. */
|
|
11
|
+
onValueChange?: (value: string[]) => void;
|
|
12
|
+
/** Rung of the control ladder for every toggle inside. Defaults to `"md"`. */
|
|
13
|
+
size?: FormControlSize;
|
|
14
|
+
/** Extra classes for the group frame. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** The {@link Toggle}s, each carrying a `value`. */
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A cluster of {@link Toggle}s sharing one pressed state.
|
|
21
|
+
*
|
|
22
|
+
* The difference from {@link SegmentedControl} is not cosmetic: a toggle group
|
|
23
|
+
* can be **empty**. Pressing the pressed item unpresses it, so "no filter" is a
|
|
24
|
+
* reachable state — which is what a filter bar needs and what a view switcher
|
|
25
|
+
* must never offer. Reach for `SegmentedControl` when the answer is always one
|
|
26
|
+
* of N, and for this when the answer may be none, or several (`multiple`).
|
|
27
|
+
*
|
|
28
|
+
* Arrow-key roving focus and the pressed-state ARIA come from Base UI; this
|
|
29
|
+
* layer supplies the density rung (published to the children through context)
|
|
30
|
+
* and the flat frame-less layout — a group of toggles is a row of controls, not
|
|
31
|
+
* a boxed widget.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* <ToggleGroup aria-label="Layers" multiple value={layers} onValueChange={setLayers}>
|
|
35
|
+
* <Toggle value="beams">Beams</Toggle>
|
|
36
|
+
* <Toggle value="haze">Haze</Toggle>
|
|
37
|
+
* </ToggleGroup>
|
|
38
|
+
*/
|
|
39
|
+
declare const ToggleGroup$1: React.ForwardRefExoticComponent<Omit<ToggleGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { ToggleGroup$1 as ToggleGroup, ToggleGroupProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
6
|
+
//#region src/forms/toggle-group.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The rung the group publishes to the {@link Toggle}s inside it, so a caller
|
|
9
|
+
* sizes the cluster once instead of repeating `size` on every member.
|
|
10
|
+
*
|
|
11
|
+
* `null` outside a group — a lone toggle then falls back to its own default.
|
|
12
|
+
*
|
|
13
|
+
* @internal Not part of the public API; read by `toggle.tsx`.
|
|
14
|
+
*/
|
|
15
|
+
const ToggleGroupSizeContext = React.createContext(null);
|
|
16
|
+
/**
|
|
17
|
+
* A cluster of {@link Toggle}s sharing one pressed state.
|
|
18
|
+
*
|
|
19
|
+
* The difference from {@link SegmentedControl} is not cosmetic: a toggle group
|
|
20
|
+
* can be **empty**. Pressing the pressed item unpresses it, so "no filter" is a
|
|
21
|
+
* reachable state — which is what a filter bar needs and what a view switcher
|
|
22
|
+
* must never offer. Reach for `SegmentedControl` when the answer is always one
|
|
23
|
+
* of N, and for this when the answer may be none, or several (`multiple`).
|
|
24
|
+
*
|
|
25
|
+
* Arrow-key roving focus and the pressed-state ARIA come from Base UI; this
|
|
26
|
+
* layer supplies the density rung (published to the children through context)
|
|
27
|
+
* and the flat frame-less layout — a group of toggles is a row of controls, not
|
|
28
|
+
* a boxed widget.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <ToggleGroup aria-label="Layers" multiple value={layers} onValueChange={setLayers}>
|
|
32
|
+
* <Toggle value="beams">Beams</Toggle>
|
|
33
|
+
* <Toggle value="haze">Haze</Toggle>
|
|
34
|
+
* </ToggleGroup>
|
|
35
|
+
*/
|
|
36
|
+
const ToggleGroup$1 = React.forwardRef(function ToggleGroup$2({ value, defaultValue, onValueChange, size = "md", orientation, className, children, ...groupProps }, ref) {
|
|
37
|
+
const handleValueChange = React.useCallback((next) => {
|
|
38
|
+
onValueChange?.(next);
|
|
39
|
+
}, [onValueChange]);
|
|
40
|
+
return /* @__PURE__ */ jsx(ToggleGroup, {
|
|
41
|
+
ref,
|
|
42
|
+
"data-slot": "toggle-group",
|
|
43
|
+
value,
|
|
44
|
+
defaultValue,
|
|
45
|
+
onValueChange: onValueChange === void 0 ? void 0 : handleValueChange,
|
|
46
|
+
orientation,
|
|
47
|
+
className: cn("inline-flex items-center gap-(--cue-space-1)", orientation === "vertical" && "flex-col items-stretch", className),
|
|
48
|
+
...groupProps,
|
|
49
|
+
children: /* @__PURE__ */ jsx(ToggleGroupSizeContext.Provider, {
|
|
50
|
+
value: size,
|
|
51
|
+
children
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
//#endregion
|
|
56
|
+
export { ToggleGroup$1 as ToggleGroup, ToggleGroupSizeContext };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FormControlSize } from "./_chassis.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
4
|
+
//#region src/forms/toggle.d.ts
|
|
5
|
+
interface ToggleProps extends Omit<Toggle.Props, "className"> {
|
|
6
|
+
/** Extra classes, merged over the recipe. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Rung of the control ladder. Defaults to the enclosing {@link ToggleGroup}'s
|
|
10
|
+
* rung, or `"md"` outside one.
|
|
11
|
+
*/
|
|
12
|
+
size?: FormControlSize;
|
|
13
|
+
/**
|
|
14
|
+
* Optional leading icon component (e.g. a lucide icon). Rendered `aria-hidden`
|
|
15
|
+
* and sized to the density icon token. With no `children` the toggle collapses
|
|
16
|
+
* to a square target instead of a wide pill.
|
|
17
|
+
*/
|
|
18
|
+
icon?: React.ElementType;
|
|
19
|
+
/** The label. Leave it off for an icon-only toggle — and then pass `aria-label`. */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A two-state button: solo, mute, snap-to-grid, "show hidden".
|
|
24
|
+
*
|
|
25
|
+
* Distinct from {@link Switch}, which sets a *setting* and reads as a physical
|
|
26
|
+
* throw; a toggle is a **button that stays down**, so it belongs in a toolbar
|
|
27
|
+
* next to other buttons rather than in a settings list. `aria-pressed` — not
|
|
28
|
+
* `aria-checked` — is what says so to assistive technology, and Base UI wires
|
|
29
|
+
* that for us.
|
|
30
|
+
*
|
|
31
|
+
* Inside a {@link ToggleGroup} it inherits the group's density rung and joins
|
|
32
|
+
* its roving-focus ring; on its own it is a perfectly good standalone control.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <Toggle aria-label="Solo" icon={Headphones} pressed={solo} onPressedChange={setSolo} />
|
|
36
|
+
* @example
|
|
37
|
+
* <Toggle defaultPressed>Snap</Toggle>
|
|
38
|
+
*/
|
|
39
|
+
declare const Toggle$1: React.ForwardRefExoticComponent<Omit<ToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Toggle$1 as Toggle, ToggleProps };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { cva } from "../lib/cva.js";
|
|
4
|
+
import { ToggleGroupSizeContext } from "./toggle-group.js";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
8
|
+
//#region src/forms/toggle.tsx
|
|
9
|
+
/**
|
|
10
|
+
* A toggle is a *ghost* button until it is pressed, and then it is a **tint**,
|
|
11
|
+
* never a solid fill — the same ruling that governs the segmented control and
|
|
12
|
+
* the highlighted menu row. A solid accent block on a 22px control reads as a
|
|
13
|
+
* second, louder button and drowns the labels beside it.
|
|
14
|
+
*/
|
|
15
|
+
const toggleVariants = cva("inline-flex shrink-0 cursor-pointer select-none items-center justify-center gap-[0.4em] whitespace-nowrap rounded-(--radius-control) border border-transparent bg-transparent font-mono font-medium text-fg-muted transition-colors duration-150 outline-none hover:bg-surface-2 hover:text-fg focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-1 focus-visible:outline-accent data-[pressed]:bg-accent-soft data-[pressed]:text-accent data-[disabled]:pointer-events-none data-[disabled]:opacity-40", {
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
sm: "text-(length:--cue-text-label)",
|
|
19
|
+
md: "text-(length:--cue-text-ui)",
|
|
20
|
+
lg: "text-(length:--cue-text-body)"
|
|
21
|
+
},
|
|
22
|
+
/** Icon-only toggles are square; labelled ones get a height and padding. */
|
|
23
|
+
square: {
|
|
24
|
+
true: "",
|
|
25
|
+
false: ""
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
compoundVariants: [
|
|
29
|
+
{
|
|
30
|
+
size: "sm",
|
|
31
|
+
square: false,
|
|
32
|
+
class: "h-control-sm px-(--cue-space-3)"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
size: "md",
|
|
36
|
+
square: false,
|
|
37
|
+
class: "h-control-md px-(--cue-space-4)"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
size: "lg",
|
|
41
|
+
square: false,
|
|
42
|
+
class: "h-control-lg px-(--cue-space-5)"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
size: "sm",
|
|
46
|
+
square: true,
|
|
47
|
+
class: "size-control-sm"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
size: "md",
|
|
51
|
+
square: true,
|
|
52
|
+
class: "size-control-md"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
size: "lg",
|
|
56
|
+
square: true,
|
|
57
|
+
class: "size-control-lg"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
size: "md",
|
|
62
|
+
square: false
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* A two-state button: solo, mute, snap-to-grid, "show hidden".
|
|
67
|
+
*
|
|
68
|
+
* Distinct from {@link Switch}, which sets a *setting* and reads as a physical
|
|
69
|
+
* throw; a toggle is a **button that stays down**, so it belongs in a toolbar
|
|
70
|
+
* next to other buttons rather than in a settings list. `aria-pressed` — not
|
|
71
|
+
* `aria-checked` — is what says so to assistive technology, and Base UI wires
|
|
72
|
+
* that for us.
|
|
73
|
+
*
|
|
74
|
+
* Inside a {@link ToggleGroup} it inherits the group's density rung and joins
|
|
75
|
+
* its roving-focus ring; on its own it is a perfectly good standalone control.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* <Toggle aria-label="Solo" icon={Headphones} pressed={solo} onPressedChange={setSolo} />
|
|
79
|
+
* @example
|
|
80
|
+
* <Toggle defaultPressed>Snap</Toggle>
|
|
81
|
+
*/
|
|
82
|
+
const Toggle$1 = React.forwardRef(function Toggle$2({ className, size, icon: Icon, children, ...elementProps }, ref) {
|
|
83
|
+
const groupSize = React.useContext(ToggleGroupSizeContext);
|
|
84
|
+
const rung = size ?? groupSize ?? "md";
|
|
85
|
+
return /* @__PURE__ */ jsxs(Toggle, {
|
|
86
|
+
ref,
|
|
87
|
+
"data-slot": "toggle",
|
|
88
|
+
className: cn(toggleVariants({
|
|
89
|
+
size: rung,
|
|
90
|
+
square: children === void 0 || children === null || children === false
|
|
91
|
+
}), className),
|
|
92
|
+
...elementProps,
|
|
93
|
+
children: [Icon === void 0 ? null : /* @__PURE__ */ jsx(Icon, {
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
className: cn("shrink-0", rung === "sm" ? "size-icon-sm" : "size-icon-md")
|
|
96
|
+
}), children]
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
//#endregion
|
|
100
|
+
export { Toggle$1 as Toggle };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, AgentColorOptions, agentColor, agentColorStyle } from "./chat/agent-color.js";
|
|
2
|
+
import { AgentPile, AgentPileEntry, AgentPileProps, AgentPileSize } from "./chat/agent-pile.js";
|
|
3
|
+
import { AskAnswer, AskBox, AskBoxProps, AskDanger, AskKind, AskOption } from "./chat/ask-box.js";
|
|
4
|
+
import { Composer, ComposerProps, ComposerSubmitKey } from "./chat/composer.js";
|
|
5
|
+
import { DelegationCard, DelegationCardProps, DelegationDirection, DelegationStatus } from "./chat/delegation-card.js";
|
|
6
|
+
import { Message, MessageProps, MessageRole } from "./chat/message.js";
|
|
7
|
+
import { MessageList, MessageListProps } from "./chat/message-list.js";
|
|
8
|
+
import "./chat/index.js";
|
|
9
|
+
import { ScrollEdges, TAB_FADE_PX, computeScrollEdges, edgeFadeMask } from "./chrome/_tabs-scroll.js";
|
|
10
|
+
import { TREE_GUIDE_GLYPHS, TreeGuide, TreeItem, TreeRow, flattenTree } from "./chrome/_tree.js";
|
|
11
|
+
import { EmptyState, EmptyStateProps } from "./chrome/empty-state.js";
|
|
12
|
+
import { Eyebrow, EyebrowProps } from "./chrome/eyebrow.js";
|
|
13
|
+
import { NavigationMenu, NavigationMenuContentProps, NavigationMenuItemProps, NavigationMenuLinkProps, NavigationMenuListProps, NavigationMenuRootProps, NavigationMenuTriggerProps, NavigationMenuViewportProps } from "./chrome/navigation-menu.js";
|
|
14
|
+
import { PageShell, PageShellProps, PageWidth } from "./chrome/page-shell.js";
|
|
15
|
+
import { Panel, PanelHeader, PanelHeaderProps, PanelProps } from "./chrome/panel.js";
|
|
16
|
+
import { Row, RowProps, SeamList, SeamListProps, rowVariants } from "./chrome/row.js";
|
|
17
|
+
import { ScrollArea, ScrollAreaOrientation, ScrollAreaProps } from "./chrome/scroll-area.js";
|
|
18
|
+
import { SectionHeader, SectionHeaderProps } from "./chrome/section-header.js";
|
|
19
|
+
import { SegmentedControl, SegmentedControlItem, SegmentedControlProps, SegmentedControlSize } from "./chrome/segmented-control.js";
|
|
20
|
+
import { StatusBar, StatusBarItemProps, StatusBarProps, StatusBarTone } from "./chrome/status-bar.js";
|
|
21
|
+
import { ScrollableTabsList, ScrollableTabsListProps, Tabs, TabsListProps, TabsPanelProps, TabsRootProps, TabsTabProps } from "./chrome/tabs.js";
|
|
22
|
+
import { TitleBar, TitleBarProps } from "./chrome/title-bar.js";
|
|
23
|
+
import { Tree, TreeProps, TreeVisibility, TreeVisibilityToggle, TreeVisibilityToggleProps } from "./chrome/tree.js";
|
|
24
|
+
import { Toolbar, ToolbarButtonProps, ToolbarGroupProps, ToolbarRootProps, ToolbarSeparatorProps } from "./chrome/toolbar.js";
|
|
25
|
+
import "./chrome/index.js";
|
|
26
|
+
import { ControlVariantProps, FormControlSize, bareControlClasses, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants } from "./forms/_chassis.js";
|
|
27
|
+
import { ResolvedMode, ThemeContextValue, ThemeProvider, ThemeProviderProps } from "./system/theme-provider.js";
|
|
28
|
+
import { Autocomplete, AutocompleteProps } from "./forms/autocomplete.js";
|
|
29
|
+
import { ButtonGroup, ButtonGroupOrientation, ButtonGroupProps } from "./forms/button-group.js";
|
|
30
|
+
import { Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps } from "./forms/checkbox.js";
|
|
31
|
+
import { Combobox, ComboboxOption, ComboboxProps } from "./forms/combobox.js";
|
|
32
|
+
import { EnvVarInput, EnvVarInputProps, envReference, parseEnvReference } from "./forms/env-var-input.js";
|
|
33
|
+
import { Field, FieldDescription, FieldDescriptionProps, FieldError, FieldErrorProps, FieldIssue, FieldLabel, FieldLabelProps, FieldProps } from "./forms/field.js";
|
|
34
|
+
import { FilePartition, FilePartitionOptions, FileRejectReason, FileRejection, FileUpload, FileUploadProps, UploadFile, UploadStatus, partitionFiles } from "./forms/file-upload.js";
|
|
35
|
+
import { Input, InputProps } from "./forms/input.js";
|
|
36
|
+
import { InputGroup, InputGroupProps } from "./forms/input-group.js";
|
|
37
|
+
import { MultiSelect, MultiSelectProps } from "./forms/multi-select.js";
|
|
38
|
+
import { NumberField, NumberFieldProps } from "./forms/number-field.js";
|
|
39
|
+
import { OTPField, OTPFieldProps } from "./forms/otp-field.js";
|
|
40
|
+
import { PasswordInput, PasswordInputProps } from "./forms/password-input.js";
|
|
41
|
+
import { Radio, RadioGroup, RadioGroupProps, RadioProps } from "./forms/radio-group.js";
|
|
42
|
+
import { Rating, RatingProps, RatingSize } from "./forms/rating.js";
|
|
43
|
+
import { ScrubInput, ScrubInputProps } from "./forms/scrub-input.js";
|
|
44
|
+
import { SearchInput, SearchInputProps } from "./forms/search-input.js";
|
|
45
|
+
import { Select, SelectOption, SelectProps } from "./forms/select.js";
|
|
46
|
+
import { Slider, SliderProps } from "./forms/slider.js";
|
|
47
|
+
import { Switch, SwitchProps } from "./forms/switch.js";
|
|
48
|
+
import { TagsInput, TagsInputProps } from "./forms/tags-input.js";
|
|
49
|
+
import { Textarea, TextareaProps } from "./forms/textarea.js";
|
|
50
|
+
import { Toggle, ToggleProps } from "./forms/toggle.js";
|
|
51
|
+
import { ToggleGroup, ToggleGroupProps } from "./forms/toggle-group.js";
|
|
52
|
+
import "./forms/index.js";
|
|
53
|
+
import { AppWindowFrame, AppWindowFrameProps } from "./instruments/app-window-frame.js";
|
|
54
|
+
import { Button, ButtonProps, buttonVariants } from "./primitives/button.js";
|
|
55
|
+
import { CopyButton, CopyButtonProps } from "./instruments/copy-button.js";
|
|
56
|
+
import { GroupBar, GroupBarItem, GroupBarProps, GroupBarTone } from "./instruments/group-bar.js";
|
|
57
|
+
import { Meter, MeterProps, MeterProvenance, MeterTone } from "./instruments/meter.js";
|
|
58
|
+
import { Progress, ProgressProps } from "./instruments/progress.js";
|
|
59
|
+
import { SeamCell, SeamCellProps, SeamGrid, SeamGridProps, SeamGround } from "./instruments/seam-grid.js";
|
|
60
|
+
import { Sparkline, SparklineProps } from "./instruments/sparkline.js";
|
|
61
|
+
import { Stat, StatProps, StatTone } from "./instruments/stat.js";
|
|
62
|
+
import { Table, TableCaptionProps, TableCellProps, TableHeadProps, TableRootProps, TableRowProps, TableSectionProps } from "./instruments/table.js";
|
|
63
|
+
import { TerminalFrame, TerminalFrameLine, TerminalFrameProps, TerminalLine, TerminalLineTone, TerminalScript, TerminalStep } from "./instruments/terminal-frame.js";
|
|
64
|
+
import { TwoStepButton, TwoStepButtonProps, TwoStepTone } from "./instruments/two-step-button.js";
|
|
65
|
+
import { UsageChart, UsageChartPoint, UsageChartProps, UsageChartTone } from "./instruments/usage-chart.js";
|
|
66
|
+
import "./instruments/index.js";
|
|
67
|
+
import { Accordion, AccordionHeaderProps, AccordionItemProps, AccordionPanelProps, AccordionRootProps, AccordionTriggerProps } from "./layout/accordion.js";
|
|
68
|
+
import { Breadcrumb, BreadcrumbItem, BreadcrumbProps } from "./layout/breadcrumb.js";
|
|
69
|
+
import { Card, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps } from "./layout/card.js";
|
|
70
|
+
import { Collapsible, CollapsiblePanelProps, CollapsibleRootProps, CollapsibleTriggerProps, Disclosure, DisclosureProps } from "./layout/collapsible.js";
|
|
71
|
+
import { Container, ContainerProps, ContainerWidth } from "./layout/container.js";
|
|
72
|
+
import { DescriptionList, DescriptionListDetailProps, DescriptionListLayout, DescriptionListRootProps, DescriptionListTermProps } from "./layout/description-list.js";
|
|
73
|
+
import { SpaceStep, Stack, StackAlign, StackJustify, StackProps } from "./layout/stack.js";
|
|
74
|
+
import { Grid, GridColumns, GridProps } from "./layout/grid.js";
|
|
75
|
+
import { Item, ItemProps, itemVariants } from "./layout/item.js";
|
|
76
|
+
import { Link, LinkProps, linkVariants } from "./layout/link.js";
|
|
77
|
+
import { Pagination, PaginationEntry, PaginationProps, paginationRange } from "./layout/pagination.js";
|
|
78
|
+
import { Sidebar, SidebarItemProps, SidebarRailProps, SidebarRootProps, SidebarSectionProps, useSidebar } from "./layout/sidebar.js";
|
|
79
|
+
import { Stepper, StepperProps, StepperState, StepperStep } from "./layout/stepper.js";
|
|
80
|
+
import { StatusDot, StatusDotProps, StatusTone } from "./primitives/status-dot.js";
|
|
81
|
+
import { Timeline, TimelineContentProps, TimelineItemProps, TimelineMarkerProps, TimelineRootProps } from "./layout/timeline.js";
|
|
82
|
+
import "./layout/index.js";
|
|
83
|
+
import { OVERLAY_SIDE_OFFSET, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, scrimClasses } from "./overlays/_surface.js";
|
|
84
|
+
import { AlertDialog, AlertDialogActionProps, AlertDialogCancelProps, AlertDialogContentProps, AlertDialogDescriptionProps, AlertDialogFooterProps, AlertDialogRootProps, AlertDialogTitleProps, AlertDialogTriggerProps } from "./overlays/alert-dialog.js";
|
|
85
|
+
import { CommandPalette, CommandPaletteItem, CommandPaletteProps } from "./overlays/command-palette.js";
|
|
86
|
+
import { DropdownMenu, DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownMenuGroupProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuRootProps, DropdownMenuSeparatorProps, DropdownMenuTriggerProps } from "./overlays/dropdown-menu.js";
|
|
87
|
+
import { ContextMenu, ContextMenuContentProps, ContextMenuRootProps, ContextMenuTriggerProps } from "./overlays/context-menu.js";
|
|
88
|
+
import { Dialog, DialogCloseProps, DialogContentProps, DialogDescriptionProps, DialogFooterProps, DialogRootProps, DialogTitleProps, DialogTriggerProps } from "./overlays/dialog.js";
|
|
89
|
+
import { Drawer, DrawerCloseProps, DrawerContentProps, DrawerDescriptionProps, DrawerFooterProps, DrawerRootProps, DrawerSwipeDirection, DrawerTitleProps, DrawerTriggerProps } from "./overlays/drawer.js";
|
|
90
|
+
import { HoverCard, HoverCardContentProps, HoverCardRootProps, HoverCardTriggerProps } from "./overlays/hover-card.js";
|
|
91
|
+
import { Tooltip, TooltipContentProps, TooltipProviderProps, TooltipRootProps, TooltipTriggerProps } from "./overlays/tooltip.js";
|
|
92
|
+
import { InfoTip, InfoTipProps } from "./overlays/info-tip.js";
|
|
93
|
+
import { Menubar, MenubarContentProps, MenubarMenuProps, MenubarRootProps, MenubarTriggerProps } from "./overlays/menubar.js";
|
|
94
|
+
import { Popover, PopoverCloseProps, PopoverContentProps, PopoverDescriptionProps, PopoverRootProps, PopoverTitleProps, PopoverTriggerProps } from "./overlays/popover.js";
|
|
95
|
+
import { Sheet, SheetCloseProps, SheetContentProps, SheetDescriptionProps, SheetFooterProps, SheetRootProps, SheetTitleProps, SheetTriggerProps } from "./overlays/sheet.js";
|
|
96
|
+
import { Toast, ToastManager, ToastOptions, ToastProviderProps, ToastTone, ToastViewportProps, useToast } from "./overlays/toast.js";
|
|
97
|
+
import "./overlays/index.js";
|
|
98
|
+
import { Avatar, AvatarGroup, AvatarGroupProps, AvatarProps, AvatarSize } from "./primitives/avatar.js";
|
|
99
|
+
import { Chip, ChipProps, chipVariants } from "./primitives/chip.js";
|
|
100
|
+
import { IconButton, IconButtonProps } from "./primitives/icon-button.js";
|
|
101
|
+
import { Kbd, KbdProps } from "./primitives/kbd.js";
|
|
102
|
+
import { Separator, SeparatorProps } from "./primitives/separator.js";
|
|
103
|
+
import { Skeleton, SkeletonProps } from "./primitives/skeleton.js";
|
|
104
|
+
import { Spinner, SpinnerProps } from "./primitives/spinner.js";
|
|
105
|
+
import "./primitives/index.js";
|
|
106
|
+
import { Density, DensityProps } from "./system/density.js";
|
|
107
|
+
import { CuePortalFrame, CuePortalFrameProps, useCuePortalProps } from "./system/portal.js";
|
|
108
|
+
import { DEFAULT_STORAGE_KEY, PersistedPreferences, prepaintScript } from "./system/prepaint.js";
|
|
109
|
+
import { ControlSize, useControlHeight, useDensity } from "./system/use-density.js";
|
|
110
|
+
import { useTheme } from "./system/use-theme.js";
|
|
111
|
+
import { DensityLevel, Mode, ThemeName } from "./system/index.js";
|
|
112
|
+
export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, type AccordionHeaderProps, type AccordionItemProps, type AccordionPanelProps, type AccordionRootProps, type AccordionTriggerProps, type AgentColorOptions, AgentPile, type AgentPileEntry, type AgentPileProps, type AgentPileSize, AlertDialog, type AlertDialogActionProps, type AlertDialogCancelProps, type AlertDialogContentProps, type AlertDialogDescriptionProps, type AlertDialogFooterProps, type AlertDialogRootProps, type AlertDialogTitleProps, type AlertDialogTriggerProps, AppWindowFrame, type AppWindowFrameProps, type AskAnswer, AskBox, type AskBoxProps, type AskDanger, type AskKind, type AskOption, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, type AvatarSize, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupOrientation, type ButtonGroupProps, type ButtonProps, Card, type CardContentProps, type CardDescriptionProps, type CardFooterProps, type CardHeaderProps, type CardRootProps, type CardTitleProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Chip, type ChipProps, Collapsible, type CollapsiblePanelProps, type CollapsibleRootProps, type CollapsibleTriggerProps, Combobox, type ComboboxOption, type ComboboxProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, Composer, type ComposerProps, type ComposerSubmitKey, Container, type ContainerProps, type ContainerWidth, ContextMenu, type ContextMenuContentProps, type ContextMenuRootProps, type ContextMenuTriggerProps, type ControlSize, type ControlVariantProps, CopyButton, type CopyButtonProps, CuePortalFrame, type CuePortalFrameProps, DEFAULT_STORAGE_KEY, DelegationCard, type DelegationCardProps, type DelegationDirection, type DelegationStatus, Density, type DensityLevel, type DensityProps, DescriptionList, type DescriptionListDetailProps, type DescriptionListLayout, type DescriptionListRootProps, type DescriptionListTermProps, Dialog, type DialogCloseProps, type DialogContentProps, type DialogDescriptionProps, type DialogFooterProps, type DialogRootProps, type DialogTitleProps, type DialogTriggerProps, Disclosure, type DisclosureProps, Drawer, type DrawerCloseProps, type DrawerContentProps, type DrawerDescriptionProps, type DrawerFooterProps, type DrawerRootProps, type DrawerSwipeDirection, type DrawerTitleProps, type DrawerTriggerProps, DropdownMenu, type DropdownMenuCheckboxItemProps, type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuItemProps, type DropdownMenuLabelProps, type DropdownMenuRootProps, type DropdownMenuSeparatorProps, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, EnvVarInput, type EnvVarInputProps, Eyebrow, type EyebrowProps, Field, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorProps, type FieldIssue, FieldLabel, type FieldLabelProps, type FieldProps, type FilePartition, type FilePartitionOptions, type FileRejectReason, type FileRejection, FileUpload, type FileUploadProps, type FormControlSize, Grid, type GridColumns, type GridProps, GroupBar, type GroupBarItem, type GroupBarProps, type GroupBarTone, HoverCard, type HoverCardContentProps, type HoverCardRootProps, type HoverCardTriggerProps, IconButton, type IconButtonProps, InfoTip, type InfoTipProps, Input, InputGroup, type InputGroupProps, type InputProps, Item, type ItemProps, Kbd, type KbdProps, Link, type LinkProps, Menubar, type MenubarContentProps, type MenubarMenuProps, type MenubarRootProps, type MenubarTriggerProps, Message, MessageList, type MessageListProps, type MessageProps, type MessageRole, Meter, type MeterProps, type MeterProvenance, type MeterTone, type Mode, MultiSelect, type MultiSelectProps, NavigationMenu, type NavigationMenuContentProps, type NavigationMenuItemProps, type NavigationMenuLinkProps, type NavigationMenuListProps, type NavigationMenuRootProps, type NavigationMenuTriggerProps, type NavigationMenuViewportProps, NumberField, type NumberFieldProps, OTPField, type OTPFieldProps, OVERLAY_SIDE_OFFSET, PageShell, type PageShellProps, type PageWidth, Pagination, type PaginationEntry, type PaginationProps, Panel, PanelHeader, type PanelHeaderProps, type PanelProps, PasswordInput, type PasswordInputProps, type PersistedPreferences, Popover, type PopoverCloseProps, type PopoverContentProps, type PopoverDescriptionProps, type PopoverRootProps, type PopoverTitleProps, type PopoverTriggerProps, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, type RatingSize, type ResolvedMode, Row, type RowProps, ScrollArea, type ScrollAreaOrientation, type ScrollAreaProps, type ScrollEdges, ScrollableTabsList, type ScrollableTabsListProps, ScrubInput, type ScrubInputProps, SeamCell, type SeamCellProps, SeamGrid, type SeamGridProps, type SeamGround, SeamList, type SeamListProps, SearchInput, type SearchInputProps, SectionHeader, type SectionHeaderProps, SegmentedControl, type SegmentedControlItem, type SegmentedControlProps, type SegmentedControlSize, Select, type SelectOption, type SelectProps, Separator, type SeparatorProps, Sheet, type SheetCloseProps, type SheetContentProps, type SheetDescriptionProps, type SheetFooterProps, type SheetRootProps, type SheetTitleProps, type SheetTriggerProps, Sidebar, type SidebarItemProps, type SidebarRailProps, type SidebarRootProps, type SidebarSectionProps, Skeleton, type SkeletonProps, Slider, type SliderProps, type SpaceStep, Sparkline, type SparklineProps, Spinner, type SpinnerProps, Stack, type StackAlign, type StackJustify, type StackProps, Stat, type StatProps, type StatTone, StatusBar, type StatusBarItemProps, type StatusBarProps, type StatusBarTone, StatusDot, type StatusDotProps, type StatusTone, Stepper, type StepperProps, type StepperState, type StepperStep, Switch, type SwitchProps, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, type TableCaptionProps, type TableCellProps, type TableHeadProps, type TableRootProps, type TableRowProps, type TableSectionProps, Tabs, type TabsListProps, type TabsPanelProps, type TabsRootProps, type TabsTabProps, TagsInput, type TagsInputProps, TerminalFrame, type TerminalFrameLine, type TerminalFrameProps, type TerminalLine, type TerminalLineTone, type TerminalScript, type TerminalStep, Textarea, type TextareaProps, type ThemeContextValue, type ThemeName, ThemeProvider, type ThemeProviderProps, Timeline, type TimelineContentProps, type TimelineItemProps, type TimelineMarkerProps, type TimelineRootProps, TitleBar, type TitleBarProps, Toast, type ToastManager, type ToastOptions, type ToastProviderProps, type ToastTone, type ToastViewportProps, Toggle, ToggleGroup, type ToggleGroupProps, type ToggleProps, Toolbar, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarRootProps, type ToolbarSeparatorProps, Tooltip, type TooltipContentProps, type TooltipProviderProps, type TooltipRootProps, type TooltipTriggerProps, Tree, type TreeGuide, type TreeItem, type TreeProps, type TreeRow, type TreeVisibility, TreeVisibilityToggle, type TreeVisibilityToggleProps, TwoStepButton, type TwoStepButtonProps, type TwoStepTone, type UploadFile, type UploadStatus, UsageChart, type UsageChartPoint, type UsageChartProps, type UsageChartTone, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensity, useSidebar, useTheme, useToast };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, agentColor, agentColorStyle } from "./chat/agent-color.js";
|
|
2
|
+
import { AgentPile } from "./chat/agent-pile.js";
|
|
3
|
+
import { Checkbox, CheckboxGroup } from "./forms/checkbox.js";
|
|
4
|
+
import { bareControlClasses, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants } from "./forms/_chassis.js";
|
|
5
|
+
import { InputGroup } from "./forms/input-group.js";
|
|
6
|
+
import { Input } from "./forms/input.js";
|
|
7
|
+
import { NumberField } from "./forms/number-field.js";
|
|
8
|
+
import { Radio, RadioGroup } from "./forms/radio-group.js";
|
|
9
|
+
import { Button, buttonVariants } from "./primitives/button.js";
|
|
10
|
+
import { Chip, chipVariants } from "./primitives/chip.js";
|
|
11
|
+
import { AskBox } from "./chat/ask-box.js";
|
|
12
|
+
import { Composer } from "./chat/composer.js";
|
|
13
|
+
import { Spinner } from "./primitives/spinner.js";
|
|
14
|
+
import { DelegationCard } from "./chat/delegation-card.js";
|
|
15
|
+
import { Message } from "./chat/message.js";
|
|
16
|
+
import { MessageList } from "./chat/message-list.js";
|
|
17
|
+
import { TAB_FADE_PX, computeScrollEdges, edgeFadeMask } from "./chrome/_tabs-scroll.js";
|
|
18
|
+
import { TREE_GUIDE_GLYPHS, flattenTree } from "./chrome/_tree.js";
|
|
19
|
+
import { EmptyState } from "./chrome/empty-state.js";
|
|
20
|
+
import { Eyebrow } from "./chrome/eyebrow.js";
|
|
21
|
+
import { Density } from "./system/density.js";
|
|
22
|
+
import { DEFAULT_STORAGE_KEY, prepaintScript } from "./system/prepaint.js";
|
|
23
|
+
import { ThemeProvider } from "./system/theme-provider.js";
|
|
24
|
+
import { CuePortalFrame, useCuePortalProps } from "./system/portal.js";
|
|
25
|
+
import { OVERLAY_SIDE_OFFSET, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, scrimClasses } from "./overlays/_surface.js";
|
|
26
|
+
import { NavigationMenu } from "./chrome/navigation-menu.js";
|
|
27
|
+
import { PageShell } from "./chrome/page-shell.js";
|
|
28
|
+
import { Panel, PanelHeader } from "./chrome/panel.js";
|
|
29
|
+
import { Row, SeamList, rowVariants } from "./chrome/row.js";
|
|
30
|
+
import { ScrollArea } from "./chrome/scroll-area.js";
|
|
31
|
+
import { SectionHeader } from "./chrome/section-header.js";
|
|
32
|
+
import { SegmentedControl } from "./chrome/segmented-control.js";
|
|
33
|
+
import { StatusBar } from "./chrome/status-bar.js";
|
|
34
|
+
import { ScrollableTabsList, Tabs } from "./chrome/tabs.js";
|
|
35
|
+
import { TitleBar } from "./chrome/title-bar.js";
|
|
36
|
+
import { Tree, TreeVisibilityToggle } from "./chrome/tree.js";
|
|
37
|
+
import { Toolbar } from "./chrome/toolbar.js";
|
|
38
|
+
import { Autocomplete } from "./forms/autocomplete.js";
|
|
39
|
+
import { ButtonGroup } from "./forms/button-group.js";
|
|
40
|
+
import { Combobox } from "./forms/combobox.js";
|
|
41
|
+
import { PasswordInput } from "./forms/password-input.js";
|
|
42
|
+
import { EnvVarInput, envReference, parseEnvReference } from "./forms/env-var-input.js";
|
|
43
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "./forms/field.js";
|
|
44
|
+
import { FileUpload, partitionFiles } from "./forms/file-upload.js";
|
|
45
|
+
import { MultiSelect } from "./forms/multi-select.js";
|
|
46
|
+
import { OTPField } from "./forms/otp-field.js";
|
|
47
|
+
import { Rating } from "./forms/rating.js";
|
|
48
|
+
import { ScrubInput } from "./forms/scrub-input.js";
|
|
49
|
+
import { SearchInput } from "./forms/search-input.js";
|
|
50
|
+
import { Select } from "./forms/select.js";
|
|
51
|
+
import { Slider } from "./forms/slider.js";
|
|
52
|
+
import { Switch } from "./forms/switch.js";
|
|
53
|
+
import { TagsInput } from "./forms/tags-input.js";
|
|
54
|
+
import { Textarea } from "./forms/textarea.js";
|
|
55
|
+
import { ToggleGroup } from "./forms/toggle-group.js";
|
|
56
|
+
import { Toggle } from "./forms/toggle.js";
|
|
57
|
+
import { AppWindowFrame } from "./instruments/app-window-frame.js";
|
|
58
|
+
import { CopyButton } from "./instruments/copy-button.js";
|
|
59
|
+
import { GroupBar } from "./instruments/group-bar.js";
|
|
60
|
+
import { Meter } from "./instruments/meter.js";
|
|
61
|
+
import { Progress } from "./instruments/progress.js";
|
|
62
|
+
import { SeamCell, SeamGrid } from "./instruments/seam-grid.js";
|
|
63
|
+
import { Sparkline } from "./instruments/sparkline.js";
|
|
64
|
+
import { Stat } from "./instruments/stat.js";
|
|
65
|
+
import { Table } from "./instruments/table.js";
|
|
66
|
+
import { TerminalFrame } from "./instruments/terminal-frame.js";
|
|
67
|
+
import { TwoStepButton } from "./instruments/two-step-button.js";
|
|
68
|
+
import { UsageChart } from "./instruments/usage-chart.js";
|
|
69
|
+
import { Accordion } from "./layout/accordion.js";
|
|
70
|
+
import { Breadcrumb } from "./layout/breadcrumb.js";
|
|
71
|
+
import { Card } from "./layout/card.js";
|
|
72
|
+
import { Collapsible, Disclosure } from "./layout/collapsible.js";
|
|
73
|
+
import { Container } from "./layout/container.js";
|
|
74
|
+
import { DescriptionList } from "./layout/description-list.js";
|
|
75
|
+
import { Stack } from "./layout/stack.js";
|
|
76
|
+
import { Grid } from "./layout/grid.js";
|
|
77
|
+
import { Item, itemVariants } from "./layout/item.js";
|
|
78
|
+
import { Link, linkVariants } from "./layout/link.js";
|
|
79
|
+
import { IconButton } from "./primitives/icon-button.js";
|
|
80
|
+
import { Pagination, paginationRange } from "./layout/pagination.js";
|
|
81
|
+
import { Sidebar, useSidebar } from "./layout/sidebar.js";
|
|
82
|
+
import { Stepper } from "./layout/stepper.js";
|
|
83
|
+
import { StatusDot } from "./primitives/status-dot.js";
|
|
84
|
+
import { Timeline } from "./layout/timeline.js";
|
|
85
|
+
import { AlertDialog } from "./overlays/alert-dialog.js";
|
|
86
|
+
import { CommandPalette } from "./overlays/command-palette.js";
|
|
87
|
+
import { DropdownMenu } from "./overlays/dropdown-menu.js";
|
|
88
|
+
import { ContextMenu } from "./overlays/context-menu.js";
|
|
89
|
+
import { Dialog } from "./overlays/dialog.js";
|
|
90
|
+
import { Drawer } from "./overlays/drawer.js";
|
|
91
|
+
import { HoverCard } from "./overlays/hover-card.js";
|
|
92
|
+
import { Tooltip } from "./overlays/tooltip.js";
|
|
93
|
+
import { InfoTip } from "./overlays/info-tip.js";
|
|
94
|
+
import { Menubar } from "./overlays/menubar.js";
|
|
95
|
+
import { Popover } from "./overlays/popover.js";
|
|
96
|
+
import { Sheet } from "./overlays/sheet.js";
|
|
97
|
+
import { Toast, useToast } from "./overlays/toast.js";
|
|
98
|
+
import { Avatar, AvatarGroup } from "./primitives/avatar.js";
|
|
99
|
+
import { Kbd } from "./primitives/kbd.js";
|
|
100
|
+
import { Separator } from "./primitives/separator.js";
|
|
101
|
+
import { Skeleton } from "./primitives/skeleton.js";
|
|
102
|
+
import { useControlHeight, useDensity } from "./system/use-density.js";
|
|
103
|
+
import { useTheme } from "./system/use-theme.js";
|
|
104
|
+
export { AGENT_COLOR_PROPERTY, AGENT_HUES, AGENT_ROOT_COLOR, Accordion, AgentPile, AlertDialog, AppWindowFrame, AskBox, Autocomplete, Avatar, AvatarGroup, Breadcrumb, Button, ButtonGroup, Card, Checkbox, CheckboxGroup, Chip, Collapsible, Combobox, CommandPalette, Composer, Container, ContextMenu, CopyButton, CuePortalFrame, DEFAULT_STORAGE_KEY, DelegationCard, Density, DescriptionList, Dialog, Disclosure, Drawer, DropdownMenu, EmptyState, EnvVarInput, Eyebrow, Field, FieldDescription, FieldError, FieldLabel, FileUpload, Grid, GroupBar, HoverCard, IconButton, InfoTip, Input, InputGroup, Item, Kbd, Link, Menubar, Message, MessageList, Meter, MultiSelect, NavigationMenu, NumberField, OTPField, OVERLAY_SIDE_OFFSET, PageShell, Pagination, Panel, PanelHeader, PasswordInput, Popover, Progress, Radio, RadioGroup, Rating, Row, ScrollArea, ScrollableTabsList, ScrubInput, SeamCell, SeamGrid, SeamList, SearchInput, SectionHeader, SegmentedControl, Select, Separator, Sheet, Sidebar, Skeleton, Slider, Sparkline, Spinner, Stack, Stat, StatusBar, StatusDot, Stepper, Switch, TAB_FADE_PX, TREE_GUIDE_GLYPHS, Table, Tabs, TagsInput, TerminalFrame, Textarea, ThemeProvider, Timeline, TitleBar, Toast, Toggle, ToggleGroup, Toolbar, Tooltip, Tree, TreeVisibilityToggle, TwoStepButton, UsageChart, agentColor, agentColorStyle, bareControlClasses, buttonVariants, chipVariants, computeScrollEdges, controlClasses, controlGroupFocusClasses, controlSurface, controlVariants, edgeFadeMask, envReference, flattenTree, itemVariants, linkVariants, menuItemClasses, menuLabelClasses, menuPopupClasses, menuSeparatorClasses, overlayDescriptionClasses, overlayFooterClasses, overlayModalTransitionClasses, overlayPopupTransitionClasses, overlayPositionerClasses, overlaySurfaceClasses, overlayTextClasses, overlayTitleClasses, paginationRange, parseEnvReference, partitionFiles, prepaintScript, rowVariants, scrimClasses, useControlHeight, useCuePortalProps, useDensity, useSidebar, useTheme, useToast };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import Anser from "anser";
|
|
2
|
+
//#region src/instruments/_ansi.ts
|
|
3
|
+
/**
|
|
4
|
+
* The eight ANSI hues on the system's tokens.
|
|
5
|
+
*
|
|
6
|
+
* `blue` and `cyan` share `info`, and `magenta` borrows `accent`: the palette
|
|
7
|
+
* has one cool status colour and no sixth hue, and inventing two more would put
|
|
8
|
+
* colours on screen that no theme controls. Bright variants resolve to the same
|
|
9
|
+
* token — brightness in a terminal is an intensity, and intensity here is the
|
|
10
|
+
* `bold` flag.
|
|
11
|
+
*/
|
|
12
|
+
const NAMED_COLORS = {
|
|
13
|
+
black: "var(--cue-fg-subtle)",
|
|
14
|
+
red: "var(--cue-danger)",
|
|
15
|
+
green: "var(--cue-ok)",
|
|
16
|
+
yellow: "var(--cue-warn)",
|
|
17
|
+
blue: "var(--cue-info)",
|
|
18
|
+
magenta: "var(--cue-accent)",
|
|
19
|
+
cyan: "var(--cue-info)",
|
|
20
|
+
white: "var(--cue-fg)",
|
|
21
|
+
"bright-black": "var(--cue-fg-muted)",
|
|
22
|
+
"bright-red": "var(--cue-danger)",
|
|
23
|
+
"bright-green": "var(--cue-ok)",
|
|
24
|
+
"bright-yellow": "var(--cue-warn)",
|
|
25
|
+
"bright-blue": "var(--cue-info)",
|
|
26
|
+
"bright-magenta": "var(--cue-accent)",
|
|
27
|
+
"bright-cyan": "var(--cue-info)",
|
|
28
|
+
"bright-white": "var(--cue-fg)"
|
|
29
|
+
};
|
|
30
|
+
/** The 256-colour palette's first sixteen slots, in index order. */
|
|
31
|
+
const PALETTE_NAMES = [
|
|
32
|
+
"black",
|
|
33
|
+
"red",
|
|
34
|
+
"green",
|
|
35
|
+
"yellow",
|
|
36
|
+
"blue",
|
|
37
|
+
"magenta",
|
|
38
|
+
"cyan",
|
|
39
|
+
"white",
|
|
40
|
+
"bright-black",
|
|
41
|
+
"bright-red",
|
|
42
|
+
"bright-green",
|
|
43
|
+
"bright-yellow",
|
|
44
|
+
"bright-blue",
|
|
45
|
+
"bright-magenta",
|
|
46
|
+
"bright-cyan",
|
|
47
|
+
"bright-white"
|
|
48
|
+
];
|
|
49
|
+
/** The six levels each channel of the 6×6×6 cube can take. */
|
|
50
|
+
const CUBE_LEVELS = [
|
|
51
|
+
0,
|
|
52
|
+
95,
|
|
53
|
+
135,
|
|
54
|
+
175,
|
|
55
|
+
215,
|
|
56
|
+
255
|
|
57
|
+
];
|
|
58
|
+
/** Resolve one of anser's class names into a CSS colour. */
|
|
59
|
+
function resolveColor(name, truecolor) {
|
|
60
|
+
if (name === null) return void 0;
|
|
61
|
+
if (name === "ansi-truecolor") return truecolor === null ? void 0 : `rgb(${truecolor})`;
|
|
62
|
+
const palette = /^ansi-palette-(\d+)$/.exec(name);
|
|
63
|
+
if (palette !== null) {
|
|
64
|
+
const index = Number(palette[1]);
|
|
65
|
+
if (index < 16) return NAMED_COLORS[PALETTE_NAMES[index]];
|
|
66
|
+
if (index > 255) return void 0;
|
|
67
|
+
if (index >= 232) {
|
|
68
|
+
const level = 8 + (index - 232) * 10;
|
|
69
|
+
return `rgb(${level}, ${level}, ${level})`;
|
|
70
|
+
}
|
|
71
|
+
const offset = index - 16;
|
|
72
|
+
return `rgb(${CUBE_LEVELS[Math.floor(offset / 36)]}, ${CUBE_LEVELS[Math.floor(offset / 6) % 6]}, ${CUBE_LEVELS[offset % 6]})`;
|
|
73
|
+
}
|
|
74
|
+
return NAMED_COLORS[name.replace(/^ansi-/, "")];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse one line of terminal output into styled spans.
|
|
78
|
+
*
|
|
79
|
+
* Always returns at least one span — an empty line still needs a row of the
|
|
80
|
+
* right height — and never returns markup.
|
|
81
|
+
*
|
|
82
|
+
* @param text - One line, escape sequences and all.
|
|
83
|
+
* @returns The runs, in order.
|
|
84
|
+
* @example
|
|
85
|
+
* ansiSpans("[31mfailed").map((span) => span.color); // ["var(--cue-danger)"]
|
|
86
|
+
*/
|
|
87
|
+
function ansiSpans(text) {
|
|
88
|
+
const spans = Anser.ansiToJson(text, {
|
|
89
|
+
use_classes: true,
|
|
90
|
+
remove_empty: true
|
|
91
|
+
}).map((entry) => {
|
|
92
|
+
const decorations = new Set(entry.decorations);
|
|
93
|
+
return {
|
|
94
|
+
text: entry.content,
|
|
95
|
+
color: resolveColor(entry.fg, entry.fg_truecolor),
|
|
96
|
+
background: resolveColor(entry.bg, entry.bg_truecolor),
|
|
97
|
+
bold: decorations.has("bold"),
|
|
98
|
+
dim: decorations.has("dim"),
|
|
99
|
+
italic: decorations.has("italic"),
|
|
100
|
+
underline: decorations.has("underline"),
|
|
101
|
+
strikethrough: decorations.has("strikethrough")
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
return spans.length > 0 ? spans : [{
|
|
105
|
+
text: "",
|
|
106
|
+
color: void 0,
|
|
107
|
+
background: void 0,
|
|
108
|
+
bold: false,
|
|
109
|
+
dim: false,
|
|
110
|
+
italic: false,
|
|
111
|
+
underline: false,
|
|
112
|
+
strikethrough: false
|
|
113
|
+
}];
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { ansiSpans };
|