@visulima/tui 1.0.0-alpha.3 → 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 +21 -0
- package/LICENSE.md +140 -0
- package/README.md +3 -3
- 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,38 +0,0 @@
|
|
|
1
|
-
export type UseStopwatchOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* Whether to start counting immediately.
|
|
4
|
-
* @default false
|
|
5
|
-
*/
|
|
6
|
-
readonly autoStart?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Tick interval in milliseconds.
|
|
9
|
-
* @default 1000
|
|
10
|
-
*/
|
|
11
|
-
readonly interval?: number;
|
|
12
|
-
};
|
|
13
|
-
export type UseStopwatchResult = {
|
|
14
|
-
/** Milliseconds elapsed since start (or last reset). */
|
|
15
|
-
readonly elapsed: number;
|
|
16
|
-
/** Whether the stopwatch is currently running. */
|
|
17
|
-
readonly isRunning: boolean;
|
|
18
|
-
/** Capture the current elapsed time as a lap. Returns the elapsed value. */
|
|
19
|
-
readonly lap: () => number;
|
|
20
|
-
/** Accumulated lap times. */
|
|
21
|
-
readonly laps: ReadonlyArray<number>;
|
|
22
|
-
/** Reset elapsed to 0, clear laps, and stop the stopwatch. */
|
|
23
|
-
readonly reset: () => void;
|
|
24
|
-
/** Start counting. */
|
|
25
|
-
readonly start: () => void;
|
|
26
|
-
/** Pause counting. */
|
|
27
|
-
readonly stop: () => void;
|
|
28
|
-
/** Toggle between running and stopped. */
|
|
29
|
-
readonly toggle: () => void;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* A count-up stopwatch hook built on `useAnimation`.
|
|
33
|
-
*
|
|
34
|
-
* ```tsx
|
|
35
|
-
* const { elapsed, isRunning, start, stop, reset, lap, laps } = useStopwatch();
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export default function useStopwatch(options?: UseStopwatchOptions): UseStopwatchResult;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { TerminalPalette } from "../terminal-palette.d.ts";
|
|
2
|
-
export type UseTerminalPaletteResult = {
|
|
3
|
-
readonly isLoading: boolean;
|
|
4
|
-
readonly isSupported: boolean;
|
|
5
|
-
readonly palette: Partial<TerminalPalette> | null;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Hook that queries the terminal for its current color palette.
|
|
9
|
-
* Returns the detected palette colors or null if not yet loaded.
|
|
10
|
-
*
|
|
11
|
-
* ```tsx
|
|
12
|
-
* const { palette, isLoading } = useTerminalPalette();
|
|
13
|
-
* if (palette?.background) {
|
|
14
|
-
* console.log("Terminal background:", palette.background);
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare const useTerminalPalette: () => UseTerminalPaletteResult;
|
|
19
|
-
export default useTerminalPalette;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export type CursorPosition = {
|
|
2
|
-
readonly col: number;
|
|
3
|
-
readonly line: number;
|
|
4
|
-
};
|
|
5
|
-
export type TextBufferState = {
|
|
6
|
-
readonly anchor: CursorPosition | null;
|
|
7
|
-
readonly cursor: CursorPosition;
|
|
8
|
-
readonly lines: ReadonlyArray<string>;
|
|
9
|
-
};
|
|
10
|
-
export type UseTextBufferResult = {
|
|
11
|
-
readonly anchor: CursorPosition | null;
|
|
12
|
-
readonly clearSelection: () => void;
|
|
13
|
-
readonly cursor: CursorPosition;
|
|
14
|
-
readonly deleteBack: () => void;
|
|
15
|
-
readonly deleteForward: () => void;
|
|
16
|
-
readonly deleteLine: () => void;
|
|
17
|
-
readonly deleteSelection: () => void;
|
|
18
|
-
readonly deleteToLineEnd: () => void;
|
|
19
|
-
readonly deleteToLineStart: () => void;
|
|
20
|
-
readonly deleteWord: () => void;
|
|
21
|
-
readonly getSelectedText: () => string;
|
|
22
|
-
readonly hasSelection: () => boolean;
|
|
23
|
-
readonly insert: (text: string) => void;
|
|
24
|
-
readonly lines: ReadonlyArray<string>;
|
|
25
|
-
readonly moveCursor: (direction: "down" | "left" | "right" | "up", selecting?: boolean) => void;
|
|
26
|
-
readonly moveToEnd: (selecting?: boolean) => void;
|
|
27
|
-
readonly moveToLineEnd: (selecting?: boolean) => void;
|
|
28
|
-
readonly moveToLineStart: (selecting?: boolean) => void;
|
|
29
|
-
readonly moveToStart: (selecting?: boolean) => void;
|
|
30
|
-
readonly newline: () => void;
|
|
31
|
-
readonly redo: () => void;
|
|
32
|
-
readonly replaceSelection: (text: string) => void;
|
|
33
|
-
readonly selectAll: () => void;
|
|
34
|
-
readonly setValue: (value: string) => void;
|
|
35
|
-
readonly undo: () => void;
|
|
36
|
-
readonly value: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Hook managing a multi-line text buffer with cursor, selection, and undo/redo.
|
|
40
|
-
*/
|
|
41
|
-
declare const useTextBuffer: (initialValue?: string) => UseTextBufferResult;
|
|
42
|
-
export default useTextBuffer;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React hook for managing text selection with keyboard and clipboard integration.
|
|
3
|
-
*
|
|
4
|
-
* Builds on the existing Selection/Range classes from `../selection.ts` and
|
|
5
|
-
* provides a high-level API for Shift+Arrow selection and copy-to-clipboard.
|
|
6
|
-
*/
|
|
7
|
-
import type { RefObject } from "react";
|
|
8
|
-
import type { DOMElement } from "../dom.d.ts";
|
|
9
|
-
import { Selection } from "../selection.d.ts";
|
|
10
|
-
export type UseTextSelectionOptions = {
|
|
11
|
-
/**
|
|
12
|
-
* Automatically copy selected text to clipboard when selection changes.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
readonly copyOnSelect?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Enable or disable text selection.
|
|
18
|
-
* @default true
|
|
19
|
-
*/
|
|
20
|
-
readonly isActive?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Called whenever the selection changes.
|
|
23
|
-
*/
|
|
24
|
-
readonly onSelectionChange?: (selectedText: string) => void;
|
|
25
|
-
};
|
|
26
|
-
export type UseTextSelectionResult = {
|
|
27
|
-
/** Clear the current selection. */
|
|
28
|
-
readonly clearSelection: () => void;
|
|
29
|
-
/** Select all content within the referenced element. */
|
|
30
|
-
readonly selectAll: () => void;
|
|
31
|
-
/** The currently selected text. */
|
|
32
|
-
readonly selectedText: string;
|
|
33
|
-
/** The underlying Selection instance. */
|
|
34
|
-
readonly selection: Selection;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Hook for managing text selection on a DOM element.
|
|
38
|
-
*
|
|
39
|
-
* ```tsx
|
|
40
|
-
* const ref = useRef(null);
|
|
41
|
-
* const { selectedText, selectAll, clearSelection } = useTextSelection(ref);
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
declare const useTextSelection: (ref: RefObject<DOMElement | null>, options?: UseTextSelectionOptions) => UseTextSelectionResult;
|
|
45
|
-
export default useTextSelection;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type UseTimeoutOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* When false, the timer never starts. Flipping to true restarts it.
|
|
4
|
-
* @default true
|
|
5
|
-
*/
|
|
6
|
-
readonly isActive?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export type UseTimeoutResult = {
|
|
9
|
-
/**
|
|
10
|
-
* Cancel the pending timer (no-op if already fired or never scheduled).
|
|
11
|
-
*/
|
|
12
|
-
readonly cancel: () => void;
|
|
13
|
-
/**
|
|
14
|
-
* Restart the timer from now with the current delay.
|
|
15
|
-
*/
|
|
16
|
-
readonly reset: () => void;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* A React hook that fires `callback` once after `delay` ms. Changing `delay`
|
|
20
|
-
* or toggling `isActive` reschedules the timer from zero. Call `reset()` to
|
|
21
|
-
* restart on demand.
|
|
22
|
-
*/
|
|
23
|
-
declare const useTimeout: (callback: () => void, delay: number, options?: UseTimeoutOptions) => UseTimeoutResult;
|
|
24
|
-
export default useTimeout;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export type UseTimerOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* Whether to start the timer immediately.
|
|
4
|
-
* @default false
|
|
5
|
-
*/
|
|
6
|
-
readonly autoStart?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Total countdown duration in milliseconds.
|
|
9
|
-
*/
|
|
10
|
-
readonly duration: number;
|
|
11
|
-
/**
|
|
12
|
-
* Tick interval in milliseconds.
|
|
13
|
-
* @default 1000
|
|
14
|
-
*/
|
|
15
|
-
readonly interval?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Called once when the timer reaches zero.
|
|
18
|
-
*/
|
|
19
|
-
readonly onTimeout?: () => void;
|
|
20
|
-
};
|
|
21
|
-
export type UseTimerResult = {
|
|
22
|
-
/** Whether the countdown has reached zero. */
|
|
23
|
-
readonly isFinished: boolean;
|
|
24
|
-
/** Whether the timer is currently counting down. */
|
|
25
|
-
readonly isRunning: boolean;
|
|
26
|
-
/** Milliseconds remaining (clamped to >= 0). */
|
|
27
|
-
readonly remaining: number;
|
|
28
|
-
/** Reset the timer to the original duration and stop it. */
|
|
29
|
-
readonly reset: () => void;
|
|
30
|
-
/** Start the countdown. */
|
|
31
|
-
readonly start: () => void;
|
|
32
|
-
/** Stop (pause) the countdown. */
|
|
33
|
-
readonly stop: () => void;
|
|
34
|
-
/** Toggle between running and stopped. */
|
|
35
|
-
readonly toggle: () => void;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* A countdown timer hook built on `useAnimation`.
|
|
39
|
-
*
|
|
40
|
-
* ```tsx
|
|
41
|
-
* const { remaining, isRunning, start, stop, reset, isFinished } = useTimer({
|
|
42
|
-
* duration: 60_000,
|
|
43
|
-
* onTimeout: () => console.log("Time's up!"),
|
|
44
|
-
* });
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export default function useTimer(options: UseTimerOptions): UseTimerResult;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dimensions of the terminal window.
|
|
3
|
-
*/
|
|
4
|
-
export type WindowSize = {
|
|
5
|
-
/**
|
|
6
|
-
* Number of columns (horizontal character cells).
|
|
7
|
-
*/
|
|
8
|
-
readonly columns: number;
|
|
9
|
-
/**
|
|
10
|
-
* Number of rows (vertical character cells).
|
|
11
|
-
*/
|
|
12
|
-
readonly rows: number;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* A React hook that returns the current terminal window dimensions and re-renders the component whenever the terminal is resized.
|
|
16
|
-
*/
|
|
17
|
-
declare const useWindowSize: () => WindowSize;
|
|
18
|
-
export default useWindowSize;
|
package/dist/ink/ime-utils.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detect whether a string contains non-ASCII characters that are likely
|
|
3
|
-
* IME (Input Method Editor) composition input — CJK ideographs, Hangul,
|
|
4
|
-
* Thai, Vietnamese diacritics, etc.
|
|
5
|
-
*/
|
|
6
|
-
declare const isIMEInput: (data: string) => boolean;
|
|
7
|
-
type IMECompositionBufferOptions = {
|
|
8
|
-
onFlush: (text: string) => void;
|
|
9
|
-
timeout: number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Buffers rapid multi-byte character input from IME and flushes the
|
|
13
|
-
* accumulated text after a configurable timeout.
|
|
14
|
-
*/
|
|
15
|
-
declare class IMECompositionBuffer {
|
|
16
|
-
private buffer;
|
|
17
|
-
private timer;
|
|
18
|
-
private readonly onFlush;
|
|
19
|
-
private readonly timeout;
|
|
20
|
-
constructor({ onFlush, timeout }: IMECompositionBufferOptions);
|
|
21
|
-
add(text: string): void;
|
|
22
|
-
flush(): void;
|
|
23
|
-
destroy(): void;
|
|
24
|
-
}
|
|
25
|
-
export { IMECompositionBuffer, isIMEInput };
|
package/dist/ink/ink.d.ts
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import * as dom from "./dom.d.ts";
|
|
3
|
-
import type { KittyKeyboardOptions } from "./kitty-keyboard.d.ts";
|
|
4
|
-
import type { CursorPosition } from "./log-update.d.ts";
|
|
5
|
-
/**
|
|
6
|
-
* Performance metrics for a render operation.
|
|
7
|
-
*/
|
|
8
|
-
export type RenderMetrics = {
|
|
9
|
-
/**
|
|
10
|
-
* Time spent rendering in milliseconds.
|
|
11
|
-
*/
|
|
12
|
-
renderTime: number;
|
|
13
|
-
};
|
|
14
|
-
export type Options = {
|
|
15
|
-
/**
|
|
16
|
-
* Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
|
|
17
|
-
*
|
|
18
|
-
* Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
|
|
19
|
-
*
|
|
20
|
-
* Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
|
|
21
|
-
*
|
|
22
|
-
Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
|
|
23
|
-
|
|
24
|
-
Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
25
|
-
|
|
26
|
-
@default false
|
|
27
|
-
|
|
28
|
-
@see {@link RenderOptions.alternateScreen}
|
|
29
|
-
*/
|
|
30
|
-
alternateScreen?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Enable React Concurrent Rendering mode.
|
|
33
|
-
*
|
|
34
|
-
* When enabled:
|
|
35
|
-
* - Suspense boundaries work correctly with async data
|
|
36
|
-
* - `useTransition` and `useDeferredValue` are fully functional
|
|
37
|
-
- Updates can be interrupted for higher priority work
|
|
38
|
-
|
|
39
|
-
Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
|
|
40
|
-
|
|
41
|
-
@default false
|
|
42
|
-
@experimental
|
|
43
|
-
*/
|
|
44
|
-
concurrent?: boolean;
|
|
45
|
-
debug: boolean;
|
|
46
|
-
exitOnCtrlC: boolean;
|
|
47
|
-
incrementalRendering?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Override automatic interactive mode detection.
|
|
50
|
-
*
|
|
51
|
-
* By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
|
|
52
|
-
*
|
|
53
|
-
* When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
|
|
54
|
-
*
|
|
55
|
-
Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
|
|
56
|
-
|
|
57
|
-
Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
|
|
58
|
-
|
|
59
|
-
@default true (false if in CI or `stdout.isTTY` is falsy)
|
|
60
|
-
|
|
61
|
-
@see {@link RenderOptions.interactive}
|
|
62
|
-
*/
|
|
63
|
-
interactive?: boolean;
|
|
64
|
-
isScreenReaderEnabled?: boolean;
|
|
65
|
-
kittyKeyboard?: KittyKeyboardOptions;
|
|
66
|
-
maxFps?: number;
|
|
67
|
-
onRender?: (metrics: RenderMetrics) => void;
|
|
68
|
-
patchConsole: boolean;
|
|
69
|
-
standardReactLayoutTiming?: boolean;
|
|
70
|
-
stderr: NodeJS.WriteStream;
|
|
71
|
-
stdin: NodeJS.ReadStream;
|
|
72
|
-
stdout: NodeJS.WriteStream;
|
|
73
|
-
/**
|
|
74
|
-
* Whether to track text selection state during rendering.
|
|
75
|
-
*
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
trackSelection?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Use the native Rust cell-diff renderer instead of ANSI string-based log-update.
|
|
81
|
-
* Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
|
|
82
|
-
* generating minimal ANSI escape sequences. Significantly reduces GC pressure
|
|
83
|
-
* and improves rendering performance for complex UIs.
|
|
84
|
-
*
|
|
85
|
-
* Falls back to the string-based path if native bindings are not available.
|
|
86
|
-
* @default false
|
|
87
|
-
*/
|
|
88
|
-
useNativeRenderer?: boolean;
|
|
89
|
-
waitUntilExit?: () => Promise<unknown>;
|
|
90
|
-
};
|
|
91
|
-
export default class Ink {
|
|
92
|
-
/**
|
|
93
|
-
* Whether this instance is using concurrent rendering mode.
|
|
94
|
-
*/
|
|
95
|
-
readonly isConcurrent: boolean;
|
|
96
|
-
private readonly options;
|
|
97
|
-
private readonly log;
|
|
98
|
-
private manualCursorPosition;
|
|
99
|
-
private renderedCursorPosition;
|
|
100
|
-
private renderedCursorRequested;
|
|
101
|
-
private readonly throttledLog;
|
|
102
|
-
private readonly isScreenReaderEnabled;
|
|
103
|
-
private readonly interactive;
|
|
104
|
-
private readonly renderThrottleMs;
|
|
105
|
-
private alternateScreen;
|
|
106
|
-
private isUnmounted;
|
|
107
|
-
private isUnmounting;
|
|
108
|
-
private lastOutput;
|
|
109
|
-
private lastOutputToRender;
|
|
110
|
-
private lastOutputHeight;
|
|
111
|
-
private lastTerminalWidth;
|
|
112
|
-
private readonly nativeLog;
|
|
113
|
-
private readonly useNativeRenderer;
|
|
114
|
-
private readonly container;
|
|
115
|
-
readonly rootNode: dom.DOMElement;
|
|
116
|
-
private fullStaticOutput;
|
|
117
|
-
private readonly exitPromise;
|
|
118
|
-
private exitResult;
|
|
119
|
-
private beforeExitHandler?;
|
|
120
|
-
private restoreConsole?;
|
|
121
|
-
private unsubscribeResize?;
|
|
122
|
-
private readonly throttledOnRender?;
|
|
123
|
-
private hasPendingThrottledRender;
|
|
124
|
-
private kittyProtocolEnabled;
|
|
125
|
-
private cancelKittyDetection?;
|
|
126
|
-
private nextRenderCommit?;
|
|
127
|
-
private deferredInitDone;
|
|
128
|
-
constructor(options: Options);
|
|
129
|
-
/**
|
|
130
|
-
* Perform deferred initialization on the first render frame.
|
|
131
|
-
* Kitty keyboard auto-detection is deferred here because the CSI ? u
|
|
132
|
-
* query sets up a synchronous stdin listener with a 200ms timeout.
|
|
133
|
-
* "enabled" mode runs immediately in the constructor (it's just a write).
|
|
134
|
-
*/
|
|
135
|
-
private runDeferredInit;
|
|
136
|
-
resized: () => void;
|
|
137
|
-
resolveExitPromise: (result?: unknown) => void;
|
|
138
|
-
rejectExitPromise: (reason?: Error) => void;
|
|
139
|
-
unsubscribeExit: () => void;
|
|
140
|
-
handleAppExit: (errorOrResult?: unknown) => void;
|
|
141
|
-
getActiveCursorPosition: () => CursorPosition | undefined;
|
|
142
|
-
setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
143
|
-
restoreLastOutput: () => void;
|
|
144
|
-
calculateLayout: () => void;
|
|
145
|
-
private calculateScrollAndTriggerObservers;
|
|
146
|
-
/**
|
|
147
|
-
* Force a full layout recalculation by marking all text nodes dirty.
|
|
148
|
-
* Useful when the string width function changes or terminal font changes.
|
|
149
|
-
*/
|
|
150
|
-
recalculateLayout(): void;
|
|
151
|
-
/**
|
|
152
|
-
* Walks the DOM tree before Yoga layout to handle StaticRender nodes.
|
|
153
|
-
*
|
|
154
|
-
* - Re-attach Yoga children if a cached render was invalidated.
|
|
155
|
-
* - Pre-render ink-static-render nodes that don't have a cached render yet.
|
|
156
|
-
*/
|
|
157
|
-
private prepareYogaTree;
|
|
158
|
-
private markAllTextNodesDirty;
|
|
159
|
-
onRender: () => void;
|
|
160
|
-
private accessibilityContextValue;
|
|
161
|
-
render(node: ReactNode): void;
|
|
162
|
-
writeToStdout: (data: string) => void;
|
|
163
|
-
writeToStderr: (data: string) => void;
|
|
164
|
-
unmount: (error?: Error | number | null) => void;
|
|
165
|
-
waitUntilExit(): Promise<unknown>;
|
|
166
|
-
waitUntilRenderFlush(): Promise<void>;
|
|
167
|
-
clear(): void;
|
|
168
|
-
patchConsole(): void;
|
|
169
|
-
private setAlternateScreen;
|
|
170
|
-
private resolveInteractiveOption;
|
|
171
|
-
private resolveAlternateScreenOption;
|
|
172
|
-
private shouldSync;
|
|
173
|
-
private writeBestEffort;
|
|
174
|
-
private awaitExit;
|
|
175
|
-
private hasPendingConcurrentWork;
|
|
176
|
-
private awaitNextRender;
|
|
177
|
-
private renderInteractiveFrame;
|
|
178
|
-
/**
|
|
179
|
-
* Handle kitty keyboard "enabled" mode immediately (just a stdout.write).
|
|
180
|
-
* Called from the constructor.
|
|
181
|
-
*/
|
|
182
|
-
private initImmediateKittyKeyboard;
|
|
183
|
-
/**
|
|
184
|
-
* Handle kitty keyboard "auto" mode detection. Deferred to first render
|
|
185
|
-
* because the CSI ? u query sets up a stdin listener with a 200ms timeout.
|
|
186
|
-
*/
|
|
187
|
-
private initDeferredKittyKeyboard;
|
|
188
|
-
private confirmKittySupport;
|
|
189
|
-
private enableKittyProtocol;
|
|
190
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type InputEvent = string | {
|
|
2
|
-
readonly paste: string;
|
|
3
|
-
};
|
|
4
|
-
export type InputParser = {
|
|
5
|
-
flushPendingEscape: () => string | undefined;
|
|
6
|
-
hasPendingEscape: () => boolean;
|
|
7
|
-
push: (chunk: string) => InputEvent[];
|
|
8
|
-
reset: () => void;
|
|
9
|
-
};
|
|
10
|
-
export declare const createInputParser: () => InputParser;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared input filtering utilities for text input components.
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Check if a character is a C0 control character or DEL.
|
|
6
|
-
*/
|
|
7
|
-
export declare const isControlCharacter: (input: string) => boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Determine whether the input should be inserted as text.
|
|
10
|
-
* Filters out modifier chords (Ctrl+S, Meta+S, etc.) while allowing
|
|
11
|
-
* AltGr-produced symbols (Ctrl+Meta+@, Ctrl+Meta+€) on international keyboards.
|
|
12
|
-
*/
|
|
13
|
-
export declare const isInsertableInput: (input: string, key: {
|
|
14
|
-
ctrl: boolean;
|
|
15
|
-
meta: boolean;
|
|
16
|
-
}) => boolean;
|
package/dist/ink/instances.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const kittyFlags: {
|
|
2
|
-
readonly disambiguateEscapeCodes: 1;
|
|
3
|
-
readonly reportAllKeysAsEscapeCodes: 8;
|
|
4
|
-
readonly reportAlternateKeys: 4;
|
|
5
|
-
readonly reportAssociatedText: 16;
|
|
6
|
-
readonly reportEventTypes: 2;
|
|
7
|
-
};
|
|
8
|
-
export type KittyFlagName = keyof typeof kittyFlags;
|
|
9
|
-
export declare function resolveFlags(flags: KittyFlagName[]): number;
|
|
10
|
-
export declare const kittyModifiers: {
|
|
11
|
-
readonly alt: 2;
|
|
12
|
-
readonly capsLock: 64;
|
|
13
|
-
readonly ctrl: 4;
|
|
14
|
-
readonly hyper: 16;
|
|
15
|
-
readonly meta: 32;
|
|
16
|
-
readonly numLock: 128;
|
|
17
|
-
readonly shift: 1;
|
|
18
|
-
readonly super: 8;
|
|
19
|
-
};
|
|
20
|
-
export type KittyKeyboardOptions = {
|
|
21
|
-
flags?: KittyFlagName[];
|
|
22
|
-
mode?: "auto" | "enabled" | "disabled";
|
|
23
|
-
};
|
package/dist/ink/layout.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { DOMElement, DOMNode } from "./dom.d.ts";
|
|
2
|
-
import type { TextFragment } from "./measure-element.d.ts";
|
|
3
|
-
type Position = {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
};
|
|
7
|
-
declare const getAbsolutePosition: (node: DOMElement) => Position | undefined;
|
|
8
|
-
declare const getAbsoluteContentPosition: (node: DOMElement) => Position | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* Generic layout tree walker with callbacks for text, newline, and space events.
|
|
11
|
-
* Used by selection.ts for extracting text from the DOM tree with proper layout positioning.
|
|
12
|
-
*
|
|
13
|
-
* Ported from jacob314/ink fork (Google LLC, Apache-2.0).
|
|
14
|
-
*/
|
|
15
|
-
export type LayoutCallbacks<T> = {
|
|
16
|
-
initialState: () => T;
|
|
17
|
-
onNewline: (count: number, state: T) => void;
|
|
18
|
-
onSpace: (count: number, state: T) => void;
|
|
19
|
-
onText: (fragment: TextFragment, state: T) => void;
|
|
20
|
-
};
|
|
21
|
-
export declare const processLayout: <T>(node: DOMNode, callbacks: LayoutCallbacks<T>) => {
|
|
22
|
-
lineBottom: number;
|
|
23
|
-
state: T;
|
|
24
|
-
};
|
|
25
|
-
export type { Position };
|
|
26
|
-
export { getAbsoluteContentPosition, getAbsolutePosition };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type NativeLogUpdate = {
|
|
2
|
-
clear: () => void;
|
|
3
|
-
destroy: () => void;
|
|
4
|
-
render: (buffer: Uint32Array, width: number, height: number) => void;
|
|
5
|
-
resize: (width: number, height: number) => void;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Create a native (Rust-backed) renderer for Ink's output.
|
|
9
|
-
*
|
|
10
|
-
* The native binding is loaded lazily — if it's not available (e.g., unsupported
|
|
11
|
-
* platform), `createNative` returns `undefined`. The binding lookup is cached
|
|
12
|
-
* at the module level so subsequent calls avoid the try-catch + require overhead.
|
|
13
|
-
*/
|
|
14
|
-
export declare const createNative: (stream: NodeJS.WriteStream) => NativeLogUpdate | undefined;
|
package/dist/ink/log-update.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Writable } from "node:stream";
|
|
2
|
-
import type { CursorPosition } from "./cursor-helpers.d.ts";
|
|
3
|
-
export type { CursorPosition } from "./cursor-helpers.d.ts";
|
|
4
|
-
export type LogUpdate = {
|
|
5
|
-
clear: () => void;
|
|
6
|
-
done: () => void;
|
|
7
|
-
isCursorDirty: () => boolean;
|
|
8
|
-
reset: () => void;
|
|
9
|
-
setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
10
|
-
sync: (string_: string) => void;
|
|
11
|
-
willRender: (string_: string) => boolean;
|
|
12
|
-
(string_: string): boolean;
|
|
13
|
-
};
|
|
14
|
-
declare const create: (stream: Writable, { incremental, showCursor }?: {
|
|
15
|
-
incremental?: boolean;
|
|
16
|
-
showCursor?: boolean;
|
|
17
|
-
}) => LogUpdate;
|
|
18
|
-
declare const logUpdate: {
|
|
19
|
-
create: typeof create;
|
|
20
|
-
};
|
|
21
|
-
export default logUpdate;
|