create-pmos 0.441.0 → 0.443.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 (87) hide show
  1. package/package.json +25 -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/adler-seasons-art-test.js +106 -0
  7. package/workspace/adler-seasons-test.js +111 -0
  8. package/workspace/briefing-premium-board-test.js +19 -17
  9. package/workspace/briefing-premium-initiative-test.js +7 -4
  10. package/workspace/changelog.json +24 -0
  11. package/workspace/goals-clear-ui-test.js +249 -0
  12. package/workspace/guide/adler.md +10 -0
  13. package/workspace/guide/home.md +8 -1
  14. package/workspace/guide/metric-drafts.md +8 -2
  15. package/workspace/home-railcard-test.js +193 -0
  16. package/workspace/ini-workflow-test.js +6 -2
  17. package/workspace/intelligence-gaps-ui-test.js +16 -14
  18. package/workspace/lib/engine/records/index.js +9 -2
  19. package/workspace/lib/initiative-layout.js +3 -1
  20. package/workspace/lib/insights-premium.js +22 -1
  21. package/workspace/lib/metric-drafts.js +37 -10
  22. package/workspace/lib/metric-read-runs.js +20 -13
  23. package/workspace/lib/metric-reads.js +208 -23
  24. package/workspace/lib/metrics-cli.js +62 -5
  25. package/workspace/lib/routes-goal-status.js +89 -6
  26. package/workspace/lib/routes-insights-premium.js +1 -1
  27. package/workspace/lib/routes-metric-drafts.js +26 -3
  28. package/workspace/lib/settings-store.js +38 -0
  29. package/workspace/metric-drafts-ui-test.js +7 -4
  30. package/workspace/okr-goals-ui-test.js +7 -5
  31. package/workspace/package-lock.json +2 -2
  32. package/workspace/package.json +1 -1
  33. package/workspace/premium-board-actions-test.js +2 -1
  34. package/workspace/premium-chat-attach-test.js +2 -0
  35. package/workspace/program-panel-test.js +1 -1
  36. package/workspace/public/pm/bd-ini-panel.js +2 -2
  37. package/workspace/public/pm/c3-ini-ui.js +1 -1
  38. package/workspace/public/pm/cozy-adler.css +21 -0
  39. package/workspace/public/pm/cozy-adler.js +415 -8
  40. package/workspace/public/pm/cozy-ev.css +16 -1
  41. package/workspace/public/pm/cozy-home.css +8 -0
  42. package/workspace/public/pm/cozy-insights.css +82 -0
  43. package/workspace/public/pm/cozy-live-pill.css +5 -0
  44. package/workspace/public/pm/cozy-news.js +1 -1
  45. package/workspace/public/pm/cozy-seasons.js +318 -0
  46. package/workspace/public/pm/cozy-settings.js +88 -5
  47. package/workspace/public/pm/cozy-today.css +15 -0
  48. package/workspace/public/pm/cozy-viewer.js +50 -18
  49. package/workspace/public/pm/cozy-vw-shell.css +4 -0
  50. package/workspace/public/pm/cozy.css +65 -0
  51. package/workspace/public/pm/dash-view.js +4 -2
  52. package/workspace/public/pm/goals-clear.js +258 -0
  53. package/workspace/public/pm/home-app.js +59 -5
  54. package/workspace/public/pm/home-chat.js +1 -1
  55. package/workspace/public/pm/home-day.js +7 -4
  56. package/workspace/public/pm/home-ini.js +2 -2
  57. package/workspace/public/pm/home-mentions.js +1 -1
  58. package/workspace/public/pm/home-today.js +51 -10
  59. package/workspace/public/pm/impact.js +1 -1
  60. package/workspace/public/pm/ini-groups.js +28 -17
  61. package/workspace/public/pm/ini-links.js +1 -1
  62. package/workspace/public/pm/ini-tasks.js +246 -48
  63. package/workspace/public/pm/ini-view-model.js +45 -16
  64. package/workspace/public/pm/ini-view.css +330 -1
  65. package/workspace/public/pm/ini-view.js +196 -83
  66. package/workspace/public/pm/metric-drafts.js +4 -1
  67. package/workspace/public/pm/mission.js +238 -0
  68. package/workspace/public/pm/premium-board.js +1 -1
  69. package/workspace/public/pm/premium-insights.js +178 -24
  70. package/workspace/public/pm/premium-welcome.js +2 -2
  71. package/workspace/public/pm/split-merge.js +1 -1
  72. package/workspace/public/pm/stage-line.js +2 -2
  73. package/workspace/server.js +6 -2
  74. package/workspace/skills/metric-read.skill +7 -5
  75. package/workspace/split-merge-ui-test.js +1 -1
  76. package/workspace/stage-card-test.js +56 -11
  77. package/workspace/task-links-test.js +2 -0
  78. package/workspace/task-milestones-test.js +5 -1
  79. package/workspace/task-plans-test.js +3 -3
  80. package/workspace/task-views-test.js +279 -37
  81. package/workspace/test-lists/adler-seasons-art.json +13 -0
  82. package/workspace/test-lists/batch18-adler-seasons.json +13 -0
  83. package/workspace/test-lists/goals-clear.json +15 -0
  84. package/workspace/test-lists/home-railcard.json +9 -0
  85. package/workspace/test-lists/mission.json +5 -0
  86. package/workspace/test-lists/viewer-tasks.json +5 -0
  87. package/workspace/tk-tasks-test.js +27 -32
@@ -5,11 +5,19 @@
5
5
  *
6
6
  * viewMode() / setViewMode(m) 'list' | 'timeline' | 'kanban': the last view, remembered for the PM across initiatives; first time List
7
7
  * switchHtml(m) the icon-only segment List / Timeline / Kanban (Kanban is the Board's "By stage" icon)
8
- * headExtraHtml(v, m) what the view adds to the header: Timeline's Weeks/Months/Quarter/Year/2 years/5 years picker, Kanban's stage picker
9
- * timelineHtml(v, o, isOpen) the stage groups of the List (the same folds), bars by start → due, a circle for a due day only, a dashed
10
- * date press at today for a task with no dates, the Today line and the legend under it
8
+ * viewBtnHtml(m) the Tasks header's one view button (batch 18 item 1, XvpA4Sheet); its press opens the view sheet
9
+ * fullBtnHtml(m) Full width, beside the view button: a desktop's Timeline at Weeks or Months (0.442.0 hotfix)
10
+ * sheetHtml(m, g, z) the sheet: View, Group by (Stage, Owner, Status, ⋯ for Epic and Your groups) and the Timeline's Zoom
11
+ * (Weeks, Months, All); a bottom sheet on a phone, a popover under the button on a desktop
12
+ * kanbanPickHtml(v) Kanban's stage picker, at the top of the Kanban
13
+ * zoomMode() 'week' | 'month' | 'all'; a zoom stored before the three steps (quarter, year, y2, y5) reads as All
14
+ * timelineHtml(v, o, isOpen) Weeks and Months: the stage groups of the List (the same folds), bars by start → due, a circle for a due
15
+ * day only, the tasks with no dates in one "N without dates · Set" row at the foot, the Today line and the
16
+ * legend under it. On a phone each title sits above its bar, from the bar's start (XvpA3bMonths).
17
+ * allHtml(v, o, isOpen) All (XvpA3Timeline): one row per stage in the width it has; a press unfolds its tasks and milestones
11
18
  * kanbanHtml(v, o, isOpen) one stage at a time; columns To do, In progress, Done; Won't do a folded strip; phone: one column a screen
12
- * press(b, d, root, H) a press this file owns → true: the view switch, the pickers, the status caret, a date, a bar, a tab
19
+ * press(b, d, root, H) a press this file owns → true: the view button and its sheet, the pickers, the status caret, a date, a bar, a tab
20
+ * (H.__g: the sheet's Group by, pm/ini-groups.js api)
13
21
  * wireDrag(body) once per body: drag a bar (move, or an end), drag a card between columns, long-press a box on a phone
14
22
  *
15
23
  * The host's handlers (wireView's h): h.check(uid) the box's one-press Done (Undo in the host's toast), h.status(uid, state) and
@@ -22,7 +30,7 @@ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&':
22
30
  const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
23
31
  export const P = {
24
32
  list: 'M9 6h11M9 12h11M9 18h11M4.5 6h.01M4.5 12h.01M4.5 18h.01', time: 'M4 6h9M8 12h11M6 18h7', kanban: 'M4 4h4v16H4zM10 4h4v10h-4zM16 4h4v13h-4z',
25
- down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M12 3l9 9-9 9-9-9z', check: 'M5 12l5 5 9-10',
33
+ down: 'M7 10l5 5 5-5', right: 'M10 7l5 5-5 5', cal: 'M4 5h16v15H4zM8 3v4M16 3v4M4 10h16', jira: 'M4 7h16v3a2 2 0 0 0 0 4v3H4v-3a2 2 0 0 0 0-4z', check: 'M5 12l5 5 9-10',
26
34
  dia: 'M12 4l8 8-8 8-8-8z', skip: 'M6 7l5 5-5 5M13 7l5 5-5 5', bin: 'M5 7h14M10 7V4h4v3M7 7l1 13h8l1-13',
27
35
  full: 'M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5', unfull: 'M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5',
28
36
  };
@@ -33,8 +41,10 @@ export const msGlyph = (x) => (x && x.ms ? `<span class="iv-ms${x.done ? ' dn' :
33
41
  export const msNoDate = (x) => !!(x && x.ms && !x.end && !x.closed);
34
42
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
35
43
  const VIEWS = [['list', 'List', P.list], ['timeline', 'Timeline', P.time], ['kanban', 'Kanban', P.kanban]];
36
- // [key, label, px a day, the days the axis shows ahead at least]: Year, 2 years and 5 years (batch 17 item 3) read like the Board's spans
37
- const ZOOMS = [['week', 'Weeks', 14, 42], ['month', 'Months', 4, 42], ['quarter', 'Quarter', 1.6, 92], ['year', 'Year', 0.8, 365], ['y2', '2 years', 0.4, 730], ['y5', '5 years', 0.16, 1826]];
44
+ // [key, label, px a day, the days the axis shows ahead at least]. Three steps (batch 18 item 1, XvpA4Sheet): Weeks and Months scroll, All
45
+ // fits the whole initiative in the width it has, however long. The six steps before it (Quarter, Year, 2 years, 5 years) read as All.
46
+ const ZOOMS = [['week', 'Weeks', 14, 42], ['month', 'Months', 4, 42], ['all', 'All', 0, 0]];
47
+ const OLD_ZOOM = { quarter: 'all', year: 'all', y2: 'all', y5: 'all' };
38
48
  const COLS = [['To do', 'To do'], ['In progress', 'In progress'], ['Done', 'Done']];
39
49
 
40
50
  /* ── what the PM picked: the view and the zoom for the PM (this browser), the Kanban stage per initiative for the session ── */
@@ -67,7 +77,9 @@ function setFull(on) {
67
77
  }, true);
68
78
  }
69
79
  }
70
- const zoomOf = () => { if (!ZOOM) { const z = store.get('pmos.tasks.zoom'); ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
80
+ const zoomOf = () => { if (!ZOOM) { const z0 = store.get('pmos.tasks.zoom'), z = OLD_ZOOM[z0] || z0; ZOOM = ZOOMS.some((x) => x[0] === z) ? z : 'week'; } return ZOOM; };
81
+ /** The Timeline's zoom: 'week' | 'month' | 'all'. A stored zoom from before the three steps reads as All. */
82
+ export const zoomMode = () => zoomOf();
71
83
  /** For the tests: forget the PM's picks. */
72
84
  export const resetViews = () => { VIEW = null; ZOOM = null; STAGE.clear(); SCROLL.clear(); };
73
85
  /** The stage card's press on a stage (batch 11 item 21): the Kanban turns to that stage. */
@@ -105,21 +117,54 @@ export function stagesOf(v) {
105
117
  return now ? [{ key: now.key, label: now.name, count: now.count }, all, ...rest] : [all, ...rest];
106
118
  }
107
119
  const stageKeyOf = (v) => { const L = stagesOf(v), k = STAGE.get(v.id || v.key); return L.some((x) => x.key === k) ? k : L[0].key; };
108
- export function headExtraHtml(v, m) {
109
- if (m === 'timeline') {
110
- const z = ZOOMS.find((x) => x[0] === zoomOf());
111
- const f = fullOn(), fl = f ? 'Back to the panel' : 'Full width';
112
- return `<button type="button" class="ivx-pick" data-iv-zoom aria-haspopup="menu" aria-label="Zoom: ${esc(z[1].toLowerCase())}. Change">${esc(z[1])}${SVG(P.down, 14, 2)}</button>`
113
- + (PHONE() ? '' : `<button type="button" class="iv-ib" data-iv-full aria-pressed="${f}" aria-label="${fl}" title="${fl}">${SVG(f ? P.unfull : P.full, 18)}</button>`);
120
+ /* ── the one view button (batch 18 item 1, XvpA4Sheet): the Tasks header holds this and + only. It shows the view in use; a press opens the
121
+ * view sheet (a bottom sheet on a phone, a popover under it on a desktop): View, Group by and Zoom, three rows of the same shape. ── */
122
+ export function viewBtnHtml(m) {
123
+ const x = VIEWS.find((y) => y[0] === m) || VIEWS[0];
124
+ return `<button type="button" class="ivx-vb" data-iv-vbtn aria-haspopup="dialog" aria-expanded="false" aria-label="${esc('Tasks view: ' + x[1] + '. Change the view, grouping or zoom')}" title="View, group and zoom">${SVG(x[2], 18)}${SVG(P.down, 13, 2.2)}</button>`;
125
+ }
126
+ /** The Kanban's stage picker (or group picker): at the top of the Kanban, not in the header. */
127
+ export function kanbanPickHtml(v) {
128
+ const L = stagesOf(v), k = stageKeyOf(v), x = L.find((y) => y.key === k);
129
+ const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
130
+ return `<button type="button" class="ivx-pick on" data-iv-kstage aria-haspopup="menu" aria-label="${what}: ${esc(x.label)}. Change">${esc(x.label)}${SVG(P.down, 14, 2)}</button>`;
131
+ }
132
+ /** Full width: a desktop's Timeline at Weeks and Months (All fits the panel), in the Tasks header beside the view button (0.442.0 hotfix:
133
+ * at the Timeline's foot it went unseen). Once on it stays there at All too, so the way back is where it was. */
134
+ export function fullBtnHtml(m) {
135
+ if (m !== 'timeline' || PHONE() || (zoomOf() === 'all' && !fullOn())) return '';
136
+ const f = fullOn(), fl = f ? 'Back to the panel' : 'Full width';
137
+ return `<button type="button" class="iv-ib ivt-fl" data-iv-full aria-pressed="${f}" aria-label="${fl}" title="${fl}">${SVG(f ? P.unfull : P.full, 16)}</button>`;
138
+ }
139
+ const MORE = 'M5 12h.01M12 12h.01M19 12h.01';
140
+ /** The sheet's rows. g: the grouping as the host knows it ({ by, label } or null where Tasks cannot be grouped). */
141
+ export function sheetHtml(m, g, z = zoomOf()) {
142
+ const seg = (label, items) => `<div class="ivs-seg" role="group" aria-label="${esc(label)}">${items.map((x) => `<button type="button" class="${[x.cls, x.on ? 'on' : ''].filter(Boolean).join(' ')}" aria-pressed="${!!x.on}" ${x.attr}${x.aria ? ` aria-label="${esc(x.aria)}"` : ''} title="${esc(x.tip || x.aria || x.text)}">${x.html || esc(x.text)}</button>`).join('')}</div>`;
143
+ let h = '<p class="ivs-h">View</p>' + seg('View', VIEWS.map(([k, l, d]) => ({ attr: `data-ivs-view="${k}"`, on: k === m, aria: l, html: SVG(d, 18) })));
144
+ if (g) {
145
+ const other = !['stage', 'owner', 'status'].includes(g.by);
146
+ // Epic and Your groups (batch 11 item 20) stay one press away: the ⋯ opens them, named while one is on
147
+ h += '<p class="ivs-h">Group by</p>' + seg('Group by', [['stage', 'Stage'], ['owner', 'Owner'], ['status', 'Status']].map(([k, l]) => ({ attr: `data-ivs-by="${k}"`, on: g.by === k, text: l }))
148
+ .concat({ attr: 'data-ivs-more', cls: 'mo', on: other, aria: other ? 'Grouped by ' + g.label + '. Other groupings' : 'Other groupings: Epic, Your groups', html: other ? esc(g.label) : SVG(MORE, 18, 3) }));
114
149
  }
115
- if (m === 'kanban') {
116
- const L = stagesOf(v), k = stageKeyOf(v), x = L.find((y) => y.key === k);
117
- const what = v.tasks.by && v.tasks.by !== 'stage' ? 'Group' : 'Stage';
118
- return `<button type="button" class="ivx-pick on" data-iv-kstage aria-haspopup="menu" aria-label="${what}: ${esc(x.label)}. Change">${esc(x.label)}${SVG(P.down, 14, 2)}</button>`;
150
+ if (m === 'timeline') {
151
+ h += '<p class="ivs-h">Zoom</p>' + seg('Zoom', ZOOMS.map(([k, l]) => ({ attr: `data-ivs-zoom="${k}"`, on: k === z, text: l, aria: k === 'all' ? 'All: the whole initiative fits the screen' : l })));
152
+ if (z === 'all') h += '<p class="ivs-note">All fits the whole initiative, however long. Tap a stage to see its tasks.</p>';
119
153
  }
120
- return '';
154
+ return `<div class="tkc-pop ivs" role="dialog" aria-label="Tasks view"><span class="ivs-grab" aria-hidden="true"></span>${h}</div>`;
155
+ }
156
+ function openSheet(anchor, H) {
157
+ const g = () => (H.__g && H.__g.ok ? { by: H.__g.by(), label: H.__g.label() } : null);
158
+ const draw = () => { if (POP && POP.anchor === anchor) POP.el.innerHTML = sheetHtml(viewMode(), g()); };
159
+ const el = openPop(anchor, sheetHtml(viewMode(), g()), (b) => {
160
+ const d = b.dataset;
161
+ if (d.ivsView) { setViewMode(d.ivsView); if (H.redraw) H.redraw(); draw(); return; }
162
+ if (d.ivsZoom) { ZOOM = d.ivsZoom; store.set('pmos.tasks.zoom', ZOOM); if (H.redraw) H.redraw(); draw(); return; }
163
+ if (d.ivsBy && H.__g) { const r = H.__g.set(d.ivsBy); if (r && r.then) r.then(draw); else draw(); return; }
164
+ if ('ivsMore' in d && H.__g) { const a = POP && POP.anchor; closePop(); if (a && a.isConnected) H.__g.more(a); }
165
+ }, { sheet: PHONE(), right: true });
166
+ return el;
121
167
  }
122
-
123
168
  /* ── the rows a group holds, flat: the List folds by work package; Timeline and Kanban do not ── */
124
169
  const flat = (sec) => (sec.stages ? sec.stages.flatMap((s) => flat(s)) : [...sec.top, ...sec.groups.flatMap((g) => g.rows)]);
125
170
  const flatDone = (sec) => (sec.stages ? sec.stages.flatMap((s) => flatDone(s)) : sec.done);
@@ -129,7 +174,18 @@ const tkOf = (sec) => (sec.stages ? sec.stages.flatMap((s) => tkOf(s)) : sec.tk
129
174
  const tkMark = (t) => (t.inJira ? `<span class="ig-sq ${esc(t.cat || 'todo')}" role="img" aria-label="${esc('In Jira: ' + (t.status || 'To do'))}"></span>`
130
175
  : `<span class="ig-tkd" role="img" aria-label="Jira ticket drafted, not sent" title="Drafted, not in Jira">${SVG(P.jira, 14, 2)}</span>`);
131
176
  const tkTitle = (t) => `<button type="button" class="iv-tt" data-ig-tk="${esc(t.id)}">${t.inJira && t.key ? `<em>${esc(t.key)}</em> ` : ''}${esc(t.title)}</button>`;
177
+ /** A task linked to a Jira ticket it names (ini-view-model.js linkOf): the key once, in blue, then the rest of its title. A key PMOS has not
178
+ * read stays plain text in the title (0.442.0 hotfix). */
179
+ export function keyName(x) {
180
+ if (!x.jkey) return esc(x.title);
181
+ const rest = String(x.title || '').replace(new RegExp('[\\[(]?\\b' + x.jkey + '\\b[\\])]?\\s*[:\u2013\u2014-]?\\s*'), '').trim();
182
+ return `<em>${esc(x.jkey)}</em>${rest ? ' ' + esc(rest) : ''}`;
183
+ }
184
+ /** The Jira mark of a linked task, in place of its box: the status square the ticket rows draw (To do, In progress, Done). Jira owns the
185
+ * status, so it marks nothing here. */
186
+ export const jqMark = (x) => `<span class="iv-jq ig-sq ${x.closed ? 'done' : x.prog ? 'doing' : 'todo'}" role="img" aria-label="${esc('Jira ' + x.jkey + ': ' + (x.jst || x.status))}" title="${esc('Jira · ' + (x.jst || x.status))}"></span>`;
132
187
  const box = (x, o) => {
188
+ if (x.jkey && !x.dr) return `<span class="iv-bxw">${jqMark(x)}</span>`;
133
189
  // a draft's task (batch 11 item 8) is an assumption: a dashed box that marks nothing; its caret still changes the status in the draft
134
190
  if (x.dr) return `<span class="iv-bxw"><span class="iv-cb dr" aria-hidden="true"></span>` + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" aria-haspopup="dialog" aria-label="${esc('Change the status in the draft: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
135
191
  const cls = ['iv-cb', x.done ? 'on' : '', x.prog ? 'pr' : '', x.wont ? 'wo' : ''].filter(Boolean).join(' ');
@@ -137,7 +193,8 @@ const box = (x, o) => {
137
193
  + (o.quick ? `<button type="button" class="iv-car" data-iv-stat="${esc(x.uid)}" data-st="${esc(x.status)}" data-ms="${x.ms ? 1 : 0}" aria-haspopup="dialog" aria-label="${esc('Change the status: ' + x.title)}" title="Status">${SVG(P.down, 10, 2.6)}</button>` : '') + '</span>';
138
194
  };
139
195
  const jmark = (k) => `<span class="iv-jm" role="img" aria-label="${esc('Jira ticket, ' + (k.status || 'To do') + '. Status and dates come from Jira')}" title="${esc('Jira · ' + (k.status || 'To do'))}">${SVG(P.jira, 14, 2)}</span>`;
140
- const title = (x, o) => (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${esc(x.title)}</button>` : `<b class="iv-tt">${esc(x.title)}</b>`) + msGlyph(x) + addedMark(x);
196
+ // noMs: the row already leads with its ◇ (Timeline at All), so the title does not repeat it
197
+ const title = (x, o, noMs = false) => (o.openTask && x.uid && !x.dr ? `<button type="button" class="iv-tt" data-iv-task="${esc(x.uid)}">${keyName(x)}</button>` : `<b class="iv-tt">${keyName(x)}</b>`) + (noMs ? '' : msGlyph(x)) + addedMark(x);
141
198
  /* ── planned versus actual (batch 11 item 8; canvas PvaAC1Live): ⊕ after a title added after the compared version, the slip after a date ── */
142
199
  const ADDED = 'M12 8v8M8 12h8M12 3a9 9 0 1 0 0 18 9 9 0 1 0 0-18';
143
200
  export const addedMark = (x) => (x.added ? `<span class="vs-add" role="img" aria-label="Added after the plan" title="Added after the plan">${SVG(ADDED, 14, 1.8)}</span>` : '');
@@ -154,7 +211,7 @@ const ttitle = (k) => `<button type="button" class="iv-tt" data-iv-ticket="${esc
154
211
  /** The date press: the task card's start and due picker opens right under it. No dates: a calendar icon, shown on hover. */
155
212
  export function dateBtn(x, o) {
156
213
  if (!o.quick || !x.uid) return x.days ? `<span class="${x.late ? 'w' : ''}">${esc(x.days)}</span>` : '';
157
- const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="${x.jira ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
214
+ const a = `data-iv-date="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}" title="${x.jira || x.jkey ? 'Start and due, kept in PMOS. Jira is not changed' : 'Start and due'}"`;
158
215
  // a milestone with no due date: a dashed chip asks for it, shown always (canvas XmlA6Suggest)
159
216
  if (msNoDate(x)) return `<button type="button" class="iv-dc ms" ${a} aria-label="${esc('Set the due date: ' + x.title)}">${SVG(P.cal, 13)}Set the due date</button>`;
160
217
  return x.days ? `<button type="button" class="iv-dc${x.late ? ' w' : ''}" ${a} aria-label="${esc('Dates: ' + x.days + '. Change')}">${esc(x.days)}</button>`
@@ -174,8 +231,12 @@ function fitPx(z, days) {
174
231
  }
175
232
  const tone = (x) => (x.closed ? 'dn' : x.late ? 'lt' : x.prog ? 'pr' : '');
176
233
  export function timelineHtml(v, o, isOpen) {
234
+ if (zoomOf() === 'all') return allHtml(v, o, isOpen);
177
235
  const today = dn(v.today) || Math.round(Date.now() / 864e5), z = ZOOMS.find((x) => x[0] === zoomOf());
178
236
  const S = v.tasks.sections;
237
+ // the tasks with no dates share one row at the foot, "N without dates · Set" (XvpA3bMonths), in place of a dashed press on each row
238
+ const undated = (x) => !x.closed && dn(x.start) == null && dn(x.end) == null;
239
+ const ND = o.quick ? S.flatMap(flat).filter(undated) : [];
179
240
  // the range: the open tasks around today, a little air each side; never more than a few years
180
241
  const ns = [];
181
242
  for (const s of S) { for (const x of flat(s).concat(flatDone(s))) { const a = dn(x.start), b = dn(x.end); if (a != null) ns.push(a); if (b != null) ns.push(b); if (x.cmp) { const c = dn(x.cmp.start), d = dn(x.cmp.due); if (c != null) ns.push(c); if (d != null) ns.push(d); } } for (const k of jiraOf(s)) { const b = dn(k.due); if (b != null) ns.push(b); } }
@@ -212,7 +273,8 @@ export function timelineHtml(v, o, isOpen) {
212
273
  const lw = LK.barWords(x, o.lk);
213
274
  const at = `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"${o.quick && !x.closed ? drag : ''} aria-label="${esc(lbl + (lw ? ', ' + lw : '') + '. Change the dates')}"`;
214
275
  if (a == null && b == null) return x.closed || !o.quick ? '' : `<button type="button" class="ivt-g" data-iv-date="${esc(x.uid)}" data-s="" data-e="" data-tlx="${X(today) - 18}" aria-label="${esc('No dates yet. Set dates: ' + x.title)}" title="Set dates">${SVG(P.cal, 13)}</button>`;
215
- if (a == null) return `<button type="button" class="ivt-d ${cls}" ${at} data-only="due" data-tlx="${X(b) + Math.round(px / 2)}"></button>`;
276
+ // a milestone with a due day only is its ◇ (the guide drops through it), not the due-only circle
277
+ if (a == null) return `<button type="button" class="ivt-d ${cls}${x.ms && !x.wont ? ' ms' : ''}" ${at} data-only="due" data-tlx="${x.ms && !x.wont ? X(b + 1) : X(b) + Math.round(px / 2)}"></button>`;
216
278
  const e = b == null ? a : Math.max(a, b);
217
279
  return `<button type="button" class="ivt-b ${cls}" ${at} data-tlx="${X(a)}" data-tlw="${Math.max(10, X(e + 1) - X(a))}">`
218
280
  + (o.quick && !x.closed ? '<span class="ivt-gp l" data-grip="start" aria-hidden="true"></span><span class="ivt-gp r" data-grip="end" aria-hidden="true"></span>' : '') + av + LK.barExtra(x, o.lk, o.quick) + '</button>' + msEnd(x);
@@ -226,7 +288,11 @@ export function timelineHtml(v, o, isOpen) {
226
288
  // a Jira ticket's bar drags and its ends change the dates kept in PMOS, as a task's do (batch 11 item 23); read-only views draw the due dot
227
289
  const jbar = (k) => { if (o.quick) return barOf0(jiraRow(k)).replace(/class="ivt-(b|d|g) /, 'class="ivt-$1 jr ').replace('class="ivt-g"', 'class="ivt-g jr"');
228
290
  const b = dn(k.due); return b == null ? '' : `<span class="ivt-d jr" role="img" data-ivt-jr="${esc(k.key)}" data-tlx="${X(b) + Math.round(px / 2)}" aria-label="${esc('Due ' + md(b) + ' in Jira')}" title="${esc('Jira · ' + md(b))}"></span>`; };
229
- const row = (n, c, cls = '') => `<div class="ivt-r${cls}"><div class="ivt-n">${n}</div><div class="ivt-c">${c}</div></div>`;
291
+ // on a phone the title sits above its bar, from the bar's start (data-tln; it sticks to the left edge once the start scrolls away)
292
+ const nx = (a, b) => { const n = a != null ? a : b; return n == null ? null : Math.max(0, Math.min(X(n), W - 220)); };
293
+ const row = (n, c, cls = '', at = null) => `<div class="ivt-r${cls}"><div class="ivt-n"${at != null ? ` data-tln="${at}"` : ''}>${n}</div><div class="ivt-c">${c}</div></div>`;
294
+ const when = (x) => (x.days ? `<span class="ivt-wn">· ${esc(x.days)}${x.lateText ? `<b>, ${esc(x.lateText)}</b>` : ''}</span>` : '');
295
+ const trow = (x, cls = '') => row(`${box(x, o)}${title(x, o)}${when(x)}`, barOf(x), ' k' + cls, nx(dn(x.start), dn(x.end)));
230
296
  const band = (rs) => { const ds = rs.flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null); if (!ds.length) return ''; const a = Math.min(...ds), b = Math.max(...ds); return `<span class="ivt-band" data-tlx="${X(a)}" data-tlw="${Math.max(8, X(b + 1) - X(a))}"></span>`; };
231
297
  // a skipped stage keeps its group row: a hairline from the band before it to the band after it, with » on it (batch 11 item 13, XgapA2Tasks);
232
298
  // a skip before the first dated stage or after the last draws nothing
@@ -247,21 +313,22 @@ export function timelineHtml(v, o, isOpen) {
247
313
  };
248
314
  let h = '';
249
315
  for (const [si, sec] of S.entries()) {
250
- const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec), tk = tkOf(sec);
316
+ const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec).filter((x) => !ND.includes(x)), dn_ = flatDone(sec), jr = jiraOf(sec), tk = tkOf(sec);
251
317
  const has = rs.length || dn_.length || jr.length || tk.length;
252
318
  const head = `<button type="button" class="ivt-gh${sec.kind === 'past' || sec.kind === 'later' || sec.status === 'skip' ? ' mut' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'}>${o.mark(sec)}<b>${esc(sec.label || sec.name)}</b>${sec.count ? `<span class="n${sec.warn ? ' w' : ''}">${esc(sec.count)}</span>` : ''}${has ? `<span class="iv-cv" aria-hidden="true">${SVG(op ? P.down : P.right, 15, 2)}</span>` : ''}</button>`;
253
319
  h += row(head, sec.status === 'skip' && !has ? skipLine(si) : band(rs.concat(dn_)), ' g');
254
320
  if (!op || !has) continue;
255
- for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, '', ' k');
256
- for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}`, jbar(k), ' k');
257
- for (const x of rs) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k');
321
+ // a ticket in Jira whose task is linked to it (By epic) draws that task's bar: its dates are the task's, kept in PMOS
322
+ for (const t of tk) h += row(`${tkMark(t)}${tkTitle(t)}`, t.x ? barOf(t.x) : '', ' k', t.x ? nx(dn(t.x.start), dn(t.x.end)) : null);
323
+ for (const k of jr) h += row(`${jmark(k)}${ttitle(k)}${k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : ''}`, jbar(k), ' k', nx(dn(k.start), dn(k.due)));
324
+ for (const x of rs) h += trow(x);
258
325
  // a stage with nothing open lists its done tasks straight away, as the List does: no "Done" fold inside the stage's own fold
259
326
  // (PM, 2026-10-27: "Grouping 'Done' items is confusing")
260
- if (dn_.length && !rs.length && !jr.length && !tk.length) for (const x of dn_) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k x' + (x.wont ? ' wo' : ''));
327
+ if (dn_.length && !rs.length && !jr.length && !tk.length) for (const x of dn_) h += trow(x, ' x' + (x.wont ? ' wo' : ''));
261
328
  else if (dn_.length) {
262
329
  const dk = (sec.key || 'none') + ':done', dop = isOpen(dk, false);
263
330
  h += row(`<button type="button" class="ivt-df" data-iv-fold="${esc(dk)}" aria-expanded="${dop}">Done<span class="n">${dn_.length}</span><span class="iv-cv" aria-hidden="true">${SVG(dop ? P.down : P.right, 14, 2)}</span></button>`, dop ? '' : dn_.map(barOf).join(''), ' k');
264
- if (dop) for (const x of dn_) h += row(`${box(x, o)}${title(x, o)}`, barOf(x), ' k x' + (x.wont ? ' wo' : ''));
331
+ if (dop) for (const x of dn_) h += trow(x, ' x' + (x.wont ? ' wo' : ''));
265
332
  }
266
333
  }
267
334
  const grid = ticks.map((t) => `<i data-tlx="${t.x}"></i>`).join('') + guides;
@@ -275,18 +342,121 @@ export function timelineHtml(v, o, isOpen) {
275
342
  const firstOpen = S.flatMap(flat).flatMap((x) => [dn(x.start), dn(x.end)]).filter((n) => n != null);
276
343
  const first = firstOpen.length ? X(Math.min(...firstOpen)) : X(today);
277
344
  return `<div class="ivt"${LK.dataOf(o.lk)} data-ivt="${esc((v.id || v.key) + '|' + z[0])}" data-px="${px}" data-today="${X(today)}" data-first="${first}"><div class="ivt-sc"><div class="ivt-in" data-tlw="${W}">`
278
- + `<div class="ivt-grid" aria-hidden="true">${grid}</div>${axis}${h}<span class="ivt-today" data-tlx="${X(today) + Math.round(px / 2)}" aria-hidden="true"><i>Today</i></span></div></div></div>${legend}`;
345
+ + `<div class="ivt-grid" aria-hidden="true">${grid}</div>${axis}${h}<span class="ivt-today" data-tlx="${X(today) + Math.round(px / 2)}" aria-hidden="true"><i>Today</i></span></div></div>`
346
+ + `<i class="ivt-fade" aria-hidden="true"></i>${noDatesHtml(ND, o, isOpen)}</div>${legend}`;
347
+ }
348
+
349
+ /** The one row for the tasks with no dates (Weeks and Months): "N without dates", and Set. One task: Set opens its date picker. More: Set
350
+ * unfolds them, each with its own date press. */
351
+ function noDatesHtml(ND, o, isOpen) {
352
+ if (!ND.length) return '';
353
+ const n = ND.length, words = n + ' without dates';
354
+ if (n === 1) {
355
+ const x = ND[0];
356
+ return `<div class="ivt-nd"><span class="w">${SVG(P.cal, 16)}${esc(words)}</span><button type="button" class="ivt-set" data-iv-date="${esc(x.uid)}" data-s="" data-e="" aria-label="${esc('Set the dates: ' + x.title)}">Set</button></div>`;
357
+ }
358
+ const op = isOpen('nodates', false);
359
+ const rows = op ? ND.map((x) => `<div class="iv-tr">${box(x, o)}<span class="w">${title(x, o)}<span class="iv-rm">${dateBtn(x, o)}</span></span></div>`).join('') : '';
360
+ return `<div class="ivt-nd"><span class="w">${SVG(P.cal, 16)}${esc(words)}</span><button type="button" class="ivt-set" data-iv-fold="nodates" aria-expanded="${op}" aria-label="${esc(words + '. ' + (op ? 'Hide them' : 'Set their dates'))}">${op ? 'Hide' : 'Set'}</button></div>`
361
+ + (op ? `<div class="ivt-ndl">${rows}</div>` : '');
362
+ }
363
+
364
+ /* ── Timeline at All (batch 18 item 1; phone XvpA3Timeline, desktop XvpD3Timeline): the whole initiative in the width it has, however long.
365
+ * One row per stage, Today across all of them with its chip at the foot. A press on a stage unfolds its tasks and milestones under it.
366
+ * One markup, two layouts (the css container query on .iv-tk): a desktop has a name column (the stage's number, name and dates; under an
367
+ * open stage its tasks with their box and a late or "you" note, ◇ for a milestone) and the bars on the right; a phone keeps a narrow number
368
+ * column and puts each task's title, with its dates, above its bar. Positions are in % of the track, so a narrower panel only scales it.
369
+ * No drag here: a bar's press opens its date picker. ── */
370
+ const short = (n) => "\u2019" + String(new Date(n * 864e5).getUTCFullYear()).slice(2);
371
+ /** "Oct 9 – Nov 27", "Dec 14 – 18", "Mar 1": a stage's days in the name column. */
372
+ const rng = (a, b) => { if (a === b) return md(a); const x = new Date(a * 864e5), y = new Date(b * 864e5); return md(a) + ' \u2013 ' + (x.getUTCMonth() === y.getUTCMonth() && x.getUTCFullYear() === y.getUTCFullYear() ? y.getUTCDate() : md(b)); };
373
+ export function allHtml(v, o, isOpen) {
374
+ const S = v.tasks.sections, today = dn(v.today) || Math.round(Date.now() / 864e5);
375
+ const rowsOf = (sec) => flat(sec).concat(flatDone(sec));
376
+ const spanOf = (sec) => {
377
+ const ds = rowsOf(sec).filter((x) => !x.wont).flatMap((x) => [dn(x.start), dn(x.end)]).concat(jiraOf(sec).flatMap((k) => [dn(k.start), dn(k.due)])).filter((n) => n != null);
378
+ return ds.length ? [Math.min(...ds), Math.max(...ds)] : null;
379
+ };
380
+ const SP = S.map(spanOf), all = SP.filter(Boolean).flat();
381
+ let lo = Math.min(today, ...all), hi = Math.max(today, ...all);
382
+ if (!all.length) { lo = today - 30; hi = today + 60; }
383
+ const pad = Math.max(3, Math.round((hi - lo) * 0.04)); lo -= pad; hi += pad;
384
+ const D = hi - lo + 1, fr = (n) => Math.max(0, Math.min(1, (n - lo) / D));
385
+ const pc = (n) => +(fr(n) * 100).toFixed(2) + '%', pw = (a, b) => +(Math.max(0.8, ((b - a + 1) / D) * 100)).toFixed(2) + '%';
386
+ // the axis: months up to about 14 months (a phone names only the quarters past 5 months), quarters up to 3 years, else years
387
+ const ticks = [];
388
+ for (let n = lo; n <= hi; n++) {
389
+ const d = new Date(n * 864e5), m = d.getUTCMonth(); if (d.getUTCDate() !== 1) continue;
390
+ const yr = m === 0 ? ' ' + short(n) : '';
391
+ if (D <= 150) ticks.push({ n, t: MON[m] + yr, b: m === 0 });
392
+ else if (D <= 430) ticks.push({ n, t: MON[m] + yr, b: m === 0, mo: m % 3 !== 0, q: m % 3 === 0 ? 'Q' + (m / 3 + 1) + yr : '' });
393
+ else if (D <= 1100) { if (m % 3 === 0) ticks.push({ n, t: 'Q' + (m / 3 + 1) + yr, b: m === 0 }); }
394
+ else if (m === 0) ticks.push({ n, t: String(d.getUTCFullYear()), b: true });
395
+ }
396
+ const stageTone = (sec) => (sec.status === 'done' || sec.kind === 'past' ? 'dn' : sec.status === 'now' ? 'now' : '');
397
+ const msMark = (x) => { const b = dn(x.end); if (b == null) return '';
398
+ return `<i class="iva-md${x.done ? ' dn' : x.late ? ' lt' : ''}" data-tlx="${pc(b)}" role="img" aria-label="${esc('Milestone ' + x.title + ', ' + md(b))}" title="${esc(x.title + ' · ' + md(b))}"></i>`; };
399
+ const name = (sec) => sec.label || sec.name || 'Not in a stage';
400
+ const dia = `<span class="iva-mg" aria-hidden="true">${SVG(P.dia, 13, 2.4)}</span>`;
401
+ let h = '';
402
+ for (const [i, sec] of S.entries()) {
403
+ const key = 'sec:' + (sec.key || 'none'), op = isOpen(key, sec.open), rs = flat(sec), dn_ = flatDone(sec), jr = jiraOf(sec), tk = tkOf(sec), sp = SP[i];
404
+ const has = rs.length || dn_.length || jr.length || tk.length;
405
+ const mk = o.mark(sec);
406
+ let mark = '';
407
+ if (sp && sec.ms) mark = `<i class="iva-md st${sec.status === 'done' ? ' dn' : ''}" data-tlx="${pc(sp[1])}"></i>`;
408
+ else if (sp) mark = `<i class="iva-b ${stageTone(sec)}" data-tlx="${pc(sp[0])}" data-tlw="${pw(sp[0], sp[1])}"></i>` + rowsOf(sec).filter((x) => x.ms && !x.wont).map(msMark).join('');
409
+ const when = sp ? (sec.ms ? md(sp[1]) : rng(sp[0], sp[1])) : '';
410
+ const say = name(sec) + (sec.count ? ', ' + sec.count : '') + (sp ? ', ' + rng(sp[0], sp[1]) : ', no dates yet') + (has ? '. ' + (op ? 'Hide' : 'Show') + ' its tasks' : '');
411
+ // the name column (a desktop): the name and the dates, the fold's chevron; a phone shows only the number, or a group's name above its bar
412
+ const lab = `<span class="iva-l" data-tlp="${sp ? fr(sp[0]).toFixed(4) : 0}"><b>${esc(name(sec))}</b>${when ? `<small>${esc(when)}</small>` : ''}${has ? `<span class="iva-ch" aria-hidden="true">${SVG(op ? P.down : P.right, 14, 2.2)}</span>` : ''}</span>`;
413
+ h += `<button type="button" class="iva-r g${op && has ? ' op' : ''}${mk ? '' : ' nm'}${sec.kind === 'past' || sec.kind === 'later' || sec.status === 'skip' ? ' mut' : ''}" ${has ? `data-iv-fold="${esc(key)}" aria-expanded="${op}"` : 'disabled'} aria-label="${esc(say)}" title="${esc(name(sec))}">`
414
+ + `<span class="iva-n">${mk}</span>${lab}<span class="iva-c">${mark}${op && has ? `<span class="iva-cv" aria-hidden="true">${SVG(P.down, 14, 2.4)}</span>` : ''}</span></button>`;
415
+ if (!op || !has) continue;
416
+ // its tasks: tickets drafted, Jira, the open tasks, then the done ones (quieter)
417
+ const trow = (lc, ttl, bar, p0, cls = '') => `<div class="iva-r k${cls}"><span class="iva-n">${lc}</span><span class="iva-l" data-tlp="${p0}">${ttl}</span><span class="iva-c">${bar}</span></div>`;
418
+ // the words after a title: a phone says the dates and the late days; a desktop the late days or "you" only (XvpD3Timeline)
419
+ const tline = (x) => title(x, o, true)
420
+ + (x.days ? `<span class="ivt-wn">· ${esc(x.days)}${x.lateText ? `<b>, ${esc(x.lateText)}</b>` : ''}</span>` : '')
421
+ + (x.lateText && !x.closed ? `<span class="iva-nt lt">${esc(x.lateText)}</span>` : x.owner === 'You' && !x.closed ? '<span class="iva-nt you">you</span>' : '')
422
+ + (!x.days && o.quick && x.uid && !x.closed ? ' ' + dateBtn(x, o) : '');
423
+ const tbar = (x) => {
424
+ const a = dn(x.start), b = dn(x.end), cls = tone(x) + (x.dr ? ' dr' : '');
425
+ if (a == null && b == null) return '';
426
+ const lb = esc((x.days || '') + (o.quick && x.uid && !x.closed ? '. Change the dates' : ''));
427
+ const at = o.quick && x.uid && !x.closed ? `data-ivt-bar="${esc(x.uid)}" data-s="${esc(x.start)}" data-e="${esc(x.end)}"` : '';
428
+ const tag = at ? 'button' : 'span', open0 = at ? 'button type="button"' : 'span';
429
+ if (x.ms && b != null) return `<${open0} class="iva-md${x.done ? ' dn' : x.late ? ' lt' : ''}" ${at} data-tlx="${pc(b)}" aria-label="${lb}"></${tag}>`;
430
+ const s0 = a == null ? b : a, e0 = b == null ? a : Math.max(a, b);
431
+ return `<${open0} class="iva-tb ${cls}" ${at} data-tlx="${pc(s0)}" data-tlw="${pw(s0, e0)}" aria-label="${lb}"></${tag}>`;
432
+ };
433
+ const p0 = (x) => { const n = dn(x.start) != null ? dn(x.start) : dn(x.end); return n == null ? 0 : fr(n).toFixed(4); };
434
+ for (const t of tk) h += trow(tkMark(t), tkTitle(t), t.x ? tbar(t.x) : '', t.x ? p0(t.x) : 0);
435
+ for (const k of jr) { const r = jiraRow(k); h += trow(jmark(k), ttitle(k) + (k.days ? `<span class="ivt-wn">· ${esc(k.days)}</span>` : ''), tbar({ ...r, title: k.title }), p0(r)); }
436
+ for (const x of rs) h += trow(x.ms ? dia : box(x, o), tline(x), tbar(x), p0(x));
437
+ for (const x of dn_) h += trow(x.ms ? dia : box(x, o), tline(x), tbar(x), p0(x), ' x' + (x.wont ? ' wo' : ''));
438
+ }
439
+ const tick = (t) => `<span class="${[t.b ? 'b' : '', t.mo ? 'mo' : '', t.q ? 'qm' : ''].filter(Boolean).join(' ')}" data-tlx="${pc(t.n)}"${t.q ? ` data-q="${esc(t.q)}"` : ''}>${esc(t.t)}</span>`;
440
+ const axis = `<div class="iva-ax"><span class="iva-n"></span><span class="iva-l"></span><span class="iva-c">${ticks.map(tick).join('')}</span></div>`;
441
+ const grid = `<div class="iva-ly" aria-hidden="true">${ticks.map((t) => `<i class="${t.mo ? 'mo' : ''}" data-tlx="${pc(t.n)}"></i>`).join('')}<i class="iva-tl" data-tlx="${pc(today)}"></i></div>`;
442
+ // Today's chip sits at the foot, under its line
443
+ const foot = `<div class="iva-ft"><span class="iva-n"></span><span class="iva-l"></span><span class="iva-c"><i class="iva-tc" data-tlx="${pc(today)}">Today</i></span></div>`;
444
+ return `<div class="ivt iva" data-iva="${esc(v.id || v.key || '')}" role="region" aria-label="Tasks timeline, the whole initiative">${axis}<div class="iva-bd">${grid}${h}</div>${foot}</div>`;
279
445
  }
280
446
 
281
447
  /** The Timeline's geometry, set at run time as the layout's own custom properties (--tl-x, --tl-w; the stylesheet places them): every
282
448
  * [data-tlx] / [data-tlw] under root. Called on each draw, before the paint. */
283
449
  export function place(root) {
284
450
  if (!root || !root.querySelectorAll) return;
285
- for (const e of root.querySelectorAll('[data-tlx], [data-tlw]')) {
451
+ for (const e of root.querySelectorAll('[data-tlx], [data-tlw], [data-tln], [data-tlp]')) {
286
452
  if (e.__tl) continue; // placed once: a drag moves it from there
287
453
  e.__tl = true;
288
- if (e.dataset.tlx != null) e.style.setProperty('--tl-x', e.dataset.tlx + 'px');
289
- if (e.dataset.tlw != null) e.style.setProperty('--tl-w', e.dataset.tlw + 'px');
454
+ // Timeline at All places in % of its track; Weeks and Months in px
455
+ const u = (x) => (/%$/.test(x) ? x : x + 'px');
456
+ if (e.dataset.tlx != null) e.style.setProperty('--tl-x', u(e.dataset.tlx));
457
+ if (e.dataset.tlw != null) e.style.setProperty('--tl-w', u(e.dataset.tlw));
458
+ if (e.dataset.tln != null) e.style.setProperty('--tl-n', u(e.dataset.tln));
459
+ if (e.dataset.tlp != null) e.style.setProperty('--tl-p', e.dataset.tlp); // a fraction of the track (All on a phone)
290
460
  }
291
461
  }
292
462
 
@@ -307,7 +477,7 @@ export function kanbanHtml(v, o, isOpen) {
307
477
  return `<div class="ivk-d jr">${jmark(t)}<div class="w">${ttitle(t)}<div class="ivk-m">${d != null ? `<span>${esc(md(d))}</span>` : ''}${t.av ? `<span class="ivt-av" aria-hidden="true">${esc(t.av)}</span>` : ''}</div></div></div>`;
308
478
  }
309
479
  const x = c.x;
310
- return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}"${o.quick && x.uid ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
480
+ return `<div class="ivk-d${x.closed ? ' x' : ''}${x.wont ? ' wo' : ''}${x.dr ? ' dr' : ''}${x.jkey ? ' jr' : ''}"${o.quick && x.uid && !x.jkey ? ` draggable="true" data-ivk-card="${esc(x.uid)}" data-st="${esc(x.status)}"` : ''}>${box(x, o)}<div class="w">${title(x, o)}`
311
481
  + `<div class="ivk-m">${dateBtn(x, o)}${LK.metaHtml(x, o.lk, o.quick)}${x.av ? `<span class="ivt-av" aria-hidden="true">${esc(x.av)}</span>` : ''}</div></div></div>`;
312
482
  };
313
483
  const wop = isOpen('kb:wont', false), nW = by["Won't do"].length;
@@ -321,22 +491,28 @@ export function kanbanHtml(v, o, isOpen) {
321
491
 
322
492
  /* ── the popovers: the task card's own status segment and date picker, opened right under the press ── */
323
493
  let POP = null;
324
- function closePop() { if (!POP) return; const { el, anchor } = POP; POP = null; el.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
325
- function openPop(anchor, html, onPress) {
494
+ function closePop() { if (!POP) return; const { el, anchor, scrim } = POP; POP = null; el.remove(); if (scrim) scrim.remove(); if (anchor && anchor.isConnected) anchor.setAttribute('aria-expanded', 'false'); }
495
+ /** o.sheet: a bottom sheet over a scrim (a phone); o.right: the popover's right edge under the press's right edge. */
496
+ function openPop(anchor, html, onPress, o = {}) {
326
497
  closePop(); cardStyle();
327
498
  const el = document.createElement('div');
328
- el.className = 'tkc ivq'; el.dataset.escLayer = ''; el.innerHTML = html; document.body.appendChild(el); // data-esc-layer: Escape closes this first, not the Viewer
329
- const r = anchor.getBoundingClientRect(), w = el.offsetWidth, h = el.offsetHeight;
330
- const left = Math.max(8, Math.min(r.left, innerWidth - w - 8)), below = r.bottom + 6 + h <= innerHeight - 8;
331
- el.style.setProperty('--tl-x', left + 'px'); el.style.setProperty('--tl-y', (below ? r.bottom + 6 : Math.max(8, r.top - 6 - h)) + 'px');
499
+ el.className = 'tkc ivq' + (o.sheet != null ? ' vs-pop' : '') + (o.sheet ? ' sheet' : ''); el.dataset.escLayer = ''; el.innerHTML = html; // data-esc-layer: Escape closes this first, not the Viewer
500
+ let scrim = null;
501
+ if (o.sheet) { scrim = document.createElement('div'); scrim.className = 'vs-scrim'; document.body.appendChild(scrim); }
502
+ document.body.appendChild(el);
503
+ if (!o.sheet) {
504
+ const r = anchor.getBoundingClientRect(), w = el.offsetWidth, h = el.offsetHeight;
505
+ const left = Math.max(8, Math.min(o.right ? r.right - w : r.left, innerWidth - w - 8)), below = r.bottom + 6 + h <= innerHeight - 8;
506
+ el.style.setProperty('--tl-x', left + 'px'); el.style.setProperty('--tl-y', (below ? r.bottom + 6 : Math.max(8, r.top - 6 - h)) + 'px');
507
+ }
332
508
  anchor.setAttribute('aria-expanded', 'true');
333
- POP = { el, anchor, onPress };
334
- const f = el.querySelector('[aria-checked="true"], button'); if (f) f.focus({ preventScroll: true });
509
+ POP = { el, anchor, onPress, scrim };
510
+ const f = el.querySelector('[aria-checked="true"], [aria-pressed="true"], button'); if (f) f.focus({ preventScroll: true });
335
511
  return el;
336
512
  }
337
513
  if (typeof document !== 'undefined' && document.head) {
338
514
  cardStyle(); // the task card's look, before the first press, so a picker opens at its own size
339
- document.addEventListener('pointerdown', (e) => { if (POP && !POP.el.contains(e.target) && e.target !== POP.anchor) closePop(); }, true);
515
+ document.addEventListener('pointerdown', (e) => { if (POP && !POP.el.contains(e.target) && e.target !== POP.anchor && !(POP.scrim == null && POP.el.querySelector('.ivs') && e.target.closest && e.target.closest('[data-iv-vbtn]'))) closePop(); }, true);
340
516
  // a press inside the open picker (one listener on the document: the picker's own buttons are real buttons)
341
517
  document.addEventListener('click', (e) => { if (!POP) return; const b = e.target.closest && e.target.closest('button'); if (b && POP.el.contains(b)) POP.onPress(b, e); });
342
518
  // the drags and the long press, read on the document for every Tasks section (each section's body holds its handlers in __iv)
@@ -345,8 +521,9 @@ if (typeof document !== 'undefined' && document.head) {
345
521
  document.addEventListener('pointercancel', () => { dragEnd(); longOff(); });
346
522
  document.addEventListener('pointermove', (e) => dragMove(e));
347
523
  document.addEventListener('keydown', (e) => { if (POP && e.key === 'Escape') { e.stopPropagation(); const a = POP.anchor; closePop(); if (a && a.isConnected) a.focus(); } }, true);
348
- addEventListener('resize', () => closePop());
349
- document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target)) closePop(); }, true);
524
+ addEventListener('resize', () => { if (POP && !POP.scrim) closePop(); });
525
+ // the view sheet stays through a scroll: its own presses redraw Tasks, and a Timeline settles its scroll as it draws
526
+ document.addEventListener('scroll', (e) => { if (POP && !POP.el.contains(e.target) && !POP.el.querySelector('.ivs')) closePop(); }, true);
350
527
  }
351
528
  /** The five icons (To do, In progress, Done, Won't do | Archive), only the current one named: the task card's segment. */
352
529
  /** ms: the task's ◇ flag, or null where the flag cannot change here: after a second divider, the ◇ toggle (batch 11 item 3).
@@ -400,6 +577,7 @@ let LONG = 0; // a long press opened the status picker: the click that follows
400
577
  /** A press inside the Tasks section that this file owns. → true when handled. */
401
578
  export function press(b, d, root, H, e) {
402
579
  const id = root.dataset.iv;
580
+ if ('ivVbtn' in d) { if (POP && POP.el.querySelector('.ivs')) closePop(); else openSheet(b, H); return true; }
403
581
  if (d.ivView) {
404
582
  // a narrow header shows only the view in use (batch 11 item 20, XtaA5Phone: the group icon, the view, + and Make live fit at 390 px);
405
583
  // its press opens the three as a menu
@@ -408,7 +586,6 @@ export function press(b, d, root, H, e) {
408
586
  setViewMode(d.ivView); closePop(); if (H.redraw) H.redraw(); return true;
409
587
  }
410
588
  if ('ivFull' in d) { REDRAW = H && H.redraw; setFull(!fullOn()); return true; }
411
- if ('ivZoom' in d) { menuPop(b, 'Zoom', ZOOMS.map(([k, l]) => ({ k, label: l, on: k === zoomOf() })), (x) => { ZOOM = x.k; store.set('pmos.tasks.zoom', x.k); if (H.redraw) H.redraw(); }); return true; }
412
589
  if ('ivKstage' in d) {
413
590
  const v = H.__v; if (!v) return true;
414
591
  const cur = stageKeyOf(v);
@@ -449,7 +626,28 @@ export function wireDrag(body, after) {
449
626
  sc.__settled = true;
450
627
  const k = T.dataset.ivt, nw = T.querySelector('.ivt-n') ? T.querySelector('.ivt-n').offsetWidth : 0;
451
628
  sc.scrollLeft = SCROLL.has(k) ? SCROLL.get(k) : Math.max(0, Math.min((+T.dataset.today || 0) - Math.max(0, sc.clientWidth - nw) * 0.25, (+T.dataset.first || 0) - 16));
452
- sc.addEventListener('scroll', () => SCROLL.set(k, sc.scrollLeft), { passive: true });
629
+ // an earlier start fades in at the left edge once the Timeline is scrolled from its start (XvpA3bMonths)
630
+ const fade = () => T.classList.toggle('scl', sc.scrollLeft > 2);
631
+ // an axis label cut by the left edge (or the name column) or under the Today chip is hidden, not half drawn (0.442.0 hotfix: "5", "9")
632
+ const cut = () => {
633
+ const c = sc.getBoundingClientRect(), ch = T.querySelector('.ivt-today i'), t = ch ? ch.getBoundingClientRect() : null;
634
+ for (const e of T.querySelectorAll('.ivt-r.ax .ivt-c span')) {
635
+ const r = e.getBoundingClientRect(), x0 = r.left + 4;
636
+ e.classList.toggle('cut', x0 < c.left + nw - 1 || r.right > c.right + 1 || (!!t && r.right > t.left - 4 && x0 < t.right + 4));
637
+ }
638
+ };
639
+ // a phone: each title starts at its bar's start, but slides back from the right edge so it is whole on the screen (0.442.0 hotfix)
640
+ const fit = () => {
641
+ if (T.offsetWidth >= 520) return;
642
+ const L = sc.scrollLeft, vw = sc.clientWidth;
643
+ for (const n of T.querySelectorAll('.ivt-r.k .ivt-n[data-tln]')) {
644
+ const kids = [...n.children], w = kids.reduce((a, c) => a + (c.classList.contains('iv-tt') ? c.scrollWidth : c.offsetWidth), 0) + 8 * Math.max(0, kids.length - 1) + 12;
645
+ n.style.setProperty('--tl-fw', (vw - 24) + 'px'); // its content: the padding takes the other 12
646
+ n.style.setProperty('--tl-fl', Math.max(0, Math.min(+n.dataset.tln || 0, L + vw - Math.min(w, vw - 12) - 4)) + 'px');
647
+ }
648
+ };
649
+ fade(); cut(); fit();
650
+ sc.addEventListener('scroll', () => { SCROLL.set(k, sc.scrollLeft); fade(); cut(); fit(); }, { passive: true });
453
651
  }
454
652
  if (after) after();
455
653
  };