@visulima/tui 0.0.1 → 1.0.0-alpha.2
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 +200 -0
- package/LICENSE.md +303 -0
- package/README.md +173 -29
- package/dist/core/app.d.ts +50 -0
- package/dist/core/cell.d.ts +33 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.js +5 -0
- package/dist/core/inline.d.ts +22 -0
- package/dist/core/input.d.ts +18 -0
- package/dist/core/native-binding.d.ts +22 -0
- package/dist/ink/ansi-to-cell.d.ts +5 -0
- package/dist/ink/ansi-tokenizer.d.ts +38 -0
- package/dist/ink/clipboard.d.ts +29 -0
- package/dist/ink/color-matrix.d.ts +49 -0
- package/dist/ink/color-utils.d.ts +30 -0
- package/dist/ink/colorize.d.ts +4 -0
- package/dist/ink/components/AccessibilityContext.d.ts +4 -0
- package/dist/ink/components/Alert.d.ts +30 -0
- package/dist/ink/components/AnimationContext.d.ts +10 -0
- package/dist/ink/components/App.d.ts +19 -0
- package/dist/ink/components/AppContext.d.ts +38 -0
- package/dist/ink/components/BackgroundContext.d.ts +5 -0
- package/dist/ink/components/Badge.d.ts +27 -0
- package/dist/ink/components/BigText.d.ts +71 -0
- package/dist/ink/components/Box.d.ts +58 -0
- package/dist/ink/components/Code.d.ts +46 -0
- package/dist/ink/components/ConfirmInput.d.ts +40 -0
- package/dist/ink/components/ConsoleOverlay.d.ts +52 -0
- package/dist/ink/components/Cursor.d.ts +43 -0
- package/dist/ink/components/CursorContext.d.ts +12 -0
- package/dist/ink/components/Dialog.d.ts +93 -0
- package/dist/ink/components/DiffView.d.ts +71 -0
- package/dist/ink/components/ErrorBoundary.d.ts +17 -0
- package/dist/ink/components/ErrorOverview.d.ts +6 -0
- package/dist/ink/components/FocusContext.d.ts +17 -0
- package/dist/ink/components/Gradient.d.ts +38 -0
- package/dist/ink/components/Help.d.ts +49 -0
- package/dist/ink/components/Link.d.ts +34 -0
- package/dist/ink/components/Markdown.d.ts +34 -0
- package/dist/ink/components/MultiSelect.d.ts +63 -0
- package/dist/ink/components/Newline.d.ts +12 -0
- package/dist/ink/components/OrderedList.d.ts +30 -0
- package/dist/ink/components/Paginator.d.ts +75 -0
- package/dist/ink/components/ProgressBar.d.ts +51 -0
- package/dist/ink/components/SelectInput.d.ts +96 -0
- package/dist/ink/components/SelectInputIndicator.d.ts +36 -0
- package/dist/ink/components/SelectInputItem.d.ts +43 -0
- package/dist/ink/components/Slider.d.ts +92 -0
- package/dist/ink/components/Spacer.d.ts +7 -0
- package/dist/ink/components/Spinner.d.ts +42 -0
- package/dist/ink/components/Static.d.ts +24 -0
- package/dist/ink/components/StaticRender.d.ts +28 -0
- package/dist/ink/components/StatusMessage.d.ts +26 -0
- package/dist/ink/components/StderrContext.d.ts +16 -0
- package/dist/ink/components/StdinContext.d.ts +29 -0
- package/dist/ink/components/StdoutContext.d.ts +16 -0
- package/dist/ink/components/Stopwatch.d.ts +44 -0
- package/dist/ink/components/Tab.d.ts +25 -0
- package/dist/ink/components/Table.d.ts +80 -0
- package/dist/ink/components/Tabs.d.ts +104 -0
- package/dist/ink/components/Text.d.ts +63 -0
- package/dist/ink/components/TextInput.d.ts +48 -0
- package/dist/ink/components/Textarea.d.ts +62 -0
- package/dist/ink/components/Timer.d.ts +52 -0
- package/dist/ink/components/Transform.d.ts +16 -0
- package/dist/ink/components/UnorderedList.d.ts +35 -0
- package/dist/ink/components/file-picker/FilePicker.d.ts +75 -0
- package/dist/ink/components/file-picker/index.d.ts +3 -0
- package/dist/ink/components/file-picker/types.d.ts +38 -0
- package/dist/ink/components/file-picker/use-file-system.d.ts +16 -0
- package/dist/ink/components/scroll/ControlledScrollView.d.ts +43 -0
- package/dist/ink/components/scroll/ScrollBar.d.ts +20 -0
- package/dist/ink/components/scroll/ScrollBarBox.d.ts +15 -0
- package/dist/ink/components/scroll/ScrollList.d.ts +12 -0
- package/dist/ink/components/scroll/ScrollView.d.ts +98 -0
- package/dist/ink/components/scroll/index.d.ts +10 -0
- package/dist/ink/components/scroll/use-state-ref.d.ts +8 -0
- package/dist/ink/components/tree-view/TreeView.d.ts +89 -0
- package/dist/ink/components/tree-view/TreeViewNode.d.ts +29 -0
- package/dist/ink/components/tree-view/index.d.ts +11 -0
- package/dist/ink/components/tree-view/theme.d.ts +24 -0
- package/dist/ink/components/tree-view/tree-node-map.d.ts +72 -0
- package/dist/ink/components/tree-view/types.d.ts +55 -0
- package/dist/ink/components/tree-view/use-tree-view-state.d.ts +135 -0
- package/dist/ink/components/tree-view/use-tree-view.d.ts +26 -0
- package/dist/ink/components/variant-config.d.ts +10 -0
- package/dist/ink/cursor-helpers.d.ts +38 -0
- package/dist/ink/data-limited-lru-map.d.ts +21 -0
- package/dist/ink/devtools-window-polyfill.d.ts +1 -0
- package/dist/ink/devtools.d.ts +1 -0
- package/dist/ink/dom.d.ts +213 -0
- package/dist/ink/get-max-width.d.ts +3 -0
- package/dist/ink/highlighter.d.ts +28 -0
- package/dist/ink/hooks/use-animation.d.ts +43 -0
- package/dist/ink/hooks/use-app.d.ts +6 -0
- package/dist/ink/hooks/use-box-metrics.d.ts +58 -0
- package/dist/ink/hooks/use-clipboard.d.ts +29 -0
- package/dist/ink/hooks/use-color-blindness.d.ts +33 -0
- package/dist/ink/hooks/use-console-capture.d.ts +43 -0
- package/dist/ink/hooks/use-cursor.d.ts +12 -0
- package/dist/ink/hooks/use-focus-manager.d.ts +42 -0
- package/dist/ink/hooks/use-focus.d.ts +30 -0
- package/dist/ink/hooks/use-input.d.ts +149 -0
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +6 -0
- package/dist/ink/hooks/use-key-bindings.d.ts +61 -0
- package/dist/ink/hooks/use-linked-scroll.d.ts +41 -0
- package/dist/ink/hooks/use-paste.d.ts +44 -0
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +47 -0
- package/dist/ink/hooks/use-scroll-input.d.ts +34 -0
- package/dist/ink/hooks/use-stderr.d.ts +6 -0
- package/dist/ink/hooks/use-stdin.d.ts +7 -0
- package/dist/ink/hooks/use-stdout.d.ts +6 -0
- package/dist/ink/hooks/use-stopwatch.d.ts +40 -0
- package/dist/ink/hooks/use-terminal-palette.d.ts +19 -0
- package/dist/ink/hooks/use-text-buffer.d.ts +42 -0
- package/dist/ink/hooks/use-text-selection.d.ts +45 -0
- package/dist/ink/hooks/use-timer.d.ts +49 -0
- package/dist/ink/hooks/use-window-size.d.ts +18 -0
- package/dist/ink/ime-utils.d.ts +25 -0
- package/dist/ink/index.d.ts +159 -0
- package/dist/ink/index.js +100 -0
- package/dist/ink/ink.d.ts +189 -0
- package/dist/ink/input-parser.d.ts +10 -0
- package/dist/ink/input-utils.d.ts +16 -0
- package/dist/ink/instances.d.ts +3 -0
- package/dist/ink/kitty-keyboard.d.ts +23 -0
- package/dist/ink/layout.d.ts +26 -0
- package/dist/ink/log-update-native.d.ts +14 -0
- package/dist/ink/log-update.d.ts +21 -0
- package/dist/ink/measure-element.d.ts +147 -0
- package/dist/ink/measure-text.d.ts +56 -0
- package/dist/ink/mouse/Fullscreen.d.ts +8 -0
- package/dist/ink/mouse/MouseProvider.d.ts +11 -0
- package/dist/ink/mouse/ansi-parser.d.ts +37 -0
- package/dist/ink/mouse/constants.d.ts +59 -0
- package/dist/ink/mouse/index.d.ts +20 -0
- package/dist/ink/mouse/is-intersecting.d.ts +18 -0
- package/dist/ink/mouse/mouse-context.d.ts +36 -0
- package/dist/ink/mouse/use-element-position.d.ts +29 -0
- package/dist/ink/mouse/use-mouse-action.d.ts +7 -0
- package/dist/ink/mouse/use-mouse-position.d.ts +7 -0
- package/dist/ink/mouse/use-mouse.d.ts +7 -0
- package/dist/ink/mouse/use-on-mouse-click.d.ts +14 -0
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +8 -0
- package/dist/ink/mouse/use-on-mouse-state.d.ts +11 -0
- package/dist/ink/output.d.ts +74 -0
- package/dist/ink/parse-keypress.d.ts +22 -0
- package/dist/ink/reconciler.d.ts +3 -0
- package/dist/ink/region.d.ts +99 -0
- package/dist/ink/render-background.d.ts +4 -0
- package/dist/ink/render-border.d.ts +4 -0
- package/dist/ink/render-node-to-output.d.ts +38 -0
- package/dist/ink/render-scrollbar.d.ts +9 -0
- package/dist/ink/render-sticky.d.ts +44 -0
- package/dist/ink/render-to-string.d.ts +37 -0
- package/dist/ink/render.d.ts +191 -0
- package/dist/ink/renderer.d.ts +17 -0
- package/dist/ink/resize-observer.d.ts +44 -0
- package/dist/ink/sanitize-ansi.d.ts +2 -0
- package/dist/ink/scroll.d.ts +23 -0
- package/dist/ink/selection.d.ts +70 -0
- package/dist/ink/squash-text-nodes.d.ts +18 -0
- package/dist/ink/style-flags.d.ts +17 -0
- package/dist/ink/styled-line-factory.d.ts +25 -0
- package/dist/ink/styled-line-serializer.d.ts +18 -0
- package/dist/ink/styled-line.d.ts +109 -0
- package/dist/ink/styles.d.ts +369 -0
- package/dist/ink/terminal-palette.d.ts +25 -0
- package/dist/ink/text-wrap.d.ts +10 -0
- package/dist/ink/token-to-elements.d.ts +22 -0
- package/dist/ink/utils/format-time.d.ts +4 -0
- package/dist/ink/utils.d.ts +9 -0
- package/dist/ink/wrap-text.d.ts +3 -0
- package/dist/ink/write-synchronized.d.ts +4 -0
- package/dist/packem_chunks/devtools.js +27 -0
- package/dist/packem_shared/AccessibilityContext-BLelHhNU.js +7 -0
- package/dist/packem_shared/Alert-Dr3s_LD9.js +17 -0
- package/dist/packem_shared/AnimationContext-BcJg8Jr6.js +15 -0
- package/dist/packem_shared/AppContext-CP0U6H7O.js +11 -0
- package/dist/packem_shared/BackgroundContext-BAUaxfOb.js +5 -0
- package/dist/packem_shared/Badge-Dk7EGGM6.js +13 -0
- package/dist/packem_shared/BigText-CjMdY63X.js +24 -0
- package/dist/packem_shared/Box-D_pSJ9Jp.js +73 -0
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-BsMy5Ewl.js +81 -0
- package/dist/packem_shared/Cell-DCg1kJY-.js +48 -0
- package/dist/packem_shared/Code-DjQvPBD9.js +53 -0
- package/dist/packem_shared/ConfirmInput-85Y4kRQW.js +44 -0
- package/dist/packem_shared/ConsoleOverlay-DBNa4vtj.js +57 -0
- package/dist/packem_shared/ControlledScrollView-BlOaxcsN.js +286 -0
- package/dist/packem_shared/ControlledScrollView-DfAhcufF.js +5 -0
- package/dist/packem_shared/Cursor-DiW7YoSK.js +18 -0
- package/dist/packem_shared/CursorContext-JxRzlqAx.js +9 -0
- package/dist/packem_shared/DevTools-aMPIsaHx.js +61 -0
- package/dist/packem_shared/Dialog-DsSNAVgC.js +71 -0
- package/dist/packem_shared/DiffView-hqaw-2S6.js +329 -0
- package/dist/packem_shared/FilePicker-DNwFxRhq.js +254 -0
- package/dist/packem_shared/FocusContext-CWkYtgcm.js +26 -0
- package/dist/packem_shared/FocusContext-D5wFxSRz.js +153 -0
- package/dist/packem_shared/Fullscreen-DrElAE1o.js +11 -0
- package/dist/packem_shared/Gradient-Ql5P0GUd.js +136 -0
- package/dist/packem_shared/Help-6wanGG38.js +112 -0
- package/dist/packem_shared/IMECompositionBuffer-Dl3S0KnF.js +55 -0
- package/dist/packem_shared/InputParser-BKHpWfvN.js +156 -0
- package/dist/packem_shared/LayoutNode-Cjnsodiy.js +131 -0
- package/dist/packem_shared/Link-COcKYfGT.js +66 -0
- package/dist/packem_shared/Markdown-y1ISztof.js +212 -0
- package/dist/packem_shared/MouseProvider-Y9TSSEGl.js +136 -0
- package/dist/packem_shared/MultiSelect-ChoLUcDI.js +129 -0
- package/dist/packem_shared/NAMED_COLORS-a4QBvb5r.js +262 -0
- package/dist/packem_shared/Newline-DBtYEg8x.js +7 -0
- package/dist/packem_shared/OrderedList-Cp7pXr6m.js +26 -0
- package/dist/packem_shared/Paginator-D1AuD-kj.js +104 -0
- package/dist/packem_shared/ProgressBar-DOfpVagn.js +22 -0
- package/dist/packem_shared/Renderer-zZ5O3vxc.js +31 -0
- package/dist/packem_shared/ResizeObserverEntry-Br4seLeQ.js +102 -0
- package/dist/packem_shared/ScrollBar-EWAs2Uc7.js +106 -0
- package/dist/packem_shared/ScrollBarBox-DTNNlh7R.js +72 -0
- package/dist/packem_shared/ScrollList-DCeIFL8M.js +227 -0
- package/dist/packem_shared/ScrollView-v3MCNIyX.js +196 -0
- package/dist/packem_shared/SelectInput-BN2TMyxp.js +260 -0
- package/dist/packem_shared/SelectInputIndicator-DkRMoH_b.js +9 -0
- package/dist/packem_shared/SelectInputItem-BF9LQgKu.js +8 -0
- package/dist/packem_shared/Slider-BWD7xZX6.js +116 -0
- package/dist/packem_shared/Spacer-Bs4ER-HK.js +8 -0
- package/dist/packem_shared/Spinner-BuI-kN4p.js +1799 -0
- package/dist/packem_shared/Static-DpTd6Eed.js +22 -0
- package/dist/packem_shared/Static-xmD9giJj.js +18 -0
- package/dist/packem_shared/StaticRender-tYwH6QXl.js +33 -0
- package/dist/packem_shared/StatusMessage-BtSYxzwb.js +14 -0
- package/dist/packem_shared/StderrContext-Bj4Mf7v7.js +17 -0
- package/dist/packem_shared/StdinContext-Bq_GNJ3z.js +38 -0
- package/dist/packem_shared/StdoutContext-CgjWeCdO.js +17 -0
- package/dist/packem_shared/Stopwatch-DjtTCyHn.js +23 -0
- package/dist/packem_shared/Tab-C6r5q4hR.js +7 -0
- package/dist/packem_shared/Table-D-rSVlzb.js +82 -0
- package/dist/packem_shared/Tabs-hki-KRnx.js +153 -0
- package/dist/packem_shared/Text-DvAUdZcK.js +65 -0
- package/dist/packem_shared/TextInput-C79WEQ5U.js +137 -0
- package/dist/packem_shared/Textarea-Dj06R6Zd.js +272 -0
- package/dist/packem_shared/Timer-wi9zuh4n.js +22 -0
- package/dist/packem_shared/Transform-BHxY_dAM.js +14 -0
- package/dist/packem_shared/TreeNodeMap-CtJUvBnd.js +155 -0
- package/dist/packem_shared/TreeView-C2062dtj.js +148 -0
- package/dist/packem_shared/TuiApp-DfxOnXqi.js +120 -0
- package/dist/packem_shared/TuiContext-CqEjMyXd.js +415 -0
- package/dist/packem_shared/UnorderedList-DhnadWjX.js +33 -0
- package/dist/packem_shared/ansi-parser-0BdVTKho.js +41 -0
- package/dist/packem_shared/ansi-tokenizer-LHq2LUWA.js +307 -0
- package/dist/packem_shared/boxes-oi3WUbyR.js +92 -0
- package/dist/packem_shared/colorize-88_Vk8cn.js +48 -0
- package/dist/packem_shared/comparePoints-CGMDnd3_.js +287 -0
- package/dist/packem_shared/createInlineLoop-BxMmcq9D.js +93 -0
- package/dist/packem_shared/createLinkedScrollGroup-Djw4Ceo0.js +44 -0
- package/dist/packem_shared/dom-DvzhsAez.js +225 -0
- package/dist/packem_shared/format-time-BGmnDukX.js +12 -0
- package/dist/packem_shared/getPathToRoot-a1wbwxfL.js +4 -0
- package/dist/packem_shared/getScrollHeight-BubfU_df.js +63 -0
- package/dist/packem_shared/input-utils-ViAEXa0Z.js +19 -0
- package/dist/packem_shared/isIntersecting-fEXHJN5R.js +10 -0
- package/dist/packem_shared/isOsc52Supported-G0k4sXJx.js +36 -0
- package/dist/packem_shared/isTerminalPaletteQuerySupported-EeiwMKbr.js +93 -0
- package/dist/packem_shared/kittyFlags-bNNf_9kX.js +26 -0
- package/dist/packem_shared/measure-element-Reza_yfC.js +396 -0
- package/dist/packem_shared/measure-text-DItZYotK.js +1189 -0
- package/dist/packem_shared/measureElement-CTgFCmKd.js +4 -0
- package/dist/packem_shared/mouse-context-BUHWKEIe.js +6 -0
- package/dist/packem_shared/parseSgrMouse-BHVBPP9G.js +1 -0
- package/dist/packem_shared/processLayout-BQ9kXfd3.js +2 -0
- package/dist/packem_shared/reconciler-BXf6miSS.js +211 -0
- package/dist/packem_shared/reconciler-gfmqURLy.js +680 -0
- package/dist/packem_shared/render-BAwdjfki.js +2806 -0
- package/dist/packem_shared/render-Bpjhf0lD.js +195 -0
- package/dist/packem_shared/renderToString-Cfg55DRD.js +62 -0
- package/dist/packem_shared/renderToString-ClIaXgrC.js +86 -0
- package/dist/packem_shared/renderTreeToBuffer-D3mo7M7m.js +308 -0
- package/dist/packem_shared/renderer-B3wROkeg.js +1431 -0
- package/dist/packem_shared/setEnableStyledLineCache-BpskngSJ.js +2 -0
- package/dist/packem_shared/squashTextNodesWithMap-iqm6OMMT.js +100 -0
- package/dist/packem_shared/text-width-DhuarWcB.js +42 -0
- package/dist/packem_shared/token-to-elements-BRFl_rzw.js +249 -0
- package/dist/packem_shared/treeViewTheme-BpSw9TMf.js +52 -0
- package/dist/packem_shared/useAnimation-kj31sA-T.js +62 -0
- package/dist/packem_shared/useApp-DPQlRzi5.js +6 -0
- package/dist/packem_shared/useBoxMetrics-rBjKc-g4.js +54 -0
- package/dist/packem_shared/useClipboard-B_9-adw1.js +23 -0
- package/dist/packem_shared/useColorBlindness-D_sTIhcb.js +30 -0
- package/dist/packem_shared/useConsoleCapture-Dvt7G1W1.js +61 -0
- package/dist/packem_shared/useCursor-BIJzc8k9.js +19 -0
- package/dist/packem_shared/useElementDimensions-CAoKitVD.js +67 -0
- package/dist/packem_shared/useFocus-CNl5QHHf.js +37 -0
- package/dist/packem_shared/useFocusManager-BPYaUuKQ.js +16 -0
- package/dist/packem_shared/useInput-Cfp5zB2s.js +594 -0
- package/dist/packem_shared/useIsScreenReaderEnabled-CnGKCe0f.js +9 -0
- package/dist/packem_shared/useKeyBindings-B78l1E1n.js +66 -0
- package/dist/packem_shared/useMouseAction-C5gZ2nj7.js +29 -0
- package/dist/packem_shared/useMouseContext-D-rFy60Q.js +12 -0
- package/dist/packem_shared/useMousePosition-BHBJ-kBk.js +25 -0
- package/dist/packem_shared/useOnMouseClick--ZIyBOBO.js +35 -0
- package/dist/packem_shared/useOnMouseHover-26diuXUC.js +32 -0
- package/dist/packem_shared/useOnMouseState-NO_Kda_C.js +13 -0
- package/dist/packem_shared/usePaste-Ct8J4AGR.js +35 -0
- package/dist/packem_shared/useScrollAcceleration-R9LfrPVG.js +73 -0
- package/dist/packem_shared/useScrollInput-D3CpBq_a.js +72 -0
- package/dist/packem_shared/useStderr-CAOVUh4E.js +6 -0
- package/dist/packem_shared/useStdin-X-O0kd-n.js +7 -0
- package/dist/packem_shared/useStdout-DyF6DSH0.js +6 -0
- package/dist/packem_shared/useStopwatch-qC4Beai4.js +33 -0
- package/dist/packem_shared/useTerminalPalette-BaWO2c4Q.js +38 -0
- package/dist/packem_shared/useTextBuffer-C8fEe9Ly.js +398 -0
- package/dist/packem_shared/useTextSelection-mXtxgsPK.js +50 -0
- package/dist/packem_shared/useTimer-CPQ7j827.js +46 -0
- package/dist/packem_shared/useTreeView-BT57P3Kx.js +101 -0
- package/dist/packem_shared/useTreeViewState-BpS_KZ-K.js +502 -0
- package/dist/packem_shared/useWindowSize-ugEmGZJm.js +20 -0
- package/dist/packem_shared/utils-BgdlrbOH.js +140 -0
- package/dist/packem_shared/variant-config-DSZoX5TM.js +8 -0
- package/dist/packem_shared/wrapOrTruncateStyledLine-DN3Nogoc.js +147 -0
- package/dist/react/devtools.d.ts +27 -0
- package/dist/react/focus.d.ts +39 -0
- package/dist/react/hooks.d.ts +238 -0
- package/dist/react/index.d.ts +8 -0
- package/dist/react/index.js +9 -0
- package/dist/react/layout.d.ts +35 -0
- package/dist/react/react.d.ts +57 -0
- package/dist/react/reconciler.d.ts +4 -0
- package/dist/react/render-to-string.d.ts +21 -0
- package/dist/react/renderer.d.ts +2 -0
- package/dist/react/scene.d.ts +3 -0
- package/dist/react/static.d.ts +39 -0
- package/dist/react/styles.d.ts +83 -0
- package/dist/react/text-width.d.ts +20 -0
- package/dist/testing/index.d.ts +144 -0
- package/dist/testing/index.js +260 -0
- package/dist/testing/keys.d.ts +89 -0
- package/dist/testing/screen.d.ts +35 -0
- package/dist/testing/wait-for.d.ts +21 -0
- package/index.js +585 -0
- package/package.json +117 -7
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type ConsoleLevel = "debug" | "error" | "info" | "log" | "warn";
|
|
2
|
+
export type ConsoleEntry = {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly level: ConsoleLevel;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly timestamp: number;
|
|
7
|
+
};
|
|
8
|
+
export type UseConsoleCaptureOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* Which console levels to capture.
|
|
11
|
+
* @default ["log", "info", "warn", "error", "debug"]
|
|
12
|
+
*/
|
|
13
|
+
readonly filter?: ReadonlyArray<ConsoleLevel>;
|
|
14
|
+
/**
|
|
15
|
+
* Enable or disable capture.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
readonly isActive?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum number of entries to keep in the buffer.
|
|
21
|
+
* @default 200
|
|
22
|
+
*/
|
|
23
|
+
readonly maxEntries?: number;
|
|
24
|
+
};
|
|
25
|
+
export type UseConsoleCaptureResult = {
|
|
26
|
+
/** Clear all captured entries. */
|
|
27
|
+
readonly clear: () => void;
|
|
28
|
+
/** Captured console entries (newest last). */
|
|
29
|
+
readonly entries: ReadonlyArray<ConsoleEntry>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Hook that captures console output into a React state buffer.
|
|
33
|
+
*
|
|
34
|
+
* **Note:** Only one active `useConsoleCapture` instance should exist at a time.
|
|
35
|
+
* The `ConsoleOverlay` component uses this hook internally — do not use both
|
|
36
|
+
* simultaneously unless the hook instance has `isActive: false`.
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const { entries, clear } = useConsoleCapture({ maxEntries: 100 });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const useConsoleCapture: (options?: UseConsoleCaptureOptions) => UseConsoleCaptureResult;
|
|
43
|
+
export default useConsoleCapture;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CursorPosition } from "../log-update.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A React hook that returns methods to control the terminal cursor position.
|
|
4
|
+
*
|
|
5
|
+
* Setting a cursor position makes the cursor visible at the specified coordinates (relative to the Ink output origin). This is useful for IME (Input Method Editor) support, where the composing character is displayed at the cursor location.
|
|
6
|
+
*
|
|
7
|
+
* Pass `undefined` to hide the cursor.
|
|
8
|
+
*/
|
|
9
|
+
declare const useCursor: () => {
|
|
10
|
+
setCursorPosition: (position: CursorPosition | undefined) => void;
|
|
11
|
+
};
|
|
12
|
+
export default useCursor;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Props } from '../components/FocusContext.d.ts';
|
|
2
|
+
type Output = {
|
|
3
|
+
/**
|
|
4
|
+
* The ID of the currently focused component, or `undefined` if no component is focused.
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import {Text, useFocusManager} from 'ink';
|
|
8
|
+
*
|
|
9
|
+
* const Example = () => {
|
|
10
|
+
* const {activeId} = useFocusManager();
|
|
11
|
+
*
|
|
12
|
+
* return <Text>Focused: {activeId ?? 'none'}</Text>;
|
|
13
|
+
* };
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
activeId: Props["activeId"];
|
|
17
|
+
/**
|
|
18
|
+
* Disable focus management for all components. The currently active component (if there's one) will lose its focus.
|
|
19
|
+
*/
|
|
20
|
+
disableFocus: Props["disableFocus"];
|
|
21
|
+
/**
|
|
22
|
+
* Enable focus management for all components.
|
|
23
|
+
*/
|
|
24
|
+
enableFocus: Props["enableFocus"];
|
|
25
|
+
/**
|
|
26
|
+
* Switch focus to the element with provided `id`. If there's no element with that `id`, focus is not changed.
|
|
27
|
+
*/
|
|
28
|
+
focus: Props["focus"];
|
|
29
|
+
/**
|
|
30
|
+
* Switch focus to the next focusable component. If there's no active component right now, focus will be given to the first focusable component. If the active component is the last in the list of focusable components, focus will be switched to the first focusable component.
|
|
31
|
+
*/
|
|
32
|
+
focusNext: Props["focusNext"];
|
|
33
|
+
/**
|
|
34
|
+
* Switch focus to the previous focusable component. If there's no active component right now, focus will be given to the first focusable component. If the active component is the first in the list of focusable components, focus will be switched to the last focusable component.
|
|
35
|
+
*/
|
|
36
|
+
focusPrevious: Props["focusPrevious"];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A React hook that returns methods to enable or disable focus management for all components or manually switch focus to the next or previous components.
|
|
40
|
+
*/
|
|
41
|
+
declare const useFocusManager: () => Output;
|
|
42
|
+
export default useFocusManager;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type Input = {
|
|
2
|
+
/**
|
|
3
|
+
* Auto-focus this component if there's no active (focused) component right now.
|
|
4
|
+
*/
|
|
5
|
+
autoFocus?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Assign an ID to this component, so it can be programmatically focused with `focus(id)`.
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Enable or disable this component's focus, while still maintaining its position in the list of focusable components.
|
|
12
|
+
*/
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type Output = {
|
|
16
|
+
/**
|
|
17
|
+
* Allows focusing a specific element with the provided `id`.
|
|
18
|
+
*/
|
|
19
|
+
focus: (id: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Determines whether this component is focused.
|
|
22
|
+
*/
|
|
23
|
+
isFocused: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A React hook that returns focus state and focus controls for the current component.
|
|
27
|
+
* A component that uses the `useFocus` hook becomes "focusable" to Ink, so when the user presses <kbd>Tab</kbd>, Ink will switch focus to this component. If there are multiple components that execute the `useFocus` hook, focus will be given to them in the order in which these components are rendered.
|
|
28
|
+
*/
|
|
29
|
+
declare const useFocus: ({ autoFocus, id: customId, isActive }?: Input) => Output;
|
|
30
|
+
export default useFocus;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handy information about a key that was pressed.
|
|
3
|
+
*/
|
|
4
|
+
export type Key = {
|
|
5
|
+
/**
|
|
6
|
+
* Backspace key was pressed.
|
|
7
|
+
*/
|
|
8
|
+
backspace: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Caps Lock is active.
|
|
11
|
+
*
|
|
12
|
+
* Only available with kitty keyboard protocol.
|
|
13
|
+
*/
|
|
14
|
+
capsLock: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Ctrl key was pressed.
|
|
17
|
+
*/
|
|
18
|
+
ctrl: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Delete key was pressed.
|
|
21
|
+
*/
|
|
22
|
+
delete: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Down arrow key was pressed.
|
|
25
|
+
*/
|
|
26
|
+
downArrow: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* End key was pressed.
|
|
29
|
+
*/
|
|
30
|
+
end: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Escape key was pressed.
|
|
33
|
+
*/
|
|
34
|
+
escape: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Event type for key events.
|
|
37
|
+
*
|
|
38
|
+
* Only available with kitty keyboard protocol.
|
|
39
|
+
*/
|
|
40
|
+
eventType?: "press" | "repeat" | "release";
|
|
41
|
+
/**
|
|
42
|
+
* Home key was pressed.
|
|
43
|
+
*/
|
|
44
|
+
home: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Hyper key was pressed.
|
|
47
|
+
*
|
|
48
|
+
* Only available with kitty keyboard protocol.
|
|
49
|
+
*/
|
|
50
|
+
hyper: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Left arrow key was pressed.
|
|
53
|
+
*/
|
|
54
|
+
leftArrow: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* [Meta key](https://en.wikipedia.org/wiki/Meta_key) was pressed.
|
|
57
|
+
*/
|
|
58
|
+
meta: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Num Lock is active.
|
|
61
|
+
*
|
|
62
|
+
* Only available with kitty keyboard protocol.
|
|
63
|
+
*/
|
|
64
|
+
numLock: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Page Down key was pressed.
|
|
67
|
+
*/
|
|
68
|
+
pageDown: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Page Up key was pressed.
|
|
71
|
+
*/
|
|
72
|
+
pageUp: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Return (Enter) key was pressed.
|
|
75
|
+
*/
|
|
76
|
+
return: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Right arrow key was pressed.
|
|
79
|
+
*/
|
|
80
|
+
rightArrow: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Shift key was pressed.
|
|
83
|
+
*/
|
|
84
|
+
shift: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Super key (Cmd on Mac, Win on Windows) was pressed.
|
|
87
|
+
*
|
|
88
|
+
* Only available with kitty keyboard protocol.
|
|
89
|
+
*/
|
|
90
|
+
super: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Tab key was pressed.
|
|
93
|
+
*/
|
|
94
|
+
tab: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Up arrow key was pressed.
|
|
97
|
+
*/
|
|
98
|
+
upArrow: boolean;
|
|
99
|
+
};
|
|
100
|
+
type Handler = (input: string, key: Key) => void;
|
|
101
|
+
type Options = {
|
|
102
|
+
/**
|
|
103
|
+
* Enable IME (Input Method Editor) composition buffering for Vietnamese, Chinese,
|
|
104
|
+
* Japanese, Korean, and other non-ASCII input methods.
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
imeEnabled?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Timeout in milliseconds to wait before flushing IME composition buffer.
|
|
110
|
+
* @default 50
|
|
111
|
+
*/
|
|
112
|
+
imeTimeout?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Enable or disable capturing of user input. Useful when there are multiple `useInput` hooks used at once to avoid handling the same input several times.
|
|
115
|
+
* @default true
|
|
116
|
+
*/
|
|
117
|
+
isActive?: boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* A React hook that returns `void` and handles user input.
|
|
121
|
+
* It's a more convenient alternative to using `StdinContext` and listening for
|
|
122
|
+
* `data` events. The callback you pass to `useInput` is called for typed
|
|
123
|
+
* characters and key events.
|
|
124
|
+
*
|
|
125
|
+
* Bracketed paste payloads belong to `usePaste`. If no `usePaste` handler is
|
|
126
|
+
* active, Ink still forwards bracketed paste text to `useInput` for backward
|
|
127
|
+
* compatibility, but that fallback is deprecated and will be removed in the next
|
|
128
|
+
* major version.
|
|
129
|
+
*
|
|
130
|
+
* ```
|
|
131
|
+
* import {useInput} from 'ink';
|
|
132
|
+
*
|
|
133
|
+
* const UserInput = () => {
|
|
134
|
+
* useInput((input, key) => {
|
|
135
|
+
* if (input === 'q') {
|
|
136
|
+
* // Exit program
|
|
137
|
+
* }
|
|
138
|
+
*
|
|
139
|
+
* if (key.leftArrow) {
|
|
140
|
+
* // Left arrow key pressed
|
|
141
|
+
* }
|
|
142
|
+
* });
|
|
143
|
+
*
|
|
144
|
+
* return …
|
|
145
|
+
* };
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
declare const useInput: (inputHandler: Handler, options?: Options) => void;
|
|
149
|
+
export default useInput;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single key binding definition.
|
|
3
|
+
*/
|
|
4
|
+
export type KeyBinding = {
|
|
5
|
+
/** Human-readable description shown in Help. */
|
|
6
|
+
readonly description: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether this binding is active.
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
readonly enabled?: boolean;
|
|
13
|
+
/** Optional group name for organizing in the Help component's full mode. */
|
|
14
|
+
readonly group?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Key(s) that trigger this binding.
|
|
17
|
+
*
|
|
18
|
+
* A string can be:
|
|
19
|
+
* - A single character: `"q"`, `"a"`, `" "` (space)
|
|
20
|
+
* - A `Key` boolean field name: `"return"`, `"escape"`, `"upArrow"`, `"leftArrow"`, etc.
|
|
21
|
+
* - A modifier combo: `"ctrl+c"`, `"meta+s"` (modifier + character)
|
|
22
|
+
*
|
|
23
|
+
* Provide an array to match multiple keys for the same action.
|
|
24
|
+
*/
|
|
25
|
+
readonly key: string | readonly string[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A binding paired with its handler function.
|
|
29
|
+
*/
|
|
30
|
+
export type KeyBindingHandler = {
|
|
31
|
+
readonly binding: KeyBinding;
|
|
32
|
+
readonly handler: () => void;
|
|
33
|
+
};
|
|
34
|
+
type UseKeyBindingsOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* Whether keyboard input is captured.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
readonly isActive?: boolean;
|
|
41
|
+
};
|
|
42
|
+
type UseKeyBindingsResult = {
|
|
43
|
+
/** The enabled bindings, suitable for passing to the Help component. */
|
|
44
|
+
readonly bindings: readonly KeyBinding[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Declarative keybinding hook. Registers multiple key bindings with handlers
|
|
48
|
+
* and returns the enabled bindings for display in a Help component.
|
|
49
|
+
*
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const { bindings } = useKeyBindings([
|
|
52
|
+
* { binding: { key: "q", description: "Quit" }, handler: () => exit() },
|
|
53
|
+
* { binding: { key: ["upArrow", "k"], description: "Move up" }, handler: () => moveUp() },
|
|
54
|
+
* { binding: { key: "ctrl+s", description: "Save" }, handler: () => save() },
|
|
55
|
+
* ]);
|
|
56
|
+
*
|
|
57
|
+
* <Help bindings={bindings} />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export default function useKeyBindings(handlers: readonly KeyBindingHandler[], options?: UseKeyBindingsOptions): UseKeyBindingsResult;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import type { ScrollViewRef } from "../components/scroll/ScrollView.d.ts";
|
|
3
|
+
export type UseLinkedScrollReturn = {
|
|
4
|
+
/**
|
|
5
|
+
* Callback to pass to ScrollView's `onScroll` prop.
|
|
6
|
+
* Broadcasts the scroll position to all linked instances.
|
|
7
|
+
*/
|
|
8
|
+
onScroll: (scrollOffset: number) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Ref to attach to the ScrollView component.
|
|
11
|
+
* Used internally to call `scrollTo()` when other instances scroll.
|
|
12
|
+
*/
|
|
13
|
+
ref: RefObject<ScrollViewRef | null>;
|
|
14
|
+
};
|
|
15
|
+
export type LinkedScrollGroup = {
|
|
16
|
+
/**
|
|
17
|
+
* Hook that returns a ref and onScroll callback for linking a ScrollView
|
|
18
|
+
* to this group. Call once per ScrollView instance.
|
|
19
|
+
*/
|
|
20
|
+
useLinkedScroll: () => UseLinkedScrollReturn;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Creates a linked scroll group that synchronizes scroll position
|
|
24
|
+
* across multiple ScrollView instances.
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const group = createLinkedScrollGroup();
|
|
28
|
+
*
|
|
29
|
+
* const PanelA = () => {
|
|
30
|
+
* const { ref, onScroll } = group.useLinkedScroll();
|
|
31
|
+
* return <ScrollView ref={ref} onScroll={onScroll}>...</ScrollView>;
|
|
32
|
+
* };
|
|
33
|
+
*
|
|
34
|
+
* const PanelB = () => {
|
|
35
|
+
* const { ref, onScroll } = group.useLinkedScroll();
|
|
36
|
+
* return <ScrollView ref={ref} onScroll={onScroll}>...</ScrollView>;
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const createLinkedScrollGroup: () => LinkedScrollGroup;
|
|
41
|
+
export default createLinkedScrollGroup;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
type Options = {
|
|
2
|
+
/**
|
|
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
|
+
isActive?: boolean;
|
|
7
|
+
};
|
|
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, usePaste} from 'ink';
|
|
25
|
+
*
|
|
26
|
+
* const MyInput = () => {
|
|
27
|
+
* useInput((input, key) => {
|
|
28
|
+
* // Only receives typed characters and key events, not pasted text.
|
|
29
|
+
* if (key.return) {
|
|
30
|
+
* // Submit
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* usePaste((text) => {
|
|
35
|
+
* // Receives the full pasted string, including newlines.
|
|
36
|
+
* console.log('Pasted:', text);
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* return …
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare const usePaste: (handler: (text: string) => void, options?: Options) => void;
|
|
44
|
+
export default usePaste;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type UseScrollAccelerationOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Velocity multiplier per rapid scroll event.
|
|
4
|
+
* @default 1.5
|
|
5
|
+
*/
|
|
6
|
+
readonly acceleration?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Velocity decay factor per tick (0-1). Lower = faster stop.
|
|
9
|
+
* @default 0.92
|
|
10
|
+
*/
|
|
11
|
+
readonly decayRate?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Enable or disable acceleration.
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
readonly isActive?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum velocity in lines per tick.
|
|
19
|
+
* @default 20
|
|
20
|
+
*/
|
|
21
|
+
readonly maxVelocity?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Callback invoked with the scroll delta (signed integer lines) on each tick.
|
|
24
|
+
*/
|
|
25
|
+
readonly onScroll?: (delta: number) => void;
|
|
26
|
+
};
|
|
27
|
+
export type UseScrollAccelerationResult = {
|
|
28
|
+
/** Handle a discrete scroll event (from mouse wheel or keyboard). */
|
|
29
|
+
readonly handleScroll: (direction: "down" | "up") => void;
|
|
30
|
+
/** Whether momentum is still active (coasting after last input). */
|
|
31
|
+
readonly isCoasting: boolean;
|
|
32
|
+
/** Current velocity (positive = down, negative = up). */
|
|
33
|
+
readonly velocity: number;
|
|
34
|
+
};
|
|
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
|
+
*/
|
|
46
|
+
declare const useScrollAcceleration: (options?: UseScrollAccelerationOptions) => UseScrollAccelerationResult;
|
|
47
|
+
export default useScrollAcceleration;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type UseScrollInputOptions = {
|
|
2
|
+
/**
|
|
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
|
+
getViewportHeight: () => number;
|
|
7
|
+
/**
|
|
8
|
+
* Enable or disable scroll input handling.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
isActive?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Scroll by a relative delta (in lines).
|
|
14
|
+
*/
|
|
15
|
+
scrollBy: (delta: number) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Jump to the bottom of the content.
|
|
18
|
+
*/
|
|
19
|
+
scrollToBottom: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Jump to the top of the content.
|
|
22
|
+
*/
|
|
23
|
+
scrollToTop: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Enable vim-style keybindings (j/k/g/G/u/d).
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
vimBindings?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type UseScrollInputReturn = {
|
|
31
|
+
isFocused: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare const useScrollInput: (options: UseScrollInputOptions) => UseScrollInputReturn;
|
|
34
|
+
export default useScrollInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Props, PublicProps } from "../components/StdinContext.d.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A React hook that returns the stdin stream and stdin-related utilities.
|
|
4
|
+
*/
|
|
5
|
+
declare const useStdin: () => PublicProps;
|
|
6
|
+
export declare const useStdinContext: () => Props;
|
|
7
|
+
export default useStdin;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type UseStopwatchOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to start counting immediately.
|
|
4
|
+
*
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
readonly autoStart?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Tick interval in milliseconds.
|
|
10
|
+
*
|
|
11
|
+
* @default 1000
|
|
12
|
+
*/
|
|
13
|
+
readonly interval?: number;
|
|
14
|
+
};
|
|
15
|
+
export type UseStopwatchResult = {
|
|
16
|
+
/** Milliseconds elapsed since start (or last reset). */
|
|
17
|
+
readonly elapsed: number;
|
|
18
|
+
/** Whether the stopwatch is currently running. */
|
|
19
|
+
readonly isRunning: boolean;
|
|
20
|
+
/** Capture the current elapsed time as a lap. Returns the elapsed value. */
|
|
21
|
+
readonly lap: () => number;
|
|
22
|
+
/** Accumulated lap times. */
|
|
23
|
+
readonly laps: readonly number[];
|
|
24
|
+
/** Reset elapsed to 0, clear laps, and stop the stopwatch. */
|
|
25
|
+
readonly reset: () => void;
|
|
26
|
+
/** Start counting. */
|
|
27
|
+
readonly start: () => void;
|
|
28
|
+
/** Pause counting. */
|
|
29
|
+
readonly stop: () => void;
|
|
30
|
+
/** Toggle between running and stopped. */
|
|
31
|
+
readonly toggle: () => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A count-up stopwatch hook built on `useAnimation`.
|
|
35
|
+
*
|
|
36
|
+
* ```tsx
|
|
37
|
+
* const { elapsed, isRunning, start, stop, reset, lap, laps } = useStopwatch();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export default function useStopwatch(options?: UseStopwatchOptions): UseStopwatchResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TerminalPalette } from "../terminal-palette.d.ts";
|
|
2
|
+
export type UseTerminalPaletteResult = {
|
|
3
|
+
readonly isLoading: boolean;
|
|
4
|
+
readonly isSupported: boolean;
|
|
5
|
+
readonly palette: Partial<TerminalPalette> | null;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Hook that queries the terminal for its current color palette.
|
|
9
|
+
* Returns the detected palette colors or null if not yet loaded.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { palette, isLoading } = useTerminalPalette();
|
|
13
|
+
* if (palette?.background) {
|
|
14
|
+
* console.log("Terminal background:", palette.background);
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare const useTerminalPalette: () => UseTerminalPaletteResult;
|
|
19
|
+
export default useTerminalPalette;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type CursorPosition = {
|
|
2
|
+
readonly col: number;
|
|
3
|
+
readonly line: number;
|
|
4
|
+
};
|
|
5
|
+
export type TextBufferState = {
|
|
6
|
+
readonly anchor: CursorPosition | null;
|
|
7
|
+
readonly cursor: CursorPosition;
|
|
8
|
+
readonly lines: ReadonlyArray<string>;
|
|
9
|
+
};
|
|
10
|
+
export type UseTextBufferResult = {
|
|
11
|
+
readonly anchor: CursorPosition | null;
|
|
12
|
+
readonly clearSelection: () => void;
|
|
13
|
+
readonly cursor: CursorPosition;
|
|
14
|
+
readonly deleteBack: () => void;
|
|
15
|
+
readonly deleteForward: () => void;
|
|
16
|
+
readonly deleteLine: () => void;
|
|
17
|
+
readonly deleteSelection: () => void;
|
|
18
|
+
readonly deleteToLineEnd: () => void;
|
|
19
|
+
readonly deleteToLineStart: () => void;
|
|
20
|
+
readonly deleteWord: () => void;
|
|
21
|
+
readonly getSelectedText: () => string;
|
|
22
|
+
readonly hasSelection: () => boolean;
|
|
23
|
+
readonly insert: (text: string) => void;
|
|
24
|
+
readonly lines: ReadonlyArray<string>;
|
|
25
|
+
readonly moveCursor: (direction: "down" | "left" | "right" | "up", selecting?: boolean) => void;
|
|
26
|
+
readonly moveToEnd: (selecting?: boolean) => void;
|
|
27
|
+
readonly moveToLineEnd: (selecting?: boolean) => void;
|
|
28
|
+
readonly moveToLineStart: (selecting?: boolean) => void;
|
|
29
|
+
readonly moveToStart: (selecting?: boolean) => void;
|
|
30
|
+
readonly newline: () => void;
|
|
31
|
+
readonly redo: () => void;
|
|
32
|
+
readonly replaceSelection: (text: string) => void;
|
|
33
|
+
readonly selectAll: () => void;
|
|
34
|
+
readonly setValue: (value: string) => void;
|
|
35
|
+
readonly undo: () => void;
|
|
36
|
+
readonly value: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Hook managing a multi-line text buffer with cursor, selection, and undo/redo.
|
|
40
|
+
*/
|
|
41
|
+
declare const useTextBuffer: (initialValue?: string) => UseTextBufferResult;
|
|
42
|
+
export default useTextBuffer;
|