@outfitter/cli 0.2.0 → 0.4.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/README.md +47 -4
- package/dist/actions.js +0 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -2
- package/dist/{render → colors}/colors.d.ts +1 -1
- package/dist/{render → colors}/colors.js +2 -6
- package/dist/colors/index.d.ts +1 -1
- package/dist/colors/index.js +3 -4
- package/dist/command.d.ts +1 -1
- package/dist/command.js +1 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -5
- package/dist/input.d.ts +3 -26
- package/dist/input.js +1 -31
- package/dist/output.d.ts +3 -3
- package/dist/output.js +4 -3
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +0 -2
- package/dist/shared/@outfitter/{cli-ttt7r0j7.d.ts → cli-02kyvj7h.d.ts} +2 -13
- package/dist/shared/@outfitter/{cli-8gg0hck1.js → cli-7wp5nj0s.js} +16 -12
- package/dist/shared/@outfitter/{cli-72kg550t.d.ts → cli-f79bwzsp.d.ts} +30 -2
- package/dist/shared/@outfitter/{cli-d9ad0rqj.js → cli-jbj78ac5.js} +1 -6
- package/dist/shared/@outfitter/{cli-5g6rkv3d.js → cli-rk9zagkm.js} +24 -32
- package/dist/shared/@outfitter/{cli-efy6jfcj.js → cli-zahqsaby.js} +33 -10
- package/dist/terminal/detection.js +1 -5
- package/dist/terminal/index.js +1 -6
- package/dist/{shared/@outfitter/cli-4cb5g831.d.ts → text.d.ts} +1 -1
- package/dist/{shared/@outfitter/cli-mwxsh3sr.js → text.js} +15 -14
- package/dist/types.d.ts +2 -2
- package/dist/types.js +0 -2
- package/package.json +35 -213
- package/dist/borders/index.d.ts +0 -3
- package/dist/borders/index.js +0 -13
- package/dist/box/index.d.ts +0 -4
- package/dist/box/index.js +0 -13
- package/dist/demo/index.d.ts +0 -78
- package/dist/demo/index.js +0 -148
- package/dist/demo/registry.d.ts +0 -7
- package/dist/demo/registry.js +0 -28
- package/dist/demo/renderers/borders.d.ts +0 -7
- package/dist/demo/renderers/borders.js +0 -17
- package/dist/demo/renderers/box.d.ts +0 -7
- package/dist/demo/renderers/box.js +0 -18
- package/dist/demo/renderers/colors.d.ts +0 -7
- package/dist/demo/renderers/colors.js +0 -18
- package/dist/demo/renderers/indicators.d.ts +0 -7
- package/dist/demo/renderers/indicators.js +0 -17
- package/dist/demo/renderers/list.d.ts +0 -7
- package/dist/demo/renderers/list.js +0 -19
- package/dist/demo/renderers/markdown.d.ts +0 -7
- package/dist/demo/renderers/markdown.js +0 -18
- package/dist/demo/renderers/progress.d.ts +0 -7
- package/dist/demo/renderers/progress.js +0 -17
- package/dist/demo/renderers/spinner.d.ts +0 -7
- package/dist/demo/renderers/spinner.js +0 -19
- package/dist/demo/renderers/table.d.ts +0 -7
- package/dist/demo/renderers/table.js +0 -19
- package/dist/demo/renderers/text.d.ts +0 -7
- package/dist/demo/renderers/text.js +0 -16
- package/dist/demo/renderers/tree.d.ts +0 -7
- package/dist/demo/renderers/tree.js +0 -18
- package/dist/demo/section.d.ts +0 -5
- package/dist/demo/section.js +0 -23
- package/dist/demo/templates.d.ts +0 -4
- package/dist/demo/templates.js +0 -10
- package/dist/demo/types.d.ts +0 -3
- package/dist/demo/types.js +0 -8
- package/dist/list/index.d.ts +0 -3
- package/dist/list/index.js +0 -9
- package/dist/preset/full.d.ts +0 -14
- package/dist/preset/full.js +0 -41
- package/dist/preset/standard.d.ts +0 -11
- package/dist/preset/standard.js +0 -30
- package/dist/prompt/confirm.d.ts +0 -4
- package/dist/prompt/confirm.js +0 -9
- package/dist/prompt/group.d.ts +0 -4
- package/dist/prompt/group.js +0 -9
- package/dist/prompt/index.d.ts +0 -7
- package/dist/prompt/index.js +0 -32
- package/dist/prompt/select.d.ts +0 -4
- package/dist/prompt/select.js +0 -11
- package/dist/prompt/text.d.ts +0 -4
- package/dist/prompt/text.js +0 -11
- package/dist/prompt/types.d.ts +0 -3
- package/dist/prompt/types.js +0 -8
- package/dist/prompt/validators.d.ts +0 -2
- package/dist/prompt/validators.js +0 -8
- package/dist/render/borders.d.ts +0 -2
- package/dist/render/borders.js +0 -15
- package/dist/render/box.d.ts +0 -3
- package/dist/render/box.js +0 -23
- package/dist/render/date.d.ts +0 -2
- package/dist/render/date.js +0 -12
- package/dist/render/format-relative.d.ts +0 -2
- package/dist/render/format-relative.js +0 -8
- package/dist/render/format.d.ts +0 -2
- package/dist/render/format.js +0 -10
- package/dist/render/heading.d.ts +0 -3
- package/dist/render/heading.js +0 -14
- package/dist/render/index.d.ts +0 -32
- package/dist/render/index.js +0 -235
- package/dist/render/indicators.d.ts +0 -2
- package/dist/render/indicators.js +0 -16
- package/dist/render/json.d.ts +0 -2
- package/dist/render/json.js +0 -10
- package/dist/render/layout.d.ts +0 -5
- package/dist/render/layout.js +0 -25
- package/dist/render/list.d.ts +0 -2
- package/dist/render/list.js +0 -8
- package/dist/render/markdown.d.ts +0 -2
- package/dist/render/markdown.js +0 -10
- package/dist/render/progress.d.ts +0 -2
- package/dist/render/progress.js +0 -8
- package/dist/render/separator.d.ts +0 -3
- package/dist/render/separator.js +0 -14
- package/dist/render/shapes.d.ts +0 -2
- package/dist/render/shapes.js +0 -35
- package/dist/render/spinner.d.ts +0 -2
- package/dist/render/spinner.js +0 -12
- package/dist/render/stack.d.ts +0 -3
- package/dist/render/stack.js +0 -38
- package/dist/render/table.d.ts +0 -3
- package/dist/render/table.js +0 -12
- package/dist/render/text.d.ts +0 -2
- package/dist/render/text.js +0 -27
- package/dist/render/tree.d.ts +0 -2
- package/dist/render/tree.js +0 -10
- package/dist/render/types.d.ts +0 -2
- package/dist/shared/@outfitter/cli-0djg8q91.js +0 -7
- package/dist/shared/@outfitter/cli-0w242qtv.d.ts +0 -48
- package/dist/shared/@outfitter/cli-1g8tt31a.d.ts +0 -119
- package/dist/shared/@outfitter/cli-1kwbnt86.d.ts +0 -45
- package/dist/shared/@outfitter/cli-1sb3xvnw.js +0 -95
- package/dist/shared/@outfitter/cli-1vy0vtga.js +0 -135
- package/dist/shared/@outfitter/cli-2g8bx1aq.d.ts +0 -50
- package/dist/shared/@outfitter/cli-33e97cjs.d.ts +0 -42
- package/dist/shared/@outfitter/cli-3b7ed3rm.d.ts +0 -97
- package/dist/shared/@outfitter/cli-3hk2xf3c.js +0 -82
- package/dist/shared/@outfitter/cli-3hp8qwx3.js +0 -11
- package/dist/shared/@outfitter/cli-47yw5h6a.js +0 -7
- package/dist/shared/@outfitter/cli-4b6tbp68.d.ts +0 -36
- package/dist/shared/@outfitter/cli-4fcz51qa.js +0 -70
- package/dist/shared/@outfitter/cli-4x6pqnez.js +0 -20
- package/dist/shared/@outfitter/cli-4zk2y4a2.d.ts +0 -61
- package/dist/shared/@outfitter/cli-60b5xh1r.js +0 -20
- package/dist/shared/@outfitter/cli-6bztk73z.d.ts +0 -51
- package/dist/shared/@outfitter/cli-6fxffp8k.js +0 -1
- package/dist/shared/@outfitter/cli-6hg0sg2d.d.ts +0 -93
- package/dist/shared/@outfitter/cli-6r3m2knf.js +0 -62
- package/dist/shared/@outfitter/cli-6ty1nvws.js +0 -179
- package/dist/shared/@outfitter/cli-7n610r63.js +0 -20
- package/dist/shared/@outfitter/cli-7na6p4fs.d.ts +0 -59
- package/dist/shared/@outfitter/cli-83jwvj1t.d.ts +0 -17
- package/dist/shared/@outfitter/cli-85fg2vr5.js +0 -123
- package/dist/shared/@outfitter/cli-8bwaw3pz.js +0 -7
- package/dist/shared/@outfitter/cli-8hngbjyr.d.ts +0 -164
- package/dist/shared/@outfitter/cli-8j5k6mr3.js +0 -71
- package/dist/shared/@outfitter/cli-8xsmsbbd.d.ts +0 -223
- package/dist/shared/@outfitter/cli-914d47mt.js +0 -20
- package/dist/shared/@outfitter/cli-9bcm4zhf.d.ts +0 -87
- package/dist/shared/@outfitter/cli-9khk3cbq.d.ts +0 -190
- package/dist/shared/@outfitter/cli-a4q87517.d.ts +0 -64
- package/dist/shared/@outfitter/cli-aem6v4c8.js +0 -146
- package/dist/shared/@outfitter/cli-b0tzqgnf.d.ts +0 -132
- package/dist/shared/@outfitter/cli-b5c2k0d7.js +0 -39
- package/dist/shared/@outfitter/cli-b5epywry.js +0 -1
- package/dist/shared/@outfitter/cli-bc17qeh2.js +0 -19
- package/dist/shared/@outfitter/cli-bcmcaz1b.js +0 -23
- package/dist/shared/@outfitter/cli-bv09nme3.d.ts +0 -56
- package/dist/shared/@outfitter/cli-c6pbxpw0.d.ts +0 -112
- package/dist/shared/@outfitter/cli-c8fqdaes.js +0 -117
- package/dist/shared/@outfitter/cli-c8q4f71g.js +0 -144
- package/dist/shared/@outfitter/cli-c9knfqn5.d.ts +0 -30
- package/dist/shared/@outfitter/cli-cf1xexgn.d.ts +0 -53
- package/dist/shared/@outfitter/cli-cf2s94s1.d.ts +0 -42
- package/dist/shared/@outfitter/cli-cwgj6mcs.js +0 -214
- package/dist/shared/@outfitter/cli-d8ahdd9d.js +0 -272
- package/dist/shared/@outfitter/cli-dbyteh27.d.ts +0 -24
- package/dist/shared/@outfitter/cli-e5ms1y0x.d.ts +0 -91
- package/dist/shared/@outfitter/cli-en6zn6sj.js +0 -1
- package/dist/shared/@outfitter/cli-evx7qcp1.d.ts +0 -300
- package/dist/shared/@outfitter/cli-f6fsaayd.js +0 -94
- package/dist/shared/@outfitter/cli-fakncnjp.d.ts +0 -106
- package/dist/shared/@outfitter/cli-ffa0jwb7.js +0 -122
- package/dist/shared/@outfitter/cli-h20jc0bs.d.ts +0 -66
- package/dist/shared/@outfitter/cli-h3jz0bxz.js +0 -48
- package/dist/shared/@outfitter/cli-h4wpzb3f.js +0 -67
- package/dist/shared/@outfitter/cli-hda6mc28.js +0 -126
- package/dist/shared/@outfitter/cli-hnpbqmc8.d.ts +0 -328
- package/dist/shared/@outfitter/cli-j19a91ck.js +0 -30
- package/dist/shared/@outfitter/cli-jejfypgf.js +0 -85
- package/dist/shared/@outfitter/cli-jp0k3qd9.js +0 -279
- package/dist/shared/@outfitter/cli-k76e7173.js +0 -128
- package/dist/shared/@outfitter/cli-kc3ffp1v.d.ts +0 -23
- package/dist/shared/@outfitter/cli-kk5hnndk.d.ts +0 -128
- package/dist/shared/@outfitter/cli-ktqme80d.js +0 -7
- package/dist/shared/@outfitter/cli-mq0jp15z.js +0 -1
- package/dist/shared/@outfitter/cli-n0c33vba.js +0 -25
- package/dist/shared/@outfitter/cli-n17gt1dz.js +0 -19
- package/dist/shared/@outfitter/cli-n9dbh0hp.js +0 -51
- package/dist/shared/@outfitter/cli-ndem6tz8.js +0 -63
- package/dist/shared/@outfitter/cli-nj4nqy1h.d.ts +0 -24
- package/dist/shared/@outfitter/cli-nkns8p4r.js +0 -61
- package/dist/shared/@outfitter/cli-p3dqm1vd.js +0 -22
- package/dist/shared/@outfitter/cli-pndwprz8.js +0 -118
- package/dist/shared/@outfitter/cli-pvrwv6rb.js +0 -352
- package/dist/shared/@outfitter/cli-py02m79x.d.ts +0 -20
- package/dist/shared/@outfitter/cli-qj83y5wj.d.ts +0 -71
- package/dist/shared/@outfitter/cli-regjbef6.d.ts +0 -26
- package/dist/shared/@outfitter/cli-s1tx5kha.d.ts +0 -59
- package/dist/shared/@outfitter/cli-sam2sq50.js +0 -37
- package/dist/shared/@outfitter/cli-snxj55n6.js +0 -43
- package/dist/shared/@outfitter/cli-symyxb0z.js +0 -20
- package/dist/shared/@outfitter/cli-tvw1xrdj.js +0 -20
- package/dist/shared/@outfitter/cli-v1tzwxkt.js +0 -32
- package/dist/shared/@outfitter/cli-vd60dj65.js +0 -1
- package/dist/shared/@outfitter/cli-vfcrskfj.d.ts +0 -41
- package/dist/shared/@outfitter/cli-vstbkzky.d.ts +0 -74
- package/dist/shared/@outfitter/cli-vtg0sqk2.d.ts +0 -54
- package/dist/shared/@outfitter/cli-x4cavvc0.js +0 -1
- package/dist/shared/@outfitter/cli-xep6v2c0.js +0 -52
- package/dist/shared/@outfitter/cli-xg5y5fhk.js +0 -86
- package/dist/shared/@outfitter/cli-y7k1t81k.js +0 -30
- package/dist/shared/@outfitter/cli-yfyzy95c.js +0 -67
- package/dist/shared/@outfitter/cli-z78mkrc7.js +0 -59
- package/dist/shared/@outfitter/cli-znc47004.js +0 -134
- package/dist/shared/@outfitter/cli-zx598p8q.d.ts +0 -26
- package/dist/streaming/ansi.d.ts +0 -2
- package/dist/streaming/ansi.js +0 -8
- package/dist/streaming/index.d.ts +0 -4
- package/dist/streaming/index.js +0 -17
- package/dist/streaming/spinner.d.ts +0 -3
- package/dist/streaming/spinner.js +0 -10
- package/dist/streaming/writer.d.ts +0 -2
- package/dist/streaming/writer.js +0 -9
- package/dist/table/index.d.ts +0 -4
- package/dist/table/index.js +0 -13
- package/dist/theme/context.d.ts +0 -9
- package/dist/theme/context.js +0 -14
- package/dist/theme/create.d.ts +0 -8
- package/dist/theme/create.js +0 -12
- package/dist/theme/index.d.ts +0 -17
- package/dist/theme/index.js +0 -42
- package/dist/theme/presets/bold.d.ts +0 -8
- package/dist/theme/presets/bold.js +0 -12
- package/dist/theme/presets/default.d.ts +0 -8
- package/dist/theme/presets/default.js +0 -11
- package/dist/theme/presets/index.d.ts +0 -12
- package/dist/theme/presets/index.js +0 -24
- package/dist/theme/presets/minimal.d.ts +0 -8
- package/dist/theme/presets/minimal.js +0 -12
- package/dist/theme/presets/rounded.d.ts +0 -8
- package/dist/theme/presets/rounded.js +0 -12
- package/dist/theme/resolve.d.ts +0 -8
- package/dist/theme/resolve.js +0 -11
- package/dist/theme/types.d.ts +0 -7
- package/dist/theme/types.js +0 -1
- package/dist/tree/index.d.ts +0 -3
- package/dist/tree/index.js +0 -11
- /package/dist/shared/@outfitter/{cli-ykxn7rb2.d.ts → cli-xppg982q.d.ts} +0 -0
- /package/dist/{render/types.js → shared/@outfitter/cli-zw75pdk8.js} +0 -0
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { BorderStyle } from "./cli-fakncnjp";
|
|
2
|
-
/**
|
|
3
|
-
* Text alignment options for box content.
|
|
4
|
-
*/
|
|
5
|
-
type BoxAlign = "left" | "center" | "right";
|
|
6
|
-
/**
|
|
7
|
-
* Options for customizing box rendering.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* // Box with title and rounded corners
|
|
12
|
-
* renderBox("Content", {
|
|
13
|
-
* title: "Status",
|
|
14
|
-
* border: "rounded",
|
|
15
|
-
* padding: 1,
|
|
16
|
-
* });
|
|
17
|
-
*
|
|
18
|
-
* // Fixed-width centered box
|
|
19
|
-
* renderBox("Centered", {
|
|
20
|
-
* width: 40,
|
|
21
|
-
* align: "center",
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Spacing configuration for individual sides.
|
|
27
|
-
*/
|
|
28
|
-
interface BoxSpacing {
|
|
29
|
-
top?: number;
|
|
30
|
-
right?: number;
|
|
31
|
-
bottom?: number;
|
|
32
|
-
left?: number;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Border visibility configuration for individual sides.
|
|
36
|
-
*/
|
|
37
|
-
interface BoxBorders {
|
|
38
|
-
top?: boolean;
|
|
39
|
-
right?: boolean;
|
|
40
|
-
bottom?: boolean;
|
|
41
|
-
left?: boolean;
|
|
42
|
-
}
|
|
43
|
-
interface BoxOptions {
|
|
44
|
-
/**
|
|
45
|
-
* Border style to use.
|
|
46
|
-
* @default "single"
|
|
47
|
-
*/
|
|
48
|
-
border?: BorderStyle;
|
|
49
|
-
/**
|
|
50
|
-
* Control which borders to render.
|
|
51
|
-
* @default { top: true, right: true, bottom: true, left: true }
|
|
52
|
-
*/
|
|
53
|
-
borders?: BoxBorders;
|
|
54
|
-
/**
|
|
55
|
-
* Internal padding (spaces between border and content).
|
|
56
|
-
* Can be a single number for all sides or an object for individual sides.
|
|
57
|
-
* @default 1
|
|
58
|
-
*/
|
|
59
|
-
padding?: number | BoxSpacing;
|
|
60
|
-
/**
|
|
61
|
-
* External margin (spacing outside the box).
|
|
62
|
-
* Can be a single number for all sides or an object for individual sides.
|
|
63
|
-
*/
|
|
64
|
-
margin?: number | BoxSpacing;
|
|
65
|
-
/**
|
|
66
|
-
* Fixed width for the box. If not specified, auto-fits to content.
|
|
67
|
-
*/
|
|
68
|
-
width?: number;
|
|
69
|
-
/**
|
|
70
|
-
* Optional title to display in the top border.
|
|
71
|
-
*/
|
|
72
|
-
title?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Content alignment within the box.
|
|
75
|
-
* @default "left"
|
|
76
|
-
*/
|
|
77
|
-
align?: BoxAlign;
|
|
78
|
-
/**
|
|
79
|
-
* Content sections separated by internal dividers.
|
|
80
|
-
* Each section can be a string or string[].
|
|
81
|
-
* When provided, takes precedence over the content parameter.
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* renderBox("", {
|
|
86
|
-
* sections: [
|
|
87
|
-
* "Header",
|
|
88
|
-
* ["Line 1", "Line 2"],
|
|
89
|
-
* "Footer"
|
|
90
|
-
* ],
|
|
91
|
-
* border: "single"
|
|
92
|
-
* });
|
|
93
|
-
* // ┌─────────────────┐
|
|
94
|
-
* // │ Header │
|
|
95
|
-
* // ├─────────────────┤
|
|
96
|
-
* // │ Line 1 │
|
|
97
|
-
* // │ Line 2 │
|
|
98
|
-
* // ├─────────────────┤
|
|
99
|
-
* // │ Footer │
|
|
100
|
-
* // └─────────────────┘
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
sections?: Array<string | string[]>;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* A rendered box with metadata for composition.
|
|
107
|
-
*/
|
|
108
|
-
interface Box {
|
|
109
|
-
/** Rendered string representation */
|
|
110
|
-
readonly output: string;
|
|
111
|
-
/** Width in characters */
|
|
112
|
-
readonly width: number;
|
|
113
|
-
/** Height in lines */
|
|
114
|
-
readonly height: number;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Content that can be rendered inside a box.
|
|
118
|
-
* - string: Plain text content
|
|
119
|
-
* - string[]: Multi-line content
|
|
120
|
-
* - Box: Nested box (rendered string with metadata)
|
|
121
|
-
*/
|
|
122
|
-
type BoxContent = string | string[] | Box;
|
|
123
|
-
/**
|
|
124
|
-
* Normalized spacing with all four sides defined.
|
|
125
|
-
*/
|
|
126
|
-
interface NormalizedSpacing {
|
|
127
|
-
top: number;
|
|
128
|
-
right: number;
|
|
129
|
-
bottom: number;
|
|
130
|
-
left: number;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Normalized borders with all four sides defined.
|
|
134
|
-
*/
|
|
135
|
-
interface NormalizedBorders {
|
|
136
|
-
top: boolean;
|
|
137
|
-
right: boolean;
|
|
138
|
-
bottom: boolean;
|
|
139
|
-
left: boolean;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Normalizes padding input to have all four sides.
|
|
143
|
-
* For backward compatibility, when padding is a number it only applies to horizontal (left/right).
|
|
144
|
-
* When padding is an object, all sides can be specified.
|
|
145
|
-
*/
|
|
146
|
-
declare function normalizePadding(padding: number | BoxSpacing | undefined, defaultValue: number): NormalizedSpacing;
|
|
147
|
-
/**
|
|
148
|
-
* Normalizes margin input to have all four sides.
|
|
149
|
-
* When margin is a number, it applies to all sides.
|
|
150
|
-
*/
|
|
151
|
-
declare function normalizeMargin(margin: number | BoxSpacing | undefined, defaultValue: number): NormalizedSpacing;
|
|
152
|
-
/**
|
|
153
|
-
* Normalizes borders input to have all four sides.
|
|
154
|
-
*/
|
|
155
|
-
declare function normalizeBorders(borders: BoxBorders | undefined): NormalizedBorders;
|
|
156
|
-
/**
|
|
157
|
-
* Renders content within a bordered panel.
|
|
158
|
-
*
|
|
159
|
-
* Creates a box with Unicode borders around the content. Supports multiple
|
|
160
|
-
* border styles, titles, padding, and alignment options.
|
|
161
|
-
*
|
|
162
|
-
* @param content - The content to render (string or array of strings)
|
|
163
|
-
* @param options - Optional configuration for border style, padding, etc.
|
|
164
|
-
* @returns Formatted box string
|
|
165
|
-
*
|
|
166
|
-
* @example
|
|
167
|
-
* ```typescript
|
|
168
|
-
* // Simple box
|
|
169
|
-
* console.log(renderBox("Hello, world!"));
|
|
170
|
-
* // ┌───────────────┐
|
|
171
|
-
* // │ Hello, world! │
|
|
172
|
-
* // └───────────────┘
|
|
173
|
-
*
|
|
174
|
-
* // Box with title
|
|
175
|
-
* console.log(renderBox("All systems go", { title: "Status" }));
|
|
176
|
-
* // ┌─ Status ──────┐
|
|
177
|
-
* // │ All systems go │
|
|
178
|
-
* // └────────────────┘
|
|
179
|
-
*
|
|
180
|
-
* // Rounded box with padding
|
|
181
|
-
* console.log(renderBox(["Line 1", "Line 2"], {
|
|
182
|
-
* border: "rounded",
|
|
183
|
-
* padding: 2,
|
|
184
|
-
* }));
|
|
185
|
-
* // ╭──────────────╮
|
|
186
|
-
* // │ │
|
|
187
|
-
* // │ Line 1 │
|
|
188
|
-
* // │ Line 2 │
|
|
189
|
-
* // │ │
|
|
190
|
-
* // ╰──────────────╯
|
|
191
|
-
* ```
|
|
192
|
-
*/
|
|
193
|
-
declare function renderBox(content: string | string[], options?: BoxOptions): string;
|
|
194
|
-
/**
|
|
195
|
-
* Creates a Box object that can be composed with other boxes.
|
|
196
|
-
*
|
|
197
|
-
* Unlike `renderBox` which returns a string, `createBox` returns a Box object
|
|
198
|
-
* with metadata (width, height) that enables nested composition.
|
|
199
|
-
*
|
|
200
|
-
* @param content - The content to render (string, string[], Box, or array of mixed)
|
|
201
|
-
* @param options - Optional configuration for border style, padding, etc.
|
|
202
|
-
* @returns Box object with output, width, and height
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```typescript
|
|
206
|
-
* // Simple box
|
|
207
|
-
* const box = createBox("Hello");
|
|
208
|
-
* console.log(box.output);
|
|
209
|
-
* console.log(`Width: ${box.width}, Height: ${box.height}`);
|
|
210
|
-
*
|
|
211
|
-
* // Nested boxes
|
|
212
|
-
* const inner = createBox("Inner", { border: "rounded" });
|
|
213
|
-
* const outer = createBox(inner, { border: "double", title: "Container" });
|
|
214
|
-
* console.log(outer.output);
|
|
215
|
-
* // ╔═ Container ═══════════════╗
|
|
216
|
-
* // ║ ╭───────────────────────╮ ║
|
|
217
|
-
* // ║ │ Inner │ ║
|
|
218
|
-
* // ║ ╰───────────────────────╯ ║
|
|
219
|
-
* // ╚═══════════════════════════╝
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
declare function createBox(content: BoxContent | BoxContent[], options?: BoxOptions): Box;
|
|
223
|
-
export { BoxAlign, BoxSpacing, BoxBorders, BoxOptions, Box, BoxContent, NormalizedSpacing, NormalizedBorders, normalizePadding, normalizeMargin, normalizeBorders, renderBox, createBox };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
defaultTheme
|
|
4
|
-
} from "./cli-z78mkrc7.js";
|
|
5
|
-
import {
|
|
6
|
-
BORDERS,
|
|
7
|
-
init_borders
|
|
8
|
-
} from "./cli-85fg2vr5.js";
|
|
9
|
-
|
|
10
|
-
// packages/cli/src/theme/presets/rounded.ts
|
|
11
|
-
init_borders();
|
|
12
|
-
var roundedTheme = {
|
|
13
|
-
...defaultTheme,
|
|
14
|
-
name: "rounded",
|
|
15
|
-
border: "rounded",
|
|
16
|
-
borderChars: BORDERS.rounded,
|
|
17
|
-
treeGuide: "rounded"
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { roundedTheme };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { Validator } from "./cli-vstbkzky";
|
|
2
|
-
import { Result } from "better-result";
|
|
3
|
-
/**
|
|
4
|
-
* Error returned when user cancels a prompt.
|
|
5
|
-
*/
|
|
6
|
-
interface CancelledError {
|
|
7
|
-
type: "cancelled";
|
|
8
|
-
message: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Creates a cancelled error.
|
|
12
|
-
*/
|
|
13
|
-
declare function createCancelledError(message?: string): CancelledError;
|
|
14
|
-
/**
|
|
15
|
-
* Options for text prompts.
|
|
16
|
-
*/
|
|
17
|
-
interface TextPromptOptions {
|
|
18
|
-
/** Prompt message to display */
|
|
19
|
-
message: string;
|
|
20
|
-
/** Placeholder text */
|
|
21
|
-
placeholder?: string;
|
|
22
|
-
/** Default value */
|
|
23
|
-
defaultValue?: string;
|
|
24
|
-
/** Validation function */
|
|
25
|
-
validate?: Validator;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Options for password prompts.
|
|
29
|
-
*/
|
|
30
|
-
interface PasswordPromptOptions {
|
|
31
|
-
/** Prompt message to display */
|
|
32
|
-
message: string;
|
|
33
|
-
/** Validation function */
|
|
34
|
-
validate?: Validator;
|
|
35
|
-
/** Mask character (default: •) */
|
|
36
|
-
mask?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Options for select prompts.
|
|
40
|
-
*/
|
|
41
|
-
interface SelectPromptOptions<T> {
|
|
42
|
-
/** Prompt message to display */
|
|
43
|
-
message: string;
|
|
44
|
-
/** Available options */
|
|
45
|
-
options: Array<{
|
|
46
|
-
value: T;
|
|
47
|
-
label: string;
|
|
48
|
-
hint?: string;
|
|
49
|
-
}>;
|
|
50
|
-
/** Initial selected index */
|
|
51
|
-
initialValue?: T;
|
|
52
|
-
/** Maximum number of items to display at once */
|
|
53
|
-
pageSize?: number;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Options for multi-select prompts.
|
|
57
|
-
*/
|
|
58
|
-
interface MultiSelectPromptOptions<T> {
|
|
59
|
-
/** Prompt message to display */
|
|
60
|
-
message: string;
|
|
61
|
-
/** Available options */
|
|
62
|
-
options: Array<{
|
|
63
|
-
value: T;
|
|
64
|
-
label: string;
|
|
65
|
-
hint?: string;
|
|
66
|
-
}>;
|
|
67
|
-
/** Initially selected values */
|
|
68
|
-
initialValues?: T[];
|
|
69
|
-
/** Require at least one selection */
|
|
70
|
-
required?: boolean;
|
|
71
|
-
/** Maximum number of items to display at once */
|
|
72
|
-
pageSize?: number;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Options for confirm prompts.
|
|
76
|
-
*/
|
|
77
|
-
interface ConfirmPromptOptions {
|
|
78
|
-
/** Prompt message to display */
|
|
79
|
-
message: string;
|
|
80
|
-
/** Initial value */
|
|
81
|
-
initialValue?: boolean;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Type alias for prompt results.
|
|
85
|
-
*/
|
|
86
|
-
type PromptResult<T> = Promise<Result<T, CancelledError>>;
|
|
87
|
-
export { CancelledError, createCancelledError, TextPromptOptions, PasswordPromptOptions, SelectPromptOptions, MultiSelectPromptOptions, ConfirmPromptOptions, PromptResult };
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { BoxOptions } from "./cli-8xsmsbbd";
|
|
2
|
-
import { LayoutContext, WidthMode } from "./cli-2g8bx1aq";
|
|
3
|
-
/**
|
|
4
|
-
* Gets the current terminal width.
|
|
5
|
-
*
|
|
6
|
-
* Returns `process.stdout.columns` if available, otherwise falls back to 80
|
|
7
|
-
* (standard terminal width).
|
|
8
|
-
*
|
|
9
|
-
* @returns Terminal width in characters
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { getTerminalWidth } from "@outfitter/cli/render";
|
|
14
|
-
*
|
|
15
|
-
* const width = getTerminalWidth();
|
|
16
|
-
* console.log(`Terminal is ${width} columns wide`);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function getTerminalWidth(): number;
|
|
20
|
-
/**
|
|
21
|
-
* Calculates box overhead (borders + padding) for each axis.
|
|
22
|
-
*
|
|
23
|
-
* Returns the total character/line count consumed by borders and padding,
|
|
24
|
-
* separate from content.
|
|
25
|
-
*
|
|
26
|
-
* @param options - Box options (padding, borders)
|
|
27
|
-
* @returns Object with horizontal and vertical overhead
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* import { getBoxOverhead } from "@outfitter/cli/render";
|
|
32
|
-
*
|
|
33
|
-
* const overhead = getBoxOverhead({ padding: 1, border: "single" });
|
|
34
|
-
* // { horizontal: 4, vertical: 2 }
|
|
35
|
-
* // horizontal: left border (1) + left padding (1) + right padding (1) + right border (1)
|
|
36
|
-
* // vertical: top border (1) + bottom border (1)
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
declare function getBoxOverhead(options: BoxOptions): {
|
|
40
|
-
horizontal: number;
|
|
41
|
-
vertical: number;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Calculates available content width inside a box.
|
|
45
|
-
*
|
|
46
|
-
* Accounts for borders and padding to determine how much space remains
|
|
47
|
-
* for content. Use this to size nested components appropriately.
|
|
48
|
-
*
|
|
49
|
-
* @param options - Box options (width, padding, borders)
|
|
50
|
-
* @returns Available width in characters for content
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* import { getContentWidth, createBox, renderProgress } from "@outfitter/cli/render";
|
|
55
|
-
*
|
|
56
|
-
* const boxOpts = { width: 40, padding: 1, border: "single" };
|
|
57
|
-
* const available = getContentWidth(boxOpts); // → 36
|
|
58
|
-
*
|
|
59
|
-
* const progress = renderProgress(0.5, { width: available });
|
|
60
|
-
* const box = createBox(progress, boxOpts);
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
declare function getContentWidth(options: BoxOptions): number;
|
|
64
|
-
/**
|
|
65
|
-
* Resolves a width mode to a concrete character width.
|
|
66
|
-
*
|
|
67
|
-
* Width modes allow flexible sizing relative to terminal or container:
|
|
68
|
-
* - `"text"` → 0 (content-sized, no constraint)
|
|
69
|
-
* - `"full"` → terminal width
|
|
70
|
-
* - `"container"` → container width (requires context)
|
|
71
|
-
* - `number` → fixed width
|
|
72
|
-
* - `"${number}%"` → percentage of container/terminal
|
|
73
|
-
*
|
|
74
|
-
* @param mode - Width specification
|
|
75
|
-
* @param ctx - Layout context for container-relative modes
|
|
76
|
-
* @returns Resolved width in characters
|
|
77
|
-
* @throws Error if "container" mode used without context
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* import { resolveWidth, createLayoutContext } from "@outfitter/cli/render";
|
|
82
|
-
*
|
|
83
|
-
* resolveWidth("full"); // → 120 (terminal width)
|
|
84
|
-
* resolveWidth(50); // → 50
|
|
85
|
-
* resolveWidth("50%"); // → 60 (half of terminal)
|
|
86
|
-
*
|
|
87
|
-
* const ctx = createLayoutContext({ width: 80, padding: 1 });
|
|
88
|
-
* resolveWidth("50%", ctx); // → 38 (half of context width)
|
|
89
|
-
* resolveWidth("container", ctx); // → 76 (context width)
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare function resolveWidth(mode: WidthMode, ctx?: LayoutContext): number;
|
|
93
|
-
/**
|
|
94
|
-
* Creates a layout context from box options.
|
|
95
|
-
*
|
|
96
|
-
* Layout contexts propagate width information through nested components,
|
|
97
|
-
* enabling relative sizing like `"50%"` or `"container"`.
|
|
98
|
-
*
|
|
99
|
-
* @param options - Box options defining the container
|
|
100
|
-
* @param parent - Parent context for chained calculations
|
|
101
|
-
* @returns New layout context with calculated content width
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* ```typescript
|
|
105
|
-
* import { createLayoutContext, resolveWidth, createBox } from "@outfitter/cli/render";
|
|
106
|
-
*
|
|
107
|
-
* // Outer container
|
|
108
|
-
* const outerOpts = { width: 80, padding: 1 };
|
|
109
|
-
* const outerCtx = createLayoutContext(outerOpts);
|
|
110
|
-
* // outerCtx.width = 76 (80 - 4 overhead)
|
|
111
|
-
*
|
|
112
|
-
* // Nested component at 50% width
|
|
113
|
-
* const innerWidth = resolveWidth("50%", outerCtx);
|
|
114
|
-
* const innerOpts = { width: innerWidth, padding: 1 };
|
|
115
|
-
* const innerCtx = createLayoutContext(innerOpts, outerCtx);
|
|
116
|
-
* // innerCtx.width = 34 (38 - 4 overhead)
|
|
117
|
-
* ```
|
|
118
|
-
*/
|
|
119
|
-
declare function createLayoutContext(options: BoxOptions, parent?: LayoutContext): LayoutContext;
|
|
120
|
-
/**
|
|
121
|
-
* Vertical alignment for horizontal layout.
|
|
122
|
-
*/
|
|
123
|
-
type Alignment = "top" | "center" | "bottom";
|
|
124
|
-
/**
|
|
125
|
-
* Options for horizontal layout.
|
|
126
|
-
*/
|
|
127
|
-
interface HorizontalLayoutOptions {
|
|
128
|
-
/** Gap (in characters) between blocks */
|
|
129
|
-
gap?: number;
|
|
130
|
-
/** Vertical alignment of blocks */
|
|
131
|
-
align?: Alignment;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Options for vertical layout.
|
|
135
|
-
*/
|
|
136
|
-
interface VerticalLayoutOptions {
|
|
137
|
-
/** Gap (in lines) between blocks */
|
|
138
|
-
gap?: number;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Joins multiple text blocks horizontally (side by side).
|
|
142
|
-
*
|
|
143
|
-
* Handles blocks of different heights by aligning them according
|
|
144
|
-
* to the `align` option. Blocks are padded to maintain alignment.
|
|
145
|
-
*
|
|
146
|
-
* @param blocks - Array of text blocks to join
|
|
147
|
-
* @param options - Layout options
|
|
148
|
-
* @returns Combined string with blocks side by side
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* ```typescript
|
|
152
|
-
* import { joinHorizontal } from "@outfitter/cli/render";
|
|
153
|
-
* import { renderBox } from "@outfitter/cli/render";
|
|
154
|
-
*
|
|
155
|
-
* const left = renderBox({ content: "Left", borderStyle: "single" });
|
|
156
|
-
* const right = renderBox({ content: "Right", borderStyle: "single" });
|
|
157
|
-
*
|
|
158
|
-
* console.log(joinHorizontal([left, right], { gap: 2 }));
|
|
159
|
-
* // ┌──────┐ ┌───────┐
|
|
160
|
-
* // │ Left │ │ Right │
|
|
161
|
-
* // └──────┘ └───────┘
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
declare function joinHorizontal(blocks: string[], options?: HorizontalLayoutOptions): string;
|
|
165
|
-
/**
|
|
166
|
-
* Joins multiple text blocks vertically (stacked).
|
|
167
|
-
*
|
|
168
|
-
* @param blocks - Array of text blocks to stack
|
|
169
|
-
* @param options - Layout options
|
|
170
|
-
* @returns Combined string with blocks stacked
|
|
171
|
-
*
|
|
172
|
-
* @example
|
|
173
|
-
* ```typescript
|
|
174
|
-
* import { joinVertical, renderHeading, renderSeparator } from "@outfitter/cli/render";
|
|
175
|
-
*
|
|
176
|
-
* const heading = renderHeading("Section Title");
|
|
177
|
-
* const separator = renderSeparator({ width: 20 });
|
|
178
|
-
* const content = "Some content here.";
|
|
179
|
-
*
|
|
180
|
-
* console.log(joinVertical([heading, separator, content], { gap: 1 }));
|
|
181
|
-
* // SECTION TITLE
|
|
182
|
-
* // =============
|
|
183
|
-
* //
|
|
184
|
-
* // ────────────────────
|
|
185
|
-
* //
|
|
186
|
-
* // Some content here.
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
declare function joinVertical(blocks: string[], options?: VerticalLayoutOptions): string;
|
|
190
|
-
export { getTerminalWidth, getBoxOverhead, getContentWidth, resolveWidth, createLayoutContext, Alignment, HorizontalLayoutOptions, VerticalLayoutOptions, joinHorizontal, joinVertical };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Result, ValidationError } from "@outfitter/contracts";
|
|
2
|
-
/**
|
|
3
|
-
* Represents a date range with start and end dates.
|
|
4
|
-
*/
|
|
5
|
-
interface DateRange {
|
|
6
|
-
/** Start of the range (inclusive, at 00:00:00.000) */
|
|
7
|
-
start: Date;
|
|
8
|
-
/** End of the range (inclusive, at 23:59:59.999) */
|
|
9
|
-
end: Date;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Returns a new Date set to the start of the day (00:00:00.000).
|
|
13
|
-
*
|
|
14
|
-
* @param date - The date to adjust
|
|
15
|
-
* @returns A new Date object at 00:00:00.000 on the same day
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* startOfDay(new Date("2024-06-15T14:30:00Z"))
|
|
20
|
-
* // Returns 2024-06-15T00:00:00.000 (local time)
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare function startOfDay(date: Date): Date;
|
|
24
|
-
/**
|
|
25
|
-
* Returns a new Date set to the end of the day (23:59:59.999).
|
|
26
|
-
*
|
|
27
|
-
* @param date - The date to adjust
|
|
28
|
-
* @returns A new Date object at 23:59:59.999 on the same day
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* endOfDay(new Date("2024-06-15T14:30:00Z"))
|
|
33
|
-
* // Returns 2024-06-15T23:59:59.999 (local time)
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
declare function endOfDay(date: Date): Date;
|
|
37
|
-
/**
|
|
38
|
-
* Parses date range strings into structured DateRange.
|
|
39
|
-
*
|
|
40
|
-
* Supported formats:
|
|
41
|
-
* - `"today"` - Current day (00:00:00 to 23:59:59)
|
|
42
|
-
* - `"yesterday"` - Previous day
|
|
43
|
-
* - `"last week"` - Last 7 days
|
|
44
|
-
* - `"last month"` - Last 30 days
|
|
45
|
-
* - `"2024-01-01..2024-12-31"` - Explicit range
|
|
46
|
-
* - `"2024-01-01"` - Single day
|
|
47
|
-
*
|
|
48
|
-
* @param input - The date range string to parse
|
|
49
|
-
* @returns Result containing DateRange on success, or ValidationError on failure
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* parseDateRange("today")
|
|
54
|
-
* // Ok({ start: today 00:00, end: today 23:59:59 })
|
|
55
|
-
*
|
|
56
|
-
* parseDateRange("2024-01-01..2024-12-31")
|
|
57
|
-
* // Ok({ start: 2024-01-01 00:00, end: 2024-12-31 23:59:59 })
|
|
58
|
-
*
|
|
59
|
-
* parseDateRange("invalid")
|
|
60
|
-
* // Err(ValidationError)
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
declare function parseDateRange(input: string): Result<DateRange, InstanceType<typeof ValidationError>>;
|
|
64
|
-
export { DateRange, startOfDay, endOfDay, parseDateRange };
|