create-pmos 0.712.0 → 0.714.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 (123) hide show
  1. package/package.json +99 -51
  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 +10 -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 +98 -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 +10 -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 +27 -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/moments.js +41 -3
  31. package/workspace/lib/needs-providers.js +1 -0
  32. package/workspace/lib/parked-cli.js +105 -0
  33. package/workspace/lib/parked-reasons.js +245 -0
  34. package/workspace/lib/pmos-verbs.js +4 -1
  35. package/workspace/lib/prefs-sync.js +138 -0
  36. package/workspace/lib/product-dots.js +60 -0
  37. package/workspace/lib/route-modules.js +2 -0
  38. package/workspace/lib/routes-briefing-premium.js +11 -1
  39. package/workspace/lib/routes-moments.js +1 -1
  40. package/workspace/lib/routes-prefs.js +56 -0
  41. package/workspace/lib/routes-strategy-card.js +53 -0
  42. package/workspace/lib/routes-use-log.js +24 -3
  43. package/workspace/lib/routine-sentence.js +250 -0
  44. package/workspace/lib/strategy-card.js +133 -0
  45. package/workspace/lib/unused-controls.js +178 -0
  46. package/workspace/lib/use-log.js +27 -3
  47. package/workspace/package-lock.json +2 -2
  48. package/workspace/package.json +1 -1
  49. package/workspace/premium-vw-doc-test.js +2 -0
  50. package/workspace/public/pm/action-keys.js +187 -0
  51. package/workspace/public/pm/back-place.js +87 -0
  52. package/workspace/public/pm/bd-pop-ds.css +10 -0
  53. package/workspace/public/pm/bd-pop-ds.js +27 -3
  54. package/workspace/public/pm/bd-strategy.js +85 -0
  55. package/workspace/public/pm/bd-views.js +2 -1
  56. package/workspace/public/pm/changed-mark.css +7 -0
  57. package/workspace/public/pm/changed-mark.js +117 -0
  58. package/workspace/public/pm/cozy-ev.css +7 -0
  59. package/workspace/public/pm/cozy-nav.js +2 -0
  60. package/workspace/public/pm/cozy-pick.css +12 -0
  61. package/workspace/public/pm/cozy-pop-work.css +10 -1
  62. package/workspace/public/pm/cozy-pop-work.js +201 -17
  63. package/workspace/public/pm/cozy-routine-job.js +50 -7
  64. package/workspace/public/pm/cozy-routine.css +2 -0
  65. package/workspace/public/pm/cozy-settings.js +21 -3
  66. package/workspace/public/pm/cozy-today-page.css +1 -0
  67. package/workspace/public/pm/cozy-viewer.css +1 -1
  68. package/workspace/public/pm/cozy-viewer.js +14 -2
  69. package/workspace/public/pm/cozy-vw-mtg.css +0 -2
  70. package/workspace/public/pm/cozy-vw.css +0 -1
  71. package/workspace/public/pm/home-app.js +21 -1
  72. package/workspace/public/pm/home-today.js +2 -0
  73. package/workspace/public/pm/ini-tasks.js +4 -1
  74. package/workspace/public/pm/komorebi.css +11 -0
  75. package/workspace/public/pm/page-chat.js +16 -0
  76. package/workspace/public/pm/prefs-sync.js +111 -0
  77. package/workspace/public/pm/premium-board.js +20 -2
  78. package/workspace/public/pm/premium-chart-tab.js +2 -1
  79. package/workspace/public/pm/premium-insights.js +2 -2
  80. package/workspace/public/pm/premium-mtg-replay.js +4 -3
  81. package/workspace/public/pm/premium-report-read.js +5 -4
  82. package/workspace/public/pm/premium-report-tab.js +4 -3
  83. package/workspace/public/pm/premium-vw-backlog.css +2 -1
  84. package/workspace/public/pm/premium-vw-backlog.js +4 -3
  85. package/workspace/public/pm/premium-vw-cal.css +1 -2
  86. package/workspace/public/pm/premium-vw-cal.js +14 -13
  87. package/workspace/public/pm/premium-vw-copies.js +3 -2
  88. package/workspace/public/pm/premium-vw-copy.css +0 -3
  89. package/workspace/public/pm/premium-vw-mtg.js +12 -11
  90. package/workspace/public/pm/product-switcher.js +41 -0
  91. package/workspace/public/pm/quiet-place.js +15 -2
  92. package/workspace/public/pm/report-orders-ui.js +2 -1
  93. package/workspace/public/pm/rp-parts.js +3 -2
  94. package/workspace/public/pm/state-blocks.js +67 -0
  95. package/workspace/public/pm/use-log.js +127 -1
  96. package/workspace/public/pm/work-select.js +92 -2
  97. package/workspace/public/pm/work-tree.js +70 -0
  98. package/workspace/public/premium-aud.html +1 -0
  99. package/workspace/public/premium-board.html +5 -0
  100. package/workspace/public/premium-buddy.html +1 -0
  101. package/workspace/public/premium-events.html +1 -0
  102. package/workspace/public/premium-goals.html +1 -0
  103. package/workspace/public/premium-intelligence.html +1 -0
  104. package/workspace/public/premium-library.html +1 -0
  105. package/workspace/public/premium-present.html +1 -0
  106. package/workspace/public/premium-rec.html +1 -0
  107. package/workspace/public/premium-routine.html +1 -0
  108. package/workspace/public/premium-viewer.html +1 -0
  109. package/workspace/public/premium-workflows.html +1 -0
  110. package/workspace/public/today.html +1 -0
  111. package/workspace/server.js +20 -0
  112. package/workspace/test-lists/action-keys.json +9 -0
  113. package/workspace/test-lists/back-place.json +9 -0
  114. package/workspace/test-lists/changed-mark.json +9 -0
  115. package/workspace/test-lists/launch-tiers.json +9 -0
  116. package/workspace/test-lists/parked-reasons.json +9 -0
  117. package/workspace/test-lists/prefs-follow-person.json +9 -0
  118. package/workspace/test-lists/product-switcher-dots.json +9 -0
  119. package/workspace/test-lists/routine-sentence.json +9 -0
  120. package/workspace/test-lists/shared-empty-states.json +9 -0
  121. package/workspace/test-lists/strategy-card.json +9 -0
  122. package/workspace/test-lists/unused-controls.json +9 -0
  123. 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) {
@@ -8,6 +8,8 @@
8
8
  * (the same chat with the scope filled in), and Settings › Workflows' New workflow opens here too, so there is no second chat column.
9
9
  *
10
10
  * openCos({ here, ws? }) → true the chief-of-staff chat; here: the page's words for the chip ("Board · Atlas"), '' for none
11
+ * ask(text, { ws?, here? }) → true the chief-of-staff chat with `text` written in its box, NOT sent: the person reads it and sends it
12
+ * (a waiting page's next step, state-blocks.js next; initiative empty-page-next-action)
11
13
  * openTarget(t, o) → true any chat target (home-chat.js mountChat open), o: { title, url }; while the popup shows, its chat
12
14
  * box() → { el, chat } the chat for the popup's right side (cozy-popup.js)
13
15
  *
@@ -99,6 +101,20 @@ export async function openCos(o = {}) {
99
101
  if (!isPhone()) { const P = await import('./cozy-popup.js'); return P.openCos(cosTarget(o.here, o.ws)); }
100
102
  return openTarget(cosTarget(o.here, o.ws), { title: 'Ask PMOS', url: '/premium.html' });
101
103
  }
104
+ export async function ask(text, o = {}) {
105
+ const here = o.here != null ? String(o.here) : String((typeof document !== 'undefined' && document.title) || '').replace(/\s*[·|–-]\s*PMOS\s*$/i, '').trim();
106
+ await openCos({ here, ws: o.ws });
107
+ let n = 0;
108
+ const t = setInterval(() => {
109
+ const b = document.querySelector('.pc-chat textarea');
110
+ if (!b && ++n <= 40) return;
111
+ clearInterval(t);
112
+ if (!b) return;
113
+ b.value = String(text || ''); b.dispatchEvent(new Event('input', { bubbles: true })); b.focus();
114
+ try { b.setSelectionRange(b.value.length, b.value.length); } catch { /* not a text box */ }
115
+ }, 50);
116
+ return true;
117
+ }
102
118
  const isPhone = () => typeof innerWidth === 'number' && innerWidth <= 760;
103
119
  /** The chat itself for the popup (cozy-popup.js): mounted once, the same element and conversation reader as the chat panel. */
104
120
  export async function box() {
@@ -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>`;
@@ -35,7 +35,7 @@ import * as GW from './grill-words.js'; // Grill and Forecast screens (canvas
35
35
  import * as PK from './cozy-pick.js'; // the one product picker Home, Board and Insights share (batch 12 item 5)
36
36
  import { openReport } from './premium-report-read.js';
37
37
  import { mountNav } from './cozy-nav.js';
38
- import { quietPlace, quietLine } from './quiet-place.js'; // onboarding B3: before a goal is kept Intelligence shows one line; reports before a week of movement
38
+ import { quietPlace, quietLine, quietNext } from './quiet-place.js'; // onboarding B3: before a goal is kept Intelligence shows one line; reports before a week of movement
39
39
  import { mountLivePill } from './cozy-live-pill.js';
40
40
  import { mountPanels } from './cozy-panels.js';
41
41
  import * as IM from './impact.js'; // Your impact's ✦ line (batch 16 item 7): a key result your work moved
@@ -2195,7 +2195,7 @@ function drawList() {
2195
2195
  // U3: no "Needs you N" heading; the rows and their ✓ are the signal, and the count belongs to Your move on Home (zero is silence)
2196
2196
  const needs = nNeed ? `<div class="ins-nlist" id="repNeeds" role="list" aria-label="Waiting for you">${waits.map(needRowHtml).join('')}${waitAsks.map(askNeedHtml).join('')}</div>` : '';
2197
2197
  const table = rest.length + restAsks.length ? `<div class="ins-sec"><h3>Yours</h3><span class="q">${rest.length + restAsks.length}</span></div><div class="ins-rtbl" id="repAsks">${head3}<div role="list">${rest.map(repRowHtml).join('')}${restAsks.map(askRowHtml).join('')}</div></div>`
2198
- : !empty && !needs ? (quietLine('reports') ? `<div class="ins-empty"><b>${esc(quietLine('reports'))}</b></div>` : '<div class="ins-empty"><b>No report is set up and no report file is on record.</b> Reports are made in Home.</div>') : '';
2198
+ : !empty && !needs ? (quietLine('reports') ? `<div class="ins-empty"><b>${esc(quietLine('reports'))}</b>${quietNext('reports')}</div>` : '<div class="ins-empty"><b>No report is set up and no report file is on record.</b> Reports are made in Home.</div>') : '';
2199
2199
  const dd = savedDash().length ? null : draftedDash();
2200
2200
  const dashBlock = `<div class="ins-sec"><h3>Dashboards</h3><span class="q">${dashes.length && !dd ? dashes.length + ' · a dashboard is a saved view of Goals' : dd ? '1 drafted · ' + esc(dd.name) : 'none saved · select rows, then Save'}</span></div><div class="ins-dgrid" role="list">${dd ? draftedCard(dd) : ''}${dashes.map(dashCard).join('')}</div>`;
2201
2201
  $('#repBody').innerHTML = `${needs}${oneNote()}${libFolds(LIB.L) || '<div id="readyLib"></div>'}<div id="listRows" aria-label="Dashboards and reports">${fbox}${empty}${table}${dashBlock}</div>`;
@@ -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}