@gperezmz/bb-plugin-thread-glance 0.3.0 → 0.4.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.
@@ -29,12 +29,18 @@ import type { RowNote } from "./notes";
29
29
  /** How many quiet children stay in an expanded tree. */
30
30
  export const KEEP_QUIET_CHILDREN = 3;
31
31
 
32
- /** The children chip: the muted count of a parent's direct children, and its chevron. */
32
+ /** The children chip: the count of a parent's direct children and its chevron, after the state of its descendants. */
33
33
  export interface Chip {
34
- /** Direct children opening it shows, hidden ones left out. */
34
+ /** Direct children opening it shows, hidden ones left out; 0 draws no number. */
35
35
  count: number;
36
36
  /** The user opened the chip, so every child shows. */
37
37
  expanded: boolean;
38
+ /**
39
+ * The most urgent state among the descendants at any depth, open or
40
+ * collapsed, or null for none: its glyph leads the chip and colours it, and
41
+ * keeps that colour through dimming and hover.
42
+ */
43
+ flag: Flag | null;
38
44
  }
39
45
 
40
46
  export interface ThreadRow {
@@ -53,11 +59,6 @@ export interface ThreadRow {
53
59
  * default, a child whose harness is not its parent thread's.
54
60
  */
55
61
  harness: boolean;
56
- /**
57
- * The child dot on the status glyph: the most urgent state among the
58
- * thread's descendants at any depth, or null for none.
59
- */
60
- childDot: Flag | null;
61
62
  /** The title is bold: the thread is unread. */
62
63
  bold: boolean;
63
64
  /** A root whose tree holds an unread thread: it offers Mark read for the whole tree. */
@@ -267,7 +268,6 @@ function threadRow(
267
268
  parentTitle: titleOf(context, info.parentId),
268
269
  chip: options.chip,
269
270
  harness: drawsHarness(context, info),
270
- childDot: mostUrgent(subtreeOf(context, info.thread.id).dotFlags),
271
271
  bold: info.unread,
272
272
  treeUnread: info === root && [root, ...(context.forest.treeOf.get(root.thread.id)?.descendants ?? [])].some((info) => info.unread),
273
273
  note: info.note,
@@ -405,11 +405,13 @@ function clusterEnvironments(context: Context, units: Unit[], depth: number): Tr
405
405
  return rows;
406
406
  }
407
407
 
408
- /** The children chip of a parent, or null when opening it would show nothing. */
408
+ /** The children chip of a parent, or null when it would show nothing. */
409
409
  function chipOf(context: Context, info: ThreadInfo, expanded: boolean): Chip | null {
410
- const count = subtreeOf(context, info.thread.id).childCount;
411
- if (count === 0 && eligibleChildren(context, info.thread.id).length === 0) return null;
412
- return { count, expanded };
410
+ const { childCount: count, chipFlags } = subtreeOf(context, info.thread.id);
411
+ const flag = mostUrgent(chipFlags);
412
+ // A hidden child's failure that needs no attention has no row, yet the chip still shows it.
413
+ if (count === 0 && flag === null && eligibleChildren(context, info.thread.id).length === 0) return null;
414
+ return { count, expanded, flag };
413
415
  }
414
416
 
415
417
  /** What a thread and everything under it carry, for an environment folder's glyph. */
@@ -0,0 +1,13 @@
1
+ @import "tailwindcss";
2
+
3
+ /* The tests measure where the row's boxes end up; fades would only delay it. */
4
+ *,
5
+ *::before,
6
+ *::after {
7
+ transition: none !important;
8
+ }
9
+
10
+ /* bb draws icons as sized SVGs; the test SDK's stand-in is a bare span. */
11
+ [data-icon] {
12
+ display: inline-block;
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gperezmz/bb-plugin-thread-glance",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "bb": ">=0.43",
@@ -34,12 +34,14 @@
34
34
  "@radix-ui/react-popover": "^1.1.19",
35
35
  "@radix-ui/react-select": "^2.3.3",
36
36
  "@radix-ui/react-tooltip": "^1.2.12",
37
+ "@tailwindcss/vite": "^4.3.3",
37
38
  "@testing-library/dom": "^10.4.2",
38
39
  "@testing-library/react": "^16.3.3",
39
40
  "@types/better-sqlite3": "^7.6.12",
40
41
  "@types/node": "^22.0.0",
41
42
  "@types/react": "^19.0.0",
42
43
  "@types/react-dom": "^19.0.0",
44
+ "@vitest/browser-playwright": "5.0.1",
43
45
  "better-sqlite3": "^12.0.0",
44
46
  "class-variance-authority": "^0.7.1",
45
47
  "clsx": "^2.1.1",
@@ -47,10 +49,12 @@
47
49
  "esbuild": "^0.28.2",
48
50
  "hono": "^4.11.9",
49
51
  "jsdom": "^30.1.1",
52
+ "playwright": "^1.63.0",
50
53
  "react": "^19.3.0",
51
54
  "react-dom": "^19.3.0",
52
55
  "sonner": "^1.7.4",
53
56
  "tailwind-merge": "^3.4.0",
57
+ "tailwindcss": "^4.3.3",
54
58
  "typescript": "^7.0.2",
55
59
  "vaul": "^1.1.2",
56
60
  "vitest": "^5.0.1"