create-pmos 0.712.0 → 0.713.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/package.json +80 -38
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/design-system/ui/README.md +1 -1
  4. package/payload/design-system/ui/components/State/README.md +21 -0
  5. package/payload/design-system/ui/components/State/preview.html +8 -0
  6. package/payload/design-system/ui/components/bundle.css +12 -0
  7. package/payload/design-system/ui/interactions.md +2 -0
  8. package/payload/planning/evals/eval-calibration.md +1 -1
  9. package/payload/planning/okrs/health-budgets.md +1 -1
  10. package/payload/state/discoveries.md +1 -1
  11. package/workspace/bin/back-place-health.js +70 -0
  12. package/workspace/changelog.json +79 -0
  13. package/workspace/design-system/ui/README.md +1 -1
  14. package/workspace/design-system/ui/components/State/README.md +21 -0
  15. package/workspace/design-system/ui/components/State/preview.html +8 -0
  16. package/workspace/design-system/ui/components/bundle.css +12 -0
  17. package/workspace/design-system/ui/interactions.md +2 -0
  18. package/workspace/guide/breakdown.md +20 -1
  19. package/workspace/guide/claude-proposes.md +5 -1
  20. package/workspace/guide/cli.md +10 -1
  21. package/workspace/guide/home.md +1 -0
  22. package/workspace/guide/initiatives-and-next-steps.md +13 -0
  23. package/workspace/guide/layout.md +8 -1
  24. package/workspace/guide/routine.md +10 -2
  25. package/workspace/guide/settings-and-switches.md +4 -0
  26. package/workspace/lib/briefing-premium-products.js +16 -2
  27. package/workspace/lib/changed-mark.js +34 -0
  28. package/workspace/lib/launch-cli.js +43 -5
  29. package/workspace/lib/launch-tiers.js +143 -0
  30. package/workspace/lib/needs-providers.js +1 -0
  31. package/workspace/lib/parked-cli.js +105 -0
  32. package/workspace/lib/parked-reasons.js +245 -0
  33. package/workspace/lib/pmos-verbs.js +4 -1
  34. package/workspace/lib/prefs-sync.js +138 -0
  35. package/workspace/lib/product-dots.js +60 -0
  36. package/workspace/lib/route-modules.js +2 -0
  37. package/workspace/lib/routes-briefing-premium.js +11 -1
  38. package/workspace/lib/routes-prefs.js +56 -0
  39. package/workspace/lib/routes-strategy-card.js +53 -0
  40. package/workspace/lib/routes-use-log.js +24 -3
  41. package/workspace/lib/routine-sentence.js +250 -0
  42. package/workspace/lib/strategy-card.js +133 -0
  43. package/workspace/lib/unused-controls.js +178 -0
  44. package/workspace/package-lock.json +2 -2
  45. package/workspace/package.json +1 -1
  46. package/workspace/public/pm/back-place.js +87 -0
  47. package/workspace/public/pm/bd-pop-ds.css +10 -0
  48. package/workspace/public/pm/bd-pop-ds.js +27 -3
  49. package/workspace/public/pm/bd-strategy.js +85 -0
  50. package/workspace/public/pm/bd-views.js +2 -1
  51. package/workspace/public/pm/changed-mark.css +7 -0
  52. package/workspace/public/pm/changed-mark.js +117 -0
  53. package/workspace/public/pm/cozy-pick.css +12 -0
  54. package/workspace/public/pm/cozy-pop-work.css +10 -1
  55. package/workspace/public/pm/cozy-pop-work.js +201 -17
  56. package/workspace/public/pm/cozy-routine-job.js +50 -7
  57. package/workspace/public/pm/cozy-routine.css +2 -0
  58. package/workspace/public/pm/cozy-settings.js +21 -3
  59. package/workspace/public/pm/cozy-today-page.css +1 -0
  60. package/workspace/public/pm/cozy-viewer.css +1 -1
  61. package/workspace/public/pm/cozy-viewer.js +14 -2
  62. package/workspace/public/pm/cozy-vw-mtg.css +0 -2
  63. package/workspace/public/pm/cozy-vw.css +0 -1
  64. package/workspace/public/pm/home-app.js +21 -1
  65. package/workspace/public/pm/home-today.js +2 -0
  66. package/workspace/public/pm/ini-tasks.js +4 -1
  67. package/workspace/public/pm/komorebi.css +11 -0
  68. package/workspace/public/pm/prefs-sync.js +111 -0
  69. package/workspace/public/pm/premium-board.js +20 -2
  70. package/workspace/public/pm/premium-chart-tab.js +2 -1
  71. package/workspace/public/pm/premium-mtg-replay.js +4 -3
  72. package/workspace/public/pm/premium-report-read.js +5 -4
  73. package/workspace/public/pm/premium-report-tab.js +4 -3
  74. package/workspace/public/pm/premium-vw-backlog.css +2 -1
  75. package/workspace/public/pm/premium-vw-backlog.js +4 -3
  76. package/workspace/public/pm/premium-vw-cal.css +1 -2
  77. package/workspace/public/pm/premium-vw-cal.js +14 -13
  78. package/workspace/public/pm/premium-vw-copies.js +3 -2
  79. package/workspace/public/pm/premium-vw-copy.css +0 -3
  80. package/workspace/public/pm/premium-vw-mtg.js +12 -11
  81. package/workspace/public/pm/product-switcher.js +41 -0
  82. package/workspace/public/pm/report-orders-ui.js +2 -1
  83. package/workspace/public/pm/rp-parts.js +3 -2
  84. package/workspace/public/pm/state-blocks.js +36 -0
  85. package/workspace/public/pm/use-log.js +118 -1
  86. package/workspace/public/pm/work-select.js +92 -2
  87. package/workspace/public/pm/work-tree.js +70 -0
  88. package/workspace/public/premium-aud.html +1 -0
  89. package/workspace/public/premium-board.html +5 -0
  90. package/workspace/public/premium-buddy.html +1 -0
  91. package/workspace/public/premium-events.html +1 -0
  92. package/workspace/public/premium-goals.html +1 -0
  93. package/workspace/public/premium-intelligence.html +1 -0
  94. package/workspace/public/premium-library.html +1 -0
  95. package/workspace/public/premium-present.html +1 -0
  96. package/workspace/public/premium-rec.html +1 -0
  97. package/workspace/public/premium-routine.html +1 -0
  98. package/workspace/public/premium-viewer.html +1 -0
  99. package/workspace/public/premium-workflows.html +1 -0
  100. package/workspace/public/today.html +1 -0
  101. package/workspace/server.js +20 -0
  102. package/workspace/test-lists/back-place.json +9 -0
  103. package/workspace/test-lists/changed-mark.json +9 -0
  104. package/workspace/test-lists/launch-tiers.json +9 -0
  105. package/workspace/test-lists/parked-reasons.json +9 -0
  106. package/workspace/test-lists/prefs-follow-person.json +9 -0
  107. package/workspace/test-lists/product-switcher-dots.json +9 -0
  108. package/workspace/test-lists/routine-sentence.json +9 -0
  109. package/workspace/test-lists/shared-empty-states.json +9 -0
  110. package/workspace/test-lists/strategy-card.json +9 -0
  111. package/workspace/test-lists/unused-controls.json +9 -0
  112. package/workspace/test-lists/work-subtasks-followups.json +9 -0
@@ -71,7 +71,6 @@
71
71
  .vzm-pop { position: absolute; right: 0; top: 4px; z-index: 30; width: min(380px, 100%); display: flex; flex-direction: column; gap: 6px; padding: var(--space-12); border-radius: var(--radius-card, 18px); background: var(--cz-card); border: 1px solid var(--cz-hair); box-shadow: var(--cz-lift); }
72
72
  .vzm-anc[data-pop="mat"] { height: auto; }
73
73
  .vzm-anc[data-pop="mat"] .vzm-pop { position: relative; top: 0; width: 100%; }
74
- .vzm-pop .vz-empty { font-size: var(--fs-meta); line-height: var(--lh-meta); }
75
74
  .vzm-mi2 { display: flex !important; width: 100%; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px !important; border-radius: var(--radius-md, 10px); font-size: var(--fs-body); color: var(--cz-ink); line-height: var(--lh-body); }
76
75
  .vzm-mi2.hl, .vzm-mi2[aria-current="true"] { background: var(--cz-well); }
77
76
  .vzm-mi2 .vzm-k { color: var(--cz-ink3); font-size: var(--fs-meta); line-height: var(--lh-meta); }
@@ -191,7 +190,6 @@
191
190
  .vzp-lr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; padding: var(--space-8) 6px var(--space-8) 28px; font-size: var(--fs-meta); color: var(--cz-ink2); border-top: 1px solid var(--cz-hair); line-height: var(--lh-meta); }
192
191
  .vzp-lr small { font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); }
193
192
  .vzp-link { color: var(--cz-blueink); font-weight: var(--fw-strong); font-size: var(--fs-label); line-height: var(--lh-label); }
194
- .vzp-empty { margin: 0; font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); }
195
193
  .vzp-phh { display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); }
196
194
  .vzp-dark { min-height: 32px; padding: 0 14px !important; border-radius: var(--radius-pill, 999px); background: var(--vzd) !important; color: var(--vzd-on) !important; font-size: var(--fs-row); font-weight: var(--fw-strong); line-height: var(--lh-row); }
197
195
  .vzp-h3 { margin: var(--space-8) 0 0 !important; font-size: var(--fs-section); font-weight: var(--fw-strong); line-height: var(--lh-section); }
@@ -73,7 +73,6 @@
73
73
  .vz-ph svg { color: var(--cz-ink3); transition: transform .15s; }
74
74
  .vz-part[data-open="true"] .vz-ph svg { transform: rotate(180deg); }
75
75
  .vz-pb { padding: 2px 14px var(--space-16); display: flex; flex-direction: column; gap: 14px; }
76
- .vz-empty { font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); }
77
76
 
78
77
  /* rows shared by the parts */
79
78
  .vz-ready { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-body); line-height: var(--lh-body); }
@@ -36,6 +36,7 @@ import * as H from './home-data.js';
36
36
  import { mountChat, avHtml } from './home-chat.js';
37
37
  import * as MORE from './home-more.js';
38
38
  import * as PP from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
39
+ import * as SW from './product-switcher.js'; // the product switcher row with its dots (bet A381)
39
40
  import { headModel, STEPS, gateOf } from './premium-initiative-head.js';
40
41
  import * as SC from './home-stage-card.js'; // the initiative's stage card D
41
42
  import * as WFM from './ini-wf-model.js'; // D99: the workflow an initiative runs (kind line, usual days)
@@ -245,6 +246,7 @@ async function load() {
245
246
  loadMoment();
246
247
  readImpact();
247
248
  loadGrillNews();
249
+ loadDots();
248
250
  // the top of Home (A′): the ranked list's own reads and Waiting on others, after the first draw so they never hold the list up
249
251
  document.body.dataset.hmTop = '0';
250
252
  // the top of Home is off until a new design is agreed (Wawan 2026-11-17: the list stays navigation). GET /api/waiting is not read, so no
@@ -387,7 +389,7 @@ function homeListHtml() {
387
389
  const sel = S.sel || (S.ini && S.ini !== 'product' ? 'i:' + S.ini : null);
388
390
  return TD.listHtml(M, todayModel(), {
389
391
  sel, selHead: S.head, ses: S.ses, pOpen, here: isPhone() ? null : TD.groupOfOpen(M, sel) || S.head, restOpen: (k) => S.rest.has(k), cap: S.cap, pin: S.pin, avHtml, ready: S.ready, err: S.D.err.length ? S.D.err[0] : '',
390
- pick: S.D.pick, tones: pickTones(), review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? revealLeft(S.reveal) + RECROW.html() + (S.drift ? DRIFT.rowHtml(S.drift.c, { esc, sel: S.sel === 'drift' }) : '') + (T ? '<i data-hm-topslot hidden></i>' : '') : '', held: T ? T.held : null, // chief-of-staff C3: the Mentions and Your impact cards are gone; their asks land in Your move
392
+ pick: S.D.pick, tones: pickTones(), psw: S.ready ? SW.switcherHtml(dotsPick(), { tones: pickTones(), cls: 'hv-psw' }) : '', review: R, mic: canDictate(), phone: isPhone(), day: S.day, news: S.news && S.news.ok ? S.news.count : 0, top: S.ready ? revealLeft(S.reveal) + RECROW.html() + (S.drift ? DRIFT.rowHtml(S.drift.c, { esc, sel: S.sel === 'drift' }) : '') + (T ? '<i data-hm-topslot hidden></i>' : '') : '', held: T ? T.held : null, // chief-of-staff C3: the Mentions and Your impact cards are gone; their asks land in Your move
391
393
  last: S.ready ? '' : LS.last(LAST_KEY), keep: S.ready && S.filter === 'today' && !S.ini ? (b) => LS.keepLast(LAST_KEY, b) : null,
392
394
  imFace: IM.faceHtml(S.im, { joy: S.imJoy }), grill: S.ready ? grillNews() : null,
393
395
  });
@@ -1680,6 +1682,23 @@ function pickTones() {
1680
1682
  const own = ((S.D.board && S.D.board.board) || {}).ws || '';
1681
1683
  return PP.tonesOf(P.products.map((p) => ({ ...p, primary: own ? p.ws === own : p.primary })));
1682
1684
  }
1685
+ /** The pick with each product's needs (S.dots, GET /api/briefing-premium/products?needs=1), for the switcher row; the saved pick decides
1686
+ * which product is shown alone, so a read that came before a save does not draw the old one */
1687
+ function dotsPick() {
1688
+ const P = S.D.pick; if (!P) return null;
1689
+ const N = new Map(((S.dots && S.dots.products) || []).map((p) => [p.ws, p.needs]));
1690
+ return { ...P, products: P.products.map((p) => ({ ...p, needs: N.has(p.ws) ? N.get(p.ws) : null })) };
1691
+ }
1692
+ // a product not read yet comes back null and its read starts on the server: ask again a little later, a few times, then on each load
1693
+ let dotsTry = 0;
1694
+ function loadDots() {
1695
+ SW.readDots().then((r) => {
1696
+ if (!r) return;
1697
+ const was = JSON.stringify(S.dots && S.dots.products.map((p) => p.needs)); S.dots = r;
1698
+ if (JSON.stringify(r.products.map((p) => p.needs)) !== was) drawList();
1699
+ if (r.products.some((p) => p.needs === null) && dotsTry++ < 3) setTimeout(loadDots, 15000);
1700
+ }).catch(() => null);
1701
+ }
1683
1702
  function pickLine(ws) {
1684
1703
  const M = S.M; if (!M) return '';
1685
1704
  const p = M.products.find((x) => x.ws === ws); if (!p) return '';
@@ -2207,6 +2226,7 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
2207
2226
  if (d.hmCheck) { checkRow(d.hmCheck); return; }
2208
2227
  if ('hmReview' in d) { if (S.day) day(false); openReviewVw(); return; }
2209
2228
  if ('hmPick' in d) { pickProduct(b); return; }
2229
+ if (d.psw) { const P = dotsPick(); if (P) SW.press(P, d.psw).then((r) => { if (!r.ok) toast(r.error); }); return; }
2210
2230
  if ('hmCapmic' in d) { const i = $('#hmCap'); if (i) capMic(i, b); return; }
2211
2231
  if (d.hmTc) { if (S.day && d.hmTc === 'cal') day(false); todayPress(d.hmTc, b); return; }
2212
2232
  if (d.hmEnd) { endRow(d.hmEnd); return; }
@@ -334,6 +334,8 @@ export function listHtml(M, T, o) {
334
334
  + SO.btnHtml('ut-ib hv-ib' + (SO.layout().sort !== 'mine' ? ' on' : ''))
335
335
  + `<button type="button" class="ut-ib hv-ib" data-hm-new aria-haspopup="menu" aria-label="New" title="New">${svg(P.plus, 20)}</button>`
336
336
  + '</span></div>'
337
+ // the product switcher row (bet A381, pm/product-switcher.js): one press shows one product; a blue dot is a product that needs the PM
338
+ + (o.psw || '')
337
339
  // Claude grilled something by itself this week and left findings (canvas FcPhone, Home): one quiet line with ✦, else nothing
338
340
  + (o.grill ? `<p class="hv-sub hv-gn"><span>${esc(o.grill.text)}</span><button type="button" class="ut-ib hv-ib" data-hm-gn="${esc(o.grill.id)}" aria-label="${esc('Open the ' + o.grill.n + (o.grill.n === 1 ? ' finding' : ' findings') + ' on ' + o.grill.title)}" title="Open the findings">${svg('M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', 18)}</button></p>` : '');
339
341
  // the Today card only while the day has a moment; the plain day (its meetings and load) is in Your day
@@ -145,7 +145,10 @@ function openSheet(anchor, H) {
145
145
  if (d.ivsCol) { const on = timelineCols(); setTimelineCols(on.includes(d.ivsCol) ? on.filter((k) => k !== d.ivsCol) : on.concat(d.ivsCol)); if (H.redraw) H.redraw(); draw(); return; }
146
146
  if (d.ivsZoom) { ZOOM = d.ivsZoom; store.set('pmos.tasks.zoom', ZOOM); if (H.redraw) H.redraw(); draw(); return; }
147
147
  if (d.ivsBy && H.__g) { const r = H.__g.set(d.ivsBy); if (r && r.then) r.then(draw); else draw(); return; }
148
- if ('ivsMore' in d && H.__g) { const a = POP && POP.anchor; closePop(); if (a && a.isConnected) H.__g.more(a); }
148
+ if ('ivsMore' in d && H.__g) {
149
+ // the Tasks header can draw again while the sheet is open (a read of the page): the menu then opens under the view button drawn now
150
+ const a0 = POP && POP.anchor, a = a0 && a0.isConnected ? a0 : document.querySelector('[data-iv-vbtn]'); closePop(); if (a) H.__g.more(a);
151
+ }
149
152
  }, { sheet: PHONE(), right: true });
150
153
  return el;
151
154
  }
@@ -144,6 +144,17 @@
144
144
  .pm-ds .pm-rail .pm-count{position:absolute;top:3px;right:5px}
145
145
  .pm-ds .pm-path{display:flex;align-items:center;gap:6px;font-size:var(--type-small)}
146
146
  .pm-ds .pm-path a{color:var(--blue)}
147
+ .pm-ds .pm-state{margin:0;padding:var(--space-8) 0;font-size:var(--type-small);line-height:var(--leading-small);color:var(--muted)}
148
+ .pm-ds .pm-state.empty{max-width:62ch}
149
+ .pm-ds .pm-state.loading{display:flex;flex-direction:column;gap:var(--space-4)}
150
+ .pm-ds .pm-state.loading .ph{display:flex;align-items:center;gap:var(--space-12);min-height:var(--space-32)}
151
+ .pm-ds .pm-state.loading .ph::before{content:"";flex:none;width:var(--space-12);height:var(--space-12);border-radius:var(--radius-sm);background:var(--line)}
152
+ .pm-ds .pm-state.loading .ph i{display:block;flex:none;width:62%;height:var(--space-8);border-radius:var(--radius-sm);background:var(--line)}
153
+ .pm-ds .pm-state.loading .ph:nth-child(3n+2) i{width:78%}
154
+ .pm-ds .pm-state.loading .ph:nth-child(3n) i{width:48%}
155
+ .pm-ds .pm-state.error{display:flex;align-items:center;gap:var(--space-8);color:var(--ink)}
156
+ .pm-ds .pm-state.error::before{content:"";flex:none;width:var(--space-8);height:var(--space-8);border-radius:var(--radius-pill);background:var(--alert)}
157
+ .pm-ds .pm-state.error .pm-btn{margin-left:auto}
147
158
  .pm-ds .pm-motion-enter{animation:pmEnter var(--duration-enter) var(--ease-out) both}
148
159
  @keyframes pmEnter{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
149
160
  @media (prefers-reduced-motion: reduce) {
@@ -0,0 +1,111 @@
1
+ /* pm/prefs-sync.js — the page side of view preferences that follow the person (bet A461; the store is lib/prefs-sync.js, the routes
2
+ * lib/routes-prefs.js). A CLASSIC script, not a module: GET /api/view-prefs/boot.js serves it with the person's values in front, and every
3
+ * page loads that first, right after the nonce meta, so this runs before any page code reads localStorage. No page code changes.
4
+ *
5
+ * start(win) → { flush(keepalive), took, pending() } | null
6
+ * 1. TAKE: each kept value whose time is later than this browser's copy is written into this browser's storage (`took` counts them).
7
+ * A browser value with no time yet (kept before this change) gives way to the person's value.
8
+ * 2. SEED: an allowed value this browser holds that the store lacks, or holds newer, is sent.
9
+ * 3. WATCH: a later write or remove of an allowed key, by any page code, is sent in a batch (1.5 s after the last write, and when the
10
+ * page hides). Every other key (a draft, a cache, a seen marker, a panel size) is never sent.
11
+ * allowedBy(keys) → (key) → boolean · deviceOf(width) PURE
12
+ *
13
+ * ON THIS COMPUTER ONLY: one relative URL, POST /api/view-prefs, to this workspace's own server, with the page's nonce. A browser a script
14
+ * drives (navigator.webdriver: a test, a crawler) takes nothing and sends nothing, so one test's view never reaches the next. */
15
+ (function (root) {
16
+ 'use strict';
17
+ var STAMP = 'pmos.viewPrefs.at'; // this browser's time per key: { <key>: <ms> }
18
+ var FLUSH_MS = 1500;
19
+
20
+ function allowedBy(keys) {
21
+ var exact = {}; var pre = (keys && keys.prefix) || [];
22
+ ((keys && keys.exact) || []).forEach(function (k) { exact[k] = true; });
23
+ return function (k) {
24
+ if (typeof k !== 'string' || !k || k.length > 120) return false;
25
+ if (exact[k]) return true;
26
+ for (var i = 0; i < pre.length; i++) if (k.length > pre[i].length && k.indexOf(pre[i]) === 0) return true;
27
+ return false;
28
+ };
29
+ }
30
+ function deviceOf(w) { return w <= 760 ? 'phone' : w <= 1100 ? 'tablet' : 'desk'; }
31
+
32
+ function start(win) {
33
+ if (!win || win.__pmosViewPrefsStarted) return null;
34
+ try { if (win.navigator && win.navigator.webdriver) return null; } catch (e) { /* no navigator */ }
35
+ if (win.__pmosViewPrefsOn === false) return null;
36
+ var ls; try { ls = win.localStorage; } catch (e) { ls = null; }
37
+ if (!ls) return null;
38
+ win.__pmosViewPrefsStarted = true;
39
+ var SP = (win.Storage && win.Storage.prototype) || Object.getPrototypeOf(ls);
40
+ var oSet = SP.setItem, oGet = SP.getItem, oDel = SP.removeItem;
41
+ var get = function (k) { try { return oGet.call(ls, k); } catch (e) { return null; } };
42
+ var put = function (k, v) { try { oSet.call(ls, k, v); } catch (e) { /* storage full or blocked */ } };
43
+ var del = function (k) { try { oDel.call(ls, k); } catch (e) { /* blocked */ } };
44
+ var now = function () { return Date.now(); };
45
+ var allowed = allowedBy(win.__pmosViewPrefsKeys);
46
+ var kept = win.__pmosViewPrefs && typeof win.__pmosViewPrefs === 'object' ? win.__pmosViewPrefs : {};
47
+ var stamps; try { stamps = JSON.parse(get(STAMP) || '{}') || {}; } catch (e) { stamps = {}; }
48
+ if (typeof stamps !== 'object' || Array.isArray(stamps)) stamps = {};
49
+ var dirty = {}; var took = 0; var timer = null;
50
+
51
+ // 1. TAKE
52
+ Object.keys(kept).forEach(function (k) {
53
+ var e = kept[k];
54
+ if (!allowed(k) || !e || typeof e.at !== 'number') return;
55
+ var mine = stamps[k];
56
+ if (typeof mine === 'number' && mine >= e.at) return;
57
+ var cur = get(k);
58
+ if (e.v === null) { if (cur !== null) { del(k); took++; } } else if (typeof e.v === 'string' && cur !== e.v) { put(k, e.v); took++; }
59
+ stamps[k] = e.at;
60
+ });
61
+ // 2. SEED
62
+ var n = 0; try { n = ls.length; } catch (e) { n = 0; }
63
+ var names = []; for (var i = 0; i < n; i++) { var key = null; try { key = ls.key(i); } catch (e) { key = null; } if (key) names.push(key); }
64
+ names.forEach(function (k) {
65
+ if (!allowed(k)) return;
66
+ var e = kept[k];
67
+ if (typeof stamps[k] !== 'number') stamps[k] = now();
68
+ if (!e || stamps[k] > e.at) dirty[k] = { v: get(k), at: stamps[k] };
69
+ });
70
+ put(STAMP, JSON.stringify(stamps));
71
+
72
+ function nonce() {
73
+ try { var m = win.document && win.document.querySelector('meta[name="pmos-nonce"]'); return (m && m.getAttribute('content')) || ''; } catch (e) { return ''; }
74
+ }
75
+ function pending() { return Object.keys(dirty).length; }
76
+ function flush(keepalive) {
77
+ if (timer) { win.clearTimeout(timer); timer = null; }
78
+ if (!pending() && !took) return false;
79
+ var set = dirty; dirty = {};
80
+ var body = { set: set, followed: took, device: deviceOf(win.innerWidth || 1280) };
81
+ took = 0;
82
+ var h = { 'Content-Type': 'application/json' }; var nn = nonce(); if (nn) h['x-pmos-nonce'] = nn;
83
+ var back = function () { Object.keys(set).forEach(function (k) { if (!dirty[k] || dirty[k].at < set[k].at) dirty[k] = set[k]; }); };
84
+ try {
85
+ var p = win.fetch('/api/view-prefs', { method: 'POST', headers: h, body: JSON.stringify(body), keepalive: !!keepalive, credentials: 'same-origin' });
86
+ if (p && p.then) p.then(function (r) { if (!r || !r.ok) back(); }, back);
87
+ } catch (e) { back(); }
88
+ return true;
89
+ }
90
+ function later() { if (timer) win.clearTimeout(timer); timer = win.setTimeout(function () { flush(false); }, FLUSH_MS); }
91
+ function note(store, k) {
92
+ if (store !== ls || k === STAMP || !allowed(k)) return;
93
+ var at = now();
94
+ stamps[k] = at; put(STAMP, JSON.stringify(stamps));
95
+ dirty[k] = { v: get(k), at: at };
96
+ later();
97
+ }
98
+ // 3. WATCH: every write of every page script goes through the Storage prototype
99
+ SP.setItem = function (k, v) { var r = oSet.apply(this, arguments); note(this, String(k)); return r; };
100
+ SP.removeItem = function (k) { var r = oDel.apply(this, arguments); note(this, String(k)); return r; };
101
+ if (pending() || took) win.setTimeout(function () { flush(false); }, 3000);
102
+ try {
103
+ win.addEventListener('pagehide', function () { flush(true); });
104
+ if (win.document) win.document.addEventListener('visibilitychange', function () { if (win.document.visibilityState === 'hidden') flush(true); });
105
+ } catch (e) { /* no events */ }
106
+ return { flush: flush, get took() { return took; }, pending: pending };
107
+ }
108
+
109
+ if (typeof module !== 'undefined' && module.exports) module.exports = { start: start, allowedBy: allowedBy, deviceOf: deviceOf, STAMP: STAMP };
110
+ else if (root && root.window === root) root.__pmosViewPrefsSync = start(root);
111
+ })(typeof window !== 'undefined' ? window : this);
@@ -23,6 +23,7 @@ import { pmPost } from './http.js';
23
23
  import { followDoc } from './doc-follow.js';
24
24
  import { $, $$, esc, store, chatAbout, setPageGaps } from './premium-shell.js';
25
25
  import * as PK from './cozy-pick.js';
26
+ import * as SW from './product-switcher.js'; // the product switcher row beside the chip, on a desktop (bet A381)
26
27
  import { productName, whenNames } from './scope-chip.js'; // the products' display names ("IDPF", not "pmos-idpf") // the one product picker Home, Board and Insights share (batch 12 item 5)
27
28
  import { mountNav } from './cozy-nav.js';
28
29
  import { quietPlace } from './quiet-place.js'; // onboarding B3: before three initiatives or a date, the Board shows one line
@@ -58,6 +59,7 @@ import { nextHtml } from './bd-next.js';
58
59
  import * as GL from './bd-goal.js'; // board AwH: the Track grouped By goal
59
60
  import { statusOf as ivStatus } from './ini-view-model.js';
60
61
  import { initiativeRename, taskRename } from './rename-press.js';
62
+ import * as CM from './changed-mark.js'; // bet A456: the ✦ and Undo on a row PMOS changed by itself in the last 24 h
61
63
  import { setSay } from './cozy-xv.js';
62
64
  import { narrowForm } from './pn-narrow.js';
63
65
  import * as BP2 from './bd-pane.js';
@@ -65,6 +67,7 @@ import * as WV from './bd-work.js'; // Work, one view on a desk (slice 4 of th
65
67
  import * as BK from './bd-backlog.js';
66
68
  import * as ST from './bd-stands.js'; // Where it stands, its Suggestion and the Next milestones line (initiative work-design-system-blocks, WorkDS) // the Backlog beside Initiatives in Work: every task in one list (initiative work-backlog)
67
69
  import * as LS from './load-shapes.js'; // the skeleton and the slow-case line while the board is read (page-open-speed, SpD) // the Board as the first panel: fit(), the rows that open beside, the open row's mark
70
+ import * as STRAT from './bd-strategy.js'; // the product's strategy in five lines above the initiatives (bet A458)
68
71
  import * as SWN from './cozy-status-when.js'; // the day a status move really happened, in the toast (round 3 point 18)
69
72
 
70
73
  const VIEW_KEY = 'pmos.board.view', PVIEW_KEY = 'pmos.board.pview', SPAN_KEY = 'pmos.board.span', GROUPING_KEY = 'pmos.board.grouping';
@@ -229,9 +232,15 @@ function shownPick() {
229
232
  const ws = new Set(M.board.all ? (M.board.products || []).map((p) => p.ws) : [M.board.ws]);
230
233
  return { ...PKP, products: PKP.products.map((p) => ({ ...p, on: ws.has(p.ws) })) };
231
234
  }
235
+ /* the switcher row's dots (bet A381): each product's needs, read once per page (GET /api/briefing-premium/products?needs=1) */
236
+ let DOTS = null;
237
+ const dotsPick = (P) => (P ? { ...P, products: P.products.map((p) => ({ ...p, needs: DOTS && p.ws in DOTS ? DOTS[p.ws] : null })) } : null);
232
238
  function drawPick() {
233
239
  const P = shownPick(), host = $('#crumbHost'); if (!host) return;
234
- host.innerHTML = P ? PK.chipHtml(P, { id: 'bdPick', label: 'Products', names: !matchMedia('(max-width: 760px)').matches }) : `<span class="crpg">${esc(M.board.name || 'Board')}</span>`;
240
+ const desk = !matchMedia('(max-width: 760px)').matches;
241
+ host.innerHTML = P ? PK.chipHtml(P, { id: 'bdPick', label: 'Products', names: desk }) + (desk ? SW.switcherHtml(dotsPick(P)) : '') : `<span class="crpg">${esc(M.board.name || 'Board')}</span>`;
242
+ host.onclick = (e) => { const b = e.target.closest('[data-psw]'); if (!b) return; e.stopPropagation(); SW.press(dotsPick(shownPick()), b.dataset.psw).then((r) => { if (!r.ok) say(r.error); }); };
243
+ if (P && desk && !DOTS) { DOTS = {}; SW.readDots().then((r) => { if (r) { DOTS = Object.fromEntries(r.products.map((p) => [p.ws, p.needs])); drawPick(); } }).catch(() => null); }
235
244
  const chip = $('#bdPick'); if (!chip) return;
236
245
  // a product's line: its open initiatives on this page (zero is silence)
237
246
  const lines = (ws) => { const rows = (M.initiatives.list.rows || []).filter((r) => (M.board.all ? r.ws === ws : M.board.ws === ws)); return rows.length ? rows.length + (rows.length === 1 ? ' initiative' : ' initiatives') : ''; };
@@ -525,7 +534,7 @@ function trackRow(r, cls = '', po = false) {
525
534
  return `<div class="bt-r bt-l${cls}${peek && peek.key === r.key && peek.kind !== 'acts' ? ' sel' : ''}${r.acts && r.acts.life === 'hold' ? ' held' : ''}" role="row" data-row="${esc(r.key)}"${po ? ` data-po-id="${esc(r.id)}"` : ''}>${po ? PO.gripHtml(r.title) : ''}`
526
535
  + `<button type="button" class="ini2 bt-nm" data-key="${esc(r.key)}" role="rowheader" aria-haspopup="dialog"><b>${r.inProgram ? PG.memberIcon(PGS, r.inProgram) : ''}${many ? WF.wfIcon(WF.wfOf(r), 18) : ''}${WK.iconHtml(r.kind)}${SM.nameHtml(r)}</b><span class="cs s-${s.tone}"${s.from ? ` title="${esc(s.from)}"` : ''}><i class="cz-dot ${s.tone}"></i>${esc(s.text)}</span><span class="bt-pst">${t.ms ? '<i class="cz-ms" aria-hidden="true"></i>' : ''}${esc(t.label)} · ${DAYS(t)}</span></button>`
527
536
  + `<div class="${cellsCls()}" role="presentation"${cellsStyle()}>${cells}</div>`
528
- + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, factory: M.board.factory, icon: !small() })}</div></div>`; // the Next cell (XocA): what finishes the step next
537
+ + `<div class="bt-dl" role="cell">${nextHtml(r, { self: M.board.self, factory: M.board.factory, icon: !small() })}${CM.markFor(r.ws || M.board.ws || '', r.id)}</div></div>`; // the Next cell (XocA): what finishes the step next
529
538
  }
530
539
  const cellsCls = () => 'bt-cells' + (TK.mode === 'cats' ? ' bands' : TK.mode === 'wf' ? ' wfn' : '');
531
540
  const cellsStyle = () => (TK.mode === 'wf' ? ` style="--n:${Math.max(1, TK.steps.length)}"` : '');
@@ -1387,10 +1396,19 @@ async function load() {
1387
1396
  return;
1388
1397
  }
1389
1398
  M = r.model; readTries = 0; jiraReading = false; holdNames(); draw();
1399
+ readChanges();
1400
+ STRAT.refresh($('#cStrat'), { ws: M.board.ws || null, board: M.board.id || null, single: !ALL, say });
1390
1401
  focusOnce(); programOnce(); newOnce(); loadOthers(); loadWorkflows();
1391
1402
  if (r.stale) setTimeout(load, 2000); // a press is still being derived: ask again
1392
1403
  else { loadTrail(); loadGrill(); }
1393
1404
  }
1405
+ /** What PMOS changed by itself in the last 24 h, per product on this Board (pm/changed-mark.js, bet A456): read after each read of the board,
1406
+ * at most once a minute per product; a press of a row's Undo reads the board again. */
1407
+ function readChanges() {
1408
+ const ws = M.board.all ? (M.board.products || []).map((p) => p.ws) : [M.board.ws || ''];
1409
+ CM.read(ws, () => drawInit()).catch(() => null);
1410
+ }
1411
+ CM.bind({ onUndone: (r) => { if (r.ok) load(); else drawInit(); } });
1394
1412
  /** The workflows' own stage lists (GET /api/workflows), once, when a row here is on another workflow than Product feature: a picked workflow
1395
1413
  * draws every one of its stages, the empty ones too (WfABoardOne). Not read: the stages come from the rows (pm/bd-wf.js stagesOfWf). */
1396
1414
  let wfRead = false;
@@ -16,6 +16,7 @@ import { pmGet, pmPost } from './http.js';
16
16
  import { open as vOpen, current as vCur, body as vBody } from './cozy-viewer.js';
17
17
  import { vzStyle } from './premium-vw-open.js';
18
18
  import { deriveChart, unitTxt } from './premium-chart-draw.js';
19
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
19
20
 
20
21
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
21
22
  const FORMS = [['line', 'Line'], ['bars', 'Bars'], ['number', 'Number'], ['meter', 'Meter']];
@@ -149,7 +150,7 @@ function dashHtml(t) {
149
150
  }
150
151
  function bodyHtml(t) {
151
152
  const noun = t.block.kind;
152
- if (!t.loaded) return `<p class="vz-empty" role="status">Reading the ${noun}.</p>`;
153
+ if (!t.loaded) return SB.loading(`Reading the ${noun}.`);
153
154
  if (!t.M) return `<p class="vz-msg">The Intelligence records could not be read, so the ${noun} cannot be drawn. Try again in a moment.</p>`;
154
155
  if (t.removed) return '<p class="vz-msg">Deleted. Ask in the chat for a new one.</p>';
155
156
  if (t.gone) return `<p class="vz-msg">This ${noun} (${esc(t.block.id)}) is deleted, or it is not saved on this board.</p>`;
@@ -27,6 +27,7 @@
27
27
  * due and state); n = the note (GET /api/notes/one) for the remarks of the live transcript; points, edits, lessons, terms = GET /api/meeting-points.
28
28
  * replayView(rep, { n, points, edits, lessons, terms, now }) → the view model
29
29
  * replayHtml(V, ui) → the desk and the phone. ui = { pos, playing, speed, pt (the selected point), strip, caps, chaps, allShots, edit, draft } */
30
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
30
31
 
31
32
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
32
33
  const clip = (s, n) => { const t = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
@@ -241,7 +242,7 @@ function rowHtml(V, p, ui, sel) {
241
242
  export function pointsCardHtml(V, ui = {}) {
242
243
  const sel = selOf(V, ui), cnt = ['decision', 'action', 'question'].map((k) => { const c = V.points.filter((p) => p.kind === k).length; return c ? `<span class="vzr-cnt">${kindIcon(k)}${c}</span>` : ''; }).join('');
243
244
  const head = `<div class="vzr-ph"><h3>${V.points.length} kept</h3>${cnt}<span class="vzp-sp"></span>${V.toConfirm ? `<button type="button" class="vzp-dark vzr-cfall" data-a="confirmall">${ic('chk', 14)}Confirm ${V.toConfirm}</button>` : ''}</div>`;
244
- const rows = V.rows.length ? V.rows.map((p) => rowHtml(V, p, ui, !!sel && sel.id === p.id)).join('') : `<p class="vzp-empty vzr-pad">Nothing was agreed, owned or left open in this meeting.</p>`;
245
+ const rows = V.rows.length ? V.rows.map((p) => rowHtml(V, p, ui, !!sel && sel.id === p.id)).join('') : '<div class="vzr-pad">' + SB.empty('Nothing was agreed, owned or left open in this meeting.') + '</div>';
245
246
  return `<section class="vzr-pts" aria-label="Kept points">${head}<div class="vzp-kl">${rows}</div></section>`;
246
247
  }
247
248
  /** Left out (a panel of the strip): each remark and why it was left out; a point marked not right can be put back. */
@@ -358,11 +359,11 @@ export function phoneHtml(V, ui = {}) {
358
359
  const sel = selOf(V, ui);
359
360
  const rows = V.rows.map((p) => rowHtml(V, p, ui, !!sel && sel.id === p.id)).join('');
360
361
  return playerHtml(V, ui, true) + `<div class="vzr-phk"><div class="vzr-ph"><h3>${V.points.length} kept</h3><span class="vzp-sp"></span>${V.toConfirm ? `<button type="button" class="vzp-dark vzr-cfall" data-a="confirmall">${ic('chk', 14)}Confirm ${V.toConfirm}</button>` : ''}</div>`
361
- + (rows ? `<div class="vzp-kl">${rows}</div>` : '<p class="vzp-empty">Nothing was agreed, owned or left open in this meeting.</p>') + '</div>';
362
+ + (rows ? `<div class="vzp-kl">${rows}</div>` : SB.empty('Nothing was agreed, owned or left open in this meeting.')) + '</div>';
362
363
  }
363
364
 
364
365
  /** The whole of it: the desk and the phone; the stylesheet shows one (cozy-vw-mtg.css). o: deskHtml's (the summary and the strip). */
365
366
  export function replayHtml(V, ui = {}, o = {}) {
366
- if (!V) return '<p class="vzp-empty">This meeting has no recording to replay.</p>';
367
+ if (!V) return SB.empty('This meeting has no recording to replay.');
367
368
  return `${deskHtml(V, ui, o)}<div class="vzp vzp-mb">${phoneHtml(V, ui)}</div>`;
368
369
  }
@@ -60,6 +60,7 @@ import * as OU from './report-orders-ui.js'; // batch 27 item 16: the orders o
60
60
  import { adler } from './cozy-adler.js'; // registers window.czViews; vzStyle adds the Viewer's sheet (cozy-vw.css)
61
61
  import { cycleGroups, cycleName, briefModel, briefGlanceHtml, briefConfirmHtml, briefWhyHtml, briefLooksHtml, paperModel, paperHtml, liveModel, liveHtml, presentHtml, dayMon, reportSummary,
62
62
  rpSumHtml, rpBarHtml, cadenceWords, goesOutWords, FORMATS, RP_ICONS } from './rp-parts.js';
63
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
63
64
 
64
65
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
65
66
  const svg = (p, n = 18) => `<svg viewBox="0 0 24 24" width="${n}" height="${n}" aria-hidden="true">${p}</svg>`;
@@ -433,7 +434,7 @@ function foldsHtml() {
433
434
  }
434
435
  function deckHtml() {
435
436
  const L = slides();
436
- if (!L.length) return '<p class="vz-empty">This cycle has no slides. Read it as a page.</p>';
437
+ if (!L.length) return SB.empty('This cycle has no slides. Read it as a page.');
437
438
  const i = R.i = Math.max(0, Math.min(R.i, L.length - 1));
438
439
  return `<div class="vz-slide" tabindex="0" role="group" aria-roledescription="slide" aria-label="Slide ${i + 1} of ${L.length}: ${esc(L[i].h)}. Use the arrow keys to change slide." data-r="slide">${slideCard(L[i])}</div>`
439
440
  + `<div class="rp-nav">${ib('prev', ic('prev', 15), 'Previous slide', { off: i === 0 })}<span class="rp-count" aria-live="polite">Slide ${i + 1} of ${L.length}</span>${ib('next', ic('next', 15), 'Next slide', { off: i === L.length - 1 })}${R.pyr && !R.cyc && R.ord && R.ord.engine && !R.edit ? ib('ord|slide', ic('mark', 15), 'Save this slide\'s layout to My slides', { cls: ' ro-slmark', off: R.busy }) : ''}</div>`
@@ -471,7 +472,7 @@ function rfhHtml() {
471
472
  R.issued ? null : { act: 'edit', label: 'Edit', icon: 'pen' }, { act: 'present', label: 'Present', icon: 'present' },
472
473
  R.archived ? null : { act: 'share', label: 'Share', icon: 'share', exp: R.pop === 'share', pop: 'dialog' },
473
474
  { act: 'dlm', label: 'Download', icon: 'dl', exp: R.pop === 'dl' }] });
474
- const view = R.err ? `<p class="vz-msg" data-tone="bad" role="alert">The document could not be read: ${esc(R.err)}</p>` : !R.W ? '<p class="vz-empty" role="status">Reading the report.</p>'
475
+ const view = R.err ? SB.error('The document could not be read: ' + R.err) : !R.W ? SB.loading('Reading the report.')
475
476
  : R.gal ? galView() : (R.view === 'doc' ? pageHtml() : deckHtml()) + ordAssHtml();
476
477
  const conf = confirm && R.BF ? czSections([{ id: 'confirm', title: 'Please confirm', count: confirm, open: true, render: () => briefConfirmHtml(R.BF, { issued: R.issued, busy: R.busy }) + (R.bfMsg ? `<p class="vz-msg" role="status">${esc(R.bfMsg)}</p>` : '') }], { key: 'report' }) : '';
477
478
  const pri = R.archived ? { act: 'unarch|' + R.row.path, label: 'Bring back', icon: 'back' } : R.issued ? null : { act: 'issue', label: 'Issue it', icon: 'send' };
@@ -486,7 +487,7 @@ function bodyHtml() {
486
487
  + (R.view === 'deck' && !R.noTip ? `<p class="vz-tip"><span>${tipText(at, n)}</span>${ib('notip', ic('x', 14), 'Hide this tip', { cls: ' vz-small' })}</p>` : '')
487
488
  + '<div class="vz-ed" data-vz-ed></div></div>';
488
489
  }
489
- const view = R.err ? `<p class="vz-msg" data-tone="bad" role="alert">The document could not be read: ${esc(R.err)}</p>` : !R.W ? '<p class="vz-empty" role="status">Reading the report.</p>'
490
+ const view = R.err ? SB.error('The document could not be read: ' + R.err) : !R.W ? SB.loading('Reading the report.')
490
491
  : R.gal ? galView() : (R.view === 'deck' ? deckHtml() : R.view === 'live' ? liveView() : pageHtml()) + ordAssHtml();
491
492
  return `<div class="vz-rpb">${R.conf ? confHtml() : R.W ? sumHtml() + ordRowHtml() : ''}${R.W && !R.err ? cutsHtml() : ''}${R.msg ? `<p class="vz-msg" role="status" data-tone="${R.msg.tone || ''}">${esc(R.msg.text)}</p>` : ''}${R.edit ? '' : waitHtml()}${R.W && !R.err ? barHtml() : ''}${view}${R.W && !R.err && !R.issued ? rvHtml() : ''}${R.W && !R.err ? foldsHtml() : ''}${askHtml()}</div>`;
492
493
  }
@@ -824,7 +825,7 @@ async function lifeIt(k, at) {
824
825
  if (R.onChange) R.onChange();
825
826
  const rest = R.cycles.filter((x) => x.path !== R.row.path);
826
827
  if (rest.length) return openReport(rest[0], { ...R.hand, cycles: rest });
827
- const b = bodyEl(); if (b) b.innerHTML = '<div class="vz"><p class="vz-empty" role="status">The draft is discarded.</p></div>';
828
+ const b = bodyEl(); if (b) b.innerHTML = '<div class="vz">' + SB.empty('The draft is discarded.') + '</div>';
828
829
  return;
829
830
  }
830
831
  R.cycles = R.cycles.map((x) => (x.path === rel ? { ...x, archived } : x));
@@ -35,6 +35,7 @@ import { FORMATS } from './rp-parts.js';
35
35
  import { vzStyle } from './premium-vw-open.js';
36
36
  import * as RF from './report-flow.js';
37
37
  import { adler } from './cozy-adler.js';
38
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
38
39
 
39
40
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
40
41
  const OUT = FORMATS;
@@ -300,13 +301,13 @@ export function deckOf(p, sections) {
300
301
  export const frameOf = (sections) => (Array.isArray(sections) && sections.length ? sections.map((h) => [h, '']) : FRAME);
301
302
  /** The report's current state while no cycle is written yet (RfH1). */
302
303
  function currentHtml(t) {
303
- if (!t.F) return '<p class="vz-empty" role="status">Reading the report.</p>';
304
+ if (!t.F) return SB.loading('Reading the report.');
304
305
  if (t.F.err) return `<p class="vz-msg" data-tone="bad">${esc(t.F.err)}</p>`;
305
306
  return RF.waitHtml(t.F, adler(t.F.drafting && t.F.drafting.state === 'ended' ? 'honest' : 'thinking', 36));
306
307
  }
307
308
  /** The template (RfH3): the questions on its current version, what changed, its history, Keep the current template | Make a different template. */
308
309
  function templateHtml(t) {
309
- if (!t.F) return '<p class="vz-empty" role="status">Reading the template.</p>';
310
+ if (!t.F) return SB.loading('Reading the template.');
310
311
  if (t.F.err) return `<p class="vz-msg" data-tone="bad">${esc(t.F.err)}</p>`;
311
312
  return RF.questionsHtml(t.tq, { template: tplOf(t), name: t.F.name, making: t.making, busy: t.busy, msg: t.msg })
312
313
  + `<p class="vz-note">Its sections and look, and its cycles: <button type="button" class="rp-linkbtn vz-hv" data-rt="manage">Sections, look and cycles</button></p>`;
@@ -351,7 +352,7 @@ function picked(t, e) {
351
352
  }
352
353
  function setupHtml(t) {
353
354
  const s = t.setup;
354
- if (!t.loaded) return '<p class="vz-empty" role="status">Reading the report.</p>';
355
+ if (!t.loaded) return SB.loading('Reading the report.');
355
356
  if (t.gone) return `<p class="vz-msg">This template (${esc(t.block.id)}) is deleted, or it is not set up in this workspace. Its issued reports are kept.</p>${cyclesHtml(t)}`;
356
357
  const cur = s.status === 'paused' ? 'off' : s.schedule;
357
358
  const want = t.block.schedule && !sameSched(t.block.schedule, cur) ? `<div class="vz-ask"><p>PMOS proposes: <b>${esc(schedWords(t.block.schedule))}</b></p><div>${btn('sched-use', 'Change the schedule', { off: t.busy })}</div></div>` : '';
@@ -24,6 +24,7 @@
24
24
  .vbl .bl-p{font:var(--fw-regular) var(--fs-meta)/var(--lh-meta) var(--mono);min-width:24px;text-align:center;padding:1px 6px;border-radius:var(--radius-sm);border:1px solid var(--hair);color:var(--ink-2)}
25
25
  .vbl .bl-in{font-size:var(--fs-meta);color:var(--ink-3);max-width:16ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:var(--lh-meta);}
26
26
  .vbl .bl-why{flex-basis:100%;margin:-6px 0 6px;font-size:var(--fs-meta);color:var(--bad);line-height:var(--lh-meta);}
27
- .vbl .bl-none,.vbl .bl-empty{margin:0;padding:var(--space-12) 14px;font-size:var(--fs-meta);color:var(--ink-3);line-height:var(--lh-meta);}
27
+ .vbl > .pm-state{padding-left:var(--space-12);padding-right:var(--space-12)}
28
+ .vbl .bl-none{margin:0;padding:var(--space-12) 14px;font-size:var(--fs-meta);color:var(--ink-3);line-height:var(--lh-meta);}
28
29
  .vbl .bl-f button:focus-visible,.vbl .bl-t:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
29
30
  @media (max-width:560px){.vbl .bl-in{display:none}}
@@ -11,6 +11,7 @@
11
11
  * - no rank (the list goes by key), no assignee, no sprint capacity: the readings hold none of them.
12
12
  * - read-only: moving a ticket between sprints or ranking it happens in Jira (Jira owns sprint and rank, D88). */
13
13
  import { vwOpen, vwStyle } from './premium-viewer.js';
14
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
14
15
 
15
16
  const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
16
17
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -48,8 +49,8 @@ function rowHtml(x) {
48
49
  + (x.blocked ? `<span class="bl-why">${esc(x.blocked)}</span>` : '') + (x.stale ? '<span class="bl-why">Not in the last read</span>' : '') + '</li>';
49
50
  }
50
51
  export function backlogHtml(m, f = '') {
51
- if (!m) return '<p class="bl-empty">The backlog could not be read. Try again in a moment.</p>';
52
- if (m.empty) return '<p class="bl-empty">No Jira reading for this board yet. The backlog appears once the Jira status check has read the initiatives\' tickets.</p>';
52
+ if (!m) return SB.error('The backlog could not be read. Try again in a moment.');
53
+ if (m.empty) return SB.empty('No Jira reading for this board yet. The backlog appears once the Jira status check has read the initiatives\' tickets.');
53
54
  const opts = [['', 'All'], ['blocked', 'Blocked']].concat(m.bugs ? [['bug', 'Bugs']] : []);
54
55
  const secs = m.sections.map((s) => {
55
56
  const rows = s.rows.filter(keep(f));
@@ -70,7 +71,7 @@ async function openTicket({ ws, board, initiative, key, url }) {
70
71
  export function openBacklog({ ws, board, title } = {}) {
71
72
  vwStyle('backlog');
72
73
  let m = null; let f = '';
73
- const draw = (el) => { el.innerHTML = `<div class="vbl">${m === undefined ? '<p class="bl-empty">Reading the backlog…</p>' : backlogHtml(m, f)}</div>`; };
74
+ const draw = (el) => { el.innerHTML = `<div class="vbl">${m === undefined ? SB.loading('Reading the backlog.') : backlogHtml(m, f)}</div>`; };
74
75
  return vwOpen({
75
76
  id: 'backlog:' + (board || ''), title: title || 'Backlog', icon: 'list',
76
77
  render: async (el) => {
@@ -19,8 +19,7 @@
19
19
  .vc .vc-seg button{min-height:32px;padding:0 var(--space-12);border-radius:var(--radius-sm, 6px);font-size:var(--fs-meta);font-weight:var(--fw-regular);color:var(--ink-2);line-height:var(--lh-meta);}
20
20
  .vc .vc-seg button[aria-pressed="true"]{background:var(--solid);color:var(--on-solid)}
21
21
  .vc button:focus-visible{outline:2px solid var(--ember);outline-offset:2px}
22
- .vc .vc-empty{margin:0;padding:var(--space-12) 14px;font-size:var(--fs-meta);color:var(--ink-3);border-bottom:1px solid var(--hair);line-height:var(--lh-meta);}
23
- .vc .vc-w>.vc-empty:last-child{border-bottom:0}
22
+ .vc .vc-w>.pm-state{padding-left:var(--space-12);padding-right:var(--space-12)}
24
23
  /* the timeline (Day and Week), as the console's Calendar draws it (console3.css .cal3-tg): 46px an hour, every hour labelled */
25
24
  .vc{--vc-ev:color-mix(in oklab,var(--ember) 30%,var(--card-solid));--vc-evh:color-mix(in oklab,var(--ember) 42%,var(--card-solid));--vc-we:color-mix(in oklab,var(--well) 70%,transparent);--vc-now:color-mix(in oklab,var(--ember) 9%,transparent)}
26
25
  .vc .vc-sx{overflow-x:auto;min-width:0}
@@ -23,6 +23,7 @@ import { open as vOpen, current as vCur, czSummary, setWidth, widthOf } from './
23
23
  import { pmGet } from './http.js';
24
24
  import { notesCards } from './premium-vw-notes.js';
25
25
  import './premium-vw-open.js'; // registers window.czViews
26
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
26
27
 
27
28
  export const VIEWS = [['day', 'Day'], ['week', 'Week'], ['month', 'Month']];
28
29
  const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@@ -130,9 +131,9 @@ export function calHtml(M, esc, nowMin = null) {
130
131
  const seg = `<div class="vc-seg" role="group" aria-label="Calendar view">${VIEWS.map(([k, l]) => `<button type="button" data-cv="${k}" aria-pressed="${M.view === k}">${l}</button>`).join('')}</div>`;
131
132
  const step = M.view === 'day' ? 'day' : M.view === 'week' ? 'week' : 'month';
132
133
  const head = `<div class="vc-h"><button type="button" class="vc-ib" data-cn="-1" aria-label="Previous ${step}">${ic('back')}</button><button type="button" class="vc-ib" data-cn="1" aria-label="Next ${step}">${ic('next')}</button><button type="button" class="vc-tdy" data-cn="0">Today</button><b class="vc-t">${esc(M.title)}</b><small class="vc-cap">${esc(M.caption)}</small>${seg}</div>`;
133
- if (M.state !== 'ok') return `<div class="vc-w">${head}<p class="vc-empty" role="status">Calendar not read. ${esc(M.reason)}</p></div>`;
134
+ if (M.state !== 'ok') return `<div class="vc-w">${head}${SB.error('Calendar not read. ' + (M.reason || ''))}</div>`;
134
135
  const chip = (a) => a.row ? `<button type="button" class="vc-ad meet" data-ev="${esc(a.ref)}" title="${esc(a.title + ', all day')}">${esc(a.title)}</button>` : `<span class="vc-ad ${esc(a.kind)}${a.tone ? ' t-' + esc(a.tone) : ''}" title="${esc(a.title)}">${esc(a.title)}</span>`;
135
- const empty = M.empty ? `<p class="vc-empty" role="status">${esc(M.empty)}</p>` : '';
136
+ const empty = M.empty ? SB.empty(M.empty) : '';
136
137
  if (M.view === 'month') {
137
138
  const cells = M.days.map((x) => {
138
139
  const ev = [...x.allday.filter((a) => a.row), ...x.timed].sort((a, b) => (a.s || 0) - (b.s || 0));
@@ -281,8 +282,8 @@ export function calSummary(TD) {
281
282
  /** The day (XvACal): the five weekdays with their load bars, then one list, each entry at its time. A day other than today says its count. */
282
283
  export function dayHtml(strip, D, isToday = false) {
283
284
  const h = [`<div class="vzc-days" role="group" aria-label="This week">${strip.map((d) => `<button type="button" class="vzc-dy${d.today ? ' now' : ''}" aria-pressed="${d.on}" data-c="day" data-k="${d.key}" aria-label="${esc(d.dow + ' ' + d.n + (d.today ? ', today' : '') + ': ' + plural(d.count, 'meeting'))}"><span>${d.dow}</span><b>${d.n}</b><span class="vzc-lb" data-tl="${Math.round(d.bar * 100)}%"><i></i></span></button>`).join('')}</div>`];
284
- if (D.state === 'error') return h.join('') + `<p class="vz-empty" role="status">The calendar was not read. ${esc(D.reason || '')}</p>`;
285
- if (!D.rows.length) return h.join('') + '<p class="vz-empty">No meetings on this day.</p>';
285
+ if (D.state === 'error') return h.join('') + SB.error('The calendar was not read. ' + (D.reason || ''));
286
+ if (!D.rows.length) return h.join('') + SB.empty('No meetings on this day.');
286
287
  if (!isToday) { const mins = D.rows.reduce((a, r) => a + (r.mins || 0), 0), allEv = D.rows.every((r) => r.kind === 'event'); h.push(`<p class="vzc-mut">${esc(D.title)} · ${allEv ? plural(D.rows.length, 'meeting') : plural(D.rows.length, 'entry', 'entries')}${mins ? ' · ' + hrsText(mins) : ''}</p>`); }
287
288
  h.push(`<div class="vzc-list">${D.rows.map((r, i) => `<button type="button" class="vzc-de vz-hv${r.ended ? ' past' : ''}" data-c="open" data-i="${i}"${r.next ? ' data-next' : ''}><span class="vzc-t">${esc(r.time)}</span><span class="vzc-dt"><b>${esc(r.title)}</b><small>${esc(r.sub)}</small></span>${r.chip === 'Link it' ? `<span class="vz-cc vzc-link" data-c="link" data-i="${i}" role="button" tabindex="0" title="Link it to an initiative">Link it</span>` : r.chip ? chipHtml(r.chip, r.k) : r.next ? '<i class="vzc-nx" aria-label="Next"></i>' : ''}</button>`).join('')}</div>`);
288
289
  return h.join('');
@@ -306,20 +307,20 @@ export function calViewHtml(st, X) {
306
307
  if (S) h.push(czSummary(S));
307
308
  if (st.view !== 'day') h.push(`<div class="vzc-head"><h2 class="vzm-h2">${esc(rangeTitle(st.view, st.date, X.today))}</h2><button type="button" class="vzm-ib vz-hv" data-c="nav" data-k="-1" aria-label="Previous ${st.view}">${sv('prev')}</button><button type="button" class="vzm-ib vz-hv" data-c="nav" data-k="1" aria-label="Next ${st.view}">${sv('next')}</button><button type="button" class="vzm-btn vzm-soft" data-c="nav" data-k="0">Today</button><span class="vz-sp"></span><button type="button" class="vzm-btn vzm-soft" data-c="view" data-k="day">Day</button></div>`);
308
309
  const M = X.M;
309
- if (!M) h.push('<p class="vz-empty" role="status">Reading the calendar PMOS holds.</p>');
310
- else if (M.state !== 'ok' && st.view !== 'day') h.push(`<p class="vz-empty" role="status">The calendar was not read. ${esc(M.reason || '')}</p>`);
311
- else if (st.view === 'week') h.push(weekHtml(M, X.notes, X.nowMin) + (M.empty ? `<p class="vz-empty" role="status">${esc(M.empty)}</p>` : ''));
312
- else if (st.view === 'month') h.push(monthHtml(M) + (M.empty ? `<p class="vz-empty" role="status">${esc(M.empty)}</p>` : ''));
313
- else h.push(X.day ? dayHtml(X.strip, X.day, st.date === X.today) : '<p class="vz-empty" role="status">Reading the calendar PMOS holds.</p>');
310
+ if (!M) h.push(SB.loading('Reading the calendar PMOS holds.'));
311
+ else if (M.state !== 'ok' && st.view !== 'day') h.push(SB.error('The calendar was not read. ' + (M.reason || '')));
312
+ else if (st.view === 'week') h.push(weekHtml(M, X.notes, X.nowMin) + (M.empty ? SB.empty(M.empty) : ''));
313
+ else if (st.view === 'month') h.push(monthHtml(M) + (M.empty ? SB.empty(M.empty) : ''));
314
+ else h.push(X.day ? dayHtml(X.strip, X.day, st.date === X.today) : SB.loading('Reading the calendar PMOS holds.'));
314
315
  if (st.view !== 'day') h.push(`<div class="vzc-leg"><span><i class="vzc-sw"></i>Linked</span><span><i class="vzc-sw un"></i>Not linked</span><span class="vz-sp"></span><span title="${esc(CAL_FOOT)}">${esc(CAL_HINT)}</span></div>`);
315
316
  } else {
316
317
  const C = X.cards;
317
318
  h.push(`<div class="vzm-in vzc-find">${sv('find')}<input type="search" data-c="q" aria-label="${esc(SEARCH_HINT)}" placeholder="${esc(SEARCH_HINT)}" value="${esc(st.q || '')}">${st.q ? `<span class="vzc-mut">${C && C.state === 'ok' ? plural(C.count, 'note') : ''}</span><button type="button" class="vzm-ib vz-hv" data-c="clear" aria-label="Clear the search">${sv('x', 14)}</button>` : ''}</div>`);
318
319
  h.push(`<div class="vzc-chips" role="group" aria-label="Show">${NOTE_FILTERS.map(([k, l]) => `<button type="button" class="vzm-chip${(st.filter || 'all') === k ? ' on' : ''}" data-c="filter" data-k="${k}" aria-pressed="${(st.filter || 'all') === k}">${l}</button>`).join('')}</div>`);
319
- if (!C) h.push('<p class="vz-empty" role="status">Reading the notes.</p>');
320
- else if (C.state === 'error') h.push(`<p class="vz-empty" role="status">The notes could not be read. ${esc(C.error)}</p>`);
321
- else if (!C.total) h.push('<p class="vz-empty">No notes yet. Notes you record show here, grouped by initiative.</p>');
322
- else if (!C.groups.length) h.push(`<p class="vz-empty" role="status">${st.searching ? 'Searching what was said.' : st.q ? 'No note matches “' + esc(st.q) + '”.' : 'No note of this kind.'}</p>`);
320
+ if (!C) h.push(SB.loading('Reading the notes.'));
321
+ else if (C.state === 'error') h.push(SB.error('The notes could not be read. ' + (C.error || '')));
322
+ else if (!C.total) h.push(SB.empty('No notes yet. Notes you record show here, grouped by initiative.'));
323
+ else if (!C.groups.length) h.push((st.searching ? SB.loading('Searching what was said.') : SB.empty(st.q ? 'No note matches “' + st.q + '”.' : 'No note of this kind.')));
323
324
  else C.groups.forEach((g) => h.push(`<section class="vzc-grp"><p class="vzm-lbl">${esc(g.title)} <small>${esc(g.n)}</small></p>${g.entries.map((e) => entryHtml(e, st)).join('')}</section>`));
324
325
  }
325
326
  return `<div class="vz vz-cal" data-tab="${st.tab}" data-view="${st.view}">${h.join('')}</div>`;
@@ -10,6 +10,7 @@
10
10
  import { vwOpen, vwStyle } from './premium-viewer.js';
11
11
  import { pmGet, pmPost } from './http.js';
12
12
  import { mdHtml, copyKindOf } from './premium-doc-edit.js';
13
+ import * as SB from './state-blocks.js'; // the empty, loading and error states every block has (Komorebi State)
13
14
 
14
15
  const TOOL = { google: 'Google Docs', confluence: 'Confluence', 'google-slides': 'Google Slides', 'google-sheets': 'Google Sheets' };
15
16
  const COPY = { google: 'the Google Doc', confluence: 'the Confluence page', 'google-slides': 'the slides', 'google-sheets': 'the sheet' };
@@ -86,9 +87,9 @@ export function openCopy(o) {
86
87
  }
87
88
  const head = `<div class="cpv-bar">${ICON(kind)}<div><b>${t}</b><small>${esc(tool)}${where}</small></div><span class="chp"><i></i>${r.state === 'reading' ? 'Reading' : 'Link only'}</span></div>`;
88
89
  if (r.state === 'reading') return `<div class="cpv">${head}<p class="note">A session is reading the page with your ${esc(tool)} connector${r.since ? ' (started ' + esc(r.since) + ')' : ''}. The text shows here when it is done.</p><div class="cpv-acts">${ext(o.url, tool)}</div></div>`;
89
- return `<div class="cpv">${head}<div class="cpv-empty"><b>PMOS has only the address of this page.</b><p>It was added as a link, so PMOS holds no text to show here.</p>`
90
+ return `<div class="cpv">${head}${SB.empty('PMOS has only the address of this page. It was added as a link, so PMOS holds no text to show here.')}`
90
91
  + `<div class="cpv-acts">${r.state === 'none' ? `<button type="button" class="dmcta" data-cp="read"${S.busy ? ' disabled' : ''}>Read it now</button>` : ''}${ext(o.url, tool)}</div>`
91
- + `<p class="note">${r.state === 'error' ? esc(r.error) : r.failed ? 'The last read did not finish: ' + esc(r.failed) + '. Press Read it now to try again.' : `Read it now starts one session that reads the page with your ${esc(tool)} connector and keeps the text in PMOS. It changes nothing in ${esc(tool)}.`}</p></div></div>`;
92
+ + `<p class="note">${r.state === 'error' ? esc(r.error) : r.failed ? 'The last read did not finish: ' + esc(r.failed) + '. Press Read it now to try again.' : `Read it now starts one session that reads the page with your ${esc(tool)} connector and keeps the text in PMOS. It changes nothing in ${esc(tool)}.`}</p></div>`;
92
93
  }
93
94
  async function load() {
94
95
  S.err = '';