@purview-dev/pm-docs-site 0.1.0-pre.1 → 0.1.0-pre.2

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 (47) hide show
  1. package/README.md +63 -11
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +90 -0
  4. package/dist/index.d.ts +7 -0
  5. package/dist/index.js +118 -0
  6. package/dist/options.d.ts +5 -0
  7. package/dist/options.js +46 -0
  8. package/dist/repo-docs.d.ts +33 -0
  9. package/dist/repo-docs.js +94 -0
  10. package/dist/schema-version.d.ts +10 -0
  11. package/dist/schema-version.js +19 -0
  12. package/dist/sidebar.d.ts +10 -0
  13. package/dist/sidebar.js +30 -0
  14. package/dist/site-options.d.ts +9 -0
  15. package/dist/site-options.js +39 -0
  16. package/dist/types.d.ts +47 -0
  17. package/dist/types.js +4 -0
  18. package/lib/{repo-docs.mjs → repo-docs.ts} +22 -46
  19. package/lib/{schema-version.mjs → schema-version.ts} +4 -9
  20. package/package.json +14 -8
  21. package/src/components/PlanInteractions.astro +15 -3
  22. package/src/components/board/Board.tsx +244 -0
  23. package/src/components/board/KanbanItemCard.tsx +129 -0
  24. package/src/components/board/LinkRuns.tsx +21 -0
  25. package/src/components/board/TaskKanbanCard.tsx +81 -0
  26. package/src/components/board/useBoardUrlState.ts +41 -0
  27. package/src/components/timeline/Timeline.tsx +159 -0
  28. package/src/components/timeline/useTimelineLayout.ts +39 -0
  29. package/src/env.d.ts +2 -2
  30. package/src/lib/board-data.ts +84 -0
  31. package/src/lib/board.ts +209 -0
  32. package/src/lib/planning.ts +66 -38
  33. package/src/lib/references.ts +1 -1
  34. package/src/lib/timeline.ts +156 -0
  35. package/src/loaders/repo-docs.ts +3 -3
  36. package/src/pages/plan/board.astro +14 -113
  37. package/src/pages/plan/roadmap.astro +20 -2
  38. package/src/scripts/plan.ts +3 -49
  39. package/src/styles/components.css +127 -10
  40. package/src/styles/kanban.css +277 -0
  41. package/src/styles/timeline.css +210 -0
  42. package/cli.mjs +0 -120
  43. package/index.d.ts +0 -49
  44. package/index.mjs +0 -97
  45. package/lib/options.mjs +0 -67
  46. package/lib/sidebar.mjs +0 -47
  47. package/lib/site-options.mjs +0 -38
@@ -9,9 +9,9 @@ import { relative, sep } from 'node:path';
9
9
 
10
10
  import config from 'virtual:pm-docs-site/config';
11
11
 
12
- import type { DocsSource } from '../../index';
13
- import { pagesOf } from '../../lib/repo-docs.mjs';
14
- import { checkSchemaVersion, PlanningExportError, SUPPORTED_SCHEMA_VERSIONS } from '../../lib/schema-version.mjs';
12
+ import type { DocsSource } from '../../lib/types.ts';
13
+ import { pagesOf } from '../../lib/repo-docs.ts';
14
+ import { checkSchemaVersion, PlanningExportError, SUPPORTED_SCHEMA_VERSIONS } from '../../lib/schema-version.ts';
15
15
  import type { Brief, InboxEntry, Level, Milestone, Owner, Planning, Rag, Risk, RoadmapItem, Size, Stage } from './planning-types';
16
16
 
17
17
  export { PlanningExportError, SUPPORTED_SCHEMA_VERSIONS };
@@ -63,6 +63,7 @@ export interface RoadmapGroup {
63
63
  id: string;
64
64
  name: string;
65
65
  status: string | null;
66
+ target: string | null;
66
67
  exitCriteria: string | null;
67
68
  isFocus: boolean;
68
69
  } | null;
@@ -71,64 +72,84 @@ export interface RoadmapGroup {
71
72
  progress: { done: number; total: number };
72
73
  }
73
74
 
75
+ /** Lower wins: a non-null ID keeps only the event in this state, the same precedence `features()` uses. */
76
+ const EVENT_PRECEDENCE: Record<TimelineEvent['status'], number> = { active: 0, pending: 1, done: 2 };
77
+
78
+ /**
79
+ * Each non-null ID kept once across the whole page, in the higher-precedence
80
+ * state, so a group never lists an ID that another group's count holds.
81
+ */
82
+ function dedupeEvents<T extends { event: TimelineEvent }>(entries: T[]): T[] {
83
+ const best = new Map<string, TimelineEvent>();
84
+
85
+ for (const { event } of entries) {
86
+ if (event.id === null) continue;
87
+
88
+ const current = best.get(event.id);
89
+
90
+ if (!current || EVENT_PRECEDENCE[event.status] < EVENT_PRECEDENCE[current.status]) best.set(event.id, event);
91
+ }
92
+
93
+ return entries.filter(({ event }) => event.id === null || best.get(event.id) === event);
94
+ }
95
+
74
96
  /**
75
- * One group per milestone in strategy order, then "no milestone": the Done log
76
- * (newest first), the Now item, then Next and Later in roadmap order.
97
+ * One group per milestone in strategy order, then "no milestone" when it
98
+ * counts an item: the Done log (newest first), the Now item, then Next and
99
+ * Later in roadmap order. An ID that appears more than once (for example done
100
+ * under one milestone and still queued under another) is listed once on the
101
+ * page, in the state and group `features()` counts it in.
77
102
  */
78
103
  export function roadmapGroups(planning: Planning): RoadmapGroup[] {
79
104
  const groupOf = (milestone: string | null) => milestoneId(milestone, planning.strategy.milestones);
80
105
  const focus = planning.strategy.focus.milestone ?? '';
106
+ const summaries = milestoneSummaries(planning);
107
+ const progressFor = (id: string | null) => summaries.find((summary) => summary.id === id)?.progress ?? { done: 0, total: 0 };
81
108
 
82
- const eventsFor = (id: string | null): TimelineEvent[] => [
83
- ...planning.log.done
84
- .filter((entry) => groupOf(entry.milestone) === id)
85
- .map((entry) => ({
86
- id: entry.id,
87
- title: label(entry.id, entry.title),
88
- desc: entry.result ?? '',
89
- time: entry.date,
90
- status: 'done' as const,
91
- })),
92
- ...(planning.now.item && groupOf(planning.now.milestone) === id
109
+ const placed = dedupeEvents([
110
+ ...planning.log.done.map((entry) => ({
111
+ group: groupOf(entry.milestone),
112
+ event: { id: entry.id, title: label(entry.id, entry.title), desc: entry.result ?? '', time: entry.date, status: 'done' as const },
113
+ })),
114
+ ...(planning.now.item
93
115
  ? [
94
116
  {
95
- id: planning.now.item.id,
96
- title: label(planning.now.item.id, planning.now.item.title),
97
- desc: planning.now.stage ? `In progress: ${planning.now.stage}` : 'In progress',
98
- time: 'Now',
99
- status: 'active' as const,
117
+ group: groupOf(planning.now.milestone),
118
+ event: {
119
+ id: planning.now.item.id,
120
+ title: label(planning.now.item.id, planning.now.item.title),
121
+ desc: planning.now.stage ? `In progress: ${planning.now.stage}` : 'In progress',
122
+ time: 'Now',
123
+ status: 'active' as const,
124
+ },
100
125
  },
101
126
  ]
102
127
  : []),
103
- ...[...planning.roadmap.next, ...planning.roadmap.later]
104
- .filter((item) => groupOf(item.milestone) === id)
105
- .map((item) => ({
106
- id: item.id,
107
- title: label(item.id, item.title),
108
- desc: item.doneWhen,
109
- time: item.section === 'next' ? 'Next' : 'Later',
110
- status: 'pending' as const,
111
- })),
112
- ];
128
+ ...[...planning.roadmap.next, ...planning.roadmap.later].map((item) => ({
129
+ group: groupOf(item.milestone),
130
+ event: { id: item.id, title: label(item.id, item.title), desc: item.doneWhen, time: item.section === 'next' ? 'Next' : 'Later', status: 'pending' as const },
131
+ })),
132
+ ]);
133
+
134
+ const eventsFor = (id: string | null): TimelineEvent[] => placed.filter((entry) => entry.group === id).map((entry) => entry.event);
113
135
 
114
136
  const groups: RoadmapGroup[] = planning.strategy.milestones.map((milestone) => ({
115
137
  milestone: {
116
138
  id: milestone.id,
117
139
  name: milestone.name,
118
140
  status: milestone.status,
141
+ target: normaliseTarget(milestone.target),
119
142
  exitCriteria: milestone.exitCriteria,
120
143
  isFocus: milestoneId(focus, [milestone]) !== null,
121
144
  },
122
- ...withProgress(eventsFor(milestone.id)),
145
+ events: eventsFor(milestone.id),
146
+ progress: progressFor(milestone.id),
123
147
  }));
124
148
 
125
- const unassigned = eventsFor(null);
149
+ // The same rule as the `No milestone` card: shown only when it counts an item.
150
+ const unassignedProgress = progressFor(null);
126
151
 
127
- return unassigned.length > 0 ? [...groups, { milestone: null, ...withProgress(unassigned) }] : groups;
128
- }
129
-
130
- function withProgress(events: TimelineEvent[]): Pick<RoadmapGroup, 'events' | 'progress'> {
131
- return { events, progress: { done: events.filter((event) => event.status === 'done').length, total: events.length } };
152
+ return unassignedProgress.total > 0 ? [...groups, { milestone: null, events: eventsFor(null), progress: unassignedProgress }] : groups;
132
153
  }
133
154
 
134
155
  const LEVELS: Level[] = ['low', 'medium', 'high'];
@@ -214,6 +235,13 @@ export function planProgress(plan: { checked: number; total: number } | null): n
214
235
  return plan && plan.total > 0 ? Math.round((plan.checked / plan.total) * 100) : 0;
215
236
  }
216
237
 
238
+ /** A milestone's target, written as given; `null`, empty, or `none` (any case) is no target. */
239
+ export function normaliseTarget(target: string | null): string | null {
240
+ const text = target?.trim() ?? '';
241
+
242
+ return text === '' || text.toLowerCase() === 'none' ? null : text;
243
+ }
244
+
217
245
  /** Inbox severity as a card priority: the inbox has no priority of its own. */
218
246
  export function severityToPriority(severity: InboxEntry['severity']): 'low' | 'medium' | 'high' | 'urgent' {
219
247
  return severity === 'blocker' ? 'urgent' : severity === 'major' ? 'high' : severity === 'minor' ? 'medium' : 'low';
@@ -5,7 +5,7 @@
5
5
 
6
6
  import config from 'virtual:pm-docs-site/config';
7
7
 
8
- import type { ViewName } from '../../index';
8
+ import type { ViewName } from '../../lib/types.ts';
9
9
  import { briefAnchor, briefOf, featureHref, features, loadPlanning, milestoneHref, milestoneSummaries, roadmapGroups, type Feature } from './planning';
10
10
  import type { Planning } from './planning-types';
11
11
 
@@ -0,0 +1,156 @@
1
+ // Pure derivations for the Roadmap page's milestone timeline: the cards in
2
+ // strategy order, their status and target text, and their progress. All from
3
+ // planning.json through milestoneSummaries; nothing here touches the DOM.
4
+
5
+ import { milestoneSummaries, normaliseTarget } from './planning';
6
+ import type { Planning } from './planning-types';
7
+
8
+ export { normaliseTarget } from './planning';
9
+
10
+ export type MilestoneState = 'active' | 'planned' | 'done' | 'other';
11
+
12
+ export interface MilestoneStatus {
13
+ state: MilestoneState;
14
+ label: string;
15
+ doneOn: string | null;
16
+ }
17
+
18
+ export interface TimelineMilestone {
19
+ /** `null` for the no-milestone card. */
20
+ id: string | null;
21
+ /** `id`, or `none` for the no-milestone card. */
22
+ key: string;
23
+ name: string;
24
+ href: string | null;
25
+ isFocus: boolean;
26
+ status: MilestoneStatus;
27
+ target: string | null;
28
+ progress: { done: number; total: number; percent: number };
29
+ }
30
+
31
+ const DONE = /^done(?:\s*\((\d{4}-\d{2}-\d{2})\))?$/i;
32
+
33
+ /** A milestone's status text as its state, label, and done date, if any. An unrecognised value is `other`, shown with its own text. */
34
+ export function parseMilestoneStatus(status: string | null): MilestoneStatus {
35
+ const text = status?.trim() ?? '';
36
+
37
+ if (!text) return { state: 'other', label: 'No status', doneOn: null };
38
+
39
+ const done = DONE.exec(text);
40
+
41
+ if (done) return { state: 'done', label: 'done', doneOn: done[1] ?? null };
42
+
43
+ const lower = text.toLowerCase();
44
+
45
+ return lower === 'active' || lower === 'planned' ? { state: lower, label: lower, doneOn: null } : { state: 'other', label: text, doneOn: null };
46
+ }
47
+
48
+ /**
49
+ * The timeline's cards, in strategy order, then `No milestone` last. Drops the
50
+ * `No milestone` card when every one of its items is dropped (its progress is
51
+ * then `0` of `0`, since dropped items are never counted).
52
+ */
53
+ export function timelineMilestones(planning: Planning, known: Map<string, { href: string | null }>): TimelineMilestone[] {
54
+ return milestoneSummaries(planning)
55
+ .filter((summary) => summary.id !== null || summary.progress.total > 0)
56
+ .map((summary) => {
57
+ const key = summary.id ?? 'none';
58
+ const { done, total } = summary.progress;
59
+
60
+ return {
61
+ id: summary.id,
62
+ key,
63
+ name: summary.name,
64
+ href: known.get(key)?.href ?? null,
65
+ isFocus: summary.isFocus,
66
+ status: parseMilestoneStatus(summary.status),
67
+ target: normaliseTarget(summary.target),
68
+ progress: { done, total, percent: total === 0 ? 0 : Math.round((done / total) * 100) },
69
+ };
70
+ });
71
+ }
72
+
73
+ // Layout URL state, zoom maths, and the wheel rule: the strip's horizontal or
74
+ // vertical layout lives in the URL (never the zoom); zoom lives only in the
75
+ // island's own state, snapped to a fixed step; and the wheel rule tells a
76
+ // plain vertical wheel apart from a pinch-zoom gesture and from a gesture the
77
+ // strip's native horizontal scrolling already handles.
78
+
79
+ export type TimelineLayout = 'horizontal' | 'vertical';
80
+
81
+ /** The layout named by `?layout=`; anything other than the exact value `vertical` is horizontal. */
82
+ export function parseTimelineQuery(search: string): TimelineLayout {
83
+ return new URLSearchParams(search).get('layout') === 'vertical' ? 'vertical' : 'horizontal';
84
+ }
85
+
86
+ /** `search` with `layout` set for `vertical` (appended last) or removed for `horizontal`; keeps every other parameter. `''` when none remain. */
87
+ export function timelineQuery(layout: TimelineLayout, search: string): string {
88
+ const params = new URLSearchParams(search);
89
+
90
+ params.delete('layout');
91
+
92
+ if (layout === 'vertical') params.append('layout', 'vertical');
93
+
94
+ const query = params.toString();
95
+
96
+ return query === '' ? '' : `?${query}`;
97
+ }
98
+
99
+ export const ZOOM = { min: 0.5, max: 2, step: 0.25, default: 1 } as const;
100
+
101
+ /** The wheel delta, in pixels, that one pinch-zoom notch accumulates before the zoom steps. */
102
+ export const PINCH_STEP = 50;
103
+
104
+ const ZOOM_TICKS_PER_UNIT = Math.round(1 / ZOOM.step);
105
+ const ZOOM_MIN_TICKS = Math.round(ZOOM.min * ZOOM_TICKS_PER_UNIT);
106
+ const ZOOM_MAX_TICKS = Math.round(ZOOM.max * ZOOM_TICKS_PER_UNIT);
107
+
108
+ /** `zoom` snapped to the nearest step, moved one step in `direction`, then clamped to `[ZOOM.min, ZOOM.max]`. Integer ticks avoid float drift. */
109
+ export function zoomStep(zoom: number, direction: 1 | -1): number {
110
+ const ticks = Math.round(zoom * ZOOM_TICKS_PER_UNIT) + direction;
111
+ const clamped = Math.min(ZOOM_MAX_TICKS, Math.max(ZOOM_MIN_TICKS, ticks));
112
+
113
+ return clamped / ZOOM_TICKS_PER_UNIT;
114
+ }
115
+
116
+ /**
117
+ * One wheel event's effect on zoom. A mouse notch (`deltaMode !== 0`, or
118
+ * pixels already past `PINCH_STEP`) steps immediately and clears `pending`. A
119
+ * trackpad pinch accumulates `pending` in pixels and steps once per
120
+ * `PINCH_STEP` crossed, keeping the remainder. `deltaY` `0` is a no-op.
121
+ */
122
+ export function zoomFromWheel(zoom: number, pending: number, deltaY: number, deltaMode: number): { zoom: number; pending: number } {
123
+ if (deltaY === 0) return { zoom, pending };
124
+
125
+ if (deltaMode !== 0 || Math.abs(deltaY) >= PINCH_STEP) {
126
+ return { zoom: zoomStep(zoom, deltaY < 0 ? 1 : -1), pending: 0 };
127
+ }
128
+
129
+ let nextZoom = zoom;
130
+ let nextPending = pending + deltaY;
131
+
132
+ while (Math.abs(nextPending) >= PINCH_STEP) {
133
+ const negative = nextPending < 0;
134
+
135
+ nextZoom = zoomStep(nextZoom, negative ? 1 : -1);
136
+ nextPending += negative ? PINCH_STEP : -PINCH_STEP;
137
+ }
138
+
139
+ return { zoom: nextZoom, pending: nextPending };
140
+ }
141
+
142
+ /** Whether the strip's own horizontal scrolling should consume this wheel event, with 1px of tolerance at either end. */
143
+ export function wheelScrollsStrip(
144
+ e: { deltaX: number; deltaY: number },
145
+ s: { scrollLeft: number; scrollWidth: number; clientWidth: number },
146
+ ): boolean {
147
+ if (Math.abs(e.deltaX) >= Math.abs(e.deltaY)) return false;
148
+ if (s.scrollWidth <= s.clientWidth) return false;
149
+
150
+ const TOLERANCE = 1;
151
+ const maxScrollLeft = s.scrollWidth - s.clientWidth;
152
+
153
+ if (e.deltaY > 0) return s.scrollLeft < maxScrollLeft - TOLERANCE;
154
+
155
+ return s.scrollLeft > TOLERANCE;
156
+ }
@@ -1,5 +1,5 @@
1
1
  // Markdown from anywhere in the repository as Starlight's `docs` collection,
2
- // read in place. The matching and parsing live in lib/repo-docs.mjs, shared with
2
+ // read in place. The matching and parsing live in lib/repo-docs.ts, shared with
3
3
  // the sidebar.
4
4
 
5
5
  import { readFile } from 'node:fs/promises';
@@ -8,8 +8,8 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
8
8
 
9
9
  import type { Loader } from 'astro/loaders';
10
10
 
11
- import type { DocsSource } from '../../index';
12
- import { pagesOf, readPage } from '../../lib/repo-docs.mjs';
11
+ import type { DocsSource } from '../../lib/types.ts';
12
+ import { pagesOf, readPage } from '../../lib/repo-docs.ts';
13
13
 
14
14
  /** Starlight's `docs` collection over every source; `root` is the docs root, absolute or relative to the site root. */
15
15
  export function repoDocsLoader(options: { root: string; sources: DocsSource[] }): Loader {
@@ -1,42 +1,28 @@
1
1
  ---
2
2
  // The task board, column by column, from planning.json's `board.columns` —
3
- // the same columns the pm-board skill renders. Each card links to its item's
4
- // page; a plain click opens the item popup, and each column can collapse.
3
+ // the same columns the pm-board skill renders — as a server-rendered React
4
+ // island (src/components/board/Board.tsx) that filters the cards and
5
+ // collapses columns. Each card links to its item's page; a plain click opens
6
+ // the item popup (src/scripts/plan.ts) from the templates below.
5
7
  import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
6
8
 
9
+ import Board from '../../components/board/Board';
7
10
  import ExportStamp from '../../components/ExportStamp.astro';
8
11
  import ItemDetail from '../../components/ItemDetail.astro';
9
12
  import ItemDialog from '../../components/ItemDialog.astro';
10
- import KanbanItemCard from '../../components/lib/KanbanItemCard.astro';
11
- import TaskKanbanCard from '../../components/lib/TaskKanbanCard.astro';
12
13
  import PlanInteractions from '../../components/PlanInteractions.astro';
13
- import { features, initials, loadPlanning, planProgress, sizeToPriority } from '../../lib/planning';
14
+ import { boardCards } from '../../lib/board-data';
15
+ import { loadPlanning } from '../../lib/planning';
14
16
  import { siteRefs } from '../../lib/references';
15
- import type { Card } from '../../lib/planning-types';
16
17
  import '../../styles/components.css';
18
+ import '../../styles/kanban.css';
17
19
 
18
20
  const planning = loadPlanning();
19
- const { columns } = planning.board;
20
21
  const { known } = siteRefs();
21
-
22
- // The item behind a card, for its milestone and its page.
23
- const items = new Map(features(planning).map((feature) => [feature.id, feature]));
24
- const hrefOf = (id: string | null) => (id ? (known.get(id)?.href ?? undefined) : undefined);
25
- const milestoneKey = (id: string | null) => (id ? (items.get(id)?.milestone ?? 'none') : 'none');
26
- const tagOf = (id: string | null) => {
27
- const key = milestoneKey(id);
28
-
29
- return { tag: key === 'none' ? 'No milestone' : key, tagHref: known.get(key)?.href ?? null };
30
- };
31
-
32
- const progress = planProgress(planning.plan);
33
- const taskPriority = (size: Card['size']) => ({ low: 'low', medium: 'med', high: 'high' } as const)[sizeToPriority(size)];
34
-
35
- const queued = [
36
- { name: 'next', title: 'Next', cards: columns.next },
37
- { name: 'foryou', title: 'For you', cards: columns.foryou },
38
- { name: 'waiting', title: 'Waiting', cards: columns.waiting },
39
- ];
22
+ const cards = boardCards(planning, known);
23
+ const milestones = planning.strategy.milestones.map(({ id, name }) => ({ id, name }));
24
+ // One popup template per item with a page, even when the same item is on two cards.
25
+ const details = [...new Set(cards.filter((card) => card.href && card.id).map((card) => card.id!))];
40
26
  ---
41
27
 
42
28
  <StarlightPage
@@ -47,94 +33,9 @@ const queued = [
47
33
 
48
34
  <!-- `not-content`: Starlight's prose spacing would push every column after the first down. -->
49
35
  <div class="plan-columns not-content">
50
- <section class="plan-column" data-column="now" aria-labelledby="col-now">
51
- <h2 id="col-now">
52
- <button type="button" class="plan-column__toggle" aria-expanded="true" aria-controls="col-now-cards">
53
- <span class="plan-column__name">Now</span> <span class="plan-column__count">{columns.now.length}</span>
54
- </button>
55
- </h2>
56
- <div class="plan-column__cards" id="col-now-cards">
57
- {columns.now.length === 0 && <p class="plan-empty">Nothing here</p>}
58
- {
59
- columns.now.map((card) => (
60
- <>
61
- <TaskKanbanCard
62
- task={`${card.id} ${card.title}`}
63
- date={planning.now.started ?? ''}
64
- assigneeInitials={initials(card.owner)}
65
- priority={taskPriority(card.size)}
66
- progress={progress}
67
- href={hrefOf(card.id)}
68
- itemId={card.id}
69
- />
70
- {hrefOf(card.id) && <ItemDetail id={card.id} />}
71
- </>
72
- ))
73
- }
74
- </div>
75
- </section>
76
-
77
- {
78
- queued.map((column) => (
79
- <section class="plan-column" data-column={column.name} aria-labelledby={`col-${column.name}`}>
80
- <h2 id={`col-${column.name}`}>
81
- <button type="button" class="plan-column__toggle" aria-expanded="true" aria-controls={`col-${column.name}-cards`}>
82
- <span class="plan-column__name">{column.title}</span> <span class="plan-column__count">{column.cards.length}</span>
83
- </button>
84
- </h2>
85
- <div class="plan-column__cards" id={`col-${column.name}-cards`}>
86
- {column.cards.length === 0 && <p class="plan-empty">Nothing here</p>}
87
- {column.cards.map((card) => (
88
- <>
89
- <KanbanItemCard
90
- title={`${card.id} ${card.title}`}
91
- {...tagOf(card.id)}
92
- assignee={initials(card.owner)}
93
- dueDate={card.detail ?? ''}
94
- priority={sizeToPriority(card.size)}
95
- commentsCount={0}
96
- attachmentsCount={0}
97
- href={hrefOf(card.id)}
98
- itemId={card.id}
99
- />
100
- {hrefOf(card.id) && <ItemDetail id={card.id} />}
101
- </>
102
- ))}
103
- </div>
104
- </section>
105
- ))
106
- }
107
-
108
- <section class="plan-column" data-column="done" aria-labelledby="col-done">
109
- <h2 id="col-done">
110
- <button type="button" class="plan-column__toggle" aria-expanded="true" aria-controls="col-done-cards">
111
- <span class="plan-column__name">Done</span> <span class="plan-column__count">{columns.done.length}</span>
112
- </button>
113
- </h2>
114
- <div class="plan-column__cards" id="col-done-cards">
115
- {columns.done.length === 0 && <p class="plan-empty">Nothing here</p>}
116
- {
117
- columns.done.map((entry) => (
118
- // The result can run to a paragraph; it is on the Log page, not squeezed into a tag.
119
- <>
120
- <KanbanItemCard
121
- title={entry.id ? `${entry.id} ${entry.title}` : entry.title}
122
- {...tagOf(entry.id)}
123
- assignee={initials(entry.owner)}
124
- dueDate={entry.date}
125
- priority="low"
126
- commentsCount={0}
127
- attachmentsCount={0}
128
- href={hrefOf(entry.id)}
129
- itemId={entry.id ?? undefined}
130
- />
131
- {entry.id && hrefOf(entry.id) && <ItemDetail id={entry.id} />}
132
- </>
133
- ))
134
- }
135
- </div>
136
- </section>
36
+ <Board client:load cards={cards} milestones={milestones} />
137
37
  </div>
138
38
 
39
+ {details.map((id) => <ItemDetail id={id} />)}
139
40
  <ItemDialog />
140
41
  </StarlightPage>
@@ -1,9 +1,17 @@
1
1
  ---
2
2
  // The roadmap by milestone, in strategy order: what is done, what is in
3
- // progress, and what is queued, all from planning.json.
3
+ // progress, and what is queued, all from planning.json. The milestone
4
+ // timeline (src/components/timeline/Timeline.tsx) sits above the sections.
5
+ // Its inline script runs as the page is parsed, before the strip paints: a
6
+ // `?layout=vertical` link hides the strip until the island has rendered it
7
+ // vertical and deleted the mark (useTimelineLayout.ts), so it never flashes
8
+ // horizontal first. The mark is set on this page only; timeline.css reveals
9
+ // the strip after 3s if the island never loads. It must stay in step with
10
+ // parseTimelineQuery in src/lib/timeline.ts.
4
11
  import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
5
12
 
6
13
  import ExportStamp from '../../components/ExportStamp.astro';
14
+ import Timeline from '../../components/timeline/Timeline';
7
15
  import ItemDetail from '../../components/ItemDetail.astro';
8
16
  import ItemDialog from '../../components/ItemDialog.astro';
9
17
  import LinkedText from '../../components/LinkedText.astro';
@@ -12,10 +20,14 @@ import PlanInteractions from '../../components/PlanInteractions.astro';
12
20
  import RefLink from '../../components/RefLink.astro';
13
21
  import { loadPlanning, roadmapGroups } from '../../lib/planning';
14
22
  import { siteRefs } from '../../lib/references';
23
+ import { timelineMilestones } from '../../lib/timeline';
15
24
  import '../../styles/components.css';
25
+ import '../../styles/timeline.css';
16
26
 
17
27
  const { known } = siteRefs();
18
- const groups = roadmapGroups(loadPlanning()).map((group) => ({
28
+ const planning = loadPlanning();
29
+ const milestones = timelineMilestones(planning, known);
30
+ const groups = roadmapGroups(planning).map((group) => ({
19
31
  ...group,
20
32
  events: group.events.map((event) => {
21
33
  const href = event.id ? known.get(event.id)?.href : null;
@@ -28,6 +40,11 @@ const groups = roadmapGroups(loadPlanning()).map((group) => ({
28
40
  <StarlightPage frontmatter={{ title: 'Roadmap', description: 'Milestones in order, with what is done, in progress and queued.', tableOfContents: false }}>
29
41
  <ExportStamp />
30
42
 
43
+ <script is:inline>
44
+ if (new URLSearchParams(location.search).get('layout') === 'vertical') document.documentElement.dataset.timelinePending = '';
45
+ </script>
46
+ <Timeline client:load milestones={milestones} />
47
+
31
48
  {
32
49
  groups.map((group) => (
33
50
  <section class="roadmap-group">
@@ -37,6 +54,7 @@ const groups = roadmapGroups(loadPlanning()).map((group) => ({
37
54
  </h2>
38
55
  <p class="roadmap-meta">
39
56
  {group.milestone && <strong>{group.milestone.status}</strong>}
57
+ {group.milestone?.target && ` · target ${group.milestone.target}`}
40
58
  {group.milestone && ' · '}
41
59
  {group.progress.done} of {group.progress.total} done
42
60
  {group.milestone?.exitCriteria && (
@@ -1,38 +1,7 @@
1
1
  // The Board and Roadmap in the browser: a plain click on a card opens its item
2
- // popup (any other click is the browser's), and Board columns collapse and
3
- // remember it. Without this script every card is a link and every column open.
4
-
5
- export const STORAGE_KEY = 'pm-docs-site:board:collapsed';
6
-
7
- /** The collapsed column names in storage; junk or no storage is none. */
8
- export function readCollapsed(): Set<string> {
9
- try {
10
- const value: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
11
-
12
- return new Set(Array.isArray(value) ? value.filter((name): name is string => typeof name === 'string') : []);
13
- } catch {
14
- return new Set();
15
- }
16
- }
17
-
18
- function writeCollapsed(names: Set<string>): void {
19
- try {
20
- localStorage.setItem(STORAGE_KEY, JSON.stringify([...names]));
21
- } catch {
22
- // No storage (private mode, a blocked origin): the state lasts until the page closes.
23
- }
24
- }
25
-
26
- function applyCollapsed(names: Set<string>): void {
27
- document.documentElement.dataset.boardCollapsed = [...names].join(' ');
28
-
29
- for (const column of document.querySelectorAll<HTMLElement>('[data-column]')) {
30
- const collapsed = names.has(column.dataset.column ?? '');
31
-
32
- column.toggleAttribute('data-collapsed', collapsed);
33
- column.querySelector('.plan-column__toggle')?.setAttribute('aria-expanded', String(!collapsed));
34
- }
35
- }
2
+ // popup (any other click is the browser's). Without this script every card is
3
+ // a link. The Board's column collapse lives in its island
4
+ // (src/components/board/Board.tsx).
36
5
 
37
6
  function openItem(link: HTMLAnchorElement): void {
38
7
  const dialog = document.querySelector<HTMLDialogElement>('dialog[data-item-dialog]');
@@ -51,10 +20,6 @@ function openItem(link: HTMLAnchorElement): void {
51
20
  }
52
21
 
53
22
  function start(): void {
54
- const collapsed = readCollapsed();
55
-
56
- applyCollapsed(collapsed);
57
-
58
23
  document.addEventListener('click', (event) => {
59
24
  const target = event.target as Element | null;
60
25
  const link = target?.closest<HTMLAnchorElement>('a[data-item]');
@@ -68,17 +33,6 @@ function start(): void {
68
33
 
69
34
  if (target?.closest('[data-item-dialog-close]')) {
70
35
  target.closest('dialog')?.close();
71
- return;
72
- }
73
-
74
- const toggle = target?.closest<HTMLButtonElement>('.plan-column__toggle');
75
- const name = toggle?.closest<HTMLElement>('[data-column]')?.dataset.column;
76
-
77
- if (name) {
78
- if (collapsed.has(name)) collapsed.delete(name);
79
- else collapsed.add(name);
80
- writeCollapsed(collapsed);
81
- applyCollapsed(collapsed);
82
36
  }
83
37
  });
84
38
  }