@visulima/tui 1.0.0-alpha.9 → 1.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 +650 -0
- package/LICENSE.md +2414 -187
- package/README.md +49 -4
- package/dist/components/accordion.d.ts +59 -0
- package/dist/components/accordion.js +1 -0
- package/dist/components/alert.d.ts +26 -0
- package/dist/components/alert.js +1 -0
- package/dist/components/animate-presence.d.ts +18 -0
- package/dist/components/animate-presence.js +1 -0
- package/dist/components/approval-prompt.d.ts +65 -0
- package/dist/components/approval-prompt.js +1 -0
- package/dist/components/area-chart.d.ts +66 -0
- package/dist/components/area-chart.js +1 -0
- package/dist/components/badge.d.ts +22 -0
- package/dist/components/badge.js +1 -0
- package/dist/components/bar-chart.d.ts +67 -0
- package/dist/components/bar-chart.js +1 -0
- package/dist/components/big-text.d.ts +81 -0
- package/dist/components/big-text.js +1 -0
- package/dist/components/blink-dot.d.ts +36 -0
- package/dist/components/blink-dot.js +1 -0
- package/dist/components/box.d.ts +62 -0
- package/dist/components/box.js +1 -0
- package/dist/components/breadcrumb.d.ts +33 -0
- package/dist/components/breadcrumb.js +1 -0
- package/dist/components/button.d.ts +45 -0
- package/dist/components/button.js +1 -0
- package/dist/components/calendar.d.ts +72 -0
- package/dist/components/calendar.js +1 -0
- package/dist/components/canvas.d.ts +44 -0
- package/dist/components/canvas.js +1 -0
- package/dist/components/card.d.ts +57 -0
- package/dist/components/card.js +1 -0
- package/dist/components/checkbox.d.ts +48 -0
- package/dist/components/checkbox.js +1 -0
- package/dist/components/code.d.ts +48 -0
- package/dist/components/code.js +2 -0
- package/dist/components/collapsible.d.ts +53 -0
- package/dist/components/collapsible.js +1 -0
- package/dist/components/command-block.d.ts +47 -0
- package/dist/components/command-block.js +4 -0
- package/dist/components/command-palette.d.ts +82 -0
- package/dist/components/command-palette.js +1 -0
- package/dist/components/confirm-dialog.d.ts +75 -0
- package/dist/components/confirm-dialog.js +1 -0
- package/dist/components/confirm-input.d.ts +38 -0
- package/dist/components/confirm-input.js +1 -0
- package/dist/components/console-overlay.d.ts +54 -0
- package/dist/components/console-overlay.js +1 -0
- package/dist/components/content-switcher.d.ts +57 -0
- package/dist/components/content-switcher.js +1 -0
- package/dist/components/controlled-scroll-view.d.ts +61 -0
- package/dist/components/controlled-scroll-view.js +1 -0
- package/dist/components/cursor.d.ts +62 -0
- package/dist/components/cursor.js +1 -0
- package/dist/components/date-picker.d.ts +65 -0
- package/dist/components/date-picker.js +1 -0
- package/dist/components/definition-list.d.ts +44 -0
- package/dist/components/definition-list.js +1 -0
- package/dist/components/dialog.d.ts +117 -0
- package/dist/components/dialog.js +1 -0
- package/dist/components/diff-view.d.ts +85 -0
- package/dist/components/diff-view.js +1 -0
- package/dist/components/divider.d.ts +49 -0
- package/dist/components/divider.js +1 -0
- package/dist/components/file-picker-entry.d.ts +104 -0
- package/dist/components/file-picker-entry.js +1 -0
- package/dist/components/form.d.ts +81 -0
- package/dist/components/form.js +1 -0
- package/dist/components/gauge.d.ts +87 -0
- package/dist/components/gauge.js +1 -0
- package/dist/components/gradient.d.ts +42 -0
- package/dist/components/gradient.js +1 -0
- package/dist/components/heading.d.ts +33 -0
- package/dist/components/heading.js +1 -0
- package/dist/components/heatmap.d.ts +62 -0
- package/dist/components/heatmap.js +1 -0
- package/dist/components/help.d.ts +52 -0
- package/dist/components/help.js +1 -0
- package/dist/components/histogram.d.ts +62 -0
- package/dist/components/histogram.js +1 -0
- package/dist/components/kbd.d.ts +31 -0
- package/dist/components/kbd.js +1 -0
- package/dist/components/line-chart.d.ts +109 -0
- package/dist/components/line-chart.js +1 -0
- package/dist/components/link.d.ts +38 -0
- package/dist/components/link.js +1 -0
- package/dist/components/loading-indicator.d.ts +29 -0
- package/dist/components/loading-indicator.js +1 -0
- package/dist/components/markdown.d.ts +40 -0
- package/dist/components/markdown.js +1 -0
- package/dist/components/masked-input.d.ts +50 -0
- package/dist/components/masked-input.js +1 -0
- package/dist/components/menu.d.ts +78 -0
- package/dist/components/menu.js +1 -0
- package/dist/components/message-bubble.d.ts +43 -0
- package/dist/components/message-bubble.js +1 -0
- package/dist/components/model-badge.d.ts +39 -0
- package/dist/components/model-badge.js +1 -0
- package/dist/components/multi-select.d.ts +65 -0
- package/dist/components/multi-select.js +1 -0
- package/dist/components/newline.d.ts +15 -0
- package/dist/components/newline.js +2 -0
- package/dist/components/operation-tree.d.ts +49 -0
- package/dist/components/operation-tree.js +1 -0
- package/dist/components/option-list.d.ts +47 -0
- package/dist/components/option-list.js +1 -0
- package/dist/components/ordered-list.d.ts +24 -0
- package/dist/components/ordered-list.js +1 -0
- package/dist/components/paginator.d.ts +69 -0
- package/dist/components/paginator.js +1 -0
- package/dist/components/paragraph.d.ts +38 -0
- package/dist/components/paragraph.js +1 -0
- package/dist/components/placeholder.d.ts +55 -0
- package/dist/components/placeholder.js +1 -0
- package/dist/components/progress-bar.d.ts +56 -0
- package/dist/components/progress-bar.js +1 -0
- package/dist/components/radio-group.d.ts +74 -0
- package/dist/components/radio-group.js +1 -0
- package/dist/components/scatter-plot.d.ts +35 -0
- package/dist/components/scatter-plot.js +1 -0
- package/dist/components/scroll-bar-box.d.ts +37 -0
- package/dist/components/scroll-bar-box.js +1 -0
- package/dist/components/scroll-bar.d.ts +25 -0
- package/dist/components/scroll-bar.js +1 -0
- package/dist/components/scroll-list.d.ts +20 -0
- package/dist/components/scroll-list.js +1 -0
- package/dist/components/scroll-view.d.ts +10 -0
- package/dist/components/scroll-view.js +1 -0
- package/dist/components/search-input.d.ts +55 -0
- package/dist/components/search-input.js +1 -0
- package/dist/components/select-input-indicator.d.ts +32 -0
- package/dist/components/select-input-indicator.js +1 -0
- package/dist/components/select-input-item.d.ts +41 -0
- package/dist/components/select-input-item.js +1 -0
- package/dist/components/select-input.d.ts +110 -0
- package/dist/components/select-input.js +1 -0
- package/dist/components/shimmer-text.d.ts +47 -0
- package/dist/components/shimmer-text.js +1 -0
- package/dist/components/slider.d.ts +103 -0
- package/dist/components/slider.js +1 -0
- package/dist/components/spacer.d.ts +8 -0
- package/dist/components/spacer.js +1 -0
- package/dist/components/sparkline.d.ts +35 -0
- package/dist/components/sparkline.js +1 -0
- package/dist/components/spinner.d.ts +17 -0
- package/dist/components/spinner.js +1 -0
- package/dist/components/static-render.d.ts +55 -0
- package/dist/components/static-render.js +1 -0
- package/dist/components/static.d.ts +29 -0
- package/dist/components/static.js +1 -0
- package/dist/components/status-line.d.ts +37 -0
- package/dist/components/status-line.js +1 -0
- package/dist/components/status-message.d.ts +21 -0
- package/dist/components/status-message.js +1 -0
- package/dist/components/stepper.d.ts +48 -0
- package/dist/components/stepper.js +1 -0
- package/dist/components/stopwatch.d.ts +49 -0
- package/dist/components/stopwatch.js +1 -0
- package/dist/components/streaming-text.d.ts +46 -0
- package/dist/components/streaming-text.js +1 -0
- package/dist/components/switch.d.ts +55 -0
- package/dist/components/switch.js +1 -0
- package/dist/components/tab.d.ts +19 -0
- package/dist/components/tab.js +1 -0
- package/dist/components/table.d.ts +119 -0
- package/dist/components/table.js +1 -0
- package/dist/components/tabs.d.ts +107 -0
- package/dist/components/tabs.js +1 -0
- package/dist/components/tag.d.ts +35 -0
- package/dist/components/tag.js +1 -0
- package/dist/components/text-input.d.ts +48 -0
- package/dist/components/text-input.js +1 -0
- package/dist/components/text.d.ts +79 -0
- package/dist/components/text.js +1 -0
- package/dist/components/textarea.d.ts +68 -0
- package/dist/components/textarea.js +2 -0
- package/dist/components/timer.d.ts +59 -0
- package/dist/components/timer.js +1 -0
- package/dist/components/toast.d.ts +49 -0
- package/dist/components/toast.js +1 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +1 -0
- package/dist/components/transform.d.ts +21 -0
- package/dist/components/transform.js +1 -0
- package/dist/components/transition.d.ts +74 -0
- package/dist/components/transition.js +1 -0
- package/dist/components/tree-view-entry.d.ts +357 -0
- package/dist/components/tree-view-entry.js +1 -0
- package/dist/components/unordered-list.d.ts +30 -0
- package/dist/components/unordered-list.js +1 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1 -1
- package/dist/ink/hooks/use-animation.d.ts +41 -0
- package/dist/ink/hooks/use-animation.js +1 -0
- package/dist/ink/hooks/use-app.d.ts +38 -0
- package/dist/ink/hooks/use-app.js +1 -0
- package/dist/ink/hooks/use-box-metrics.d.ts +66 -0
- package/dist/ink/hooks/use-box-metrics.js +1 -0
- package/dist/ink/hooks/use-clipboard.d.ts +30 -0
- package/dist/ink/hooks/use-clipboard.js +1 -0
- package/dist/ink/hooks/use-color-blindness.d.ts +33 -0
- package/dist/ink/hooks/use-color-blindness.js +1 -0
- package/dist/ink/hooks/use-console-capture.d.ts +43 -0
- package/dist/ink/hooks/use-console-capture.js +1 -0
- package/dist/ink/hooks/use-cursor.d.ts +13 -0
- package/dist/ink/hooks/use-cursor.js +1 -0
- package/dist/ink/hooks/use-focus-manager.d.ts +57 -0
- package/dist/ink/hooks/use-focus-manager.js +1 -0
- package/dist/ink/hooks/use-focus.d.ts +34 -0
- package/dist/ink/hooks/use-focus.js +1 -0
- package/dist/ink/hooks/use-form.d.ts +68 -0
- package/dist/ink/hooks/use-form.js +1 -0
- package/dist/ink/hooks/use-hotkey.d.ts +37 -0
- package/dist/ink/hooks/use-hotkey.js +1 -0
- package/dist/ink/hooks/use-input.d.ts +149 -0
- package/dist/ink/hooks/use-input.js +2 -0
- package/dist/ink/hooks/use-interval.d.ts +25 -0
- package/dist/ink/hooks/use-interval.js +1 -0
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +6 -0
- package/dist/ink/hooks/use-is-screen-reader-enabled.js +1 -0
- package/dist/ink/hooks/use-key-bindings.d.ts +59 -0
- package/dist/ink/hooks/use-key-bindings.js +1 -0
- package/dist/ink/hooks/use-key-chord.d.ts +25 -0
- package/dist/ink/hooks/use-key-chord.js +1 -0
- package/dist/ink/hooks/use-linked-scroll.d.ts +49 -0
- package/dist/ink/hooks/use-linked-scroll.js +1 -0
- package/dist/ink/hooks/use-paste.d.ts +45 -0
- package/dist/ink/hooks/use-paste.js +1 -0
- package/dist/ink/hooks/use-persistent-state.d.ts +65 -0
- package/dist/ink/hooks/use-persistent-state.js +2 -0
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +47 -0
- package/dist/ink/hooks/use-scroll-acceleration.js +1 -0
- package/dist/ink/hooks/use-scroll-input.d.ts +34 -0
- package/dist/ink/hooks/use-scroll-input.js +1 -0
- package/dist/ink/hooks/use-stderr.d.ts +16 -0
- package/dist/ink/hooks/use-stderr.js +1 -0
- package/dist/ink/hooks/use-stdin.d.ts +30 -0
- package/dist/ink/hooks/use-stdin.js +1 -0
- package/dist/ink/hooks/use-stdout.d.ts +16 -0
- package/dist/ink/hooks/use-stdout.js +1 -0
- package/dist/ink/hooks/use-stopwatch.d.ts +39 -0
- package/dist/ink/hooks/use-stopwatch.js +1 -0
- package/dist/ink/hooks/use-terminal-palette.d.ts +20 -0
- package/dist/ink/hooks/use-terminal-palette.js +1 -0
- package/dist/ink/hooks/use-text-buffer.d.ts +42 -0
- package/dist/ink/hooks/use-text-buffer.js +4 -0
- package/dist/ink/hooks/use-text-selection.d.ts +45 -0
- package/dist/ink/hooks/use-text-selection.js +1 -0
- package/dist/ink/hooks/use-timeout.d.ts +24 -0
- package/dist/ink/hooks/use-timeout.js +1 -0
- package/dist/ink/hooks/use-timer.d.ts +48 -0
- package/dist/ink/hooks/use-timer.js +1 -0
- package/dist/ink/hooks/use-window-size.d.ts +18 -0
- package/dist/ink/hooks/use-window-size.js +1 -0
- package/dist/ink/index.d.ts +30 -6251
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +31 -0
- package/dist/ink/mouse/use-element-position.js +1 -0
- package/dist/ink/mouse/use-mouse-action.d.ts +5 -0
- package/dist/ink/mouse/use-mouse-action.js +1 -0
- package/dist/ink/mouse/use-mouse-position.d.ts +5 -0
- package/dist/ink/mouse/use-mouse-position.js +1 -0
- package/dist/ink/mouse/use-mouse.d.ts +5 -0
- package/dist/ink/mouse/use-mouse.js +1 -0
- package/dist/ink/mouse/use-on-mouse-click.d.ts +16 -0
- package/dist/ink/mouse/use-on-mouse-click.js +1 -0
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +10 -0
- package/dist/ink/mouse/use-on-mouse-hover.js +1 -0
- package/dist/ink/mouse/use-on-mouse-state.d.ts +13 -0
- package/dist/ink/mouse/use-on-mouse-state.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/COLOR_BLINDNESS_COMPENSATION-Ilnoyeqc.js +1 -0
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +1 -0
- package/dist/packem_shared/DevTools-k6uiVzqv.js +1 -0
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +1 -0
- package/dist/packem_shared/FocusContext-C2Sosxa4.js +1 -0
- package/dist/packem_shared/Fullscreen-BRhuBLBh.js +1 -0
- package/dist/packem_shared/IMECompositionBuffer-VhC9HRCv.js +1 -0
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +2 -0
- package/dist/packem_shared/KEY-C--kOw41.js +1 -0
- package/dist/packem_shared/LayoutNode-LPYsuzBg.js +1 -0
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +1 -0
- package/dist/packem_shared/NAMED_COLORS-82DpREQV.js +1 -0
- package/dist/packem_shared/Range-BsVYNWtg.js +1 -0
- package/dist/packem_shared/Renderer-DsskdkUd.js +1 -0
- package/dist/packem_shared/ResizeObserver-BI9bDy-j.js +1 -0
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +1 -0
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +1 -0
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +1 -0
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +1 -0
- package/dist/packem_shared/Static-DSzsElz4.js +1 -0
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +1 -0
- package/dist/packem_shared/TreeView-BsvLCsf0.js +1 -0
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +1 -0
- package/dist/packem_shared/TuiContext-BNmP0lMY.js +3 -0
- package/dist/packem_shared/ansi-parser-DlgLtOYO.js +1 -0
- package/dist/packem_shared/ansi-tokenizer-BU67A126.js +1 -0
- package/dist/packem_shared/braille-ch3O5D7I.js +1 -0
- package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +39 -0
- package/dist/packem_shared/calculateScroll-D4Y_JR4H.js +1 -0
- package/dist/packem_shared/{measureElement-DA8WqFP_.js → calculateScrollbarLayout-Lf6i24c9.js} +1 -1
- package/dist/packem_shared/clearOsc52-BUpnQOav.js +1 -0
- package/dist/packem_shared/clearStringWidthCache-DKFjfJuB.js +1 -0
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +50 -0
- package/dist/packem_shared/colorize-DU4YZkp3.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +1 -0
- package/dist/packem_shared/createInlineLoop-BT40Wpmx.js +2 -0
- package/dist/packem_shared/createScreen-DoYpyL0V.js +3 -0
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +12 -0
- package/dist/packem_shared/dom-rphpG0kf.js +1 -0
- package/dist/packem_shared/dom.d-B4kXbaVY.d.ts +449 -0
- package/dist/packem_shared/format-time-fjoQHMxD.js +1 -0
- package/dist/packem_shared/{getPathToRoot-B2tKmx3i.js → getPathToRoot-PDJeqiEH.js} +1 -1
- package/dist/packem_shared/input-utils-BSWCb4F_.js +1 -0
- package/dist/packem_shared/{input.d-Bfq7oc06.d.ts → input.d-CgxV2e8U.d.ts} +1 -1
- package/dist/packem_shared/isIntersecting-Bo2npvMR.js +1 -0
- package/dist/packem_shared/isTerminalPaletteQuerySupported-BYzmqq9-.js +1 -0
- package/dist/packem_shared/kittyFlags-g8ALyoCU.js +1 -0
- package/dist/packem_shared/line-chart-C7CUrvVs.js +1 -0
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +1 -0
- package/dist/packem_shared/measure-element-D4M9iSYp.js +1 -0
- package/dist/packem_shared/measure-text-B7juNq4Y.js +3 -0
- package/dist/packem_shared/mouse-context.d-BfL9xGk_.d.ts +30 -0
- package/dist/packem_shared/parseSgrMouse-bUrqPrh-.js +1 -0
- package/dist/packem_shared/processLayout-I83k6vXE.js +2 -0
- package/dist/packem_shared/reconciler-CFyBVf7l.js +1 -0
- package/dist/packem_shared/reconciler-ClpU7Y-V.js +1 -0
- package/dist/packem_shared/render-CuQecTAs.js +24 -0
- package/dist/packem_shared/render-DFZ8NHlG.js +1 -0
- package/dist/packem_shared/render.d-CBnYBDk2.d.ts +417 -0
- package/dist/packem_shared/renderToString-DwXFY8Qh.js +4 -0
- package/dist/packem_shared/renderToString-L_bpw4OQ.js +2 -0
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +2 -0
- package/dist/packem_shared/renderer-k-xShm1P.js +17 -0
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +119 -0
- package/dist/packem_shared/selection.d-CI3_p8wg.d.ts +62 -0
- package/dist/packem_shared/squashTextNodesWithMap-BmUSBPfc.js +1 -0
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +1 -0
- package/dist/packem_shared/stdin-context-88AhuztD.js +1 -0
- package/dist/packem_shared/styles.d-cMo36xQz.d.ts +396 -0
- package/dist/packem_shared/terminal-palette.d-D2SQjfn-.d.ts +19 -0
- package/dist/packem_shared/text-width-e49vlbQH.js +2 -0
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +1 -0
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +1 -0
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +1 -0
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +1 -0
- package/dist/packem_shared/utils-Bup8lyK8.js +1 -0
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
- package/dist/packem_shared/waitFor-CTAki32d.js +4 -0
- package/dist/packem_shared/wrapOrTruncateStyledLine-46W8bTtv.js +3 -0
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +5 -1
- package/dist/testing/index.js +1 -1
- package/index.js +65 -156
- package/package.json +601 -47
- package/dist/packem_shared/Accordion-BXsqchV-.js +0 -1
- package/dist/packem_shared/Alert-BhYVMHtR.js +0 -1
- package/dist/packem_shared/AnimatePresence-Eu7Z8KHc.js +0 -1
- package/dist/packem_shared/ApprovalPrompt-BSn0FT1g.js +0 -1
- package/dist/packem_shared/AreaChart-Chy-frI7.js +0 -1
- package/dist/packem_shared/Badge-B8WPyRsK.js +0 -1
- package/dist/packem_shared/BarChart-rpZtlMcF.js +0 -1
- package/dist/packem_shared/BigText-CRpwUzrt.js +0 -1
- package/dist/packem_shared/BlinkDot-BvnRuWP8.js +0 -1
- package/dist/packem_shared/Box-BwqSvWuq.js +0 -1
- package/dist/packem_shared/Breadcrumb-D0hClbRV.js +0 -1
- package/dist/packem_shared/Button-B89Yvbc6.js +0 -1
- package/dist/packem_shared/COLOR_BLINDNESS_SIMULATION-DqErf7XX.js +0 -1
- package/dist/packem_shared/Calendar-Dmflvm2S.js +0 -1
- package/dist/packem_shared/Canvas-CKg6WV47.js +0 -1
- package/dist/packem_shared/Card-B_9fXdtU.js +0 -1
- package/dist/packem_shared/Checkbox-BN71eCWU.js +0 -1
- package/dist/packem_shared/Code-HhevcyiH.js +0 -2
- package/dist/packem_shared/Collapsible-u6uf_FdV.js +0 -1
- package/dist/packem_shared/CommandBlock-B-nslpCv.js +0 -4
- package/dist/packem_shared/CommandPalette-CEFdaURo.js +0 -1
- package/dist/packem_shared/ConfirmDialog-5Jje_Xpu.js +0 -1
- package/dist/packem_shared/ConfirmInput-D44Mb9oo.js +0 -1
- package/dist/packem_shared/ConsoleOverlay-CM3APfgP.js +0 -1
- package/dist/packem_shared/ContentSwitcher-Dm5BkrCt.js +0 -1
- package/dist/packem_shared/ControlledScrollView-DI8KZOQB.js +0 -1
- package/dist/packem_shared/Cursor-BoLFIMol.js +0 -1
- package/dist/packem_shared/DatePicker-CnSrFFAE.js +0 -1
- package/dist/packem_shared/DefinitionList-v8RDuF_R.js +0 -1
- package/dist/packem_shared/DevTools-O8EbCfHa.js +0 -1
- package/dist/packem_shared/Dialog-CTaL8pn0.js +0 -1
- package/dist/packem_shared/DiffView-BUIFqUB0.js +0 -1
- package/dist/packem_shared/Divider-C47bKmqu.js +0 -1
- package/dist/packem_shared/FilePicker-CUo7R5Qb.js +0 -1
- package/dist/packem_shared/FocusContext-Xy0cwJpO.js +0 -1
- package/dist/packem_shared/FormField-af3aUpRL.js +0 -1
- package/dist/packem_shared/Fullscreen-CuJ8y0s0.js +0 -1
- package/dist/packem_shared/Gauge-Dz-usH__.js +0 -1
- package/dist/packem_shared/Gradient-DYNc0GZA.js +0 -1
- package/dist/packem_shared/Heading-mwEYza3Y.js +0 -1
- package/dist/packem_shared/Heatmap-ChL97U1-.js +0 -1
- package/dist/packem_shared/Help-Zcelyw_U.js +0 -1
- package/dist/packem_shared/Histogram-FIf2F83d.js +0 -1
- package/dist/packem_shared/IMECompositionBuffer-C89PhiOu.js +0 -1
- package/dist/packem_shared/InputParser-rZKjY_7Y.js +0 -2
- package/dist/packem_shared/KEY-Bk8B-3h_.js +0 -1
- package/dist/packem_shared/Kbd-DpkPp4jB.js +0 -1
- package/dist/packem_shared/LayoutNode-rxblE317.js +0 -1
- package/dist/packem_shared/LineChart-BXE_girm.js +0 -1
- package/dist/packem_shared/Link-i2o2EG4-.js +0 -1
- package/dist/packem_shared/LoadingIndicator-TC1Fjwyt.js +0 -1
- package/dist/packem_shared/Markdown-R1XqK63D.js +0 -1
- package/dist/packem_shared/MaskedInput-J01phOZs.js +0 -1
- package/dist/packem_shared/Menu-CfrH4ymk.js +0 -1
- package/dist/packem_shared/MessageBubble-BmBBU2Rm.js +0 -1
- package/dist/packem_shared/ModelBadge-D3wrXncu.js +0 -1
- package/dist/packem_shared/MouseProvider-pjza-lpc.js +0 -1
- package/dist/packem_shared/MultiSelect-Dqmn-bVo.js +0 -1
- package/dist/packem_shared/NAMED_COLORS-B9fJsYdg.js +0 -1
- package/dist/packem_shared/Newline-BSG4iUqp.js +0 -2
- package/dist/packem_shared/OperationTree-DksxjMIV.js +0 -1
- package/dist/packem_shared/OptionList-CNx7r9yN.js +0 -1
- package/dist/packem_shared/OrderedList-BeDy035w.js +0 -1
- package/dist/packem_shared/Paginator-B56s6bhS.js +0 -1
- package/dist/packem_shared/Paragraph-BqJlH0R-.js +0 -1
- package/dist/packem_shared/Placeholder-GMpHRGC8.js +0 -1
- package/dist/packem_shared/ProgressBar-Bj3fmORR.js +0 -1
- package/dist/packem_shared/RadioGroup-Br8BeEwS.js +0 -1
- package/dist/packem_shared/Renderer-DJXooAsp.js +0 -1
- package/dist/packem_shared/ResizeObserverEntry-Dq0dk8Kq.js +0 -1
- package/dist/packem_shared/ScatterPlot-OhfYco5l.js +0 -1
- package/dist/packem_shared/ScrollBar-Da5Y3z7N.js +0 -1
- package/dist/packem_shared/ScrollBarBox-Dz6F-Eat.js +0 -1
- package/dist/packem_shared/ScrollList-DiVGyEjv.js +0 -1
- package/dist/packem_shared/ScrollView-BojONotI.js +0 -1
- package/dist/packem_shared/SearchInput-BoPTRbhV.js +0 -1
- package/dist/packem_shared/SelectInput-CAJ7SCBq.js +0 -1
- package/dist/packem_shared/SelectInputIndicator-N1n8ULHs.js +0 -1
- package/dist/packem_shared/SelectInputItem-BEkbmobs.js +0 -1
- package/dist/packem_shared/ShimmerText-CuGQ2NDC.js +0 -1
- package/dist/packem_shared/Slider-Cg_tJpKa.js +0 -1
- package/dist/packem_shared/Spacer-eT3HOrXk.js +0 -1
- package/dist/packem_shared/Sparkline-T6_FPVET.js +0 -1
- package/dist/packem_shared/Spinner-B0-A50pu.js +0 -1
- package/dist/packem_shared/Static-DLynr5pn.js +0 -1
- package/dist/packem_shared/Static-jzLPaHJF.js +0 -1
- package/dist/packem_shared/StaticRender-BgD61E7x.js +0 -1
- package/dist/packem_shared/StatusLine-Ch4jjef1.js +0 -1
- package/dist/packem_shared/StatusMessage-B1qfKeMM.js +0 -1
- package/dist/packem_shared/Stepper-CNPAqxiU.js +0 -1
- package/dist/packem_shared/Stopwatch-CAx2EWwq.js +0 -1
- package/dist/packem_shared/StreamingText-BYOKSB2T.js +0 -1
- package/dist/packem_shared/Switch-DzSpKYu7.js +0 -1
- package/dist/packem_shared/Tab-BcXzSUdj.js +0 -1
- package/dist/packem_shared/Table-DJp1TLrR.js +0 -1
- package/dist/packem_shared/Tabs-D68z0SOt.js +0 -1
- package/dist/packem_shared/Tag-BvLHnYRn.js +0 -1
- package/dist/packem_shared/Text-mTAve9R2.js +0 -1
- package/dist/packem_shared/TextInput-C_gYQlnF.js +0 -1
- package/dist/packem_shared/Textarea-C2ET_oMb.js +0 -2
- package/dist/packem_shared/Timer-CI3aQX65.js +0 -1
- package/dist/packem_shared/Toast-Drvc8XfG.js +0 -1
- package/dist/packem_shared/Tooltip-C5UnQlLd.js +0 -1
- package/dist/packem_shared/Transform-fYmcdqRT.js +0 -1
- package/dist/packem_shared/Transition-CJDBKYUB.js +0 -1
- package/dist/packem_shared/TreeNodeMap-CspqSCpb.js +0 -1
- package/dist/packem_shared/TreeView-DjhacGJ5.js +0 -1
- package/dist/packem_shared/TuiApp-DrjI_i-R.js +0 -1
- package/dist/packem_shared/TuiContext-BoJvG3NN.js +0 -3
- package/dist/packem_shared/UnorderedList-BnfqexZs.js +0 -1
- package/dist/packem_shared/ansi-parser-B6uXaq65.js +0 -1
- package/dist/packem_shared/ansi-tokenizer-DqX9nJuk.js +0 -1
- package/dist/packem_shared/boxes-DyY_LXCi.js +0 -1
- package/dist/packem_shared/braille-BBjIoaN0.js +0 -1
- package/dist/packem_shared/colorize-DbTZMrJO.js +0 -1
- package/dist/packem_shared/comparePoints-C85EsmNz.js +0 -1
- package/dist/packem_shared/controlled-scroll-view-CmrAEvJk.js +0 -1
- package/dist/packem_shared/createInlineLoop-DRNZ7jqH.js +0 -2
- package/dist/packem_shared/createLinkedScrollGroup-BMTJ7rAj.js +0 -1
- package/dist/packem_shared/createMemoryStorage-QVZNXbWz.js +0 -2
- package/dist/packem_shared/createScreen-CrLrxA6t.js +0 -3
- package/dist/packem_shared/dom-4y__5fWB.js +0 -1
- package/dist/packem_shared/format-time-C7Q-hQZq.js +0 -1
- package/dist/packem_shared/getScrollHeight-BTEY8ewu.js +0 -1
- package/dist/packem_shared/input-utils-fAxzSlNh.js +0 -1
- package/dist/packem_shared/isIntersecting-B3KbKTmu.js +0 -1
- package/dist/packem_shared/isOsc52Supported-DKK7Uee6.js +0 -1
- package/dist/packem_shared/isTerminalPaletteQuerySupported-Dn2hFAZ_.js +0 -1
- package/dist/packem_shared/kittyFlags-C3rZLbcK.js +0 -1
- package/dist/packem_shared/line-chart-DrM8PwnI.js +0 -1
- package/dist/packem_shared/measure-element-DSp7YDus.js +0 -2
- package/dist/packem_shared/measure-text-DDjHT1jD.js +0 -3
- package/dist/packem_shared/parseSgrMouse-Ccj70ijb.js +0 -1
- package/dist/packem_shared/processLayout-DXDfFb_d.js +0 -1
- package/dist/packem_shared/reconciler-BuOP-TZ6.js +0 -1
- package/dist/packem_shared/reconciler-DSYCrIZs.js +0 -1
- package/dist/packem_shared/render-DDqtMAFN.js +0 -1
- package/dist/packem_shared/render-_r0K9K11.js +0 -28
- package/dist/packem_shared/render.d-CNIzVQTh.d.ts +0 -1257
- package/dist/packem_shared/renderToString-DeqOWRP8.js +0 -4
- package/dist/packem_shared/renderToString-IYYPyASm.js +0 -2
- package/dist/packem_shared/renderTreeToBuffer-DPkoCgP2.js +0 -2
- package/dist/packem_shared/renderer-D2p6av2X.js +0 -17
- package/dist/packem_shared/setEnableStyledLineCache-D2gZbwFM.js +0 -1
- package/dist/packem_shared/squashTextNodesWithMap-Cpqmc45i.js +0 -1
- package/dist/packem_shared/stderr-context-BzEaUICS.js +0 -1
- package/dist/packem_shared/stdin-context-BTaaFagk.js +0 -1
- package/dist/packem_shared/text-width-CZ9vPvM0.js +0 -2
- package/dist/packem_shared/token-to-elements-BYxT6J_Q.js +0 -1
- package/dist/packem_shared/treeViewTheme-1RIZyB4M.js +0 -1
- package/dist/packem_shared/useAnimation-B9we6ZzL.js +0 -1
- package/dist/packem_shared/useApp-B6fvM42d.js +0 -1
- package/dist/packem_shared/useBoxMetrics-D5pkIr6P.js +0 -1
- package/dist/packem_shared/useClipboard-CBxy0hT8.js +0 -1
- package/dist/packem_shared/useColorBlindness-BvWcu2Bb.js +0 -1
- package/dist/packem_shared/useConsoleCapture-BxiG8iLJ.js +0 -1
- package/dist/packem_shared/useCursor-CPu8T5Db.js +0 -1
- package/dist/packem_shared/useElementDimensions-qJ_WXFZ9.js +0 -1
- package/dist/packem_shared/useFocus-DSmziO_x.js +0 -1
- package/dist/packem_shared/useFocusManager-Uapn3LQo.js +0 -1
- package/dist/packem_shared/useForm-CzV-Oext.js +0 -1
- package/dist/packem_shared/useHotkey-D0dGey14.js +0 -1
- package/dist/packem_shared/useInput-D1_jG26Z.js +0 -2
- package/dist/packem_shared/useInterval-AobjZT3u.js +0 -1
- package/dist/packem_shared/useIsScreenReaderEnabled-DjWHh-II.js +0 -1
- package/dist/packem_shared/useKeyBindings-zabkEJQs.js +0 -1
- package/dist/packem_shared/useKeyChord-CICQIxXj.js +0 -1
- package/dist/packem_shared/useMouseAction-2dRfU1vE.js +0 -1
- package/dist/packem_shared/useMouseContext-C746G7kY.js +0 -1
- package/dist/packem_shared/useMousePosition-BTWfV4JK.js +0 -1
- package/dist/packem_shared/useOnMouseClick-nY8xLZmt.js +0 -1
- package/dist/packem_shared/useOnMouseHover-D3DczIol.js +0 -1
- package/dist/packem_shared/useOnMouseState-cRK8QvzD.js +0 -1
- package/dist/packem_shared/usePaste-CKKB9H-Z.js +0 -1
- package/dist/packem_shared/useScrollAcceleration-NrY1oVMs.js +0 -1
- package/dist/packem_shared/useScrollInput-Caghtn-Q.js +0 -1
- package/dist/packem_shared/useStderr-BDZb6InG.js +0 -1
- package/dist/packem_shared/useStdin-DKa4h35k.js +0 -1
- package/dist/packem_shared/useStdout-B-2lX4C5.js +0 -1
- package/dist/packem_shared/useStopwatch-DffK7iMh.js +0 -1
- package/dist/packem_shared/useTerminalPalette-Cv7tSduR.js +0 -1
- package/dist/packem_shared/useTextBuffer-DekkGLxI.js +0 -4
- package/dist/packem_shared/useTextSelection-CGT0GLDR.js +0 -1
- package/dist/packem_shared/useTimeout-7LEFYTnG.js +0 -1
- package/dist/packem_shared/useTimer-DyoqSyGi.js +0 -1
- package/dist/packem_shared/useTreeView-8UlTK6sW.js +0 -1
- package/dist/packem_shared/useTreeViewState-CRPCUWrb.js +0 -1
- package/dist/packem_shared/useWindowSize-yDZsXF8z.js +0 -1
- package/dist/packem_shared/utils-THUhYKG2.js +0 -1
- package/dist/packem_shared/waitFor-Dj5zfL5s.js +0 -4
- package/dist/packem_shared/wrapOrTruncateStyledLine-BZ00SM8i.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import{useImperativeHandle as m}from"react";import f from"../ink/hooks/use-stopwatch.js";import{f as i}from"../packem_shared/format-time-fjoQHMxD.js";import{Text as n}from"./text.js";const x=({autoStart:o,bold:r,color:a,format:e=i,interval:s,ref:l})=>{const t=f({autoStart:o,interval:s});return m(l,()=>({lap:t.lap,reset:t.reset,start:t.start,stop:t.stop,toggle:t.toggle}),[t.lap,t.reset,t.start,t.stop,t.toggle]),p(n,{bold:r,color:a,children:e(t.elapsed)})};export{x as Stopwatch,x as default};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Color applied to the streamed output.
|
|
7
|
+
*/
|
|
8
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Glyph rendered at the streaming caret while characters are still being revealed.
|
|
11
|
+
* @default "▊" (left three quarters block)
|
|
12
|
+
*/
|
|
13
|
+
readonly cursor?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Milliseconds between characters.
|
|
16
|
+
* @default 20
|
|
17
|
+
*/
|
|
18
|
+
readonly interval?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Called exactly once per `text` value, after the full text has been revealed.
|
|
21
|
+
*/
|
|
22
|
+
readonly onComplete?: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to display the cursor after streaming completes.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
readonly showCursorWhenDone?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Full text to stream into the output.
|
|
30
|
+
*/
|
|
31
|
+
readonly text: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Typewriter animation that reveals text one character at a time.
|
|
35
|
+
* Automatically resets and replays when `text` changes. `onComplete`
|
|
36
|
+
* fires exactly once per `text` value once it is fully revealed.
|
|
37
|
+
*/
|
|
38
|
+
declare function StreamingText({
|
|
39
|
+
color,
|
|
40
|
+
cursor,
|
|
41
|
+
interval,
|
|
42
|
+
onComplete,
|
|
43
|
+
showCursorWhenDone,
|
|
44
|
+
text
|
|
45
|
+
}: Props): ReactElement;
|
|
46
|
+
export { Props, StreamingText, type Props as StreamingTextProps, StreamingText as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as g}from"react/jsx-runtime";import{useState as T,useRef as c,useEffect as l}from"react";import{Text as d}from"./text.js";function k({color:f,cursor:i="▊",interval:o=20,onComplete:n,showCursorWhenDone:a=!1,text:r}){const[t,s]=T(0),u=c(n),e=c(!1);u.current=n,l(()=>{s(0),e.current=!1},[r]),l(()=>{if(t>=r.length){e.current||(e.current=!0,u.current?.());return}const p=setTimeout(()=>{s(x=>Math.min(r.length,x+1))},o);return()=>{clearTimeout(p)}},[t,r,o]);const m=!(t>=r.length)||a,h=r.slice(0,t);return g(d,{color:f,children:[h,m?i:""]})}export{k as StreamingText,k as default};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Accent color for the on state.
|
|
7
|
+
* @default "green"
|
|
8
|
+
*/
|
|
9
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Auto-focus when mounted if nothing else is focused.
|
|
12
|
+
*/
|
|
13
|
+
readonly autoFocus?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Optional label rendered after the switch.
|
|
16
|
+
*/
|
|
17
|
+
readonly children?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Initial value when uncontrolled.
|
|
20
|
+
*/
|
|
21
|
+
readonly defaultValue?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Disable input and dim the switch.
|
|
24
|
+
*/
|
|
25
|
+
readonly isDisabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Labels displayed inside the switch track.
|
|
28
|
+
* @default ["off", "on"]
|
|
29
|
+
*/
|
|
30
|
+
readonly labels?: readonly [string, string];
|
|
31
|
+
/**
|
|
32
|
+
* Fired when the switch is toggled.
|
|
33
|
+
*/
|
|
34
|
+
readonly onChange?: (value: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Controlled value. Pair with `onChange` to update the parent.
|
|
37
|
+
*/
|
|
38
|
+
readonly value?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Focusable on/off switch. Toggles with Space or Enter.
|
|
42
|
+
* @returns A `ReactElement` rendering two labeled segments plus an optional
|
|
43
|
+
* trailing label.
|
|
44
|
+
*/
|
|
45
|
+
declare function Switch({
|
|
46
|
+
accentColor,
|
|
47
|
+
autoFocus,
|
|
48
|
+
children,
|
|
49
|
+
defaultValue,
|
|
50
|
+
isDisabled,
|
|
51
|
+
labels,
|
|
52
|
+
onChange,
|
|
53
|
+
value
|
|
54
|
+
}: Props): ReactElement;
|
|
55
|
+
export { Props, Switch, type Props as SwitchProps, Switch as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as l,jsx as x}from"react/jsx-runtime";import{useState as F,useCallback as $}from"react";import j from"../ink/hooks/use-focus.js";import y from"../ink/hooks/use-input.js";import{Box as u}from"./box.js";import{Text as a}from"./text.js";const A=["off","on"];function V({accentColor:e="green",autoFocus:f=!1,children:n,defaultValue:m=!1,isDisabled:r=!1,labels:s=A,onChange:t,value:c}){const{isFocused:i}=j({autoFocus:f,isActive:!r}),[v,b]=F(m),o=c??v;y($((h,k)=>{if(i&&(k.return||h===" ")){const d=!o;c===void 0&&b(d),t?.(d)}},[i,o,c,t]),{isActive:!r&&i});const p=s[0],C=s[1],g=i?e:void 0;return l(u,{gap:1,children:[l(u,{gap:0,children:[l(a,{backgroundColor:o?void 0:"gray",color:o?void 0:"black",dimColor:r,children:[" ",p," "]}),l(a,{backgroundColor:o?e:void 0,color:o?"black":void 0,dimColor:r,children:[" ",C," "]})]}),n===void 0?void 0:x(a,{color:g,dimColor:r,children:n})]})}export{V as Switch,V as default};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Tab content to render when the tab is active.
|
|
5
|
+
*/
|
|
6
|
+
readonly children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Unique name identifying this tab.
|
|
9
|
+
*/
|
|
10
|
+
readonly name: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A single tab within a Tabs container.
|
|
14
|
+
* The `name` prop identifies the tab; `children` is rendered when active.
|
|
15
|
+
*/
|
|
16
|
+
declare function Tab({
|
|
17
|
+
children
|
|
18
|
+
}: Props): ReactElement;
|
|
19
|
+
export { Props, Tab, type Props as TabProps, Tab as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,Fragment as n}from"react/jsx-runtime";function a({children:r}){return e(n,{children:r})}export{a as Tab,a as default};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
interface BorderComponent {
|
|
3
|
+
char: string;
|
|
4
|
+
width: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Represents the style of the border for a table or grid.
|
|
8
|
+
*/
|
|
9
|
+
interface BorderStyle {
|
|
10
|
+
/** Box vertical character. */
|
|
11
|
+
bodyJoin: BorderComponent;
|
|
12
|
+
/** Box vertical character. */
|
|
13
|
+
bodyLeft: BorderComponent;
|
|
14
|
+
/** Box vertical character. */
|
|
15
|
+
bodyRight: BorderComponent;
|
|
16
|
+
/** Box horizontal character. */
|
|
17
|
+
bottomBody: BorderComponent;
|
|
18
|
+
/** Box bottom join character. */
|
|
19
|
+
bottomJoin: BorderComponent;
|
|
20
|
+
/** Box bottom left character. */
|
|
21
|
+
bottomLeft: BorderComponent;
|
|
22
|
+
/** Box bottom right character. */
|
|
23
|
+
bottomRight: BorderComponent;
|
|
24
|
+
/** Box horizontal character. */
|
|
25
|
+
joinBody: BorderComponent;
|
|
26
|
+
/** Box horizontal join character. */
|
|
27
|
+
joinJoin: BorderComponent;
|
|
28
|
+
/** Box left join character. */
|
|
29
|
+
joinLeft: BorderComponent;
|
|
30
|
+
/** Box right join character. */
|
|
31
|
+
joinRight: BorderComponent;
|
|
32
|
+
/** Box horizontal character. */
|
|
33
|
+
topBody: BorderComponent;
|
|
34
|
+
/** Box top join character. */
|
|
35
|
+
topJoin: BorderComponent;
|
|
36
|
+
/** Box top left character. */
|
|
37
|
+
topLeft: BorderComponent;
|
|
38
|
+
/** Box top right character. */
|
|
39
|
+
topRight: BorderComponent;
|
|
40
|
+
}
|
|
41
|
+
/** Base style properties applicable globally */
|
|
42
|
+
type HorizontalAlignment = "center" | "left" | "right";
|
|
43
|
+
/**
|
|
44
|
+
* Scalar value that can be displayed in a table cell.
|
|
45
|
+
*/
|
|
46
|
+
type Scalar = bigint | boolean | number | string | null | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Dictionary with scalar values, representing a single row of data.
|
|
49
|
+
*/
|
|
50
|
+
type ScalarDict = Record<string, Scalar>;
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for a single table column.
|
|
53
|
+
*/
|
|
54
|
+
type ColumnConfig<T extends ScalarDict> = {
|
|
55
|
+
/**
|
|
56
|
+
* Horizontal alignment of cell content.
|
|
57
|
+
*/
|
|
58
|
+
readonly align?: HorizontalAlignment;
|
|
59
|
+
/**
|
|
60
|
+
* Custom header label. Defaults to the key name.
|
|
61
|
+
*/
|
|
62
|
+
readonly header?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Key from the data object to display in this column.
|
|
65
|
+
*/
|
|
66
|
+
readonly key: keyof T & string;
|
|
67
|
+
/**
|
|
68
|
+
* Fixed width for this column in characters.
|
|
69
|
+
*/
|
|
70
|
+
readonly width?: number;
|
|
71
|
+
};
|
|
72
|
+
type Props<T extends ScalarDict> = {
|
|
73
|
+
/**
|
|
74
|
+
* Border style preset name or a custom `BorderStyle` object from `@visulima/tabular`.
|
|
75
|
+
* @default "default"
|
|
76
|
+
*/
|
|
77
|
+
readonly borderStyle?: "ascii" | "block" | "default" | "dots" | "double" | "markdown" | "minimal" | "none" | "rounded" | "thick" | BorderStyle;
|
|
78
|
+
/**
|
|
79
|
+
* Columns to display and their order.
|
|
80
|
+
* Accepts simple key strings or `ColumnConfig` objects for advanced control.
|
|
81
|
+
* If omitted, all keys from the first data item are used.
|
|
82
|
+
*/
|
|
83
|
+
readonly columns?: ((keyof T & string) | ColumnConfig<T>)[];
|
|
84
|
+
/**
|
|
85
|
+
* Array of objects to display as rows.
|
|
86
|
+
*/
|
|
87
|
+
readonly data: T[];
|
|
88
|
+
/**
|
|
89
|
+
* Format a cell value before rendering. Return a string to display in the cell.
|
|
90
|
+
*/
|
|
91
|
+
readonly formatCell?: (value: Scalar, column: keyof T & string, rowIndex: number) => string;
|
|
92
|
+
/**
|
|
93
|
+
* Format a header label before rendering. Return a string to display as the column header.
|
|
94
|
+
*/
|
|
95
|
+
readonly formatHeader?: (column: keyof T & string) => string;
|
|
96
|
+
/**
|
|
97
|
+
* Maximum width of the table in characters. Columns will be truncated or wrapped to fit.
|
|
98
|
+
*/
|
|
99
|
+
readonly maxWidth?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Cell padding (left and right) in characters.
|
|
102
|
+
* @default 1
|
|
103
|
+
*/
|
|
104
|
+
readonly padding?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Whether to show the header row.
|
|
107
|
+
* @default true
|
|
108
|
+
*/
|
|
109
|
+
readonly showHeader?: boolean;
|
|
110
|
+
/** Placeholder shown in place of `null` or `undefined` cell values. Defaults to an empty string. */
|
|
111
|
+
readonly skeleton?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Enable word wrap instead of truncation when cells exceed their width.
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
readonly wordWrap?: boolean;
|
|
117
|
+
};
|
|
118
|
+
declare const Table: <T extends ScalarDict>(props: Props<T>) => ReactElement;
|
|
119
|
+
export { type ColumnConfig, type Props, type Scalar, type ScalarDict, Table, type ColumnConfig as TableColumnConfig, type Props as TableProps, type Scalar as TableScalar, type ScalarDict as TableScalarDict, Table as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as y}from"react/jsx-runtime";import{Table as _}from"@visulima/tabular";import{THICK_BORDER as g,ROUNDED_BORDER as b,NO_BORDER as w,MINIMAL_BORDER as S,MARKDOWN_BORDER as W,DOUBLE_BORDER as x,DOTS_BORDER as C,DEFAULT_BORDER as E,BLOCK_BORDER as H,ASCII_BORDER as I}from"@visulima/tabular/style";import{useMemo as L}from"react";import{Text as M}from"./text.js";const N={ascii:I,block:H,default:E,dots:C,double:x,markdown:W,minimal:S,none:w,rounded:b,thick:g},T=t=>typeof t=="string"?{key:t}:t,A=({borderStyle:t="default",columns:d,data:a,formatCell:n,formatHeader:m,maxWidth:f,padding:i=1,showHeader:s=!0,skeleton:u="",wordWrap:D=!1})=>{const h=L(()=>{if(a.length===0)return"";let r;if(d?r=d.map(e=>T(e)):r=Object.keys(a[0]).map(e=>({key:e})),r.length===0)return"";const k=typeof t=="string"?N[t]??E:t,O=r.map(e=>e.width),B=O.some(e=>e!==void 0),R=new _({columnWidths:B?O:void 0,maxWidth:f,showHeader:s,style:{border:k,paddingLeft:i,paddingRight:i},wordWrap:D});if(s){const e=r.map(o=>{const l=o.header??o.key;return m?m(o.key):l});R.setHeaders(e)}for(const[e,o]of a.entries()){const l=r.map(c=>{const p=o[c.key];return n?n(p,c.key,e):p==null?u:String(p)});R.addRow(l)}return R.toString()},[t,d,a,n,m,f,i,s,u,D]);return y(M,{children:h})},q=A;export{q as Table,q as default};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
import { Props as Props$1 } from "./tab.js";
|
|
5
|
+
/**
|
|
6
|
+
* Keyboard navigation configuration for Tabs.
|
|
7
|
+
*/
|
|
8
|
+
type KeyMap = {
|
|
9
|
+
/**
|
|
10
|
+
* Key names that move to the next tab.
|
|
11
|
+
* Defaults to `["rightArrow"]` for row layouts and `["downArrow"]` for column layouts.
|
|
12
|
+
*/
|
|
13
|
+
readonly next?: ReadonlyArray<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Key names that move to the previous tab.
|
|
16
|
+
* Defaults to `["leftArrow"]` for row layouts and `["upArrow"]` for column layouts.
|
|
17
|
+
*/
|
|
18
|
+
readonly previous?: ReadonlyArray<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Whether Meta/Cmd + 1–9 jumps to a specific tab.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
readonly useNumbers?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the Tab key cycles through tabs (only when `isFocused` is not managed by Ink).
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
readonly useTab?: boolean;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Color customization for active tab styling.
|
|
32
|
+
*/
|
|
33
|
+
type TabColors = {
|
|
34
|
+
readonly activeTab?: {
|
|
35
|
+
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
36
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type Props = {
|
|
40
|
+
/**
|
|
41
|
+
* Tab elements to render.
|
|
42
|
+
*/
|
|
43
|
+
readonly children: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Active tab colors. When `isFocused` is `false`, the active tab uses gray.
|
|
46
|
+
*/
|
|
47
|
+
readonly colors?: TabColors;
|
|
48
|
+
/**
|
|
49
|
+
* Name of the tab to select initially (uncontrolled mode).
|
|
50
|
+
* Ignored when `value` is provided.
|
|
51
|
+
*/
|
|
52
|
+
readonly defaultValue?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Layout direction for the tab bar.
|
|
55
|
+
* @default "row"
|
|
56
|
+
*/
|
|
57
|
+
readonly flexDirection?: "column" | "column-reverse" | "row" | "row-reverse";
|
|
58
|
+
/**
|
|
59
|
+
* Whether the tabs are focused and respond to keyboard input.
|
|
60
|
+
* - `true`: focused, uses active colors.
|
|
61
|
+
* - `false`: unfocused, uses gray active color, ignores input.
|
|
62
|
+
* - `undefined`/`null`: always active (focus not managed by Ink).
|
|
63
|
+
* @default undefined
|
|
64
|
+
*/
|
|
65
|
+
readonly isFocused?: boolean | null;
|
|
66
|
+
/**
|
|
67
|
+
* Custom keyboard mappings.
|
|
68
|
+
*/
|
|
69
|
+
readonly keyMap?: KeyMap;
|
|
70
|
+
/**
|
|
71
|
+
* Called when the active tab changes.
|
|
72
|
+
*/
|
|
73
|
+
readonly onChange: (name: string, activeTab: ReactElement<Props$1>) => void;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to display 1-based index numbers before each tab name.
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
readonly showIndex?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Controlled active tab name. When provided, the component is controlled —
|
|
81
|
+
* the parent owns the active tab state and must update it via `onChange`.
|
|
82
|
+
* When omitted, the component manages its own state (uncontrolled mode).
|
|
83
|
+
*/
|
|
84
|
+
readonly value?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Width of the container Box. Also determines the separator width in column layouts.
|
|
87
|
+
*/
|
|
88
|
+
readonly width?: number | string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Tabbed navigation component. Renders a row or column of tabs with keyboard
|
|
92
|
+
* navigation (arrow keys, Tab, number keys) and calls `onChange` when the
|
|
93
|
+
* active tab changes.
|
|
94
|
+
*/
|
|
95
|
+
declare function Tabs({
|
|
96
|
+
children,
|
|
97
|
+
colors: colorsProp,
|
|
98
|
+
defaultValue,
|
|
99
|
+
flexDirection,
|
|
100
|
+
isFocused,
|
|
101
|
+
keyMap: keyMapProp,
|
|
102
|
+
onChange,
|
|
103
|
+
showIndex,
|
|
104
|
+
value,
|
|
105
|
+
width
|
|
106
|
+
}: Props): ReactElement;
|
|
107
|
+
export { KeyMap, Props, TabColors, Tabs, type KeyMap as TabsKeyMap, type Props as TabsProps, Tabs as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as y,jsxs as A}from"react/jsx-runtime";import{useRef as I,useState as U,useCallback as d,useEffect as X,useMemo as j,Children as Y}from"react";import Z from"../ink/hooks/use-input.js";import{Box as M}from"./box.js";import{Text as D}from"./text.js";const _=/^\d$/u,G=e=>e!=null&&typeof e=="object"&&"props"in e&&"name"in e.props,H=e=>{const t=[];for(const n of Y.toArray(e))G(n)&&t.push(n);return t},E=(e,t)=>e.some(n=>t[n]),J=(e,t,n)=>e?t?{backgroundColor:n?.activeTab?.backgroundColor??"green",color:n?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function nr({children:e,colors:t,defaultValue:n,flexDirection:f="row",isFocused:b,keyMap:u,onChange:T,showIndex:F=!0,value:x,width:v}){const s=H(e),c=s.length,p=I(s);p.current=s;const l=f==="column"||f==="column-reverse",g=x!==void 0,[L,O]=U(()=>{const r=x??n;if(r==null||c===0)return 0;const o=s.findIndex(i=>i.props.name===r);return o===-1?0:o}),h=g?Math.max(0,s.findIndex(r=>r.props.name===x)):L,P=d(()=>{},[]),a=g?P:O,m=I(T);m.current=T,X(()=>{if(g)return;const r=p.current[h];r&&m.current(r.props.name,r)},[]);const B=j(()=>u?.previous??[l?"upArrow":"leftArrow"],[u?.previous,l]),N=j(()=>u?.next??[l?"downArrow":"rightArrow"],[u?.next,l]),R=u?.useNumbers??!0,S=u?.useTab??!0,k=I(h);k.current=h;const V=d(r=>{a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[a]),C=d(()=>{const r=(k.current+1)%c;a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[c,a]),w=d(()=>{const r=(k.current-1+c)%c;a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[c,a]);Z(d((r,o)=>{if(E(B,o)){w();return}if(E(N,o)){C();return}if(o.tab&&S&&b==null){o.shift?w():C();return}if(R&&o.meta&&_.test(r)){const i=r==="0"?9:Number.parseInt(r,10)-1;i<c&&V(i)}},[B,N,S,R,b,w,C,c,V]),{isActive:b!==!1});const $=typeof v=="number"?v:6,Q=j(()=>l?"─".repeat($):" | ",[l,$]);return y(M,{flexDirection:f,width:v,children:s.map((r,o)=>{const{name:i}=r.props,q=J(h===o,b!==!1,t);let z=null;return F&&(z=A(D,{color:"grey",children:[o+1,"."," "]})),A(M,{flexDirection:f,children:[o!==0&&y(D,{color:"dim",children:Q}),A(M,{children:[z,y(D,{backgroundColor:q.backgroundColor,color:q.color,children:r})]})]},i)})})}export{nr as Tabs,nr as default};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type TagVariant = "outline" | "solid" | "subtle";
|
|
5
|
+
type Props = {
|
|
6
|
+
/**
|
|
7
|
+
* Tag content.
|
|
8
|
+
*/
|
|
9
|
+
readonly children: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Base color.
|
|
12
|
+
* @default "blue"
|
|
13
|
+
*/
|
|
14
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Optional symbol rendered before the label (e.g. `●`, `✔`, `★`).
|
|
17
|
+
*/
|
|
18
|
+
readonly icon?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Visual style.
|
|
21
|
+
* @default "subtle"
|
|
22
|
+
*/
|
|
23
|
+
readonly variant?: TagVariant;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Render a short pill-shaped label.
|
|
27
|
+
* @returns A `ReactElement` rendering the tag in the requested variant.
|
|
28
|
+
*/
|
|
29
|
+
declare function Tag({
|
|
30
|
+
children,
|
|
31
|
+
color,
|
|
32
|
+
icon,
|
|
33
|
+
variant
|
|
34
|
+
}: Props): ReactElement;
|
|
35
|
+
export { Props, Tag, type Props as TagProps, TagVariant, Tag as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as l}from"react/jsx-runtime";import{Box as a}from"./box.js";import{Text as n}from"./text.js";function u({children:d,color:i="blue",icon:o,variant:c="subtle"}){return c==="outline"?e(a,{borderColor:i,borderStyle:"round",paddingX:1,children:r(n,{color:i,children:[o===void 0?void 0:r(l,{children:[o," "]}),d]})}):c==="solid"?r(n,{backgroundColor:i,color:"black",children:[" ",o===void 0?void 0:r(l,{children:[o," "]}),d," "]}):r(n,{color:i,children:[o===void 0?void 0:r(l,{children:[o," "]}),d]})}export{u as Tag,u as default};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** @default "" */
|
|
4
|
+
readonly defaultValue?: string;
|
|
5
|
+
/**
|
|
6
|
+
* When true, all input is ignored and text is dimmed.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
readonly isDisabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When true, renders asterisks instead of the actual characters.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
readonly mask?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Fires on every keystroke with the updated text.
|
|
17
|
+
*/
|
|
18
|
+
readonly onChange?: (value: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Fires when the user presses Enter.
|
|
21
|
+
*/
|
|
22
|
+
readonly onSubmit?: (value: string) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Greyed-out text shown when the input is empty.
|
|
25
|
+
*/
|
|
26
|
+
readonly placeholder?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Autocomplete candidates. The first case-sensitive prefix match is shown
|
|
29
|
+
* dimmed after the current input. Press right-arrow or Enter to accept.
|
|
30
|
+
*/
|
|
31
|
+
readonly suggestions?: ReadonlyArray<string>;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A single-line text input with cursor navigation, optional placeholder,
|
|
35
|
+
* autocomplete suggestions, and password masking.
|
|
36
|
+
*
|
|
37
|
+
* Supports arrow keys, Home/End, Ctrl+A/E, Ctrl+U/K/W, Backspace, Delete.
|
|
38
|
+
*/
|
|
39
|
+
declare function TextInput({
|
|
40
|
+
defaultValue,
|
|
41
|
+
isDisabled,
|
|
42
|
+
mask,
|
|
43
|
+
onChange,
|
|
44
|
+
onSubmit,
|
|
45
|
+
placeholder,
|
|
46
|
+
suggestions
|
|
47
|
+
}: Props): ReactElement;
|
|
48
|
+
export { Props, TextInput, type Props as TextInputProps, TextInput as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as f,jsxs as w}from"react/jsx-runtime";import{useState as q,useRef as k,useCallback as L}from"react";import N from"../ink/hooks/use-input.js";import{i as O}from"../packem_shared/input-utils-BSWCb4F_.js";import{Box as I}from"./box.js";import{Text as h}from"./text.js";const P=/\S+\s*$/,S=(n,r)=>n.length===0||!r?void 0:r.find(t=>t.startsWith(n))?.slice(n.length)??void 0,y=-1,T=(n,r,t,e)=>r.leftArrow?Math.max(0,t-1):r.home||r.ctrl&&n==="a"?0:r.end||r.ctrl&&n==="e"?e:y,V=(n,r,t,e)=>{if(r.backspace&&e>0)return[t.slice(0,e-1)+t.slice(e),e-1];if(r.delete&&e<t.length)return[t.slice(0,e)+t.slice(e+1),e];if(r.ctrl&&n==="u")return[t.slice(e),0];if(r.ctrl&&n==="k")return[t.slice(0,e),e];if(r.ctrl&&n==="w"){const m=t.slice(0,e).replace(P,"");return[m+t.slice(e),m.length]}};function U({defaultValue:n="",isDisabled:r=!1,mask:t=!1,onChange:e,onSubmit:m,placeholder:x,suggestions:b}){const[o,v]=q(n),[d,u]=q(n.length),A=k(o);A.current=o;const M=k(d);M.current=d;const g=k(e);g.current=e;const j=k(m);j.current=m;const B=S(o,b),z=L((p,a)=>{const{current:s}=M,c=A.current;if(a.return){const i=S(c,b),l=i?c+i:c;i&&(v(l),u(l.length),g.current?.(l)),j.current?.(l);return}if(a.escape)return;if(a.rightArrow){const i=S(c,b);if(s===c.length&&i){const l=c+i;v(l),u(l.length),g.current?.(l);return}u(Math.min(c.length,s+1));return}const D=T(p,a,s,c.length);if(D!==y){u(D);return}const R=V(p,a,c,s);if(R){const[i,l]=R;v(i),u(l),g.current?.(i);return}if(O(p,a)){const i=c.slice(0,s)+p+c.slice(s);v(i),u(s+p.length),g.current?.(i)}},[b]);N(z,{isActive:!r});const C=t?"*".repeat(o.length):o,E=C.slice(0,d),F=C[d],H=C.slice(d+1);return r?f(I,{children:f(h,{dimColor:!0,children:C||x||""})}):o.length===0&&x?w(I,{children:[f(h,{dimColor:!0,inverse:!0,children:x[0]}),f(h,{dimColor:!0,children:x.slice(1)})]}):w(I,{children:[w(h,{children:[E,f(h,{inverse:!0,children:F??" "}),H]}),B?f(h,{dimColor:!0,children:B}):void 0]})}export{U as TextInput,U as default};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
import { S as Styles } from "../packem_shared/styles.d-cMo36xQz.js";
|
|
5
|
+
import 'cli-boxes';
|
|
6
|
+
import 'yoga-layout';
|
|
7
|
+
type Props = {
|
|
8
|
+
/**
|
|
9
|
+
* Hide the element from screen readers.
|
|
10
|
+
*/
|
|
11
|
+
readonly "aria-hidden"?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* A label for the element for screen readers.
|
|
14
|
+
*/
|
|
15
|
+
readonly "aria-label"?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Same as `color`, but for the background.
|
|
18
|
+
*/
|
|
19
|
+
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Make the text bold.
|
|
22
|
+
*/
|
|
23
|
+
readonly bold?: boolean;
|
|
24
|
+
readonly children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Change text color. Ink uses @visulima/colorize under the hood, so all its functionality is supported.
|
|
27
|
+
*/
|
|
28
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Dim the color (make it less bright).
|
|
31
|
+
*/
|
|
32
|
+
readonly dimColor?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Inverse background and foreground colors.
|
|
35
|
+
*/
|
|
36
|
+
readonly inverse?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Make the text italic.
|
|
39
|
+
*/
|
|
40
|
+
readonly italic?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Make the text crossed out with a line.
|
|
43
|
+
*/
|
|
44
|
+
readonly strikethrough?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Make the text underlined.
|
|
47
|
+
*/
|
|
48
|
+
readonly underline?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Controls how text wraps when it exceeds the container width.
|
|
51
|
+
*
|
|
52
|
+
* - `wrap` (default) — Wrap at word boundaries; break inside words only when a single word exceeds the width.
|
|
53
|
+
* - `wrap-anywhere` — Break at any character boundary, even when a whitespace break exists earlier.
|
|
54
|
+
* - `wrap-preserve-words` — Wrap at word boundaries; never break inside words (long words may overflow).
|
|
55
|
+
* - `wrap-strict` — Enforce exact width; always break at the column limit.
|
|
56
|
+
* - `truncate` / `truncate-end` — Truncate at the end with an ellipsis.
|
|
57
|
+
* - `truncate-start` — Truncate at the start with an ellipsis.
|
|
58
|
+
* - `truncate-middle` — Truncate in the middle with an ellipsis.
|
|
59
|
+
*/
|
|
60
|
+
readonly wrap?: Styles["textWrap"];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* This component can display text and change its style to make it bold, underlined, italic, or strikethrough.
|
|
64
|
+
*/
|
|
65
|
+
declare function Text({
|
|
66
|
+
"aria-hidden": ariaHidden,
|
|
67
|
+
"aria-label": ariaLabel,
|
|
68
|
+
backgroundColor,
|
|
69
|
+
bold,
|
|
70
|
+
children,
|
|
71
|
+
color,
|
|
72
|
+
dimColor,
|
|
73
|
+
inverse,
|
|
74
|
+
italic,
|
|
75
|
+
strikethrough,
|
|
76
|
+
underline,
|
|
77
|
+
wrap
|
|
78
|
+
}: Props): ReactElement | null;
|
|
79
|
+
export { Props, Text, type Props as TextProps, Text as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as w}from"react/jsx-runtime";import e from"@visulima/colorize";import{useContext as b,useCallback as v}from"react";import{a as k}from"../packem_shared/colorize-DU4YZkp3.js";import{a as R}from"../packem_shared/accessibility-context-DDyHTwmA.js";import{b as S}from"../packem_shared/background-context-rjOaWFki.js";function W({"aria-hidden":p=!1,"aria-label":a,backgroundColor:i,bold:t=!1,children:s,color:l,dimColor:o=!1,inverse:f=!1,italic:d=!1,strikethrough:u=!1,underline:c=!1,wrap:h="wrap"}){const{isScreenReaderEnabled:n}=b(R),m=b(S),g=n&&a?a:s,C=v(r=>{o&&(r=e.dim(r)),l&&(r=k(r,l,"foreground"));const x=i??m;return x&&(r=k(r,x,"background")),t&&(r=e.bold(r)),d&&(r=e.italic(r)),c&&(r=e.underline(r)),u&&(r=e.strikethrough(r)),f&&(r=e.inverse(r)),r},[o,l,i,m,t,d,c,u,f]);return g==null||n&&p?null:w("ink-text",{internal_transform:C,style:{flexDirection:"row",flexGrow:0,flexShrink:1,textWrap:h},children:n&&a?a:s})}export{W as Text,W as default};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** @default "" */
|
|
4
|
+
readonly defaultValue?: string;
|
|
5
|
+
/**
|
|
6
|
+
* When true, all input is ignored and text is dimmed.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
readonly isDisabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When true, the component responds to keyboard input.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
readonly isFocused?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum visible rows before viewport scrolling kicks in.
|
|
17
|
+
* When set, the textarea will grow from `rows` to `maxRows` before scrolling.
|
|
18
|
+
*/
|
|
19
|
+
readonly maxRows?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Fires on every edit with the updated text.
|
|
22
|
+
*/
|
|
23
|
+
readonly onChange?: (value: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Fires when the user presses Meta+Enter or Ctrl+Enter.
|
|
26
|
+
*/
|
|
27
|
+
readonly onSubmit?: (value: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Greyed-out text shown when the textarea is empty.
|
|
30
|
+
*/
|
|
31
|
+
readonly placeholder?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Number of visible rows (viewport height).
|
|
34
|
+
* @default 5
|
|
35
|
+
*/
|
|
36
|
+
readonly rows?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Show line numbers in the left gutter.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
readonly showLineNumbers?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Number of spaces inserted for a Tab key press.
|
|
44
|
+
* @default 2
|
|
45
|
+
*/
|
|
46
|
+
readonly tabSize?: number;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* A multi-line text input with cursor navigation, selection, clipboard, undo/redo,
|
|
50
|
+
* paste support, and viewport scrolling.
|
|
51
|
+
*
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <Textarea defaultValue="Hello\nWorld" rows={10} onChange={setValue} onSubmit={handleSubmit} />
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function Textarea({
|
|
57
|
+
defaultValue,
|
|
58
|
+
isDisabled,
|
|
59
|
+
isFocused,
|
|
60
|
+
maxRows,
|
|
61
|
+
onChange,
|
|
62
|
+
onSubmit,
|
|
63
|
+
placeholder,
|
|
64
|
+
rows,
|
|
65
|
+
showLineNumbers,
|
|
66
|
+
tabSize
|
|
67
|
+
}: Props): ReactElement;
|
|
68
|
+
export { Props, Textarea, type Props as TextareaProps, Textarea as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as l,jsxs as m,Fragment as x}from"react/jsx-runtime";import{useRef as T,useState as I,useEffect as B,useMemo as W,useCallback as F}from"react";import G from"../ink/hooks/use-clipboard.js";import H from"../ink/hooks/use-input.js";import N from"../ink/hooks/use-paste.js";import O from"../ink/hooks/use-text-buffer.js";import{i as P}from"../packem_shared/input-utils-BSWCb4F_.js";import{Box as C}from"./box.js";import{Text as o}from"./text.js";const Q=(i,c)=>c.line<i.line||c.line===i.line&&c.col<i.col?{endCol:i.col,endLine:i.line,startCol:c.col,startLine:c.line}:{endCol:c.col,endLine:c.line,startCol:i.col,startLine:i.line};function rr({defaultValue:i="",isDisabled:c=!1,isFocused:g=!0,maxRows:d,onChange:v,onSubmit:h,placeholder:p,rows:a=5,showLineNumbers:f=!1,tabSize:L=2}){const n=O(i),S=T(n);S.current=n;const{copy:u}=G(),[s,A]=I(0),E=T(v);E.current=v;const k=T(h);k.current=h;const D=T(i);B(()=>{n.value!==D.current&&(D.current=n.value,E.current?.(n.value))},[n.value]);const w=W(()=>d?Math.min(Math.max(a,n.lines.length),d):a,[a,d,n.lines.length]);B(()=>{A(t=>n.cursor.line<t?n.cursor.line:n.cursor.line>=t+w?n.cursor.line-w+1:t)},[n.cursor.line,w]);const M=F((t,r)=>{const e=S.current;if(r.return&&(r.meta||r.ctrl)){k.current?.(e.value);return}if(r.return){e.newline();return}if(r.escape){e.clearSelection();return}if(r.tab){e.insert(" ".repeat(L));return}if(r.ctrl&&t==="z"){e.undo();return}if(r.ctrl&&(t==="y"||r.shift&&t==="Z")){e.redo();return}if(r.ctrl&&t==="c"&&e.hasSelection()){u(e.getSelectedText());return}if(r.ctrl&&(t==="A"||t==="a"&&r.shift)){e.selectAll();return}if(r.upArrow){e.moveCursor("up",r.shift);return}if(r.downArrow){e.moveCursor("down",r.shift);return}if(r.leftArrow){e.moveCursor("left",r.shift);return}if(r.rightArrow){e.moveCursor("right",r.shift);return}if(r.home){r.ctrl?e.moveToStart(r.shift):e.moveToLineStart(r.shift);return}if(r.end){r.ctrl?e.moveToEnd(r.shift):e.moveToLineEnd(r.shift);return}if(r.ctrl&&t==="a"){e.moveToLineStart(r.shift);return}if(r.ctrl&&t==="e"){e.moveToLineEnd(r.shift);return}if(r.backspace){e.deleteBack();return}if(r.delete){e.deleteForward();return}if(r.ctrl&&t==="u"){e.deleteToLineStart();return}if(r.ctrl&&t==="k"){e.deleteToLineEnd();return}if(r.ctrl&&t==="w"){e.deleteWord();return}P(t,r)&&(e.hasSelection()?e.replaceSelection(t):e.insert(t))},[u,L]);H(M,{isActive:g&&!c});const R=F(t=>{const r=S.current;r.hasSelection()?r.replaceSelection(t):r.insert(t)},[]);N(R,{isActive:g&&!c});const z=n.lines.slice(s,s+w),b=f?String(n.lines.length).length+1:0,j=n.anchor?Q(n.cursor,n.anchor):null;if(c)return l(C,{flexDirection:"column",children:z.map((t,r)=>{const e=s+r;return m(C,{children:[f?m(o,{dimColor:!0,children:[String(e+1).padStart(b)," "]}):void 0,l(o,{dimColor:!0,children:t||(e===0&&p?p:"")})]},e)})});if(n.value.length===0&&p){const t=p.split(`
|
|
2
|
+
`).slice(0,w);return l(C,{flexDirection:"column",children:t.map((r,e)=>m(C,{children:[f?m(o,{dimColor:!0,children:[String(e+1).padStart(b)," "]}):void 0,e===0?m(o,{children:[l(o,{dimColor:!0,inverse:!0,children:r[0]??" "}),l(o,{dimColor:!0,children:r.slice(1)})]}):l(o,{dimColor:!0,children:r})]},e))})}return l(C,{flexDirection:"column",children:z.map((t,r)=>{const e=s+r,y=e===n.cursor.line;return m(C,{children:[f?m(o,{dimColor:!y,children:[String(e+1).padStart(b)," "]}):void 0,l(o,{children:U(t,e,n.cursor,j)})]},e)})})}function U(i,c,g,d){const v=c===g.line,h=v?g.col:-1,p=d&&c>=d.startLine&&c<=d.endLine;if(!p&&!v)return l(x,{children:i});if(!p){const u=i.slice(0,h),s=i[h],A=i.slice(h+1);return m(x,{children:[u,l(o,{inverse:!0,children:s??" "}),A]})}const a=c===d.startLine?d.startCol:0,f=c===d.endLine?d.endCol:i.length,L=i.slice(0,a),n=i.slice(a,f),S=i.slice(f);if(v&&(h<a||h>=f)){const u=[];let s=0;return h<a?(u.push(l(o,{children:i.slice(0,h)},s++)),u.push(l(o,{inverse:!0,children:i[h]??" "},s++)),u.push(l(o,{children:i.slice(h+1,a)},s++)),u.push(l(o,{inverse:!0,children:n},s++)),u.push(l(o,{children:S},s++))):(u.push(l(o,{children:L},s++)),u.push(l(o,{inverse:!0,children:n},s++)),u.push(l(o,{children:i.slice(f,h)},s++)),u.push(l(o,{inverse:!0,children:i[h]??" "},s++)),u.push(l(o,{children:i.slice(h+1)},s++))),l(x,{children:u})}return m(x,{children:[L,l(o,{inverse:!0,children:n}),S]})}export{rr as Textarea,rr as default};
|