create-pmos 0.483.0 → 0.484.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +14 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +13 -0
- package/workspace/guide/briefing-premium.md +1 -1
- package/workspace/guide/home.md +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-html-viewer-test.js +6 -0
- package/workspace/public/pm/home-app.js +6 -2
- package/workspace/public/pm/home-list.js +10 -3
- package/workspace/public/pm/home-today.js +2 -2
- package/workspace/public/pm/premium-vw-doc.css +6 -1
- package/workspace/public/pm/premium-vw-file.js +7 -2
- package/workspace/public/pm/premium-vw-pdf.js +42 -0
- package/workspace/public/vendor/pdf.min.js +28 -0
- package/workspace/public/vendor/pdf.worker.min.js +28 -0
- package/workspace/ready-dash-ui-test.js +2 -1
- package/workspace/server.js +3 -0
- package/workspace/third-party/README.md +9 -4
- package/workspace/third-party/pdfjs-dist-5.4.296.LICENSE +177 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.484.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": {
|
|
@@ -32,6 +32,19 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.484.0",
|
|
37
|
+
"at": "2026-11-02T02:00:11.221Z",
|
|
38
|
+
"f": 3,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 1143,
|
|
42
|
+
"t": "Program chats get the header pill; a phone shows every PDF page (batch 22 items 17, 18)",
|
|
43
|
+
"s": "Program chats get the header pill; a phone shows every PDF page (batch 22 items 17, 18)",
|
|
44
|
+
"k": "fix"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
35
48
|
{
|
|
36
49
|
"v": "0.483.0",
|
|
37
50
|
"at": "2026-11-02T00:26:37.780Z",
|
|
@@ -282,19 +295,6 @@
|
|
|
282
295
|
"k": "new"
|
|
283
296
|
}
|
|
284
297
|
]
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
"v": "0.464.0",
|
|
288
|
-
"at": "2026-10-31T02:53:30.027Z",
|
|
289
|
-
"f": 3,
|
|
290
|
-
"prs": [
|
|
291
|
-
{
|
|
292
|
-
"n": 1116,
|
|
293
|
-
"t": "No folder per initiative in a document repository, finished worktrees clean up, one plain notice (D102)",
|
|
294
|
-
"s": "No folder per initiative in a document repository, finished worktrees clean up, one plain notice",
|
|
295
|
-
"k": "new"
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
298
|
}
|
|
299
299
|
]
|
|
300
300
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-02T02:00:07Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-02T02:00:07Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-11-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-02T02:00:07Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.484.0",
|
|
4
|
+
"at": "2026-11-02T02:00:11.221Z",
|
|
5
|
+
"f": 3,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1143,
|
|
9
|
+
"t": "Program chats get the header pill; a phone shows every PDF page (batch 22 items 17, 18)",
|
|
10
|
+
"s": "Program chats get the header pill; a phone shows every PDF page (batch 22 items 17, 18)",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.483.0",
|
|
4
17
|
"at": "2026-11-02T00:26:37.780Z",
|
|
@@ -508,7 +508,7 @@ Press **+** at the left of the message box. The menu has three items: **Add file
|
|
|
508
508
|
|
|
509
509
|
### Open a file Claude names
|
|
510
510
|
|
|
511
|
-
A PDF that Claude names opens in the Viewer, in the browser's own PDF viewer. It takes the whole width and height of the Viewer, with its path under it. Other files show as text.
|
|
511
|
+
A PDF that Claude names opens in the Viewer, in the browser's own PDF viewer. It takes the whole width and height of the Viewer, with its path under it. On a phone, where the browser shows only the first page, the Viewer draws every page itself, one under the other. Other files show as text.
|
|
512
512
|
|
|
513
513
|
### Give Claude a goal with `/goal`
|
|
514
514
|
|
package/workspace/guide/home.md
CHANGED
|
@@ -25,7 +25,7 @@ Home, the Board, Insights and the Viewer use one type scale: 11, 12, 14, 16, 20
|
|
|
25
25
|
- A **program** comes first, above the products. Its header shows the program icon, its name, the next milestone (◆ and the date) and how many of its initiatives are ready for that milestone. Inside it, the program's own tasks come first, then its initiatives under a small heading for each product. Each initiative shows once. Press the program's name to open the program in the Viewer. The chat then talks about the program. Press the chevron to close or open the group.
|
|
26
26
|
- The **product picker** is the chip on the top line. It shows the tiles of the ticked products, overlapped, with **+N** after 3, or **All** when every product is ticked. It shows even with one product. A git worktree of a repository is not a product: it does not appear in the list. Its repository stands for it. Hold the pointer on it to read the names. Press it to open the list: **All products**, then each product with its tile, its name and one line (for example "3 initiatives · 1 of 2 goals"), then **Add a product**. Press a product to tick or untick it; the list stays open, and the last ticked product stays ticked. The pick applies when the list closes (Escape, a press outside, or the chip again). On a phone the list is a sheet at the bottom. The pick is one saved setting (`ws.briefing.include`) that Home, the Board and Insights share, so a product that you untick on one page goes from all three. With **All** ticked, a product that you add later is ticked too. The **Product** row in Settings opens the same list.
|
|
27
27
|
- A program with no open initiative yet still shows, with "No initiatives yet" or "No open initiatives". A program shows only when it holds work of a ticked product. Home reads again when you come back to its tab, so a program made on the Board shows at once.
|
|
28
|
-
- Then the list is grouped by **product**. A product header shows a tile with the product's short name, the product name, one dot for each goal (green on track, amber off track) and a chevron. When the product has chats of its own (the product's chat and its new sessions), the header has the same pill as an initiative row: press it to see them, and **+** starts a new session in the product. These chats are not under **Not in an initiative**. You set the short name in Settings. Press the product's name to open the product in the Viewer, with its goals and this week's update and metrics review. The chat then talks about the product. This is the same for every product in the list: Home stays on the workspace you opened it on. For another product, the weekly update and the metrics review open that product's own Home in a new tab. An initiative of another product opens from that product's own board, and its chat works in that product's workspace. This is also true for a new initiative that an agent made with `pmos initiative new` and that is not on the board's Now list yet: it opens with its title, stage and tasks.
|
|
28
|
+
- Then the list is grouped by **product**. A product header shows a tile with the product's short name, the product name, one dot for each goal (green on track, amber off track) and a chevron. When the product has chats of its own (the product's chat and its new sessions), the header has the same pill as an initiative row: press it to see them, and **+** starts a new session in the product. These chats are not under **Not in an initiative**. A program header has the same pill for the program's own chats, and **+** starts a new session in the program. The chat then shows the program or the product as its scope, not **Loose**. You set the short name in Settings. Press the product's name to open the product in the Viewer, with its goals and this week's update and metrics review. The chat then talks about the product. This is the same for every product in the list: Home stays on the workspace you opened it on. For another product, the weekly update and the metrics review open that product's own Home in a new tab. An initiative of another product opens from that product's own board, and its chat works in that product's workspace. This is also true for a new initiative that an agent made with `pmos initiative new` and that is not on the board's Now list yet: it opens with its title, stage and tasks.
|
|
29
29
|
- Each row is one line. A dot is a session: blue when it waits on you, a ring while it runs. A check box is a task: amber when it is late. The stage track on the right shows where the initiative is. A session that runs under an initiative shows indented under it. An initiative shows its 3 most urgent tasks, and **N more** shows the rest.
|
|
30
30
|
- **Not in an initiative** is one line at the end, with a blue dot, an amber square and a count. Press it to open the items that have no initiative.
|
|
31
31
|
- **Kept** and **Done** are in the filter icon's menu, on a desktop only.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.484.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.484.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -51,6 +51,12 @@ const SHOTS = process.env.PMOS_SHOTS || '', TAG = process.env.PMOS_SHOTS_TAG ||
|
|
|
51
51
|
ok('H5 the frame is sandboxed to scripts alone', /sandbox="allow-scripts"/.test(src) && !/allow-same-origin/.test(src), src);
|
|
52
52
|
const pdf = M.fileHtml({ name: 'deck.pdf', kind: 'pdf', src: '/api/asset?ws=w&path=planning%2Fdeck.pdf', rel: 'planning/deck.pdf' });
|
|
53
53
|
ok('H5b batch 22 item 12: a PDF shows in the browser\'s PDF viewer, from /api/asset, never "could not be shown", and full width with no card (item 15)', /<iframe class="vwframe vwpdff"[^>]*src="\/api\/asset\?ws=w&path=planning%2Fdeck\.pdf#view=FitH"/.test(pdf) && !/could not be shown/.test(pdf) && !/class="cf /.test(pdf) && M.downloadsOf({ name: 'deck.pdf', kind: 'pdf', src: 'x' }).length === 0, pdf);
|
|
54
|
+
const rd = M.fileHtml({ name: 'deck.pdf', kind: 'pdf', reader: true, src: '/api/asset?ws=w&path=deck.pdf', rel: 'deck.pdf' });
|
|
55
|
+
const P = await import('./public/pm/premium-vw-pdf.js');
|
|
56
|
+
ok('H5c batch 22 item 18: on a phone the Viewer draws the PDF\'s pages itself (no frame); an iPhone, an iPad and a phone\'s Chrome need it, a desktop does not',
|
|
57
|
+
/class="vwpdfr" data-pdf-src="\/api\/asset\?ws=w&path=deck\.pdf"/.test(rd) && !/<iframe/.test(rd)
|
|
58
|
+
&& P.needsReader({ userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X)' }) && P.needsReader({ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)', maxTouchPoints: 5 })
|
|
59
|
+
&& P.needsReader({ userAgent: 'Mozilla/5.0 (Linux; Android 14)', pdfViewerEnabled: false }) && !P.needsReader({ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)', maxTouchPoints: 0, pdfViewerEnabled: true }), rd);
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
const exe = findBrowser();
|
|
@@ -836,7 +836,11 @@ function sessionTarget(s) {
|
|
|
836
836
|
const key = H.keyOfSession(s);
|
|
837
837
|
const ini = H.iniOfSession(s);
|
|
838
838
|
const role = H.roleOf(s, S.D.desk && S.D.desk.roles);
|
|
839
|
-
|
|
839
|
+
// a program's or a product's own chat says so in its scope, never "Loose" (batch 22 item 17)
|
|
840
|
+
const pm = /^chat:program:([^:]+)/.exec(key || ''), pr = pm ? (S.D.programs || []).find((p) => p && p.id === pm[1]) : null;
|
|
841
|
+
const prod = !ini && !pr && /^product(:|$)/.test(key || '') ? H.productName(S.D) : '';
|
|
842
|
+
const home = pr ? { text: pr.title, icon: TD.P.layers } : prod ? { text: prod, icon: I.home } : null;
|
|
843
|
+
const t = { title: H.nameOf(s), ses: s.id, sub: [role.name, ini ? iniTitle(ini) : home ? home.text : 'Loose'].join(' · '), ini, role, scope: ini ? scopeOf(ini) : home || { text: 'Loose', icon: I.chat, loose: true }, rich: rich(), to: rich() ? role : null, also: alsoOf(ini) };
|
|
840
844
|
if (key && /^(decision|blocked|waited|src|ev|work|board|init|doc|ins|chat|pop):/.test(key)) { t.key = key; t.sid = undefined; } else t.sid = s.id;
|
|
841
845
|
if (!t.key) t.sid = s.id;
|
|
842
846
|
if (/^schedule:/.test(s.origin || '')) t.routine = true; // a scheduled run: a stop reads "Run stopped at 3 of 5" with Run again (home-sweep.js)
|
|
@@ -1744,7 +1748,7 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
|
|
|
1744
1748
|
if (d.hmSes) { sesPill(d.hmSes === S.ses ? null : d.hmSes); return; } // an initiative's pill: what sits in it, under it (a sheet on a phone)
|
|
1745
1749
|
if ('hmSesx' in d) { sesPill(null); return; }
|
|
1746
1750
|
if (d.hmSesnew) { sesPill(null, false); newIn(d.hmSesnew); return; }
|
|
1747
|
-
if (d.hmProdnew) { sesPill(null, false); const g = ((S.M && S.M.groups) || []).find((x) => x.key === d.hmProdnew); if (g && !g.primary && g.product && g.product.ws) goOtherProduct(g); else goIni('product'); { const c = chat.current(); if (c && c.newChat) c.newChat(); } return; }
|
|
1751
|
+
if (d.hmProdnew) { sesPill(null, false); const g = ((S.M && S.M.groups) || []).find((x) => x.key === d.hmProdnew); if (g && g.kind === 'program') goProgram(g.program.id); else if (g && !g.primary && g.product && g.product.ws) goOtherProduct(g); else goIni('product'); { const c = chat.current(); if (c && c.newChat) c.newChat(); } return; }
|
|
1748
1752
|
if (d.hmCompact) { compact(d.hmCompact); return; } // ✓ on Claude's ✦ Compact (batch 13 item 8): the pill's list stays open
|
|
1749
1753
|
if (S.ses && !b.closest('.hv-spp, .hv-sps, .hv-rcs')) sesPill(null, false); // a press anywhere else in the list closes it
|
|
1750
1754
|
if (d.hmSel) { if (S.ses) sesPill(null, false); if (S.day) S.day = false; select(d.hmSel); return; }
|
|
@@ -150,6 +150,11 @@ function iniRowOf(D, r, needs, now) {
|
|
|
150
150
|
|
|
151
151
|
/** A product's own chat key: the board's product is `product` or `product:<n>`; another product is `product:<ws>` or `product:<ws>:<n>`
|
|
152
152
|
* (home-app.js productTarget, goOtherProduct, newProduct). */
|
|
153
|
+
/** A program's own chat key: `chat:program:<id>` (home-app.js programTarget), or a new session of it (`chat:program:<id>:<n>`). */
|
|
154
|
+
export function isProgramChat(key, id) {
|
|
155
|
+
const k = String(key || ''), b = 'chat:program:' + id;
|
|
156
|
+
return !!id && (k === b || k.startsWith(b + ':'));
|
|
157
|
+
}
|
|
153
158
|
export function isProductChat(key, p) {
|
|
154
159
|
const k = String(key || ''), ws = p && p.ws ? 'product:' + p.ws : null;
|
|
155
160
|
return !!((p && p.primary && (k === 'product' || /^product:\d+$/.test(k))) || (ws && (k === ws || /^:\d+$/.test(k.slice(ws.length)) && k.startsWith(ws + ':'))));
|
|
@@ -197,8 +202,10 @@ export function programGroups(D, groups, products, o, now) {
|
|
|
197
202
|
// Claude's milestone changes wait on the PM: one Your move line per program, never one per change (canvas XmsgB, Home frame)
|
|
198
203
|
const msSub = homeSub(pr);
|
|
199
204
|
const msRow = msSub ? { id: 'ms:' + pr.id, kind: 'msreview', program: pr.id, name: pr.title, hint: msSub, state: 'needs' } : null;
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
// the program's own chats sit in its header's pill, as a product's do, never under "Not in an initiative" (Wawan, 2026-11-02, batch 22 item 17)
|
|
206
|
+
const kids = (D.sessions || []).filter((s) => listed(s) && isProgramChat(keyOfSession(s), pr.id)).map((s) => sessionRow(s, D.desk && D.desk.roles)).sort((a, b) => (RANK[b.state] || 0) - (RANK[a.state] || 0));
|
|
207
|
+
out.push({ key: 'g:' + pr.id, kind: 'program', program: pr, st, name: pr.title, subs, inis, rest: [], tasks, count: inis.length, turnN, msRow, kids,
|
|
208
|
+
yours: inis.reduce((n, x) => n + x.yours, 0) + tasks.filter((t) => t.mine && t.late).length + (msRow ? 1 : 0) + kids.filter((k) => k.state === 'needs' || k.state === 'blocked').length, late: inis.some((x) => x.late) || tasks.some((t) => t.late),
|
|
202
209
|
products: st.products, closedLine: closedOf(inis.length, turnN) });
|
|
203
210
|
}
|
|
204
211
|
return out;
|
|
@@ -268,7 +275,7 @@ export function homeList(D, o = {}) {
|
|
|
268
275
|
// an item the PM linked to an initiative (the clean-up, batch 13 item 3) sits under that initiative, not here
|
|
269
276
|
for (const r of tabRows('today')) if (!r.ini || !groups.some((g) => g.inis.concat(g.rest).some((i) => i.ini === r.ini))) loose.push(itemRow(r));
|
|
270
277
|
for (const m of todayOf(D).filter((x) => !meetIni(x) && x.state !== 'past')) loose.push(meetRow(m, null));
|
|
271
|
-
const inProduct = (s) => products.some((p) => isProductChat(keyOfSession(s), p));
|
|
278
|
+
const inProduct = (s) => products.some((p) => isProductChat(keyOfSession(s), p)) || /^chat:program:/.test(keyOfSession(s) || '');
|
|
272
279
|
for (const s of (D.sessions || []).filter((s) => listed(s) && !iniOfSession(s) && !inProduct(s) && s.shown !== 'needs' && s.shown !== 'blocked')) loose.push({ ...sessionRow(s, D.desk && D.desk.roles), loose: true });
|
|
273
280
|
// the folded line's signals (HvAC .lh): a blue dot when a row waits on the PM, an amber square when one of the PM's own is late
|
|
274
281
|
const lsig = { needs: loose.filter((r) => r.state === 'needs' || r.state === 'blocked').length, sessions: loose.filter((r) => r.kind === 'session' || r.needSession).length, tasks: loose.filter((r) => r.check).length, late: loose.filter((r) => r.check && r.late).length };
|
|
@@ -205,8 +205,8 @@ function programHtml(g, o) {
|
|
|
205
205
|
const ms = msHtml(g);
|
|
206
206
|
const line = nx ? 'Next milestone ' + nx.name + (nx.day ? ', ' + nx.day : '') + (nx.late ? ', late' : '') + (nx.n ? ', ' + nx.ready + ' of ' + nx.n + (nx.n === 1 ? ' initiative' : ' initiatives') + ' ready' : '') : 'No open milestone';
|
|
207
207
|
const head = `<div class="hv-gh hv-prg${open ? '' : ' closed'}${o.selHead === g.key ? ' sel' : ''}"><button type="button" class="hv-pt" data-hm-prog="${esc(g.program.id)}" aria-label="Open ${esc(g.name)}, a program"${o.selHead === g.key ? ' aria-current="true"' : ''}>`
|
|
208
|
-
+ `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}"${o.here === g.key ? ' data-cz-rail-here' : ''}>${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${open && g.st ? sugHtml(g.program, g.st) : ''}`
|
|
209
|
-
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button
|
|
208
|
+
+ `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}"${o.here === g.key ? ' data-cz-rail-here' : ''}>${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${prodPillHtml(g, o)}${open && g.st ? sugHtml(g.program, g.st) : ''}`
|
|
209
|
+
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button>${prodPopHtml(g, o)}</div>`;
|
|
210
210
|
const sec = `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}" data-po-id="g:${esc(g.program.id)}">${SO.gripHtml(g.name)}`;
|
|
211
211
|
if (!open) return `${sec}${head}</section>`;
|
|
212
212
|
// the program's tasks are on its panel (On the program), not on Home: Home lists no tasks (Wawan, 2026-10-25)
|
|
@@ -257,4 +257,9 @@ iframe.vwprint{position:fixed;right:0;bottom:0;width:1px;height:1px;border:0;opa
|
|
|
257
257
|
.vwdoc.vwpdf{max-width:none;padding:0 0 8px}
|
|
258
258
|
.vwpdf .vwfile{display:flex;flex-direction:column;gap:6px}
|
|
259
259
|
.vwpdf .vwpdff{height:calc(100dvh - 150px);min-height:420px}
|
|
260
|
-
.vwpdf .cff{display:flex;gap:8px;font-size:var(--fs-1);color:var(--
|
|
260
|
+
.vwpdf .cff{display:flex;gap:8px;font-size:var(--fs-1);color:var(--ink-3);padding:0 2px}
|
|
261
|
+
.vwpdfr{display:flex;flex-direction:column;gap:8px}
|
|
262
|
+
.vwpdfp{display:flex;flex-direction:column;gap:8px}
|
|
263
|
+
.vwpdfp canvas{display:block;border-radius:4px;box-shadow:0 0 0 1px var(--hair)}
|
|
264
|
+
.vwpdfs{margin:0;font-size:var(--fs-1);color:var(--ink-3)}
|
|
265
|
+
.vwpdfs:empty{display:none}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* openChatFile(path, { session, ws }) -> the tab's pane */
|
|
10
10
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
11
11
|
import { bodyHtml, pageHead, splitDoc, readMinutes } from './premium-vw-doc-model.js';
|
|
12
|
+
import { needsReader, drawPdf } from './premium-vw-pdf.js';
|
|
12
13
|
|
|
13
14
|
const CHECK_MS = 2500;
|
|
14
15
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
@@ -100,7 +101,10 @@ export function fileHtml(f, view = 'page') {
|
|
|
100
101
|
return `<div class="vwdoc"><div class="vwfnone" role="status"><b>${esc(head)}</b><p class="vwmut">${esc(f.why || '')}</p><code>${esc(f.path)}</code></div></div>`;
|
|
101
102
|
}
|
|
102
103
|
if (f.err) return `<div class="vwdoc"><div class="vwfnone" role="status"><b>The file could not be shown</b><p class="vwmut">${esc(f.err)}</p><code>${esc(f.abs || f.path)}</code></div></div>`;
|
|
103
|
-
if (f.kind === 'pdf' && f.src) return `<div class="vwdoc vwpdf"><article class="vwfile">${''/* the Viewer's header names the file: the PDF takes the whole width (Wawan, 2026-11-02) */}
|
|
104
|
+
if (f.kind === 'pdf' && f.src) return `<div class="vwdoc vwpdf"><article class="vwfile">${''/* the Viewer's header names the file: the PDF takes the whole width (Wawan, 2026-11-02) */}`
|
|
105
|
+
// a phone cannot show a PDF in a frame: the Viewer draws every page itself (premium-vw-pdf.js, batch 22 item 18)
|
|
106
|
+
+ (f.reader ? `<div class="vwpdfr" data-pdf-src="${esc(f.src)}"><p class="vwpdfs" role="status">Drawing the pages.</p><div class="vwpdfp"></div></div>`
|
|
107
|
+
: `<iframe class="vwframe vwpdff" title="${esc(f.name)}" src="${esc(f.src)}#view=FitH"></iframe>`)
|
|
104
108
|
+ `<footer class="cff"><span>Read-only · PDF</span><span class="gap"></span><code>${esc(f.abs || f.rel)}</code></footer></article></div>`;
|
|
105
109
|
const foot = `<footer class="cff"><span>Read-only · ${readMinutes(f.text)} min read</span><span class="gap"></span><code>${esc(f.abs || f.rel)}</code></footer>`;
|
|
106
110
|
if (f.kind === 'markdown') {
|
|
@@ -137,6 +141,7 @@ export function openChatFile(p, ctx = {}) {
|
|
|
137
141
|
// Page and Source on an .html file: the press draws the other view; the choice stays while the tab is open
|
|
138
142
|
// the download icon: one format saves at once; more open a menu under the icon (Escape or a press elsewhere closes it)
|
|
139
143
|
const wire = (el) => {
|
|
144
|
+
const r = el.querySelector('.vwpdfr[data-pdf-src]'); if (r) drawPdf(r, r.dataset.pdfSrc);
|
|
140
145
|
el.onclick = (e) => {
|
|
141
146
|
const d = e.target.closest('[data-fdl]');
|
|
142
147
|
if (d) { const opts = downloadsOf(st.f); if (opts.length === 1) download(st.f, opts[0].fmt); else dlMenu(d, opts); return; }
|
|
@@ -174,7 +179,7 @@ export function openChatFile(p, ctx = {}) {
|
|
|
174
179
|
const sig = loc.ws + '/' + loc.rel + '@' + loc.mtime + ':' + loc.size;
|
|
175
180
|
if (sig === st.sig) return false;
|
|
176
181
|
// a PDF is not text: the browser's own PDF viewer shows it, streamed by /api/asset (batch 22 item 12: "The file could not be shown")
|
|
177
|
-
if (/\.pdf$/i.test(loc.name || loc.rel || '')) { st.sig = sig; st.f = { path: p, name: loc.name, ws: loc.ws, rel: loc.rel, abs: loc.abs, kind: 'pdf', src: '/api/asset?' + q({ ws: loc.ws, path: loc.rel }) + '&v=' + encodeURIComponent(String(loc.mtime || '')) }; return true; }
|
|
182
|
+
if (/\.pdf$/i.test(loc.name || loc.rel || '')) { st.sig = sig; st.f = { path: p, name: loc.name, ws: loc.ws, rel: loc.rel, abs: loc.abs, kind: 'pdf', reader: needsReader(typeof navigator === 'undefined' ? null : navigator), src: '/api/asset?' + q({ ws: loc.ws, path: loc.rel }) + '&v=' + encodeURIComponent(String(loc.mtime || '')) }; return true; }
|
|
178
183
|
const got = await getText('/api/doc?' + q({ ws: loc.ws, path: loc.rel }));
|
|
179
184
|
st.sig = sig;
|
|
180
185
|
st.f = got.ok ? { path: p, name: loc.name, ws: loc.ws, rel: loc.rel, abs: loc.abs, kind: got.kind, text: got.text } : { path: p, abs: loc.abs, err: got.text };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* pm/premium-vw-pdf.js — every page of a PDF, drawn in the Viewer where the browser's own PDF viewer cannot (batch 22 item 18,
|
|
2
|
+
* Wawan 2026-11-02: "PDF viewer didn't work on mobile"). iPhone and iPad Safari draw only the first page of a PDF inside a frame,
|
|
3
|
+
* and a phone's Chrome draws none. There the Viewer draws each page itself with pdf.js 5.4.296, vendored offline under D86 as
|
|
4
|
+
* amended 2026-11-02 (public/vendor/pdf.min.js and pdf.worker.min.js). A desktop keeps the browser's own viewer.
|
|
5
|
+
* needsReader(nav) -> true when the browser cannot show a PDF in a frame. Pure, for Node.
|
|
6
|
+
* drawPdf(box, src) -> draws the pages into box (a .vwpdfr); a later call on the same box replaces them. */
|
|
7
|
+
export function needsReader(nav) {
|
|
8
|
+
if (!nav) return false;
|
|
9
|
+
const ua = String(nav.userAgent || '');
|
|
10
|
+
if (/iPad|iPhone|iPod/.test(ua)) return true;
|
|
11
|
+
if (/Macintosh/.test(ua) && (nav.maxTouchPoints || 0) > 1) return true; // an iPad that asks for the desktop site
|
|
12
|
+
return nav.pdfViewerEnabled === false; // a phone's Chrome, Firefox on Android
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let lib = null;
|
|
16
|
+
const load = () => (lib = lib || import('/vendor/pdf.min.js').then((m) => { m.GlobalWorkerOptions.workerSrc = '/vendor/pdf.worker.min.js'; return m; }));
|
|
17
|
+
|
|
18
|
+
export async function drawPdf(box, src) {
|
|
19
|
+
if (!box) return;
|
|
20
|
+
const run = (box._pdfRun = (box._pdfRun || 0) + 1);
|
|
21
|
+
const say = (t) => { const s = box.querySelector('.vwpdfs'); if (s) s.textContent = t; };
|
|
22
|
+
try {
|
|
23
|
+
const pdf = await (await load()).getDocument({ url: src, isEvalSupported: false }).promise;
|
|
24
|
+
if (run !== box._pdfRun) return;
|
|
25
|
+
const width = Math.max(240, box.clientWidth || 360), dpr = Math.min(2, (typeof devicePixelRatio === 'number' && devicePixelRatio) || 1);
|
|
26
|
+
const pages = box.querySelector('.vwpdfp');
|
|
27
|
+
for (let n = 1; n <= pdf.numPages; n++) {
|
|
28
|
+
const page = await pdf.getPage(n);
|
|
29
|
+
if (run !== box._pdfRun || !box.isConnected) return;
|
|
30
|
+
const vp = page.getViewport({ scale: width / page.getViewport({ scale: 1 }).width });
|
|
31
|
+
const c = document.createElement('canvas');
|
|
32
|
+
c.width = Math.floor(vp.width * dpr); c.height = Math.floor(vp.height * dpr);
|
|
33
|
+
c.style.width = '100%'; c.setAttribute('role', 'img'); c.setAttribute('aria-label', `Page ${n} of ${pdf.numPages}`);
|
|
34
|
+
pages.append(c);
|
|
35
|
+
await page.render({ canvasContext: c.getContext('2d'), viewport: vp, transform: dpr === 1 ? null : [dpr, 0, 0, dpr, 0, 0] }).promise;
|
|
36
|
+
say(n < pdf.numPages ? `Page ${n} of ${pdf.numPages}` : '');
|
|
37
|
+
}
|
|
38
|
+
box.dataset.pages = String(pdf.numPages);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
if (run === box._pdfRun) say('The PDF could not be drawn here.');
|
|
41
|
+
}
|
|
42
|
+
}
|