create-pmos 0.398.0 → 0.400.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 (515) 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 +19 -15
  7. package/workspace/briefing-premium-board-test.js +82 -50
  8. package/workspace/briefing-premium-calendar-2-test.js +36 -36
  9. package/workspace/briefing-premium-calendar-3-test.js +39 -39
  10. package/workspace/briefing-premium-calendar-test.js +23 -24
  11. package/workspace/briefing-premium-doc-edit-test.js +8 -10
  12. package/workspace/briefing-premium-initiative-test.js +38 -16
  13. package/workspace/briefing-premium-insights-test.js +114 -37
  14. package/workspace/briefing-premium-metrics-test.js +6 -4
  15. package/workspace/briefing-premium-products-test.js +10 -7
  16. package/workspace/briefing-premium-sources-test.js +25 -22
  17. package/workspace/briefing-premium-test.js +48 -43
  18. package/workspace/briefing-premium-work-test.js +16 -11
  19. package/workspace/c3-capture-test.js +0 -17
  20. package/workspace/changelog.json +29 -0
  21. package/workspace/ev-everywhere-test.js +210 -0
  22. package/workspace/fixtures/premium-viewer-fixtures.js +11 -6
  23. package/workspace/guide/briefing-premium.md +2 -2
  24. package/workspace/guide/home.md +58 -19
  25. package/workspace/guide/index.md +1 -1
  26. package/workspace/guide/layout.md +2 -2
  27. package/workspace/guide/notes.md +2 -2
  28. package/workspace/guide/phone-companion.md +1 -1
  29. package/workspace/lib/board-grill.js +63 -0
  30. package/workspace/lib/board-premium.js +36 -5
  31. package/workspace/lib/initiative-layout.js +77 -0
  32. package/workspace/lib/insights-premium.js +3 -2
  33. package/workspace/lib/insights-records.js +21 -7
  34. package/workspace/lib/meeting-points.js +52 -0
  35. package/workspace/lib/news-for-you.js +88 -0
  36. package/workspace/lib/notes-series.js +29 -6
  37. package/workspace/lib/report-confirm.js +48 -0
  38. package/workspace/lib/route-modules.js +9 -9
  39. package/workspace/lib/routes-board-docs.js +46 -0
  40. package/workspace/lib/routes-board-grill.js +90 -0
  41. package/workspace/lib/routes-home-review.js +108 -0
  42. package/workspace/lib/routes-initiative-layout.js +57 -0
  43. package/workspace/lib/routes-insights-premium.js +4 -1
  44. package/workspace/lib/routes-insights-records.js +8 -4
  45. package/workspace/lib/routes-meeting-points.js +37 -0
  46. package/workspace/lib/routes-news.js +57 -0
  47. package/workspace/lib/routes-notes.js +2 -1
  48. package/workspace/lib/routes-phone-day.js +18 -9
  49. package/workspace/lib/routes-report-confirm.js +31 -0
  50. package/workspace/lib/routes-search.js +38 -0
  51. package/workspace/lib/routes-slash.js +95 -0
  52. package/workspace/lib/search-index.js +176 -0
  53. package/workspace/package-lock.json +2 -2
  54. package/workspace/package.json +1 -2
  55. package/workspace/premium-board-actions-test.js +86 -50
  56. package/workspace/premium-briefing-depth-test.js +55 -54
  57. package/workspace/premium-chat-chart-tab-test.js +4 -2
  58. package/workspace/premium-chat-goal-view-test.js +1 -1
  59. package/workspace/premium-chat-report-tab-test.js +16 -2
  60. package/workspace/premium-chat-term-test.js +0 -10
  61. package/workspace/premium-core-doc-issue-test.js +15 -13
  62. package/workspace/premium-menu-rows-test.js +1 -1
  63. package/workspace/premium-phone-card-test.js +7 -5
  64. package/workspace/premium-report-read-test.js +55 -18
  65. package/workspace/premium-vw-backlog-test.js +2 -2
  66. package/workspace/premium-vw-cal-test.js +50 -35
  67. package/workspace/premium-vw-doc-test.js +10 -11
  68. package/workspace/premium-vw-item-test.js +1 -1
  69. package/workspace/premium-vw-jira-test.js +2 -2
  70. package/workspace/premium-vw-meet-test.js +37 -40
  71. package/workspace/premium-vw-notes-test.js +21 -19
  72. package/workspace/premium-vw-rec-test.js +11 -12
  73. package/workspace/premium-welcome-test.js +3 -3
  74. package/workspace/premium-work-depth-test.js +5 -6
  75. package/workspace/public/capture.html +23 -0
  76. package/workspace/public/pm/bd-acts.js +303 -225
  77. package/workspace/public/pm/bd-asks.js +261 -0
  78. package/workspace/public/pm/bd-pop.js +59 -0
  79. package/workspace/public/pm/bd-span.js +49 -13
  80. package/workspace/public/pm/bd-views.js +169 -0
  81. package/workspace/public/pm/c3-base.js +47 -0
  82. package/workspace/public/pm/c3-capture.js +1 -1
  83. package/workspace/public/pm/c3-ini-ui.js +1 -1
  84. package/workspace/public/pm/c3-sheet.js +1 -1
  85. package/workspace/public/pm/c3-toast.js +1 -1
  86. package/workspace/public/pm/console3.css +3 -0
  87. package/workspace/public/pm/cozy-board.css +301 -0
  88. package/workspace/public/pm/cozy-ev.css +228 -0
  89. package/workspace/public/pm/cozy-evmodel.js +106 -0
  90. package/workspace/public/pm/cozy-evui.js +47 -0
  91. package/workspace/public/pm/cozy-home.css +20 -5
  92. package/workspace/public/pm/cozy-insights.css +148 -10
  93. package/workspace/public/pm/cozy-nav.js +103 -39
  94. package/workspace/public/pm/cozy-news.js +140 -0
  95. package/workspace/public/pm/cozy-search.js +203 -0
  96. package/workspace/public/pm/cozy-settings.js +198 -0
  97. package/workspace/public/pm/cozy-sources.js +89 -0
  98. package/workspace/public/pm/cozy-today.css +220 -0
  99. package/workspace/public/pm/cozy-viewer.js +5 -2
  100. package/workspace/public/pm/cozy-vw-mtg.css +350 -0
  101. package/workspace/public/pm/cozy-vw-rp.css +152 -0
  102. package/workspace/public/pm/cozy.css +9 -0
  103. package/workspace/public/pm/goal-chat.js +5 -1
  104. package/workspace/public/pm/home-adddoc.js +5 -5
  105. package/workspace/public/pm/home-app.js +365 -70
  106. package/workspace/public/pm/home-around.js +24 -126
  107. package/workspace/public/pm/home-chat.js +77 -18
  108. package/workspace/public/pm/home-data.js +9 -7
  109. package/workspace/public/pm/home-dictate.js +57 -0
  110. package/workspace/public/pm/home-draft.js +6 -6
  111. package/workspace/public/pm/home-ini-model.js +190 -0
  112. package/workspace/public/pm/home-ini.css +171 -0
  113. package/workspace/public/pm/home-ini.js +466 -0
  114. package/workspace/public/pm/home-list.js +289 -0
  115. package/workspace/public/pm/home-more.js +18 -135
  116. package/workspace/public/pm/home-phone-card.js +13 -8
  117. package/workspace/public/pm/home-review.js +103 -0
  118. package/workspace/public/pm/home-task.js +67 -0
  119. package/workspace/public/pm/home-today.js +148 -0
  120. package/workspace/public/pm/home-work.js +63 -28
  121. package/workspace/public/pm/note-dock.js +1 -2
  122. package/workspace/public/pm/notes-links.js +1 -2
  123. package/workspace/public/pm/notes-task.js +3 -4
  124. package/workspace/public/pm/premium-board.js +164 -40
  125. package/workspace/public/pm/premium-chart-tab.js +4 -5
  126. package/workspace/public/pm/premium-first.js +5 -7
  127. package/workspace/public/pm/premium-initiative-head.js +3 -3
  128. package/workspace/public/pm/premium-insights.js +499 -202
  129. package/workspace/public/pm/premium-mtg-present.js +138 -0
  130. package/workspace/public/pm/premium-mtg-replay.js +142 -0
  131. package/workspace/public/pm/premium-report-read.js +216 -52
  132. package/workspace/public/pm/premium-report-tab.js +44 -19
  133. package/workspace/public/pm/premium-shell.js +7 -7
  134. package/workspace/public/pm/premium-vw-cal.js +150 -60
  135. package/workspace/public/pm/premium-vw-doc.css +20 -2
  136. package/workspace/public/pm/premium-vw-doc.js +22 -7
  137. package/workspace/public/pm/premium-vw-mtg.js +488 -261
  138. package/workspace/public/pm/premium-vw-notes.js +61 -0
  139. package/workspace/public/pm/rp-parts.js +269 -0
  140. package/workspace/public/pm/view-notes.js +2 -2
  141. package/workspace/public/premium-board.html +4 -3
  142. package/workspace/public/premium-insights.html +10 -10
  143. package/workspace/public/premium.html +3 -1
  144. package/workspace/r/m1.png +0 -0
  145. package/workspace/r/m2.png +0 -0
  146. package/workspace/r/m3.png +0 -0
  147. package/workspace/r/nl.png +0 -0
  148. package/workspace/replaced-tests.json +435 -0
  149. package/workspace/run-tests.js +323 -28
  150. package/workspace/server.js +15 -10
  151. package/workspace/test-files.json +3 -140
  152. package/workspace/test-lists/base.json +1 -2
  153. package/workspace/test-lists/c3-desktop-light-load.json +1 -2
  154. package/workspace/test-lists/c3-initiative-boards.json +1 -2
  155. package/workspace/test-lists/c3-meeting-focus.json +2 -12
  156. package/workspace/test-lists/c3-work-agent.json +1 -2
  157. package/workspace/test-lists/calendar-tidy-up.json +1 -2
  158. package/workspace/test-lists/console3-reports.json +1 -2
  159. package/workspace/test-lists/docs-three-way-sync.json +1 -2
  160. package/workspace/test-lists/extension-capture.json +5 -0
  161. package/workspace/test-lists/initiative-layout.json +9 -0
  162. package/workspace/test-lists/jira-wbs.json +1 -2
  163. package/workspace/test-lists/legacy-cleanup-a.json +9 -0
  164. package/workspace/test-lists/meeting-material.json +1 -2
  165. package/workspace/test-lists/meeting-notes.json +2 -36
  166. package/workspace/test-lists/meeting-replay.json +1 -2
  167. package/workspace/test-lists/mm-capture.json +2 -12
  168. package/workspace/test-lists/my-work.json +2 -10
  169. package/workspace/test-lists/onboarding-firstrun.json +2 -12
  170. package/workspace/test-lists/people-directory.json +1 -2
  171. package/workspace/test-lists/premium-uncovered-meetings.json +9 -0
  172. package/workspace/test-lists/premium-uncovered-reports.json +9 -0
  173. package/workspace/test-lists/run2-a.json +1 -2
  174. package/workspace/test-lists/run2-d.json +2 -19
  175. package/workspace/test-lists/run3-b.json +1 -2
  176. package/workspace/test-lists/run3-c.json +2 -12
  177. package/workspace/test-lists/run4-b.json +1 -2
  178. package/workspace/test-lists/run4-d.json +1 -5
  179. package/workspace/test-lists/run5-c.json +1 -11
  180. package/workspace/test-lists/run6.json +1 -5
  181. package/workspace/test-lists/uf-everywhere.json +15 -0
  182. package/workspace/test-lists/uf-home.json +9 -0
  183. package/workspace/test-lists/uncovered-board.json +9 -0
  184. package/workspace/test-lists/workspace-launch-flags.json +2 -12
  185. package/workspace/test-lists/workspace-profile-detection.json +2 -10
  186. package/workspace/test-timings.json +242 -123
  187. package/workspace/c3-briefing-test.js +0 -136
  188. package/workspace/c3-core-docs-test.js +0 -170
  189. package/workspace/c3-driver-fixture.js +0 -64
  190. package/workspace/c3-driver-test.js +0 -169
  191. package/workspace/c3-foundation-test.js +0 -163
  192. package/workspace/c3-ib-items-test.js +0 -114
  193. package/workspace/c3-ib-more-test.js +0 -146
  194. package/workspace/c3-ib-triage-backlog-test.js +0 -128
  195. package/workspace/c3-ini-harness.js +0 -66
  196. package/workspace/c3-ini-life-test.js +0 -167
  197. package/workspace/c3-initiatives-test.js +0 -186
  198. package/workspace/c3-light-load-test.js +0 -112
  199. package/workspace/c3-one-home-test.js +0 -149
  200. package/workspace/c3-phone-test.js +0 -289
  201. package/workspace/c3-quiet-test.js +0 -157
  202. package/workspace/c3-report-design-real-test.js +0 -264
  203. package/workspace/c3-report-design-test.js +0 -442
  204. package/workspace/c3-report-setup-test.js +0 -192
  205. package/workspace/c3-report-structure-real-test.js +0 -248
  206. package/workspace/c3-report-structure-test.js +0 -397
  207. package/workspace/c3-reports-test.js +0 -288
  208. package/workspace/c3-scan-test.js +0 -517
  209. package/workspace/c3-sessions-panel-test.js +0 -365
  210. package/workspace/c3-settings-test.js +0 -204
  211. package/workspace/c3-updates-test.js +0 -131
  212. package/workspace/c3-work-test.js +0 -260
  213. package/workspace/cut-stub.js +0 -40
  214. package/workspace/first-paint-audit.js +0 -160
  215. package/workspace/lib/c3-full-console.js +0 -15
  216. package/workspace/lib/engine/derived/trust.js +0 -3
  217. package/workspace/lib/engine/plan-forecast.js +0 -342
  218. package/workspace/lib/engine/report-families.js +0 -175
  219. package/workspace/lib/engine/truth-table.js +0 -57
  220. package/workspace/lib/routes-c3-init.js +0 -54
  221. package/workspace/lib/routes-c3-life.js +0 -120
  222. package/workspace/lib/routes-c3-timeline.js +0 -192
  223. package/workspace/lib/routes-forecast.js +0 -86
  224. package/workspace/lib/routes-releases.js +0 -130
  225. package/workspace/lib/routes-report-facts.js +0 -85
  226. package/workspace/lib/routes-report-families.js +0 -33
  227. package/workspace/lib/routes-signals.js +0 -51
  228. package/workspace/lib/routes-timeline.js +0 -197
  229. package/workspace/public/c3.html +0 -35
  230. package/workspace/public/index.html +0 -156
  231. package/workspace/public/pm/app.js +0 -831
  232. package/workspace/public/pm/bd-board.js +0 -159
  233. package/workspace/public/pm/bd-drag.js +0 -59
  234. package/workspace/public/pm/bd-model.js +0 -152
  235. package/workspace/public/pm/bd-timeline.js +0 -233
  236. package/workspace/public/pm/bd-tree.js +0 -244
  237. package/workspace/public/pm/board-copy.js +0 -59
  238. package/workspace/public/pm/board-read.js +0 -38
  239. package/workspace/public/pm/branches-sheet.js +0 -56
  240. package/workspace/public/pm/breakdown-api.js +0 -58
  241. package/workspace/public/pm/breakdown-copy.js +0 -138
  242. package/workspace/public/pm/briefing-deck.js +0 -441
  243. package/workspace/public/pm/briefing-model.js +0 -251
  244. package/workspace/public/pm/c3-ambient.js +0 -100
  245. package/workspace/public/pm/c3-audience-link.js +0 -21
  246. package/workspace/public/pm/c3-audience.js +0 -46
  247. package/workspace/public/pm/c3-boot.js +0 -13
  248. package/workspace/public/pm/c3-breakdown.js +0 -240
  249. package/workspace/public/pm/c3-brief-data.js +0 -11
  250. package/workspace/public/pm/c3-brief-mentions.js +0 -137
  251. package/workspace/public/pm/c3-brief-needs.js +0 -288
  252. package/workspace/public/pm/c3-brief-pulse.js +0 -112
  253. package/workspace/public/pm/c3-brief-summary.js +0 -139
  254. package/workspace/public/pm/c3-brief-today.js +0 -79
  255. package/workspace/public/pm/c3-brief.js +0 -279
  256. package/workspace/public/pm/c3-cal-strategy.js +0 -529
  257. package/workspace/public/pm/c3-calendar.js +0 -965
  258. package/workspace/public/pm/c3-calpop.js +0 -111
  259. package/workspace/public/pm/c3-case.js +0 -196
  260. package/workspace/public/pm/c3-core-docs.css +0 -18
  261. package/workspace/public/pm/c3-core-docs.js +0 -236
  262. package/workspace/public/pm/c3-daypart.js +0 -176
  263. package/workspace/public/pm/c3-demo-boards.js +0 -764
  264. package/workspace/public/pm/c3-demo-brief-ix.js +0 -350
  265. package/workspace/public/pm/c3-demo-brief-page.js +0 -70
  266. package/workspace/public/pm/c3-demo-cal-ix.js +0 -74
  267. package/workspace/public/pm/c3-demo-cal2.js +0 -66
  268. package/workspace/public/pm/c3-demo-cal3.js +0 -173
  269. package/workspace/public/pm/c3-demo-cal4.js +0 -169
  270. package/workspace/public/pm/c3-demo-cal5.js +0 -52
  271. package/workspace/public/pm/c3-demo-coredocs.js +0 -221
  272. package/workspace/public/pm/c3-demo-data.js +0 -552
  273. package/workspace/public/pm/c3-demo-focus.js +0 -181
  274. package/workspace/public/pm/c3-demo-init.js +0 -430
  275. package/workspace/public/pm/c3-demo-life.js +0 -77
  276. package/workspace/public/pm/c3-demo-material.js +0 -58
  277. package/workspace/public/pm/c3-demo-misc2.js +0 -34
  278. package/workspace/public/pm/c3-demo-phone.js +0 -48
  279. package/workspace/public/pm/c3-demo-plan2.js +0 -30
  280. package/workspace/public/pm/c3-demo-rd.js +0 -432
  281. package/workspace/public/pm/c3-demo-rep-ix.js +0 -126
  282. package/workspace/public/pm/c3-demo-rep2.js +0 -130
  283. package/workspace/public/pm/c3-demo-rep3.js +0 -138
  284. package/workspace/public/pm/c3-demo-rs.js +0 -287
  285. package/workspace/public/pm/c3-demo-term.js +0 -153
  286. package/workspace/public/pm/c3-demo-time.js +0 -49
  287. package/workspace/public/pm/c3-demo-work-ix.js +0 -32
  288. package/workspace/public/pm/c3-demo.js +0 -131
  289. package/workspace/public/pm/c3-design-studio.js +0 -369
  290. package/workspace/public/pm/c3-doc-formats.js +0 -153
  291. package/workspace/public/pm/c3-doc-sheet.js +0 -1230
  292. package/workspace/public/pm/c3-dock.js +0 -206
  293. package/workspace/public/pm/c3-docs.js +0 -291
  294. package/workspace/public/pm/c3-driver-work.js +0 -110
  295. package/workspace/public/pm/c3-driver.css +0 -18
  296. package/workspace/public/pm/c3-driver.js +0 -298
  297. package/workspace/public/pm/c3-focus.css +0 -304
  298. package/workspace/public/pm/c3-focus.js +0 -983
  299. package/workspace/public/pm/c3-ib-docs.js +0 -92
  300. package/workspace/public/pm/c3-ib-initiatives.js +0 -201
  301. package/workspace/public/pm/c3-ib-items.js +0 -210
  302. package/workspace/public/pm/c3-ib-releases.js +0 -48
  303. package/workspace/public/pm/c3-ib-sprints.js +0 -201
  304. package/workspace/public/pm/c3-ib-triage.js +0 -177
  305. package/workspace/public/pm/c3-ii-tabs.js +0 -252
  306. package/workspace/public/pm/c3-ini-life.css +0 -34
  307. package/workspace/public/pm/c3-ini-life.js +0 -379
  308. package/workspace/public/pm/c3-ini-records.js +0 -197
  309. package/workspace/public/pm/c3-ini-timeline.js +0 -278
  310. package/workspace/public/pm/c3-ini-work.js +0 -139
  311. package/workspace/public/pm/c3-init-extras.js +0 -170
  312. package/workspace/public/pm/c3-initiatives.js +0 -852
  313. package/workspace/public/pm/c3-lifecycle-panels.js +0 -479
  314. package/workspace/public/pm/c3-look.js +0 -27
  315. package/workspace/public/pm/c3-material.css +0 -22
  316. package/workspace/public/pm/c3-material.js +0 -321
  317. package/workspace/public/pm/c3-md.js +0 -3
  318. package/workspace/public/pm/c3-misc-panels.js +0 -89
  319. package/workspace/public/pm/c3-new-session.js +0 -110
  320. package/workspace/public/pm/c3-notes.js +0 -751
  321. package/workspace/public/pm/c3-phone-boot.js +0 -47
  322. package/workspace/public/pm/c3-phone-detail.js +0 -97
  323. package/workspace/public/pm/c3-phone-model.js +0 -3
  324. package/workspace/public/pm/c3-phone.css +0 -66
  325. package/workspace/public/pm/c3-phone.js +0 -444
  326. package/workspace/public/pm/c3-plan-panels.js +0 -163
  327. package/workspace/public/pm/c3-plan.js +0 -193
  328. package/workspace/public/pm/c3-quiet.css +0 -113
  329. package/workspace/public/pm/c3-quiet.js +0 -177
  330. package/workspace/public/pm/c3-replay.css +0 -133
  331. package/workspace/public/pm/c3-replay.js +0 -429
  332. package/workspace/public/pm/c3-report-deck.css +0 -163
  333. package/workspace/public/pm/c3-report-deck.js +0 -598
  334. package/workspace/public/pm/c3-report-frame.css +0 -20
  335. package/workspace/public/pm/c3-report-print.css +0 -20
  336. package/workspace/public/pm/c3-report-setup.css +0 -67
  337. package/workspace/public/pm/c3-report-setup.js +0 -298
  338. package/workspace/public/pm/c3-report-store.js +0 -244
  339. package/workspace/public/pm/c3-report-structure.css +0 -44
  340. package/workspace/public/pm/c3-report-structure.js +0 -473
  341. package/workspace/public/pm/c3-reports.css +0 -68
  342. package/workspace/public/pm/c3-reports.js +0 -377
  343. package/workspace/public/pm/c3-roadmap.js +0 -249
  344. package/workspace/public/pm/c3-scan-api.js +0 -167
  345. package/workspace/public/pm/c3-scan-next.js +0 -248
  346. package/workspace/public/pm/c3-scan-setup.js +0 -313
  347. package/workspace/public/pm/c3-scan-words.js +0 -41
  348. package/workspace/public/pm/c3-scan.css +0 -74
  349. package/workspace/public/pm/c3-scan.js +0 -93
  350. package/workspace/public/pm/c3-session-chat.js +0 -103
  351. package/workspace/public/pm/c3-session-conv.js +0 -165
  352. package/workspace/public/pm/c3-session-term.js +0 -216
  353. package/workspace/public/pm/c3-settings.css +0 -85
  354. package/workspace/public/pm/c3-settings.js +0 -1045
  355. package/workspace/public/pm/c3-shell.js +0 -628
  356. package/workspace/public/pm/c3-signals.js +0 -196
  357. package/workspace/public/pm/c3-strategy-panels.js +0 -45
  358. package/workspace/public/pm/c3-swipe.js +0 -230
  359. package/workspace/public/pm/c3-terminal-data.js +0 -48
  360. package/workspace/public/pm/c3-terminal-edge.js +0 -91
  361. package/workspace/public/pm/c3-terminal-icons.js +0 -40
  362. package/workspace/public/pm/c3-terminal-results.js +0 -141
  363. package/workspace/public/pm/c3-terminal.js +0 -52
  364. package/workspace/public/pm/c3-tickets.js +0 -163
  365. package/workspace/public/pm/c3-timeline.js +0 -201
  366. package/workspace/public/pm/calendar-views.js +0 -1049
  367. package/workspace/public/pm/console3-lift.md +0 -220
  368. package/workspace/public/pm/cozy-home.js +0 -172
  369. package/workspace/public/pm/cozy-initiative.css +0 -138
  370. package/workspace/public/pm/cycle-review.js +0 -125
  371. package/workspace/public/pm/data.js +0 -1577
  372. package/workspace/public/pm/dest-board.js +0 -444
  373. package/workspace/public/pm/dest-docs.js +0 -530
  374. package/workspace/public/pm/dest-initiatives.js +0 -162
  375. package/workspace/public/pm/dest-mywork.js +0 -307
  376. package/workspace/public/pm/dest-notes.js +0 -537
  377. package/workspace/public/pm/dest-people.js +0 -449
  378. package/workspace/public/pm/dest-reports.js +0 -383
  379. package/workspace/public/pm/dest-settings.js +0 -601
  380. package/workspace/public/pm/dest-today.js +0 -267
  381. package/workspace/public/pm/display-word.js +0 -56
  382. package/workspace/public/pm/doc-editor.js +0 -473
  383. package/workspace/public/pm/doc-graph.js +0 -272
  384. package/workspace/public/pm/doc-health-panel.js +0 -110
  385. package/workspace/public/pm/doc-rail.js +0 -167
  386. package/workspace/public/pm/doc-remote.js +0 -180
  387. package/workspace/public/pm/dock-sessions.js +0 -472
  388. package/workspace/public/pm/dock.js +0 -216
  389. package/workspace/public/pm/fixture.js +0 -821
  390. package/workspace/public/pm/flag-picker.js +0 -104
  391. package/workspace/public/pm/frame-copy.js +0 -278
  392. package/workspace/public/pm/freshness-line.js +0 -149
  393. package/workspace/public/pm/handoff-box.js +0 -82
  394. package/workspace/public/pm/initiative-list.js +0 -235
  395. package/workspace/public/pm/initiative-sheet.js +0 -331
  396. package/workspace/public/pm/initiatives-api.js +0 -95
  397. package/workspace/public/pm/initiatives-copy.js +0 -287
  398. package/workspace/public/pm/initiatives-timeline-copy.js +0 -59
  399. package/workspace/public/pm/initiatives-timeline.js +0 -410
  400. package/workspace/public/pm/initiatives-ui.js +0 -291
  401. package/workspace/public/pm/item-sheet.js +0 -268
  402. package/workspace/public/pm/keep-card.js +0 -204
  403. package/workspace/public/pm/lifecycle-lens-model.js +0 -246
  404. package/workspace/public/pm/lifecycle-lens.js +0 -276
  405. package/workspace/public/pm/lifecycle.js +0 -111
  406. package/workspace/public/pm/mobile.css +0 -366
  407. package/workspace/public/pm/mobile.js +0 -581
  408. package/workspace/public/pm/modes-live.js +0 -453
  409. package/workspace/public/pm/modes.js +0 -147
  410. package/workspace/public/pm/my-work-card.js +0 -51
  411. package/workspace/public/pm/my-work-data.js +0 -36
  412. package/workspace/public/pm/new-initiative-sheet.js +0 -169
  413. package/workspace/public/pm/next-step-ui.js +0 -190
  414. package/workspace/public/pm/outbox-panel.js +0 -125
  415. package/workspace/public/pm/palette-copy.js +0 -55
  416. package/workspace/public/pm/palette.js +0 -343
  417. package/workspace/public/pm/panel-breakdown.js +0 -702
  418. package/workspace/public/pm/panel-cockpit.js +0 -425
  419. package/workspace/public/pm/panel-detail.js +0 -1513
  420. package/workspace/public/pm/panel-initiatives.js +0 -929
  421. package/workspace/public/pm/panel-newsess.js +0 -709
  422. package/workspace/public/pm/panel-repos.js +0 -741
  423. package/workspace/public/pm/panel-tabs.js +0 -1506
  424. package/workspace/public/pm/panel-trees.js +0 -204
  425. package/workspace/public/pm/people-link.js +0 -106
  426. package/workspace/public/pm/phone-deck.js +0 -167
  427. package/workspace/public/pm/pm-work-view.js +0 -1533
  428. package/workspace/public/pm/portfolio-report.js +0 -61
  429. package/workspace/public/pm/premium-acts.js +0 -280
  430. package/workspace/public/pm/premium-brief.js +0 -111
  431. package/workspace/public/pm/premium-chat.js +0 -22
  432. package/workspace/public/pm/premium-doc-sheet.js +0 -312
  433. package/workspace/public/pm/premium-initiative.js +0 -324
  434. package/workspace/public/pm/premium-insights.css +0 -228
  435. package/workspace/public/pm/premium-metric-tiles.js +0 -68
  436. package/workspace/public/pm/premium-report-brief.js +0 -132
  437. package/workspace/public/pm/premium-vw-rec.js +0 -67
  438. package/workspace/public/pm/premium-wide.css +0 -30
  439. package/workspace/public/pm/print.css +0 -44
  440. package/workspace/public/pm/provider-cards.js +0 -136
  441. package/workspace/public/pm/registry.js +0 -203
  442. package/workspace/public/pm/release-card.js +0 -110
  443. package/workspace/public/pm/releases-view.js +0 -248
  444. package/workspace/public/pm/report-families-view.js +0 -505
  445. package/workspace/public/pm/report-slides.js +0 -438
  446. package/workspace/public/pm/report-tab.js +0 -33
  447. package/workspace/public/pm/report-view.js +0 -337
  448. package/workspace/public/pm/reports-copy.js +0 -134
  449. package/workspace/public/pm/roadmap.js +0 -294
  450. package/workspace/public/pm/run-card.js +0 -260
  451. package/workspace/public/pm/sessions-panel.js +0 -219
  452. package/workspace/public/pm/sheet-jira.js +0 -353
  453. package/workspace/public/pm/shell-bell.js +0 -163
  454. package/workspace/public/pm/shell-model.js +0 -83
  455. package/workspace/public/pm/shell-phone.js +0 -124
  456. package/workspace/public/pm/shell-readaloud.js +0 -53
  457. package/workspace/public/pm/shell-recording.js +0 -274
  458. package/workspace/public/pm/shell-ticker.js +0 -90
  459. package/workspace/public/pm/sig-watch.js +0 -41
  460. package/workspace/public/pm/slide-confirm.js +0 -163
  461. package/workspace/public/pm/slides-copy.js +0 -52
  462. package/workspace/public/pm/status-banner.js +0 -95
  463. package/workspace/public/pm/tab-doc.js +0 -859
  464. package/workspace/public/pm/tab-gone.js +0 -21
  465. package/workspace/public/pm/tab-term.js +0 -1210
  466. package/workspace/public/pm/tab-web.js +0 -90
  467. package/workspace/public/pm/timeline-copy.js +0 -48
  468. package/workspace/public/pm/timeline-forecast-view.js +0 -164
  469. package/workspace/public/pm/today-agenda.js +0 -331
  470. package/workspace/public/pm/today-cards.js +0 -244
  471. package/workspace/public/pm/today-copy.js +0 -506
  472. package/workspace/public/pm/today-day.js +0 -1371
  473. package/workspace/public/pm/today-goals.js +0 -297
  474. package/workspace/public/pm/today-jobs.js +0 -84
  475. package/workspace/public/pm/today-mentions.js +0 -50
  476. package/workspace/public/pm/topbar.js +0 -202
  477. package/workspace/public/pm/triage-card.js +0 -60
  478. package/workspace/public/pm/undo-hold.js +0 -103
  479. package/workspace/public/pm/view-addrepo.js +0 -208
  480. package/workspace/public/pm/view-files.js +0 -197
  481. package/workspace/public/pm/view-livenotes.js +0 -399
  482. package/workspace/public/pm/view-today.js +0 -13
  483. package/workspace/public/pm/view-validate.js +0 -171
  484. package/workspace/public/pm/welcome.js +0 -391
  485. package/workspace/public/pm/work-place.js +0 -68
  486. package/workspace/public/pm/xlsx-read.js +0 -117
  487. package/workspace/public/welcome.html +0 -22
  488. package/workspace/test-lists/browser-suites-green.json +0 -5
  489. package/workspace/test-lists/c3-core-docs.json +0 -9
  490. package/workspace/test-lists/c3-doc-sheet-rich.json +0 -6
  491. package/workspace/test-lists/c3-doc-sheet-size.json +0 -6
  492. package/workspace/test-lists/c3-doc-sheet-v2.json +0 -6
  493. package/workspace/test-lists/c3-ib-items.json +0 -9
  494. package/workspace/test-lists/c3-ib-more.json +0 -9
  495. package/workspace/test-lists/c3-ib-triage-backlog.json +0 -9
  496. package/workspace/test-lists/c3-ini-life.json +0 -9
  497. package/workspace/test-lists/c3-meeting-board.json +0 -5
  498. package/workspace/test-lists/c3-meeting-card.json +0 -5
  499. package/workspace/test-lists/c3-notes-place.json +0 -5
  500. package/workspace/test-lists/c3-notes-series.json +0 -5
  501. package/workspace/test-lists/calendar-time-page.json +0 -5
  502. package/workspace/test-lists/calpop.json +0 -4
  503. package/workspace/test-lists/console3-briefing.json +0 -9
  504. package/workspace/test-lists/console3-foundation.json +0 -9
  505. package/workspace/test-lists/console3-work-page.json +0 -9
  506. package/workspace/test-lists/premium-brief-parity.json +0 -9
  507. package/workspace/test-lists/report-design-studio-ui.json +0 -5
  508. package/workspace/test-lists/report-structure-ui.json +0 -11
  509. package/workspace/test-lists/report-workspace-ui.json +0 -5
  510. package/workspace/test-lists/run3-a.json +0 -5
  511. package/workspace/test-lists/run3-d.json +0 -6
  512. package/workspace/test-lists/run4-c.json +0 -13
  513. package/workspace/test-lists/today-goals-jobs-ui.json +0 -5
  514. package/workspace/test-lists/today-mentions-cards.json +0 -5
  515. package/workspace/test-lists/workspace-tabs-declutter.json +0 -13
@@ -1,1049 +0,0 @@
1
- /* pm/calendar-views.js — the Calendar views Day, Week, Month, Quarter and Year (console3 wave C2), built on the console3
2
- * mockup's own markup and CSS. The mockup (prototype/pmos-console-handoff/mockups/console3.html) is the UI: the zoom bar
3
- * (.calbar, .lens, .seg, .ib), the Today chip (.tdy), the lens header (.lh), the day timeline (.vday, .vb), the month grid
4
- * (.cal, .cd), the progress chart (svg.pg: progSVG, line 2712), the direction card (.fc.dir with .dial and .sevs), the key
5
- * result rows (.krg, .krt) and the swipe and key gestures. The styles are pm/console3.css (see pm/console3-lift.md).
6
- * This file keeps the data call and draws what the server sent. It reads GET /api/calendar-views only; its Record button starts, resumes or stops a recording through pm/note-dock.js.
7
- * A KR without a metric reads "no metric" and is not scored; an empty lens says why; nothing is invented.
8
- *
9
- * mountCalendarViews(host, ctx) is safe to call on every render. disposeCalendarViews(host) drops the host's state. */
10
-
11
- import { el } from './dom.js';
12
- import { pmGet } from './http.js';
13
- import { ensureC3Css, c3ic, c3ib, c3ring, c3Phone } from './pm-work-view.js';
14
- import { toast } from './c3-toast.js';
15
- import { goInitiative } from './c3-init-extras.js';
16
- import { openSheet, closeSheet } from './c3-sheet.js';
17
- import { renderCase } from './c3-case.js';
18
- import { makeXp, attachExpand } from './c3-expand.js';
19
- import { mountQuarter, mountYear, dispose as disposeStrategy } from './c3-cal-strategy.js'; // the Quarter and Year panes
20
- import { simDock, simStart, simState, isDemo } from './shell-recording.js';
21
- import * as dock from './note-dock.js';
22
- import { drawCalendarPage } from './c3-calendar.js'; // the Calendar tab as a page about time (ctx.page)
23
- import { openNote as showNote } from './c3-notes.js'; // the Record chip opens Calendar › Notes (c3-open-note)
24
-
25
- /* ── shared state of the /c3.html page (console3 wave C3) ──────────────────────────────────────────────────────────
26
- * `live` holds every mounted instance, so a press in the Briefing's ribbon can select a meeting on the Calendar tab's instance.
27
- * `IX()` is the demo fixtures (c3-demo-cal-ix.js sets window.__c3calix); in real mode it is null and only the calendar's own fields are shown.
28
- * The page's tab buttons carry data-c3-tab; pressing one is the only hook into the shell (c3-shell.js is not edited). */
29
- const live = new Set();
30
- let SHARED_SEL = null; // a meeting chosen on the Briefing, read when the Calendar tab mounts
31
- const IX = () => (typeof window !== 'undefined' && window.__c3calix) || null;
32
- const baseId = (e) => String((e && e.id) || '').split('@')[0];
33
- const gotoTab = (id) => { const b = document.querySelector('[data-c3-tab="' + id + '"]'); if (b) b.click(); };
34
- const isC3 = (r) => !!(r && r.ctx && (r.ctx.ribbon || r.ctx.plan || r.ctx.page));
35
- const isCalTab = (x) => !!(x && x.ctx && (x.ctx.plan || (x.ctx.page && !x.ctx.overlay))); // the Calendar tab's own instance (the older mount passes plan, the page passes page)
36
-
37
- const NS = 'http://www.w3.org/2000/svg';
38
- const VIEWS = [['day', 'Day'], ['week', 'Week'], ['month', 'Month'], ['quarter', 'Quarter'], ['year', 'Year']];
39
- /* the mockup's ribbon (console3.html line 1435): Today | Week | Quarter | Year | 5 yrs. Each reads the calendar view in [1]; 5 yrs has no calendar view, so it reads the year. */
40
- const RIB = [['today', 'Today', 'day'], ['week', 'Week', 'week'], ['quarter', 'Quarter', 'quarter'], ['year', 'Year', 'year'], ['five', '5 yrs', 'year']];
41
- const SHORT = { day: 'Day', week: 'Wk', month: 'Mo', quarter: 'Qtr', year: 'Yr' }; // the mockup's CMS (line 2829)
42
- /* The mockup's ST table (line 2704): colour and icon of a status. The server's words map onto its keys. */
43
- const ST = {
44
- ok: { l: 'On time', c: 'var(--success)', i: 'check' }, risk: { l: 'At risk', c: 'var(--warning)', i: 'alert' },
45
- late: { l: 'Delayed', c: 'var(--destructive)', i: 'clock' }, over: { l: 'Overdue', c: 'var(--destructive)', i: 'alert' },
46
- none: { l: 'No plan', c: 'var(--muted-foreground)', i: 'moon' },
47
- };
48
- const STKEY = { 'on time': 'ok', 'at risk': 'risk', delayed: 'late', overdue: 'over', 'no plan': 'none' };
49
- const MN = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
50
- const DN = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
51
- const roots = new WeakMap(); // host -> { root, view, date, data, error, loading }
52
- const small = 'font-size:var(--fs-2)';
53
-
54
- const pad = (n) => String(n).padStart(2, '0');
55
- const todayStr = () => { const d = new Date(); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; };
56
- const ymd = (s) => String(s).slice(0, 10).split('-').map(Number);
57
- const utc = (s) => { const [y, m, d] = ymd(s); return Date.UTC(y, m - 1, d); };
58
- const dowOf = (s) => new Date(utc(s)).getUTCDay();
59
- const shift = (view, date, dir) => {
60
- const [y, m, d] = ymd(date);
61
- const t = view === 'day' ? new Date(y, m - 1, d + dir) : view === 'week' ? new Date(y, m - 1, d + 7 * dir)
62
- : view === 'month' ? new Date(y, m - 1 + dir, 1) : view === 'quarter' ? new Date(y, m - 1 + 3 * dir, 1) : new Date(y + dir, 0, 1);
63
- return `${t.getFullYear()}-${pad(t.getMonth() + 1)}-${pad(t.getDate())}`;
64
- };
65
- /* the mockup's date strings, console3.html: Thu 8 Oct (weekday, day, month; no comma, not locale-ordered) */
66
- const dayLabel = (s) => { const [y, m, d] = ymd(s); return DN[new Date(y, m - 1, d).getDay()] + ' ' + d + ' ' + MN[m - 1]; };
67
- const cellLabel = (c, unit) => unit === 'day' ? dayLabel(c.start) : unit === 'week' ? 'Week of ' + dayLabel(c.start)
68
- : new Date(...c.start.split('-').map((n, i) => (i === 1 ? n - 1 : Number(n)))).toLocaleDateString(undefined, { month: 'long' });
69
- const rangeText = (range, view) => (view === 'quarter' ? 'Q' + (Math.floor((Number(range.start.slice(5, 7)) - 1) / 3) + 1) + " '" + range.start.slice(2, 4) + ' · ' + MN[Number(range.start.slice(5, 7)) - 1] + ' to ' + MN[Number(range.end.slice(5, 7)) - 1] : view === 'month' ? new Date(utc(range.start)).toLocaleDateString('en-GB', { month: 'long', year: 'numeric', timeZone: 'UTC' }) : range.start === range.end ? dayLabel(range.start) : `${dayLabel(range.start)} to ${dayLabel(range.end)}`);
70
-
71
- function svg(tag, attrs, ...kids) {
72
- const n = document.createElementNS(NS, tag);
73
- for (const k of Object.keys(attrs || {})) n.setAttribute(k, attrs[k]);
74
- for (const c of kids) if (c) n.appendChild(c);
75
- return n;
76
- }
77
- const text = (x, y, s, attrs) => { const t = svg('text', { x, y, ...(attrs || {}) }); t.textContent = s; return t; };
78
-
79
- /* On a phone the chart rows are too short to press (30px of a 720px chart on a 390px screen), so each initiative is also a 44px button under it. */
80
- function phoneRows(rows, r, host) {
81
- return el('ul', { class: 'list', role: 'list', style: 'margin:0', 'data-cv': 'init-rows' }, rows.map((g) => { const k = STKEY[g.status] || 'none'; const S = ST[k];
82
- return el('li', { class: 'prow', style: '--c:' + S.c }, el('button', { type: 'button', class: 'nrow', style: 'width:100%;min-height:44px;border:0;background:none;text-align:left;display:flex;justify-content:space-between;gap:8px;align-items:center', 'data-a': 'goinit', 'data-k': g.id, onClick: () => openInit(host, r, g.id, g.title) },
83
- el('b', null, g.title || g.id), el('span', { class: 'mono', style: small + ';color:' + S.c }, S.l + (g.slip_days > 0 ? ' +' + g.slip_days + ' d' : '')))); }));
84
- }
85
- const isPhoneR = (r) => !!(r && r.root && r.root.classList.contains('ph'));
86
-
87
- /* ── the bar: the mockup's calHead3 (line 2584, with the Today chip of line 2790) ─────────────────────────────────── */
88
-
89
- /* The Today chip. On today's range it is the quiet .tdy; away from it, the .tdy.on button that goes back. */
90
- function todayChip(host, r) {
91
- const range = r.data && r.data.range; const today = (r.data && r.data.today) || todayStr();
92
- const here = range ? range.start <= today && today <= range.end : r.date === todayStr();
93
- if (here) return el('span', { class: 'tdy', 'aria-label': 'You are on today', 'data-cv': 'today' }, c3ic('sun', 'sm'), 'Today');
94
- const ahead = range ? range.start > today : r.date > todayStr();
95
- return el('button', { type: 'button', class: 'tdy on', 'data-cv': 'today', title: 'Back to today (t)', onClick: () => go(host, r, { date: todayStr(), anim: ahead ? 'sp' : 'sn' }) },
96
- ahead ? c3ic('prev', 'sm') : null, 'Today', ahead ? null : c3ic('next', 'sm'));
97
- }
98
-
99
- function bar(host, r, phone) {
100
- const rib = !!(r.ctx && r.ctx.ribbon);
101
- const L = rib ? RIB : VIEWS; const cur = rib ? r.zoom : r.view;
102
- const i = L.findIndex((v) => v[0] === cur);
103
- const to = (j, anim) => go(host, r, rib ? { view: L[j][2], zoom: L[j][0], anim } : { view: L[j][0], anim });
104
- const zoom = (k) => { const j = i + k; if (j >= 0 && j < L.length) to(j, k < 0 ? 'zi' : 'zo'); };
105
- const range = r.data && r.data.range;
106
- return el('div', { class: 'calbar' },
107
- el('div', { class: 'lens' },
108
- c3ib('Zoom in (+)', 'zin', { disabled: i === 0, 'data-a': rib ? 'rzoom' : 'czoom', 'data-k': '-1', onClick: () => zoom(-1) }, 'sm'),
109
- el('div', { class: 'seg', role: 'group', 'aria-label': rib ? 'Time horizon' : 'Calendar view', 'data-cv': 'switch' },
110
- L.map(([id, label], j) => el('button', { type: 'button', 'aria-pressed': String(cur === id), 'data-cv-view': id, 'data-a': rib ? 'ribbon' : 'calmode', 'data-k': id, onClick: () => to(j, j < i ? 'zi' : 'zo') },
111
- phone && SHORT[id] ? SHORT[id] : label))),
112
- c3ib('Zoom out (-)', 'zout', { disabled: i === L.length - 1, 'data-a': rib ? 'rzoom' : 'czoom', 'data-k': '1', onClick: () => zoom(1) }, 'sm')),
113
- el('div', { class: 'chips2' },
114
- c3ib('Previous (swipe right)', 'prev', { 'data-cv': 'prev', 'data-a': 'calprev', onClick: () => go(host, r, { date: shift(r.view, r.date, -1), anim: 'sp' }) }, 'sm'),
115
- el('b', { class: 'mono', style: small + ';min-width:96px;text-align:center', 'data-cv': 'range', 'aria-live': 'polite' }, range ? rangeText(range, r.view) : ''),
116
- c3ib('Next (swipe left)', 'next', { 'data-cv': 'next', 'data-a': 'calnext', onClick: () => go(host, r, { date: shift(r.view, r.date, 1), anim: 'sn' }) }, 'sm'),
117
- todayChip(host, r)));
118
- }
119
-
120
- /* ── the lens header: the mockup's calLensHead (line 2582), from what the server sent ─────────────────────────────── */
121
-
122
- function lensHead(data) {
123
- if (data.lens_head) { // optional (demo): the mockup's calLensHead line and ring
124
- const L = data.lens_head;
125
- return el('div', { class: 'lh' }, el('span', { class: 'ki' }, c3ic('cal')), el('div', { style: 'min-width:0' }, el('b', null, L.h), el('div', { class: 'dim' }, L.s)), c3ring(L.ring[0], Math.max(1, L.ring[1]), 44));
126
- }
127
- const n = (data.cells || []).reduce((t, c) => t + c.events.length, 0);
128
- const rows = (data.gantt || []).filter((g) => g.status !== 'no plan'); // only a row with a promise can be on time or late
129
- const ontime = rows.filter((g) => g.status === 'on time').length;
130
- const b = n ? `${n} event${n === 1 ? '' : 's'} in ${data.unit === 'day' ? 'this range' : 'the ' + data.unit + 's shown'}`
131
- : data.events_source === 'none' ? 'No calendar is cached yet' : 'Nothing is scheduled in this range';
132
- const s = rows.length ? `${ontime} of ${rows.length} initiative${rows.length === 1 ? '' : 's'} on time against the promise.` : 'No initiative has a date in this range.';
133
- return el('div', { class: 'lh' }, el('span', { class: 'ki' }, c3ic('cal')),
134
- el('div', { style: 'min-width:0' }, el('b', null, b), el('div', { class: 'dim' }, s)),
135
- c3ring(ontime, rows.length, 44));
136
- }
137
-
138
- /* ── events: the day timeline, the week list, the month grid, the quarter and year rows ──────────────────────────── */
139
-
140
- const timeOf = (at) => { const m = /T(\d{2}):(\d{2})/.exec(String(at || '')); return m ? Number(m[1]) + Number(m[2]) / 60 : null; };
141
- const hhmm = (x) => `${pad(Math.floor(x))}:${pad(Math.round((x % 1) * 60))}`;
142
-
143
- /* The mockup's vday (line 1400): hour lines, .vb blocks placed by time, .vnow for now. Events without a time go in a list. */
144
- function dayTimeline(data, ribbon, r, host) {
145
- const evs = (data.cells[0] && data.cells[0].events) || [];
146
- const timed = evs.filter((e) => timeOf(e.at) !== null).sort((a, b) => timeOf(a.at) - timeOf(b.at));
147
- const untimed = evs.filter((e) => timeOf(e.at) === null);
148
- const end = (e) => { const t = timeOf(e.end); return t !== null && String(e.end).slice(0, 10) === String(e.at).slice(0, 10) && t > timeOf(e.at) ? t : timeOf(e.at) + 1; };
149
- let t0 = Math.min(8, ...timed.map((e) => Math.floor(timeOf(e.at)))); let t1 = Math.max(18, ...timed.map((e) => Math.ceil(end(e))));
150
- if (data.span) { t0 = data.span[0]; t1 = data.span[1]; } // optional (demo): the mockup's 08:00 to 17:30 day
151
- const pph = 38; const T = (t) => (t - t0) * pph;
152
- const v = el('div', { class: 'vday', style: 'height:' + ((t1 - t0) * pph - 1) + 'px' });
153
- for (let t = t0; t <= t1 - (data.span ? 1.5 : 2); t += 2) v.appendChild(el('div', { class: 'hr', style: 'top:' + T(t) + 'px' }, el('span', null, hhmm(t))));
154
- /* Optional, additive fields the server does not send (the /c3.html demo mode serves them): data.free_gaps = [[from, to, label]] draws the
155
- * mockup's hatched free windows (.vf); an event's `mock_routine` and `mock_hot` give the muted and the red block, and `mock_decide_by` the red line (.vdl). (The prefix keeps them apart from the
156
- * calendar memory's own event fields, which already include `routine`.) */
157
- (data.free_gaps || []).forEach(([a, b, lab]) => { if (lab) v.appendChild(el('div', { class: 'vf', style: `top:${T(a) + 2}px;height:${(b - a) * pph - 4}px` }, lab)); });
158
- const selE = r ? selEvent(r) : null; const selId = selE ? selE.id : (timed.find((e) => e.mock_hot) || {}).id;
159
- const c3 = isC3(r);
160
- timed.forEach((e, i) => {
161
- const s = timeOf(e.at); const f = end(e);
162
- v.appendChild(el('button', { type: 'button', class: 'vb' + (e.mock_routine ? ' rt' : '') + (e.mock_hot ? ' hot' : '') + (selId && e.id === selId ? ' sel' : ''), style: `top:${T(s) + 1}px;height:${(f - s) * pph - 3}px;animation-delay:${i * 70}ms`, 'data-cv-cell': e.id, 'data-a': ribbon ? 'rsel' : 'msel', 'data-k': baseId(e), title: e.title || e.id,
163
- ...(c3 ? { 'aria-pressed': String(e.id === selId), onClick: () => selectMeeting(host, r, e.id) } : {}) },
164
- el('b', null, e.title || e.id), f - s >= 0.75 ? el('small', null, hhmm(s) + (e.kind ? ' · ' + e.kind : '')) : null));
165
- if (e.mock_decide_by) { const d = timeOf(e.at); v.appendChild(el('div', { class: 'vdl', style: 'top:' + T(d) + 'px' }, el('span', null, 'decide by ' + hhmm(d)))); }
166
- });
167
- const today = data.today; const now = new Date();
168
- if (data.range.start === today && now.getHours() >= t0 && now.getHours() < t1) v.appendChild(el('div', { class: 'vnow', style: 'top:' + T(now.getHours() + now.getMinutes() / 60).toFixed(1) + 'px' }));
169
- const rows = untimed.map((e) => el('li', { class: 'nrow', 'data-cv-cell': e.id },
170
- el('span', { class: 'ki' }, c3ic('cal')), el('div', { class: 'nb' }, el('span', { class: 'tt' }, e.title || e.id), el('div', { class: 'chips' }, el('span', { class: 'tag' }, 'all day' + (e.kind ? ' · ' + e.kind : ''))))));
171
- // the mockup's loadHtml (line 1410): meeting hours against the free hours of an eight to eighteen day
172
- const mh = timed.reduce((t, e) => t + (end(e) - timeOf(e.at)), 0); const free = Math.max(0, 10 - mh);
173
- const load = el('div', { 'data-cv': 'load' }, el('div', { class: 'lbar' }, el('i', { style: 'width:' + Math.min(100, mh / 10 * 100) + '%;background:var(--acc)' }), el('i', { style: 'flex:1;background:var(--muted)' })),
174
- el('div', { class: 'chips2 dim mono', style: 'font-size:var(--fs-1);justify-content:space-between;margin-top:4px' }, el('span', null, mh.toFixed(1) + ' h meetings'), el('span', null, free.toFixed(1) + ' h free')));
175
- const sel = ribbon && r && selE ? rdetNode(host, r, selE) : null;
176
- if (c3) scrubWire(v, timed, end, t0, pph);
177
- const parts = [timed.length ? v : null, sel, rows.length ? el('ul', { class: 'list', role: 'list' }, rows) : null, timed.length ? load : null];
178
- if (ribbon) return el('div', { class: 'rpane', 'data-z': 'today', style: 'display:grid;gap:var(--sp-3)' }, lensHead(data), ...parts);
179
- return el('section', { class: 'card glass ribbon', 'data-cv': 'deck' }, ...parts);
180
- }
181
-
182
- /* The mockup's weekListPh (line 2620): one .nrow per day, the day as a mono .ki, the events as chips. */
183
- function listRows(data, r, host) {
184
- const cells = (data.cells || []).filter((c) => c.events.length);
185
- const rows = cells.map((c) => el('li', { class: 'nrow', 'data-cv-cell': c.key, 'data-today': c.start <= data.today && data.today <= c.end ? 'true' : null, tabindex: '0', style: 'grid-template-columns:auto minmax(0,1fr);cursor:pointer;padding-inline:8px',
186
- onClick: () => { if (data.unit === 'day') go(host, r, { view: 'day', date: c.start, anim: 'zi' }); } },
187
- el('span', { class: 'ki mono', style: 'width:auto;padding:0 8px;' + small }, data.unit === 'day' ? dayLabel(c.start) : cellLabel(c, data.unit)),
188
- el('div', { class: 'nb' },
189
- ...c.events.slice(0, 5).map((e) => (data.unit === 'day' && timeOf(e.at) !== null
190
- ? el('button', { type: 'button', class: 'tt', 'data-cv-ev': e.id, 'data-a': 'calblk', 'data-k': Number(c.start.slice(8)) + '|' + baseId(e), title: 'Open ' + (e.title || e.id) + ' on ' + dayLabel(c.start), style: 'display:block;font-weight:400;border:0;background:none;padding:0;text-align:left;cursor:pointer;color:inherit', onClick: (ev) => { ev.stopPropagation(); go(host, r, { view: 'day', date: c.start, anim: 'zi' }); r.sel = e.id; } }, e.title || e.id)
191
- : el('div', { class: 'tt', style: 'display:block;font-weight:400' }, e.title || e.id))),
192
- c.events.length > 5 ? el('div', { class: 'chips2 dim mono', style: small }, `+${c.events.length - 5} more`) : null)));
193
- return el('section', { class: 'card', 'data-cv': 'deck' }, el('ul', { class: 'list', role: 'list', style: 'margin:0' }, rows));
194
- }
195
-
196
- /* The mockup's monthView (line 1555): a Monday-first .cal grid of .cd day buttons; the shade is the number of events. */
197
- /* the mockup's day marks (MS, line 1509 and mglyph): a glyph per release, promise, report or learning that day; a calendar with no marks names the count */
198
- function monthMarks(c, n) {
199
- const mk = c.events.filter((e) => e.kind === 'milestone').map((e) => markOf(e.title)).filter(Boolean);
200
- if (mk.length) return mk.slice(0, 4).map((k) => el('span', { style: 'color:' + (MKS[k] || MKS.report)[1] }, (MKS[k] || MKS.report)[0]));
201
- return IX() ? [] : [n ? n + (n === 1 ? ' event' : ' events') : ''];
202
- }
203
- function monthGrid(data, r, host) {
204
- const first = data.range.start; const off = (dowOf(first) + 6) % 7;
205
- const cells = data.cells || []; const max = Math.max(1, ...cells.map((c) => c.events.length));
206
- const h = el('div', { class: 'cal' }, ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map((n) => el('div', { class: 'dh' }, n)));
207
- for (let i = 0; i < off; i++) h.appendChild(el('div', { class: 'cd out', 'aria-hidden': 'true' }));
208
- cells.forEach((c) => {
209
- const n = c.events.length; const wd = dowOf(c.start);
210
- h.appendChild(el('button', { type: 'button', class: 'cd' + (wd === 0 || wd === 6 ? ' we' : '') + (c.start === data.today ? ' today' : ''), 'data-cv-cell': c.key, 'data-a': 'calday', 'data-k': String(Number(c.start.slice(8))), 'data-today': c.start === data.today ? 'true' : null,
211
- title: n ? c.events.map((e) => e.title || e.id).join(', ') : 'No events', onClick: () => go(host, r, { view: 'day', date: c.start, anim: 'zi' }) },
212
- el('span', { class: 'n' }, String(Number(c.start.slice(8)))), el('span', { class: 'm', 'aria-hidden': 'true' }, ...monthMarks(c, n)), n ? el('span', { class: 'heat', style: 'height:' + Math.round(n / max * 100) + '%' }) : null));
213
- });
214
- return el('section', { class: 'card', 'data-cv': 'deck' }, h, el('div', { class: 'legend' }, el('span', null, 'shade = events that day')));
215
- }
216
-
217
- function events(data, r, host) {
218
- if (isC3(r) && (r.view === 'quarter' || r.view === 'year') && data.strategy) return null; // the mockup's quarter and year are the strategy lens: no list of meetings
219
- const n = (data.cells || []).reduce((t, c) => t + c.events.length, 0);
220
- if (!n) {
221
- return el('section', { class: 'card', 'data-cv': 'deck' },
222
- el('div', { class: 'fold', 'data-cv': 'no-events' }, c3ic('moon', 'sm'), data.events_source === 'none' ? 'No calendar is cached yet, so there are no meetings to show.' : 'Nothing is scheduled in this range.'));
223
- }
224
- return data.unit === 'day' && data.range.start === data.range.end ? dayTimeline(data, false, r, host) : data.range.days > 7 && data.unit === 'day' ? monthGrid(data, r, host) : listRows(data, r, host);
225
- }
226
-
227
- /* ── promised against forecast: the mockup's progSVG (line 2712), drawn from the server's gantt rows ───────────────── */
228
-
229
- function gantt(data, r, host) {
230
- const every = data.gantt || [];
231
- const all = every.filter((g) => g.status !== 'no plan'); // a row with no plan has no bar to draw: it is counted, not drawn
232
- const noPlan = every.length - all.length;
233
- const head = el('h3', null, c3ic('target'), 'Promised against forecast ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'when things land, and whether they will'));
234
- const nope = noPlan ? el('div', { class: 'dim mono', style: small, 'data-cv': 'no-plan' }, noPlan + ' initiative' + (noPlan === 1 ? ' has' : 's have') + ' no plan date, so no bar.') : null;
235
- if (!all.length) return el('section', { class: 'card', 'data-cv': 'gantt' }, head, el('div', { class: 'fold' }, c3ic('moon', 'sm'), 'No initiative has a date in this range.'), nope);
236
- const R = all.slice(0, 10);
237
- const a = utc(data.range.start); const N = Math.round((utc(data.range.end) - a) / 864e5) + 1;
238
- const W = 720; const LW = 150; const SW = 104; const CW = W - LW - SW; const dw = CW / N; const rh = 30; const top = 28; const H = top + R.length * rh + 8;
239
- const X = (s) => LW + Math.max(0, Math.min(N, (utc(s) - a) / 864e5)) * dw; // the left edge of a day
240
- const Xe = (s) => X(s) + dw; // the right edge of a day
241
- const s = svg('svg', { class: 'pg', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Progress of commitments: planned and forecast bars, the promised date, and the status of each initiative' });
242
- // the day ticks: every day for a short range, Mondays for up to nine weeks, the first of each month beyond that
243
- for (let i = 0; i < N; i++) {
244
- const t = new Date(a + i * 864e5); const w = t.getUTCDay(); const d = t.getUTCDate();
245
- const lab = N <= 14 ? (DN[w] + ' ' + d) : N <= 62 ? (w === 1 ? String(d) : null) : (d === 1 ? MN[t.getUTCMonth()] : null);
246
- if (lab) { s.appendChild(svg('line', { x1: LW + i * dw, x2: LW + i * dw, y1: 18, y2: H - 4, stroke: 'var(--border)' })); s.appendChild(text(LW + i * dw + 3, 14, lab)); }
247
- }
248
- const today = data.today;
249
- if (today >= data.range.start && today <= data.range.end) {
250
- const tx = X(today);
251
- s.appendChild(svg('rect', { x: tx, y: 20, width: dw, height: H - 24, fill: 'var(--accw)', rx: 6 }));
252
- s.appendChild(svg('line', { x1: tx + dw / 2, x2: tx + dw / 2, y1: 20, y2: H - 4, stroke: 'var(--foreground)', 'stroke-width': 2 }));
253
- }
254
- const clip = svg('clipPath', { id: 'cvc' + data.range.start }, svg('rect', { x: LW, y: 18, width: CW, height: H - 18 }));
255
- s.appendChild(svg('defs', {}, clip));
256
- R.forEach((g, i) => {
257
- const y = top + i * rh; const cy = y + rh / 2; const k = STKEY[g.status] || 'none'; const S = ST[k];
258
- const nm = (g.title || g.id || '').length > 17 ? (g.title || g.id).slice(0, 16) + '…' : (g.title || g.id || '');
259
- const row = svg('g', { 'data-cv-row': g.id, 'data-status': g.status, ...(isPhoneR(r) ? {} : { role: 'button', tabindex: '0', 'data-a': 'goinit', 'data-k': g.id, 'aria-label': 'Open ' + (g.title || g.id) + ': ' + g.status }), style: isPhoneR(r) ? '' : 'cursor:pointer', opacity: k === 'none' ? '.6' : '1' });
260
- row.appendChild(svg('rect', { x: 0, y, width: W, height: rh, fill: 'transparent' }));
261
- const openIt = () => { if (!goInitiative(g.id)) openInit(host, r, g.id, g.title); }; // the mockup's goinit: the Initiatives tab with this initiative chosen
262
- if (!isPhoneR(r)) row.addEventListener('click', openIt); if (!isPhoneR(r)) row.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); openIt(); } });
263
- row.appendChild(text(0, cy + 4, nm, { class: 't' }));
264
- const bars = svg('g', { 'clip-path': `url(#cvc${data.range.start})` });
265
- const has = (q) => q && (q.start || q.end);
266
- if (has(g.planned)) { const x0 = X(g.planned.start || g.planned.end); const x1 = Xe(g.planned.end || g.planned.start); bars.appendChild(svg('rect', { x: x0, y: cy - 8, width: Math.max(2, x1 - x0), height: 6, rx: 3, fill: 'var(--ring)', 'fill-opacity': '.6' })); }
267
- if (has(g.forecast)) { const x0 = X(g.forecast.start || g.forecast.end); const x1 = Xe(g.forecast.end || g.forecast.start); bars.appendChild(svg('rect', { x: x0, y: cy, width: Math.max(2, x1 - x0), height: 6, rx: 3, fill: S.c })); }
268
- if (g.promised && g.promised >= data.range.start && g.promised <= data.range.end) {
269
- const px = X(g.promised) + dw / 2;
270
- bars.appendChild(svg('path', { d: `M${px} ${cy - 9} l7 9 -7 9 -7 -9z`, fill: 'var(--card)', stroke: S.c, 'stroke-width': 2 }, svg('title', {})));
271
- bars.lastChild.firstChild.textContent = 'Promised ' + g.promised;
272
- }
273
- row.appendChild(bars);
274
- row.appendChild(text(W - SW + 10, cy + 4, S.l + (g.slip_days > 0 ? ` +${g.slip_days} d` : ''), { style: 'fill:' + S.c + ';font-weight:500' }));
275
- const t = svg('title', {}); t.textContent = `${g.title || g.id}: ${g.status}${g.slip_days > 0 ? ', ' + g.slip_days + ' days past the plan' : ''}`; row.appendChild(t);
276
- s.appendChild(row);
277
- });
278
- return el('section', { class: 'card', 'data-cv': 'gantt' }, head, s,
279
- isPhoneR(r) ? phoneRows(R, r, host) : null,
280
- all.length > R.length ? el('div', { class: 'dim mono', style: small }, `+${all.length - R.length} more initiatives not drawn`) : null, nope,
281
- el('div', { class: 'pgl' }, el('span', null, '▬ planned'), el('span', null, '▬ forecast, coloured by status'), el('span', null, '◇ promised'), el('span', null, '| today'),
282
- el('span', { style: 'color:var(--success)' }, '■ on time'), el('span', { style: 'color:var(--warning)' }, '■ at risk'), el('span', { style: 'color:var(--destructive)' }, '■ delayed or overdue')));
283
- }
284
-
285
- /* ── the strategy lens for Quarter and Year: the mockup's direction card (dirCard, line 2958) and key result rows (krCard, line 2863) ── */
286
-
287
- function strategy(data) {
288
- const xrow = (row, detail) => { const xp = makeXp(el('div', { class: 'dim', style: 'padding:6px 0;font-size:var(--fs-2)' }, detail)); row.setAttribute('tabindex', '0'); row.style.cursor = 'pointer'; attachExpand(row, xp, { key: row.getAttribute('data-cv-kr') }); return el('div', { class: 'krw' }, row, xp); };
289
- const s = data.strategy; if (!s) return null;
290
- const pct = (v) => Math.round(v * 100) + '%';
291
- const warns = s.deviations.filter((d) => d.early_warning).length;
292
- // the dial is derived from the lens's own rules: a pivot signal, else an early warning, else (when something is scored) on course
293
- const state = s.pivot.signal ? 'pivot' : warns ? 'adjust' : s.north_star.scored ? 'persevere' : null;
294
- const D = [['persevere', 'Persevere', 'var(--success)'], ['adjust', 'Adjust', 'var(--warning)'], ['pivot', 'Pivot', 'var(--destructive)']];
295
- const A = data.view === 'quarter';
296
- const tc = state === 'pivot' ? 'var(--destructive)' : state === 'adjust' ? 'var(--warning)' : state === 'persevere' ? 'var(--success)' : 'var(--muted-foreground)';
297
- const dir = el('article', { class: 'fc solo on dir', 'data-tag': 'x', 'data-cv': 'north-star', 'data-signal': String(!!s.pivot.signal), style: '--tc:' + tc },
298
- el('div', { class: 'ff' },
299
- el('div', null, el('span', { class: 'tg', style: '--tc:' + tc }, c3ic('target', 'sm'), A ? 'Quarter direction' : 'Year direction')),
300
- el('div', null, el('h2', null, s.north_star.progress == null ? 'Not scored' : 'North star: ' + pct(s.north_star.progress) + ' of the way'),
301
- el('div', { class: 'dim', style: 'margin-top:4px' }, `${s.north_star.scored} of ${s.north_star.total} key results scored`)),
302
- el('div', { class: 'dial', role: 'img', 'aria-label': 'Direction: ' + (state || 'not scored') },
303
- D.map((d) => el('span', { class: d[0] === state ? 'on' : '', style: '--c:' + d[2] }, el('i'), d[1]))),
304
- el('div', { class: 'sevs' },
305
- el('span', { style: 'color:var(--warning)' }, c3ic('clock', 'sm'), warns + ' early warning' + (warns === 1 ? '' : 's')),
306
- el('span', null, c3ic('info', 'sm'), s.unscored.length + ' without a metric'),
307
- s.pivot.signal ? el('span', { style: 'color:var(--destructive)' }, c3ic('alert', 'sm'), 'pivot signal') : null)));
308
- const note = (t, cls, attrs) => el('div', { class: 'fold' + (cls ? ' ' + cls : ''), ...attrs }, c3ic(cls === 'w' ? 'alert' : 'info', 'sm'), t);
309
- const rows = [
310
- ...s.deviations.map((d) => {
311
- const c = d.early_warning ? 'var(--warning)' : 'var(--success)';
312
- return xrow(el('div', { class: 'krg', style: '--c:' + c, 'data-cv-kr': d.kr, 'data-early-warning': String(!!d.early_warning) },
313
- el('div', null, el('b', null, d.kr), el('small', null, d.metric || '')),
314
- el('div', null, el('div', { class: 'krt', title: 'How far behind the line' }, el('i', { style: 'width:' + Math.max(0, Math.min(100, Math.round(d.shortfall * 100))) + '%' })),
315
- el('small', null, `expected ${d.expected} · actual ${d.actual} · behind the line by ${Math.round(d.shortfall * 100)}%`)),
316
- el('div', { class: 'chip-s', style: '--c:' + c }, d.early_warning ? 'Early warning' : 'On the line')),
317
- (d.early_warning ? 'An early warning: it is behind the expected line. ' : 'On the expected line. ') + 'Expected ' + d.expected + ', actual ' + d.actual + (d.metric ? ' (' + d.metric + ')' : '') + '. A pivot needs 3 checks behind the line and not closing; this is not one by itself.');
318
- }),
319
- ...s.unscored.map((u) => xrow(el('div', { class: 'krg', style: '--c:var(--muted-foreground)', 'data-cv-kr': u.kr, 'data-no-metric': 'true' },
320
- el('div', null, el('b', null, u.kr), el('small', null, 'not scored')), el('div', null, el('small', null, 'No metric, baseline, target or date, so there is no line to compare.')),
321
- el('div', { class: 'chip-s', style: '--c:var(--muted-foreground)' }, 'no metric')), 'Add a metric, a baseline, a target and a date to the key result in its file, and it is scored against a line.')),
322
- ];
323
- const kr = el('section', { class: 'card', 'data-cv': 'strategy' },
324
- el('h3', null, c3ic('target'), 'Key results ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'where they are against the line')),
325
- s.reason ? note(s.reason, '', { 'data-cv': 'lens-reason' }) : null,
326
- rows.length ? el('div', null, rows) : null,
327
- note(s.pivot.reason || '', s.pivot.signal ? 'w' : '', { 'data-cv': 'pivot', 'data-signal': String(!!s.pivot.signal) }),
328
- el('div', { class: 'pgl' }, el('span', null, '▬ how far behind the expected line'), el('span', null, 'a pivot needs 3 checks behind the line and not closing')));
329
- return el('div', { class: 'brief sbb' }, el('div', { class: 'bcols' }, el('div', { class: 'bcol l' }, dir), el('div', { class: 'bcol r' }, kr)));
330
- }
331
-
332
-
333
- /* ── the ribbon (the Briefing's middle card): the mockup's weekStrip, quarterStrip, yearPane and fivePane (console3.html lines 1378 to 1434) ── */
334
-
335
- const tspan = (n) => { const m = /T(\d{2}):(\d{2})/.exec(String(n || '')); return m ? Number(m[1]) + Number(m[2]) / 60 : null; };
336
- const hoursOf = (c) => c.events.reduce((t, e) => { const a = tspan(e.at); const b = tspan(e.end); return a !== null && b !== null && b > a && e.kind !== 'milestone' ? t + (b - a) : t; }, 0);
337
- /* the mockup's marker glyphs (MKS, line 1509): ship, promise, report, learn. Read from a milestone's title; `mock_week` (demo) names them. */
338
- const MKS = { ship: ['◆', 'var(--acc)'], promise: ['◇', 'var(--foreground)'], report: ['▪', 'var(--muted-foreground)'], learn: ['○', 'var(--success)'], copy: ['▪', 'var(--muted-foreground)'] };
339
- const markOf = (t) => (/release|freeze|ship/i.test(t) ? 'ship' : /promise|forecast/i.test(t) ? 'promise' : /status|update|report|review/i.test(t) ? 'report' : /interview|insight|learning|discovery|plan/i.test(t) ? 'learn' : null);
340
- const hrsLinked = (c) => c.events.reduce((t, e) => { const a = tspan(e.at); const b = tspan(e.end); return a !== null && b !== null && b > a && e.kind !== 'milestone' && !e.mock_routine && !e.routine ? t + (b - a) : t; }, 0);
341
- /* the next working days: from `mock_week` (demo) or from the calendar's own events (this week and the next) */
342
- function weekDays(r) {
343
- if (r.data && r.data.mock_week) return r.data.mock_week;
344
- const today = (r.data && r.data.today) || todayStr();
345
- return [...((r.data && r.data.cells) || []), ...((r.data2 && r.data2.cells) || [])].filter((c) => { const w = dowOf(c.start); return w !== 0 && w !== 6 && c.start >= today; }).slice(0, 7)
346
- .map((c) => ({ date: c.start, d: DN[dowOf(c.start)] + ' ' + Number(c.start.slice(8)), v: Math.round(hoursOf(c) * 10) / 10, lk: Math.round(hrsLinked(c) * 10) / 10,
347
- mk: c.events.filter((e) => e.kind === 'milestone').map((e) => [markOf(e.title), e.title]).filter((x) => x[0]) }));
348
- }
349
- /* the header of each pane (the mockup's lensInfo, line 2379): from `ribbon_heads` (demo), else worked out from what the server sent */
350
- function paneHead(z, r, days) {
351
- const d = r.data; const H = d.ribbon_heads && d.ribbon_heads[z];
352
- if (H) return H;
353
- if (z === 'week') {
354
- if (!days.length) return null;
355
- const tot = days.reduce((t, x) => t + x.v, 0); const lk = days.reduce((t, x) => t + x.lk, 0); const hv = days.reduce((m, x) => (x.v > m.v ? x : m), days[0]);
356
- return { i: 'cal', h: hv.d.split(' ')[0] + ' is the heaviest day: ' + hv.v + ' h of meetings', s: Math.round(lk) + ' of ' + Math.round(tot) + ' h are tied to a promise or a decision. The rest is routine.', ring: [Math.round(lk), Math.max(1, Math.round(tot))] };
357
- }
358
- const rows = (d.gantt || []).filter((g) => g.status !== 'no plan'); const on = rows.filter((g) => g.status === 'on time').length;
359
- return { i: 'init', h: rows.length ? on + ' of ' + rows.length + ' initiatives on time' : 'No initiative has a date in this range', s: 'Promised dates against forecast.', ring: rows.length ? [on, rows.length] : null };
360
- }
361
- const headNode = (H) => (H ? el('div', { class: 'lh' }, el('span', { class: 'ki' }, c3ic(H.i)), el('div', { style: 'min-width:0' }, el('b', null, H.h), el('div', { class: 'dim' }, H.s)), H.ring ? c3ring(H.ring[0], Math.max(1, H.ring[1]), 44) : null) : null);
362
-
363
- /* the date of a day named by weekday and number (the demo's "Fri 9"), looked up in the fortnight from today */
364
- function dateOfDay(today, label) { const n = Number(String(label).split(' ')[1]); for (let i = 0; i < 14; i++) { const t = shift('day', today, i); if (Number(t.slice(8)) === n) return t; } return today; }
365
-
366
- function weekStrip(r, host) {
367
- const days = weekDays(r);
368
- if (!days.length) return el('p', { class: 'dim mono', style: small, 'data-cv': 'no-events' }, 'No calendar is cached yet, so there are no meeting hours to draw.');
369
- const W = 380; const H = 122; const Y = (v) => 78 - v / 6 * 52;
370
- const s = svg('svg', { class: 'chart', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Meeting hours for the next seven working days, split into time tied to a promise or decision and routine time', 'data-cv': 'week-strip' });
371
- s.appendChild(svg('line', { x1: 6, x2: W - 6, y1: Y(6), y2: Y(6), stroke: 'var(--border)' })); s.appendChild(text(W - 6, Y(6) - 4, '6 h', { 'text-anchor': 'end' }));
372
- days.forEach((x, i) => {
373
- const cx = 30 + i * 53;
374
- s.appendChild(svg('rect', { x: cx - 11, y: Y(x.v), width: 22, height: 78 - Y(x.v), rx: 4, fill: 'var(--ring)', opacity: '.55' }));
375
- if (x.lk) s.appendChild(svg('rect', { x: cx - 11, y: Y(x.lk), width: 22, height: 78 - Y(x.lk), rx: 4, fill: 'var(--acc)' }));
376
- s.appendChild(text(cx, Y(x.v) - 5, String(x.v), { 'text-anchor': 'middle', class: i === 0 ? 't' : '' })); s.appendChild(text(cx, 96, x.d, { 'text-anchor': 'middle', class: i === 0 ? 't' : '' }));
377
- const dt = x.date || dateOfDay(r.data.today || todayStr(), x.d);
378
- const hit = svg('rect', { class: 'hit', x: cx - 26, y: 16, width: 52, height: 104, role: 'button', tabindex: '0', 'data-a': 'calday', 'data-k': (x.d || '').split(' ')[1], 'aria-label': 'Open ' + x.d + ' in Calendar' });
379
- const goDay = () => openDay(dt, null); hit.addEventListener('click', goDay); hit.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); goDay(); } });
380
- (x.mk || []).forEach((m, k) => { const g = svg('g', {}); const gl = MKS[m[0]] || MKS.report; g.appendChild(text(cx + (k - (x.mk.length - 1) / 2) * 14, 113, gl[0], { 'text-anchor': 'middle', style: 'font-size:var(--fs-3);fill:' + gl[1] })); const t = svg('title', {}); t.textContent = m[1]; g.appendChild(t); s.appendChild(g); });
381
- s.appendChild(hit);
382
- });
383
- return el('div', null, s, el('div', { class: 'legend' }, el('span', { style: 'color:var(--acc)' }, '■ tied to a promise or decision'), el('span', null, '■ routine'), el('span', null, '◆ release'), el('span', null, '◇ promise'), el('span', null, '▪ report')));
384
- }
385
-
386
- /* initiatives against their promised dates over the range the server answered (the quarter, or the year) */
387
- function ganttStrip(data, label, r, host) {
388
- const rows = (data.gantt || []).filter((g) => g.status !== 'no plan'); const noPlan = (data.gantt || []).length - rows.length;
389
- if (!rows.length) return el('p', { class: 'dim mono', style: small }, 'No initiative has a date in this range.');
390
- const a = utc(data.range.start); const N = Math.round((utc(data.range.end) - a) / 864e5) + 1;
391
- const mm = data.mock_marks; // optional (demo): the mockup's leadership dates under the rows, { dates, label }
392
- const W = 380; const x0 = 92; const x1 = 372; const X = (d) => x0 + Math.max(0, Math.min(N, (utc(d) - a) / 864e5)) / N * (x1 - x0); const rh = 30; const top = 24; const H = top + rows.length * rh + (mm ? 36 : 12);
393
- const s = svg('svg', { class: 'chart', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': label + ': initiatives against promised dates' });
394
- for (let i = 0; i < N; i++) { const t = new Date(a + i * 864e5); if (t.getUTCDate() === 1) { s.appendChild(svg('line', { x1: X(t.toISOString().slice(0, 10)), x2: X(t.toISOString().slice(0, 10)), y1: 16, y2: H - 8, stroke: 'var(--border)' })); s.appendChild(text(X(t.toISOString().slice(0, 10)) + 4, 11, MN[t.getUTCMonth()])); } }
395
- const today = data.today;
396
- rows.forEach((g, k) => {
397
- const y = top + k * rh; const f = (g.forecast && (g.forecast.end || g.forecast.start)) || g.promised; const st = (g.planned && g.planned.start) || (g.forecast && g.forecast.start) || data.range.start;
398
- const end = f && g.promised && f > g.promised ? f : (g.promised || f);
399
- const nm = (g.title || g.id || ''); s.appendChild(text(0, y + 17, nm.length > 13 ? nm.slice(0, 12) + '…' : nm, { class: 't' }));
400
- if (end) {
401
- const cut = today >= st && today <= end ? today : end;
402
- s.appendChild(svg('rect', { x: X(st), y: y + 7, width: Math.max(2, X(cut) - X(st)), height: 12, rx: 4, fill: 'var(--acc)' }));
403
- if (cut < end) s.appendChild(svg('rect', { x: X(cut), y: y + 7, width: Math.max(0, X(end) - X(cut)), height: 12, rx: 4, fill: 'var(--accw)' }));
404
- }
405
- if (g.promised && f && f > g.promised) s.appendChild(svg('rect', { x: X(g.promised), y: y + 23, width: X(f) - X(g.promised), height: 3, rx: 1.5, fill: 'var(--destructive)' }));
406
- if (g.promised) s.appendChild(svg('path', { d: `M${X(g.promised)} ${y + 2} l6 6 -6 6 -6 -6z`, fill: 'var(--background)', stroke: 'var(--foreground)', 'stroke-width': 2 }));
407
- const hit = svg('rect', { class: 'hit', x: 0, y, width: W, height: rh, ...(isPhoneR(r) ? {} : { role: 'button', tabindex: '0', 'data-a': 'goinit', 'data-k': g.id, 'aria-label': 'Open ' + nm + ': ' + g.status }) }); const t = svg('title', {}); t.textContent = nm + ': ' + g.status; hit.appendChild(t); s.appendChild(hit);
408
- const openIt = () => { if (!goInitiative(g.id)) openInit(host, r, g.id, nm); }; if (!isPhoneR(r)) hit.addEventListener('click', openIt); if (!isPhoneR(r)) hit.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); openIt(); } });
409
- });
410
- if (mm) { mm.dates.forEach((d) => s.appendChild(text(X(d), H - 22, '▪', { 'text-anchor': 'middle', style: 'font-size:var(--fs-3);fill:var(--muted-foreground)' }))); s.appendChild(text((X(mm.dates[0]) + X(mm.dates[mm.dates.length - 1])) / 2, H - 10, mm.label, { 'text-anchor': 'middle' })); }
411
- if (today >= data.range.start && today <= data.range.end) { s.appendChild(svg('line', { x1: X(today), x2: X(today), y1: 16, y2: H - 8, stroke: 'var(--foreground)', 'stroke-width': 2 })); s.appendChild(text(X(today), 11, 'today', { 'text-anchor': 'middle', class: 't' })); }
412
- return el('div', null, s, isPhoneR(r) ? phoneRows(rows, r, host) : null, el('div', { class: 'legend' }, el('span', null, '◇ promised'), el('span', { style: 'color:var(--destructive)' }, '▬ slip'), mm ? el('span', null, '▪ leadership') : null), noPlan && !data.ribbon_heads ? el('div', { class: 'dim mono', style: small }, noPlan + ' initiative' + (noPlan === 1 ? ' has' : 's have') + ' no plan date, so no bar.') : null);
413
- }
414
-
415
- const RAGCLS = { bad: 'dotc bad', warn: 'dotc warn', ok: 'dotc ok', park: 'dotc' };
416
- /* The mockup's yearPane: a row per pillar, a column per quarter. Drawn from data.mock_year (demo); the calendar route sends no pillars. */
417
- function yearPane(m, r, host) {
418
- const g = el('div', { style: 'display:grid;grid-template-columns:84px repeat(4,minmax(0,1fr));gap:6px;align-items:center' }, el('span'),
419
- ...m.quarters.map((q) => el('span', { class: 'mono dim', style: 'font-size:var(--fs-1);text-align:center' }, q)));
420
- m.pillars.forEach((p) => {
421
- g.append(el('span', { class: 'chips2', style: 'font-size:var(--fs-2);font-weight:500' }, c3ic(p.icon, 'sm'), p.n));
422
- p.cells.forEach((cell) => g.append(el('span', { style: 'display:flex;justify-content:center;flex-wrap:wrap;min-height:24px;align-items:center' },
423
- ...cell.map(([n, rag]) => { if (rag === null) return el('span', { class: 'dotp', title: n }); const id = IX() && IX().LINK && IX().LINK[n]; const dot = el('span', { class: RAGCLS[rag] || 'dotc' });
424
- return id ? el('button', { type: 'button', class: 'dotb', title: n, 'aria-label': 'Open ' + n, onClick: () => openInit(host, r, id, n) }, dot) : el('span', { class: 'dotb', title: n }, dot); }))));
425
- });
426
- return el('div', null, g, el('div', { class: 'legend' }, el('span', null, '● in flight, coloured by status'), el('span', null, '◌ planned')));
427
- }
428
- /* The mockup's fivePane: the weekly-actives cone and a pillar by year grid. Drawn from data.mock_five (demo). */
429
- function fivePane(m) {
430
- const W = 380; const H = 156; const x0 = 34; const x1 = 366; const X = (y) => x0 + (y - 2025) / 6 * (x1 - x0); const Y = (v) => 124 - v / 130 * 100; const f = (y) => Math.max(0, (y - 2026.8) * 0.07);
431
- const tgt = [[2026.8, 12.4], [2027, 16], [2028, 35], [2029, 60], [2030, 90], [2031, 120]];
432
- const up = tgt.map((p) => X(p[0]).toFixed(1) + ',' + Y(p[1] * (1 + f(p[0]))).toFixed(1)); const lo = tgt.slice().reverse().map((p) => X(p[0]).toFixed(1) + ',' + Y(p[1] * (1 - f(p[0]))).toFixed(1));
433
- const s = svg('svg', { class: 'chart', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Weekly active accounts, 12.4k now, target 120k in 2031, with a widening range' });
434
- [0, 60, 120].forEach((v) => { s.appendChild(svg('line', { x1: x0, x2: x1, y1: Y(v), y2: Y(v), stroke: 'var(--border)' })); s.appendChild(text(x0 - 5, Y(v) + 4, v + 'k', { 'text-anchor': 'end' })); });
435
- [2025, 2027, 2029, 2031].forEach((y) => s.appendChild(text(X(y), 144, String(y), { 'text-anchor': 'middle' })));
436
- s.appendChild(svg('polygon', { points: up.join(' ') + ' ' + lo.join(' '), fill: 'var(--accw)' }));
437
- s.appendChild(svg('polyline', { fill: 'none', stroke: 'var(--acc)', 'stroke-opacity': '.55', 'stroke-width': 2, points: tgt.map((p) => X(p[0]) + ',' + Y(p[1])).join(' ') }));
438
- s.appendChild(svg('polyline', { fill: 'none', stroke: 'var(--acc)', 'stroke-width': 2, 'stroke-linecap': 'round', points: [[2025, 9.5], [2026, 11.2], [2026.8, 12.4]].map((p) => X(p[0]) + ',' + Y(p[1])).join(' ') }));
439
- s.appendChild(svg('circle', { cx: X(2026.8), cy: Y(12.4), r: 4, fill: 'var(--acc)', stroke: 'var(--card)', 'stroke-width': 2 })); s.appendChild(text(X(2026.8) - 6, Y(12.4) + 15, '12.4k', { 'text-anchor': 'end', class: 't' }));
440
- s.appendChild(svg('circle', { cx: X(2031), cy: Y(120), r: 4, fill: 'var(--background)', stroke: 'var(--acc)', 'stroke-width': 2 })); s.appendChild(text(X(2031) - 8, Y(120) - 8, '120k', { 'text-anchor': 'end', class: 't' }));
441
- const g = el('div', { style: 'display:grid;grid-template-columns:84px repeat(5,minmax(0,1fr));gap:4px 5px;align-items:center;margin-top:6px' }, el('span'), ...m.years.map((y) => el('span', { class: 'mono dim', style: 'font-size:var(--fs-1);text-align:center' }, y)));
442
- m.pillars.forEach((p) => { g.append(el('span', { class: 'chips2', style: 'font-size:var(--fs-2);font-weight:500' }, c3ic(p.icon, 'sm'), p.n)); p.cols.forEach((c, i) => g.append(el('span', { class: 'yc c' + (i + 1 > 4 ? 4 : i + 1), title: c[1] }, c[0]))); });
443
- return el('div', null, s, g, el('div', { class: 'legend' }, el('span', null, 'solid = in detail'), el('span', null, 'tint = planned'), el('span', null, 'outline = direction'), el('span', null, 'dashed = bet')));
444
- }
445
-
446
- function ribbonCard(host, r) {
447
- const phone = r.root.classList.contains('ph');
448
- let pane;
449
- if (r.error) pane = el('p', { class: 'dim mono', style: small, role: 'status', 'data-cv': 'error' }, 'The calendar could not be read: ' + r.error);
450
- else if (!r.data) pane = el('p', { class: 'dim mono', style: small, role: 'status', 'data-cv': 'loading' }, 'Reading the repository');
451
- else {
452
- const d = r.data;
453
- if (r.zoom === 'today') pane = (d.cells || []).reduce((t, c) => t + c.events.length, 0) ? dayTimeline(d, true, r, host) : el('div', { class: 'rpane', 'data-z': 'today' }, lensHead(d), el('div', { class: 'fold', 'data-cv': 'no-events' }, c3ic('moon', 'sm'), d.events_source === 'none' ? 'No calendar is cached yet, so there are no meetings to show.' : 'Nothing is scheduled in this range.'));
454
- else if (r.zoom === 'week') pane = el('div', { class: 'rpane', 'data-z': 'week' }, headNode(paneHead('week', r, weekDays(r))), weekStrip(r, host));
455
- else if (r.zoom === 'quarter') pane = el('div', { class: 'rpane', 'data-z': 'quarter' }, headNode(paneHead('quarter', r)), ganttStrip(d, 'This quarter', r, host));
456
- else if (r.zoom === 'year') pane = d.mock_year ? el('div', { class: 'rpane', 'data-z': 'year' }, headNode(paneHead('year', r)), yearPane(d.mock_year, r, host)) : el('div', { class: 'rpane', 'data-z': 'year' }, headNode(paneHead('year', r)), ganttStrip(d, 'This year', r, host));
457
- else pane = d.mock_five ? el('div', { class: 'rpane', 'data-z': 'five' }, headNode(paneHead('five', r)), fivePane(d.mock_five))
458
- : el('div', { class: 'rpane', 'data-z': 'five' }, el('p', { class: 'dim mono', style: small, 'data-cv': 'five-note' }, 'Five years has no calendar data yet, so the year is shown.'), ganttStrip(d, 'This year', r, host));
459
- }
460
- return el('section', { class: 'card glass ribbon', style: 'gap:8px', 'data-cv': 'ribbon' }, bar(host, r, phone), el('div', { class: 'calbody' + (r.anim && !r.loading ? ' ' + r.anim : '') }, pane));
461
- }
462
-
463
- /* ── the meeting card, the stage, the case sheets and the click-throughs (console3 wave C3) ──────────────────────────────────────────
464
- * The mockup (console3.html: rdet line 2387, meetCard 2586, beforeView 1582, duringView 1586, afterExtra 1590, the click handler 2446 and 2640)
465
- * selects a meeting from the timeline and redraws its card; a meeting card flips to a case file with the options; a day, a week block, a
466
- * gantt row or a pulse row opens something. Here a press selects in place (no read), the options and the initiative case files open as the
467
- * shared sheet (c3-sheet.js + c3-case.js), and a jump to another tab presses that tab's own button. Nothing is sent: an option that
468
- * would tell a person is outward, so its slide stays disabled ("no channel connected"). */
469
-
470
- const NO_CHANNEL = 'No channel is connected, so this would only stay a draft.';
471
- const endH = (e) => { const s = timeOf(e.at); const t = timeOf(e.end); return t !== null && String(e.end).slice(0, 10) === String(e.at).slice(0, 10) && t > s ? t : s + 1; };
472
- const nowH = () => { const d = new Date(); return d.getHours() + d.getMinutes() / 60; };
473
- const dayEvents = (r) => { const c = r.data && r.data.cells && r.data.cells[0]; return c && r.data.unit === 'day' && r.data.range.start === r.data.range.end ? c.events.filter((e) => timeOf(e.at) !== null && e.kind !== 'milestone') : []; };
474
-
475
- /** The meeting that is selected: the one pressed, else the one the page is waiting on, else the next that is not routine. */
476
- function selEvent(r) {
477
- const ev = dayEvents(r); if (!ev.length) return null;
478
- const f = (r.sel && (ev.find((e) => e.id === r.sel) || ev.find((e) => baseId(e) === r.sel))) || ev.find((e) => e.mock_hot);
479
- return f || ev.find((e) => !e.mock_routine && !e.routine && timeOf(e.at) >= nowH()) || ev[0];
480
- }
481
-
482
- const PRS = { ready: ['check', 'Prep ready', 'ok'], review: ['eye', 'Prep drafted, needs your look', 'warn'], blocked: ['alert', 'Blocked on your decision', 'bad'] };
483
- const PRS_REAL = { ready: ['check', 'Prep done', 'ok'], review: ['eye', 'Prep in progress', 'warn'], blocked: ['alert', 'Prep at risk: not enough time left', 'bad'] };
484
- const NOPREP = ['info', 'No prep is recorded for this meeting', ''];
485
-
486
- function realCase(m, steps, done) {
487
- return { id: 'meet:' + m.key, tc: 'var(--acc)', sit: m.title + ' at ' + m.time + '. ' + m.line, move: '',
488
- chg: steps.map((t, i) => [i < done ? 'check' : 'clock', t, i < done ? 'prep done' : 'prep open', i < done ? 'ok' : 'warn']),
489
- unsure: steps.length ? '' : 'The calendar holds no prep, purpose or notes for this meeting.' };
490
- }
491
-
492
- /** What the card shows for a meeting: the demo fixtures when they exist, else only what the calendar memory holds for the event. */
493
- function meetModel(e) {
494
- const ix = IX(); const fx = ix && ix.MEET && ix.MEET[baseId(e)];
495
- const s = timeOf(e.at); const f = endH(e);
496
- const m = { id: e.id, key: baseId(e) || e.id, title: e.title || e.id, time: hhmm(s) + ' to ' + hhmm(f), from: s };
497
- if (fx) return { ...m, line: fx.line, why: fx.why, prep: fx.prep, att: fx.att, attN: fx.att.length, prepRows: fx.prepRows, case: fx.case, demo: true };
498
- const steps = Array.isArray(e.prep) ? e.prep : []; const done = Math.min(Number(e.prep_done) || 0, steps.length);
499
- const prep = !steps.length ? null : done >= steps.length ? 'ready' : e.ready === 'risk' ? 'blocked' : 'review';
500
- const kind = e.kind && !/^(ready|prep ready|review prep|blocked.*)$/i.test(e.kind) ? e.kind : '';
501
- const bits = [e.with ? 'With ' + e.with : '', e.open ? 'Open: ' + e.open : '', e.notes ? String(e.notes) : '', typeof e.attendees === 'number' ? e.attendees + ' attendees' : '', kind].filter(Boolean);
502
- m.line = bits.join(' · ') || 'No purpose or notes are recorded for this meeting.';
503
- return { ...m, prep, att: [], attN: typeof e.attendees === 'number' ? e.attendees : null, prepRows: steps.map((t, i) => ['spark', 'Step ' + (i + 1), t, i < done]), case: realCase(m, steps, done), demo: false };
504
- }
505
- const prState = (m) => (m.prep ? (m.demo ? PRS : PRS_REAL)[m.prep] : NOPREP);
506
-
507
- /* the options sheet of a meeting or an initiative: the shared case file. `store` is the instance's record of what was confirmed. */
508
- function showCase({ title, icon, model, meta, onDone, onGo, tail }) {
509
- const raw = model.opts || [];
510
- const node = renderCase({ ...model, outboxReason: NO_CHANNEL }, {
511
- outbox: false,
512
- onGo: (go) => { closeSheet(); if (onGo) onGo(go); },
513
- onConfirm: ({ option }) => {
514
- const o = raw.find((x) => x.id === option.id) || {};
515
- closeSheet();
516
- if (onDone) onDone(option, o);
517
- toast({ text: o.msg || 'Done. Nothing outside changed.', timeout: 4200 });
518
- },
519
- });
520
- return openSheet({ title, icon, body: [meta || null, node, tail || null], onClose: () => { if (node.c3case) node.c3case.dispose(); } });
521
- }
522
-
523
- function avs(m) {
524
- return [...m.att.map((w) => el('span', { class: 'av' }, w)), !m.att.length && m.attN ? el('span', { class: 'chip2', title: m.attN + ' attendees' }, c3ic('user', 'sm'), String(m.attN)) : null];
525
- }
526
-
527
- function openMeetCase(host, r, e) {
528
- const m = meetModel(e);
529
- const real = !m.demo;
530
- const tail = real ? el('div', { class: 'chips2', 'data-cv': 'case-off' },
531
- el('button', { type: 'button', class: 'chip2', disabled: true, title: NO_CHANNEL }, c3ic('clock', 'sm'), 'Move it'),
532
- el('button', { type: 'button', class: 'chip2', disabled: true, title: NO_CHANNEL }, c3ic('user', 'sm'), 'Ask the organiser')) : null;
533
- showCase({ title: m.title, icon: 'cal', model: m.case, tail,
534
- meta: el('div', { class: 'chips2 dim mono', style: small }, m.time, ...avs(m)),
535
- onDone: (opt) => { r.done[m.key] = { id: opt.id, label: opt.label }; refreshSel(host, r); } });
536
- }
537
-
538
- function openInit(host, r, id, name) {
539
- const ix = IX(); const g = ((r && r.data && r.data.gantt) || []).find((x) => x.id === id) || null;
540
- const title = (g && g.title) || name || id;
541
- let model = ix && ix.INIT && ix.INIT[id];
542
- if (!model) {
543
- const f = g && g.forecast && (g.forecast.end || g.forecast.start); const bits = [];
544
- if (g) { if (g.promised) bits.push(['target', 'Promised ' + g.promised, 'Plan']); if (f) bits.push(['clock', 'Forecast ' + f + (g.slip_days > 0 ? ' (+' + g.slip_days + ' days)' : ''), 'Forecast', g.slip_days > 0 ? 'warn' : 'ok']); if (g.planned && (g.planned.start || g.planned.end)) bits.push(['cal', 'Planned ' + (g.planned.start || '') + ' to ' + (g.planned.end || ''), 'Plan']); }
545
- model = { id: 'init:' + id, sit: g ? (STKEY[g.status] ? ST[STKEY[g.status]].l : g.status) + '. ' + (bits.length ? 'Promised against forecast, from the repository.' : 'No dates are recorded for this initiative.') : 'The initiative is not in this range.', chg: bits, go: { action: 'tab', key: 'init', label: 'Open Initiatives' } };
546
- } else model = { ...model, id: 'init:' + id };
547
- showCase({ title, icon: 'init', model, onGo: (go) => { if (go && go.key) gotoTab(go.key); },
548
- onDone: (opt) => { if (r) { r.done['init:' + id] = { id: opt.id, label: opt.label }; } } });
549
- }
550
-
551
- /* the selected meeting's card under the timeline: the mockup's rdet */
552
- function rdetNode(host, r, e) {
553
- const m = meetModel(e); const d = r.done[m.key];
554
- const pr = d ? ['check', 'Decided: ' + d.label, 'ok'] : prState(m);
555
- const open = () => openMeetCase(host, r, e);
556
- const status = pr[2] === 'ok' || !pr[2] ? el('span', { class: 'st ' + pr[2], style: 'font-weight:400' }, pr[1])
557
- : el('button', { type: 'button', class: 'st ' + pr[2] + ' lk', style: 'font-weight:400;border:0;background:none;padding:0;text-decoration:underline;cursor:pointer;text-align:left', title: 'Open the options: decide, ask or move', 'data-cv': 'decide', onClick: open }, pr[1]);
558
- return el('div', { class: 'rdet', 'data-cv': 'selected', 'data-cv-sel': m.key },
559
- el('div', { class: 'chips2', style: 'justify-content:space-between' }, el('b', { style: 'font-size:var(--fs-3)' }, m.title), el('span', { class: 'mono dim', style: small }, m.time)),
560
- el('div', { class: 'rr' }, c3ic('target', 'sm'), el('span', null, m.line)),
561
- el('div', { class: 'rr' }, c3ic(pr[0], 'sm'), status,
562
- el('span', { class: 'chips2', style: 'margin-left:auto' }, ...avs(m),
563
- el('button', { type: 'button', class: 'chip2 lk', 'data-cv': 'options', title: 'Options: decide, ask or move', 'aria-label': 'Options for ' + m.title, onClick: open }, c3ic('scale', 'sm')),
564
- r.ctx && r.ctx.ribbon ? el('button', { type: 'button', class: 'chip2 lk', 'data-cv': 'to-cal', title: 'Open in Calendar', 'aria-label': 'Open ' + m.title + ' in Calendar', onClick: () => openDay(todayOf(r), baseId(e) || e.id) }, c3ic('next', 'sm')) : null)));
565
- }
566
- const todayOf = (r) => (r.data && r.data.today) || todayStr();
567
-
568
- /* a day (and a meeting) on the Calendar tab's own instance; if that tab has not mounted yet its instance reads PENDING when it does */
569
- let PENDING = null;
570
- function openDay(date, sel) {
571
- const cal = [...live].find(isCalTab);
572
- if (cal) { cal.sel = sel || null; cal.phase = null; go(cal.host, cal, { view: 'day', date, anim: 'zi' }); }
573
- else PENDING = { date, sel: sel || null };
574
- gotoTab('cal');
575
- }
576
-
577
- /* the selection moves without a read: the classes, the card and the stage are redrawn from the data in hand */
578
- function selectMeeting(host, r, id) { r.sel = id; r.phase = null; refreshSel(host, r); }
579
- function refreshSel(host, r) {
580
- const e = selEvent(r); if (!e) return;
581
- r.root.querySelectorAll('.vb[data-cv-cell]').forEach((b) => { const on = b.dataset.cvCell === e.id; b.classList.toggle('sel', on); b.setAttribute('aria-pressed', String(on)); });
582
- const old = r.root.querySelector('[data-cv="selected"]'); if (old) old.replaceWith(rdetNode(host, r, e));
583
- const st = r.root.querySelector('[data-cv="stage"]'); if (st) { const n = stageNode(host, r); if (n) st.replaceWith(n); }
584
- }
585
-
586
- /* the hover scrub line of the day timeline (mockup line 2176): the time under the pointer and what is there */
587
- function scrubWire(v, timed, end, t0, pph) {
588
- const sc = el('div', { class: 'vsc' }, el('span')); v.appendChild(sc);
589
- const label = (t) => {
590
- const cur = timed.find((e) => t >= timeOf(e.at) && t < end(e));
591
- if (cur) return hhmm(t) + ' · ' + (cur.title || cur.id);
592
- const nx = timed.filter((e) => timeOf(e.at) > t).sort((a, b) => timeOf(a.at) - timeOf(b.at))[0];
593
- return hhmm(t) + ' · free' + (nx ? ' for ' + Math.round((timeOf(nx.at) - t) * 60) + ' min' : '');
594
- };
595
- v.addEventListener('pointermove', (e) => { if (e.pointerType === 'touch') return; const rc = v.getBoundingClientRect(); const y = Math.max(0, Math.min(rc.height, e.clientY - rc.top)); sc.style.top = y + 'px'; sc.firstChild.textContent = label(t0 + y / pph); sc.style.opacity = '1'; });
596
- v.addEventListener('pointerleave', () => { sc.style.opacity = '0'; });
597
- }
598
-
599
- /* ── the stage under a day's cards on the Calendar tab: the mockup's Before, During and After (stageHtml line 2598) ── */
600
-
601
- const autoPhase = (e) => (endH(e) <= nowH() ? 'after' : timeOf(e.at) <= nowH() ? 'during' : 'before');
602
- const IX2 = () => (typeof window !== 'undefined' && window.__c3cal2) || null; // c3-demo-cal2.js (demo only): the After notes, the Week grid, the progress rows
603
- const simOn = () => simState().mode !== 'idle';
604
- const realMode = () => { try { return dock.recordState().mode; } catch { return 'idle'; } };
605
-
606
- /* the Record button of the During and After stages (the mockup's data-a="nlive"). In demo it drives the simulated recorder, which the top bar's
607
- * recording group shows (shell-recording.js). In real mode it records through the note dock, the same recorder as the top bar's Record control:
608
- * Record starts a note linked to this calendar event, Resume continues a paused meeting, Stop asks first. `ev` is the calendar cell's event. */
609
- const asEvent = (ev) => ({ ...ev, id: baseId(ev), start: ev.start || ev.at, end: ev.end || null });
610
- function recordBtn(m, ev, redraw) {
611
- const demo = isDemo(); const on = demo && simOn();
612
- const mode = demo ? 'idle' : realMode();
613
- const label = demo ? (on ? 'Stop' : 'Record') : mode === 'recording' ? 'Stop' : mode === 'paused' ? 'Resume' : 'Record';
614
- const done = () => { if (redraw) setTimeout(redraw, 300); };
615
- const real = async () => {
616
- if (mode === 'recording') await dock.stopNow();
617
- else if (mode === 'paused') await dock.resumeNow();
618
- else if (ev) await dock.recordEvent(asEvent(ev));
619
- done();
620
- };
621
- const title = demo ? (on ? 'Stop and write final notes' : 'Record (a simulation: the demo records nothing)') : mode === 'recording' ? 'Stop and write final notes' : mode === 'paused' ? 'Resume the paused meeting' : 'Record this meeting. Notes stay on this machine.';
622
- const b = c3ib(title, label === 'Stop' ? 'stop' : 'mic', { 'data-cv': 'record', 'aria-label': label,
623
- onClick: () => { if (!demo) { real(); return; } if (simOn()) simDock.stopNow(); else simStart(m.title); } }, 'pri c3cv-rec');
624
- b.append(label);
625
- return b;
626
- }
627
- const liveBody = () => [el('div', { class: 'wave', 'aria-hidden': 'true' }, ...new Array(28).fill(0).map(() => el('i'))),
628
- el('div', { class: 'term', 'data-cv': 'live-text' }, (IX2() && IX2().NOTES.live) || 'Dara: the keys are the real blocker, not the scope.\nYou: then we cut to three flows and keep 24 Oct.\n[highlight] decision: cut to three flows\n[caught] action: Dara confirms sandbox keys'),
629
- el('div', { class: 'chips2 dim mono', style: 'font-size:var(--fs-2)' }, c3ic('lock', 'sm'), 'transcribed on this machine' + (simState().mode === 'paused' ? ' · paused' : ''))];
630
- const avN = (n) => el('span', { class: 'av', title: n }, String(n)[0]);
631
-
632
- /* the After stage's notes card: the mockup's notesView (line 1494). Decisions, actions with owner and due, routing, and who was told what. */
633
- function notesCard(host, r, m) {
634
- const N = isDemo() && IX2() && IX2().NOTES; const redraw = () => refreshSel(host, r);
635
- const head = el('div', { class: 'c3cv-head' }, el('h3', null, c3ic('notes'), 'Notes'), recordBtn(m, selEvent(r), redraw));
636
- if (isDemo() && simOn()) return el('section', { class: 'card', 'data-cv': 'notes' }, head, ...liveBody());
637
- if (!N) return el('section', { class: 'card', 'data-cv': 'notes' }, head, el('div', { class: 'fold', 'data-cv': 'no-notes' }, c3ic('moon', 'sm'), 'No notes, decisions or actions are held for this meeting. Press Record to take them. Notes stay on this machine.'));
638
- const nt = r.nt || (r.nt = { owners: {}, due: {}, logged: {}, diff: false, sent: false });
639
- const sel = (label, opts, val, on) => el('select', { 'aria-label': label, onChange: (e) => on(e.target.value) }, ...opts.map((x) => el('option', { value: x, selected: x === val }, x || 'No owner')));
640
- const small2 = 'font-size:var(--fs-2)';
641
- return el('section', { class: 'card', 'data-cv': 'notes' }, head,
642
- el('div', { class: 'chips2' }, el('b', null, N.title), el('span', { class: 'dim mono', style: small2 }, N.when), ...N.who.map(avN)),
643
- nt.diff ? null : el('div', { class: 'fold w', 'data-cv': 'diff' }, c3ic('alert', 'sm'), N.diff + ' ', el('button', { type: 'button', class: 'link', style: 'background:none;border:0;color:inherit;text-decoration:underline', onClick: () => { nt.diff = true; toast({ text: 'Settled. Nothing outside changed.', timeout: 4200 }); redraw(); } }, 'Settle')),
644
- el('table', { class: 'tbl', 'data-cv': 'decisions' }, el('thead', null, el('tr', null, el('th', null, 'Decision'), el('th', null, 'Rejected'), el('th'))),
645
- el('tbody', null, ...N.decisions.map((d) => el('tr', null, el('td', null, d.t), el('td', { class: 'dim' }, d.rej), el('td', { style: 'text-align:right' },
646
- nt.logged[d.id] ? el('span', { class: 'st ok' }, c3ic('check', 'sm'), 'logged')
647
- : el('button', { type: 'button', class: 'ib sm', 'data-cv': 'log', title: 'Log in the Checkout v2 decision log', 'aria-label': 'Log in the Checkout v2 decision log: ' + d.t, onClick: () => { nt.logged[d.id] = 1; toast({ text: 'Logged in Checkout v2. Demo: nothing was saved.', timeout: 4200 }); redraw(); } }, c3ic('scale', 'sm'))))))),
648
- el('table', { class: 'tbl', 'data-cv': 'actions' }, el('thead', null, el('tr', null, el('th', null, 'Action'), el('th', null, 'Owner'), el('th', null, 'Due'))),
649
- el('tbody', null, ...N.actions.map((a) => el('tr', null, el('td', null, a.t),
650
- el('td', null, sel('Owner', N.owners, nt.owners[a.id] !== undefined ? nt.owners[a.id] : a.o, (v) => { nt.owners[a.id] = v; })),
651
- el('td', null, sel('Due', N.dues, nt.due[a.id] || a.d, (v) => { nt.due[a.id] = v; })))))),
652
- el('div', { class: 'chips2' },
653
- el('button', { type: 'button', class: 'ib pri', style: 'width:auto;padding:0 14px;gap:6px;display:inline-flex;align-items:center', 'data-cv': 'route', disabled: nt.sent,
654
- title: 'Yours go to the Inbox. Others go to To-Do, Waiting For, and show on their card. Demo: nothing is saved.', onClick: () => { nt.sent = true; toast({ text: N.actions.length + ' routed to Work · 0 already existed. Demo: nothing was saved.', timeout: 4200 }); redraw(); } }, c3ic('out'), nt.sent ? 'Routed' : 'Route actions'),
655
- el('span', { class: 'dim mono', style: small2, title: 'Yours go to the Inbox. Others go to To-Do, Waiting For, and show on their card.' }, c3ic('info', 'sm'), 'yours to Inbox · theirs to Waiting For')),
656
- el('div', { class: 'chips2' }, el('span', { class: 'dim mono', style: small2 }, 'told'), ...N.told.map(avN), el('span', { class: 'dim mono', style: small2 }, 'not told'), ...N.notTold.map(avN),
657
- el('span', { class: 'st warn', title: 'The 24 Oct date is now conditional' }, c3ic('alert', 'sm'), N.flag)));
658
- }
659
-
660
- /* Before: "Read first" and "People" draw as the mockup's chips (a file chip, an avatar with what that person owes), when the demo row has that shape */
661
- function prepDetail(x, m) {
662
- if (!m.demo) return x[2];
663
- if (x[1] === 'Read first' && /\.\w{2,4}( · |$)/.test(x[2])) return el('span', { class: 'chips2', style: 'display:inline-flex;flex-wrap:wrap' }, ...x[2].split(' · ').map((f) => el('span', { class: 'chip2' }, c3ic('doc', 'sm'), f)));
664
- if (x[1] === 'People' && (m.att || []).length) {
665
- const owe = {}; String(x[2]).split(' · ').forEach((t) => { const k = /^(\w+) owes (\d+)$/.exec(t); if (k) owe[k[1][0]] = k[2]; });
666
- return el('span', { class: 'chips2', style: 'display:inline-flex;flex-wrap:wrap' }, ...m.att.map((a) => el('span', { class: 'chips2', style: 'display:inline-flex' }, el('span', { class: 'av' }, a), owe[a] ? el('span', { class: 'dim mono', style: 'font-size:var(--fs-1)' }, 'owe ' + owe[a]) : null)));
667
- }
668
- return x[2];
669
- }
670
-
671
- function stageNode(host, r) {
672
- const e = selEvent(r); if (!e) return null;
673
- const m = meetModel(e); const ph = r.phase || autoPhase(e); const key = m.key;
674
- const rd = r.ready || (r.ready = {});
675
- const head = el('section', { class: 'card', 'data-cv': 'stage-head' },
676
- el('div', { style: 'display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap' },
677
- el('span', { class: 'chips2' }, el('b', null, m.title), el('span', { class: 'mono dim', style: small }, hhmm(timeOf(e.at)))),
678
- el('div', { class: 'stg', role: 'group', 'aria-label': 'Meeting stage', 'data-cv': 'phase' },
679
- [['before', 'clip', 'Before'], ['during', 'mic', 'During'], ['after', 'notes', 'After']].map(([k, ic, l]) =>
680
- el('button', { type: 'button', class: 'sgb', 'data-cv-phase': k, 'data-a': 'phase', 'data-k': k, 'aria-pressed': String(ph === k), title: l, onClick: () => { r.phase = k; refreshSel(host, r); } }, c3ic(ic), el('span', null, l))))),
681
- el('div', { class: 'chips2 dim', style: small }, c3ic(prState(m)[0], 'sm'), prState(m)[1], el('button', { type: 'button', class: 'chip2 lk', 'data-cv': 'options', onClick: () => openMeetCase(host, r, e) }, c3ic('scale', 'sm'), 'Decide, ask or move')));
682
- let body;
683
- if (ph === 'before') {
684
- const rows = m.prepRows;
685
- body = el('section', { class: 'card', 'data-cv': 'stage-before' }, el('h3', null, c3ic('spark'), 'Prepared for you ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'automatically, 24 h before')),
686
- rows.length ? rows.map((x, i) => {
687
- const ok = x[3] || !!rd[key + ':' + i];
688
- return el('div', { class: 'chips2', style: 'align-items:flex-start;padding:6px 0;border-bottom:1px solid var(--border)' },
689
- el('span', { class: 'ki', style: 'flex:none;' + (ok ? '' : 'background:var(--accw);color:var(--acc)') }, c3ic(x[0])),
690
- el('div', { style: 'flex:1;min-width:0' }, el('b', { style: 'font-size:var(--fs-3)' }, x[1]), el('div', { class: 'dim', style: 'font-size:var(--fs-3)' }, prepDetail(x, m))),
691
- ok ? el('span', { class: 'st ok', title: 'Prepared' }, c3ic('check', 'sm'))
692
- : el('button', { type: 'button', class: 'ib pri sm', 'data-cv': 'prepready', 'data-a': 'prepready', 'data-k': key, 'aria-label': 'Mark ready: ' + x[1], disabled: !m.demo, title: m.demo ? 'Mark the pre-read ready' : 'Marking a step done needs the calendar memory to take a write. No page route does that yet.',
693
- onClick: () => { rd[key + ':' + i] = true; toast({ text: 'Pre-read marked ready. Send it when you are ready.', timeout: 4200 }); refreshSel(host, r); } }, c3ic('check', 'sm')));
694
- }) : el('div', { class: 'fold' }, c3ic('info', 'sm'), 'No prep is recorded for this meeting. Add steps to its calendar entry and they show here.'));
695
- } else if (ph === 'during') {
696
- const sim = isDemo() && simOn();
697
- body = el('section', { class: 'card', 'data-cv': 'stage-during' },
698
- el('div', { class: 'c3cv-head' }, el('h3', null, c3ic('mic'), 'Live notes'), recordBtn(m, e, () => refreshSel(host, r))),
699
- sim ? liveBody() : el('div', { class: 'fold', 'data-cv': 'live-idle' }, c3ic('mic', 'sm'), realMode() === 'idle' ? 'Press Record. Notes stay on this machine.' : 'A meeting is ' + (realMode() === 'recording' ? 'recording' : 'paused') + '. Use the Record control in the top bar to mark a moment, pause or stop.'));
700
- } else {
701
- const D = m.demo ? [['Note to Priya: 24 Oct is conditional', 'out'], ['Note to design: scope decision', 'out']] : [];
702
- const drafts = el('section', { class: 'card', 'data-cv': 'stage-after' }, el('h3', null, c3ic('spark'), 'Drafted after the meeting'),
703
- D.length ? D.map((d, i) => { const k = key + ':fu' + i; return el('div', { class: 'chips2', style: 'justify-content:space-between' }, el('span', { class: 'chips2' }, c3ic(d[1], 'sm'), d[0]),
704
- rd[k] ? el('span', { class: 'st ok' }, c3ic('check', 'sm'), 'ready') : el('button', { type: 'button', class: 'ib pri sm', 'aria-label': 'Mark ready: ' + d[0], title: 'Mark ready. Nothing is sent.', onClick: () => { rd[k] = true; toast({ text: 'Marked ready. Nothing was sent.', timeout: 4200 }); refreshSel(host, r); } }, c3ic('check', 'sm'))); })
705
- : el('div', { class: 'fold' }, c3ic('moon', 'sm'), 'Nothing is drafted for this meeting yet. Notes taken during it are summarised here.'));
706
- body = el('div', { style: 'display:grid;gap:var(--sp-3)', 'data-cv': 'after' }, notesCard(host, r, m), drafts);
707
- }
708
- return el('div', { 'data-cv': 'stage', style: 'display:grid;gap:var(--sp-3)' }, head, body);
709
- }
710
-
711
- /* ── the page-level hooks: the pulse rows live in the shell (c3-shell.js, c3-plan.js) and are not edited there; they get their press from here ── */
712
-
713
- const PULSEK = { red: 'bad', delayed: 'bad', overdue: 'bad', amber: 'warn', 'at risk': 'warn', green: 'ok', 'on time': 'ok', park: '', 'no plan': '' };
714
- let pulseOn = false;
715
- function pulseA11y(root) {
716
- root.querySelectorAll('[data-c3pg-prow]').forEach((p) => { if (!p.hasAttribute('role')) { p.setAttribute('role', 'button'); p.tabIndex = 0; p.title = 'Show details'; } });
717
- root.querySelectorAll('.pbs > span').forEach((s) => { if (!s.hasAttribute('role')) { s.setAttribute('role', 'button'); s.tabIndex = 0; s.setAttribute('aria-pressed', 'false'); } });
718
- }
719
- function pulseFilter(seg) {
720
- const bar = seg.parentElement; const word = (seg.getAttribute('title') || '').replace(/^\d+\s*/, '').toLowerCase(); const want = PULSEK[word];
721
- const on = seg.getAttribute('aria-pressed') !== 'true';
722
- bar.querySelectorAll(':scope > span').forEach((s) => { s.setAttribute('aria-pressed', String(on && s === seg)); s.style.opacity = on && s !== seg ? '.28' : ''; });
723
- const box = bar.closest('[data-c3pg="pulse"]');
724
- box.querySelectorAll('[data-c3pg-prow]').forEach((p) => { const d = p.querySelector('.dotc'); const k = d ? (d.classList.contains('bad') ? 'bad' : d.classList.contains('warn') ? 'warn' : d.classList.contains('ok') ? 'ok' : '') : ''; p.hidden = on && want !== undefined && k !== want; const x = p.nextElementSibling; if (x && x.classList.contains('xp')) x.hidden = p.hidden; });
725
- }
726
- function installPulse(host) {
727
- const parent = host.parentElement; if (parent) { pulseA11y(parent); new MutationObserver(() => pulseA11y(parent)).observe(parent, { childList: true, subtree: true }); }
728
- if (pulseOn) return; pulseOn = true;
729
- const act = (t) => {
730
- const seg = t.closest && t.closest('[data-c3pg="pulse"] .pbs > span');
731
- if (seg) { pulseFilter(seg); return true; }
732
- return false;
733
- };
734
- document.addEventListener('click', (e) => { if (act(e.target)) e.preventDefault(); });
735
- document.addEventListener('keydown', (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-c3pg="pulse"] .pbs > span') && act(e.target)) e.preventDefault(); });
736
- }
737
-
738
- /* ── the Week page: "Progress and timing" and the time grid (console3 mockup progSVG line 2716, progCard 2739, weekView2 2604, weekListPh 2620) ── */
739
-
740
- const ST2 = { ...ST, done: { l: 'Done', c: 'var(--success)', i: 'check' }, park: { l: 'Parked', c: 'var(--muted-foreground)', i: 'moon' } };
741
- const SEV = { over: 0, late: 1, risk: 2, ok: 3, park: 4, done: 5 };
742
- const ROUTINE_RE = /^(Standup|1:1|Sync$)/i;
743
- const dlab = (s) => { const [, m, d] = ymd(s); return d + ' ' + MN[m - 1]; };
744
-
745
- /** The commitments in a range: the initiatives' promised dates against forecast (from the server's gantt rows), and, in demo, the mockup's dated tasks. */
746
- function commitRows(data) {
747
- const c2 = IX2(); const a = utc(data.range.start); const dn = (s) => Math.round((utc(s) - a) / 864e5); const rows = [];
748
- const today = data.today || todayStr();
749
- for (const g of data.gantt || []) {
750
- let k = (c2 && c2.STAT && c2.STAT[g.id]) || STKEY[g.status]; if (!k || k === 'none') continue;
751
- const due = g.promised || (g.planned && g.planned.end) || (g.forecast && (g.forecast.end || g.forecast.start)); if (!due) continue;
752
- const start = (g.planned && g.planned.start) || (g.forecast && g.forecast.start) || due; const fc = (g.forecast && (g.forecast.end || g.forecast.start)) || due;
753
- const why = (g.pulse && g.pulse.why) || (g.title || g.id) + ': ' + g.status;
754
- rows.push({ id: g.id, n: g.title || g.id, kind: 'init', start: dn(start), due: dn(due), fc: dn(fc), dueS: due, fcS: fc, pct: c2 && c2.PCT && c2.PCT[g.id] != null ? c2.PCT[g.id] : null, st: k, why, late: g.slip_days });
755
- }
756
- if (c2) for (const t of c2.TASKS || []) rows.push({ id: t.id, n: t.n, kind: 'task', due: dn(t.due), dueS: t.due, st: t.st, why: t.why, late: t.late });
757
- rows.todayN = dn(today);
758
- return rows;
759
- }
760
- const statTxt = (c, todayN) => (c.st === 'over' ? 'Overdue ' + (c.late || todayN - c.due) + ' d' : c.st === 'late' ? 'Delayed +' + (c.fc - c.due) + ' d' : ST2[c.st].l);
761
-
762
- /* "Progress and timing": a row per commitment, its bar from start to promise, how far it is, where it should be today, and the forecast past the promise */
763
- function progressCard(data, r, host) {
764
- const week = r.view === 'week'; const a = 0; const N = week ? 5 : Math.round((utc(data.range.end) - utc(data.range.start)) / 864e5) + 1; const b = N - 1;
765
- const all = commitRows(data); const td = all.todayN;
766
- const R = all.filter((c) => { const lo = c.kind === 'init' ? c.start : c.due; const hi = Math.max(c.due, c.fc || c.due); if (c.st === 'over' && b >= td && a <= td) return true; return hi >= a && lo <= b; })
767
- .sort((x, y) => SEV[x.st] - SEV[y.st] || x.due - y.due).slice(0, week ? 9 : 10);
768
- const head = el('h3', null, c3ic('target'), 'Progress and timing ', el('span', { class: 'dim', style: 'text-transform:none;letter-spacing:0' }, 'when things land, and whether they will'));
769
- if (!R.length) return el('section', { class: 'card', 'data-cv': 'progress' }, head, el('div', { class: 'fold' }, c3ic('moon', 'sm'), data.events_source === 'none' || !(data.gantt || []).length ? 'No initiative or task has a date in this range.' : 'Nothing falls due in this range, and no initiative runs through it.'));
770
- const W = 720; const LW = 150; const SW = 104; const CW = W - LW - SW; const dw = CW / N; const rh = 30; const top = 28; const H = top + R.length * rh + 8;
771
- const Xl = (n) => LW + (n - a) * dw; const Xc = (n) => Xl(n) + dw / 2;
772
- const s = svg('svg', { class: 'pg', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Progress of commitments: on time, at risk, delayed and overdue' });
773
- const clipId = 'pgc' + r.view + data.range.start;
774
- s.appendChild(svg('defs', {}, svg('clipPath', { id: clipId }, svg('rect', { x: LW, y: 18, width: CW, height: H - 18 }))));
775
- for (let n = a; n <= b; n++) {
776
- const t = new Date(utc(data.range.start) + n * 864e5); const w = t.getUTCDay(); const d = t.getUTCDate();
777
- if (week) { s.appendChild(text(Xc(n), 14, DN[w] + ' ' + d, { 'text-anchor': 'middle', class: n === td ? 't' : '' })); if (n > a) s.appendChild(svg('line', { x1: Xl(n), x2: Xl(n), y1: 20, y2: H - 4, stroke: 'var(--border)' })); }
778
- else if (w === 1) { s.appendChild(svg('line', { x1: Xl(n), x2: Xl(n), y1: 18, y2: H - 4, stroke: 'var(--border)' })); s.appendChild(text(Xl(n) + 3, 14, String(d))); }
779
- }
780
- if (td >= a && td <= b) {
781
- const now = new Date(); const tx = Xl(td) + dw * Math.max(0, Math.min(1, (now.getHours() + now.getMinutes() / 60 - 8) / 10));
782
- s.appendChild(svg('rect', { x: Xl(td), y: 20, width: dw, height: H - 24, fill: 'var(--accw)', rx: 6 })); s.appendChild(svg('line', { x1: tx, x2: tx, y1: 20, y2: H - 4, stroke: 'var(--foreground)', 'stroke-width': 2 }));
783
- }
784
- let anyPct = false;
785
- R.forEach((c, i) => {
786
- const y = top + i * rh; const cy = y + rh / 2; const S = ST2[c.st]; const nm = c.n.length > 17 ? c.n.slice(0, 16) + '…' : c.n; const dim = c.st === 'done' || c.st === 'park';
787
- const go = c.kind === 'init' && !isPhoneR(r);
788
- const g = svg('g', { opacity: dim ? '.6' : '1', class: 'pgrow', 'data-cv-prog': c.id, 'data-status': c.st, ...(go ? { role: 'button', tabindex: '0', 'data-a': 'goinit', 'data-k': c.id, 'aria-label': 'Open ' + c.n + ': ' + statTxt(c, td) } : {}), ...(go ? { style: 'cursor:pointer' } : {}) });
789
- g.appendChild(text(0, cy + 4, nm, { class: 't' }));
790
- if (c.kind === 'init') {
791
- const xs = Xl(c.start); const xe = Xc(c.due); const ex = Math.max(0, Math.min(1, (td - c.start) / Math.max(1, c.due - c.start))); const xt = xs + (xe - xs) * ex;
792
- const have = c.pct != null; if (have) anyPct = true; const xf = xs + (xe - xs) * (have ? c.pct : 0);
793
- const clip = svg('g', { 'clip-path': `url(#${clipId})` });
794
- clip.appendChild(svg('rect', { x: xs, y: cy - 5, width: Math.max(2, xe - xs), height: 10, rx: 5, fill: S.c, 'fill-opacity': have ? '.2' : '.35' }));
795
- if (have) clip.appendChild(svg('rect', { x: xs, y: cy - 5, width: Math.max(2, xf - xs), height: 10, rx: 5, fill: S.c }));
796
- if (c.st !== 'park') clip.appendChild(svg('line', { x1: xt, x2: xt, y1: cy - 9, y2: cy + 9, stroke: 'var(--foreground)', 'stroke-width': 2 }));
797
- if (c.fc > c.due) { clip.appendChild(svg('rect', { x: xe, y: cy - 2.5, width: Xc(c.fc) - xe, height: 5, rx: 2.5, fill: 'var(--destructive)', 'fill-opacity': '.6' })); clip.appendChild(svg('circle', { cx: Xc(c.fc), cy, r: 6, fill: 'var(--destructive)', stroke: 'var(--card)', 'stroke-width': 2 })); }
798
- clip.appendChild(svg('path', { d: `M${xe} ${cy - 9} l8 9 -8 9 -8 -9z`, fill: 'var(--card)', stroke: S.c, 'stroke-width': 2 }));
799
- g.appendChild(clip);
800
- if (c.due > b) g.appendChild(text(Xl(b + 1) - 4, cy - 12, 'due ' + dlab(c.dueS) + (c.fc > c.due ? ' → ' + dlab(c.fcS) : ''), { 'text-anchor': 'end', style: 'font-size:var(--fs-1)' }));
801
- } else {
802
- if (c.st === 'over') g.appendChild(svg('line', { x1: Xc(Math.max(a, c.due)), x2: Xc(Math.min(b, td)), y1: cy, y2: cy, stroke: 'var(--destructive)', 'stroke-width': 3, 'stroke-dasharray': '5 4', 'stroke-linecap': 'round' }));
803
- if (c.due >= a && c.due <= b) {
804
- if (c.st === 'done') { g.appendChild(svg('circle', { cx: Xc(c.due), cy, r: 8, fill: 'var(--success)', 'fill-opacity': '.18' })); g.appendChild(svg('path', { d: `M${Xc(c.due) - 4} ${cy} l3 3 5 -6`, fill: 'none', stroke: 'var(--success)', 'stroke-width': 2, 'stroke-linecap': 'round' })); }
805
- else g.appendChild(svg('path', { d: `M${Xc(c.due)} ${cy - 8} l7 8 -7 8 -7 -8z`, fill: c.st === 'over' ? S.c : 'var(--card)', stroke: S.c, 'stroke-width': 2 }));
806
- }
807
- }
808
- g.appendChild(text(W - SW + 10, cy + 4, statTxt(c, td), { style: 'fill:' + S.c + ';font-weight:500' }));
809
- const tt = svg('title', {}); tt.textContent = c.why; g.appendChild(tt);
810
- g.insertBefore(svg('rect', { x: 0, y, width: W, height: rh, fill: 'transparent' }), g.firstChild);
811
- if (go) { const open = () => { if (!goInitiative(c.id)) openInit(host, r, c.id, c.n); }; g.addEventListener('click', open); g.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); open(); } }); }
812
- s.appendChild(g);
813
- });
814
- const cut = all.filter((c) => c.kind === 'init').length;
815
- return el('section', { class: 'card', 'data-cv': 'progress' }, head, s,
816
- isPhoneR(r) ? phoneRows(data.gantt.filter((g) => STKEY[g.status] && STKEY[g.status] !== 'none').slice(0, 10), r, host) : null,
817
- el('div', { class: 'pgl' }, el('span', null, '◇ due'), el('span', { style: 'color:var(--destructive)' }, '● forecast'), anyPct ? el('span', null, '▬ actual progress') : null, el('span', null, '| where it should be today'), el('span', { style: 'color:var(--destructive)' }, '┅ overdue'),
818
- el('span', { style: 'color:var(--success)' }, '■ on time'), el('span', { style: 'color:var(--warning)' }, '■ at risk'), el('span', { style: 'color:var(--destructive)' }, '■ delayed')),
819
- !anyPct && cut ? el('div', { class: 'dim mono', style: small, 'data-cv': 'no-pct' }, 'How far each initiative is done is not recorded, so the bars show the plan, the promise and the forecast only.') : null);
820
- }
821
-
822
- /* the days of the week page, Monday to Friday: meetings (start, end, title, routine, hot), markers, hours and the hours tied to a promise */
823
- function gridDays(data) {
824
- const c2 = IX2(); const out = [];
825
- for (let i = 0; i < 5; i++) {
826
- const date = shift('day', data.range.start, i);
827
- let ms; let mk;
828
- if (c2) { const d = c2.day(date); ms = d.ms; mk = d.mk; }
829
- else {
830
- const cell = (data.cells || []).find((c) => c.start === date); const ev = cell ? cell.events : [];
831
- ms = ev.filter((e) => e.kind !== 'milestone' && timeOf(e.at) !== null).map((e) => ({ id: e.id, s: timeOf(e.at), e: endH(e), t: e.title || e.id, rt: !!(e.routine || e.mock_routine || ROUTINE_RE.test(e.title || '')), hot: !!e.mock_hot }));
832
- mk = ev.filter((e) => e.kind === 'milestone').map((e) => [markOf(e.title), e.title]).filter((x) => x[0]);
833
- }
834
- ms = ms.slice().sort((x, y) => x.s - y.s);
835
- const v = ms.reduce((t, q) => t + q.e - q.s, 0); const lk = ms.reduce((t, q) => (q.rt ? t : t + q.e - q.s), 0);
836
- out.push({ date, dn: DN[dowOf(date)] + ' ' + Number(date.slice(8)), ms, mk, v, lk });
837
- }
838
- return out;
839
- }
840
- const rd1 = (x) => Math.round(x * 10) / 10;
841
- const MK2 = { ...MKS, risk: ['▲', 'var(--destructive)'], forecast: ['●', 'var(--warning)'] };
842
-
843
- function weekGrid(data, r, host) {
844
- const days = gridDays(data); const today = data.today || todayStr();
845
- const all = days.flatMap((d) => d.ms); const t0 = Math.min(8, ...all.map((q) => Math.floor(q.s))); const t1 = Math.max(18, ...all.map((q) => Math.ceil(q.e)));
846
- const W = 760; const x0 = 44; const cw = 142; const top = 66; const ph = 38; const rows = t1 - t0; const H = top + rows * ph + 14; const X = (i) => x0 + i * cw; const Yt = (t) => top + (t - t0) * ph;
847
- const s = svg('svg', { class: 'chart md hide-ph', viewBox: `0 0 ${W} ${H}`, role: 'img', 'aria-label': 'Meetings this week. Blue is tied to a promise or decision, grey is routine, dashed purple is a focus window.' });
848
- for (let t = t0; t <= t1; t += 2) { s.appendChild(svg('line', { x1: x0, x2: x0 + 5 * cw, y1: Yt(t), y2: Yt(t), stroke: 'var(--border)' })); s.appendChild(text(x0 - 6, Yt(t) + 4, hhmm(t), { 'text-anchor': 'end' })); }
849
- const now = new Date(); const nh = Math.max(t0, Math.min(t1, now.getHours() + now.getMinutes() / 60));
850
- days.forEach((d, i) => {
851
- const isT = d.date === today; const bw = cw - 16;
852
- if (isT) s.appendChild(svg('rect', { x: X(i), y: top - 44, width: cw, height: rows * ph + 44, fill: 'var(--accw)', rx: 8 }));
853
- s.appendChild(text(X(i) + 8, top - 32, d.dn, { class: 't', style: small })); s.appendChild(text(X(i) + cw - 8, top - 32, rd1(d.v) + ' h', { 'text-anchor': 'end' }));
854
- s.appendChild(svg('rect', { x: X(i) + 8, y: top - 26, width: bw, height: 5, rx: 2.5, fill: 'var(--muted)' }));
855
- s.appendChild(svg('rect', { x: X(i) + 8, y: top - 26, width: Math.min(bw, d.v / 6 * bw), height: 5, rx: 2.5, fill: 'var(--ring)', opacity: '.6' }));
856
- s.appendChild(svg('rect', { x: X(i) + 8, y: top - 26, width: Math.min(bw, d.lk / 6 * bw), height: 5, rx: 2.5, fill: 'var(--acc)' }));
857
- d.mk.forEach((q, k) => { const g = MK2[q[0]] || MK2.report; const n = svg('g', {}, text(X(i) + 8 + k * 16, top - 6, g[0], { style: 'font-size:var(--fs-4);fill:' + g[1] })); const t = svg('title', {}); t.textContent = q[1]; n.appendChild(t); s.appendChild(n); });
858
- let prev = 9; // a focus window: a gap of an hour and a half or more between meetings, from 09:00 to 17:30
859
- d.ms.concat([{ s: 17.5, e: 17.5 }]).forEach((q) => {
860
- if (q.s - prev >= 1.5) { const g = svg('g', {}, svg('rect', { x: X(i) + 4, y: Yt(prev) + 2, width: cw - 8, height: (q.s - prev) * ph - 4, rx: 6, fill: 'var(--purple)', 'fill-opacity': '.07', stroke: 'var(--purple)', 'stroke-dasharray': '4 4' }), text(X(i) + cw / 2, Yt(prev) + (q.s - prev) * ph / 2 + 4, rd1(q.s - prev) + ' h focus', { 'text-anchor': 'middle', style: 'fill:var(--purple)' })); s.appendChild(g); }
861
- prev = Math.max(prev, q.e);
862
- });
863
- d.ms.forEach((q, k) => {
864
- const nm = q.t.length > 17 ? q.t.slice(0, 16) + '…' : q.t; const done = r.done && q.id && r.done[baseId({ id: q.id })];
865
- const open = () => openDay(d.date, q.id || null);
866
- const g = svg('g', { class: 'wb', role: 'button', tabindex: '0', 'data-a': 'calblk', 'data-k': Number(d.date.slice(8)) + '|' + (q.id || ''), 'data-cv-block': q.id || d.date, 'aria-label': q.t + ', ' + d.dn + ' ' + hhmm(q.s) + '. Open the day.', style: 'cursor:pointer' },
867
- svg('rect', { class: 'grow', style: `animation-delay:${i * 60 + k * 30}ms`, x: X(i) + 4, y: Yt(q.s), width: cw - 8, height: (q.e - q.s) * ph - 2, rx: 6, fill: q.hot ? 'var(--destructive)' : q.rt ? 'var(--ring)' : 'var(--acc)', 'fill-opacity': q.rt ? '.5' : '.88', ...(done && done.id === 'skip' ? { 'stroke-dasharray': '4 3', stroke: 'var(--ring)' } : {}) }),
868
- text(X(i) + 11, Yt(q.s) + 15, nm, { style: 'fill:' + (q.rt ? 'var(--foreground)' : '#fff') + ';font-size:var(--fs-2)' }));
869
- const t = svg('title', {}); t.textContent = q.t + ' ' + hhmm(q.s); g.appendChild(t);
870
- g.addEventListener('click', open); g.addEventListener('keydown', (ev) => { if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); open(); } });
871
- s.appendChild(g);
872
- });
873
- if (isT) s.appendChild(svg('line', { x1: X(i), x2: X(i) + cw, y1: Yt(nh), y2: Yt(nh), stroke: 'var(--foreground)', 'stroke-width': 2 }));
874
- });
875
- const list = el('ul', { class: 'list', style: 'margin:0' }, ...days.map((d) => el('li', { class: 'nrow', 'data-a': 'calblk', style: 'grid-template-columns:auto minmax(0,1fr);cursor:pointer;padding-inline:8px', role: 'button', tabindex: '0', onClick: () => openDay(d.date, null), onKeydown: (ev) => { if (ev.key === 'Enter') openDay(d.date, null); } },
876
- el('span', { class: 'ki mono', style: 'width:auto;padding:0 8px;' + small }, d.dn),
877
- el('div', { class: 'nb' }, el('div', { class: 'lbar' }, el('i', { style: `width:${d.lk / 6 * 100}%;background:var(--acc)` }), el('i', { style: `width:${(d.v - d.lk) / 6 * 100}%;background:var(--ring)` }), el('i', { style: 'flex:1;background:var(--muted)' })),
878
- el('div', { class: 'chips2 dim mono', style: small }, rd1(d.v) + ' h' + d.mk.map((q) => ' · ' + (MK2[q[0]] || MK2.report)[0] + ' ' + q[1]).join(''))))));
879
- if (!all.length && !days.some((d) => d.mk.length)) return el('section', { class: 'card', 'data-cv': 'week-grid' }, el('div', { class: 'fold', 'data-cv': 'no-events' }, c3ic('moon', 'sm'), data.events_source === 'none' ? 'No calendar is cached yet, so there are no meetings to draw.' : 'Nothing is scheduled this week.'));
880
- return el('section', { class: 'card', 'data-cv': 'week-grid' }, s, el('div', { class: 'show-ph' }, list),
881
- el('div', { class: 'legend' }, el('span', { style: 'color:var(--acc)' }, '■ tied to a promise or decision'), el('span', null, '■ routine'), el('span', { style: 'color:var(--purple)' }, '▭ focus window'), el('span', null, '◆ release'), el('span', null, '◇ promise'), el('span', null, '▪ report')));
882
- }
883
-
884
- /* the line above the week: the heaviest day, and how many meeting hours are tied to a promise or a decision (the mockup's lensInfo, line 2367) */
885
- function weekHead(data) {
886
- const days = gridDays(data); const tot = days.reduce((t, d) => t + d.v, 0); const lk = days.reduce((t, d) => t + d.lk, 0);
887
- if (!tot) return lensHead(data);
888
- const hv = days.reduce((m, d) => (d.v > m.v ? d : m), days[0]);
889
- return el('div', { class: 'lh' }, el('span', { class: 'ki' }, c3ic('cal')), el('div', { style: 'min-width:0' }, el('b', null, hv.dn.split(' ')[0] + ' is the heaviest day: ' + rd1(hv.v) + ' h of meetings'),
890
- el('div', { class: 'dim' }, Math.round(lk) + ' of ' + Math.round(tot) + ' h are tied to a promise or a decision. The rest is routine.')), c3ring(Math.round(lk), Math.max(1, Math.round(tot)), 44));
891
- }
892
-
893
- /* ── the page ───────────────────────────────────────────────────────────────────────────────────────────────────── */
894
-
895
- function draw(host, r) {
896
- if (r.ctx && r.ctx.ribbon) { r.root.replaceChildren(ribbonCard(host, r)); if (!r.loading) r.anim = null; return; }
897
- if (r.ctx && r.ctx.page) { disposeStrategy(r.root); r.root.replaceChildren(drawCalendarPage(host, r, PAGE)); if (!r.loading) r.anim = null; return; } // the Calendar tab (c3-calendar.js): no deck, no due list, no strategy lens
898
- const phone = r.root.classList.contains('ph');
899
- const head = bar(host, r, phone);
900
- let body;
901
- if (r.error) body = el('p', { class: 'dim mono', style: small, role: 'status', 'data-cv': 'error' }, 'The calendar could not be read: ' + r.error);
902
- else if (!r.data) body = el('p', { class: 'dim mono', style: small, role: 'status', 'data-cv': 'loading' }, 'Reading the repository');
903
- else {
904
- const d = r.data;
905
- const strat = strategy(d);
906
- const c = r.ctx || {};
907
- // The mockup's day page (vCal, line 2648): the deck and the due list on the left, the timeline on the right. Other zooms stack.
908
- const two = d.unit === 'day' && c.plan;
909
- const week = c.plan && r.view === 'week' && d.unit === 'day';
910
- const kids = week ? [weekHead(d), el('div', { class: 'brief sbb' }, el('div', { class: 'bcols' }, el('div', { class: 'bcol l' }, c.plan, progressCard(d, r, host)),
911
- el('div', { class: 'bcol r' }, el('section', { class: 'card', 'data-cv': 'glance' }, el('h3', null, c3ic('cal'), 'The week at a glance'), weekStrip(r, host)))), weekGrid(d, r, host)), strat]
912
- : two
913
- ? [lensHead(d), el('div', { class: 'brief sbb' }, el('div', { class: 'bcols' }, el('div', { class: 'bcol l' }, c.plan, r.view === 'day' ? (c.due || null) : null, c.plan && r.view === 'day' ? stageNode(host, r) : null, r.view === 'month' ? progressCard(d, r, host) : null), el('div', { class: 'bcol r' }, events(d, r, host)))), r.view === 'day' || r.view === 'month' ? null : gantt(d, r, host), strat]
914
- : [lensHead(d), c.plan || null, events(d, r, host), gantt(d, r, host), strat];
915
- // the mockup's Quarter and Year are the strategy lens, two different panes (c3-cal-strategy.js); they replace the day-part deck, the list and the gantt
916
- const qy = isC3(r) && (r.view === 'quarter' || r.view === 'year') ? (r.view === 'quarter' ? mountQuarter : mountYear)(el('div', { 'data-cv': 'strategy-pane' }), { data: d, today: d.today, goInit: (id, t) => { if (!goInitiative(id)) openInit(host, r, id, t); } }) : null;
917
- body = el('div', { class: 'calbody' + (r.anim && !r.loading ? ' ' + r.anim : '') }, ...(qy ? [qy] : kids));
918
- if (!r.loading) r.anim = null;
919
- }
920
- disposeStrategy(r.root);
921
- r.root.replaceChildren(head, body);
922
- }
923
-
924
- /* What the Calendar page (c3-calendar.js) reuses from this file: the zoom bar with the Today chip, the reads and the date helpers. */
925
- const PAGE = { bar, go: (host, r, change) => go(host, r, change), redraw: (host, r) => draw(host, r), shift, dayLabel, timeOf, endH, hhmm, baseId, dowOf, MN, DN,
926
- gotoTab, goInitiative, openInit };
927
-
928
- /* Change the view or the date and read again. anim names the mockup's transition (.zi, .zo, .sn, .sp, console3.css). */
929
- function go(host, r, change) {
930
- if (change.view) r.view = change.view;
931
- if (change.zoom) r.zoom = change.zoom;
932
- if (change.date) r.date = change.date;
933
- r.anim = change.anim || null;
934
- load(host, r);
935
- }
936
-
937
- async function load(host, r) {
938
- const seq = (r.seq = (r.seq || 0) + 1);
939
- r.loading = true; r.error = null; draw(host, r);
940
- try {
941
- const d = await pmGet(`/api/calendar-views?view=${encodeURIComponent(r.view)}&date=${encodeURIComponent(r.date)}` + (r.ctx && r.ctx.scope ? '&scope=' + encodeURIComponent(r.ctx.scope) : ''));
942
- if (seq !== r.seq || !roots.has(host)) return;
943
- if (!d || d.ok === false) throw new Error((d && d.error) || 'unreadable');
944
- r.data = d; r.data2 = null;
945
- if (r.ctx && r.ctx.ribbon && r.view === 'week') { const d2 = await pmGet(`/api/calendar-views?view=week&date=${encodeURIComponent(shift('week', r.date, 1))}` + (r.ctx.scope ? '&scope=' + encodeURIComponent(r.ctx.scope) : '')).catch(() => null); if (seq !== r.seq || !roots.has(host)) return; r.data2 = d2 && d2.ok !== false ? d2 : null; }
946
- } catch (e) {
947
- if (seq !== r.seq || !roots.has(host)) return;
948
- r.error = String((e && e.message) || e); r.data = null;
949
- }
950
- r.loading = false; draw(host, r);
951
- }
952
-
953
- /* The mockup's calendar gestures (lines 2640 to 2700): a sideways swipe of more than 80px, a pinch and Ctrl or Cmd with the wheel step the zoom or the
954
- * period; + and - zoom; t goes to today; the arrows step. The mockup binds the keys on the document, so they work without focus inside the view.
955
- * The Briefing's ribbon has no period to step: it takes + and - and the wheel only. */
956
- function wire(host, r) {
957
- const root = r.root; let s = null; let sup = false; let supT = null; const pts = {}; let pinch = null; let wt = 0;
958
- const rib = !!(r.ctx && r.ctx.ribbon);
959
- const zoomBy = (k) => { // k < 0 zooms in (toward the day), k > 0 out
960
- const L = rib ? RIB : VIEWS; const i = L.findIndex((v) => v[0] === (rib ? r.zoom : r.view)); const j = i + k;
961
- if (i < 0 || j < 0 || j >= L.length) return false;
962
- go(host, r, rib ? { view: L[j][2], zoom: L[j][0], anim: k < 0 ? 'zi' : 'zo' } : { view: L[j][0], anim: k < 0 ? 'zi' : 'zo' }); return true;
963
- };
964
- const hush = () => { sup = true; clearTimeout(supT); supT = setTimeout(() => { sup = false; }, 90); };
965
- root.addEventListener('pointerdown', (e) => {
966
- if (rib || e.target.closest('.slt,select,input,textarea,.fc.back')) { s = null; return; }
967
- pts[e.pointerId] = [e.clientX, e.clientY]; const ids = Object.keys(pts);
968
- if (ids.length === 2) { pinch = Math.hypot(pts[ids[0]][0] - pts[ids[1]][0], pts[ids[0]][1] - pts[ids[1]][1]); s = null; return; }
969
- s = { x: e.clientX, y: e.clientY };
970
- });
971
- root.addEventListener('pointermove', (e) => {
972
- if (!pinch || !pts[e.pointerId]) return; pts[e.pointerId] = [e.clientX, e.clientY]; const ids = Object.keys(pts); if (ids.length < 2) return;
973
- const d = Math.hypot(pts[ids[0]][0] - pts[ids[1]][0], pts[ids[0]][1] - pts[ids[1]][1]); const q = d / pinch;
974
- if (q > 1.3 || q < 0.75) { pinch = d; zoomBy(q > 1.3 ? -1 : 1); }
975
- });
976
- const up = (e) => {
977
- delete pts[e.pointerId]; if (Object.keys(pts).length) return; pinch = null;
978
- if (!s) return; const dx = e.clientX - s.x; const dy = e.clientY - s.y; s = null;
979
- if (r.page && r.page.mode === 'notes') return;
980
- if (Math.abs(dx) > 80 && Math.abs(dy) < 45) { hush(); go(host, r, { date: shift(r.view, r.date, dx < 0 ? 1 : -1), anim: dx < 0 ? 'sn' : 'sp' }); }
981
- };
982
- root.addEventListener('pointerup', up); root.addEventListener('pointercancel', (e) => { delete pts[e.pointerId]; s = null; pinch = null; });
983
- root.addEventListener('click', (e) => { if (sup) { sup = false; e.stopPropagation(); e.preventDefault(); } }, true);
984
- root.addEventListener('wheel', (e) => {
985
- if (!(e.ctrlKey || e.metaKey) || (r.page && r.page.mode === 'notes')) return; e.preventDefault(); const n = Date.now(); if (n - wt < 350) return; wt = n; zoomBy(e.deltaY > 0 ? 1 : -1);
986
- }, { passive: false });
987
- const onKey = (e) => {
988
- if (e.metaKey || e.ctrlKey || e.altKey || e.defaultPrevented) return;
989
- if (!root.isConnected || !root.offsetParent) return; // another tab is showing
990
- const t = e.target; if (t && t.closest && t.closest('input,select,textarea,[contenteditable="true"]')) return;
991
- if (document.querySelector('[data-shell="sheet"]')) return; // a sheet is open
992
- if (!root.closest('[data-shell="calpop"]') && document.querySelector('[data-shell="calpop"]')) return; // the calendar popup is open: it takes the keys, not the tab behind it
993
- if (r.page && r.page.mode === 'notes') return; // Calendar › Notes has no zoom or period to step
994
- if ((e.key === '+' || e.key === '=') && zoomBy(-1)) e.preventDefault();
995
- else if ((e.key === '-' || e.key === '_') && zoomBy(1)) e.preventDefault();
996
- else if (rib) return;
997
- else if (e.key === 't' && r.date !== todayStr()) go(host, r, { date: todayStr(), anim: r.date > todayStr() ? 'sp' : 'sn' });
998
- else if ((e.key === 'ArrowRight' || e.key === 'ArrowLeft') && !(t && t.closest && t.closest('.fc'))) { e.preventDefault(); go(host, r, { date: shift(r.view, r.date, e.key === 'ArrowRight' ? 1 : -1), anim: e.key === 'ArrowRight' ? 'sn' : 'sp' }); }
999
- };
1000
- document.addEventListener('keydown', onKey);
1001
- r.off = () => { document.removeEventListener('keydown', onKey); clearTimeout(supT); };
1002
- }
1003
-
1004
- /* the Record chip (shell-recording.js) asks for the note being recorded: Calendar › Notes on the During stage of the Calendar tab's
1005
- * instance; if that tab has not mounted yet, its instance opens the note when it does */
1006
- let PENDING_NOTE = null;
1007
- if (typeof window !== 'undefined') window.addEventListener('c3-open-note', (ev) => {
1008
- const id = (ev.detail && ev.detail.id) || null;
1009
- const cal = [...live].find((x) => isCalTab(x) && x.ctx.page);
1010
- if (cal) { showNote(cal, id, 'during'); draw(cal.host, cal); } else PENDING_NOTE = { id };
1011
- gotoTab('cal');
1012
- });
1013
-
1014
- /* the simulated recorder (shell-recording.js, demo only): a start, a stop or a pause redraws the stage under the day's cards, and the group's title opens the During stage */
1015
- let simOnWin = false;
1016
- function installSim() {
1017
- if (simOnWin || typeof window === 'undefined') return; simOnWin = true;
1018
- const calInst = () => [...live].filter((x) => isCalTab(x) && x.root.isConnected);
1019
- window.addEventListener('c3-sim-rec', () => calInst().forEach((x) => { if (selEvent(x)) refreshSel(x.host, x); }));
1020
- window.addEventListener('c3-sim-open', () => { gotoTab('cal'); calInst().forEach((x) => { if (x.view !== 'day') x.view = 'day'; x.phase = 'during'; if (x.data && x.data.unit === 'day' && x.data.range.start === x.data.range.end) refreshSel(x.host, x); else go(x.host, x, { view: 'day', date: todayOf(x) }); }); });
1021
- }
1022
-
1023
- export function mountCalendarViews(host, ctx) {
1024
- if (!host) return;
1025
- ensureC3Css();
1026
- let r = roots.get(host);
1027
- if (!r) {
1028
- r = { ctx: ctx || {}, root: el('section', { class: 'c3 calwrap', 'data-board': 'calendar-views', 'aria-label': 'Calendar' }), view: (ctx && ctx.view) || 'week', zoom: (ctx && ctx.view === 'day') ? 'today' : (ctx && ctx.view) || 'week', date: todayStr(), data: null, error: null, host, done: {}, ready: {}, sel: null, phase: null };
1029
- if (PENDING && ctx && ctx.plan) { r.sel = PENDING.sel; if (PENDING.date) r.date = PENDING.date; PENDING = null; }
1030
- if (PENDING_NOTE && isCalTab(r)) { showNote(r, PENDING_NOTE.id, 'during'); PENDING_NOTE = null; }
1031
- live.add(r);
1032
- r.stopPhone = c3Phone(r.root);
1033
- roots.set(host, r);
1034
- wire(host, r);
1035
- if (ctx && ctx.ribbon) installPulse(host);
1036
- installSim();
1037
- host.replaceChildren(r.root);
1038
- load(host, r);
1039
- return;
1040
- }
1041
- if (!r.root.isConnected) host.replaceChildren(r.root);
1042
- }
1043
-
1044
- export function disposeCalendarViews(host) {
1045
- const r = roots.get(host);
1046
- if (r && r.stopPhone) r.stopPhone();
1047
- if (r) { live.delete(r); if (r.off) r.off(); }
1048
- roots.delete(host);
1049
- }