@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,15 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import type { Props as BoxProps } from "../box.d.ts";
|
|
3
|
-
interface ScrollBarBoxProps extends BoxProps {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
contentHeight: number;
|
|
6
|
-
scrollBarAutoHide?: boolean;
|
|
7
|
-
scrollBarPosition?: "left" | "right";
|
|
8
|
-
scrollOffset: number;
|
|
9
|
-
thumbChar?: string;
|
|
10
|
-
viewportHeight: number;
|
|
11
|
-
}
|
|
12
|
-
declare const ScrollBarBox: ({ borderColor, borderDimColor, borderLeftColor, borderLeftDimColor, borderRightColor, borderRightDimColor, borderStyle, children, contentHeight, height, scrollBarAutoHide, scrollBarPosition, scrollOffset, thumbChar, viewportHeight, ...boxProps }: ScrollBarBoxProps) => React.JSX.Element;
|
|
13
|
-
export type { ScrollBarBoxProps };
|
|
14
|
-
export { ScrollBarBox };
|
|
15
|
-
export default ScrollBarBox;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Props as BoxProps } from "../box.d.ts";
|
|
3
|
-
type ScrollBarPlacement = "inset" | "left" | "right";
|
|
4
|
-
type ScrollBarStyle = BoxProps["borderStyle"] | "block" | "line" | "thick" | "dots";
|
|
5
|
-
interface ScrollBarProps {
|
|
6
|
-
autoHide?: boolean;
|
|
7
|
-
color?: string;
|
|
8
|
-
contentHeight: number;
|
|
9
|
-
dimColor?: boolean;
|
|
10
|
-
placement?: ScrollBarPlacement;
|
|
11
|
-
scrollOffset: number;
|
|
12
|
-
style?: ScrollBarStyle;
|
|
13
|
-
thumbChar?: string;
|
|
14
|
-
trackChar?: string;
|
|
15
|
-
viewportHeight: number;
|
|
16
|
-
}
|
|
17
|
-
declare const ScrollBar: React.FC<ScrollBarProps>;
|
|
18
|
-
export type { ScrollBarPlacement, ScrollBarProps, ScrollBarStyle };
|
|
19
|
-
export { ScrollBar };
|
|
20
|
-
export default ScrollBar;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import type { Ref } from "react";
|
|
3
|
-
import type { ScrollViewProps, ScrollViewRef } from "./scroll-view.d.ts";
|
|
4
|
-
export type ScrollAlignment = "auto" | "bottom" | "center" | "top";
|
|
5
|
-
export interface ScrollListProps extends ScrollViewProps {
|
|
6
|
-
readonly scrollAlignment?: ScrollAlignment;
|
|
7
|
-
readonly selectedIndex?: number;
|
|
8
|
-
}
|
|
9
|
-
export type ScrollListRef = ScrollViewRef;
|
|
10
|
-
export declare const ScrollList: (props: ScrollListProps & {
|
|
11
|
-
ref?: Ref<ScrollListRef>;
|
|
12
|
-
}) => React.JSX.Element;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
import type { ReactNode, Ref } from "react";
|
|
3
|
-
import type { Props as BoxProps } from "../box.d.ts";
|
|
4
|
-
export interface ScrollViewProps extends BoxProps {
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
debug?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Auto-scroll to bottom when content grows and user is at/near the bottom.
|
|
9
|
-
* Pauses when user scrolls away from bottom; resumes when they return.
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
followOutput?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Number of lines from bottom that still counts as "at bottom" for followOutput.
|
|
15
|
-
* @default 3
|
|
16
|
-
*/
|
|
17
|
-
followThreshold?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Enable built-in keyboard navigation (arrows, page up/down, home/end, ctrl+u/d).
|
|
20
|
-
* When enabled, the component becomes focusable.
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
keyboard?: boolean;
|
|
24
|
-
onContentHeightChange?: (height: number, previousHeight: number) => void;
|
|
25
|
-
onItemHeightChange?: (index: number, height: number, previousHeight: number) => void;
|
|
26
|
-
/**
|
|
27
|
-
* Fires when scrolled within `reachThreshold` lines of the end.
|
|
28
|
-
* Only fires once per entry into the threshold zone.
|
|
29
|
-
*/
|
|
30
|
-
onReachEnd?: () => void;
|
|
31
|
-
/**
|
|
32
|
-
* Fires when scrolled within `reachThreshold` lines of the start.
|
|
33
|
-
* Only fires once per entry into the threshold zone.
|
|
34
|
-
*/
|
|
35
|
-
onReachStart?: () => void;
|
|
36
|
-
onScroll?: (scrollOffset: number) => void;
|
|
37
|
-
onViewportSizeChange?: (size: {
|
|
38
|
-
height: number;
|
|
39
|
-
width: number;
|
|
40
|
-
}, previousSize: {
|
|
41
|
-
height: number;
|
|
42
|
-
width: number;
|
|
43
|
-
}) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Number of extra items to render above/below the viewport when virtualized.
|
|
46
|
-
* @default 3
|
|
47
|
-
*/
|
|
48
|
-
overscan?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Distance in lines from the edge to trigger onReachEnd/onReachStart.
|
|
51
|
-
* @default 5
|
|
52
|
-
*/
|
|
53
|
-
reachThreshold?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Show a scrollbar track when content overflows the viewport.
|
|
56
|
-
* @default false
|
|
57
|
-
*/
|
|
58
|
-
scrollbar?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Color of the scrollbar thumb and track.
|
|
61
|
-
*/
|
|
62
|
-
scrollbarColor?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Scrollbar visual style.
|
|
65
|
-
* @default "line"
|
|
66
|
-
*/
|
|
67
|
-
scrollbarStyle?: "arrow" | "block" | "bold" | "classic" | "dots" | "double" | "doubleSingle" | "line" | "round" | "single" | "singleDouble" | "thick";
|
|
68
|
-
/**
|
|
69
|
-
* Enable vim-style keybindings (j/k/g/G/u/d). Requires `keyboard` to be true.
|
|
70
|
-
* @default false
|
|
71
|
-
*/
|
|
72
|
-
vimBindings?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Only render items visible in the viewport plus overscan. Requires items to be measured first.
|
|
75
|
-
* @default false
|
|
76
|
-
*/
|
|
77
|
-
virtualize?: boolean;
|
|
78
|
-
}
|
|
79
|
-
export interface ScrollViewRef {
|
|
80
|
-
getBottomOffset: () => number;
|
|
81
|
-
getContentHeight: () => number;
|
|
82
|
-
getItemHeight: (index: number) => number;
|
|
83
|
-
getItemPosition: (index: number) => {
|
|
84
|
-
height: number;
|
|
85
|
-
top: number;
|
|
86
|
-
} | null;
|
|
87
|
-
getScrollOffset: () => number;
|
|
88
|
-
getViewportHeight: () => number;
|
|
89
|
-
remeasure: () => void;
|
|
90
|
-
remeasureItem: (index: number) => void;
|
|
91
|
-
scrollBy: (delta: number) => void;
|
|
92
|
-
scrollTo: (offset: number) => void;
|
|
93
|
-
scrollToBottom: () => void;
|
|
94
|
-
scrollToTop: () => void;
|
|
95
|
-
}
|
|
96
|
-
export declare const ScrollView: ({ children, debug, followOutput, followThreshold, keyboard, onContentHeightChange, onItemHeightChange, onReachEnd, onReachStart, onScroll, onViewportSizeChange, overscan, reachThreshold, ref, scrollbar, scrollbarColor, scrollbarStyle: scrollbarStyleProp, vimBindings, virtualize, ...boxProps }: ScrollViewProps & {
|
|
97
|
-
ref?: Ref<ScrollViewRef>;
|
|
98
|
-
}) => React.JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Hook to manage state with immediate ref synchronization.
|
|
4
|
-
* Useful for values that need to be read synchronously in imperative methods
|
|
5
|
-
* but also trigger re-renders when changed.
|
|
6
|
-
*/
|
|
7
|
-
declare const useStateRef: <T>(initialValue: T) => readonly [T, (update: React.SetStateAction<T>) => void, () => T];
|
|
8
|
-
export default useStateRef;
|
|
@@ -1,46 +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 Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Color of the accent elements (border, icon).
|
|
7
|
-
* @default "blue"
|
|
8
|
-
*/
|
|
9
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
-
/**
|
|
11
|
-
* Initial value.
|
|
12
|
-
*/
|
|
13
|
-
readonly defaultValue?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Optional icon rendered before the input.
|
|
16
|
-
* @default "⌕"
|
|
17
|
-
*/
|
|
18
|
-
readonly icon?: ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Disable the input.
|
|
21
|
-
*/
|
|
22
|
-
readonly isDisabled?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Fired whenever the value changes.
|
|
25
|
-
*/
|
|
26
|
-
readonly onChange?: (value: string) => void;
|
|
27
|
-
/**
|
|
28
|
-
* Fired when the user presses Enter.
|
|
29
|
-
*/
|
|
30
|
-
readonly onSubmit?: (value: string) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Placeholder text shown when the input is empty.
|
|
33
|
-
* @default "Search..."
|
|
34
|
-
*/
|
|
35
|
-
readonly placeholder?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Autocomplete suggestions.
|
|
38
|
-
*/
|
|
39
|
-
readonly suggestions?: ReadonlyArray<string>;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Search-styled text input with an icon and bordered container.
|
|
43
|
-
* @param props See {@link Props}.
|
|
44
|
-
* @returns A `ReactElement` wrapping `TextInput` with an icon column.
|
|
45
|
-
*/
|
|
46
|
-
export default function SearchInput({ accentColor, defaultValue, icon, isDisabled, onChange, onSubmit, placeholder, suggestions, }: Props): ReactElement;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default indicator component for SelectInput.
|
|
3
|
-
*
|
|
4
|
-
* Based on ink-select-input by Vadim Demedes.
|
|
5
|
-
* @see https://github.com/vadimdemedes/ink-select-input
|
|
6
|
-
*
|
|
7
|
-
* MIT License
|
|
8
|
-
* Copyright (c) Vadym Demedes (github.com/vadimdemedes)
|
|
9
|
-
*/
|
|
10
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
11
|
-
import type { ReactElement } from "react";
|
|
12
|
-
import type { LiteralUnion } from "type-fest";
|
|
13
|
-
export type Props = {
|
|
14
|
-
/**
|
|
15
|
-
* Color of the indicator when selected.
|
|
16
|
-
* @default "blue"
|
|
17
|
-
*/
|
|
18
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
19
|
-
/**
|
|
20
|
-
* Whether the parent SelectInput has focus.
|
|
21
|
-
* When `false`, the indicator is dimmed even if the item is selected.
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
readonly isFocused?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Whether this indicator's item is currently selected.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
readonly isSelected?: boolean;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Renders a pointer indicator next to the selected item, or a blank space otherwise.
|
|
33
|
-
* When unfocused, the indicator is rendered with `dimColor` to visually distinguish
|
|
34
|
-
* the active select input from inactive ones.
|
|
35
|
-
*/
|
|
36
|
-
export default function SelectInputIndicator({ accentColor, isFocused, isSelected }: Props): ReactElement;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default item component for SelectInput.
|
|
3
|
-
*
|
|
4
|
-
* Based on ink-select-input by Vadim Demedes.
|
|
5
|
-
* @see https://github.com/vadimdemedes/ink-select-input
|
|
6
|
-
*
|
|
7
|
-
* MIT License
|
|
8
|
-
* Copyright (c) Vadym Demedes (github.com/vadimdemedes)
|
|
9
|
-
*/
|
|
10
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
11
|
-
import type { ReactElement } from "react";
|
|
12
|
-
import type { LiteralUnion } from "type-fest";
|
|
13
|
-
export type Props = {
|
|
14
|
-
/**
|
|
15
|
-
* Color of the label when selected.
|
|
16
|
-
* @default "blue"
|
|
17
|
-
*/
|
|
18
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
19
|
-
/**
|
|
20
|
-
* Color of the label when not selected.
|
|
21
|
-
*/
|
|
22
|
-
readonly defaultColor?: LiteralUnion<AnsiColors, string>;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the parent SelectInput has focus.
|
|
25
|
-
* When `false`, the selected item is dimmed.
|
|
26
|
-
* @default true
|
|
27
|
-
*/
|
|
28
|
-
readonly isFocused?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Whether this item is currently selected.
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
readonly isSelected?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Text label to display for this item.
|
|
36
|
-
*/
|
|
37
|
-
readonly label: string;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Renders an item label, using `accentColor` when selected and `defaultColor` otherwise.
|
|
41
|
-
* When unfocused, selected items are rendered with `dimColor`.
|
|
42
|
-
*/
|
|
43
|
-
export default function SelectInputItem({ accentColor, defaultColor, isFocused, isSelected, label }: Props): ReactElement;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
2
|
-
import type { FC, ReactElement } from "react";
|
|
3
|
-
import type { LiteralUnion } from "type-fest";
|
|
4
|
-
import type { Props as IndicatorProps } from "./select-input-indicator.d.ts";
|
|
5
|
-
import type { Props as ItemProps } from "./select-input-item.d.ts";
|
|
6
|
-
export type Item<V> = {
|
|
7
|
-
/**
|
|
8
|
-
* Called automatically when this item is selected (via Enter or number key).
|
|
9
|
-
* Fires after `onSelect`. Useful for defining per-item behavior inline.
|
|
10
|
-
*/
|
|
11
|
-
readonly action?: () => void;
|
|
12
|
-
readonly key?: string;
|
|
13
|
-
readonly label: string;
|
|
14
|
-
readonly value: V;
|
|
15
|
-
};
|
|
16
|
-
export type SeparatorItem = {
|
|
17
|
-
/**
|
|
18
|
-
* Marks this entry as a non-focusable separator line.
|
|
19
|
-
*/
|
|
20
|
-
readonly isSeparator: true;
|
|
21
|
-
readonly key?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Custom separator text. Defaults to `"───"`.
|
|
24
|
-
*/
|
|
25
|
-
readonly label?: string;
|
|
26
|
-
};
|
|
27
|
-
export type SelectInputEntry<V> = Item<V> | SeparatorItem;
|
|
28
|
-
export type Props<V> = {
|
|
29
|
-
/**
|
|
30
|
-
* Color used for the selected item and indicator.
|
|
31
|
-
* @default "blue"
|
|
32
|
-
*/
|
|
33
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
34
|
-
/**
|
|
35
|
-
* Color used for unselected items.
|
|
36
|
-
*/
|
|
37
|
-
readonly defaultColor?: LiteralUnion<AnsiColors, string>;
|
|
38
|
-
/**
|
|
39
|
-
* Controlled selected index. When provided, the component becomes controlled
|
|
40
|
-
* and `initialIndex` is ignored. Update this value in the `onHighlight` callback
|
|
41
|
-
* to track selection externally. If the index points to a separator, the nearest
|
|
42
|
-
* selectable item is highlighted instead.
|
|
43
|
-
*/
|
|
44
|
-
readonly index?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Custom component to override the default indicator component.
|
|
47
|
-
*/
|
|
48
|
-
readonly indicatorComponent?: FC<IndicatorProps>;
|
|
49
|
-
/**
|
|
50
|
-
* Index of initially-selected item in `items` array.
|
|
51
|
-
* Ignored when `index` is provided.
|
|
52
|
-
* When omitted (`undefined`), no item is highlighted until the user presses a key.
|
|
53
|
-
* If the index points to a separator, the nearest selectable item is used.
|
|
54
|
-
*/
|
|
55
|
-
readonly initialIndex?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Whether the input is focused. Useful for when there are multiple
|
|
58
|
-
* inputs on the screen and you need to control which one captures input.
|
|
59
|
-
* @default true
|
|
60
|
-
*/
|
|
61
|
-
readonly isFocused?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Custom component to override the default item component.
|
|
64
|
-
*/
|
|
65
|
-
readonly itemComponent?: FC<ItemProps>;
|
|
66
|
-
/** @default [] */
|
|
67
|
-
readonly items?: ReadonlyArray<SelectInputEntry<V>>;
|
|
68
|
-
/**
|
|
69
|
-
* Number of visible items. Useful if the list is long and you want
|
|
70
|
-
* to limit the display with a scrolling window.
|
|
71
|
-
*/
|
|
72
|
-
readonly limit?: number;
|
|
73
|
-
/**
|
|
74
|
-
* Called when the user highlights a new item via arrow keys or `j`/`k`.
|
|
75
|
-
* The second argument is the index of the highlighted item in the visible list.
|
|
76
|
-
*/
|
|
77
|
-
readonly onHighlight?: (item: Item<V>, index: number) => void;
|
|
78
|
-
/**
|
|
79
|
-
* Called when the user selects an item via Enter or a number key (1-9).
|
|
80
|
-
*/
|
|
81
|
-
readonly onSelect?: (item: Item<V>) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Whether to reset the selection when items change.
|
|
84
|
-
* Set to `false` to preserve the current selection across item updates.
|
|
85
|
-
* @default true
|
|
86
|
-
*/
|
|
87
|
-
readonly resetOnItemsChange?: boolean;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* A select input component for terminal UIs.
|
|
91
|
-
*
|
|
92
|
-
* Renders a list of items with an indicator showing the currently highlighted item.
|
|
93
|
-
* Users can navigate with arrow keys or `j`/`k`, select with Enter, or jump to an
|
|
94
|
-
* item by pressing a number key (1-9).
|
|
95
|
-
*/
|
|
96
|
-
export default function SelectInput<V>({ accentColor, defaultColor, index, indicatorComponent, initialIndex, isFocused, itemComponent, items, limit: customLimit, onHighlight, onSelect, resetOnItemsChange, }: Props<V>): ReactElement;
|
|
@@ -1,39 +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
|
-
* Width of the highlighted band in characters.
|
|
7
|
-
* @default 3
|
|
8
|
-
*/
|
|
9
|
-
readonly bandWidth?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Base color of the non-highlighted text.
|
|
12
|
-
*/
|
|
13
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
14
|
-
/**
|
|
15
|
-
* Highlight color of the sweeping band.
|
|
16
|
-
* @default "white"
|
|
17
|
-
*/
|
|
18
|
-
readonly highlightColor?: LiteralUnion<AnsiColors, string>;
|
|
19
|
-
/**
|
|
20
|
-
* Milliseconds between frames of the shimmer.
|
|
21
|
-
* @default 60
|
|
22
|
-
*/
|
|
23
|
-
readonly interval?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Text to render with a shimmer sweep.
|
|
26
|
-
*/
|
|
27
|
-
readonly text: string;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Text with an animated highlight band that sweeps across the characters.
|
|
31
|
-
* Perfect for "generating…" states.
|
|
32
|
-
* @param props.bandWidth Number of characters in the bright band.
|
|
33
|
-
* @param props.color Color applied to characters outside the band.
|
|
34
|
-
* @param props.highlightColor Color applied to characters inside the band.
|
|
35
|
-
* @param props.interval Milliseconds between frames.
|
|
36
|
-
* @param props.text Content to shimmer.
|
|
37
|
-
* @returns A single `Text` element composed of per-character `Text` children.
|
|
38
|
-
*/
|
|
39
|
-
export default function ShimmerText({ bandWidth, color, highlightColor, interval, text }: Props): ReactElement;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slider component for Ink.
|
|
3
|
-
*
|
|
4
|
-
* A keyboard-driven range input for terminal UIs, supporting
|
|
5
|
-
* horizontal and vertical orientations.
|
|
6
|
-
*/
|
|
7
|
-
import type { AnsiColors } from "@visulima/colorize";
|
|
8
|
-
import type { ReactElement } from "react";
|
|
9
|
-
import type { LiteralUnion } from "type-fest";
|
|
10
|
-
export type Props = {
|
|
11
|
-
/**
|
|
12
|
-
* Accent color for the filled portion of the track and thumb.
|
|
13
|
-
* @default "green"
|
|
14
|
-
*/
|
|
15
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
16
|
-
/**
|
|
17
|
-
* Color for the empty portion of the track.
|
|
18
|
-
* @default "gray"
|
|
19
|
-
*/
|
|
20
|
-
readonly defaultColor?: LiteralUnion<AnsiColors, string>;
|
|
21
|
-
/**
|
|
22
|
-
* Initial value when uncontrolled.
|
|
23
|
-
* @default 0
|
|
24
|
-
*/
|
|
25
|
-
readonly defaultValue?: number;
|
|
26
|
-
/**
|
|
27
|
-
* Character used for the empty portion of the track.
|
|
28
|
-
* @default "░"
|
|
29
|
-
*/
|
|
30
|
-
readonly emptyCharacter?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Character used for the filled portion of the track.
|
|
33
|
-
* @default "█"
|
|
34
|
-
*/
|
|
35
|
-
readonly filledCharacter?: string;
|
|
36
|
-
/**
|
|
37
|
-
* When true, all input is ignored and the slider is dimmed.
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
readonly isDisabled?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* When true, the component responds to keyboard input.
|
|
43
|
-
* @default true
|
|
44
|
-
*/
|
|
45
|
-
readonly isFocused?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Maximum value.
|
|
48
|
-
* @default 100
|
|
49
|
-
*/
|
|
50
|
-
readonly max?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Minimum value.
|
|
53
|
-
* @default 0
|
|
54
|
-
*/
|
|
55
|
-
readonly min?: number;
|
|
56
|
-
/**
|
|
57
|
-
* Fires whenever the value changes.
|
|
58
|
-
*/
|
|
59
|
-
readonly onChange?: (value: number) => void;
|
|
60
|
-
/**
|
|
61
|
-
* Layout direction of the slider.
|
|
62
|
-
* @default "horizontal"
|
|
63
|
-
*/
|
|
64
|
-
readonly orientation?: "horizontal" | "vertical";
|
|
65
|
-
/**
|
|
66
|
-
* Increment size for arrow key presses.
|
|
67
|
-
* @default 1
|
|
68
|
-
*/
|
|
69
|
-
readonly step?: number;
|
|
70
|
-
/**
|
|
71
|
-
* Character used to indicate the current position.
|
|
72
|
-
* @default "●"
|
|
73
|
-
*/
|
|
74
|
-
readonly thumbCharacter?: string;
|
|
75
|
-
/**
|
|
76
|
-
* Controlled value. When provided, `defaultValue` is ignored.
|
|
77
|
-
*/
|
|
78
|
-
readonly value?: number;
|
|
79
|
-
/**
|
|
80
|
-
* Width of the slider track in columns (horizontal) or rows (vertical).
|
|
81
|
-
* @default 20
|
|
82
|
-
*/
|
|
83
|
-
readonly width?: number;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* A keyboard-driven slider / range input.
|
|
87
|
-
*
|
|
88
|
-
* ```tsx
|
|
89
|
-
* <Slider defaultValue={50} min={0} max={100} onChange={setValue} />
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
export default function Slider({ accentColor, defaultColor, defaultValue, emptyCharacter, filledCharacter, isDisabled, isFocused, max, min, onChange, orientation, step, thumbCharacter, value: controlledValue, width, }: Props): ReactElement;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* A flexible space that expands along the major axis of its containing layout.
|
|
4
|
-
*
|
|
5
|
-
* It's useful as a shortcut for filling all the available space between elements.
|
|
6
|
-
*/
|
|
7
|
-
export default function Spacer(): ReactElement;
|
|
@@ -1,30 +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
|
-
* Color applied to the chart glyphs.
|
|
7
|
-
*/
|
|
8
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
9
|
-
/**
|
|
10
|
-
* Data points to plot. Values may be any real numbers.
|
|
11
|
-
*/
|
|
12
|
-
readonly data: ReadonlyArray<number>;
|
|
13
|
-
/**
|
|
14
|
-
* Optional fixed maximum for the vertical scale.
|
|
15
|
-
* When omitted the maximum data value is used.
|
|
16
|
-
*/
|
|
17
|
-
readonly max?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Optional fixed minimum for the vertical scale.
|
|
20
|
-
* When omitted the minimum data value is used.
|
|
21
|
-
*/
|
|
22
|
-
readonly min?: number;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Inline bar chart using Unicode block glyphs.
|
|
26
|
-
* @param props See {@link Props}.
|
|
27
|
-
* @returns A `ReactElement` containing the glyph string, or `null` when
|
|
28
|
-
* `data` is empty.
|
|
29
|
-
*/
|
|
30
|
-
export default function Sparkline({ color, data, max, min }: Props): ReactElement | null;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Spinner component for Ink.
|
|
3
|
-
*
|
|
4
|
-
* Based on ink-spinner by Vadim Demedes.
|
|
5
|
-
* @see https://github.com/vadimdemedes/ink-spinner
|
|
6
|
-
*
|
|
7
|
-
* MIT License
|
|
8
|
-
* Copyright (c) Vadym Demedes (github.com/vadimdemedes)
|
|
9
|
-
*
|
|
10
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
11
|
-
* this software and associated documentation files (the "Software"), to deal in the
|
|
12
|
-
* Software without restriction, including without limitation the rights to use, copy,
|
|
13
|
-
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
|
14
|
-
* and to permit persons to whom the Software is furnished to do so, subject to the
|
|
15
|
-
* following conditions:
|
|
16
|
-
*
|
|
17
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
* copies or substantial portions of the Software.
|
|
19
|
-
*
|
|
20
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
21
|
-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
22
|
-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
23
|
-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
24
|
-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
25
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
import type { SpinnerName } from "@visulima/spinner";
|
|
28
|
-
import type { ReactElement } from "react";
|
|
29
|
-
export type Props = {
|
|
30
|
-
/**
|
|
31
|
-
* Type of a spinner.
|
|
32
|
-
* Accepts any preset from `@visulima/spinner` (cli-spinners + custom frame sets).
|
|
33
|
-
* @default "dots"
|
|
34
|
-
*/
|
|
35
|
-
readonly type?: SpinnerName;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Spinner component that renders an animated loading indicator.
|
|
39
|
-
*/
|
|
40
|
-
export default function Spinner({ type }: Props): ReactElement;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StaticRender component — pre-renders children once and caches the result.
|
|
3
|
-
*
|
|
4
|
-
* When mounted, StaticRender renders its children into a Region via
|
|
5
|
-
* prepareYogaTree() in the Ink layout phase, then caches the result on the
|
|
6
|
-
* DOM node. On subsequent renders, the cached Region is composited directly
|
|
7
|
-
* via addRegionTree(), skipping the entire subtree traversal.
|
|
8
|
-
*
|
|
9
|
-
* Children are passed as a render function `() => ReactNode`. Once the cache
|
|
10
|
-
* is ready, the component stops calling the function so React does not
|
|
11
|
-
* re-reconcile the subtree on subsequent renders.
|
|
12
|
-
*
|
|
13
|
-
* Re-rendering the cached content is controlled via the `deps` prop (similar
|
|
14
|
-
* to React's hook deps). When `deps` changes, the cache is invalidated and
|
|
15
|
-
* `children()` is invoked again. If `deps` is omitted, the cache is
|
|
16
|
-
* invalidated whenever the `children` function reference changes.
|
|
17
|
-
*
|
|
18
|
-
* Use this for content that renders once and doesn't change (e.g., completed
|
|
19
|
-
* task output, logged messages, static headers).
|
|
20
|
-
*
|
|
21
|
-
* Ported from jacob314/ink (Google LLC, Apache-2.0).
|
|
22
|
-
* @license Apache-2.0
|
|
23
|
-
*/
|
|
24
|
-
import type { DependencyList, ReactNode } from "react";
|
|
25
|
-
import React from "react";
|
|
26
|
-
import type { Styles } from "../styles.d.ts";
|
|
27
|
-
/**
|
|
28
|
-
* @property children Render function invoked once to produce the cached content.
|
|
29
|
-
* @property deps Dependencies that control when the static content is re-rendered. When any dependency changes (shallow, Object.is comparison), the cache is invalidated and children() is invoked again. If omitted, the cache is invalidated whenever the children function reference changes.
|
|
30
|
-
* @property style Optional style applied to the static-render container.
|
|
31
|
-
* @property width Optional fixed width for the cached region.
|
|
32
|
-
*/
|
|
33
|
-
export type Props = {
|
|
34
|
-
readonly children: () => ReactNode;
|
|
35
|
-
readonly deps?: DependencyList;
|
|
36
|
-
readonly style?: Styles;
|
|
37
|
-
readonly width?: number;
|
|
38
|
-
};
|
|
39
|
-
declare const StaticRender: ({ children, deps, style, width }: Props) => React.ReactNode;
|
|
40
|
-
export default StaticRender;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from "react";
|
|
2
|
-
import type { Styles } from "../styles.d.ts";
|
|
3
|
-
export type Props<T> = {
|
|
4
|
-
/**
|
|
5
|
-
* Function that is called to render every item in the `items` array. The first argument is the item itself, and the second argument is the index of that item in the `items` array. Note that a `key` must be assigned to the root component.
|
|
6
|
-
*/
|
|
7
|
-
readonly children: (item: T, index: number) => ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Array of items of any type to render using the function you pass as a component child.
|
|
10
|
-
*/
|
|
11
|
-
readonly items: T[];
|
|
12
|
-
/**
|
|
13
|
-
* Styles to apply to a container of child elements. See <Box> for supported properties.
|
|
14
|
-
*/
|
|
15
|
-
readonly style?: Styles;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* `<Static>` component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs—things that don't change after they're rendered (hence the name "Static").
|
|
19
|
-
*
|
|
20
|
-
* It's preferred to use `<Static>` for use cases like these when you can't know or control the number of items that need to be rendered.
|
|
21
|
-
*
|
|
22
|
-
* For example, [Tap](https://github.com/tapjs/node-tap) uses `<Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
|
|
23
|
-
*/
|
|
24
|
-
export default function Static<T>(props: Props<T>): ReactElement;
|