@visulima/tui 1.0.0-alpha.4 → 1.0.0-alpha.6
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 +33 -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-BR3gA-N8.d.ts +1257 -0
- package/dist/react/index.d.ts +519 -8
- package/dist/testing/index.d.ts +274 -135
- package/package.json +16 -17
- 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
package/dist/ink/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export { default as Gradient } from '../packem_shared/Gradient-Dg0NezWc.js';
|
|
|
37
37
|
export { default as Heading } from '../packem_shared/Heading-BnR7McmP.js';
|
|
38
38
|
export { default as Heatmap } from '../packem_shared/Heatmap-_jqISOU0.js';
|
|
39
39
|
export { default as Help } from '../packem_shared/Help-0yZ_IcQg.js';
|
|
40
|
-
export { default as Histogram } from '../packem_shared/Histogram-
|
|
40
|
+
export { default as Histogram } from '../packem_shared/Histogram-CB6XcmZW.js';
|
|
41
41
|
export { default as Kbd } from '../packem_shared/Kbd-BNDXQgey.js';
|
|
42
42
|
export { L as LineChart } from '../packem_shared/line-chart-VGU2l7pu.js';
|
|
43
43
|
export { default as Link } from '../packem_shared/Link-DZ2Tiq1m.js';
|
|
@@ -13,7 +13,7 @@ const binData = (data, thresholds) => {
|
|
|
13
13
|
if (thresholds.length < 2) {
|
|
14
14
|
return [];
|
|
15
15
|
}
|
|
16
|
-
const counts = Array.from({ length: thresholds.length - 1 }
|
|
16
|
+
const counts = Array.from({ length: thresholds.length - 1 }).fill(0);
|
|
17
17
|
const lowerBound = thresholds[0];
|
|
18
18
|
const upperBound = thresholds[thresholds.length - 1];
|
|
19
19
|
for (const value of data) {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
declare class TuiApp extends EventEmitter {
|
|
3
|
+
private renderer;
|
|
4
|
+
private terminal;
|
|
5
|
+
private backBuffer;
|
|
6
|
+
private width;
|
|
7
|
+
private height;
|
|
8
|
+
private isRunning;
|
|
9
|
+
private stdoutBuffer;
|
|
10
|
+
private stderrBuffer;
|
|
11
|
+
constructor();
|
|
12
|
+
/** Enters raw mode + alternate screen. Does NOT start any render loop. */
|
|
13
|
+
start(): void;
|
|
14
|
+
/** Request a clean exit — restores terminal, stops input, exits the process. */
|
|
15
|
+
quit(): void;
|
|
16
|
+
/** Exits raw mode + alternate screen, then flushes any buffered stdout/stderr. */
|
|
17
|
+
stop(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Buffer a write to stdout. While the alternate screen is active, writing
|
|
20
|
+
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
21
|
+
*/
|
|
22
|
+
writeStdout(text: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Buffer a write to stderr. While the alternate screen is active, writing
|
|
25
|
+
* directly would corrupt the TUI. Buffered output is flushed on stop().
|
|
26
|
+
*/
|
|
27
|
+
writeStderr(text: string): void;
|
|
28
|
+
/** Returns the shared Uint32Array back-buffer (width * height * 2 u32 cells). */
|
|
29
|
+
getBuffer(): Uint32Array;
|
|
30
|
+
/** Returns current terminal dimensions. */
|
|
31
|
+
getSize(): {
|
|
32
|
+
height: number;
|
|
33
|
+
width: number;
|
|
34
|
+
};
|
|
35
|
+
/** Update terminal dimensions (called on SIGWINCH). */
|
|
36
|
+
resize(width: number, height: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Callbacks fired on every frame after React paints the buffer but before
|
|
39
|
+
* the Rust diff engine flushes to stdout. Use for direct buffer painting
|
|
40
|
+
* that needs to overlay React output (animated graphs, overlays, FPS counters).
|
|
41
|
+
* Multiple listeners are supported — they fire in registration order.
|
|
42
|
+
*/
|
|
43
|
+
private beforeFlushListeners;
|
|
44
|
+
onBeforeFlush(function_: (buffer: Uint32Array, width: number, height: number) => void): () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Layout + paint synchronously. Called from the render loop on every dirty frame,
|
|
47
|
+
* and directly on resize for immediate response.
|
|
48
|
+
*/
|
|
49
|
+
paintNow(calculateLayout: (w: number, h: number) => void, renderToBuffer: (buf: Uint32Array, w: number, h: number) => void): void;
|
|
50
|
+
}
|
|
51
|
+
interface InlineOptions {
|
|
52
|
+
/** Frames per second. Default: 60 */
|
|
53
|
+
fps?: number;
|
|
54
|
+
/**
|
|
55
|
+
* What to do with the rendered content when the loop stops.
|
|
56
|
+
* - 'preserve' (default) — content stays in terminal scrollback
|
|
57
|
+
* - 'destroy' — content is cleared, terminal looks untouched
|
|
58
|
+
*/
|
|
59
|
+
onExit?: "preserve" | "destroy";
|
|
60
|
+
/** Number of terminal rows to reserve. Default: 10 */
|
|
61
|
+
rows?: number;
|
|
62
|
+
}
|
|
63
|
+
type InlinePaintFn = (buf: Uint32Array, cols: number, rows: number, frame: number) => void;
|
|
64
|
+
interface InlineLoop {
|
|
65
|
+
start: () => void;
|
|
66
|
+
stop: () => void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Create an inline render loop. Renders `rows` lines immediately below the
|
|
70
|
+
* current cursor position (no alternate screen).
|
|
71
|
+
*/
|
|
72
|
+
declare function createInlineLoop(paint: InlinePaintFn, options?: InlineOptions): InlineLoop;
|
|
73
|
+
interface MouseEvent {
|
|
74
|
+
button: "left" | "right" | "middle" | "scrollUp" | "scrollDown";
|
|
75
|
+
ctrl: boolean;
|
|
76
|
+
meta: boolean;
|
|
77
|
+
shift: boolean;
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
}
|
|
81
|
+
declare class InputParser extends EventEmitter {
|
|
82
|
+
private stdin;
|
|
83
|
+
private _boundHandleData;
|
|
84
|
+
private _pasteBuffer;
|
|
85
|
+
constructor(stdin: NodeJS.ReadStream);
|
|
86
|
+
start(): void;
|
|
87
|
+
stop(): void;
|
|
88
|
+
private handleData;
|
|
89
|
+
}
|
|
90
|
+
export { InlineLoop as I, MouseEvent as M, TuiApp as T, InlineOptions as a, InlinePaintFn as b, InputParser as c, createInlineLoop as d };
|