@visulima/tui 1.0.0-alpha.4 → 1.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE.md +140 -0
- package/dist/core/index.d.ts +58 -5
- package/dist/ink/index.d.ts +6592 -294
- package/dist/ink/index.js +1 -1
- package/dist/packem_shared/{Histogram-cgAjY5AJ.js → Histogram-CB6XcmZW.js} +1 -1
- package/dist/packem_shared/input.d-Bfq7oc06.d.ts +90 -0
- package/dist/packem_shared/render.d-CNIzVQTh.d.ts +1257 -0
- package/dist/react/index.d.ts +519 -8
- package/dist/testing/index.d.ts +274 -135
- package/package.json +15 -16
- package/dist/core/app.d.ts +0 -50
- package/dist/core/cell.d.ts +0 -33
- package/dist/core/inline.d.ts +0 -22
- package/dist/core/input.d.ts +0 -18
- package/dist/core/native-binding.d.ts +0 -22
- package/dist/ink/ansi-to-cell.d.ts +0 -5
- package/dist/ink/ansi-tokenizer.d.ts +0 -38
- package/dist/ink/canvas/braille.d.ts +0 -22
- package/dist/ink/canvas/buffer.d.ts +0 -67
- package/dist/ink/clipboard.d.ts +0 -29
- package/dist/ink/color-matrix.d.ts +0 -49
- package/dist/ink/color-utils.d.ts +0 -30
- package/dist/ink/colorize.d.ts +0 -4
- package/dist/ink/components/accessibility-context.d.ts +0 -4
- package/dist/ink/components/accordion.d.ts +0 -52
- package/dist/ink/components/alert.d.ts +0 -30
- package/dist/ink/components/animate-presence.d.ts +0 -15
- package/dist/ink/components/animation-context.d.ts +0 -10
- package/dist/ink/components/app-context.d.ts +0 -38
- package/dist/ink/components/app.d.ts +0 -19
- package/dist/ink/components/approval-prompt.d.ts +0 -55
- package/dist/ink/components/area-chart.d.ts +0 -54
- package/dist/ink/components/background-context.d.ts +0 -5
- package/dist/ink/components/badge.d.ts +0 -27
- package/dist/ink/components/bar-chart.d.ts +0 -57
- package/dist/ink/components/big-text.d.ts +0 -71
- package/dist/ink/components/blink-dot.d.ts +0 -30
- package/dist/ink/components/box.d.ts +0 -58
- package/dist/ink/components/breadcrumb.d.ts +0 -28
- package/dist/ink/components/button.d.ts +0 -38
- package/dist/ink/components/calendar.d.ts +0 -60
- package/dist/ink/components/canvas.d.ts +0 -38
- package/dist/ink/components/card.d.ts +0 -46
- package/dist/ink/components/chart-utils.d.ts +0 -54
- package/dist/ink/components/checkbox.d.ts +0 -39
- package/dist/ink/components/code.d.ts +0 -46
- package/dist/ink/components/collapsible.d.ts +0 -43
- package/dist/ink/components/command-block.d.ts +0 -38
- package/dist/ink/components/command-palette.d.ts +0 -72
- package/dist/ink/components/confirm-dialog.d.ts +0 -63
- package/dist/ink/components/confirm-input.d.ts +0 -40
- package/dist/ink/components/console-overlay.d.ts +0 -52
- package/dist/ink/components/content-switcher.d.ts +0 -49
- package/dist/ink/components/cursor-context.d.ts +0 -12
- package/dist/ink/components/cursor.d.ts +0 -43
- package/dist/ink/components/date-picker.d.ts +0 -53
- package/dist/ink/components/definition-list.d.ts +0 -37
- package/dist/ink/components/dialog.d.ts +0 -93
- package/dist/ink/components/diff-view.d.ts +0 -71
- package/dist/ink/components/divider.d.ts +0 -40
- package/dist/ink/components/error-boundary.d.ts +0 -17
- package/dist/ink/components/error-overview.d.ts +0 -6
- package/dist/ink/components/file-picker/file-picker.d.ts +0 -58
- package/dist/ink/components/file-picker/types.d.ts +0 -35
- package/dist/ink/components/file-picker/use-file-system.d.ts +0 -16
- package/dist/ink/components/focus-context.d.ts +0 -17
- package/dist/ink/components/form.d.ts +0 -74
- package/dist/ink/components/gauge.d.ts +0 -75
- package/dist/ink/components/gradient.d.ts +0 -38
- package/dist/ink/components/heading.d.ts +0 -27
- package/dist/ink/components/heatmap.d.ts +0 -51
- package/dist/ink/components/help.d.ts +0 -44
- package/dist/ink/components/histogram.d.ts +0 -52
- package/dist/ink/components/kbd.d.ts +0 -27
- package/dist/ink/components/line-chart.d.ts +0 -94
- package/dist/ink/components/link.d.ts +0 -34
- package/dist/ink/components/loading-indicator.d.ts +0 -24
- package/dist/ink/components/markdown.d.ts +0 -34
- package/dist/ink/components/masked-input.d.ts +0 -41
- package/dist/ink/components/menu.d.ts +0 -70
- package/dist/ink/components/message-bubble.d.ts +0 -35
- package/dist/ink/components/model-badge.d.ts +0 -32
- package/dist/ink/components/multi-select.d.ts +0 -63
- package/dist/ink/components/newline.d.ts +0 -12
- package/dist/ink/components/operation-tree.d.ts +0 -46
- package/dist/ink/components/option-list.d.ts +0 -41
- package/dist/ink/components/ordered-list.d.ts +0 -30
- package/dist/ink/components/paginator.d.ts +0 -59
- package/dist/ink/components/paragraph.d.ts +0 -31
- package/dist/ink/components/placeholder.d.ts +0 -47
- package/dist/ink/components/progress-bar.d.ts +0 -51
- package/dist/ink/components/radio-group.d.ts +0 -62
- package/dist/ink/components/scatter-plot.d.ts +0 -23
- package/dist/ink/components/scroll/controlled-scroll-view.d.ts +0 -43
- package/dist/ink/components/scroll/index.d.ts +0 -10
- package/dist/ink/components/scroll/scroll-bar-box.d.ts +0 -15
- package/dist/ink/components/scroll/scroll-bar.d.ts +0 -20
- package/dist/ink/components/scroll/scroll-list.d.ts +0 -12
- package/dist/ink/components/scroll/scroll-view.d.ts +0 -98
- package/dist/ink/components/scroll/use-state-ref.d.ts +0 -8
- package/dist/ink/components/search-input.d.ts +0 -46
- package/dist/ink/components/select-input-indicator.d.ts +0 -36
- package/dist/ink/components/select-input-item.d.ts +0 -43
- package/dist/ink/components/select-input.d.ts +0 -96
- package/dist/ink/components/shimmer-text.d.ts +0 -39
- package/dist/ink/components/slider.d.ts +0 -92
- package/dist/ink/components/spacer.d.ts +0 -7
- package/dist/ink/components/sparkline.d.ts +0 -30
- package/dist/ink/components/spinner.d.ts +0 -40
- package/dist/ink/components/static-render.d.ts +0 -40
- package/dist/ink/components/static.d.ts +0 -24
- package/dist/ink/components/status-line.d.ts +0 -30
- package/dist/ink/components/status-message.d.ts +0 -26
- package/dist/ink/components/stderr-context.d.ts +0 -16
- package/dist/ink/components/stdin-context.d.ts +0 -29
- package/dist/ink/components/stdout-context.d.ts +0 -16
- package/dist/ink/components/stepper.d.ts +0 -42
- package/dist/ink/components/stopwatch.d.ts +0 -42
- package/dist/ink/components/streaming-text.d.ts +0 -38
- package/dist/ink/components/switch.d.ts +0 -46
- package/dist/ink/components/tab.d.ts +0 -25
- package/dist/ink/components/table.d.ts +0 -80
- package/dist/ink/components/tabs.d.ts +0 -104
- package/dist/ink/components/tag.d.ts +0 -30
- package/dist/ink/components/text-input.d.ts +0 -48
- package/dist/ink/components/text.d.ts +0 -63
- package/dist/ink/components/textarea.d.ts +0 -62
- package/dist/ink/components/timer.d.ts +0 -50
- package/dist/ink/components/toast.d.ts +0 -41
- package/dist/ink/components/tooltip.d.ts +0 -36
- package/dist/ink/components/transform.d.ts +0 -16
- package/dist/ink/components/transition.d.ts +0 -53
- package/dist/ink/components/tree-view/theme.d.ts +0 -24
- package/dist/ink/components/tree-view/tree-node-map.d.ts +0 -72
- package/dist/ink/components/tree-view/tree-view-node.d.ts +0 -29
- package/dist/ink/components/tree-view/tree-view.d.ts +0 -89
- package/dist/ink/components/tree-view/types.d.ts +0 -55
- package/dist/ink/components/tree-view/use-tree-view-state.d.ts +0 -135
- package/dist/ink/components/tree-view/use-tree-view.d.ts +0 -26
- package/dist/ink/components/unordered-list.d.ts +0 -35
- package/dist/ink/components/variant-config.d.ts +0 -10
- package/dist/ink/cursor-helpers.d.ts +0 -35
- package/dist/ink/data-limited-lru-map.d.ts +0 -21
- package/dist/ink/devtools-window-polyfill.d.ts +0 -1
- package/dist/ink/devtools.d.ts +0 -1
- package/dist/ink/dom.d.ts +0 -214
- package/dist/ink/get-max-width.d.ts +0 -3
- package/dist/ink/highlighter.d.ts +0 -28
- package/dist/ink/hooks/use-animation.d.ts +0 -41
- package/dist/ink/hooks/use-app.d.ts +0 -6
- package/dist/ink/hooks/use-box-metrics.d.ts +0 -58
- package/dist/ink/hooks/use-clipboard.d.ts +0 -29
- package/dist/ink/hooks/use-color-blindness.d.ts +0 -33
- package/dist/ink/hooks/use-console-capture.d.ts +0 -43
- package/dist/ink/hooks/use-cursor.d.ts +0 -12
- package/dist/ink/hooks/use-focus-manager.d.ts +0 -42
- package/dist/ink/hooks/use-focus.d.ts +0 -30
- package/dist/ink/hooks/use-form.d.ts +0 -70
- package/dist/ink/hooks/use-hotkey.d.ts +0 -37
- package/dist/ink/hooks/use-input.d.ts +0 -149
- package/dist/ink/hooks/use-interval.d.ts +0 -25
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +0 -6
- package/dist/ink/hooks/use-key-bindings.d.ts +0 -59
- package/dist/ink/hooks/use-key-chord.d.ts +0 -26
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -41
- package/dist/ink/hooks/use-paste.d.ts +0 -44
- package/dist/ink/hooks/use-persistent-state.d.ts +0 -56
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +0 -47
- package/dist/ink/hooks/use-scroll-input.d.ts +0 -34
- package/dist/ink/hooks/use-stderr.d.ts +0 -6
- package/dist/ink/hooks/use-stdin.d.ts +0 -7
- package/dist/ink/hooks/use-stdout.d.ts +0 -6
- package/dist/ink/hooks/use-stopwatch.d.ts +0 -38
- package/dist/ink/hooks/use-terminal-palette.d.ts +0 -19
- package/dist/ink/hooks/use-text-buffer.d.ts +0 -42
- package/dist/ink/hooks/use-text-selection.d.ts +0 -45
- package/dist/ink/hooks/use-timeout.d.ts +0 -24
- package/dist/ink/hooks/use-timer.d.ts +0 -47
- package/dist/ink/hooks/use-window-size.d.ts +0 -18
- package/dist/ink/ime-utils.d.ts +0 -25
- package/dist/ink/ink.d.ts +0 -190
- package/dist/ink/input-parser.d.ts +0 -10
- package/dist/ink/input-utils.d.ts +0 -16
- package/dist/ink/instances.d.ts +0 -3
- package/dist/ink/kitty-keyboard.d.ts +0 -23
- package/dist/ink/layout.d.ts +0 -26
- package/dist/ink/log-update-native.d.ts +0 -14
- package/dist/ink/log-update.d.ts +0 -21
- package/dist/ink/measure-element.d.ts +0 -147
- package/dist/ink/measure-text.d.ts +0 -56
- package/dist/ink/mouse/ansi-parser.d.ts +0 -37
- package/dist/ink/mouse/constants.d.ts +0 -14
- package/dist/ink/mouse/fullscreen.d.ts +0 -8
- package/dist/ink/mouse/index.d.ts +0 -20
- package/dist/ink/mouse/is-intersecting.d.ts +0 -18
- package/dist/ink/mouse/mouse-context.d.ts +0 -36
- package/dist/ink/mouse/mouse-provider.d.ts +0 -11
- package/dist/ink/mouse/use-element-position.d.ts +0 -29
- package/dist/ink/mouse/use-mouse-action.d.ts +0 -7
- package/dist/ink/mouse/use-mouse-position.d.ts +0 -7
- package/dist/ink/mouse/use-mouse.d.ts +0 -7
- package/dist/ink/mouse/use-on-mouse-click.d.ts +0 -14
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +0 -8
- package/dist/ink/mouse/use-on-mouse-state.d.ts +0 -11
- package/dist/ink/output.d.ts +0 -75
- package/dist/ink/parse-keypress.d.ts +0 -22
- package/dist/ink/reconciler.d.ts +0 -3
- package/dist/ink/region.d.ts +0 -99
- package/dist/ink/render-background.d.ts +0 -4
- package/dist/ink/render-border.d.ts +0 -4
- package/dist/ink/render-node-to-output.d.ts +0 -38
- package/dist/ink/render-scrollbar.d.ts +0 -9
- package/dist/ink/render-sticky.d.ts +0 -44
- package/dist/ink/render-to-string.d.ts +0 -37
- package/dist/ink/render.d.ts +0 -191
- package/dist/ink/renderer.d.ts +0 -17
- package/dist/ink/resize-observer.d.ts +0 -44
- package/dist/ink/sanitize-ansi.d.ts +0 -2
- package/dist/ink/scroll.d.ts +0 -23
- package/dist/ink/selection.d.ts +0 -70
- package/dist/ink/squash-text-nodes.d.ts +0 -18
- package/dist/ink/style-flags.d.ts +0 -17
- package/dist/ink/styled-line-factory.d.ts +0 -25
- package/dist/ink/styled-line-serializer.d.ts +0 -18
- package/dist/ink/styled-line.d.ts +0 -119
- package/dist/ink/styles.d.ts +0 -369
- package/dist/ink/terminal-palette.d.ts +0 -25
- package/dist/ink/text-wrap.d.ts +0 -10
- package/dist/ink/token-to-elements.d.ts +0 -22
- package/dist/ink/utils/format-time.d.ts +0 -4
- package/dist/ink/utils.d.ts +0 -9
- package/dist/ink/wrap-text.d.ts +0 -3
- package/dist/ink/write-synchronized.d.ts +0 -4
- package/dist/react/devtools.d.ts +0 -27
- package/dist/react/focus.d.ts +0 -39
- package/dist/react/hooks.d.ts +0 -238
- package/dist/react/layout.d.ts +0 -33
- package/dist/react/react.d.ts +0 -57
- package/dist/react/reconciler.d.ts +0 -4
- package/dist/react/render-to-string.d.ts +0 -21
- package/dist/react/renderer.d.ts +0 -2
- package/dist/react/scene.d.ts +0 -3
- package/dist/react/static.d.ts +0 -39
- package/dist/react/styles.d.ts +0 -83
- package/dist/react/text-width.d.ts +0 -20
- package/dist/testing/keys.d.ts +0 -89
- package/dist/testing/screen.d.ts +0 -35
- package/dist/testing/wait-for.d.ts +0 -20
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Confirm input component for Ink.
|
|
3
|
-
*
|
|
4
|
-
* Inspired by ink-ui ConfirmInput by Vadim Demedes.
|
|
5
|
-
* @see https://github.com/vadimdemedes/ink-ui
|
|
6
|
-
*
|
|
7
|
-
* MIT License
|
|
8
|
-
* Copyright (c) Vadym Demedes (github.com/vadimdemedes)
|
|
9
|
-
*/
|
|
10
|
-
import type { ReactElement } from "react";
|
|
11
|
-
export type Props = {
|
|
12
|
-
/**
|
|
13
|
-
* The default action when pressing Enter without typing Y or N.
|
|
14
|
-
* @default "confirm"
|
|
15
|
-
*/
|
|
16
|
-
readonly defaultChoice?: "cancel" | "confirm";
|
|
17
|
-
/**
|
|
18
|
-
* Whether the input is disabled.
|
|
19
|
-
* @default false
|
|
20
|
-
*/
|
|
21
|
-
readonly isDisabled?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Called when the user cancels (presses N).
|
|
24
|
-
*/
|
|
25
|
-
readonly onCancel: () => void;
|
|
26
|
-
/**
|
|
27
|
-
* Called when the user confirms (presses Y).
|
|
28
|
-
*/
|
|
29
|
-
readonly onConfirm: () => void;
|
|
30
|
-
/**
|
|
31
|
-
* Whether pressing Enter submits the default choice.
|
|
32
|
-
* @default true
|
|
33
|
-
*/
|
|
34
|
-
readonly submitOnEnter?: boolean;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Renders a Y/N confirmation prompt. Shows "Y/n" when default is confirm,
|
|
38
|
-
* or "y/N" when default is cancel.
|
|
39
|
-
*/
|
|
40
|
-
export default function ConfirmInput({ defaultChoice, isDisabled, onCancel, onConfirm, submitOnEnter }: Props): ReactElement;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Console overlay component for Ink.
|
|
3
|
-
*
|
|
4
|
-
* Captures console.log/warn/error/debug output and displays it
|
|
5
|
-
* in a dockable panel within the TUI, similar to browser devtools.
|
|
6
|
-
*/
|
|
7
|
-
import type { ReactElement } from "react";
|
|
8
|
-
import type { ConsoleLevel } from "../hooks/use-console-capture.d.ts";
|
|
9
|
-
export type ConsoleOverlayDock = "bottom" | "top";
|
|
10
|
-
export type Props = {
|
|
11
|
-
/**
|
|
12
|
-
* Dock position within the parent container.
|
|
13
|
-
* @default "bottom"
|
|
14
|
-
*/
|
|
15
|
-
readonly dock?: ConsoleOverlayDock;
|
|
16
|
-
/**
|
|
17
|
-
* Which console levels to capture.
|
|
18
|
-
* @default ["log", "info", "warn", "error", "debug"]
|
|
19
|
-
*/
|
|
20
|
-
readonly filter?: ReadonlyArray<ConsoleLevel>;
|
|
21
|
-
/**
|
|
22
|
-
* Visible height in rows.
|
|
23
|
-
* @default 8
|
|
24
|
-
*/
|
|
25
|
-
readonly height?: number;
|
|
26
|
-
/**
|
|
27
|
-
* Maximum entries to keep in the buffer.
|
|
28
|
-
* @default 200
|
|
29
|
-
*/
|
|
30
|
-
readonly maxEntries?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Show the log level label.
|
|
33
|
-
* @default true
|
|
34
|
-
*/
|
|
35
|
-
readonly showLevel?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Show timestamps on each entry.
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
readonly showTimestamp?: boolean;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* A dockable console overlay that captures and displays console output.
|
|
44
|
-
*
|
|
45
|
-
* ```tsx
|
|
46
|
-
* <Box flexDirection="column" height="100%">
|
|
47
|
-
* <Box flexGrow={1}>{mainContent}</Box>
|
|
48
|
-
* <ConsoleOverlay dock="bottom" height={6} />
|
|
49
|
-
* </Box>
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export default function ConsoleOverlay({ dock, filter, height, maxEntries, showLevel, showTimestamp }: Props): ReactElement;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
2
|
-
import type { ReactElement, ReactNode } from "react";
|
|
3
|
-
import type { LiteralUnion } from "type-fest";
|
|
4
|
-
export type ContentSwitcherOption = {
|
|
5
|
-
readonly content: ReactNode;
|
|
6
|
-
readonly icon?: ReactNode;
|
|
7
|
-
readonly id: string;
|
|
8
|
-
readonly label: string;
|
|
9
|
-
};
|
|
10
|
-
export type Props = {
|
|
11
|
-
/**
|
|
12
|
-
* Accent color for the selected segment.
|
|
13
|
-
* @default "blue"
|
|
14
|
-
*/
|
|
15
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
16
|
-
/**
|
|
17
|
-
* Auto-focus the switcher on mount.
|
|
18
|
-
*/
|
|
19
|
-
readonly autoFocus?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Initial selected id (uncontrolled).
|
|
22
|
-
*/
|
|
23
|
-
readonly defaultValue?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Disable input.
|
|
26
|
-
*/
|
|
27
|
-
readonly isDisabled?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Called when the selection changes.
|
|
30
|
-
*/
|
|
31
|
-
readonly onChange?: (id: string) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Segments to toggle between.
|
|
34
|
-
*/
|
|
35
|
-
readonly options: ReadonlyArray<ContentSwitcherOption>;
|
|
36
|
-
/**
|
|
37
|
-
* Controlled selected id.
|
|
38
|
-
*/
|
|
39
|
-
readonly value?: string;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Segmented control that flips between mutually exclusive content. More
|
|
43
|
-
* compact than `Tabs`: the selected segment is highlighted as a pill, and
|
|
44
|
-
* only the active segment's content is rendered.
|
|
45
|
-
* @param props See {@link Props}.
|
|
46
|
-
* @returns A `ReactElement` with a segmented header row and the active
|
|
47
|
-
* panel's content beneath it.
|
|
48
|
-
*/
|
|
49
|
-
export default function ContentSwitcher({ accentColor, autoFocus, defaultValue, isDisabled, onChange, options, value, }: Props): ReactElement;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Context } from "react";
|
|
2
|
-
import type { CursorPosition } from "../log-update.d.ts";
|
|
3
|
-
export type Props = {
|
|
4
|
-
/**
|
|
5
|
-
* Set the cursor position relative to the Ink output.
|
|
6
|
-
*
|
|
7
|
-
* Pass `undefined` to hide the cursor.
|
|
8
|
-
*/
|
|
9
|
-
readonly setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
10
|
-
};
|
|
11
|
-
declare const CursorContext: Context<Props>;
|
|
12
|
-
export default CursorContext;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { RefObject } from "react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import type { DOMElement } from "../dom.d.ts";
|
|
4
|
-
export type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Optional reference to anchor cursor coordinates to a different element.
|
|
7
|
-
* If omitted, `<Cursor>` uses the parent container as anchor.
|
|
8
|
-
* If `anchorRef` is set but currently unresolved, Ink hides the cursor for that frame.
|
|
9
|
-
* If multiple `<Cursor>` components are rendered in one frame, the last rendered one controls the terminal cursor position.
|
|
10
|
-
*/
|
|
11
|
-
readonly anchorRef?: RefObject<DOMElement | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Horizontal offset from anchor content origin.
|
|
14
|
-
*/
|
|
15
|
-
readonly x?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Vertical offset from anchor content origin.
|
|
18
|
-
*/
|
|
19
|
-
readonly y?: number;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Declaratively position the terminal cursor.
|
|
23
|
-
* `<Cursor>` must not be rendered inside `<Text>`.
|
|
24
|
-
*
|
|
25
|
-
* **Inline mode** (no props): place `<Cursor />` after a `<Text>` node and the
|
|
26
|
-
* cursor appears where that text ended — even when text wraps across lines.
|
|
27
|
-
*
|
|
28
|
-
* **Anchor mode**: pass `anchorRef` and/or `x`/`y` to position relative to
|
|
29
|
-
* another element's content origin.
|
|
30
|
-
* @example Inline mode — cursor follows text naturally
|
|
31
|
-
* ```jsx
|
|
32
|
-
* <Box>
|
|
33
|
-
* <Text>{prompt + value}</Text>
|
|
34
|
-
* <Cursor />
|
|
35
|
-
* </Box>
|
|
36
|
-
* ```
|
|
37
|
-
* @example Anchor mode — offset from a referenced element
|
|
38
|
-
* ```jsx
|
|
39
|
-
* <Box ref={ref} />
|
|
40
|
-
* <Cursor anchorRef={ref} x={5} />
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export default function Cursor({ anchorRef, x, y }: Props): React.JSX.Element;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
2
|
-
import type { ReactElement } from "react";
|
|
3
|
-
import type { LiteralUnion } from "type-fest";
|
|
4
|
-
export type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Accent color used by the inner calendar when open.
|
|
7
|
-
* @default "blue"
|
|
8
|
-
*/
|
|
9
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
-
/**
|
|
11
|
-
* Auto-focus the picker on mount.
|
|
12
|
-
*/
|
|
13
|
-
readonly autoFocus?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Initial selected date when uncontrolled.
|
|
16
|
-
*/
|
|
17
|
-
readonly defaultValue?: Date;
|
|
18
|
-
/**
|
|
19
|
-
* Override the way the selected date is rendered in the input row.
|
|
20
|
-
*/
|
|
21
|
-
readonly formatValue?: (date: Date) => string;
|
|
22
|
-
/**
|
|
23
|
-
* Disable the picker.
|
|
24
|
-
*/
|
|
25
|
-
readonly isDisabled?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Upper bound for selectable dates.
|
|
28
|
-
*/
|
|
29
|
-
readonly maxDate?: Date;
|
|
30
|
-
/**
|
|
31
|
-
* Lower bound for selectable dates.
|
|
32
|
-
*/
|
|
33
|
-
readonly minDate?: Date;
|
|
34
|
-
/**
|
|
35
|
-
* Fired when the user commits a date with Enter.
|
|
36
|
-
*/
|
|
37
|
-
readonly onChange?: (date: Date) => void;
|
|
38
|
-
/**
|
|
39
|
-
* Placeholder rendered when no date is selected.
|
|
40
|
-
* @default "Pick a date"
|
|
41
|
-
*/
|
|
42
|
-
readonly placeholder?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Controlled selected date.
|
|
45
|
-
*/
|
|
46
|
-
readonly value?: Date;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Compact date input. Shows the currently-selected date; Enter / Space opens
|
|
50
|
-
* the inline `Calendar` for navigation. Enter inside the calendar commits the
|
|
51
|
-
* date and closes the picker.
|
|
52
|
-
*/
|
|
53
|
-
export default function DatePicker({ accentColor, autoFocus, defaultValue, formatValue, isDisabled, maxDate, minDate, onChange, placeholder, value, }: Props): ReactElement;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
2
|
-
import type { ReactElement, ReactNode } from "react";
|
|
3
|
-
import type { LiteralUnion } from "type-fest";
|
|
4
|
-
export type DefinitionItem = {
|
|
5
|
-
readonly description: ReactNode;
|
|
6
|
-
readonly key?: string;
|
|
7
|
-
readonly term: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
export type Props = {
|
|
10
|
-
/**
|
|
11
|
-
* Spacing between term and description columns.
|
|
12
|
-
* @default 2
|
|
13
|
-
*/
|
|
14
|
-
readonly columnGap?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Entries to render.
|
|
17
|
-
*/
|
|
18
|
-
readonly items: ReadonlyArray<DefinitionItem>;
|
|
19
|
-
/**
|
|
20
|
-
* Inline items display on the same row; stacked items display with the term above the description.
|
|
21
|
-
* @default "inline"
|
|
22
|
-
*/
|
|
23
|
-
readonly layout?: "inline" | "stacked";
|
|
24
|
-
/**
|
|
25
|
-
* Color applied to the term.
|
|
26
|
-
* @default "cyan"
|
|
27
|
-
*/
|
|
28
|
-
readonly termColor?: LiteralUnion<AnsiColors, string>;
|
|
29
|
-
/**
|
|
30
|
-
* Minimum width used to align inline terms.
|
|
31
|
-
*/
|
|
32
|
-
readonly termWidth?: number;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Key/value style definition list. Equivalent to the HTML `<dl>` element.
|
|
36
|
-
*/
|
|
37
|
-
export default function DefinitionList({ columnGap, items, layout, termColor, termWidth }: Props): ReactElement;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from "react";
|
|
2
|
-
import type { ScrollViewRef } from "./index.d.ts";
|
|
3
|
-
export type Props = {
|
|
4
|
-
/**
|
|
5
|
-
* Background color for the dialog. Defaults to the detected terminal
|
|
6
|
-
* background color, falling back to `"black"`.
|
|
7
|
-
*/
|
|
8
|
-
readonly backgroundColor?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Border color.
|
|
11
|
-
* @default "cyan"
|
|
12
|
-
*/
|
|
13
|
-
readonly borderColor?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Border style.
|
|
16
|
-
* @default "round"
|
|
17
|
-
*/
|
|
18
|
-
readonly borderStyle?: "arrow" | "bold" | "classic" | "double" | "doubleSingle" | "round" | "single" | "singleDouble";
|
|
19
|
-
/**
|
|
20
|
-
* Dialog content.
|
|
21
|
-
*/
|
|
22
|
-
readonly children: ReactNode;
|
|
23
|
-
/**
|
|
24
|
-
* Override terminal columns. Useful in renderToString or testing contexts
|
|
25
|
-
* where useWindowSize is unavailable.
|
|
26
|
-
*/
|
|
27
|
-
readonly columns?: number;
|
|
28
|
-
/**
|
|
29
|
-
* Footer content rendered below the scrollable area.
|
|
30
|
-
* Useful for hints like "Press ? to close".
|
|
31
|
-
*/
|
|
32
|
-
readonly footer?: ReactNode;
|
|
33
|
-
/**
|
|
34
|
-
* Maximum height as a fraction of terminal rows (0-1) or absolute rows.
|
|
35
|
-
* Values <= 1 are treated as fractions; values > 1 as absolute row counts.
|
|
36
|
-
* @default 0.8
|
|
37
|
-
*/
|
|
38
|
-
readonly maxHeight?: number;
|
|
39
|
-
/**
|
|
40
|
-
* Padding inside the dialog border.
|
|
41
|
-
* @default 2
|
|
42
|
-
*/
|
|
43
|
-
readonly paddingX?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Vertical padding inside the dialog border.
|
|
46
|
-
* @default 1
|
|
47
|
-
*/
|
|
48
|
-
readonly paddingY?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Override terminal rows. Useful in renderToString or testing contexts
|
|
51
|
-
* where useWindowSize is unavailable.
|
|
52
|
-
*/
|
|
53
|
-
readonly rows?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Scrollbar visual style.
|
|
56
|
-
* @default "block"
|
|
57
|
-
*/
|
|
58
|
-
readonly scrollbarStyle?: "arrow" | "block" | "bold" | "classic" | "dots" | "double" | "doubleSingle" | "line" | "round" | "single" | "singleDouble" | "thick";
|
|
59
|
-
/**
|
|
60
|
-
* Ref to the internal ScrollView for programmatic scrolling.
|
|
61
|
-
*/
|
|
62
|
-
readonly scrollRef?: React.Ref<ScrollViewRef>;
|
|
63
|
-
/**
|
|
64
|
-
* Title rendered at the top of the dialog. If a string is provided,
|
|
65
|
-
* it is rendered as bold cyan text.
|
|
66
|
-
*/
|
|
67
|
-
readonly title?: ReactNode;
|
|
68
|
-
/**
|
|
69
|
-
* Whether the dialog is visible. When `false`, nothing is rendered.
|
|
70
|
-
* @default true
|
|
71
|
-
*/
|
|
72
|
-
readonly visible?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Dialog width in columns.
|
|
75
|
-
* @default 60
|
|
76
|
-
*/
|
|
77
|
-
readonly width?: number;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* A centered overlay dialog with automatic scrolling and scrollbar when
|
|
81
|
-
* content exceeds the available terminal height.
|
|
82
|
-
*
|
|
83
|
-
* Uses the terminal's detected background color by default so the
|
|
84
|
-
* dialog blends with the user's theme.
|
|
85
|
-
*
|
|
86
|
-
* ```tsx
|
|
87
|
-
* <Dialog title="Help" footer={<Text dimColor>Press Esc to close</Text>}>
|
|
88
|
-
* <Text>Dialog content here</Text>
|
|
89
|
-
* </Dialog>
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare const Dialog: ({ backgroundColor: backgroundColorProp, borderColor, borderStyle, children, columns: columnsProp, footer, maxHeight: maxHeightProp, paddingX, paddingY, rows: rowsProp, scrollbarStyle: scrollbarStyleProp, scrollRef: externalScrollRef, title, visible, width, }: Props) => ReactElement | null;
|
|
93
|
-
export default Dialog;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react";
|
|
2
|
-
export type DiffViewMode = "split" | "unified";
|
|
3
|
-
export type InlineDiffMode = "chars" | "words";
|
|
4
|
-
export type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Number of unchanged context lines around changes.
|
|
7
|
-
* @default 3
|
|
8
|
-
*/
|
|
9
|
-
readonly context?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Pre-computed unified diff string. If provided, `oldText`/`newText` are ignored.
|
|
12
|
-
*/
|
|
13
|
-
readonly diff?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Enable character-level inline diff highlighting within changed lines.
|
|
16
|
-
* @default true
|
|
17
|
-
*/
|
|
18
|
-
readonly inlineDiff?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Granularity of inline diff highlighting.
|
|
21
|
-
* - `"chars"` — character-level (best for code)
|
|
22
|
-
* - `"words"` — word-level (best for prose)
|
|
23
|
-
* @default "chars"
|
|
24
|
-
*/
|
|
25
|
-
readonly inlineDiffMode?: InlineDiffMode;
|
|
26
|
-
/**
|
|
27
|
-
* Programming language for syntax highlighting within diff lines.
|
|
28
|
-
* When provided, diff content is highlighted with Shiki.
|
|
29
|
-
*/
|
|
30
|
-
readonly language?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Display mode: unified (interleaved) or split (side-by-side).
|
|
33
|
-
* @default "unified"
|
|
34
|
-
*/
|
|
35
|
-
readonly mode?: DiffViewMode;
|
|
36
|
-
/**
|
|
37
|
-
* Label for the new version.
|
|
38
|
-
*/
|
|
39
|
-
readonly newLabel?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Modified text ("new" / right side).
|
|
42
|
-
*/
|
|
43
|
-
readonly newText?: string;
|
|
44
|
-
/**
|
|
45
|
-
* Label for the old version.
|
|
46
|
-
*/
|
|
47
|
-
readonly oldLabel?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Original text ("old" / left side).
|
|
50
|
-
*/
|
|
51
|
-
readonly oldText?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Whether to display line numbers.
|
|
54
|
-
* @default true
|
|
55
|
-
*/
|
|
56
|
-
readonly showLineNumbers?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Shiki theme for syntax highlighting.
|
|
59
|
-
* @default "github-dark-default"
|
|
60
|
-
*/
|
|
61
|
-
readonly theme?: string;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Display file differences with colored additions/deletions.
|
|
65
|
-
*
|
|
66
|
-
* ```tsx
|
|
67
|
-
* <DiffView oldText="hello" newText="hello world" />
|
|
68
|
-
* <DiffView diff={unifiedDiffString} mode="split" />
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
export default function DiffView({ context, diff: diffProp, inlineDiff, inlineDiffMode, language, mode, newLabel, newText, oldLabel, oldText, showLineNumbers, theme, }: Props): ReactElement;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
2
|
-
import type { ReactElement } from "react";
|
|
3
|
-
import type { LiteralUnion } from "type-fest";
|
|
4
|
-
export type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Custom character to use instead of the default line character.
|
|
7
|
-
*/
|
|
8
|
-
readonly character?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Color of the divider line.
|
|
11
|
-
*/
|
|
12
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
13
|
-
/**
|
|
14
|
-
* Render the divider with dim color.
|
|
15
|
-
*/
|
|
16
|
-
readonly dimColor?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Optional label rendered in the middle of a horizontal divider.
|
|
19
|
-
*/
|
|
20
|
-
readonly label?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Padding around the label.
|
|
23
|
-
* @default 1
|
|
24
|
-
*/
|
|
25
|
-
readonly labelPadding?: number;
|
|
26
|
-
/**
|
|
27
|
-
* Total length of the divider. When omitted, horizontal dividers stretch to
|
|
28
|
-
* fill the available space and vertical dividers default to one row.
|
|
29
|
-
*/
|
|
30
|
-
readonly length?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Orientation of the divider.
|
|
33
|
-
* @default "horizontal"
|
|
34
|
-
*/
|
|
35
|
-
readonly orientation?: "horizontal" | "vertical";
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Horizontal or vertical divider line, optionally with a centered label.
|
|
39
|
-
*/
|
|
40
|
-
export default function Divider({ character, color, dimColor, label, labelPadding, length, orientation }: Props): ReactElement;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { PureComponent } from "react";
|
|
3
|
-
type Props = {
|
|
4
|
-
readonly children: ReactNode;
|
|
5
|
-
readonly onError: (error: Error) => void;
|
|
6
|
-
};
|
|
7
|
-
type State = {
|
|
8
|
-
readonly error?: Error;
|
|
9
|
-
};
|
|
10
|
-
export default class ErrorBoundary extends PureComponent<Props, State> {
|
|
11
|
-
static displayName: string;
|
|
12
|
-
static getDerivedStateFromError(error: Error): State;
|
|
13
|
-
state: State;
|
|
14
|
-
componentDidCatch(error: Error): void;
|
|
15
|
-
render(): ReactNode;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react";
|
|
2
|
-
import type { FileEntry, FilePickerFilter } from "./types.d.ts";
|
|
3
|
-
export type Props = {
|
|
4
|
-
/**
|
|
5
|
-
* Color for the focused item highlight.
|
|
6
|
-
* @default "cyan"
|
|
7
|
-
*/
|
|
8
|
-
readonly accentColor?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Color for directory entries.
|
|
11
|
-
* @default "blue"
|
|
12
|
-
*/
|
|
13
|
-
readonly directoryColor?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Color for file entries.
|
|
16
|
-
* @default "white"
|
|
17
|
-
*/
|
|
18
|
-
readonly fileColor?: string;
|
|
19
|
-
/**
|
|
20
|
-
* File filter options.
|
|
21
|
-
*/
|
|
22
|
-
readonly filter?: FilePickerFilter;
|
|
23
|
-
/**
|
|
24
|
-
* Starting directory path.
|
|
25
|
-
* @default process.cwd()
|
|
26
|
-
*/
|
|
27
|
-
readonly initialPath?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Whether keyboard navigation is active.
|
|
30
|
-
* @default true
|
|
31
|
-
*/
|
|
32
|
-
readonly isFocused?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Maximum number of visible items (viewport height).
|
|
35
|
-
* @default 10
|
|
36
|
-
*/
|
|
37
|
-
readonly limit?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Called when escape is pressed.
|
|
40
|
-
*/
|
|
41
|
-
readonly onCancel?: () => void;
|
|
42
|
-
/**
|
|
43
|
-
* Called when a file is selected (enter on a file entry).
|
|
44
|
-
*/
|
|
45
|
-
readonly onSelect?: (entry: FileEntry) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Show file permissions column.
|
|
48
|
-
* @default false
|
|
49
|
-
*/
|
|
50
|
-
readonly showPermissions?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Show file size column.
|
|
53
|
-
* @default false
|
|
54
|
-
*/
|
|
55
|
-
readonly showSize?: boolean;
|
|
56
|
-
};
|
|
57
|
-
declare const FilePicker: ({ accentColor, directoryColor, fileColor, filter, initialPath, isFocused, limit, onCancel, onSelect, showPermissions, showSize, }: Props) => ReactElement;
|
|
58
|
-
export default FilePicker;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A single entry (file or directory) returned by the file system hook.
|
|
3
|
-
*/
|
|
4
|
-
export type FileEntry = {
|
|
5
|
-
readonly isDirectory: boolean;
|
|
6
|
-
readonly isHidden: boolean;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
readonly path: string;
|
|
9
|
-
readonly permissions: string;
|
|
10
|
-
readonly size: number;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Filter options for the file picker.
|
|
14
|
-
*/
|
|
15
|
-
export type FilePickerFilter = {
|
|
16
|
-
/**
|
|
17
|
-
* Allowed file extensions (e.g. `[".ts", ".tsx"]`). Empty or omitted means all.
|
|
18
|
-
*/
|
|
19
|
-
readonly extensions?: ReadonlyArray<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Whether to include directories in the list.
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
readonly showDirectories?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Whether to include regular files in the list.
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
readonly showFiles?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to include hidden files (names starting with `.`).
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
|
-
readonly showHidden?: boolean;
|
|
35
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FileEntry, FilePickerFilter } from "./types.d.ts";
|
|
2
|
-
type UseFileSystemOptions = {
|
|
3
|
-
readonly filter: FilePickerFilter;
|
|
4
|
-
readonly initialPath: string;
|
|
5
|
-
};
|
|
6
|
-
type UseFileSystemResult = {
|
|
7
|
-
readonly currentPath: string;
|
|
8
|
-
readonly entries: ReadonlyArray<FileEntry>;
|
|
9
|
-
readonly error: string | undefined;
|
|
10
|
-
readonly goUp: () => void;
|
|
11
|
-
readonly isLoading: boolean;
|
|
12
|
-
readonly navigateTo: (path: string) => void;
|
|
13
|
-
readonly refresh: () => void;
|
|
14
|
-
};
|
|
15
|
-
export default function useFileSystem(options: UseFileSystemOptions): UseFileSystemResult;
|
|
16
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Context } from "react";
|
|
2
|
-
export type Props = {
|
|
3
|
-
readonly activate: (id: string) => void;
|
|
4
|
-
readonly activeId?: string;
|
|
5
|
-
readonly add: (id: string, options: {
|
|
6
|
-
autoFocus: boolean;
|
|
7
|
-
}) => void;
|
|
8
|
-
readonly deactivate: (id: string) => void;
|
|
9
|
-
readonly disableFocus: () => void;
|
|
10
|
-
readonly enableFocus: () => void;
|
|
11
|
-
readonly focus: (id: string) => void;
|
|
12
|
-
readonly focusNext: () => void;
|
|
13
|
-
readonly focusPrevious: () => void;
|
|
14
|
-
readonly remove: (id: string) => void;
|
|
15
|
-
};
|
|
16
|
-
declare const FocusContext: Context<Props>;
|
|
17
|
-
export default FocusContext;
|