@visulima/tui 1.0.8 → 2.0.1
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 +4 -0
- package/LICENSE.md +54 -2444
- package/MIGRATION-GUIDE.md +164 -0
- package/README.md +15 -12
- package/dist/components/box.d.ts +26 -27
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/canvas.js +1 -1
- package/dist/components/cursor.d.ts +40 -46
- package/dist/components/error-boundary.d.ts +16 -0
- package/dist/components/error-boundary.js +1 -0
- package/dist/components/error-overview.d.ts +6 -0
- package/dist/components/error-overview.js +1 -0
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +10 -42
- package/dist/components/static.d.ts +13 -14
- package/dist/components/text.d.ts +34 -48
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -12
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +24 -0
- package/dist/ink/canvas/index.js +1 -0
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -34
- package/dist/ink/hooks/use-app.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +17 -18
- package/dist/ink/hooks/use-clipboard.d.ts +16 -16
- package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
- package/dist/ink/hooks/use-console-capture.d.ts +19 -19
- package/dist/ink/hooks/use-cursor.d.ts +7 -7
- package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
- package/dist/ink/hooks/use-focus.d.ts +14 -18
- package/dist/ink/hooks/use-form.d.ts +32 -32
- package/dist/ink/hooks/use-hotkey.d.ts +17 -17
- package/dist/ink/hooks/use-input.d.ts +92 -92
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-interval.d.ts +14 -14
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
- package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
- package/dist/ink/hooks/use-key-chord.d.ts +15 -15
- package/dist/ink/hooks/use-paste.d.ts +38 -38
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
- package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
- package/dist/ink/hooks/use-stderr.d.ts +6 -6
- package/dist/ink/hooks/use-stderr.js +1 -1
- package/dist/ink/hooks/use-stdin.d.ts +10 -10
- package/dist/ink/hooks/use-stdin.js +1 -1
- package/dist/ink/hooks/use-stdout.d.ts +6 -6
- package/dist/ink/hooks/use-stdout.js +1 -1
- package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
- package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
- package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +19 -20
- package/dist/ink/hooks/use-timeout.d.ts +11 -11
- package/dist/ink/hooks/use-timer.d.ts +19 -19
- package/dist/ink/hooks/use-window-size.d.ts +8 -8
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +110 -123
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +7 -8
- package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
- package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
- package/dist/ink/mouse/use-mouse.d.ts +1 -1
- package/dist/ink/mouse/use-on-mouse-click.d.ts +4 -5
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
- package/dist/ink/public/cursor.d.ts +47 -0
- package/dist/ink/public/cursor.js +1 -0
- package/dist/ink/public/dom.d.ts +6 -0
- package/dist/ink/public/dom.js +0 -0
- package/dist/ink/public/highlighter.d.ts +44 -0
- package/dist/ink/public/highlighter.js +1 -0
- package/dist/ink/public/input.d.ts +14 -0
- package/dist/ink/public/input.js +1 -0
- package/dist/ink/public/styles.d.ts +4 -0
- package/dist/ink/public/styles.js +0 -0
- package/dist/ink/public/utils.d.ts +5 -0
- package/dist/ink/public/utils.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-BxD3PYAN.js} +1 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
- package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
- package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
- package/dist/packem_shared/TuiApp-CCVaiKbf.js +1 -0
- package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/buffer.d-CttIC480.d.ts +67 -0
- package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
- package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
- package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
- package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
- package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
- package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
- package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-CLGlidfI.d.ts} +140 -154
- package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
- package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
- package/dist/packem_shared/input.d-Bb8pWHvp.d.ts +172 -0
- package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
- package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
- package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
- package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
- package/dist/packem_shared/render-CuCo-R-l.js +24 -0
- package/dist/packem_shared/{render-DFZ8NHlG.js → render-DtQd8qQq.js} +1 -1
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
- package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
- package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
- package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
- package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
- package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
- package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
- package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
- package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
- package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
- package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
- package/dist/react/index.d.ts +160 -179
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +152 -152
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +49 -384
- package/dist/components/accordion.d.ts +0 -59
- package/dist/components/accordion.js +0 -1
- package/dist/components/alert.d.ts +0 -26
- package/dist/components/alert.js +0 -1
- package/dist/components/animate-presence.d.ts +0 -18
- package/dist/components/animate-presence.js +0 -1
- package/dist/components/approval-prompt.d.ts +0 -65
- package/dist/components/approval-prompt.js +0 -1
- package/dist/components/area-chart.d.ts +0 -66
- package/dist/components/area-chart.js +0 -1
- package/dist/components/badge.d.ts +0 -22
- package/dist/components/badge.js +0 -1
- package/dist/components/bar-chart.d.ts +0 -67
- package/dist/components/bar-chart.js +0 -1
- package/dist/components/big-text.d.ts +0 -81
- package/dist/components/big-text.js +0 -1
- package/dist/components/blink-dot.d.ts +0 -36
- package/dist/components/blink-dot.js +0 -1
- package/dist/components/breadcrumb.d.ts +0 -33
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/button.d.ts +0 -45
- package/dist/components/button.js +0 -1
- package/dist/components/calendar.d.ts +0 -72
- package/dist/components/calendar.js +0 -1
- package/dist/components/card.d.ts +0 -57
- package/dist/components/card.js +0 -1
- package/dist/components/checkbox.d.ts +0 -48
- package/dist/components/checkbox.js +0 -1
- package/dist/components/code.d.ts +0 -48
- package/dist/components/code.js +0 -2
- package/dist/components/collapsible.d.ts +0 -53
- package/dist/components/collapsible.js +0 -1
- package/dist/components/command-block.d.ts +0 -47
- package/dist/components/command-block.js +0 -4
- package/dist/components/command-palette.d.ts +0 -82
- package/dist/components/command-palette.js +0 -1
- package/dist/components/confirm-dialog.d.ts +0 -75
- package/dist/components/confirm-dialog.js +0 -1
- package/dist/components/confirm-input.d.ts +0 -38
- package/dist/components/confirm-input.js +0 -1
- package/dist/components/console-overlay.d.ts +0 -54
- package/dist/components/console-overlay.js +0 -1
- package/dist/components/content-switcher.d.ts +0 -57
- package/dist/components/content-switcher.js +0 -1
- package/dist/components/controlled-scroll-view.d.ts +0 -61
- package/dist/components/controlled-scroll-view.js +0 -1
- package/dist/components/date-picker.d.ts +0 -65
- package/dist/components/date-picker.js +0 -1
- package/dist/components/definition-list.d.ts +0 -44
- package/dist/components/definition-list.js +0 -1
- package/dist/components/dialog.d.ts +0 -117
- package/dist/components/dialog.js +0 -1
- package/dist/components/diff-view.d.ts +0 -85
- package/dist/components/diff-view.js +0 -1
- package/dist/components/divider.d.ts +0 -49
- package/dist/components/divider.js +0 -1
- package/dist/components/file-picker-entry.d.ts +0 -104
- package/dist/components/file-picker-entry.js +0 -1
- package/dist/components/form.d.ts +0 -81
- package/dist/components/form.js +0 -1
- package/dist/components/gauge.d.ts +0 -87
- package/dist/components/gauge.js +0 -1
- package/dist/components/gradient.d.ts +0 -42
- package/dist/components/gradient.js +0 -1
- package/dist/components/heading.d.ts +0 -33
- package/dist/components/heading.js +0 -1
- package/dist/components/heatmap.d.ts +0 -62
- package/dist/components/heatmap.js +0 -1
- package/dist/components/help.d.ts +0 -52
- package/dist/components/help.js +0 -1
- package/dist/components/histogram.d.ts +0 -62
- package/dist/components/histogram.js +0 -1
- package/dist/components/kbd.d.ts +0 -31
- package/dist/components/kbd.js +0 -1
- package/dist/components/line-chart.d.ts +0 -109
- package/dist/components/line-chart.js +0 -1
- package/dist/components/link.d.ts +0 -38
- package/dist/components/link.js +0 -1
- package/dist/components/loading-indicator.d.ts +0 -29
- package/dist/components/loading-indicator.js +0 -1
- package/dist/components/markdown.d.ts +0 -40
- package/dist/components/markdown.js +0 -1
- package/dist/components/masked-input.d.ts +0 -50
- package/dist/components/masked-input.js +0 -1
- package/dist/components/menu.d.ts +0 -78
- package/dist/components/menu.js +0 -1
- package/dist/components/message-bubble.d.ts +0 -43
- package/dist/components/message-bubble.js +0 -1
- package/dist/components/model-badge.d.ts +0 -39
- package/dist/components/model-badge.js +0 -1
- package/dist/components/multi-select.d.ts +0 -65
- package/dist/components/multi-select.js +0 -1
- package/dist/components/operation-tree.d.ts +0 -49
- package/dist/components/operation-tree.js +0 -1
- package/dist/components/option-list.d.ts +0 -47
- package/dist/components/option-list.js +0 -1
- package/dist/components/ordered-list.d.ts +0 -24
- package/dist/components/ordered-list.js +0 -1
- package/dist/components/paginator.d.ts +0 -69
- package/dist/components/paginator.js +0 -1
- package/dist/components/paragraph.d.ts +0 -38
- package/dist/components/paragraph.js +0 -1
- package/dist/components/placeholder.d.ts +0 -55
- package/dist/components/placeholder.js +0 -1
- package/dist/components/progress-bar.d.ts +0 -56
- package/dist/components/progress-bar.js +0 -1
- package/dist/components/radio-group.d.ts +0 -74
- package/dist/components/radio-group.js +0 -1
- package/dist/components/scatter-plot.d.ts +0 -35
- package/dist/components/scatter-plot.js +0 -1
- package/dist/components/scroll-bar-box.d.ts +0 -37
- package/dist/components/scroll-bar-box.js +0 -1
- package/dist/components/scroll-bar.d.ts +0 -25
- package/dist/components/scroll-bar.js +0 -1
- package/dist/components/scroll-list.d.ts +0 -20
- package/dist/components/scroll-list.js +0 -1
- package/dist/components/scroll-view.d.ts +0 -10
- package/dist/components/scroll-view.js +0 -1
- package/dist/components/search-input.d.ts +0 -55
- package/dist/components/search-input.js +0 -1
- package/dist/components/select-input-indicator.d.ts +0 -32
- package/dist/components/select-input-indicator.js +0 -1
- package/dist/components/select-input-item.d.ts +0 -41
- package/dist/components/select-input-item.js +0 -1
- package/dist/components/select-input.d.ts +0 -110
- package/dist/components/select-input.js +0 -1
- package/dist/components/shimmer-text.d.ts +0 -47
- package/dist/components/shimmer-text.js +0 -1
- package/dist/components/slider.d.ts +0 -103
- package/dist/components/slider.js +0 -1
- package/dist/components/sparkline.d.ts +0 -35
- package/dist/components/sparkline.js +0 -1
- package/dist/components/spinner.d.ts +0 -17
- package/dist/components/spinner.js +0 -1
- package/dist/components/status-line.d.ts +0 -37
- package/dist/components/status-line.js +0 -1
- package/dist/components/status-message.d.ts +0 -21
- package/dist/components/status-message.js +0 -1
- package/dist/components/stepper.d.ts +0 -48
- package/dist/components/stepper.js +0 -1
- package/dist/components/stopwatch.d.ts +0 -49
- package/dist/components/stopwatch.js +0 -1
- package/dist/components/streaming-text.d.ts +0 -46
- package/dist/components/streaming-text.js +0 -1
- package/dist/components/switch.d.ts +0 -55
- package/dist/components/switch.js +0 -1
- package/dist/components/tab.d.ts +0 -19
- package/dist/components/tab.js +0 -1
- package/dist/components/table.d.ts +0 -119
- package/dist/components/table.js +0 -1
- package/dist/components/tabs.d.ts +0 -107
- package/dist/components/tabs.js +0 -1
- package/dist/components/tag.d.ts +0 -35
- package/dist/components/tag.js +0 -1
- package/dist/components/text-input.d.ts +0 -48
- package/dist/components/text-input.js +0 -1
- package/dist/components/textarea.d.ts +0 -68
- package/dist/components/textarea.js +0 -2
- package/dist/components/timer.d.ts +0 -59
- package/dist/components/timer.js +0 -1
- package/dist/components/toast.d.ts +0 -49
- package/dist/components/toast.js +0 -1
- package/dist/components/tooltip.d.ts +0 -43
- package/dist/components/tooltip.js +0 -1
- package/dist/components/transition.d.ts +0 -74
- package/dist/components/transition.js +0 -1
- package/dist/components/tree-view-entry.d.ts +0 -357
- package/dist/components/tree-view-entry.js +0 -1
- package/dist/components/unordered-list.d.ts +0 -30
- package/dist/components/unordered-list.js +0 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
- package/dist/ink/hooks/use-linked-scroll.js +0 -1
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
- package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +0 -39
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
- package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-CFyBVf7l.js +0 -1
- package/dist/packem_shared/render-CuQecTAs.js +0 -24
- package/dist/packem_shared/render.d-CBnYBDk2.d.ts +0 -417
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
- package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
- package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +0 -396
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
- package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
- package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
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
|
-
* @returns A `ReactElement` containing the glyph string, or `null` when
|
|
27
|
-
* `data` is empty.
|
|
28
|
-
*/
|
|
29
|
-
declare function Sparkline({
|
|
30
|
-
color,
|
|
31
|
-
data,
|
|
32
|
-
max,
|
|
33
|
-
min
|
|
34
|
-
}: Props): ReactElement | null;
|
|
35
|
-
export { Props, Sparkline, type Props as SparklineProps, Sparkline as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as f}from"react/jsx-runtime";import{useMemo as s}from"react";import{Text as c}from"./text.js";const e="▁▂▃▄▅▆▇█",I=(m,t,o)=>{if(o===0)return e[0];const r=(m-t)/o,n=Math.max(0,Math.min(e.length-1,Math.floor(r*e.length)));return e[n]},h=(m,t,o)=>{let r=t??Number.POSITIVE_INFINITY,n=o??Number.NEGATIVE_INFINITY;if(t===void 0||o===void 0)for(const i of m)t===void 0&&i<r&&(r=i),o===void 0&&i>n&&(n=i);return{max:n,min:r}};function p({color:m,data:t,max:o,min:r}){const n=s(()=>{if(t.length===0)return"";const{max:i,min:a}=h(t,r,o),l=i-a;return t.map(u=>I(u,a,l)).join("")},[t,r,o]);return n.length===0?null:f(c,{color:m,children:n})}export{p as Sparkline,p as default};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SpinnerName } from '@visulima/spinner';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
type Props = {
|
|
4
|
-
/**
|
|
5
|
-
* Type of a spinner.
|
|
6
|
-
* Accepts any preset from `@visulima/spinner` (cli-spinners + custom frame sets).
|
|
7
|
-
* @default "dots"
|
|
8
|
-
*/
|
|
9
|
-
readonly type?: SpinnerName;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Spinner component that renders an animated loading indicator.
|
|
13
|
-
*/
|
|
14
|
-
declare function Spinner({
|
|
15
|
-
type
|
|
16
|
-
}: Props): ReactElement;
|
|
17
|
-
export { Props, Spinner, type Props as SpinnerProps, Spinner as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import{getSpinner as e}from"@visulima/spinner";import m from"../ink/hooks/use-animation.js";import{Text as p}from"./text.js";function d({type:n="dots"}){const r=e(n)??e("dots"),t=r?.frames??[" "],{frame:o}=m({interval:r?.interval??80});return i(p,{children:t[o%t.length]})}export{d as Spinner,d as default};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Background color spanning the whole row.
|
|
7
|
-
*/
|
|
8
|
-
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
9
|
-
/**
|
|
10
|
-
* Content rendered in the center. Optional.
|
|
11
|
-
*/
|
|
12
|
-
readonly center?: ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Default foreground for text rendered inside the row.
|
|
15
|
-
*/
|
|
16
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Content rendered flush-left.
|
|
19
|
-
*/
|
|
20
|
-
readonly left?: ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* Content rendered flush-right.
|
|
23
|
-
*/
|
|
24
|
-
readonly right?: ReactNode;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Full-width status bar with left / center / right slots. Typically pinned to
|
|
28
|
-
* the bottom of the UI.
|
|
29
|
-
*/
|
|
30
|
-
declare function StatusLine({
|
|
31
|
-
backgroundColor,
|
|
32
|
-
center,
|
|
33
|
-
color,
|
|
34
|
-
left,
|
|
35
|
-
right
|
|
36
|
-
}: Props): ReactElement;
|
|
37
|
-
export { Props, StatusLine, type Props as StatusLineProps, StatusLine as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as l,jsx as t}from"react/jsx-runtime";import{Box as i}from"./box.js";import{Text as c}from"./text.js";const e=(r,o)=>{if(r!==void 0)return typeof r=="string"||typeof r=="number"?t(c,{color:o,children:r}):r};function u({backgroundColor:r,center:o,color:n,left:d,right:f}){return l(i,{backgroundColor:r,paddingX:1,width:"100%",children:[t(i,{flexGrow:1,flexShrink:1,minWidth:0,children:e(d,n)}),o===void 0?void 0:t(i,{flexGrow:0,flexShrink:0,justifyContent:"center",children:e(o,n)}),t(i,{flexGrow:1,flexShrink:1,justifyContent:"flex-end",minWidth:0,children:e(f,n)})]})}export{u as StatusLine,u as default};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { V as Variant } from "../packem_shared/variant-config.d-D5NnrrQK.js";
|
|
3
|
-
type StatusMessageVariant = Variant;
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Message content.
|
|
7
|
-
*/
|
|
8
|
-
readonly children: ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* Determines the icon and color of the status message.
|
|
11
|
-
*/
|
|
12
|
-
readonly variant: StatusMessageVariant;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Renders a status notification with a colored icon and message text.
|
|
16
|
-
*/
|
|
17
|
-
declare function StatusMessage({
|
|
18
|
-
children,
|
|
19
|
-
variant
|
|
20
|
-
}: Props): ReactElement;
|
|
21
|
-
export { Props, StatusMessage, type Props as StatusMessageProps, StatusMessageVariant, StatusMessage as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as n,jsx as o}from"react/jsx-runtime";import{Box as e}from"./box.js";import{Text as r}from"./text.js";import{o as c}from"../packem_shared/variant-config-BJqpNo7H.js";function d({children:s,variant:t}){const{color:a,icon:i}=c[t];return n(e,{gap:1,children:[o(r,{color:a,children:i}),o(r,{children:s})]})}export{d as StatusMessage,d as default};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type StepStatus = "active" | "completed" | "error" | "pending";
|
|
5
|
-
type StepperStep = {
|
|
6
|
-
readonly description?: string;
|
|
7
|
-
readonly key?: string;
|
|
8
|
-
readonly label: ReactNode;
|
|
9
|
-
readonly status?: StepStatus;
|
|
10
|
-
};
|
|
11
|
-
type Props = {
|
|
12
|
-
/**
|
|
13
|
-
* Color used for active and completed steps.
|
|
14
|
-
* @default "blue"
|
|
15
|
-
*/
|
|
16
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Index of the current step (used when steps do not provide a status).
|
|
19
|
-
* @default 0
|
|
20
|
-
*/
|
|
21
|
-
readonly activeIndex?: number;
|
|
22
|
-
/**
|
|
23
|
-
* Color used for errors.
|
|
24
|
-
* @default "red"
|
|
25
|
-
*/
|
|
26
|
-
readonly errorColor?: LiteralUnion<AnsiColors, string>;
|
|
27
|
-
/**
|
|
28
|
-
* Orientation of the stepper.
|
|
29
|
-
* @default "horizontal"
|
|
30
|
-
*/
|
|
31
|
-
readonly orientation?: "horizontal" | "vertical";
|
|
32
|
-
/**
|
|
33
|
-
* List of steps.
|
|
34
|
-
*/
|
|
35
|
-
readonly steps: ReadonlyArray<StepperStep>;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Step indicator for multi-stage flows.
|
|
39
|
-
* @returns A `ReactElement` rendering the steps horizontally or vertically.
|
|
40
|
-
*/
|
|
41
|
-
declare function Stepper({
|
|
42
|
-
accentColor,
|
|
43
|
-
activeIndex,
|
|
44
|
-
errorColor,
|
|
45
|
-
orientation,
|
|
46
|
-
steps
|
|
47
|
-
}: Props): ReactElement;
|
|
48
|
-
export { Props, StepStatus, Stepper, type Props as StepperProps, StepperStep, Stepper as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as i,jsxs as d}from"react/jsx-runtime";import{Fragment as v}from"react";import{Box as n}from"./box.js";import{Text as l}from"./text.js";const h={active:"●",completed:"✔",error:"✖",pending:"○"},u=(t,c,m)=>t.status!==void 0?t.status:c<m?"completed":c===m?"active":"pending";function k({accentColor:t="blue",activeIndex:c=0,errorColor:m="red",orientation:g="horizontal",steps:a}){return g==="vertical"?i(n,{flexDirection:"column",children:a.map((r,o)=>{const e=u(r,o,c),p=o===a.length-1,s=e==="error"?m:e==="pending"?void 0:t;return d(n,{flexDirection:"column",children:[d(n,{children:[d(l,{color:s,dimColor:e==="pending",children:[h[e]," "]}),i(l,{bold:e==="active",color:s,dimColor:e==="pending",children:r.label})]}),r.description===void 0?void 0:i(n,{marginLeft:2,children:i(l,{dimColor:!0,children:r.description})}),p?void 0:i(n,{marginLeft:0,children:i(l,{dimColor:!0,children:"│"})})]},r.key??o)})}):i(n,{children:a.map((r,o)=>{const e=u(r,o,c),p=e==="error"?m:e==="pending"?void 0:t,s=o===a.length-1;return d(v,{children:[d(n,{children:[d(l,{color:p,dimColor:e==="pending",children:[h[e]," "]}),i(l,{bold:e==="active",color:p,dimColor:e==="pending",children:r.label})]}),s?void 0:i(l,{dimColor:!0,children:" ── "})]},r.key??o)})})}export{k as Stepper,k as default};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Ref, ReactElement } from 'react';
|
|
2
|
-
import { UseStopwatchResult } from "../ink/hooks/use-stopwatch.js";
|
|
3
|
-
type StopwatchRef = Omit<UseStopwatchResult, "elapsed" | "isRunning" | "laps">;
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Whether to start counting immediately.
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
readonly autoStart?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Make the rendered text bold.
|
|
12
|
-
*/
|
|
13
|
-
readonly bold?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Text color for the rendered time.
|
|
16
|
-
*/
|
|
17
|
-
readonly color?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Custom formatter for the elapsed time.
|
|
20
|
-
* Receives elapsed milliseconds, returns a display string.
|
|
21
|
-
* @default formatDuration (MM:SS or HH:MM:SS)
|
|
22
|
-
*/
|
|
23
|
-
readonly format?: (elapsed: number) => string;
|
|
24
|
-
/**
|
|
25
|
-
* Tick interval in milliseconds.
|
|
26
|
-
* @default 1000
|
|
27
|
-
*/
|
|
28
|
-
readonly interval?: number;
|
|
29
|
-
readonly ref?: Ref<StopwatchRef>;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* A count-up stopwatch component.
|
|
33
|
-
*
|
|
34
|
-
* Exposes `start`, `stop`, `toggle`, `reset`, and `lap` methods via ref.
|
|
35
|
-
*
|
|
36
|
-
* ```tsx
|
|
37
|
-
* const ref = useRef<StopwatchRef>(null);
|
|
38
|
-
* <Stopwatch ref={ref} autoStart />
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
declare const Stopwatch: ({
|
|
42
|
-
autoStart,
|
|
43
|
-
bold,
|
|
44
|
-
color,
|
|
45
|
-
format,
|
|
46
|
-
interval,
|
|
47
|
-
ref
|
|
48
|
-
}: Props) => ReactElement;
|
|
49
|
-
export { Props, Stopwatch, type Props as StopwatchProps, StopwatchRef, Stopwatch as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as p}from"react/jsx-runtime";import{useImperativeHandle as m}from"react";import f from"../ink/hooks/use-stopwatch.js";import{f as i}from"../packem_shared/format-time-fjoQHMxD.js";import{Text as n}from"./text.js";const x=({autoStart:o,bold:r,color:a,format:e=i,interval:s,ref:l})=>{const t=f({autoStart:o,interval:s});return m(l,()=>({lap:t.lap,reset:t.reset,start:t.start,stop:t.stop,toggle:t.toggle}),[t.lap,t.reset,t.start,t.stop,t.toggle]),p(n,{bold:r,color:a,children:e(t.elapsed)})};export{x as Stopwatch,x as default};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Color applied to the streamed output.
|
|
7
|
-
*/
|
|
8
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
9
|
-
/**
|
|
10
|
-
* Glyph rendered at the streaming caret while characters are still being revealed.
|
|
11
|
-
* @default "▊" (left three quarters block)
|
|
12
|
-
*/
|
|
13
|
-
readonly cursor?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Milliseconds between characters.
|
|
16
|
-
* @default 20
|
|
17
|
-
*/
|
|
18
|
-
readonly interval?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Called exactly once per `text` value, after the full text has been revealed.
|
|
21
|
-
*/
|
|
22
|
-
readonly onComplete?: () => void;
|
|
23
|
-
/**
|
|
24
|
-
* Whether to display the cursor after streaming completes.
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
readonly showCursorWhenDone?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Full text to stream into the output.
|
|
30
|
-
*/
|
|
31
|
-
readonly text: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Typewriter animation that reveals text one character at a time.
|
|
35
|
-
* Automatically resets and replays when `text` changes. `onComplete`
|
|
36
|
-
* fires exactly once per `text` value once it is fully revealed.
|
|
37
|
-
*/
|
|
38
|
-
declare function StreamingText({
|
|
39
|
-
color,
|
|
40
|
-
cursor,
|
|
41
|
-
interval,
|
|
42
|
-
onComplete,
|
|
43
|
-
showCursorWhenDone,
|
|
44
|
-
text
|
|
45
|
-
}: Props): ReactElement;
|
|
46
|
-
export { Props, StreamingText, type Props as StreamingTextProps, StreamingText as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as g}from"react/jsx-runtime";import{useState as T,useRef as c,useEffect as l}from"react";import{Text as d}from"./text.js";function k({color:f,cursor:i="▊",interval:o=20,onComplete:n,showCursorWhenDone:a=!1,text:r}){const[t,s]=T(0),u=c(n),e=c(!1);u.current=n,l(()=>{s(0),e.current=!1},[r]),l(()=>{if(t>=r.length){e.current||(e.current=!0,u.current?.());return}const p=setTimeout(()=>{s(x=>Math.min(r.length,x+1))},o);return()=>{clearTimeout(p)}},[t,r,o]);const m=!(t>=r.length)||a,h=r.slice(0,t);return g(d,{color:f,children:[h,m?i:""]})}export{k as StreamingText,k as default};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Accent color for the on state.
|
|
7
|
-
* @default "green"
|
|
8
|
-
*/
|
|
9
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
-
/**
|
|
11
|
-
* Auto-focus when mounted if nothing else is focused.
|
|
12
|
-
*/
|
|
13
|
-
readonly autoFocus?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Optional label rendered after the switch.
|
|
16
|
-
*/
|
|
17
|
-
readonly children?: ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Initial value when uncontrolled.
|
|
20
|
-
*/
|
|
21
|
-
readonly defaultValue?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Disable input and dim the switch.
|
|
24
|
-
*/
|
|
25
|
-
readonly isDisabled?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Labels displayed inside the switch track.
|
|
28
|
-
* @default ["off", "on"]
|
|
29
|
-
*/
|
|
30
|
-
readonly labels?: readonly [string, string];
|
|
31
|
-
/**
|
|
32
|
-
* Fired when the switch is toggled.
|
|
33
|
-
*/
|
|
34
|
-
readonly onChange?: (value: boolean) => void;
|
|
35
|
-
/**
|
|
36
|
-
* Controlled value. Pair with `onChange` to update the parent.
|
|
37
|
-
*/
|
|
38
|
-
readonly value?: boolean;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Focusable on/off switch. Toggles with Space or Enter.
|
|
42
|
-
* @returns A `ReactElement` rendering two labeled segments plus an optional
|
|
43
|
-
* trailing label.
|
|
44
|
-
*/
|
|
45
|
-
declare function Switch({
|
|
46
|
-
accentColor,
|
|
47
|
-
autoFocus,
|
|
48
|
-
children,
|
|
49
|
-
defaultValue,
|
|
50
|
-
isDisabled,
|
|
51
|
-
labels,
|
|
52
|
-
onChange,
|
|
53
|
-
value
|
|
54
|
-
}: Props): ReactElement;
|
|
55
|
-
export { Props, Switch, type Props as SwitchProps, Switch as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as l,jsx as x}from"react/jsx-runtime";import{useState as F,useCallback as $}from"react";import j from"../ink/hooks/use-focus.js";import y from"../ink/hooks/use-input.js";import{Box as u}from"./box.js";import{Text as a}from"./text.js";const A=["off","on"];function V({accentColor:e="green",autoFocus:f=!1,children:n,defaultValue:m=!1,isDisabled:r=!1,labels:s=A,onChange:t,value:c}){const{isFocused:i}=j({autoFocus:f,isActive:!r}),[v,b]=F(m),o=c??v;y($((h,k)=>{if(i&&(k.return||h===" ")){const d=!o;c===void 0&&b(d),t?.(d)}},[i,o,c,t]),{isActive:!r&&i});const p=s[0],C=s[1],g=i?e:void 0;return l(u,{gap:1,children:[l(u,{gap:0,children:[l(a,{backgroundColor:o?void 0:"gray",color:o?void 0:"black",dimColor:r,children:[" ",p," "]}),l(a,{backgroundColor:o?e:void 0,color:o?"black":void 0,dimColor:r,children:[" ",C," "]})]}),n===void 0?void 0:x(a,{color:g,dimColor:r,children:n})]})}export{V as Switch,V as default};
|
package/dist/components/tab.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
type Props = {
|
|
3
|
-
/**
|
|
4
|
-
* Tab content to render when the tab is active.
|
|
5
|
-
*/
|
|
6
|
-
readonly children: ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
* Unique name identifying this tab.
|
|
9
|
-
*/
|
|
10
|
-
readonly name: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* A single tab within a Tabs container.
|
|
14
|
-
* The `name` prop identifies the tab; `children` is rendered when active.
|
|
15
|
-
*/
|
|
16
|
-
declare function Tab({
|
|
17
|
-
children
|
|
18
|
-
}: Props): ReactElement;
|
|
19
|
-
export { Props, Tab, type Props as TabProps, Tab as default };
|
package/dist/components/tab.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,Fragment as n}from"react/jsx-runtime";function a({children:r}){return e(n,{children:r})}export{a as Tab,a as default};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
interface BorderComponent {
|
|
3
|
-
char: string;
|
|
4
|
-
width: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Represents the style of the border for a table or grid.
|
|
8
|
-
*/
|
|
9
|
-
interface BorderStyle {
|
|
10
|
-
/** Box vertical character. */
|
|
11
|
-
bodyJoin: BorderComponent;
|
|
12
|
-
/** Box vertical character. */
|
|
13
|
-
bodyLeft: BorderComponent;
|
|
14
|
-
/** Box vertical character. */
|
|
15
|
-
bodyRight: BorderComponent;
|
|
16
|
-
/** Box horizontal character. */
|
|
17
|
-
bottomBody: BorderComponent;
|
|
18
|
-
/** Box bottom join character. */
|
|
19
|
-
bottomJoin: BorderComponent;
|
|
20
|
-
/** Box bottom left character. */
|
|
21
|
-
bottomLeft: BorderComponent;
|
|
22
|
-
/** Box bottom right character. */
|
|
23
|
-
bottomRight: BorderComponent;
|
|
24
|
-
/** Box horizontal character. */
|
|
25
|
-
joinBody: BorderComponent;
|
|
26
|
-
/** Box horizontal join character. */
|
|
27
|
-
joinJoin: BorderComponent;
|
|
28
|
-
/** Box left join character. */
|
|
29
|
-
joinLeft: BorderComponent;
|
|
30
|
-
/** Box right join character. */
|
|
31
|
-
joinRight: BorderComponent;
|
|
32
|
-
/** Box horizontal character. */
|
|
33
|
-
topBody: BorderComponent;
|
|
34
|
-
/** Box top join character. */
|
|
35
|
-
topJoin: BorderComponent;
|
|
36
|
-
/** Box top left character. */
|
|
37
|
-
topLeft: BorderComponent;
|
|
38
|
-
/** Box top right character. */
|
|
39
|
-
topRight: BorderComponent;
|
|
40
|
-
}
|
|
41
|
-
/** Base style properties applicable globally */
|
|
42
|
-
type HorizontalAlignment = "center" | "left" | "right";
|
|
43
|
-
/**
|
|
44
|
-
* Scalar value that can be displayed in a table cell.
|
|
45
|
-
*/
|
|
46
|
-
type Scalar = bigint | boolean | number | string | null | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Dictionary with scalar values, representing a single row of data.
|
|
49
|
-
*/
|
|
50
|
-
type ScalarDict = Record<string, Scalar>;
|
|
51
|
-
/**
|
|
52
|
-
* Configuration for a single table column.
|
|
53
|
-
*/
|
|
54
|
-
type ColumnConfig<T extends ScalarDict> = {
|
|
55
|
-
/**
|
|
56
|
-
* Horizontal alignment of cell content.
|
|
57
|
-
*/
|
|
58
|
-
readonly align?: HorizontalAlignment;
|
|
59
|
-
/**
|
|
60
|
-
* Custom header label. Defaults to the key name.
|
|
61
|
-
*/
|
|
62
|
-
readonly header?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Key from the data object to display in this column.
|
|
65
|
-
*/
|
|
66
|
-
readonly key: keyof T & string;
|
|
67
|
-
/**
|
|
68
|
-
* Fixed width for this column in characters.
|
|
69
|
-
*/
|
|
70
|
-
readonly width?: number;
|
|
71
|
-
};
|
|
72
|
-
type Props<T extends ScalarDict> = {
|
|
73
|
-
/**
|
|
74
|
-
* Border style preset name or a custom `BorderStyle` object from `@visulima/tabular`.
|
|
75
|
-
* @default "default"
|
|
76
|
-
*/
|
|
77
|
-
readonly borderStyle?: "ascii" | "block" | "default" | "dots" | "double" | "markdown" | "minimal" | "none" | "rounded" | "thick" | BorderStyle;
|
|
78
|
-
/**
|
|
79
|
-
* Columns to display and their order.
|
|
80
|
-
* Accepts simple key strings or `ColumnConfig` objects for advanced control.
|
|
81
|
-
* If omitted, all keys from the first data item are used.
|
|
82
|
-
*/
|
|
83
|
-
readonly columns?: ((keyof T & string) | ColumnConfig<T>)[];
|
|
84
|
-
/**
|
|
85
|
-
* Array of objects to display as rows.
|
|
86
|
-
*/
|
|
87
|
-
readonly data: T[];
|
|
88
|
-
/**
|
|
89
|
-
* Format a cell value before rendering. Return a string to display in the cell.
|
|
90
|
-
*/
|
|
91
|
-
readonly formatCell?: (value: Scalar, column: keyof T & string, rowIndex: number) => string;
|
|
92
|
-
/**
|
|
93
|
-
* Format a header label before rendering. Return a string to display as the column header.
|
|
94
|
-
*/
|
|
95
|
-
readonly formatHeader?: (column: keyof T & string) => string;
|
|
96
|
-
/**
|
|
97
|
-
* Maximum width of the table in characters. Columns will be truncated or wrapped to fit.
|
|
98
|
-
*/
|
|
99
|
-
readonly maxWidth?: number;
|
|
100
|
-
/**
|
|
101
|
-
* Cell padding (left and right) in characters.
|
|
102
|
-
* @default 1
|
|
103
|
-
*/
|
|
104
|
-
readonly padding?: number;
|
|
105
|
-
/**
|
|
106
|
-
* Whether to show the header row.
|
|
107
|
-
* @default true
|
|
108
|
-
*/
|
|
109
|
-
readonly showHeader?: boolean;
|
|
110
|
-
/** Placeholder shown in place of `null` or `undefined` cell values. Defaults to an empty string. */
|
|
111
|
-
readonly skeleton?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Enable word wrap instead of truncation when cells exceed their width.
|
|
114
|
-
* @default false
|
|
115
|
-
*/
|
|
116
|
-
readonly wordWrap?: boolean;
|
|
117
|
-
};
|
|
118
|
-
declare const Table: <T extends ScalarDict>(props: Props<T>) => ReactElement;
|
|
119
|
-
export { type ColumnConfig, type Props, type Scalar, type ScalarDict, Table, type ColumnConfig as TableColumnConfig, type Props as TableProps, type Scalar as TableScalar, type ScalarDict as TableScalarDict, Table as default };
|
package/dist/components/table.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as y}from"react/jsx-runtime";import{Table as _}from"@visulima/tabular";import{THICK_BORDER as g,ROUNDED_BORDER as b,NO_BORDER as w,MINIMAL_BORDER as S,MARKDOWN_BORDER as W,DOUBLE_BORDER as x,DOTS_BORDER as C,DEFAULT_BORDER as E,BLOCK_BORDER as H,ASCII_BORDER as I}from"@visulima/tabular/style";import{useMemo as L}from"react";import{Text as M}from"./text.js";const N={ascii:I,block:H,default:E,dots:C,double:x,markdown:W,minimal:S,none:w,rounded:b,thick:g},T=t=>typeof t=="string"?{key:t}:t,A=({borderStyle:t="default",columns:d,data:a,formatCell:n,formatHeader:m,maxWidth:f,padding:i=1,showHeader:s=!0,skeleton:u="",wordWrap:D=!1})=>{const h=L(()=>{if(a.length===0)return"";let r;if(d?r=d.map(e=>T(e)):r=Object.keys(a[0]).map(e=>({key:e})),r.length===0)return"";const k=typeof t=="string"?N[t]??E:t,O=r.map(e=>e.width),B=O.some(e=>e!==void 0),R=new _({columnWidths:B?O:void 0,maxWidth:f,showHeader:s,style:{border:k,paddingLeft:i,paddingRight:i},wordWrap:D});if(s){const e=r.map(o=>{const l=o.header??o.key;return m?m(o.key):l});R.setHeaders(e)}for(const[e,o]of a.entries()){const l=r.map(c=>{const p=o[c.key];return n?n(p,c.key,e):p==null?u:String(p)});R.addRow(l)}return R.toString()},[t,d,a,n,m,f,i,s,u,D]);return y(M,{children:h})},q=A;export{q as Table,q as default};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
import { Props as Props$1 } from "./tab.js";
|
|
5
|
-
/**
|
|
6
|
-
* Keyboard navigation configuration for Tabs.
|
|
7
|
-
*/
|
|
8
|
-
type KeyMap = {
|
|
9
|
-
/**
|
|
10
|
-
* Key names that move to the next tab.
|
|
11
|
-
* Defaults to `["rightArrow"]` for row layouts and `["downArrow"]` for column layouts.
|
|
12
|
-
*/
|
|
13
|
-
readonly next?: ReadonlyArray<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Key names that move to the previous tab.
|
|
16
|
-
* Defaults to `["leftArrow"]` for row layouts and `["upArrow"]` for column layouts.
|
|
17
|
-
*/
|
|
18
|
-
readonly previous?: ReadonlyArray<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Whether Meta/Cmd + 1–9 jumps to a specific tab.
|
|
21
|
-
* @default true
|
|
22
|
-
*/
|
|
23
|
-
readonly useNumbers?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Whether the Tab key cycles through tabs (only when `isFocused` is not managed by Ink).
|
|
26
|
-
* @default true
|
|
27
|
-
*/
|
|
28
|
-
readonly useTab?: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Color customization for active tab styling.
|
|
32
|
-
*/
|
|
33
|
-
type TabColors = {
|
|
34
|
-
readonly activeTab?: {
|
|
35
|
-
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
36
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
type Props = {
|
|
40
|
-
/**
|
|
41
|
-
* Tab elements to render.
|
|
42
|
-
*/
|
|
43
|
-
readonly children: ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* Active tab colors. When `isFocused` is `false`, the active tab uses gray.
|
|
46
|
-
*/
|
|
47
|
-
readonly colors?: TabColors;
|
|
48
|
-
/**
|
|
49
|
-
* Name of the tab to select initially (uncontrolled mode).
|
|
50
|
-
* Ignored when `value` is provided.
|
|
51
|
-
*/
|
|
52
|
-
readonly defaultValue?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Layout direction for the tab bar.
|
|
55
|
-
* @default "row"
|
|
56
|
-
*/
|
|
57
|
-
readonly flexDirection?: "column" | "column-reverse" | "row" | "row-reverse";
|
|
58
|
-
/**
|
|
59
|
-
* Whether the tabs are focused and respond to keyboard input.
|
|
60
|
-
* - `true`: focused, uses active colors.
|
|
61
|
-
* - `false`: unfocused, uses gray active color, ignores input.
|
|
62
|
-
* - `undefined`/`null`: always active (focus not managed by Ink).
|
|
63
|
-
* @default undefined
|
|
64
|
-
*/
|
|
65
|
-
readonly isFocused?: boolean | null;
|
|
66
|
-
/**
|
|
67
|
-
* Custom keyboard mappings.
|
|
68
|
-
*/
|
|
69
|
-
readonly keyMap?: KeyMap;
|
|
70
|
-
/**
|
|
71
|
-
* Called when the active tab changes.
|
|
72
|
-
*/
|
|
73
|
-
readonly onChange: (name: string, activeTab: ReactElement<Props$1>) => void;
|
|
74
|
-
/**
|
|
75
|
-
* Whether to display 1-based index numbers before each tab name.
|
|
76
|
-
* @default true
|
|
77
|
-
*/
|
|
78
|
-
readonly showIndex?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Controlled active tab name. When provided, the component is controlled —
|
|
81
|
-
* the parent owns the active tab state and must update it via `onChange`.
|
|
82
|
-
* When omitted, the component manages its own state (uncontrolled mode).
|
|
83
|
-
*/
|
|
84
|
-
readonly value?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Width of the container Box. Also determines the separator width in column layouts.
|
|
87
|
-
*/
|
|
88
|
-
readonly width?: number | string;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Tabbed navigation component. Renders a row or column of tabs with keyboard
|
|
92
|
-
* navigation (arrow keys, Tab, number keys) and calls `onChange` when the
|
|
93
|
-
* active tab changes.
|
|
94
|
-
*/
|
|
95
|
-
declare function Tabs({
|
|
96
|
-
children,
|
|
97
|
-
colors: colorsProp,
|
|
98
|
-
defaultValue,
|
|
99
|
-
flexDirection,
|
|
100
|
-
isFocused,
|
|
101
|
-
keyMap: keyMapProp,
|
|
102
|
-
onChange,
|
|
103
|
-
showIndex,
|
|
104
|
-
value,
|
|
105
|
-
width
|
|
106
|
-
}: Props): ReactElement;
|
|
107
|
-
export { KeyMap, Props, TabColors, Tabs, type KeyMap as TabsKeyMap, type Props as TabsProps, Tabs as default };
|
package/dist/components/tabs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as y,jsxs as A}from"react/jsx-runtime";import{useRef as I,useState as U,useCallback as d,useEffect as X,useMemo as j,Children as Y}from"react";import Z from"../ink/hooks/use-input.js";import{Box as M}from"./box.js";import{Text as D}from"./text.js";const _=/^\d$/u,G=e=>e!=null&&typeof e=="object"&&"props"in e&&"name"in e.props,H=e=>{const t=[];for(const n of Y.toArray(e))G(n)&&t.push(n);return t},E=(e,t)=>e.some(n=>t[n]),J=(e,t,n)=>e?t?{backgroundColor:n?.activeTab?.backgroundColor??"green",color:n?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function nr({children:e,colors:t,defaultValue:n,flexDirection:f="row",isFocused:b,keyMap:u,onChange:T,showIndex:F=!0,value:x,width:v}){const s=H(e),c=s.length,p=I(s);p.current=s;const l=f==="column"||f==="column-reverse",g=x!==void 0,[L,O]=U(()=>{const r=x??n;if(r==null||c===0)return 0;const o=s.findIndex(i=>i.props.name===r);return o===-1?0:o}),h=g?Math.max(0,s.findIndex(r=>r.props.name===x)):L,P=d(()=>{},[]),a=g?P:O,m=I(T);m.current=T,X(()=>{if(g)return;const r=p.current[h];r&&m.current(r.props.name,r)},[]);const B=j(()=>u?.previous??[l?"upArrow":"leftArrow"],[u?.previous,l]),N=j(()=>u?.next??[l?"downArrow":"rightArrow"],[u?.next,l]),R=u?.useNumbers??!0,S=u?.useTab??!0,k=I(h);k.current=h;const V=d(r=>{a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[a]),C=d(()=>{const r=(k.current+1)%c;a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[c,a]),w=d(()=>{const r=(k.current-1+c)%c;a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[c,a]);Z(d((r,o)=>{if(E(B,o)){w();return}if(E(N,o)){C();return}if(o.tab&&S&&b==null){o.shift?w():C();return}if(R&&o.meta&&_.test(r)){const i=r==="0"?9:Number.parseInt(r,10)-1;i<c&&V(i)}},[B,N,S,R,b,w,C,c,V]),{isActive:b!==!1});const $=typeof v=="number"?v:6,Q=j(()=>l?"─".repeat($):" | ",[l,$]);return y(M,{flexDirection:f,width:v,children:s.map((r,o)=>{const{name:i}=r.props,q=J(h===o,b!==!1,t);let z=null;return F&&(z=A(D,{color:"grey",children:[o+1,"."," "]})),A(M,{flexDirection:f,children:[o!==0&&y(D,{color:"dim",children:Q}),A(M,{children:[z,y(D,{backgroundColor:q.backgroundColor,color:q.color,children:r})]})]},i)})})}export{nr as Tabs,nr as default};
|
package/dist/components/tag.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type TagVariant = "outline" | "solid" | "subtle";
|
|
5
|
-
type Props = {
|
|
6
|
-
/**
|
|
7
|
-
* Tag content.
|
|
8
|
-
*/
|
|
9
|
-
readonly children: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* Base color.
|
|
12
|
-
* @default "blue"
|
|
13
|
-
*/
|
|
14
|
-
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
15
|
-
/**
|
|
16
|
-
* Optional symbol rendered before the label (e.g. `●`, `✔`, `★`).
|
|
17
|
-
*/
|
|
18
|
-
readonly icon?: ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Visual style.
|
|
21
|
-
* @default "subtle"
|
|
22
|
-
*/
|
|
23
|
-
readonly variant?: TagVariant;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Render a short pill-shaped label.
|
|
27
|
-
* @returns A `ReactElement` rendering the tag in the requested variant.
|
|
28
|
-
*/
|
|
29
|
-
declare function Tag({
|
|
30
|
-
children,
|
|
31
|
-
color,
|
|
32
|
-
icon,
|
|
33
|
-
variant
|
|
34
|
-
}: Props): ReactElement;
|
|
35
|
-
export { Props, Tag, type Props as TagProps, TagVariant, Tag as default };
|
package/dist/components/tag.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as l}from"react/jsx-runtime";import{Box as a}from"./box.js";import{Text as n}from"./text.js";function u({children:d,color:i="blue",icon:o,variant:c="subtle"}){return c==="outline"?e(a,{borderColor:i,borderStyle:"round",paddingX:1,children:r(n,{color:i,children:[o===void 0?void 0:r(l,{children:[o," "]}),d]})}):c==="solid"?r(n,{backgroundColor:i,color:"black",children:[" ",o===void 0?void 0:r(l,{children:[o," "]}),d," "]}):r(n,{color:i,children:[o===void 0?void 0:r(l,{children:[o," "]}),d]})}export{u as Tag,u as default};
|