console-toolkit 1.2.14 → 1.3.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.
Files changed (88) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +4 -0
  3. package/llms-full.txt +64 -4
  4. package/package.json +6 -6
  5. package/src/alphanumeric/arrows.js +0 -23
  6. package/src/alphanumeric/fractions.js +0 -49
  7. package/src/alphanumeric/number-formatters.js +0 -44
  8. package/src/alphanumeric/roman.js +0 -12
  9. package/src/alphanumeric/unicode-cultural-numbers.js +0 -1
  10. package/src/alphanumeric/unicode-letters.js +0 -8
  11. package/src/alphanumeric/unicode-numbers.js +0 -21
  12. package/src/alphanumeric/utils.js +0 -26
  13. package/src/ansi/csi.js +0 -49
  14. package/src/ansi/sgr-state.js +7 -50
  15. package/src/ansi/sgr.js +0 -420
  16. package/src/box.d.ts +4 -1
  17. package/src/box.js +15 -115
  18. package/src/charts/bars/block-frac-grouped.js +0 -6
  19. package/src/charts/bars/block-frac.js +1 -14
  20. package/src/charts/bars/block-grouped.js +0 -6
  21. package/src/charts/bars/block.js +1 -14
  22. package/src/charts/bars/draw-grouped.js +0 -4
  23. package/src/charts/bars/draw-stacked.js +0 -4
  24. package/src/charts/bars/frac-grouped.js +2 -14
  25. package/src/charts/bars/plain-grouped.js +0 -6
  26. package/src/charts/bars/plain.js +1 -28
  27. package/src/charts/columns/block-frac-grouped.js +0 -6
  28. package/src/charts/columns/block-frac.js +0 -13
  29. package/src/charts/columns/block-grouped.js +0 -6
  30. package/src/charts/columns/block.js +0 -13
  31. package/src/charts/columns/draw-grouped.js +1 -5
  32. package/src/charts/columns/draw-stacked.js +0 -4
  33. package/src/charts/columns/frac-grouped.js +1 -13
  34. package/src/charts/columns/plain-grouped.js +0 -6
  35. package/src/charts/columns/plain.js +0 -13
  36. package/src/charts/themes/default.js +0 -1
  37. package/src/charts/themes/rainbow-reversed.js +0 -1
  38. package/src/charts/themes/rainbow.js +0 -1
  39. package/src/charts/utils.js +2 -28
  40. package/src/draw-block-frac.js +0 -14
  41. package/src/draw-block.js +0 -24
  42. package/src/meta.js +0 -64
  43. package/src/output/show.d.ts +8 -3
  44. package/src/output/show.js +7 -38
  45. package/src/output/updater.d.ts +8 -3
  46. package/src/output/updater.js +4 -51
  47. package/src/output/writer.js +1 -53
  48. package/src/panel.d.ts +16 -10
  49. package/src/panel.js +21 -276
  50. package/src/plot/bitmap.js +5 -33
  51. package/src/plot/draw-line.js +0 -8
  52. package/src/plot/draw-rect.js +25 -103
  53. package/src/plot/index.js +0 -22
  54. package/src/plot/to-quads.js +3 -6
  55. package/src/spinner/spin.js +23 -20
  56. package/src/spinner/spinner.d.ts +16 -2
  57. package/src/spinner/spinner.js +22 -34
  58. package/src/spinner/spinners.js +0 -16
  59. package/src/strings/clip.js +0 -10
  60. package/src/strings/parse.js +0 -7
  61. package/src/strings/split.js +0 -15
  62. package/src/strings.d.ts +2 -0
  63. package/src/strings.js +2 -32
  64. package/src/style.js +2 -58
  65. package/src/symbols.js +0 -84
  66. package/src/table/draw-borders.js +0 -9
  67. package/src/table/index.d.ts +1 -1
  68. package/src/table/index.js +0 -1
  69. package/src/table/table.js +3 -58
  70. package/src/themes/blocks/unicode-half.js +0 -1
  71. package/src/themes/blocks/unicode-thin.js +0 -1
  72. package/src/themes/lines/ascii-compact.js +5 -9
  73. package/src/themes/lines/ascii-dots.js +2 -7
  74. package/src/themes/lines/ascii-girder.js +4 -7
  75. package/src/themes/lines/ascii-github.js +5 -9
  76. package/src/themes/lines/ascii-reddit.js +5 -9
  77. package/src/themes/lines/ascii-rounded.js +5 -9
  78. package/src/themes/lines/ascii.js +5 -9
  79. package/src/themes/lines/unicode-bold.js +8 -14
  80. package/src/themes/lines/unicode-rounded.js +8 -14
  81. package/src/themes/lines/unicode.js +8 -14
  82. package/src/themes/utils.d.ts +6 -0
  83. package/src/themes/utils.js +6 -7
  84. package/src/turtle/draw-line-art.js +26 -18
  85. package/src/turtle/draw-unicode.js +0 -8
  86. package/src/turtle/index.d.ts +1 -1
  87. package/src/turtle/index.js +0 -8
  88. package/src/turtle/turtle.js +0 -120
package/src/panel.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  import {SgrState} from './ansi/sgr-state.js';
2
2
  import Box from './box.js';
3
3
  import {StringsInput} from './strings.js';
4
+ import {SplitOptions} from './strings/split.js';
5
+
6
+ /** Sentinel character ('\x07' BELL) used to mark empty cells when placing text via `Panel.put()`. */
7
+ export const EMPTY_CELL_SENTINEL: string;
4
8
 
5
9
  /** A single cell in a Panel. */
6
10
  export interface PanelCell {
@@ -22,7 +26,7 @@ export interface PanelToStringsOptions {
22
26
 
23
27
  /** Options for `Panel.put()`. */
24
28
  export interface PanelPutOptions {
25
- /** Character treated as an empty cell (default: '\x07' BELL). */
29
+ /** Character treated as an empty cell (default: `EMPTY_CELL_SENTINEL`, '\x07' BELL). */
26
30
  emptySymbol?: string;
27
31
  /** If true, ignore control symbols when calculating width. */
28
32
  ignoreControlSymbols?: boolean;
@@ -132,7 +136,7 @@ export class Panel {
132
136
  * @returns This Panel (mutated).
133
137
  */
134
138
  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.
139
+ /** Places text onto this panel at the given position. Characters matching `emptySymbol` (default: `EMPTY_CELL_SENTINEL`, '\x07' BELL) are treated as empty cells.
136
140
  * @param x - Left column.
137
141
  * @param y - Top row.
138
142
  * @param text - Content to place (Panel, Box, string, or string array).
@@ -152,15 +156,14 @@ export class Panel {
152
156
  * @param width - Region width.
153
157
  * @param height - Region height.
154
158
  * @param fn - Cell transformation function.
155
- * @param options - Reserved for future use.
159
+ * @param options - Grapheme split options forwarded to width detection (for wide-character support).
156
160
  * @returns This Panel (mutated).
157
161
  */
158
- applyFn(x: number, y: number, width: number, height: number, fn: ApplyFn): Panel;
162
+ applyFn(x: number, y: number, width: number, height: number, fn: ApplyFn, options?: SplitOptions): Panel;
159
163
 
160
164
  /** Fills the entire panel with a symbol and optional state.
161
165
  * @param symbol - Fill character.
162
166
  * @param state - SGR state.
163
- * @param options - Reserved.
164
167
  * @returns This Panel (mutated).
165
168
  */
166
169
  fill(symbol: string, state?: SgrState | string | string[]): Panel;
@@ -171,7 +174,7 @@ export class Panel {
171
174
  * @param height - Region height.
172
175
  * @param symbol - Fill character.
173
176
  * @param state - SGR state.
174
- * @param options - Reserved.
177
+ * @param options - Grapheme split options forwarded to width detection.
175
178
  * @returns This Panel (mutated).
176
179
  */
177
180
  fill(
@@ -180,7 +183,8 @@ export class Panel {
180
183
  width: number,
181
184
  height: number,
182
185
  symbol: string,
183
- state?: SgrState | string | string[]
186
+ state?: SgrState | string | string[],
187
+ options?: SplitOptions
184
188
  ): Panel;
185
189
 
186
190
  /** Fills all cells with the given state, using `emptySymbol` for empty cells' symbol.
@@ -259,10 +263,10 @@ export class Panel {
259
263
  * @param y - Top row.
260
264
  * @param width - Region width.
261
265
  * @param height - Region height.
262
- * @param options - Options passed to `applyFn()`.
266
+ * @param options - Grapheme split options forwarded to width detection.
263
267
  * @returns This Panel (mutated).
264
268
  */
265
- clear(x: number, y?: number, width?: number, height?: number): Panel;
269
+ clear(x: number, y?: number, width?: number, height?: number, options?: SplitOptions): Panel;
266
270
 
267
271
  /** Pads the left side.
268
272
  * @param n - Columns.
@@ -296,7 +300,9 @@ export class Panel {
296
300
  * @returns This Panel (mutated).
297
301
  */
298
302
  padTopBottom(n: number, m: number): Panel;
299
- /** Pads using CSS-style shorthand.
303
+ /** Pads using CSS-style shorthand. Padding adds null cells (rendered later via the
304
+ * `emptySymbol`/`emptyState` options of `toStrings()`); unlike `Box.pad`, this method
305
+ * intentionally has no `symbol` parameter — set the rendering character at draw time.
300
306
  * @param t - Top.
301
307
  * @param r - Right.
302
308
  * @param b - Bottom.
package/src/panel.js CHANGED
@@ -15,15 +15,18 @@ import split, {size} from './strings/split.js';
15
15
  import Box from './box.js';
16
16
  import {addAliases} from './meta.js';
17
17
 
18
- /** A 2D array of cells, where each cell has a character symbol and an SGR state.
19
- * Provides methods for manipulation, styling, geometric transforms, and conversion to Box/strings.
20
- * @see {@link https://github.com/uhop/console-toolkit/wiki/Module:-panel}
21
- */
18
+ export const EMPTY_CELL_SENTINEL = '\x07';
19
+
20
+ const normalizeState = state => {
21
+ if (typeof state == 'string') return commandsToState(state.split(';'));
22
+ if (Array.isArray(state)) return commandsToState(state);
23
+ return toState(state);
24
+ };
25
+
26
+ const normalizeRegionArgs = (panel, x, y, width, height, options) =>
27
+ typeof x === 'object' ? [0, 0, panel.width, panel.height, x] : [x, y, width, height, options];
28
+
22
29
  export class Panel {
23
- /** Creates an empty Panel of the given dimensions.
24
- * @param {number} width - Width in columns.
25
- * @param {number} height - Height in rows.
26
- */
27
30
  constructor(width, height) {
28
31
  this.box = new Array(height);
29
32
  for (let i = 0; i < height; ++i) {
@@ -31,21 +34,14 @@ export class Panel {
31
34
  }
32
35
  }
33
36
 
34
- /** The width of the panel in columns. */
35
37
  get width() {
36
38
  return this.box.length && this.box[0].length;
37
39
  }
38
40
 
39
- /** The height of the panel in rows. */
40
41
  get height() {
41
42
  return this.box.length;
42
43
  }
43
44
 
44
- /** Creates a Panel from various input types (Panel, Box, string, string[], function).
45
- * @param {import('./strings.js').StringsInput} s - Input data.
46
- * @param {object} [options] - Options passed to Box.make() or put().
47
- * @returns {Panel}
48
- */
49
45
  static make(s, options) {
50
46
  main: for (;;) {
51
47
  switch (typeof s) {
@@ -67,12 +63,6 @@ export class Panel {
67
63
  return panel;
68
64
  }
69
65
 
70
- /** Converts the panel to an array of strings with embedded ANSI escape sequences.
71
- * @param {object} [options] - Options.
72
- * @param {string} [options.emptySymbol=' '] - Character for empty cells.
73
- * @param {object} [options.emptyState] - SGR state for empty cells.
74
- * @returns {string[]}
75
- */
76
66
  toStrings(options = {}) {
77
67
  if (!this.height || !this.width) return Box.makeBlank(this.width, this.height).box;
78
68
 
@@ -102,21 +92,10 @@ export class Panel {
102
92
  return s;
103
93
  }
104
94
 
105
- /** Converts the panel to a Box.
106
- * @param {object} [options] - Options passed to toStrings().
107
- * @returns {import('./box.js').Box}
108
- */
109
95
  toBox(options) {
110
96
  return new Box(this.toStrings(options), true);
111
97
  }
112
98
 
113
- /** Extracts a rectangular region as a new Panel.
114
- * @param {number} [x=0] - Left column.
115
- * @param {number} [y=0] - Top row.
116
- * @param {number} [width] - Width (defaults to panel width).
117
- * @param {number} [height] - Height (defaults to panel height).
118
- * @returns {Panel}
119
- */
120
99
  extract(x, y, width, height) {
121
100
  // normalize arguments
122
101
 
@@ -163,23 +142,10 @@ export class Panel {
163
142
  return panel;
164
143
  }
165
144
 
166
- /** Creates a deep copy of this panel.
167
- * @returns {Panel}
168
- */
169
145
  clone() {
170
146
  return this.extract();
171
147
  }
172
148
 
173
- /** Copies cells from another panel into this panel.
174
- * @param {number} x - Destination x.
175
- * @param {number} y - Destination y.
176
- * @param {number} width - Width to copy.
177
- * @param {number} height - Height to copy.
178
- * @param {Panel} panel - Source panel.
179
- * @param {number} [x1=0] - Source x.
180
- * @param {number} [y1=0] - Source y.
181
- * @returns {this}
182
- */
183
149
  copyFrom(x, y, width, height, panel, x1 = 0, y1 = 0) {
184
150
  // normalize arguments
185
151
 
@@ -214,14 +180,6 @@ export class Panel {
214
180
  return this;
215
181
  }
216
182
 
217
- /** Places text onto this panel at the given position. Characters matching `emptySymbol` (default: '\x07' BELL) are treated as empty cells.
218
- * @param {number} x - Left column.
219
- * @param {number} y - Top row.
220
- * @param {import('./strings.js').StringsInput} text - Content to place.
221
- * @param {object} [options] - Put options.
222
- * @param {string} [options.emptySymbol='\x07'] - Character treated as an empty cell.
223
- * @returns {this}
224
- */
225
183
  put(x, y, text, options = {}) {
226
184
  if (text instanceof Panel) return this.copyFrom(x, y, text.width, text.height, text);
227
185
 
@@ -238,7 +196,7 @@ export class Panel {
238
196
  if (y >= this.height) return this;
239
197
  if (y + height > this.height) height = this.height - y;
240
198
 
241
- const {emptySymbol = '\x07'} = options;
199
+ const {emptySymbol = EMPTY_CELL_SENTINEL} = options;
242
200
 
243
201
  // copy characters
244
202
  let state = {};
@@ -281,15 +239,6 @@ export class Panel {
281
239
  return this;
282
240
  }
283
241
 
284
- /** Applies a function to each cell in a rectangular region.
285
- * @param {number|Function} x - Left column, or the function if called with a single argument.
286
- * @param {number} [y] - Top row.
287
- * @param {number} [width] - Width.
288
- * @param {number} [height] - Height.
289
- * @param {Function} [fn] - Function `(x, y, cell) => newCell`.
290
- * @param {object} [options] - Options.
291
- * @returns {this}
292
- */
293
242
  applyFn(x, y, width, height, fn, options) {
294
243
  // normalize arguments
295
244
 
@@ -336,16 +285,6 @@ export class Panel {
336
285
  return this;
337
286
  }
338
287
 
339
- /** Fills a rectangular region with a symbol and state.
340
- * @param {number|string} x - Left column, or symbol if filling the entire panel.
341
- * @param {number} [y] - Top row.
342
- * @param {number} [width] - Width.
343
- * @param {number} [height] - Height.
344
- * @param {string} [symbol] - Fill character.
345
- * @param {object|string|string[]} [state={}] - SGR state.
346
- * @param {object} [options] - Options.
347
- * @returns {this}
348
- */
349
288
  fill(x, y, width, height, symbol, state = {}, options) {
350
289
  if (typeof x === 'string') {
351
290
  symbol = x;
@@ -355,40 +294,14 @@ export class Panel {
355
294
  width = this.width;
356
295
  height = this.height;
357
296
  }
358
- if (typeof state == 'string') {
359
- state = commandsToState(state.split(';'));
360
- } else if (Array.isArray(state)) {
361
- state = commandsToState(state);
362
- } else {
363
- state = toState(state);
364
- }
297
+ state = normalizeState(state);
365
298
  return this.applyFn(x, y, width, height, () => ({symbol, state}), options);
366
299
  }
367
300
 
368
- /** Fills all cells with the given state, using `emptySymbol` for empty cells' symbol.
369
- * @param {number|object} x - Left column, or options if filling the entire panel.
370
- * @param {number} [y] - Top row.
371
- * @param {number} [width] - Width.
372
- * @param {number} [height] - Height.
373
- * @param {object} [options] - Options with `state` and `emptySymbol`.
374
- * @returns {this}
375
- */
376
301
  fillState(x, y, width, height, options) {
377
- if (typeof x === 'object') {
378
- options = x;
379
- x = 0;
380
- y = 0;
381
- width = this.width;
382
- height = this.height;
383
- }
302
+ [x, y, width, height, options] = normalizeRegionArgs(this, x, y, width, height, options);
384
303
  let {state = {}, emptySymbol = ' '} = options || {};
385
- if (typeof state == 'string') {
386
- state = commandsToState(state.split(';'));
387
- } else if (Array.isArray(state)) {
388
- state = commandsToState(state);
389
- } else {
390
- state = toState(state);
391
- }
304
+ state = normalizeState(state);
392
305
  return this.applyFn(
393
306
  x,
394
307
  y,
@@ -399,57 +312,17 @@ export class Panel {
399
312
  );
400
313
  }
401
314
 
402
- /** Fills state only for non-empty cells in a region.
403
- * @param {number|object} x - Left column, or options if filling the entire panel.
404
- * @param {number} [y] - Top row.
405
- * @param {number} [width] - Width.
406
- * @param {number} [height] - Height.
407
- * @param {object} [options] - Options with `state`.
408
- * @returns {this}
409
- */
410
315
  fillNonEmptyState(x, y, width, height, options) {
411
- if (typeof x === 'object') {
412
- options = x;
413
- x = 0;
414
- y = 0;
415
- width = this.width;
416
- height = this.height;
417
- }
316
+ [x, y, width, height, options] = normalizeRegionArgs(this, x, y, width, height, options);
418
317
  let {state = {}} = options || {};
419
- if (typeof state == 'string') {
420
- state = commandsToState(state.split(';'));
421
- } else if (Array.isArray(state)) {
422
- state = commandsToState(state);
423
- } else {
424
- state = toState(state);
425
- }
318
+ state = normalizeState(state);
426
319
  return this.applyFn(x, y, width, height, (x, y, cell) => cell && {symbol: cell.symbol, state}, options);
427
320
  }
428
321
 
429
- /** Combines a state before existing cell states (applied state acts as a base that cells override).
430
- * @param {number|object} x - Left column, or options if filling the entire panel.
431
- * @param {number} [y] - Top row.
432
- * @param {number} [width] - Width.
433
- * @param {number} [height] - Height.
434
- * @param {object} [options] - Options with `state`, `emptySymbol`, `emptyState`.
435
- * @returns {this}
436
- */
437
322
  combineStateBefore(x, y, width, height, options) {
438
- if (typeof x === 'object') {
439
- options = x;
440
- x = 0;
441
- y = 0;
442
- width = this.width;
443
- height = this.height;
444
- }
323
+ [x, y, width, height, options] = normalizeRegionArgs(this, x, y, width, height, options);
445
324
  let {state = {}, emptySymbol = ' ', emptyState = RESET_STATE} = options || {};
446
- if (typeof state == 'string') {
447
- state = commandsToState(state.split(';'));
448
- } else if (Array.isArray(state)) {
449
- state = commandsToState(state);
450
- } else {
451
- state = toState(state);
452
- }
325
+ state = normalizeState(state);
453
326
  return this.applyFn(
454
327
  x,
455
328
  y,
@@ -463,30 +336,10 @@ export class Panel {
463
336
  );
464
337
  }
465
338
 
466
- /** Combines a state after existing cell states (applied state overrides cell properties).
467
- * @param {number|object} x - Left column, or options if filling the entire panel.
468
- * @param {number} [y] - Top row.
469
- * @param {number} [width] - Width.
470
- * @param {number} [height] - Height.
471
- * @param {object} [options] - Options with `state`, `emptySymbol`, `emptyState`.
472
- * @returns {this}
473
- */
474
339
  combineStateAfter(x, y, width, height, options) {
475
- if (typeof x === 'object') {
476
- options = x;
477
- x = 0;
478
- y = 0;
479
- width = this.width;
480
- height = this.height;
481
- }
340
+ [x, y, width, height, options] = normalizeRegionArgs(this, x, y, width, height, options);
482
341
  let {state = {}, emptySymbol = ' ', emptyState = RESET_STATE} = options || {};
483
- if (typeof state == 'string') {
484
- state = commandsToState(state.split(';'));
485
- } else if (Array.isArray(state)) {
486
- state = commandsToState(state);
487
- } else {
488
- state = toState(state);
489
- }
342
+ state = normalizeState(state);
490
343
  return this.applyFn(
491
344
  x,
492
345
  y,
@@ -500,14 +353,6 @@ export class Panel {
500
353
  );
501
354
  }
502
355
 
503
- /** Clears (nullifies) cells in a rectangular region.
504
- * @param {number} [x=0] - Left column.
505
- * @param {number} [y=0] - Top row.
506
- * @param {number} [width] - Width.
507
- * @param {number} [height] - Height.
508
- * @param {object} [options] - Options.
509
- * @returns {this}
510
- */
511
356
  clear(x, y, width, height, options) {
512
357
  // normalize arguments
513
358
  if (typeof x != 'number') {
@@ -528,10 +373,6 @@ export class Panel {
528
373
  return this.applyFn(x, y, width, height, () => null, options);
529
374
  }
530
375
 
531
- /** Pads the left side with `n` empty columns.
532
- * @param {number} n
533
- * @returns {this}
534
- */
535
376
  padLeft(n) {
536
377
  if (n <= 0) return this;
537
378
 
@@ -543,10 +384,6 @@ export class Panel {
543
384
  return this;
544
385
  }
545
386
 
546
- /** Pads the right side with `n` empty columns.
547
- * @param {number} n
548
- * @returns {this}
549
- */
550
387
  padRight(n) {
551
388
  if (n <= 0) return this;
552
389
 
@@ -558,11 +395,6 @@ export class Panel {
558
395
  return this;
559
396
  }
560
397
 
561
- /** Pads left and right sides with empty cells.
562
- * @param {number} n - Left columns.
563
- * @param {number} m - Right columns.
564
- * @returns {this}
565
- */
566
398
  padLeftRight(n, m) {
567
399
  if (n <= 0) return this.padRight(m);
568
400
  if (m <= 0) return this.padLeft(n);
@@ -574,10 +406,6 @@ export class Panel {
574
406
  return this;
575
407
  }
576
408
 
577
- /** Pads the top with `n` empty rows.
578
- * @param {number} n
579
- * @returns {this}
580
- */
581
409
  padTop(n) {
582
410
  if (n <= 0) return this;
583
411
 
@@ -588,10 +416,6 @@ export class Panel {
588
416
  return this;
589
417
  }
590
418
 
591
- /** Pads the bottom with `n` empty rows.
592
- * @param {number} n
593
- * @returns {this}
594
- */
595
419
  padBottom(n) {
596
420
  if (n <= 0) return this;
597
421
 
@@ -602,11 +426,6 @@ export class Panel {
602
426
  return this;
603
427
  }
604
428
 
605
- /** Pads top and bottom with empty rows.
606
- * @param {number} n - Top rows.
607
- * @param {number} m - Bottom rows.
608
- * @returns {this}
609
- */
610
429
  padTopBottom(n, m) {
611
430
  if (n <= 0) return this.padBottom(m);
612
431
  if (m <= 0) return this.padTop(n);
@@ -622,13 +441,6 @@ export class Panel {
622
441
  return this;
623
442
  }
624
443
 
625
- /** Pads the panel using CSS-style shorthand (top, right, bottom, left).
626
- * @param {number} t - Top (or all sides if only argument).
627
- * @param {number} [r] - Right.
628
- * @param {number} [b] - Bottom.
629
- * @param {number} [l] - Left.
630
- * @returns {this}
631
- */
632
444
  pad(t, r, b, l) {
633
445
  // use values according to CSS rules
634
446
  if (typeof r != 'number') {
@@ -643,11 +455,6 @@ export class Panel {
643
455
  return this.padLeftRight(l, r).padTopBottom(t, b);
644
456
  }
645
457
 
646
- /** Removes `n` columns starting at column `x`.
647
- * @param {number} x - Start column.
648
- * @param {number} n - Number of columns to remove.
649
- * @returns {this}
650
- */
651
458
  removeColumns(x, n) {
652
459
  // normalize arguments
653
460
  if (x < 0) {
@@ -661,11 +468,6 @@ export class Panel {
661
468
  return this;
662
469
  }
663
470
 
664
- /** Removes `n` rows starting at row `y`.
665
- * @param {number} y - Start row.
666
- * @param {number} n - Number of rows to remove.
667
- * @returns {this}
668
- */
669
471
  removeRows(y, n) {
670
472
  // normalize arguments
671
473
  if (y < 0) {
@@ -679,11 +481,6 @@ export class Panel {
679
481
  return this;
680
482
  }
681
483
 
682
- /** Resizes the panel horizontally.
683
- * @param {number} newWidth - New width.
684
- * @param {'left'|'center'|'right'} [align='right'] - Alignment when adding/removing columns.
685
- * @returns {this}
686
- */
687
484
  resizeH(newWidth, align = 'right') {
688
485
  if (!this.width) return this.padRight(newWidth);
689
486
 
@@ -704,11 +501,6 @@ export class Panel {
704
501
  return diff < 0 ? this.removeColumns(newWidth, -diff) : this.padRight(diff);
705
502
  }
706
503
 
707
- /** Resizes the panel vertically.
708
- * @param {number} newHeight - New height.
709
- * @param {'top'|'center'|'bottom'} [align='bottom'] - Alignment when adding/removing rows.
710
- * @returns {this}
711
- */
712
504
  resizeV(newHeight, align = 'bottom') {
713
505
  if (!this.height) return this.padBottom(newHeight);
714
506
 
@@ -729,13 +521,6 @@ export class Panel {
729
521
  return diff < 0 ? this.removeRows(newHeight, -diff) : this.padBottom(diff);
730
522
  }
731
523
 
732
- /** Resizes the panel in both dimensions.
733
- * @param {number} newWidth - New width.
734
- * @param {number} newHeight - New height.
735
- * @param {'left'|'center'|'right'} [horizontal='right'] - Horizontal alignment.
736
- * @param {'top'|'center'|'bottom'} [vertical='bottom'] - Vertical alignment.
737
- * @returns {this}
738
- */
739
524
  resize(newWidth, newHeight, horizontal = 'right', vertical = 'bottom') {
740
525
  if (!this.height) return this.padBottom(newHeight).padRight(newWidth);
741
526
 
@@ -744,11 +529,6 @@ export class Panel {
744
529
  : this.resizeH(newWidth, horizontal).resizeV(newHeight, vertical);
745
530
  }
746
531
 
747
- /** Inserts `n` empty columns at position `x`.
748
- * @param {number} x - Insert position.
749
- * @param {number} n - Number of columns.
750
- * @returns {this}
751
- */
752
532
  insertColumns(x, n) {
753
533
  // normalize arguments
754
534
  if (n <= 0) return this;
@@ -760,11 +540,6 @@ export class Panel {
760
540
  return this;
761
541
  }
762
542
 
763
- /** Inserts `n` empty rows at position `y`.
764
- * @param {number} y - Insert position.
765
- * @param {number} n - Number of rows.
766
- * @returns {this}
767
- */
768
543
  insertRows(y, n) {
769
544
  // normalize arguments
770
545
  if (n <= 0) return this;
@@ -777,12 +552,6 @@ export class Panel {
777
552
  return this;
778
553
  }
779
554
 
780
- /** Appends another panel below this one.
781
- * @param {Panel} panel - Panel to append.
782
- * @param {object} [options] - Options.
783
- * @param {'left'|'center'|'right'} [options.align='left'] - Horizontal alignment.
784
- * @returns {this}
785
- */
786
555
  addBottom(panel, {align = 'left'} = {}) {
787
556
  panel = panel.clone();
788
557
 
@@ -825,12 +594,6 @@ export class Panel {
825
594
  return this;
826
595
  }
827
596
 
828
- /** Appends another panel to the right of this one.
829
- * @param {Panel} panel - Panel to append.
830
- * @param {object} [options] - Options.
831
- * @param {'top'|'center'|'bottom'} [options.align='top'] - Vertical alignment.
832
- * @returns {this}
833
- */
834
597
  addRight(panel, {align = 'top'} = {}) {
835
598
  panel = panel.clone();
836
599
 
@@ -909,9 +672,6 @@ export class Panel {
909
672
  return this;
910
673
  }
911
674
 
912
- /** Returns a new Panel that is the transpose of this one (rows become columns).
913
- * @returns {Panel}
914
- */
915
675
  transpose() {
916
676
  const panel = new Panel(this.height, this.width);
917
677
  for (let i = 0; i < this.height; ++i) {
@@ -924,9 +684,6 @@ export class Panel {
924
684
  return panel;
925
685
  }
926
686
 
927
- /** Returns a new Panel rotated 90° clockwise.
928
- * @returns {Panel}
929
- */
930
687
  rotateRight() {
931
688
  const panel = new Panel(this.height, this.width);
932
689
  for (let i = 0; i < this.height; ++i) {
@@ -939,9 +696,6 @@ export class Panel {
939
696
  return panel;
940
697
  }
941
698
 
942
- /** Returns a new Panel rotated 90° counter-clockwise.
943
- * @returns {Panel}
944
- */
945
699
  rotateLeft() {
946
700
  const panel = new Panel(this.height, this.width);
947
701
  for (let i = 0; i < this.height; ++i) {
@@ -954,17 +708,11 @@ export class Panel {
954
708
  return panel;
955
709
  }
956
710
 
957
- /** Flips the panel horizontally (mirrors left-right) in place.
958
- * @returns {this}
959
- */
960
711
  flipH() {
961
712
  for (const row of this.box) row.reverse();
962
713
  return this;
963
714
  }
964
715
 
965
- /** Flips the panel vertically (mirrors top-bottom) in place.
966
- * @returns {this}
967
- */
968
716
  flipV() {
969
717
  this.box.reverse();
970
718
  return this;
@@ -973,9 +721,6 @@ export class Panel {
973
721
 
974
722
  addAliases(Panel, {combineState: 'combineStateAfter', toPanel: 'clone'});
975
723
 
976
- /** Alias for `Panel.make()`. Creates a Panel from various input types.
977
- * @type {typeof Panel.make}
978
- */
979
724
  export const toPanel = Panel.make;
980
725
 
981
726
  export default Panel;