create-pmos 0.649.0 → 0.650.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 +14 -14
- 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 +13 -0
- package/workspace/guide/layout.md +14 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-ini-panel.js +7 -1
- package/workspace/public/pm/bd-pop-ds.css +80 -0
- package/workspace/public/pm/bd-pop-ds.js +201 -0
- package/workspace/public/pm/cozy-pop-work.js +41 -3
- package/workspace/public/pm/pop-work-model.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.650.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,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.650.0",
|
|
38
|
+
"at": "2026-11-20T06:52:20.858Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1432,
|
|
43
|
+
"t": "The initiative popup is built from design system blocks",
|
|
44
|
+
"s": "The initiative popup is built from design system blocks",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.649.0",
|
|
38
51
|
"at": "2026-11-20T06:16:36.793Z",
|
|
@@ -303,19 +316,6 @@
|
|
|
303
316
|
"k": "new"
|
|
304
317
|
}
|
|
305
318
|
]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"v": "0.623.0",
|
|
309
|
-
"at": "2026-11-19T05:21:06.341Z",
|
|
310
|
-
"f": 4,
|
|
311
|
-
"prs": [
|
|
312
|
-
{
|
|
313
|
-
"n": 1405,
|
|
314
|
-
"t": "Work's bars stop at the timeline's edge at every span",
|
|
315
|
-
"s": "Work's bars stop at the timeline's edge at every span",
|
|
316
|
-
"k": "fix"
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
319
|
}
|
|
320
320
|
]
|
|
321
321
|
}
|
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-20T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-20T06:52:18Z"}
|
|
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-20T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-20T06:52:18Z"}
|
|
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-20T06:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-20T06:52:18Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.650.0",
|
|
4
|
+
"at": "2026-11-20T06:52:20.858Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1432,
|
|
9
|
+
"t": "The initiative popup is built from design system blocks",
|
|
10
|
+
"s": "The initiative popup is built from design system blocks",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.649.0",
|
|
4
17
|
"at": "2026-11-20T06:16:36.793Z",
|
|
@@ -135,7 +135,20 @@ A phone keeps its own layout. A shared read-only Board has no popup.
|
|
|
135
135
|
|
|
136
136
|
### What the popup shows for an initiative
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
On a computer the popup is built from the parts of the PMOS design system. The top line shows **Work ›**, the initiative's name, the **Initiative** chip and one line under it: the stage, the goal it is anchored to, when it opened and its owner. Press **Work** or ← to go back to the page.
|
|
139
|
+
|
|
140
|
+
The left column has three blocks:
|
|
141
|
+
|
|
142
|
+
- **Where it stands.** What is happening, in a few sentences. Then **Next**: the next three dates, a milestone as a diamond and the outcome check as a circle; press a milestone to open it. Then one suggestion from PMOS with **Why**, **PMOS will** and **Based on**. The pencil opens it so you can change it first, ✓ does it and ✕ drops it. Other suggestions are one link under it.
|
|
143
|
+
- **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 has a bar only when it has real dates. A milestone is a diamond on its stage's row.
|
|
144
|
+
- **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". A done task stays in its stage, in grey with a check. Stages with no tasks fold into one line at the end. Press the box before a task to change its status, its name to rename it, and the rest of the row to open it; ↗ and ⋯ show when you point at the row. **Gantt** is the table described below, with its bars.
|
|
145
|
+
|
|
146
|
+
The right column has two blocks:
|
|
147
|
+
|
|
148
|
+
- **The case.** **Problem**, **Goal** and **Done when** from the initiative's records, then its facts (status, dates, the next milestone, goal, product, program, workflow and what is open). Press a line to change it. A line not written offers a PMOS draft (✦) or ✕. When no line is written yet, one suggestion offers to draft them all from what is linked: ✓ sends the request to the chat, ✕ says not this, and the pencil lets you write it yourself.
|
|
149
|
+
- **Artefacts.** The brief, the prototype and the documents, each with its kind and date. A document the gate needs that nobody wrote is grey and says which gate. + adds a file, a link or a new document.
|
|
150
|
+
|
|
151
|
+
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.
|
|
139
152
|
|
|
140
153
|
- **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**.
|
|
141
154
|
- **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. In a long stage you see the late tasks, the tasks in progress and the next five, then **N more tasks**. Done tasks fold to one line, and 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.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.650.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.650.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -320,6 +320,12 @@ export const vidOf = (r) => (r.id ? String(r.id) : 'bd:' + r.key);
|
|
|
320
320
|
/** A published copy (pm/readonly.js) opens a row of Work in the one popup, read only (shared-copy brief Part A 4); the four views a phone and
|
|
321
321
|
* the narrow form keep open their side viewer, as before. */
|
|
322
322
|
const roPop = () => (window.PMOS_READONLY && document.body.classList.contains('wk-on') ? { ro: true, force: true } : {});
|
|
323
|
+
const MON3 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
324
|
+
/** The popup head's meta line (WorkPopupDS): "Triage · anchored to KR 2.3 · opened 11 Oct · owner Dara". A part the record does not hold is left out. */
|
|
325
|
+
export function metaOf(r) {
|
|
326
|
+
const d = /^(\d{4})-(\d{2})-(\d{2})/.exec(String((r && r.start) || ''));
|
|
327
|
+
return [r && r.stage, r && r.kr ? 'anchored to ' + r.kr : '', d ? 'opened ' + +d[3] + ' ' + MON3[+d[2] - 1] : '', r && r.owner ? 'owner ' + r.owner : ''].filter(Boolean).join(' · ');
|
|
328
|
+
}
|
|
323
329
|
export function openIni(r, from, o = {}) {
|
|
324
330
|
if (!O || !r || !r.track) return;
|
|
325
331
|
adding = o.addTo != null ? r.key : null; addTo = o.addTo || ''; addDates = o.addDates || null;
|
|
@@ -330,7 +336,7 @@ export function openIni(r, from, o = {}) {
|
|
|
330
336
|
// the same tile as Home's initiative page; no "Open in full": the header's expand already opens it wide (batch 14 item 5)
|
|
331
337
|
// on a desk it opens in the one popup with Ask PMOS about it beside it (slice 2 of the six-place navigation); a phone keeps its sheet
|
|
332
338
|
const B = (O.M() || {}).board || {};
|
|
333
|
-
VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r), pop: { id: r.id || '', kind: 'initiative', title: r.title, ws: r.ws || B.ws || undefined, ...roPop() },
|
|
339
|
+
VW.open({ kind: 'Initiative', title: r.title, icon: 'goal', wrap: true, id: vidOf(r), from: 'Work', kindChip: 'Initiative', sub: metaOf(r), pop: { id: r.id || '', kind: 'initiative', title: r.title, ws: r.ws || B.ws || undefined, ...roPop() },
|
|
334
340
|
discuss: r.id ? true : () => location.assign(O.askHref(r, '')), more: () => { const x = O.rowOf(r.key) || r, b = VW.bodyOf(vidOf(x)); return (PW.on(b) ? PW.moreItems(null, popExtra(x)) : []).concat(iniMore(x)); }, rename: O.rename ? O.rename(r) : null,
|
|
335
341
|
// the kind of work (batch 29 item 11, KdV1-3): its glyph stands before Discuss; a tap opens the three kinds. A published copy
|
|
336
342
|
// (pm/readonly.js) cannot change it, so it has no press: the Board's icon still names the kind
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* pm/bd-pop-ds.css — the initiative popup on a computer, built from PMOS Komorebi parts (initiative work-ds-popup; Exploring 3 page "work",
|
|
2
|
+
* boards WorkPopupDS, WorkGanttDS, WorkCaseEmptyDS). It only places the parts pm/bd-pop-ds.js draws (pm-block, pm-sug x, pm-tabs, pm-gt,
|
|
3
|
+
* pm-dia, pm-now, pm-group, pm-li, pm-fold, pm-input); the look is the system's. */
|
|
4
|
+
|
|
5
|
+
/* ── two columns: the work on the left, the case and its artefacts on the right ── */
|
|
6
|
+
.pw.pwd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: var(--space-16); align-items: start; padding-bottom: var(--space-24); }
|
|
7
|
+
.pwd-main, .pwd-side { display: flex; flex-direction: column; gap: var(--space-16); min-width: 0; }
|
|
8
|
+
.pwd-blk { gap: var(--space-12); }
|
|
9
|
+
.pwd-bh { justify-content: space-between; gap: var(--space-8); }
|
|
10
|
+
.pwd-bh .pm-h-sm { margin: 0; }
|
|
11
|
+
@container (max-width: 860px) { .pw.pwd { grid-template-columns: minmax(0, 1fr); } }
|
|
12
|
+
@media (max-width: 1100px) { .pw.pwd { grid-template-columns: minmax(0, 1fr); } }
|
|
13
|
+
|
|
14
|
+
/* ── Where it stands ── */
|
|
15
|
+
.pwd-say { margin: 0; font-size: var(--fs-body); line-height: 24px; }
|
|
16
|
+
.pwd-next { flex-wrap: wrap; gap: var(--space-8) var(--space-16); margin: 0; font-size: var(--fs-row); }
|
|
17
|
+
.pwd-nx { display: inline-flex; align-items: center; gap: var(--space-4); border: 0; background: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
|
|
18
|
+
span.pwd-nx { cursor: default; }
|
|
19
|
+
.pwd-nx:focus-visible { outline: none; box-shadow: var(--glow); border-radius: var(--radius-sm); }
|
|
20
|
+
.pwd-mk { display: inline-block; width: 10px; height: 10px; box-sizing: border-box; border: 2px solid var(--ink); flex: none; }
|
|
21
|
+
.pwd-mk.dia { transform: rotate(45deg); border-radius: 2px; }
|
|
22
|
+
.pwd-mk.ring { border-radius: 50%; }
|
|
23
|
+
.pwd-moresug { margin: 0; }
|
|
24
|
+
|
|
25
|
+
/* ── Stages: the name and its dates on the left, the track on the right ── */
|
|
26
|
+
.pwd-st { display: flex; flex-direction: column; }
|
|
27
|
+
.pwd-sr { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; min-height: 52px; }
|
|
28
|
+
.pwd-sr.pwd-sh { min-height: 24px; }
|
|
29
|
+
.pwd-sn { display: flex; flex-direction: column; font-size: var(--fs-row); line-height: 20px; }
|
|
30
|
+
.pwd-sn b { font-weight: var(--fw-strong); }
|
|
31
|
+
.pwd-sr.now .pwd-sn b { color: var(--blue); }
|
|
32
|
+
.pwd-tk { position: relative; height: 100%; min-height: 24px; }
|
|
33
|
+
.pwd-sh .pwd-tk { height: 24px; }
|
|
34
|
+
.pwd-mo { position: absolute; top: 2px; transform: translateX(-50%); font-size: var(--fs-meta); color: var(--muted); white-space: nowrap; }
|
|
35
|
+
.pwd-mo.td { color: var(--alert); font-weight: var(--fw-strong); }
|
|
36
|
+
.pwd-sr .pm-gt { height: 52px; }
|
|
37
|
+
.pwd-sr .pm-gt > .b { top: 21px; }
|
|
38
|
+
.pwd-sr .pm-now > span { display: none; }
|
|
39
|
+
|
|
40
|
+
/* ── the Work breakdown: List ── */
|
|
41
|
+
.pwd-cap { width: 100%; box-sizing: border-box; }
|
|
42
|
+
.pwd-list { display: flex; flex-direction: column; margin: 0 calc(-1 * var(--space-16)); }
|
|
43
|
+
.pwd-list .pm-group { margin-top: var(--space-4); }
|
|
44
|
+
.pwd-li { cursor: pointer; }
|
|
45
|
+
.pwd-li .pwd-tt { border: 0; background: none; padding: 0; font: inherit; font-weight: var(--fw-strong); color: inherit; text-align: left; cursor: text; max-width: 100%; }
|
|
46
|
+
.pwd-li .w.late { color: var(--alert); }
|
|
47
|
+
.pwd-li.dn { color: var(--muted); }
|
|
48
|
+
.pwd-li.dn .t { font-weight: var(--fw-regular); }
|
|
49
|
+
.pwd-ck { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: var(--radius-sm); background: none; padding: 0; color: var(--muted); }
|
|
50
|
+
button.pwd-ck { cursor: pointer; }
|
|
51
|
+
button.pwd-ck:hover { color: var(--ink); background: var(--well); }
|
|
52
|
+
.pwd-ck.dn { color: var(--leaf); }
|
|
53
|
+
.pwd-fold { cursor: default; }
|
|
54
|
+
.pwd-none { margin: var(--space-8) var(--space-16); }
|
|
55
|
+
.pwd-loose { margin: 0; }
|
|
56
|
+
|
|
57
|
+
/* ── the Work breakdown: Gantt (the breakdown table inside the block) ── */
|
|
58
|
+
.pwd-wbs.pw-sec { margin: 0; }
|
|
59
|
+
.pwd-wbs .pw-sech { margin-bottom: 0; }
|
|
60
|
+
.pwd-wbs .pw-sech .pwd-bh { flex: 1; }
|
|
61
|
+
|
|
62
|
+
/* ── The case ── */
|
|
63
|
+
.pwd-cl { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
64
|
+
.pwd-cl p { margin: 0; font-size: var(--fs-body); line-height: 24px; }
|
|
65
|
+
.pwd-cv { cursor: text; border-radius: var(--radius-sm); }
|
|
66
|
+
.pwd-cv:hover { background: var(--well); }
|
|
67
|
+
.pwd-cv:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
68
|
+
.pwd-cv.grey, .pwd-case .grey { color: var(--muted); }
|
|
69
|
+
.pwd-off { display: inline-flex; gap: var(--space-4); margin-left: var(--space-4); vertical-align: middle; }
|
|
70
|
+
.pwd-facts { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--space-4) var(--space-12); margin: 0; font-size: var(--fs-row); }
|
|
71
|
+
.pwd-facts dt { color: var(--muted); }
|
|
72
|
+
.pwd-facts dd { margin: 0; min-width: 0; }
|
|
73
|
+
.pwd-case .warn { color: var(--alert); }
|
|
74
|
+
|
|
75
|
+
/* ── Artefacts ── */
|
|
76
|
+
.pwd-art { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; margin: 0 calc(-1 * var(--space-8)); width: calc(100% + 2 * var(--space-8)); }
|
|
77
|
+
div.pwd-art { cursor: default; }
|
|
78
|
+
.pwd-art.miss .t { color: var(--muted); }
|
|
79
|
+
.pwd-art .w.warn { color: var(--alert); }
|
|
80
|
+
.pwd-ai { flex: none; color: var(--muted); display: inline-flex; }
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/* pm/bd-pop-ds.js — the initiative popup on a computer, built from the design system's blocks (initiative work-ds-popup; Exploring 3 page
|
|
2
|
+
* "work", boards WorkPopupDS, WorkGanttDS, WorkCaseEmptyDS; brief /mnt/project-files/design-system/work-rebuild/brief.md). Pure: strings
|
|
3
|
+
* only, no DOM and no reads. pm/cozy-pop-work.js draws it from pm/pop-work-model.js and wires its presses: every press here carries the
|
|
4
|
+
* popup's own data-pw-* attribute, so the handlers stay the ones the popup already has.
|
|
5
|
+
*
|
|
6
|
+
* nextOf(r, W, n) → [{ kind: 'ms' | 'check', date, text, name, uid }] the next n dates: open milestones, then the outcome check
|
|
7
|
+
* standsHtml(W, r, o) → the Where it stands block: the summary, the Next line, one expanded Suggestion. Nothing to say: ''
|
|
8
|
+
* stagesHtml(st, W) → the Stages block: each stage, its dates or "no dates yet", a month scale, the today line; a bar only for real dates
|
|
9
|
+
* listHtml(rows, W, o) → the Work breakdown's List: one capture Input, one group per stage with tasks, empty stages folded into one line
|
|
10
|
+
* wbsHead(view) → the Work breakdown's head: its name and the List / Gantt tabs
|
|
11
|
+
* caseHtml(W, o) → The case: its lines (each editable), the facts; no line written: one Suggestion to draft them all
|
|
12
|
+
* artsHtml(arts) → Artefacts: a List with Add in the head
|
|
13
|
+
* stageKeyOf(text, st) → { key, name, title } the stage a captured line names ("… in Plan"), else the stage in progress
|
|
14
|
+
*
|
|
15
|
+
* The UI says PMOS, never Claude. Buttons are icons with aria-label. */
|
|
16
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
17
|
+
const SV = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
18
|
+
export const I = {
|
|
19
|
+
star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', pen: 'M4 20h4L19 9l-4-4L4 16z', ok: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18',
|
|
20
|
+
plus: 'M12 5v14M5 12h14', more: 'M5 12h.01M12 12h.01M19 12h.01', open: 'M14 5h5v5M19 5l-8 8M18 14v5H5V6h5', box: 'M6 5h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z',
|
|
21
|
+
dia: 'M12 4l8 8-8 8-8-8z', doc: 'M7 3h7l4 4v14H7zM14 3v4h4M9.5 12h6M9.5 16h6', deck: 'M4 5h16v11H4zM12 16v4M8 20h8', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
|
|
22
|
+
proto: 'M4 5h16v12H4zM9 21h6M12 17v4', right: 'M10 7l5 5-5 5',
|
|
23
|
+
};
|
|
24
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
25
|
+
const DAY = 864e5;
|
|
26
|
+
const day = (v) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? Date.UTC(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
27
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
28
|
+
/** "4 Nov"; a year that is not today's: "13 Jan 2027". */
|
|
29
|
+
export function dayText(v, today) {
|
|
30
|
+
const d = day(v); if (d == null) return '';
|
|
31
|
+
const x = new Date(d), ty = new Date(day(today) || Date.now()).getUTCFullYear();
|
|
32
|
+
return x.getUTCDate() + ' ' + MON[x.getUTCMonth()] + (x.getUTCFullYear() !== ty ? ' ' + x.getUTCFullYear() : '');
|
|
33
|
+
}
|
|
34
|
+
/** A stage's dates: "4 – 25 Nov", "4 Nov – 9 Jan", "from 4 Nov", "ends 20 Feb", "no dates yet". */
|
|
35
|
+
export function spanText(a, b, today) {
|
|
36
|
+
if (a && b && a.slice(0, 10) === b.slice(0, 10)) return dayText(a, today);
|
|
37
|
+
if (a && b) {
|
|
38
|
+
const x = new Date(day(a)), y = new Date(day(b));
|
|
39
|
+
return x.getUTCMonth() === y.getUTCMonth() && x.getUTCFullYear() === y.getUTCFullYear() ? x.getUTCDate() + ' – ' + dayText(b, today) : dayText(a, today) + ' – ' + dayText(b, today);
|
|
40
|
+
}
|
|
41
|
+
if (a) return 'from ' + dayText(a, today);
|
|
42
|
+
if (b) return 'ends ' + dayText(b, today);
|
|
43
|
+
return 'no dates yet';
|
|
44
|
+
}
|
|
45
|
+
const inDays = (iso, today) => { const n = Math.round((day(iso) - day(today)) / DAY); return n === 0 ? 'today' : n === 1 ? 'tomorrow' : n > 1 ? 'in ' + n + ' days' : ''; };
|
|
46
|
+
const pct = (v, S) => { const a = day(S.a), b = day(S.b); return ((day(v) - a) / Math.max(DAY, b - a)) * 100; };
|
|
47
|
+
|
|
48
|
+
/* ── Where it stands ── */
|
|
49
|
+
/** The next dates of this initiative from today on: its open milestones, and the outcome check when the record holds one. */
|
|
50
|
+
export function nextOf(r, W, n = 3) {
|
|
51
|
+
const t = W.today, out = [];
|
|
52
|
+
for (const m of (r && r.milestones) || []) if (m && !m.done && m.date && m.date >= t) out.push({ kind: 'ms', date: m.date, name: m.name, uid: m.id || '' });
|
|
53
|
+
const ck = r && r.outcome && /^\d{4}-\d{2}-\d{2}/.test(String(r.outcome.next || '')) ? String(r.outcome.next).slice(0, 10) : '';
|
|
54
|
+
if (ck && ck >= t) out.push({ kind: 'check', date: ck, name: 'Check the outcome', uid: '' });
|
|
55
|
+
return out.sort((a, b) => a.date.localeCompare(b.date)).slice(0, n).map((x) => ({ ...x, text: dayText(x.date, t) }));
|
|
56
|
+
}
|
|
57
|
+
const sugWill = (s) => {
|
|
58
|
+
if (s.choices) return [];
|
|
59
|
+
const it = (s.items || []).filter((x) => x && (x.title || x.task));
|
|
60
|
+
if (s.group === 'dates' && it.length) return it.slice(0, 4).map((x) => 'Move ' + (x.title || x.task) + (x.to ? ' to ' + dayText(x.to) : ''));
|
|
61
|
+
if (it.length) return it.slice(0, 4).map((x) => String(x.title || x.task));
|
|
62
|
+
return s.ask || s.move || s.moveAll ? [s.say] : [];
|
|
63
|
+
};
|
|
64
|
+
/** One proposal as the expanded Suggestion. Pencil opens it (its page: change it first, ask about it), ✓ does it, ✕ says no. */
|
|
65
|
+
export function sugHtml(s) {
|
|
66
|
+
if (!s || !s.say) return '';
|
|
67
|
+
const row = (k, v, cls = '') => (v ? `<dt>${k}</dt><dd${cls ? ` class="${cls}"` : ''}>${v}</dd>` : '');
|
|
68
|
+
const will = sugWill(s), src = (s.sources || []).map((x) => x && x.label).filter(Boolean).join(', ');
|
|
69
|
+
const ans = s.choices
|
|
70
|
+
? s.choices.map((c, i) => `<button type="button" class="pm-btn outline" data-pw-choice="${esc(s.id + '|' + i)}">${esc(c.label)}</button>`).join('') + `<button type="button" class="pm-btn outline" data-pw-drop="${esc(s.id)}" aria-label="Not now" title="Not now">${SV(I.x)}</button>`
|
|
71
|
+
: `<button type="button" class="pm-btn" data-pw-sug="${esc(s.id)}" aria-label="Change it first" title="Change it first">${SV(I.pen)}</button>`
|
|
72
|
+
+ `<button type="button" class="pm-btn primary" data-pw-keep="${esc(s.id)}" aria-label="Yes, do it" title="Yes, do it">${SV(I.ok)}</button>`
|
|
73
|
+
+ `<button type="button" class="pm-btn outline" data-pw-drop="${esc(s.id)}" aria-label="No" title="No">${SV(I.x)}</button>`;
|
|
74
|
+
return `<div class="pm-sug x" role="group" aria-label="PMOS suggests"><div class="ttl">${SV(I.star)}<b class="say">${esc(s.say)}</b></div>`
|
|
75
|
+
+ `<dl>${row('Why', esc(s.why))}${row('PMOS will', will.length && !(will.length === 1 && will[0] === s.say) ? `<ul>${will.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '')}${row('Based on', esc(src), 'src')}</dl>`
|
|
76
|
+
+ `<div class="ans">${ans}</div></div>`;
|
|
77
|
+
}
|
|
78
|
+
export function standsHtml(W, r, o = {}) {
|
|
79
|
+
const say = (W.summary && W.summary.text) || '';
|
|
80
|
+
const nx = nextOf(r, W);
|
|
81
|
+
const next = nx.length ? `<p class="pm-row pwd-next"><span class="pm-meta">Next</span>${nx.map((x) => {
|
|
82
|
+
const mk = x.kind === 'ms' ? '<i class="pwd-mk dia" aria-hidden="true"></i>' : '<i class="pwd-mk ring" aria-hidden="true"></i>';
|
|
83
|
+
const soon = inDays(x.date, W.today), when = soon && /^(today|tomorrow|in [1-7] days)$/.test(soon) ? ` <span class="pm-badge">${esc(soon)}</span>` : '';
|
|
84
|
+
const lbl = `${mk}<span class="pm-meta code">${esc(x.text)}</span> <span>${esc(x.name)}</span>${when}`;
|
|
85
|
+
return x.uid ? `<button type="button" class="pwd-nx" data-pw-open="${esc(x.uid)}" aria-label="${esc('Open ' + x.name + ', ' + x.text)}">${lbl}</button>` : `<span class="pwd-nx">${lbl}</span>`;
|
|
86
|
+
}).join('')}</p>` : '';
|
|
87
|
+
const s = (W.suggests || [])[0], more = Math.max(0, (W.suggests || []).length - 1) + (W.more || 0);
|
|
88
|
+
const sug = o.ro ? '' : sugHtml(s) + (more ? `<p class="pwd-moresug"><button type="button" class="pw-lk" data-pw-props>${esc(plural(more, 'more suggestion', 'more suggestions'))}</button></p>` : '');
|
|
89
|
+
if (!say && !next && !sug) return '';
|
|
90
|
+
return `<section class="pm-block pwd-blk pwd-stands" aria-label="Where it stands"><h2 class="pm-h-sm pm-row">${SV(I.star).replace('pm-ic', 'pm-ic pm-star')}Where it stands</h2>`
|
|
91
|
+
+ (say ? `<p class="pwd-say">${esc(say)}</p>` : '') + next + sug + '</section>';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ── Stages ── */
|
|
95
|
+
/** st: the stage rows of the breakdown with every stage drawn ({ key, name, start, end, now, done, marks }). */
|
|
96
|
+
export function stagesHtml(st, W) {
|
|
97
|
+
const S = W.span, list = (st || []).filter((x) => x && x.kind === 'stage' && x.key !== '');
|
|
98
|
+
if (!list.length) return '';
|
|
99
|
+
const a = day(S.a), b = day(S.b), months = [];
|
|
100
|
+
for (let d = new Date(a); d.getTime() < b; ) {
|
|
101
|
+
d = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + 1, 1));
|
|
102
|
+
if (d.getTime() >= b) break;
|
|
103
|
+
months.push({ x: pct(new Date(d).toISOString().slice(0, 10), S), label: MON[d.getUTCMonth()] + (d.getUTCMonth() === 0 ? ' ' + d.getUTCFullYear() : '') });
|
|
104
|
+
}
|
|
105
|
+
const step = months.length > 14 ? 3 : 1;
|
|
106
|
+
const tx = W.today >= S.a && W.today <= S.b ? pct(W.today, S) : null;
|
|
107
|
+
const now = tx != null ? `<i class="pm-now" style="left:${tx.toFixed(2)}%"></i>` : '';
|
|
108
|
+
const scale = `<div class="pwd-sr pwd-sh" aria-hidden="true"><span></span><div class="pwd-tk">${months.filter((m, i) => i % step === 0 && m.x > 2 && m.x < 97 && !(tx != null && Math.abs(m.x - tx) < 6)).map((m) => `<span class="pwd-mo" style="left:${m.x.toFixed(2)}%">${esc(m.label)}</span>`).join('')}${tx != null ? `<span class="pwd-mo td" style="left:${tx.toFixed(2)}%">${esc(dayText(W.today, W.today))}</span>` : ''}</div></div>`;
|
|
109
|
+
const rows = list.map((x) => {
|
|
110
|
+
const bar = x.start && x.end ? (() => { const l = Math.max(0, pct(x.start, S)), r = Math.min(100, pct(x.end, S)); return r > l ? `<i class="b${x.done ? ' dn' : x.now ? ' nw' : ''}" style="left:${l.toFixed(2)}%;width:${Math.max(0.8, r - l).toFixed(2)}%"></i>` : ''; })() : '';
|
|
111
|
+
const marks = (x.marks || []).filter((m) => m.end >= S.a && m.end <= S.b).map((m) => `<button type="button" class="pm-dia${m.done ? ' dn' : m.late ? ' late' : ''}" style="left:${pct(m.end, S).toFixed(2)}%" data-pw-open="${esc(m.uid)}" aria-label="${esc(m.title + ', ' + dayText(m.end, W.today))}" title="${esc(m.title + ' · ' + dayText(m.end, W.today))}"></button>`).join('');
|
|
112
|
+
return `<div class="pwd-sr${x.now ? ' now' : ''}" role="row"><span class="pwd-sn"><b>${esc(x.name)}</b><span class="pm-meta">${esc(spanText(x.start, x.end, W.today))}</span></span><div class="pm-gt pwd-tk">${bar}${marks}${now}</div></div>`;
|
|
113
|
+
}).join('');
|
|
114
|
+
return `<section class="pm-block pwd-blk pwd-stages" aria-label="Stages"><h2 class="pm-h-sm">Stages</h2><div class="pwd-st" role="table" aria-label="Stages">${scale}${rows}</div></section>`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ── the Work breakdown ── */
|
|
118
|
+
export function wbsHead(view) {
|
|
119
|
+
const t = (k, l) => `<button type="button" class="pm-tab" role="tab" aria-selected="${view === k}" data-pwv="${k}">${l}</button>`;
|
|
120
|
+
return `<div class="pm-row pwd-bh"><h2 class="pm-h-sm">Work breakdown</h2><div class="pm-tabs" role="tablist" aria-label="View of the work breakdown">${t('list', 'List')}${t('gantt', 'Gantt')}</div></div>`;
|
|
121
|
+
}
|
|
122
|
+
/** The stage a captured line names: "Write the runbook in Plan" → Plan; else the stage in progress, else the first stage. */
|
|
123
|
+
export function stageKeyOf(text, st) {
|
|
124
|
+
const L = (st || []).filter((x) => x && x.kind === 'stage' && x.key !== '');
|
|
125
|
+
const s = String(text || '').trim();
|
|
126
|
+
for (const x of L) {
|
|
127
|
+
const re = new RegExp('\\s+(?:in|for|under|to)\\s+(?:the\\s+)?' + x.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?:\\s+stage)?\\s*$', 'i');
|
|
128
|
+
if (re.test(s)) return { key: x.key, name: x.name, title: s.replace(re, '').trim() };
|
|
129
|
+
}
|
|
130
|
+
const cur = L.find((x) => x.now) || L.find((x) => !x.done) || L[0];
|
|
131
|
+
return cur ? { key: cur.key, name: cur.name, title: s, guessed: true } : null;
|
|
132
|
+
}
|
|
133
|
+
/** rows: the breakdown with every stage open, its done tasks shown and no fold (pop-work-model.js breakdownOf). o: { ro, looseN, ms } */
|
|
134
|
+
export function listHtml(rows, W, o = {}) {
|
|
135
|
+
const groups = [], empty = [];
|
|
136
|
+
let g = null;
|
|
137
|
+
for (const x of rows || []) {
|
|
138
|
+
if (x.kind === 'stage') { g = x.key === '' ? null : { s: x, tasks: [] }; if (g) groups.push(g); continue; }
|
|
139
|
+
if (g && x.kind === 'task') g.tasks.push(x);
|
|
140
|
+
}
|
|
141
|
+
const li = (x) => {
|
|
142
|
+
const sub = [x.date, x.who && x.who !== 'You' ? x.who : ''].filter(Boolean).join(' · ');
|
|
143
|
+
const box = x.done ? `<span class="pwd-ck dn" aria-label="Done" role="img">${SV(I.ok, 14)}</span>`
|
|
144
|
+
: o.ro || x.jira ? `<span class="pwd-ck" aria-hidden="true">${SV(x.ms ? I.dia : I.box, 14)}</span>`
|
|
145
|
+
: `<button type="button" class="pwd-ck" data-pw-status="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('Status: ' + x.status + '. Change it')}" title="${esc(x.status)}">${SV(x.ms ? I.dia : I.box, 14)}</button>`;
|
|
146
|
+
const title = x.jira || o.ro || x.done ? `<span class="t">${esc(x.title)}</span>` : `<button type="button" class="t pwd-tt" data-pw-name="${esc(x.uid)}" aria-label="${esc('Rename ' + x.title)}">${esc(x.title)}</button>`;
|
|
147
|
+
const acts = o.ro ? '' : `<span class="acts"><button type="button" class="pm-btn" data-pw-open="${esc(x.uid)}" aria-label="Open the task" title="Open the task">${SV(I.open)}</button><button type="button" class="pm-btn" data-pw-row-more="${esc(x.uid)}" aria-haspopup="menu" aria-label="${esc('More for ' + x.title)}" title="More">${SV(I.more)}</button></span>`;
|
|
148
|
+
return `<div class="pm-li pwd-li${x.done ? ' dn' : ''}${x.lit ? ' now' : ''}" data-pwli="${esc(x.uid)}" data-pw-row="${esc(x.uid)}">${box}<span class="txt">${title}${sub ? `<span class="w${x.late ? ' late' : ''}">${esc(sub)}</span>` : ''}</span>${acts}</div>`;
|
|
149
|
+
};
|
|
150
|
+
const body = groups.map((G) => {
|
|
151
|
+
if (!G.tasks.length) { empty.push(G.s.name); return ''; }
|
|
152
|
+
const open = G.tasks.filter((x) => !x.done), dn = G.tasks.filter((x) => x.done);
|
|
153
|
+
return `<div class="pm-group${G.s.now ? ' now' : ''}"><b>${esc(G.s.name)}</b> <span class="pm-meta">${esc(dn.length + ' of ' + G.tasks.length + ' done')}</span></div>` + open.concat(dn).map(li).join('');
|
|
154
|
+
}).join('');
|
|
155
|
+
const fold = empty.length ? `<div class="pm-fold pwd-fold">${esc(empty.length === 1 ? empty[0] + ' has no tasks yet' : empty.slice(0, -1).join(', ') + ' and ' + empty[empty.length - 1] + ' have no tasks yet')}</div>` : '';
|
|
156
|
+
const cap = o.ro ? '' : `<input class="pm-input pwd-cap" data-pw-cap placeholder="Add a task; say its stage, or PMOS picks one" aria-label="Add a task. Say its stage, or PMOS picks one" maxlength="200" autocomplete="off">`;
|
|
157
|
+
const loose = o.looseN && !o.ro ? `<p class="pwd-loose"><button type="button" class="pw-lk" data-pw-backlog>${esc(o.looseN === 1 ? '1 task with no stage is in the Backlog' : o.looseN + ' tasks with no stage are in the Backlog')}${SV(I.right, 13)}</button></p>` : '';
|
|
158
|
+
return cap + `<div class="pwd-list" role="list" aria-label="Work breakdown">${body || (fold ? '' : '<p class="pm-meta pwd-none">No task yet.</p>')}${fold}</div>` + loose;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* ── the side column ── */
|
|
162
|
+
/** The case: the lines PMOS read from the records, each a press that edits it in place; a line not written offers a PMOS draft. No line
|
|
163
|
+
* written: one Suggestion drafts them all (✓ sends the asks to Ask PMOS), ✕ says not now, the pencil starts the first line yourself. */
|
|
164
|
+
export function caseHtml(W, o = {}) {
|
|
165
|
+
const ov = W.overview || { lines: [] }, dr = o.dropped || new Set(), oid = o.oid || '';
|
|
166
|
+
const L = ov.lines || [], none = L.length && L.every((x) => !x.text);
|
|
167
|
+
const sid = (x) => 'ov:' + oid + ':' + x.id;
|
|
168
|
+
const ask = L.filter((x) => !x.text && x.ask && !dr.has(sid(x)));
|
|
169
|
+
let top = '';
|
|
170
|
+
if (none && !o.ro && ask.length) {
|
|
171
|
+
top = `<div class="pm-sug x" role="group" aria-label="PMOS suggests"><div class="ttl">${SV(I.star)}<b class="say">Let PMOS draft the case from what is linked</b></div>`
|
|
172
|
+
+ `<dl><dt>Why</dt><dd>No line of the case is written yet.</dd><dt>PMOS will</dt><dd><ul>${ask.map((x) => `<li>${esc('Draft the ' + x.k.toLowerCase() + ' from the linked tickets, documents and meetings')}</li>`).join('')}</ul></dd><dt>What changes</dt><dd>You read the draft before it is saved.</dd></dl>`
|
|
173
|
+
+ `<div class="ans"><button type="button" class="pm-btn" data-pw-line="${esc(L[0].id)}" aria-label="Write it yourself" title="Write it yourself">${SV(I.pen)}</button>`
|
|
174
|
+
+ `<button type="button" class="pm-btn primary" data-pw-lkeep="${esc(ask.map((x) => x.id).join(','))}" aria-label="Use a PMOS draft" title="Use a PMOS draft">${SV(I.ok)}</button>`
|
|
175
|
+
+ `<button type="button" class="pm-btn outline" data-pw-ldrop="${esc(ask.map(sid).join(','))}" aria-label="Not this" title="Not this">${SV(I.x)}</button></div></div>`;
|
|
176
|
+
}
|
|
177
|
+
const lines = L.filter((x) => !(none && top) || x.text).map((x) => {
|
|
178
|
+
const ed = !o.ro && x.edit;
|
|
179
|
+
const words = x.text ? esc(x.text) : 'Not written yet.';
|
|
180
|
+
const tx = ed ? `<span class="pwd-cv${x.text ? '' : ' grey'}" data-pw-line="${esc(x.id)}" tabindex="0" role="button" aria-label="${esc((x.text ? 'Change the ' : 'Write the ') + x.k.toLowerCase())}">${words}</span>` : `<span class="${x.text ? '' : 'grey'}">${words}</span>`;
|
|
181
|
+
const src = !o.ro && x.text && x.src ? (x.path ? ` <button type="button" class="pw-osrc" data-pw-src="${esc(x.path)}">from ${esc(x.src)}</button>` : ` <span class="pm-meta">from ${esc(x.src)}</span>`) : '';
|
|
182
|
+
const off = !o.ro && !x.text && x.ask && !dr.has(sid(x)) ? `<span class="pm-row pwd-off"><button type="button" class="pm-btn" data-pw-lkeep="${esc(x.id)}" aria-label="Yes, PMOS drafts it" title="Yes, PMOS drafts it">${SV(I.star, 14)}</button><button type="button" class="pm-btn" data-pw-ldrop="${esc(sid(x))}" aria-label="No" title="No">${SV(I.x, 14)}</button></span>` : '';
|
|
183
|
+
return `<div class="pwd-cl"><span class="pm-meta">${esc(x.k)}</span><p>${tx}${x.serves ? ' <span class="pm-meta">' + esc(x.serves) + '</span>' : ''}${src}${off}</p></div>`;
|
|
184
|
+
}).join('');
|
|
185
|
+
const F = (W.facts || []).filter((f) => f && f.k !== 'Stage' && !/^no signal$/i.test(String(f.v || '').trim()));
|
|
186
|
+
const facts = F.length ? `<dl class="pwd-facts">${F.map((f) => `<dt>${esc(f.k)}</dt><dd>${f.act && !f.read && !o.ro ? `<button type="button" class="pw-lk" data-pw-fact="${esc(f.act)}">${esc(f.v)}</button>` : `<span class="${f.grey ? 'grey' : ''}${f.warn && !f.note ? ' warn' : ''}">${esc(f.v)}</span>`}${f.note ? ` <span class="pm-meta${f.warn ? ' warn' : ''}">${esc(f.note)}</span>` : ''}</dd>`).join('')}</dl>` : '';
|
|
187
|
+
return `<section class="pm-block pwd-blk pwd-case" aria-label="The case"><h2 class="pm-h-sm">The case</h2>${top}${lines}${ov.status && !W.summary ? `<p>${esc(ov.status)}</p>` : ''}${facts}</section>`;
|
|
188
|
+
}
|
|
189
|
+
const iconOf = (a) => (a.link || /^link/i.test(a.kind || '') ? I.link : /slide|deck/i.test(a.kind || '') ? I.deck : /proto|design/i.test((a.kindName || '') + ' ' + (a.kind || '') + ' ' + (a.akind || '')) ? I.proto : I.doc);
|
|
190
|
+
/** arts: the model's artefacts, in its order (each row's press is its index, as the popup's handler reads it). o: { ro, merge (the ✦ line) } */
|
|
191
|
+
export function artsHtml(arts, o = {}) {
|
|
192
|
+
const R = (arts || []).map((a, i) => ({ a, i })).filter((x) => !(o.ro && x.a.missing));
|
|
193
|
+
if (o.ro && !R.length) return '';
|
|
194
|
+
const rows = R.map(({ a, i }) => {
|
|
195
|
+
const meta = a.missing ? String(a.missing) : [a.kindName || a.kind, a.came, a.when].filter(Boolean).join(' · ');
|
|
196
|
+
const inner = `<span class="pwd-ai">${SV(iconOf(a))}</span><span class="txt"><span class="t">${esc(a.title)}</span>${meta ? `<span class="w${a.missing ? ' warn' : ''}">${esc(meta)}</span>` : ''}</span>`;
|
|
197
|
+
return a.missing || o.ro ? `<div class="pm-li pwd-art${a.missing ? ' miss' : ''}">${inner}</div>` : `<button type="button" class="pm-li pwd-art" data-pw-art="${i}">${inner}</button>`;
|
|
198
|
+
}).join('');
|
|
199
|
+
const add = o.ro ? '' : `<button type="button" class="pm-btn" data-pw-addart aria-label="Add an artefact: a file, a link, or a new document" title="Add an artefact">${SV(I.plus)}</button>`;
|
|
200
|
+
return `<section class="pm-block pwd-blk pwd-arts" aria-label="Artefacts"><div class="pm-row pwd-bh"><h2 class="pm-h-sm">Artefacts</h2>${add}</div>${o.merge || ''}${rows || '<p class="pm-meta">Nothing yet.</p>'}</section>`;
|
|
201
|
+
}
|
|
@@ -26,12 +26,16 @@ import * as ED from './ini-edit.js';
|
|
|
26
26
|
import * as SW from './cozy-status-when.js'; // When did this happen? after a status pick (round 3 point 18)
|
|
27
27
|
import * as DP from './cozy-day-pick.js'; // the app's own day field, "15 Oct 2026"
|
|
28
28
|
const { localToday } = DP;
|
|
29
|
-
import * as AK from './artefact-kind.js';
|
|
29
|
+
import * as AK from './artefact-kind.js';
|
|
30
|
+
import * as PD from './bd-pop-ds.js'; // the popup on a computer, built from the design system's blocks (initiative work-ds-popup) // the Kind of a file and one row per kind (round 3 point 16), shared with the Library // the rename and its Undo, the same write as the old List (batch 18 item 16)
|
|
30
31
|
|
|
31
|
-
const CSS = new URL('./cozy-pop-work.css', import.meta.url).href;
|
|
32
|
+
const CSS = new URL('./cozy-pop-work.css', import.meta.url).href, DSCSS = new URL('./bd-pop-ds.css', import.meta.url).href;
|
|
32
33
|
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${CSS}"]`)) {
|
|
33
34
|
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = CSS; document.head.appendChild(l);
|
|
34
35
|
}
|
|
36
|
+
if (typeof document !== 'undefined' && document.head && !document.querySelector(`link[href="${DSCSS}"]`)) {
|
|
37
|
+
const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = DSCSS; document.head.appendChild(l);
|
|
38
|
+
}
|
|
35
39
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
36
40
|
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>`;
|
|
37
41
|
const P = {
|
|
@@ -291,9 +295,30 @@ export function html(r, v, o = {}) {
|
|
|
291
295
|
const { W, S } = model(r, v, o), C = cols(), mode = store.get(SPAN, 'full');
|
|
292
296
|
if (phone() && !RO) return phoneHtml(W, S, keyOf(v, o), v);
|
|
293
297
|
if (S.big) return `<div class="pw" data-pw-big-on>${breakdownHtml(W, C, mode, true, S)}</div>`;
|
|
298
|
+
if (!RO && !phone()) return dsHtml(r, v, o, W, S, C, mode);
|
|
294
299
|
return `<div class="pw">${overviewHtml(W, S, keyOf(v, o))}${breakdownHtml(W, C, mode, false, S)}${artefactsHtml(W.artefacts, C, true, { scope: keyOf(v, o), recPath: v.prd && (v.prd.path || v.prd) })}</div>`;
|
|
295
300
|
}
|
|
296
301
|
|
|
302
|
+
/* ── a computer (initiative work-ds-popup; boards WorkPopupDS, WorkGanttDS, WorkCaseEmptyDS): the main column (Where it stands, Stages, the
|
|
303
|
+
* Work breakdown as List or Gantt) and the side column (The case, Artefacts), from the system's blocks (pm/bd-pop-ds.js). The Gantt view is the
|
|
304
|
+
* breakdown table with its bars and tools; List and Gantt are one remembered choice ('pw-view'). */
|
|
305
|
+
const VIEW = 'pw-view';
|
|
306
|
+
const allOpen = (v) => { const k = new Set(((v.tasks || {}).sections || []).filter((s) => s.kind === 'stage').map((s) => s.key)); return k; };
|
|
307
|
+
function stagesOf(r, v, o) {
|
|
308
|
+
const k = allOpen(v);
|
|
309
|
+
return M.breakdownOf(r, v, { ...o, open: k, shut: new Set(), doneOpen: k, moreOpen: k, farOpen: true }).rows;
|
|
310
|
+
}
|
|
311
|
+
function dsHtml(r, v, o, W, S, C, mode) {
|
|
312
|
+
const id = keyOf(v, o), view = store.get(VIEW, 'list') === 'gantt' ? 'gantt' : 'list';
|
|
313
|
+
const st = stagesOf(r, v, { ...o, today: W.today, focus: S.focus });
|
|
314
|
+
const wbs = view === 'gantt'
|
|
315
|
+
? breakdownHtml(W, C, mode, false, S).replace('<h3>Work breakdown</h3>', PD.wbsHead('gantt')).replace('class="pw-sec"', 'class="pw-sec pm-block pwd-blk pwd-wbs"')
|
|
316
|
+
: `<section class="pm-block pwd-blk pwd-wbs" aria-label="Work breakdown">${PD.wbsHead('list')}${PD.listHtml(st, W, { looseN: W.looseN })}</section>`;
|
|
317
|
+
const mg = mergeOf(W.artefacts), merge = mg ? `<div class="pw-sugs pw-amg" role="list" aria-label="PMOS suggests">${sugLine({ id: mg.id, say: mg.say, merge: mg })}</div>` : '';
|
|
318
|
+
return `<div class="pw pwd">${'<div class="pwd-main">'}${PD.standsHtml(W, r)}${PD.stagesHtml(st, W)}${wbs}</div>`
|
|
319
|
+
+ `<aside class="pwd-side">${PD.caseHtml(W, { oid: id, dropped: dropped() })}${PD.artsHtml(W.artefacts, { merge })}</aside></div>`;
|
|
320
|
+
}
|
|
321
|
+
|
|
297
322
|
/* ── a phone (board Ph2_init; build brief nav-structure/phone/build-brief-v2.md item 8): the popup's content in a phone layout. No cards and
|
|
298
323
|
* no table: the stage and its days over, the gate line, ✦ Overview with the lines that are written and one proposal for the ones that are not,
|
|
299
324
|
* the status line and PMOS's proposals, the Work breakdown as rows with a status dot (grey done, blue in progress, an empty ring to do), the
|
|
@@ -450,10 +475,14 @@ export function wire(body, h0, x0) {
|
|
|
450
475
|
body.addEventListener('scroll', () => { if (!body.querySelector(':scope > .pw, .pw:not(.pw-sp)')) return; const c = cur(); if (c) c.S.top = body.scrollTop; }, { passive: true });
|
|
451
476
|
body.addEventListener('click', async (e) => {
|
|
452
477
|
if (!live(e)) return;
|
|
453
|
-
const b = e.target.closest('button, [data-pw-line]');
|
|
478
|
+
const b = e.target.closest('button, [data-pw-line]');
|
|
479
|
+
// a List row (work-ds-popup): a press on the rest of the row opens the task
|
|
480
|
+
if (!b) { const li = e.target.closest('[data-pwli]'); if (li && !e.target.closest('input, textarea')) { const c0 = cur(); if (c0) openSmall(li.dataset.pwli, c0, body.__pwh, body.__pwx, body); } return; }
|
|
481
|
+
if (b.disabled || !body.contains(b)) return;
|
|
454
482
|
const c = cur(); if (!c) return;
|
|
455
483
|
const h = body.__pwh, x = body.__pwx;
|
|
456
484
|
const d = b.dataset, S = c.S, W = c.W;
|
|
485
|
+
if (d.pwv) { store.set(VIEW, d.pwv); redraw(); return; }
|
|
457
486
|
if ('pwDetails' in d) { S.details = !S.details; redraw(); return; }
|
|
458
487
|
if (d.pwFold != null) { const k = d.pwFold, open = b.getAttribute('aria-expanded') === 'true'; S.open.delete(k); S.shut.delete(k); (open ? S.shut : S.open).add(k); if (k === '') looseKeep(c.id, !open); redraw(); return; }
|
|
459
488
|
if ('pwFar' in d) { S.farOpen = true; redraw(); return; }
|
|
@@ -494,6 +523,15 @@ export function wire(body, h0, x0) {
|
|
|
494
523
|
if (!live(e)) return;
|
|
495
524
|
const t = e.target, h = body.__pwh;
|
|
496
525
|
if (t.matches && t.matches('[data-pw-line]') && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); t.click(); return; }
|
|
526
|
+
// the List's one capture Input (work-ds-popup): the task goes to the stage it names ("… in Plan"), else the stage in progress
|
|
527
|
+
if (t.matches && t.matches('[data-pw-cap]') && e.key === 'Enter') {
|
|
528
|
+
e.preventDefault(); const v0 = t.value.trim(), c = cur(); if (!v0 || !h.addTask || !c) return;
|
|
529
|
+
const ms = /^◇\s*/.test(v0), k = PD.stageKeyOf(v0.replace(/^◇\s*/, ''), stagesOf(c.r, c.v, { ...(body.__pwx.o() || {}), today: c.W.today }));
|
|
530
|
+
if (!k || !k.title) return;
|
|
531
|
+
await h.addTask(k.title, t, { section: k.key, name: k.name, ...(ms ? { milestone: true } : {}) });
|
|
532
|
+
setTimeout(() => { const f = body.querySelector('[data-pw-cap]'); if (f) { f.value = ''; f.focus(); } }, 0);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
497
535
|
if (t.matches && t.matches('[data-pw-add]') && e.key === 'Enter') {
|
|
498
536
|
e.preventDefault(); const v0 = t.value.trim(); if (!v0 || !h.addTask) return;
|
|
499
537
|
const sec = t.dataset.pwAdd, c = cur();
|
|
@@ -291,7 +291,7 @@ export function goalName(list, anchor) {
|
|
|
291
291
|
function taskRow(x, t) {
|
|
292
292
|
const dl = x.end ? dateLate(x.end, t, !x.closed) : { text: x.start ? 'from ' + dayText(x.start, t) : '', late: false };
|
|
293
293
|
const st = taskStatus(x);
|
|
294
|
-
return { kind: 'task', uid: x.uid, title: x.title, status: st, date: dl.text, late: dl.late, start: x.start || '', end: x.end || '', since: x.since || '', done: !!x.closed, ms: !!x.ms, jira: !!x.jkey, canCheck: !!x.canCheck,
|
|
294
|
+
return { kind: 'task', uid: x.uid, title: x.title, who: x.owner || '', status: st, date: dl.text, late: dl.late, start: x.start || '', end: x.end || '', since: x.since || '', done: !!x.closed, ms: !!x.ms, jira: !!x.jkey, canCheck: !!x.canCheck,
|
|
295
295
|
prog: /progress|review/i.test(st), wont: !!x.wont || st === "Won't do" };
|
|
296
296
|
}
|
|
297
297
|
/** o.focus: the task a Today row opened (round 3 item 11b): its stage, its done fold and the far stages open, and its row lit. */
|