@visulima/tui 1.0.8 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/LICENSE.md +54 -2444
- package/MIGRATION-GUIDE.md +164 -0
- package/README.md +15 -12
- package/dist/components/box.d.ts +26 -27
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/canvas.js +1 -1
- package/dist/components/cursor.d.ts +40 -46
- package/dist/components/error-boundary.d.ts +16 -0
- package/dist/components/error-boundary.js +1 -0
- package/dist/components/error-overview.d.ts +6 -0
- package/dist/components/error-overview.js +1 -0
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +10 -42
- package/dist/components/static.d.ts +13 -14
- package/dist/components/text.d.ts +34 -48
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -12
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +24 -0
- package/dist/ink/canvas/index.js +1 -0
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -34
- package/dist/ink/hooks/use-app.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +17 -18
- package/dist/ink/hooks/use-clipboard.d.ts +16 -16
- package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
- package/dist/ink/hooks/use-console-capture.d.ts +19 -19
- package/dist/ink/hooks/use-cursor.d.ts +7 -7
- package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
- package/dist/ink/hooks/use-focus.d.ts +14 -18
- package/dist/ink/hooks/use-form.d.ts +32 -32
- package/dist/ink/hooks/use-hotkey.d.ts +17 -17
- package/dist/ink/hooks/use-input.d.ts +92 -92
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-interval.d.ts +14 -14
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
- package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
- package/dist/ink/hooks/use-key-chord.d.ts +15 -15
- package/dist/ink/hooks/use-paste.d.ts +38 -38
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
- package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
- package/dist/ink/hooks/use-stderr.d.ts +6 -6
- package/dist/ink/hooks/use-stderr.js +1 -1
- package/dist/ink/hooks/use-stdin.d.ts +10 -10
- package/dist/ink/hooks/use-stdin.js +1 -1
- package/dist/ink/hooks/use-stdout.d.ts +6 -6
- package/dist/ink/hooks/use-stdout.js +1 -1
- package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
- package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
- package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +19 -20
- package/dist/ink/hooks/use-timeout.d.ts +11 -11
- package/dist/ink/hooks/use-timer.d.ts +19 -19
- package/dist/ink/hooks/use-window-size.d.ts +8 -8
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +110 -123
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +7 -8
- package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
- package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
- package/dist/ink/mouse/use-mouse.d.ts +1 -1
- package/dist/ink/mouse/use-on-mouse-click.d.ts +4 -5
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
- package/dist/ink/public/cursor.d.ts +47 -0
- package/dist/ink/public/cursor.js +1 -0
- package/dist/ink/public/dom.d.ts +6 -0
- package/dist/ink/public/dom.js +0 -0
- package/dist/ink/public/highlighter.d.ts +44 -0
- package/dist/ink/public/highlighter.js +1 -0
- package/dist/ink/public/input.d.ts +14 -0
- package/dist/ink/public/input.js +1 -0
- package/dist/ink/public/styles.d.ts +4 -0
- package/dist/ink/public/styles.js +0 -0
- package/dist/ink/public/utils.d.ts +5 -0
- package/dist/ink/public/utils.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-BxD3PYAN.js} +1 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
- package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
- package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
- package/dist/packem_shared/TuiApp-CCVaiKbf.js +1 -0
- package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/buffer.d-CttIC480.d.ts +67 -0
- package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
- package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
- package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
- package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
- package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
- package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
- package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-CLGlidfI.d.ts} +140 -154
- package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
- package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
- package/dist/packem_shared/input.d-Bb8pWHvp.d.ts +172 -0
- package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
- package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
- package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
- package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
- package/dist/packem_shared/render-CuCo-R-l.js +24 -0
- package/dist/packem_shared/{render-DFZ8NHlG.js → render-DtQd8qQq.js} +1 -1
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
- package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
- package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
- package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
- package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
- package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
- package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
- package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
- package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
- package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
- package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
- package/dist/react/index.d.ts +160 -179
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +152 -152
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +49 -384
- package/dist/components/accordion.d.ts +0 -59
- package/dist/components/accordion.js +0 -1
- package/dist/components/alert.d.ts +0 -26
- package/dist/components/alert.js +0 -1
- package/dist/components/animate-presence.d.ts +0 -18
- package/dist/components/animate-presence.js +0 -1
- package/dist/components/approval-prompt.d.ts +0 -65
- package/dist/components/approval-prompt.js +0 -1
- package/dist/components/area-chart.d.ts +0 -66
- package/dist/components/area-chart.js +0 -1
- package/dist/components/badge.d.ts +0 -22
- package/dist/components/badge.js +0 -1
- package/dist/components/bar-chart.d.ts +0 -67
- package/dist/components/bar-chart.js +0 -1
- package/dist/components/big-text.d.ts +0 -81
- package/dist/components/big-text.js +0 -1
- package/dist/components/blink-dot.d.ts +0 -36
- package/dist/components/blink-dot.js +0 -1
- package/dist/components/breadcrumb.d.ts +0 -33
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/button.d.ts +0 -45
- package/dist/components/button.js +0 -1
- package/dist/components/calendar.d.ts +0 -72
- package/dist/components/calendar.js +0 -1
- package/dist/components/card.d.ts +0 -57
- package/dist/components/card.js +0 -1
- package/dist/components/checkbox.d.ts +0 -48
- package/dist/components/checkbox.js +0 -1
- package/dist/components/code.d.ts +0 -48
- package/dist/components/code.js +0 -2
- package/dist/components/collapsible.d.ts +0 -53
- package/dist/components/collapsible.js +0 -1
- package/dist/components/command-block.d.ts +0 -47
- package/dist/components/command-block.js +0 -4
- package/dist/components/command-palette.d.ts +0 -82
- package/dist/components/command-palette.js +0 -1
- package/dist/components/confirm-dialog.d.ts +0 -75
- package/dist/components/confirm-dialog.js +0 -1
- package/dist/components/confirm-input.d.ts +0 -38
- package/dist/components/confirm-input.js +0 -1
- package/dist/components/console-overlay.d.ts +0 -54
- package/dist/components/console-overlay.js +0 -1
- package/dist/components/content-switcher.d.ts +0 -57
- package/dist/components/content-switcher.js +0 -1
- package/dist/components/controlled-scroll-view.d.ts +0 -61
- package/dist/components/controlled-scroll-view.js +0 -1
- package/dist/components/date-picker.d.ts +0 -65
- package/dist/components/date-picker.js +0 -1
- package/dist/components/definition-list.d.ts +0 -44
- package/dist/components/definition-list.js +0 -1
- package/dist/components/dialog.d.ts +0 -117
- package/dist/components/dialog.js +0 -1
- package/dist/components/diff-view.d.ts +0 -85
- package/dist/components/diff-view.js +0 -1
- package/dist/components/divider.d.ts +0 -49
- package/dist/components/divider.js +0 -1
- package/dist/components/file-picker-entry.d.ts +0 -104
- package/dist/components/file-picker-entry.js +0 -1
- package/dist/components/form.d.ts +0 -81
- package/dist/components/form.js +0 -1
- package/dist/components/gauge.d.ts +0 -87
- package/dist/components/gauge.js +0 -1
- package/dist/components/gradient.d.ts +0 -42
- package/dist/components/gradient.js +0 -1
- package/dist/components/heading.d.ts +0 -33
- package/dist/components/heading.js +0 -1
- package/dist/components/heatmap.d.ts +0 -62
- package/dist/components/heatmap.js +0 -1
- package/dist/components/help.d.ts +0 -52
- package/dist/components/help.js +0 -1
- package/dist/components/histogram.d.ts +0 -62
- package/dist/components/histogram.js +0 -1
- package/dist/components/kbd.d.ts +0 -31
- package/dist/components/kbd.js +0 -1
- package/dist/components/line-chart.d.ts +0 -109
- package/dist/components/line-chart.js +0 -1
- package/dist/components/link.d.ts +0 -38
- package/dist/components/link.js +0 -1
- package/dist/components/loading-indicator.d.ts +0 -29
- package/dist/components/loading-indicator.js +0 -1
- package/dist/components/markdown.d.ts +0 -40
- package/dist/components/markdown.js +0 -1
- package/dist/components/masked-input.d.ts +0 -50
- package/dist/components/masked-input.js +0 -1
- package/dist/components/menu.d.ts +0 -78
- package/dist/components/menu.js +0 -1
- package/dist/components/message-bubble.d.ts +0 -43
- package/dist/components/message-bubble.js +0 -1
- package/dist/components/model-badge.d.ts +0 -39
- package/dist/components/model-badge.js +0 -1
- package/dist/components/multi-select.d.ts +0 -65
- package/dist/components/multi-select.js +0 -1
- package/dist/components/operation-tree.d.ts +0 -49
- package/dist/components/operation-tree.js +0 -1
- package/dist/components/option-list.d.ts +0 -47
- package/dist/components/option-list.js +0 -1
- package/dist/components/ordered-list.d.ts +0 -24
- package/dist/components/ordered-list.js +0 -1
- package/dist/components/paginator.d.ts +0 -69
- package/dist/components/paginator.js +0 -1
- package/dist/components/paragraph.d.ts +0 -38
- package/dist/components/paragraph.js +0 -1
- package/dist/components/placeholder.d.ts +0 -55
- package/dist/components/placeholder.js +0 -1
- package/dist/components/progress-bar.d.ts +0 -56
- package/dist/components/progress-bar.js +0 -1
- package/dist/components/radio-group.d.ts +0 -74
- package/dist/components/radio-group.js +0 -1
- package/dist/components/scatter-plot.d.ts +0 -35
- package/dist/components/scatter-plot.js +0 -1
- package/dist/components/scroll-bar-box.d.ts +0 -37
- package/dist/components/scroll-bar-box.js +0 -1
- package/dist/components/scroll-bar.d.ts +0 -25
- package/dist/components/scroll-bar.js +0 -1
- package/dist/components/scroll-list.d.ts +0 -20
- package/dist/components/scroll-list.js +0 -1
- package/dist/components/scroll-view.d.ts +0 -10
- package/dist/components/scroll-view.js +0 -1
- package/dist/components/search-input.d.ts +0 -55
- package/dist/components/search-input.js +0 -1
- package/dist/components/select-input-indicator.d.ts +0 -32
- package/dist/components/select-input-indicator.js +0 -1
- package/dist/components/select-input-item.d.ts +0 -41
- package/dist/components/select-input-item.js +0 -1
- package/dist/components/select-input.d.ts +0 -110
- package/dist/components/select-input.js +0 -1
- package/dist/components/shimmer-text.d.ts +0 -47
- package/dist/components/shimmer-text.js +0 -1
- package/dist/components/slider.d.ts +0 -103
- package/dist/components/slider.js +0 -1
- package/dist/components/sparkline.d.ts +0 -35
- package/dist/components/sparkline.js +0 -1
- package/dist/components/spinner.d.ts +0 -17
- package/dist/components/spinner.js +0 -1
- package/dist/components/status-line.d.ts +0 -37
- package/dist/components/status-line.js +0 -1
- package/dist/components/status-message.d.ts +0 -21
- package/dist/components/status-message.js +0 -1
- package/dist/components/stepper.d.ts +0 -48
- package/dist/components/stepper.js +0 -1
- package/dist/components/stopwatch.d.ts +0 -49
- package/dist/components/stopwatch.js +0 -1
- package/dist/components/streaming-text.d.ts +0 -46
- package/dist/components/streaming-text.js +0 -1
- package/dist/components/switch.d.ts +0 -55
- package/dist/components/switch.js +0 -1
- package/dist/components/tab.d.ts +0 -19
- package/dist/components/tab.js +0 -1
- package/dist/components/table.d.ts +0 -119
- package/dist/components/table.js +0 -1
- package/dist/components/tabs.d.ts +0 -107
- package/dist/components/tabs.js +0 -1
- package/dist/components/tag.d.ts +0 -35
- package/dist/components/tag.js +0 -1
- package/dist/components/text-input.d.ts +0 -48
- package/dist/components/text-input.js +0 -1
- package/dist/components/textarea.d.ts +0 -68
- package/dist/components/textarea.js +0 -2
- package/dist/components/timer.d.ts +0 -59
- package/dist/components/timer.js +0 -1
- package/dist/components/toast.d.ts +0 -49
- package/dist/components/toast.js +0 -1
- package/dist/components/tooltip.d.ts +0 -43
- package/dist/components/tooltip.js +0 -1
- package/dist/components/transition.d.ts +0 -74
- package/dist/components/transition.js +0 -1
- package/dist/components/tree-view-entry.d.ts +0 -357
- package/dist/components/tree-view-entry.js +0 -1
- package/dist/components/unordered-list.d.ts +0 -30
- package/dist/components/unordered-list.js +0 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
- package/dist/ink/hooks/use-linked-scroll.js +0 -1
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
- package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +0 -39
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
- package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-CFyBVf7l.js +0 -1
- package/dist/packem_shared/render-CuQecTAs.js +0 -24
- package/dist/packem_shared/render.d-CBnYBDk2.d.ts +0 -417
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
- package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
- package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +0 -396
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
- package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
- package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
|
@@ -1,18 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as y}from"react/jsx-runtime";import{useState as k,Children as f,isValidElement as a,useEffect as w,useCallback as d,cloneElement as m}from"react";import{Box as E}from"./box.js";const p=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]=k(()=>{const e=[];return f.forEach(s,t=>{if(!a(t))return;const n=p(t);n!==void 0&&e.push({element:t,key:n,show:!0})}),e});w(()=>{const e=new Map;f.forEach(s,t=>{if(!a(t))return;const n=p(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=d(e=>{c(t=>t.filter(n=>n.key!==e))},[]);return y(E,{flexDirection:"column",children:r.map(e=>{if(!x(e.element))return m(e.element,{key:e.key});const t=e.element.props.onExit;return m(e.element,{key:e.key,onExit:()=>{t?.(),h(e.key)},show:e.show})})})}export{A as AnimatePresence,A as default};
|
|
@@ -1,65 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as n,jsx as o}from"react/jsx-runtime";import{useCallback as v}from"react";import x from"../ink/hooks/use-focus.js";import S from"../ink/hooks/use-input.js";import{Box as i}from"./box.js";import{Text as e}from"./text.js";const C={high:"red",low:"green",medium:"yellow"},k={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}=x({autoFocus:b,isActive:!h});S(v((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 n(i,{borderColor:d,borderStyle:"round",flexDirection:"column",paddingX:1,children:[n(i,{children:[n(e,{backgroundColor:d,color:"black",children:[" ",k[f]," "]}),n(e,{children:[" ",o(e,{bold:!0,children:y})]})]}),m===void 0?void 0:o(i,{marginTop:1,children:o(e,{children:m})}),g.length===0?void 0:o(i,{flexDirection:"column",marginTop:1,children:g.map(([t,c])=>n(i,{children:[n(e,{color:"cyan",children:[t,"="]}),o(e,{wrap:"truncate-end",children:A(c)})]},t))}),u===void 0?void 0:o(i,{marginTop:1,children:u}),o(i,{marginTop:1,children:n(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};
|
|
@@ -1,66 +0,0 @@
|
|
|
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 "../packem_shared/buffer.d-EJkZr8uH.js";
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as b,jsx as m}from"react/jsx-runtime";import{useMemo as A}from"react";import{c as P}from"../packem_shared/braille-ch3O5D7I.js";import{Box as M}from"./box.js";import{Canvas as Y}from"./canvas.js";import{t as _,p as F,c as L,D,a as u}from"../packem_shared/line-chart-C7CUrvVs.js";import{Text as w}from"./text.js";const S=D,V={heavy:"▓",light:"░",medium:"▒"};function H({axisColor:I="gray",fillDensity:y="medium",height:g=10,maxY:p,minY:h,palette:d=S,series:f,showLegend:C=!0,width:N=40}){const s=A(()=>{const o=f.map((r,c)=>({color:F(r,c,d),points:_(r.data),series:r})),t=L(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:h??(t.yMin===Number.POSITIVE_INFINITY?0:t.yMin)}},[f,d,h,p]),T=V[y];return b(M,{flexDirection:"column",children:[m(Y,{draw:o=>{o.clear();const t=o.width*2,r=o.height*4,c={xMax:s.xMax,xMin:s.xMin,yMax:s.yMax,yMin:s.yMin};for(const{color:a,points:n}of s.list)if(n.length!==0)for(let l=0;l<o.width;l+=1){let i;for(const e of n){const{px:x,py:v}=u(e,c,t,r);if(Math.floor(x/2)===l){const E=Math.floor(v/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:a,dim:!0})}for(let a=0;a<o.width;a+=2)o.setCell(a,o.height-1,"·",{color:I,dim:!0});for(const{color:a,points:n}of s.list){if(n.length===0)continue;const l=P(o.width,o.height);let i=u(n[0],c,t,r);l.plotPoint(i.px,i.py);for(let e=1;e<n.length;e+=1){const x=u(n[e],c,t,r);l.plotLine(i.px,i.py,x.px,x.py),i=x}l.flush(o,{bold:!0,color:a})}},height:g,version:[f,N,g,h,p,y,I,d],width:N}),C?m(M,{gap:2,marginTop:1,children:s.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{H as AreaChart,H as default};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* 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/components/badge.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as a,jsx as n}from"react/jsx-runtime";import{Text as o}from"./text.js";function l({children:r,color:t="magenta"}){const e=typeof r=="string"?r.toUpperCase():r;return a(o,{backgroundColor:t,children:[" ",n(o,{color:"black",children:e})," "]})}export{l as Badge,l as default};
|
|
@@ -1,67 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as B}from"react/jsx-runtime";import{useMemo as E}from"react";import{Box as o}from"./box.js";import{Canvas as C}from"./canvas.js";import{Text as p}from"./text.js";const j=["cyan","magenta","yellow","green","blue","red"],D=(r,t)=>{if(t!==void 0)return t;if(r.length===0)return 0;let a=r[0].value;for(let u=1;u<r.length;u+=1){const{value:h}=r[u];h>a&&(a=h)}return a},S=(r,t,a)=>a.color??t[r%t.length]??"cyan";function z({data:r,height:t=10,max:a,orientation:u="vertical",palette:h=j,showLabels:w=!0,showValues:g=!1,width:k}){const c=E(()=>D(r,a),[r,a]);if(u==="horizontal"){const i=k??24;return e(o,{flexDirection:"column",children:r.map((l,s)=>{const v=c===0?0:l.value/c,m=S(s,h,l);return B(o,{gap:1,children:[w&&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(C,{draw:f=>{f.clear(),f.drawHBar(0,0,i,v,{color:m})},height:1,version:[l.value,c,m,i],width:i})}),g?e(o,{flexShrink:0,children:e(p,{children:String(l.value)})}):void 0]},s)})})}const n=2,d=1,b=k??Math.max(r.length*(n+d),1);return B(o,{flexDirection:"column",children:[e(C,{draw:i=>{i.clear(),r.forEach((l,s)=>{const v=c===0?0:l.value/c,m=S(s,h,l),f=s*(n+d);for(let x=0;x<n;x+=1)i.drawVBar(f+x,0,t,v,{color:m})})},height:t,version:[r,c,h,n,d,t],width:b}),g?e(o,{children:r.map((i,l)=>e(o,{width:n+d,children:e(p,{dimColor:!0,children:String(i.value).padEnd(n+d," ")})},l))}):void 0,w?e(o,{children:r.map((i,l)=>e(o,{width:n+d,children:e(p,{dimColor:!0,wrap:"truncate-end",children:(i.label??"").padEnd(n+d," ")})},l))}):void 0]})}export{z as BarChart,z as default};
|
|
@@ -1,81 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as s}from"react/jsx-runtime";import m from"cfonts";import{useMemo as p}from"react";import{Text as f}from"./text.js";const u={align:"left",backgroundColor:"transparent",colors:["system"],font:"block",letterSpacing:1,lineHeight:1,maxLength:0,space:!0};function b({align:t,backgroundColor:e,colors:o,font:r,letterSpacing:n,lineHeight:a,maxLength:i,space:c,text:g}){const l=p(()=>m.render(g,{...u,align:t,backgroundColor:e,colors:o,font:r,letterSpacing:n,lineHeight:a,maxLength:i,space:c}),[g,t,e,o,r,n,a,i,c]);return s(f,{children:l&&l.string})}export{b as BigText,b as default};
|
|
@@ -1,36 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as c}from"react/jsx-runtime";import l from"../ink/hooks/use-animation.js";import{Text as m}from"./text.js";function h({character:t="●",color:o="red",interval:e=800,isActive:r=!0}){const{frame:i}=l({interval:Math.max(1,Math.floor(e/2)),isActive:r}),a=!r||i%2===0;return c(m,{color:o,children:a?t:" "})}export{h as BlinkDot,h as default};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type BreadcrumbItem = {
|
|
5
|
-
readonly icon?: ReactNode;
|
|
6
|
-
readonly key?: string;
|
|
7
|
-
readonly label: string;
|
|
8
|
-
};
|
|
9
|
-
type Props = {
|
|
10
|
-
/**
|
|
11
|
-
* Color applied to the trailing (current) item.
|
|
12
|
-
* @default "blue"
|
|
13
|
-
*/
|
|
14
|
-
readonly currentColor?: LiteralUnion<AnsiColors, string>;
|
|
15
|
-
/**
|
|
16
|
-
* Items to display from root to current page.
|
|
17
|
-
*/
|
|
18
|
-
readonly items: ReadonlyArray<BreadcrumbItem>;
|
|
19
|
-
/**
|
|
20
|
-
* Glyph rendered between adjacent items.
|
|
21
|
-
* @default "›" (right single angle quote)
|
|
22
|
-
*/
|
|
23
|
-
readonly separator?: string;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Render a breadcrumb trail (last item is highlighted).
|
|
27
|
-
*/
|
|
28
|
-
declare function Breadcrumb({
|
|
29
|
-
currentColor,
|
|
30
|
-
items,
|
|
31
|
-
separator
|
|
32
|
-
}: Props): ReactElement;
|
|
33
|
-
export { Breadcrumb, BreadcrumbItem, type Props as BreadcrumbProps, Props, Breadcrumb as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as a,jsxs as o,Fragment as d}from"react/jsx-runtime";import{Fragment as c}from"react";import{Box as s}from"./box.js";import{Text as t}from"./text.js";function b({currentColor:n="blue",items:i,separator:m="›"}){return a(s,{children:i.map((r,l)=>{const e=l===i.length-1;return o(c,{children:[l>0?o(t,{dimColor:!0,children:[" ",m," "]}):void 0,o(t,{bold:e,color:e?n:void 0,dimColor:!e,children:[r.icon===void 0?void 0:o(d,{children:[r.icon," "]}),r.label]})]},r.key??r.label)})})}export{b as Breadcrumb,b as default};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type ButtonVariant = "ghost" | "outline" | "primary" | "secondary";
|
|
5
|
-
type Props = {
|
|
6
|
-
/**
|
|
7
|
-
* Accent color used when the button is focused.
|
|
8
|
-
* @default "blue"
|
|
9
|
-
*/
|
|
10
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
11
|
-
/**
|
|
12
|
-
* Focus this button when mounted if nothing else is focused.
|
|
13
|
-
*/
|
|
14
|
-
readonly autoFocus?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Button label.
|
|
17
|
-
*/
|
|
18
|
-
readonly children: ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* When true, the button ignores input and is rendered dim.
|
|
21
|
-
*/
|
|
22
|
-
readonly isDisabled?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Called when the user presses Enter or Space while the button has focus.
|
|
25
|
-
*/
|
|
26
|
-
readonly onPress?: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* Visual style.
|
|
29
|
-
* @default "primary"
|
|
30
|
-
*/
|
|
31
|
-
readonly variant?: ButtonVariant;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Focusable button. Triggers `onPress` on Enter / Space.
|
|
35
|
-
* @returns A `ReactElement` rendering the button (bordered or ghost variant).
|
|
36
|
-
*/
|
|
37
|
-
declare function Button({
|
|
38
|
-
accentColor,
|
|
39
|
-
autoFocus,
|
|
40
|
-
children,
|
|
41
|
-
isDisabled,
|
|
42
|
-
onPress,
|
|
43
|
-
variant
|
|
44
|
-
}: Props): ReactElement;
|
|
45
|
-
export { Button, type Props as ButtonProps, ButtonVariant, Props, Button as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useCallback as p}from"react";import b from"../ink/hooks/use-focus.js";import g from"../ink/hooks/use-input.js";import{Box as e}from"./box.js";import{Text as c}from"./text.js";const h="round",y=(i,s,a,r)=>{if(!a){if(i==="primary"&&s)return"black";if(s)return r}};function A({accentColor:i="blue",autoFocus:s=!1,children:a,isDisabled:r=!1,onPress:l,variant:n="primary"}){const{isFocused:o}=b({autoFocus:s,isActive:!r});g(p((m,u)=>{o&&(u.return||m===" ")&&l?.()},[o,l]),{isActive:!r&&o});const t=y(n,o,r,i);return n==="ghost"?d(e,{paddingX:1,children:f(c,{bold:o,color:t,dimColor:r,children:[o?"▸ ":" ",a]})}):d(e,{backgroundColor:n==="primary"&&o?i:void 0,borderColor:n==="outline"?o?i:"gray":n==="secondary"||o?i:void 0,borderStyle:h,paddingX:1,children:d(c,{bold:o,color:t,dimColor:r,children:a})})}export{A as Button,A as default};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Accent color for today / the focused cell.
|
|
7
|
-
* @default "blue"
|
|
8
|
-
*/
|
|
9
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
-
/**
|
|
11
|
-
* Auto-focus the grid on mount.
|
|
12
|
-
*/
|
|
13
|
-
readonly autoFocus?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Initial focused day when uncontrolled. Defaults to `value` or today.
|
|
16
|
-
*/
|
|
17
|
-
readonly defaultValue?: Date;
|
|
18
|
-
/**
|
|
19
|
-
* First day of the week: 0 = Sunday, 1 = Monday.
|
|
20
|
-
* @default 1
|
|
21
|
-
*/
|
|
22
|
-
readonly firstDayOfWeek?: 0 | 1;
|
|
23
|
-
/**
|
|
24
|
-
* When true, disable input and render the grid dim.
|
|
25
|
-
*/
|
|
26
|
-
readonly isDisabled?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Upper bound; days after `maxDate` cannot be selected.
|
|
29
|
-
*/
|
|
30
|
-
readonly maxDate?: Date;
|
|
31
|
-
/**
|
|
32
|
-
* Lower bound; days before `minDate` cannot be selected.
|
|
33
|
-
*/
|
|
34
|
-
readonly minDate?: Date;
|
|
35
|
-
/**
|
|
36
|
-
* Called whenever the user navigates or selects a day.
|
|
37
|
-
*/
|
|
38
|
-
readonly onChange?: (date: Date) => void;
|
|
39
|
-
/**
|
|
40
|
-
* Called when the user presses Enter.
|
|
41
|
-
*/
|
|
42
|
-
readonly onSubmit?: (date: Date) => void;
|
|
43
|
-
/**
|
|
44
|
-
* Color used to mark the currently selected day.
|
|
45
|
-
* @default "green"
|
|
46
|
-
*/
|
|
47
|
-
readonly selectedColor?: LiteralUnion<AnsiColors, string>;
|
|
48
|
-
/**
|
|
49
|
-
* Controlled selected date.
|
|
50
|
-
*/
|
|
51
|
-
readonly value?: Date;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Month-grid date picker. Arrow keys move focus by one day, page up/down move
|
|
55
|
-
* by month. Enter submits; Space or Enter selects.
|
|
56
|
-
* @returns A bordered `ReactElement` containing the month header, weekday
|
|
57
|
-
* labels, and the day grid.
|
|
58
|
-
*/
|
|
59
|
-
declare function Calendar({
|
|
60
|
-
accentColor,
|
|
61
|
-
autoFocus,
|
|
62
|
-
defaultValue,
|
|
63
|
-
firstDayOfWeek,
|
|
64
|
-
isDisabled,
|
|
65
|
-
maxDate,
|
|
66
|
-
minDate,
|
|
67
|
-
onChange,
|
|
68
|
-
onSubmit,
|
|
69
|
-
selectedColor,
|
|
70
|
-
value
|
|
71
|
-
}: Props): ReactElement;
|
|
72
|
-
export { Calendar, type Props as CalendarProps, Props, Calendar as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as y,jsx as u}from"react/jsx-runtime";import{useMemo as w,useState as V,useRef as W,useCallback as S}from"react";import I from"../ink/hooks/use-focus.js";import K from"../ink/hooks/use-input.js";import{Box as h}from"./box.js";import{Text as b}from"./text.js";const P=["January","February","March","April","May","June","July","August","September","October","November","December"],k=["Su","Mo","Tu","We","Th","Fr","Sa"],p=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),x=(e,r)=>{const i=e.getFullYear(),l=e.getMonth()+r,g=new Date(i,l+1,0).getDate(),a=Math.min(e.getDate(),g);return new Date(i,l,a)},T=(e,r)=>e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()&&e.getDate()===r.getDate(),J=(e,r,i)=>r!==void 0&&e<p(r)||i!==void 0&&e>p(i),X=(e,r,i)=>{const l=(new Date(e,r,1).getDay()-i+7)%7,g=new Date(e,r+1,0).getDate(),a=[];for(let o=0;o<l;o+=1)a.push(void 0);for(let o=1;o<=g;o+=1)a.push(new Date(e,r,o));for(;a.length%7!==0;)a.push(void 0);const D=[];for(let o=0;o<a.length;o+=7)D.push(a.slice(o,o+7));return D};function Z({accentColor:e="blue",autoFocus:r=!1,defaultValue:i,firstDayOfWeek:l=1,isDisabled:g=!1,maxDate:a,minDate:D,onChange:o,onSubmit:F,selectedColor:$="green",value:f}){const{isFocused:m}=I({autoFocus:r,isActive:!g}),M=w(()=>p(new Date),[]),j=p(f??i??M),[O,B]=V(j),c=f?p(f):O,v=W(c);v.current=c;const E=w(()=>[...k.slice(l),...k.slice(0,l)],[l]),N=w(()=>X(c.getFullYear(),c.getMonth(),l),[c,l]),d=S(s=>{const n=p(s);J(n,D,a)||(f===void 0&&B(n),o?.(n))},[f,o,D,a]);K(S((s,n)=>{if(!m)return;const{current:t}=v;n.leftArrow?d(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1)):n.rightArrow?d(new Date(t.getFullYear(),t.getMonth(),t.getDate()+1)):n.upArrow?d(new Date(t.getFullYear(),t.getMonth(),t.getDate()-7)):n.downArrow?d(new Date(t.getFullYear(),t.getMonth(),t.getDate()+7)):n.pageUp?d(x(t,-1)):n.pageDown?d(x(t,1)):n.return&&F?.(t)},[m,d,F]),{isActive:!g&&m});const R=`${P[c.getMonth()]} ${c.getFullYear()}`;return y(h,{borderColor:m?e:void 0,borderStyle:"round",flexDirection:"column",paddingX:1,children:[u(h,{justifyContent:"center",children:u(b,{bold:!0,color:e,children:R})}),u(h,{marginTop:1,children:E.map(s=>u(h,{width:3,children:u(b,{dimColor:!0,children:s.padEnd(2," ")})},s))}),N.map((s,n)=>u(h,{children:s.map((t,C)=>{if(t===void 0)return u(h,{width:3,children:u(b,{children:" "})},C);const Y=T(t,M),A=T(t,c),U=J(t,D,a);return u(h,{width:3,children:y(b,{backgroundColor:A&&m?e:void 0,bold:Y,color:A&&m?"black":Y?$:void 0,dimColor:U||g,children:[String(t.getDate()).padStart(2," ")," "]})},C)})},n))]})}export{Z as Calendar,Z as default};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Border color.
|
|
7
|
-
*/
|
|
8
|
-
readonly borderColor?: LiteralUnion<AnsiColors, string>;
|
|
9
|
-
/**
|
|
10
|
-
* Border style name, passed through to `Box`.
|
|
11
|
-
* @default "round"
|
|
12
|
-
*/
|
|
13
|
-
readonly borderStyle?: "arrow" | "bold" | "classic" | "double" | "doubleSingle" | "round" | "single" | "singleDouble";
|
|
14
|
-
/**
|
|
15
|
-
* Card body.
|
|
16
|
-
*/
|
|
17
|
-
readonly children: ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Optional footer rendered below body with a dim divider.
|
|
20
|
-
*/
|
|
21
|
-
readonly footer?: ReactNode;
|
|
22
|
-
/**
|
|
23
|
-
* Optional content rendered after the title on the same row.
|
|
24
|
-
*/
|
|
25
|
-
readonly headerRight?: ReactNode;
|
|
26
|
-
/**
|
|
27
|
-
* Optional subtitle rendered below the title.
|
|
28
|
-
*/
|
|
29
|
-
readonly subtitle?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Optional title rendered in the header area.
|
|
32
|
-
*/
|
|
33
|
-
readonly title?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Color applied to the title.
|
|
36
|
-
*/
|
|
37
|
-
readonly titleColor?: LiteralUnion<AnsiColors, string>;
|
|
38
|
-
/**
|
|
39
|
-
* Fix the card width. When omitted the card grows to fill its parent.
|
|
40
|
-
*/
|
|
41
|
-
readonly width?: number | string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Bordered container with optional title, subtitle, and footer.
|
|
45
|
-
*/
|
|
46
|
-
declare function Card({
|
|
47
|
-
borderColor,
|
|
48
|
-
borderStyle,
|
|
49
|
-
children,
|
|
50
|
-
footer,
|
|
51
|
-
headerRight,
|
|
52
|
-
subtitle,
|
|
53
|
-
title,
|
|
54
|
-
titleColor,
|
|
55
|
-
width
|
|
56
|
-
}: Props): ReactElement;
|
|
57
|
-
export { Card, type Props as CardProps, Props, Card as default };
|
package/dist/components/card.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as r,jsx as i}from"react/jsx-runtime";import{Box as o}from"./box.js";import{Divider as u}from"./divider.js";import{Text as c}from"./text.js";function b({borderColor:m,borderStyle:h="round",children:a,footer:l,headerRight:e,subtitle:d,title:t,titleColor:f,width:n}){return r(o,{borderColor:m,borderStyle:h,flexDirection:"column",paddingX:1,width:n,children:[t!==void 0||d!==void 0||e!==void 0?r(o,{flexDirection:"column",marginBottom:1,children:[r(o,{justifyContent:"space-between",children:[i(o,{children:t===void 0?void 0:i(c,{bold:!0,color:f,children:t})}),e===void 0?void 0:i(o,{children:e})]}),d===void 0?void 0:i(c,{dimColor:!0,children:d})]}):void 0,i(o,{flexDirection:"column",children:a}),l===void 0?void 0:r(o,{flexDirection:"column",marginTop:1,children:[i(u,{dimColor:!0,length:typeof n=="number"?Math.max(1,n-4):void 0}),i(o,{marginTop:1,children:l})]})]})}export{b as Card,b as default};
|