@visulima/tui 1.0.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +54 -2444
- package/MIGRATION-GUIDE.md +164 -0
- package/README.md +15 -12
- package/dist/components/box.d.ts +3 -4
- package/dist/components/canvas.d.ts +2 -2
- package/dist/components/canvas.js +1 -1
- package/dist/components/cursor.d.ts +3 -4
- package/dist/components/error-boundary.d.ts +16 -0
- package/dist/components/error-boundary.js +1 -0
- package/dist/components/error-overview.d.ts +8 -0
- package/dist/components/error-overview.js +1 -0
- package/dist/components/static-render.d.ts +3 -4
- package/dist/components/static.d.ts +1 -2
- package/dist/components/text.d.ts +1 -2
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +24 -0
- package/dist/ink/canvas/index.js +1 -0
- package/dist/ink/hooks/use-app.d.ts +1 -32
- package/dist/ink/hooks/use-app.js +1 -1
- package/dist/ink/hooks/use-box-metrics.d.ts +3 -4
- package/dist/ink/hooks/use-cursor.d.ts +1 -1
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +4 -5
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +7 -7
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-click.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
- package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
- package/dist/ink/public/cursor.d.ts +47 -0
- package/dist/ink/public/cursor.js +1 -0
- package/dist/ink/public/dom.d.ts +6 -0
- package/dist/ink/public/dom.js +0 -0
- package/dist/ink/public/highlighter.d.ts +54 -0
- package/dist/ink/public/highlighter.js +1 -0
- package/dist/ink/public/input.d.ts +14 -0
- package/dist/ink/public/input.js +1 -0
- package/dist/ink/public/styles.d.ts +4 -0
- package/dist/ink/public/styles.js +0 -0
- package/dist/ink/public/utils.d.ts +5 -0
- package/dist/ink/public/utils.js +1 -0
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-D9tfChBc.js} +1 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
- package/dist/packem_shared/TuiApp-DjIgv5Sk.js +1 -0
- package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
- package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +56 -0
- package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
- package/dist/packem_shared/{buffer.d-EJkZr8uH.d.ts → buffer.d-j_dP5JyC.d.ts} +29 -1
- package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
- package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
- package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
- package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
- package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-g-nsYquD.d.ts} +3 -4
- package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
- package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
- package/dist/packem_shared/input.d-D-Yxqha8.d.ts +172 -0
- package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
- package/dist/packem_shared/{reconciler-CFyBVf7l.js → reconciler-DhUGYWCr.js} +1 -1
- package/dist/packem_shared/render-D7aV_hO1.js +24 -0
- package/dist/packem_shared/{render-DFZ8NHlG.js → render-DMcWfI6-.js} +1 -1
- package/dist/packem_shared/{render.d-CBnYBDk2.d.ts → render.d-BvfwvSCx.d.ts} +20 -2
- package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
- package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-DqLFFPvO.js} +1 -1
- package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
- package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
- package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
- package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-KWphH--_.d.ts} +1 -1
- package/dist/packem_shared/{styles.d-cMo36xQz.d.ts → styles.d-D7iZuNC-.d.ts} +97 -1
- package/dist/packem_shared/utils-C8l_3Dzw.js +1 -0
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +5 -5
- package/dist/testing/index.js +1 -1
- package/index.js +26 -26
- package/package.json +49 -384
- package/dist/components/accordion.d.ts +0 -59
- package/dist/components/accordion.js +0 -1
- package/dist/components/alert.d.ts +0 -26
- package/dist/components/alert.js +0 -1
- package/dist/components/animate-presence.d.ts +0 -18
- package/dist/components/animate-presence.js +0 -1
- package/dist/components/approval-prompt.d.ts +0 -65
- package/dist/components/approval-prompt.js +0 -1
- package/dist/components/area-chart.d.ts +0 -66
- package/dist/components/area-chart.js +0 -1
- package/dist/components/badge.d.ts +0 -22
- package/dist/components/badge.js +0 -1
- package/dist/components/bar-chart.d.ts +0 -67
- package/dist/components/bar-chart.js +0 -1
- package/dist/components/big-text.d.ts +0 -81
- package/dist/components/big-text.js +0 -1
- package/dist/components/blink-dot.d.ts +0 -36
- package/dist/components/blink-dot.js +0 -1
- package/dist/components/breadcrumb.d.ts +0 -33
- package/dist/components/breadcrumb.js +0 -1
- package/dist/components/button.d.ts +0 -45
- package/dist/components/button.js +0 -1
- package/dist/components/calendar.d.ts +0 -72
- package/dist/components/calendar.js +0 -1
- package/dist/components/card.d.ts +0 -57
- package/dist/components/card.js +0 -1
- package/dist/components/checkbox.d.ts +0 -48
- package/dist/components/checkbox.js +0 -1
- package/dist/components/code.d.ts +0 -48
- package/dist/components/code.js +0 -2
- package/dist/components/collapsible.d.ts +0 -53
- package/dist/components/collapsible.js +0 -1
- package/dist/components/command-block.d.ts +0 -47
- package/dist/components/command-block.js +0 -4
- package/dist/components/command-palette.d.ts +0 -82
- package/dist/components/command-palette.js +0 -1
- package/dist/components/confirm-dialog.d.ts +0 -75
- package/dist/components/confirm-dialog.js +0 -1
- package/dist/components/confirm-input.d.ts +0 -38
- package/dist/components/confirm-input.js +0 -1
- package/dist/components/console-overlay.d.ts +0 -54
- package/dist/components/console-overlay.js +0 -1
- package/dist/components/content-switcher.d.ts +0 -57
- package/dist/components/content-switcher.js +0 -1
- package/dist/components/controlled-scroll-view.d.ts +0 -61
- package/dist/components/controlled-scroll-view.js +0 -1
- package/dist/components/date-picker.d.ts +0 -65
- package/dist/components/date-picker.js +0 -1
- package/dist/components/definition-list.d.ts +0 -44
- package/dist/components/definition-list.js +0 -1
- package/dist/components/dialog.d.ts +0 -117
- package/dist/components/dialog.js +0 -1
- package/dist/components/diff-view.d.ts +0 -85
- package/dist/components/diff-view.js +0 -1
- package/dist/components/divider.d.ts +0 -49
- package/dist/components/divider.js +0 -1
- package/dist/components/file-picker-entry.d.ts +0 -104
- package/dist/components/file-picker-entry.js +0 -1
- package/dist/components/form.d.ts +0 -81
- package/dist/components/form.js +0 -1
- package/dist/components/gauge.d.ts +0 -87
- package/dist/components/gauge.js +0 -1
- package/dist/components/gradient.d.ts +0 -42
- package/dist/components/gradient.js +0 -1
- package/dist/components/heading.d.ts +0 -33
- package/dist/components/heading.js +0 -1
- package/dist/components/heatmap.d.ts +0 -62
- package/dist/components/heatmap.js +0 -1
- package/dist/components/help.d.ts +0 -52
- package/dist/components/help.js +0 -1
- package/dist/components/histogram.d.ts +0 -62
- package/dist/components/histogram.js +0 -1
- package/dist/components/kbd.d.ts +0 -31
- package/dist/components/kbd.js +0 -1
- package/dist/components/line-chart.d.ts +0 -109
- package/dist/components/line-chart.js +0 -1
- package/dist/components/link.d.ts +0 -38
- package/dist/components/link.js +0 -1
- package/dist/components/loading-indicator.d.ts +0 -29
- package/dist/components/loading-indicator.js +0 -1
- package/dist/components/markdown.d.ts +0 -40
- package/dist/components/markdown.js +0 -1
- package/dist/components/masked-input.d.ts +0 -50
- package/dist/components/masked-input.js +0 -1
- package/dist/components/menu.d.ts +0 -78
- package/dist/components/menu.js +0 -1
- package/dist/components/message-bubble.d.ts +0 -43
- package/dist/components/message-bubble.js +0 -1
- package/dist/components/model-badge.d.ts +0 -39
- package/dist/components/model-badge.js +0 -1
- package/dist/components/multi-select.d.ts +0 -65
- package/dist/components/multi-select.js +0 -1
- package/dist/components/operation-tree.d.ts +0 -49
- package/dist/components/operation-tree.js +0 -1
- package/dist/components/option-list.d.ts +0 -47
- package/dist/components/option-list.js +0 -1
- package/dist/components/ordered-list.d.ts +0 -24
- package/dist/components/ordered-list.js +0 -1
- package/dist/components/paginator.d.ts +0 -69
- package/dist/components/paginator.js +0 -1
- package/dist/components/paragraph.d.ts +0 -38
- package/dist/components/paragraph.js +0 -1
- package/dist/components/placeholder.d.ts +0 -55
- package/dist/components/placeholder.js +0 -1
- package/dist/components/progress-bar.d.ts +0 -56
- package/dist/components/progress-bar.js +0 -1
- package/dist/components/radio-group.d.ts +0 -74
- package/dist/components/radio-group.js +0 -1
- package/dist/components/scatter-plot.d.ts +0 -35
- package/dist/components/scatter-plot.js +0 -1
- package/dist/components/scroll-bar-box.d.ts +0 -37
- package/dist/components/scroll-bar-box.js +0 -1
- package/dist/components/scroll-bar.d.ts +0 -25
- package/dist/components/scroll-bar.js +0 -1
- package/dist/components/scroll-list.d.ts +0 -20
- package/dist/components/scroll-list.js +0 -1
- package/dist/components/scroll-view.d.ts +0 -10
- package/dist/components/scroll-view.js +0 -1
- package/dist/components/search-input.d.ts +0 -55
- package/dist/components/search-input.js +0 -1
- package/dist/components/select-input-indicator.d.ts +0 -32
- package/dist/components/select-input-indicator.js +0 -1
- package/dist/components/select-input-item.d.ts +0 -41
- package/dist/components/select-input-item.js +0 -1
- package/dist/components/select-input.d.ts +0 -110
- package/dist/components/select-input.js +0 -1
- package/dist/components/shimmer-text.d.ts +0 -47
- package/dist/components/shimmer-text.js +0 -1
- package/dist/components/slider.d.ts +0 -103
- package/dist/components/slider.js +0 -1
- package/dist/components/sparkline.d.ts +0 -35
- package/dist/components/sparkline.js +0 -1
- package/dist/components/spinner.d.ts +0 -17
- package/dist/components/spinner.js +0 -1
- package/dist/components/status-line.d.ts +0 -37
- package/dist/components/status-line.js +0 -1
- package/dist/components/status-message.d.ts +0 -21
- package/dist/components/status-message.js +0 -1
- package/dist/components/stepper.d.ts +0 -48
- package/dist/components/stepper.js +0 -1
- package/dist/components/stopwatch.d.ts +0 -49
- package/dist/components/stopwatch.js +0 -1
- package/dist/components/streaming-text.d.ts +0 -46
- package/dist/components/streaming-text.js +0 -1
- package/dist/components/switch.d.ts +0 -55
- package/dist/components/switch.js +0 -1
- package/dist/components/tab.d.ts +0 -19
- package/dist/components/tab.js +0 -1
- package/dist/components/table.d.ts +0 -119
- package/dist/components/table.js +0 -1
- package/dist/components/tabs.d.ts +0 -107
- package/dist/components/tabs.js +0 -1
- package/dist/components/tag.d.ts +0 -35
- package/dist/components/tag.js +0 -1
- package/dist/components/text-input.d.ts +0 -48
- package/dist/components/text-input.js +0 -1
- package/dist/components/textarea.d.ts +0 -68
- package/dist/components/textarea.js +0 -2
- package/dist/components/timer.d.ts +0 -59
- package/dist/components/timer.js +0 -1
- package/dist/components/toast.d.ts +0 -49
- package/dist/components/toast.js +0 -1
- package/dist/components/tooltip.d.ts +0 -43
- package/dist/components/tooltip.js +0 -1
- package/dist/components/transition.d.ts +0 -74
- package/dist/components/transition.js +0 -1
- package/dist/components/tree-view-entry.d.ts +0 -357
- package/dist/components/tree-view-entry.js +0 -1
- package/dist/components/unordered-list.d.ts +0 -30
- package/dist/components/unordered-list.js +0 -1
- package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
- package/dist/ink/hooks/use-linked-scroll.js +0 -1
- package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
- package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
- package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
- package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
- package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
- package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
- package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
- package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
- package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
- package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
- package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
- package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
- package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
- package/dist/packem_shared/render-CuQecTAs.js +0 -24
- package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
- package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
- package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
- package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
- package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
- package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type Props = {
|
|
5
|
-
/**
|
|
6
|
-
* Accent color 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 };
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,44 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,117 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,85 +0,0 @@
|
|
|
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 };
|
|
@@ -1 +0,0 @@
|
|
|
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};
|
|
@@ -1,49 +0,0 @@
|
|
|
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({
|
|
41
|
-
character,
|
|
42
|
-
color,
|
|
43
|
-
dimColor,
|
|
44
|
-
label,
|
|
45
|
-
labelPadding,
|
|
46
|
-
length,
|
|
47
|
-
orientation
|
|
48
|
-
}: Props): ReactElement;
|
|
49
|
-
export { Divider, type Props as DividerProps, Props, Divider as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as r,jsxs as f}from"react/jsx-runtime";import w from"../ink/hooks/use-window-size.js";import{Box as e}from"./box.js";import{Text as t}from"./text.js";function S({character:x,color:i,dimColor:l=!1,label:a,labelPadding:s=1,length:o,orientation:d="horizontal"}){const{columns:p}=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(p,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(s);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};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* A single entry (file or directory) returned by the file system hook.
|
|
4
|
-
*/
|
|
5
|
-
type FileEntry = {
|
|
6
|
-
readonly isDirectory: boolean;
|
|
7
|
-
readonly isHidden: boolean;
|
|
8
|
-
readonly name: string;
|
|
9
|
-
readonly path: string;
|
|
10
|
-
readonly permissions: string;
|
|
11
|
-
readonly size: number;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Filter options for the file picker.
|
|
15
|
-
*/
|
|
16
|
-
type FilePickerFilter = {
|
|
17
|
-
/**
|
|
18
|
-
* Allowed file extensions (e.g. `[".ts", ".tsx"]`). Empty or omitted means all.
|
|
19
|
-
*/
|
|
20
|
-
readonly extensions?: ReadonlyArray<string>;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to include directories in the list.
|
|
23
|
-
* @default true
|
|
24
|
-
*/
|
|
25
|
-
readonly showDirectories?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Whether to include regular files in the list.
|
|
28
|
-
* @default true
|
|
29
|
-
*/
|
|
30
|
-
readonly showFiles?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Whether to include hidden files (names starting with `.`).
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
|
-
readonly showHidden?: boolean;
|
|
36
|
-
};
|
|
37
|
-
type Props = {
|
|
38
|
-
/**
|
|
39
|
-
* Color for the focused item highlight.
|
|
40
|
-
* @default "cyan"
|
|
41
|
-
*/
|
|
42
|
-
readonly accentColor?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Color for directory entries.
|
|
45
|
-
* @default "blue"
|
|
46
|
-
*/
|
|
47
|
-
readonly directoryColor?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Color for file entries.
|
|
50
|
-
* @default "white"
|
|
51
|
-
*/
|
|
52
|
-
readonly fileColor?: string;
|
|
53
|
-
/**
|
|
54
|
-
* File filter options.
|
|
55
|
-
*/
|
|
56
|
-
readonly filter?: FilePickerFilter;
|
|
57
|
-
/**
|
|
58
|
-
* Starting directory path.
|
|
59
|
-
* @default process.cwd()
|
|
60
|
-
*/
|
|
61
|
-
readonly initialPath?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Whether keyboard navigation is active.
|
|
64
|
-
* @default true
|
|
65
|
-
*/
|
|
66
|
-
readonly isFocused?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Maximum number of visible items (viewport height).
|
|
69
|
-
* @default 10
|
|
70
|
-
*/
|
|
71
|
-
readonly limit?: number;
|
|
72
|
-
/**
|
|
73
|
-
* Called when escape is pressed.
|
|
74
|
-
*/
|
|
75
|
-
readonly onCancel?: () => void;
|
|
76
|
-
/**
|
|
77
|
-
* Called when a file is selected (enter on a file entry).
|
|
78
|
-
*/
|
|
79
|
-
readonly onSelect?: (entry: FileEntry) => void;
|
|
80
|
-
/**
|
|
81
|
-
* Show file permissions column.
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
readonly showPermissions?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Show file size column.
|
|
87
|
-
* @default false
|
|
88
|
-
*/
|
|
89
|
-
readonly showSize?: boolean;
|
|
90
|
-
};
|
|
91
|
-
declare const FilePicker: ({
|
|
92
|
-
accentColor,
|
|
93
|
-
directoryColor,
|
|
94
|
-
fileColor,
|
|
95
|
-
filter,
|
|
96
|
-
initialPath,
|
|
97
|
-
isFocused,
|
|
98
|
-
limit,
|
|
99
|
-
onCancel,
|
|
100
|
-
onSelect,
|
|
101
|
-
showPermissions,
|
|
102
|
-
showSize
|
|
103
|
-
}: Props) => ReactElement;
|
|
104
|
-
export { type FileEntry, FilePicker, type FilePickerFilter, type Props as FilePickerProps, FilePicker as default };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{default as f,default as l}from"../packem_shared/FilePicker-BLS9nOPz.js";export{f as FilePicker,l as default};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type FormFieldProps = {
|
|
5
|
-
/**
|
|
6
|
-
* The input element (TextInput, Checkbox, Select, …).
|
|
7
|
-
*/
|
|
8
|
-
readonly children: ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* Optional helper text rendered beneath the input.
|
|
11
|
-
*/
|
|
12
|
-
readonly description?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Validation error — dimmed red below the input.
|
|
15
|
-
*/
|
|
16
|
-
readonly error?: string;
|
|
17
|
-
/**
|
|
18
|
-
* When true, the field's label and description are dim.
|
|
19
|
-
*/
|
|
20
|
-
readonly isDisabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Label rendered above the input.
|
|
23
|
-
*/
|
|
24
|
-
readonly label: string;
|
|
25
|
-
/**
|
|
26
|
-
* Mark the field as required (adds a trailing `*`).
|
|
27
|
-
*/
|
|
28
|
-
readonly required?: boolean;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Standard form field wrapper: label + input + helper/error.
|
|
32
|
-
*/
|
|
33
|
-
declare const FormField: ({
|
|
34
|
-
children,
|
|
35
|
-
description,
|
|
36
|
-
error,
|
|
37
|
-
isDisabled,
|
|
38
|
-
label,
|
|
39
|
-
required
|
|
40
|
-
}: FormFieldProps) => ReactElement;
|
|
41
|
-
type Props = {
|
|
42
|
-
/**
|
|
43
|
-
* Accent color for the form chrome.
|
|
44
|
-
* @default "blue"
|
|
45
|
-
*/
|
|
46
|
-
readonly accentColor?: LiteralUnion<AnsiColors, string>;
|
|
47
|
-
/**
|
|
48
|
-
* Render a border around the form.
|
|
49
|
-
* @default true
|
|
50
|
-
*/
|
|
51
|
-
readonly bordered?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Fields composed via `<FormField />`.
|
|
54
|
-
*/
|
|
55
|
-
readonly children: ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* Optional description rendered under the title.
|
|
58
|
-
*/
|
|
59
|
-
readonly description?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Optional footer rendered below the fields (buttons, hints, summary).
|
|
62
|
-
*/
|
|
63
|
-
readonly footer?: ReactNode;
|
|
64
|
-
/**
|
|
65
|
-
* Optional heading rendered at the top.
|
|
66
|
-
*/
|
|
67
|
-
readonly title?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Fixed width.
|
|
70
|
-
*/
|
|
71
|
-
readonly width?: number;
|
|
72
|
-
};
|
|
73
|
-
type FormComponent = ((props: Props) => ReactElement) & {
|
|
74
|
-
Field: typeof FormField;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Stateless form layout. Pair with the `useForm` hook for state management
|
|
78
|
-
* and `FormField` for consistent label/error styling.
|
|
79
|
-
*/
|
|
80
|
-
declare const Form: FormComponent;
|
|
81
|
-
export { Form, FormField, FormFieldProps, type Props as FormProps, Props, Form as default };
|
package/dist/components/form.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as m,jsx as r}from"react/jsx-runtime";import{Box as o}from"./box.js";import{Text as i}from"./text.js";const a=({children:e,description:d,error:l,isDisabled:n=!1,label:c,required:t=!1})=>m(o,{flexDirection:"column",marginBottom:1,children:[m(o,{children:[r(i,{bold:!0,dimColor:n,children:c}),t?r(i,{color:"red",children:" *"}):void 0]}),r(o,{marginTop:0,children:e}),l===void 0?d===void 0?void 0:r(i,{dimColor:!0,children:d}):r(i,{color:"red",children:l})]}),x=Object.assign(({accentColor:e="blue",bordered:d=!0,children:l,description:n,footer:c,title:t,width:h})=>{const s=m(o,{flexDirection:"column",children:[t===void 0?void 0:r(o,{marginBottom:1,children:r(i,{bold:!0,color:e,children:t})}),n===void 0?void 0:r(o,{marginBottom:1,children:r(i,{dimColor:!0,children:n})}),r(o,{flexDirection:"column",children:l}),c===void 0?void 0:r(o,{marginTop:1,children:c})]});return d?r(o,{borderColor:e,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:h,children:s}):r(o,{flexDirection:"column",width:h,children:s})},{Field:a});export{x as Form,a as FormField,x as default};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
import { ReactElement } from 'react';
|
|
3
|
-
import { LiteralUnion } from 'type-fest';
|
|
4
|
-
type GaugeThreshold = {
|
|
5
|
-
/**
|
|
6
|
-
* Color used for the arc segment and, when the current value falls into
|
|
7
|
-
* this segment, for the value readout.
|
|
8
|
-
*/
|
|
9
|
-
readonly color: LiteralUnion<AnsiColors, string>;
|
|
10
|
-
/**
|
|
11
|
-
* Optional label used by the legend under the gauge.
|
|
12
|
-
*/
|
|
13
|
-
readonly label?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Upper bound of this threshold segment (inclusive). Segments are sorted
|
|
16
|
-
* ascending and painted in order.
|
|
17
|
-
*/
|
|
18
|
-
readonly max: number;
|
|
19
|
-
};
|
|
20
|
-
type GaugeSize = "large" | "medium" | "small";
|
|
21
|
-
type Props = {
|
|
22
|
-
/**
|
|
23
|
-
* Color of the arc background (the portion beyond `value`).
|
|
24
|
-
* @default "gray"
|
|
25
|
-
*/
|
|
26
|
-
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
27
|
-
/**
|
|
28
|
-
* Format for the numeric readout. Defaults to rounding to an integer.
|
|
29
|
-
*/
|
|
30
|
-
readonly formatValue?: (value: number) => string;
|
|
31
|
-
/**
|
|
32
|
-
* Optional label rendered above the readout.
|
|
33
|
-
*/
|
|
34
|
-
readonly label?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Upper bound of the range.
|
|
37
|
-
* @default 100
|
|
38
|
-
*/
|
|
39
|
-
readonly max?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Lower bound of the range.
|
|
42
|
-
* @default 0
|
|
43
|
-
*/
|
|
44
|
-
readonly min?: number;
|
|
45
|
-
/**
|
|
46
|
-
* Show a legend listing thresholds below the gauge.
|
|
47
|
-
* @default false
|
|
48
|
-
*/
|
|
49
|
-
readonly showLegend?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Show a numeric readout in the middle of the gauge.
|
|
52
|
-
* @default true
|
|
53
|
-
*/
|
|
54
|
-
readonly showValue?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Overall dimension preset.
|
|
57
|
-
* @default "medium"
|
|
58
|
-
*/
|
|
59
|
-
readonly size?: GaugeSize;
|
|
60
|
-
/**
|
|
61
|
-
* Color threshold ramp. When provided, segments of the arc are painted in
|
|
62
|
-
* the corresponding colors and the value readout picks up the color for
|
|
63
|
-
* the segment `value` lands in.
|
|
64
|
-
*/
|
|
65
|
-
readonly thresholds?: ReadonlyArray<GaugeThreshold>;
|
|
66
|
-
/**
|
|
67
|
-
* Current value. Clamped into the `[min, max]` range.
|
|
68
|
-
*/
|
|
69
|
-
readonly value: number;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Semi-circular gauge rendered at 2x4 sub-cell resolution. Supports colored
|
|
73
|
-
* threshold segments and an optional needle.
|
|
74
|
-
*/
|
|
75
|
-
declare function Gauge({
|
|
76
|
-
backgroundColor,
|
|
77
|
-
formatValue,
|
|
78
|
-
label,
|
|
79
|
-
max,
|
|
80
|
-
min,
|
|
81
|
-
showLegend,
|
|
82
|
-
showValue,
|
|
83
|
-
size,
|
|
84
|
-
thresholds,
|
|
85
|
-
value
|
|
86
|
-
}: Props): ReactElement;
|
|
87
|
-
export { Gauge, type Props as GaugeProps, GaugeSize, GaugeThreshold, Props, Gauge as default };
|
package/dist/components/gauge.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as C,jsx as l}from"react/jsx-runtime";import{useMemo as q}from"react";import{c as T}from"../packem_shared/braille-ch3O5D7I.js";import{Box as s}from"./box.js";import{Canvas as U}from"./canvas.js";import{Text as x}from"./text.js";const W={large:{cols:40,rows:10},medium:{cols:24,rows:6},small:{cols:16,rows:4}},X=.9,_=2,Y=r=>String(Math.round(r)),z=(r,m,c,e)=>{const t=m+(c-m)*e;for(const f of r)if(t<=f.max)return f;return r[r.length-1]};function no({backgroundColor:r="gray",formatValue:m=Y,label:c,max:e=100,min:t=0,showLegend:f=!1,showValue:j=!0,size:b="medium",thresholds:n,value:P}){const{cols:A,rows:E}=W[b],I=Math.max(t,Math.min(e,P)),F=e-t||1,M=(I-t)/F,d=q(()=>{if(!(n===void 0||n.length===0))return[...n].toSorted((o,h)=>o.max-h.max)},[n]),k=q(()=>{if(d!==void 0)return z(d,t,e,M)},[d,t,e,M]),G=m(I);return C(s,{flexDirection:"column",children:[l(U,{draw:o=>{o.clear();const h=o.width*2,B=o.height*4,w=h/2,v=B-1,H=h/2-1,J=B-1,g=Math.max(1,Math.min(H,J)),y=new Map,D=i=>{const a=y.get(i);if(a!==void 0)return a;const u=T(o.width,o.height);return y.set(i,u),u},L=Math.max(32,Math.round(Math.PI*g)*_);for(let i=0;i<=L;i+=1){const a=i/L,u=Math.PI*(1-a),Q=Math.round(w+g*Math.cos(u)),R=Math.round(v-g*Math.sin(u));let p;a>M?p=r:d?p=z(d,t,e,a)?.color??"cyan":p="cyan",D(p).plotPoint(Q,R)}const S=g*X,V=Math.PI*(1-M),K=Math.round(w+S*Math.cos(V)),N=Math.round(v-S*Math.sin(V)),O=k?.color??"white";D(O).plotLine(Math.round(w),Math.round(v),K,N);for(const[i,a]of y)a.flush(o,{color:i})},height:E,version:[P,t,e,b,n,r],width:A}),j||c?C(s,{flexDirection:"column",children:[c===void 0?void 0:l(s,{justifyContent:"center",children:l(x,{dimColor:!0,children:c})}),j?l(s,{justifyContent:"center",children:l(x,{bold:!0,color:k?.color??"white",children:G})}):void 0]}):void 0,f&&n&&n.length>0?l(s,{gap:2,justifyContent:"center",marginTop:1,children:n.map((o,h)=>C(s,{gap:1,children:[l(x,{color:o.color,children:"●"}),l(x,{dimColor:!0,children:o.label??`≤ ${o.max}`})]},h))}):void 0]})}export{no as Gauge,no as default};
|