create-pmos 0.319.0 → 0.320.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.319.0",
3
+ "version": "0.320.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@ed07d2c
1
+ kernel-source: pmos@aeaf614
2
2
  assembled: 2026-10-19
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-19T14:43:52Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T15:07:56Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-19T14:43:52Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T15:07:56Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-19T14:43:52Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-19T15:07:56Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -166,6 +166,8 @@ When you scroll past the hero, the hero folds into a bar at the top. The bar sho
166
166
 
167
167
  A row or a Today item opens a dialog with the same parts every time. At the top is a short log of what PMOS read, for example the kill-condition file and `pm-decisions.md`. Under it is one plain sentence. Then one card holds the evidence and, for a decision, the options. The record sits on the right: a draft `pm-decisions.md` entry for a decision, the initiative record for blocked work, the commit for a merge.
168
168
 
169
+ The right side can hold more than one item. When the dialog opens a related item there, such as a document, a meeting or a ticket, the item opens as a tab beside the dialog's own detail. The first tab is always the dialog's own detail. You can have up to four more tabs; a fifth closes the oldest. Click a tab or use the arrow keys to move between them. Use the **×** on a tab, or press Delete, to close it. The tabs close when the dialog closes. With no extra item, there are no tabs.
170
+
169
171
  A decision opens with no option chosen, because no recommendation is on record. Choose one and the draft entry on the right changes. Nothing is written. The main button, "Not yet" and "Return this run to the agent" are off in this version, and each says why.
170
172
 
171
173
  ## The conversation
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.319.0",
3
+ "version": "0.320.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.319.0",
9
+ "version": "0.320.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.319.0",
3
+ "version": "0.320.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -0,0 +1,136 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* premium-viewer-test.js — the premium dialog's right pane as a viewer with tabs (initiative premium-viewer, S1; planning/prd/premium-viewer-prd.md R1, R7).
4
+ * Serves the real Briefing page from the real server with the Briefing model answered by a stand-in, opens a row's dialog, then drives window.__premiumViewer.
5
+ * R1 tabs: open, switch, close, at most 4 extra, #oMain kept with its handlers, reset on the next dialog · R7 floors: 390px, 44px targets, dark theme
6
+ * Every wait polls the page; no fixed sleep stands in for a state. */
7
+ const path = require('path');
8
+ const { spawn } = require('child_process');
9
+ const { findBrowser } = require('./lib/find-browser');
10
+ const T = require('./test-run').configure({ name: 'premium-viewer' });
11
+ const B = require('./lib/briefing-premium.js');
12
+ const F = require('./fixtures/briefing-premium-facts.js');
13
+
14
+ const BASE = T.BASE;
15
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
16
+ const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
17
+ const results = [];
18
+ const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
19
+ let srv = null; let browser = null;
20
+ const finish = async (code) => {
21
+ if (browser) await browser.close().catch(() => {});
22
+ if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
23
+ T.killTmux();
24
+ const bad = results.filter((x) => !x.cond).length;
25
+ console.log(`\n${results.length - bad}/${results.length} premium-viewer assertions passed`);
26
+ process.exit(code !== undefined ? code : (bad ? 1 : 0));
27
+ };
28
+ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
29
+
30
+ (async () => {
31
+ const exe = findBrowser();
32
+ if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
33
+ let chromium;
34
+ try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
35
+ srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
36
+ await T.waitForServer(BASE);
37
+ browser = await chromium.launch({ executablePath: exe });
38
+
39
+ const open = async ({ w = 1280, h = 900, theme = 'light' } = {}) => {
40
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
41
+ const page = await ctx.newPage();
42
+ const S = { errors: [] };
43
+ page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
44
+ await page.route('**/api/briefing-premium*', (r) => r.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: B.build(F.facts()), as_of: Date.now() }) }));
45
+ await page.goto(BASE + '/premium.html?theme=' + theme);
46
+ S.up = await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length > 0 && !!window.__premiumViewer), 20000);
47
+ return { page, ctx, S };
48
+ };
49
+ /* opens the first row that opens a dialog on this page (a row with its own page would navigate away) */
50
+ const openDialog = async (page) => {
51
+ const n = await page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length);
52
+ for (let i = 0; i < n; i++) {
53
+ const url = page.url();
54
+ await page.evaluate((k) => document.querySelectorAll('#rank .rr .rhd')[k].click(), i);
55
+ if (await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on')), 3000)) return true;
56
+ if (page.url() !== url) { await page.goBack(); await until(() => page.evaluate(() => document.querySelectorAll('#rank .rr .rhd').length > 0 && !!window.__premiumViewer), 20000); }
57
+ }
58
+ return false;
59
+ };
60
+ const st = (page) => page.evaluate(() => {
61
+ const t = document.querySelector('#vTabs'), m = document.querySelector('#oMain'), lab = document.querySelector('#oLab');
62
+ const vis = (e) => !!e && !e.hidden && getComputedStyle(e).display !== 'none';
63
+ return { ...window.__premiumViewer.vwState(), strip: vis(t), lab: vis(lab), main: vis(m), tabs: t ? [...t.querySelectorAll('.vtab')].map((x) => x.dataset.vw) : [],
64
+ sel: t ? [...t.querySelectorAll('.vtab[aria-selected="true"]')].map((x) => x.dataset.vw) : [], panes: [...document.querySelectorAll('#dOut .obody.vw')].map((p) => [p.dataset.vw, vis(p)]) };
65
+ });
66
+
67
+ /* R1 desktop */
68
+ {
69
+ const { page, ctx, S } = await open();
70
+ ok('R1 the Briefing loads with the viewer module', S.up);
71
+ ok('R1 a row opens the dialog', await openDialog(page));
72
+ let s = await st(page);
73
+ ok('R1 with no extra tab the strip is hidden, #oLab shows, #oMain shows', !s.strip && s.lab && s.main && s.ids.length === 0, JSON.stringify(s));
74
+ /* a page's handler on #oMain, and a node inside it, must survive the tabs */
75
+ await page.evaluate(() => { const m = document.querySelector('#oMain'); window.__hits = 0; m.addEventListener('click', () => { window.__hits++; }); const p = document.createElement('p'); p.id = 'vwMark'; p.textContent = 'mark'; m.append(p); });
76
+ await page.evaluate(() => window.__premiumViewer.vwOpen({ id: 'a', title: 'Alpha doc', icon: 'doc', html: '<p id="paneA">Alpha</p>', wire: (el) => { el.querySelector('#paneA').dataset.wired = '1'; } }));
77
+ s = await st(page);
78
+ ok('R1 opening an item shows the strip with the main tab and the item, the item selected', s.strip && !s.lab && JSON.stringify(s.tabs) === '["main","a"]' && JSON.stringify(s.sel) === '["a"]' && !s.main, JSON.stringify(s));
79
+ ok('R1 the item fills its own pane and wire runs on it', await page.evaluate(() => document.querySelector('#paneA') && document.querySelector('#paneA').dataset.wired === '1'));
80
+ ok('R1 the main tab is labelled with the dialog\'s label and has no close button', await page.evaluate(() => { const t = document.querySelector('#vTabs .vtab[data-vw="main"]'); return t.textContent.trim() === document.querySelector('#oLab').textContent.trim() && !t.querySelector('.vx'); }));
81
+ await page.click('#vTabs .vtab[data-vw="main"]');
82
+ s = await st(page);
83
+ ok('R1 a click on the main tab shows #oMain and hides the item', s.main && s.on === 'main' && s.panes.every((p) => !p[1]), JSON.stringify(s));
84
+ ok('R1 #oMain was not re-rendered: the node inside it and its handler are still there', await page.evaluate(() => { document.querySelector('#vwMark').click(); return !!document.querySelector('#oMain #vwMark') && window.__hits === 1; }));
85
+ await page.evaluate(() => window.__premiumViewer.vwOpen({ id: 'a', title: 'Alpha doc', html: '<p id="paneA">Alpha 2</p>' }));
86
+ s = await st(page);
87
+ ok('R1 opening the same id again refills that tab and shows it, with no second tab', s.ids.length === 1 && s.on === 'a' && (await page.textContent('#paneA')) === 'Alpha 2', JSON.stringify(s));
88
+ for (const id of ['b', 'c', 'd', 'e']) await page.evaluate((x) => window.__premiumViewer.vwOpen({ id: x, title: 'Item ' + x, html: `<p>${x}</p>` }), id);
89
+ s = await st(page);
90
+ ok('R1 at most 4 extra tabs: the fifth closes the oldest', JSON.stringify(s.ids) === '["b","c","d","e"]' && s.on === 'e' && s.panes.length === 4, JSON.stringify(s));
91
+ await page.click('#vTabs .vtab[data-vw="e"] .vx');
92
+ s = await st(page);
93
+ ok('R1 closing the shown tab shows the one before it', JSON.stringify(s.ids) === '["b","c","d"]' && s.on === 'd', JSON.stringify(s));
94
+ await page.focus('#vTabs .vtab[data-vw="d"]');
95
+ await page.keyboard.press('ArrowLeft');
96
+ s = await st(page);
97
+ ok('R1 the arrow keys move between tabs', s.on === 'c' && (await page.evaluate(() => document.activeElement.dataset.vw)) === 'c', JSON.stringify(s));
98
+ await page.keyboard.press('Delete');
99
+ s = await st(page);
100
+ ok('R1 Delete closes the focused tab', JSON.stringify(s.ids) === '["b","d"]', JSON.stringify(s));
101
+ const yes = page.evaluate(() => window.__premiumViewer.vwConfirm(document.querySelector('#dOut .obody.vw:not([hidden])'), { text: 'Undo all 3 edits?', yes: 'Undo all' }));
102
+ await until(() => page.evaluate(() => !!document.querySelector('.vcf')));
103
+ ok('R1 vwConfirm draws a card with the question in the shown pane', (await page.textContent('.vcf p')) === 'Undo all 3 edits?');
104
+ await page.click('.vcf [data-a="1"]');
105
+ ok('R1 vwConfirm resolves true on the yes button and removes the card', (await yes) === true && !(await page.$('.vcf')));
106
+ await page.evaluate(() => window.__premiumViewer.vwStyle('none-such'));
107
+ ok('R1 vwStyle adds the view\'s stylesheet link once', await page.evaluate(() => { window.__premiumViewer.vwStyle('none-such'); window.__premiumViewer.vwStyle('../x'); return document.querySelectorAll('link[data-vw-css]').length === 1 && document.querySelector('link[data-vw-css]').getAttribute('href') === '/pm/premium-vw-none-such.css'; }));
108
+ await page.keyboard.press('Escape');
109
+ await until(() => page.evaluate(() => !document.querySelector('#dlg').classList.contains('on')), 3000);
110
+ await openDialog(page);
111
+ s = await st(page);
112
+ ok('R1 the next dialog starts with no extra tab', s.ids.length === 0 && !s.strip && s.main && s.panes.length === 0, JSON.stringify(s));
113
+ ok('R1 no page error', S.errors.length === 0, S.errors.join(' | '));
114
+ await ctx.close();
115
+ }
116
+
117
+ /* R7 phone and dark theme */
118
+ {
119
+ const { page, ctx, S } = await open({ w: 390, h: 844, theme: 'dark' });
120
+ ok('R7 a row opens the dialog at 390px', await openDialog(page));
121
+ for (const id of ['a', 'b']) await page.evaluate((x) => window.__premiumViewer.vwOpen({ id: x, title: 'A long item title ' + x, html: `<p>${x}</p>` }), id);
122
+ const m = await page.evaluate(() => {
123
+ const r = (e) => e.getBoundingClientRect();
124
+ const tabs = [...document.querySelectorAll('#vTabs .vtab')], xs = [...document.querySelectorAll('#vTabs .vx')];
125
+ return { tabH: Math.min(...tabs.map((t) => r(t).height)), xH: Math.min(...xs.map((t) => r(t).height)), xW: Math.min(...xs.map((t) => r(t).width)),
126
+ over: document.documentElement.scrollWidth > window.innerWidth, stripW: r(document.querySelector('#vTabs')).right <= window.innerWidth + 1,
127
+ bg: getComputedStyle(document.querySelector('#vTabs .vtab[aria-selected="true"]')).backgroundColor };
128
+ });
129
+ ok('R7 tabs and close buttons are at least 44px at 390px', m.tabH >= 44 && m.xH >= 44 && m.xW >= 44, JSON.stringify(m));
130
+ ok('R7 the strip fits the width and the page does not scroll sideways', m.stripW && !m.over, JSON.stringify(m));
131
+ ok('R7 in the dark theme the selected tab is not a light card', (() => { const c = (m.bg.match(/\d+/g) || []).slice(0, 3).map(Number); return c.length === 3 && c[0] + c[1] + c[2] < 3 * 160; })(), m.bg);
132
+ ok('R7 no page error', S.errors.length === 0, S.errors.join(' | '));
133
+ await ctx.close();
134
+ }
135
+ finish();
136
+ })();
@@ -1,6 +1,7 @@
1
1
  /* pm/premium-shell.js — what the premium Briefing and My work pages share: the theme, the toast, the standard dialog and the read-only agent's conversation (initiatives briefing-premium and my-work-premium). */
2
2
  import { pmGet, pmPost } from './http.js';
3
3
  import { recChipView, STOP_LINE } from './premium-meeting.js';
4
+ import { vwReset } from './premium-viewer.js';
4
5
  import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
5
6
  export const $ = (s, r = document) => r.querySelector(s);
6
7
  export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
@@ -170,7 +171,7 @@ export function openDlg(o) {
170
171
  $$('.rail,main.stage,#dock').forEach((x) => { x.inert = true; });
171
172
  $('#dlg').inert = false; document.documentElement.style.overflow = 'hidden';
172
173
  $('#dEye').textContent = o.eye; $('#dTitle').textContent = o.title; $('#dSub').textContent = o.sub || ''; $('#dSub').hidden = !o.sub;
173
- $('#oMain').innerHTML = o.pane || `<article class="paper doc">${o.html}</article>`; $('#oLab').textContent = o.label || 'Detail';
174
+ $('#oMain').innerHTML = o.pane || `<article class="paper doc">${o.html}</article>`; $('#oLab').textContent = o.label || 'Detail'; vwReset(); // extra viewer tabs belong to the dialog that opened them
174
175
  $('#dBody').innerHTML = `<div class="stream" role="log">${o.stream || turnA(ptx(o.say))}</div><form class="askbar" id="askF"><input id="askIn" placeholder="Ask the agent about this row" maxlength="2000" autocomplete="off" aria-label="A question for the agent"><button type="submit" data-act="ask" id="askGo" aria-label="Ask the agent" title="Ask the agent"><svg class="i" viewBox="0 0 24 24"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></form><p class="fine2" id="askNote">The agent reads this repository and answers in words. It cannot change anything, and its answers are not checked against the records.</p>`;
175
176
  $('#dlg').classList.remove('full'); setMode('split'); setTab('out'); // on a phone the dialog opens on the Detail tab and the Detail / Conversation switch brings the conversation, as the mockup draws it
176
177
  $('#veil').classList.add('on'); $('#dlg').classList.add('on');
@@ -0,0 +1,97 @@
1
+ /* pm/premium-viewer.js — the right pane of the premium dialog as a viewer with tabs (initiative premium-viewer, R1).
2
+ * The dialog's own detail (#oMain) is always the first tab and is never re-rendered here, so the handlers pages bind on #oMain keep
3
+ * working. vwOpen(item) opens another item as a tab beside it, in its own .obody; at most MAX extra tabs, the oldest closes first.
4
+ * With no extra tab the pane looks as it did: the tab strip is hidden and #oLab shows the label.
5
+ * vwOpen({ id, title, icon?, html | render(el), wire?(el) }) · vwClose(id) · vwShow(id | 'main') · vwReset() (openDlg calls it)
6
+ * vwStyle(name) loads pm/premium-vw-<name>.css once, so each view keeps its rules out of the shared premium.css.
7
+ * vwConfirm(el, { text, yes, no }) puts a confirm card at the top of a view's pane and resolves true or false.
8
+ * The contract for views is /mnt/project-files/premium-viewer-build/frame-contract.md. */
9
+ const MAX = 4;
10
+ const IC = {
11
+ doc: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5', cal: 'M3.5 5h17v15h-17zM3.5 10h17M8 3v4M16 3v4', notes: 'M6 3h9l4 4v14H6zM14 3v5h5M9 12h7M9 16h5',
12
+ tk: 'M4 4h16v16H4zM8.5 12.5l2.5 2.5 4.5-5', list: 'M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01', mic: 'M9 3h6v11H9zM5 11a7 7 0 0 0 14 0M12 18v3',
13
+ };
14
+ const svg = (k) => `<svg class="i" viewBox="0 0 24 24"><path d="${IC[k] || IC.doc}"/></svg>`;
15
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c]));
16
+ const V = { items: [], on: 'main' };
17
+ const q = (s) => document.querySelector(s);
18
+
19
+ function strip() {
20
+ let t = q('#vTabs');
21
+ if (!t) { const top = q('#dOut .otop'); if (!top) return null; t = document.createElement('div'); t.id = 'vTabs'; t.className = 'vtabs'; t.setAttribute('role', 'tablist'); t.setAttribute('aria-label', 'Open items'); top.prepend(t); t.onclick = onTab; t.onkeydown = onKey; } // delegated: the tabs carry role=tab and the keys below, the close is a real button
22
+ return t;
23
+ }
24
+ function draw() {
25
+ const t = strip(); if (!t) return;
26
+ const lab = q('#oLab'), many = V.items.length > 0;
27
+ t.hidden = !many; if (lab) lab.hidden = many;
28
+ if (!many) { t.innerHTML = ''; return; }
29
+ const tab = (id, title, icon, x) => `<div class="vtab" role="tab" tabindex="${V.on === id ? 0 : -1}" aria-selected="${V.on === id}" data-vw="${esc(id)}">${svg(icon)}<span>${esc(title)}</span>${x ? `<button type="button" class="vx" data-vx="${esc(id)}" aria-label="Close ${esc(title)}" title="Close"><svg class="i" viewBox="0 0 24 24"><path d="M6 6l12 12M18 6 6 18"/></svg></button>` : ''}</div>`;
30
+ t.innerHTML = tab('main', (lab && lab.textContent) || 'Detail', 'doc', false) + V.items.map((it) => tab(it.id, it.title, it.icon, true)).join('');
31
+ }
32
+ function pane(id) { return id === 'main' ? q('#oMain') : document.querySelector(`#dOut .obody.vw[data-vw="${CSS.escape(id)}"]`); }
33
+ export function vwShow(id) {
34
+ if (id !== 'main' && !V.items.some((x) => x.id === id)) id = 'main';
35
+ V.on = id;
36
+ const m = q('#oMain'); if (m) m.hidden = id !== 'main';
37
+ document.querySelectorAll('#dOut .obody.vw').forEach((p) => { p.hidden = p.dataset.vw !== id; });
38
+ draw();
39
+ const p = q('#dOut'); if (p) p.scrollTop = 0;
40
+ }
41
+ export function vwOpen(it) {
42
+ if (!it || !it.id) return null;
43
+ const was = V.items.find((x) => x.id === it.id);
44
+ if (was) { Object.assign(was, it); fill(was); vwShow(it.id); return pane(it.id); }
45
+ if (V.items.length >= MAX) vwClose(V.items[0].id, true);
46
+ const el = document.createElement('div'); el.className = 'obody vw'; el.dataset.vw = it.id; el.setAttribute('role', 'tabpanel');
47
+ const at = q('#dOut .tabhint'); if (at) at.before(el); else q('#dOut').append(el);
48
+ const rec = { id: it.id, title: it.title || 'Item', icon: it.icon || 'doc', html: it.html, render: it.render, wire: it.wire };
49
+ V.items.push(rec); fill(rec); vwShow(it.id);
50
+ return el;
51
+ }
52
+ function fill(rec) {
53
+ const el = pane(rec.id); if (!el) return;
54
+ if (rec.render) rec.render(el); else el.innerHTML = rec.html || '';
55
+ if (rec.wire) rec.wire(el);
56
+ }
57
+ export function vwClose(id, quiet) {
58
+ const i = V.items.findIndex((x) => x.id === id); if (i < 0) return;
59
+ V.items.splice(i, 1); const p = pane(id); if (p) p.remove();
60
+ if (quiet) return;
61
+ if (V.on === id) vwShow(V.items[i - 1] ? V.items[i - 1].id : V.items[i] ? V.items[i].id : 'main'); else draw();
62
+ }
63
+ export function vwReset() {
64
+ V.items.forEach((it) => { const p = pane(it.id); if (p) p.remove(); });
65
+ V.items = []; V.on = 'main';
66
+ const m = q('#oMain'); if (m) m.hidden = false;
67
+ draw();
68
+ }
69
+ export const vwState = () => ({ on: V.on, ids: V.items.map((x) => x.id) });
70
+ function onTab(e) {
71
+ const x = e.target.closest('[data-vx]'); if (x) { e.stopPropagation(); vwClose(x.dataset.vx); return; }
72
+ const t = e.target.closest('[data-vw]'); if (t) vwShow(t.dataset.vw);
73
+ }
74
+ function onKey(e) {
75
+ const tabs = [...document.querySelectorAll('#vTabs .vtab')], i = tabs.indexOf(document.activeElement); if (i < 0) return;
76
+ let n = -1;
77
+ if (e.key === 'ArrowRight') n = (i + 1) % tabs.length; else if (e.key === 'ArrowLeft') n = (i - 1 + tabs.length) % tabs.length;
78
+ else if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); vwShow(tabs[i].dataset.vw); return; }
79
+ else if ((e.key === 'Delete' || e.key === 'Backspace') && tabs[i].dataset.vw !== 'main') { vwClose(tabs[i].dataset.vw); return; }
80
+ if (n < 0) return; e.preventDefault(); vwShow(tabs[n].dataset.vw); const f = q(`#vTabs .vtab[data-vw="${CSS.escape(tabs[n].dataset.vw)}"]`); if (f) f.focus();
81
+ }
82
+ export function vwStyle(name) {
83
+ if (!/^[a-z0-9-]+$/.test(name || '') || document.querySelector(`link[data-vw-css="${name}"]`)) return;
84
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = `/pm/premium-vw-${name}.css`; l.dataset.vwCss = name; document.head.append(l);
85
+ }
86
+ export function vwConfirm(el, o) {
87
+ return new Promise((done) => {
88
+ if (!el) { done(false); return; }
89
+ const old = el.querySelector(':scope > .vcf'); if (old) old.remove();
90
+ const c = document.createElement('div'); c.className = 'vcf'; c.setAttribute('role', 'alertdialog'); c.setAttribute('aria-label', (o && o.text) || 'Confirm');
91
+ c.innerHTML = `<p>${esc(o && o.text)}</p><div class="vcfb"><button type="button" class="btn" data-a="1">${esc((o && o.yes) || 'Yes')}</button><button type="button" class="btn sec" data-a="0">${esc((o && o.no) || 'Cancel')}</button></div>`;
92
+ c.onclick = (e) => { // delegated to the card's two buttons
93
+ const b = e.target.closest('[data-a]'); if (!b) return; c.remove(); done(b.dataset.a === '1'); };
94
+ el.prepend(c); const f = c.querySelector('[data-a="1"]'); if (f) f.focus();
95
+ });
96
+ }
97
+ if (typeof window !== 'undefined') window.__premiumViewer = { vwOpen, vwClose, vwShow, vwReset, vwState, vwStyle, vwConfirm };
@@ -2020,6 +2020,25 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
2020
2020
  .wkdue span{font:600 var(--fs-2) var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--ember-ink)}.wkdue b{font-weight:500}
2021
2021
  .tl.wkday{min-height:0}.tl.wkday .ev{cursor:default}
2022
2022
  #todayCard.wkm .foldb{margin-left:auto}
2023
+ /* the viewer's tabs (initiative premium-viewer, R1): the dialog's detail is the first tab, items opened from it follow */
2024
+ .vtabs{display:flex;align-items:center;gap:4px;min-width:0;overflow-x:auto;scrollbar-width:none;flex:1 1 auto}
2025
+ .vtabs[hidden]{display:none}
2026
+ .vtab{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 6px 0 12px;border-radius:var(--r-chip);font-size:var(--fs-2);font-weight:500;color:var(--ink-2);white-space:nowrap;cursor:pointer;flex:none;max-width:220px}
2027
+ .vtab span{overflow:hidden;text-overflow:ellipsis}
2028
+ .vtab .i{width:14px;height:14px;flex:none}
2029
+ .vtab:hover{background:var(--card)}
2030
+ .vtab[aria-selected="true"]{background:var(--card-solid);color:var(--ink);font-weight:600;box-shadow:var(--card-shadow)}
2031
+ .vtab[data-vw="main"]{padding-right:12px}
2032
+ .vtab .vx{width:24px;height:24px;border-radius:6px;display:grid;place-items:center;color:var(--ink-3)}
2033
+ .vtab .vx:hover{background:var(--well);color:var(--ink)}
2034
+ .vtab .vx .i{width:12px;height:12px}
2035
+ .vtab:focus-visible{outline:2px solid var(--ink);outline-offset:1px}
2036
+ .obody[hidden]{display:none!important}
2037
+ @media (max-width:700px){.vtab{height:44px}.vtab .vx{width:44px;height:44px}}
2038
+ .vcf{border:1px solid var(--hair);border-radius:var(--r-chip);background:var(--card-solid);box-shadow:var(--card-shadow);padding:12px 14px;margin:0 0 14px}
2039
+ .vcf p{margin:0 0 10px;font-size:var(--fs-3)}
2040
+ .vcfb{display:flex;gap:8px;flex-wrap:wrap}
2041
+ @media (max-width:700px){.vcfb .btn{min-height:44px}}
2023
2042
 
2024
2043
  /* one top bar on every premium page (initiative premium-topbar): left = where you are + Chat; right = Sources chip, bell, one ⋯ menu */
2025
2044
  .top{flex-wrap:nowrap}
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Initiative premium-viewer: the premium dialog's right pane as a viewer with tabs (S1, the frame the view slices build on).",
3
+ "panels": [
4
+ "premium-viewer-test.js"
5
+ ],
6
+ "seconds": {
7
+ "premium-viewer-test.js": 60
8
+ }
9
+ }