@visulima/tui 0.0.1 → 1.0.0-alpha.10
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 +331 -0
- package/LICENSE.md +497 -0
- package/README.md +173 -29
- package/dist/core/index.d.ts +58 -0
- package/dist/core/index.js +1 -0
- package/dist/ink/index.d.ts +6574 -0
- package/dist/ink/index.js +1 -0
- package/dist/packem_chunks/devtools.js +4 -0
- package/dist/packem_shared/Accordion-BXsqchV-.js +1 -0
- package/dist/packem_shared/Alert-BhYVMHtR.js +1 -0
- package/dist/packem_shared/AnimatePresence-Eu7Z8KHc.js +1 -0
- package/dist/packem_shared/ApprovalPrompt-BSn0FT1g.js +1 -0
- package/dist/packem_shared/AreaChart-Chy-frI7.js +1 -0
- package/dist/packem_shared/Badge-B8WPyRsK.js +1 -0
- package/dist/packem_shared/BarChart-rpZtlMcF.js +1 -0
- package/dist/packem_shared/BigText-CRpwUzrt.js +1 -0
- package/dist/packem_shared/BlinkDot-BvnRuWP8.js +1 -0
- package/dist/packem_shared/Box-BwqSvWuq.js +1 -0
- package/dist/packem_shared/Breadcrumb-D0hClbRV.js +1 -0
- package/dist/packem_shared/Button-B89Yvbc6.js +1 -0
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +1 -0
- package/dist/packem_shared/Calendar-Dmflvm2S.js +1 -0
- package/dist/packem_shared/Canvas-CKg6WV47.js +1 -0
- package/dist/packem_shared/Card-B_9fXdtU.js +1 -0
- package/dist/packem_shared/Cell-BrXn3jxY.js +1 -0
- package/dist/packem_shared/Checkbox-BN71eCWU.js +1 -0
- package/dist/packem_shared/Code-HhevcyiH.js +2 -0
- package/dist/packem_shared/Collapsible-u6uf_FdV.js +1 -0
- package/dist/packem_shared/CommandBlock-B-nslpCv.js +4 -0
- package/dist/packem_shared/CommandPalette-CEFdaURo.js +1 -0
- package/dist/packem_shared/ConfirmDialog-5Jje_Xpu.js +1 -0
- package/dist/packem_shared/ConfirmInput-D44Mb9oo.js +1 -0
- package/dist/packem_shared/ConsoleOverlay-CM3APfgP.js +1 -0
- package/dist/packem_shared/ContentSwitcher-Dm5BkrCt.js +1 -0
- package/dist/packem_shared/ControlledScrollView-DI8KZOQB.js +1 -0
- package/dist/packem_shared/Cursor-BoLFIMol.js +1 -0
- package/dist/packem_shared/DatePicker-CnSrFFAE.js +1 -0
- package/dist/packem_shared/DefinitionList-v8RDuF_R.js +1 -0
- package/dist/packem_shared/DevTools-O8EbCfHa.js +1 -0
- package/dist/packem_shared/Dialog-CTaL8pn0.js +1 -0
- package/dist/packem_shared/DiffView-BUIFqUB0.js +1 -0
- package/dist/packem_shared/Divider-C47bKmqu.js +1 -0
- package/dist/packem_shared/FilePicker-CUo7R5Qb.js +1 -0
- package/dist/packem_shared/FocusContext-Xy0cwJpO.js +1 -0
- package/dist/packem_shared/FormField-af3aUpRL.js +1 -0
- package/dist/packem_shared/Fullscreen-CuJ8y0s0.js +1 -0
- package/dist/packem_shared/Gauge-Dz-usH__.js +1 -0
- package/dist/packem_shared/Gradient-DYNc0GZA.js +1 -0
- package/dist/packem_shared/Heading-mwEYza3Y.js +1 -0
- package/dist/packem_shared/Heatmap-ChL97U1-.js +1 -0
- package/dist/packem_shared/Help-Zcelyw_U.js +1 -0
- package/dist/packem_shared/Histogram-FIf2F83d.js +1 -0
- package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +1 -0
- package/dist/packem_shared/InputParser-rZKjY_7Y.js +2 -0
- package/dist/packem_shared/KEY-Bk8B-3h_.js +1 -0
- package/dist/packem_shared/Kbd-DpkPp4jB.js +1 -0
- package/dist/packem_shared/LayoutNode-rxblE317.js +1 -0
- package/dist/packem_shared/LineChart-BXE_girm.js +1 -0
- package/dist/packem_shared/Link-i2o2EG4-.js +1 -0
- package/dist/packem_shared/LoadingIndicator-TC1Fjwyt.js +1 -0
- package/dist/packem_shared/Markdown-R1XqK63D.js +1 -0
- package/dist/packem_shared/MaskedInput-J01phOZs.js +1 -0
- package/dist/packem_shared/Menu-CfrH4ymk.js +1 -0
- package/dist/packem_shared/MessageBubble-BmBBU2Rm.js +1 -0
- package/dist/packem_shared/ModelBadge-D3wrXncu.js +1 -0
- package/dist/packem_shared/MouseProvider-pjza-lpc.js +1 -0
- package/dist/packem_shared/MultiSelect-Dqmn-bVo.js +1 -0
- package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +1 -0
- package/dist/packem_shared/Newline-BSG4iUqp.js +2 -0
- package/dist/packem_shared/OperationTree-DksxjMIV.js +1 -0
- package/dist/packem_shared/OptionList-CNx7r9yN.js +1 -0
- package/dist/packem_shared/OrderedList-BeDy035w.js +1 -0
- package/dist/packem_shared/Paginator-B56s6bhS.js +1 -0
- package/dist/packem_shared/Paragraph-BqJlH0R-.js +1 -0
- package/dist/packem_shared/Placeholder-GMpHRGC8.js +1 -0
- package/dist/packem_shared/ProgressBar-Bj3fmORR.js +1 -0
- package/dist/packem_shared/RadioGroup-Br8BeEwS.js +1 -0
- package/dist/packem_shared/Renderer-DJXooAsp.js +1 -0
- package/dist/packem_shared/ResizeObserverEntry-Dq0dk8Kq.js +1 -0
- package/dist/packem_shared/ScatterPlot-OhfYco5l.js +1 -0
- package/dist/packem_shared/ScrollBar-Da5Y3z7N.js +1 -0
- package/dist/packem_shared/ScrollBarBox-Dz6F-Eat.js +1 -0
- package/dist/packem_shared/ScrollList-DiVGyEjv.js +1 -0
- package/dist/packem_shared/ScrollView-BojONotI.js +1 -0
- package/dist/packem_shared/SearchInput-BoPTRbhV.js +1 -0
- package/dist/packem_shared/SelectInput-CAJ7SCBq.js +1 -0
- package/dist/packem_shared/SelectInputIndicator-N1n8ULHs.js +1 -0
- package/dist/packem_shared/SelectInputItem-BEkbmobs.js +1 -0
- package/dist/packem_shared/ShimmerText-CuGQ2NDC.js +1 -0
- package/dist/packem_shared/Slider-Cg_tJpKa.js +1 -0
- package/dist/packem_shared/Spacer-eT3HOrXk.js +1 -0
- package/dist/packem_shared/Sparkline-T6_FPVET.js +1 -0
- package/dist/packem_shared/Spinner-B0-A50pu.js +1 -0
- package/dist/packem_shared/Static-DLynr5pn.js +1 -0
- package/dist/packem_shared/Static-jzLPaHJF.js +1 -0
- package/dist/packem_shared/StaticRender-BgD61E7x.js +1 -0
- package/dist/packem_shared/StatusLine-Ch4jjef1.js +1 -0
- package/dist/packem_shared/StatusMessage-B1qfKeMM.js +1 -0
- package/dist/packem_shared/Stepper-CNPAqxiU.js +1 -0
- package/dist/packem_shared/Stopwatch-CAx2EWwq.js +1 -0
- package/dist/packem_shared/StreamingText-BYOKSB2T.js +1 -0
- package/dist/packem_shared/Switch-DzSpKYu7.js +1 -0
- package/dist/packem_shared/Tab-BcXzSUdj.js +1 -0
- package/dist/packem_shared/Table-DJp1TLrR.js +1 -0
- package/dist/packem_shared/Tabs-D68z0SOt.js +1 -0
- package/dist/packem_shared/Tag-BvLHnYRn.js +1 -0
- package/dist/packem_shared/Text-mTAve9R2.js +1 -0
- package/dist/packem_shared/TextInput-C_gYQlnF.js +1 -0
- package/dist/packem_shared/Textarea-C2ET_oMb.js +2 -0
- package/dist/packem_shared/Timer-CI3aQX65.js +1 -0
- package/dist/packem_shared/Toast-Drvc8XfG.js +1 -0
- package/dist/packem_shared/Tooltip-C5UnQlLd.js +1 -0
- package/dist/packem_shared/Transform-fYmcdqRT.js +1 -0
- package/dist/packem_shared/Transition-CJDBKYUB.js +1 -0
- package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +1 -0
- package/dist/packem_shared/TreeView-DjhacGJ5.js +1 -0
- package/dist/packem_shared/TuiApp-DrjI_i-R.js +1 -0
- package/dist/packem_shared/TuiContext-BoJvG3NN.js +3 -0
- package/dist/packem_shared/UnorderedList-BnfqexZs.js +1 -0
- package/dist/packem_shared/accessibility-context-DDyHTwmA.js +1 -0
- package/dist/packem_shared/animation-context-DW3p-vpk.js +1 -0
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +1 -0
- package/dist/packem_shared/ansi-tokenizer-DqX9nJuk.js +1 -0
- package/dist/packem_shared/app-context-BVpKlG1z.js +1 -0
- package/dist/packem_shared/background-context-rjOaWFki.js +1 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/braille-BBjIoaN0.js +1 -0
- package/dist/packem_shared/colorize-DbTZMrJO.js +1 -0
- package/dist/packem_shared/comparePoints-C85EsmNz.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-CmrAEvJk.js +1 -0
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +2 -0
- package/dist/packem_shared/createLinkedScrollGroup-BMTJ7rAj.js +1 -0
- package/dist/packem_shared/createMemoryStorage-QVZNXbWz.js +2 -0
- package/dist/packem_shared/createScreen-CrLrxA6t.js +3 -0
- package/dist/packem_shared/cursor-context-CFviBqPX.js +1 -0
- package/dist/packem_shared/dom-4y__5fWB.js +1 -0
- package/dist/packem_shared/focus-context-CsT69klR.js +1 -0
- package/dist/packem_shared/format-time-C7Q-hQZq.js +1 -0
- package/dist/packem_shared/getPathToRoot-B2tKmx3i.js +1 -0
- package/dist/packem_shared/getScrollHeight-BTEY8ewu.js +1 -0
- package/dist/packem_shared/input-utils-fAxzSlNh.js +1 -0
- package/dist/packem_shared/input.d-Bfq7oc06.d.ts +90 -0
- package/dist/packem_shared/isIntersecting-B3KbKTmu.js +1 -0
- package/dist/packem_shared/isOsc52Supported-DKK7Uee6.js +1 -0
- package/dist/packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js +1 -0
- package/dist/packem_shared/kittyFlags-C3rZLbcK.js +1 -0
- package/dist/packem_shared/line-chart-DrM8PwnI.js +1 -0
- package/dist/packem_shared/measure-element-DSp7YDus.js +2 -0
- package/dist/packem_shared/measure-text-DDjHT1jD.js +3 -0
- package/dist/packem_shared/measureElement-DA8WqFP_.js +1 -0
- package/dist/packem_shared/mouse-context-DaARgUu1.js +1 -0
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +1 -0
- package/dist/packem_shared/processLayout-DXDfFb_d.js +1 -0
- package/dist/packem_shared/reconciler-BuOP-TZ6.js +1 -0
- package/dist/packem_shared/reconciler-DSYCrIZs.js +1 -0
- package/dist/packem_shared/render-DDqtMAFN.js +1 -0
- package/dist/packem_shared/render-_r0K9K11.js +28 -0
- package/dist/packem_shared/render.d-BR3gA-N8.d.ts +1257 -0
- package/dist/packem_shared/renderToString-DeqOWRP8.js +4 -0
- package/dist/packem_shared/renderToString-IYYPyASm.js +2 -0
- package/dist/packem_shared/renderTreeToBuffer-DPkoCgP2.js +2 -0
- package/dist/packem_shared/renderer-D2p6av2X.js +17 -0
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +1 -0
- package/dist/packem_shared/squashTextNodesWithMap-Cpqmc45i.js +1 -0
- package/dist/packem_shared/stderr-context-BzEaUICS.js +1 -0
- package/dist/packem_shared/stdin-context-BTaaFagk.js +1 -0
- package/dist/packem_shared/stdout-context-BnblEPez.js +1 -0
- package/dist/packem_shared/text-width-CZ9vPvM0.js +2 -0
- package/dist/packem_shared/token-to-elements-BYxT6J_Q.js +1 -0
- package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +1 -0
- package/dist/packem_shared/useAnimation-B9we6ZzL.js +1 -0
- package/dist/packem_shared/useApp-B6fvM42d.js +1 -0
- package/dist/packem_shared/useBoxMetrics-D5pkIr6P.js +1 -0
- package/dist/packem_shared/useClipboard-CBxy0hT8.js +1 -0
- package/dist/packem_shared/useColorBlindness-BvWcu2Bb.js +1 -0
- package/dist/packem_shared/useConsoleCapture-BxiG8iLJ.js +1 -0
- package/dist/packem_shared/useCursor-CPu8T5Db.js +1 -0
- package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +1 -0
- package/dist/packem_shared/useFocus-DSmziO_x.js +1 -0
- package/dist/packem_shared/useFocusManager-Uapn3LQo.js +1 -0
- package/dist/packem_shared/useForm-CzV-Oext.js +1 -0
- package/dist/packem_shared/useHotkey-D0dGey14.js +1 -0
- package/dist/packem_shared/useInput-D1_jG26Z.js +2 -0
- package/dist/packem_shared/useInterval-AobjZT3u.js +1 -0
- package/dist/packem_shared/useIsScreenReaderEnabled-DjWHh-II.js +1 -0
- package/dist/packem_shared/useKeyBindings-zabkEJQs.js +1 -0
- package/dist/packem_shared/useKeyChord-CICQIxXj.js +1 -0
- package/dist/packem_shared/useMouseAction-2dRfU1vE.js +1 -0
- package/dist/packem_shared/useMouseContext-C746G7kY.js +1 -0
- package/dist/packem_shared/useMousePosition-BTWfV4JK.js +1 -0
- package/dist/packem_shared/useOnMouseClick-nY8xLZmt.js +1 -0
- package/dist/packem_shared/useOnMouseHover-D3DczIol.js +1 -0
- package/dist/packem_shared/useOnMouseState-cRK8QvzD.js +1 -0
- package/dist/packem_shared/usePaste-CKKB9H-Z.js +1 -0
- package/dist/packem_shared/useScrollAcceleration-NrY1oVMs.js +1 -0
- package/dist/packem_shared/useScrollInput-Caghtn-Q.js +1 -0
- package/dist/packem_shared/useStderr-BDZb6InG.js +1 -0
- package/dist/packem_shared/useStdin-DKa4h35k.js +1 -0
- package/dist/packem_shared/useStdout-B-2lX4C5.js +1 -0
- package/dist/packem_shared/useStopwatch-DffK7iMh.js +1 -0
- package/dist/packem_shared/useTerminalPalette-Cv7tSduR.js +1 -0
- package/dist/packem_shared/useTextBuffer-DekkGLxI.js +4 -0
- package/dist/packem_shared/useTextSelection-CGT0GLDR.js +1 -0
- package/dist/packem_shared/useTimeout-7LEFYTnG.js +1 -0
- package/dist/packem_shared/useTimer-DyoqSyGi.js +1 -0
- package/dist/packem_shared/useTreeView-8UlTK6sW.js +1 -0
- package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +1 -0
- package/dist/packem_shared/useWindowSize-yDZsXF8z.js +1 -0
- package/dist/packem_shared/utils-THUhYKG2.js +1 -0
- package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
- package/dist/packem_shared/waitFor-Dj5zfL5s.js +4 -0
- package/dist/packem_shared/wrapOrTruncateStyledLine-BZ00SM8i.js +3 -0
- package/dist/react/index.d.ts +519 -0
- package/dist/react/index.js +1 -0
- package/dist/testing/index.d.ts +283 -0
- package/dist/testing/index.js +1 -0
- package/index.js +737 -0
- package/package.json +113 -7
package/README.md
CHANGED
|
@@ -1,45 +1,189 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<a href="https://www.anolilab.com/open-source" align="center">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<img src="__assets__/package-og.svg" alt="tui" />
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
</a>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<h3 align="center">React-based TUI library powered by a native Rust diff engine, drop-in Ink-compatible API</h3>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@visulima/tui`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
11
|
+
<!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
<br />
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
<div align="center">
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
[![typescript-image][typescript-badge]][typescript-url]
|
|
18
|
+
[![mit licence][license-badge]][license]
|
|
19
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
20
|
+
[![Chat][chat-badge]][chat]
|
|
21
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
</div>
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
25
|
+
---
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
<div align="center">
|
|
28
|
+
<p>
|
|
29
|
+
<sup>
|
|
30
|
+
Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
|
|
31
|
+
</sup>
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
35
|
+
---
|
|
36
36
|
|
|
37
|
-
##
|
|
37
|
+
## Overview
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
39
|
+
`@visulima/tui` is a React-based terminal UI library with a native Rust diff engine and drop-in [Ink](https://github.com/vadimdemedes/ink)-compatible API. Build rich, interactive CLI applications with React components, hooks, and a familiar developer experience.
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
Based on [ratatat](https://github.com/geoffmiller/ratatat) by Geoff Miller.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- **Faster than Ink** on mount (1.3-2.3x), competitive on rerender
|
|
46
|
+
- **Drop-in Ink-compatible** React API
|
|
47
|
+
- **Native Rust diff engine** via NAPI for high-throughput rendering
|
|
48
|
+
- **React hooks** for input, focus, clipboard, mouse, scroll, animation, and window size
|
|
49
|
+
- **Rich component library** - Box, Text, Spinner, Select, TextInput, Tabs, ScrollView, and more
|
|
50
|
+
- **Cross-platform** native bindings (macOS, Linux glibc/musl, Windows x64/arm64)
|
|
51
|
+
- **Server-side rendering** via `renderToString`
|
|
52
|
+
- **Testing utilities** with mock streams and frame capture
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm install @visulima/tui react react-reconciler
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
yarn add @visulima/tui react react-reconciler
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
pnpm add @visulima/tui react react-reconciler
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { render, Box, Text } from "@visulima/tui";
|
|
72
|
+
|
|
73
|
+
const App = () => (
|
|
74
|
+
<Box flexDirection="column" padding={1}>
|
|
75
|
+
<Text bold>Hello, world!</Text>
|
|
76
|
+
<Text color="green">Powered by a native Rust diff engine</Text>
|
|
77
|
+
</Box>
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
render(<App />);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Hooks
|
|
84
|
+
|
|
85
|
+
### `useAnimation(options?)`
|
|
86
|
+
|
|
87
|
+
Drive frame-based or time-based animations with a shared timer. Multiple `useAnimation` calls consolidate into one render cycle.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { Text, useAnimation } from "@visulima/tui";
|
|
91
|
+
|
|
92
|
+
const Spinner = () => {
|
|
93
|
+
const { frame } = useAnimation({ interval: 80 });
|
|
94
|
+
const characters = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
95
|
+
|
|
96
|
+
return <Text>{characters[frame % characters.length]}</Text>;
|
|
97
|
+
};
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
| Option | Type | Default | Description |
|
|
101
|
+
| ---------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
102
|
+
| `interval` | `number` | `100` | Time between ticks in milliseconds. |
|
|
103
|
+
| `isActive` | `boolean` | `true` | Whether the animation is running. When set to `false`, the animation stops. When toggled back to `true`, values reset to 0. |
|
|
104
|
+
|
|
105
|
+
Returns `{ frame, time, delta, reset }`. See the [full hooks reference](https://visulima.com/packages/tui/hooks#useanimation) for detailed return values, more examples (sine waves, physics, pausable, reset), and `maxFps` interaction.
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
108
|
+
|
|
109
|
+
Full documentation, API reference, component gallery, and guides are available at:
|
|
110
|
+
|
|
111
|
+
**[visulima.com/packages/tui](https://visulima.com/packages/tui)**
|
|
112
|
+
|
|
113
|
+
- [Getting Started](https://visulima.com/packages/tui/getting-started)
|
|
114
|
+
- [Package Map](https://visulima.com/packages/tui/package-map) - Entry points and what they export
|
|
115
|
+
- [Components](https://visulima.com/packages/tui/components) - Box, Text, Spinner, Select, TextInput, and more
|
|
116
|
+
- [Hooks](https://visulima.com/packages/tui/hooks) - useInput, useFocus, useApp, useStdout, and more
|
|
117
|
+
- [Mouse Support](https://visulima.com/packages/tui/mouse) - Click, hover, drag, and scroll events
|
|
118
|
+
- [Scroll](https://visulima.com/packages/tui/scroll) - ScrollView, ScrollList, and overflow handling
|
|
119
|
+
- [Rendering Modes](https://visulima.com/packages/tui/rendering-modes) - Ink-compatible, React, and raw buffer
|
|
120
|
+
- [Ink Compatibility](https://visulima.com/packages/tui/ink-compat) - Migration guide from Ink
|
|
121
|
+
- [Testing](https://visulima.com/packages/tui/testing) - Testing utilities with mock streams
|
|
122
|
+
- [Troubleshooting](https://visulima.com/packages/tui/troubleshooting)
|
|
123
|
+
|
|
124
|
+
## Performance
|
|
125
|
+
|
|
126
|
+
| Scenario | @visulima/tui | Ink 6.8 | Speedup |
|
|
127
|
+
| -------------------------- | ------------: | -----------: | --------------: |
|
|
128
|
+
| Mount + render (simple) | 3,221 ops/s | 2,694 ops/s | **1.2x faster** |
|
|
129
|
+
| Mount + render (dashboard) | 1,659 ops/s | 718 ops/s | **2.3x faster** |
|
|
130
|
+
| Rerender (simple) | 19,111 ops/s | 25,743 ops/s | 0.74x |
|
|
131
|
+
|
|
132
|
+
> Benchmarks use production builds. Run: `pnpm --filter @visulima/tui run build:prod && pnpm vitest bench`
|
|
133
|
+
|
|
134
|
+
### Kitchen Sink Demo
|
|
135
|
+
|
|
136
|
+
| Layout | Focus | Graph | Live |
|
|
137
|
+
| ----------------------------------- | --------------------------------- | --------------------------------- | ------------------------------- |
|
|
138
|
+
|  |  |  |  |
|
|
139
|
+
|
|
140
|
+
| Incremental | UI | Static | Mouse |
|
|
141
|
+
| --------------------------------------------- | --------------------------- | ----------------------------------- | --------------------------------- |
|
|
142
|
+
|  |  |  |  |
|
|
143
|
+
|
|
144
|
+
## Related
|
|
145
|
+
|
|
146
|
+
- [ink](https://github.com/vadimdemedes/ink) - React for interactive command-line apps
|
|
147
|
+
- [ratatat](https://github.com/geoffmiller/ratatat) - The project this library is based on
|
|
148
|
+
- [jacob314/ink](https://github.com/jacob314/ink) - Fork with StyledLine, Region model, and render caching (ported features)
|
|
149
|
+
|
|
150
|
+
## Supported Node.js Versions
|
|
151
|
+
|
|
152
|
+
Libraries in this ecosystem make the best effort to track [Node.js' release schedule](https://github.com/nodejs/release#release-schedule).
|
|
153
|
+
Here's [a post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
154
|
+
|
|
155
|
+
## Contributing
|
|
156
|
+
|
|
157
|
+
If you would like to help take a look at the [list of issues](https://github.com/visulima/visulima/issues) and check our [Contributing](.github/CONTRIBUTING.md) guidelines.
|
|
158
|
+
|
|
159
|
+
> **Note:** please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
|
|
160
|
+
|
|
161
|
+
## Credits
|
|
162
|
+
|
|
163
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
164
|
+
- [Geoff Miller](https://github.com/geoffmiller) - Original [ratatat](https://github.com/geoffmiller/ratatat) library
|
|
165
|
+
- [Vadym Demedes](https://github.com/vadimdemedes) - [Ink](https://github.com/vadimdemedes/ink) (MIT)
|
|
166
|
+
- [Google LLC / jacob314](https://github.com/jacob314/ink) - StyledLine, Region model, render caching (Apache-2.0)
|
|
167
|
+
- [Zeno Jiricek](https://github.com/nickhudkins/ink-mouse) - Mouse event system (Apache-2.0)
|
|
168
|
+
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
169
|
+
|
|
170
|
+
## Made with ❤️ at Anolilab
|
|
171
|
+
|
|
172
|
+
This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
The visulima tui is open-sourced software licensed under the [MIT][license]
|
|
177
|
+
|
|
178
|
+
<!-- badges -->
|
|
44
179
|
|
|
45
|
-
|
|
180
|
+
[license-badge]: https://img.shields.io/npm/l/@visulima/tui?style=for-the-badge
|
|
181
|
+
[license]: https://github.com/visulima/visulima/blob/main/LICENSE
|
|
182
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/tui?style=for-the-badge
|
|
183
|
+
[npm-downloads]: https://www.npmjs.com/package/@visulima/tui
|
|
184
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
185
|
+
[prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
|
|
186
|
+
[chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
|
|
187
|
+
[chat]: https://discord.gg/TtFJY8xkFK
|
|
188
|
+
[typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
189
|
+
[typescript-url]: https://www.typescriptlang.org/
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export { I as InlineLoop, a as InlineOptions, b as InlinePaintFn, c as InputParser, M as MouseEvent, T as TuiApp, d as createInlineLoop } from "../packem_shared/input.d-Bfq7oc06.js";
|
|
2
|
+
import 'eventemitter3';
|
|
3
|
+
/**
|
|
4
|
+
* 2×u32 per-cell back-buffer layout:
|
|
5
|
+
* buffer[idx * 2] = charCode (Unicode codepoint, u32)
|
|
6
|
+
* buffer[idx * 2 + 1] = attrCode = (styles << 16) | (bg << 8) | fg
|
|
7
|
+
*/
|
|
8
|
+
declare const Cell: {
|
|
9
|
+
/** Read bg color from an attr slot value (buffer[idx*2+1]) — bits 15:8 */
|
|
10
|
+
getBg(attributeSlot: number): number;
|
|
11
|
+
/** Read the char character from a raw char slot value (buffer[idx*2]) */
|
|
12
|
+
getChar(charSlot: number): string;
|
|
13
|
+
/** Read fg color from an attr slot value (buffer[idx*2+1]) — bits 7:0 */
|
|
14
|
+
getFg(attributeSlot: number): number;
|
|
15
|
+
/** Read styles bitmask from an attr slot value (buffer[idx*2+1]) — bits 23:16 */
|
|
16
|
+
getStyles(attributeSlot: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Pack a cell into a [charCode, attrCode] tuple.
|
|
19
|
+
* charCode = char.codePointAt(0)
|
|
20
|
+
* attrCode = (styles & 0xFF) << 16 | (bg & 0xFF) << 8 | (fg & 0xFF)
|
|
21
|
+
*
|
|
22
|
+
* Write to buffer as: buffer[idx*2] = charCode; buffer[idx*2+1] = attrCode
|
|
23
|
+
*/
|
|
24
|
+
pack(char: string, fg?: number, bg?: number, styles?: number): [number, number];
|
|
25
|
+
};
|
|
26
|
+
declare const StyleMasks: {
|
|
27
|
+
BLINK: number;
|
|
28
|
+
BOLD: number;
|
|
29
|
+
DIM: number;
|
|
30
|
+
HIDDEN: number;
|
|
31
|
+
INVERT: number;
|
|
32
|
+
ITALIC: number;
|
|
33
|
+
STRIKETHROUGH: number;
|
|
34
|
+
UNDERLINE: number;
|
|
35
|
+
};
|
|
36
|
+
interface TerminalSize {
|
|
37
|
+
cols: number;
|
|
38
|
+
rows: number;
|
|
39
|
+
}
|
|
40
|
+
interface RendererInstance {
|
|
41
|
+
readonly height: number;
|
|
42
|
+
render: (backBuffer: Uint32Array) => void;
|
|
43
|
+
renderDiff: (backBuffer: Uint32Array) => string;
|
|
44
|
+
resize: (width: number, height: number) => void;
|
|
45
|
+
setRowOffset: (offset: number) => void;
|
|
46
|
+
readonly width: number;
|
|
47
|
+
writeRaw: (data: string) => void;
|
|
48
|
+
}
|
|
49
|
+
type RendererConstructor = new (width: number, height: number) => RendererInstance;
|
|
50
|
+
interface TerminalGuardInstance {
|
|
51
|
+
getSize: () => TerminalSize;
|
|
52
|
+
leave: () => void;
|
|
53
|
+
}
|
|
54
|
+
type TerminalGuardConstructor = new (mouse?: boolean | undefined | null) => TerminalGuardInstance;
|
|
55
|
+
declare const Renderer: RendererConstructor;
|
|
56
|
+
declare const TerminalGuard: TerminalGuardConstructor;
|
|
57
|
+
declare const terminalSize: () => TerminalSize;
|
|
58
|
+
export { Cell, Renderer, StyleMasks, TerminalGuard, type TerminalSize, terminalSize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{TuiApp as o}from"../packem_shared/TuiApp-DrjI_i-R.js";import{Cell as t,StyleMasks as m}from"../packem_shared/Cell-BrXn3jxY.js";import{createInlineLoop as l}from"../packem_shared/createInlineLoop-DRNZ7jqH.js";import{InputParser as f}from"../packem_shared/InputParser-rZKjY_7Y.js";import{Renderer as x,TerminalGuard as s,terminalSize as u}from"../packem_shared/Renderer-DJXooAsp.js";export{t as Cell,f as InputParser,x as Renderer,m as StyleMasks,s as TerminalGuard,o as TuiApp,l as createInlineLoop,u as terminalSize};
|