create-pmos 0.399.0 → 0.401.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 (425) hide show
  1. package/package.json +30 -25
  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/briefing-premium-adddoc-test.js +2 -2
  7. package/workspace/briefing-premium-board-test.js +3 -3
  8. package/workspace/briefing-premium-doc-edit-test.js +2 -8
  9. package/workspace/briefing-premium-sources-test.js +2 -0
  10. package/workspace/briefing-premium-test.js +6 -2
  11. package/workspace/briefing-premium-work-test.js +9 -4
  12. package/workspace/c3-capture-test.js +0 -17
  13. package/workspace/changelog.json +29 -0
  14. package/workspace/guide/briefing-premium.md +2 -2
  15. package/workspace/guide/home.md +24 -3
  16. package/workspace/guide/layout.md +2 -2
  17. package/workspace/guide/notes.md +2 -2
  18. package/workspace/guide/phone-companion.md +1 -1
  19. package/workspace/lib/core-docs.js +2 -2
  20. package/workspace/lib/route-modules.js +1 -9
  21. package/workspace/lib/routes-phone-day.js +18 -9
  22. package/workspace/lib/routes-slash.js +95 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -2
  25. package/workspace/premium-chat-goal-view-test.js +1 -1
  26. package/workspace/premium-chat-term-test.js +0 -10
  27. package/workspace/premium-menu-rows-test.js +1 -1
  28. package/workspace/premium-phone-card-test.js +8 -3
  29. package/workspace/premium-vw-cal-test.js +4 -1
  30. package/workspace/premium-vw-doc-test.js +1 -8
  31. package/workspace/premium-work-depth-test.js +2 -3
  32. package/workspace/public/capture.html +23 -0
  33. package/workspace/public/pm/c3-base.js +47 -0
  34. package/workspace/public/pm/c3-capture.js +1 -1
  35. package/workspace/public/pm/c3-ini-ui.js +1 -1
  36. package/workspace/public/pm/c3-sheet.js +1 -1
  37. package/workspace/public/pm/c3-toast.js +1 -1
  38. package/workspace/public/pm/console3.css +3 -0
  39. package/workspace/public/pm/cozy-home.css +21 -6
  40. package/workspace/public/pm/cozy-today.css +4 -3
  41. package/workspace/public/pm/cozy-viewer.js +4 -2
  42. package/workspace/public/pm/cozy.css +9 -0
  43. package/workspace/public/pm/goal-chat.js +5 -1
  44. package/workspace/public/pm/home-app.js +65 -33
  45. package/workspace/public/pm/home-chat.js +34 -29
  46. package/workspace/public/pm/home-data.js +10 -2
  47. package/workspace/public/pm/home-dictate.js +7 -4
  48. package/workspace/public/pm/home-ini.js +13 -3
  49. package/workspace/public/pm/home-list.js +18 -10
  50. package/workspace/public/pm/home-more.js +2 -2
  51. package/workspace/public/pm/home-phone-card.js +9 -4
  52. package/workspace/public/pm/home-review.js +2 -3
  53. package/workspace/public/pm/home-today.js +11 -8
  54. package/workspace/public/pm/home-work.js +13 -8
  55. package/workspace/public/pm/note-dock.js +1 -2
  56. package/workspace/public/pm/notes-links.js +1 -2
  57. package/workspace/public/pm/notes-task.js +3 -4
  58. package/workspace/public/pm/premium-board.js +1 -1
  59. package/workspace/public/pm/premium-initiative-head.js +3 -3
  60. package/workspace/public/pm/premium-vw-doc.css +20 -2
  61. package/workspace/public/pm/premium-vw-doc.js +22 -7
  62. package/workspace/public/pm/premium-vw-item.css +6 -0
  63. package/workspace/public/pm/view-notes.js +2 -2
  64. package/workspace/replaced-tests.json +435 -0
  65. package/workspace/run-tests.js +323 -28
  66. package/workspace/server.js +15 -10
  67. package/workspace/test-files.json +4 -140
  68. package/workspace/test-lists/base.json +1 -2
  69. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  70. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  71. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  72. package/workspace/test-lists/c3-work-agent.json +1 -2
  73. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  74. package/workspace/test-lists/console3-reports.json +1 -2
  75. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  76. package/workspace/test-lists/extension-capture.json +5 -0
  77. package/workspace/test-lists/jira-wbs.json +1 -2
  78. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  79. package/workspace/test-lists/meeting-material.json +1 -2
  80. package/workspace/test-lists/meeting-notes.json +2 -36
  81. package/workspace/test-lists/meeting-replay.json +1 -2
  82. package/workspace/test-lists/mm-capture.json +2 -12
  83. package/workspace/test-lists/my-work.json +2 -10
  84. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  85. package/workspace/test-lists/people-directory.json +1 -2
  86. package/workspace/test-lists/run2-a.json +1 -2
  87. package/workspace/test-lists/run2-d.json +2 -19
  88. package/workspace/test-lists/run3-b.json +1 -2
  89. package/workspace/test-lists/run3-c.json +2 -12
  90. package/workspace/test-lists/run4-b.json +1 -2
  91. package/workspace/test-lists/run4-d.json +1 -5
  92. package/workspace/test-lists/run5-c.json +1 -11
  93. package/workspace/test-lists/run6.json +1 -5
  94. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  95. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  96. package/workspace/test-timings.json +242 -123
  97. package/workspace/c3-briefing-test.js +0 -136
  98. package/workspace/c3-core-docs-test.js +0 -170
  99. package/workspace/c3-driver-fixture.js +0 -64
  100. package/workspace/c3-driver-test.js +0 -169
  101. package/workspace/c3-foundation-test.js +0 -163
  102. package/workspace/c3-ib-items-test.js +0 -114
  103. package/workspace/c3-ib-more-test.js +0 -146
  104. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  105. package/workspace/c3-ini-harness.js +0 -66
  106. package/workspace/c3-ini-life-test.js +0 -167
  107. package/workspace/c3-initiatives-test.js +0 -186
  108. package/workspace/c3-light-load-test.js +0 -112
  109. package/workspace/c3-one-home-test.js +0 -149
  110. package/workspace/c3-phone-test.js +0 -289
  111. package/workspace/c3-quiet-test.js +0 -157
  112. package/workspace/c3-report-design-real-test.js +0 -264
  113. package/workspace/c3-report-design-test.js +0 -442
  114. package/workspace/c3-report-setup-test.js +0 -192
  115. package/workspace/c3-report-structure-real-test.js +0 -248
  116. package/workspace/c3-report-structure-test.js +0 -397
  117. package/workspace/c3-reports-test.js +0 -288
  118. package/workspace/c3-scan-test.js +0 -517
  119. package/workspace/c3-sessions-panel-test.js +0 -365
  120. package/workspace/c3-settings-test.js +0 -204
  121. package/workspace/c3-updates-test.js +0 -131
  122. package/workspace/c3-work-test.js +0 -260
  123. package/workspace/cut-stub.js +0 -40
  124. package/workspace/first-paint-audit.js +0 -160
  125. package/workspace/lib/c3-full-console.js +0 -15
  126. package/workspace/lib/engine/derived/trust.js +0 -3
  127. package/workspace/lib/engine/plan-forecast.js +0 -342
  128. package/workspace/lib/engine/report-families.js +0 -175
  129. package/workspace/lib/engine/truth-table.js +0 -57
  130. package/workspace/lib/routes-c3-init.js +0 -54
  131. package/workspace/lib/routes-c3-life.js +0 -120
  132. package/workspace/lib/routes-c3-timeline.js +0 -192
  133. package/workspace/lib/routes-forecast.js +0 -86
  134. package/workspace/lib/routes-releases.js +0 -130
  135. package/workspace/lib/routes-report-facts.js +0 -85
  136. package/workspace/lib/routes-report-families.js +0 -33
  137. package/workspace/lib/routes-signals.js +0 -51
  138. package/workspace/lib/routes-timeline.js +0 -197
  139. package/workspace/public/c3.html +0 -35
  140. package/workspace/public/index.html +0 -156
  141. package/workspace/public/pm/app.js +0 -831
  142. package/workspace/public/pm/bd-board.js +0 -159
  143. package/workspace/public/pm/bd-drag.js +0 -59
  144. package/workspace/public/pm/bd-model.js +0 -152
  145. package/workspace/public/pm/bd-timeline.js +0 -233
  146. package/workspace/public/pm/bd-tree.js +0 -244
  147. package/workspace/public/pm/board-copy.js +0 -59
  148. package/workspace/public/pm/board-read.js +0 -38
  149. package/workspace/public/pm/branches-sheet.js +0 -56
  150. package/workspace/public/pm/breakdown-api.js +0 -58
  151. package/workspace/public/pm/breakdown-copy.js +0 -138
  152. package/workspace/public/pm/briefing-deck.js +0 -441
  153. package/workspace/public/pm/briefing-model.js +0 -251
  154. package/workspace/public/pm/c3-ambient.js +0 -100
  155. package/workspace/public/pm/c3-audience-link.js +0 -21
  156. package/workspace/public/pm/c3-audience.js +0 -46
  157. package/workspace/public/pm/c3-boot.js +0 -13
  158. package/workspace/public/pm/c3-breakdown.js +0 -240
  159. package/workspace/public/pm/c3-brief-data.js +0 -11
  160. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  161. package/workspace/public/pm/c3-brief-needs.js +0 -288
  162. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  163. package/workspace/public/pm/c3-brief-summary.js +0 -139
  164. package/workspace/public/pm/c3-brief-today.js +0 -79
  165. package/workspace/public/pm/c3-brief.js +0 -279
  166. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  167. package/workspace/public/pm/c3-calendar.js +0 -965
  168. package/workspace/public/pm/c3-calpop.js +0 -111
  169. package/workspace/public/pm/c3-case.js +0 -196
  170. package/workspace/public/pm/c3-core-docs.css +0 -18
  171. package/workspace/public/pm/c3-core-docs.js +0 -236
  172. package/workspace/public/pm/c3-daypart.js +0 -176
  173. package/workspace/public/pm/c3-demo-boards.js +0 -764
  174. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  175. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  176. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  177. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  178. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  179. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  180. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  181. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  182. package/workspace/public/pm/c3-demo-data.js +0 -552
  183. package/workspace/public/pm/c3-demo-focus.js +0 -181
  184. package/workspace/public/pm/c3-demo-init.js +0 -430
  185. package/workspace/public/pm/c3-demo-life.js +0 -77
  186. package/workspace/public/pm/c3-demo-material.js +0 -58
  187. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  188. package/workspace/public/pm/c3-demo-phone.js +0 -48
  189. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  190. package/workspace/public/pm/c3-demo-rd.js +0 -432
  191. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  192. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  193. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  194. package/workspace/public/pm/c3-demo-rs.js +0 -287
  195. package/workspace/public/pm/c3-demo-term.js +0 -153
  196. package/workspace/public/pm/c3-demo-time.js +0 -49
  197. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  198. package/workspace/public/pm/c3-demo.js +0 -131
  199. package/workspace/public/pm/c3-design-studio.js +0 -369
  200. package/workspace/public/pm/c3-doc-formats.js +0 -153
  201. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  202. package/workspace/public/pm/c3-dock.js +0 -206
  203. package/workspace/public/pm/c3-docs.js +0 -291
  204. package/workspace/public/pm/c3-driver-work.js +0 -110
  205. package/workspace/public/pm/c3-driver.css +0 -18
  206. package/workspace/public/pm/c3-driver.js +0 -298
  207. package/workspace/public/pm/c3-focus.css +0 -304
  208. package/workspace/public/pm/c3-focus.js +0 -983
  209. package/workspace/public/pm/c3-ib-docs.js +0 -92
  210. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  211. package/workspace/public/pm/c3-ib-items.js +0 -210
  212. package/workspace/public/pm/c3-ib-releases.js +0 -48
  213. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  214. package/workspace/public/pm/c3-ib-triage.js +0 -177
  215. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  216. package/workspace/public/pm/c3-ini-life.css +0 -34
  217. package/workspace/public/pm/c3-ini-life.js +0 -379
  218. package/workspace/public/pm/c3-ini-records.js +0 -197
  219. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  220. package/workspace/public/pm/c3-ini-work.js +0 -139
  221. package/workspace/public/pm/c3-init-extras.js +0 -170
  222. package/workspace/public/pm/c3-initiatives.js +0 -852
  223. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  224. package/workspace/public/pm/c3-look.js +0 -27
  225. package/workspace/public/pm/c3-material.css +0 -22
  226. package/workspace/public/pm/c3-material.js +0 -321
  227. package/workspace/public/pm/c3-md.js +0 -3
  228. package/workspace/public/pm/c3-misc-panels.js +0 -89
  229. package/workspace/public/pm/c3-new-session.js +0 -110
  230. package/workspace/public/pm/c3-notes.js +0 -751
  231. package/workspace/public/pm/c3-phone-boot.js +0 -47
  232. package/workspace/public/pm/c3-phone-detail.js +0 -97
  233. package/workspace/public/pm/c3-phone-model.js +0 -3
  234. package/workspace/public/pm/c3-phone.css +0 -66
  235. package/workspace/public/pm/c3-phone.js +0 -444
  236. package/workspace/public/pm/c3-plan-panels.js +0 -163
  237. package/workspace/public/pm/c3-plan.js +0 -193
  238. package/workspace/public/pm/c3-quiet.css +0 -113
  239. package/workspace/public/pm/c3-quiet.js +0 -177
  240. package/workspace/public/pm/c3-replay.css +0 -133
  241. package/workspace/public/pm/c3-replay.js +0 -429
  242. package/workspace/public/pm/c3-report-deck.css +0 -163
  243. package/workspace/public/pm/c3-report-deck.js +0 -598
  244. package/workspace/public/pm/c3-report-frame.css +0 -20
  245. package/workspace/public/pm/c3-report-print.css +0 -20
  246. package/workspace/public/pm/c3-report-setup.css +0 -67
  247. package/workspace/public/pm/c3-report-setup.js +0 -298
  248. package/workspace/public/pm/c3-report-store.js +0 -244
  249. package/workspace/public/pm/c3-report-structure.css +0 -44
  250. package/workspace/public/pm/c3-report-structure.js +0 -473
  251. package/workspace/public/pm/c3-reports.css +0 -68
  252. package/workspace/public/pm/c3-reports.js +0 -377
  253. package/workspace/public/pm/c3-roadmap.js +0 -249
  254. package/workspace/public/pm/c3-scan-api.js +0 -167
  255. package/workspace/public/pm/c3-scan-next.js +0 -248
  256. package/workspace/public/pm/c3-scan-setup.js +0 -313
  257. package/workspace/public/pm/c3-scan-words.js +0 -41
  258. package/workspace/public/pm/c3-scan.css +0 -74
  259. package/workspace/public/pm/c3-scan.js +0 -93
  260. package/workspace/public/pm/c3-session-chat.js +0 -103
  261. package/workspace/public/pm/c3-session-conv.js +0 -165
  262. package/workspace/public/pm/c3-session-term.js +0 -216
  263. package/workspace/public/pm/c3-settings.css +0 -85
  264. package/workspace/public/pm/c3-settings.js +0 -1045
  265. package/workspace/public/pm/c3-shell.js +0 -628
  266. package/workspace/public/pm/c3-signals.js +0 -196
  267. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  268. package/workspace/public/pm/c3-swipe.js +0 -230
  269. package/workspace/public/pm/c3-terminal-data.js +0 -48
  270. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  271. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  272. package/workspace/public/pm/c3-terminal-results.js +0 -141
  273. package/workspace/public/pm/c3-terminal.js +0 -52
  274. package/workspace/public/pm/c3-tickets.js +0 -163
  275. package/workspace/public/pm/c3-timeline.js +0 -201
  276. package/workspace/public/pm/calendar-views.js +0 -1049
  277. package/workspace/public/pm/console3-lift.md +0 -220
  278. package/workspace/public/pm/cozy-home.js +0 -172
  279. package/workspace/public/pm/cozy-initiative.css +0 -138
  280. package/workspace/public/pm/cycle-review.js +0 -125
  281. package/workspace/public/pm/data.js +0 -1577
  282. package/workspace/public/pm/dest-board.js +0 -444
  283. package/workspace/public/pm/dest-docs.js +0 -530
  284. package/workspace/public/pm/dest-initiatives.js +0 -162
  285. package/workspace/public/pm/dest-mywork.js +0 -307
  286. package/workspace/public/pm/dest-notes.js +0 -537
  287. package/workspace/public/pm/dest-people.js +0 -449
  288. package/workspace/public/pm/dest-reports.js +0 -383
  289. package/workspace/public/pm/dest-settings.js +0 -601
  290. package/workspace/public/pm/dest-today.js +0 -267
  291. package/workspace/public/pm/display-word.js +0 -56
  292. package/workspace/public/pm/doc-editor.js +0 -473
  293. package/workspace/public/pm/doc-graph.js +0 -272
  294. package/workspace/public/pm/doc-health-panel.js +0 -110
  295. package/workspace/public/pm/doc-rail.js +0 -167
  296. package/workspace/public/pm/doc-remote.js +0 -180
  297. package/workspace/public/pm/dock-sessions.js +0 -472
  298. package/workspace/public/pm/dock.js +0 -216
  299. package/workspace/public/pm/fixture.js +0 -821
  300. package/workspace/public/pm/flag-picker.js +0 -104
  301. package/workspace/public/pm/frame-copy.js +0 -278
  302. package/workspace/public/pm/freshness-line.js +0 -149
  303. package/workspace/public/pm/handoff-box.js +0 -82
  304. package/workspace/public/pm/initiative-list.js +0 -235
  305. package/workspace/public/pm/initiative-sheet.js +0 -331
  306. package/workspace/public/pm/initiatives-api.js +0 -95
  307. package/workspace/public/pm/initiatives-copy.js +0 -287
  308. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  309. package/workspace/public/pm/initiatives-timeline.js +0 -410
  310. package/workspace/public/pm/initiatives-ui.js +0 -291
  311. package/workspace/public/pm/item-sheet.js +0 -268
  312. package/workspace/public/pm/keep-card.js +0 -204
  313. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  314. package/workspace/public/pm/lifecycle-lens.js +0 -276
  315. package/workspace/public/pm/lifecycle.js +0 -111
  316. package/workspace/public/pm/mobile.css +0 -366
  317. package/workspace/public/pm/mobile.js +0 -581
  318. package/workspace/public/pm/modes-live.js +0 -453
  319. package/workspace/public/pm/modes.js +0 -147
  320. package/workspace/public/pm/my-work-card.js +0 -51
  321. package/workspace/public/pm/my-work-data.js +0 -36
  322. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  323. package/workspace/public/pm/next-step-ui.js +0 -190
  324. package/workspace/public/pm/outbox-panel.js +0 -125
  325. package/workspace/public/pm/palette-copy.js +0 -55
  326. package/workspace/public/pm/palette.js +0 -343
  327. package/workspace/public/pm/panel-breakdown.js +0 -702
  328. package/workspace/public/pm/panel-cockpit.js +0 -425
  329. package/workspace/public/pm/panel-detail.js +0 -1513
  330. package/workspace/public/pm/panel-initiatives.js +0 -929
  331. package/workspace/public/pm/panel-newsess.js +0 -709
  332. package/workspace/public/pm/panel-repos.js +0 -741
  333. package/workspace/public/pm/panel-tabs.js +0 -1506
  334. package/workspace/public/pm/panel-trees.js +0 -204
  335. package/workspace/public/pm/people-link.js +0 -106
  336. package/workspace/public/pm/phone-deck.js +0 -167
  337. package/workspace/public/pm/pm-work-view.js +0 -1533
  338. package/workspace/public/pm/portfolio-report.js +0 -61
  339. package/workspace/public/pm/premium-acts.js +0 -280
  340. package/workspace/public/pm/premium-brief.js +0 -111
  341. package/workspace/public/pm/premium-chat.js +0 -22
  342. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  343. package/workspace/public/pm/premium-initiative.js +0 -324
  344. package/workspace/public/pm/premium-insights.css +0 -228
  345. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  346. package/workspace/public/pm/premium-report-brief.js +0 -132
  347. package/workspace/public/pm/premium-vw-rec.js +0 -67
  348. package/workspace/public/pm/premium-wide.css +0 -30
  349. package/workspace/public/pm/print.css +0 -44
  350. package/workspace/public/pm/provider-cards.js +0 -136
  351. package/workspace/public/pm/registry.js +0 -203
  352. package/workspace/public/pm/release-card.js +0 -110
  353. package/workspace/public/pm/releases-view.js +0 -248
  354. package/workspace/public/pm/report-families-view.js +0 -505
  355. package/workspace/public/pm/report-slides.js +0 -438
  356. package/workspace/public/pm/report-tab.js +0 -33
  357. package/workspace/public/pm/report-view.js +0 -337
  358. package/workspace/public/pm/reports-copy.js +0 -134
  359. package/workspace/public/pm/roadmap.js +0 -294
  360. package/workspace/public/pm/run-card.js +0 -260
  361. package/workspace/public/pm/sessions-panel.js +0 -219
  362. package/workspace/public/pm/sheet-jira.js +0 -353
  363. package/workspace/public/pm/shell-bell.js +0 -163
  364. package/workspace/public/pm/shell-model.js +0 -83
  365. package/workspace/public/pm/shell-phone.js +0 -124
  366. package/workspace/public/pm/shell-readaloud.js +0 -53
  367. package/workspace/public/pm/shell-recording.js +0 -274
  368. package/workspace/public/pm/shell-ticker.js +0 -90
  369. package/workspace/public/pm/sig-watch.js +0 -41
  370. package/workspace/public/pm/slide-confirm.js +0 -163
  371. package/workspace/public/pm/slides-copy.js +0 -52
  372. package/workspace/public/pm/status-banner.js +0 -95
  373. package/workspace/public/pm/tab-doc.js +0 -859
  374. package/workspace/public/pm/tab-gone.js +0 -21
  375. package/workspace/public/pm/tab-term.js +0 -1210
  376. package/workspace/public/pm/tab-web.js +0 -90
  377. package/workspace/public/pm/timeline-copy.js +0 -48
  378. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  379. package/workspace/public/pm/today-agenda.js +0 -331
  380. package/workspace/public/pm/today-cards.js +0 -244
  381. package/workspace/public/pm/today-copy.js +0 -506
  382. package/workspace/public/pm/today-day.js +0 -1371
  383. package/workspace/public/pm/today-goals.js +0 -297
  384. package/workspace/public/pm/today-jobs.js +0 -84
  385. package/workspace/public/pm/today-mentions.js +0 -50
  386. package/workspace/public/pm/topbar.js +0 -202
  387. package/workspace/public/pm/triage-card.js +0 -60
  388. package/workspace/public/pm/undo-hold.js +0 -103
  389. package/workspace/public/pm/view-addrepo.js +0 -208
  390. package/workspace/public/pm/view-files.js +0 -197
  391. package/workspace/public/pm/view-livenotes.js +0 -399
  392. package/workspace/public/pm/view-today.js +0 -13
  393. package/workspace/public/pm/view-validate.js +0 -171
  394. package/workspace/public/pm/welcome.js +0 -391
  395. package/workspace/public/pm/work-place.js +0 -68
  396. package/workspace/public/pm/xlsx-read.js +0 -117
  397. package/workspace/public/welcome.html +0 -22
  398. package/workspace/test-lists/browser-suites-green.json +0 -5
  399. package/workspace/test-lists/c3-core-docs.json +0 -9
  400. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  401. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  402. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  403. package/workspace/test-lists/c3-ib-items.json +0 -9
  404. package/workspace/test-lists/c3-ib-more.json +0 -9
  405. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  406. package/workspace/test-lists/c3-ini-life.json +0 -9
  407. package/workspace/test-lists/c3-meeting-board.json +0 -5
  408. package/workspace/test-lists/c3-meeting-card.json +0 -5
  409. package/workspace/test-lists/c3-notes-place.json +0 -5
  410. package/workspace/test-lists/c3-notes-series.json +0 -5
  411. package/workspace/test-lists/calendar-time-page.json +0 -5
  412. package/workspace/test-lists/calpop.json +0 -4
  413. package/workspace/test-lists/console3-briefing.json +0 -9
  414. package/workspace/test-lists/console3-foundation.json +0 -9
  415. package/workspace/test-lists/console3-work-page.json +0 -9
  416. package/workspace/test-lists/premium-brief-parity.json +0 -9
  417. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  418. package/workspace/test-lists/report-structure-ui.json +0 -11
  419. package/workspace/test-lists/report-workspace-ui.json +0 -5
  420. package/workspace/test-lists/run3-a.json +0 -5
  421. package/workspace/test-lists/run3-d.json +0 -6
  422. package/workspace/test-lists/run4-c.json +0 -13
  423. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  424. package/workspace/test-lists/today-mentions-cards.json +0 -5
  425. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,965 +0,0 @@
1
- /* pm/c3-calendar.js — the Calendar tab of /c3.html as a page about time (initiative calendar-time-page, PRD R1 to R8).
2
- *
3
- * calendar-views.js mounts it: mountCalendarViews(host, { page: true, ... }) makes draw() hand the instance to
4
- * drawCalendarPage(host, r, helpers). That file keeps the data call (GET /api/calendar-views), the zoom bar, the Today
5
- * chip and the swipe, pinch and key gestures; the helpers it passes are its own, so nothing is copied here.
6
- *
7
- * Top to bottom: the page line and the zoom bar (Day, Week, Month, Quarter, Year), the layer chips (Meetings, Milestones
8
- * and due dates, Releases, Report dates, My due items, then Free time and Tidy-up), the grid of the zoom with the layer
9
- * markers on it, and the detail column (under the grid on a narrow screen, at the right from 1100px). A meeting opens in a popup
10
- * sheet instead, as a session does (initiative c3-cal-strip-popup); a dated marker keeps its card in the column.
11
- *
12
- * What it reads from the answer, all optional and additive: `cells` (the meetings), `layers` (the dated items, each with
13
- * kind, layer, tone and a reference to its home), `free` (free blocks with a suggested use or none), `context` (what came
14
- * out of a past meeting and what moved after it; what is prepared and what to prepare for a coming one), `layers_note`, and
15
- * `tidy`, `tidy_total`, `tidy_note` (initiative calendar-tidy-up: suggestions by fixed rules, each a proposal in words with
16
- * references; the Tidy-up chip lists them and marks the meetings they name on the Day and Week timeline).
17
- * A key that is missing reads as "the server sent none", in words. Nothing is invented.
18
- *
19
- * What it does: it selects (a meeting, a marker) and it navigates (a zoom, a day, a reference to the home of an item).
20
- * It writes nothing. A marker carries no action: its detail has one reference link that opens the item where it lives. */
21
- import { el } from './dom.js';
22
- import { c3ic } from './pm-work-view.js';
23
- import { button, ensureComponentsCss } from './primitives.js';
24
- import { toast } from './c3-toast.js';
25
- import { pmPost } from './http.js';
26
- import { notesView, openNote, noteOfEvent, primeNotes } from './c3-notes.js'; // Calendar › Notes (initiative c3-notes-place)
27
- import { onNotes } from './notes-links.js';
28
- import { openSheet } from './c3-sheet.js';
29
- import { materialSection } from './c3-material.js'; // Material on the meeting card (initiative meeting-material-replay)
30
-
31
- const LAYERS = [
32
- ['meetings', 'Meetings'],
33
- ['milestones', 'Milestones and due dates'],
34
- ['releases', 'Releases'],
35
- ['reports', 'Report dates'],
36
- ['mine', 'My due items'],
37
- ];
38
- const KIND = {
39
- milestone: ['Milestone', 'flag'], due: ['Due date', 'clock'], release: ['Release', 'bolt'], report: ['Report date', 'report'], own: ['My due item', 'todo'],
40
- };
41
- const RANK = { milestone: 0, release: 1, report: 2, due: 3, own: 4 };
42
- const TONE = { bad: 'Late or at risk of missing', warn: 'At risk', ok: 'On track' };
43
- const REF = { initiative: 'Open the initiative', 'plan-item': 'Open the initiative', item: 'Open in Work', release: 'Open the release', report: 'Open in Reports',
44
- jira: 'Open the sprint', ask: 'Open in Triage', portfolio: 'Open the Portfolio' };
45
- const CTXWORD = { decision: 'Decision', action: 'Action', moved: 'Moved', prepared: 'Prepared', todo: 'To prepare' };
46
- const NO_SUGGESTION = 'Free, nothing specific to suggest';
47
- /* the tidy-up suggestions (lib/calendar-tidy.js): the severity groups in order, and each rule in words */
48
- const TIDY_GROUPS = [['bad', 'Needs a fix'], ['warn', 'At risk'], ['info', 'Worth a look']];
49
- const TIDY_RULE = { overlap: 'Overlap', 'no-buffer': 'No break', 'prep-risk': 'Prep at risk', 'dead-initiative': 'Stopped initiative',
50
- 'review-early': 'Review too early', 'likely-delay': 'Late initiative', 'heavy-day': 'Heavy day' };
51
- const TIDY_RANK = { bad: 0, warn: 1, info: 2 };
52
- const PPH_PAGE = 46; // pixels per hour on the Day and Week timelines (the mockup's page grid)
53
- const PPH_OVERLAY = 36; // the same grid in the overlay drawer
54
- const DAY_LOAD = 6; // the scale of a day's load bar, in hours
55
- const HOME = { event: 'Calendar', milestone: 'Initiatives', due: 'Initiatives', release: 'Initiatives', report: 'Reports', own: 'Work' }; // where a record lives (the home chip)
56
- /* the overlay remembers the layers the PM hid, from one opening to the next (the mockup's mem.hide) */
57
- const mem = { hide: [] };
58
- /* the page's own Tidy-up choices: what was proposed and what was dismissed. They write nothing (D65) */
59
- const proposed = new Set(); const dismissed = new Set();
60
-
61
- const pad = (n) => String(n).padStart(2, '0');
62
- const nowIso = () => { const d = new Date(); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`; };
63
- const plural = (n, one, many) => n + ' ' + (n === 1 ? one : (many || one + 's'));
64
- const kindOf = (m) => KIND[m.kind] || ['Dated item', 'cal'];
65
- const hmToH = (s) => { const m = /^(\d{1,2}):(\d{2})/.exec(String(s || '')); return m ? Number(m[1]) + Number(m[2]) / 60 : null; };
66
- const setVar = (node, name, value) => { node.style.setProperty('--cal3-' + name, String(value)); return node; };
67
-
68
- /* ── the page's own state on the instance: which layers are on, whether free time shows, what is selected ─────────── */
69
-
70
- function state(r) {
71
- const st = r.page || (r.page = { on: new Set(LAYERS.map((l) => l[0]).filter((id) => !(r.ctx && r.ctx.overlay && mem.hide.includes(id)))), free: true, tidy: false, routine: false, sel: null });
72
- if (r.sel) { st.sel = { type: 'event', id: r.sel }; r.sel = null; } // a meeting chosen on the Briefing (openDay)
73
- if (r.pendingMode) { st.mode = r.pendingMode; r.pendingMode = null; } // a note opened before the page drew (the Record chip)
74
- if (!st.mode) st.mode = 'cal';
75
- return st;
76
- }
77
-
78
- /* ── what the answer holds ────────────────────────────────────────────────────────────────────────────────────────── */
79
-
80
- function model(d, h) {
81
- const view = d.view || (d.range && d.range.view) || 'week';
82
- const cells = d.cells || [];
83
- const meetingsOf = (c) => (c.events || []).filter((e) => e.kind !== 'milestone'); // a milestone event is the older marker; the layers carry dates now
84
- const meetings = cells.flatMap((c) => meetingsOf(c).map((e) => ({ e, date: String(e.at || c.start).slice(0, 10) })));
85
- const layers = Array.isArray(d.layers) ? d.layers : null;
86
- const free = d.free && Array.isArray(d.free.days) ? d.free : null;
87
- const freeBy = new Map(); if (free) for (const x of free.days) freeBy.set(x.date, x.blocks || []);
88
- const ctx = d.context && typeof d.context === 'object' ? d.context : null;
89
- const findEvent = (id) => meetings.find((m) => m.e.id === id) || meetings.find((m) => h.baseId(m.e) === id) || null;
90
- const tidy = Array.isArray(d.tidy) ? d.tidy.filter((s) => s && s.id && !dismissed.has(s.id)) : null;
91
- const tidyBy = new Map(); // event id -> the suggestions that name it, the most severe first
92
- if (tidy) for (const s of tidy) for (const x of s.refs || []) if (x && x.type === 'event' && x.id) { if (!tidyBy.has(x.id)) tidyBy.set(x.id, []); tidyBy.get(x.id).push(s); }
93
- for (const list of tidyBy.values()) list.sort((a, b) => (TIDY_RANK[a.severity] ?? 3) - (TIDY_RANK[b.severity] ?? 3));
94
- return { view, cells, meetingsOf, meetings, layers, free, freeBy, ctx, findEvent, tidy, tidyBy };
95
- }
96
-
97
- const sortMarks = (a, b) => (a.tone === 'bad' ? 0 : 1) - (b.tone === 'bad' ? 0 : 1) || (RANK[a.kind] ?? 9) - (RANK[b.kind] ?? 9) || String(a.date).localeCompare(String(b.date));
98
- function marksIn(M, st, a, b) {
99
- if (!M.layers) return [];
100
- return M.layers.filter((m) => st.on.has(m.layer) && m.date >= a && m.date <= b).sort(sortMarks);
101
- }
102
- const freeIn = (M, a, b) => (M.free ? M.free.days.filter((x) => x.date >= a && x.date <= b).flatMap((x) => (x.blocks || []).map((bl) => ({ ...bl, date: x.date }))) : []);
103
-
104
- /* ── the page ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
105
-
106
- /** Draw the Calendar tab of instance r into a new node. h is calendar-views.js's own helpers (see PAGE there). */
107
- export function drawCalendarPage(host, r, h) {
108
- ensureComponentsCss(); // the Tidy-up buttons are pmc-btn
109
- const st = state(r);
110
- const phone = r.root.classList.contains('ph');
111
- const page = (b, ...kids) => el('div', { class: 'cal3' + (r.ctx.overlay ? ' ov' : ''), 'data-cal3': 'page', 'data-cal3-show': st.mode }, r.ctx.deck || null, b, ...kids);
112
- const redraw0 = () => h.redraw(host, r);
113
- const modes = r.ctx.overlay ? null : modeSeg(st, redraw0);
114
- if (st.mode === 'notes' && modes) { // Calendar › Notes: the list and the open note; the zoom and the period have nothing to step here
115
- if (st.sel && st.sel.type === 'event') { st.sel = null; closeMeetingSheet(r); }
116
- return page(el('div', { class: 'calbar' }, el('div', { class: 'lens' }, modes)), notesView({ host, r, h, st, redraw: redraw0 }));
117
- }
118
- if (!r.notesOff) { // a meeting's "Open the note" needs the shared notes read; a new note redraws the open detail
119
- r.notesOff = onNotes(() => { if (r.root.isConnected && st.mode === 'cal' && st.sel) h.redraw(host, r); });
120
- primeNotes();
121
- }
122
- const bar = h.bar(host, r, phone);
123
- if (modes) { const lens = bar.querySelector('.lens'); if (lens) lens.prepend(modes); }
124
- const pageBar = (...kids) => page(bar, ...kids);
125
- if (r.error) return pageBar(fold('alert', 'The calendar could not be read: ' + r.error, { 'data-cv': 'error', role: 'status' }));
126
- if (!r.data) return pageBar(fold('clock', 'Reading the repository', { 'data-cv': 'loading', role: 'status' }));
127
-
128
- const d = r.data; const M = model(d, h);
129
- const redraw = (focusSel) => {
130
- h.redraw(host, r);
131
- if (focusSel) { const n = r.root.querySelector(focusSel) || (meet && meet.r === r ? meet.root.querySelector(focusSel) : null); if (n) n.focus(); }
132
- };
133
- const select = (sel, focusSel) => {
134
- st.sel = sel; redraw(focusSel);
135
- const det = r.root.querySelector('[data-cal3="detail"]');
136
- if (det && det.scrollIntoView && r.root.getBoundingClientRect().width < 1100) det.scrollIntoView({ block: 'nearest' });
137
- };
138
- const ui = { host, r, h, st, M, d, redraw, select };
139
-
140
- const range = d.range || { start: d.today, end: d.today };
141
- const nMeet = st.on.has('meetings') ? M.meetings.length : 0;
142
- const nMarks = marksIn(M, st, range.start, range.end).length;
143
- const empty = !nMeet && !nMarks ? fold('moon', M.meetings.length || (M.layers && M.layers.length)
144
- ? 'Every layer with items in this range is turned off. Turn a layer on to see it.'
145
- : d.events_source === 'none' && !M.layers ? 'No calendar is cached yet, and the server sent no dated items. Nothing is drawn.'
146
- : 'Nothing is scheduled and nothing falls due in this range.', { 'data-cal3': 'empty' }) : null;
147
-
148
- let grid;
149
- if (M.view === 'day' || M.view === 'week') {
150
- const days = []; for (let x = range.start; x <= range.end && days.length < 7; x = h.shift('day', x, 1)) days.push(x);
151
- grid = timeGrid(ui, days);
152
- } else if (M.view === 'month') grid = monthGrid(ui);
153
- else if (M.view === 'quarter') grid = quarterRows(ui);
154
- else grid = yearCards(ui);
155
-
156
- const body = el('div', { class: 'calbody' + (r.anim && !r.loading ? ' ' + r.anim : '') },
157
- el('div', { class: 'cal3-wrap' },
158
- el('div', { class: 'cal3-main' }, empty, empty ? null : highlights(ui, range), grid),
159
- el('div', { class: 'cal3-side' }, detail(ui), st.tidy ? tidyList(ui) : null, st.free ? freeList(ui, range) : null, lanes(ui, range))));
160
- syncMeetingSheet(ui);
161
- return pageBar(chips(ui, range), body);
162
- }
163
-
164
- /* ── a meeting in a popup (initiative c3-cal-strip-popup): the session sheet, with its Normal, Half, 2/3 and Whole sizes ── */
165
- const MEET_SIZE_KEY = 'pmos.workspace.c3.meeting-size';
166
- const MEET_SIZES = [['normal', 'Normal', 'Normal'], ['half', 'Half', 'Half of the window'], ['two-thirds', '2/3', 'Two-thirds of the window'], ['whole', 'Whole', 'Whole window']];
167
- const meetStore = {
168
- get() { try { return localStorage.getItem(MEET_SIZE_KEY); } catch { return null; } },
169
- set(v) { try { localStorage.setItem(MEET_SIZE_KEY, v); } catch { /* no storage */ } },
170
- };
171
- let meet = null; // the open popup: { r, id, close, root, sheet, body, title }
172
-
173
- export function closeMeetingSheet(r) {
174
- if (!meet || (r && meet.r !== r)) return;
175
- const m = meet; meet = null; m.quiet = true; m.close();
176
- }
177
-
178
- /* open, refresh or close the popup so it matches the selection; the page calls it on every draw */
179
- function syncMeetingSheet(ui) {
180
- const { st, M, r, h } = ui;
181
- const hit = !r.ctx.overlay && st.sel && st.sel.type === 'event' ? M.findEvent(st.sel.id) : null;
182
- if (!hit) { closeMeetingSheet(r); return; }
183
- const box = el('section', { class: 'cal3 cal3-detail cal3-meet', 'data-cal3': 'detail', 'aria-label': 'Meeting', 'data-cal3-sel': hit.e.id }, ...meetingDetail(ui, hit, true));
184
- const title = hit.e.title || hit.e.id;
185
- if (meet && meet.r === r && meet.root.isConnected) {
186
- meet.body.replaceChildren(box);
187
- if (meet.id !== hit.e.id) { meet.id = hit.e.id; meet.title.textContent = title; meet.sheet.setAttribute('aria-label', title); meet.body.parentElement.scrollTop = 0; }
188
- return;
189
- }
190
- let size = MEET_SIZES.some((x) => x[0] === meetStore.get()) ? meetStore.get() : 'half';
191
- const btns = MEET_SIZES.map(([k, label, tip]) => button({ label, variant: 'ghost', attrs: { 'aria-pressed': String(k === size), 'data-cal3-size': k, title: tip, 'aria-label': tip },
192
- onClick: () => setSize(k) }));
193
- const seg = el('div', { class: 'seg cal3-msize', role: 'group', 'aria-label': 'Size', 'data-cal3': 'meeting-size' }, ...btns);
194
- const self = {};
195
- const o = openSheet({ title, icon: 'cal', wide: true, body: box, actions: [seg], cls: 'cal3-ms tsz-' + size,
196
- onClose: () => { if (meet === self) meet = null; if (self.quiet) return; if (st.sel && st.sel.type === 'event') { st.sel = null; h.redraw(ui.host, r); } } });
197
- Object.assign(self, { r, id: hit.e.id, close: o.close, root: o.root, sheet: o.sheet, body: o.body, title: o.sheet.querySelector('.sh2 b') });
198
- o.root.setAttribute('data-cal3-meeting', '');
199
- meet = self;
200
- function setSize(k) {
201
- size = k; meetStore.set(k);
202
- MEET_SIZES.forEach(([x]) => o.sheet.classList.toggle('tsz-' + x, x === k));
203
- btns.forEach((b) => b.setAttribute('aria-pressed', String(b.getAttribute('data-cal3-size') === k)));
204
- }
205
- }
206
-
207
- /* the note of a meeting beside what came out of it: its title, its first summary lines and "Open the note" */
208
- function noteCard(ui, e) {
209
- const n = noteOfEvent(e); if (!n) return null;
210
- const lines = (n.summary_lines || []).filter(Boolean);
211
- return el('div', { class: 'cal3-ctx cal3-mnote', 'data-cal3-ctx': 'note' }, el('h4', null, 'Note'),
212
- el('div', { class: 'cal3-mnote-b' }, el('b', null, n.title || 'Untitled note'),
213
- ...(lines.length ? lines.map((t) => el('p', null, t)) : [el('p', { class: 'dim' }, n.private ? 'A private note. Its summary stays in the note.' : 'No summary yet.')])),
214
- el('a', { href: '#', class: 'cal3-ref', 'data-cal3': 'open-note', 'data-cal3-open-note': n.id, title: 'Open the note: ' + (n.title || 'Untitled note'),
215
- onClick: (ev) => { ev.preventDefault(); openNote(ui.r, n.id); ui.redraw(); } }, c3ic('notes', 'sm'), 'Open the note'));
216
- }
217
-
218
- /* "Open the note": the note recorded for this meeting, on Calendar › Notes; nothing when no note names the meeting */
219
- function noteLink(ui, e) {
220
- if (ui.r.ctx.overlay) return null;
221
- const n = noteOfEvent(e); if (!n) return null;
222
- return el('div', { class: 'cal3-ctx', 'data-cal3-ctx': 'note' }, el('h4', null, 'Notes'),
223
- el('a', { href: '#', class: 'cal3-ref', 'data-cal3': 'open-note', 'data-cal3-open-note': n.id, title: 'Open the note: ' + (n.title || 'Untitled note'),
224
- onClick: (ev) => { ev.preventDefault(); openNote(ui.r, n.id); ui.redraw(); } }, c3ic('notes', 'sm'), 'Open the note'));
225
- }
226
-
227
- /* the Calendar | Notes switch, before the zoom (the mockup the PM approved on 2026-10-12) */
228
- function modeSeg(st, redraw) {
229
- const b = (id, icon, label) => { const x = button({ variant: 'ghost', attrs: { class: 'cal3-b', 'aria-pressed': String(st.mode === id), 'data-cal3-mode': id, title: label }, onClick: () => { if (st.mode !== id) { st.mode = id; redraw(); } } }); x.replaceChildren(c3ic(icon, 'sm'), el('span', null, label)); return x; };
230
- return el('div', { class: 'seg', role: 'group', 'aria-label': 'Show', 'data-cal3': 'mode' }, b('cal', 'cal', 'Calendar'), b('notes', 'notes', 'Notes'));
231
- }
232
-
233
- function fold(icon, text, attrs) { return el('div', { class: 'fold', ...(attrs || {}) }, c3ic(icon, 'sm'), text); }
234
-
235
- /* ── the layer chips ──────────────────────────────────────────────────────────────────────────────────────────────── */
236
-
237
- function chips(ui, range) {
238
- const { st, M } = ui;
239
- const count = (id) => (id === 'meetings' ? M.meetings.length : M.layers ? M.layers.filter((m) => m.layer === id && m.date >= range.start && m.date <= range.end).length : null);
240
- const chip = (id, label, n, on, toggle, lead) => button({
241
- label: [lead, label, n === null ? null : el('span', { class: 'cal3-n' }, String(n))], variant: 'ghost', size: 'sm',
242
- attrs: { class: 'cal3-chip', 'aria-pressed': String(on), 'data-cal3-chip': id, title: (on ? 'Hide ' : 'Show ') + label },
243
- onClick: () => { toggle(); ui.redraw('[data-cal3-chip="' + id + '"]'); },
244
- });
245
- const freeN = M.free ? (typeof M.free.count === 'number' ? M.free.count : freeIn(M, range.start, range.end).length) : null;
246
- return el('div', { class: 'cal3-chips', role: 'group', 'aria-label': 'Layers', 'data-cal3': 'chips' },
247
- ...LAYERS.map(([id, label]) => chip(id, label, count(id), st.on.has(id), () => {
248
- if (st.on.has(id)) st.on.delete(id); else st.on.add(id);
249
- if (ui.r.ctx.overlay) mem.hide = LAYERS.map((l) => l[0]).filter((x) => !st.on.has(x)); // the overlay remembers what was hidden
250
- }, el('i', { class: 'cal3-sw cal3-sw-' + id }))),
251
- el('span', { class: 'cal3-sep', 'aria-hidden': 'true' }),
252
- chip('free', 'Free time', freeN, st.free, () => { st.free = !st.free; }, c3ic('clock', 'sm')),
253
- chip('tidy', 'Tidy-up', tidyCount(M, ui.d), st.tidy, () => { st.tidy = !st.tidy; }, c3ic('spark', 'sm')),
254
- WIDE.includes(M.view) ? chip('routine', 'Routine', routineCount(ui, range), st.routine, () => { st.routine = !st.routine; }, c3ic('report', 'sm')) : null);
255
- }
256
- /* the number of suggestions in the range: the server's total (the list may be capped), or null when it sent none */
257
- const tidyCount = (M, d) => (M.tidy ? Math.max(0, (typeof d.tidy_total === 'number' ? d.tidy_total : M.tidy.length) - (d.tidy.length - M.tidy.length)) : null); // less the ones the PM dismissed
258
-
259
- /* ── a marker: glyph and short title, tone from the tokens; pressing it selects it (the detail has the reference) ─── */
260
-
261
- function marker(ui, m, compact, tagged) {
262
- const [word, icon] = kindOf(m);
263
- const sel = ui.st.sel && ui.st.sel.type === 'marker' && ui.st.sel.id === m.id;
264
- const name = word + ': ' + m.title + ', ' + ui.h.dayLabel(m.date) + (m.tone && TONE[m.tone] ? '. ' + TONE[m.tone] : '');
265
- // inside the Reports fold the state is a tag after the name: "Daily report draft scheduled"
266
- const label = tagged && m.state ? [c3ic(icon, 'sm'), el('span', { class: 'cal3-mk-t' }, untag(m.title)), el('span', { class: 'cal3-mk-s' }, m.state)]
267
- : [c3ic(icon, 'sm'), el('span', { class: 'cal3-mk-t' }, m.title)];
268
- return button({
269
- label, variant: 'ghost', size: 'sm',
270
- attrs: { class: 'cal3-mk cal3-k-' + (KIND[m.kind] ? m.kind : 'other') + (m.tone ? ' cal3-tone-' + m.tone : '') + (compact ? ' compact' : '') + (sel ? ' sel' : ''),
271
- 'data-cal3-mk': m.id, 'data-cal3-layer': m.layer, 'data-cal3-kind': m.kind, 'aria-pressed': String(!!sel), 'aria-label': name, title: name },
272
- onClick: () => ui.select({ type: 'marker', id: m.id }, '[data-cal3-mk="' + cssId(m.id) + '"]'),
273
- });
274
- }
275
- const cssId = (s) => String(s).replace(/["\\]/g, '\\$&');
276
- const untag = (t) => String(t).replace(/\s*\((scheduled|not issued)\)$/, '');
277
-
278
- /* the dates strip of one day (initiative c3-cal-strip-popup): every report of the day folds into one Reports chip that opens in place,
279
- * except a late one, which stays out with the other dated items. A Day lays them in one wrapping line; a Week column stacks them. */
280
- function stripMarks(ui, date, one) {
281
- const all = marksIn(ui.M, ui.st, date, date);
282
- const folded = all.filter((m) => m.kind === 'report' && m.tone !== 'warn' && m.tone !== 'bad');
283
- const rest = all.filter((m) => !folded.includes(m));
284
- const max = one ? 12 : 4;
285
- const out = [...rest.slice(0, max).map((m) => marker(ui, m, !one)), rest.length > max ? moreBtn(ui, rest.length - max, date, date, 'day') : null];
286
- if (!folded.length) return out;
287
- const st = ui.st;
288
- if (!st.repOpen) st.repOpen = new Set();
289
- const held = st.sel && st.sel.type === 'marker' && folded.some((m) => m.id === st.sel.id); // a selected report keeps its fold open
290
- const open = st.repOpen.has(date) || held;
291
- const n = (s) => folded.filter((m) => m.state === s).length;
292
- const words = ['scheduled', 'not issued', 'issued'].filter((s) => n(s)).map((s) => n(s) + ' ' + s).join(' · ');
293
- const say = plural(folded.length, 'report') + ' on ' + ui.h.dayLabel(date) + (words ? ': ' + words : '') + '. ' + (open ? 'Hide them' : 'Show them');
294
- out.push(button({
295
- label: [c3ic('report', 'sm'), el('span', { class: 'cal3-rf-t' }, 'Reports'), el('span', { class: 'cal3-n' }, String(folded.length)),
296
- one && words ? el('span', { class: 'cal3-rf-bd' }, words) : null],
297
- variant: 'ghost', size: 'sm',
298
- attrs: { class: 'cal3-rf', 'data-cal3-rf': date, 'aria-expanded': String(open), 'aria-label': say, title: say },
299
- onClick: () => { if (open) { st.repOpen.delete(date); if (held) st.sel = null; } else st.repOpen.add(date); ui.redraw('[data-cal3-rf="' + date + '"]'); },
300
- }));
301
- if (open) out.push(el('div', { class: 'cal3-rf-open', 'data-cal3-rf-open': date }, ...folded.map((m) => marker(ui, m, false, true))));
302
- return out;
303
- }
304
-
305
- /* the markers of a span, the most important first, at most `max`, and a "+N" for the rest */
306
- function markRow(ui, a, b, max, compact, view) {
307
- const all = marksIn(ui.M, ui.st, a, b);
308
- return [...all.slice(0, max).map((m) => marker(ui, m, compact)), all.length > max ? moreBtn(ui, all.length - max, a, b, view) : null];
309
- }
310
- /* the "+N" of a span is a button: it zooms into the week or the month that holds the rest */
311
- function moreBtn(ui, n, a, b, view) {
312
- const label = view === 'week' ? 'Open the week of ' + ui.h.dayLabel(a) : view === 'day' ? 'Open ' + ui.h.dayLabel(a) : 'Open ' + ui.h.MN[Number(a.slice(5, 7)) - 1] + ' ' + a.slice(0, 4);
313
- return button({ label: '+' + n, variant: 'ghost', size: 'sm', attrs: { class: 'cal3-more', 'data-cal3-more': a, title: plural(n, 'more dated item') + '. ' + label, 'aria-label': plural(n, 'more dated item') + '. ' + label },
314
- onClick: () => ui.h.go(ui.host, ui.r, { view, date: a, anim: 'zi' }) });
315
- }
316
-
317
- /* ── Day and Week: the timeline with the all-day marker strip above it ───────────────────────────────────────────── */
318
-
319
- /* what a meeting is, for the grid: tied to a promise or a decision (an initiative, prep, or a record PMOS holds), or routine; blocked
320
- * and prep left come from the event or its context when the server sends them (the mockup's blocked(), kind() and note) */
321
- function evState(ui, m, nowStr) {
322
- const { M, h } = ui; const e = m.e;
323
- const rec = M.ctx ? (M.ctx[e.id] || M.ctx[h.baseId(e)] || null) : null;
324
- const items = rec && Array.isArray(rec.items) ? rec.items : [];
325
- const todo = items.some((x) => x.kind === 'todo') || e.prep_todo === true;
326
- const held = !!rec && rec.held !== false && items.length > 0;
327
- const standup = /stand-?up/i.test(e.title || '');
328
- const tied = !standup && !(e.routine || e.mock_routine) && !!(e.initiative || (Array.isArray(e.prep) ? e.prep.length : e.prep) || items.length);
329
- const past = String(e.end || e.at) <= nowStr;
330
- return { tied, blocked: e.blocked === true || e.mock_hot === true, todo, held, past, note: past ? (held ? ' · held' : '') : (todo ? ' · prep to do' : '') };
331
- }
332
- const hoursOf = (m, h) => Math.max(0, h.endH(m.e) - h.timeOf(m.e.at));
333
-
334
- function timeGrid(ui, days) {
335
- const { M, st, h, d } = ui;
336
- const PPH = ui.r.ctx.overlay ? PPH_OVERLAY : PPH_PAGE;
337
- const now = nowIso(); const today = d.today;
338
- const timedOn = (date) => (st.on.has('meetings') ? M.meetings.filter((m) => m.date === date && h.timeOf(m.e.at) !== null) : []);
339
- const allDayOn = (date) => (st.on.has('meetings') ? M.meetings.filter((m) => m.date === date && h.timeOf(m.e.at) === null) : []);
340
- const all = days.flatMap(timedOn);
341
- const fr = M.free || {};
342
- const t0 = Math.min(Math.floor(hmToH(fr.day_start) ?? 8), 8, ...all.map((m) => Math.floor(h.timeOf(m.e.at))));
343
- const t1 = Math.max(Math.ceil(hmToH(fr.day_end) ?? 18), 18, ...all.map((m) => Math.ceil(h.endH(m.e))));
344
- const Y = (t) => Math.round((Math.max(t0, Math.min(t1, t)) - t0) * PPH);
345
-
346
- const tg = el('div', { class: 'cal3-tg' + (days.length === 1 ? ' one' : ''), 'data-cal3': days.length === 1 ? 'day' : 'week' });
347
- setVar(tg, 'n', days.length); setVar(tg, 'hgt', (t1 - t0) * PPH + 'px'); setVar(tg, 'pph', PPH + 'px');
348
-
349
- /* the hours of a day and its load: tied to a promise or a decision, routine, and the rest, on a 6 hour scale */
350
- const load = (date) => {
351
- const es = timedOn(date); let tot = 0; let tied = 0;
352
- for (const m of es) { const x = hoursOf(m, h); tot += x; if (evState(ui, m, now).tied) tied += x; }
353
- return { tot, tied };
354
- };
355
- const seg = (hrs, cls) => setVar(el('i', { class: cls }), 'w', Math.min(100, hrs / DAY_LOAD * 100) + '%');
356
- const headRow = el('div', { class: 'cal3-row cal3-dhead' }, el('div', { class: 'cal3-gut' }),
357
- ...days.map((date) => {
358
- const L = load(date);
359
- return el('div', { class: 'cal3-dh' + (date === today ? ' today' : ''), 'data-cal3-dh': date },
360
- el('div', { class: 'dhl' },
361
- days.length > 1 ? button({ label: h.dayLabel(date), variant: 'ghost', size: 'sm', attrs: { class: 'cal3-dbtn', 'data-cal3-day': date, title: 'Open ' + h.dayLabel(date) }, onClick: () => h.go(ui.host, ui.r, { view: 'day', date, anim: 'zi' }) })
362
- : el('b', null, h.dayLabel(date)),
363
- el('span', { class: 'hrs', 'data-cal3-hrs': date }, L.tot ? +L.tot.toFixed(1) + ' h' : '')),
364
- el('div', { class: 'lbar', 'aria-hidden': 'true' }, seg(L.tied, 'tied'), seg(L.tot - L.tied, 'rt'), el('i', { class: 'rest' })));
365
- }));
366
-
367
- const strip = el('div', { class: 'cal3-row cal3-strip', 'data-cal3': 'strip' }, el('div', { class: 'cal3-gut' }, 'dates'),
368
- ...days.map((date) => {
369
- const kids = [...allDayOn(date).map((m) => meetingButton(ui, m, 'cal3-allday')), ...stripMarks(ui, date, days.length === 1)];
370
- return el('div', { class: 'cal3-sc' + (days.length === 1 ? ' line' : ''), 'data-cal3-strip': date }, ...(kids.filter(Boolean).length ? kids : [el('span', { class: 'cal3-none' }, days.length === 1 ? 'No dated item on this day' : '')]));
371
- }));
372
-
373
- const hours = el('div', { class: 'cal3-hours', 'aria-hidden': 'true' });
374
- for (let t = t0; t < t1; t++) hours.appendChild(setVar(el('span', null, pad(t) + ':00'), 'y', Y(t) + 'px'));
375
-
376
- const cols = days.map((date) => {
377
- const wd = h.dowOf(date);
378
- const col = el('div', { class: 'vday cal3-col' + (date === today ? ' today' : '') + (wd === 0 || wd === 6 ? ' we' : ''), 'data-cal3-col': date });
379
- if (st.free) for (const b of (M.freeBy.get(date) || [])) col.appendChild(freeBlock(ui, date, b, Y));
380
- const evs = timedOn(date).sort((a, b) => h.timeOf(a.e.at) - h.timeOf(b.e.at));
381
- lanes4(evs, h).forEach(([m, lane, n]) => {
382
- const s = h.timeOf(m.e.at); const f = h.endH(m.e);
383
- const S = evState(ui, m, now); const rt = !S.tied && !S.held && !S.todo; // routine: a standup, or no initiative, no prep and no record
384
- const b = meetingButton(ui, m, 'vb cal3-ev' + (S.past ? ' past' : '') + (rt || m.e.routine || m.e.mock_routine ? ' rt' : '') + (S.blocked ? ' hot' : ''), [el('b', null, m.e.title || m.e.id), f - s >= 0.5 ? el('small', null, h.hhmm(s) + ' to ' + h.hhmm(f) + S.note) : null]);
385
- setVar(b, 'y', (Y(s) + 1) + 'px'); setVar(b, 'h', Math.max(16, Y(f) - Y(s) - 3) + 'px'); setVar(b, 'l', lane); setVar(b, 'lc', n);
386
- col.appendChild(b);
387
- });
388
- if (date === today && now.slice(0, 10) === today) { const t = hmToH(now.slice(11)); if (t > t0 && t < t1) col.appendChild(setVar(el('div', { class: 'vnow cal3-now', 'aria-hidden': 'true' }), 'y', Y(t) + 'px')); }
389
- return col;
390
- });
391
- tg.append(headRow, strip, el('div', { class: 'cal3-row cal3-body' }, hours, ...cols));
392
- const key = (cls, text, wrap) => el('span', { class: wrap || null }, el('i', { class: 'lgk ' + cls, 'aria-hidden': 'true' }), text);
393
- const legend = el('div', { class: 'legend', 'data-cal3': 'legend' }, key('tied', 'tied to a promise or decision'), key('rt', 'routine'), key('fw', 'focus window', 'lgfw'), key('rel', 'release'), key('pro', 'promise'), key('rep', 'report'));
394
- return el('section', { class: 'card cal3-grid', 'data-cv': 'grid' }, el('div', { class: 'cal3-scroll' }, tg), legend);
395
- }
396
-
397
- /* overlapping meetings share the column side by side: [meeting, lane, lanes in its cluster] */
398
- function lanes4(evs, h) {
399
- const out = []; let cluster = []; let cEnd = -1;
400
- const flush = () => { const ends = []; const at = cluster.map((m) => { let l = ends.findIndex((x) => x <= h.timeOf(m.e.at)); if (l < 0) { l = ends.length; ends.push(h.endH(m.e)); } else ends[l] = h.endH(m.e); return [m, l]; }); at.forEach(([m, l]) => out.push([m, l, ends.length])); cluster = []; };
401
- for (const m of evs) { if (cluster.length && h.timeOf(m.e.at) >= cEnd) flush(); cluster.push(m); cEnd = Math.max(cEnd, h.endH(m.e)); }
402
- if (cluster.length) flush();
403
- return out;
404
- }
405
-
406
- function meetingButton(ui, m, cls, label) {
407
- const sel = ui.st.sel && ui.st.sel.type === 'event' && (ui.st.sel.id === m.e.id || ui.st.sel.id === ui.h.baseId(m.e));
408
- const t = m.e.title || m.e.id; const s = ui.h.timeOf(m.e.at);
409
- // with the Tidy-up chip on, a meeting that a suggestion names carries the most severe one's tone and title
410
- const tidy = ui.st.tidy ? (ui.M.tidyBy.get(m.e.id) || ui.M.tidyBy.get(ui.h.baseId(m.e)) || null) : null;
411
- const sev = tidy ? tidy[0].severity : null;
412
- const name = t + ', ' + ui.h.dayLabel(m.date) + (s !== null ? ' at ' + ui.h.hhmm(s) : ', all day') + (tidy ? '. Tidy-up: ' + tidy.map((x) => x.title).join('; ') : '');
413
- return button({
414
- label: label || t, variant: 'ghost', size: 'sm',
415
- attrs: { class: cls + (sel ? ' sel' : '') + (tidy ? ' cal3-tidy-ev cal3-tidy-' + (TIDY_RANK[sev] !== undefined ? sev : 'info') : ''), 'data-id': m.e.id, 'data-cal3-ev': m.e.id,
416
- ...(tidy ? { 'data-cal3-tidy': sev } : {}), 'aria-pressed': String(!!sel), 'aria-label': name, title: name },
417
- onClick: () => ui.select({ type: 'event', id: m.e.id }, '[data-cal3-ev="' + cssId(m.e.id) + '"]'),
418
- });
419
- }
420
-
421
- /* a free block: a dashed focus window with its length; the suggested use is in its title and in the Free time list */
422
- function freeBlock(ui, date, b, Y) {
423
- const s = hmToH(b.from); const f = hmToH(b.to);
424
- const text = b.suggestion && b.suggestion.text ? b.suggestion.text : NO_SUGGESTION;
425
- const n = el('div', { class: 'vf cal3-free', 'data-cal3-free': date + ' ' + b.from, title: b.from + ' to ' + b.to + ': ' + text },
426
- el('b', null, +((f - s)).toFixed(1) + ' h focus'));
427
- setVar(n, 'y', (Y(s) + 2) + 'px'); setVar(n, 'h', Math.max(18, Y(f) - Y(s) - 4) + 'px');
428
- return n;
429
- }
430
-
431
- /* ── significance (initiative calendar-highlights) ───────────────────────────────────────────────────────────────
432
- * Month, Quarter and Year show what matters and fold the rest into a count. Routine: a report date that recurs more often
433
- * than monthly (the server's `routine` flag, or a daily, weekly or bi-weekly cadence), a meeting that repeats in the range,
434
- * a stand-up or a 1:1, and a meeting tied to nothing. A due item that is on track is counted, not named. Key at Day, Week and
435
- * Month: milestones, releases, reports that go out, late or at-risk due items, and meetings tied to a promise or a decision.
436
- * Quarter and Year are one step stricter: milestones, releases, reports that go out, and late items; meetings are counted.
437
- * The Routine chip (Month, Quarter, Year) brings back every item as markers. */
438
- const WIDE = ['month', 'quarter', 'year'];
439
- const FREQUENT = /\b(daily|weekly|bi-?weekly|fortnightly|stand-?up)\b/i;
440
- const normT = (t) => String(t || '').toLowerCase().replace(/[^\p{L}\p{N}]+/gu, ' ').trim();
441
- const isDue = (m) => m.kind === 'due' || m.kind === 'own';
442
- const routineMark = (m) => m.kind === 'report' && (m.routine === true || (m.routine !== false && (FREQUENT.test(String(m.cadence || '')) || FREQUENT.test(String(m.title || '')) || /\bdraft\b/i.test(String(m.title || '')))));
443
- const quietDue = (m) => isDue(m) && m.tone !== 'bad' && m.tone !== 'warn';
444
- const keyMark = (m) => !routineMark(m) && !quietDue(m);
445
- const landMark = (m) => m.kind === 'milestone' || m.kind === 'release' || (m.kind === 'report' && !routineMark(m)) || (isDue(m) && m.tone === 'bad');
446
- const shortDay = (h, date) => h.dayLabel(date).replace(/^\S+ /, '');
447
-
448
- /* the meetings of the range, each marked key or routine; a title seen more than once in the range is a recurring meeting */
449
- function meetingsKeyed(ui) {
450
- const { M } = ui;
451
- if (!M._keyed) {
452
- const seen = new Map(); for (const m of M.meetings) { const k = normT(m.e.title); seen.set(k, (seen.get(k) || 0) + 1); }
453
- const now = nowIso();
454
- M._keyed = M.meetings.map((m) => {
455
- const t = m.e.title || '';
456
- const routine = m.e.routine === true || seen.get(normT(t)) > 1 || /stand-?up|\b1\s*[:/-]\s*1\b|one[- ]on[- ]one/i.test(t) || !evState(ui, m, now).tied;
457
- return { ...m, key: m.e.key === true || !routine };
458
- });
459
- }
460
- return M._keyed;
461
- }
462
- const meetingsIn = (ui, a, b) => (ui.st.on.has('meetings') ? meetingsKeyed(ui).filter((m) => m.date >= a && m.date <= b) : []);
463
-
464
- /* the number of folded items in the range, for the Routine chip */
465
- function routineCount(ui, range) {
466
- const wide = ui.M.view !== 'month';
467
- const marks = marksIn(ui.M, ui.st, range.start, range.end).filter((m) => (wide ? !landMark(m) : !keyMark(m))).length;
468
- return marks + meetingsIn(ui, range.start, range.end).filter((m) => wide || !m.key).length;
469
- }
470
-
471
- /* a name inside a highlight: a link-styled button that selects the item, so its detail opens beside the grid */
472
- function nameBtn(ui, sel, label, attrs) {
473
- return button({ label, variant: 'ghost', attrs: { class: 'cal3-sl', ...attrs }, onClick: () => ui.select(sel, null) });
474
- }
475
- const markName = (ui, m, label) => nameBtn(ui, { type: 'marker', id: m.id }, label || m.title, { 'data-cal3-mk': m.id, 'data-cal3-layer': m.layer, 'data-cal3-kind': m.kind, title: kindOf(m)[0] + ': ' + m.title + ', ' + ui.h.dayLabel(m.date) });
476
- const meetName = (ui, m) => nameBtn(ui, { type: 'event', id: m.e.id }, m.e.title || m.e.id, { 'data-cal3-hl-ev': m.e.id, title: (m.e.title || m.e.id) + ', ' + ui.h.dayLabel(m.date) });
477
-
478
- /* join nodes as "a, b and c", with "N more" for what is past max */
479
- function joinList(nodes, max) {
480
- const a = nodes.slice(0, max); if (nodes.length > max) a.push(String(nodes.length - max) + ' more');
481
- const out = [];
482
- a.forEach((n, i) => { if (i) out.push(i === a.length - 1 ? ' and ' : ', '); out.push(n); });
483
- return out;
484
- }
485
-
486
- /* the highlight of a span as a list of text and name nodes; [] when nothing in it is significant.
487
- * mode 'cell' is the short form of a Month day; 'top' is the range summary and a Quarter or Year column. */
488
- function highlightOf(ui, a, b, mode) {
489
- const { h, M } = ui; const cell = mode === 'cell'; const wide = M.view === 'quarter' || M.view === 'year';
490
- const marks = marksIn(M, ui.st, a, b); const meets = wide ? [] : meetingsIn(ui, a, b).filter((m) => m.key);
491
- const on = (date) => (cell ? '' : ' on ' + shortDay(h, date));
492
- const rel = marks.filter((m) => m.kind === 'release'); const ms = marks.filter((m) => m.kind === 'milestone' && (!m.tone || m.tone === 'ok'));
493
- const rep = marks.filter((m) => m.kind === 'report' && !routineMark(m));
494
- const lateMs = marks.filter((m) => m.kind === 'milestone' && (m.tone === 'bad' || m.tone === 'warn'));
495
- const riskRel = rel.filter((m) => m.tone === 'bad' || m.tone === 'warn');
496
- const lateDue = marks.filter((m) => isDue(m) && m.tone === 'bad'); const riskDue = wide ? [] : marks.filter((m) => isDue(m) && m.tone === 'warn');
497
- const out = []; const sent = (...k) => { if (out.length) out.push(' '); out.push(...k); };
498
- const dated = (list, max) => joinList(list.map((m) => el('span', null, markName(ui, m), on(m.date))), max);
499
- if (rel.length) sent(...(cell ? [...joinList(rel.map((m) => markName(ui, m)), 2), rel.length === 1 ? ' ships.' : ' ship.'] : [plural(rel.length, 'release') + ': ', ...dated(rel, 3), '.']));
500
- if (ms.length) sent(ms.length === 1 ? 'Milestone: ' : plural(ms.length, 'milestone') + ': ', ...dated(ms, 3), '.');
501
- if (meets.length) {
502
- if (cell || M.view === 'day') sent(...joinList(meets.map((m) => el('span', null, meetName(ui, m), h.timeOf(m.e.at) !== null ? ' at ' + h.hhmm(h.timeOf(m.e.at)) : '')), cell ? 2 : 4), '.');
503
- else {
504
- const big = meets.slice().sort((x, y) => hoursOf(y, h) - hoursOf(x, h) || String(x.e.at).localeCompare(String(y.e.at))).slice(0, 2).sort((x, y) => String(x.e.at).localeCompare(String(y.e.at)));
505
- sent(plural(meets.length, 'key meeting') + (meets.length > big.length ? ', the biggest ' : ': '), ...joinList(big.map((m) => el('span', null, meetName(ui, m), ' on ' + shortDay(h, m.date))), 2), '.');
506
- }
507
- }
508
- if (rep.length) sent(...(cell || rep.length <= 2 ? [...joinList(rep.map((m) => markName(ui, m, m.title.replace(/ goes out$/, ''))), 2), rep.length === 1 ? ' goes out.' : ' go out.'] : [rep.length + ' reports go out.']));
509
- const watch = [];
510
- for (const m of lateMs) watch.push(el('span', null, markName(ui, m, m.title.replace(/\s*\(late\)$/, '')), m.tone === 'bad' ? ' is late' : ' is at risk', cell ? '' : ' (' + shortDay(h, m.date) + ')'));
511
- for (const m of riskRel) watch.push(el('span', null, markName(ui, m), m.tone === 'bad' ? ' is late' : ' is at risk'));
512
- if (lateDue.length) watch.push(cell || lateDue.length <= 2 ? el('span', null, ...joinList(lateDue.map((m) => markName(ui, m)), 2), lateDue.length === 1 ? ' is late' : ' are late') : plural(lateDue.length, 'due item') + ' are late');
513
- if (riskDue.length) watch.push(cell || riskDue.length <= 2 ? el('span', null, ...joinList(riskDue.map((m) => markName(ui, m)), 2), ' due soon') : plural(riskDue.length, 'due item') + ' due soon');
514
- if (watch.length) sent(el('b', { class: 'cal3-watch' }, 'Watch:'), ' ', ...joinList(watch, 4), '.');
515
- return out;
516
- }
517
-
518
- /* the range summary above the grid, at every zoom */
519
- function highlights(ui, range) {
520
- const { h, M } = ui;
521
- const MF = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
522
- const mo = Number(range.start.slice(5, 7));
523
- const label = M.view === 'day' ? h.dayLabel(range.start) : M.view === 'week' ? 'Week of ' + h.dayLabel(range.start) : M.view === 'month' ? MF[mo - 1] : M.view === 'quarter' ? 'Q' + (Math.floor((mo - 1) / 3) + 1) : range.start.slice(0, 4);
524
- const body = highlightOf(ui, range.start, range.end, 'top');
525
- return el('div', { class: 'cal3-sum', 'data-cal3': 'highlights' },
526
- el('span', { class: 'cal3-sum-h' }, label + ' highlights'),
527
- el('p', null, ...(body.length ? body : ['Nothing significant. Only routine items fall in this range.'])));
528
- }
529
-
530
- /* the quiet line of a span: what is counted and not named; pressing it opens the span */
531
- function quietLine(ui, a, b, view, opts) {
532
- const wide = opts && opts.wide;
533
- const marks = marksIn(ui.M, ui.st, a, b); const meets = meetingsIn(ui, a, b);
534
- const due = marks.filter((m) => isDue(m) && (wide ? m.tone !== 'bad' : quietDue(m)));
535
- const rt = marks.filter(routineMark).length + (wide ? 0 : meets.filter((m) => !m.key).length);
536
- const nMeet = wide ? meets.length : 0;
537
- const parts = [nMeet ? plural(nMeet, 'meeting') : null, due.length ? due.length + ' due' : null, rt ? rt + ' routine' : null].filter(Boolean);
538
- if (!parts.length) return null;
539
- const mo = Number(a.slice(5, 7));
540
- const where = view === 'day' ? ui.h.dayLabel(a) : view === 'week' ? 'the week of ' + ui.h.dayLabel(a) : view === 'quarter' ? 'Q' + (Math.floor((mo - 1) / 3) + 1) + ' ' + a.slice(0, 4) : ui.h.MN[mo - 1] + ' ' + a.slice(0, 4);
541
- const names = [...new Set([...due.map((m) => m.title), ...marks.filter(routineMark).map((m) => m.title)])];
542
- const tip = parts.join(', ') + (names.length ? ': ' + names.slice(0, 8).join(', ') + (names.length > 8 ? ' and more' : '') : '') + '. Open ' + where;
543
- return button({ label: parts.join(' · '), variant: 'ghost', size: 'sm', attrs: { class: 'cal3-more cal3-rt', 'data-cal3-quiet': a, title: tip, 'aria-label': tip },
544
- onClick: () => ui.h.go(ui.host, ui.r, { view, date: a, anim: 'zi' }) });
545
- }
546
-
547
- /* ── Month: a cell per day. Its highlight in a sentence and a quiet line; with Routine on, the meeting count and every marker ── */
548
-
549
- function monthGrid(ui) {
550
- const { M, st, h, d } = ui;
551
- const days = M.cells.filter((c) => c.start === c.end);
552
- const g = el('div', { class: 'cal3-month', 'data-cal3': 'month' }, ...['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map((n) => el('div', { class: 'cal3-wd' }, n)));
553
- const off = days.length ? (h.dowOf(days[0].start) + 6) % 7 : 0;
554
- for (let i = 0; i < off; i++) g.appendChild(el('div', { class: 'cal3-mc out', 'aria-hidden': 'true' }));
555
- for (const c of days) {
556
- const wd = h.dowOf(c.start); const n = st.on.has('meetings') ? M.meetingsOf(c).length : 0;
557
- const hl = st.routine ? [] : highlightOf(ui, c.start, c.start, 'cell');
558
- g.appendChild(el('div', { class: 'cal3-mc' + (wd === 0 || wd === 6 ? ' we' : '') + (c.start === d.today ? ' today' : '') + (hl.length ? ' key' : ''), 'data-cal3-date': c.start },
559
- button({ label: String(Number(c.start.slice(8))), variant: 'ghost', size: 'sm', attrs: { class: 'cal3-dn', 'data-cal3-day': c.start, 'aria-label': 'Open ' + h.dayLabel(c.start) + (n ? ', ' + plural(n, 'meeting') : ''), title: 'Open ' + h.dayLabel(c.start) }, onClick: () => h.go(ui.host, ui.r, { view: 'day', date: c.start, anim: 'zi' }) }),
560
- ...(st.routine
561
- ? [n ? el('span', { class: 'cal3-cnt' }, plural(n, 'meeting')) : null, ...markRow(ui, c.start, c.start, 3, true, 'day')]
562
- : [hl.length ? el('p', { class: 'cal3-hl', 'data-cal3-hl': c.start }, ...hl) : null, quietLine(ui, c.start, c.start, 'day')])));
563
- }
564
- return el('section', { class: 'card cal3-grid', 'data-cv': 'grid' }, g, foldNote(ui));
565
- }
566
-
567
- /* the line under a Month, Quarter or Year grid that says what is counted and not named */
568
- function foldNote(ui) {
569
- if (ui.st.routine) return null;
570
- return el('p', { class: 'dim cal3-fold', 'data-cal3': 'fold-note' }, (ui.M.view === 'month'
571
- ? 'Report drafts, recurring meetings, stand-ups, 1:1s and due items on track are counted under each day, not listed.'
572
- : 'Meetings, due items that are not late, and routine items are counted under each highlight, not listed. Open a month for its key meetings.')
573
- + ' Turn on Routine to show everything.');
574
- }
575
-
576
- /* ── Quarter: a column per month; Year: a column per quarter. Each has its highlight and its quiet line ──────────── */
577
-
578
- const monthEnd = (start) => { const y = Number(start.slice(0, 4)); const m = Number(start.slice(5, 7)); const last = new Date(y, m, 0).getDate(); return start.slice(0, 8) + String(last).padStart(2, '0'); };
579
- const monthStart = (y, m) => y + '-' + String(m).padStart(2, '0') + '-01';
580
-
581
- function spanColumn(ui, a, b, head, now, extra, view) {
582
- const hl = ui.st.routine ? null : highlightOf(ui, a, b, 'top');
583
- return el('div', { class: 'cal3-ym cal3-col' + (now ? ' now' : ''), 'data-cal3-span': a }, head,
584
- ui.st.routine ? el('div', { class: 'cal3-qmk' }, ...markRow(ui, a, b, 12, false, view))
585
- : el('p', { class: 'cal3-hl' + (hl.length ? '' : ' dim'), 'data-cal3-hl': a }, ...(hl.length ? hl : ['Nothing significant.'])),
586
- extra || null, ui.st.routine ? null : quietLine(ui, a, b, view, { wide: true }));
587
- }
588
-
589
- function quarterRows(ui) {
590
- const { h, d } = ui; const range = d.range || { start: d.today, end: d.today };
591
- const y = Number(range.start.slice(0, 4)); const m0 = Number(range.start.slice(5, 7));
592
- const cols = [0, 1, 2].map((i) => {
593
- const a = monthStart(y, m0 + i); const b = monthEnd(a);
594
- const head = button({ label: h.MN[m0 + i - 1] + ' ' + y, variant: 'ghost', size: 'sm', attrs: { class: 'cal3-dbtn', 'data-cal3-month': a.slice(0, 7), title: 'Open ' + h.MN[m0 + i - 1] + ' ' + y }, onClick: () => h.go(ui.host, ui.r, { view: 'month', date: a, anim: 'zi' }) });
595
- return spanColumn(ui, a, b, head, a <= d.today && d.today <= b, null, 'month');
596
- });
597
- return el('section', { class: 'card cal3-grid', 'data-cv': 'grid' }, el('div', { class: 'cal3-cols cal3-cols-3', 'data-cal3': 'quarter' }, ...cols), foldNote(ui));
598
- }
599
-
600
- function yearCards(ui) {
601
- const { h, d } = ui; const range = d.range || { start: d.today, end: d.today }; const y = Number(range.start.slice(0, 4));
602
- const cols = [0, 1, 2, 3].map((q) => {
603
- const a = monthStart(y, q * 3 + 1); const b = monthEnd(monthStart(y, q * 3 + 3));
604
- const head = button({ label: 'Q' + (q + 1) + ' ' + y + ' · ' + h.MN[q * 3] + ' to ' + h.MN[q * 3 + 2], variant: 'ghost', size: 'sm', attrs: { class: 'cal3-dbtn', 'data-cal3-quarter': 'Q' + (q + 1), title: 'Open Q' + (q + 1) + ' ' + y }, onClick: () => h.go(ui.host, ui.r, { view: 'quarter', date: a, anim: 'zi' }) });
605
- const months = el('div', { class: 'cal3-mlinks' }, ...[1, 2, 3].map((k) => { const s = monthStart(y, q * 3 + k); return button({ label: h.MN[q * 3 + k - 1], variant: 'ghost', size: 'sm', attrs: { class: 'cal3-more', 'data-cal3-month': s.slice(0, 7), title: 'Open ' + h.MN[q * 3 + k - 1] + ' ' + y }, onClick: () => h.go(ui.host, ui.r, { view: 'month', date: s, anim: 'zi' }) }); }));
606
- return spanColumn(ui, a, b, head, a <= d.today && d.today <= b, months, 'quarter');
607
- });
608
- return el('section', { class: 'card cal3-grid', 'data-cv': 'grid' }, el('div', { class: 'cal3-cols cal3-cols-4', 'data-cal3': 'year' }, ...cols), foldNote(ui));
609
- }
610
-
611
- /* ── the detail column ────────────────────────────────────────────────────────────────────────────────────────────── */
612
-
613
- function refLink(ui, ref, extra) {
614
- if (!ref || !ref.type || !ref.id) return el('span', { class: 'dim cal3-noptr' }, 'no pointer');
615
- if (ref.type === 'note' && !ui.r.ctx.overlay) return el('a', { href: '#', class: 'cal3-ref', 'data-cal3-ref': 'note:' + ref.id, title: 'Open the note',
616
- onClick: (ev) => { ev.preventDefault(); openNote(ui.r, ref.id); ui.redraw(); } }, c3ic('notes', 'sm'), 'Open the note');
617
- if (!REF[ref.type]) return el('span', { class: 'dim mono cal3-noptr' }, ref.type + ' ' + ref.id);
618
- return el('a', { href: '#', class: 'cal3-ref', 'data-cal3-ref': ref.type + ':' + ref.id, title: REF[ref.type] + ': ' + ref.id,
619
- onClick: (ev) => { ev.preventDefault(); openRef(ui, ref, extra || {}); } }, c3ic('out', 'sm'), REF[ref.type]);
620
- }
621
-
622
- /* open the home of a reference: an initiative on Initiatives, a work item on Work, a report on Reports */
623
- function openRef(ui, ref, extra) {
624
- const { h, host, r } = ui;
625
- if (ui.st.sel && ui.st.sel.type === 'event') { ui.st.sel = null; closeMeetingSheet(r); } // the popup does not follow you to another page
626
- if (ref.type === 'initiative') { if (!h.goInitiative(ref.id)) h.openInit(host, r, ref.id, extra.title); return; }
627
- if (ref.type === 'plan-item' || ref.type === 'release') { const ini = extra.initiative || ref.initiative; if (!(ini && h.goInitiative(ini))) h.gotoTab('init'); return; }
628
- if (ref.type === 'item') { h.gotoTab('work'); return; }
629
- if (ref.type === 'jira' || ref.type === 'ask') { openBoardTab(ui, ref.board, ref.type === 'jira' ? 'sprints' : 'triage'); return; }
630
- if (ref.type === PORTFOLIO) { openBoardTab(ui, null); return; }
631
- if (ref.type === 'report') h.gotoTab('rep');
632
- }
633
-
634
- /* the home chip: where the record lives (the mockup's UI.homeChip) */
635
- const homeChip = (name) => el('span', { class: 'chip2', title: 'Where this lives', 'data-cal3': 'home' }, c3ic('repo', 'sm'), name || 'its home');
636
- const peopleOf = (e) => [].concat(e.people || e.with || e.attendees || []).map((p) => (p && typeof p === 'object' ? p.name || p.id : p)).filter(Boolean).map(String);
637
-
638
- function closeBtn(ui) {
639
- return button({ label: 'Close', variant: 'ghost', size: 'sm', attrs: { class: 'cal3-close', 'data-cal3': 'close' }, onClick: () => { ui.st.sel = null; ui.redraw('[data-cal3-chip="meetings"]'); } });
640
- }
641
-
642
- function detail(ui) {
643
- const { st, M, h } = ui;
644
- const box = (kids, attrs) => el('section', { class: 'card cal3-detail', 'data-cal3': 'detail', 'aria-label': 'Detail', ...(attrs || {}) }, ...kids);
645
- if (st.sel && st.sel.type === 'marker' && M.layers) {
646
- const m = M.layers.find((x) => x.id === st.sel.id);
647
- if (m) {
648
- const [word, icon] = kindOf(m);
649
- return box([
650
- el('div', { class: 'cal3-dt' }, el('h3', null, c3ic(icon), word), closeBtn(ui)),
651
- el('b', { class: 'cal3-title' }, m.title),
652
- el('div', { class: 'chips2' }, homeChip(HOME[m.kind]), el('span', { class: 'tag' }, word), el('span', { class: 'tag' }, h.dayLabel(m.date) + (m.end && m.end !== m.date ? ' to ' + h.dayLabel(m.end) : '')),
653
- m.tone && TONE[m.tone] ? el('span', { class: 'tag cal3-tone-' + m.tone }, TONE[m.tone]) : null, m.initiative ? el('span', { class: 'tag' }, 'Initiative: ' + (((ui.d.gantt || []).find((g) => g.id === m.initiative) || {}).title || m.initiative)) : null),
654
- el('div', { class: 'cal3-open', 'data-cal3': 'open' }, refLink(ui, m.ref, { initiative: m.initiative, title: m.title })),
655
- el('p', { class: 'dim cal3-note' }, m.kind === 'own' ? 'A marker shows the date only. You act on the item where it lives.' : 'This date lives here. Change it where the plan is kept, not on the grid.'),
656
- ], { 'data-cal3-sel': m.id });
657
- }
658
- }
659
- if (st.sel && st.sel.type === 'event') {
660
- const hit = M.findEvent(st.sel.id);
661
- if (hit && ui.r.ctx.overlay) return box(meetingDetail(ui, hit), { 'data-cal3-sel': hit.e.id }); // the calendar popup is a drawer already
662
- }
663
- return box([el('div', { class: 'cal3-dt' }, el('h3', null, c3ic('info'), 'Detail')),
664
- el('p', { class: 'dim cal3-note' }, 'Select a meeting to see what came out of it or what to prepare. Select a dated marker to see its date and open its home.')]);
665
- }
666
-
667
- /** The Meeting focus page (initiative c3-meeting-focus): one calm full-screen page for a meeting that is today. It loads when pressed. */
668
- /* from the popup, Focus closes it first: the focus page is the whole screen and has its own sheets (c3-cal-strip-popup) */
669
- const focusBtn = (e, date, ui) => button({ label: [c3ic('target', 'sm'), 'Focus'], variant: 'primary', size: 'sm',
670
- attrs: { 'data-cal3': 'focus', title: 'Open the meeting focus page: the clock, the topics, the material and PMOS beside the conversation' },
671
- onClick: () => { if (ui) { ui.st.sel = null; closeMeetingSheet(ui.r); ui.redraw(); } import('./c3-focus.js').then((m) => m.openFocus({ event: e, date })).catch(() => toast({ text: 'The focus page could not load.', tone: 'error' })); } });
672
-
673
- /* "Replay": the full-screen replay of a meeting that has ended and has a recorded note (c3-replay.js); it closes the popup first, as Focus does */
674
- const replayBtn = (e, ui) => {
675
- const n = noteOfEvent(e);
676
- if (!n || n.private || n.state === 'recording' || n.state === 'paused' || !(n.segments > 0 || (n.words || 0) > 0)) return null;
677
- return button({ label: [c3ic('play', 'sm'), 'Replay'], variant: 'ghost', size: 'sm',
678
- attrs: { 'data-cal3': 'replay', title: 'Open the meeting replay: the topics, the key points, the screen and the conversation along the audio' },
679
- onClick: () => { if (ui) { ui.st.sel = null; closeMeetingSheet(ui.r); ui.redraw(); } import('./c3-replay.js').then((m) => m.openReplay({ note: n.id })).catch(() => toast({ text: 'The replay could not load.', tone: 'error' })); } });
680
- };
681
-
682
- function meetingDetail(ui, hit, inSheet) {
683
- const { M, h } = ui; const e = hit.e;
684
- const s = h.timeOf(e.at); const f = s === null ? null : h.endH(e);
685
- const rec = M.ctx ? (M.ctx[e.id] || M.ctx[h.baseId(e)] || null) : null;
686
- const phase = rec && rec.phase ? rec.phase : String(e.end || e.at) <= nowIso() ? 'past' : 'upcoming';
687
- const past = phase === 'past';
688
- const items = rec && Array.isArray(rec.items) ? rec.items : [];
689
- const list = (kinds, title, key, none) => {
690
- const rows = items.filter((x) => kinds.includes(x.kind));
691
- // lines that all come from one note name it once, under the list, instead of a pointer on every line
692
- const r0 = rows.length > 1 && rows[0].ref && rows[0].ref.type === 'note' ? rows[0].ref : null;
693
- const one = r0 && rows.every((x) => x.ref && x.ref.type === 'note' && x.ref.id === r0.id) ? r0 : null;
694
- return el('div', { class: 'cal3-ctx', 'data-cal3-ctx': key }, el('h4', null, title),
695
- rows.length ? el('ul', { class: 'cal3-cl', role: 'list' }, ...rows.map((x) => el('li', { class: 'cal3-ci', 'data-cal3-item': x.kind },
696
- el('span', { class: 'tag' + (x.done ? ' cal3-up' : '') }, x.done && x.kind === 'todo' ? 'Done' : CTXWORD[x.kind] || x.kind), el('span', { class: 'cal3-ct' }, x.text),
697
- x.at ? el('span', { class: 'dim mono cal3-at' }, h.dayLabel(x.at) + (h.timeOf(x.at) !== null ? ' ' + h.hhmm(h.timeOf(x.at)) : '')) : null,
698
- one ? null : refLink(ui, x.ref, { title: x.text })))) : el('p', { class: 'dim cal3-note' }, none),
699
- one ? el('p', { class: 'dim cal3-note cal3-src', 'data-cal3': 'from-note' }, 'From the meeting note. ', refLink(ui, one)) : null);
700
- };
701
- let body;
702
- if (!M.ctx) body = [fold('info', 'The calendar sent no meeting context, so PMOS shows nothing for this meeting.', { 'data-cal3': 'no-context' })];
703
- else if (past && (!rec || rec.held === false)) body = [fold('moon', 'Nothing held for this meeting: no note, decisions or linked items yet.', { 'data-cal3': 'nothing-held' })];
704
- else if (past) body = [list(['decision', 'action'], 'What came out of it', 'out', 'No decision or action is recorded.'), list(['moved'], 'What moved after it', 'moved', 'Nothing moved within 48 hours that refers to it.')];
705
- else body = upcomingBody(ui, rec, items, e, hit.date);
706
- const b = !past && rec && rec.brief ? rec.brief : null;
707
- const lv = !past && rec ? rec.level || null : null;
708
- const iniId = lv && lv.kind !== 'initiative' ? null : typeof e.initiative === 'string' && !(lv && lv.by === 'pm') ? e.initiative : b && b.initiative ? b.initiative.id : null;
709
- const iniTitle = iniId ? (b && b.initiative && b.initiative.id === iniId && b.initiative.title) || (((ui.d.gantt || []).find((g) => g.id === iniId) || {}).title) || iniId : null;
710
- const iniStatus = b && b.initiative && b.initiative.id === iniId ? b.initiative.status : (((ui.d.gantt || []).find((g) => g.id === iniId) || {}).status || null);
711
- const sources = b && b.sources && b.sources.length ? 'Put together from ' + listWords(b.sources) + '. Each line opens its source. ' : '';
712
- const chipsRow = () => el('div', { class: 'chips2', 'data-cal3': 'meeting-chips' }, homeChip('Calendar'), ...peopleOf(e).map((n) => el('span', { class: 'tag', 'data-cal3': 'person' }, n)),
713
- iniId ? el('span', { class: 'tag', 'data-cal3': 'meeting-initiative' }, 'Initiative: ' + iniTitle) : null,
714
- iniStatus && STATUS_TONE[iniStatus] ? el('span', { class: 'tag cal3-tone-' + STATUS_TONE[iniStatus] }, iniStatus) : null);
715
- const tail = el('p', { class: 'dim cal3-note', 'data-cal3': past ? 'past-note' : 'sources' }, past ? 'Only what PMOS holds a record for: items created or closed within 48 hours of the meeting. Each line opens its source.' : sources + 'PMOS proposes changes. It never edits your calendar.');
716
- if (inSheet) {
717
- // the popup: the sheet's header carries the title and Close; at Half and wider the note sits beside what came out of it
718
- const side = noteCard(ui, e);
719
- return [
720
- el('div', { class: 'cal3-dt' }, el('span', { class: 'tag' + (past ? '' : ' cal3-up') }, past ? 'past' : 'upcoming'), !past && s !== null && hit.date === ui.d.today ? focusBtn(e, hit.date, ui) : null, past ? replayBtn(e, ui) : null),
721
- el('div', { class: 'dim mono cal3-when' }, h.dayLabel(hit.date) + (s === null ? ', all day' : ' · ' + h.hhmm(s) + ' to ' + h.hhmm(f))),
722
- chipsRow(),
723
- past || !M.ctx ? null : levelRow(ui, e, lv),
724
- el('div', { class: 'cal3-mcols' + (side ? '' : ' one') }, el('div', { class: 'cal3-mcol' }, ...body, tail), side ? el('div', { class: 'cal3-mcol' }, side) : null),
725
- ];
726
- }
727
- return [
728
- el('div', { class: 'cal3-dt' }, el('h3', null, c3ic('cal'), 'Meeting'), el('span', { class: 'tag' + (past ? '' : ' cal3-up') }, past ? 'past' : 'upcoming'),
729
- !past && s !== null && hit.date === ui.d.today ? focusBtn(e, hit.date) : null, closeBtn(ui)),
730
- el('b', { class: 'cal3-title' }, e.title || e.id),
731
- el('div', { class: 'dim mono cal3-when' }, h.dayLabel(hit.date) + (s === null ? ', all day' : ' · ' + h.hhmm(s) + ' to ' + h.hhmm(f))),
732
- chipsRow(),
733
- past || !M.ctx ? null : levelRow(ui, e, lv),
734
- noteLink(ui, e),
735
- ...body,
736
- tail,
737
- ];
738
- }
739
-
740
- /* the card before a meeting (initiative c3-meeting-card, the mockup the PM approved on 2026-10-12): what it is for, what
741
- * matters today, what happened last time and what to bring. Every part comes from the server's `brief` (lib/calendar-layers.js
742
- * briefOf) or the prep items; a part with no record is left out. When PMOS knows little, it says what is missing. */
743
- const STATUS_TONE = { 'at risk': 'warn', delayed: 'bad', overdue: 'bad' };
744
- const listWords = (a) => (a.length < 2 ? a.join('') : a.slice(0, -1).join(', ') + ' and ' + a[a.length - 1]);
745
- const ctxBox = (key, title, ...kids) => el('div', { class: 'cal3-ctx', 'data-cal3-ctx': key }, el('h4', null, ...[].concat(title)), ...kids);
746
- const ul = (rows) => el('ul', { class: 'cal3-cl', role: 'list' }, ...rows);
747
- const ci = (attrs, ...kids) => el('li', { class: 'cal3-ci', ...attrs }, ...kids);
748
-
749
- /* ── what a meeting is about: the Portfolio, a board or an initiative (initiative c3-meeting-board) ──
750
- * The switch says which level the card reads and why PMOS chose it (lib/calendar-layers.js levelOf). Pressing a level links every
751
- * occurrence of the meeting to it (POST /api/calendar-links); Board and Initiative ask which one when there is more than one. */
752
- // the meeting's level, not the old initiative list's Portfolio mode (cuts.test.js keeps that mode out)
753
- const PORTFOLIO = 'portfolio';
754
- const LEVELS = [[PORTFOLIO, 'Portfolio', 'Read every board'], ['board', 'Board', 'Read one board and its sprint'], ['initiative', 'Initiative', 'Read one initiative']];
755
- const linkPick = new Map(); // event id → the level whose picker is open
756
-
757
- function levelRow(ui, e, lv) {
758
- const open = linkPick.get(e.id) || null;
759
- const seg = el('div', { class: 'seg cal3-lvseg', role: 'group', 'aria-label': 'This meeting is about', 'data-cal3': 'level' },
760
- ...LEVELS.map(([k, label, title]) => { const x = button({ variant: 'ghost', attrs: { class: 'cal3-b', 'aria-pressed': String(!!lv && lv.kind === k), 'data-cal3-level': k, title },
761
- onClick: () => pickLevel(ui, e, lv, k) }); x.replaceChildren(el('span', null, label)); return x; }));
762
- const what = !lv ? 'Not linked yet. Pick a level and PMOS reads it before the meeting.'
763
- : lv.kind === PORTFOLIO ? 'Reads every board, linked because ' + lv.why + '.'
764
- : lv.kind === 'board' ? 'Reads the ' + (lv.name || lv.id) + ' board and its sprint, linked because ' + lv.why + '.'
765
- : 'Reads ' + (lv.name || lv.id) + ', linked because ' + lv.why + '.';
766
- const unlink = lv && lv.by === 'pm' ? el('a', { href: '#', class: 'cal3-ref', 'data-cal3': 'unlink', onClick: (ev) => { ev.preventDefault(); saveLink(ui, e, { kind: 'none' }, 'The link is removed.'); } }, 'Unlink') : null;
767
- return el('div', { class: 'cal3-level', 'data-cal3-ctx': 'level', 'data-cal3-level-by': lv ? lv.by : 'none' }, seg, el('span', { class: 'dim cal3-note' }, what), unlink, open ? pickerOf(ui, e, open) : null);
768
- }
769
-
770
- function pickLevel(ui, e, lv, kind) {
771
- if (lv && lv.kind === kind && lv.by === 'pm' && kind === PORTFOLIO) return;
772
- if (kind === PORTFOLIO) { saveLink(ui, e, { kind }, 'This meeting now reads every board.'); return; }
773
- const choices = choicesOf(ui, kind);
774
- if (choices.length === 1) { saveLink(ui, e, linkBody(kind, choices[0]), 'This meeting now reads ' + choices[0].name + '.'); return; }
775
- linkPick.set(e.id, linkPick.get(e.id) === kind ? null : kind);
776
- ui.redraw();
777
- }
778
-
779
- const choicesOf = (ui, kind) => kind === 'board' ? (ui.d.link_boards || []).map((b) => ({ ws: b.ws, id: b.id, name: b.name }))
780
- : (ui.d.gantt || []).filter((g) => g && g.id).map((g) => ({ id: g.id, name: g.title || g.id }));
781
- const linkBody = (kind, c) => kind === 'board' ? { kind, ws: c.ws, board: c.id, title: c.name } : { kind, initiative: c.id, title: c.name };
782
-
783
- function pickerOf(ui, e, kind) {
784
- const choices = choicesOf(ui, kind);
785
- if (!choices.length) return el('span', { class: 'dim cal3-note', 'data-cal3': 'level-none' }, kind === 'board' ? 'No board to link yet.' : 'No initiative to link in this range.');
786
- const sel = el('select', { 'aria-label': kind === 'board' ? 'Pick the board' : 'Pick the initiative', 'data-cal3': 'level-pick',
787
- onChange: () => { const c = choices[Number(sel.value)]; if (c) saveLink(ui, e, linkBody(kind, c), 'This meeting now reads ' + c.name + '.'); } },
788
- el('option', { value: '' }, kind === 'board' ? 'Pick the board' : 'Pick the initiative'), ...choices.map((c, i) => el('option', { value: String(i) }, c.name)));
789
- return sel;
790
- }
791
-
792
- async function saveLink(ui, e, body, said) {
793
- linkPick.delete(e.id);
794
- let r = null;
795
- try { r = await pmPost('/api/calendar-links', { event: { title: e.title || e.id, series: e.series || null }, ...body }); } catch (err) { r = { ok: false, error: String((err && err.message) || err) }; }
796
- if (!r || !r.ok) { toast('The link was not saved: ' + ((r && r.error) || 'no answer') + '.'); ui.redraw(); return; }
797
- toast(said);
798
- ui.h.go(ui.host, ui.r, {});
799
- }
800
-
801
- /* the sprint's days left in words: working days after today up to its end */
802
- function sprintLeft(h, end, today) {
803
- if (!end) return '';
804
- if (end < today) return 'ended ' + h.dayLabel(end);
805
- let n = 0;
806
- for (let t = new Date(today + 'T12:00:00Z').getTime() + 86400000; ; t += 86400000) {
807
- const d = new Date(t).toISOString().slice(0, 10); if (d > end) break;
808
- const w = new Date(t).getUTCDay(); if (w > 0 && w < 6) n++;
809
- }
810
- return (n === 0 ? 'last day' : plural(n, 'working day') + ' left') + ', ends ' + h.dayLabel(end);
811
- }
812
-
813
- const HEALTH = { ok: ['', 'On track'], warn: ['warn', 'Needs attention'], bad: ['bad', 'Off track'] };
814
-
815
- function boardParts(ui, b) {
816
- const { h } = ui;
817
- const out = [];
818
- if (b.boards && b.boards.length) out.push(ctxBox('boards', [c3ic('cols', 'sm'), 'Boards'], ul(b.boards.map((x) => {
819
- const [tone, word] = HEALTH[x.health] || ['', 'Not read'];
820
- return ci({ 'data-cal3-board': x.id }, el('span', { class: 'tag' + (tone ? ' cal3-tone-' + tone : '') }, word), el('span', { class: 'cal3-ct' }, x.name), el('span', { class: 'dim mono cal3-at' }, x.line),
821
- el('a', { href: '#', class: 'cal3-ref', title: 'Open the board: ' + x.name, onClick: (ev) => { ev.preventDefault(); openBoardTab(ui, x.id, 'summary'); } }, c3ic('out', 'sm'), 'Open the board'));
822
- }))));
823
- if (b.sprint) {
824
- const sp = b.sprint; const c = sp.counts || { todo: 0, doing: 0, done: 0 };
825
- out.push(ctxBox('sprint', [c3ic('cols', 'sm'), sp.name, el('span', { class: 'dim mono cal3-h4r' }, sprintLeft(h, sp.end, ui.d.today || ''))],
826
- el('div', { class: 'cal3-bar', role: 'img', 'aria-label': c.done + ' done, ' + c.doing + ' in progress, ' + c.todo + ' to do' },
827
- setVar(el('i', { class: 'd' }), 'n', c.done), setVar(el('i', { class: 'p' }), 'n', c.doing), setVar(el('i', { class: 't' }), 'n', c.todo)),
828
- el('div', { class: 'chips2 dim mono cal3-counts' }, el('span', null, c.done + ' done'), el('span', null, c.doing + ' in progress'), el('span', null, c.todo + ' to do'),
829
- b.next ? el('span', { 'data-cal3': 'next-sprint' }, '· ' + b.next.name + ': ' + b.next.planned + ' planned, ' + b.next.carry + ' may carry over') : null)));
830
- }
831
- return out;
832
- }
833
-
834
- /* a board's home on Initiatives: the page reads ?init= when it opens (c3-initiatives.js parseLoc) */
835
- function openBoardTab(ui, board, tab) {
836
- try { const u = new URL(location.href); u.searchParams.set('init', board ? 'board:' + encodeURIComponent(board) + ':' + tab : ''); if (!board) u.searchParams.delete('init'); history.replaceState(history.state, '', u); } catch { /* no history */ }
837
- ui.h.gotoTab('init');
838
- }
839
-
840
- function upcomingBody(ui, rec, items, e, date) {
841
- const { h } = ui;
842
- const b = rec && rec.brief ? rec.brief : null;
843
- const lv = rec && rec.level ? rec.level : null;
844
- const prep = items.filter((x) => x.kind === 'prepared' || x.kind === 'todo');
845
- const out = [];
846
- if (b && b.gist && b.gist.length) out.push(el('div', { class: 'cal3-ctx cal3-gist', 'data-cal3-ctx': 'gist' }, el('h4', null, c3ic('spark', 'sm'), 'In short'), el('p', { class: 'cal3-p' }, b.gist.join(' '))));
847
- if (b) out.push(...boardParts(ui, b));
848
- if (b && b.matters && b.matters.length) out.push(ctxBox('matters', b.planning ? 'To settle in planning' : 'What matters today', ul(b.matters.map((x) => ci({ 'data-cal3-matter': x.tag },
849
- el('span', { class: 'tag cal3-tone-' + x.tone }, x.tag), el('span', { class: 'cal3-ct' }, x.text), x.meta ? el('span', { class: 'dim mono cal3-at' }, x.meta) : null,
850
- refLink(ui, x.ref, { initiative: x.ref.initiative, title: x.text }))))));
851
- if (b && b.last) {
852
- const l = b.last;
853
- const open = ui.r.ctx.overlay ? null : el('a', { href: '#', class: 'cal3-ref', 'data-cal3': 'open-last-note', title: 'Open the note: ' + (l.title || 'Untitled note'),
854
- onClick: (ev) => { ev.preventDefault(); openNote(ui.r, l.id); ui.redraw(); } }, c3ic('notes', 'sm'), 'Open the last note');
855
- out.push(ctxBox('last', 'Since the last one · ' + h.dayLabel(String(l.at).slice(0, 10)),
856
- l.private ? el('p', { class: 'dim cal3-note' }, 'That note is private, so only its title shows: ' + (l.title || 'Untitled note') + '.')
857
- : l.overview ? el('p', { class: 'cal3-p' }, l.overview) : el('p', { class: 'dim cal3-note' }, 'That note has no summary yet.'),
858
- !l.private && ((l.decisions || []).length || (l.actions || []).length) ? ul([
859
- ...(l.decisions || []).map((t) => ci({ 'data-cal3-item': 'last-decision' }, el('span', { class: 'tag' }, 'Decision'), el('span', { class: 'cal3-ct' }, t))),
860
- ...(l.actions || []).map((a) => ci({ 'data-cal3-item': 'last-action' }, el('span', { class: 'tag cal3-tone-warn' }, 'From last time'), el('span', { class: 'cal3-ct' }, a.text),
861
- a.owner || a.due ? el('span', { class: 'dim mono cal3-at' }, [a.owner, a.due && 'due ' + a.due].filter(Boolean).join(' · ')) : null))]) : null,
862
- el('div', { class: 'chips2' }, open, b.earlier > 1 ? el('span', { class: 'dim', 'data-cal3': 'earlier' }, b.earlier + ' earlier notes of this meeting') : null)));
863
- }
864
- if (prep.length || (b && b.prep)) out.push(ctxBox('prepare', 'To prepare', ul([
865
- ...(b && b.prep ? [ci({ 'data-cal3-item': 'ready' }, el('span', { class: 'tag' }, 'To be ready'), el('span', { class: 'cal3-ct' }, b.prep))] : []),
866
- ...prep.filter((x) => !(b && b.prep && /^Prep notes from your agent/.test(x.text))).map((x) => ci({ 'data-cal3-item': x.kind },
867
- el('span', { class: 'tag' + (x.done ? ' cal3-up' : '') }, CTXWORD[x.kind] || x.kind), el('span', { class: 'cal3-ct' }, x.text),
868
- x.at ? el('span', { class: 'dim mono cal3-at' }, h.dayLabel(x.at) + (h.timeOf(x.at) !== null ? ' ' + h.hhmm(h.timeOf(x.at)) : '')) : null,
869
- x.ref && REF[x.ref.type] ? refLink(ui, x.ref, { title: x.text }) : null))])));
870
- if (e) out.push(materialSection({ event: e, date, level: lv, brief: b,
871
- back: () => { if (!ui.st.sel) { ui.st.sel = { type: 'event', id: e.id }; ui.redraw(); } } }));
872
- if (b && ((b.links || []).length || (b.refs || []).length)) out.push(el('div', { class: 'chips2', 'data-cal3': 'meeting-links' },
873
- ...(b.links || []).map((l) => el('a', { class: 'chip2', href: l.url, target: '_blank', rel: 'noopener noreferrer' }, c3ic('out', 'sm'), l.label)),
874
- ...(b.refs || []).map((r) => r.link ? el('a', { class: 'chip2', href: r.link, target: '_blank', rel: 'noopener noreferrer' }, c3ic('out', 'sm'), r.label, r.source ? el('span', { class: 'dim' }, ' ' + r.source) : null)
875
- : el('span', { class: 'chip2' }, r.label, r.source ? el('span', { class: 'dim' }, ' ' + r.source) : null))));
876
- const noIni = !lv; const noLast = !(b && b.last);
877
- if (noIni || noLast) {
878
- const missing = noIni && noLast ? 'This meeting is not linked and there is no earlier note from it.' : noIni ? 'This meeting is not linked to the Portfolio, a board or an initiative.' : 'There is no earlier note from this meeting.';
879
- out.push(ctxBox('knows', 'What PMOS knows', fold('info', missing + (out.length ? '' : ' Nothing is recorded to prepare.'), { 'data-cal3': 'knows' }),
880
- ul([noIni ? ci({}, el('span', { class: 'tag' }, 'Link'), el('span', { class: 'cal3-ct' }, 'Pick Portfolio, Board or Initiative above, and what matters there shows here.')) : null,
881
- ci({}, el('span', { class: 'tag' }, 'Note'), el('span', { class: 'cal3-ct' }, 'Take a note in this meeting, and the next one opens with its summary and next steps.'))].filter(Boolean))));
882
- }
883
- return out;
884
- }
885
-
886
- /* the free blocks of the range in words, with the suggested use or none; nothing is written */
887
- function freeList(ui, range) {
888
- const { M, h } = ui;
889
- const head = el('h3', null, c3ic('clock'), 'Free time');
890
- if (!M.free) return el('section', { class: 'card cal3-freel', 'data-cal3': 'free-list' }, head, fold('info', 'The calendar sent no free time for this range.', { 'data-cal3': 'no-free' }));
891
- const all = freeIn(M, range.start, range.end);
892
- const small = ui.M.view === 'day' || ui.M.view === 'week';
893
- const cap = 8;
894
- return el('section', { class: 'card cal3-freel', 'data-cal3': 'free-list' }, head,
895
- el('p', { class: 'dim cal3-note' }, 'Blocks of ' + (M.free.min_minutes || 90) + ' minutes or more between ' + (M.free.day_start || '09:00') + ' and ' + (M.free.day_end || '18:00') + '. A suggestion is a proposal: PMOS writes nothing.'),
896
- !small ? fold('info', 'Free time shows in the Day and Week views.', { 'data-cal3': 'free-small' })
897
- : all.length ? el('ul', { class: 'cal3-cl', role: 'list' }, ...all.slice(0, cap).map((b) => el('li', { class: 'cal3-ci', 'data-cal3-fb': b.date + ' ' + b.from },
898
- el('span', { class: 'dim mono cal3-at' }, h.dayLabel(b.date) + ' ' + b.from + ' to ' + b.to),
899
- el('span', { class: 'cal3-ct' }, b.suggestion && b.suggestion.text ? b.suggestion.text : NO_SUGGESTION),
900
- b.suggestion && b.suggestion.ref ? refLink(ui, b.suggestion.ref, { title: b.suggestion.text }) : null)))
901
- : el('p', { class: 'dim cal3-note' }, 'No free block of ' + (M.free.min_minutes || 90) + ' minutes or more in this range.'),
902
- small && all.length > cap ? el('p', { class: 'dim mono cal3-note' }, '+' + (all.length - cap) + ' more blocks in this range') : null);
903
- }
904
-
905
- /* the tidy-up suggestions of the range, grouped by severity: what is wrong, why, the proposed change and the references
906
- * to the items involved. A suggestion is a proposal in words; the panel has no control that changes anything. */
907
- function tidyList(ui) {
908
- const { M, d, h } = ui;
909
- const head = el('h3', null, c3ic('spark'), 'Tidy-up');
910
- const box = (...kids) => el('section', { class: 'card cal3-tidyl', 'data-cal3': 'tidy-list', 'aria-label': 'Tidy-up suggestions' }, head, ...kids);
911
- const notes = d.tidy_note && typeof d.tidy_note === 'object' ? Object.keys(d.tidy_note).filter((k) => d.tidy_note[k]) : [];
912
- const noteList = notes.length ? el('div', { class: 'cal3-ctx', 'data-cal3': 'tidy-notes' }, el('h4', null, 'Not checked'),
913
- el('ul', { class: 'cal3-cl', role: 'list' }, ...notes.map((k) => el('li', { class: 'cal3-ci', 'data-cal3-tidy-note': k },
914
- el('span', { class: 'tag' }, TIDY_RULE[k] || k), el('span', { class: 'cal3-ct dim' }, String(d.tidy_note[k])))))) : null;
915
- if (!M.tidy) return box(fold('info', 'The server sent no tidy-up list.', { 'data-cal3': 'no-tidy' }), noteList);
916
- const lead = el('p', { class: 'dim cal3-note' }, 'Each suggestion is a proposal. PMOS changes nothing in your calendar: you make the change where the meeting or the item lives.');
917
- if (!M.tidy.length) return box(lead, el('p', { class: 'dim cal3-note', 'data-cal3': 'tidy-empty' }, 'Nothing to tidy in this range.'), noteList);
918
- const total = tidyCount(M, d);
919
- const refOf = (s, x) => {
920
- if (x.type === 'event') {
921
- const hit = M.findEvent(x.id);
922
- if (!hit) return el('span', { class: 'dim cal3-noptr' }, 'meeting not drawn');
923
- return el('a', { href: '#', class: 'cal3-ref', 'data-cal3-ref': 'event:' + x.id, title: 'Show the meeting: ' + (hit.e.title || x.id),
924
- onClick: (ev) => { ev.preventDefault(); ui.select({ type: 'event', id: hit.e.id }, '[data-cal3-ev="' + cssId(hit.e.id) + '"]'); } }, c3ic('cal', 'sm'), hit.e.title || 'Show the meeting');
925
- }
926
- const ini = (s.refs || []).find((y) => y && y.type === 'initiative');
927
- return refLink(ui, x, { title: s.title, initiative: ini ? ini.id : undefined });
928
- };
929
- const groups = TIDY_GROUPS.map(([sev, label]) => {
930
- const rows = M.tidy.filter((s) => s.severity === sev);
931
- if (!rows.length) return null;
932
- return el('div', { class: 'cal3-ctx', 'data-cal3-tidy-group': sev }, el('h4', { class: 'cal3-tone-' + sev }, label + ' (' + rows.length + ')'),
933
- el('ul', { class: 'cal3-cl', role: 'list' }, ...rows.map((s) => el('li', { class: 'cal3-ci cal3-tidy-i cal3-tidy-' + sev, 'data-cal3-tidy-item': s.id, 'data-cal3-rule': s.rule },
934
- el('span', { class: 'tag cal3-tone-' + sev }, TIDY_RULE[s.rule] || s.rule),
935
- el('span', { class: 'dim mono cal3-at' }, h.dayLabel(s.date)),
936
- el('b', { class: 'cal3-tidy-t' }, s.title),
937
- s.why ? el('p', { class: 'cal3-note cal3-tidy-why' }, s.why) : null,
938
- s.suggestion ? el('p', { class: 'cal3-note cal3-tidy-fix', 'data-cal3': 'tidy-fix' }, el('b', null, 'Proposed: '), s.suggestion) : null,
939
- el('span', { class: 'cal3-tidy-refs' }, ...(s.refs || []).filter((x) => x && x.type && x.id).map((x) => refOf(s, x))),
940
- /* a proposal is a note on this page and nothing more: no control here changes the calendar or sends a word (D65) */
941
- el('span', { class: 'iacts' },
942
- proposed.has(s.id) ? el('span', { class: 'tag cal3-up', 'data-cal3-proposed': s.id }, 'Proposed')
943
- : button({ label: 'Propose it', variant: 'outline', size: 'sm', attrs: { 'data-cal3-act': 'propose', 'data-cal3-key': s.id },
944
- onClick: () => { proposed.add(s.id); toast('Proposal: ' + String(s.suggestion || s.title).replace(/\.$/, '') + '. Nothing changed in your calendar.'); ui.redraw('[data-cal3-proposed="' + cssId(s.id) + '"]'); } }),
945
- button({ label: 'Dismiss', variant: 'ghost', size: 'sm', attrs: { 'data-cal3-act': 'dismiss', 'data-cal3-key': s.id },
946
- onClick: () => { dismissed.add(s.id); toast('Dismissed'); ui.redraw('[data-cal3-chip="tidy"]'); } }))))));
947
- });
948
- return box(lead, ...groups.filter(Boolean),
949
- total > M.tidy.length ? el('p', { class: 'dim mono cal3-note' }, 'Showing ' + M.tidy.length + ' of ' + total + ' suggestions, the most severe first.') : null, noteList);
950
- }
951
-
952
- /* each lane in words: its count in the range, or why it is empty */
953
- function lanes(ui, range) {
954
- const { M, st, d } = ui;
955
- const notes = d.layers_note && typeof d.layers_note === 'object' ? d.layers_note : {};
956
- const rows = LAYERS.map(([id, label]) => {
957
- const n = id === 'meetings' ? M.meetings.length : M.layers ? M.layers.filter((m) => m.layer === id && m.date >= range.start && m.date <= range.end).length : null;
958
- const why = n ? plural(n, id === 'meetings' ? 'meeting' : 'item') + (st.on.has(id) ? '' : ', hidden')
959
- : id === 'meetings' ? (d.events_source === 'none' ? 'No calendar is cached yet.' : 'No meeting in this range.')
960
- : n === null ? 'The calendar sent no dated items, so this layer is empty.' : notes[id] || 'Nothing in this range.';
961
- return el('li', { class: 'cal3-lane', 'data-cal3-lane': id }, el('i', { class: 'cal3-sw cal3-sw-' + id }), el('span', null, label), el('span', { class: 'dim cal3-why' }, why));
962
- });
963
- const extra = Object.keys(notes).filter((k) => !LAYERS.some((l) => l[0] === k)).map((k) => el('li', { class: 'cal3-lane dim' }, el('span', null, k), el('span', { class: 'cal3-why' }, String(notes[k]))));
964
- return el('section', { class: 'card cal3-lanes', 'data-cal3': 'lanes' }, el('h3', null, c3ic('filter'), 'In this range'), el('ul', { class: 'cal3-cl', role: 'list' }, ...rows, ...extra));
965
- }