console-toolkit 1.2.11 → 1.2.13

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 CHANGED
@@ -132,6 +132,8 @@ BSD 3-Clause License
132
132
 
133
133
  ## Release history
134
134
 
135
+ - 1.2.13 _Fixed spinner .d.ts export, added TS type tests, stricter type checking, updated dev deps._
136
+ - 1.2.12 _Minor bug fixes, improved test coverage, documentation corrections._
135
137
  - 1.2.11 _Improved docs for brevity and clarity, added script descriptions, added AI workflows._
136
138
  - 1.2.10 _Added TypeScript typings, JSDoc, minor bug fixes, updated dev deps._
137
139
  - 1.2.9 _Updated dev deps._
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "console-toolkit",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "Toolkit to produce a fancy console output (boxes, tables, charts, colors).",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -29,6 +29,9 @@
29
29
  "test:seq:bun": "bun run `tape6-seq --self` --flags FO",
30
30
  "test:seq:deno": "deno run -A `tape6-seq --self` --flags FO",
31
31
  "ts-check": "tsc --noEmit",
32
+ "ts-test": "tape6 --flags FO 'tests/test-*.ts'",
33
+ "ts-test:bun": "tape6-bun --flags FO 'tests/test-*.ts'",
34
+ "ts-test:deno": "tape6-deno --flags FO 'tests/test-*.ts'",
32
35
  "lint": "prettier --check .",
33
36
  "lint:fix": "prettier --write ."
34
37
  },
@@ -82,12 +85,12 @@
82
85
  ]
83
86
  },
84
87
  "devDependencies": {
85
- "@types/node": "^25.3.0",
88
+ "@types/node": "^25.3.5",
86
89
  "emoji-regex": "^10.6.0",
87
90
  "get-east-asian-width": "^1.5.0",
88
91
  "prettier": "^3.8.1",
89
- "tape-six": "^1.7.2",
90
- "tape-six-proc": "^1.2.3",
92
+ "tape-six": "^1.7.11",
93
+ "tape-six-proc": "^1.2.6",
91
94
  "typescript": "^5.9.3"
92
95
  }
93
96
  }
@@ -38,8 +38,6 @@ export const drawRealHeightBlock = (width, realHeight, drawEmptyBorder) => {
38
38
  hasFrac = realHeight - intHeight > 0,
39
39
  drawBorder = hasFrac && (drawEmptyBorder || index > 0);
40
40
 
41
- let result = fullBlock.repeat(intHeight);
42
- if (drawBorder) result += hBlocks8th[index];
43
41
  return new Box(
44
42
  [...(drawBorder ? [vBlocks8th[index].repeat(width)] : []), ...new Array(intHeight).fill(fullBlock.repeat(width))],
45
43
  true
@@ -50,7 +50,9 @@ export class Writer {
50
50
  * @returns {boolean} True if supported.
51
51
  */
52
52
  hasColors(...args) {
53
- return this.forceColorDepth ? args[0] <= Math.pow(2, this.forceColorDepth) : this.stream.hasColors?.(...args);
53
+ if (!this.forceColorDepth) return this.stream.hasColors?.(...args);
54
+ const count = typeof args[0] == 'number' ? args[0] : 2;
55
+ return count <= Math.pow(2, this.forceColorDepth);
54
56
  }
55
57
 
56
58
  /** Clears the current line.
package/src/panel.js CHANGED
@@ -74,7 +74,7 @@ export class Panel {
74
74
  * @returns {string[]}
75
75
  */
76
76
  toStrings(options = {}) {
77
- if (!this.height || !this.width) return Box.makeBlank(this.width, this.height);
77
+ if (!this.height || !this.width) return Box.makeBlank(this.width, this.height).box;
78
78
 
79
79
  let {emptySymbol = ' ', emptyState = RESET_STATE} = options;
80
80
  emptyState = toState(emptyState);
@@ -1,4 +1,5 @@
1
1
  export {Spinner} from './spinner.js';
2
- export {default as spin} from './spin.js';
2
+ import spin from './spin.js';
3
3
 
4
+ export {spin};
4
5
  export default spin;
package/src/symbols.js CHANGED
@@ -28,7 +28,7 @@ export const vBlocks8th = [' ', ...generateSequence(0x2581, 0, 7)];
28
28
  /** Horizontal block elements in 1/8th increments (index 0 = space, 7 = full block).
29
29
  * @type {string[]}
30
30
  */
31
- export const hBlocks8th = [' ', ...generateSequence(0x2588, 7, 0, -1)];
31
+ export const hBlocks8th = [' ', ...generateSequence(0x2588, 7, 0)];
32
32
  /** Full block character (█). */
33
33
  export const fullBlock = '\u{2588}';
34
34
 
@@ -188,8 +188,8 @@ export class Table {
188
188
  }
189
189
  const hAlign = getCellAlign(cell.align, 0) || this.options.hAlign[j] || 'left',
190
190
  vAlign = getCellAlign(cell.align, 1) || this.options.vAlign[i] || 'top',
191
- dx = hAlign === 'l' || hAlign == 'left' ? 0 : hAlign === 'r' || hAlign === 'right' ? diffX : diffX >> 1,
192
- dy = vAlign === 't' || vAlign == 'top' ? 0 : vAlign === 'b' || vAlign === 'bottom' ? diffY : diffY >> 1;
191
+ dx = hAlign === 'l' || hAlign === 'left' ? 0 : hAlign === 'r' || hAlign === 'right' ? diffX : diffX >> 1,
192
+ dy = vAlign === 't' || vAlign === 'top' ? 0 : vAlign === 'b' || vAlign === 'bottom' ? diffY : diffY >> 1;
193
193
  panel.put(x + dx, y + dy, cell.box);
194
194
  }
195
195
  x += hAxis[2 * j + 1] + (this.lineTheme['w_' + hAxis[2 * j + 2]] || 0);