@techninja/clearstack 0.4.33 → 0.4.35

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 (2) hide show
  1. package/lib/watch-ui.js +14 -10
  2. package/package.json +5 -2
package/lib/watch-ui.js CHANGED
@@ -7,9 +7,6 @@
7
7
 
8
8
  import { screen, statusBox, divider, logBox, getSpin, getCopyNote } from './watch-widgets.js';
9
9
 
10
- /** @param {string} s @param {number} max @returns {string} */
11
- const truncate = (s, max) => s.length > max ? s.slice(0, max - 1) + '…' : s;
12
-
13
10
  export { setQuit } from './watch-widgets.js';
14
11
  export { splitCandidates, extractViolations } from './watch-violations.js';
15
12
 
@@ -43,11 +40,11 @@ const rowLine = (r, w) => {
43
40
  const n = (r.label ?? r.name ?? r.key).padEnd(w);
44
41
  const isIdle = r.pass === false && r.keyBinding;
45
42
  const name = (!isIdle && r.pass === false) ? `{red-fg}${n}{/}` : n;
46
- const maxDetail = Math.max(10, (screen.width ?? 80) - w - 8);
47
43
  const rawDetail = isIdle
48
44
  ? (r.ranAt ? timeAgo(r.ranAt) : `press ${r.keyBinding} to run`)
49
45
  : (r.detail ?? '');
50
- const detail = rawDetail ? `{grey-fg}${truncate(rawDetail, maxDetail)}{/}` : '';
46
+ const isError = r.key === 'server' && /error/i.test(rawDetail);
47
+ const detail = rawDetail ? `{${isError ? 'red' : 'grey'}-fg}${rawDetail}{/}` : '';
51
48
  return ` ${rowIcon(r)} ${name} ${detail}`;
52
49
  };
53
50
 
@@ -56,8 +53,12 @@ const rowLine = (r, w) => {
56
53
  /** @param {object[]} rows @param {string} lastCheck @param {string[]} watchDirs */
57
54
  function statusContent(rows, lastCheck, watchDirs) {
58
55
  const w = Math.max(...rows.map((r) => (r.label ?? r.name ?? r.key).length));
59
- return [...rows.map((r) => rowLine(r, w)), '',
60
- `{grey-fg} watching ${watchDirs.join(', ')} last check: ${lastCheck}{/}${getCopyNote()}`];
56
+ const server = rows.filter((r) => r.key === 'server');
57
+ const failing = rows.filter((r) => r.key !== 'server' && r.pass === false);
58
+ const rest = rows.filter((r) => r.key !== 'server' && r.pass !== false);
59
+ const sorted = [...server, ...failing, ...rest];
60
+ const footer = `{grey-fg} watching ${watchDirs.join(', ')} last check: ${lastCheck}{/}${getCopyNote()}`;
61
+ return [...sorted.map((r) => rowLine(r, w)), '', footer];
61
62
  }
62
63
 
63
64
  // ── Public API ────────────────────────────────────────────────────────────────
@@ -71,10 +72,13 @@ function statusContent(rows, lastCheck, watchDirs) {
71
72
  */
72
73
  export function render(rows, lastCheck, watchDirs, violations) {
73
74
  const lines = statusContent(rows, lastCheck, watchDirs);
74
- statusBox.setContent(lines.join('\n'));
75
- statusBox.height = lines.length;
75
+ const termH = (screen.height ?? 24) - 2; // subtract outer border
76
+ const maxStatus = Math.max(1, termH - (violations.length ? Math.floor(termH / 2) : 0));
77
+ const visible = lines.slice(0, maxStatus);
78
+ statusBox.setContent(visible.join('\n'));
79
+ statusBox.height = visible.length;
76
80
 
77
- const statusHeight = lines.length + 1;
81
+ const statusHeight = visible.length + 1;
78
82
  divider.top = statusHeight;
79
83
  logBox.top = statusHeight + 1;
80
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techninja/clearstack",
3
- "version": "0.4.33",
3
+ "version": "0.4.35",
4
4
  "type": "module",
5
5
  "description": "A no-build web component framework specification — scaffold, validate, and evolve spec-compliant projects",
6
6
  "bin": {
@@ -54,6 +54,9 @@
54
54
  "hybrids"
55
55
  ],
56
56
  "license": "MIT",
57
+ "overrides": {
58
+ "smol-toml": "^1.8.0"
59
+ },
57
60
  "dependencies": {
58
61
  "@inquirer/prompts": "^8.3.2",
59
62
  "blessed": "^0.1.81",
@@ -62,7 +65,7 @@
62
65
  "devDependencies": {
63
66
  "@open-wc/testing": "^4.0.0",
64
67
  "@types/ws": "^8.18.1",
65
- "@web/test-runner": "^0.20.0",
68
+ "@web/test-runner": "^1.0.0",
66
69
  "@web/test-runner-playwright": "^0.11.0",
67
70
  "eslint": "^10.1.0",
68
71
  "eslint-config-prettier": "^10.1.8",