@visulima/tui-kit 0.0.0 → 1.0.0
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 +6 -0
- package/LICENSE.md +2095 -0
- package/README.md +115 -29
- package/dist/accordion.d.ts +59 -0
- package/dist/accordion.js +1 -0
- package/dist/alert.d.ts +26 -0
- package/dist/alert.js +1 -0
- package/dist/animate-presence.d.ts +18 -0
- package/dist/animate-presence.js +1 -0
- package/dist/approval-prompt.d.ts +65 -0
- package/dist/approval-prompt.js +1 -0
- package/dist/area-chart.d.ts +66 -0
- package/dist/area-chart.js +1 -0
- package/dist/badge.d.ts +22 -0
- package/dist/badge.js +1 -0
- package/dist/bar-chart.d.ts +67 -0
- package/dist/bar-chart.js +1 -0
- package/dist/big-text.d.ts +81 -0
- package/dist/big-text.js +1 -0
- package/dist/blink-dot.d.ts +36 -0
- package/dist/blink-dot.js +1 -0
- package/dist/breadcrumb.d.ts +33 -0
- package/dist/breadcrumb.js +1 -0
- package/dist/button.d.ts +45 -0
- package/dist/button.js +1 -0
- package/dist/calendar.d.ts +72 -0
- package/dist/calendar.js +1 -0
- package/dist/card.d.ts +57 -0
- package/dist/card.js +1 -0
- package/dist/checkbox-group.d.ts +59 -0
- package/dist/checkbox-group.js +1 -0
- package/dist/checkbox.d.ts +48 -0
- package/dist/checkbox.js +1 -0
- package/dist/code.d.ts +48 -0
- package/dist/code.js +2 -0
- package/dist/collapsible.d.ts +53 -0
- package/dist/collapsible.js +1 -0
- package/dist/color-picker.d.ts +71 -0
- package/dist/color-picker.js +1 -0
- package/dist/command-block.d.ts +47 -0
- package/dist/command-block.js +4 -0
- package/dist/command-palette.d.ts +82 -0
- package/dist/command-palette.js +1 -0
- package/dist/confirm-dialog.d.ts +75 -0
- package/dist/confirm-dialog.js +1 -0
- package/dist/confirm-input.d.ts +38 -0
- package/dist/confirm-input.js +1 -0
- package/dist/console-overlay.d.ts +54 -0
- package/dist/console-overlay.js +1 -0
- package/dist/content-switcher.d.ts +57 -0
- package/dist/content-switcher.js +1 -0
- package/dist/controlled-scroll-view.d.ts +3 -0
- package/dist/controlled-scroll-view.js +1 -0
- package/dist/data-grid.d.ts +49 -0
- package/dist/data-grid.js +1 -0
- package/dist/date-picker.d.ts +65 -0
- package/dist/date-picker.js +1 -0
- package/dist/definition-list.d.ts +44 -0
- package/dist/definition-list.js +1 -0
- package/dist/dialog.d.ts +110 -0
- package/dist/dialog.js +1 -0
- package/dist/diff-view.d.ts +85 -0
- package/dist/diff-view.js +1 -0
- package/dist/digits.d.ts +30 -0
- package/dist/digits.js +1 -0
- package/dist/directory-tree.d.ts +51 -0
- package/dist/directory-tree.js +1 -0
- package/dist/divider.d.ts +49 -0
- package/dist/divider.js +1 -0
- package/dist/drawer.d.ts +53 -0
- package/dist/drawer.js +1 -0
- package/dist/file-change.d.ts +40 -0
- package/dist/file-change.js +1 -0
- package/dist/file-picker-entry.d.ts +2 -0
- package/dist/file-picker-entry.js +1 -0
- package/dist/form.d.ts +81 -0
- package/dist/form.js +1 -0
- package/dist/gauge.d.ts +87 -0
- package/dist/gauge.js +1 -0
- package/dist/gradient.d.ts +42 -0
- package/dist/gradient.js +1 -0
- package/dist/grid.d.ts +40 -0
- package/dist/grid.js +1 -0
- package/dist/heading.d.ts +33 -0
- package/dist/heading.js +1 -0
- package/dist/heatmap.d.ts +62 -0
- package/dist/heatmap.js +1 -0
- package/dist/help.d.ts +52 -0
- package/dist/help.js +1 -0
- package/dist/histogram.d.ts +62 -0
- package/dist/histogram.js +1 -0
- package/dist/image.d.ts +26 -0
- package/dist/image.js +1 -0
- package/dist/index.d.ts +125 -0
- package/dist/index.js +1 -0
- package/dist/json.d.ts +58 -0
- package/dist/json.js +1 -0
- package/dist/kbd.d.ts +31 -0
- package/dist/kbd.js +1 -0
- package/dist/line-chart.d.ts +109 -0
- package/dist/line-chart.js +1 -0
- package/dist/link.d.ts +38 -0
- package/dist/link.js +1 -0
- package/dist/loading-indicator.d.ts +29 -0
- package/dist/loading-indicator.js +1 -0
- package/dist/log.d.ts +38 -0
- package/dist/log.js +1 -0
- package/dist/markdown.d.ts +40 -0
- package/dist/markdown.js +1 -0
- package/dist/masked-input.d.ts +50 -0
- package/dist/masked-input.js +1 -0
- package/dist/menu.d.ts +78 -0
- package/dist/menu.js +1 -0
- package/dist/message-bubble.d.ts +43 -0
- package/dist/message-bubble.js +1 -0
- package/dist/model-badge.d.ts +39 -0
- package/dist/model-badge.js +1 -0
- package/dist/model-selector.d.ts +52 -0
- package/dist/model-selector.js +1 -0
- package/dist/multi-progress.d.ts +55 -0
- package/dist/multi-progress.js +1 -0
- package/dist/multi-select.d.ts +65 -0
- package/dist/multi-select.js +1 -0
- package/dist/notification-badge.d.ts +47 -0
- package/dist/notification-badge.js +1 -0
- package/dist/number-input.d.ts +85 -0
- package/dist/number-input.js +1 -0
- package/dist/operation-tree.d.ts +49 -0
- package/dist/operation-tree.js +1 -0
- package/dist/option-list.d.ts +47 -0
- package/dist/option-list.js +1 -0
- package/dist/ordered-list.d.ts +24 -0
- package/dist/ordered-list.js +1 -0
- package/dist/packem_shared/ControlledScrollView-BzlbIUph.js +1 -0
- package/dist/packem_shared/FilePicker-V5H2fb-v.js +1 -0
- package/dist/packem_shared/ScrollBar-C9i3z3Ft.js +1 -0
- package/dist/packem_shared/ScrollBarBox-DZEC8YnV.js +1 -0
- package/dist/packem_shared/ScrollList-Djtb2vVy.js +1 -0
- package/dist/packem_shared/ScrollView-ESxpl6Hy.js +1 -0
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +1 -0
- package/dist/packem_shared/TreeView-q0l446NV.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-DerVKKv6.js +1 -0
- package/dist/packem_shared/controlled-scroll-view.d-vF4wevEJ.d.ts +54 -0
- package/dist/packem_shared/file-picker.d-Cie6aAMD.d.ts +104 -0
- package/dist/packem_shared/line-chart-BbhMhcZg.js +1 -0
- package/dist/packem_shared/scroll-bar-box.d-DSBbBsRc.d.ts +30 -0
- package/dist/packem_shared/scroll-bar.d-B4sD1hBR.d.ts +18 -0
- package/dist/packem_shared/scroll-list.d-BP0UZSY4.d.ts +12 -0
- package/dist/packem_shared/scroll-view.d-BqKpI-F-.d.ts +119 -0
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +1 -0
- package/dist/packem_shared/use-tree-view.d-dXTKoDPM.d.ts +350 -0
- package/dist/packem_shared/useTreeView-D0JEqT6W.js +1 -0
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +1 -0
- package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
- package/dist/paginator.d.ts +69 -0
- package/dist/paginator.js +1 -0
- package/dist/paragraph.d.ts +38 -0
- package/dist/paragraph.js +1 -0
- package/dist/path-input.d.ts +67 -0
- package/dist/path-input.js +1 -0
- package/dist/pie-chart.d.ts +50 -0
- package/dist/pie-chart.js +1 -0
- package/dist/placeholder.d.ts +55 -0
- package/dist/placeholder.js +1 -0
- package/dist/popover.d.ts +46 -0
- package/dist/popover.js +1 -0
- package/dist/progress-bar.d.ts +51 -0
- package/dist/progress-bar.js +1 -0
- package/dist/progress-circle.d.ts +59 -0
- package/dist/progress-circle.js +1 -0
- package/dist/qr-code.d.ts +45 -0
- package/dist/qr-code.js +1 -0
- package/dist/r/accordion.json +24 -0
- package/dist/r/alert.json +24 -0
- package/dist/r/animate-presence.json +22 -0
- package/dist/r/approval-prompt.json +24 -0
- package/dist/r/area-chart.json +27 -0
- package/dist/r/badge.json +24 -0
- package/dist/r/bar-chart.json +24 -0
- package/dist/r/big-text.json +23 -0
- package/dist/r/blink-dot.json +24 -0
- package/dist/r/breadcrumb.json +24 -0
- package/dist/r/button.json +24 -0
- package/dist/r/calendar.json +24 -0
- package/dist/r/card.json +26 -0
- package/dist/r/chart-utils.json +24 -0
- package/dist/r/checkbox-group.json +24 -0
- package/dist/r/checkbox.json +24 -0
- package/dist/r/code.json +23 -0
- package/dist/r/collapsible.json +24 -0
- package/dist/r/color-picker.json +24 -0
- package/dist/r/command-block.json +26 -0
- package/dist/r/command-palette.json +24 -0
- package/dist/r/confirm-dialog.json +24 -0
- package/dist/r/confirm-input.json +22 -0
- package/dist/r/console-overlay.json +22 -0
- package/dist/r/content-switcher.json +24 -0
- package/dist/r/controlled-scroll-view.json +24 -0
- package/dist/r/data-grid.json +24 -0
- package/dist/r/date-picker.json +26 -0
- package/dist/r/definition-list.json +24 -0
- package/dist/r/dialog.json +24 -0
- package/dist/r/diff-view.json +24 -0
- package/dist/r/digits.json +24 -0
- package/dist/r/directory-tree.json +24 -0
- package/dist/r/divider.json +24 -0
- package/dist/r/drawer.json +24 -0
- package/dist/r/file-change.json +24 -0
- package/dist/r/file-picker.json +44 -0
- package/dist/r/form.json +24 -0
- package/dist/r/gauge.json +24 -0
- package/dist/r/gradient.json +24 -0
- package/dist/r/grid.json +22 -0
- package/dist/r/heading.json +24 -0
- package/dist/r/heatmap.json +24 -0
- package/dist/r/help.json +22 -0
- package/dist/r/histogram.json +26 -0
- package/dist/r/image.json +24 -0
- package/dist/r/json.json +24 -0
- package/dist/r/kbd.json +24 -0
- package/dist/r/line-chart.json +26 -0
- package/dist/r/link.json +23 -0
- package/dist/r/loading-indicator.json +27 -0
- package/dist/r/log.json +24 -0
- package/dist/r/markdown.json +29 -0
- package/dist/r/masked-input.json +22 -0
- package/dist/r/menu.json +24 -0
- package/dist/r/message-bubble.json +24 -0
- package/dist/r/model-badge.json +24 -0
- package/dist/r/model-selector.json +24 -0
- package/dist/r/multi-progress.json +24 -0
- package/dist/r/multi-select.json +24 -0
- package/dist/r/notification-badge.json +24 -0
- package/dist/r/number-input.json +24 -0
- package/dist/r/operation-tree.json +26 -0
- package/dist/r/option-list.json +24 -0
- package/dist/r/ordered-list.json +22 -0
- package/dist/r/paginator.json +22 -0
- package/dist/r/paragraph.json +24 -0
- package/dist/r/path-input.json +26 -0
- package/dist/r/pie-chart.json +24 -0
- package/dist/r/placeholder.json +24 -0
- package/dist/r/popover.json +24 -0
- package/dist/r/progress-bar.json +22 -0
- package/dist/r/progress-circle.json +24 -0
- package/dist/r/qr-code.json +24 -0
- package/dist/r/radio-group.json +24 -0
- package/dist/r/registry.json +1051 -0
- package/dist/r/scatter-plot.json +27 -0
- package/dist/r/scroll-bar-box.json +24 -0
- package/dist/r/scroll-bar.json +24 -0
- package/dist/r/scroll-list.json +24 -0
- package/dist/r/scroll-view.json +24 -0
- package/dist/r/scroll.json +58 -0
- package/dist/r/search-input.json +26 -0
- package/dist/r/select-input-indicator.json +24 -0
- package/dist/r/select-input-item.json +24 -0
- package/dist/r/select-input.json +28 -0
- package/dist/r/shimmer-text.json +24 -0
- package/dist/r/sidebar.json +24 -0
- package/dist/r/slider.json +24 -0
- package/dist/r/sparkline.json +24 -0
- package/dist/r/spinner.json +23 -0
- package/dist/r/status-line.json +24 -0
- package/dist/r/status-message.json +24 -0
- package/dist/r/stepper.json +24 -0
- package/dist/r/stopwatch.json +22 -0
- package/dist/r/streaming-text.json +24 -0
- package/dist/r/switch.json +24 -0
- package/dist/r/tab.json +22 -0
- package/dist/r/table.json +23 -0
- package/dist/r/tabs.json +26 -0
- package/dist/r/tag-input.json +24 -0
- package/dist/r/tag.json +24 -0
- package/dist/r/text-input.json +22 -0
- package/dist/r/textarea.json +22 -0
- package/dist/r/thinking-block.json +24 -0
- package/dist/r/time-picker.json +24 -0
- package/dist/r/timer.json +22 -0
- package/dist/r/toast.json +24 -0
- package/dist/r/token-usage.json +24 -0
- package/dist/r/tool-call.json +24 -0
- package/dist/r/tooltip.json +24 -0
- package/dist/r/transition.json +22 -0
- package/dist/r/tree-select.json +24 -0
- package/dist/r/tree-view.json +64 -0
- package/dist/r/unordered-list.json +22 -0
- package/dist/r/use-linked-scroll.json +24 -0
- package/dist/r/variant-config.json +22 -0
- package/dist/radio-group.d.ts +74 -0
- package/dist/radio-group.js +1 -0
- package/dist/scatter-plot.d.ts +35 -0
- package/dist/scatter-plot.js +1 -0
- package/dist/scroll-bar-box.d.ts +3 -0
- package/dist/scroll-bar-box.js +1 -0
- package/dist/scroll-bar.d.ts +3 -0
- package/dist/scroll-bar.js +1 -0
- package/dist/scroll-list.d.ts +4 -0
- package/dist/scroll-list.js +1 -0
- package/dist/scroll-view.d.ts +3 -0
- package/dist/scroll-view.js +1 -0
- package/dist/search-input.d.ts +55 -0
- package/dist/search-input.js +1 -0
- package/dist/select-input-indicator.d.ts +32 -0
- package/dist/select-input-indicator.js +1 -0
- package/dist/select-input-item.d.ts +41 -0
- package/dist/select-input-item.js +1 -0
- package/dist/select-input.d.ts +110 -0
- package/dist/select-input.js +1 -0
- package/dist/shimmer-text.d.ts +47 -0
- package/dist/shimmer-text.js +1 -0
- package/dist/sidebar.d.ts +47 -0
- package/dist/sidebar.js +1 -0
- package/dist/slider.d.ts +103 -0
- package/dist/slider.js +1 -0
- package/dist/sparkline.d.ts +42 -0
- package/dist/sparkline.js +1 -0
- package/dist/spinner.d.ts +17 -0
- package/dist/spinner.js +1 -0
- package/dist/status-line.d.ts +37 -0
- package/dist/status-line.js +1 -0
- package/dist/status-message.d.ts +21 -0
- package/dist/status-message.js +1 -0
- package/dist/stepper.d.ts +48 -0
- package/dist/stepper.js +1 -0
- package/dist/stopwatch.d.ts +49 -0
- package/dist/stopwatch.js +1 -0
- package/dist/streaming-text.d.ts +46 -0
- package/dist/streaming-text.js +1 -0
- package/dist/switch.d.ts +55 -0
- package/dist/switch.js +1 -0
- package/dist/tab.d.ts +19 -0
- package/dist/tab.js +1 -0
- package/dist/table.d.ts +119 -0
- package/dist/table.js +1 -0
- package/dist/tabs.d.ts +107 -0
- package/dist/tabs.js +1 -0
- package/dist/tag-input.d.ts +71 -0
- package/dist/tag-input.js +1 -0
- package/dist/tag.d.ts +35 -0
- package/dist/tag.js +1 -0
- package/dist/text-input.d.ts +48 -0
- package/dist/text-input.js +1 -0
- package/dist/textarea.d.ts +68 -0
- package/dist/textarea.js +2 -0
- package/dist/thinking-block.d.ts +57 -0
- package/dist/thinking-block.js +1 -0
- package/dist/time-picker.d.ts +67 -0
- package/dist/time-picker.js +1 -0
- package/dist/timer.d.ts +59 -0
- package/dist/timer.js +1 -0
- package/dist/toast.d.ts +49 -0
- package/dist/toast.js +1 -0
- package/dist/token-usage.d.ts +50 -0
- package/dist/token-usage.js +1 -0
- package/dist/tool-call.d.ts +33 -0
- package/dist/tool-call.js +1 -0
- package/dist/tooltip.d.ts +43 -0
- package/dist/tooltip.js +1 -0
- package/dist/transition.d.ts +74 -0
- package/dist/transition.js +1 -0
- package/dist/tree-select.d.ts +65 -0
- package/dist/tree-select.js +1 -0
- package/dist/tree-view-entry.d.ts +4 -0
- package/dist/tree-view-entry.js +1 -0
- package/dist/unordered-list.d.ts +30 -0
- package/dist/unordered-list.js +1 -0
- package/dist/use-linked-scroll.d.ts +42 -0
- package/dist/use-linked-scroll.js +1 -0
- package/package.json +553 -7
package/README.md
CHANGED
|
@@ -1,45 +1,131 @@
|
|
|
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-kit" />
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
</a>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
<h3 align="center">Component library for @visulima/tui — installable as a package, or copy-pasteable via the shadcn CLI registry</h3>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@visulima/tui-kit`
|
|
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
|
+
<div align="center">
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
[![typescript-image][typescript-badge]][typescript-url]
|
|
16
|
+
[![mit licence][license-badge]][license]
|
|
17
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
18
|
+
[![Chat][chat-badge]][chat]
|
|
19
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
</div>
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<div align="center">
|
|
26
|
+
<p>
|
|
27
|
+
<sup>
|
|
28
|
+
Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
|
|
29
|
+
</sup>
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
23
32
|
|
|
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
|
|
33
|
+
---
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
Charts, inputs, overlays, layout and AI-chat components for [`@visulima/tui`](../tui/README.md). Every component is rendered by the `@visulima/tui` runtime — its React reconciler, yoga layout and native Rust diff engine — so this package holds components only.
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
37
|
+
## Two ways to use it
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
Pick whichever fits. The source is identical; only the delivery differs.
|
|
38
40
|
|
|
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)
|
|
41
|
+
### 1. Install it
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
You get versioned components and upgrades for free. Each component is its own subpath export, so you only pay for what you import.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @visulima/tui @visulima/tui-kit
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pnpm add @visulima/tui @visulima/tui-kit
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { render } from "@visulima/tui";
|
|
55
|
+
import Box from "@visulima/tui/components/box";
|
|
56
|
+
import Gauge from "@visulima/tui-kit/gauge";
|
|
57
|
+
|
|
58
|
+
render(
|
|
59
|
+
<Box>
|
|
60
|
+
<Gauge label="CPU" value={72} />
|
|
61
|
+
</Box>,
|
|
62
|
+
);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 2. Copy it in
|
|
66
|
+
|
|
67
|
+
You own the code and can change anything. The component is copied into your repo; `@visulima/tui` stays an installed dependency because the renderer can't be copy-pasted.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
npx shadcn@latest add https://visulima.com/r/gauge.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Components that build on others (`area-chart` uses `line-chart` and `chart-utils`) declare those as registry dependencies, so the CLI fetches them too.
|
|
74
|
+
|
|
75
|
+
> **Note:** copied files use the automatic JSX runtime and do not import React. Your `tsconfig.json` needs `"jsx": "react-jsx"`, otherwise you'll hit `ReferenceError: React is not defined`.
|
|
76
|
+
|
|
77
|
+
## What lives where
|
|
78
|
+
|
|
79
|
+
`@visulima/tui` owns the runtime and the primitives every component builds on — `Box`, `Text`, `Canvas`, `Cursor`, `Newline`, `Spacer`, `Static`, `StaticRender`, `Transform` — plus the hooks (`@visulima/tui/hooks/*`). Import those from there:
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import Box from "@visulima/tui/components/box";
|
|
83
|
+
import Text from "@visulima/tui/components/text";
|
|
84
|
+
import useInput from "@visulima/tui/hooks/use-input";
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Everything above that layer lives here: charts (`gauge`, `area-chart`, `bar-chart`, `line-chart`, `sparkline`, `heatmap`, `histogram`, `scatter-plot`), inputs (`text-input`, `textarea`, `select-input`, `multi-select`, `slider`, `date-picker`, `calendar`, `masked-input`, `search-input`), overlays (`dialog`, `toast`, `tooltip`, `command-palette`), layout (`card`, `table`, `tabs`, `tree-view`, `scroll-view`), and AI-chat widgets (`message-bubble`, `streaming-text`, `approval-prompt`, `operation-tree`).
|
|
88
|
+
|
|
89
|
+
## Heavy features are optional
|
|
90
|
+
|
|
91
|
+
Some components need a peer that is not installed by default, so unused features cost nothing. Install the peer only if you use the component:
|
|
92
|
+
|
|
93
|
+
| Component | Peer |
|
|
94
|
+
| ------------------ | ---------------------------------- |
|
|
95
|
+
| `code`, `markdown` | `shiki`, `@shikijs/langs`/`themes` |
|
|
96
|
+
| `markdown` | `marked` |
|
|
97
|
+
| `diff-view` | `diff` |
|
|
98
|
+
| `big-text` | `cfonts` |
|
|
99
|
+
| `table` | `@visulima/tabular` |
|
|
100
|
+
|
|
101
|
+
## Contributing
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
|
|
105
|
+
> **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.
|
|
106
|
+
|
|
107
|
+
## Credits
|
|
108
|
+
|
|
109
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
110
|
+
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
111
|
+
|
|
112
|
+
## Made with ❤️ at Anolilab
|
|
113
|
+
|
|
114
|
+
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!
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
The visulima tui-kit is open-sourced software licensed under the [MIT][license]
|
|
119
|
+
|
|
120
|
+
<!-- badges -->
|
|
44
121
|
|
|
45
|
-
|
|
122
|
+
[license-badge]: https://img.shields.io/npm/l/@visulima/tui-kit?style=for-the-badge
|
|
123
|
+
[license]: https://github.com/visulima/visulima/blob/main/LICENSE
|
|
124
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/tui-kit?style=for-the-badge
|
|
125
|
+
[npm-downloads]: https://www.npmjs.com/package/@visulima/tui-kit
|
|
126
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
127
|
+
[prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
|
|
128
|
+
[chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
|
|
129
|
+
[chat]: https://discord.gg/TtFJY8xkFK
|
|
130
|
+
[typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
131
|
+
[typescript-url]: https://www.typescriptlang.org/
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type AccordionItem = {
|
|
5
|
+
/**
|
|
6
|
+
* Content rendered when the item is expanded.
|
|
7
|
+
*/
|
|
8
|
+
readonly content: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier.
|
|
11
|
+
*/
|
|
12
|
+
readonly id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Header label.
|
|
15
|
+
*/
|
|
16
|
+
readonly title: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
type Props = {
|
|
19
|
+
/**
|
|
20
|
+
* Accent color for the focused header.
|
|
21
|
+
* @default "blue"
|
|
22
|
+
*/
|
|
23
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
24
|
+
/**
|
|
25
|
+
* When true, multiple panels can be open at once.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
readonly allowMultiple?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Auto-focus the first item on mount.
|
|
31
|
+
*/
|
|
32
|
+
readonly autoFocus?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Initially open item ids.
|
|
35
|
+
*/
|
|
36
|
+
readonly defaultExpanded?: ReadonlyArray<string>;
|
|
37
|
+
/**
|
|
38
|
+
* Disable interaction.
|
|
39
|
+
*/
|
|
40
|
+
readonly isDisabled?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* List of panels.
|
|
43
|
+
*/
|
|
44
|
+
readonly items: ReadonlyArray<AccordionItem>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Keyboard-navigable accordion. Use arrow keys to move between panels and
|
|
48
|
+
* Enter / Space to toggle.
|
|
49
|
+
* @returns A `ReactElement` rendering the accordion column.
|
|
50
|
+
*/
|
|
51
|
+
declare function Accordion({
|
|
52
|
+
accentColor,
|
|
53
|
+
allowMultiple,
|
|
54
|
+
autoFocus,
|
|
55
|
+
defaultExpanded,
|
|
56
|
+
isDisabled,
|
|
57
|
+
items
|
|
58
|
+
}: Props): ReactElement;
|
|
59
|
+
export { Accordion, AccordionItem, type Props as AccordionProps, Props, Accordion as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as m,jsxs as a}from"react/jsx-runtime";import u from"@visulima/tui/components/box";import b from"@visulima/tui/components/text";import F from"@visulima/tui/hooks/use-focus";import j from"@visulima/tui/hooks/use-input";import{useState as v,useRef as k,useCallback as A}from"react";function R({accentColor:D="blue",allowMultiple:d=!1,autoFocus:g=!1,defaultExpanded:n,isDisabled:c=!1,items:l}){const{isFocused:s}=F({autoFocus:g,isActive:!c}),[w,C]=v(()=>n===void 0||n.length===0?[]:d?n:n.slice(0,1)),[f,p]=v(0),i=k(f);i.current=f;const h=A(r=>{C(e=>{const o=e.includes(r);return d?o?e.filter(t=>t!==r):[...e,r]:o?[]:[r]})},[d]);return j(A((r,e)=>{if(!s)return;const o=l.length;if((e.downArrow||r==="j")&&i.current<o-1)p(i.current+1);else if((e.upArrow||r==="k")&&i.current>0)p(i.current-1);else if(e.return||r===" "){const t=l[i.current];t&&h(t.id)}},[s,l,h]),{isActive:!c&&s}),m(u,{flexDirection:"column",children:l.map((r,e)=>{const o=w.includes(r.id),t=s&&e===f,x=t?D:void 0;return a(u,{flexDirection:"column",children:[a(u,{children:[a(b,{color:x,dimColor:c,children:[t?"▸ ":" ",o?"▼ ":"▶ "]}),m(b,{bold:t,color:x,dimColor:c,children:r.title})]}),o?m(u,{flexDirection:"column",marginBottom:1,marginLeft:4,children:r.content}):void 0]},r.id)})})}export{R as Accordion,R as default};
|
package/dist/alert.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
import { V as Variant } from "./packem_shared/variant-config.d-D5NnrrQK.js";
|
|
3
|
+
type AlertVariant = Variant;
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Alert message content.
|
|
7
|
+
*/
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Optional heading displayed above the message.
|
|
11
|
+
*/
|
|
12
|
+
readonly title?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Determines the border color and icon.
|
|
15
|
+
*/
|
|
16
|
+
readonly variant: AlertVariant;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Renders a bordered alert box with a variant-specific icon, optional title, and message.
|
|
20
|
+
*/
|
|
21
|
+
declare function Alert({
|
|
22
|
+
children,
|
|
23
|
+
title,
|
|
24
|
+
variant
|
|
25
|
+
}: Props): ReactElement;
|
|
26
|
+
export { Alert, type Props as AlertProps, AlertVariant, Props, Alert as default };
|
package/dist/alert.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as n,jsx as r}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";import{o as f}from"./packem_shared/variant-config-BJqpNo7H.js";function p({children:d,title:e,variant:t}){const{color:l,icon:c}=f[t];return n(o,{borderColor:l,borderStyle:"round",flexGrow:1,gap:1,paddingX:1,children:[r(o,{flexShrink:0,children:r(i,{color:l,children:c})}),n(o,{flexDirection:"column",flexGrow:1,flexShrink:1,gap:1,minWidth:0,children:[e?r(i,{bold:!0,children:e}):void 0,r(i,{children:d})]})]})}export{p as Alert,p as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Keyed children. Any child that accepts a `show: boolean` prop and calls
|
|
5
|
+
* `onExit` when its exit transition finishes (such as `<Transition />`) is
|
|
6
|
+
* orchestrated automatically. Other children render as-is.
|
|
7
|
+
*/
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Orchestrates enter / exit animations for keyed children. Wrap a dynamic
|
|
12
|
+
* list of `<Transition />` (or any component accepting `show` + `onExit`) to
|
|
13
|
+
* keep outgoing children mounted until their exit animation finishes.
|
|
14
|
+
*/
|
|
15
|
+
declare function AnimatePresence({
|
|
16
|
+
children
|
|
17
|
+
}: Props): ReactElement;
|
|
18
|
+
export { AnimatePresence, type Props as AnimatePresenceProps, Props, AnimatePresence as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as y}from"react/jsx-runtime";import k from"@visulima/tui/components/box";import{useState as w,Children as f,isValidElement as m,useEffect as d,useCallback as E,cloneElement as p}from"react";const a=s=>{const{key:r}=s;if(r!==null)return r},x=s=>s.type?.isAnimatable===!0?!0:typeof s.props=="object"&&s.props!==null&&"show"in s.props;function A({children:s}){const[r,c]=w(()=>{const e=[];return f.forEach(s,t=>{if(!m(t))return;const n=a(t);n!==void 0&&e.push({element:t,key:n,show:!0})}),e});d(()=>{const e=new Map;f.forEach(s,t=>{if(!m(t))return;const n=a(t);n!==void 0&&e.set(n,t)}),c(t=>{const n=[],i=new Set;let l=!1;for(const o of t)if(e.has(o.key)){const u=e.get(o.key);(!o.show||o.element!==u)&&(l=!0),n.push({element:u,key:o.key,show:!0}),i.add(o.key)}else o.show&&(l=!0),n.push({...o,show:!1});for(const[o,u]of e)i.has(o)||(l=!0,n.push({element:u,key:o,show:!0}));return l?n:t})},[s]);const h=E(e=>{c(t=>t.filter(n=>n.key!==e))},[]);return y(k,{flexDirection:"column",children:r.map(e=>{if(!x(e.element))return p(e.element,{key:e.key});const t=e.element.props.onExit;return p(e.element,{key:e.key,onExit:()=>{t?.(),h(e.key)},show:e.show})})})}export{A as AnimatePresence,A as default};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type ApprovalRisk = "high" | "low" | "medium";
|
|
5
|
+
type ApprovalDecision = "allow-always" | "allow-once" | "deny";
|
|
6
|
+
type Props = {
|
|
7
|
+
/**
|
|
8
|
+
* Accent color for the highlighted option letters. Overrides the risk color.
|
|
9
|
+
*/
|
|
10
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Auto-focus the prompt on mount. Set to `false` if a parent already
|
|
13
|
+
* owns focus and routes input to this component.
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
readonly autoFocus?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional body rendered between the header and the prompt line (e.g. a
|
|
19
|
+
* rendered diff or command preview).
|
|
20
|
+
*/
|
|
21
|
+
readonly children?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Accessible description of what approving will do.
|
|
24
|
+
*/
|
|
25
|
+
readonly description?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Disable input; use when a parent manages focus and input routing.
|
|
28
|
+
*/
|
|
29
|
+
readonly isDisabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Resolution callback. Called once the user answers.
|
|
32
|
+
*/
|
|
33
|
+
readonly onDecision: (decision: ApprovalDecision) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Params shown as a compact key=value preview.
|
|
36
|
+
*/
|
|
37
|
+
readonly params?: Readonly<Record<string, unknown>>;
|
|
38
|
+
/**
|
|
39
|
+
* Severity badge; controls the border color.
|
|
40
|
+
* @default "medium"
|
|
41
|
+
*/
|
|
42
|
+
readonly risk?: ApprovalRisk;
|
|
43
|
+
/**
|
|
44
|
+
* Name of the tool / action under review.
|
|
45
|
+
*/
|
|
46
|
+
readonly tool: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Three-way approval prompt for tool calls. Resolves via `onDecision`:
|
|
50
|
+
* `y` / Enter → allow-once, `a` → allow-always, `n` / Esc → deny.
|
|
51
|
+
* @returns A bordered `ReactElement` containing the risk banner, params
|
|
52
|
+
* preview, optional body, and the prompt line.
|
|
53
|
+
*/
|
|
54
|
+
declare function ApprovalPrompt({
|
|
55
|
+
accentColor,
|
|
56
|
+
autoFocus,
|
|
57
|
+
children,
|
|
58
|
+
description,
|
|
59
|
+
isDisabled,
|
|
60
|
+
onDecision,
|
|
61
|
+
params,
|
|
62
|
+
risk,
|
|
63
|
+
tool
|
|
64
|
+
}: Props): ReactElement;
|
|
65
|
+
export { ApprovalDecision, ApprovalPrompt, type Props as ApprovalPromptProps, ApprovalRisk, Props, ApprovalPrompt as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as i,jsx as o}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";import v from"@visulima/tui/hooks/use-focus";import S from"@visulima/tui/hooks/use-input";import{useCallback as x}from"react";const C={high:"red",low:"green",medium:"yellow"},D={high:"HIGH RISK",low:"LOW RISK",medium:"MEDIUM RISK"},A=r=>{if(r===null)return"null";if(typeof r=="string")return r;if(typeof r=="number"||typeof r=="boolean")return String(r);try{return JSON.stringify(r)}catch{return String(r)}};function O({accentColor:r,autoFocus:b=!0,children:u,description:m,isDisabled:h=!1,onDecision:l,params:p,risk:f="medium",tool:y}){const d=C[f],a=r??d,{isFocused:w}=v({autoFocus:b,isActive:!h});S(x((t,c)=>{const s=t.toLowerCase();if(s==="y"||c.return){l("allow-once");return}if(s==="a"){l("allow-always");return}(s==="n"||c.escape)&&l("deny")},[l]),{isActive:!h&&w});const g=p===void 0?[]:Object.entries(p);return i(n,{borderColor:d,borderStyle:"round",flexDirection:"column",paddingX:1,children:[i(n,{children:[i(e,{backgroundColor:d,color:"black",children:[" ",D[f]," "]}),i(e,{children:[" ",o(e,{bold:!0,children:y})]})]}),m===void 0?void 0:o(n,{marginTop:1,children:o(e,{children:m})}),g.length===0?void 0:o(n,{flexDirection:"column",marginTop:1,children:g.map(([t,c])=>i(n,{children:[i(e,{color:"cyan",children:[t,"="]}),o(e,{wrap:"truncate-end",children:A(c)})]},t))}),u===void 0?void 0:o(n,{marginTop:1,children:u}),o(n,{marginTop:1,children:i(e,{children:["Allow? [",o(e,{bold:!0,color:a,children:"y"}),"es /"," ",o(e,{bold:!0,color:a,children:"a"}),"lways /"," ",o(e,{bold:!0,color:a,children:"n"}),"o ]"]})})]})}export{O as ApprovalPrompt,O as default};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
import { LineSeries } from "./line-chart.js";
|
|
5
|
+
import '@visulima/tui/canvas';
|
|
6
|
+
type Props = {
|
|
7
|
+
/**
|
|
8
|
+
* Axis label color.
|
|
9
|
+
* @default "gray"
|
|
10
|
+
*/
|
|
11
|
+
readonly axisColor?: LiteralUnion<AnsiColors, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Density of the shaded fill below each line.
|
|
14
|
+
* - `light` → `░`
|
|
15
|
+
* - `medium` → `▒` (default)
|
|
16
|
+
* - `heavy` → `▓`
|
|
17
|
+
*/
|
|
18
|
+
readonly fillDensity?: "heavy" | "light" | "medium";
|
|
19
|
+
/**
|
|
20
|
+
* Chart body height in character rows.
|
|
21
|
+
* @default 10
|
|
22
|
+
*/
|
|
23
|
+
readonly height?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Upper bound for the y-axis.
|
|
26
|
+
*/
|
|
27
|
+
readonly maxY?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Lower bound for the y-axis.
|
|
30
|
+
*/
|
|
31
|
+
readonly minY?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Fallback palette.
|
|
34
|
+
*/
|
|
35
|
+
readonly palette?: ReadonlyArray<LiteralUnion<AnsiColors, string>>;
|
|
36
|
+
/**
|
|
37
|
+
* Series to plot.
|
|
38
|
+
*/
|
|
39
|
+
readonly series: ReadonlyArray<LineSeries>;
|
|
40
|
+
/**
|
|
41
|
+
* Render the legend below the plot.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
readonly showLegend?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Chart body width in character columns.
|
|
47
|
+
* @default 40
|
|
48
|
+
*/
|
|
49
|
+
readonly width?: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Area chart: line chart with the area between the line and the baseline
|
|
53
|
+
* filled with shaded blocks.
|
|
54
|
+
*/
|
|
55
|
+
declare function AreaChart({
|
|
56
|
+
axisColor,
|
|
57
|
+
fillDensity,
|
|
58
|
+
height,
|
|
59
|
+
maxY,
|
|
60
|
+
minY,
|
|
61
|
+
palette,
|
|
62
|
+
series,
|
|
63
|
+
showLegend,
|
|
64
|
+
width
|
|
65
|
+
}: Props): ReactElement;
|
|
66
|
+
export { AreaChart, type Props as AreaChartProps, Props, AreaChart as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as b,jsx as m}from"react/jsx-runtime";import{createBrailleGrid as P}from"@visulima/tui/canvas";import M from"@visulima/tui/components/box";import Y from"@visulima/tui/components/canvas";import w from"@visulima/tui/components/text";import{useMemo as _}from"react";import{t as v,p as F,c as D,D as L,a as u}from"./packem_shared/line-chart-BbhMhcZg.js";const S=L,V={heavy:"▓",light:"░",medium:"▒"};function R({axisColor:I="gray",fillDensity:g="medium",height:y=10,maxY:p,minY:x,palette:d=S,series:f,showLegend:A=!0,width:N=40}){const n=_(()=>{const o=f.map((r,h)=>({color:F(r,h,d),points:v(r.data),series:r})),t=D(o);return{list:o,xMax:t.xMax===Number.NEGATIVE_INFINITY?1:t.xMax,xMin:t.xMin===Number.POSITIVE_INFINITY?0:t.xMin,yMax:p??(t.yMax===Number.NEGATIVE_INFINITY?1:t.yMax),yMin:x??(t.yMin===Number.POSITIVE_INFINITY?0:t.yMin)}},[f,d,x,p]),T=V[g];return b(M,{flexDirection:"column",children:[m(Y,{draw:o=>{o.clear();const t=o.width*2,r=o.height*4,h={xMax:n.xMax,xMin:n.xMin,yMax:n.yMax,yMin:n.yMin};for(const{color:s,points:a}of n.list)if(a.length!==0)for(let l=0;l<o.width;l+=1){let i;for(const e of a){const{px:c,py:C}=u(e,h,t,r);if(Math.floor(c/2)===l){const E=Math.floor(C/4);(i===void 0||E<i)&&(i=E)}}if(i!==void 0)for(let e=i+1;e<o.height;e+=1)o.setCell(l,e,T,{color:s,dim:!0})}for(let s=0;s<o.width;s+=2)o.setCell(s,o.height-1,"·",{color:I,dim:!0});for(const{color:s,points:a}of n.list){if(a.length===0)continue;const l=P(o.width,o.height);let i=u(a[0],h,t,r);l.plotPoint(i.px,i.py);for(let e=1;e<a.length;e+=1){const c=u(a[e],h,t,r);l.plotLine(i.px,i.py,c.px,c.py),i=c}l.flush(o,{bold:!0,color:s})}},height:y,version:[f,N,y,x,p,g,I,d],width:N}),A?m(M,{gap:2,marginTop:1,children:n.list.map(({color:o,series:t},r)=>b(M,{gap:1,children:[m(w,{color:o,children:T}),m(w,{children:t.label??`Series ${r+1}`})]},`${r}:${t.label??""}`))}):void 0]})}export{R as AreaChart,R as default};
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Label content. Strings are automatically uppercased.
|
|
7
|
+
*/
|
|
8
|
+
readonly children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Background color for the badge.
|
|
11
|
+
* @default "magenta"
|
|
12
|
+
*/
|
|
13
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Renders an uppercase colored label badge, useful for status indicators.
|
|
17
|
+
*/
|
|
18
|
+
declare function Badge({
|
|
19
|
+
children,
|
|
20
|
+
color
|
|
21
|
+
}: Props): ReactElement;
|
|
22
|
+
export { Badge, type Props as BadgeProps, Props, Badge as default };
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as n,jsx as a}from"react/jsx-runtime";import o from"@visulima/tui/components/text";function l({children:r,color:t="magenta"}){const e=typeof r=="string"?r.toUpperCase():r;return n(o,{backgroundColor:t,children:[" ",a(o,{color:"black",children:e})," "]})}export{l as Badge,l as default};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type BarDatum = {
|
|
5
|
+
/**
|
|
6
|
+
* Per-bar color override. Falls back to the chart-level palette.
|
|
7
|
+
*/
|
|
8
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
9
|
+
readonly label?: string;
|
|
10
|
+
readonly value: number;
|
|
11
|
+
};
|
|
12
|
+
type Props = {
|
|
13
|
+
/**
|
|
14
|
+
* Bars to render.
|
|
15
|
+
*/
|
|
16
|
+
readonly data: ReadonlyArray<BarDatum>;
|
|
17
|
+
/**
|
|
18
|
+
* Total height of the plot area in character rows.
|
|
19
|
+
* @default 10
|
|
20
|
+
*/
|
|
21
|
+
readonly height?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Optional upper bound for the axis. When omitted the chart uses the
|
|
24
|
+
* largest value in `data`.
|
|
25
|
+
*/
|
|
26
|
+
readonly max?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Orientation of the bars.
|
|
29
|
+
* @default "vertical"
|
|
30
|
+
*/
|
|
31
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
32
|
+
/**
|
|
33
|
+
* Fallback palette cycled through when a bar does not provide its own color.
|
|
34
|
+
* @default ["cyan", "magenta", "yellow", "green", "blue", "red"]
|
|
35
|
+
*/
|
|
36
|
+
readonly palette?: ReadonlyArray<LiteralUnion<AnsiColors, string>>;
|
|
37
|
+
/**
|
|
38
|
+
* Render labels underneath vertical bars (or to the left of horizontal bars).
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
readonly showLabels?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Render numeric values next to each bar.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
readonly showValues?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Total width of the plot area in character columns. Defaults to
|
|
49
|
+
* `data.length * 3` for vertical charts, or `24` for horizontal.
|
|
50
|
+
*/
|
|
51
|
+
readonly width?: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Bar chart rendered on top of `Canvas`. Uses fractional block glyphs for
|
|
55
|
+
* sub-cell precision (▁▂▃▄▅▆▇█ vertical, ▏▎▍▌▋▊▉█ horizontal).
|
|
56
|
+
*/
|
|
57
|
+
declare function BarChart({
|
|
58
|
+
data,
|
|
59
|
+
height,
|
|
60
|
+
max: maxOverride,
|
|
61
|
+
orientation,
|
|
62
|
+
palette,
|
|
63
|
+
showLabels,
|
|
64
|
+
showValues,
|
|
65
|
+
width: widthOverride
|
|
66
|
+
}: Props): ReactElement;
|
|
67
|
+
export { BarChart, type Props as BarChartProps, BarDatum, Props, BarChart as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as b}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import k from"@visulima/tui/components/canvas";import p from"@visulima/tui/components/text";import{useMemo as E}from"react";const j=["cyan","magenta","yellow","green","blue","red"],D=(r,t)=>{if(t!==void 0)return t;if(r.length===0)return 0;let n=r[0].value;for(let u=1;u<r.length;u+=1){const{value:h}=r[u];h>n&&(n=h)}return n},B=(r,t,n)=>n.color??t[r%t.length]??"cyan";function A({data:r,height:t=10,max:n,orientation:u="vertical",palette:h=j,showLabels:g=!0,showValues:x=!1,width:S}){const c=E(()=>D(r,n),[r,n]);if(u==="horizontal"){const i=S??24;return e(o,{flexDirection:"column",children:r.map((l,m)=>{const v=c===0?0:l.value/c,s=B(m,h,l);return b(o,{gap:1,children:[g&&l.label!==void 0?e(o,{flexShrink:0,minWidth:8,children:e(p,{dimColor:!0,wrap:"truncate-end",children:l.label})}):void 0,e(o,{flexGrow:1,flexShrink:1,children:e(k,{draw:f=>{f.clear(),f.drawHBar(0,0,i,v,{color:s})},height:1,version:[l.value,c,s,i],width:i})}),x?e(o,{flexShrink:0,children:e(p,{children:String(l.value)})}):void 0]},m)})})}const a=2,d=1,C=S??Math.max(r.length*(a+d),1);return b(o,{flexDirection:"column",children:[e(k,{draw:i=>{i.clear(),r.forEach((l,m)=>{const v=c===0?0:l.value/c,s=B(m,h,l),f=m*(a+d);for(let w=0;w<a;w+=1)i.drawVBar(f+w,0,t,v,{color:s})})},height:t,version:[r,c,h,a,d,t],width:C}),x?e(o,{children:r.map((i,l)=>e(o,{width:a+d,children:e(p,{dimColor:!0,children:String(i.value).padEnd(a+d," ")})},l))}):void 0,g?e(o,{children:r.map((i,l)=>e(o,{width:a+d,children:e(p,{dimColor:!0,wrap:"truncate-end",children:(i.label??"").padEnd(a+d," ")})},l))}):void 0]})}export{A as BarChart,A as default};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Available CFonts font faces.
|
|
4
|
+
*/
|
|
5
|
+
type Font = "3d" | "block" | "chrome" | "grid" | "huge" | "pallet" | "shade" | "simple" | "simple3d" | "simpleBlock" | "slick" | "tiny";
|
|
6
|
+
/**
|
|
7
|
+
* Horizontal text alignment.
|
|
8
|
+
*/
|
|
9
|
+
type Align = "center" | "left" | "right";
|
|
10
|
+
/**
|
|
11
|
+
* Terminal background color names supported by CFonts.
|
|
12
|
+
*/
|
|
13
|
+
type BackgroundColor = "black" | "blue" | "cyan" | "green" | "magenta" | "red" | "transparent" | "white" | "yellow";
|
|
14
|
+
type Props = {
|
|
15
|
+
/**
|
|
16
|
+
* Horizontal alignment of the text.
|
|
17
|
+
* @default "left"
|
|
18
|
+
*/
|
|
19
|
+
readonly align?: Align;
|
|
20
|
+
/**
|
|
21
|
+
* Background color.
|
|
22
|
+
* @default "transparent"
|
|
23
|
+
*/
|
|
24
|
+
readonly backgroundColor?: BackgroundColor;
|
|
25
|
+
/**
|
|
26
|
+
* Colors to use for the font. Accepts color names, hex values, or `"system"` for terminal default.
|
|
27
|
+
* @default ["system"]
|
|
28
|
+
*/
|
|
29
|
+
readonly colors?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Font face to use.
|
|
32
|
+
* @default "block"
|
|
33
|
+
* @see https://github.com/dominikwilkowski/cfonts#supported-fonts
|
|
34
|
+
*/
|
|
35
|
+
readonly font?: Font;
|
|
36
|
+
/**
|
|
37
|
+
* Letter spacing.
|
|
38
|
+
* @default 1
|
|
39
|
+
*/
|
|
40
|
+
readonly letterSpacing?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Line height.
|
|
43
|
+
* @default 1
|
|
44
|
+
*/
|
|
45
|
+
readonly lineHeight?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum character length per line. `0` means no limit.
|
|
48
|
+
* @default 0
|
|
49
|
+
*/
|
|
50
|
+
readonly maxLength?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to add an empty line on top and at the bottom of the output.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
readonly space?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* The text to render in a large font.
|
|
58
|
+
*/
|
|
59
|
+
readonly text: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Render large terminal text using CFonts.
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* import { BigText } from "@visulima/tui/ink";
|
|
66
|
+
*
|
|
67
|
+
* <BigText text="Hello" font="block" />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function BigText({
|
|
71
|
+
align,
|
|
72
|
+
backgroundColor,
|
|
73
|
+
colors,
|
|
74
|
+
font,
|
|
75
|
+
letterSpacing,
|
|
76
|
+
lineHeight,
|
|
77
|
+
maxLength,
|
|
78
|
+
space,
|
|
79
|
+
text
|
|
80
|
+
}: Props): ReactElement;
|
|
81
|
+
export { type Align, type BackgroundColor, BigText, type Align as BigTextAlign, type BackgroundColor as BigTextBackgroundColor, type Font as BigTextFont, type Props as BigTextProps, type Font, type Props, BigText as default };
|
package/dist/big-text.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import m from"@visulima/tui/components/text";import p from"cfonts";import{useMemo as f}from"react";const u={align:"left",backgroundColor:"transparent",colors:["system"],font:"block",letterSpacing:1,lineHeight:1,maxLength:0,space:!0};function k({align:t,backgroundColor:e,colors:o,font:r,letterSpacing:n,lineHeight:i,maxLength:a,space:g,text:l}){const c=f(()=>p.render(l,{...u,align:t,backgroundColor:e,colors:o,font:r,letterSpacing:n,lineHeight:i,maxLength:a,space:g}),[l,t,e,o,r,n,i,a,g]);return s(m,{children:c&&c.string})}export{k as BigText,k as default};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Glyph rendered as the blinking dot.
|
|
7
|
+
* @default "●" (filled bullet)
|
|
8
|
+
*/
|
|
9
|
+
readonly character?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Dot color.
|
|
12
|
+
* @default "red"
|
|
13
|
+
*/
|
|
14
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Milliseconds per blink cycle. The dot is visible for half the cycle.
|
|
17
|
+
* @default 800
|
|
18
|
+
*/
|
|
19
|
+
readonly interval?: number;
|
|
20
|
+
/**
|
|
21
|
+
* When false, the dot stays solid (no animation).
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
readonly isActive?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Steady or blinking indicator dot. Pair with `StatusLine` or next to a
|
|
28
|
+
* label to show a "live" / "recording" status.
|
|
29
|
+
*/
|
|
30
|
+
declare function BlinkDot({
|
|
31
|
+
character,
|
|
32
|
+
color,
|
|
33
|
+
interval,
|
|
34
|
+
isActive
|
|
35
|
+
}: Props): ReactElement;
|
|
36
|
+
export { BlinkDot, type Props as BlinkDotProps, Props, BlinkDot as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import l from"@visulima/tui/components/text";import m from"@visulima/tui/hooks/use-animation";function p({character:t="●",color:o="red",interval:i=800,isActive:r=!0}){const{frame:e}=m({interval:Math.max(1,Math.floor(i/2)),isActive:r}),a=!r||e%2===0;return c(l,{color:o,children:a?t:" "})}export{p as BlinkDot,p as default};
|