@visulima/tui-kit 0.0.0 → 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 +13 -0
- package/LICENSE.md +2095 -0
- package/README.md +115 -29
- package/dist/accordion.d.ts +52 -0
- package/dist/accordion.js +1 -0
- package/dist/alert.d.ts +22 -0
- package/dist/alert.js +1 -0
- package/dist/animate-presence.d.ts +16 -0
- package/dist/animate-presence.js +1 -0
- package/dist/approval-prompt.d.ts +55 -0
- package/dist/approval-prompt.js +1 -0
- package/dist/area-chart.d.ts +56 -0
- package/dist/area-chart.js +1 -0
- package/dist/badge.d.ts +19 -0
- package/dist/badge.js +1 -0
- package/dist/bar-chart.d.ts +58 -0
- package/dist/bar-chart.js +1 -0
- package/dist/big-text.d.ts +71 -0
- package/dist/big-text.js +1 -0
- package/dist/blink-dot.d.ts +31 -0
- package/dist/blink-dot.js +1 -0
- package/dist/breadcrumb.d.ts +29 -0
- package/dist/breadcrumb.js +1 -0
- package/dist/button.d.ts +38 -0
- package/dist/button.js +1 -0
- package/dist/calendar.d.ts +60 -0
- package/dist/calendar.js +1 -0
- package/dist/card.d.ts +47 -0
- package/dist/card.js +1 -0
- package/dist/checkbox-group.d.ts +50 -0
- package/dist/checkbox-group.js +1 -0
- package/dist/checkbox.d.ts +40 -0
- package/dist/checkbox.js +1 -0
- package/dist/code.d.ts +41 -0
- package/dist/code.js +2 -0
- package/dist/collapsible.d.ts +44 -0
- package/dist/collapsible.js +1 -0
- package/dist/color-picker.d.ts +59 -0
- package/dist/color-picker.js +1 -0
- package/dist/command-block.d.ts +39 -0
- package/dist/command-block.js +4 -0
- package/dist/command-palette.d.ts +73 -0
- package/dist/command-palette.js +1 -0
- package/dist/confirm-dialog.d.ts +63 -0
- package/dist/confirm-dialog.js +1 -0
- package/dist/confirm-input.d.ts +32 -0
- package/dist/confirm-input.js +1 -0
- package/dist/console-overlay.d.ts +47 -0
- package/dist/console-overlay.js +1 -0
- package/dist/content-switcher.d.ts +49 -0
- package/dist/content-switcher.js +1 -0
- package/dist/controlled-scroll-view.d.ts +3 -0
- package/dist/controlled-scroll-view.js +1 -0
- package/dist/data-grid.d.ts +43 -0
- package/dist/data-grid.js +1 -0
- package/dist/date-picker.d.ts +54 -0
- package/dist/date-picker.js +1 -0
- package/dist/definition-list.d.ts +38 -0
- package/dist/definition-list.js +1 -0
- package/dist/dialog.d.ts +94 -0
- package/dist/dialog.js +1 -0
- package/dist/diff-view.d.ts +72 -0
- package/dist/diff-view.js +1 -0
- package/dist/digits.d.ts +26 -0
- package/dist/digits.js +1 -0
- package/dist/directory-tree.d.ts +44 -0
- package/dist/directory-tree.js +1 -0
- package/dist/divider.d.ts +41 -0
- package/dist/divider.js +1 -0
- package/dist/drawer.d.ts +45 -0
- package/dist/drawer.js +1 -0
- package/dist/file-change.d.ts +34 -0
- package/dist/file-change.js +1 -0
- package/dist/file-picker-entry.d.ts +2 -0
- package/dist/file-picker-entry.js +1 -0
- package/dist/form.d.ts +74 -0
- package/dist/form.js +1 -0
- package/dist/gauge.d.ts +76 -0
- package/dist/gauge.js +1 -0
- package/dist/gradient.d.ts +38 -0
- package/dist/gradient.js +1 -0
- package/dist/grid.d.ts +34 -0
- package/dist/grid.js +1 -0
- package/dist/heading.d.ts +28 -0
- package/dist/heading.js +1 -0
- package/dist/heatmap.d.ts +52 -0
- package/dist/heatmap.js +1 -0
- package/dist/help.d.ts +45 -0
- package/dist/help.js +1 -0
- package/dist/histogram.d.ts +52 -0
- package/dist/histogram.js +1 -0
- package/dist/image.d.ts +23 -0
- package/dist/image.js +1 -0
- package/dist/index.d.ts +125 -0
- package/dist/index.js +1 -0
- package/dist/json.d.ts +51 -0
- package/dist/json.js +1 -0
- package/dist/kbd.d.ts +27 -0
- package/dist/kbd.js +1 -0
- package/dist/line-chart.d.ts +100 -0
- package/dist/line-chart.js +1 -0
- package/dist/link.d.ts +34 -0
- package/dist/link.js +1 -0
- package/dist/loading-indicator.d.ts +25 -0
- package/dist/loading-indicator.js +1 -0
- package/dist/log.d.ts +33 -0
- package/dist/log.js +1 -0
- package/dist/markdown.d.ts +35 -0
- package/dist/markdown.js +1 -0
- package/dist/masked-input.d.ts +42 -0
- package/dist/masked-input.js +1 -0
- package/dist/menu.d.ts +70 -0
- package/dist/menu.js +1 -0
- package/dist/message-bubble.d.ts +36 -0
- package/dist/message-bubble.js +1 -0
- package/dist/model-badge.d.ts +33 -0
- package/dist/model-badge.js +1 -0
- package/dist/model-selector.d.ts +45 -0
- package/dist/model-selector.js +1 -0
- package/dist/multi-progress.d.ts +48 -0
- package/dist/multi-progress.js +1 -0
- package/dist/multi-select.d.ts +55 -0
- package/dist/multi-select.js +1 -0
- package/dist/notification-badge.d.ts +40 -0
- package/dist/notification-badge.js +1 -0
- package/dist/number-input.d.ts +71 -0
- package/dist/number-input.js +1 -0
- package/dist/operation-tree.d.ts +46 -0
- package/dist/operation-tree.js +1 -0
- package/dist/option-list.d.ts +41 -0
- package/dist/option-list.js +1 -0
- package/dist/ordered-list.d.ts +22 -0
- package/dist/ordered-list.js +1 -0
- package/dist/packem_shared/ControlledScrollView-BzlbIUph.js +1 -0
- package/dist/packem_shared/FilePicker-V5H2fb-v.js +1 -0
- package/dist/packem_shared/ScrollBar-C9i3z3Ft.js +1 -0
- package/dist/packem_shared/ScrollBarBox-DZEC8YnV.js +1 -0
- package/dist/packem_shared/ScrollList-Djtb2vVy.js +1 -0
- package/dist/packem_shared/ScrollView-ESxpl6Hy.js +1 -0
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +1 -0
- package/dist/packem_shared/TreeView-q0l446NV.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-DerVKKv6.js +1 -0
- package/dist/packem_shared/controlled-scroll-view.d-D3kZZzjI.d.ts +43 -0
- package/dist/packem_shared/file-picker.d-CH7pccC7.d.ts +92 -0
- package/dist/packem_shared/line-chart-BbhMhcZg.js +1 -0
- package/dist/packem_shared/scroll-bar-box.d-CpTYEcTZ.d.ts +13 -0
- package/dist/packem_shared/scroll-bar.d-B4sD1hBR.d.ts +18 -0
- package/dist/packem_shared/scroll-list.d-CPCF0RwC.d.ts +12 -0
- package/dist/packem_shared/scroll-view.d-GZcgAHl4.d.ts +98 -0
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +1 -0
- package/dist/packem_shared/use-tree-view.d-DeMQ6G2r.d.ts +314 -0
- package/dist/packem_shared/useTreeView-D0JEqT6W.js +1 -0
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +1 -0
- package/dist/packem_shared/variant-config-BJqpNo7H.js +1 -0
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +2 -0
- package/dist/paginator.d.ts +59 -0
- package/dist/paginator.js +1 -0
- package/dist/paragraph.d.ts +32 -0
- package/dist/paragraph.js +1 -0
- package/dist/path-input.d.ts +56 -0
- package/dist/path-input.js +1 -0
- package/dist/pie-chart.d.ts +44 -0
- package/dist/pie-chart.js +1 -0
- package/dist/placeholder.d.ts +47 -0
- package/dist/placeholder.js +1 -0
- package/dist/popover.d.ts +39 -0
- package/dist/popover.js +1 -0
- package/dist/progress-bar.d.ts +43 -0
- package/dist/progress-bar.js +1 -0
- package/dist/progress-circle.d.ts +50 -0
- package/dist/progress-circle.js +1 -0
- package/dist/qr-code.d.ts +39 -0
- package/dist/qr-code.js +1 -0
- package/dist/r/accordion.json +24 -0
- package/dist/r/alert.json +24 -0
- package/dist/r/animate-presence.json +22 -0
- package/dist/r/approval-prompt.json +24 -0
- package/dist/r/area-chart.json +27 -0
- package/dist/r/badge.json +24 -0
- package/dist/r/bar-chart.json +24 -0
- package/dist/r/big-text.json +23 -0
- package/dist/r/blink-dot.json +24 -0
- package/dist/r/breadcrumb.json +24 -0
- package/dist/r/button.json +24 -0
- package/dist/r/calendar.json +24 -0
- package/dist/r/card.json +26 -0
- package/dist/r/chart-utils.json +24 -0
- package/dist/r/checkbox-group.json +24 -0
- package/dist/r/checkbox.json +24 -0
- package/dist/r/code.json +23 -0
- package/dist/r/collapsible.json +24 -0
- package/dist/r/color-picker.json +24 -0
- package/dist/r/command-block.json +26 -0
- package/dist/r/command-palette.json +24 -0
- package/dist/r/confirm-dialog.json +24 -0
- package/dist/r/confirm-input.json +22 -0
- package/dist/r/console-overlay.json +22 -0
- package/dist/r/content-switcher.json +24 -0
- package/dist/r/controlled-scroll-view.json +24 -0
- package/dist/r/data-grid.json +24 -0
- package/dist/r/date-picker.json +26 -0
- package/dist/r/definition-list.json +24 -0
- package/dist/r/dialog.json +24 -0
- package/dist/r/diff-view.json +24 -0
- package/dist/r/digits.json +24 -0
- package/dist/r/directory-tree.json +24 -0
- package/dist/r/divider.json +24 -0
- package/dist/r/drawer.json +24 -0
- package/dist/r/file-change.json +24 -0
- package/dist/r/file-picker.json +44 -0
- package/dist/r/form.json +24 -0
- package/dist/r/gauge.json +24 -0
- package/dist/r/gradient.json +24 -0
- package/dist/r/grid.json +22 -0
- package/dist/r/heading.json +24 -0
- package/dist/r/heatmap.json +24 -0
- package/dist/r/help.json +22 -0
- package/dist/r/histogram.json +26 -0
- package/dist/r/image.json +24 -0
- package/dist/r/json.json +24 -0
- package/dist/r/kbd.json +24 -0
- package/dist/r/line-chart.json +26 -0
- package/dist/r/link.json +23 -0
- package/dist/r/loading-indicator.json +27 -0
- package/dist/r/log.json +24 -0
- package/dist/r/markdown.json +29 -0
- package/dist/r/masked-input.json +22 -0
- package/dist/r/menu.json +24 -0
- package/dist/r/message-bubble.json +24 -0
- package/dist/r/model-badge.json +24 -0
- package/dist/r/model-selector.json +24 -0
- package/dist/r/multi-progress.json +24 -0
- package/dist/r/multi-select.json +24 -0
- package/dist/r/notification-badge.json +24 -0
- package/dist/r/number-input.json +24 -0
- package/dist/r/operation-tree.json +26 -0
- package/dist/r/option-list.json +24 -0
- package/dist/r/ordered-list.json +22 -0
- package/dist/r/paginator.json +22 -0
- package/dist/r/paragraph.json +24 -0
- package/dist/r/path-input.json +26 -0
- package/dist/r/pie-chart.json +24 -0
- package/dist/r/placeholder.json +24 -0
- package/dist/r/popover.json +24 -0
- package/dist/r/progress-bar.json +22 -0
- package/dist/r/progress-circle.json +24 -0
- package/dist/r/qr-code.json +24 -0
- package/dist/r/radio-group.json +24 -0
- package/dist/r/registry.json +1051 -0
- package/dist/r/scatter-plot.json +27 -0
- package/dist/r/scroll-bar-box.json +24 -0
- package/dist/r/scroll-bar.json +24 -0
- package/dist/r/scroll-list.json +24 -0
- package/dist/r/scroll-view.json +24 -0
- package/dist/r/scroll.json +58 -0
- package/dist/r/search-input.json +26 -0
- package/dist/r/select-input-indicator.json +24 -0
- package/dist/r/select-input-item.json +24 -0
- package/dist/r/select-input.json +28 -0
- package/dist/r/shimmer-text.json +24 -0
- package/dist/r/sidebar.json +24 -0
- package/dist/r/slider.json +24 -0
- package/dist/r/sparkline.json +24 -0
- package/dist/r/spinner.json +23 -0
- package/dist/r/status-line.json +24 -0
- package/dist/r/status-message.json +24 -0
- package/dist/r/stepper.json +24 -0
- package/dist/r/stopwatch.json +22 -0
- package/dist/r/streaming-text.json +24 -0
- package/dist/r/switch.json +24 -0
- package/dist/r/tab.json +22 -0
- package/dist/r/table.json +23 -0
- package/dist/r/tabs.json +26 -0
- package/dist/r/tag-input.json +24 -0
- package/dist/r/tag.json +24 -0
- package/dist/r/text-input.json +22 -0
- package/dist/r/textarea.json +22 -0
- package/dist/r/thinking-block.json +24 -0
- package/dist/r/time-picker.json +24 -0
- package/dist/r/timer.json +22 -0
- package/dist/r/toast.json +24 -0
- package/dist/r/token-usage.json +24 -0
- package/dist/r/tool-call.json +24 -0
- package/dist/r/tooltip.json +24 -0
- package/dist/r/transition.json +22 -0
- package/dist/r/tree-select.json +24 -0
- package/dist/r/tree-view.json +64 -0
- package/dist/r/unordered-list.json +22 -0
- package/dist/r/use-linked-scroll.json +24 -0
- package/dist/r/variant-config.json +22 -0
- package/dist/radio-group.d.ts +63 -0
- package/dist/radio-group.js +1 -0
- package/dist/scatter-plot.d.ts +24 -0
- package/dist/scatter-plot.js +1 -0
- package/dist/scroll-bar-box.d.ts +3 -0
- package/dist/scroll-bar-box.js +1 -0
- package/dist/scroll-bar.d.ts +3 -0
- package/dist/scroll-bar.js +1 -0
- package/dist/scroll-list.d.ts +4 -0
- package/dist/scroll-list.js +1 -0
- package/dist/scroll-view.d.ts +3 -0
- package/dist/scroll-view.js +1 -0
- package/dist/search-input.d.ts +46 -0
- package/dist/search-input.js +1 -0
- package/dist/select-input-indicator.d.ts +28 -0
- package/dist/select-input-indicator.js +1 -0
- package/dist/select-input-item.d.ts +35 -0
- package/dist/select-input-item.js +1 -0
- package/dist/select-input.d.ts +97 -0
- package/dist/select-input.js +1 -0
- package/dist/shimmer-text.d.ts +41 -0
- package/dist/shimmer-text.js +1 -0
- package/dist/sidebar.d.ts +40 -0
- package/dist/sidebar.js +1 -0
- package/dist/slider.d.ts +87 -0
- package/dist/slider.js +1 -0
- package/dist/sparkline.d.ts +36 -0
- package/dist/sparkline.js +1 -0
- package/dist/spinner.d.ts +15 -0
- package/dist/spinner.js +1 -0
- package/dist/status-line.d.ts +31 -0
- package/dist/status-line.js +1 -0
- package/dist/status-message.d.ts +18 -0
- package/dist/status-message.js +1 -0
- package/dist/stepper.d.ts +42 -0
- package/dist/stepper.js +1 -0
- package/dist/stopwatch.d.ts +42 -0
- package/dist/stopwatch.js +1 -0
- package/dist/streaming-text.d.ts +39 -0
- package/dist/streaming-text.js +1 -0
- package/dist/switch.d.ts +46 -0
- package/dist/switch.js +1 -0
- package/dist/tab.d.ts +17 -0
- package/dist/tab.js +1 -0
- package/dist/table.d.ts +118 -0
- package/dist/table.js +1 -0
- package/dist/tabs.d.ts +96 -0
- package/dist/tabs.js +1 -0
- package/dist/tag-input.d.ts +59 -0
- package/dist/tag-input.js +1 -0
- package/dist/tag.d.ts +30 -0
- package/dist/tag.js +1 -0
- package/dist/text-input.d.ts +40 -0
- package/dist/text-input.js +1 -0
- package/dist/textarea.d.ts +57 -0
- package/dist/textarea.js +2 -0
- package/dist/thinking-block.d.ts +48 -0
- package/dist/thinking-block.js +1 -0
- package/dist/time-picker.d.ts +57 -0
- package/dist/time-picker.js +1 -0
- package/dist/timer.d.ts +50 -0
- package/dist/timer.js +1 -0
- package/dist/toast.d.ts +41 -0
- package/dist/toast.js +1 -0
- package/dist/token-usage.d.ts +43 -0
- package/dist/token-usage.js +1 -0
- package/dist/tool-call.d.ts +28 -0
- package/dist/tool-call.js +1 -0
- package/dist/tooltip.d.ts +37 -0
- package/dist/tooltip.js +1 -0
- package/dist/transition.d.ts +66 -0
- package/dist/transition.js +1 -0
- package/dist/tree-select.d.ts +55 -0
- package/dist/tree-select.js +1 -0
- package/dist/tree-view-entry.d.ts +4 -0
- package/dist/tree-view-entry.js +1 -0
- package/dist/unordered-list.d.ts +27 -0
- package/dist/unordered-list.js +1 -0
- package/dist/use-linked-scroll.d.ts +42 -0
- package/dist/use-linked-scroll.js +1 -0
- package/package.json +553 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as s,jsxs as a}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import p from"@visulima/tui/components/text";import C from"@visulima/tui/hooks/use-input";import{useRef as f,useCallback as d}from"react";function y({defaultChoice:r="confirm",isDisabled:n=!1,onCancel:t,onConfirm:i,submitOnEnter:c=!0}){const e=f(i);e.current=i;const o=f(t);return o.current=t,C(d((u,m)=>{if(u.toLowerCase()==="y"){e.current();return}if(u.toLowerCase()==="n"){o.current();return}m.return&&c&&(r==="confirm"?e.current():o.current())},[c,r]),{isActive:!n}),s(l,{children:a(p,{dimColor:n,children:[r==="confirm"?"Y":"y","/",r==="cancel"?"N":"n"]})})}export{y as ConfirmInput,y as default};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ConsoleLevel } from '@visulima/tui/hooks/use-console-capture';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
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({ dock, filter, height, maxEntries, showLevel, showTimestamp }: Props): ReactElement;
|
|
47
|
+
export { ConsoleOverlay, ConsoleOverlayDock, type Props as ConsoleOverlayProps, Props, ConsoleOverlay as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as m,jsxs as d}from"react/jsx-runtime";import p from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";import u from"@visulima/tui/hooks/use-console-capture";import{useMemo as c}from"react";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:g=!0}){const{entries:a}=u({filter:r,maxEntries:i}),s=c(()=>a.slice(-o),[a,o]);return m(p,{borderBottom:t==="top",borderBottomColor:"gray",borderTop:t==="bottom",borderTopColor:"gray",flexDirection:"column",height:o+1,children:s.length===0?m(l,{dimColor:!0,children:"Console output will appear here..."}):s.map(e=>d(p,{children:[g?d(l,{dimColor:!0,children:["[",b(e.timestamp),"]"," "]}):void 0,n?d(l,{color:h[e.level],children:[f[e.level]," "]}):void 0,m(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,49 @@
|
|
|
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({ accentColor, autoFocus, defaultValue, isDisabled, onChange, options, value }: Props): ReactElement;
|
|
49
|
+
export { ContentSwitcher, ContentSwitcherOption, type Props as ContentSwitcherProps, Props, ContentSwitcher as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as u,jsx as v,Fragment as w}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import D from"@visulima/tui/components/text";import F from"@visulima/tui/hooks/use-focus";import M from"@visulima/tui/hooks/use-input";import{useState as k,useMemo as j,useCallback as p}from"react";function q({accentColor:g="blue",autoFocus:x=!1,defaultValue:b,isDisabled:l=!1,onChange:f,options:r,value:t}){const{isFocused:c}=F({autoFocus:x,isActive:!l}),C=b??r[0]?.id,[a,A]=k(C),d=t??a,n=j(()=>{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??a;i.id!==e&&(t===void 0&&A(i.id),f?.(i.id))},[r,t,a,f]);M(p((o,i)=>{c&&(i.leftArrow||o==="h"?s(Math.max(0,n-1)):(i.rightArrow||o==="l")&&s(Math.min(r.length-1,n+1)))},[c,n,r.length,s]),{isActive:!l&&c});const h=r[n];return u(m,{flexDirection:"column",children:[v(m,{children:r.map((o,i)=>{const e=i===n;return u(D,{backgroundColor:e?g:void 0,color:e?"black":void 0,dimColor:l&&!e,children:[" ",o.icon===void 0?void 0:u(w,{children:[o.icon," "]}),o.label," "]},o.id)})}),h===void 0?void 0:v(m,{flexDirection:"column",marginTop:1,children:h.content})]})}export{q as ContentSwitcher,q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as r}from"./packem_shared/controlled-scroll-view-DerVKKv6.js";export{r as ControlledScrollView};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type DataGridColumn<Row> = {
|
|
5
|
+
readonly align?: "left" | "right";
|
|
6
|
+
readonly header: string;
|
|
7
|
+
readonly key: keyof Row & string;
|
|
8
|
+
/**
|
|
9
|
+
* Render a cell to a string. Defaults to `String(row[key])`.
|
|
10
|
+
*/
|
|
11
|
+
readonly render?: (row: Row) => string;
|
|
12
|
+
readonly width?: number;
|
|
13
|
+
};
|
|
14
|
+
type Props<Row extends Record<string, unknown>> = {
|
|
15
|
+
/**
|
|
16
|
+
* Accent color for the cursor row and active sort column.
|
|
17
|
+
* @default "blue"
|
|
18
|
+
*/
|
|
19
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Auto-focus for keyboard navigation.
|
|
22
|
+
*/
|
|
23
|
+
readonly autoFocus?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Column definitions in display order.
|
|
26
|
+
*/
|
|
27
|
+
readonly columns: ReadonlyArray<DataGridColumn<Row>>;
|
|
28
|
+
/**
|
|
29
|
+
* The rows to display.
|
|
30
|
+
*/
|
|
31
|
+
readonly data: ReadonlyArray<Row>;
|
|
32
|
+
/**
|
|
33
|
+
* Fires with the row under the cursor when Enter is pressed.
|
|
34
|
+
*/
|
|
35
|
+
readonly onSelect?: (row: Row) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A navigable, sortable table. ↑/↓ move the row cursor, ←/→ move the column
|
|
39
|
+
* cursor, `s` sorts by the cursor column (toggling direction), and Enter fires
|
|
40
|
+
* `onSelect` with the current row. Column widths default to the widest cell.
|
|
41
|
+
*/
|
|
42
|
+
declare function DataGrid<Row extends Record<string, unknown>>({ accentColor, autoFocus, columns, data, onSelect }: Props<Row>): ReactElement;
|
|
43
|
+
export { DataGrid, DataGridColumn, type Props as DataGridProps, Props, DataGrid as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as N,jsx as d}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import h from"@visulima/tui/components/text";import M from"@visulima/tui/hooks/use-focus";import P from"@visulima/tui/hooks/use-input";import{useState as w,useMemo as D,useCallback as T}from"react";function f(t,i){return i===0?0:(t%i+i)%i}const g=(t,i)=>t.render?t.render(i):String(i[t.key]??""),R=(t,i,n)=>t.length>=i?t.slice(0,i):n==="right"?t.padStart(i):t.padEnd(i);function L({accentColor:t="blue",autoFocus:i=!1,columns:n,data:l,onSelect:b}){const{isFocused:p}=M({autoFocus:i}),[k,A]=w(0),[y,S]=w(0),[a,j]=w(void 0),C=D(()=>n.map(r=>{if(r.width!==void 0)return r.width;let o=r.header.length+2;for(const e of l)o=Math.max(o,g(r,e).length);return o}),[n,l]),s=D(()=>{if(a===void 0)return l;const r=n.find(e=>e.key===a.key);if(r===void 0)return l;const o=a.direction==="asc"?1:-1;return[...l].toSorted((e,c)=>{const u=g(r,e),v=g(r,c),x=Number(u),F=Number(v),G=u.length>0&&v.length>0&&!Number.isNaN(x)&&!Number.isNaN(F);return o*(G?x-F:u.localeCompare(v))})},[n,l,a]),B=T((r,o)=>{if(o.upArrow)A(e=>f(e-1,s.length));else if(o.downArrow)A(e=>f(e+1,s.length));else if(o.leftArrow)S(e=>f(e-1,n.length));else if(o.rightArrow)S(e=>f(e+1,n.length));else if(r==="s"){const e=n[y];e!==void 0&&j(c=>c?.key===e.key&&c.direction==="asc"?{direction:"desc",key:e.key}:{direction:"asc",key:e.key})}else if(o.return){const e=s[k];e!==void 0&&b?.(e)}},[y,n,b,k,s]);P(B,{isActive:p});const E=r=>a?.key!==r?"":a.direction==="asc"?" ▲":" ▼";return N(m,{flexDirection:"column",children:[N(m,{children:[d(h,{children:" "}),n.map((r,o)=>d(m,{marginRight:1,children:d(h,{bold:!0,color:p&&o===y?t:void 0,children:R(`${r.header}${E(r.key)}`,C[o],r.align??"left")})},r.key))]}),s.map((r,o)=>{const e=p&&o===k;return N(m,{children:[d(h,{color:e?t:void 0,children:e?"❯":" "}),n.map((c,u)=>d(m,{marginRight:1,children:d(h,{color:e?t:void 0,dimColor:!e,children:R(g(c,r),C[u],c.align??"left")})},c.key))]},o)})]})}export{L as DataGrid,L as default};
|
|
@@ -0,0 +1,54 @@
|
|
|
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({ accentColor, autoFocus, defaultValue, formatValue, isDisabled, maxDate, minDate, onChange, placeholder, value }: Props): ReactElement;
|
|
54
|
+
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 i from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";import k from"@visulima/tui/hooks/use-focus";import C from"@visulima/tui/hooks/use-input";import{useState as D,useCallback as h}from"react";import{Calendar as V}from"./calendar.js";const j=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=j,isDisabled:s=!1,maxDate:b,minDate:S,onChange:v,placeholder:x="Pick a date",value:u}){const{isFocused:r}=k({autoFocus:n,isActive:!s}),[t,m]=D(!1),[F,$]=D(c),f=u??F;C(h((a,p)=>{!r||t||(p.return||a===" ")&&m(!0)},[r,t]),{isActive:!s&&r&&!t}),C(h((a,p)=>{p.escape&&m(!1)},[]),{isActive:!s&&r&&t});const A=h(a=>{u===void 0&&$(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:x}):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(V,{accentColor:e,autoFocus:!0,defaultValue:f,maxDate:b,minDate:S,onSubmit:A})}):void 0]})}export{O as DatePicker,O as default};
|
|
@@ -0,0 +1,38 @@
|
|
|
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({ columnGap, items, layout, termColor, termWidth }: Props): ReactElement;
|
|
38
|
+
export { DefinitionItem, DefinitionList, type Props as DefinitionListProps, Props, DefinitionList as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import r from"@visulima/tui/components/box";import n from"@visulima/tui/components/text";function s({columnGap:d=2,items:c,layout:m="inline",termColor:o="cyan",termWidth:h}){return m==="stacked"?e(r,{flexDirection:"column",gap:1,children:c.map((i,l)=>t(r,{flexDirection:"column",children:[e(n,{bold:!0,color:o,children:i.term}),e(n,{children:i.description})]},i.key??l))}):e(r,{flexDirection:"column",children:c.map((i,l)=>t(r,{gap:d,children:[e(r,{flexShrink:0,width:h,children:e(n,{color:o,children:i.term})}),e(r,{flexGrow:1,flexShrink:1,children:e(n,{children:i.description})})]},i.key??l))})}export{s as DefinitionList,s as default};
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
import '@visulima/tui/components/box';
|
|
3
|
+
import { b as ScrollViewRef } from "./packem_shared/scroll-view.d-GZcgAHl4.js";
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Background color for the dialog. Defaults to the detected terminal
|
|
7
|
+
* background color, falling back to `"black"`.
|
|
8
|
+
*/
|
|
9
|
+
readonly backgroundColor?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Border color.
|
|
12
|
+
* @default "cyan"
|
|
13
|
+
*/
|
|
14
|
+
readonly borderColor?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Border style.
|
|
17
|
+
* @default "round"
|
|
18
|
+
*/
|
|
19
|
+
readonly borderStyle?: "arrow" | "bold" | "classic" | "double" | "doubleSingle" | "round" | "single" | "singleDouble";
|
|
20
|
+
/**
|
|
21
|
+
* Dialog content.
|
|
22
|
+
*/
|
|
23
|
+
readonly children: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Override terminal columns. Useful in renderToString or testing contexts
|
|
26
|
+
* where useWindowSize is unavailable.
|
|
27
|
+
*/
|
|
28
|
+
readonly columns?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Footer content rendered below the scrollable area.
|
|
31
|
+
* Useful for hints like "Press ? to close".
|
|
32
|
+
*/
|
|
33
|
+
readonly footer?: ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Maximum height as a fraction of terminal rows (0-1) or absolute rows.
|
|
36
|
+
* Values <= 1 are treated as fractions; values > 1 as absolute row counts.
|
|
37
|
+
* @default 0.8
|
|
38
|
+
*/
|
|
39
|
+
readonly maxHeight?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Padding inside the dialog border.
|
|
42
|
+
* @default 2
|
|
43
|
+
*/
|
|
44
|
+
readonly paddingX?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Vertical padding inside the dialog border.
|
|
47
|
+
* @default 1
|
|
48
|
+
*/
|
|
49
|
+
readonly paddingY?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Override terminal rows. Useful in renderToString or testing contexts
|
|
52
|
+
* where useWindowSize is unavailable.
|
|
53
|
+
*/
|
|
54
|
+
readonly rows?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Scrollbar visual style.
|
|
57
|
+
* @default "block"
|
|
58
|
+
*/
|
|
59
|
+
readonly scrollbarStyle?: "arrow" | "block" | "bold" | "classic" | "dots" | "double" | "doubleSingle" | "line" | "round" | "single" | "singleDouble" | "thick";
|
|
60
|
+
/**
|
|
61
|
+
* Ref to the internal ScrollView for programmatic scrolling.
|
|
62
|
+
*/
|
|
63
|
+
readonly scrollRef?: React.Ref<ScrollViewRef>;
|
|
64
|
+
/**
|
|
65
|
+
* Title rendered at the top of the dialog. If a string is provided,
|
|
66
|
+
* it is rendered as bold cyan text.
|
|
67
|
+
*/
|
|
68
|
+
readonly title?: ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the dialog is visible. When `false`, nothing is rendered.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
readonly visible?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Dialog width in columns.
|
|
76
|
+
* @default 60
|
|
77
|
+
*/
|
|
78
|
+
readonly width?: number;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A centered overlay dialog with automatic scrolling and scrollbar when
|
|
82
|
+
* content exceeds the available terminal height.
|
|
83
|
+
*
|
|
84
|
+
* Uses the terminal's detected background color by default so the
|
|
85
|
+
* dialog blends with the user's theme.
|
|
86
|
+
*
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <Dialog title="Help" footer={<Text dimColor>Press Esc to close</Text>}>
|
|
89
|
+
* <Text>Dialog content here</Text>
|
|
90
|
+
* </Dialog>
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
declare const Dialog: ({ backgroundColor: backgroundColorProp, borderColor, borderStyle, children, columns: columnsProp, footer, maxHeight: maxHeightProp, paddingX, paddingY, rows: rowsProp, scrollbarStyle: scrollbarStyleProp, scrollRef: externalScrollRef, title, visible, width }: Props) => ReactElement | null;
|
|
94
|
+
export { Dialog, type Props as DialogProps, Props, Dialog as default };
|
package/dist/dialog.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as B}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import M from"@visulima/tui/components/text";import H from"@visulima/tui/hooks/use-terminal-palette";import I from"@visulima/tui/hooks/use-window-size";import{useRef as R}from"react";import{ScrollView as V}from"./packem_shared/ScrollView-ESxpl6Hy.js";const T=({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:k="block",scrollRef:x,title:n,visible:C=!0,width:S=60})=>{const c=I(),{isLoading:w,palette:y}=H(),D=R(null),X=x??D;if(!C)return null;const a=g??(c.columns||80),t=b??(c.rows||24),m=u??(w?"black":y?.background??"black"),j=e<=1?Math.floor(t*e):Math.min(e,t-2),s=typeof n=="string"?r(o,{marginBottom:1,children:r(M,{bold:!0,color:l,children:n})}):n??null;return r(o,{alignItems:"center",height:t,justifyContent:"center",position:"absolute",width:a,children:B(o,{backgroundColor:m,borderBackgroundColor:m,borderColor:l,borderStyle:f,flexDirection:"column",maxHeight:j,opaque:!0,paddingY:p,width:Math.min(S,a-4),children:[s!=null&&r(o,{flexShrink:0,paddingX:i,children:s}),r(V,{flexGrow:1,flexShrink:1,paddingX:i,ref:X,scrollbar:!0,scrollbarColor:l,scrollbarStyle:k,children:h}),d!=null&&r(o,{alignItems:"center",flexDirection:"column",flexShrink:0,marginTop:1,paddingX:i,children:d})]})})};export{T as Dialog,T as default};
|
|
@@ -0,0 +1,72 @@
|
|
|
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({ context, diff: diffProp, inlineDiff, inlineDiffMode, language, mode, newLabel, newText, oldLabel, oldText, showLineNumbers, theme }: Props): ReactElement;
|
|
72
|
+
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 H}from"react/jsx-runtime";import p from"@visulima/tui/components/box";import a from"@visulima/tui/components/text";import{resolveLanguage as P,isLanguageSupported as T,getHighlighter as I,getCachedTokens as M,renderTokenLine as W}from"@visulima/tui/highlighter";import j from"@visulima/tui/hooks/use-window-size";import{createPatch as B,parsePatch as E,diffWords as q,diffChars as z}from"diff";import{useMemo as y,useState as A,useRef as F,useEffect as G}from"react";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}):W(o)},b=(r,i,n)=>{const[d,o]=A(null),h=F(!1);return G(()=>{if(h.current=!1,!i){o(null);return}const e=P(i);if(!T(e)){o(null);return}return(async()=>{try{const f=await I([e],n),l=M(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=E(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},k=500,U=(r,i,n="chars")=>{if(r.length>k||i.length>k)return null;const d=n==="words"?q(r,i):z(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(H,{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}=j(),t=b(s,o,w),m=b(f,o,w),x=y(()=>i||B("file",s,f,l,e,{context:r}),[i,s,f,l,e,r]),v=y(()=>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};
|
package/dist/digits.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Color of the digits.
|
|
7
|
+
* @default "cyan"
|
|
8
|
+
*/
|
|
9
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Number of spaces between glyphs.
|
|
12
|
+
* @default 1
|
|
13
|
+
*/
|
|
14
|
+
readonly gap?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The value to render. Numbers are stringified; unsupported characters
|
|
17
|
+
* render as `?`.
|
|
18
|
+
*/
|
|
19
|
+
readonly value: number | string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A large seven-segment-style numeric readout. Supports digits, space, minus,
|
|
23
|
+
* dot and colon — enough for counters, clocks and timers.
|
|
24
|
+
*/
|
|
25
|
+
declare function Digits({ color, gap, value }: Props): ReactElement;
|
|
26
|
+
export { Digits, type Props as DigitsProps, Props, Digits as default };
|
package/dist/digits.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import f from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";const s={" ":[" "," "," "],0:[" ▄ ","█ █","▀▄▀"],1:[" ▄ "," █ "," ▪ "],2:["▄▄ "," ▄▀","▀▄▄"],3:["▄▄ "," ▄▀","▄▄▀"],4:[" ","█▄█"," █"],5:["▄▄▄","█▄ ","▄▄▀"],6:[" ▄ ","█▄ ","▀▄▀"],7:["▄▄▄"," █"," █ "],8:[" ▄ ","▄▀▄","▀▄▀"],9:[" ▄ ","▀▄█"," ▄▀"],"-":[" "," ─ "," "],".":[" "," "," ▪ "],":":[" "," ▪ "," ▪ "]},u=[" "," ? "," "];function g({color:a="cyan",gap:c=1,value:i}){const m=String(i),e=" ".repeat(Math.max(0,c)),t=[];for(const o of m)t.push(o);const p=[0,1,2].map(o=>t.map(r=>(s[r]??u)[o]).join(e));return n(f,{flexDirection:"column",children:p.map((o,r)=>n(l,{color:a,children:o},r))})}export{g as Digits,g as default};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type DirectoryNode = {
|
|
5
|
+
readonly children?: ReadonlyArray<DirectoryNode>;
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly type: "directory" | "file";
|
|
8
|
+
};
|
|
9
|
+
type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* Accent color for the focused row.
|
|
12
|
+
* @default "blue"
|
|
13
|
+
*/
|
|
14
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Auto-focus for keyboard navigation.
|
|
17
|
+
*/
|
|
18
|
+
readonly autoFocus?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Start with every directory expanded.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
readonly defaultExpanded?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Color used for directory names.
|
|
26
|
+
* @default "cyan"
|
|
27
|
+
*/
|
|
28
|
+
readonly directoryColor?: LiteralUnion<AnsiColors, string>;
|
|
29
|
+
/**
|
|
30
|
+
* The tree to render.
|
|
31
|
+
*/
|
|
32
|
+
readonly nodes: ReadonlyArray<DirectoryNode>;
|
|
33
|
+
/**
|
|
34
|
+
* Fires with the path segments when Enter is pressed on a file.
|
|
35
|
+
*/
|
|
36
|
+
readonly onSelect?: (path: ReadonlyArray<string>) => void;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A read-only filesystem tree. Directories show a ▸/▾ toggle and a folder
|
|
40
|
+
* glyph; files show a document glyph. Arrow keys navigate, →/← and Space
|
|
41
|
+
* expand/collapse directories, and Enter fires `onSelect` with a file's path.
|
|
42
|
+
*/
|
|
43
|
+
declare function DirectoryTree({ accentColor, autoFocus, defaultExpanded, directoryColor, nodes, onSelect }: Props): ReactElement;
|
|
44
|
+
export { DirectoryNode, DirectoryTree, type Props as DirectoryTreeProps, Props, DirectoryTree as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as y,jsxs as x}from"react/jsx-runtime";import S from"@visulima/tui/components/box";import w from"@visulima/tui/components/text";import B from"@visulima/tui/hooks/use-focus";import k from"@visulima/tui/hooks/use-input";import{useState as g,useMemo as E,useCallback as $}from"react";function F(i,e){return e===0?0:(i%e+e)%e}function M(i,e){return i?e?"▾ 📁":"▸ 📁":" 📄"}const b=(i,e,u,l,s,f)=>{for(const d of i){const a=`${l}/${d.name}`,m=[...s,d.name];f.push({depth:u,id:a,node:d,path:m}),d.type==="directory"&&d.children!==void 0&&e.has(a)&&b(d.children,e,u+1,a,m,f)}},C=(i,e,u)=>{for(const l of i){const s=`${e}/${l.name}`;l.type==="directory"&&l.children!==void 0&&(u.add(s),C(l.children,s,u))}};function H({accentColor:i="blue",autoFocus:e=!1,defaultExpanded:u=!1,directoryColor:l="cyan",nodes:s,onSelect:f}){const{isFocused:d}=B({autoFocus:e}),[a,m]=g(()=>{if(!u)return new Set;const r=new Set;return C(s,"",r),r}),[p,v]=g(0),h=E(()=>{const r=[];return b(s,a,0,"",[],r),r},[a,s]),A=$((r,t)=>{m(o=>{const n=new Set(o);return t??!n.has(r)?n.add(r):n.delete(r),n})},[]),D=$((r,t)=>{const o=h[p];if(t.upArrow){v(c=>F(c-1,h.length));return}if(t.downArrow){v(c=>F(c+1,h.length));return}if(o===void 0)return;const n=o.node.type==="directory";if(n&&o.node.children!==void 0&&(r===" "||t.rightArrow||t.leftArrow)){let c;t.rightArrow?c=!0:t.leftArrow&&(c=!1),A(o.id,c);return}t.return&&!n&&f?.(o.path)},[p,f,h,A]);return k(D,{isActive:d}),y(S,{flexDirection:"column",children:h.map((r,t)=>{const o=d&&t===p,n=r.node.type==="directory",c=a.has(r.id),j=M(n,c);return x(S,{children:[y(w,{color:o?i:void 0,children:o?"❯":" "}),y(w,{children:" ".repeat(r.depth)}),x(w,{color:n?l:void 0,children:[j," ",r.node.name]})]},r.id)})})}export{H as DirectoryTree,H as default};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { LiteralUnion } from 'type-fest';
|
|
4
|
+
type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* Custom character to use instead of the default line character.
|
|
7
|
+
*/
|
|
8
|
+
readonly character?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Color of the divider line.
|
|
11
|
+
*/
|
|
12
|
+
readonly color?: LiteralUnion<AnsiColors, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Render the divider with dim color.
|
|
15
|
+
*/
|
|
16
|
+
readonly dimColor?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional label rendered in the middle of a horizontal divider.
|
|
19
|
+
*/
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Padding around the label.
|
|
23
|
+
* @default 1
|
|
24
|
+
*/
|
|
25
|
+
readonly labelPadding?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Total length of the divider. When omitted, horizontal dividers stretch to
|
|
28
|
+
* fill the available space and vertical dividers default to one row.
|
|
29
|
+
*/
|
|
30
|
+
readonly length?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Orientation of the divider.
|
|
33
|
+
* @default "horizontal"
|
|
34
|
+
*/
|
|
35
|
+
readonly orientation?: "horizontal" | "vertical";
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Horizontal or vertical divider line, optionally with a centered label.
|
|
39
|
+
*/
|
|
40
|
+
declare function Divider({ character, color, dimColor, label, labelPadding, length, orientation }: Props): ReactElement;
|
|
41
|
+
export { Divider, type Props as DividerProps, Props, Divider as default };
|
package/dist/divider.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r,jsxs as f}from"react/jsx-runtime";import e from"@visulima/tui/components/box";import t from"@visulima/tui/components/text";import w from"@visulima/tui/hooks/use-window-size";function S({character:x,color:i,dimColor:l=!1,label:a,labelPadding:p=1,length:o,orientation:d="horizontal"}){const{columns:s}=w(),n=x??(d==="horizontal"?"─":"│");if(d==="vertical"){const m=o??1;return r(e,{flexDirection:"column",height:m,children:Array.from({length:m},(v,u)=>r(t,{color:i,dimColor:l,children:n},`divider-row-${u}`))})}const c=Math.min(500,o??Math.max(s,1));if(a===void 0)return r(e,{flexGrow:o===void 0?1:0,width:o,children:r(t,{color:i,dimColor:l,wrap:"truncate",children:n.repeat(c)})});const h=" ".repeat(p);return f(e,{flexGrow:o===void 0?1:0,width:o,children:[r(e,{flexGrow:1,flexShrink:1,children:r(t,{color:i,dimColor:l,wrap:"truncate",children:n.repeat(c)})}),r(e,{flexShrink:0,children:f(t,{color:i,dimColor:l,children:[h,a,h]})}),r(e,{flexGrow:1,flexShrink:1,children:r(t,{color:i,dimColor:l,wrap:"truncate",children:n.repeat(c)})})]})}export{S as Divider,S as default};
|
package/dist/drawer.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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 border and title.
|
|
7
|
+
* @default "blue"
|
|
8
|
+
*/
|
|
9
|
+
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Drawer body.
|
|
12
|
+
*/
|
|
13
|
+
readonly children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the drawer is open. When false, nothing is rendered.
|
|
16
|
+
*/
|
|
17
|
+
readonly isOpen: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Fires when Escape is pressed while open.
|
|
20
|
+
*/
|
|
21
|
+
readonly onClose?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* Edge the drawer is anchored to. Left/right drawers take a fixed `size`
|
|
24
|
+
* as width; top/bottom take it as height.
|
|
25
|
+
* @default "right"
|
|
26
|
+
*/
|
|
27
|
+
readonly side?: "bottom" | "left" | "right" | "top";
|
|
28
|
+
/**
|
|
29
|
+
* Fixed extent (width for left/right, height for top/bottom) in cells.
|
|
30
|
+
* @default 32
|
|
31
|
+
*/
|
|
32
|
+
readonly size?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Optional title shown in the drawer header.
|
|
35
|
+
*/
|
|
36
|
+
readonly title?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A slide-over panel anchored to a terminal edge. Rendered as a bordered box
|
|
40
|
+
* sized along one axis; Escape fires `onClose`, and nothing renders while
|
|
41
|
+
* closed. Terminals have no true overlay layer, so place the drawer where it
|
|
42
|
+
* should appear in your layout.
|
|
43
|
+
*/
|
|
44
|
+
declare function Drawer({ accentColor, children, isOpen, onClose, side, size, title }: Props): ReactElement | null;
|
|
45
|
+
export { Drawer, type Props as DrawerProps, Props, Drawer as default };
|
package/dist/drawer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as s,jsx as r}from"react/jsx-runtime";import e from"@visulima/tui/components/box";import m from"@visulima/tui/components/text";import a from"@visulima/tui/hooks/use-input";import{useCallback as h}from"react";function j({accentColor:i="blue",children:u,isOpen:t,onClose:n,side:l="right",size:c=32,title:o}){const f=h((b,p)=>{p.escape&&n?.()},[n]);if(a(f,{isActive:t}),!t)return null;const d=l==="left"||l==="right";return s(e,{borderColor:i,borderStyle:"round",flexDirection:"column",height:d?void 0:c,paddingX:1,width:d?c:void 0,children:[o===void 0?void 0:s(e,{justifyContent:"space-between",children:[r(m,{bold:!0,color:i,children:o}),r(m,{dimColor:!0,children:"esc"})]}),r(e,{flexDirection:"column",marginTop:o===void 0?0:1,children:u})]})}export{j as Drawer,j as default};
|