console-toolkit 1.2.8 → 1.2.10
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 +70 -25
- package/package.json +26 -6
- package/src/alphanumeric/arrows.d.ts +48 -0
- package/src/alphanumeric/arrows.js +23 -0
- package/src/alphanumeric/fractions.d.ts +65 -0
- package/src/alphanumeric/fractions.js +49 -0
- package/src/alphanumeric/number-formatters.d.ts +91 -0
- package/src/alphanumeric/number-formatters.js +45 -1
- package/src/alphanumeric/roman.d.ts +15 -0
- package/src/alphanumeric/roman.js +12 -0
- package/src/alphanumeric/unicode-cultural-numbers.d.ts +65 -0
- package/src/alphanumeric/unicode-cultural-numbers.js +1 -0
- package/src/alphanumeric/unicode-letters.d.ts +32 -0
- package/src/alphanumeric/unicode-letters.js +8 -0
- package/src/alphanumeric/unicode-numbers.d.ts +44 -0
- package/src/alphanumeric/unicode-numbers.js +21 -0
- package/src/alphanumeric/utils.d.ts +45 -0
- package/src/alphanumeric/utils.js +26 -0
- package/src/ansi/csi.d.ts +141 -0
- package/src/ansi/csi.js +51 -2
- package/src/ansi/index.d.ts +26 -0
- package/src/ansi/sgr-constants.d.ts +173 -0
- package/src/ansi/sgr-state.d.ts +91 -0
- package/src/ansi/sgr-state.js +45 -0
- package/src/ansi/sgr.d.ts +587 -0
- package/src/ansi/sgr.js +426 -6
- package/src/box.d.ts +160 -0
- package/src/box.js +113 -12
- package/src/charts/bars/block-frac-grouped.d.ts +12 -0
- package/src/charts/bars/block-frac-grouped.js +6 -0
- package/src/charts/bars/block-frac.d.ts +34 -0
- package/src/charts/bars/block-frac.js +13 -0
- package/src/charts/bars/block-grouped.d.ts +12 -0
- package/src/charts/bars/block-grouped.js +6 -0
- package/src/charts/bars/block.d.ts +43 -0
- package/src/charts/bars/block.js +13 -0
- package/src/charts/bars/draw-grouped.d.ts +41 -0
- package/src/charts/bars/draw-grouped.js +4 -0
- package/src/charts/bars/draw-stacked.d.ts +47 -0
- package/src/charts/bars/draw-stacked.js +4 -0
- package/src/charts/bars/frac-grouped.d.ts +32 -0
- package/src/charts/bars/frac-grouped.js +13 -0
- package/src/charts/bars/plain-grouped.d.ts +12 -0
- package/src/charts/bars/plain-grouped.js +6 -0
- package/src/charts/bars/plain.d.ts +75 -0
- package/src/charts/bars/plain.js +27 -0
- package/src/charts/columns/block-frac-grouped.d.ts +12 -0
- package/src/charts/columns/block-frac-grouped.js +6 -0
- package/src/charts/columns/block-frac.d.ts +39 -0
- package/src/charts/columns/block-frac.js +13 -0
- package/src/charts/columns/block-grouped.d.ts +12 -0
- package/src/charts/columns/block-grouped.js +6 -0
- package/src/charts/columns/block.d.ts +43 -0
- package/src/charts/columns/block.js +13 -0
- package/src/charts/columns/draw-grouped.d.ts +41 -0
- package/src/charts/columns/draw-grouped.js +4 -0
- package/src/charts/columns/draw-stacked.d.ts +39 -0
- package/src/charts/columns/draw-stacked.js +4 -0
- package/src/charts/columns/frac-grouped.d.ts +37 -0
- package/src/charts/columns/frac-grouped.js +13 -0
- package/src/charts/columns/plain-grouped.d.ts +12 -0
- package/src/charts/columns/plain-grouped.js +6 -0
- package/src/charts/columns/plain.d.ts +32 -0
- package/src/charts/columns/plain.js +13 -0
- package/src/charts/themes/default.d.ts +6 -0
- package/src/charts/themes/default.js +1 -0
- package/src/charts/themes/rainbow-reversed.d.ts +6 -0
- package/src/charts/themes/rainbow-reversed.js +2 -1
- package/src/charts/themes/rainbow.d.ts +6 -0
- package/src/charts/themes/rainbow.js +1 -0
- package/src/charts/utils.d.ts +79 -0
- package/src/charts/utils.js +32 -4
- package/src/draw-block-frac.d.ts +16 -0
- package/src/draw-block-frac.js +14 -0
- package/src/draw-block.d.ts +53 -0
- package/src/draw-block.js +25 -1
- package/src/meta.d.ts +84 -0
- package/src/meta.js +64 -0
- package/src/output/show.d.ts +55 -0
- package/src/output/show.js +28 -0
- package/src/output/updater.d.ts +114 -0
- package/src/output/updater.js +58 -4
- package/src/output/writer.d.ts +87 -0
- package/src/output/writer.js +57 -5
- package/src/panel.d.ts +402 -0
- package/src/panel.js +219 -5
- package/src/plot/bitmap.d.ts +80 -0
- package/src/plot/bitmap.js +33 -4
- package/src/plot/draw-line.d.ts +13 -0
- package/src/plot/draw-line.js +8 -0
- package/src/plot/draw-rect.d.ts +13 -0
- package/src/plot/draw-rect.js +38 -30
- package/src/plot/index.d.ts +39 -0
- package/src/plot/index.js +22 -0
- package/src/plot/to-quads.d.ts +10 -0
- package/src/plot/to-quads.js +5 -0
- package/src/spinner/index.d.ts +4 -0
- package/src/spinner/index.js +0 -2
- package/src/spinner/spin.d.ts +13 -0
- package/src/spinner/spin.js +13 -2
- package/src/spinner/spinner.d.ts +69 -0
- package/src/spinner/spinner.js +30 -2
- package/src/spinner/spinners.d.ts +34 -0
- package/src/spinner/spinners.js +23 -9
- package/src/strings/clip.d.ts +21 -0
- package/src/strings/clip.js +10 -0
- package/src/strings/parse.d.ts +23 -0
- package/src/strings/parse.js +7 -0
- package/src/strings/split.d.ts +38 -0
- package/src/strings/split.js +15 -0
- package/src/strings.d.ts +44 -0
- package/src/strings.js +34 -4
- package/src/style.d.ts +462 -0
- package/src/style.js +58 -4
- package/src/symbols.d.ts +167 -0
- package/src/symbols.js +91 -7
- package/src/table/draw-borders.d.ts +38 -0
- package/src/table/draw-borders.js +10 -2
- package/src/table/index.d.ts +8 -0
- package/src/table/index.js +1 -0
- package/src/table/table.d.ts +234 -0
- package/src/table/table.js +59 -1
- package/src/themes/blocks/unicode-half.d.ts +6 -0
- package/src/themes/blocks/unicode-half.js +1 -0
- package/src/themes/blocks/unicode-thin.d.ts +6 -0
- package/src/themes/blocks/unicode-thin.js +1 -0
- package/src/themes/lines/ascii-compact.d.ts +6 -0
- package/src/themes/lines/ascii-compact.js +1 -0
- package/src/themes/lines/ascii-dots.d.ts +6 -0
- package/src/themes/lines/ascii-dots.js +1 -0
- package/src/themes/lines/ascii-girder.d.ts +6 -0
- package/src/themes/lines/ascii-girder.js +1 -0
- package/src/themes/lines/ascii-github.d.ts +6 -0
- package/src/themes/lines/ascii-github.js +1 -0
- package/src/themes/lines/ascii-reddit.d.ts +6 -0
- package/src/themes/lines/ascii-reddit.js +1 -0
- package/src/themes/lines/ascii-rounded.d.ts +6 -0
- package/src/themes/lines/ascii-rounded.js +1 -0
- package/src/themes/lines/ascii.d.ts +6 -0
- package/src/themes/lines/ascii.js +1 -0
- package/src/themes/lines/unicode-bold.d.ts +6 -0
- package/src/themes/lines/unicode-bold.js +1 -0
- package/src/themes/lines/unicode-rounded.d.ts +6 -0
- package/src/themes/lines/unicode-rounded.js +1 -0
- package/src/themes/lines/unicode.d.ts +6 -0
- package/src/themes/lines/unicode.js +1 -0
- package/src/themes/utils.d.ts +33 -0
- package/src/themes/utils.js +7 -0
- package/src/turtle/draw-line-art.d.ts +19 -0
- package/src/turtle/draw-line-art.js +7 -0
- package/src/turtle/draw-unicode.d.ts +19 -0
- package/src/turtle/draw-unicode.js +8 -0
- package/src/turtle/index.d.ts +21 -0
- package/src/turtle/index.js +8 -0
- package/src/turtle/turtle.d.ts +269 -0
- package/src/turtle/turtle.js +124 -4
package/src/panel.d.ts
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {SgrState} from './ansi/sgr-state.js';
|
|
2
|
+
import Box from './box.js';
|
|
3
|
+
import {StringsInput} from './strings.js';
|
|
4
|
+
|
|
5
|
+
/** A single cell in a Panel. */
|
|
6
|
+
export interface PanelCell {
|
|
7
|
+
/** The character displayed in this cell. */
|
|
8
|
+
symbol: string;
|
|
9
|
+
/** The SGR state applied to this cell. */
|
|
10
|
+
state: SgrState;
|
|
11
|
+
/** If true, this cell is ignored during rendering (e.g., second half of wide char). */
|
|
12
|
+
ignore?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Options for `Panel.toStrings()`. */
|
|
16
|
+
export interface PanelToStringsOptions {
|
|
17
|
+
/** Character used for empty (null) cells (default: ' '). */
|
|
18
|
+
emptySymbol?: string;
|
|
19
|
+
/** SGR state used for empty cells. */
|
|
20
|
+
emptyState?: SgrState | string | string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Options for `Panel.put()`. */
|
|
24
|
+
export interface PanelPutOptions {
|
|
25
|
+
/** Character treated as an empty cell (default: '\x07' BELL). */
|
|
26
|
+
emptySymbol?: string;
|
|
27
|
+
/** If true, ignore control symbols when calculating width. */
|
|
28
|
+
ignoreControlSymbols?: boolean;
|
|
29
|
+
/** If true, treat East Asian ambiguous-width characters as wide. */
|
|
30
|
+
ambiguousAsWide?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Options for `Panel.fillState()`. */
|
|
34
|
+
export interface PanelFillStateOptions {
|
|
35
|
+
/** The SGR state to fill with. */
|
|
36
|
+
state?: SgrState | string | string[];
|
|
37
|
+
/** Character used for empty cells (default: ' '). */
|
|
38
|
+
emptySymbol?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Options for `Panel.combineStateBefore()` and `Panel.combineStateAfter()`. */
|
|
42
|
+
export interface PanelCombineStateOptions {
|
|
43
|
+
/** The SGR state to combine. */
|
|
44
|
+
state?: SgrState | string | string[];
|
|
45
|
+
/** Character used for empty cells (default: ' '). */
|
|
46
|
+
emptySymbol?: string;
|
|
47
|
+
/** SGR state used for empty cells. */
|
|
48
|
+
emptyState?: SgrState | string | string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Options for `Panel.addBottom()`. */
|
|
52
|
+
export interface PanelAddBottomOptions {
|
|
53
|
+
/** Horizontal alignment (default: 'left'). */
|
|
54
|
+
align?: 'left' | 'l' | 'right' | 'r' | 'center' | 'c';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Options for `Panel.addRight()`. */
|
|
58
|
+
export interface PanelAddRightOptions {
|
|
59
|
+
/** Vertical alignment (default: 'top'). */
|
|
60
|
+
align?: 'top' | 't' | 'bottom' | 'b' | 'center' | 'c';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Callback function for `Panel.applyFn()`. Receives cell coordinates and current cell, returns new cell or null/undefined.
|
|
64
|
+
* @param x - Column index.
|
|
65
|
+
* @param y - Row index.
|
|
66
|
+
* @param cell - The current cell or null if empty.
|
|
67
|
+
* @returns A new cell, null, or undefined.
|
|
68
|
+
*/
|
|
69
|
+
type ApplyFn = (x: number, y: number, cell: PanelCell | null) => PanelCell | null | undefined;
|
|
70
|
+
|
|
71
|
+
/** A 2D array of styled cells for compositing styled text.
|
|
72
|
+
* @see {@link https://github.com/uhop/console-toolkit/wiki/Module:-panel}
|
|
73
|
+
*/
|
|
74
|
+
export class Panel {
|
|
75
|
+
/** The 2D array of cells. */
|
|
76
|
+
box: (PanelCell | null)[][];
|
|
77
|
+
|
|
78
|
+
/** Creates an empty Panel of the given dimensions.
|
|
79
|
+
* @param width - Width in columns.
|
|
80
|
+
* @param height - Height in rows.
|
|
81
|
+
*/
|
|
82
|
+
constructor(width: number, height: number);
|
|
83
|
+
|
|
84
|
+
/** The width of the panel in columns. */
|
|
85
|
+
readonly width: number;
|
|
86
|
+
/** The height of the panel in rows. */
|
|
87
|
+
readonly height: number;
|
|
88
|
+
|
|
89
|
+
/** Creates a Panel from various input types.
|
|
90
|
+
* @param s - Input: Panel, Box, string, string array, or object with `toPanel()`/`toBox()`.
|
|
91
|
+
* @param options - Options passed to the conversion.
|
|
92
|
+
* @returns A new Panel instance.
|
|
93
|
+
*/
|
|
94
|
+
static make(s: StringsInput, options?: PanelPutOptions): Panel;
|
|
95
|
+
|
|
96
|
+
/** Converts the panel to an array of strings with ANSI escape sequences.
|
|
97
|
+
* @param options - Rendering options.
|
|
98
|
+
* @returns Array of styled strings.
|
|
99
|
+
*/
|
|
100
|
+
toStrings(options?: PanelToStringsOptions): string[];
|
|
101
|
+
/** Converts the panel to a Box.
|
|
102
|
+
* @param options - Rendering options.
|
|
103
|
+
* @returns A new Box.
|
|
104
|
+
*/
|
|
105
|
+
toBox(options?: PanelToStringsOptions): Box;
|
|
106
|
+
/** Returns a clone of this panel.
|
|
107
|
+
* @returns A new Panel copy.
|
|
108
|
+
*/
|
|
109
|
+
toPanel(): Panel;
|
|
110
|
+
|
|
111
|
+
/** Extracts a rectangular region as a new Panel.
|
|
112
|
+
* @param x - Left column (default: 0).
|
|
113
|
+
* @param y - Top row (default: 0).
|
|
114
|
+
* @param width - Region width (default: panel width).
|
|
115
|
+
* @param height - Region height (default: panel height).
|
|
116
|
+
* @returns A new Panel with the extracted region.
|
|
117
|
+
*/
|
|
118
|
+
extract(x?: number, y?: number, width?: number, height?: number): Panel;
|
|
119
|
+
/** Creates a deep copy of this panel.
|
|
120
|
+
* @returns A new Panel copy.
|
|
121
|
+
*/
|
|
122
|
+
clone(): Panel;
|
|
123
|
+
|
|
124
|
+
/** Copies cells from another panel into this panel.
|
|
125
|
+
* @param x - Destination left column.
|
|
126
|
+
* @param y - Destination top row.
|
|
127
|
+
* @param width - Region width.
|
|
128
|
+
* @param height - Region height.
|
|
129
|
+
* @param panel - Source panel.
|
|
130
|
+
* @param x1 - Source left column (default: 0).
|
|
131
|
+
* @param y1 - Source top row (default: 0).
|
|
132
|
+
* @returns This Panel (mutated).
|
|
133
|
+
*/
|
|
134
|
+
copyFrom(x: number, y: number, width: number, height: number, panel: Panel, x1?: number, y1?: number): Panel;
|
|
135
|
+
/** Places text onto this panel at the given position. Characters matching `emptySymbol` (default: '\x07' BELL) are treated as empty cells.
|
|
136
|
+
* @param x - Left column.
|
|
137
|
+
* @param y - Top row.
|
|
138
|
+
* @param text - Content to place (Panel, Box, string, or string array).
|
|
139
|
+
* @param options - Put options.
|
|
140
|
+
* @returns This Panel (mutated).
|
|
141
|
+
*/
|
|
142
|
+
put(x: number, y: number, text: StringsInput, options?: PanelPutOptions): Panel;
|
|
143
|
+
|
|
144
|
+
/** Applies a function to each cell in the entire panel.
|
|
145
|
+
* @param fn - Cell transformation function.
|
|
146
|
+
* @returns This Panel (mutated).
|
|
147
|
+
*/
|
|
148
|
+
applyFn(fn: ApplyFn): Panel;
|
|
149
|
+
/** Applies a function to each cell in a rectangular region.
|
|
150
|
+
* @param x - Left column.
|
|
151
|
+
* @param y - Top row.
|
|
152
|
+
* @param width - Region width.
|
|
153
|
+
* @param height - Region height.
|
|
154
|
+
* @param fn - Cell transformation function.
|
|
155
|
+
* @param options - Reserved for future use.
|
|
156
|
+
* @returns This Panel (mutated).
|
|
157
|
+
*/
|
|
158
|
+
applyFn(x: number, y: number, width: number, height: number, fn: ApplyFn): Panel;
|
|
159
|
+
|
|
160
|
+
/** Fills the entire panel with a symbol and optional state.
|
|
161
|
+
* @param symbol - Fill character.
|
|
162
|
+
* @param state - SGR state.
|
|
163
|
+
* @param options - Reserved.
|
|
164
|
+
* @returns This Panel (mutated).
|
|
165
|
+
*/
|
|
166
|
+
fill(symbol: string, state?: SgrState | string | string[]): Panel;
|
|
167
|
+
/** Fills a rectangular region with a symbol and optional state.
|
|
168
|
+
* @param x - Left column.
|
|
169
|
+
* @param y - Top row.
|
|
170
|
+
* @param width - Region width.
|
|
171
|
+
* @param height - Region height.
|
|
172
|
+
* @param symbol - Fill character.
|
|
173
|
+
* @param state - SGR state.
|
|
174
|
+
* @param options - Reserved.
|
|
175
|
+
* @returns This Panel (mutated).
|
|
176
|
+
*/
|
|
177
|
+
fill(
|
|
178
|
+
x: number,
|
|
179
|
+
y: number,
|
|
180
|
+
width: number,
|
|
181
|
+
height: number,
|
|
182
|
+
symbol: string,
|
|
183
|
+
state?: SgrState | string | string[]
|
|
184
|
+
): Panel;
|
|
185
|
+
|
|
186
|
+
/** Fills all cells with the given state, using `emptySymbol` for empty cells' symbol.
|
|
187
|
+
* @param options - Fill state options.
|
|
188
|
+
* @returns This Panel (mutated).
|
|
189
|
+
*/
|
|
190
|
+
fillState(options?: PanelFillStateOptions): Panel;
|
|
191
|
+
/** Fills cells in a rectangular region with the given state, using `emptySymbol` for empty cells' symbol.
|
|
192
|
+
* @param x - Left column.
|
|
193
|
+
* @param y - Top row.
|
|
194
|
+
* @param width - Region width.
|
|
195
|
+
* @param height - Region height.
|
|
196
|
+
* @param options - Fill state options.
|
|
197
|
+
* @returns This Panel (mutated).
|
|
198
|
+
*/
|
|
199
|
+
fillState(x: number, y: number, width: number, height: number, options?: PanelFillStateOptions): Panel;
|
|
200
|
+
|
|
201
|
+
/** Fills the SGR state for non-empty cells.
|
|
202
|
+
* @param options - State options.
|
|
203
|
+
* @returns This Panel (mutated).
|
|
204
|
+
*/
|
|
205
|
+
fillNonEmptyState(options?: {state?: SgrState | string | string[]}): Panel;
|
|
206
|
+
/** Fills the SGR state for non-empty cells in a rectangular region.
|
|
207
|
+
* @param x - Left column.
|
|
208
|
+
* @param y - Top row.
|
|
209
|
+
* @param width - Region width.
|
|
210
|
+
* @param height - Region height.
|
|
211
|
+
* @param options - State options.
|
|
212
|
+
* @returns This Panel (mutated).
|
|
213
|
+
*/
|
|
214
|
+
fillNonEmptyState(
|
|
215
|
+
x: number,
|
|
216
|
+
y: number,
|
|
217
|
+
width: number,
|
|
218
|
+
height: number,
|
|
219
|
+
options?: {state?: SgrState | string | string[]}
|
|
220
|
+
): Panel;
|
|
221
|
+
|
|
222
|
+
/** Combines a state before existing cell states (applied state acts as a base that cells override).
|
|
223
|
+
* @param options - Combine options.
|
|
224
|
+
* @returns This Panel (mutated).
|
|
225
|
+
*/
|
|
226
|
+
combineStateBefore(options?: PanelCombineStateOptions): Panel;
|
|
227
|
+
/** Combines a state before existing cell states in a region (applied state acts as a base that cells override).
|
|
228
|
+
* @param x - Left column.
|
|
229
|
+
* @param y - Top row.
|
|
230
|
+
* @param width - Region width.
|
|
231
|
+
* @param height - Region height.
|
|
232
|
+
* @param options - Combine options.
|
|
233
|
+
* @returns This Panel (mutated).
|
|
234
|
+
*/
|
|
235
|
+
combineStateBefore(x: number, y: number, width: number, height: number, options?: PanelCombineStateOptions): Panel;
|
|
236
|
+
|
|
237
|
+
/** Combines a state after existing cell states (applied state overrides cell properties).
|
|
238
|
+
* @param options - Combine options.
|
|
239
|
+
* @returns This Panel (mutated).
|
|
240
|
+
*/
|
|
241
|
+
combineStateAfter(options?: PanelCombineStateOptions): Panel;
|
|
242
|
+
/** Combines a state after existing cell states in a region (applied state overrides cell properties).
|
|
243
|
+
* @param x - Left column.
|
|
244
|
+
* @param y - Top row.
|
|
245
|
+
* @param width - Region width.
|
|
246
|
+
* @param height - Region height.
|
|
247
|
+
* @param options - Combine options.
|
|
248
|
+
* @returns This Panel (mutated).
|
|
249
|
+
*/
|
|
250
|
+
combineStateAfter(x: number, y: number, width: number, height: number, options?: PanelCombineStateOptions): Panel;
|
|
251
|
+
|
|
252
|
+
/** Alias for `combineStateAfter`. */
|
|
253
|
+
combineState: Panel['combineStateAfter'];
|
|
254
|
+
|
|
255
|
+
/** Clears the entire panel (sets all cells to null). @returns This Panel (mutated). */
|
|
256
|
+
clear(): Panel;
|
|
257
|
+
/** Clears a rectangular region (sets cells to null).
|
|
258
|
+
* @param x - Left column.
|
|
259
|
+
* @param y - Top row.
|
|
260
|
+
* @param width - Region width.
|
|
261
|
+
* @param height - Region height.
|
|
262
|
+
* @param options - Options passed to `applyFn()`.
|
|
263
|
+
* @returns This Panel (mutated).
|
|
264
|
+
*/
|
|
265
|
+
clear(x: number, y?: number, width?: number, height?: number): Panel;
|
|
266
|
+
|
|
267
|
+
/** Pads the left side.
|
|
268
|
+
* @param n - Columns.
|
|
269
|
+
* @returns This Panel (mutated).
|
|
270
|
+
*/
|
|
271
|
+
padLeft(n: number): Panel;
|
|
272
|
+
/** Pads the right side.
|
|
273
|
+
* @param n - Columns.
|
|
274
|
+
* @returns This Panel (mutated).
|
|
275
|
+
*/
|
|
276
|
+
padRight(n: number): Panel;
|
|
277
|
+
/** Pads left and right sides.
|
|
278
|
+
* @param n - Left columns.
|
|
279
|
+
* @param m - Right columns.
|
|
280
|
+
* @returns This Panel (mutated).
|
|
281
|
+
*/
|
|
282
|
+
padLeftRight(n: number, m: number): Panel;
|
|
283
|
+
/** Pads the top.
|
|
284
|
+
* @param n - Rows.
|
|
285
|
+
* @returns This Panel (mutated).
|
|
286
|
+
*/
|
|
287
|
+
padTop(n: number): Panel;
|
|
288
|
+
/** Pads the bottom.
|
|
289
|
+
* @param n - Rows.
|
|
290
|
+
* @returns This Panel (mutated).
|
|
291
|
+
*/
|
|
292
|
+
padBottom(n: number): Panel;
|
|
293
|
+
/** Pads top and bottom.
|
|
294
|
+
* @param n - Top rows.
|
|
295
|
+
* @param m - Bottom rows.
|
|
296
|
+
* @returns This Panel (mutated).
|
|
297
|
+
*/
|
|
298
|
+
padTopBottom(n: number, m: number): Panel;
|
|
299
|
+
/** Pads using CSS-style shorthand.
|
|
300
|
+
* @param t - Top.
|
|
301
|
+
* @param r - Right.
|
|
302
|
+
* @param b - Bottom.
|
|
303
|
+
* @param l - Left.
|
|
304
|
+
* @returns This Panel (mutated).
|
|
305
|
+
*/
|
|
306
|
+
pad(t: number, r?: number, b?: number, l?: number): Panel;
|
|
307
|
+
|
|
308
|
+
/** Removes columns starting at `x`.
|
|
309
|
+
* @param x - Start column.
|
|
310
|
+
* @param n - Number of columns.
|
|
311
|
+
* @returns This Panel (mutated).
|
|
312
|
+
*/
|
|
313
|
+
removeColumns(x: number, n: number): Panel;
|
|
314
|
+
/** Removes rows starting at `y`.
|
|
315
|
+
* @param y - Start row.
|
|
316
|
+
* @param n - Number of rows.
|
|
317
|
+
* @returns This Panel (mutated).
|
|
318
|
+
*/
|
|
319
|
+
removeRows(y: number, n: number): Panel;
|
|
320
|
+
|
|
321
|
+
/** Resizes horizontally.
|
|
322
|
+
* @param newWidth - New width.
|
|
323
|
+
* @param align - Alignment (default: 'right').
|
|
324
|
+
* @returns This Panel (mutated).
|
|
325
|
+
*/
|
|
326
|
+
resizeH(newWidth: number, align?: 'left' | 'l' | 'right' | 'r' | 'center' | 'c'): Panel;
|
|
327
|
+
/** Resizes vertically.
|
|
328
|
+
* @param newHeight - New height.
|
|
329
|
+
* @param align - Alignment (default: 'bottom').
|
|
330
|
+
* @returns This Panel (mutated).
|
|
331
|
+
*/
|
|
332
|
+
resizeV(newHeight: number, align?: 'top' | 't' | 'bottom' | 'b' | 'center' | 'c'): Panel;
|
|
333
|
+
/** Resizes both dimensions.
|
|
334
|
+
* @param newWidth - New width.
|
|
335
|
+
* @param newHeight - New height.
|
|
336
|
+
* @param horizontal - Horizontal alignment (default: 'right').
|
|
337
|
+
* @param vertical - Vertical alignment (default: 'bottom').
|
|
338
|
+
* @returns This Panel (mutated).
|
|
339
|
+
*/
|
|
340
|
+
resize(
|
|
341
|
+
newWidth: number,
|
|
342
|
+
newHeight: number,
|
|
343
|
+
horizontal?: 'left' | 'l' | 'right' | 'r' | 'center' | 'c',
|
|
344
|
+
vertical?: 'top' | 't' | 'bottom' | 'b' | 'center' | 'c'
|
|
345
|
+
): Panel;
|
|
346
|
+
|
|
347
|
+
/** Inserts empty columns at `x`.
|
|
348
|
+
* @param x - Column index.
|
|
349
|
+
* @param n - Number of columns.
|
|
350
|
+
* @returns This Panel (mutated).
|
|
351
|
+
*/
|
|
352
|
+
insertColumns(x: number, n: number): Panel;
|
|
353
|
+
/** Inserts empty rows at `y`.
|
|
354
|
+
* @param y - Row index.
|
|
355
|
+
* @param n - Number of rows.
|
|
356
|
+
* @returns This Panel (mutated).
|
|
357
|
+
*/
|
|
358
|
+
insertRows(y: number, n: number): Panel;
|
|
359
|
+
|
|
360
|
+
/** Appends another panel below this one.
|
|
361
|
+
* @param panel - Panel to append.
|
|
362
|
+
* @param options - Alignment options.
|
|
363
|
+
* @returns This Panel (mutated).
|
|
364
|
+
*/
|
|
365
|
+
addBottom(panel: Panel, options?: PanelAddBottomOptions): Panel;
|
|
366
|
+
/** Appends another panel to the right.
|
|
367
|
+
* @param panel - Panel to append.
|
|
368
|
+
* @param options - Alignment options.
|
|
369
|
+
* @returns This Panel (mutated).
|
|
370
|
+
*/
|
|
371
|
+
addRight(panel: Panel, options?: PanelAddRightOptions): Panel;
|
|
372
|
+
|
|
373
|
+
/** Returns a transposed copy (rows become columns).
|
|
374
|
+
* @returns A new Panel.
|
|
375
|
+
*/
|
|
376
|
+
transpose(): Panel;
|
|
377
|
+
/** Returns a copy rotated 90° clockwise.
|
|
378
|
+
* @returns A new Panel.
|
|
379
|
+
*/
|
|
380
|
+
rotateRight(): Panel;
|
|
381
|
+
/** Returns a copy rotated 90° counter-clockwise.
|
|
382
|
+
* @returns A new Panel.
|
|
383
|
+
*/
|
|
384
|
+
rotateLeft(): Panel;
|
|
385
|
+
/** Flips the panel horizontally in place.
|
|
386
|
+
* @returns This Panel (mutated).
|
|
387
|
+
*/
|
|
388
|
+
flipH(): Panel;
|
|
389
|
+
/** Flips the panel vertically in place.
|
|
390
|
+
* @returns This Panel (mutated).
|
|
391
|
+
*/
|
|
392
|
+
flipV(): Panel;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/** Alias for `Panel.make()`. Creates a Panel from various input types.
|
|
396
|
+
* @param s - Input convertible to a Panel.
|
|
397
|
+
* @param options - Options passed to the conversion.
|
|
398
|
+
* @returns A new Panel instance.
|
|
399
|
+
*/
|
|
400
|
+
export function toPanel(s: StringsInput, options?: PanelPutOptions): Panel;
|
|
401
|
+
|
|
402
|
+
export default Panel;
|