@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,40 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A single key binding definition.
|
|
3
|
-
*/
|
|
2
|
+
* A single key binding definition.
|
|
3
|
+
*/
|
|
4
4
|
type KeyBinding = {
|
|
5
5
|
/** Human-readable description shown in Help. */
|
|
6
6
|
readonly description: string;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
* Whether this binding is active.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
11
|
readonly enabled?: boolean;
|
|
12
12
|
/** Optional group name for organizing in the Help component's full mode. */
|
|
13
13
|
readonly group?: string;
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
* Key(s) that trigger this binding.
|
|
16
|
+
*
|
|
17
|
+
* A string can be:
|
|
18
|
+
* - A single character: `"q"`, `"a"`, `" "` (space)
|
|
19
|
+
* - A `Key` boolean field name: `"return"`, `"escape"`, `"upArrow"`, `"leftArrow"`, etc.
|
|
20
|
+
* - A modifier combo: `"ctrl+c"`, `"meta+s"` (modifier + character)
|
|
21
|
+
*
|
|
22
|
+
* Provide an array to match multiple keys for the same action.
|
|
23
|
+
*/
|
|
24
24
|
readonly key: string | ReadonlyArray<string>;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* A binding paired with its handler function.
|
|
28
|
-
*/
|
|
27
|
+
* A binding paired with its handler function.
|
|
28
|
+
*/
|
|
29
29
|
type KeyBindingHandler = {
|
|
30
30
|
readonly binding: KeyBinding;
|
|
31
31
|
readonly handler: () => void;
|
|
32
32
|
};
|
|
33
33
|
type UseKeyBindingsOptions = {
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
* Whether keyboard input is captured.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
38
|
readonly isActive?: boolean;
|
|
39
39
|
};
|
|
40
40
|
type UseKeyBindingsResult = {
|
|
@@ -42,18 +42,18 @@ type UseKeyBindingsResult = {
|
|
|
42
42
|
readonly bindings: ReadonlyArray<KeyBinding>;
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Declarative keybinding hook. Registers multiple key bindings with handlers
|
|
46
|
-
* and returns the enabled bindings for display in a Help component.
|
|
47
|
-
*
|
|
48
|
-
* ```tsx
|
|
49
|
-
* const { bindings } = useKeyBindings([
|
|
50
|
-
* { binding: { key: "q", description: "Quit" }, handler: () => exit() },
|
|
51
|
-
* { binding: { key: ["upArrow", "k"], description: "Move up" }, handler: () => moveUp() },
|
|
52
|
-
* { binding: { key: "ctrl+s", description: "Save" }, handler: () => save() },
|
|
53
|
-
* ]);
|
|
54
|
-
*
|
|
55
|
-
* <Help bindings={bindings} />
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
45
|
+
* Declarative keybinding hook. Registers multiple key bindings with handlers
|
|
46
|
+
* and returns the enabled bindings for display in a Help component.
|
|
47
|
+
*
|
|
48
|
+
* ```tsx
|
|
49
|
+
* const { bindings } = useKeyBindings([
|
|
50
|
+
* { binding: { key: "q", description: "Quit" }, handler: () => exit() },
|
|
51
|
+
* { binding: { key: ["upArrow", "k"], description: "Move up" }, handler: () => moveUp() },
|
|
52
|
+
* { binding: { key: "ctrl+s", description: "Save" }, handler: () => save() },
|
|
53
|
+
* ]);
|
|
54
|
+
*
|
|
55
|
+
* <Help bindings={bindings} />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
58
|
declare function useKeyBindings(handlers: ReadonlyArray<KeyBindingHandler>, options?: UseKeyBindingsOptions): UseKeyBindingsResult;
|
|
59
59
|
export { KeyBinding, KeyBindingHandler, useKeyBindings as default, useKeyBindings };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
type KeyChordStep = string;
|
|
2
2
|
type UseKeyChordOptions = {
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
* Disable the chord while keeping the component rendered.
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
7
|
readonly isActive?: boolean;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
* Milliseconds of silence after which the partial chord resets.
|
|
10
|
+
* @default 1000
|
|
11
|
+
*/
|
|
12
12
|
readonly resetAfter?: number;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Invoke `callback` when the user types the given sequence of keys in order
|
|
16
|
-
* (like Vim's `g d` or Emacs's `C-x C-s`). The chord resets automatically
|
|
17
|
-
* after `resetAfter` ms of silence.
|
|
18
|
-
* @param sequence Ordered list of chord steps. Each step is compared against
|
|
19
|
-
* a canonical key token (e.g. `"g"`, `"space"`, `"ctrl+s"`).
|
|
20
|
-
* @param callback Invoked exactly once per successful chord match. Latest
|
|
21
|
-
* reference is captured in a ref.
|
|
22
|
-
* @param options Optional `isActive` flag and `resetAfter` silence timeout.
|
|
23
|
-
*/
|
|
15
|
+
* Invoke `callback` when the user types the given sequence of keys in order
|
|
16
|
+
* (like Vim's `g d` or Emacs's `C-x C-s`). The chord resets automatically
|
|
17
|
+
* after `resetAfter` ms of silence.
|
|
18
|
+
* @param sequence Ordered list of chord steps. Each step is compared against
|
|
19
|
+
* a canonical key token (e.g. `"g"`, `"space"`, `"ctrl+s"`).
|
|
20
|
+
* @param callback Invoked exactly once per successful chord match. Latest
|
|
21
|
+
* reference is captured in a ref.
|
|
22
|
+
* @param options Optional `isActive` flag and `resetAfter` silence timeout.
|
|
23
|
+
*/
|
|
24
24
|
declare const useKeyChord: (sequence: ReadonlyArray<KeyChordStep>, callback: () => void, options?: UseKeyChordOptions) => void;
|
|
25
25
|
export { KeyChordStep, UseKeyChordOptions, useKeyChord as default, useKeyChord };
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
type Options = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Enable or disable the paste handler. Useful when multiple components use `usePaste` and only one should be active at a time.
|
|
4
|
+
* @default true
|
|
5
|
+
*/
|
|
6
6
|
isActive?: boolean;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* A React hook that calls `handler` whenever the user pastes text in the
|
|
10
|
-
* terminal. Bracketed paste mode (`\x1b[?2004h`) is automatically enabled while
|
|
11
|
-
* the hook is active, so pasted text arrives as a single string rather than being
|
|
12
|
-
* misinterpreted as individual key presses.
|
|
13
|
-
*
|
|
14
|
-
* `usePaste` is the dedicated API for paste blobs. `usePaste` and `useInput` can
|
|
15
|
-
* be used together in the same component; they operate on separate event
|
|
16
|
-
* channels, so paste content is never forwarded to `useInput` handlers while a
|
|
17
|
-
* `usePaste` handler is active.
|
|
18
|
-
*
|
|
19
|
-
* If no `usePaste` handler is active, Ink still forwards bracketed paste text to
|
|
20
|
-
* `useInput` for backward compatibility. That fallback is deprecated and will be
|
|
21
|
-
* removed in the next major version.
|
|
22
|
-
*
|
|
23
|
-
* ```
|
|
24
|
-
* import {useInput} from '@visulima/tui/hooks/use-input';
|
|
25
|
-
* import {usePaste} from '@visulima/tui/hooks/use-paste';
|
|
26
|
-
*
|
|
27
|
-
* const MyInput = () => {
|
|
28
|
-
* useInput((input, key) => {
|
|
29
|
-
* // Only receives typed characters and key events, not pasted text.
|
|
30
|
-
* if (key.return) {
|
|
31
|
-
* // Submit
|
|
32
|
-
* }
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* usePaste((text) => {
|
|
36
|
-
* // Receives the full pasted string, including newlines.
|
|
37
|
-
* console.log('Pasted:', text);
|
|
38
|
-
* });
|
|
39
|
-
*
|
|
40
|
-
* return …
|
|
41
|
-
* };
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
9
|
+
* A React hook that calls `handler` whenever the user pastes text in the
|
|
10
|
+
* terminal. Bracketed paste mode (`\x1b[?2004h`) is automatically enabled while
|
|
11
|
+
* the hook is active, so pasted text arrives as a single string rather than being
|
|
12
|
+
* misinterpreted as individual key presses.
|
|
13
|
+
*
|
|
14
|
+
* `usePaste` is the dedicated API for paste blobs. `usePaste` and `useInput` can
|
|
15
|
+
* be used together in the same component; they operate on separate event
|
|
16
|
+
* channels, so paste content is never forwarded to `useInput` handlers while a
|
|
17
|
+
* `usePaste` handler is active.
|
|
18
|
+
*
|
|
19
|
+
* If no `usePaste` handler is active, Ink still forwards bracketed paste text to
|
|
20
|
+
* `useInput` for backward compatibility. That fallback is deprecated and will be
|
|
21
|
+
* removed in the next major version.
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
* import {useInput} from '@visulima/tui/hooks/use-input';
|
|
25
|
+
* import {usePaste} from '@visulima/tui/hooks/use-paste';
|
|
26
|
+
*
|
|
27
|
+
* const MyInput = () => {
|
|
28
|
+
* useInput((input, key) => {
|
|
29
|
+
* // Only receives typed characters and key events, not pasted text.
|
|
30
|
+
* if (key.return) {
|
|
31
|
+
* // Submit
|
|
32
|
+
* }
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* usePaste((text) => {
|
|
36
|
+
* // Receives the full pasted string, including newlines.
|
|
37
|
+
* console.log('Pasted:', text);
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* return …
|
|
41
|
+
* };
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
44
|
declare const usePaste: (handler: (text: string) => void, options?: Options) => void;
|
|
45
45
|
export { usePaste as default, usePaste };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffectEvent as c,useEffect as a}from"react";import{j as u}from"../../packem_shared/reconciler-
|
|
1
|
+
import{useEffectEvent as c,useEffect as a}from"react";import{j as u}from"../../packem_shared/reconciler-DkwOtC5B.js";import{useStdinContext as m}from"./use-stdin.js";const l=(o,e={})=>{const{internal_eventEmitter:t,setBracketedPasteMode:s,setRawMode:r}=m(),f=c(o);a(()=>{if(e.isActive!==!1)return r(!0),s(!0),()=>{r(!1),s(!1)}},[e.isActive,r,s]),a(()=>{if(e.isActive===!1)return;const i=n=>{u.discreteUpdates(()=>{f(n)})};return t.on("paste",i),()=>{t.removeListener("paste",i)}},[e.isActive,t])};export{l as default,l as usePaste};
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
type PersistentStorage = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Return the persisted JSON-encoded string for `key`, or `undefined` if
|
|
4
|
+
* nothing has been stored yet.
|
|
5
|
+
*/
|
|
6
6
|
readonly read: (key: string) => string | undefined;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
* Persist `value` (a JSON-encoded string) for `key`. Errors are swallowed
|
|
9
|
+
* by the hook so the UI keeps working in read-only environments.
|
|
10
|
+
*/
|
|
11
11
|
readonly write: (key: string, value: string) => void;
|
|
12
12
|
};
|
|
13
13
|
type UsePersistentStateOptions = {
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
* Namespace used by the default file storage. Separates keys across
|
|
16
|
+
* independent applications sharing the user's home directory.
|
|
17
|
+
* @default "tui"
|
|
18
|
+
*/
|
|
19
19
|
readonly namespace?: string;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
* Custom storage backend. When omitted, the default is a file on disk at
|
|
22
|
+
* `~/.cache/visulima-tui/<namespace>.json`.
|
|
23
|
+
*/
|
|
24
24
|
readonly storage?: PersistentStorage;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* In-memory storage shared across all hook instances that use it. Useful in
|
|
28
|
-
* tests and in environments without file access.
|
|
29
|
-
*/
|
|
27
|
+
* In-memory storage shared across all hook instances that use it. Useful in
|
|
28
|
+
* tests and in environments without file access.
|
|
29
|
+
*/
|
|
30
30
|
declare const createMemoryStorage: () => PersistentStorage;
|
|
31
31
|
/**
|
|
32
|
-
* Default file-backed storage. Reads/writes a single JSON object per
|
|
33
|
-
* namespace, keyed by `key`. The directory is created on first write and
|
|
34
|
-
* updates use a temp-file + rename to avoid partial writes if the process
|
|
35
|
-
* crashes mid-write. Errors are forwarded to `process.stderr.write` so they
|
|
36
|
-
* are visible without crashing the UI.
|
|
37
|
-
*
|
|
38
|
-
* The namespace object is parsed from disk once (lazily) and kept in memory;
|
|
39
|
-
* subsequent reads/writes operate on the cached object instead of re-reading
|
|
40
|
-
* and re-parsing the whole file on every call.
|
|
41
|
-
*/
|
|
32
|
+
* Default file-backed storage. Reads/writes a single JSON object per
|
|
33
|
+
* namespace, keyed by `key`. The directory is created on first write and
|
|
34
|
+
* updates use a temp-file + rename to avoid partial writes if the process
|
|
35
|
+
* crashes mid-write. Errors are forwarded to `process.stderr.write` so they
|
|
36
|
+
* are visible without crashing the UI.
|
|
37
|
+
*
|
|
38
|
+
* The namespace object is parsed from disk once (lazily) and kept in memory;
|
|
39
|
+
* subsequent reads/writes operate on the cached object instead of re-reading
|
|
40
|
+
* and re-parsing the whole file on every call.
|
|
41
|
+
*/
|
|
42
42
|
declare const createFileStorage: (namespace: string) => PersistentStorage;
|
|
43
43
|
/**
|
|
44
|
-
* `useState` that persists its value through the configured `storage`
|
|
45
|
-
* backend (file on disk by default). Behaves identically to `useState` at
|
|
46
|
-
* the call-site.
|
|
47
|
-
*
|
|
48
|
-
* Persistence happens in a commit-phase effect, **not** inside the state
|
|
49
|
-
* updater — updaters must be pure (React may double-invoke them under
|
|
50
|
-
* StrictMode or discard them under concurrent rendering), so writing from
|
|
51
|
-
* inside one risked double or phantom disk writes. Writing after commit means
|
|
52
|
-
* only values that actually render are persisted.
|
|
53
|
-
*
|
|
54
|
-
* **Lifecycle note:** the storage backend (resolved from `options.storage`
|
|
55
|
-
* or a fresh `createFileStorage(namespace)`) is captured once on mount and
|
|
56
|
-
* never replaced. Mutating `options.storage` on subsequent renders has no
|
|
57
|
-
* effect — remount the hook (e.g. via a `key` prop) if you need to swap
|
|
58
|
-
* backends at runtime.
|
|
59
|
-
* @param key Unique identifier within the backend namespace.
|
|
60
|
-
* @param initialValue Value used when the backend has no entry for `key`.
|
|
61
|
-
* @param options Optional storage backend + namespace overrides.
|
|
62
|
-
* @returns A `[value, setValue]` tuple. Writes flush in a post-commit effect.
|
|
63
|
-
*/
|
|
44
|
+
* `useState` that persists its value through the configured `storage`
|
|
45
|
+
* backend (file on disk by default). Behaves identically to `useState` at
|
|
46
|
+
* the call-site.
|
|
47
|
+
*
|
|
48
|
+
* Persistence happens in a commit-phase effect, **not** inside the state
|
|
49
|
+
* updater — updaters must be pure (React may double-invoke them under
|
|
50
|
+
* StrictMode or discard them under concurrent rendering), so writing from
|
|
51
|
+
* inside one risked double or phantom disk writes. Writing after commit means
|
|
52
|
+
* only values that actually render are persisted.
|
|
53
|
+
*
|
|
54
|
+
* **Lifecycle note:** the storage backend (resolved from `options.storage`
|
|
55
|
+
* or a fresh `createFileStorage(namespace)`) is captured once on mount and
|
|
56
|
+
* never replaced. Mutating `options.storage` on subsequent renders has no
|
|
57
|
+
* effect — remount the hook (e.g. via a `key` prop) if you need to swap
|
|
58
|
+
* backends at runtime.
|
|
59
|
+
* @param key Unique identifier within the backend namespace.
|
|
60
|
+
* @param initialValue Value used when the backend has no entry for `key`.
|
|
61
|
+
* @param options Optional storage backend + namespace overrides.
|
|
62
|
+
* @returns A `[value, setValue]` tuple. Writes flush in a post-commit effect.
|
|
63
|
+
*/
|
|
64
64
|
declare const usePersistentState: <T>(key: string, initialValue: T, options?: UsePersistentStateOptions) => readonly [T, (value: T | ((previous: T) => T)) => void];
|
|
65
65
|
export { PersistentStorage, UsePersistentStateOptions, createFileStorage, createMemoryStorage, usePersistentState as default, usePersistentState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as g}from"node:module";import{useRef as m,useState as
|
|
2
|
-
`)},c=()=>{if(s!==void 0)return s;try{const t=w(r,"utf8"),n=JSON.parse(t);s=n&&typeof n=="object"?n:{}}catch(t){const n=t?.code;n!=="ENOENT"&&n!=="EACCES"&&i("read",t),s={}}return s};return{read:t=>c()[t],write:(t,n)=>{const o=f.dirname(r),u=`${r}.tmp.${p.pid}`,d=c();d[t]=n;try{
|
|
1
|
+
import{createRequire as g}from"node:module";import{useRef as m,useState as b,useEffect as E,useCallback as O}from"react";let S;const v=e=>(S??=g(import.meta.url))(e),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[r,s]=a.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return a.getBuiltinModule(e)}return v(e)},{mkdirSync:_,writeFileSync:h,renameSync:j,readFileSync:w}=l("node:fs"),{homedir:N}=l("node:os"),f=l("node:path"),p=a,T=()=>{const e=new Map;return{read:r=>e.get(r),write:(r,s)=>{e.set(r,s)}}},$=/[/\\]/,k=e=>{if(e===""||e==="."||e===".."||$.test(e)||e.includes("\0"))throw new Error(`[visulima/tui] usePersistentState: invalid namespace ${JSON.stringify(e)} — must not be empty or contain path separators.`)},J=e=>{k(e);const r=f.join(N(),".cache","visulima-tui",`${e}.json`);let s;const i=(t,n)=>{const o=n instanceof Error?n.message:String(n);p.stderr.write(`[visulima/tui] persistent-state ${t} failed: ${o}
|
|
2
|
+
`)},c=()=>{if(s!==void 0)return s;try{const t=w(r,"utf8"),n=JSON.parse(t);s=n&&typeof n=="object"?n:{}}catch(t){const n=t?.code;n!=="ENOENT"&&n!=="EACCES"&&i("read",t),s={}}return s};return{read:t=>c()[t],write:(t,n)=>{const o=f.dirname(r),u=`${r}.tmp.${p.pid}`,d=c();d[t]=n;try{_(o,{recursive:!0}),h(u,JSON.stringify(d,null,2),{encoding:"utf8",flag:"w"}),j(u,r)}catch(y){i("write",y)}}}},q=(e,r,s)=>{const i=e.read(r);if(i===void 0)return s;try{return JSON.parse(i)}catch{return s}},C=(e,r,s)=>{const i=m(void 0);i.current??=s?.storage??J(s?.namespace??"tui");const c=i.current,[t,n]=b(()=>q(c,e,r)),o=m(void 0);o.current??={key:e,value:t},E(()=>{if(!(o.current?.key===e&&Object.is(o.current.value,t)))try{c.write(e,JSON.stringify(t)),o.current={key:e,value:t}}catch{}},[e,t,c]);const u=O(d=>{n(d)},[]);return[t,u]};export{J as createFileStorage,T as createMemoryStorage,C as default,C as usePersistentState};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
type UseScrollAccelerationOptions = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Velocity multiplier per rapid scroll event.
|
|
4
|
+
* @default 1.5
|
|
5
|
+
*/
|
|
6
6
|
readonly acceleration?: number;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
* Velocity decay factor per tick (0-1). Lower = faster stop.
|
|
9
|
+
* @default 0.92
|
|
10
|
+
*/
|
|
11
11
|
readonly decayRate?: number;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
* Enable or disable acceleration.
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
16
|
readonly isActive?: boolean;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
* Maximum velocity in lines per tick.
|
|
19
|
+
* @default 20
|
|
20
|
+
*/
|
|
21
21
|
readonly maxVelocity?: number;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
* Callback invoked with the scroll delta (signed integer lines) on each tick.
|
|
24
|
+
*/
|
|
25
25
|
readonly onScroll?: (delta: number) => void;
|
|
26
26
|
};
|
|
27
27
|
type UseScrollAccelerationResult = {
|
|
@@ -33,15 +33,15 @@ type UseScrollAccelerationResult = {
|
|
|
33
33
|
readonly velocity: number;
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
* Hook providing scroll acceleration with momentum physics.
|
|
37
|
-
*
|
|
38
|
-
* ```tsx
|
|
39
|
-
* const { handleScroll } = useScrollAcceleration({
|
|
40
|
-
* onScroll: (delta) => scrollViewRef.current?.scrollBy(delta),
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* useMouseAction(); // call handleScroll("up") or handleScroll("down") on scroll events
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
36
|
+
* Hook providing scroll acceleration with momentum physics.
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const { handleScroll } = useScrollAcceleration({
|
|
40
|
+
* onScroll: (delta) => scrollViewRef.current?.scrollBy(delta),
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* useMouseAction(); // call handleScroll("up") or handleScroll("down") on scroll events
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
46
|
declare const useScrollAcceleration: (options?: UseScrollAccelerationOptions) => UseScrollAccelerationResult;
|
|
47
47
|
export { UseScrollAccelerationOptions, UseScrollAccelerationResult, useScrollAcceleration as default, useScrollAcceleration };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
type UseScrollInputOptions = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Returns the current viewport height in lines. Called on each key event
|
|
4
|
+
* so the value is always fresh (avoids stale-closure issues with refs).
|
|
5
|
+
*/
|
|
6
6
|
getViewportHeight: () => number;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
* Enable or disable scroll input handling.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
11
|
isActive?: boolean;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* Scroll by a relative delta (in lines).
|
|
14
|
+
*/
|
|
15
15
|
scrollBy: (delta: number) => void;
|
|
16
16
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
* Jump to the bottom of the content.
|
|
18
|
+
*/
|
|
19
19
|
scrollToBottom: () => void;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
* Jump to the top of the content.
|
|
22
|
+
*/
|
|
23
23
|
scrollToTop: () => void;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
* Enable vim-style keybindings (j/k/g/G/u/d).
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
28
|
vimBindings?: boolean;
|
|
29
29
|
};
|
|
30
30
|
type UseScrollInputReturn = {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
|
|
5
|
+
*/
|
|
6
6
|
readonly stderr: NodeJS.WriteStream;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Write any string to stderr while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `<Static>`, except it can't accept components; it only works with strings.
|
|
9
|
+
*/
|
|
10
10
|
readonly write: (data: string) => void;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* A React hook that returns the stderr stream.
|
|
14
|
-
*/
|
|
13
|
+
* A React hook that returns the stderr stream.
|
|
14
|
+
*/
|
|
15
15
|
declare const useStderr: () => Props;
|
|
16
16
|
export { type Props as StderrProps, useStderr as default, useStderr };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as t}from"react";import{t as o}from"../../packem_shared/stderr-context-
|
|
1
|
+
import{useContext as t}from"react";import{t as o}from"../../packem_shared/stderr-context-CR2LLec6.js";const s=()=>t(o);export{s as default,s as useStderr};
|
|
@@ -2,29 +2,29 @@ import { EventEmitter } from 'node:events';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
type PublicProps = {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* A boolean flag determining if the current `stdin` supports `setRawMode`. A component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.
|
|
6
|
+
*/
|
|
7
7
|
readonly isRawModeSupported: boolean;
|
|
8
8
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* Ink exposes this function via own `<StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`. If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
|
|
10
|
+
*/
|
|
11
11
|
readonly setRawMode: (value: boolean) => void;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
* The stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default. Useful if your app needs to handle user input.
|
|
14
|
+
*/
|
|
15
15
|
readonly stdin: NodeJS.ReadStream;
|
|
16
16
|
};
|
|
17
17
|
type Props = PublicProps & {
|
|
18
18
|
readonly internal_eventEmitter: EventEmitter;
|
|
19
19
|
readonly internal_exitOnCtrlC: boolean;
|
|
20
20
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
* Enable or disable bracketed paste mode on the terminal. When enabled, pasted text is wrapped in escape sequences that allow it to be distinguished from typed input.
|
|
22
|
+
*/
|
|
23
23
|
readonly setBracketedPasteMode: (value: boolean) => void;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* A React hook that returns the stdin stream and stdin-related utilities.
|
|
27
|
-
*/
|
|
26
|
+
* A React hook that returns the stdin stream and stdin-related utilities.
|
|
27
|
+
*/
|
|
28
28
|
declare const useStdin: () => PublicProps;
|
|
29
29
|
declare const useStdinContext: () => Props;
|
|
30
30
|
export { type PublicProps as StdinProps, useStdin as default, useStdin, useStdinContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as t}from"react";import{e}from"../../packem_shared/stdin-context-
|
|
1
|
+
import{useContext as t}from"react";import{e}from"../../packem_shared/stdin-context-BjMA9Sbi.js";const n=()=>t(e),r=()=>t(e);export{n as default,n as useStdin,r as useStdinContext};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
type Props = {
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
|
|
5
|
+
*/
|
|
6
6
|
readonly stdout: NodeJS.WriteStream;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `<Static>`, except it can't accept components; it only works with strings.
|
|
9
|
+
*/
|
|
10
10
|
readonly write: (data: string) => void;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
|
-
* A React hook that returns the stdout stream where Ink renders your app.
|
|
14
|
-
*/
|
|
13
|
+
* A React hook that returns the stdout stream where Ink renders your app.
|
|
14
|
+
*/
|
|
15
15
|
declare const useStdout: () => Props;
|
|
16
16
|
export { type Props as StdoutProps, useStdout as default, useStdout };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as t}from"react";import{t as o}from"../../packem_shared/stdout-context-
|
|
1
|
+
import{useContext as t}from"react";import{t as o}from"../../packem_shared/stdout-context-DAAlQct2.js";const r=()=>t(o);export{r as default,r as useStdout};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
type UseStopwatchOptions = {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
* Whether to start counting immediately.
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
6
|
readonly autoStart?: boolean;
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
* Tick interval in milliseconds.
|
|
9
|
+
* @default 1000
|
|
10
|
+
*/
|
|
11
11
|
readonly interval?: number;
|
|
12
12
|
};
|
|
13
13
|
type UseStopwatchResult = {
|
|
@@ -29,11 +29,11 @@ type UseStopwatchResult = {
|
|
|
29
29
|
readonly toggle: () => void;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
|
-
* A count-up stopwatch hook built on `useAnimation`.
|
|
33
|
-
*
|
|
34
|
-
* ```tsx
|
|
35
|
-
* const { elapsed, isRunning, start, stop, reset, lap, laps } = useStopwatch();
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
32
|
+
* A count-up stopwatch hook built on `useAnimation`.
|
|
33
|
+
*
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const { elapsed, isRunning, start, stop, reset, lap, laps } = useStopwatch();
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
38
|
declare function useStopwatch(options?: UseStopwatchOptions): UseStopwatchResult;
|
|
39
39
|
export { UseStopwatchOptions, UseStopwatchResult, useStopwatch as default, useStopwatch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TerminalPalette } from "../../packem_shared/terminal-palette.d-
|
|
1
|
+
import { T as TerminalPalette } from "../../packem_shared/terminal-palette.d-JbWHISW-.js";
|
|
2
2
|
import 'node:stream';
|
|
3
3
|
type UseTerminalPaletteResult = {
|
|
4
4
|
readonly isLoading: boolean;
|
|
@@ -6,15 +6,15 @@ type UseTerminalPaletteResult = {
|
|
|
6
6
|
readonly palette: Partial<TerminalPalette> | null;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Hook that queries the terminal for its current color palette.
|
|
10
|
-
* Returns the detected palette colors or null if not yet loaded.
|
|
11
|
-
*
|
|
12
|
-
* ```tsx
|
|
13
|
-
* const { palette, isLoading } = useTerminalPalette();
|
|
14
|
-
* if (palette?.background) {
|
|
15
|
-
* console.log("Terminal background:", palette.background);
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
9
|
+
* Hook that queries the terminal for its current color palette.
|
|
10
|
+
* Returns the detected palette colors or null if not yet loaded.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const { palette, isLoading } = useTerminalPalette();
|
|
14
|
+
* if (palette?.background) {
|
|
15
|
+
* console.log("Terminal background:", palette.background);
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
19
|
declare const useTerminalPalette: () => UseTerminalPaletteResult;
|
|
20
20
|
export { UseTerminalPaletteResult, useTerminalPalette as default, useTerminalPalette };
|