@visulima/tui 2.0.0 → 3.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 +13 -0
- package/dist/components/box.d.ts +25 -25
- package/dist/components/canvas.d.ts +26 -31
- package/dist/components/cursor.d.ts +39 -44
- package/dist/components/error-overview.d.ts +1 -3
- package/dist/components/error-overview.js +1 -1
- package/dist/components/newline.d.ts +6 -8
- package/dist/components/spacer.d.ts +4 -4
- package/dist/components/static-render.d.ts +9 -40
- package/dist/components/static.d.ts +13 -13
- package/dist/components/text.d.ts +34 -47
- package/dist/components/transform.d.ts +7 -11
- package/dist/core/index.d.ts +11 -11
- package/dist/core/index.js +1 -1
- package/dist/ink/canvas/index.d.ts +10 -10
- package/dist/ink/hooks/use-animation.d.ts +22 -22
- package/dist/ink/hooks/use-app.d.ts +3 -3
- package/dist/ink/hooks/use-box-metrics.d.ts +16 -16
- package/dist/ink/hooks/use-clipboard.d.ts +16 -16
- package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
- package/dist/ink/hooks/use-console-capture.d.ts +19 -19
- package/dist/ink/hooks/use-cursor.d.ts +6 -6
- package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
- package/dist/ink/hooks/use-focus.d.ts +14 -18
- package/dist/ink/hooks/use-form.d.ts +32 -32
- package/dist/ink/hooks/use-hotkey.d.ts +17 -17
- package/dist/ink/hooks/use-input.d.ts +92 -92
- package/dist/ink/hooks/use-input.js +2 -2
- package/dist/ink/hooks/use-interval.d.ts +14 -14
- package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
- package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
- package/dist/ink/hooks/use-key-chord.d.ts +15 -15
- package/dist/ink/hooks/use-paste.d.ts +38 -38
- package/dist/ink/hooks/use-paste.js +1 -1
- package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
- package/dist/ink/hooks/use-persistent-state.js +2 -2
- package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
- package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
- package/dist/ink/hooks/use-stderr.d.ts +6 -6
- package/dist/ink/hooks/use-stderr.js +1 -1
- package/dist/ink/hooks/use-stdin.d.ts +10 -10
- package/dist/ink/hooks/use-stdin.js +1 -1
- package/dist/ink/hooks/use-stdout.d.ts +6 -6
- package/dist/ink/hooks/use-stdout.js +1 -1
- package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
- package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
- package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
- package/dist/ink/hooks/use-text-selection.d.ts +18 -18
- package/dist/ink/hooks/use-timeout.d.ts +11 -11
- package/dist/ink/hooks/use-timer.d.ts +19 -19
- package/dist/ink/hooks/use-window-size.d.ts +8 -8
- package/dist/ink/hooks/use-window-size.js +1 -1
- package/dist/ink/index.d.ts +109 -122
- package/dist/ink/index.js +1 -1
- package/dist/ink/mouse/use-element-position.d.ts +6 -6
- package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
- package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
- package/dist/ink/mouse/use-mouse.d.ts +1 -1
- package/dist/ink/mouse/use-on-mouse-click.d.ts +3 -3
- package/dist/ink/mouse/use-on-mouse-hover.d.ts +2 -2
- package/dist/ink/mouse/use-on-mouse-state.d.ts +2 -2
- package/dist/ink/public/cursor.d.ts +21 -21
- package/dist/ink/public/dom.d.ts +2 -2
- package/dist/ink/public/highlighter.d.ts +16 -26
- package/dist/ink/public/input.d.ts +6 -6
- package/dist/ink/public/styles.d.ts +1 -1
- package/dist/ink/public/utils.d.ts +2 -2
- package/dist/packem_shared/{DevTools-D9tfChBc.js → DevTools-CZ-O0Ckm.js} +1 -1
- package/dist/packem_shared/FocusContext-BWFqf9kb.js +1 -0
- package/dist/packem_shared/InputParser-CUAGWKQQ.js +2 -0
- package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
- package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
- package/dist/packem_shared/{TuiApp-DjIgv5Sk.js → TuiApp-CCVaiKbf.js} +1 -1
- package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
- package/dist/packem_shared/{buffer.d-j_dP5JyC.d.ts → buffer.d-CttIC480.d.ts} +26 -26
- package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
- package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
- package/dist/packem_shared/createInlineLoop-BMDYJkRp.js +2 -0
- package/dist/packem_shared/{dom.d-g-nsYquD.d.ts → dom.d-CLGlidfI.d.ts} +138 -151
- package/dist/packem_shared/{input.d-D-Yxqha8.d.ts → input.d-CL_4MfL-.d.ts} +30 -24
- package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
- package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
- package/dist/packem_shared/reconciler-D4fi5NfR.js +1 -0
- package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
- package/dist/packem_shared/render-CPVY5vpQ.js +1 -0
- package/dist/packem_shared/render-CvhjGwOg.js +24 -0
- package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
- package/dist/packem_shared/{renderToString-DqLFFPvO.js → renderToString-B1LgWcJe.js} +1 -1
- package/dist/packem_shared/{renderToString-DkTmJPaS.js → renderToString-Df6HST7u.js} +1 -1
- package/dist/packem_shared/{selection.d-KWphH--_.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
- package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
- package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
- package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
- package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
- package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
- package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
- package/dist/react/index.d.ts +160 -178
- package/dist/react/index.js +1 -1
- package/dist/testing/index.d.ts +151 -151
- package/dist/testing/index.js +1 -1
- package/index.js +52 -52
- package/package.json +13 -13
- package/dist/packem_shared/FocusContext-C2Sosxa4.js +0 -1
- package/dist/packem_shared/InputParser-CiBitCva.js +0 -2
- package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
- package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +0 -56
- package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
- package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
- package/dist/packem_shared/createInlineLoop-BT40Wpmx.js +0 -2
- package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
- package/dist/packem_shared/reconciler-ClpU7Y-V.js +0 -1
- package/dist/packem_shared/reconciler-DhUGYWCr.js +0 -1
- package/dist/packem_shared/render-D7aV_hO1.js +0 -24
- package/dist/packem_shared/render-DMcWfI6-.js +0 -1
- package/dist/packem_shared/render.d-BvfwvSCx.d.ts +0 -435
- package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
- package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
- package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
- package/dist/packem_shared/styles.d-D7iZuNC-.d.ts +0 -492
- package/dist/packem_shared/utils-C8l_3Dzw.js +0 -1
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
+
import { LiteralUnion } from 'type-fest';
|
|
3
|
+
import 'yoga-layout';
|
|
4
|
+
/**
|
|
5
|
+
Style of the box border.
|
|
6
|
+
*/
|
|
7
|
+
type BoxStyle = {
|
|
8
|
+
readonly topLeft: string;
|
|
9
|
+
readonly top: string;
|
|
10
|
+
readonly topRight: string;
|
|
11
|
+
readonly right: string;
|
|
12
|
+
readonly bottomRight: string;
|
|
13
|
+
readonly bottom: string;
|
|
14
|
+
readonly bottomLeft: string;
|
|
15
|
+
readonly left: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
All box styles.
|
|
19
|
+
*/
|
|
20
|
+
type Boxes = {
|
|
21
|
+
/**
|
|
22
|
+
@example
|
|
23
|
+
```
|
|
24
|
+
┌────┐
|
|
25
|
+
│ │
|
|
26
|
+
└────┘
|
|
27
|
+
```
|
|
28
|
+
*/
|
|
29
|
+
readonly single: BoxStyle;
|
|
30
|
+
/**
|
|
31
|
+
@example
|
|
32
|
+
```
|
|
33
|
+
╔════╗
|
|
34
|
+
║ ║
|
|
35
|
+
╚════╝
|
|
36
|
+
```
|
|
37
|
+
*/
|
|
38
|
+
readonly double: BoxStyle;
|
|
39
|
+
/**
|
|
40
|
+
@example
|
|
41
|
+
```
|
|
42
|
+
╭────╮
|
|
43
|
+
│ │
|
|
44
|
+
╰────╯
|
|
45
|
+
```
|
|
46
|
+
*/
|
|
47
|
+
readonly round: BoxStyle;
|
|
48
|
+
/**
|
|
49
|
+
@example
|
|
50
|
+
```
|
|
51
|
+
┏━━━━┓
|
|
52
|
+
┃ ┃
|
|
53
|
+
┗━━━━┛
|
|
54
|
+
```
|
|
55
|
+
*/
|
|
56
|
+
readonly bold: BoxStyle;
|
|
57
|
+
/**
|
|
58
|
+
@example
|
|
59
|
+
```
|
|
60
|
+
╓────╖
|
|
61
|
+
║ ║
|
|
62
|
+
╙────╜
|
|
63
|
+
```
|
|
64
|
+
*/
|
|
65
|
+
readonly singleDouble: BoxStyle;
|
|
66
|
+
/**
|
|
67
|
+
@example
|
|
68
|
+
```
|
|
69
|
+
╒════╕
|
|
70
|
+
│ │
|
|
71
|
+
╘════╛
|
|
72
|
+
```
|
|
73
|
+
*/
|
|
74
|
+
readonly doubleSingle: BoxStyle;
|
|
75
|
+
/**
|
|
76
|
+
@example
|
|
77
|
+
```
|
|
78
|
+
+----+
|
|
79
|
+
| |
|
|
80
|
+
+----+
|
|
81
|
+
```
|
|
82
|
+
*/
|
|
83
|
+
readonly classic: BoxStyle;
|
|
84
|
+
/**
|
|
85
|
+
@example
|
|
86
|
+
```
|
|
87
|
+
↘↓↓↓↓↙
|
|
88
|
+
→ ←
|
|
89
|
+
↗↑↑↑↑↖
|
|
90
|
+
```
|
|
91
|
+
*/
|
|
92
|
+
readonly arrow: BoxStyle;
|
|
93
|
+
};
|
|
94
|
+
type Styles = {
|
|
95
|
+
/**
|
|
96
|
+
* It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
|
|
97
|
+
* See [align-content](https://css-tricks.com/almanac/properties/a/align-content/).
|
|
98
|
+
*/
|
|
99
|
+
readonly alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
100
|
+
/**
|
|
101
|
+
* The align-items property defines the default behavior for how items are laid out along the cross axis (perpendicular to the main axis).
|
|
102
|
+
* See [align-items](https://css-tricks.com/almanac/properties/a/align-items/).
|
|
103
|
+
*/
|
|
104
|
+
readonly alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
|
|
105
|
+
/**
|
|
106
|
+
* It makes possible to override the align-items value for specific flex items.
|
|
107
|
+
* See [align-self](https://css-tricks.com/almanac/properties/a/align-self/).
|
|
108
|
+
*/
|
|
109
|
+
readonly alignSelf?: "flex-start" | "center" | "flex-end" | "auto" | "stretch" | "baseline";
|
|
110
|
+
/**
|
|
111
|
+
* Defines the aspect ratio (width/height) for the element.
|
|
112
|
+
*
|
|
113
|
+
* Use it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.
|
|
114
|
+
*/
|
|
115
|
+
readonly aspectRatio?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Background color for the element.
|
|
118
|
+
*
|
|
119
|
+
* Accepts the same values as `color` in the `<Text>` component.
|
|
120
|
+
*/
|
|
121
|
+
readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
122
|
+
/**
|
|
123
|
+
* Change border background color. A shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.
|
|
124
|
+
*/
|
|
125
|
+
readonly borderBackgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
126
|
+
/**
|
|
127
|
+
* Determines whether the bottom border is visible.
|
|
128
|
+
* @default true
|
|
129
|
+
*/
|
|
130
|
+
readonly borderBottom?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Change the bottom border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
133
|
+
*/
|
|
134
|
+
readonly borderBottomBackgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
135
|
+
/**
|
|
136
|
+
* Change the bottom border color. Accepts the same values as `color` in `Text` component.
|
|
137
|
+
*/
|
|
138
|
+
readonly borderBottomColor?: LiteralUnion<AnsiColors, string>;
|
|
139
|
+
/**
|
|
140
|
+
* Dim the bottom border color.
|
|
141
|
+
* @default false
|
|
142
|
+
*/
|
|
143
|
+
readonly borderBottomDimColor?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Text to display embedded in the bottom border line.
|
|
146
|
+
* Rendered as: `└─ title ─────────┘`
|
|
147
|
+
*/
|
|
148
|
+
readonly borderBottomTitle?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Alignment of the bottom border title.
|
|
151
|
+
* @default "left"
|
|
152
|
+
*/
|
|
153
|
+
readonly borderBottomTitleAlignment?: "center" | "left" | "right";
|
|
154
|
+
/**
|
|
155
|
+
* Change border color. A shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor`, and `borderLeftColor`.
|
|
156
|
+
*/
|
|
157
|
+
readonly borderColor?: LiteralUnion<AnsiColors, string>;
|
|
158
|
+
/**
|
|
159
|
+
* Dim the border color. A shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor`, and `borderRightDimColor`.
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
readonly borderDimColor?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Determines whether the left border is visible.
|
|
165
|
+
* @default true
|
|
166
|
+
*/
|
|
167
|
+
readonly borderLeft?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Change the left border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
170
|
+
*/
|
|
171
|
+
readonly borderLeftBackgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
172
|
+
/**
|
|
173
|
+
* Change the left border color. Accepts the same values as `color` in `Text` component.
|
|
174
|
+
*/
|
|
175
|
+
readonly borderLeftColor?: LiteralUnion<AnsiColors, string>;
|
|
176
|
+
/**
|
|
177
|
+
* Dim the left border color.
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
readonly borderLeftDimColor?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Determines whether the right border is visible.
|
|
183
|
+
* @default true
|
|
184
|
+
*/
|
|
185
|
+
readonly borderRight?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Change the right border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
188
|
+
*/
|
|
189
|
+
readonly borderRightBackgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
190
|
+
/**
|
|
191
|
+
* Change the right border color. Accepts the same values as `color` in `Text` component.
|
|
192
|
+
*/
|
|
193
|
+
readonly borderRightColor?: LiteralUnion<AnsiColors, string>;
|
|
194
|
+
/**
|
|
195
|
+
* Dim the right border color.
|
|
196
|
+
* @default false
|
|
197
|
+
*/
|
|
198
|
+
readonly borderRightDimColor?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Add a border with a specified style. If `borderStyle` is `undefined` (the default), no border will be added.
|
|
201
|
+
*/
|
|
202
|
+
readonly borderStyle?: keyof Boxes | BoxStyle;
|
|
203
|
+
/**
|
|
204
|
+
* Determines whether the top border is visible.
|
|
205
|
+
* @default true
|
|
206
|
+
*/
|
|
207
|
+
readonly borderTop?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Change the top border background color. Accepts the same values as `backgroundColor` in `Text` component.
|
|
210
|
+
*/
|
|
211
|
+
readonly borderTopBackgroundColor?: LiteralUnion<AnsiColors, string>;
|
|
212
|
+
/**
|
|
213
|
+
* Change the top border color. Accepts the same values as `color` in `Text` component.
|
|
214
|
+
*/
|
|
215
|
+
readonly borderTopColor?: LiteralUnion<AnsiColors, string>;
|
|
216
|
+
/**
|
|
217
|
+
* Dim the top border color.
|
|
218
|
+
* @default false
|
|
219
|
+
*/
|
|
220
|
+
readonly borderTopDimColor?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Text to display on the right side of the top border line.
|
|
223
|
+
* Rendered as: `┌─ title ──── rightTitle ─┐`
|
|
224
|
+
*/
|
|
225
|
+
readonly borderTopRightTitle?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Text to display embedded in the top border line.
|
|
228
|
+
* Rendered as: `┌─ title ─────────┐`
|
|
229
|
+
*/
|
|
230
|
+
readonly borderTopTitle?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Alignment of the top border title.
|
|
233
|
+
* @default "left"
|
|
234
|
+
*/
|
|
235
|
+
readonly borderTopTitleAlignment?: "center" | "left" | "right";
|
|
236
|
+
/**
|
|
237
|
+
* Bottom offset for positioned elements.
|
|
238
|
+
*/
|
|
239
|
+
readonly bottom?: number | string;
|
|
240
|
+
/**
|
|
241
|
+
* Size of the gap between an element's columns.
|
|
242
|
+
*/
|
|
243
|
+
readonly columnGap?: number;
|
|
244
|
+
/**
|
|
245
|
+
* Set this property to `none` to hide the element.
|
|
246
|
+
*/
|
|
247
|
+
readonly display?: "flex" | "none";
|
|
248
|
+
/**
|
|
249
|
+
* It specifies the initial size of the flex item, before any available space is distributed according to the flex factors.
|
|
250
|
+
* See [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).
|
|
251
|
+
*/
|
|
252
|
+
readonly flexBasis?: number | string;
|
|
253
|
+
/**
|
|
254
|
+
* It establishes the main-axis, thus defining the direction flex items are placed in the flex container.
|
|
255
|
+
* See [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).
|
|
256
|
+
*/
|
|
257
|
+
readonly flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
|
|
258
|
+
/**
|
|
259
|
+
* This property defines the ability for a flex item to grow if necessary.
|
|
260
|
+
* See [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).
|
|
261
|
+
*/
|
|
262
|
+
readonly flexGrow?: number;
|
|
263
|
+
/**
|
|
264
|
+
* It specifies the “flex shrink factor”, which determines how much the flex item will shrink relative to the rest of the flex items in the flex container when there isn’t enough space on the row.
|
|
265
|
+
* See [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).
|
|
266
|
+
*/
|
|
267
|
+
readonly flexShrink?: number;
|
|
268
|
+
/**
|
|
269
|
+
* It defines whether the flex items are forced in a single line or can be flowed into multiple lines. If set to multiple lines, it also defines the cross-axis which determines the direction new lines are stacked in.
|
|
270
|
+
* See [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/).
|
|
271
|
+
*/
|
|
272
|
+
readonly flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
273
|
+
/**
|
|
274
|
+
* Size of the gap between an element's columns and rows. A shorthand for `columnGap` and `rowGap`.
|
|
275
|
+
*/
|
|
276
|
+
readonly gap?: number;
|
|
277
|
+
/**
|
|
278
|
+
* Height of the element in lines (rows). You can also set it as a percentage, which will calculate the height based on the height of the parent element.
|
|
279
|
+
*/
|
|
280
|
+
readonly height?: number | string;
|
|
281
|
+
/**
|
|
282
|
+
* It defines the alignment along the main axis.
|
|
283
|
+
* See [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).
|
|
284
|
+
*/
|
|
285
|
+
readonly justifyContent?: "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "center";
|
|
286
|
+
/**
|
|
287
|
+
* Left offset for positioned elements.
|
|
288
|
+
*/
|
|
289
|
+
readonly left?: number | string;
|
|
290
|
+
/**
|
|
291
|
+
* Margin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft`, and `marginRight`.
|
|
292
|
+
*/
|
|
293
|
+
readonly margin?: number;
|
|
294
|
+
/**
|
|
295
|
+
* Bottom margin.
|
|
296
|
+
*/
|
|
297
|
+
readonly marginBottom?: number;
|
|
298
|
+
/**
|
|
299
|
+
* Left margin.
|
|
300
|
+
*/
|
|
301
|
+
readonly marginLeft?: number;
|
|
302
|
+
/**
|
|
303
|
+
* Right margin.
|
|
304
|
+
*/
|
|
305
|
+
readonly marginRight?: number;
|
|
306
|
+
/**
|
|
307
|
+
* Top margin.
|
|
308
|
+
*/
|
|
309
|
+
readonly marginTop?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Horizontal margin. Equivalent to setting `marginLeft` and `marginRight`.
|
|
312
|
+
*/
|
|
313
|
+
readonly marginX?: number;
|
|
314
|
+
/**
|
|
315
|
+
* Vertical margin. Equivalent to setting `marginTop` and `marginBottom`.
|
|
316
|
+
*/
|
|
317
|
+
readonly marginY?: number;
|
|
318
|
+
/**
|
|
319
|
+
* Sets a maximum height of the element in lines (rows). You can also set it as a percentage, which will calculate the maximum height based on the height of the parent element.
|
|
320
|
+
*/
|
|
321
|
+
readonly maxHeight?: number | string;
|
|
322
|
+
/**
|
|
323
|
+
* Caps how far the stable scroll height is allowed to grow beyond the
|
|
324
|
+
* content currently in the box, in rows. Only applies when both
|
|
325
|
+
* `stableScrollback` and `overflowToBackbuffer` are enabled.
|
|
326
|
+
*
|
|
327
|
+
* Without a cap, `scrollHeight` for a stable-scrollback box never shrinks
|
|
328
|
+
* and grows monotonically for the lifetime of the box (long-running logs,
|
|
329
|
+
* streaming output). That makes the scrollbar/scrollTop math treat an
|
|
330
|
+
* ever-growing region as scrollable even after the content is gone. This
|
|
331
|
+
* bounds the retained history to at most `maxScrollbackLength` rows past
|
|
332
|
+
* the current content. Omit for the previous unbounded behavior.
|
|
333
|
+
*
|
|
334
|
+
* It also bounds a single-frame backbuffer burst to at most this many rows
|
|
335
|
+
* on a large `scrollTop` jump. A value of `0` therefore disables
|
|
336
|
+
* terminal-scrollback emission entirely (scrolled-off lines are still
|
|
337
|
+
* clipped from the live view, just not flushed to history) — use it to
|
|
338
|
+
* cap growth without keeping any backbuffer, or omit it for unbounded
|
|
339
|
+
* retention.
|
|
340
|
+
*/
|
|
341
|
+
readonly maxScrollbackLength?: number;
|
|
342
|
+
/**
|
|
343
|
+
* Sets a maximum width of the element.
|
|
344
|
+
* Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
|
|
345
|
+
*/
|
|
346
|
+
readonly maxWidth?: number | string;
|
|
347
|
+
/**
|
|
348
|
+
* Sets a minimum height of the element in lines (rows). You can also set it as a percentage, which will calculate the minimum height based on the height of the parent element.
|
|
349
|
+
*/
|
|
350
|
+
readonly minHeight?: number | string;
|
|
351
|
+
/**
|
|
352
|
+
* Sets a minimum width of the element.
|
|
353
|
+
* Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
|
|
354
|
+
*/
|
|
355
|
+
readonly minWidth?: number | string;
|
|
356
|
+
/**
|
|
357
|
+
* Behavior for an element's overflow in both directions.
|
|
358
|
+
* @default 'visible'
|
|
359
|
+
*/
|
|
360
|
+
readonly overflow?: "visible" | "hidden" | "scroll";
|
|
361
|
+
/**
|
|
362
|
+
* If true, content that is scrolled out of the top of the box (when overflowY is 'scroll')
|
|
363
|
+
* is flushed into the terminal emulator's real scrollback history instead
|
|
364
|
+
* of being clipped and discarded. Scrolling back up in the terminal reveals
|
|
365
|
+
* the original lines.
|
|
366
|
+
*
|
|
367
|
+
* Constraints:
|
|
368
|
+
* - Inline mode only. In alternate-screen mode the terminal has no
|
|
369
|
+
* scrollback, so this is a no-op. Non-TTY/piped output is also a no-op
|
|
370
|
+
* (content is clipped as before).
|
|
371
|
+
* - Exactly one scrollable region in the app may enable
|
|
372
|
+
* `overflowToBackbuffer`. Results are undefined with more than one.
|
|
373
|
+
*
|
|
374
|
+
* Each scrolled-off line is emitted exactly once; scrolling back up never
|
|
375
|
+
* re-emits. Pair with `stableScrollback` to keep `scrollTop` math stable as
|
|
376
|
+
* history accumulates, and `maxScrollbackLength` to bound a single-frame
|
|
377
|
+
* burst on a large `scrollTop` jump.
|
|
378
|
+
* @default false
|
|
379
|
+
*/
|
|
380
|
+
readonly overflowToBackbuffer?: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Behavior for an element's overflow in the horizontal direction.
|
|
383
|
+
* @default 'visible'
|
|
384
|
+
*/
|
|
385
|
+
readonly overflowX?: "visible" | "hidden" | "scroll";
|
|
386
|
+
/**
|
|
387
|
+
* Behavior for an element's overflow in the vertical direction.
|
|
388
|
+
* @default 'visible'
|
|
389
|
+
*/
|
|
390
|
+
readonly overflowY?: "visible" | "hidden" | "scroll";
|
|
391
|
+
/**
|
|
392
|
+
* Padding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft`, and `paddingRight`.
|
|
393
|
+
*/
|
|
394
|
+
readonly padding?: number;
|
|
395
|
+
/**
|
|
396
|
+
* Bottom padding.
|
|
397
|
+
*/
|
|
398
|
+
readonly paddingBottom?: number;
|
|
399
|
+
/**
|
|
400
|
+
* Left padding.
|
|
401
|
+
*/
|
|
402
|
+
readonly paddingLeft?: number;
|
|
403
|
+
/**
|
|
404
|
+
* Right padding.
|
|
405
|
+
*/
|
|
406
|
+
readonly paddingRight?: number;
|
|
407
|
+
/**
|
|
408
|
+
* Top padding.
|
|
409
|
+
*/
|
|
410
|
+
readonly paddingTop?: number;
|
|
411
|
+
/**
|
|
412
|
+
* Horizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.
|
|
413
|
+
*/
|
|
414
|
+
readonly paddingX?: number;
|
|
415
|
+
/**
|
|
416
|
+
* Vertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.
|
|
417
|
+
*/
|
|
418
|
+
readonly paddingY?: number;
|
|
419
|
+
/**
|
|
420
|
+
* Controls how the element is positioned.
|
|
421
|
+
*
|
|
422
|
+
* When `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.
|
|
423
|
+
*/
|
|
424
|
+
readonly position?: "absolute" | "relative" | "static";
|
|
425
|
+
/**
|
|
426
|
+
* Right offset for positioned elements.
|
|
427
|
+
*/
|
|
428
|
+
readonly right?: number | string;
|
|
429
|
+
/**
|
|
430
|
+
* Size of the gap between an element's rows.
|
|
431
|
+
*/
|
|
432
|
+
readonly rowGap?: number;
|
|
433
|
+
/**
|
|
434
|
+
* Color of the scrollbar thumb when overflow is set to 'scroll'.
|
|
435
|
+
*/
|
|
436
|
+
readonly scrollbarThumbColor?: LiteralUnion<AnsiColors, string>;
|
|
437
|
+
/**
|
|
438
|
+
* Horizontal scroll position (in columns). Only applies when overflowX or overflow is 'scroll'.
|
|
439
|
+
*/
|
|
440
|
+
readonly scrollLeft?: number;
|
|
441
|
+
/**
|
|
442
|
+
* Vertical scroll position (in rows). Only applies when overflowY or overflow is 'scroll'.
|
|
443
|
+
*/
|
|
444
|
+
readonly scrollTop?: number;
|
|
445
|
+
/**
|
|
446
|
+
* If true, and `overflowToBackbuffer` is also enabled, the `scrollHeight` of the box
|
|
447
|
+
* will never decrease as long as the existing history remains valid.
|
|
448
|
+
* This prevents the terminal's scrollback from being corrupted when content shrinks.
|
|
449
|
+
*
|
|
450
|
+
* Growth is bounded by `maxScrollbackLength` (if set); otherwise the stable
|
|
451
|
+
* height grows monotonically for the lifetime of the box.
|
|
452
|
+
* @default false
|
|
453
|
+
*/
|
|
454
|
+
readonly stableScrollback?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Controls how text wraps when it exceeds the container width.
|
|
457
|
+
*
|
|
458
|
+
* - `wrap` (default) — Wrap at word boundaries; break inside words only when a single word exceeds the width.
|
|
459
|
+
* - `wrap-anywhere` — Break at any character boundary, even when a whitespace break exists earlier.
|
|
460
|
+
* - `wrap-preserve-words` — Wrap at word boundaries; never break inside words (long words may overflow).
|
|
461
|
+
* - `wrap-strict` — Enforce exact width; always break at the column limit.
|
|
462
|
+
* - `hard` — Alias for `wrap-strict`. Fills each line to the full column width, breaking words mid-word as needed.
|
|
463
|
+
* - `truncate` / `truncate-end` — Truncate at the end with an ellipsis.
|
|
464
|
+
* - `truncate-start` — Truncate at the start with an ellipsis.
|
|
465
|
+
* - `truncate-middle` — Truncate in the middle with an ellipsis.
|
|
466
|
+
*/
|
|
467
|
+
readonly textWrap?: "hard" | "wrap" | "wrap-anywhere" | "wrap-preserve-words" | "wrap-strict" | "end" | "middle" | "truncate-end" | "truncate" | "truncate-middle" | "truncate-start";
|
|
468
|
+
/**
|
|
469
|
+
* Top offset for positioned elements.
|
|
470
|
+
*/
|
|
471
|
+
readonly top?: number | string;
|
|
472
|
+
/**
|
|
473
|
+
* Determines whether the user can select text within this element.
|
|
474
|
+
* - `auto`: Default behavior, text is selectable.
|
|
475
|
+
* - `none`: Text cannot be selected.
|
|
476
|
+
* - `text`: Only text can be selected.
|
|
477
|
+
* - `all`: All content is selected on click.
|
|
478
|
+
*/
|
|
479
|
+
readonly userSelect?: "auto" | "none" | "text" | "all";
|
|
480
|
+
/**
|
|
481
|
+
* Width of the element in spaces. You can also set it as a percentage, which will calculate the width based on the width of the parent element.
|
|
482
|
+
*/
|
|
483
|
+
readonly width?: number | string;
|
|
484
|
+
};
|
|
485
|
+
export { Styles as S };
|
package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts}
RENAMED
|
@@ -6,14 +6,14 @@ type TerminalPalette = {
|
|
|
6
6
|
readonly foreground: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* Check if the terminal likely supports OSC palette queries.
|
|
10
|
-
*/
|
|
9
|
+
* Check if the terminal likely supports OSC palette queries.
|
|
10
|
+
*/
|
|
11
11
|
declare const isTerminalPaletteQuerySupported: () => boolean;
|
|
12
12
|
/**
|
|
13
|
-
* Query the terminal for its current color palette.
|
|
14
|
-
* @param stdin Readable stream (typically process.stdin in raw mode)
|
|
15
|
-
* @param stdout Writable stream (typically process.stdout)
|
|
16
|
-
* @param timeout Per-query timeout in milliseconds (default: 500)
|
|
17
|
-
*/
|
|
13
|
+
* Query the terminal for its current color palette.
|
|
14
|
+
* @param stdin Readable stream (typically process.stdin in raw mode)
|
|
15
|
+
* @param stdout Writable stream (typically process.stdout)
|
|
16
|
+
* @param timeout Per-query timeout in milliseconds (default: 500)
|
|
17
|
+
*/
|
|
18
18
|
declare const queryTerminalPalette: (stdin: NodeJS.ReadableStream, stdout: Writable, timeout?: number) => Promise<Partial<TerminalPalette>>;
|
|
19
19
|
export { TerminalPalette as T, isTerminalPaletteQuerySupported as i, queryTerminalPalette as q };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as w}from"node:module";let _;const b=e=>(_??=w(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,s]=o.versions.node.split(".").map(Number);if(r>22||r===22&&s>=3||r===20&&s>=16)return o.getBuiltinModule(e)}return b(e)},n=o,{execFileSync:g}=m("node:child_process"),c=m("node:fs"),h=m("node:tty"),d=80,p=24,a=(e,r,{shell:s,env:t}={})=>g(e,r,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:s,env:t}).trim(),u=(e,r)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(r,10)}),N=(e,r)=>{const{columns:s,rows:t}=u(e,r);if(!(Number.isNaN(s)||Number.isNaN(t))&&!(s===d&&t===p))return{columns:s,rows:t}},y=()=>{if(n.platform!=="linux")return!0;try{const e=c.readFileSync("/proc/self/stat","utf8"),r=e.lastIndexOf(") ");if(r===-1)return!1;const s=e.slice(r+2).trim().split(/\s+/),t=Number.parseInt(s[2],10),i=Number.parseInt(s[5],10);return Number.isNaN(t)||Number.isNaN(i)||i<=0?!1:t===i}catch{return!1}};function v(){const{env:e,stdout:r,stderr:s}=n;if(r?.columns&&r?.rows)return u(r.columns,r.rows);if(s?.columns&&s?.rows)return u(s.columns,s.rows);if(e.COLUMNS&&e.LINES)return u(e.COLUMNS,e.LINES);const t={columns:d,rows:p};return n.platform==="win32"?l()??t:n.platform==="darwin"?f()??l()??t:f()??l()??O()??t}const f=()=>{try{const e=n.platform==="darwin"?c.constants.O_EVTONLY|c.constants.O_NONBLOCK:c.constants.O_NONBLOCK,{columns:r,rows:s}=h.WriteStream(c.openSync("/dev/tty",e));return{columns:r,rows:s}}catch{}},l=()=>{try{const e=a("tput",["cols"],{env:{TERM:"dumb",...n.env}}),r=a("tput",["lines"],{env:{TERM:"dumb",...n.env}});if(e&&r)return N(e,r)}catch{}},O=()=>{try{if(!y())return;const e=a("resize",["-u"]).match(/\d+/g);if(e.length===2)return N(e[0],e[1])}catch{}},I=e=>{const{columns:r,rows:s}=e;if(r&&s)return{columns:r,rows:s};const t=v();return{columns:r||t.columns||80,rows:s||t.rows||24}};export{I as g};
|