create-pmos 0.656.0 → 0.657.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 +11 -6
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-goals.css +49 -63
- package/workspace/public/pm/goals-ds.js +207 -0
- package/workspace/public/pm/goals-model.js +9 -2
- package/workspace/public/pm/premium-goals.js +146 -61
- package/workspace/public/premium-goals.html +11 -6
- package/workspace/test-lists/goals-ds-page.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.657.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.657.0",
|
|
38
|
+
"at": "2026-11-22T03:33:57.830Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1441,
|
|
43
|
+
"t": "Goals is built from the design system's blocks",
|
|
44
|
+
"s": "Goals is built from the design system's blocks",
|
|
45
|
+
"k": "new"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.656.0",
|
|
38
51
|
"at": "2026-11-22T02:59:28.675Z",
|
|
@@ -303,19 +316,6 @@
|
|
|
303
316
|
"k": "new"
|
|
304
317
|
}
|
|
305
318
|
]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"v": "0.631.0",
|
|
309
|
-
"at": "2026-11-19T11:03:25.147Z",
|
|
310
|
-
"f": 4,
|
|
311
|
-
"prs": [
|
|
312
|
-
{
|
|
313
|
-
"n": 1412,
|
|
314
|
-
"t": "Keep a snapshot of every past sprint, with a sprint picker on the Backlog",
|
|
315
|
-
"s": "Keep a snapshot of every past sprint, with a sprint picker on the Backlog",
|
|
316
|
-
"k": "new"
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T03:33:54Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T03:33:54Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-22T03:33:54Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.657.0",
|
|
4
|
+
"at": "2026-11-22T03:33:57.830Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1441,
|
|
9
|
+
"t": "Goals is built from the design system's blocks",
|
|
10
|
+
"s": "Goals is built from the design system's blocks",
|
|
11
|
+
"k": "new"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.656.0",
|
|
4
17
|
"at": "2026-11-22T02:59:28.675Z",
|
|
@@ -219,12 +219,17 @@ The notes of a held meeting look the same wherever you open them: a short summar
|
|
|
219
219
|
|
|
220
220
|
**Goals** in the navigation answers "Am I on track? What do I do?" for the products you chose at the top left. The product choice and each product's heading show the product's name, such as IDPF, not the name of its folder. When a key result waits on a source, Goals names the tool, such as Confluence, and not a page number. It reads your OKR file as one hierarchy: the North Star, then each objective with its key results, the levers behind them and the initiatives that move them.
|
|
221
221
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
222
|
+
The page is one column of blocks.
|
|
223
|
+
|
|
224
|
+
1. The top line is the path (**Goals ›** the product), the period, such as Q4 2026, then Search, **+** (New key result) and **⋯**.
|
|
225
|
+
2. **Where it stands** says what matters now: how many key results are on pace, which one is behind and the work that moves it with its date, a key result with no reading and since when, and the next check. Press a name to open it.
|
|
226
|
+
3. Under it, PMOS makes one suggestion. It shows **Why**, **PMOS will**, **What changes** and **Based on**. Press the tick to do it, the pencil to change the words first, or the cross to say no. When PMOS drafted a North Star, the tick keeps it and the cross drops it. You can undo either for a moment.
|
|
227
|
+
4. **North Star**, **Input** and **Guardrail** show their reading, the day it was read and a small line of the readings. A measure that does not exist shows no block.
|
|
228
|
+
5. **Key results** is one table, grouped by objective, then health budgets, then the work that names no key result. Each row shows the reading against its target, its pace, the work that moves it and its check date. A dash means nothing reads it yet, and the row says what it waits on. PMOS never shows a number it did not read. The tabs show **All**, **Behind**, **No reading** or **On pace**. **Choose columns** adds **Left** (the days left) and **Levers**.
|
|
229
|
+
6. For work that names no key result, PMOS says which key result it thinks the work moves and the words they share. Press the link button to put the words in the chat box.
|
|
230
|
+
7. Press a key result to open it with the chat beside it: what PMOS read, the target and time left, the levers, the work that names it, and the source to connect. Press an initiative to open it. When its outcome check is overdue, the verdict page opens.
|
|
231
|
+
8. **Ask about your goals** at the end is the chat about the product's goals. Ask why a key result is behind, or say a new one.
|
|
232
|
+
9. Under **⋯**: **Set up** (names to confirm and sources to connect), **Charts and dashboards** (the readings and charts, on the Intelligence page) and **Export CSV**.
|
|
228
233
|
|
|
229
234
|
Reports are routine jobs, so they live in Routine.
|
|
230
235
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.657.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.657.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -1,66 +1,65 @@
|
|
|
1
|
-
/* cozy-goals.css — Goals' own layout (initiative goals-
|
|
2
|
-
* The look is the system's parts (pm/komorebi.css, scope .pm-ds: pm-
|
|
3
|
-
* places them and names no colour, size or radius of its own: every colour, space, radius and shadow
|
|
4
|
-
* (cozy.css: the panel, the rail) is not restyled here. The popup pages
|
|
5
|
-
* their few extra rules are at the end. */
|
|
1
|
+
/* cozy-goals.css — Goals' own layout, rebuilt from design system blocks (initiative goals-ds-page; board GoalsDS on Exploring 3, page "pages").
|
|
2
|
+
* The look is the system's parts (pm/komorebi.css, scope .pm-ds: pm-path, pm-chip, pm-block, pm-sug x, pm-num, pm-tabs, pm-table, pm-group,
|
|
3
|
+
* pm-badge, pm-menu, pm-btn); this file only places them and names no colour, size or radius of its own: every colour, space, radius and shadow
|
|
4
|
+
* is a system token (design-system/ui/README.md). The shared shell (cozy.css: the panel, the rail) is not restyled here. The popup pages
|
|
5
|
+
* (pm/goals-open.js) use the popup's .pw classes (cozy-pop-work.css); their few extra rules are at the end. */
|
|
6
6
|
.gl-page .vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
|
7
7
|
.gl { display: flex; flex-direction: column; gap: var(--space-16); color: var(--ink); }
|
|
8
|
-
.gl-bar { min-height: 44px; flex-wrap: nowrap; }
|
|
9
|
-
.gl-ttl { margin-right: var(--space-4); }
|
|
8
|
+
.gl-bar { min-height: 44px; flex-wrap: nowrap; gap: var(--space-12); }
|
|
10
9
|
.gl-sp { flex: 1; }
|
|
11
|
-
.gl-per { gap: 6px; white-space: nowrap; }
|
|
12
10
|
.gl-per[hidden] { display: none; }
|
|
13
|
-
.gl-per .pm-ic { width: 14px; height: 14px; }
|
|
14
|
-
.gl-pers { color: var(--muted); }
|
|
15
11
|
#glMore .pm-ic { stroke-width: 3; }
|
|
16
12
|
.gl-mw { position: relative; display: inline-flex; }
|
|
17
|
-
.gl-fdot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--blue); }
|
|
18
13
|
.gl-menu { position: absolute; top: 100%; right: 0; z-index: 30; margin-top: var(--space-4); }
|
|
19
14
|
.gl-menu[hidden] { display: none; }
|
|
20
15
|
.gl-menu button[aria-checked="true"] { font-weight: var(--fw-strong); }
|
|
21
16
|
.gl-menu button[aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--blue); }
|
|
22
|
-
|
|
17
|
+
|
|
18
|
+
/* one column of blocks (GoalsDS: single column, 1080 wide at most) */
|
|
19
|
+
.gl-col { width: 100%; max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-16); }
|
|
20
|
+
#glBody, .gl-p { display: flex; flex-direction: column; gap: var(--space-16); }
|
|
23
21
|
.gl-p + .gl-p { margin-top: var(--space-16); }
|
|
24
22
|
.gl-m0 { margin: 0; }
|
|
25
|
-
.gl-al { color: var(--alert); }
|
|
26
|
-
|
|
27
|
-
/* the hierarchy: one pm-table; an objective's name, levers and initiatives span its key results' rows */
|
|
28
|
-
.gl-tb { overflow-x: auto; }
|
|
29
|
-
.gl-tb .pm-table { font-size: var(--fs-row); }
|
|
30
|
-
.gl-tb .pm-table thead th { font-size: var(--fs-meta); white-space: nowrap; background: var(--well); }
|
|
31
|
-
.gl-tb .pm-table tbody + tbody tr.gl-first > * { border-top: 1px solid var(--line); }
|
|
32
|
-
.gl-tb .pm-table td, .gl-tb .pm-table tbody th { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
|
|
33
|
-
.gl-tb .pm-table tr:hover td { background: none; }
|
|
34
|
-
.gl-tb .pm-table th.gl-obj { width: 120px; text-align: left; font-weight: var(--fw-regular); color: var(--ink); padding-top: 12px; }
|
|
35
|
-
.gl-obj > *, .gl-lv > div > *, .gl-wide > * { display: block; }
|
|
36
|
-
.gl-obj .pm-badge { display: inline-flex; margin-top: var(--space-4); }
|
|
37
|
-
.gl-lv > div + div { margin-top: var(--space-8); }
|
|
38
|
-
.gl-lv b, .gl-wide b, .gl-obj b { font-weight: var(--fw-strong); }
|
|
39
|
-
.gl-act { width: 128px; white-space: nowrap; }
|
|
40
|
-
.gl-left { width: 84px; white-space: nowrap; }
|
|
41
|
-
.gl-lv { width: 18%; }
|
|
42
|
-
.gl-in { width: 24%; }
|
|
43
|
-
.gl-inis { display: flex; flex-direction: column; gap: var(--space-4); }
|
|
44
|
-
/* a key result and an initiative are buttons inside their cell: the row hover of the system, the system's focus ring */
|
|
45
|
-
.gl-hit { all: unset; box-sizing: border-box; width: 100%; display: flex; flex-direction: column; gap: 2px; padding: var(--space-4) var(--space-8); margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-8)); border-radius: var(--radius-md); cursor: pointer; transition: background var(--duration-quick) var(--ease-out); }
|
|
46
|
-
.gl-hit:hover { background: var(--well); }
|
|
47
|
-
.gl-hit:focus-visible { box-shadow: var(--glow); }
|
|
48
|
-
.gl-hit b { font-weight: var(--fw-strong); }
|
|
49
|
-
.gl-hit > .pm-meta { display: flex; align-items: center; gap: 6px; }
|
|
50
|
-
.gl-kr .gl-hit > span:first-child { font-weight: var(--fw-strong); }
|
|
51
|
-
.gl-tok { margin-right: 6px; font-weight: var(--fw-regular); }
|
|
52
|
-
.gl-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
53
|
-
/* an outcome's check date: a small diamond, alert once it is overdue */
|
|
54
|
-
.gl-dm { width: 8px; height: 8px; transform: rotate(45deg); border: 2px solid var(--muted); border-radius: 2px; display: inline-block; flex: none; }
|
|
55
|
-
.gl-dm.rd { border-color: var(--alert); }
|
|
56
|
-
.gl-n { margin: 0 var(--space-4); }
|
|
57
|
-
.gl-n[hidden] { display: none; }
|
|
58
|
-
.gl-n a { color: inherit; }
|
|
23
|
+
.gl-al, .gl-al a { color: var(--alert); }
|
|
59
24
|
.gl-none { padding: var(--space-24) var(--space-16); margin: 0; }
|
|
60
25
|
.gl-sk { display: flex; flex-direction: column; gap: var(--space-12); }
|
|
61
26
|
.gl-sk i { display: block; height: 44px; }
|
|
62
27
|
.gl-sk i:first-child { height: 96px; }
|
|
63
28
|
|
|
29
|
+
/* North Star, input, guardrail: Number blocks side by side */
|
|
30
|
+
.gl-nums { display: flex; gap: var(--space-16); align-items: stretch; }
|
|
31
|
+
.gl-nums > .pm-block { flex: 1; min-width: 0; }
|
|
32
|
+
.gl-numr { gap: var(--space-16); flex-wrap: nowrap; }
|
|
33
|
+
|
|
34
|
+
/* Key results: one pm-table, its group rows the system's pm-group */
|
|
35
|
+
.gl-tw { overflow-x: auto; margin: 0 calc(-1 * var(--space-8)); }
|
|
36
|
+
.gl-krs .pm-table td, .gl-krs .pm-table th { white-space: nowrap; }
|
|
37
|
+
.gl-krs .pm-table tr.gl-g td { padding: 0; }
|
|
38
|
+
.gl-krs .pm-table tr.gl-g:hover td { background: none; }
|
|
39
|
+
.gl-krs .pm-group b { color: var(--ink); }
|
|
40
|
+
.gl-krs .pm-group span { font-weight: var(--fw-regular); }
|
|
41
|
+
.gl-kr { padding-left: var(--space-24) !important; }
|
|
42
|
+
.gl-k, .gl-kr a { color: var(--ink); font-weight: var(--fw-strong); text-decoration: none; }
|
|
43
|
+
.gl-k:hover, .gl-kr a:hover, .gl-mvs a:hover { text-decoration: underline; }
|
|
44
|
+
.gl-k:focus-visible, .gl-mvs a:focus-visible, .gl-stands a:focus-visible { outline: none; box-shadow: var(--glow); border-radius: var(--radius-sm); }
|
|
45
|
+
.gl-mvs { white-space: normal !important; }
|
|
46
|
+
.gl-mvs a { color: var(--ink); text-decoration: none; }
|
|
47
|
+
.gl-now { font-variant-numeric: tabular-nums; }
|
|
48
|
+
.gl-meter { display: inline-block; vertical-align: middle; margin-left: var(--space-8); }
|
|
49
|
+
.gl-lvs > span { display: block; }
|
|
50
|
+
.gl-end { text-align: right; }
|
|
51
|
+
.gl-tn { font-weight: var(--fw-regular); color: var(--muted); }
|
|
52
|
+
|
|
53
|
+
/* the Conversation: the one chat, in a block of its own height */
|
|
54
|
+
.gl-talk[hidden] { display: none; }
|
|
55
|
+
.gl-chat { height: 420px; display: flex; flex-direction: column; min-height: 0; }
|
|
56
|
+
.gl-chat > .pc-chat { flex: 1 1 auto; min-height: 0; }
|
|
57
|
+
.gl-chat > .pc-chat > .hm-reopen { display: none; }
|
|
58
|
+
.gl-chat.away::before { content: "The chat is open in the window beside."; color: var(--muted); font-size: var(--fs-meta); }
|
|
59
|
+
.gl-n { margin: 0 var(--space-4); }
|
|
60
|
+
.gl-n[hidden] { display: none; }
|
|
61
|
+
.gl-n a { color: inherit; }
|
|
62
|
+
|
|
64
63
|
/* the popup pages (boards 31, 32, 33) */
|
|
65
64
|
.gl-pg .gl-top p { margin: 4px 0 0; color: var(--muted); }
|
|
66
65
|
.gl-pg .gl-top.gl-set { border-color: var(--line); }
|
|
@@ -79,25 +78,12 @@
|
|
|
79
78
|
.gl-sg b { font-weight: var(--fw-strong); }
|
|
80
79
|
.gl-sg span { font-size: var(--fs-meta); color: var(--muted); }
|
|
81
80
|
|
|
82
|
-
|
|
83
81
|
@media (max-width: 900px) {
|
|
84
|
-
.gl-
|
|
82
|
+
.gl-nums { flex-direction: column; }
|
|
85
83
|
}
|
|
86
|
-
/* phones: the
|
|
84
|
+
/* phones: the path wraps; the Table scrolls sideways inside its block; the chat is shorter */
|
|
87
85
|
@media (max-width: 760px) {
|
|
88
86
|
.gl-bar { flex-wrap: wrap; }
|
|
89
|
-
.gl-
|
|
90
|
-
.gl-
|
|
91
|
-
.gl-tb .pm-table thead { display: none; }
|
|
92
|
-
.gl-tb .pm-table tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-12); padding: var(--space-8) var(--space-16); }
|
|
93
|
-
.gl-tb .pm-table tbody tr + tr { border-top: 1px solid var(--line); }
|
|
94
|
-
.gl-tb .pm-table tbody + tbody { border-top: 1px solid var(--line); }
|
|
95
|
-
.gl-tb .pm-table tbody + tbody tr.gl-first > * { border-top: 0; }
|
|
96
|
-
.gl-tb .pm-table td, .gl-tb .pm-table tbody th { display: block; border: 0; padding: var(--space-4) 0; }
|
|
97
|
-
.gl-tb .pm-table th.gl-obj { flex: 1 1 100%; width: auto; margin: calc(-1 * var(--space-8)) calc(-1 * var(--space-16)) var(--space-4); padding: var(--space-8) var(--space-16); background: var(--well); }
|
|
98
|
-
.gl-tb .pm-table th.gl-obj > * { display: inline; margin-right: 6px; }
|
|
99
|
-
.gl-tb .gl-kr, .gl-tb .gl-in, .gl-tb .gl-wide { flex: 1 1 100%; width: auto; }
|
|
100
|
-
.gl-tb .gl-act, .gl-tb .gl-left { display: inline-block; width: auto; padding: 0; }
|
|
101
|
-
.gl-tb .gl-left { display: inline-block; }
|
|
102
|
-
.gl-tb .gl-in:empty { display: none; }
|
|
87
|
+
.gl-krs .head { flex-wrap: wrap; }
|
|
88
|
+
.gl-chat { height: 360px; }
|
|
103
89
|
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/* pm/goals-ds.js — the blocks Goals is built from (initiative goals-ds-page; Exploring 3 page "pages", board GoalsDS; brief
|
|
2
|
+
* design-system/pages-rebuild/brief.md). Built only from PMOS Komorebi parts (workspace/design-system/ui). PURE: no DOM, no fetch, no clock of its
|
|
3
|
+
* own; `today` ('YYYY-MM-DD') comes in. The page (pm/premium-goals.js) passes one product's model and wires the presses by their data- attributes.
|
|
4
|
+
*
|
|
5
|
+
* standsOf(model, today) → [html] Where it stands: the cause, the risk and the next decision point, never counts alone
|
|
6
|
+
* sugOf(model, ns, dismissed) → { kind, key, title, why, will, changes, basis, say } | null the one Suggestion under it
|
|
7
|
+
* numbersOf(model, ns) → [{ role, name, value, at, spark, line, ns? }] North Star, input, guardrail (Number blocks)
|
|
8
|
+
* guessKr(title, F) → { key, token, title, words } | null the key result PMOS thinks an unlinked initiative moves, and why
|
|
9
|
+
* linkSay(ini, guess) → the words Link puts in the Conversation box
|
|
10
|
+
* paceOf(row) → [label, badge tone]
|
|
11
|
+
* tableHtml(p, o) → the Key results Table (pm-table in a pm-block, group rows, tabs, Choose columns)
|
|
12
|
+
* COLS the columns: Key result always, then Now, Pace, Moved by, Check (shown) and Left, Levers (Choose columns)
|
|
13
|
+
*
|
|
14
|
+
* NOTHING HERE MAKES A NUMBER UP (the proven-only rule of pm/goals-model.js). A sentence is made from a field of the model; a key result with
|
|
15
|
+
* no reading says so and what it waits on; a sparkline needs two readings. Zero is silence: nothing to say, no block. */
|
|
16
|
+
import * as GM from './goals-model.js';
|
|
17
|
+
import { sugHtml } from './bd-stands.js';
|
|
18
|
+
|
|
19
|
+
export { sugHtml };
|
|
20
|
+
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
21
|
+
export const SV = (d, n = 16, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" width="${n}" height="${n}" viewBox="0 0 24 24" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
22
|
+
export const I = {
|
|
23
|
+
star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', 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',
|
|
24
|
+
cols: 'M4 7h10M18 7h2M4 17h4M12 17h8M14 5v4M8 15v4', chat: 'M4 5h16v11H9l-5 4z', chev: 'M10 8l4 4-4 4',
|
|
25
|
+
};
|
|
26
|
+
const noun = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
27
|
+
const kr = (ws, k, text) => `<a href="#" data-gl-ws="${esc(ws)}" data-gl-kr="${esc(k.key)}">${esc(text || k.title)}</a>`;
|
|
28
|
+
const ini = (ws, i) => `<a href="#" data-gl-ws="${esc(ws)}" data-gl-ini="${esc(i.id)}"${i.verdict ? ' data-gl-verdict' : ''}>${esc(i.title)}</a>`;
|
|
29
|
+
|
|
30
|
+
/** Every key result row of the file (filter all), with its objective. */
|
|
31
|
+
const rowsOf = (model, today) => GM.tableOf(model, today, 'all').objectives.flatMap((o) => o.krs.map((k) => ({ o, k })));
|
|
32
|
+
/** The initiative records the OKR file names, by id (each carries endAt and status). */
|
|
33
|
+
function recs(model) {
|
|
34
|
+
const by = new Map(), F = model && model.okrFile;
|
|
35
|
+
if (F) for (const o of F.objectives || []) for (const k of o.krs || []) for (const r of k.moves || []) by.set(r.id, r);
|
|
36
|
+
return by;
|
|
37
|
+
}
|
|
38
|
+
/** The work that moves a key result most soon: the open initiative with the nearest end still ahead, else the one most over. */
|
|
39
|
+
function leadWork(model, k, today) {
|
|
40
|
+
const by = recs(model);
|
|
41
|
+
const open = k.moves.map((id) => by.get(id)).filter((r) => r && r.status !== 'done' && r.status !== 'cancelled');
|
|
42
|
+
const ahead = open.filter((r) => r.endAt && GM.daysTo(today, r.endAt) >= 0).sort((a, b) => String(a.endAt).localeCompare(String(b.endAt)));
|
|
43
|
+
if (ahead.length) return { r: ahead[0], ahead: true };
|
|
44
|
+
const over = open.filter((r) => r.endAt).sort((a, b) => String(a.endAt).localeCompare(String(b.endAt)));
|
|
45
|
+
return over.length ? { r: over[0], ahead: false } : null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ── Where it stands ──────────────────────────────────────────────────────────────────────────────────────────── */
|
|
49
|
+
export function standsOf(model, today) {
|
|
50
|
+
const F = model && model.okrFile; if (!F) return [];
|
|
51
|
+
const ws = (model.board && model.board.ws) || '';
|
|
52
|
+
const all = rowsOf(model, today), out = [];
|
|
53
|
+
if (!all.length) return [];
|
|
54
|
+
const read = all.filter((x) => x.k.read), pace = read.filter((x) => x.k.dot === 'ok');
|
|
55
|
+
const behind = read.filter((x) => x.k.dot === 'rk' || x.k.dot === 'rd');
|
|
56
|
+
// 1. how many are on pace, said only when something was read (a count of nothing read would say nothing true)
|
|
57
|
+
if (read.length) out.push(`${pace.length} of ${noun(all.length, 'key result', 'key results')} ${pace.length === 1 ? 'is' : 'are'} on pace.`);
|
|
58
|
+
// 2. the behind ones: value, target, time left, and the work that moves it with its date (the cause and the risk)
|
|
59
|
+
for (const { k } of behind.slice(0, 2)) {
|
|
60
|
+
const w = leadWork(model, k, today);
|
|
61
|
+
const work = !w ? '' : w.ahead ? `, and the work that moves it, ${ini(ws, { id: w.r.id, title: w.r.title })}, ships ${esc(GM.mdy(w.r.endAt))}`
|
|
62
|
+
: `, and the work that moves it, ${ini(ws, { id: w.r.id, title: w.r.title })}, is ${esc(noun(-GM.daysTo(today, w.r.endAt), 'day', 'days'))} past its end`;
|
|
63
|
+
const left = k.left ? (k.left === 'today' ? ' with the check today' : /over$/.test(k.left) ? ', ' + esc(k.left) : ' with ' + esc(k.left) + ' left') : '';
|
|
64
|
+
out.push(`${kr(ws, k)} is behind: ${esc(k.act)}${k.target ? ' of ' + esc(k.target) : ''}${left}${work}.`);
|
|
65
|
+
}
|
|
66
|
+
// 3. no reading: the one read before and silent since, else how many wait and on what
|
|
67
|
+
const unread = all.filter((x) => !x.k.read);
|
|
68
|
+
const stale = unread.filter((x) => x.k.lastAt).sort((a, b) => String(a.k.lastAt).localeCompare(String(b.k.lastAt)))[0];
|
|
69
|
+
if (stale) out.push(`${kr(ws, stale.k)} has had no reading since ${esc(GM.mdy(stale.k.lastAt))}, so nobody knows how it is going.`);
|
|
70
|
+
else if (unread.length) {
|
|
71
|
+
const by = new Map(); for (const { k } of unread) if (k.need) by.set(k.need, (by.get(k.need) || 0) + 1);
|
|
72
|
+
const top = [...by.entries()].sort((a, b) => b[1] - a[1])[0];
|
|
73
|
+
const who = unread.length === 1 ? kr(ws, unread[0].k) + ' has' : (unread.length === all.length ? 'No key result has' : noun(unread.length, 'key result has', 'key results have'));
|
|
74
|
+
const wait = !top ? '' : unread.length === 1 ? `: it waits on ${esc(top[0])}` : top[1] === unread.length ? `: they all wait on ${esc(top[0])}` : `: ${top[1]} wait on ${esc(top[0])}`;
|
|
75
|
+
out.push(`${who} ${unread.length === all.length && unread.length > 1 ? 'a reading yet' : 'no reading yet'}${wait}.`);
|
|
76
|
+
}
|
|
77
|
+
// 4. a health budget over its cap
|
|
78
|
+
for (const b of ((model.budgets || []).filter((b) => b && b.reading && b.reading.over)).slice(0, 1)) {
|
|
79
|
+
out.push(`The ${esc(b.id)} health budget is over its cap${typeof b.reading.share === 'number' && typeof b.cap === 'number' ? `: ${Math.round(b.reading.share * 100)}% of the work against ${Math.round(b.cap * 100)}%` : ''}.`);
|
|
80
|
+
}
|
|
81
|
+
// 5. the next decision point: the nearest check still ahead
|
|
82
|
+
const next = all.filter((x) => x.k.due && GM.daysTo(today, x.k.due) >= 0).sort((a, b) => String(a.k.due).localeCompare(String(b.k.due)))[0];
|
|
83
|
+
if (next) {
|
|
84
|
+
const n = GM.daysTo(today, next.k.due), when = n === 0 ? ', today' : n === 1 ? ', tomorrow' : `, in ${noun(n, 'day', 'days')}`;
|
|
85
|
+
const end = F.period && F.period.toAt && next.k.due === F.period.toAt && !all.some((x) => x.k.due && x.k.due !== F.period.toAt);
|
|
86
|
+
out.push(end ? `Every key result is checked when ${esc(F.period.label || 'the period')} ends on ${esc(GM.mdy(next.k.due))}${when}.`
|
|
87
|
+
: `The next check is ${kr(ws, next.k, next.k.token + ' ' + next.k.title)} on ${esc(GM.mdy(next.k.due))}${when}.`);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* ── the one Suggestion ───────────────────────────────────────────────────────────────────────────────────────── */
|
|
93
|
+
/** The North Star draft first, else a source to connect (the one that frees the most key results), else drafting a North Star. A kind the PM
|
|
94
|
+
* said No to on this device (dismissed: Set of keys) is passed over. */
|
|
95
|
+
export function sugOf(model, ns, dismissed = new Set()) {
|
|
96
|
+
const F = model && model.okrFile; if (!F) return null;
|
|
97
|
+
const out = [];
|
|
98
|
+
if (ns && ns.state === 'draft') out.push({ kind: 'ns', key: 'ns:' + ns.row, title: 'Set the North Star: ' + ns.title, why: ns.sub,
|
|
99
|
+
will: ['Keep the draft as this product’s North Star measure'], changes: 'Goals shows it as the North Star, and the key results hang from it.', basis: 'PMOS’s draft from your key results' });
|
|
100
|
+
const su = GM.setupOf(model, ns);
|
|
101
|
+
for (const s of (su && su.sources) || []) {
|
|
102
|
+
const toks = s.frees.replace(/^Frees /, ''), n = (toks.match(/,| to /g) || []).length + 1;
|
|
103
|
+
out.push({ kind: 'src', key: 'src:' + s.need, title: 'Connect ' + s.need, why: `${toks} ${n === 1 ? 'has' : 'have'} no reading. Your OKR file names ${s.need} as the source.`,
|
|
104
|
+
will: ['Connect ' + s.need + ' as a source', 'Test one read before it keeps it', 'Read ' + toks + ' from it'], changes: `${toks} get readings, so their pace shows here.`, basis: 'Your OKR file',
|
|
105
|
+
say: `Connect ${s.need} and read ${toks} from it. Test one read before you keep it.` });
|
|
106
|
+
}
|
|
107
|
+
if (ns && ns.state === 'none') out.push({ kind: 'draft', key: 'draft', title: 'Draft a North Star', why: ns.sub,
|
|
108
|
+
will: ['Draft a North Star from your key results', 'Show it here for your tick before it counts'], changes: 'The key results hang from one measure.', basis: 'Your OKR file',
|
|
109
|
+
say: 'Draft a North Star for this product from its key results. I approve it with a tick.' });
|
|
110
|
+
return out.find((s) => !dismissed.has(s.key)) || null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* ── North Star, input, guardrail ─────────────────────────────────────────────────────────────────────────────── */
|
|
114
|
+
/** A sparkline's points in a 120 × 32 box, from two readings or more; '' with fewer. */
|
|
115
|
+
export function sparkOf(series) {
|
|
116
|
+
const s = (series || []).filter((x) => x && typeof x.v === 'number');
|
|
117
|
+
if (s.length < 2) return '';
|
|
118
|
+
const vs = s.map((x) => x.v), lo = Math.min(...vs), hi = Math.max(...vs), span = hi - lo || 1;
|
|
119
|
+
return s.map((x, i) => `${Math.round((i / (s.length - 1)) * 120)},${Math.round(30 - ((x.v - lo) / span) * 28)}`).join(' ');
|
|
120
|
+
}
|
|
121
|
+
const lineOf = (g) => [g.title + '.', g.targetTxt ? `Target ${g.targetTxt}${g.by ? ' by ' + g.by : ''}.` : '', g.pace && g.pace.sub && g.pace.head !== '—' ? g.pace.sub.replace(/^./, (c) => c.toUpperCase()) + '.' : ''].filter(Boolean).join(' ');
|
|
122
|
+
export function numbersOf(model, ns) {
|
|
123
|
+
const G = ((model && model.goals) || []);
|
|
124
|
+
const one = (role, name) => { const g = G.find((x) => x && x.role === role); return g ? { role, name, value: g.nowTxt || '—', at: (g.reading && g.reading.at) || null, spark: sparkOf(g.series), line: lineOf(g), goal: g.id } : null; };
|
|
125
|
+
const out = [];
|
|
126
|
+
const n = one('north-star', 'North Star');
|
|
127
|
+
if (n) out.push(n); else if (model && model.okrFile && ns) out.push({ role: 'north-star', name: 'North Star', ns });
|
|
128
|
+
for (const [r, name] of [['input', 'Input'], ['guardrail', 'Guardrail']]) { const x = one(r, name); if (x) out.push(x); }
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ── an unlinked initiative: the key result PMOS thinks it moves ──────────────────────────────────────────────── */
|
|
133
|
+
const STOP = new Set(['the', 'and', 'for', 'with', 'from', 'into', 'over', 'under', 'that', 'this', 'than', 'more', 'less', 'make', 'new', 'old', 'all', 'one', 'per',
|
|
134
|
+
'its', 'our', 'your', 'are', 'not', 'off', 'out', 'up', 'down', 'v1', 'v2', 'phase', 'work', 'held', 'least', 'good', 'before', 'after', 'week', 'month']);
|
|
135
|
+
const words = (s) => [...new Set(String(s || '').toLowerCase().replace(/[^a-z0-9 ]+/g, ' ').split(/\s+/).filter((w) => w.length >= 4 && !STOP.has(w)))];
|
|
136
|
+
/** The key result whose words the initiative's title shares most; two words, or one of six letters or more. null when none fits. */
|
|
137
|
+
export function guessKr(title, F) {
|
|
138
|
+
const mine = words(title); if (!mine.length) return null;
|
|
139
|
+
let best = null;
|
|
140
|
+
for (const o of (F && F.objectives) || []) for (const k of o.krs || []) {
|
|
141
|
+
const kw = words(k.title + ' ' + (o.title || '')), hit = mine.filter((w) => kw.includes(w));
|
|
142
|
+
const score = hit.length * 10 + hit.reduce((a, w) => a + w.length, 0);
|
|
143
|
+
if ((hit.length >= 2 || hit.some((w) => w.length >= 6)) && (!best || score > best.score)) best = { key: k.key, token: k.token, title: k.title, words: hit, score };
|
|
144
|
+
}
|
|
145
|
+
return best ? { key: best.key, token: best.token, title: best.title, words: best.words } : null;
|
|
146
|
+
}
|
|
147
|
+
export const linkSay = (i, g) => (g ? `Link ${i.title} to ${g.token} ${g.title}.` : `Which key result does ${i.title} move? Link it, or say a new one.`);
|
|
148
|
+
|
|
149
|
+
/* ── the Key results Table ────────────────────────────────────────────────────────────────────────────────────── */
|
|
150
|
+
export const COLS = Object.freeze([['now', 'Now', true], ['pace', 'Pace', true], ['moved', 'Moved by', true], ['check', 'Check', true], ['left', 'Left', false], ['levers', 'Levers', false]]);
|
|
151
|
+
const PACE = { on: ['On pace', 'blue'], close: ['Behind', 'alert'], behind: ['Behind', 'alert'], broken: ['Off track', 'alert'] };
|
|
152
|
+
export const paceOf = (k) => (k.read ? PACE[k.pace] || ['Read', ''] : ['No reading', '']);
|
|
153
|
+
const badge = ([t, tone]) => `<span class="pm-badge${tone ? ' ' + tone : ''}">${esc(t)}</span>`;
|
|
154
|
+
// the bar is an SVG (its length an attribute, never an inline style: conformance R28-1)
|
|
155
|
+
const bar = (f) => `<svg class="gl-meter" aria-hidden="true" width="90" height="6" viewBox="0 0 90 6"><rect width="90" height="6" rx="3" fill="var(--well)"/><rect width="${Math.round(Math.max(0, Math.min(1, f)) * 90)}" height="6" rx="3" fill="var(--leaf)"/></svg>`;
|
|
156
|
+
|
|
157
|
+
/** p: { ws, name, model, T (tableOf with the tab), counts: { all, slip, unread, pace } }; o: { today, filter, cols: Set, many }. */
|
|
158
|
+
export function tableHtml(p, o) {
|
|
159
|
+
const { model, T, ws } = p, F = model.okrFile, cols = COLS.filter(([k]) => o.cols.has(k)), n = cols.length + 1;
|
|
160
|
+
const by = recs(model);
|
|
161
|
+
const moved = (ids) => ids.map((id) => GM.iniItem(by.get(id) || { id, title: id }, model, o.today))
|
|
162
|
+
.map((i) => `<span class="gl-mv${i.tone ? ' gl-al' : ''}" title="${esc(i.line)}">${ini(ws, i)}</span>`).join(', ');
|
|
163
|
+
const cell = {
|
|
164
|
+
now: (k) => `<td class="gl-now">${k.act ? `<b>${esc(k.act)}</b>` : '<b>—</b>'}${k.target ? ` <span class="pm-meta">of ${esc(k.target)}</span>` : ''}`
|
|
165
|
+
+ (k.done !== null && k.done !== undefined ? bar(k.done) : !k.read ? ` <span class="pm-meta">${esc(k.lastAt ? 'last read ' + GM.mdy(k.lastAt) : k.sub)}</span>` : '') + '</td>',
|
|
166
|
+
pace: (k) => `<td>${badge(paceOf(k))}</td>`,
|
|
167
|
+
moved: (k) => `<td class="gl-mvs">${moved(k.moves)}</td>`,
|
|
168
|
+
check: (k) => `<td class="code pm-meta">${esc(k.due ? GM.mdy(k.due) : '')}</td>`,
|
|
169
|
+
left: (k) => `<td class="pm-meta">${esc(k.left)}</td>`,
|
|
170
|
+
levers: (k, ob, i) => `<td class="gl-lvs">${i === 0 ? ob.levers.map((l) => `<span><b>${esc(l.title)}</b> <span class="pm-meta${l.tone ? ' gl-al' : ''}">${esc(l.txt)}</span></span>`).join('') : ''}</td>`,
|
|
171
|
+
};
|
|
172
|
+
const group = (label, sub, extra = '') => `<tr class="gl-g"><td colspan="${n}"><div class="pm-group"><b>${esc(label)}</b><span>${esc(sub)}</span>${extra}</div></td></tr>`;
|
|
173
|
+
let body = '';
|
|
174
|
+
for (const ob of T.objectives) {
|
|
175
|
+
body += group(ob.label + (ob.title ? ' · ' + ob.title : ''), noun(ob.krs.length, 'key result', 'key results'));
|
|
176
|
+
body += ob.krs.map((k, i) => `<tr><td class="gl-kr"><a href="#" class="gl-k" data-gl-ws="${esc(ws)}" data-gl-kr="${esc(k.key)}" title="${esc(k.sub)}">${esc(k.token)} · ${esc(k.title)}</a></td>`
|
|
177
|
+
+ cols.map(([c]) => cell[c](k, ob, i)).join('') + '</tr>').join('');
|
|
178
|
+
}
|
|
179
|
+
if (T.budgets.length) {
|
|
180
|
+
body += group('Health budgets', 'work that keeps things running');
|
|
181
|
+
body += T.budgets.map((b) => {
|
|
182
|
+
const c = { now: `<td class="gl-now">${b.share ? `<b>${esc(b.share.replace(/ of .*/, ''))}</b> <span class="pm-meta">of ${esc(b.share.replace(/^.* of /, ''))} at most</span>` : '<span class="pm-meta">no share yet</span>'}</td>`,
|
|
183
|
+
pace: `<td>${b.share ? badge(b.over ? ['Over', 'alert'] : ['Within', 'blue']) : ''}</td>`, moved: `<td class="gl-mvs">${b.items.map((i) => `<span class="gl-mv${i.tone ? ' gl-al' : ''}" title="${esc(i.line)}">${ini(ws, i)}</span>`).join(', ')}</td>`,
|
|
184
|
+
check: '<td></td>', left: '<td></td>', levers: `<td class="pm-meta">${esc(b.covers)}</td>` };
|
|
185
|
+
return `<tr><td class="gl-kr"><b>${esc(b.label)}</b></td>${cols.map(([k]) => c[k]).join('')}</tr>`;
|
|
186
|
+
}).join('');
|
|
187
|
+
}
|
|
188
|
+
if (T.unlinked.length) {
|
|
189
|
+
body += group('Not linked to a key result', noun(T.unlinked.length, 'initiative', 'initiatives'));
|
|
190
|
+
body += T.unlinked.map((i) => {
|
|
191
|
+
const g = guessKr(i.title, F);
|
|
192
|
+
const say = g ? `PMOS thinks it moves ${g.token} (both say ${g.words.join(', ')})` : 'no key result fits yet';
|
|
193
|
+
return `<tr><td class="gl-kr">${ini(ws, i)}</td><td colspan="${Math.max(1, n - 2)}" class="pm-meta">${esc(say)}</td>`
|
|
194
|
+
+ `<td class="gl-end"><button type="button" class="pm-btn" data-gl-link="${esc(i.id)}" data-gl-ws="${esc(ws)}" data-gl-say="${esc(linkSay(i, g))}" aria-label="Link to a key result" title="Link to a key result">${SV(I.link)}</button></td></tr>`;
|
|
195
|
+
}).join('');
|
|
196
|
+
}
|
|
197
|
+
const tabs = GM.FILTERS.map(([k, label]) => `<button type="button" class="pm-tab" role="tab" aria-selected="${o.filter === k}" data-gl-f="${k}">${esc(label)}${p.counts[k] ? ` <span class="gl-tn">${p.counts[k]}</span>` : ''}</button>`).join('');
|
|
198
|
+
const head = `<div class="head"><h2 class="pm-h">Key results</h2>${o.many ? `<span class="pm-meta">${esc(p.name)}</span>` : ''}<span class="sp"></span>`
|
|
199
|
+
+ `<div class="pm-tabs" role="tablist" aria-label="Show">${tabs}</div>`
|
|
200
|
+
+ `<span class="gl-mw"><button type="button" class="pm-btn" data-gl-cols="${esc(ws)}" aria-haspopup="menu" aria-expanded="false" aria-label="Choose columns" title="Choose columns">${SV(I.cols)}</button></span></div>`;
|
|
201
|
+
const none = !T.objectives.length && !T.budgets.length && !T.unlinked.length;
|
|
202
|
+
const label = (GM.FILTERS.find((f) => f[0] === o.filter) || [])[1] || '';
|
|
203
|
+
return `<section class="pm-block gl-krs" aria-label="Key results">${head}`
|
|
204
|
+
+ (none ? `<p class="pm-meta gl-m0">No key result is ${esc(label.toLowerCase())} in ${esc(p.name)}.</p>`
|
|
205
|
+
: `<div class="gl-tw"><table class="pm-table" aria-label="Key results of ${esc(p.name)}"><thead><tr><th scope="col">Key result</th>${cols.map(([, h]) => `<th scope="col">${esc(h)}</th>`).join('')}</tr></thead><tbody>${body}</tbody></table></div>`)
|
|
206
|
+
+ '</section>';
|
|
207
|
+
}
|
|
@@ -25,7 +25,9 @@ export const mdy = (d) => { const t = ms(d); if (t === null) return ''; const x
|
|
|
25
25
|
export const daysTo = (a, b) => { const x = ms(a), y = ms(b); return x === null || y === null ? null : Math.round((y - x) / DAY); };
|
|
26
26
|
const noun = (n, one, many) => n + ' ' + (n === 1 ? one : many);
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
/* the Key results tabs (GoalsDS): All, Behind, No reading, On pace. 'read' (every read key result) was the old fourth choice and still filters, so a
|
|
29
|
+
* choice stored on a device before the tabs keeps working. */
|
|
30
|
+
export const FILTERS = Object.freeze([['all', 'All'], ['slip', 'Behind'], ['unread', 'No reading'], ['pace', 'On pace']]);
|
|
29
31
|
|
|
30
32
|
/** "O-A" → "Objective A", "O1" → "Objective 1", "Objective 2" stays. */
|
|
31
33
|
export function objLabel(token) {
|
|
@@ -81,9 +83,14 @@ function krRow(model, o, k, today) {
|
|
|
81
83
|
act: read ? g.nowTxt : '', target: g && g.targetTxt ? g.targetTxt : '', tone: dot === 'rk' ? 'risk' : dot === 'rd' ? 'late' : '',
|
|
82
84
|
left: d === null ? '' : d > 0 ? noun(d, 'day', 'days') : d === 0 ? 'today' : noun(-d, 'day', 'days') + ' over', due,
|
|
83
85
|
moves: (k.moves || []).map((r) => r.id),
|
|
86
|
+
// GoalsDS: the pace a reading gives (on, close, behind, broken; none with no reading), the share of the way to the target when the record
|
|
87
|
+
// has a start, a target and a reading (lib/insights-premium.js done), and the last reading's day even when it is no longer counted as read
|
|
88
|
+
pace: read ? ((g.reading || {}).dot || 'none') : 'none', done: read && typeof g.done === 'number' ? g.done : null,
|
|
89
|
+
lastAt: (g && g.reading && g.reading.at) || (g && g.lastRead && g.lastRead.day) || null,
|
|
84
90
|
};
|
|
85
91
|
}
|
|
86
|
-
const passes = (row, filter) => filter === 'slip' ? row.dot === 'rk' || row.dot === 'rd' : filter === 'unread' ? !row.read : filter === 'read' ? row.read
|
|
92
|
+
const passes = (row, filter) => filter === 'slip' ? row.dot === 'rk' || row.dot === 'rd' : filter === 'unread' ? !row.read : filter === 'read' ? row.read
|
|
93
|
+
: filter === 'pace' ? row.read && row.dot === 'ok' : true;
|
|
87
94
|
|
|
88
95
|
/** The outcome promise of an initiative (model.outcomes), by id. */
|
|
89
96
|
const outcomeOf = (model, id) => ((model && model.outcomes) || []).find((r) => r && r.id === id) || null;
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
/* pm/premium-goals.js — Goals, the place
|
|
1
|
+
/* pm/premium-goals.js — Goals, the place. REBUILT FROM DESIGN SYSTEM BLOCKS (initiative goals-ds-page; board GoalsDS on Exploring 3, page "pages";
|
|
2
|
+
* brief design-system/pages-rebuild/brief.md). One column of blocks (pm/goals-ds.js writes them):
|
|
3
|
+
* · the top line: the path Goals › the product chip, the period chip, then Search, New key result (+: the words go in the Conversation box) and More
|
|
4
|
+
* (Set up, Charts and dashboards, Export CSV). The old Filter button is the Key results tabs now.
|
|
5
|
+
* · Where it stands (a Summary block): behind key results with the work that moves them and its date, a key result with no reading and since when,
|
|
6
|
+
* the next check. One Suggestion in the expanded form follows: the North Star draft (Yes keeps it, No drops it, both with Undo), else a source to
|
|
7
|
+
* connect, else drafting a North Star. Yes on an ask sends its words to PMOS in the Conversation; No hides it on this device ('pmos.goals.no');
|
|
8
|
+
* the pencil puts the words in the box to change first.
|
|
9
|
+
* · North Star, input and guardrail as Number blocks; a North Star not set keeps its draft (✓ ✕) or the ask (✦) in its block.
|
|
10
|
+
* · Key results: one Table grouped by objective, then health budgets, then the work no key result names (PMOS's guess of the key result, Link).
|
|
11
|
+
* Tabs All, Behind, No reading, On pace ('pmos.goals.filt'); Choose columns adds Left and Levers ('pmos.goals.cols').
|
|
12
|
+
* · the Conversation block: the one chat (pm/page-chat.js) about Goals of the product. The popup borrows the same element (cozy-popup.js
|
|
13
|
+
* useChat) and gives it back, so the page never holds two chats.
|
|
14
|
+
* Everything below this line is as goals-place built it, unless it says otherwise.
|
|
15
|
+
*
|
|
16
|
+
* First built as Goals (initiative goals-place, slice 9 of the six-place navigation; boards 8, 13, 31, 32, 33 on Exploring 2,
|
|
2
17
|
* page "Navigation: Today, Work, Goals, Events, Library, Routine"; handover /mnt/project-files/goals-handover/).
|
|
3
18
|
*
|
|
4
19
|
* "Am I on track? What do I do?" as one hierarchy. Top: the product choice Work and Goals share (cozy-pick.js, full names) and the OKR period. Then
|
|
@@ -24,16 +39,20 @@ import * as POP from './cozy-popup.js'; // the one popup: window.czOpenChat fo
|
|
|
24
39
|
import * as GM from './goals-model.js';
|
|
25
40
|
import * as GO from './goals-open.js';
|
|
26
41
|
import { undoToast } from './hi-pop.js';
|
|
27
|
-
import { productName, whenNames } from './scope-chip.js';
|
|
42
|
+
import { productName, whenNames } from './scope-chip.js';
|
|
43
|
+
import * as DS from './goals-ds.js'; // names, not ids: the product's display name (IDPF), not its folder name
|
|
28
44
|
|
|
29
45
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
30
46
|
const SVG = (d, w = 16) => `<svg class="pm-ic" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
|
|
31
|
-
const I = { check: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18',
|
|
47
|
+
const I = { check: 'M5 12.5l4.5 4.5L19 7.5', x: 'M6 6l12 12M18 6L6 18', spark: 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z' };
|
|
32
48
|
const STAR = (w = 16) => `<svg class="pm-ic pm-star" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${I.spark}"/></svg>`;
|
|
33
49
|
const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* a private window */ } } };
|
|
34
50
|
const todayIso = () => { const d = new Date(); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
|
|
35
|
-
const FILT = GM.FILTERS.map((f) => f[0]);
|
|
36
|
-
const
|
|
51
|
+
const FILT = GM.FILTERS.map((f) => f[0]).concat('read'); // 'read' was the old fourth choice: a device that stored it keeps its view
|
|
52
|
+
const COLS0 = (() => { try { const v = JSON.parse(store.get('pmos.goals.cols') || 'null'); return Array.isArray(v) ? v : null; } catch { return null; } })();
|
|
53
|
+
const NO0 = (() => { try { const v = JSON.parse(store.get('pmos.goals.no') || '[]'); return Array.isArray(v) ? v : []; } catch { return []; } })();
|
|
54
|
+
const S = { P: null, list: [], at: 0, filter: FILT.includes(store.get('pmos.goals.filt')) ? store.get('pmos.goals.filt') : 'all', error: '',
|
|
55
|
+
cols: new Set(COLS0 || DS.COLS.filter((c) => c[2]).map((c) => c[0])), no: new Set(NO0), sug: null };
|
|
37
56
|
const DEEP = new URLSearchParams(location.search).get('ws');
|
|
38
57
|
|
|
39
58
|
mountNav('insights', document, { scope: () => ({ name: 'Goals', hits: (q) => hits(q) }) });
|
|
@@ -62,69 +81,92 @@ function drawPer() {
|
|
|
62
81
|
const x = S.list.find((p) => p.model && p.model.okrFile && p.model.okrFile.period);
|
|
63
82
|
const per = x ? GM.periodOf(x.model.okrFile) : null, el = $('glPer');
|
|
64
83
|
el.hidden = !per;
|
|
65
|
-
if (per) el.innerHTML =
|
|
84
|
+
if (per) { el.innerHTML = `<b>${esc(per.label)}</b>`; el.title = per.sub || ''; }
|
|
66
85
|
}
|
|
67
86
|
|
|
68
|
-
/* ── the
|
|
69
|
-
|
|
87
|
+
/* ── the blocks (pm/goals-ds.js writes the words; here they are laid out) ── */
|
|
88
|
+
/** A North Star not set: its block holds PMOS's draft (✓ ✕) or the ask to draft one (✦). */
|
|
89
|
+
function nsAsk(p) {
|
|
70
90
|
const ns = p.ns;
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
+ `<button type="button" class="pm-btn primary" data-gl-setup="${esc(p.ws)}" aria-label="Ask PMOS to draft the North Star" title="Ask PMOS to draft the North Star">${SVG(I.spark)}</button></div></section>`;
|
|
91
|
+
if (S.sug && S.sug.ws === p.ws && (S.sug.kind === 'ns' || S.sug.kind === 'draft')) return `<p class="pm-meta gl-m0">${ns.state === 'draft' ? 'PMOS drafted one: it waits for your answer in Where it stands.' : 'PMOS can draft one: see Where it stands.'}</p>`; // say it once
|
|
92
|
+
if (ns.state === 'draft') return `<div class="pm-sug" role="group" aria-label="PMOS suggests"><span class="say"><b>${esc(ns.title)}</b><br>${esc(ns.sub)}</span>`
|
|
93
|
+
+ `<button type="button" class="pm-btn primary" data-gl-nskeep="${esc(p.ws)}" aria-label="Approve this North Star" title="Approve this North Star">${SVG(I.check)}</button><button type="button" class="pm-btn outline" data-gl-nsdrop="${esc(p.ws)}" aria-label="No, drop this North Star" title="No">${SVG(I.x)}</button></div>`;
|
|
94
|
+
return `<div class="pm-sug" role="group" aria-label="PMOS suggests"><span class="say">${esc(ns.sub)}</span>`
|
|
95
|
+
+ `<button type="button" class="pm-btn primary" data-gl-setup="${esc(p.ws)}" aria-label="Ask PMOS to draft the North Star" title="Ask PMOS to draft the North Star">${SVG(I.spark)}</button></div>`;
|
|
77
96
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
return o.krs.map((k, i) => {
|
|
93
|
-
let h = '';
|
|
94
|
-
if (i === 0) h += `<th scope="rowgroup" class="gl-obj"${rs(n)}><b>${esc(o.label)}</b>${o.title ? `<span class="pm-meta">${esc(o.title)}</span>` : ''}${o.slip ? `<span class="pm-badge alert">${esc(o.slip)}</span>` : ''}</th>`;
|
|
95
|
-
h += krCells(p, k);
|
|
96
|
-
if (i === 0) h += `<td class="gl-lv"${rs(n)}>${o.levers.map((l) => `<div><b>${esc(l.title)}</b><span class="pm-meta${l.tone ? ' gl-al' : ''}">${esc(l.txt)}</span></div>`).join('')}</td>`;
|
|
97
|
-
const c = o.inis.find((x) => x.from === i + 1);
|
|
98
|
-
if (c) h += `<td class="gl-in"${rs(c.span)}>${inis(p, c.items)}</td>`;
|
|
99
|
-
else if (!o.inis.some((x) => i + 1 > x.from && i + 1 < x.from + x.span)) h += '<td class="gl-in"></td>';
|
|
100
|
-
return `<tr${i === 0 ? ' class="gl-first"' : ''}>${h}</tr>`;
|
|
101
|
-
}).join('');
|
|
102
|
-
}
|
|
103
|
-
const wideRow = (head, tone, line, say, items, p) => `<tbody><tr class="gl-first"><th scope="row" class="gl-obj"><b>${esc(head)}</b>${line ? `<span class="pm-meta${tone ? ' gl-al' : ''}">${esc(line)}</span>` : ''}</th>`
|
|
104
|
-
+ `<td class="gl-wide" colspan="4">${say}</td><td class="gl-in">${inis(p, items)}</td></tr></tbody>`;
|
|
105
|
-
function tableHtml(p) {
|
|
106
|
-
const T = p.T;
|
|
107
|
-
if (!p.model.okrFile) return `<p class="pm-meta gl-none">No OKR file was found for ${esc(nm(p))}, so there is no key result to show. Goals reads the OKR file in planning/okrs/.</p>`;
|
|
108
|
-
if (!T.objectives.length && S.filter !== 'all') return `<p class="pm-meta gl-none">No key result is ${esc((GM.FILTERS.find((f) => f[0] === S.filter) || [])[1] || '').toLowerCase()} in ${esc(nm(p))}.</p>`;
|
|
109
|
-
const hd = '<thead><tr><th scope="col">Objective</th><th scope="col">Key result</th><th scope="col" class="gl-act">Actual / target</th><th scope="col" class="gl-left">Left</th><th scope="col" class="gl-lv">Levers</th><th scope="col">Initiative</th></tr></thead>';
|
|
110
|
-
const bud = T.budgets.map((b) => wideRow('Budget', b.over, b.label + (b.share ? ' · ' + b.share : ''), `<b>No key result: a budget that is always on</b>${b.covers ? `<span class="pm-meta">${esc(b.covers)}</span>` : ''}`, b.items, p)).join('');
|
|
111
|
-
const un = T.unlinked.length ? wideRow('Unlinked', false, '', `<span class="pm-meta">${T.unlinked.length === 1 ? 'An initiative with no key result named' : T.unlinked.length + ' initiatives with no key result named'}</span>`, T.unlinked, p) : '';
|
|
112
|
-
return `<div class="pm-block list gl-tb"><table class="pm-table" aria-label="Goals of ${esc(nm(p))}">${hd}${T.objectives.map((o) => `<tbody>${objRows(p, o)}</tbody>`).join('')}${bud}${un}</table></div>`;
|
|
97
|
+
function numbersHtml(p) {
|
|
98
|
+
const N = DS.numbersOf(p.model, p.ns);
|
|
99
|
+
if (!N.length) return '';
|
|
100
|
+
return `<div class="gl-nums">${N.map((n) => `<section class="pm-block" aria-label="${esc(n.name)}"><div class="head"><h3 class="pm-h-sm">${esc(n.name)}</h3><span class="sp"></span>`
|
|
101
|
+
+ (n.ns ? `<span class="pm-meta">not set</span></div>${nsAsk(p)}` : `${n.at ? `<span class="pm-meta">read ${esc(GM.mdy(n.at))}</span>` : ''}</div>`
|
|
102
|
+
+ `<div class="pm-row gl-numr"><span class="pm-num">${esc(n.value)}</span>${n.spark ? `<svg aria-hidden="true" width="120" height="32" viewBox="0 0 120 32"><polyline points="${n.spark}" fill="none" stroke="var(--blue)" stroke-width="2"/></svg>` : ''}</div>`
|
|
103
|
+
+ `<p class="pm-meta gl-m0">${esc(n.line)}</p>`) + '</section>').join('')}</div>`;
|
|
104
|
+
}
|
|
105
|
+
/** Where it stands and its one Suggestion, for the first product that has something to say. */
|
|
106
|
+
function standsHtml(p, sug) {
|
|
107
|
+
const say = DS.standsOf(p.model, todayIso());
|
|
108
|
+
if (!say.length && !sug) return '';
|
|
109
|
+
return `<section class="pm-block gl-stands" aria-label="Where it stands"><h2 class="pm-h-sm pm-row">${STAR()}Where it stands</h2>`
|
|
110
|
+
+ (say.length ? `<p class="gl-m0">${say.join(' ')}</p>` : '') + (sug ? DS.sugHtml(sug, `data-gl-sk="${esc(sug.key)}" data-gl-sws="${esc(p.ws)}"`, 'data-gl-sug') : '') + '</section>';
|
|
113
111
|
}
|
|
114
112
|
function draw() {
|
|
115
|
-
if (!S.list.length) { body.innerHTML = `<p class="pm-meta gl-none">${esc(S.error ? 'Goals could not be read: ' + S.error + '.' : 'No product is ticked. Tick one in the product choice.')}</p>`; $('glNote').hidden = true; return; }
|
|
113
|
+
if (!S.list.length) { body.innerHTML = `<p class="pm-meta gl-none">${esc(S.error ? 'Goals could not be read: ' + S.error + '.' : 'No product is ticked. Tick one in the product choice.')}</p>`; $('glNote').hidden = true; $('glTalk').hidden = true; return; }
|
|
116
114
|
const today = todayIso(), many = S.list.length > 1;
|
|
117
115
|
let h = '';
|
|
116
|
+
S.sug = null;
|
|
118
117
|
for (const p of S.list) {
|
|
119
118
|
if (!p.model) { h += `<section class="gl-p">${many ? `<h2 class="pm-h">${esc(nm(p))}</h2>` : ''}<p class="pm-meta gl-none">${esc(nm(p))} could not be read: ${esc(p.error || 'the server did not answer')}.</p></section>`; continue; }
|
|
120
119
|
p.T = GM.tableOf(p.model, today, S.filter);
|
|
121
120
|
p.ns = GM.northStarOf(p.model, p.drafts);
|
|
122
|
-
|
|
121
|
+
p.counts = Object.fromEntries(GM.FILTERS.map(([k]) => [k, GM.tableOf(p.model, today, k).shown]));
|
|
122
|
+
const sug = S.sug ? null : DS.sugOf(p.model, p.ns, S.no); // one Suggestion on the page
|
|
123
|
+
if (sug) S.sug = { ...sug, ws: p.ws };
|
|
124
|
+
if (!p.model.okrFile) { h += `<section class="gl-p" aria-label="${esc(nm(p))}">${many ? `<h2 class="pm-h">${esc(nm(p))}</h2>` : ''}<p class="pm-meta gl-none">No OKR file was found for ${esc(nm(p))}, so there is no key result to show. Goals reads the OKR file in planning/okrs/.</p></section>`; continue; }
|
|
125
|
+
h += `<section class="gl-p" aria-label="${esc(nm(p))}">${many ? `<h2 class="pm-h">${esc(nm(p))}</h2>` : ''}${standsHtml(p, sug)}${numbersHtml(p)}`
|
|
126
|
+
+ `${DS.tableHtml({ ...p, name: nm(p) }, { today, filter: S.filter === 'read' ? 'pace' : S.filter, cols: S.cols, many })}</section>`;
|
|
123
127
|
}
|
|
124
128
|
body.innerHTML = h;
|
|
125
129
|
$('glNote').hidden = false;
|
|
126
|
-
$('glFdot').hidden = S.filter === 'all';
|
|
127
130
|
drawPer();
|
|
131
|
+
talk();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* ── the Conversation block: the one chat, about Goals of the product ── */
|
|
135
|
+
const T = { box: null, target: null, phone: matchMedia('(max-width: 760px)') };
|
|
136
|
+
function goalsTarget(PC) {
|
|
137
|
+
const p = S.list.find((x) => x.model) || null, ws = p ? p.ws : '', name = p && S.list.length === 1 ? nm(p) : '';
|
|
138
|
+
const base = PC.popTarget({ kind: 'goal', id: 'goals-' + (ws || 'all'), title: name ? 'Goals of ' + name : 'Goals' }, ws || undefined);
|
|
139
|
+
return { ...base, placeholder: 'Ask about a key result, or say a new one', empty: 'Ask why a key result is behind, or say a new one. PMOS reads your goals and says where each answer came from.' };
|
|
140
|
+
}
|
|
141
|
+
async function talk() {
|
|
142
|
+
const host = $('glChat'), sec = $('glTalk');
|
|
143
|
+
if (!S.list.some((x) => x.model) || (window.PMOS_READONLY)) { sec.hidden = true; return; } // a read-only copy has no chat
|
|
144
|
+
sec.hidden = false;
|
|
145
|
+
const PC = await import('./page-chat.js');
|
|
146
|
+
if (!T.box) {
|
|
147
|
+
T.box = await PC.box();
|
|
148
|
+
host.appendChild(T.box.el);
|
|
149
|
+
// the popup borrows this chat and gives it back (cozy-popup.js useChat): never a second chat on the page
|
|
150
|
+
POP.useChat({ el: T.box.el, open: (t) => T.box.chat.open(t), current: () => (T.box.chat.current ? T.box.chat.current() : null), focus: () => T.box.chat.focus(), stop: () => T.box.chat.stop && T.box.chat.stop() });
|
|
151
|
+
new MutationObserver(() => {
|
|
152
|
+
const home = T.box.el.parentNode === host;
|
|
153
|
+
host.classList.toggle('away', !home);
|
|
154
|
+
if (home && T.target) T.box.chat.open(T.target); // back from the popup: the chat about Goals again
|
|
155
|
+
}).observe(host, { childList: true });
|
|
156
|
+
}
|
|
157
|
+
const t = goalsTarget(PC);
|
|
158
|
+
if (!T.target || T.target.key !== t.key) { T.target = t; if (T.box.el.parentNode === host) T.box.chat.open(t); }
|
|
159
|
+
}
|
|
160
|
+
/** Words for PMOS: sent at once (Yes), or put in the box to change first (the pencil, Link, +). */
|
|
161
|
+
async function say(text, send) {
|
|
162
|
+
await talk();
|
|
163
|
+
if (!T.box) return;
|
|
164
|
+
const host = $('glChat');
|
|
165
|
+
if (T.box.el.parentNode !== host) { POP.close(); }
|
|
166
|
+
$('glTalk').scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
167
|
+
if (send) { await T.box.chat.send(text); return; }
|
|
168
|
+
const ta = T.box.el.querySelector('textarea');
|
|
169
|
+
if (ta) { ta.value = text; ta.dispatchEvent(new Event('input', { bubbles: true })); ta.focus(); ta.setSelectionRange(text.length, text.length); }
|
|
128
170
|
}
|
|
129
171
|
|
|
130
172
|
/* ── load ── */
|
|
@@ -164,21 +206,64 @@ async function dropNs(p, row) {
|
|
|
164
206
|
undoToast('Dropped.', async () => { await pmPost('/api/metric-drafts/undo', base).catch(() => null); await load(); });
|
|
165
207
|
await load();
|
|
166
208
|
}
|
|
209
|
+
const saveNo = () => store.set('pmos.goals.no', JSON.stringify([...S.no].slice(-40)));
|
|
210
|
+
async function onSug(t) {
|
|
211
|
+
const sg = S.sug; if (!sg || t.dataset.glSk !== sg.key) return;
|
|
212
|
+
const p = S.list.find((x) => x.ws === sg.ws) || S.list[0], act = t.dataset.glSug;
|
|
213
|
+
if (sg.kind === 'ns') { // the North Star draft: the metric-drafts keep and drop, with Undo, as before
|
|
214
|
+
if (act === 'yes') { t.disabled = true; keepNs(p, p.ns.row); } else if (act === 'no') { t.disabled = true; dropNs(p, p.ns.row); }
|
|
215
|
+
else say('Change the North Star draft "' + p.ns.title + '": ', false);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (act === 'yes') { say(sg.say, true); return; }
|
|
219
|
+
if (act === 'edit') { say(sg.say, false); return; }
|
|
220
|
+
// No: this Suggestion stays away on this device, with Undo
|
|
221
|
+
S.no.add(sg.key); saveNo(); draw();
|
|
222
|
+
undoToast('PMOS will not suggest this again here.', () => { S.no.delete(sg.key); saveNo(); draw(); });
|
|
223
|
+
}
|
|
167
224
|
body.onclick = (e) => {
|
|
168
|
-
const t = e.target.closest('button'); if (!t) return;
|
|
225
|
+
const t = e.target.closest('button,a'); if (!t || !body.contains(t)) return;
|
|
169
226
|
const d = t.dataset;
|
|
227
|
+
if (t.tagName === 'A' && (d.glKr || d.glIni)) e.preventDefault();
|
|
170
228
|
if (d.glKr) { GO.openKr(ctxOf(d.glWs), d.glKr); return; }
|
|
171
229
|
if (d.glIni) { const c = ctxOf(d.glWs); if ('glVerdict' in d) GO.openVerdict(c, d.glIni); else GO.openIni(c, d.glIni); return; }
|
|
230
|
+
if (d.glSug) { onSug(t); return; }
|
|
231
|
+
if (d.glF) { S.filter = d.glF; store.set('pmos.goals.filt', S.filter); draw(); const b = body.querySelector(`[data-gl-f="${S.filter}"]`); if (b) b.focus(); return; }
|
|
232
|
+
if (d.glCols !== undefined) { openCols(t); return; }
|
|
233
|
+
if (d.glLink) { say(d.glSay, false); return; }
|
|
172
234
|
if (d.glNskeep) { const p = S.list.find((x) => x.ws === d.glNskeep); if (p && p.ns.row) { t.disabled = true; keepNs(p, p.ns.row); } return; }
|
|
173
235
|
if (d.glNsdrop) { const p = S.list.find((x) => x.ws === d.glNsdrop); if (p && p.ns.row) { t.disabled = true; dropNs(p, p.ns.row); } return; }
|
|
174
236
|
if (d.glSetup) { GO.openSetup(ctxOf(d.glSetup)); setTimeout(() => GO.toChat('Draft a North Star for this product from its key results. I approve it with a tick.'), 150); }
|
|
175
237
|
};
|
|
238
|
+
/* the tabs move with the arrow keys (the system's Tabs part) */
|
|
239
|
+
body.addEventListener('keydown', (e) => {
|
|
240
|
+
const t = e.target.closest && e.target.closest('[data-gl-f]'); if (!t || (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft')) return;
|
|
241
|
+
const all = [...t.parentNode.querySelectorAll('[data-gl-f]')], i = all.indexOf(t), n = all[(i + (e.key === 'ArrowRight' ? 1 : all.length - 1)) % all.length];
|
|
242
|
+
e.preventDefault(); n.click();
|
|
243
|
+
});
|
|
244
|
+
$('glNew').onclick = () => say('New key result: ', false);
|
|
176
245
|
|
|
177
|
-
/* ──
|
|
178
|
-
|
|
246
|
+
/* ── Choose columns: a Menu of the columns, each a tick; remembered on this device ── */
|
|
247
|
+
function openCols(btn) {
|
|
248
|
+
closeMenus();
|
|
249
|
+
const old = document.getElementById('glColsMenu'); if (old) { old.remove(); btn.setAttribute('aria-expanded', 'false'); return; }
|
|
250
|
+
const m = document.createElement('div');
|
|
251
|
+
m.className = 'pm-menu gl-menu'; m.id = 'glColsMenu'; m.setAttribute('role', 'menu'); m.setAttribute('aria-label', 'Choose columns');
|
|
252
|
+
m.innerHTML = DS.COLS.map(([k, label]) => `<button type="button" role="menuitemcheckbox" aria-checked="${S.cols.has(k)}" data-gl-c="${k}">${esc(label)}</button>`).join('');
|
|
253
|
+
btn.parentNode.appendChild(m); btn.setAttribute('aria-expanded', 'true');
|
|
254
|
+
m.onclick = (e) => {
|
|
255
|
+
const b = e.target.closest('[data-gl-c]'); if (!b) return;
|
|
256
|
+
const k = b.dataset.glC; if (S.cols.has(k)) S.cols.delete(k); else S.cols.add(k);
|
|
257
|
+
store.set('pmos.goals.cols', JSON.stringify([...S.cols])); draw();
|
|
258
|
+
};
|
|
259
|
+
m.querySelector('button').focus();
|
|
260
|
+
}
|
|
261
|
+
document.addEventListener('click', (e) => { const m = document.getElementById('glColsMenu'); if (m && !e.target.closest('#glColsMenu') && !e.target.closest('[data-gl-cols]')) m.remove(); });
|
|
262
|
+
|
|
263
|
+
/* ── the ⋯ menu ── */
|
|
264
|
+
const MENUS = [['glMore', 'glMoreMenu']];
|
|
179
265
|
function closeMenus(except) { for (const [b, m] of MENUS) if (m !== except && !$(m).hidden) { $(m).hidden = true; $(b).setAttribute('aria-expanded', 'false'); } }
|
|
180
266
|
function drawMenus() {
|
|
181
|
-
$('glFiltMenu').innerHTML = GM.FILTERS.map(([k, label]) => `<button type="button" role="menuitemradio" aria-checked="${S.filter === k}" data-gl-f="${k}">${esc(label)}</button>`).join('');
|
|
182
267
|
$('glMoreMenu').innerHTML = '<button type="button" role="menuitem" data-gl-m="setup">Set up</button><button type="button" role="menuitem" data-gl-m="charts">Charts and dashboards</button><button type="button" role="menuitem" data-gl-m="csv">Export CSV</button>';
|
|
183
268
|
}
|
|
184
269
|
for (const [b, m] of MENUS) {
|
|
@@ -189,11 +274,11 @@ for (const [b, m] of MENUS) {
|
|
|
189
274
|
};
|
|
190
275
|
}
|
|
191
276
|
document.addEventListener('click', (e) => { for (const [b, m] of MENUS) if (!$(m).hidden && !e.target.closest('#' + m) && !e.target.closest('#' + b)) { $(m).hidden = true; $(b).setAttribute('aria-expanded', 'false'); } });
|
|
192
|
-
document.addEventListener('keydown', (e) => {
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
};
|
|
277
|
+
document.addEventListener('keydown', (e) => {
|
|
278
|
+
if (e.key !== 'Escape') return;
|
|
279
|
+
const c = document.getElementById('glColsMenu'); if (c) { c.remove(); const b = body.querySelector('[data-gl-cols]'); if (b) b.focus(); }
|
|
280
|
+
for (const [b, m] of MENUS) if (!$(m).hidden) { $(m).hidden = true; $(b).setAttribute('aria-expanded', 'false'); $(b).focus(); }
|
|
281
|
+
});
|
|
197
282
|
$('glMoreMenu').onclick = (e) => {
|
|
198
283
|
const t = e.target.closest('[data-gl-m]'); if (!t) return;
|
|
199
284
|
closeMenus();
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
<meta name="pmos-nonce" content="" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
|
7
7
|
<title>PMOS · Goals</title>
|
|
8
|
-
<!-- Goals
|
|
8
|
+
<!-- Goals, rebuilt from design system blocks (initiative goals-ds-page; board GoalsDS on Exploring 3, page "pages"): the path with the product
|
|
9
|
+
chip, the period chip, Search, New key result and More; then one column of blocks: Where it stands with one Suggestion, North Star, input and
|
|
10
|
+
guardrail as Number blocks, the Key results Table, and the Conversation block (the one chat, pm/page-chat.js) at the end.
|
|
11
|
+
First built as Goals (initiative goals-place, slice 9 of the six-place navigation; boards 8, 13, 31, 32, 33 on Exploring 2, handover
|
|
9
12
|
/mnt/project-files/goals-handover/). "Am I on track? What do I do?" as one hierarchy: the North Star, then one table Objective › Key result
|
|
10
13
|
(Actual / target, Left) › Levers › Initiative, a Budget row per health budget with work in it, and the work no key result names (Unlinked).
|
|
11
14
|
A press on a key result, an initiative or ⋯ › Set up opens it in the one popup (pm/cozy-popup.js) with the chat about it. It reads
|
|
@@ -25,16 +28,18 @@
|
|
|
25
28
|
<main class="stage cz-panel gl" id="stage">
|
|
26
29
|
<h1 class="vh">Goals</h1>
|
|
27
30
|
<div class="pm-row gl-bar">
|
|
28
|
-
<
|
|
29
|
-
<span id="glPick"></span>
|
|
31
|
+
<nav class="pm-path" aria-label="Path"><b>Goals</b><svg class="pm-ic" width="14" height="14" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 8l4 4-4 4"/></svg><span id="glPick"></span></nav>
|
|
30
32
|
<span class="pm-chip gl-per" id="glPer" hidden></span>
|
|
31
33
|
<span class="gl-sp"></span>
|
|
32
34
|
<button type="button" class="pm-btn" id="glFind" aria-label="Find a goal" title="Find a goal"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M11 4.5a6.5 6.5 0 1 0 0 13a6.5 6.5 0 1 0 0-13M16 16l4 4"/></svg></button>
|
|
33
|
-
<
|
|
35
|
+
<button type="button" class="pm-btn" id="glNew" aria-label="New key result" title="New key result"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button>
|
|
34
36
|
<span class="gl-mw"><button type="button" class="pm-btn" id="glMore" aria-haspopup="menu" aria-expanded="false" aria-controls="glMoreMenu" aria-label="More: set up, charts and dashboards, export" title="More"><svg class="pm-ic" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12h.01M12 12h.01M19 12h.01"/></svg></button><div class="pm-menu gl-menu" id="glMoreMenu" role="menu" aria-label="More" hidden></div></span>
|
|
35
37
|
</div>
|
|
36
|
-
<div
|
|
37
|
-
|
|
38
|
+
<div class="gl-col">
|
|
39
|
+
<div id="glBody" aria-live="polite"><div class="gl-sk" aria-hidden="true"><i class="pm-block flat"></i><i class="pm-block flat"></i><i class="pm-block flat"></i></div></div>
|
|
40
|
+
<section class="pm-block gl-talk" id="glTalk" aria-label="Ask about your goals" hidden><div class="head"><svg class="pm-ic" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z"/></svg><h2 class="pm-h-sm">Ask about your goals</h2></div><div class="gl-chat" id="glChat"></div></section>
|
|
41
|
+
<p class="pm-meta gl-n" id="glNote" hidden>Reports are routine jobs, so they live in <a href="/premium-routine.html">Routine</a>: who each one tells, when it runs, what PMOS did.</p>
|
|
42
|
+
</div>
|
|
38
43
|
</main>
|
|
39
44
|
<noscript>This page needs JavaScript.</noscript>
|
|
40
45
|
<script type="module" src="/pm/premium-goals.js"></script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Goals rebuilt from design system blocks (initiative goals-ds-page, done test C2-C7): pm/goals-ds.js, pm/goals-model.js pace, the page's top line, Conversation and sheet. Pure, node.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"goals-ds.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"goals-ds.test.js": 2
|
|
8
|
+
}
|
|
9
|
+
}
|