create-pmos 0.609.0 → 0.611.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 (145) hide show
  1. package/package.json +69 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-columns-test.js +2 -1
  7. package/workspace/board-deliveries-test.js +2 -1
  8. package/workspace/board-programs-test.js +9 -5
  9. package/workspace/board-publish-ui-test.js +2 -1
  10. package/workspace/board-shared-ui-test.js +2 -1
  11. package/workspace/board-workflows-test.js +2 -1
  12. package/workspace/briefing-premium-adddoc-test.js +2 -1
  13. package/workspace/briefing-premium-board-test.js +10 -9
  14. package/workspace/briefing-premium-doc-edit-test.js +2 -1
  15. package/workspace/briefing-premium-initiative-test.js +7 -6
  16. package/workspace/briefing-premium-insights-test.js +12 -11
  17. package/workspace/briefing-premium-products-test.js +4 -2
  18. package/workspace/briefing-premium-sources-test.js +1 -1
  19. package/workspace/briefing-premium-test.js +6 -5
  20. package/workspace/briefing-premium-work-test.js +1 -1
  21. package/workspace/calm-timeline-test.js +2 -1
  22. package/workspace/changelog.json +68 -0
  23. package/workspace/core-docs-workflow-test.js +2 -1
  24. package/workspace/ev-everywhere-test.js +11 -10
  25. package/workspace/guide/home.md +2 -2
  26. package/workspace/guide/index.md +4 -0
  27. package/workspace/guide/layout.md +92 -11
  28. package/workspace/guide/programs.md +16 -2
  29. package/workspace/guide/routine.md +50 -0
  30. package/workspace/guide/scheduled-tasks-and-cli.md +1 -1
  31. package/workspace/guide/settings-and-switches.md +1 -1
  32. package/workspace/home-other-product-test.js +2 -1
  33. package/workspace/home-railcard-test.js +2 -1
  34. package/workspace/impact-screens-test.js +3 -1
  35. package/workspace/ini-workflow-test.js +2 -1
  36. package/workspace/lib/beside-page.js +15 -0
  37. package/workspace/lib/classic-board.js +15 -0
  38. package/workspace/lib/events-place.js +216 -0
  39. package/workspace/lib/library-items.js +78 -0
  40. package/workspace/lib/notes.js +6 -1
  41. package/workspace/lib/route-modules.js +4 -0
  42. package/workspace/lib/routes-events-place.js +166 -0
  43. package/workspace/lib/routes-library.js +89 -0
  44. package/workspace/lib/routes-pop-work.js +39 -0
  45. package/workspace/lib/routes-report-setups.js +20 -0
  46. package/workspace/lib/routes-today-log.js +48 -0
  47. package/workspace/lib/routine-reports.js +52 -0
  48. package/workspace/lib/today-log.js +131 -0
  49. package/workspace/live-pill-round-test.js +11 -9
  50. package/workspace/metric-drafts-ui-test.js +3 -1
  51. package/workspace/milestone-pins-test.js +2 -1
  52. package/workspace/milestone-suggest-test.js +3 -1
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -1
  55. package/workspace/panels-test.js +6 -4
  56. package/workspace/premium-board-actions-test.js +3 -1
  57. package/workspace/premium-chat-context-test.js +6 -6
  58. package/workspace/premium-chat-line-test.js +1 -1
  59. package/workspace/premium-chat-notes-test.js +1 -1
  60. package/workspace/premium-core-doc-issue-test.js +2 -1
  61. package/workspace/premium-rec-tab-test.js +2 -1
  62. package/workspace/premium-vw-backlog-test.js +3 -1
  63. package/workspace/premium-vw-cal-test.js +1 -1
  64. package/workspace/premium-vw-doc-test.js +2 -1
  65. package/workspace/premium-vw-item-test.js +3 -1
  66. package/workspace/premium-vw-jira-test.js +3 -1
  67. package/workspace/product-lane-test.js +2 -1
  68. package/workspace/program-charter-test.js +3 -1
  69. package/workspace/program-leave-test.js +3 -1
  70. package/workspace/program-order-test.js +2 -1
  71. package/workspace/program-panel-test.js +5 -3
  72. package/workspace/public/pm/bd-ini-panel.js +75 -8
  73. package/workspace/public/pm/bd-prog-panel.js +55 -8
  74. package/workspace/public/pm/bd-scroll.js +4 -2
  75. package/workspace/public/pm/bd-work.css +130 -0
  76. package/workspace/public/pm/bd-work.js +356 -0
  77. package/workspace/public/pm/cozy-board.css +3 -0
  78. package/workspace/public/pm/cozy-ev.css +52 -0
  79. package/workspace/public/pm/cozy-events-view.js +142 -0
  80. package/workspace/public/pm/cozy-events.css +107 -0
  81. package/workspace/public/pm/cozy-events.js +210 -0
  82. package/workspace/public/pm/cozy-evmodel.js +1 -1
  83. package/workspace/public/pm/cozy-library.css +36 -0
  84. package/workspace/public/pm/cozy-live-pill.js +3 -1
  85. package/workspace/public/pm/cozy-nav.js +70 -7
  86. package/workspace/public/pm/cozy-panels.js +1 -1
  87. package/workspace/public/pm/cozy-pick.css +3 -0
  88. package/workspace/public/pm/cozy-pick.js +6 -2
  89. package/workspace/public/pm/cozy-pop-work.css +165 -0
  90. package/workspace/public/pm/cozy-pop-work.js +427 -0
  91. package/workspace/public/pm/cozy-popup.css +113 -0
  92. package/workspace/public/pm/cozy-popup.js +408 -0
  93. package/workspace/public/pm/cozy-routine-model.js +111 -0
  94. package/workspace/public/pm/cozy-routine-pop.js +196 -0
  95. package/workspace/public/pm/cozy-routine.css +102 -0
  96. package/workspace/public/pm/cozy-routine.js +156 -0
  97. package/workspace/public/pm/cozy-schedwork.js +6 -5
  98. package/workspace/public/pm/cozy-settings.js +10 -1
  99. package/workspace/public/pm/cozy-today-app.js +236 -0
  100. package/workspace/public/pm/cozy-today-model.js +176 -0
  101. package/workspace/public/pm/cozy-today-page.css +100 -0
  102. package/workspace/public/pm/cozy-today-view.js +76 -0
  103. package/workspace/public/pm/cozy-viewer.js +66 -18
  104. package/workspace/public/pm/home-app.js +29 -6
  105. package/workspace/public/pm/home-ini.js +39 -7
  106. package/workspace/public/pm/library-model.js +69 -0
  107. package/workspace/public/pm/library-open.js +34 -0
  108. package/workspace/public/pm/page-chat.js +16 -4
  109. package/workspace/public/pm/pop-sessions.js +65 -0
  110. package/workspace/public/pm/pop-work-model.js +335 -0
  111. package/workspace/public/pm/premium-board.js +137 -11
  112. package/workspace/public/pm/premium-insights.js +14 -2
  113. package/workspace/public/pm/premium-library.js +122 -0
  114. package/workspace/public/pm/premium-shell.js +1 -1
  115. package/workspace/public/premium-board.html +1 -0
  116. package/workspace/public/premium-events.html +42 -0
  117. package/workspace/public/premium-library.html +31 -0
  118. package/workspace/public/premium-routine.html +31 -0
  119. package/workspace/public/today.html +50 -0
  120. package/workspace/ready-dash-ui-test.js +3 -1
  121. package/workspace/rename-test.js +2 -1
  122. package/workspace/run-tests.js +4 -1
  123. package/workspace/server.js +3 -2
  124. package/workspace/sort-order-test.js +2 -1
  125. package/workspace/split-merge-ui-test.js +3 -1
  126. package/workspace/stage-card-tasks-test.js +5 -3
  127. package/workspace/stage-card-test.js +2 -1
  128. package/workspace/task-card-test.js +2 -1
  129. package/workspace/task-delete-test.js +3 -1
  130. package/workspace/task-links-test.js +4 -2
  131. package/workspace/task-milestones-test.js +4 -2
  132. package/workspace/task-plans-test.js +3 -1
  133. package/workspace/task-press-test.js +3 -1
  134. package/workspace/task-views-test.js +10 -8
  135. package/workspace/test-lists/events-place.json +11 -0
  136. package/workspace/test-lists/library-place.json +9 -0
  137. package/workspace/test-lists/one-popup.json +9 -0
  138. package/workspace/test-lists/pop-work.json +9 -0
  139. package/workspace/test-lists/routine-place.json +9 -0
  140. package/workspace/test-lists/today-log.json +9 -0
  141. package/workspace/test-lists/work-view.json +9 -0
  142. package/workspace/timeline-holds-test.js +3 -1
  143. package/workspace/tk-tasks-test.js +3 -1
  144. package/workspace/viewer-trail-test.js +1 -1
  145. package/workspace/workflows-setup-test.js +1 -1
@@ -10,6 +10,7 @@
10
10
  * T5 Pause, Resume, Stop · T6 a phone
11
11
  * Every wait polls the page; no fixed sleep stands in for a state. */
12
12
  const path = require('path');
13
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
13
14
  const { spawn } = require('child_process');
14
15
  const { findBrowser } = require('./lib/find-browser');
15
16
  const T = require('./test-run').configure({ name: 'premium-rec-tab' });
@@ -64,7 +65,7 @@ async function context(o = {}) {
64
65
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
65
66
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
66
67
  await T.waitForServer(BASE);
67
- browser = await chromium.launch({ executablePath: exe });
68
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
68
69
  const W = F.world();
69
70
  const posted = (S, pth) => S.posts.filter((x) => x.path === pth);
70
71
 
@@ -5,6 +5,8 @@
5
5
  * viewer still offers it: the sprint view's "Open the backlog", with the sprint view opened through its module over a task dialog of the
6
6
  * initiative page. GET /api/boards/sprints and the page models are stand-ins. The Board is checked to carry none of it. Every wait polls the page; no fixed sleep stands in for a state. */
7
7
  const path = require('path');
8
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
9
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
8
10
  const { spawn } = require('child_process');
9
11
  const { findBrowser } = require('./lib/find-browser');
10
12
  const { openMission } = require('./lib/open-mission');
@@ -44,7 +46,7 @@ const SPRINTS = { ok: true, source: 'jira', readAt: '2026-10-19T09:00:00Z', velo
44
46
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
45
47
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
46
48
  await T.waitForServer(BASE);
47
- browser = await chromium.launch({ executablePath: exe });
49
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
48
50
 
49
51
  const open = async ({ w = 1280, h = 900, theme = 'light', sprints = SPRINTS } = {}) => {
50
52
  const ctx = await openMission(await browser.newContext({ viewport: { width: w, height: h } }));
@@ -146,7 +146,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
146
146
  await E.ctx.close();
147
147
 
148
148
  /* C9 on Home, the Viewer widens for the week */
149
- const G = await F.open(browser, BASE, '/premium.html', { w: 1440, h: 900 });
149
+ const G = await F.open(browser, BASE, '/premium.html', { w: 1520, h: 900 }); // the rail of places takes 80 px of Home's desk (six-place navigation): at 1520 the side beside the chat is as wide as it was at 1440
150
150
  await until(() => G.page.evaluate(() => !!(window.czViews && window.czViews.openCalendar)), 15000);
151
151
  await G.page.evaluate(() => window.czViews.openCalendar());
152
152
  await until(() => G.page.evaluate(() => !!document.querySelector('#czViewer .vzc-dy')), 15000);
@@ -9,6 +9,7 @@
9
9
  const path = require('path');
10
10
  const { spawn } = require('child_process');
11
11
  const { findBrowser } = require('./lib/find-browser');
12
+ const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
12
13
  const T = require('./test-run').configure({ name: 'premium-vw-doc' });
13
14
  const IP = require('./lib/initiative-premium.js');
14
15
  const F = require('./fixtures/initiative-premium-facts.js');
@@ -46,7 +47,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
46
47
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
47
48
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_SELF_ROOT: path.resolve(__dirname, '..') }) });
48
49
  await T.waitForServer(BASE);
49
- browser = await chromium.launch({ executablePath: exe });
50
+ browser = besidePage(await chromium.launch({ executablePath: exe }));
50
51
 
51
52
  const open = async ({ w = 1280, h = 900, theme = 'light', props = [], post = null, live = false } = {}) => {
52
53
  const ctx = await browser.newContext({ viewport: { width: w, height: h } });
@@ -6,6 +6,8 @@
6
6
  * Overview offers Open the full record and opens each task; inside the record a task opens in its place, and the task's initiative link brings the record back.
7
7
  * Every wait polls the page; no fixed sleep stands in for a state. */
8
8
  const path = require('path');
9
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
10
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
9
11
  const { spawn } = require('child_process');
10
12
  const { findBrowser } = require('./lib/find-browser');
11
13
  const { openMission } = require('./lib/open-mission');
@@ -38,7 +40,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
38
40
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
39
41
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
40
42
  await T.waitForServer(BASE);
41
- browser = await chromium.launch({ executablePath: exe });
43
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
42
44
  const MODEL = IP.build(F.facts());
43
45
 
44
46
  const open = async ({ w = 1280, h = 900, theme = 'light', answer = null } = {}) => {
@@ -8,6 +8,8 @@
8
8
  * so the sprint view is opened through its module (openSprint) over a task dialog of the initiative page, which loads the same view.
9
9
  * F floors: 390 px with no sideways scroll, 44 px targets, light and dark, no write */
10
10
  const path = require('path');
11
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
12
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
11
13
  const { spawn } = require('child_process');
12
14
  const { findBrowser } = require('./lib/find-browser');
13
15
  const { openMission } = require('./lib/open-mission');
@@ -67,7 +69,7 @@ const TICKETS = {
67
69
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
68
70
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT), PMOS_NO_OPEN: '1' }) });
69
71
  await T.waitForServer(BASE);
70
- browser = await chromium.launch({ executablePath: exe });
72
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
71
73
 
72
74
  const model = (sprints) => BP.build(F.facts({ sprints }));
73
75
  const IMODEL = IP.build(IF.facts());
@@ -15,6 +15,7 @@
15
15
  * Q the phone: ◇ only; a tap on the folded lane opens a sheet with the product's milestones in date order
16
16
  * SHOTS_17=<dir>: the Board, the counted ◇'s list, folded and the phone sheet, into <dir>. */
17
17
  const path = require('path');
18
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
18
19
  const { spawn } = require('child_process');
19
20
  const { findBrowser } = require('./lib/find-browser');
20
21
  const T = require('./test-run').configure({ name: 'product-lane' });
@@ -69,7 +70,7 @@ function model() {
69
70
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
70
71
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
71
72
  await T.waitForServer(BASE);
72
- browser = await chromium.launch({ executablePath: exe });
73
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
73
74
 
74
75
  /** The Board on the timeline, All products. o: { w, h, span, phone, fold } */
75
76
  const open = async (o = {}) => {
@@ -9,6 +9,8 @@
9
9
  * P the picker by product with each ◆ Deliver day; an earlier milestone date warns · X what stops a save · D the drafts · N the name ·
10
10
  * O "Open again" on a done check · H on a phone. PMOS_SHOTS=<dir> also saves the screenshots the frames are compared with. */
11
11
  const path = require('path');
12
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
13
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
12
14
  const fs = require('fs');
13
15
  const { spawn } = require('child_process');
14
16
  const { findBrowser } = require('./lib/find-browser');
@@ -41,7 +43,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
41
43
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
42
44
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
43
45
  await T.waitForServer(BASE);
44
- browser = await chromium.launch({ executablePath: exe });
46
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
45
47
  if (SHOTS) fs.mkdirSync(SHOTS, { recursive: true });
46
48
  const shot = async (p, name) => { if (SHOTS) await p.screenshot({ path: path.join(SHOTS, name + '.png') }); };
47
49
 
@@ -9,11 +9,13 @@
9
9
  * its place; Move to another program lists the other program with its count; a phone's ⋯ holds the same items
10
10
  * H Home: the initiative page's ⋯ holds the same two items; an initiative in no program keeps Turn into a program and has neither */
11
11
  const fs = require('fs');
12
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
12
13
  const os = require('os');
13
14
  const path = require('path');
14
15
  const { Readable } = require('stream');
15
16
  const { spawn } = require('child_process');
16
17
  const { findBrowser } = require('./lib/find-browser');
18
+ const { besidePage } = require('./lib/beside-page'); // these checks are about work beside the page, not the popup
17
19
  const T = require('./test-run').configure({ name: 'program-leave' });
18
20
  const BP = require('./lib/board-premium.js');
19
21
  const F = require('./fixtures/board-premium-facts.js');
@@ -77,7 +79,7 @@ const waitsOf = (id) => ((R.all(rctx).find((p) => p.id === 'project-ascent') ||
77
79
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
78
80
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
79
81
  await T.waitForServer(BASE);
80
- browser = await chromium.launch({ executablePath: exe });
82
+ browser = classicBoard(besidePage(await chromium.launch({ executablePath: exe })));
81
83
 
82
84
  const board = async (o = {}) => {
83
85
  seed();
@@ -8,6 +8,7 @@
8
8
  * (the programs, products and a product's initiatives are Home's and the Board's own lists, [data-po-list^="@"]: sort-order-test.js)
9
9
  * H Home: the program group lists the same order; the grip moves a row there too; a phone holds the row, then drags it */
10
10
  const path = require('path');
11
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
11
12
  const { spawn } = require('child_process');
12
13
  const { findBrowser } = require('./lib/find-browser');
13
14
  const T = require('./test-run').configure({ name: 'program-order' });
@@ -53,7 +54,7 @@ const routePrograms = async (page) => {
53
54
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
54
55
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
55
56
  await T.waitForServer(BASE);
56
- browser = await chromium.launch({ executablePath: exe });
57
+ browser = classicBoard(await chromium.launch({ executablePath: exe }));
57
58
 
58
59
  const board = async (o = {}) => {
59
60
  const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch });
@@ -13,6 +13,8 @@
13
13
  * KRs (GET /api/boards/anchors), the Insights goals (GET /api/insights-premium) and the PMOS tasks (GET /api/boards/items) answer from
14
14
  * fixtures/program-ascent.js. */
15
15
  const path = require('path');
16
+ const { besidePage } = require('./lib/beside-page'); // these checks read the full page beside the page; in the popup work shows its three parts (nav slice 3)
17
+ const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
16
18
  const { spawn } = require('child_process');
17
19
  const { findBrowser } = require('./lib/find-browser');
18
20
  const { openMission } = require('./lib/open-mission');
@@ -44,7 +46,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
44
46
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
45
47
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
46
48
  await T.waitForServer(BASE);
47
- browser = await chromium.launch({ executablePath: exe });
49
+ browser = besidePage(classicBoard(await chromium.launch({ executablePath: exe })));
48
50
 
49
51
  const open = async ({ w = 1440, h = 900, qs = '?ws=idpf&program=project-ascent', ctx = null, programs = F.programs() } = {}) => {
50
52
  const c = ctx || await openMission(await browser.newContext({ viewport: { width: w, height: h } }));
@@ -76,7 +78,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
76
78
  ok('P ?program=<id> sends bd:program once: one path opens the program', await p.evaluate(() => window.__bdp) === 1, String(await p.evaluate(() => window.__bdp)));
77
79
  const hd = await p.evaluate(() => { const v = document.querySelector('#czViewer'); const r = v.getBoundingClientRect(); return { t: v.querySelector('.cz-vw-title').textContent, kind: (v.querySelector('.cz-vw-kind') || {}).textContent, tools: [...v.querySelectorAll('.cz-vw-head [data-cz-vw], [data-cz-vw]')].filter((b) => b.closest('#czViewer') && !b.classList.contains('cz-vw-grip')).map((b) => b.getAttribute('aria-label')), input: v.querySelectorAll('.cz-vw-body input, .cz-vw-body textarea').length, tabs: [...v.querySelectorAll('[data-pv="tab"]')].map((t) => t.dataset.k + (t.getAttribute('aria-selected') === 'true' ? '*' : '')), w: Math.round(r.width), right: Math.round(innerWidth - r.right), sel: !!document.querySelector('#ibBody [data-prow="project-ascent"].sel') }; });
78
80
  ok('P the shell\'s header names it once ("title · goal"), with Discuss in chat, ⋯, ⧉ Arrange and Close, and no Work | Dashboard toggle (batch 21 item 2: one page); no chat box; the tabs Tasks, Initiatives (open first), Reports, Documents', hd.t === 'Project Ascent · CIAM migration' && hd.kind === 'Program' && [...new Set(hd.tools)].join('|') === 'Discuss in chat|More|Arrange|Close the viewer' && hd.input === 0 && hd.tabs.join() === 'tasks,initiatives*,reports,documents', JSON.stringify(hd));
79
- ok('V the program opens beside the page, at the right edge, no wider than leaves the Board its 880 px (506 at 1440), and its band row on the Board is selected', hd.w === 506 && hd.right < 40 && hd.sel && await p.evaluate(() => !document.querySelector('#czViewer.cz-vw-float') && !!document.querySelector('.cz-pn-div')), JSON.stringify(hd));
81
+ ok('V the program opens beside the page, at the right edge, no wider than leaves the Board its 880 px (426 at 1440, beside the rail of places), and its band row on the Board is selected', hd.w === 426 && hd.right < 40 && hd.sel && await p.evaluate(() => !document.querySelector('#czViewer.cz-vw-float') && !!document.querySelector('.cz-pn-div')), JSON.stringify(hd));
80
82
  const sm = await p.evaluate(() => ({ line: (document.querySelector('#czViewer .pv-line') || {}).textContent || '', pri: (document.querySelector('#czViewer .czs-pri') || {}).textContent || '' }));
81
83
  ok('P the ✦ line leads with the next milestone and says what waits on you once; no sort primary while every task has a level', /Next: Pilot live/.test(sm.line) && /One thing waits on you/.test(sm.line) && sm.pri === '', JSON.stringify(sm));
82
84
  const g = await p.evaluate(() => ({ per: document.querySelector('#czViewer .pp-per').textContent.trim(), krs: [...document.querySelectorAll('#czViewer .pp-goal .pp-kr:not(.ghost) b')].map((b) => b.textContent) }));
@@ -132,7 +134,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
132
134
  await p.focus('.cz-pn-div');
133
135
  await p.keyboard.press('ArrowLeft');
134
136
  const gw = await p.evaluate(() => { const r = document.querySelector('#czViewer').getBoundingClientRect(); let kept = null; try { kept = JSON.parse(localStorage.getItem('cz-pn:board')); } catch { /* none */ } return { w: Math.round(r.width), kept }; });
135
- ok('V the divider beside the page widens it 24 px, and the Board keeps the share (not a width per kind)', gw.w === 530 && !!gw.kept && gw.kept.v === 2, JSON.stringify(gw));
137
+ ok('V the divider beside the page widens it 24 px, and the Board keeps the share (not a width per kind)', gw.w === 450 && !!gw.kept && gw.kept.v === 2, JSON.stringify(gw));
136
138
  await p.keyboard.press('Escape');
137
139
  ok('P Escape closes the Viewer', await until(() => p.evaluate(() => document.querySelector('#czViewer').hidden)));
138
140
  ok('0 no page error on desktop', D.errors.length === 0, D.errors.join(' | '));
@@ -38,6 +38,9 @@ import * as MD from './home-ini-model.js'; // the stage move's rules, as Home
38
38
  import * as WF from './ini-wf.js'; // D99: Change workflow, Won't do, Back to Triage, Archive, the same popovers as Home's
39
39
  import { openPop, closePop, undoToast, ensureCss as ensurePopCss } from './hi-pop.js';
40
40
  import { readyOf } from './bd-acts.js'; // how much of the step is ready, beside the next stage in the stage picker
41
+ import * as PW from './cozy-pop-work.js'; // what the popup shows for work (slice 3 of the six-place navigation): in the popup, in place of the old page
42
+ import * as PP from './ini-props.js'; // everything PMOS suggests, as a drill-in (the popup's ⋯)
43
+ import { stageName } from './stage-chip.js';
41
44
  import { iniMore as iniMoreOf, iniText, stagePick, deleteSaid, DELETE_MS } from './ini-more.js'; // the one initiative ⋯ menu and stage picker (batch 14 item 5, batch 16 item 5c)
42
45
 
43
46
  let O = null;
@@ -181,9 +184,10 @@ function dashFor(r) {
181
184
  }
182
185
  return DASH.get(r.key);
183
186
  }
184
- function iniBody(r) {
187
+ function iniBody(r, body) {
185
188
  const h = dashFor(r);
186
189
  if (h && h.shows()) return h.html(() => '');
190
+ if (PW.on(body)) return PW.html(r, viewOf(r), popOpts(r));
187
191
  const md = (v) => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+v.slice(5, 7) - 1] + ' ' + +v.slice(8, 10) + (+v.slice(0, 4) !== new Date().getFullYear() ? ' ’' + v.slice(2, 4) : '');
188
192
  const self = !!((O.M() || {}).board || {}).self, M = O.M() || {};
189
193
  // what left the ⋯ for the thing it changes (batch 16 item 5c): the workflow chip, the dashed +, the stage chip, the dates chip, Jira's ↻
@@ -193,10 +197,65 @@ function iniBody(r) {
193
197
  next: !!(r.id && v.stage.next && O.moreAct && !self), docs: docs.length ? { n: docs.length } : null, tail: TL.tailHtml(r, { VW, today: M.today }),
194
198
  wf: !!r.id && !self && !r.ended, person: !!r.id, stagePick: !!r.id, planDates: !!r.id, jira: !!M.jira });
195
199
  }
200
+ /** What pm/cozy-pop-work.js reads for the row: the Board's steps and day, the core documents, the product and the program. */
201
+ function popOpts(r) {
202
+ const M = O.M() || {}, B = M.board || {}, p = O.programOf ? O.programOf(r) : null;
203
+ return { steps: M.steps || [], today: M.today, docs: ((r.id && PAGE.get(r.id)) || {}).docs || [], product: r.wsName || (r.ws && r.ws !== B.ws ? r.ws : (M.product && M.product.name) || B.name || B.ws) || '', program: p ? { id: p.id, title: p.title } : null, canProduct: true, ws: r.ws || B.ws || '', id: r.id || '' };
204
+ }
205
+ /** The popup's own presses for the row: every part of the old page as a drill-in (so nothing is lost), and everything PMOS suggests. */
206
+ function popExtra(r) {
207
+ if (!r) return {};
208
+ const H = { where: () => where(O.rowOf(r.key) || r), reload: () => (O.reload ? O.reload() : null), toast: (m, u) => (O.toast ? O.toast(m, u) : null) };
209
+ return {
210
+ allParts: () => {
211
+ const x = O.rowOf(r.key) || r;
212
+ VW.drill();
213
+ VW.open({ kind: 'Initiative', title: x.title, icon: 'goal', id: 'all:' + vidOf(x), back: true,
214
+ render: (b) => { b.dataset.pwAll = '1'; const y = O.rowOf(r.key) || x; b.innerHTML = iniBody(y, b); wire(b, y.key); } });
215
+ },
216
+ props: r.id ? () => { const x = O.rowOf(r.key) || r; VW.drill(); PP.open(viewOf(x), H); } : null,
217
+ product: () => openProduct(O.rowOf(r.key) || r),
218
+ };
219
+ }
220
+ /** The product one level up, in the same popup (board 27): its programs, then the initiatives in no program, with the timeline. A row goes one
221
+ * level down. Read from the Board's own model, so nothing new is fetched. */
222
+ function productOf(ws) {
223
+ const M = O.M() || {}, B = M.board || {}, today = M.today;
224
+ const all = (M.rows || []).filter((x) => x.id && !x.archived && (x.ws || B.ws || '') === ws); // the board's own row (no id) is not work
225
+ const progs = new Map(), loose = [];
226
+ for (const x of all) { const p = O.programOf ? O.programOf(x) : null; if (p) { if (!progs.has(p.id)) progs.set(p.id, { p, rows: [] }); progs.get(p.id).rows.push(x); } else loose.push(x); }
227
+ const lo = (rs) => rs.map((x) => String(x.start || '').slice(0, 10)).filter(Boolean).sort()[0] || '';
228
+ const hi = (rs) => rs.map((x) => String(x.end || '').slice(0, 10)).filter(Boolean).sort().pop() || '';
229
+ const done = (x) => x.status === 'done' || !!x.closed;
230
+ const rows = [];
231
+ for (const { p, rows: rs } of progs.values()) rows.push({ id: p.id, kind: 'program', title: p.title, stage: '', count: rs.length + (rs.length === 1 ? ' initiative' : ' initiatives'), start: lo(rs), end: hi(rs), done: rs.every(done) });
232
+ for (const x of loose) rows.push({ id: x.key, kind: 'ini', title: x.title, stage: stageName(x) || (x.track && x.track.label) || '', start: String(x.start || '').slice(0, 10), end: String(x.end || '').slice(0, 10), done: done(x) });
233
+ const name = (all[0] && all[0].wsName) || (ws === B.ws ? (M.product && M.product.name) || B.name : '') || ws;
234
+ const late = rows.filter((x) => x.end && !x.done && today && x.end < today).length;
235
+ const facts = [{ k: 'Programs', v: String(progs.size) }, { k: 'Initiatives', v: String(all.length), note: late ? late + ' late' : '', warn: late > 0 }];
236
+ const mo = (d) => (d ? new Date(d + 'T12:00:00Z').toLocaleDateString('en-GB', { month: 'short', year: 'numeric', timeZone: 'UTC' }) : '');
237
+ if (lo(all) || hi(all)) facts.push({ k: 'Dates', v: [mo(lo(all)), mo(hi(all))].filter(Boolean).join(' to ') });
238
+ const said = all.length ? all.length + (all.length === 1 ? ' initiative' : ' initiatives') + (progs.size ? ' in ' + progs.size + (progs.size === 1 ? ' program' : ' programs') + (loose.length ? ' and ' + loose.length + ' on their own' : '') : '') + (late ? ', ' + late + ' late.' : ', none late.') : 'No initiative is in it yet.';
239
+ return { kind: 'product', title: name, summary: said, facts, rows, docs: [], today };
240
+ }
241
+ function openProduct(r) {
242
+ const M = O.M() || {}, ws = r.ws || (M.board || {}).ws || '';
243
+ const L0 = productOf(ws);
244
+ VW.drill();
245
+ VW.open({ kind: 'Product', title: L0.title, icon: 'goal', id: 'product:' + ws, back: true,
246
+ render: (body) => {
247
+ const L = productOf(ws);
248
+ body.innerHTML = PW.levelHtml(L, { today: L.today, add: false });
249
+ PW.wireLevel(body, {
250
+ redraw: () => { const t = body.scrollTop, L2 = productOf(ws); body.innerHTML = PW.levelHtml(L2, { today: L2.today, add: false }); body.scrollTop = t; },
251
+ go: (kind, id, b) => { if (kind === 'program' && O.openProgram) { VW.drill(); O.openProgram(id, b); } else if (kind === 'ini' && O.openIniId) { const x = O.rowOf(id); VW.drill(); if (x && x.id) O.openIniId(x.id); } },
252
+ }, () => productOf(ws));
253
+ } });
254
+ }
196
255
  /** Presses inside the shown item: the view's own (pm/ini-view.js), a ticket's drill-in, the PRD-change question. A [data-doc] goes to the page's handler. */
197
256
  function wire(body, key) {
198
- const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk)) return; const top = body.scrollTop; body.innerHTML = iniBody(r); body.scrollTop = top; };
199
- wireView(body, {
257
+ const redraw = () => { const r = O.rowOf(key); if (!r || (cur && cur.tk && !body.dataset.pwAll)) return; const top = body.scrollTop; body.innerHTML = iniBody(r, body); body.scrollTop = top; };
258
+ const H = {
200
259
  // planned versus actual (batch 11 item 8, pm/ini-versions.js): where a draft's writes go, the read after Make live, the toast with Undo
201
260
  where: () => { const r = O.rowOf(key), M = O.M() || {}; return { ws: (r && r.ws) || (M.board && M.board.ws), board: (r && r.boardId) || (M.board && M.board.id) }; },
202
261
  reload: () => (O.reload ? O.reload() : null),
@@ -239,7 +298,13 @@ function wire(body, key) {
239
298
  openIni: (id) => { if (O.openIniId) O.openIniId(id); },
240
299
  doc: (path) => O.viewDoc(path),
241
300
  redraw,
242
- });
301
+ };
302
+ // in the popup: what the popup shows for work (pm/cozy-pop-work.js), with the same handlers; else the old page
303
+ if (PW.on(body)) {
304
+ PW.wire(body, { ...H, ...popExtra(O.rowOf(key)) }, { r: () => O.rowOf(key), v: () => { const r = O.rowOf(key); return r ? viewOf(r) : null; }, o: () => { const r = O.rowOf(key); return r ? popOpts(r) : {}; } });
305
+ return;
306
+ }
307
+ wireView(body, H);
243
308
  body.onclick = (e) => {
244
309
  const r = O.rowOf(key); if (!r) return;
245
310
  const tk = e.target.closest('[data-tk]'); if (tk) { const k = ((r.track && r.track.tickets) || []).find((x) => x.key === tk.dataset.tk); if (k) openTicket(r, k); return; }
@@ -259,8 +324,10 @@ export function openIni(r, from, o = {}) {
259
324
  readPage(r, true); // the gate chips, Core documents and the stakeholders, as Home's page shows them
260
325
  { const h = dashFor(r); if (h) h.read(o.via || 'act'); } // a Board row is a press to act (PbH1Header); a link to read passes via 'read'
261
326
  // the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
262
- VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r),
263
- discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => iniMore(O.rowOf(r.key) || r), rename: O.rename ? O.rename(r) : null,
327
+ // on a desk it opens in the one popup with Ask PMOS about it beside it (slice 2 of the six-place navigation); a phone keeps its sheet
328
+ const B = (O.M() || {}).board || {};
329
+ VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r), pop: { id: r.id || '', kind: 'initiative', title: r.title, ws: r.ws || B.ws || undefined },
330
+ discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => { const x = O.rowOf(r.key) || r, b = VW.bodyOf(vidOf(x)); return (PW.on(b) ? PW.moreItems(null, popExtra(x)) : []).concat(iniMore(x)); }, rename: O.rename ? O.rename(r) : null,
264
331
  // the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
265
332
  // (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
266
333
  presses: (window.PMOS_READONLY ? [] : [WK.pressOf(r.kind)]).concat(dashFor(r) ? dashFor(r).presses() : []), onPress: (a, b) => {
@@ -271,7 +338,7 @@ export function openIni(r, from, o = {}) {
271
338
  apply: (k) => { const y = O.rowOf(r.key) || x; y.kind = k; VW.setPresses(vidOf(y), [WK.pressOf(k)].concat(dashFor(y) ? dashFor(y).presses() : [])); if (O.redraw) O.redraw(); refresh(true); },
272
339
  reload: async () => { if (O.reload) await O.reload(); } }), !!((O.M() || {}).board || {}).factory);
273
340
  },
274
- render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null, vid: vidOf(x) }; O.onShow(x.key, from); body.innerHTML = iniBody(x); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
341
+ render: (body) => { const x = O.rowOf(r.key) || r; cur = { key: x.key, tk: null, vid: vidOf(x) }; O.onShow(x.key, from); body.innerHTML = iniBody(x, body); wire(body, x.key); { const h = dashFor(x); if (h) h.wire(body); } if (adding === x.key) { const f = body.querySelector('#ivAddTask'); if (f && document.activeElement !== f) f.focus(); } },
275
342
  onClose: () => { if (cur && cur.key === r.key && !cur.tk) { cur = null; O.onHide(); } } });
276
343
  }
277
344
 
@@ -305,7 +372,7 @@ export function refresh(force) {
305
372
  const b = VW.bodyOf(vidOf(r)); if (!b || (!force && document.activeElement && b.contains(document.activeElement))) return;
306
373
  if (cur.tk) return; // the ticket Viewer reads its own records (tk-view.js); Read Jira again opens it fresh
307
374
  const top = b.scrollTop;
308
- b.innerHTML = iniBody(r);
375
+ b.innerHTML = iniBody(r, b);
309
376
  b.scrollTop = top;
310
377
  }
311
378
  /** Close the initiative's own Viewer (never the chat beside it). A ticket drilled in shows under its own id: the Viewer used last, as before. */
@@ -40,7 +40,8 @@ import * as MSG from './ms-suggest.js';
40
40
  import * as MD from './metric-drafts.js'; // the goal Claude drafts when the charter has none (batch 15 item 1, canvas Iq9Program)
41
41
  import * as DB from './dash-view.js'; // the page model's parts: the reports and the proposals (batch 17 item 1)
42
42
  import { stageName } from './stage-chip.js'; // W1: the one stage
43
- import * as PV from './prog-page.js'; // the one program page: the top and four tabs (batch 21 item 2, canvas RdProgL–RdProgP)
43
+ import * as PV from './prog-page.js';
44
+ import * as PW from './cozy-pop-work.js'; // in the popup: the program one level up, the same three parts as an initiative (slice 3, board 26) // the one program page: the top and four tabs (batch 21 item 2, canvas RdProgL–RdProgP)
44
45
 
45
46
  const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
46
47
  const I = {
@@ -413,6 +414,7 @@ function draw(keepFocus) {
413
414
  const p = progOf(cur.id); if (!p) { VW.close(); return; }
414
415
  readAway(p); readMore(p); readDrafts(p);
415
416
  const b = VW.body(); if (!b) return;
417
+ if (PW.on(b)) { const t = b.scrollTop, L = levelOf(cur.id); if (L) { b.innerHTML = PW.levelHtml(L, { today: L.today, add: false }); b.scrollTop = t; } return; } // the program in the popup (board 26)
416
418
  const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
417
419
  const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
418
420
  const top = b.scrollTop;
@@ -474,9 +476,59 @@ function openPanel(id, from, via) {
474
476
  rename.save = ((save) => async (title, x) => { const r = await save(title, x); if (!r.ok) return r; p.title = r.title; rename.value = r.title; return { ...r, title: titleOf(p) }; })(rename.save);
475
477
  rename.value = p.title;
476
478
  VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program:' + id,
477
- discuss: true, more: moreOf(p), rename,
479
+ // on a desk the program opens in the one popup, the chat about it beside it (slice 3 of the six-place navigation, board 26)
480
+ pop: RO ? undefined : { id: p.id, kind: 'program', title: p.title, ws: p.home || board().ws || undefined },
481
+ discuss: true, more: () => (PW.on(VW.bodyOf('program:' + id)) ? [{ label: 'Every part', on: () => allParts(id) }, { sep: true }] : []).concat(moreOf(progOf(id) || p)), rename,
478
482
  render: (body) => {
479
483
  { const q = progOf(id); if (q && VW.current() && VW.current().title !== titleOf(q)) VW.retitle('program:' + id, titleOf(q)); } // a rename in the charter, on ←
484
+ if (PW.on(body)) { levelDraw(body, id, from); return; }
485
+ oldDraw(body, id, from);
486
+ },
487
+ onClose: () => {
488
+ document.querySelectorAll('#ibBody [data-prow].sel').forEach((x) => x.classList.remove('sel'));
489
+ cur = null;
490
+ } });
491
+ return true;
492
+ }
493
+ /** The program in the popup (board 26): Overview, its initiatives with the timeline, its artefacts. A row opens the initiative in the same popup. */
494
+ function levelOf(id) {
495
+ const p = progOf(id); if (!p) return null;
496
+ const st = programState(p, rowsOf);
497
+ const rows = st.inis.map((i) => ({ id: i.id, kind: 'ini', ws: i.ws, title: i.title, stage: stageName(i.row) || (i.row.track && i.row.track.label) || i.stage || '', start: i.row.start || '', end: i.row.end || '', done: i.row.status === 'done' || !!i.row.closed }));
498
+ const today = (O.M() || {}).today;
499
+ const late = rows.filter((x) => x.end && !x.done && today && x.end < today).length;
500
+ const nx = st.next;
501
+ const facts = [];
502
+ if (p.goal) facts.push({ k: 'Outcome', v: p.goal });
503
+ if (st.products && st.products.length) facts.push({ k: st.products.length > 1 ? 'Products' : 'Product', v: st.products.map((x) => x.name || x).join(', ') });
504
+ if (st.span && st.span.label) facts.push({ k: 'Dates', v: st.span.label });
505
+ if (nx) facts.push({ k: 'Next milestone', v: nx.name, note: nx.day || '', warn: !!nx.late });
506
+ if (rows.length) facts.push({ k: 'Initiatives', v: String(rows.length), note: late ? late + ' late' : '', warn: late > 0 });
507
+ if (p.owner) facts.push({ k: 'Owner', v: p.owner });
508
+ const said = [p.goal ? p.goal.replace(/\.?$/, '.') : '', rows.length ? (late ? late + ' of ' + rows.length + (rows.length === 1 ? ' initiative is' : ' initiatives are') + ' late.' : rows.length + (rows.length === 1 ? ' initiative' : ' initiatives') + ', none late.') : 'No initiative is in it yet.', nx ? 'Next: ' + nx.name + (nx.day ? ', ' + nx.day : '') + '.' : ''].filter(Boolean).join(' ');
509
+ const docs = [{ title: 'Charter', kind: 'Document', when: '', charter: true }].concat(docsOf(st).map((d) => ({ title: d.name, kind: 'Document · ' + d.ini, when: '', path: d.path })));
510
+ return { kind: 'program', title: p.title, summary: said, facts, rows, docs, today };
511
+ }
512
+ function levelDraw(body, id, from) {
513
+ cur = { id, from: from || (cur && cur.id === id && cur.from) || null };
514
+ const L = levelOf(id); if (!L) { body.innerHTML = ''; return; }
515
+ body.innerHTML = PW.levelHtml(L, { today: L.today, add: false });
516
+ PW.wireLevel(body, {
517
+ redraw: () => { const t = body.scrollTop; const L2 = levelOf(id); if (L2) { body.innerHTML = PW.levelHtml(L2, { today: L2.today, add: false }); body.scrollTop = t; } },
518
+ go: (kind, iid) => { if (kind === 'ini') { VW.drill(); O.openIni(iid, null); } },
519
+ doc: (path) => { const a = document.createElement('button'); a.dataset.doc = path; a.hidden = true; document.body.appendChild(a); a.click(); a.remove(); },
520
+ art: (a) => { if (!a || !a.charter) return false; const q = progOf(id); if (q) openCharter(q); return true; },
521
+ }, () => levelOf(id));
522
+ }
523
+ /** Every part of the old program page, as a drill-in of the popup (so nothing is lost). */
524
+ function allParts(id) {
525
+ const p = progOf(id); if (!p) return;
526
+ VW.drill();
527
+ VW.open({ kind: 'Program', title: titleOf(p), icon: I.prog, id: 'program-all:' + id, back: true, more: moreOf(p),
528
+ render: (body) => { body.dataset.pwAll = '1'; oldDraw(body, id, null); } });
529
+ }
530
+ function oldDraw(body, id, from) {
531
+ {
480
532
  cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
481
533
  body.classList.add('pp-vw');
482
534
  const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = viewHtml(q); }
@@ -491,12 +543,7 @@ function openPanel(id, from, via) {
491
543
  body.onclick = (e) => { if (e.target.closest('[data-db], [data-pv]')) return; const d = e.target.closest('[data-md]'); if (d && body.contains(d) && !d.disabled) { MD.press(d, { redraw: () => draw(), toast: (t) => O.say(t) }); return; } const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
492
544
  body.onsubmit = submit;
493
545
  document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === id));
494
- },
495
- onClose: () => {
496
- document.querySelectorAll('#ibBody [data-prow].sel').forEach((x) => x.classList.remove('sel'));
497
- cur = null;
498
- } });
499
- return true;
546
+ }
500
547
  }
501
548
  function setFold(k) { if (fold.has(k)) fold.delete(k); else fold.add(k); keepFold(); draw(true); }
502
549
  /** Opens one folding row (the track's clusters open Milestones, "N more tasks" opens On its initiatives) and scrolls to it. */
@@ -38,7 +38,7 @@ function toToday(smooth) { const v = view(); scrollToX(xOf(+cur.el.dataset.now)
38
38
  /** The track's width for the screen it is on: one screen holds the span's columns. */
39
39
  function size() {
40
40
  const ratio = +cur.el.dataset.ratio || 1, w = Math.max(1, cur.sc.clientWidth - cur.nw);
41
- cur.tw = Math.round(w * ratio);
41
+ cur.tw = Math.round(w * ratio); cur.w = w;
42
42
  cur.sc.style.setProperty('--tw', cur.tw + 'px');
43
43
  cur.sc.style.setProperty('--vw', cur.sc.clientWidth + 'px');
44
44
  }
@@ -62,7 +62,9 @@ export function mount(host) {
62
62
  sc.addEventListener('keydown', onKey);
63
63
  sc.addEventListener('pointerdown', onDown);
64
64
  el.addEventListener('click', onClick, true);
65
- ro = new ResizeObserver(() => { if (!cur || cur.el !== el) return; const v = view(), mid = dateAt(v.l + v.w / 2); cur.nw = nameCell ? nameCell.getBoundingClientRect().width : 0; size(); scrollToX(xOf(mid) - view().w / 2); update(); });
65
+ ro = new ResizeObserver(() => { if (!cur || cur.el !== el) return; const w0 = cur.w || view().w, l0 = cur.sc.scrollLeft, tx0 = xOf(+el.dataset.now), at0 = tx0 >= l0 && tx0 <= l0 + w0 ? (tx0 - l0) / w0 : null, mid0 = dateAt(l0 + w0 / 2); cur.nw = nameCell ? nameCell.getBoundingClientRect().width : 0; size();
66
+ // a resize keeps today in place when it is in view (the rail or a panel can narrow the page after the first draw), else the middle date
67
+ if (at0 != null) scrollToX(xOf(+el.dataset.now) - view().w * at0); else scrollToX(xOf(mid0) - view().w / 2); update(); });
66
68
  ro.observe(sc);
67
69
  update();
68
70
  }