@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{jsxs as b,jsx as o}from"react/jsx-runtime";import{useState as w,useCallback as y}from"react";import k from"../ink/hooks/use-focus.js";import A from"../ink/hooks/use-input.js";import{Box as n}from"./box.js";import{Text as f}from"./text.js";const D={danger:"red",info:"blue",warning:"yellow"},p=({color:l,isFocused:r,label:i})=>o(n,{backgroundColor:r?l:void 0,borderColor:r?l:void 0,borderStyle:"round",paddingX:1,children:o(f,{bold:r,color:r?"black":void 0,children:i})});function X({autoFocus:l=!0,cancelLabel:r="Cancel",children:i,confirmLabel:h="Confirm",defaultFocus:g="confirm",isDisabled:u=!1,onCancel:a,onConfirm:s,title:m,tone:v="info",width:C}){const[e,x]=w(g),c=D[v],{isFocused:F}=k({autoFocus:l,isActive:!u});return A(y((t,d)=>{if(d.leftArrow||d.rightArrow||t==="h"||t==="l"){x(e==="confirm"?"cancel":"confirm");return}if(d.return){e==="confirm"?s():a();return}if(d.escape||t==="n"){a();return}t==="y"&&s()},[e,s,a]),{isActive:!u&&F}),b(n,{borderColor:c,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:C,children:[m===void 0?void 0:o(n,{marginBottom:1,children:o(f,{bold:!0,color:c,children:m})}),i===void 0?void 0:o(n,{flexDirection:"column",marginBottom:1,children:typeof i=="string"?o(f,{children:i}):i}),b(n,{gap:2,justifyContent:"flex-end",children:[o(p,{color:c,isFocused:e==="cancel",label:r}),o(p,{color:c,isFocused:e==="confirm",label:h})]})]})}export{X as ConfirmDialog,X as default};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* The default action when pressing Enter without typing Y or N.
|
|
5
|
+
* @default "confirm"
|
|
6
|
+
*/
|
|
7
|
+
readonly defaultChoice?: "cancel" | "confirm";
|
|
8
|
+
/**
|
|
9
|
+
* Whether the input is disabled.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
readonly isDisabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Called when the user cancels (presses N).
|
|
15
|
+
*/
|
|
16
|
+
readonly onCancel: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Called when the user confirms (presses Y).
|
|
19
|
+
*/
|
|
20
|
+
readonly onConfirm: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Whether pressing Enter submits the default choice.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
readonly submitOnEnter?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Renders a Y/N confirmation prompt. Shows "Y/n" when default is confirm,
|
|
29
|
+
* or "y/N" when default is cancel.
|
|
30
|
+
*/
|
|
31
|
+
declare function ConfirmInput({
|
|
32
|
+
defaultChoice,
|
|
33
|
+
isDisabled,
|
|
34
|
+
onCancel,
|
|
35
|
+
onConfirm,
|
|
36
|
+
submitOnEnter
|
|
37
|
+
}: Props): ReactElement;
|
|
38
|
+
export { ConfirmInput, type Props as ConfirmInputProps, Props, ConfirmInput as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as m,jsxs as a}from"react/jsx-runtime";import{useRef as u,useCallback as l}from"react";import p from"../ink/hooks/use-input.js";import{Box as C}from"./box.js";import{Text as d}from"./text.js";function w({defaultChoice:r="confirm",isDisabled:o=!1,onCancel:t,onConfirm:i,submitOnEnter:c=!0}){const e=u(i);e.current=i;const n=u(t);return n.current=t,p(l((s,f)=>{if(s.toLowerCase()==="y"){e.current();return}if(s.toLowerCase()==="n"){n.current();return}f.return&&c&&(r==="confirm"?e.current():n.current())},[c,r]),{isActive:!o}),m(C,{children:a(d,{dimColor:o,children:[r==="confirm"?"Y":"y","/",r==="cancel"?"N":"n"]})})}export{w as ConfirmInput,w as default};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ConsoleLevel } from "../ink/hooks/use-console-capture.js";
|
|
3
|
+
type ConsoleOverlayDock = "bottom" | "top";
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Dock position within the parent container.
|
|
7
|
+
* @default "bottom"
|
|
8
|
+
*/
|
|
9
|
+
readonly dock?: ConsoleOverlayDock;
|
|
10
|
+
/**
|
|
11
|
+
* Which console levels to capture.
|
|
12
|
+
* @default ["log", "info", "warn", "error", "debug"]
|
|
13
|
+
*/
|
|
14
|
+
readonly filter?: ReadonlyArray<ConsoleLevel>;
|
|
15
|
+
/**
|
|
16
|
+
* Visible height in rows.
|
|
17
|
+
* @default 8
|
|
18
|
+
*/
|
|
19
|
+
readonly height?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum entries to keep in the buffer.
|
|
22
|
+
* @default 200
|
|
23
|
+
*/
|
|
24
|
+
readonly maxEntries?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Show the log level label.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
readonly showLevel?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Show timestamps on each entry.
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
readonly showTimestamp?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A dockable console overlay that captures and displays console output.
|
|
38
|
+
*
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Box flexDirection="column" height="100%">
|
|
41
|
+
* <Box flexGrow={1}>{mainContent}</Box>
|
|
42
|
+
* <ConsoleOverlay dock="bottom" height={6} />
|
|
43
|
+
* </Box>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare function ConsoleOverlay({
|
|
47
|
+
dock,
|
|
48
|
+
filter,
|
|
49
|
+
height,
|
|
50
|
+
maxEntries,
|
|
51
|
+
showLevel,
|
|
52
|
+
showTimestamp
|
|
53
|
+
}: Props): ReactElement;
|
|
54
|
+
export { ConsoleOverlay, ConsoleOverlayDock, type Props as ConsoleOverlayProps, Props, ConsoleOverlay as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useMemo as c}from"react";import g from"../ink/hooks/use-console-capture.js";import{Box as p}from"./box.js";import{Text as l}from"./text.js";const h={debug:"gray",error:"red",info:"blue",log:"white",warn:"yellow"},f={debug:"DBG",error:"ERR",info:"INF",log:"LOG",warn:"WRN"},b=t=>{const r=new Date(t),o=String(r.getHours()).padStart(2,"0"),i=String(r.getMinutes()).padStart(2,"0"),n=String(r.getSeconds()).padStart(2,"0");return`${o}:${i}:${n}`};function y({dock:t="bottom",filter:r,height:o=8,maxEntries:i=200,showLevel:n=!0,showTimestamp:u=!0}){const{entries:m}=g({filter:r,maxEntries:i}),s=c(()=>m.slice(-o),[m,o]);return a(p,{borderBottom:t==="top",borderBottomColor:"gray",borderTop:t==="bottom",borderTopColor:"gray",flexDirection:"column",height:o+1,children:s.length===0?a(l,{dimColor:!0,children:"Console output will appear here..."}):s.map(e=>d(p,{children:[u?d(l,{dimColor:!0,children:["[",b(e.timestamp),"]"," "]}):void 0,n?d(l,{color:h[e.level],children:[f[e.level]," "]}):void 0,a(l,{color:e.level==="error"?"red":e.level==="warn"?"yellow":void 0,children:e.message})]},e.id))})}export{y as ConsoleOverlay,y as default};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type ContentSwitcherOption = {
|
|
5
|
+
readonly content: ReactNode;
|
|
6
|
+
readonly icon?: ReactNode;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
};
|
|
10
|
+
type Props = {
|
|
11
|
+
/**
|
|
12
|
+
* Accent color for the selected segment.
|
|
13
|
+
* @default "blue"
|
|
14
|
+
*/
|
|
15
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Auto-focus the switcher on mount.
|
|
18
|
+
*/
|
|
19
|
+
readonly autoFocus?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Initial selected id (uncontrolled).
|
|
22
|
+
*/
|
|
23
|
+
readonly defaultValue?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Disable input.
|
|
26
|
+
*/
|
|
27
|
+
readonly isDisabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Called when the selection changes.
|
|
30
|
+
*/
|
|
31
|
+
readonly onChange?: (id: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Segments to toggle between.
|
|
34
|
+
*/
|
|
35
|
+
readonly options: ReadonlyArray<ContentSwitcherOption>;
|
|
36
|
+
/**
|
|
37
|
+
* Controlled selected id.
|
|
38
|
+
*/
|
|
39
|
+
readonly value?: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Segmented control that flips between mutually exclusive content. More
|
|
43
|
+
* compact than `Tabs`: the selected segment is highlighted as a pill, and
|
|
44
|
+
* only the active segment's content is rendered.
|
|
45
|
+
* @returns A `ReactElement` with a segmented header row and the active
|
|
46
|
+
* panel's content beneath it.
|
|
47
|
+
*/
|
|
48
|
+
declare function ContentSwitcher({
|
|
49
|
+
accentColor,
|
|
50
|
+
autoFocus,
|
|
51
|
+
defaultValue,
|
|
52
|
+
isDisabled,
|
|
53
|
+
onChange,
|
|
54
|
+
options,
|
|
55
|
+
value
|
|
56
|
+
}: Props): ReactElement;
|
|
57
|
+
export { ContentSwitcher, ContentSwitcherOption, type Props as ContentSwitcherProps, Props, ContentSwitcher as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as u,jsx as v,Fragment as k}from"react/jsx-runtime";import{useState as w,useMemo as F,useCallback as p}from"react";import M from"../ink/hooks/use-focus.js";import D from"../ink/hooks/use-input.js";import{Box as m}from"./box.js";import{Text as j}from"./text.js";function $({accentColor:x="blue",autoFocus:g=!1,defaultValue:b,isDisabled:l=!1,onChange:f,options:r,value:t}){const{isFocused:a}=M({autoFocus:g,isActive:!l}),C=b??r[0]?.id,[c,A]=w(C),d=t??c,n=F(()=>{if(d===void 0)return 0;const o=r.findIndex(i=>i.id===d);return Math.max(o,0)},[r,d]),s=p(o=>{const i=r[o];if(!i)return;const e=t??c;i.id!==e&&(t===void 0&&A(i.id),f?.(i.id))},[r,t,c,f]);D(p((o,i)=>{a&&(i.leftArrow||o==="h"?s(Math.max(0,n-1)):(i.rightArrow||o==="l")&&s(Math.min(r.length-1,n+1)))},[a,n,r.length,s]),{isActive:!l&&a});const h=r[n];return u(m,{flexDirection:"column",children:[v(m,{children:r.map((o,i)=>{const e=i===n;return u(j,{backgroundColor:e?x:void 0,color:e?"black":void 0,dimColor:l&&!e,children:[" ",o.icon===void 0?void 0:u(k,{children:[o.icon," "]}),o.label," "]},o.id)})}),h===void 0?void 0:v(m,{flexDirection:"column",marginTop:1,children:h.content})]})}export{$ as ContentSwitcher,$ as default};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { ReactNode, Ref } from 'react';
|
|
2
|
+
import { BoxProps as Props } from "./box.js";
|
|
3
|
+
import 'type-fest';
|
|
4
|
+
import "../packem_shared/dom.d-B4kXbaVY.js";
|
|
5
|
+
import 'yoga-layout';
|
|
6
|
+
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
7
|
+
import '@visulima/colorize';
|
|
8
|
+
import 'cli-boxes';
|
|
9
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
10
|
+
interface ControlledScrollViewProps extends Props {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
onContentHeightChange?: (height: number, previousHeight: number) => void;
|
|
14
|
+
onItemHeightChange?: (index: number, height: number, previousHeight: number) => void;
|
|
15
|
+
onViewportSizeChange?: (size: {
|
|
16
|
+
height: number;
|
|
17
|
+
width: number;
|
|
18
|
+
}, previousSize: {
|
|
19
|
+
height: number;
|
|
20
|
+
width: number;
|
|
21
|
+
}) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Number of extra items to render above/below the viewport when virtualized.
|
|
24
|
+
* @default 3
|
|
25
|
+
*/
|
|
26
|
+
overscan?: number;
|
|
27
|
+
scrollOffset: number;
|
|
28
|
+
/**
|
|
29
|
+
* Only render items visible in the viewport plus overscan.
|
|
30
|
+
* Items must be measured first (first render always renders all items).
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
virtualize?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ControlledScrollViewRef {
|
|
36
|
+
getBottomOffset: () => number;
|
|
37
|
+
getContentHeight: () => number;
|
|
38
|
+
getItemHeight: (index: number) => number;
|
|
39
|
+
getItemPosition: (index: number) => {
|
|
40
|
+
height: number;
|
|
41
|
+
top: number;
|
|
42
|
+
} | null;
|
|
43
|
+
getViewportHeight: () => number;
|
|
44
|
+
remeasure: () => void;
|
|
45
|
+
remeasureItem: (index: number) => void;
|
|
46
|
+
}
|
|
47
|
+
declare const ControlledScrollView: ({
|
|
48
|
+
children,
|
|
49
|
+
debug,
|
|
50
|
+
onContentHeightChange,
|
|
51
|
+
onItemHeightChange,
|
|
52
|
+
onViewportSizeChange,
|
|
53
|
+
overscan,
|
|
54
|
+
ref,
|
|
55
|
+
scrollOffset,
|
|
56
|
+
virtualize,
|
|
57
|
+
...boxProps
|
|
58
|
+
}: ControlledScrollViewProps & {
|
|
59
|
+
ref?: Ref<ControlledScrollViewRef>;
|
|
60
|
+
}) => React.JSX.Element;
|
|
61
|
+
export { ControlledScrollView, type ControlledScrollViewProps, type ControlledScrollViewRef };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as r}from"../packem_shared/controlled-scroll-view-BVg7ywNW.js";export{r as ControlledScrollView};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
|
+
import { C as CursorShape } from "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
3
|
+
import { D as DOMElement } from "../packem_shared/dom.d-B4kXbaVY.js";
|
|
4
|
+
import 'yoga-layout';
|
|
5
|
+
import '@visulima/colorize';
|
|
6
|
+
import 'cli-boxes';
|
|
7
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
8
|
+
import 'type-fest';
|
|
9
|
+
type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* Optional reference to anchor cursor coordinates to a different element.
|
|
12
|
+
* If omitted, `<Cursor>` uses the parent container as anchor.
|
|
13
|
+
* If `anchorRef` is set but currently unresolved, Ink hides the cursor for that frame.
|
|
14
|
+
* If multiple `<Cursor>` components are rendered in one frame, the last rendered one controls the terminal cursor position.
|
|
15
|
+
*/
|
|
16
|
+
readonly anchorRef?: RefObject<DOMElement | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Optional cursor shape (DECSCUSR). The shape is restored to the terminal
|
|
19
|
+
* default on unmount, SIGINT, and unhandled React tree throws, so the
|
|
20
|
+
* parent shell never inherits a leaked shape.
|
|
21
|
+
*
|
|
22
|
+
* Steady variants are non-blinking; `blinking-*` variants opt into blink.
|
|
23
|
+
*/
|
|
24
|
+
readonly shape?: CursorShape;
|
|
25
|
+
/**
|
|
26
|
+
* Horizontal offset from anchor content origin.
|
|
27
|
+
*/
|
|
28
|
+
readonly x?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Vertical offset from anchor content origin.
|
|
31
|
+
*/
|
|
32
|
+
readonly y?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Declaratively position the terminal cursor.
|
|
36
|
+
* `<Cursor>` must not be rendered inside `<Text>`.
|
|
37
|
+
*
|
|
38
|
+
* **Inline mode** (no props): place `<Cursor />` after a `<Text>` node and the
|
|
39
|
+
* cursor appears where that text ended — even when text wraps across lines.
|
|
40
|
+
*
|
|
41
|
+
* **Anchor mode**: pass `anchorRef` and/or `x`/`y` to position relative to
|
|
42
|
+
* another element's content origin.
|
|
43
|
+
* @example Inline mode — cursor follows text naturally
|
|
44
|
+
* ```jsx
|
|
45
|
+
* <Box>
|
|
46
|
+
* <Text>{prompt + value}</Text>
|
|
47
|
+
* <Cursor />
|
|
48
|
+
* </Box>
|
|
49
|
+
* ```
|
|
50
|
+
* @example Anchor mode — offset from a referenced element
|
|
51
|
+
* ```jsx
|
|
52
|
+
* <Box ref={ref} />
|
|
53
|
+
* <Cursor anchorRef={ref} x={5} />
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function Cursor({
|
|
57
|
+
anchorRef,
|
|
58
|
+
shape,
|
|
59
|
+
x,
|
|
60
|
+
y
|
|
61
|
+
}: Props): React.JSX.Element;
|
|
62
|
+
export { Cursor, type Props as CursorProps, Props, Cursor as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{useMemo as u}from"react";function p({anchorRef:i,shape:s,x:o=0,y:r=0}){const n=i??void 0,e=n===void 0&&o===0&&r===0,t=u(()=>({anchorRef:n,inline:e,shape:s,x:o,y:r}),[n,e,s,o,r]);return a("ink-cursor",{internal_cursor:t})}export{p as Cursor,p as default};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Accent color used by the inner calendar when open.
|
|
7
|
+
* @default "blue"
|
|
8
|
+
*/
|
|
9
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Auto-focus the picker on mount.
|
|
12
|
+
*/
|
|
13
|
+
readonly autoFocus?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Initial selected date when uncontrolled.
|
|
16
|
+
*/
|
|
17
|
+
readonly defaultValue?: Date;
|
|
18
|
+
/**
|
|
19
|
+
* Override the way the selected date is rendered in the input row.
|
|
20
|
+
*/
|
|
21
|
+
readonly formatValue?: (date: Date) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Disable the picker.
|
|
24
|
+
*/
|
|
25
|
+
readonly isDisabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Upper bound for selectable dates.
|
|
28
|
+
*/
|
|
29
|
+
readonly maxDate?: Date;
|
|
30
|
+
/**
|
|
31
|
+
* Lower bound for selectable dates.
|
|
32
|
+
*/
|
|
33
|
+
readonly minDate?: Date;
|
|
34
|
+
/**
|
|
35
|
+
* Fired when the user commits a date with Enter.
|
|
36
|
+
*/
|
|
37
|
+
readonly onChange?: (date: Date) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Placeholder rendered when no date is selected.
|
|
40
|
+
* @default "Pick a date"
|
|
41
|
+
*/
|
|
42
|
+
readonly placeholder?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Controlled selected date.
|
|
45
|
+
*/
|
|
46
|
+
readonly value?: Date;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Compact date input. Shows the currently-selected date; Enter / Space opens
|
|
50
|
+
* the inline `Calendar` for navigation. Enter inside the calendar commits the
|
|
51
|
+
* date and closes the picker.
|
|
52
|
+
*/
|
|
53
|
+
declare function DatePicker({
|
|
54
|
+
accentColor,
|
|
55
|
+
autoFocus,
|
|
56
|
+
defaultValue,
|
|
57
|
+
formatValue,
|
|
58
|
+
isDisabled,
|
|
59
|
+
maxDate,
|
|
60
|
+
minDate,
|
|
61
|
+
onChange,
|
|
62
|
+
placeholder,
|
|
63
|
+
value
|
|
64
|
+
}: Props): ReactElement;
|
|
65
|
+
export { DatePicker, type Props as DatePickerProps, Props, DatePicker as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as g,jsx as o}from"react/jsx-runtime";import{useState as C,useCallback as h}from"react";import $ from"../ink/hooks/use-focus.js";import b from"../ink/hooks/use-input.js";import{Box as i}from"./box.js";import{Calendar as T}from"./calendar.js";import{Text as l}from"./text.js";const V=e=>{const n=e.getFullYear(),c=String(e.getMonth()+1).padStart(2,"0"),d=String(e.getDate()).padStart(2,"0");return`${n}-${c}-${d}`};function O({accentColor:e="blue",autoFocus:n=!1,defaultValue:c,formatValue:d=V,isDisabled:s=!1,maxDate:D,minDate:x,onChange:v,placeholder:S="Pick a date",value:u}){const{isFocused:r}=$({autoFocus:n,isActive:!s}),[t,m]=C(!1),[F,k]=C(c),f=u??F;b(h((a,p)=>{!r||t||(p.return||a===" ")&&m(!0)},[r,t]),{isActive:!s&&r&&!t}),b(h((a,p)=>{p.escape&&m(!1)},[]),{isActive:!s&&r&&t});const A=h(a=>{u===void 0&&k(a),m(!1),v?.(a)},[u,v]);return g(i,{flexDirection:"column",children:[g(i,{borderColor:r?e:void 0,borderStyle:"round",paddingX:1,children:[o(l,{color:e,children:"📅 "}),f===void 0?o(l,{dimColor:!0,children:S}):o(l,{bold:!0,children:d(f)}),r&&!t?o(i,{marginLeft:1,children:o(l,{dimColor:!0,children:"(Enter to open)"})}):void 0]}),t?o(i,{marginTop:1,children:o(T,{accentColor:e,autoFocus:!0,defaultValue:f,maxDate:D,minDate:x,onSubmit:A})}):void 0]})}export{O as DatePicker,O as default};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type DefinitionItem = {
|
|
5
|
+
readonly description: ReactNode;
|
|
6
|
+
readonly key?: string;
|
|
7
|
+
readonly term: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* Spacing between term and description columns.
|
|
12
|
+
* @default 2
|
|
13
|
+
*/
|
|
14
|
+
readonly columnGap?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Entries to render.
|
|
17
|
+
*/
|
|
18
|
+
readonly items: ReadonlyArray<DefinitionItem>;
|
|
19
|
+
/**
|
|
20
|
+
* Inline items display on the same row; stacked items display with the term above the description.
|
|
21
|
+
* @default "inline"
|
|
22
|
+
*/
|
|
23
|
+
readonly layout?: "inline" | "stacked";
|
|
24
|
+
/**
|
|
25
|
+
* Color applied to the term.
|
|
26
|
+
* @default "cyan"
|
|
27
|
+
*/
|
|
28
|
+
readonly termColor?: LiteralUnion<AnsiColors, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Minimum width used to align inline terms.
|
|
31
|
+
*/
|
|
32
|
+
readonly termWidth?: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Key/value style definition list. Equivalent to the HTML `<dl>` element.
|
|
36
|
+
*/
|
|
37
|
+
declare function DefinitionList({
|
|
38
|
+
columnGap,
|
|
39
|
+
items,
|
|
40
|
+
layout,
|
|
41
|
+
termColor,
|
|
42
|
+
termWidth
|
|
43
|
+
}: Props): ReactElement;
|
|
44
|
+
export { DefinitionItem, DefinitionList, type Props as DefinitionListProps, Props, DefinitionList as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Box as i}from"./box.js";import{Text as n}from"./text.js";function s({columnGap:d=2,items:t,layout:m="inline",termColor:c="cyan",termWidth:h}){return m==="stacked"?e(i,{flexDirection:"column",gap:1,children:t.map((r,l)=>o(i,{flexDirection:"column",children:[e(n,{bold:!0,color:c,children:r.term}),e(n,{children:r.description})]},r.key??l))}):e(i,{flexDirection:"column",children:t.map((r,l)=>o(i,{gap:d,children:[e(i,{flexShrink:0,width:h,children:e(n,{color:c,children:r.term})}),e(i,{flexGrow:1,flexShrink:1,children:e(n,{children:r.description})})]},r.key??l))})}export{s as DefinitionList,s as default};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
import 'yoga-layout';
|
|
3
|
+
import '@visulima/colorize';
|
|
4
|
+
import 'cli-boxes';
|
|
5
|
+
import { b as ScrollViewRef } from "../packem_shared/scroll-view.d-DtpsgHLg.js";
|
|
6
|
+
import "./box.js";
|
|
7
|
+
import 'type-fest';
|
|
8
|
+
import "../packem_shared/dom.d-B4kXbaVY.js";
|
|
9
|
+
import "../packem_shared/cursor-helpers.d-BONB9tky.js";
|
|
10
|
+
import "../packem_shared/styles.d-cMo36xQz.js";
|
|
11
|
+
type Props = {
|
|
12
|
+
/**
|
|
13
|
+
* Background color for the dialog. Defaults to the detected terminal
|
|
14
|
+
* background color, falling back to `"black"`.
|
|
15
|
+
*/
|
|
16
|
+
readonly backgroundColor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Border color.
|
|
19
|
+
* @default "cyan"
|
|
20
|
+
*/
|
|
21
|
+
readonly borderColor?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Border style.
|
|
24
|
+
* @default "round"
|
|
25
|
+
*/
|
|
26
|
+
readonly borderStyle?: "arrow" | "bold" | "classic" | "double" | "doubleSingle" | "round" | "single" | "singleDouble";
|
|
27
|
+
/**
|
|
28
|
+
* Dialog content.
|
|
29
|
+
*/
|
|
30
|
+
readonly children: ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Override terminal columns. Useful in renderToString or testing contexts
|
|
33
|
+
* where useWindowSize is unavailable.
|
|
34
|
+
*/
|
|
35
|
+
readonly columns?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Footer content rendered below the scrollable area.
|
|
38
|
+
* Useful for hints like "Press ? to close".
|
|
39
|
+
*/
|
|
40
|
+
readonly footer?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Maximum height as a fraction of terminal rows (0-1) or absolute rows.
|
|
43
|
+
* Values <= 1 are treated as fractions; values > 1 as absolute row counts.
|
|
44
|
+
* @default 0.8
|
|
45
|
+
*/
|
|
46
|
+
readonly maxHeight?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Padding inside the dialog border.
|
|
49
|
+
* @default 2
|
|
50
|
+
*/
|
|
51
|
+
readonly paddingX?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Vertical padding inside the dialog border.
|
|
54
|
+
* @default 1
|
|
55
|
+
*/
|
|
56
|
+
readonly paddingY?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Override terminal rows. Useful in renderToString or testing contexts
|
|
59
|
+
* where useWindowSize is unavailable.
|
|
60
|
+
*/
|
|
61
|
+
readonly rows?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Scrollbar visual style.
|
|
64
|
+
* @default "block"
|
|
65
|
+
*/
|
|
66
|
+
readonly scrollbarStyle?: "arrow" | "block" | "bold" | "classic" | "dots" | "double" | "doubleSingle" | "line" | "round" | "single" | "singleDouble" | "thick";
|
|
67
|
+
/**
|
|
68
|
+
* Ref to the internal ScrollView for programmatic scrolling.
|
|
69
|
+
*/
|
|
70
|
+
readonly scrollRef?: React.Ref<ScrollViewRef>;
|
|
71
|
+
/**
|
|
72
|
+
* Title rendered at the top of the dialog. If a string is provided,
|
|
73
|
+
* it is rendered as bold cyan text.
|
|
74
|
+
*/
|
|
75
|
+
readonly title?: ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the dialog is visible. When `false`, nothing is rendered.
|
|
78
|
+
* @default true
|
|
79
|
+
*/
|
|
80
|
+
readonly visible?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Dialog width in columns.
|
|
83
|
+
* @default 60
|
|
84
|
+
*/
|
|
85
|
+
readonly width?: number;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* A centered overlay dialog with automatic scrolling and scrollbar when
|
|
89
|
+
* content exceeds the available terminal height.
|
|
90
|
+
*
|
|
91
|
+
* Uses the terminal's detected background color by default so the
|
|
92
|
+
* dialog blends with the user's theme.
|
|
93
|
+
*
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <Dialog title="Help" footer={<Text dimColor>Press Esc to close</Text>}>
|
|
96
|
+
* <Text>Dialog content here</Text>
|
|
97
|
+
* </Dialog>
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
declare const Dialog: ({
|
|
101
|
+
backgroundColor: backgroundColorProp,
|
|
102
|
+
borderColor,
|
|
103
|
+
borderStyle,
|
|
104
|
+
children,
|
|
105
|
+
columns: columnsProp,
|
|
106
|
+
footer,
|
|
107
|
+
maxHeight: maxHeightProp,
|
|
108
|
+
paddingX,
|
|
109
|
+
paddingY,
|
|
110
|
+
rows: rowsProp,
|
|
111
|
+
scrollbarStyle: scrollbarStyleProp,
|
|
112
|
+
scrollRef: externalScrollRef,
|
|
113
|
+
title,
|
|
114
|
+
visible,
|
|
115
|
+
width
|
|
116
|
+
}: Props) => ReactElement | null;
|
|
117
|
+
export { Dialog, type Props as DialogProps, Props, Dialog as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as j}from"react/jsx-runtime";import{useRef as M}from"react";import H from"../ink/hooks/use-terminal-palette.js";import I from"../ink/hooks/use-window-size.js";import{Box as o}from"./box.js";import{Text as R}from"./text.js";import{ScrollView as T}from"../packem_shared/ScrollView-CHAo7Epj.js";const A=({backgroundColor:u,borderColor:l="cyan",borderStyle:f="round",children:h,columns:g,footer:d,maxHeight:e=.8,paddingX:i=2,paddingY:p=1,rows:b,scrollbarStyle:x="block",scrollRef:k,title:n,visible:C=!0,width:S=60})=>{const c=I(),{isLoading:w,palette:y}=H(),B=M(null),D=k??B;if(!C)return null;const a=g??(c.columns||80),t=b??(c.rows||24),s=u??(w?"black":y?.background??"black"),X=e<=1?Math.floor(t*e):Math.min(e,t-2),m=typeof n=="string"?r(o,{marginBottom:1,children:r(R,{bold:!0,color:l,children:n})}):n??null;return r(o,{alignItems:"center",height:t,justifyContent:"center",position:"absolute",width:a,children:j(o,{backgroundColor:s,borderBackgroundColor:s,borderColor:l,borderStyle:f,flexDirection:"column",maxHeight:X,opaque:!0,paddingY:p,width:Math.min(S,a-4),children:[m!=null&&r(o,{flexShrink:0,paddingX:i,children:m}),r(T,{flexGrow:1,flexShrink:1,paddingX:i,ref:D,scrollbar:!0,scrollbarColor:l,scrollbarStyle:x,children:h}),d!=null&&r(o,{alignItems:"center",flexDirection:"column",flexShrink:0,marginTop:1,paddingX:i,children:d})]})})};export{A as Dialog,A as default};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
type DiffViewMode = "split" | "unified";
|
|
3
|
+
type InlineDiffMode = "chars" | "words";
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Number of unchanged context lines around changes.
|
|
7
|
+
* @default 3
|
|
8
|
+
*/
|
|
9
|
+
readonly context?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Pre-computed unified diff string. If provided, `oldText`/`newText` are ignored.
|
|
12
|
+
*/
|
|
13
|
+
readonly diff?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Enable character-level inline diff highlighting within changed lines.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
readonly inlineDiff?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Granularity of inline diff highlighting.
|
|
21
|
+
* - `"chars"` — character-level (best for code)
|
|
22
|
+
* - `"words"` — word-level (best for prose)
|
|
23
|
+
* @default "chars"
|
|
24
|
+
*/
|
|
25
|
+
readonly inlineDiffMode?: InlineDiffMode;
|
|
26
|
+
/**
|
|
27
|
+
* Programming language for syntax highlighting within diff lines.
|
|
28
|
+
* When provided, diff content is highlighted with Shiki.
|
|
29
|
+
*/
|
|
30
|
+
readonly language?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Display mode: unified (interleaved) or split (side-by-side).
|
|
33
|
+
* @default "unified"
|
|
34
|
+
*/
|
|
35
|
+
readonly mode?: DiffViewMode;
|
|
36
|
+
/**
|
|
37
|
+
* Label for the new version.
|
|
38
|
+
*/
|
|
39
|
+
readonly newLabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Modified text ("new" / right side).
|
|
42
|
+
*/
|
|
43
|
+
readonly newText?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Label for the old version.
|
|
46
|
+
*/
|
|
47
|
+
readonly oldLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Original text ("old" / left side).
|
|
50
|
+
*/
|
|
51
|
+
readonly oldText?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to display line numbers.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
readonly showLineNumbers?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Shiki theme for syntax highlighting.
|
|
59
|
+
* @default "github-dark-default"
|
|
60
|
+
*/
|
|
61
|
+
readonly theme?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Display file differences with colored additions/deletions.
|
|
65
|
+
*
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <DiffView oldText="hello" newText="hello world" />
|
|
68
|
+
* <DiffView diff={unifiedDiffString} mode="split" />
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function DiffView({
|
|
72
|
+
context,
|
|
73
|
+
diff: diffProp,
|
|
74
|
+
inlineDiff,
|
|
75
|
+
inlineDiffMode,
|
|
76
|
+
language,
|
|
77
|
+
mode,
|
|
78
|
+
newLabel,
|
|
79
|
+
newText,
|
|
80
|
+
oldLabel,
|
|
81
|
+
oldText,
|
|
82
|
+
showLineNumbers,
|
|
83
|
+
theme
|
|
84
|
+
}: Props): ReactElement;
|
|
85
|
+
export { DiffView, DiffViewMode, type Props as DiffViewProps, InlineDiffMode, Props, DiffView as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as u,jsxs as g,Fragment as P}from"react/jsx-runtime";import{createPatch as H,parsePatch as T,diffWords as I,diffChars as M}from"diff";import{useMemo as k,useState as W,useRef as B,useEffect as j}from"react";import{r as q,i as z,w as A,g as E,a as F}from"../packem_shared/token-to-elements-D6J6-P2A.js";import G from"../ink/hooks/use-window-size.js";import{Box as p}from"./box.js";import{Text as a}from"./text.js";const L=(r,i,n,d)=>{if(!i||n===void 0||n<1||n>i.length)return d?u(a,{color:d,children:r}):u(a,{dimColor:!0,children:r});const o=i[n-1];return!o||o.length===0?d?u(a,{color:d,children:r}):u(a,{dimColor:!0,children:r}):F(o)},y=(r,i,n)=>{const[d,o]=W(null),h=B(!1);return j(()=>{if(h.current=!1,!i){o(null);return}const e=q(i);if(!z(e)){o(null);return}return(async()=>{try{const f=await A([e],n),l=E(f,r,e,n);h.current||o(l.tokens)}catch{h.current||o(null)}})(),()=>{h.current=!0}},[r,i,n]),d},R=(r,i,n="chars")=>{const d=T(r),o=[];for(const h of d)for(const e of h.hunks){const f=`@@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@`,l=[];let s=e.oldStart,c=e.newStart;for(const w of e.lines)w.startsWith("\\")||(w.startsWith("+")?l.push({content:w.slice(1),newLineNum:c++,type:"add"}):w.startsWith("-")?l.push({content:w.slice(1),oldLineNum:s++,type:"del"}):l.push({content:w.slice(1),newLineNum:c++,oldLineNum:s++,type:"context"}));if(i){const w=V(l);for(const[N,t]of w)if(l[N].type==="del"&&l[t].type==="add"){const m=U(l[N].content,l[t].content,n);l[N].inlineDiff=m??void 0,l[N].pairedIndex=t,l[t].inlineDiff=m??void 0,l[t].pairedIndex=N}}o.push({header:f,lines:l})}return o},b=500,U=(r,i,n="chars")=>{if(r.length>b||i.length>b)return null;const d=n==="words"?I(r,i):M(r,i),o=[],h=[];for(const e of d)e.removed?o.push({highlight:!0,value:e.value}):e.added?h.push({highlight:!0,value:e.value}):(o.push({highlight:!1,value:e.value}),h.push({highlight:!1,value:e.value}));return{addParts:h,delParts:o}},D=(r,i,n)=>u(P,{children:r.map((d,o)=>d.highlight?u(a,{backgroundColor:n,color:"white",children:d.value},o):u(a,{color:i,children:d.value},o))}),V=r=>{const i=new Map;let n=0;for(;n<r.length;){const d=n;for(;n<r.length&&r[n].type==="del";)n++;const o=n,h=n;for(;n<r.length&&r[n].type==="add";)n++;const e=n,f=o-d,l=e-h,s=Math.min(f,l);for(let c=0;c<s;c++)i.set(d+c,h+c),i.set(h+c,d+c);n===d&&n++}return i};function X({hunks:r,newHighlighted:i,oldHighlighted:n,showLineNumbers:d}){return u(p,{flexDirection:"column",children:r.map((o,h)=>g(p,{flexDirection:"column",children:[h>0?u(p,{marginBottom:0,marginTop:0,children:u(a,{dimColor:!0,children:"···"})}):void 0,u(a,{color:"cyan",dimColor:!0,children:o.header}),o.lines.map((e,f)=>{let l,s,c;switch(e.type){case"add":{s="+",c="green",l=e.inlineDiff?D(e.inlineDiff.addParts,"green","green"):L(e.content,i,e.newLineNum,"green");break}case"del":{s="-",c="red",l=e.inlineDiff?D(e.inlineDiff.delParts,"red","red"):L(e.content,n,e.oldLineNum,"red");break}default:{s=" ",c=void 0,l=L(e.content,n,e.oldLineNum);break}}return g(p,{children:[d?g(a,{color:c,dimColor:e.type==="context",children:[String(e.oldLineNum??"").padStart(4)," ",String(e.newLineNum??"").padStart(4)," "]}):void 0,u(a,{color:c,children:s}),l]},f)})]},h))})}function J({hunks:r,newHighlighted:i,oldHighlighted:n,showLineNumbers:d,width:o}){const h=Math.floor(o/2)-1;return u(p,{flexDirection:"column",children:r.map((e,f)=>{const l=f>0?u(p,{marginBottom:0,marginTop:0,children:u(a,{dimColor:!0,children:"···"})}):void 0,s=[],c=[];for(let N=0;N<e.lines.length;N++){const t=e.lines[N];switch(t.type){case"add":{t.pairedIndex===void 0&&(s.push({content:u(a,{dimColor:!0})}),c.push({content:L(t.content,i,t.newLineNum,"green"),lineNum:t.newLineNum}));break}case"context":{s.push({content:L(t.content,n,t.oldLineNum),lineNum:t.oldLineNum}),c.push({content:L(t.content,i,t.newLineNum),lineNum:t.newLineNum});break}case"del":{if(t.pairedIndex===void 0)s.push({content:L(t.content,n,t.oldLineNum,"red"),lineNum:t.oldLineNum}),c.push({content:u(a,{dimColor:!0})});else{const m=e.lines[t.pairedIndex];s.push({content:t.inlineDiff?D(t.inlineDiff.delParts,"red","red"):L(t.content,n,t.oldLineNum,"red"),lineNum:t.oldLineNum}),c.push({content:m.inlineDiff?D(m.inlineDiff.addParts,"green","green"):L(m.content,i,m.newLineNum,"green"),lineNum:m.newLineNum})}break}}}const w=Math.max(s.length,c.length);return g(p,{flexDirection:"column",children:[l,u(a,{color:"cyan",dimColor:!0,children:e.header}),Array.from({length:w},(N,t)=>{const m=s[t],x=c[t];return g(p,{flexDirection:"row",children:[g(p,{width:h,children:[d?g(a,{dimColor:!0,children:[String(m?.lineNum??"").padStart(4)," "]}):void 0,m?.content]}),u(a,{dimColor:!0,children:"│"}),g(p,{width:h,children:[d?g(a,{dimColor:!0,children:[String(x?.lineNum??"").padStart(4)," "]}):void 0,x?.content]})]},t)})]},f)})})}function ee({context:r=3,diff:i,inlineDiff:n=!0,inlineDiffMode:d="chars",language:o,mode:h="unified",newLabel:e="new",newText:f="",oldLabel:l="old",oldText:s="",showLineNumbers:c=!0,theme:w="github-dark-default"}){const{columns:N}=G(),t=y(s,o,w),m=y(f,o,w),x=k(()=>i||H("file",s,f,l,e,{context:r}),[i,s,f,l,e,r]),v=k(()=>R(x,n,d),[x,n,d]);if(v.every(S=>S.lines.length===0))return u(p,{children:u(a,{dimColor:!0,children:"No differences found."})});const C=g(p,{flexDirection:"column",children:[g(a,{color:"red",dimColor:!0,children:["---"," ",l]}),g(a,{color:"green",dimColor:!0,children:["+++"," ",e]})]});return h==="split"?g(p,{flexDirection:"column",children:[C,u(J,{hunks:v,newHighlighted:m,oldHighlighted:t,showLineNumbers:c,width:N??80})]}):g(p,{flexDirection:"column",children:[C,u(X,{hunks:v,newHighlighted:m,oldHighlighted:t,showLineNumbers:c})]})}export{ee as DiffView,ee as default};
|