create-pmos 0.765.0 → 0.767.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.
- package/package.json +27 -33
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/layout.md +3 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-chat-goal-setup-test.js +2 -1
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/public/pm/cozy-pop-work.css +7 -0
- package/workspace/public/pm/cozy-pop-work.js +53 -13
- package/workspace/public/pm/cozy-popup.js +45 -4
- package/workspace/public/pm/cozy-task-pop.js +17 -6
- package/workspace/public/pm/cozy-viewer.js +6 -3
- package/workspace/public/pm/home-task.js +2 -1
- package/workspace/public/pm/page-chat.js +14 -0
- package/workspace/public/pm/pop-work-model.js +26 -6
- package/workspace/public/pm/premium-viewer.js +1 -0
- package/workspace/public/pm/premium-vw-item.js +9 -2
- package/workspace/public/pm/task-card.js +8 -0
- package/workspace/test-lists/task-chat-scope.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.767.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,32 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.767.0",
|
|
38
|
+
"at": "2026-11-24T07:34:38.820Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1727,
|
|
43
|
+
"t": "Let the work breakdown Gantt scroll sideways",
|
|
44
|
+
"s": "Let the work breakdown Gantt scroll sideways",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.766.0",
|
|
51
|
+
"at": "2026-11-24T07:23:50.157Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1723,
|
|
56
|
+
"t": "The chat beside a task is about the task",
|
|
57
|
+
"s": "The chat beside a task is about the task",
|
|
58
|
+
"k": "fix"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.765.0",
|
|
38
64
|
"at": "2026-11-24T07:12:50.601Z",
|
|
@@ -344,38 +370,6 @@
|
|
|
344
370
|
"k": "x"
|
|
345
371
|
}
|
|
346
372
|
]
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
"v": "0.747.0",
|
|
350
|
-
"at": "2026-11-23T13:39:39.287Z",
|
|
351
|
-
"f": 4,
|
|
352
|
-
"prs": [
|
|
353
|
-
{
|
|
354
|
-
"n": 1676,
|
|
355
|
-
"t": "A guided tour, press Next to walk through a workspace",
|
|
356
|
-
"s": "A guided tour, press Next to walk through a workspace",
|
|
357
|
-
"k": "new"
|
|
358
|
-
}
|
|
359
|
-
]
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"v": "0.746.0",
|
|
363
|
-
"at": "2026-11-23T11:03:05.465Z",
|
|
364
|
-
"f": 4,
|
|
365
|
-
"prs": [
|
|
366
|
-
{
|
|
367
|
-
"n": 1670,
|
|
368
|
-
"t": "Give PressRelease a doc-category row (red main)",
|
|
369
|
-
"s": "Give PressRelease a doc-category row (red main)",
|
|
370
|
-
"k": "fix"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"n": 1668,
|
|
374
|
-
"t": "A short link for every item, which opens it in its panel on a desktop and full screen on a phone (A428)",
|
|
375
|
-
"s": "A short link for every item, which opens it in its panel on a desktop and full screen on a phone (A428)",
|
|
376
|
-
"k": "new"
|
|
377
|
-
}
|
|
378
|
-
]
|
|
379
373
|
}
|
|
380
374
|
]
|
|
381
375
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-24T07:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T07:34:35Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-24T07:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T07:34:35Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-24T07:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-24T07:34:35Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.767.0",
|
|
4
|
+
"at": "2026-11-24T07:34:38.820Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1727,
|
|
9
|
+
"t": "Let the work breakdown Gantt scroll sideways",
|
|
10
|
+
"s": "Let the work breakdown Gantt scroll sideways",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.766.0",
|
|
17
|
+
"at": "2026-11-24T07:23:50.157Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1723,
|
|
22
|
+
"t": "The chat beside a task is about the task",
|
|
23
|
+
"s": "The chat beside a task is about the task",
|
|
24
|
+
"k": "fix"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.765.0",
|
|
4
30
|
"at": "2026-11-24T07:12:50.601Z",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Layout and first run: the places, the navigation, the Viewer, the launcher and Adler"
|
|
4
4
|
description: "The places, the navigation at the left, the Viewer, the keys and the phone; the first run; when features appear; the PMOS app; and Adler."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-24
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Layout and first run
|
|
@@ -181,14 +181,14 @@ Under it, two blocks use the full width of the popup:
|
|
|
181
181
|
- **Stages.** Each stage of the workflow, with its dates under its name or "no dates yet", on a month scale with a red line for today. A stage's bar runs from the earliest start to the latest end of its tasks; a task with no start counts from its due date. Only a stage with no dated task uses the days the workflow moved through it. To change a stage's dates, change its tasks' dates. A stage has a bar only when it has real dates. A milestone is a diamond on its stage's row.
|
|
182
182
|
- **Work breakdown.** **List** or **Gantt**; PMOS keeps your choice on this computer. **List** has one box on top: type a task and press Enter. Say its stage ("… in Plan"), or it goes to the stage in progress; start with ◇ to add a milestone. Each stage with tasks is one group that says how much is done, for example "1 of 3 done". Press the group to fold it, and press it again to open it. A stage whose tasks are all done is folded until you open it. In a stage, the tasks are in date order, a late task first. A done task stays in its place, in grey with a check. Stages with no tasks fold into one line at the end. Press the box before a task to mark it done, with **Undo**. Press its name to rename it: Enter saves and Escape cancels. When you point at the row, four icons show: **Who** (You, the people on this initiative, or **PMOS does it**, which gives the task to PMOS), **Due date**, **Stage** (moves the task to another stage) and ⋯ (**Status**, **Make it a milestone** and **Open the task**). Each change has **Undo**. A Jira ticket keeps its owner and stage from Jira. **Gantt** is the table described below, with its bars.
|
|
183
183
|
|
|
184
|
-
Press the rest of a row, or a milestone, to open it as a full popup in place of the work side. Its top line has ←, the path (**Work › product › initiative**), the chat button, ⋯ and ×. ← or the initiative's name goes back to the initiative, where you left it. The chat
|
|
184
|
+
Press the rest of a row, or a milestone, to open it as a full popup in place of the work side. Its top line has ←, the path (**Work › product › initiative**), the chat button, ⋯ and ×. ← or the initiative's name goes back to the initiative, where you left it. The chat beside it is about the task or milestone itself: its own conversation, which starts with the item's status, dates, owner and notes, and the line under the chat's title reads **Task in** and the initiative. The chat button shows that chat. ← back to the initiative shows the initiative's chat again, and its sessions stay in the chat's session list. A file or a task that the chat opens itself does not change the chat. × closes the popup. A task shows its status, dates, owner, notes and what changed. A milestone also shows its date and how many days are left, the done test, **Kill if**, and the suggestion from PMOS about it when there is one.
|
|
185
185
|
|
|
186
186
|
**Artefacts** are at the top of the initiative's ⋯ menu: the brief, the prototype and the documents, each with its kind and date. Press one to open it full screen, with ← back to the initiative. A document the gate needs that nobody wrote is grey and says which gate. **Add an artefact** adds a file, a link or a new document; it is in the menu the next time you open ⋯. When PMOS suggests a merge, the suggestion is the first row of the section. After a merge, the merged file stands and says how many earlier files it holds, for example "7 earlier". An old file folds under it when its frontmatter has `superseded_by:` with the merged file's path, or when it opens with the merge's "superseded by" note. The merge suggestion then goes away by itself.
|
|
187
187
|
|
|
188
188
|
On a phone, in a shared read-only copy and in a breakdown given the whole popup, the work side keeps the three parts below. They use the full width of the popup: in a wide popup the timeline gets the extra width. A done task shows in grey text, never struck through.
|
|
189
189
|
|
|
190
190
|
- **Overview.** Three short lines from the initiative's own records: **Problem**, **Goal** (with the goal it serves, by name) and **Done when**. A line with no record says **Not written yet.** and offers a draft with ✓ and ✕. Press a line to change it; it saves when you leave the field, with **Undo**. Then one line on where it stands, **PMOS suggests** (at most three, each with ✓ and ✕), and **Details ›** for the facts: Stage, Status, Start, Target end, Next milestone, Goal, Product, Program, Workflow and Open. A fact with no value is not shown. Goal, Product, Program and Next milestone are in the link colour and open their thing; the others are plain text. An initiative that is closed or done but has open tasks shows one suggestion: **Close them** or **Reopen**.
|
|
191
|
-
- **Work breakdown.** Each stage is a row that folds and says how much is done, for example "3 of 9 done". Only the stage in progress opens by itself, and a stage whose tasks are all done stays folded until you open it. In a stage, the tasks are in date order, a late task first; a done task stays in its place, in grey. In a long stage you see the late tasks, the tasks in progress and the next five, then **N more tasks**. The stages after the next one fold to one row. A task in no stage is not in the breakdown: it is in Work › Backlog, and one quiet line under the breakdown says how many, for example **2 tasks with no stage are in the Backlog ›**. A task with no date shows no date and is never late. The timeline is on the right, with **Today** on it. Drag the grip between the columns and the timeline to make the timeline wider or narrower; a double press puts it back. Choose its span (Quarter to Full) beside the tune icon, which shows or hides columns. The four-corners icon gives the breakdown the whole popup. Type in the last row of a stage to add a task; the **Task** choice beside it makes the next one a milestone.
|
|
191
|
+
- **Work breakdown.** Each stage is a row that folds and says how much is done, for example "3 of 9 done". Only the stage in progress opens by itself, and a stage whose tasks are all done stays folded until you open it. In a stage, the tasks are in date order, a late task first; a done task stays in its place, in grey. In a long stage you see the late tasks, the tasks in progress and the next five, then **N more tasks**. The stages after the next one fold to one row. A task in no stage is not in the breakdown: it is in Work › Backlog, and one quiet line under the breakdown says how many, for example **2 tasks with no stage are in the Backlog ›**. A task with no date shows no date and is never late. The timeline is on the right, with **Today** on it. Drag the grip between the columns and the timeline to make the timeline wider or narrower; a double press puts it back. Choose its span (Quarter to Full) beside the tune icon, which shows or hides columns. A span shorter than the work opens on the period that holds today; scroll the timeline sideways to see the rest, with a sideways swipe on a trackpad, Shift and the mouse wheel, or by dragging its empty part. The item, status and date columns stay in place, and a thin bar under the dates shows where you are. A program's or a product's initiatives scroll the same way. The four-corners icon gives the breakdown the whole popup. Type in the last row of a stage to add a task; the **Task** choice beside it makes the next one a milestone.
|
|
192
192
|
- **Status.** Press a task's status and pick the new one. **When did this happen?** shows under the list, with **Today** chosen: press the status again, or Enter, to keep today. Press **Yesterday**, or **Pick a date**, when the work moved earlier than you noted it. A day in the future, or a day before the task's previous move, cannot be picked. The toast says both days, for example "Done on 14 Nov, noted today.", with **Undo**.
|
|
193
193
|
- **Open the task.** The ↗ on a row, or **Open the task** in its ⋯, opens a small popup on top: Task or Milestone, the name (press it to rename), status, dates, owner and notes. Its status asks **When did this happen?** too. ↑ and ↓ go to the task before or after it, and ⋯ has **Make it a milestone**, **Archive** and **Delete**, each with **Undo**. A change shows on the task's row at once. Escape, × or a press outside closes only the small popup, and the task's row lights for a moment.
|
|
194
194
|
- **Dates.** Press a task's date. **Task | Milestone** on top turns it into a milestone (one Date) or back into a task (Start and Due). Write a day as "15 Oct 2026", or press the calendar icon. The row's ⋯ also has **Make it a milestone** and **Open the task**.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.767.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.767.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -82,7 +82,8 @@ const look = () => {
|
|
|
82
82
|
const tag = `(${width} ${scheme})`;
|
|
83
83
|
// M1, M2: the question and its method
|
|
84
84
|
{ const { p, ctx, errs, st } = await open(width, scheme, { goal: { id: 'g1', state: 'grilling' }, messages: grill.concat({ role: 'assistant', text: QUESTION }) });
|
|
85
|
-
|
|
85
|
+
// the box's words follow the question a beat later on a slow runner: wait for them, as the other steps do
|
|
86
|
+
const s0 = await poll(p, (v) => v.methBtn && v.chips.length && v.ph === 'Answer, or pick one above');
|
|
86
87
|
ok(`M1 ${tag} the question names its method in one line with Change, and why it fits`, s0.methBtn && /Method: Done criteria/.test(s0.meth || '') && /it ends in a document/.test(s0.meth || ''), JSON.stringify(s0));
|
|
87
88
|
ok(`M1 ${tag} one dot per point the method needs, filled as agreed; no S M A R T letters`, s0.dots === 4 && s0.dotsOn === 1 && !s0.letters, JSON.stringify(s0));
|
|
88
89
|
ok(`M1 ${tag} tap answers, the recommended one marked; the box says so`, s0.chips.length === 2 && /recommended/.test(s0.rec || '') && s0.ph === 'Answer, or pick one above', JSON.stringify(s0));
|
|
@@ -51,7 +51,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
51
51
|
await page.route('**/api/initiative-premium*', (r) => { const u = r.request().url(); S.gets.push(u); if (!r.request().headers()['x-pmos-nonce']) S.vgets.push(u); const a = answer ? answer(u, S.gets.filter((x) => x === u).length) : { status: 200, body: { ok: true, state: 'ready', model: MODEL, as_of: Date.now() } }; r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); });
|
|
52
52
|
await page.route('**/api/briefing-premium/**', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }));
|
|
53
53
|
await page.goto(BASE + '/today.html?ini=self-serve-v2&ws=w1&board=w1&theme=' + theme);
|
|
54
|
-
S.up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv-mc') && !!window.__premiumWorkItem),
|
|
54
|
+
S.up = await until(() => page.evaluate(() => !!document.querySelector('#czViewer .iv-mc') && !!window.__premiumWorkItem), 45000); // the server's first reads take ~17s on main here and more on a busy CI runner
|
|
55
55
|
// When Home does not come up, say what the page holds instead, so a CI-only failure can be read from the log.
|
|
56
56
|
if (!S.up) console.log(' (R9 not up: ' + JSON.stringify(await page.evaluate(() => { const v = document.querySelector('#czViewer'); return { url: location.pathname + location.search, viewer: v ? { hidden: v.hidden, w: v.getBoundingClientRect().width, cls: v.className, html: v.innerHTML.replace(/\s+/g, ' ').slice(0, 300) } : null, item: !!window.__premiumWorkItem, body: document.body.className, fs: getComputedStyle(document.documentElement).getPropertyValue('--fs-body') }; }).catch((e) => String(e))) + ' errors ' + JSON.stringify(S.errors.slice(0, 3)) + ' gets ' + S.gets.length + ')');
|
|
57
57
|
return { page, ctx, S };
|
|
@@ -129,6 +129,13 @@ body.pw-drag, body.pw-drag * { cursor: col-resize !important; user-select: none;
|
|
|
129
129
|
.pw-span { flex: none; height: 26px; display: inline-flex; align-items: center; gap: 2px; border: 0; border-radius: var(--radius-sm); background: var(--cz-card); color: var(--cz-ink); font: inherit; font-size: var(--fs-meta); padding: 2px 6px; cursor: pointer; box-shadow: 0 0 0 1px var(--cz-hair); }
|
|
130
130
|
.pw-mk { position: absolute; top: 50%; transform: translate(-1px, -50%); font-size: var(--fs-meta); color: var(--cz-ink2); padding-left: 6px; border-left: 1px solid var(--cz-hair); line-height: 18px; pointer-events: none; }
|
|
131
131
|
.pw-tday { position: absolute; top: 50%; margin-top: calc(-1 * var(--space-8)); transform: translateX(-50%); font-size: var(--fs-badge); font-weight: var(--fw-strong); color: var(--cz-onsolid); background: var(--cz-solid); padding: 0 6px; border-radius: 99px; line-height: 16px; pointer-events: none; z-index: 1; }
|
|
132
|
+
/* the track (gantt-scroll): the timeline's content is --pw-z timelines wide and moved left by --pw-sx of them; a period shorter than the work
|
|
133
|
+
* scrolls sideways (a trackpad swipe, Shift and the wheel, or a drag on the empty part) while Item, Status and Date stay put */
|
|
134
|
+
.pw-tlin { position: absolute; top: 0; bottom: 0; left: 0; width: calc(var(--pw-z, 1) * 100%); transform: translateX(calc(var(--pw-sx, 0) / var(--pw-z, 1) * -100%)); }
|
|
135
|
+
.pw-wbs[data-pw-track] .pw-tl { touch-action: pan-y; cursor: grab; }
|
|
136
|
+
.pw-wbs[data-pw-track] .pw-tlh { overflow: hidden; }
|
|
137
|
+
.pw-wbs.pw-pan, .pw-wbs.pw-pan * { cursor: grabbing !important; user-select: none; }
|
|
138
|
+
.pw-tlbar { position: absolute; bottom: 3px; height: 3px; left: calc(var(--pw-sx, 0) / var(--pw-z, 1) * 100%); width: calc(100% / var(--pw-z, 1)); border-radius: 99px; background: color-mix(in srgb, var(--cz-ink3) 45%, transparent); pointer-events: none; }
|
|
132
139
|
.pw-now { position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--cz-ink2); transform: translateX(-.75px); pointer-events: none; }
|
|
133
140
|
.pw-key { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
134
141
|
.pw-key span { display: inline-flex; align-items: center; gap: 6px; }
|
|
@@ -210,16 +210,37 @@ function sugLine(s, under) {
|
|
|
210
210
|
+ `<span class="pw-sugb">${acts}</span></div>`;
|
|
211
211
|
}
|
|
212
212
|
function headCells(C, W, mode, kind) {
|
|
213
|
-
const mk = M.marksOf(W.span, W.today), td = mk.today;
|
|
214
|
-
// the Today pill is always on the line when today is in the window (round 3 point 8); a month mark too close to it gives way
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
+ (td != null
|
|
213
|
+
const mk = M.marksOf(W.span, W.today, W.view), td = mk.today, z = W.zoom || 1;
|
|
214
|
+
// the Today pill is always on the line when today is in the window (round 3 point 8); a month mark too close to it gives way. On a track
|
|
215
|
+
// (gantt-scroll) the distances are a window's, so they shrink as the track grows
|
|
216
|
+
const tl = C.tl ? `<div class="pw-tl pw-tlh" aria-hidden="true"><div class="pw-tlin">`
|
|
217
|
+
+ mk.months.filter((m) => m.x > 3 / z && m.x < 100 - 10 / z && !(td != null && Math.abs(m.x - td) < 7 / z)).map((m) => `<span class="pw-mk" style="left:${m.x.toFixed(2)}%">${esc(m.label)}</span>`).join('')
|
|
218
|
+
+ (td != null ? `<span class="pw-tday" style="left:clamp(24px, ${td.toFixed(2)}%, calc(100% - 24px))">Today</span>` : '') + '</div>'
|
|
219
|
+
+ (z > 1.001 ? '<i class="pw-tlbar"></i>' : '') + '</div>' : ''; // the thumb: where the window is on the track, so the scroll is seen
|
|
218
220
|
return `<div class="pw-tr pw-th" role="row"><span role="columnheader">${kind || 'Item'}</span>${W.jc ? '<span class="pw-jc" role="columnheader">Jira</span>' : ''}${C.status ? '<span role="columnheader">Status</span>' : ''}${C.date ? '<span role="columnheader">Date</span>' : ''}${tl}</div>`;
|
|
219
221
|
}
|
|
220
222
|
/* the grip between the item columns and the timeline (round 3 point 1): drag it left or right; the item columns keep about 220 px (the name)
|
|
221
223
|
* and the timeline about 240 px. Double press or Home: back to the default. The width is remembered on this computer. */
|
|
222
|
-
const tlStyle = (gc = '') => { const w = +store.get(TLW, 0), s = (w > 0 ? `--pw-tlw:${Math.round(w)}px;` : '') + (gc ? `--pw-gc:${gc};` : ''); return s ? ` style="${s}"` : ''; };
|
|
224
|
+
const tlStyle = (gc = '', W = null) => { const w = +store.get(TLW, 0), s = (w > 0 ? `--pw-tlw:${Math.round(w)}px;` : '') + (gc ? `--pw-gc:${gc};` : '') + trackStyle(W); return s ? ` style="${s}"` : ''; };
|
|
225
|
+
/* the track (gantt-scroll, Wawan 2026-11-24): a period shorter than the work scrolls sideways along the whole track, while Item, Status and
|
|
226
|
+
* Date stay put. --pw-z is the track's width in timeline widths; --pw-sx how far it has scrolled, in timeline widths (0 to z - 1). It opens
|
|
227
|
+
* on the period's window, which holds today; where the PM scrolled to is kept until the period changes. */
|
|
228
|
+
const SX = new Map();
|
|
229
|
+
const sxKey = (W) => (W ? [W.title || '', W.view ? W.view.a : '', W.span ? W.span.a + W.span.b : ''].join('|') : '');
|
|
230
|
+
const trackStyle = (W) => {
|
|
231
|
+
const z = W && W.zoom > 1.001 ? W.zoom : 1; if (z === 1) return '';
|
|
232
|
+
const k = sxKey(W), sx = SX.has(k) ? SX.get(k) : ((W.at || 0) / 100) * z;
|
|
233
|
+
return `--pw-z:${z.toFixed(4)};--pw-sx:${Math.max(0, Math.min(z - 1, sx)).toFixed(4)};`;
|
|
234
|
+
};
|
|
235
|
+
const trackAttr = (W) => (W && W.zoom > 1.001 ? ` data-pw-track="${esc(sxKey(W))}"` : '');
|
|
236
|
+
/** Scroll a card's track by dx timeline widths; it stops at either end. */
|
|
237
|
+
function scrollTrack(card, dx) {
|
|
238
|
+
const z = parseFloat(card.style.getPropertyValue('--pw-z')) || 1; if (z <= 1) return false;
|
|
239
|
+
const now = parseFloat(card.style.getPropertyValue('--pw-sx')) || 0, sx = Math.max(0, Math.min(z - 1, now + dx));
|
|
240
|
+
if (Math.abs(sx - now) < 1e-4) return false;
|
|
241
|
+
card.style.setProperty('--pw-sx', sx.toFixed(4)); SX.set(card.dataset.pwTrack || '', sx);
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
223
244
|
/* the Gantt's Jira column (WorkJiraDS, work-subtasks-followups): the grid's columns when it shows, Item · Jira · Status · Date · Timeline */
|
|
224
245
|
const gridOf = (C) => [C.tl ? 'minmax(220px, 1fr)' : 'minmax(0, 1fr)', 'minmax(0, 132px)', C.status ? (C.tl ? 'minmax(0, 112px)' : '110px') : '', C.date ? (C.tl ? 'minmax(0, 168px)' : '160px') : '', C.tl ? 'var(--pw-tl)' : ''].filter(Boolean).join(' ');
|
|
225
246
|
const gripHtml = () => `<div class="pw-tlgrip" role="separator" aria-orientation="vertical" tabindex="0" data-pw-grip aria-label="Drag to make the timeline wider or narrower. Double press to reset." title="Drag to make the timeline wider or narrower. Double press to reset."><i></i></div>`;
|
|
@@ -235,6 +256,25 @@ function wireGrip(root) {
|
|
|
235
256
|
const up = () => { g.removeEventListener('pointermove', mv); g.removeEventListener('pointerup', up); g.removeEventListener('pointercancel', up); document.body.classList.remove('pw-drag'); if (w) store.set(TLW, w); };
|
|
236
257
|
g.addEventListener('pointermove', mv); g.addEventListener('pointerup', up); g.addEventListener('pointercancel', up);
|
|
237
258
|
});
|
|
259
|
+
// the track (gantt-scroll): a sideways trackpad swipe, or Shift and the wheel, over the timeline scrolls it; a press on its empty part and a
|
|
260
|
+
// drag pans it (a bar keeps its own drag, which moves the dates)
|
|
261
|
+
root.addEventListener('wheel', (e) => {
|
|
262
|
+
const tl = e.target.closest && e.target.closest('.pw-wbs[data-pw-track] .pw-tl'); if (!tl) return;
|
|
263
|
+
const dx = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.shiftKey ? e.deltaY : 0; if (!dx) return;
|
|
264
|
+
const card = tl.closest('.pw-wbs'), px = e.deltaMode === 1 ? dx * 16 : e.deltaMode === 2 ? dx * tl.clientWidth : dx;
|
|
265
|
+
if (scrollTrack(card, px / Math.max(1, tl.clientWidth)) || Math.abs(e.deltaX) > Math.abs(e.deltaY)) e.preventDefault();
|
|
266
|
+
}, { passive: false });
|
|
267
|
+
root.addEventListener('pointerdown', (e) => {
|
|
268
|
+
if (e.button !== 0) return;
|
|
269
|
+
const tl = e.target.closest && e.target.closest('.pw-wbs[data-pw-track] .pw-tl'); if (!tl) return;
|
|
270
|
+
if (e.target.closest('button, a, input, [data-cb-ms], .iva-tb, .pw-pbar, .iva-md, .iva-b, .cb-md')) return;
|
|
271
|
+
const card = tl.closest('.pw-wbs'), w = Math.max(1, tl.clientWidth);
|
|
272
|
+
let x0 = e.clientX, moved = false;
|
|
273
|
+
try { tl.setPointerCapture(e.pointerId); } catch { /* fine */ }
|
|
274
|
+
const mv = (ev) => { const d = ev.clientX - x0; if (!moved && Math.abs(d) < 4) return; if (!moved) { moved = true; card.classList.add('pw-pan'); } x0 = ev.clientX; scrollTrack(card, -d / w); };
|
|
275
|
+
const up = () => { tl.removeEventListener('pointermove', mv); tl.removeEventListener('pointerup', up); tl.removeEventListener('pointercancel', up); card.classList.remove('pw-pan'); if (moved) root.__pwQuiet = Date.now(); };
|
|
276
|
+
tl.addEventListener('pointermove', mv); tl.addEventListener('pointerup', up); tl.addEventListener('pointercancel', up);
|
|
277
|
+
});
|
|
238
278
|
root.addEventListener('dblclick', (e) => { const g = e.target.closest('[data-pw-grip]'); if (!g) return; store.set(TLW, 0); const c = g.closest('.pw-wbs'); if (c) c.style.removeProperty('--pw-tlw'); });
|
|
239
279
|
root.addEventListener('keydown', (e) => {
|
|
240
280
|
const g = e.target.closest && e.target.closest('[data-pw-grip]'); if (!g) return;
|
|
@@ -266,7 +306,7 @@ function rowHtml(x, W, C, sugRows) {
|
|
|
266
306
|
// what the row lets the PM change, the same for every Jira row (jira-row-edit): a published copy changes nothing and shows no ✦
|
|
267
307
|
const E = WT.editOf(x, RO);
|
|
268
308
|
if (RO) sugRows = new Map();
|
|
269
|
-
const tl = C.tl ? `<div class="pw-tl">${(x.kind === 'stage' || x.kind === 'task') ? barHtml(x, W) : ''}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>` : '';
|
|
309
|
+
const tl = C.tl ? `<div class="pw-tl"><div class="pw-tlin">${(x.kind === 'stage' || x.kind === 'task') ? barHtml(x, W) : ''}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div></div>` : '';
|
|
270
310
|
// the status: a PMOS task's opens its list; a Jira ticket's moves it in Jira, and says "Moving in Jira" until Jira answers
|
|
271
311
|
const jst = E.status === 'jira' ? `<button type="button" class="pw-cell" data-pw-jstat="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status in Jira: ' + (x.jst || x.status) + '. Move it in Jira')}" title="Status, moved in Jira">${esc(x.status)}${x.jmv ? ' <small class="pw-jmv">Moving in Jira</small>' : ''}</button>` : '';
|
|
272
312
|
const stc = C.status ? `<span class="pw-st">${jst || (E.status === 'pmos' ? `<button type="button" class="pw-cell" data-pw-status="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status: ' + x.status + '. Change it')}">${esc(x.status)}</button>` : esc(x.status || ''))}</span>` : '';
|
|
@@ -306,7 +346,7 @@ function breakdownHtml(W, C, mode, full, S) {
|
|
|
306
346
|
// the tasks in no stage are not in the breakdown (Wawan, 2026-11-19): they live in Work › Backlog; one quiet line says so and goes there
|
|
307
347
|
const loose = W.looseN && !RO ? `<p class="pw-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(W.looseN === 1 ? '1 task with no stage is in the Backlog' : W.looseN + ' tasks with no stage are in the Backlog')}${SVG(P.right, 13)}</button></p>` : '';
|
|
308
348
|
return `<section class="pw-sec" aria-label="Work breakdown">${full ? `<div class="pw-sech">${tools}</div>` : `<div class="pw-sech"><h3>Work breakdown</h3>${show}${tools}</div>`}`
|
|
309
|
-
+ `<div class="pw-card pw-wbs${C.tl ? '' : ' notl'}${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}${W.jc ? ' jc' : ''}" role="table" aria-label="Work breakdown"${tlStyle(W.jc ? gridOf(C) : '')}>${C.tl ? gripHtml() : ''}${headCells(C, W, mode)}${out || '<div class="pw-tr pw-empty" role="row"><span>No task yet.</span></div>'}</div>`
|
|
349
|
+
+ `<div class="pw-card pw-wbs${C.tl ? '' : ' notl'}${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}${W.jc ? ' jc' : ''}" role="table" aria-label="Work breakdown"${tlStyle(W.jc ? gridOf(C) : '', C.tl ? W : null)}${C.tl ? trackAttr(W) : ''}>${C.tl ? gripHtml() : ''}${headCells(C, W, mode)}${out || '<div class="pw-tr pw-empty" role="row"><span>No task yet.</span></div>'}</div>`
|
|
310
350
|
+ (C.tl ? '<p class="pw-key"><span><i class="k-tb pr"></i>In progress</span><span><i class="k-tb"></i>To do</span><span><i class="k-tb dn"></i>Done</span><span><i class="k-md"></i>Milestone</span><span><i class="k-late"></i>Late</span><span><i class="k-gap"></i>No activity</span></p>' : '') + loose + '</section>';
|
|
311
351
|
}
|
|
312
352
|
/* the Artefacts (round 3 point 16): one row per Kind, in lifecycle order. Kind | Artefact (the current one) | Version | Updated. Versions and the
|
|
@@ -355,7 +395,7 @@ function model(r, v0, o) {
|
|
|
355
395
|
const g = o.goal || goalOf(o.ws, o.board, r.anchor || v.anchor);
|
|
356
396
|
const W = M.workOf(r, v, { ...o, goal: M.idShaped(g) ? '' : g, product: productName(o.product, o.ws), art: artOf(id, o.ws), open: S.open, shut: S.shut, moreOpen: S.moreOpen, farOpen: S.farOpen, focus: S.focus, subOpen: S.subOpen, subShut: S.subShut, mode: store.get(SPAN, 'full'), items: it || [], dropped: dropped() });
|
|
357
397
|
if (pd && W.overview) for (const L of W.overview.lines || []) if (pd.lines[L.id] != null) { L.text = pd.lines[L.id]; delete L.ask; delete L.miss; }
|
|
358
|
-
const mk = M.marksOf(W.span, W.today); W.tx = mk.today;
|
|
398
|
+
const mk = M.marksOf(W.span, W.today, W.view); W.tx = mk.today;
|
|
359
399
|
W.epics = (r.epics || []).filter(Boolean); RSEL = S.sel; // the epic check and the picked rows, for the Gantt rows (initiative work-subtasks)
|
|
360
400
|
// the Gantt's Jira column (work-subtasks-followups): on unless Choose columns hides it, and only when the work has a Jira row
|
|
361
401
|
W.jc = !!cols().jira && W.rows.some((x) => x.kind === 'task' && WT.keyOf(x));
|
|
@@ -1188,7 +1228,7 @@ function wireMoves(body, cur, redraw) {
|
|
|
1188
1228
|
body.addEventListener('pointerdown', (e) => {
|
|
1189
1229
|
if (e.pointerType !== 'mouse' || e.button !== 0) return;
|
|
1190
1230
|
const bar = e.target.closest && e.target.closest('.pw-kr .pw-tl .iva-tb, .pw-kr .pw-tl .pw-pbar'); if (!bar) return;
|
|
1191
|
-
const rw = bar.closest('[data-pw-row]'), tl = bar.closest('.pw-tl'), c = cur(); if (!rw || !tl || !c) return;
|
|
1231
|
+
const rw = bar.closest('[data-pw-row]'), tl = bar.closest('.pw-tlin') || bar.closest('.pw-tl'), c = cur(); if (!rw || !tl || !c) return;
|
|
1192
1232
|
const all = allOf(c), ids = SEL.shiftIds(c.S.sel, rw.dataset.pwRow, all);
|
|
1193
1233
|
const span = (Date.parse(c.W.span.b) - Date.parse(c.W.span.a)) / 864e5, w = tl.getBoundingClientRect().width, x0 = e.clientX;
|
|
1194
1234
|
const els = [...new Set(ids.concat(String(rw.dataset.pwRow)))].map((u) => body.querySelector(`.pw-kr[data-pw-row="${window.CSS.escape(u)}"] .pw-tl`)).filter(Boolean)
|
|
@@ -1413,7 +1453,7 @@ function artItems(body) {
|
|
|
1413
1453
|
/* ── one level up: a program or a product (boards 26, 27) ── */
|
|
1414
1454
|
export function levelHtml(L, o = {}) {
|
|
1415
1455
|
const W = M.levelOf(L, { today: o.today, mode: store.get(SPAN, 'full') }), C = cols(), mode = store.get(SPAN, 'full');
|
|
1416
|
-
const mk = M.marksOf(W.span, W.today); W.tx = mk.today;
|
|
1456
|
+
const mk = M.marksOf(W.span, W.today, W.view); W.tx = mk.today;
|
|
1417
1457
|
const sug = !RO && W.suggests.length ? `<div class="pw-sugs" role="list" aria-label="PMOS suggests"><p class="pw-sugh">PMOS suggests</p>${W.suggests.map((s) => sugLine(s)).join('')}</div>` : '';
|
|
1418
1458
|
// the same Overview shape as an initiative (round 3 point 10): what it is for, its goal, done when; then the status line and Details ›
|
|
1419
1459
|
const lk = 'level:' + W.kind + ':' + (W.title || ''), S = stOf(lk), open = !!S.details;
|
|
@@ -1424,12 +1464,12 @@ export function levelHtml(L, o = {}) {
|
|
|
1424
1464
|
const ov = `<section class="pw-ov" aria-label="Overview"><div class="pw-ovh"><h3>Overview</h3>${mark}${det}</div>${ovLines(W.overview, lk, false)}${W.overview.status ? `<p class="pw-ostat">${esc(W.overview.status)}</p>` : ''}${sug}${facts}</section>`;
|
|
1425
1465
|
const head = o.rowsTitle || (W.kind === 'product' ? 'Programs and initiatives' : 'Initiatives');
|
|
1426
1466
|
const rows = W.rows.map((x) => {
|
|
1427
|
-
const tl = C.tl ? `<div class="pw-tl">${barHtml({ ...x, kind: 'stage', tone: x.done ? 'dn' : '' }, W)}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div>` : '';
|
|
1467
|
+
const tl = C.tl ? `<div class="pw-tl"><div class="pw-tlin">${barHtml({ ...x, kind: 'stage', tone: x.done ? 'dn' : '' }, W)}${W.tx != null ? `<i class="pw-now" style="left:${W.tx.toFixed(2)}%"></i>` : ''}</div></div>` : '';
|
|
1428
1468
|
const lead = x.group ? `<b class="pw-grp">${esc(x.title)}</b>` : `<button type="button" class="pw-stg lv${x.sub ? ' sub' : ''}" data-pw-go="${esc(x.kind + ':' + x.id)}"><b>${esc(x.title)}</b>${SVG(P.right, 14)}${x.count ? `<small>${esc(x.count)}</small>` : ''}</button>`;
|
|
1429
1469
|
return `<div class="pw-tr pw-sr" role="row"><span class="pw-it">${lead}</span>${C.status ? `<span class="pw-st">${esc(x.stage || '')}</span>` : ''}${C.date ? `<span class="pw-dt${x.late ? ' warn' : ''}">${esc(x.date || '')}</span>` : ''}${tl}</div>`;
|
|
1430
1470
|
}).join('');
|
|
1431
1471
|
const wbs = `<section class="pw-sec" aria-label="${esc(head)}"><div class="pw-sech"><h3>${esc(head)}</h3>${!C.tl && !RO ? ib('data-pw-tl', 'Show the timeline', P.show, 'xs') : ''}<span class="pw-tools">${C.tl ? `<button type="button" class="pw-span" data-pw-span aria-haspopup="menu">${esc((M.MODES.find((m) => m[0] === mode) || M.MODES[5])[1])}${SVG(P.down, 12)}</button>` : ''}${RO ? '' : ib('data-pw-tune="wbs" aria-haspopup="menu"', 'Show or hide columns', P.tune)}</span></div>`
|
|
1432
|
-
+ `<div class="pw-card pw-wbs${C.tl ? '' : ' notl'}${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}" role="table"${tlStyle()}>${C.tl ? gripHtml() : ''}${headCells(C, W, mode, W.kind === 'product' ? 'Program or initiative' : 'Initiative').replace('<span role="columnheader">Status</span>', '<span role="columnheader">Stage</span>')}${rows || '<div class="pw-tr pw-empty" role="row"><span>Nothing one level down yet.</span></div>'}</div></section>`;
|
|
1472
|
+
+ `<div class="pw-card pw-wbs${C.tl ? '' : ' notl'}${C.status ? '' : ' nost'}${C.date ? '' : ' nodt'}" role="table"${tlStyle('', C.tl ? W : null)}${C.tl ? trackAttr(W) : ''}>${C.tl ? gripHtml() : ''}${headCells(C, W, mode, W.kind === 'product' ? 'Program or initiative' : 'Initiative').replace('<span role="columnheader">Status</span>', '<span role="columnheader">Stage</span>')}${rows || '<div class="pw-tr pw-empty" role="row"><span>Nothing one level down yet.</span></div>'}</div></section>`;
|
|
1433
1473
|
return `<div class="pw" data-pw-level>${ov}${wbs}${W.artefacts.length || o.add !== false ? artefactsHtml(W.artefacts, C, o.add !== false, { scope: lk }) : ''}</div>`;
|
|
1434
1474
|
}
|
|
1435
1475
|
export function wireLevel(body, h0, L0) {
|
|
@@ -53,6 +53,7 @@ const S = {
|
|
|
53
53
|
el: null, card: null, left: null, right: null, box: null, all: null, menu: null, toast: null, tools: null, title: null, st: null,
|
|
54
54
|
open: false, about: null, home: null, chat: null, back: null, raw: [], rows: { now: [], earlier: [], all: [] }, view: 'chat', q: '', prev: null,
|
|
55
55
|
ending: new Map(), timer: 0, toastT: 0, titles: null, opener: null, w: 0, seq: 0,
|
|
56
|
+
base: null, views: new Map(), bind: undefined, // base: what the popup was opened about; views: Viewer item id → what its chat is about
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
/* ── the page's hooks ── */
|
|
@@ -156,7 +157,17 @@ function drawDot() { const d = S.tools && S.tools.querySelector('.cz-pop-dot');
|
|
|
156
157
|
|
|
157
158
|
/* ── open and close ── */
|
|
158
159
|
VW.popHook({ host: () => { frame(); return S.left; }, show });
|
|
159
|
-
VW.onChange((d) => {
|
|
160
|
+
VW.onChange((d) => {
|
|
161
|
+
if (!d || !d.pop) return;
|
|
162
|
+
if (d.shut) { if (S.open) hide(); return; }
|
|
163
|
+
if (!S.open || RO || !d.open || d.id == null) return;
|
|
164
|
+
// the item an open with pop put on the left: its chat is the popup's base (show, retarget)
|
|
165
|
+
if (S.bind !== undefined) { S.views.set(d.id, S.bind); S.bind = undefined; return; }
|
|
166
|
+
// ← or → back to an item shown before: the chat goes back to that item's chat (the initiative's, after a task)
|
|
167
|
+
if (S.views.has(d.id)) { aboutItem(S.views.get(d.id)); return; }
|
|
168
|
+
// a drill-in that says what it is (chatAbout: a task, a milestone): the chat moves to it, unless the chat opened it itself
|
|
169
|
+
if (d.chatAbout && !d.viaChat) { const a = itemAbout(d.chatAbout); if (a) { S.views.set(d.id, a); aboutItem(a); } }
|
|
170
|
+
});
|
|
160
171
|
/** cozy-viewer.js calls this as an item goes into the popup. A popup already open keeps its chat: the work on the left changes, the chat stays. */
|
|
161
172
|
function show(pop) {
|
|
162
173
|
if (S.open) { retarget(pop); return; }
|
|
@@ -173,6 +184,7 @@ function show(pop) {
|
|
|
173
184
|
S.all.hidden = true; closeMenu();
|
|
174
185
|
const p = pop && typeof pop === 'object' ? pop : {};
|
|
175
186
|
S.about = p.session ? (p.session.ini ? { id: p.session.ini, kind: 'initiative', title: p.session.work, ws: p.session.ws } : null) : p.id ? { id: p.id, kind: p.kind || 'initiative', title: p.title || '', ws: p.ws, ...(p.path ? { path: p.path } : {}) } : null;
|
|
187
|
+
S.base = S.about; S.views = new Map(); S.bind = S.base;
|
|
176
188
|
width(parseInt(store.get('cz-pop-chat') || '', 10) || DEF_CHAT);
|
|
177
189
|
// the chat shows when it was asked for (the rail's chat icon, a session row, search's Ask PMOS), else when it was recently open on this item
|
|
178
190
|
S.userSet = false;
|
|
@@ -187,8 +199,12 @@ function show(pop) {
|
|
|
187
199
|
* item's scope ("In: <title>"), so it never keeps the previous item's conversation beside it. The same item, or none, changes nothing. */
|
|
188
200
|
function retarget(pop) {
|
|
189
201
|
const p = pop && typeof pop === 'object' ? pop : null;
|
|
190
|
-
if (!p || !p.id || p.keep || (S.
|
|
202
|
+
if (!p || !p.id || p.keep || (S.base && S.base.id === p.id)) {
|
|
203
|
+
if (p && p.id && S.base && S.base.id === p.id) { S.bind = S.base; aboutItem(null); } // the popup's own item again: its own chat
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
191
206
|
S.about = { id: p.id, kind: p.kind || 'initiative', title: p.title || '', ws: p.ws, ...(p.path ? { path: p.path } : {}) };
|
|
207
|
+
S.base = S.about; S.bind = S.base;
|
|
192
208
|
S.userSet = false;
|
|
193
209
|
chatOn(!!(p.target || p.chat || recentOn(S.about)));
|
|
194
210
|
attach(p.target || aboutTarget(S.about), null);
|
|
@@ -225,8 +241,31 @@ function aboutTarget(a) {
|
|
|
225
241
|
async function resolve(t) {
|
|
226
242
|
if (!t || !t.__about) return t;
|
|
227
243
|
const M = await pageChat(), a = t.__about;
|
|
244
|
+
if (a.item) { const x = M.itemTarget(a, a.ws); if (x) return x; } // a task, a milestone: its own conversation, with the item read in
|
|
228
245
|
return M.keyOf(a) ? M.popTarget(a, a.ws) : M.cosTarget(a.title || '', a.ws);
|
|
229
246
|
}
|
|
247
|
+
/** An item inside the popup's work (a task or a milestone over the initiative, bug 2026-11-24): { id, kind, title, ws?, parent?, subject?,
|
|
248
|
+
* say?, facts? }. null without an id and a title. */
|
|
249
|
+
function itemAbout(a) {
|
|
250
|
+
if (!a || !a.id || !a.title) return null;
|
|
251
|
+
return { id: String(a.id), kind: String(a.kind || 'item').toLowerCase(), title: String(a.title), ws: a.ws || (S.base && S.base.ws) || undefined, item: true,
|
|
252
|
+
parent: a.parent || '', subject: a.subject || '', say: a.say || '', facts: Array.isArray(a.facts) ? a.facts : [] };
|
|
253
|
+
}
|
|
254
|
+
const sameAbout = (a, b) => (!a && !b) || (!!a && !!b && a.id === b.id && (a.kind || '') === (b.kind || '') && !!a.item === !!b.item);
|
|
255
|
+
/** The chat moves to an item inside the popup's work (a task, a milestone; Wawan 2026-11-24: "When open chat from a task page, chat session
|
|
256
|
+
* should be about the task"), or back to the popup's own item with null (or the base itself). The work on the left stays; whether the chat
|
|
257
|
+
* shows does not change. The item's sessions and the initiative's stay in the session chooser. Returns false when the popup is not open. */
|
|
258
|
+
export function aboutItem(a) {
|
|
259
|
+
if (!S.open || RO) return false;
|
|
260
|
+
const next = !a || a === S.base ? S.base : a.item ? a : itemAbout(a);
|
|
261
|
+
if (!next && a) return false;
|
|
262
|
+
if (sameAbout(next, S.about)) return true;
|
|
263
|
+
S.about = next;
|
|
264
|
+
if (next) attach(aboutTarget(next), null);
|
|
265
|
+
else pageChat().then((M) => { if (S.open && !S.about) attach(M.cosTarget(''), null); }); // opened on the list of sessions: the chat over everything
|
|
266
|
+
drawDot(); read();
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
230
269
|
async function attach(want, row) {
|
|
231
270
|
const my = ++S.seq;
|
|
232
271
|
const P = await provider();
|
|
@@ -299,6 +338,7 @@ function rowHtml(r, sel) {
|
|
|
299
338
|
+ `<em class="${r.state}">${esc(r.word)}</em>`
|
|
300
339
|
+ (r.live ? `<button type="button" class="cz-pop-x" data-end="${esc(r.id)}" aria-label="${esc('End ' + r.name)}" title="End this session"><i></i></button>` : '<span></span>') + '</div>';
|
|
301
340
|
}
|
|
341
|
+
const kindWord = (k) => { const s = String(k || '').replace(/[-_]+/g, ' ').trim(); return s ? s[0].toUpperCase() + s.slice(1) : 'About'; };
|
|
302
342
|
function drawTitle() {
|
|
303
343
|
if (!S.title || !S.open) return;
|
|
304
344
|
if (S.view === 'all') {
|
|
@@ -316,7 +356,8 @@ function drawTitle() {
|
|
|
316
356
|
}
|
|
317
357
|
delete S.title.dataset.ren;
|
|
318
358
|
// one quiet context line under the session (round 3 point 19a, the phone chat's line): what the chat is about, said once
|
|
319
|
-
const a = S.about, cx = a && a.
|
|
359
|
+
const a = S.about, cx = a && a.item ? kindWord(a.kind) + (a.parent ? ' in ' + a.parent : ' · ' + a.title)
|
|
360
|
+
: a && a.title ? (a.kind === 'initiative' ? 'Initiative' : a.kind === 'program' ? 'Program' : 'About') + ' · ' + a.title : '';
|
|
320
361
|
S.title.innerHTML = `<button type="button" class="cz-pop-t" data-pop="pick" aria-haspopup="menu" aria-expanded="${on}" title="Change session" aria-label="${esc(name + '. Change session')}"><span>${esc(name)}</span>${svg(I.down, 16)}</button>`
|
|
321
362
|
+ (cx ? `<small class="cz-pop-cx" title="${esc(cx)}">${esc(cx)}</small>` : '');
|
|
322
363
|
}
|
|
@@ -501,4 +542,4 @@ export async function openCos(t) {
|
|
|
501
542
|
VW.open(sessionsItem({ target: t }));
|
|
502
543
|
return true;
|
|
503
544
|
}
|
|
504
|
-
if (typeof window !== 'undefined') { window.czOpenChat = openChat; window.czPopup = { openChat, openCos, openWork, chatTo, close, isOpen, useChat, setTitles, setOpener }; }
|
|
545
|
+
if (typeof window !== 'undefined') { window.czOpenChat = openChat; window.czPopup = { openChat, openCos, openWork, chatTo, close, isOpen, useChat, setTitles, setOpener, aboutItem }; }
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* pressed, becomes a field; Enter or leaving it saves), onClose?(uid) (the host
|
|
8
8
|
* lights the row), openIni?(id),
|
|
9
9
|
* full?: true → the full popup over the work side of the popup (work-ds-quick-edit, WorkStatesDS 4 and 6): ← and the
|
|
10
|
-
* path (path?: [crumb]) go back to the initiative, chat?() shows the
|
|
10
|
+
* path (path?: [crumb]) go back to the initiative, chat?(about) shows the chat about the task (with the one popup
|
|
11
|
+
* open, its chat already moved to the task as the task opened: window.czPopup.aboutItem), × closes the task and the popup
|
|
11
12
|
* (closeAll?()); head?(t) → html under the title (a milestone's date, done test and suggestion), its presses go to
|
|
12
13
|
* headPress?(button, { refresh, close }) }
|
|
13
14
|
* closeTask() closes it, as ✕, Esc or a press outside do. Esc closes only the small popup.
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
* where it sits, what PMOS changed) whose status pick asks when it really happened (pm/cozy-status-when.js, point 18); ⋯ with Make it a
|
|
17
18
|
* milestone, Archive and Delete (Undo). No chat inside: one level only, a second task replaces the content. On a phone it is a sheet from the bottom.
|
|
18
19
|
* Every write is the PM's press, on the board's own routes. The UI says PMOS, never Claude; icon-only buttons carry aria-label. */
|
|
19
|
-
import { taskOf, mountCard, boardSaver, cardStyle, historyFor } from './task-card.js';
|
|
20
|
+
import { taskOf, mountCard, boardSaver, cardStyle, historyFor, chatAbout } from './task-card.js';
|
|
20
21
|
import * as SWN from './cozy-status-when.js';
|
|
21
22
|
import { linkPath, copyLink } from './short-link.js'; // Copy link in ⋯ (bet A428)
|
|
22
23
|
import * as VD from './vw-ds.js'; // viewer-ds-task (board ViewerDS): the full popup's Where it stands, Linked and Activity blocks
|
|
@@ -45,10 +46,11 @@ async function rowOf(uid, ctx) {
|
|
|
45
46
|
return it ? { ...(own || {}), ...it } : own || null;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
export function closeTask() {
|
|
49
|
+
export function closeTask(o = {}) {
|
|
49
50
|
if (!S) return;
|
|
50
51
|
const S0 = S, { el, scrim, uid, ctx, prevFocus } = S;
|
|
51
52
|
S = null;
|
|
53
|
+
if (S0.chatOn && !o.all) popChat(null); // the popup stays: its chat goes back to the initiative's
|
|
52
54
|
document.removeEventListener('keydown', onKey, true);
|
|
53
55
|
if (S0.ro) S0.ro.disconnect(); if (S0.offPop) document.removeEventListener('click', S0.offPop, true); window.removeEventListener('resize', place);
|
|
54
56
|
el.remove(); scrim.remove();
|
|
@@ -66,6 +68,13 @@ function place() {
|
|
|
66
68
|
Object.assign(S.el.style, { left: r.left + 'px', top: r.top + 'px', width: r.width + 'px', height: r.height + 'px' });
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
/** The one popup's chat moves to the task (or back, with null). false when no popup is open (the task is on its own: its chat press opens one). */
|
|
72
|
+
function popChat(a) {
|
|
73
|
+
const P = typeof window !== 'undefined' ? window.czPopup : null;
|
|
74
|
+
if (!P || typeof P.aboutItem !== 'function' || !P.isOpen || !P.isOpen()) return false;
|
|
75
|
+
return P.aboutItem(a);
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
function onKey(e) {
|
|
70
79
|
if (!S) return;
|
|
71
80
|
if (e.key === 'Escape') {
|
|
@@ -97,7 +106,7 @@ export async function openTask(uid, ctx = {}) {
|
|
|
97
106
|
if (L && typeof ResizeObserver !== 'undefined') { S.ro = new ResizeObserver(place); S.ro.observe(L); }
|
|
98
107
|
window.addEventListener('resize', place); place();
|
|
99
108
|
// the popup behind closing (its scrim or its own ×) takes the full popup with it
|
|
100
|
-
S.offPop = (e) => { if (e.target.closest && e.target.closest('.cz-pop [data-pop="close"]')) closeTask(); };
|
|
109
|
+
S.offPop = (e) => { if (e.target.closest && e.target.closest('.cz-pop [data-pop="close"]')) closeTask({ all: true }); };
|
|
101
110
|
document.addEventListener('click', S.offPop, true);
|
|
102
111
|
}
|
|
103
112
|
document.addEventListener('keydown', onKey, true);
|
|
@@ -121,6 +130,8 @@ async function show(uid) {
|
|
|
121
130
|
if (!raw) { S.el.innerHTML = `<div class="ctp-h">${ib('data-ctp-close', 'Close', P.x)}</div><p class="ctp-none">This task could not be read. It may have been removed.</p>`; return; }
|
|
122
131
|
const t = taskOf(raw, { iniTitle: ctx.iniTitle ? ctx.iniTitle(raw.ini || ctx.ini) : '', board: ctx.board, ini: ctx.ini });
|
|
123
132
|
S.raw = raw; S.t = t; S.nextDay = null;
|
|
133
|
+
// the full popup over the one popup: the chat beside it is about this task now, not its initiative (bug 2026-11-24); ← gives it back
|
|
134
|
+
if (ctx.full) S.chatOn = popChat(chatAbout(t, raw)) || S.chatOn;
|
|
124
135
|
const L = ctx.list ? ctx.list() : [], i = L.indexOf(uid);
|
|
125
136
|
const kind = `<button type="button" class="ctp-kind" data-ctp-kind aria-label="${esc(t.milestone ? 'Milestone. Make it a task' : 'Task. Make it a milestone')}"${t.jira ? ' disabled' : ''}>${SVG(t.milestone ? P.dia : P.box)}<span>${t.milestone ? 'Milestone' : 'Task'}</span></button>`;
|
|
126
137
|
const title = !t.jira && ctx.rename ? `<button type="button" class="ctp-t" data-ctp-rename aria-label="${esc('Rename ' + t.title)}">${esc(t.title)}</button>` : `<span class="ctp-t">${esc(t.title)}</span>`;
|
|
@@ -265,8 +276,8 @@ async function press(e) {
|
|
|
265
276
|
if ('ctpDundo' in d) { saveDesc('', { word: 'PMOS\'s description taken back' }); return; }
|
|
266
277
|
if (b.closest('.ctp-hx')) { if (ctx.headPress) { const s0 = S; await ctx.headPress(b, { refresh: () => { if (S === s0) show(s0.uid); }, close: closeTask }); } return; }
|
|
267
278
|
if ('ctpClose' in d) { closeTask(); return; }
|
|
268
|
-
if ('ctpChat' in d) { if (ctx.chat) ctx.chat(); return; }
|
|
269
|
-
if ('ctpX' in d) { const all = ctx.closeAll; closeTask(); if (all) all(); return; }
|
|
279
|
+
if ('ctpChat' in d) { if (t) S.chatOn = popChat(chatAbout(t, S.raw)) || S.chatOn; if (ctx.chat) ctx.chat(t ? chatAbout(t, S.raw) : null); return; }
|
|
280
|
+
if ('ctpX' in d) { const all = ctx.closeAll; closeTask({ all: !!all }); if (all) all(); return; }
|
|
270
281
|
if (d.ctpStep) { const L = ctx.list ? ctx.list() : [], j = L.indexOf(S.uid) + Number(d.ctpStep); if (j >= 0 && j < L.length) show(L[j]); return; }
|
|
271
282
|
if ('ctpRename' in d && t && ctx.rename) { renameField(b); return; }
|
|
272
283
|
if ('ctpKind' in d && t) { kindOf(!t.milestone); return; }
|
|
@@ -553,7 +553,9 @@ function place(el) {
|
|
|
553
553
|
function emit(x) {
|
|
554
554
|
x = x || V;
|
|
555
555
|
const d = { open: !!V.cur, id: V.cur ? V.cur.id : null, kind: V.cur ? V.cur.kind : null, title: V.cur ? V.cur.title : null, via: V.cur ? '' : x.via || '', // via 'history': the browser's Back closed it
|
|
556
|
-
panel: 'v' + x.i, shut: !shown(x), pop: !!x.pop
|
|
556
|
+
panel: 'v' + x.i, shut: !shown(x), pop: !!x.pop,
|
|
557
|
+
// what the popup's chat should be about for this item (open({ chatAbout }): a task, a milestone), and whether the chat itself opened it
|
|
558
|
+
chatAbout: V.cur && V.cur.args && V.cur.args.chatAbout ? V.cur.args.chatAbout : null, viaChat: !!(V.cur && V.cur.viaChat) };
|
|
557
559
|
if (!x.pop) document.body.classList.toggle('cz-vw-on', side().some(shown)); // the popup covers the page: the page does not make room for it
|
|
558
560
|
G.subs.forEach((f) => { try { f(d); } catch { /* a listener's fault stays its own */ } });
|
|
559
561
|
document.dispatchEvent(new CustomEvent('cz-viewer', { detail: d }));
|
|
@@ -647,6 +649,7 @@ export function open(it) {
|
|
|
647
649
|
use(x);
|
|
648
650
|
// the chat opened it by itself (behind()): the item shown stays behind it, so ← comes back to it with its place (chat-open-keeps-back)
|
|
649
651
|
const bn = !o._inst ? G.behindNext : null; if (bn) G.behindNext = null;
|
|
652
|
+
const pr = H.press && Date.now() - H.press.t < 10000 ? H.press : null, viaChat = !!bn || !!(pr && pr.chat); // the chat opened it (an answer, a link in it)
|
|
650
653
|
if (keepsBehind(bn, V.cur, o)) o = { ...o, back: true };
|
|
651
654
|
else if (bn && V.cur && o.id != null && V.cur.id !== String(o.id)) { try { console.warn(LOG_BEHIND, 'item not kept behind', { id: o.id }); } catch { /* no console */ } }
|
|
652
655
|
// an item with unsaved changes asks first; the open goes on when it says so (and keeps a drill-in asked for before it)
|
|
@@ -674,7 +677,7 @@ export function open(it) {
|
|
|
674
677
|
V.drill = false; H.adopt = false;
|
|
675
678
|
const sameKind = V.cur && kindKey(V.cur.kind) === kindKey(o.kind);
|
|
676
679
|
leave();
|
|
677
|
-
V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, discussHome: !!o.discussHome, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, wrap: !!o.wrap, chip: o.chip && (o.chip.n > 0 || o.chip.looking) ? o.chip : null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, from: o.from || '', kindChip: o.kindChip || '', args: o };
|
|
680
|
+
V.cur = { id: o.id == null ? null : String(o.id), kind: o.kind || '', title: o.title || '', icon: o.icon, url: o.url || '', full: !!o.full, onClose: o.onClose, more: o.more, discuss: o.discuss, discussHome: !!o.discussHome, add: o.add || null, sub: o.sub || '', check: o.check || null, presses: o.presses || null, wrap: !!o.wrap, chip: o.chip && (o.chip.n > 0 || o.chip.looking) ? o.chip : null, onPress: o.onPress, guard: o.guard, rename: o.rename && typeof o.rename.save === 'function' ? o.rename : null, from: o.from || '', kindChip: o.kindChip || '', viaChat: o._nav ? false : viaChat, args: o };
|
|
678
681
|
el.setAttribute('aria-label', 'Viewer: ' + (o.kind || o.title || 'item'));
|
|
679
682
|
redraw();
|
|
680
683
|
el.querySelectorAll('.cz-vw-menu,.cz-vw-trail').forEach((m) => m.remove());
|
|
@@ -822,7 +825,7 @@ function pressAt(e) {
|
|
|
822
825
|
const t = e.target; let inst = t && t.nodeType === 1 && !t.closest('.cz-vw-trail') ? ALL.find((x) => x.el && x.el.contains(t)) || null : null;
|
|
823
826
|
// a press in the popup's chat (a file or a link it names) opens on the popup's left, behind the work shown there (board 22)
|
|
824
827
|
if (!inst && t && t.nodeType === 1 && t.closest('.cz-pop')) inst = ALL.find((x) => x.pop && shown(x)) || null;
|
|
825
|
-
H.press = { t: Date.now(), inst };
|
|
828
|
+
H.press = { t: Date.now(), inst, chat: !!(t && t.nodeType === 1 && t.closest('.cz-pop-r')) };
|
|
826
829
|
}
|
|
827
830
|
/* the trail list: hover ← or → for a moment (a mouse), or hold it (a touch). It names every step, newest first, and the page it started on. */
|
|
828
831
|
let HOLD = { t: 0, fired: 0 };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* status, the dates, the owner and the notes, and its move icon the section, the group or the initiative. Every write is the board's own route and is the PM's press; each says so
|
|
7
7
|
* in a toast with Undo, and a refusal shows the route's reason and changes nothing. Talk it through in chat is under ⋯ (the chat is beside
|
|
8
8
|
* the Viewer on Home). The PM's own items (a note, a mention made into a task) open in My work's item view (home-work.js). */
|
|
9
|
-
import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf, historyFor, deleteEntry } from './task-card.js';
|
|
9
|
+
import { taskOf, checkOf, mountCard, boardSaver, cardStyle, placeOf, historyFor, deleteEntry, chatAbout } from './task-card.js';
|
|
10
10
|
|
|
11
11
|
/** h: { VW, pmPost, toast, toastUndo?, now, ws, board, iniTitle(id), openIni(id), askInChat(task), onChange(), rename?(task),
|
|
12
12
|
* owners?() → [names], inis?() → [{ id, title }] } */
|
|
@@ -28,6 +28,7 @@ export function openTask(task, h) {
|
|
|
28
28
|
const del = deleteEntry({ ws, board, t, post: (p, b) => h.pmPost(p, b), toast, done: () => { if (h.VW.close) h.VW.close(); if (h.onChange) h.onChange(); } });
|
|
29
29
|
const body = h.VW.open({
|
|
30
30
|
id, kind: 'Task', title: t.title, icon: 'task', check: checkOf(t),
|
|
31
|
+
chatAbout: chatAbout(t, raw), // in the one popup, the chat beside it is about this task (cozy-popup.js, bug 2026-11-24)
|
|
31
32
|
// a short link (bet A428): ⋯ Copy link gives /i/t/<uid> (or /i/m/ for a milestone), which opens this task on any device
|
|
32
33
|
link: { kind: t.milestone ? 'milestone' : 'task', id: raw.uid, ws: ws || '' },
|
|
33
34
|
rename: t.jira ? null : h.rename ? h.rename(raw) : null,
|
|
@@ -114,6 +114,20 @@ export function popTarget(it, ws) {
|
|
|
114
114
|
return { ...T, popAbout: true, scope: { text: 'In: ' + T.title, icon: PIN, drop: true }, placeholder: 'Ask or tell PMOS', empty: COS_EMPTY };
|
|
115
115
|
}
|
|
116
116
|
const COS_EMPTY = 'Ask anything about your work. I read it with PMOS and say where each answer came from.';
|
|
117
|
+
/** The chat about one item that has no row of its own in a server model: a task, a milestone (bug 2026-11-24, Wawan: "When open chat from a
|
|
118
|
+
* task page, chat session should be about the task"). Its own conversation, pop:<kind>:<id>, so it never resumes the initiative's session;
|
|
119
|
+
* its first message carries what the item shows (lib/briefing-premium-agent.js popRow: title, subject, say, facts), so PMOS reads the task in.
|
|
120
|
+
* it: { id, kind, title, subject?, say?, facts?: [[label, value]] }. null without an id or a title. */
|
|
121
|
+
export function itemTarget(it, ws) {
|
|
122
|
+
const title = String((it && it.title) || '').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
123
|
+
const kind = String((it && it.kind) || 'item').trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'item';
|
|
124
|
+
const id = String((it && it.id) || '').replace(/[^A-Za-z0-9._:-]+/g, '-').replace(/^[^A-Za-z0-9]+/, '');
|
|
125
|
+
if (!id || !title) return null;
|
|
126
|
+
const key = ('pop:' + kind + ':' + id).slice(0, 104);
|
|
127
|
+
const facts = (Array.isArray(it.facts) ? it.facts : []).filter((f) => Array.isArray(f) && f[1] != null && String(f[1]).trim()).slice(0, 12).map(([a, b]) => [String(a), String(b)]);
|
|
128
|
+
return { key, ws: ws || undefined, title, about: title, role: CLAUDE, rich: false, popAbout: true, scope: { text: 'In: ' + title, icon: PIN, drop: true },
|
|
129
|
+
context: { title, subject: String(it.subject || ''), say: String(it.say || ''), facts }, placeholder: 'Ask or tell PMOS', empty: COS_EMPTY };
|
|
130
|
+
}
|
|
117
131
|
export function cosTarget(here, ws) {
|
|
118
132
|
const h = String(here || '').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
119
133
|
return { key: 'chat:main', ws: ws || undefined, title: 'Ask PMOS', about: 'Ask PMOS', role: CLAUDE, rich: false, cos: true, here: h,
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* goal (the goal's name, else the anchor), mode ('full' | 'quarter' | 'half' | 'year' | '2y' | '5y': the timeline's span), open (Set of
|
|
11
11
|
* stage keys the PM unfolded), shut (Set of stage keys the PM folded), openAll (the List: every stage with tasks opens by itself), farOpen (bool) }
|
|
12
12
|
* levelOf(L, o) → the same parts one level up: a program or a product (boards 26, 27). L: { kind, title, path, summary, facts, rows, docs, props }
|
|
13
|
+
* trackOf(dates, mode, today) → { span, view, zoom, at } the track the timeline scrolls along; view is the window that shows on open
|
|
13
14
|
* spanOf(dates, mode, today) → { a, b } ISO the window of the timeline: Full runs from the earliest start to the latest end (no bar is cut)
|
|
14
15
|
* barOf(x, span, today) → { l, w, pass, late, ms, dot } in % of the window one bar: the plan, the part that has passed, the missed date
|
|
15
16
|
* dayText(iso, today) → "4 Nov", "13 Jan 2027" dateLate(iso, today) → "4 Nov · 14 days late" | "4 Nov"
|
|
@@ -75,6 +76,23 @@ export function spanOf(dates, mode, today) {
|
|
|
75
76
|
const months = { quarter: 3, half: 6, year: 12, '2y': 24, '5y': 60 }[mode] || 12;
|
|
76
77
|
return { a: iso(start), b: iso(new Date(start.getFullYear(), start.getMonth() + months, 0)) };
|
|
77
78
|
}
|
|
79
|
+
/** The track a period scrolls along (gantt-scroll, Wawan 2026-11-24: "I should be able to scroll gantt here"): the period's window is what
|
|
80
|
+
* shows when the page opens (it holds today), and the track runs on, month by month, to the earliest and the latest date, so no bar is cut
|
|
81
|
+
* and the rest is a sideways scroll away. Full is its own window: nothing to scroll. The track stops 5 years either side of the window.
|
|
82
|
+
* → { span (the whole track), view (the window), zoom (track width / window width, ≥ 1), at (where the window starts, % of the track) } */
|
|
83
|
+
export function trackOf(dates, mode, today) {
|
|
84
|
+
const view = spanOf(dates, mode, today);
|
|
85
|
+
if (!mode || mode === 'full') return { span: view, view, zoom: 1, at: 0 };
|
|
86
|
+
const va = day(view.a), vb = day(view.b);
|
|
87
|
+
const lo = new Date(va.getFullYear() - 5, va.getMonth(), 1), hi = new Date(vb.getFullYear() + 5, vb.getMonth() + 1, 0);
|
|
88
|
+
let a = va, b = vb;
|
|
89
|
+
for (const d of (dates || []).map(day).filter(Boolean)) {
|
|
90
|
+
if (d < a) a = new Date(Math.max(lo, new Date(d.getFullYear(), d.getMonth(), 1)));
|
|
91
|
+
if (d > b) b = new Date(Math.min(hi, new Date(d.getFullYear(), d.getMonth() + 1, 0)));
|
|
92
|
+
}
|
|
93
|
+
const span = { a: iso(a), b: iso(b) };
|
|
94
|
+
return { span, view, zoom: Math.max(1, (b - a) / Math.max(DAY, vb - va)), at: Math.max(0, pct(va, span)) };
|
|
95
|
+
}
|
|
78
96
|
const pct = (d, S) => { const a = day(S.a), b = day(S.b); return ((d - a) / Math.max(DAY, b - a)) * 100; };
|
|
79
97
|
const clamp = (n) => Math.max(0, Math.min(100, n));
|
|
80
98
|
/** One bar in the window. x: { start, end, done, open }. A row with neither date has no bar (null). */
|
|
@@ -92,9 +110,11 @@ export function barOf(x, S, today) {
|
|
|
92
110
|
late: missed ? { l: clamp(pct(b0, S)), w: Math.max(0.3, tx - clamp(pct(b0, S))) } : null, ms: missed ? clamp(pct(b0, S)) : null };
|
|
93
111
|
}
|
|
94
112
|
/** The month marks on the header: the first of each month that fits, thinned to about six. */
|
|
95
|
-
export function marksOf(S, today) {
|
|
113
|
+
export function marksOf(S, today, view) {
|
|
96
114
|
const a = day(S.a), b = day(S.b), t = today instanceof Date ? today : day(today) || new Date(), out = [];
|
|
97
|
-
|
|
115
|
+
// on a track (trackOf) the marks are as close as the window that shows needs, not as the whole track would
|
|
116
|
+
const va = view ? day(view.a) : a, vb = view ? day(view.b) : b;
|
|
117
|
+
const n = (vb.getFullYear() - va.getFullYear()) * 12 + vb.getMonth() - va.getMonth();
|
|
98
118
|
const step = n <= 6 ? 1 : n <= 14 ? 3 : n <= 30 ? 6 : 12;
|
|
99
119
|
for (let d = new Date(a.getFullYear(), a.getMonth() + 1, 1); d < b; d = new Date(d.getFullYear(), d.getMonth() + 1, 1)) {
|
|
100
120
|
if (d.getMonth() % step) continue;
|
|
@@ -531,8 +551,8 @@ export function workOf(r, v, o = {}) {
|
|
|
531
551
|
const all = sug.top.concat(dv.top), rowS = new Map(sug.rows);
|
|
532
552
|
for (const [k, s] of dv.rows) if (!rowS.has(k)) rowS.set(k, s);
|
|
533
553
|
const dates = [r.start, r.end].concat(bd.rows.flatMap((x) => [x.start, x.end])).filter(Boolean);
|
|
534
|
-
const
|
|
535
|
-
return { title: v.title || r.title || '', summary: sum, overview: overviewOf(r, v, o), suggests: all.slice(0, MAX_SUGGEST), more: sug.more + Math.max(0, all.length - MAX_SUGGEST), rowSuggests: rowS, facts: factsOf(r, v, o),
|
|
554
|
+
const tk = trackOf(dates, o.mode || 'full', t), span = tk.span;
|
|
555
|
+
return { view: tk.view, zoom: tk.zoom, at: tk.at, title: v.title || r.title || '', summary: sum, overview: overviewOf(r, v, o), suggests: all.slice(0, MAX_SUGGEST), more: sug.more + Math.max(0, all.length - MAX_SUGGEST), rowSuggests: rowS, facts: factsOf(r, v, o),
|
|
536
556
|
rows: bd.rows, many: bd.many, looseN: bd.looseN || 0, span, today: iso(t), artefacts: arts };
|
|
537
557
|
}
|
|
538
558
|
|
|
@@ -545,7 +565,7 @@ export function levelOf(L, o = {}) {
|
|
|
545
565
|
const dl = x.end ? dateLate(x.end, t, !x.done) : { text: '', late: false };
|
|
546
566
|
return { ...x, date: dl.text, late: dl.late };
|
|
547
567
|
});
|
|
548
|
-
const
|
|
568
|
+
const tk = trackOf(rows.flatMap((x) => [x.start, x.end]).filter(Boolean), o.mode || 'full', t), span = tk.span;
|
|
549
569
|
const late = rows.filter((x) => x.late).length;
|
|
550
570
|
// the same Overview shape as an initiative (round 3 point 10): what it is for, its goal, done when; a line with no source offers a draft.
|
|
551
571
|
// A program reads its charter's why and goal, and Done when from its last milestone and target (initiative chat-saves-to-cards). A draft is
|
|
@@ -556,6 +576,6 @@ export function levelOf(L, o = {}) {
|
|
|
556
576
|
ask: 'Draft ' + what + ' for the ' + nm + ' ' + who + ', in two short sentences, for me to read. Say what you read. Do not invent anything the records do not say.' + save(f) } : {}) });
|
|
557
577
|
const sum = L.why ? firstSentences(L.why, 2) : L.summary && !importNote(L.summary) ? firstSentences(L.summary, 2) : '';
|
|
558
578
|
const overview = { lines: [line('for', 'For', sum, 'what the ' + nm + ' is for', 'why'), line('goal', 'Goal', L.goal || '', 'the goal of the ' + nm, 'goal'), line('done', 'Done when', L.done || '', 'how we will know the ' + nm + ' worked', '')], status: L.status || '' };
|
|
559
|
-
return { kind: L.kind, title: L.title, summary: L.summary || '', overview, facts: L.facts || [], rows, span, today: iso(t), late, artefacts: (L.docs || []).map((d) => ({ ...d, when: whenOf(d.when, t) })),
|
|
579
|
+
return { view: tk.view, zoom: tk.zoom, at: tk.at, kind: L.kind, title: L.title, summary: L.summary || '', overview, facts: L.facts || [], rows, span, today: iso(t), late, artefacts: (L.docs || []).map((d) => ({ ...d, when: whenOf(d.when, t) })),
|
|
560
580
|
suggests: suggestsOf({ props: L.props || null }).top };
|
|
561
581
|
}
|
|
@@ -89,6 +89,7 @@ function czVw(it) {
|
|
|
89
89
|
let el = null; czLast = it;
|
|
90
90
|
czOpen({ id: 'vw:' + it.id, kind: it.kind || it.title || 'Item', title: it.name || it.title || 'Item', icon: CZ_ICON[it.icon] || 'doc', url: it.url || '', rename: it.rename || null,
|
|
91
91
|
check: it.check || null, onPress: it.onPress, more: it.more, // a task's check box and its ⋯ (canvas XetX1Rest)
|
|
92
|
+
chatAbout: it.chatAbout || undefined, // the popup's chat moves to the task (cozy-popup.js, bug 2026-11-24)
|
|
92
93
|
render: (body) => {
|
|
93
94
|
el = document.createElement('div'); el.className = 'obody vw'; el.dataset.vw = it.id; el.setAttribute('role', 'region'); body.append(el);
|
|
94
95
|
if (it.render) it.render(el); else el.innerHTML = it.html || '';
|
|
@@ -9,7 +9,7 @@ import { vwOpen, vwStyle, vwClose } from './premium-viewer.js';
|
|
|
9
9
|
import { esc, iniId, taskId, stateOf, readingHtml, errorHtml, iniHtml, taskHtml, findTask, cardTask } from './premium-vw-item-model.js';
|
|
10
10
|
import { mountCard, boardSaver, checkOf, cardStyle, toastUndo, placeOf, deleteEntry, historyFor } from './task-card.js';
|
|
11
11
|
import { pmPost } from './http.js';
|
|
12
|
-
import { setCheck, retitle } from './cozy-viewer.js';
|
|
12
|
+
import { setCheck, retitle, popOpen as VW_POP } from './cozy-viewer.js';
|
|
13
13
|
|
|
14
14
|
const TRIES = 20, WAIT = 1500, KEEP = 30000;
|
|
15
15
|
const cache = new Map(); // query → { at, p }: two tabs of one initiative read once
|
|
@@ -55,7 +55,12 @@ async function openFull(o) {
|
|
|
55
55
|
rename: o.rename && typeof o.rename.save === 'function' ? (raw, title) => o.rename.save(title, {}) : null,
|
|
56
56
|
onChange: () => cache.clear(),
|
|
57
57
|
openIni: (id) => openWorkItem({ kind: 'initiative', id, title: id === o.ini && m ? m.title : '', ws: o.ws, board: o.board }),
|
|
58
|
-
chat
|
|
58
|
+
// the chat about the task itself (bug 2026-11-24), read in from what the popup shows; with the one popup open, cozy-task-pop.js moved it already
|
|
59
|
+
chat: (about) => import('./page-chat.js').then((PC) => {
|
|
60
|
+
if (VW_POP()) { const k = document.querySelector('.cz-pop [data-pop="ask"]'); if (k) k.click(); return true; }
|
|
61
|
+
const t = PC.itemTarget(about || { kind: 'task', id: uid, title: (row && row.title) || o.title || 'this task' }, ws);
|
|
62
|
+
return t ? PC.openTarget(t, { title: t.title }) : false;
|
|
63
|
+
}),
|
|
59
64
|
});
|
|
60
65
|
return true;
|
|
61
66
|
}
|
|
@@ -77,6 +82,8 @@ export function openWorkItem(o) {
|
|
|
77
82
|
id: vid,
|
|
78
83
|
title: o.title || (isTask ? 'Task' : 'Initiative'),
|
|
79
84
|
icon: isTask ? 'tk' : 'list',
|
|
85
|
+
// a task in the one popup: the chat beside it is about the task, read in (cozy-popup.js, bug 2026-11-24)
|
|
86
|
+
chatAbout: isTask && o.title ? { id: String(o.key || '').replace(/^[a-z]+:/, ''), kind: 'task', title: o.title, ws: ctx.ws || undefined, facts: [['Initiative', ctx.id], ['Task key', o.key || '']] } : undefined,
|
|
80
87
|
rename: o.rename || null, // the Viewer's rename option, from the page that knows how to write it (rename-press.js)
|
|
81
88
|
check: editable ? { state: 'todo', label: 'Mark done' } : null, // the quick Done (canvas XetX1Rest); it follows the task once read
|
|
82
89
|
onPress: (act) => { if (act === 'check' && card && cardT && !cardT.jira) card.setStatus(cardT.status === 'Done' ? 'To do' : 'Done'); },
|
|
@@ -69,6 +69,14 @@ export function taskOf(row, extra = {}) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/** What the chat about this task reads in (page-chat.js itemTarget, the server's popRow): the same facts the popup shows. */
|
|
73
|
+
export function chatAbout(t, raw = {}) {
|
|
74
|
+
const r = raw || {};
|
|
75
|
+
return { id: t.uid || String(t.key || '').replace(/^task:/, ''), kind: t.milestone ? 'milestone' : 'task', title: t.title, parent: t.iniTitle || '',
|
|
76
|
+
subject: (t.milestone ? 'Milestone' : 'Task') + (t.iniTitle ? ' in the initiative ' + t.iniTitle : '') + (t.ini ? ' (' + t.ini + ')' : '') + '. Read it with pmos before you answer.',
|
|
77
|
+
facts: [['Status', t.status], ['Start', t.start], ['Due', t.due], ['Owner', t.owner || r.owner || ''], ['Initiative', t.ini], ['Board', t.board], ['Task id', t.uid],
|
|
78
|
+
['Notes', String(t.notes || '').slice(0, 240)]] };
|
|
79
|
+
}
|
|
72
80
|
/** Where a task sits: { section, wbs }. The initiative view's model (ini-view-model.js, batch 6 item 1) owns the rules: sectionOf(task, stages)
|
|
73
81
|
* resolves the PM's placement, then the stage that made the task, then its plan-tree stage; wbsOf(title) reads the breakdown code from the
|
|
74
82
|
* title ("10.5 TC to review" sits under 10). Before that model is on the page, the same rules in their simplest form: the row's section by
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "The chat beside a task is about the task (task-chat-scope, done test C1-C5): page-chat.js itemTarget, task-card.js chatAbout and the server's popRow, plus a read of the popup's wiring. No browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"task-chat-scope.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"task-chat-scope.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|