create-pmos 0.428.0 → 0.430.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 +25 -25
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/briefing-premium-board-test.js +4 -4
- package/workspace/briefing-premium-insights-test.js +82 -61
- package/workspace/briefing-premium-metrics-test.js +5 -3
- package/workspace/briefing-premium-sources-test.js +5 -5
- package/workspace/briefing-premium-test.js +5 -4
- package/workspace/changelog.json +24 -0
- package/workspace/ev-everywhere-test.js +2 -2
- package/workspace/guide/adler.md +45 -0
- package/workspace/guide/briefing-premium.md +2 -0
- package/workspace/guide/home.md +4 -2
- package/workspace/guide/index.md +2 -0
- package/workspace/guide/metric-drafts.md +49 -0
- package/workspace/guide/programs.md +2 -0
- package/workspace/intel-report-ui-test.js +189 -0
- package/workspace/intelligence-gaps-ui-test.js +168 -0
- package/workspace/lib/board-metrics-premium.js +1 -1
- package/workspace/lib/headless.js +15 -2
- package/workspace/lib/initiative-writer.js +16 -2
- package/workspace/lib/insight-moves.js +135 -0
- package/workspace/lib/insights-premium.js +9 -4
- package/workspace/lib/insights-records.js +14 -5
- package/workspace/lib/intel-report.js +432 -0
- package/workspace/lib/metric-draft-runs.js +193 -0
- package/workspace/lib/metric-drafts.js +261 -0
- package/workspace/lib/metrics-cli.js +104 -0
- package/workspace/lib/page-opens.js +74 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/report-setups.js +29 -13
- package/workspace/lib/route-modules.js +3 -0
- package/workspace/lib/routes-insight-moves.js +119 -0
- package/workspace/lib/routes-insights-premium.js +12 -3
- package/workspace/lib/routes-insights-records.js +13 -5
- package/workspace/lib/routes-metric-drafts.js +150 -0
- package/workspace/lib/routes-page-opens.js +26 -0
- package/workspace/lib/routes-phone-day.js +13 -2
- package/workspace/lib/routes-report-setups.js +97 -3
- package/workspace/lib/routes-viewer.js +5 -2
- package/workspace/lib/settings-store.js +6 -0
- package/workspace/metric-drafts-ui-test.js +209 -0
- package/workspace/milestone-suggest-test.js +4 -4
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-phone-card-test.js +8 -5
- package/workspace/premium-viewer-flicker-test.js +1 -1
- package/workspace/public/pm/bd-acts.js +3 -3
- package/workspace/public/pm/bd-pin-card.css +4 -4
- package/workspace/public/pm/bd-prog-panel.js +12 -7
- package/workspace/public/pm/bd-prog.js +2 -2
- package/workspace/public/pm/cozy-adler.css +82 -0
- package/workspace/public/pm/cozy-adler.js +270 -0
- package/workspace/public/pm/cozy-aud.css +1 -1
- package/workspace/public/pm/cozy-board.css +256 -256
- package/workspace/public/pm/cozy-ev.css +48 -45
- package/workspace/public/pm/cozy-evmodel.js +1 -1
- package/workspace/public/pm/cozy-home-rows.css +23 -23
- package/workspace/public/pm/cozy-home.css +211 -207
- package/workspace/public/pm/cozy-insights.css +221 -108
- package/workspace/public/pm/cozy-live-pill.css +5 -5
- package/workspace/public/pm/cozy-mtg-present.css +23 -23
- package/workspace/public/pm/cozy-nav.js +3 -1
- package/workspace/public/pm/cozy-news.js +2 -2
- package/workspace/public/pm/cozy-panel.css +29 -29
- package/workspace/public/pm/cozy-pick.css +5 -5
- package/workspace/public/pm/cozy-rec-now.css +20 -20
- package/workspace/public/pm/cozy-rec-present.css +11 -11
- package/workspace/public/pm/cozy-rec-tab.css +13 -13
- package/workspace/public/pm/cozy-search.js +4 -2
- package/workspace/public/pm/cozy-settings.js +16 -3
- package/workspace/public/pm/cozy-steps.css +9 -9
- package/workspace/public/pm/cozy-today.css +122 -71
- package/workspace/public/pm/cozy-viewer.css +7 -7
- package/workspace/public/pm/cozy-viewer.js +1 -1
- package/workspace/public/pm/cozy-vw-mtg.css +81 -81
- package/workspace/public/pm/cozy-vw-rp.css +53 -53
- package/workspace/public/pm/cozy-vw-shell.css +23 -23
- package/workspace/public/pm/cozy-vw.css +117 -117
- package/workspace/public/pm/cozy-xv.css +11 -11
- package/workspace/public/pm/cozy.css +34 -15
- package/workspace/public/pm/hi-pop.css +19 -19
- package/workspace/public/pm/home-app.js +33 -9
- package/workspace/public/pm/home-chat.js +10 -2
- package/workspace/public/pm/home-day.js +155 -27
- package/workspace/public/pm/home-ini.css +32 -32
- package/workspace/public/pm/home-line.css +7 -7
- package/workspace/public/pm/home-list.js +12 -1
- package/workspace/public/pm/home-phone-card.js +18 -15
- package/workspace/public/pm/home-today.js +5 -3
- package/workspace/public/pm/ini-view-model.js +1 -1
- package/workspace/public/pm/ini-view.css +108 -102
- package/workspace/public/pm/ini-view.js +22 -3
- package/workspace/public/pm/loose-props.css +13 -13
- package/workspace/public/pm/metric-drafts.css +89 -0
- package/workspace/public/pm/metric-drafts.js +204 -0
- package/workspace/public/pm/ms-suggest.css +8 -8
- package/workspace/public/pm/ms-suggest.js +2 -1
- package/workspace/public/pm/ov-view.css +12 -12
- package/workspace/public/pm/premium-board.js +2 -2
- package/workspace/public/pm/premium-chart-tab.js +6 -6
- package/workspace/public/pm/premium-insights.js +364 -107
- package/workspace/public/pm/premium-report-intel.css +56 -0
- package/workspace/public/pm/premium-report-intel.js +232 -0
- package/workspace/public/pm/premium-shell.js +2 -2
- package/workspace/public/pm/premium-vw-cal.js +1 -1
- package/workspace/public/pm/premium-vw-file.js +2 -2
- package/workspace/public/pm/premium-welcome.js +3 -2
- package/workspace/public/pm/premium.css +130 -128
- package/workspace/public/pm/prog-order.css +6 -6
- package/workspace/public/pm/program-charter.css +23 -23
- package/workspace/public/pm/program-model.js +7 -0
- package/workspace/public/pm/rp-parts.js +2 -2
- package/workspace/public/pm/sort-order.css +1 -1
- package/workspace/public/pm/split-merge.css +15 -15
- package/workspace/public/pm/split-merge.js +2 -1
- package/workspace/public/pm/task-card.css +21 -21
- package/workspace/public/pm/tk-tasks.css +37 -37
- package/workspace/public/pm/tk-view.css +6 -6
- package/workspace/public/pm/wf-page.css +28 -28
- package/workspace/public/premium-intelligence.html +82 -0
- package/workspace/server.js +38 -3
- package/workspace/skills/metric-draft.skill +47 -0
- package/workspace/test-lists/intel-report-ui.json +5 -0
- package/workspace/test-lists/intel-report.json +9 -0
- package/workspace/test-lists/intelligence-gaps-ui.json +5 -0
- package/workspace/test-lists/intelligence-gaps.json +5 -0
- package/workspace/test-lists/metric-drafts-ui.json +5 -0
- package/workspace/test-lists/metric-drafts.json +9 -0
- package/workspace/test-run.js +3 -0
- package/workspace/public/premium-insights.html +0 -81
|
@@ -257,14 +257,14 @@ function lateSeries() {
|
|
|
257
257
|
}
|
|
258
258
|
function trendHtml(k) {
|
|
259
259
|
const [tone, name, word] = TREND[k], n = (M().chips || {})[k] || 0, on = A.F.chips.has(k);
|
|
260
|
-
let chart = `<p class="bd-amut">No weekly count of ${esc(word)} initiatives is kept yet, so no line is drawn.
|
|
260
|
+
let chart = `<p class="bd-amut">No weekly count of ${esc(word)} initiatives is kept yet, so no line is drawn. Intelligence draws it once the records hold it.</p>`;
|
|
261
261
|
if (k === 'late') {
|
|
262
262
|
const s = lateSeries(), mx = Math.max(1, ...s), X = (i) => 10 + i * 40, Y = (v) => 62 - (v / mx) * 50;
|
|
263
263
|
const d = s.map((v, i) => (i ? 'L' : 'M') + X(i) + ' ' + Y(v).toFixed(1)).join('');
|
|
264
264
|
chart = `<svg class="bd-spark" viewBox="0 0 300 70" role="img" aria-label="Late initiatives per week: ${s.join(', ')}"><path class="ax" d="M0 64H300"/><path class="ln" d="${d}"/><circle cx="${X(7)}" cy="${Y(s[7]).toFixed(1)}" r="3.5"/></svg>`
|
|
265
265
|
+ `<p class="sm">${s[0] === s[7] ? 'The same as eight weeks ago' : (s[7] < s[0] ? 'Down from ' : 'Up from ') + s[0] + ' eight weeks ago'}. ${esc(M().initiatives.list.rows.filter((r) => r.late).map((r) => r.title).slice(0, 2).join(' and ') || 'None')} ${n === 1 ? 'is' : 'are'} late now. Counted from the end dates on record.</p>`;
|
|
266
266
|
}
|
|
267
|
-
return `<div class="bd-trh"><i class="cz-dot ${tone}"></i><b>${esc(name)} · ${n} now</b><span class="bd-amut">${k === 'late' ? '8 weeks' : ''}</span></div>${chart}<div class="bd-arow"><button type="button" class="bd-btn sm${on ? ' on' : ''}" data-trshow="${k}" aria-pressed="${on}">${on ? 'Show all' : 'Show only ' + esc(word)}</button><a class="bd-btn sm ghost" href="/premium-
|
|
267
|
+
return `<div class="bd-trh"><i class="cz-dot ${tone}"></i><b>${esc(name)} · ${n} now</b><span class="bd-amut">${k === 'late' ? '8 weeks' : ''}</span></div>${chart}<div class="bd-arow"><button type="button" class="bd-btn sm${on ? ' on' : ''}" data-trshow="${k}" aria-pressed="${on}">${on ? 'Show all' : 'Show only ' + esc(word)}</button><a class="bd-btn sm ghost" href="/premium-intelligence.html?ws=${encodeURIComponent(M().board.ws || '')}">See in Intelligence${SV(I.go)}</a></div>`;
|
|
268
268
|
}
|
|
269
269
|
function openTrend(k, from) { if (TREND[k]) Pop.open(trendHtml(k), from, { label: TREND[k][1] + ' trend', width: 330, cls: 'bd-trend' }); }
|
|
270
270
|
|
|
@@ -333,7 +333,7 @@ async function openMetrics(from, again) {
|
|
|
333
333
|
+ `${t.change && !t.absent ? `<small>${esc(t.change.txt)}</small>` : ''}${t.chip ? `<em class="bd-mchip${t.ok ? ' ok' : ''}">${esc(t.chip)}${t.targetTxt ? ' · ' + esc(t.targetTxt) : ''}</em>` : t.look ? '<em class="bd-mchip">Needs a look</em>' : ''}</summary>`
|
|
334
334
|
+ `<p class="bd-amut">${esc(t.def || '')}</p>${weeks ? `<div class="bd-kv">${weeks}</div>` : ''}</details>`;
|
|
335
335
|
};
|
|
336
|
-
w.outerHTML = `<div id="metW"><p class="bd-amut">${esc(m.header || '')}${m.lead ? ' · ' + esc(m.lead) : ''}</p><div class="bd-mets">${(m.tiles || []).map(tile).join('')}</div><p class="bd-amut">${esc(m.note || '')} <a class="bd-alink" href="/premium-
|
|
336
|
+
w.outerHTML = `<div id="metW"><p class="bd-amut">${esc(m.header || '')}${m.lead ? ' · ' + esc(m.lead) : ''}</p><div class="bd-mets">${(m.tiles || []).map(tile).join('')}</div><p class="bd-amut">${esc(m.note || '')} <a class="bd-alink" href="/premium-intelligence.html?ws=${ws}">Targets and longer ranges are on Intelligence</a>.</p></div>`;
|
|
337
337
|
if (m.pending) setTimeout(() => { if ($('#metW')) openMetrics(null, true); }, 3000);
|
|
338
338
|
}
|
|
339
339
|
function openBell(from) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* pm/bd-pin-card.css — the ◇ card on the Board timeline (feedback batch 13 item 4, XcalmA5Milestones): the initiative's milestones with a pin each.
|
|
2
2
|
* The card is a pm/bd-pop.js popover; the Filter's "Milestones on the timeline" group uses the Filter's own chips. */
|
|
3
3
|
.bd-pp.bd-pc { padding: 12px 12px 6px; }
|
|
4
|
-
.bd-pc-h { margin: 0; font: 800
|
|
5
|
-
.bd-pc-sub { margin: 2px 0 6px; font-size:
|
|
4
|
+
.bd-pc-h { margin: 0; font: 800 var(--fs-3)/1.3 var(--cz-sans); color: var(--cz-ink); }
|
|
5
|
+
.bd-pc-sub { margin: 2px 0 6px; font-size: var(--fs-2); font-weight: 600; }
|
|
6
6
|
.bd-pc-r { display: flex; align-items: center; gap: 10px; min-height: 44px; border-top: 1px solid var(--cz-hair); }
|
|
7
7
|
.bd-pc-r .tg-tm-i { margin-left: 4px; }
|
|
8
|
-
.bd-pc-n { flex: 1; min-width: 0; font: 700
|
|
8
|
+
.bd-pc-n { flex: 1; min-width: 0; font: 700 var(--fs-2)/1.25 var(--cz-sans); color: var(--cz-ink2); overflow-wrap: anywhere; }
|
|
9
9
|
.bd-pc-r.on .bd-pc-n { color: var(--cz-ink); }
|
|
10
|
-
.bd-pc-n small { display: block; font-size:
|
|
10
|
+
.bd-pc-n small { display: block; font-size: var(--fs-1); font-weight: 600; color: var(--cz-ink3); }
|
|
11
11
|
.bd-pc-n small.late { color: var(--cz-late); }
|
|
12
12
|
.bd-pc-pin { all: unset; flex: none; width: 32px; height: 32px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink3); cursor: pointer; }
|
|
13
13
|
.bd-pc-pin svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
@@ -22,12 +22,14 @@
|
|
|
22
22
|
* · the milestone track: 3 milestones, the earlier done ones in a done cluster and the later ones in "N more"; both open Milestones
|
|
23
23
|
* · the folding rows (were tabs): Waits on you · On the program (its tasks, Done folded) · On its initiatives and On their epics (every
|
|
24
24
|
* open task, by level; each opens in Home) · Initiatives (per product, with their first tasks, what waits on you and their epics) · Milestones (Done, Next, Later; a program check's diamond marks it) · Documents (the charter, the PRDs, …)
|
|
25
|
+
* · first, the goal Claude drafted (pm/metric-drafts.js, canvas Iq9Program): the dashed "✦ Proposed goal" card, and once kept its Goal
|
|
26
|
+
* row with Undo; nothing when nothing is drafted (GET /api/metric-drafts, scope program)
|
|
25
27
|
* An initiative in another product is read from that product's board (GET /api/board-premium?ws=). Per product the panel also reads, once per
|
|
26
28
|
* page load: its KRs' names (GET /api/boards/anchors, the OKR files), whether each KR is met (GET /api/insights-premium, the goals Insights
|
|
27
29
|
* shows) and its PMOS tasks (GET /api/boards/items). A part whose read failed is left out, never guessed. Every fold is kept in this browser. */
|
|
28
30
|
import { pmPost } from './http.js';
|
|
29
31
|
import { esc, store } from './premium-shell.js';
|
|
30
|
-
import { programState, milestoneTrack, milestoneGroups, goalsByPeriod, shortDay, toJira, milestoneStep } from './program-model.js';
|
|
32
|
+
import { programState, liveRows, milestoneTrack, milestoneGroups, goalsByPeriod, shortDay, toJira, milestoneStep } from './program-model.js';
|
|
31
33
|
import { STEPS } from './premium-initiative-head.js';
|
|
32
34
|
import * as VW from './cozy-viewer.js';
|
|
33
35
|
import * as Pop from './bd-pop.js';
|
|
@@ -35,6 +37,7 @@ import { copyText } from './cozy-xv.js';
|
|
|
35
37
|
import { programRename } from './rename-press.js';
|
|
36
38
|
import { openCharter as charterForm, renamed as charterRenamed } from './program-charter.js';
|
|
37
39
|
import * as MSG from './ms-suggest.js';
|
|
40
|
+
import * as MD from './metric-drafts.js'; // the goal Claude drafts when the charter has none (batch 15 item 1, canvas Iq9Program)
|
|
38
41
|
|
|
39
42
|
const SV = (d, w) => `<svg viewBox="0 0 24 24" width="${w || 18}" height="${w || 18}" aria-hidden="true"><path d="${d}"/></svg>`;
|
|
40
43
|
const I = {
|
|
@@ -66,7 +69,7 @@ function rowsOf(ws) {
|
|
|
66
69
|
const M = O.M(); if (!M) return null;
|
|
67
70
|
const steps = M.steps || [];
|
|
68
71
|
const shape = (rows) => (rows || []).filter((r) => r.id).map((r) => ({ ...r, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage }));
|
|
69
|
-
if (!ws || !board().ws || ws === board().ws) return { name: board().product || board().name || '', rows: shape(M
|
|
72
|
+
if (!ws || !board().ws || ws === board().ws) return { name: board().product || board().name || '', rows: shape(liveRows(M)), here: true };
|
|
70
73
|
const a = AWAY.get(ws);
|
|
71
74
|
return a && a !== 'reading' ? { name: a.name, rows: shape(a.rows) } : null;
|
|
72
75
|
}
|
|
@@ -82,7 +85,7 @@ function readAway(p) {
|
|
|
82
85
|
// still reading (a cold board answers before its model is ready), or refused: ask again a few times, then the next open asks again,
|
|
83
86
|
// so a member does not stay "not read" until the panel is opened again
|
|
84
87
|
if (!r || !r.ok || !r.model) { AWAY.delete(ws); const n = (TRIES.get(ws) || 0) + 1; TRIES.set(ws, n); if (n < 4 && cur && cur.id === p.id) setTimeout(() => { if (cur && cur.id === p.id) { readAway(p); draw(); } }, 1500 * n); return; }
|
|
85
|
-
AWAY.set(ws, { name: (r.model.board && (r.model.board.product || r.model.board.name)) || ws, board: (r.model.board && r.model.board.id) || ws, rows: r.model
|
|
88
|
+
AWAY.set(ws, { name: (r.model.board && (r.model.board.product || r.model.board.name)) || ws, board: (r.model.board && r.model.board.id) || ws, rows: liveRows(r.model) });
|
|
86
89
|
if (cur && cur.id === p.id) draw();
|
|
87
90
|
});
|
|
88
91
|
}
|
|
@@ -110,6 +113,8 @@ function readMore(p) {
|
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
}
|
|
116
|
+
/** The goal Claude drafted for the program (GET /api/metric-drafts, scope program), once per page load; the panel draws again when it arrives. */
|
|
117
|
+
const readDrafts = (p) => MD.want(p.home || board().ws || '', 'program', p.id, () => { if (cur && cur.id === p.id) draw(true); });
|
|
113
118
|
const moreAt = (ws) => MORE.get(ws || board().ws || '') || {};
|
|
114
119
|
/** What waits on you in an initiative: its track's next action that is yours (the Board's trail), or the one its own board's trail says. */
|
|
115
120
|
const youOf = (i) => (i.row.track && i.row.track.you) || (moreAt(i.ws).you || {})[i.id] || '';
|
|
@@ -343,7 +348,7 @@ function bodyHtml(p) {
|
|
|
343
348
|
];
|
|
344
349
|
// Home on a phone (O.talk gives a function): the program's own chat is not beside the panel, so the panel ends with the way to it
|
|
345
350
|
const talk = O && O.talk && O.talk() ? `<button type="button" class="hi-talk" data-pp="talk">Message Claude about ${esc(p.title)}</button>` : '';
|
|
346
|
-
return VW.czSummary(summaryOf(p, st)) + goalsHtml(st) + trackHtml(st, p) + VW.czSections(rows, { key: 'program' }) + talk;
|
|
351
|
+
return MD.progHtml(p, p.home || board().ws || '') + VW.czSummary(summaryOf(p, st)) + goalsHtml(st) + trackHtml(st, p) + VW.czSections(rows, { key: 'program' }) + talk;
|
|
347
352
|
}
|
|
348
353
|
/** The ◆ dates this page reads for the program's initiatives (a Jira slip moves one too). A change from what the server last heard asks Claude
|
|
349
354
|
* to review once (POST /api/programs/facts); each reading is sent once per page load. */
|
|
@@ -360,7 +365,7 @@ const shownHere = () => { const c = VW.current && VW.current(); return !!(cur &&
|
|
|
360
365
|
function draw(keepFocus) {
|
|
361
366
|
if (!cur || !shownHere()) return;
|
|
362
367
|
const p = progOf(cur.id); if (!p) { VW.close(); return; }
|
|
363
|
-
readAway(p); readMore(p);
|
|
368
|
+
readAway(p); readMore(p); readDrafts(p);
|
|
364
369
|
const b = VW.body(); if (!b) return;
|
|
365
370
|
const f = keepFocus && document.activeElement && b.contains(document.activeElement) ? document.activeElement : null;
|
|
366
371
|
const sel = f ? (f.dataset.pp ? `[data-pp="${f.dataset.pp}"]` + (f.dataset.fold ? `[data-fold="${CSS.escape(f.dataset.fold)}"]` : '') + (f.dataset.key ? `[data-key="${CSS.escape(f.dataset.key)}"]` : '') + (f.dataset.ms ? `[data-ms="${CSS.escape(f.dataset.ms)}"]` : '') : f.dataset.czsFold ? `[data-czs-fold="${CSS.escape(f.dataset.czsFold)}"]` : null) : null;
|
|
@@ -421,8 +426,8 @@ function openPanel(id, from) {
|
|
|
421
426
|
{ const q = progOf(id); if (q && VW.current() && VW.current().title !== titleOf(q)) VW.retitle('program:' + id, titleOf(q)); } // a rename in the charter, on ←
|
|
422
427
|
cur = { id, from: from && !(VW.body() && VW.body().contains(from)) ? from : (cur && cur.id === id && cur.from) || null };
|
|
423
428
|
body.classList.add('pp-vw');
|
|
424
|
-
const q = progOf(id); if (q) { readAway(q); readMore(q); body.innerHTML = bodyHtml(q); }
|
|
425
|
-
body.onclick = (e) => { const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
|
|
429
|
+
const q = progOf(id); if (q) { readAway(q); readMore(q); readDrafts(q); body.innerHTML = bodyHtml(q); }
|
|
430
|
+
body.onclick = (e) => { const d = e.target.closest('[data-md]'); if (d && body.contains(d) && !d.disabled) { MD.press(d, { redraw: () => draw(), toast: (t) => O.say(t) }); return; } const m = e.target.closest('[data-ms-act]'); if (m && body.contains(m) && !m.disabled) { suggestPress(m); return; } const b = e.target.closest('[data-pp]'); if (b && body.contains(b)) press(b); };
|
|
426
431
|
body.onsubmit = submit;
|
|
427
432
|
document.querySelectorAll('#ibBody [data-prow]').forEach((x) => x.classList.toggle('sel', x.dataset.prow === id));
|
|
428
433
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* A program has no stage of its own (PM, 2026-10-23): the band shows only what its initiatives say. With one product picked, the program shows
|
|
18
18
|
* that product's initiatives (PRD decision 5); its other products count in its line and its readiness, and their initiatives are not drawn here.
|
|
19
19
|
* With All products picked, the program holds a sub-row per product with that product's initiatives, then one group per product follows. */
|
|
20
|
-
import { programState, groupRows, mergeClose } from './program-model.js';
|
|
20
|
+
import { programState, groupRows, mergeClose, liveRows } from './program-model.js';
|
|
21
21
|
import { goalsOf } from './home-list.js';
|
|
22
22
|
|
|
23
23
|
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
@@ -55,7 +55,7 @@ export function groupsOf(programs, rows, M, byProduct) {
|
|
|
55
55
|
export function stateOf(p, M, XR, now = Date.now()) {
|
|
56
56
|
const ws = (M && M.board && M.board.ws) || '';
|
|
57
57
|
const steps = (M && M.steps) || [];
|
|
58
|
-
const rows = (
|
|
58
|
+
const rows = liveRows(M).filter((r) => r.id).map((r) => ({ id: r.id, title: r.title, stage: r.track && r.track.k >= 0 && steps[r.track.k] ? steps[r.track.k].key : r.stage, anchor: r.anchor, ws: r.ws, product: r.product, start: r.start || null, end: r.end || null })); // the dates: Claude's order (prog-order.js)
|
|
59
59
|
// All products: every product's rows are on this board, each with its own workspace
|
|
60
60
|
if (M && M.board && M.board.all) return programState(p, (w) => { const R = rows.filter((r) => r.ws === w); return R.length ? { name: R[0].product, rows: R } : null; }, now);
|
|
61
61
|
return programState(p, (w) => (!w || !ws || w === ws ? { name: prodName(M), rows } : (XR && XR[w]) || null), now);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* cozy-adler.css — Adler, Claude's face in PMOS (feedback batch 16 item 2; pm/cozy-adler.js adds this sheet). The art's colours are the --ad-*
|
|
2
|
+
* tokens in cozy.css; the classes below give them to the SVG (adf- a fill, ads- a stroke, adg- a gradient stop). Then the sizes' boxes, the
|
|
3
|
+
* toast face, the scenes, dark mode (the scene dims, Adler stays warm) and the slow motion of AdMotion. All motion stops under
|
|
4
|
+
* prefers-reduced-motion and under Settings > Adler > Motion: Still (html.ad-still). Motion is on Adler and his scene only, never on data
|
|
5
|
+
* (design principle 12, the Adler exception). */
|
|
6
|
+
|
|
7
|
+
.ad-svg .adf-pink,.ad-scene .adf-pink{fill:var(--ad-pink)} .ad-svg .adf-blush,.ad-scene .adf-blush{fill:var(--ad-blush)} .ad-svg .adf-ink,.ad-scene .adf-ink{fill:var(--ad-ink)} .ad-svg .adf-mouth,.ad-scene .adf-mouth{fill:var(--ad-mouth)} .ad-svg .adf-tongue,.ad-scene .adf-tongue{fill:var(--ad-tongue)} .ad-svg .adf-white,.ad-scene .adf-white{fill:var(--ad-white)} .ad-svg .adf-shade,.ad-scene .adf-shade{fill:var(--ad-shade)} .ad-svg .adf-shadow,.ad-scene .adf-shadow{fill:var(--ad-shadow)} .ad-svg .adf-hoodd,.ad-scene .adf-hoodd{fill:var(--ad-hoodd)} .ad-svg .adf-hoodl,.ad-scene .adf-hoodl{fill:var(--ad-hoodl)} .ad-svg .adf-mug,.ad-scene .adf-mug{fill:var(--ad-mug)} .ad-svg .adf-mugleaf,.ad-scene .adf-mugleaf{fill:var(--ad-mugleaf)} .ad-svg .adf-gold,.ad-scene .adf-gold{fill:var(--ad-gold)} .ad-svg .adf-hp,.ad-scene .adf-hp{fill:var(--ad-hp)} .ad-svg .adf-lens,.ad-scene .adf-lens{fill:var(--ad-lens)} .ad-svg .adf-sun,.ad-scene .adf-sun{fill:var(--ad-sun)} .ad-svg .adf-sunglow,.ad-scene .adf-sunglow{fill:var(--ad-sunglow)} .ad-svg .adf-moon,.ad-scene .adf-moon{fill:var(--ad-moon)} .ad-svg .adf-firefly,.ad-scene .adf-firefly{fill:var(--ad-firefly)} .ad-svg .adf-raincloud,.ad-scene .adf-raincloud{fill:var(--ad-raincloud)} .ad-svg .adf-ground,.ad-scene .adf-ground{fill:var(--ad-ground)} .ad-svg .adf-groundn,.ad-scene .adf-groundn{fill:var(--ad-groundn)} .ad-svg .adf-leaf2,.ad-scene .adf-leaf2{fill:var(--ad-leaf2)} .ad-svg .adf-thinkdot,.ad-scene .adf-thinkdot{fill:var(--ad-thinkdot)} .ad-svg .adf-night0,.ad-scene .adf-night0{fill:var(--ad-night0)}
|
|
8
|
+
.ad-svg .ads-cream,.ad-scene .ads-cream{stroke:var(--ad-c1)} .ad-svg .ads-ink,.ad-scene .ads-ink{stroke:var(--ad-ink)} .ad-svg .ads-glass,.ad-scene .ads-glass{stroke:var(--ad-glass)} .ad-svg .ads-creamhi,.ad-scene .ads-creamhi{stroke:var(--ad-creamhi)} .ad-svg .ads-hp,.ad-scene .ads-hp{stroke:var(--ad-hp)} .ad-svg .ads-grass,.ad-scene .ads-grass{stroke:var(--ad-grass)} .ad-svg .ads-drop,.ad-scene .ads-drop{stroke:var(--ad-drop)} .ad-svg .ads-white,.ad-scene .ads-white{stroke:var(--ad-white)} .ad-svg .ads-cardline,.ad-scene .ads-cardline{stroke:var(--ad-cardline)} .ad-svg .ads-tick,.ad-scene .ads-tick{stroke:var(--ad-tick)}
|
|
9
|
+
.adg-f0{stop-color:var(--ad-f0)} .adg-f1{stop-color:var(--ad-f1)} .adg-f2{stop-color:var(--ad-f2)} .adg-c0{stop-color:var(--ad-c0)} .adg-c1{stop-color:var(--ad-c1)} .adg-c2{stop-color:var(--ad-c2)} .adg-h0{stop-color:var(--ad-h0)} .adg-h1{stop-color:var(--ad-h1)} .adg-h2{stop-color:var(--ad-h2)} .adg-l0{stop-color:var(--ad-l0)} .adg-l1{stop-color:var(--ad-l1)} .adg-morning0{stop-color:var(--ad-morning0)} .adg-morning1{stop-color:var(--ad-morning1)} .adg-tea0{stop-color:var(--ad-tea0)} .adg-tea1{stop-color:var(--ad-tea1)} .adg-win0{stop-color:var(--ad-win0)} .adg-win1{stop-color:var(--ad-win1)} .adg-think0{stop-color:var(--ad-think0)} .adg-think1{stop-color:var(--ad-think1)} .adg-rain0{stop-color:var(--ad-rain0)} .adg-rain1{stop-color:var(--ad-rain1)} .adg-night0{stop-color:var(--ad-night0)} .adg-night1{stop-color:var(--ad-night1)} .adg-plain0{stop-color:var(--ad-plain0)} .adg-plain1{stop-color:var(--ad-plain1)}
|
|
10
|
+
|
|
11
|
+
.ad-svg { display: inline-block; flex: none; vertical-align: middle; }
|
|
12
|
+
.ad-dot { display: inline-block; flex: none; width: var(--ad-px, 12px); height: var(--ad-px, 12px); max-width: 12px; max-height: 12px; border-radius: 50%; background: var(--cz-dot-ok, currentColor); vertical-align: middle; }
|
|
13
|
+
.ad-dot.m-honest { background: var(--cz-dot-red, currentColor); }
|
|
14
|
+
.ad-dot.m-needs-you { background: var(--cz-blue, currentColor); }
|
|
15
|
+
.ad-dot.m-thinking, .ad-dot.m-resting { background: var(--cz-dot-q, currentColor); }
|
|
16
|
+
.ad-dot.m-celebrating { background: var(--cz-dot-risk, currentColor); }
|
|
17
|
+
.ad-scene { display: block; width: 100%; height: auto; border-radius: 18px; }
|
|
18
|
+
.ad-scene .ad-z { font-family: var(--cz-sans, sans-serif); font-weight: 800; }
|
|
19
|
+
.ad-scene .ad-z.z0 { font-size: var(--fs-3); } .ad-scene .ad-z.z1 { font-size: var(--fs-4); } .ad-scene .ad-z.z2 { font-size: var(--fs-5); }
|
|
20
|
+
.ad-scene-face { display: flex; justify-content: center; padding: 12px 0; }
|
|
21
|
+
.ad-peek { display: block; }
|
|
22
|
+
/* every toast (AdM1-4): the S face before the words */
|
|
23
|
+
.ad-tf { display: inline-flex; align-items: center; margin-right: 8px; vertical-align: middle; }
|
|
24
|
+
.ad-toast { display: inline-flex; align-items: center; }
|
|
25
|
+
/* dark mode (AdU8): the scene's sky and ground dim; Adler keeps his own warm colours */
|
|
26
|
+
:root[data-theme="dark"] .ad-env, .cz.dark .ad-env { filter: brightness(.55) saturate(.85); }
|
|
27
|
+
|
|
28
|
+
.am .ad-br { animation: adBr 4.6s ease-in-out infinite; transform-origin: 100px 250px; }
|
|
29
|
+
@keyframes adBr { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.008, 1.018); } }
|
|
30
|
+
.am .ad-sp { animation: adSp 5.2s ease-in-out infinite; transform-origin: 100px 38px; }
|
|
31
|
+
@keyframes adSp { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
|
|
32
|
+
.am .ad-ey { animation: adBl 5.6s infinite; transform-box: fill-box; transform-origin: center; }
|
|
33
|
+
@keyframes adBl { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.12); } }
|
|
34
|
+
.am .ad-tl { animation: adTl 3.2s ease-in-out infinite; transform-origin: 146px 214px; }
|
|
35
|
+
@keyframes adTl { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(7deg); } }
|
|
36
|
+
.am.m-joy .ad-tl { animation-duration: 1s; }
|
|
37
|
+
.am.m-joy .ad-br { animation: adHop 2.6s ease-in-out infinite; }
|
|
38
|
+
@keyframes adHop { 0%, 60%, 100% { transform: translateY(0); } 72% { transform: translateY(-6px); } 84% { transform: translateY(0); } }
|
|
39
|
+
.am.m-joy .ad-ey, .am.m-rest .ad-ey { animation: none; }
|
|
40
|
+
.am.m-worry .ad-tl, .am.m-rest .ad-tl { animation: none; }
|
|
41
|
+
.am.m-worry .ad-sp { animation-duration: 9s; }
|
|
42
|
+
.am.m-rest .ad-br { animation-duration: 6.5s; }
|
|
43
|
+
/* the S face in a toast or a chip only blinks: a 24 px face that breathes reads as jitter */
|
|
44
|
+
.ad-tf .am *, .ad-svg[width="24"] .ad-sp { animation: none; }
|
|
45
|
+
.env-glow { animation: enGl 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
|
|
46
|
+
@keyframes enGl { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .85; transform: scale(1.08); } }
|
|
47
|
+
.env-cloud { animation: enCl 26s ease-in-out infinite alternate; }
|
|
48
|
+
@keyframes enCl { from { transform: translateX(-14px); } to { transform: translateX(18px); } }
|
|
49
|
+
.env-steam { animation: enSt 3.6s ease-out infinite; opacity: 0; }
|
|
50
|
+
.env-steam.d2 { animation-delay: 1.2s; } .env-steam.d3 { animation-delay: 2.4s; }
|
|
51
|
+
@keyframes enSt { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: .6; } 100% { opacity: 0; transform: translateY(-22px); } }
|
|
52
|
+
.env-leaf { animation: enLf 7s ease-in 1 forwards; opacity: 0; }
|
|
53
|
+
.env-leaf.d2 { animation-delay: .5s; } .env-leaf.d3 { animation-delay: 1s; } .env-leaf.d4 { animation-delay: 1.4s; } .env-leaf.d5 { animation-delay: .8s; }
|
|
54
|
+
@keyframes enLf { 0% { opacity: 0; transform: translate(0, -10px) rotate(0); } 6% { opacity: 1; } 40% { opacity: 1; transform: translate(14px, 120px) rotate(200deg); } 48%, 100% { opacity: 0; transform: translate(16px, 140px) rotate(240deg); } }
|
|
55
|
+
.env-tw { animation: enTw 3.4s ease-in-out infinite; }
|
|
56
|
+
.env-tw.d2 { animation-delay: 1.1s; } .env-tw.d3 { animation-delay: 2.2s; }
|
|
57
|
+
@keyframes enTw { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
|
|
58
|
+
.env-ff { animation: enFf 9s ease-in-out infinite alternate; }
|
|
59
|
+
.env-ff.d2 { animation-duration: 11s; animation-delay: -3s; }
|
|
60
|
+
@keyframes enFf { 0% { transform: translate(0, 0); opacity: .3; } 50% { transform: translate(18px, -14px); opacity: 1; } 100% { transform: translate(-10px, -24px); opacity: .4; } }
|
|
61
|
+
.env-z { animation: enZ 4.5s ease-out infinite; opacity: 0; }
|
|
62
|
+
.env-z.d2 { animation-delay: 1.5s; } .env-z.d3 { animation-delay: 3s; }
|
|
63
|
+
@keyframes enZ { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 25% { opacity: .8; } 100% { opacity: 0; transform: translate(14px, -34px) scale(1.15); } }
|
|
64
|
+
.env-dot { animation: enDt 1.5s ease-in-out infinite; }
|
|
65
|
+
.env-dot.d2 { animation-delay: .25s; } .env-dot.d3 { animation-delay: .5s; }
|
|
66
|
+
@keyframes enDt { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
|
|
67
|
+
.env-sway { animation: enSw 4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom center; }
|
|
68
|
+
.env-sway.d2 { animation-delay: -1.5s; }
|
|
69
|
+
@keyframes enSw { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
|
|
70
|
+
.env-drop { animation: enDr 2.2s linear infinite; opacity: 0; }
|
|
71
|
+
.env-drop.d2 { animation-delay: .7s; } .env-drop.d3 { animation-delay: 1.4s; }
|
|
72
|
+
@keyframes enDr { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: .6; } 100% { opacity: 0; transform: translateY(26px); } }
|
|
73
|
+
/* still: the OS asks for less motion, or Settings > Adler > Motion is Still. A leaf that would fall once is simply not drawn. */
|
|
74
|
+
html.ad-still .am *, html.ad-still .ad-scene * { animation: none !important; }
|
|
75
|
+
html.ad-still .env-steam, html.ad-still .env-z, html.ad-still .env-drop { opacity: .6; }
|
|
76
|
+
html.ad-still .env-leaf { opacity: 0; }
|
|
77
|
+
@media (prefers-reduced-motion: reduce) {
|
|
78
|
+
.am *, .ad-scene * { animation: none !important; }
|
|
79
|
+
.env-steam, .env-z, .env-drop { opacity: .6; }
|
|
80
|
+
.env-leaf { opacity: 0; }
|
|
81
|
+
}
|
|
82
|
+
svg.ad-svg.am { stroke: none; }
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/* pm/cozy-adler.js — Adler, Claude's face in PMOS (feedback batch 16 item 2; canvas "Adler · Claude's face in PMOS", frames AdSystem, AdSheet,
|
|
2
|
+
* AdSoft, AdMotion, AdB1-3, AdP1-6, AdH1-8, AdU1-9, AdM1-5; spec adler-character/ADLER-SYSTEM.md). Wawan's own art: a Shiba in a green hoodie
|
|
3
|
+
* with a sprout, drawn soft 3D (SVG gradients) with slow, small motion.
|
|
4
|
+
*
|
|
5
|
+
* One module draws him everywhere, so every surface shows the same Adler:
|
|
6
|
+
* adler(mood, size, o) the S face (24 px), the M face (36-48 px, default 40) or the L figure (110-170 px, default 140) as inline SVG
|
|
7
|
+
* adlerScene(kind, mood, o) the XL scene: morning, tea, win, think, rain, night (first run, after 22:00, start-up, errors)
|
|
8
|
+
* adlerPeek() his ears over the floating button when one call needs the PM (AdP6)
|
|
9
|
+
* moodOfText(t) the mood of a sentence Claude already says: honest when it failed, handled otherwise (AdM1-4 toasts)
|
|
10
|
+
* mountToastFaces(doc) every #toast gets the S face in the mood of its words
|
|
11
|
+
* prefs(), loadPrefs(), savePref(key, value) Settings > Adler (AdM5): adler.amount, adler.motion, adler.celebrate, adler.quiet
|
|
12
|
+
* asleep(now), mayCelebrate(now), celebrated(now) the after-22:00 rule and "celebrate at most once a week"
|
|
13
|
+
*
|
|
14
|
+
* The binding rules (design-principles.md, "The Adler rule"): the mood comes from real state only, and no trigger means resting or handled;
|
|
15
|
+
* one Adler per screen; never inside data (rows, bars, charts, KR rows, reports, connector lists); he never replaces a row's dot or box;
|
|
16
|
+
* Adlerian words (thanks for contribution, no praise, no points, no streaks, no blame); the mood is never happier than the data. All motion
|
|
17
|
+
* stops under prefers-reduced-motion and under Settings > Adler > Motion: Still. Off draws the plain mood dot; Face only drops the figures
|
|
18
|
+
* and scenes. Colours are the --ad-* tokens in cozy.css: this file names classes, never a colour. Each drawing has its own id prefix, so
|
|
19
|
+
* two Adlers on one page never share a gradient. Pure string builders, so a unit test can read them. */
|
|
20
|
+
|
|
21
|
+
const CSS = new URL('./cozy-adler.css', import.meta.url).href;
|
|
22
|
+
const TOKENS = new URL('./cozy.css', import.meta.url).href;
|
|
23
|
+
export const MOODS = Object.freeze(['handled', 'celebrating', 'thinking', 'needs-you', 'honest', 'resting']);
|
|
24
|
+
const INNER = { handled: 'calm', celebrating: 'joy', thinking: 'think', 'needs-you': 'ask', honest: 'worry', resting: 'rest' };
|
|
25
|
+
const WORDS = { handled: 'handled', celebrating: 'celebrating', thinking: 'thinking', 'needs-you': 'needs you', honest: 'honest, something is not right', resting: 'resting' };
|
|
26
|
+
export const SIZES = Object.freeze({ s: 24, m: 40, l: 140 });
|
|
27
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
28
|
+
const moodOf = (m) => (INNER[m] ? m : 'handled');
|
|
29
|
+
let seq = 0;
|
|
30
|
+
const nextId = () => 'ad' + (++seq).toString(36);
|
|
31
|
+
|
|
32
|
+
/* ── the art (ported from adler-character/adler.py and soft.py) ── */
|
|
33
|
+
const F = (k) => `adf-${k}`, S = (k) => `ads-${k}`;
|
|
34
|
+
const L_FUR = 'rgba(170,100,30,.22)', L_CREAM = 'rgba(170,130,80,.18)', L_HOOD = 'rgba(50,75,25,.35)', L_LEAF = 'rgba(80,120,40,.35)';
|
|
35
|
+
|
|
36
|
+
function defs(p) {
|
|
37
|
+
const rg = (id, cx, cy, r, stops) => `<radialGradient id="${p}${id}" gradientUnits="userSpaceOnUse" cx="${cx}" cy="${cy}" r="${r}">${stops.map(([o, k]) => `<stop offset="${o}" class="adg-${k}"/>`).join('')}</radialGradient>`;
|
|
38
|
+
return '<defs>' + rg('f', 78, 58, 190, [[0, 'f0'], [0.45, 'f1'], [1, 'f2']]) + rg('c', 86, 104, 80, [[0, 'c0'], [0.7, 'c1'], [1, 'c2']])
|
|
39
|
+
+ rg('h', 78, 166, 100, [[0, 'h0'], [0.55, 'h1'], [1, 'h2']]) + rg('l', 96, 4, 44, [[0, 'l0'], [1, 'l1']])
|
|
40
|
+
+ `<filter id="${p}b" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="3.5"/></filter></defs>`;
|
|
41
|
+
}
|
|
42
|
+
function sprout(m, p) {
|
|
43
|
+
const rot = { calm: 0, joy: -8, think: 10, ask: -4, worry: 30, rest: 16 }[m];
|
|
44
|
+
let l1 = 'M100 22 C 88 6, 70 8, 66 18 C 74 26, 90 28, 100 22Z', l2 = 'M100 22 C 112 4, 132 6, 136 16 C 128 26, 110 28, 100 22Z';
|
|
45
|
+
if (m === 'worry') { l1 = 'M100 22 C 90 12, 74 14, 70 24 C 80 30, 94 30, 100 22Z'; l2 = 'M100 22 C 106 30, 118 40, 130 38 C 130 28, 116 18, 100 22Z'; }
|
|
46
|
+
const leaf = (d) => `<path d="${d}" fill="url(#${p}l)" stroke="${L_LEAF}" stroke-width="2" stroke-linejoin="round"/>`;
|
|
47
|
+
return `<g class="ad-sp"><g transform="rotate(${rot} 100 36)"><path d="M100 38 L100 22" fill="none" stroke="${L_LEAF}" stroke-width="4" stroke-linecap="round"/>${leaf(l1)}${leaf(l2)}`
|
|
48
|
+
+ `<path d="M100 22 C 92 18, 82 17, 74 18" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/><path d="M100 22 C 110 17, 120 15, 128 16" fill="none" stroke="${L_LEAF}" stroke-width="1.2" opacity=".6"/></g></g>`;
|
|
49
|
+
}
|
|
50
|
+
const mirror = (d) => { let x = true; return d.replace(/[MCZ]|-?\d+\.?\d*/g, (t) => { if (/[MCZ]/.test(t)) { x = true; return t; } const v = Number(t); const o = x ? String(200 - v) : String(v); x = !x; return ' ' + o; }); };
|
|
51
|
+
function ears(m, p) {
|
|
52
|
+
const down = m === 'worry' || m === 'rest';
|
|
53
|
+
const L = down ? 'M46 70 C 34 50, 34 34, 40 26 C 56 30, 72 44, 82 56Z' : 'M44 66 C 38 44, 40 24, 50 12 C 64 20, 78 36, 86 50Z';
|
|
54
|
+
const Li = down ? 'M50 64 C 44 50, 44 40, 47 35 C 58 40, 66 48, 72 55Z' : 'M50 60 C 46 44, 48 32, 53 24 C 62 32, 70 40, 76 50Z';
|
|
55
|
+
return [[L, Li], [mirror(L), mirror(Li)]].map(([a, b]) => `<path d="${a}" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3" stroke-linejoin="round"/><path d="${b}" class="${F('pink')}"/>`).join('');
|
|
56
|
+
}
|
|
57
|
+
function face(m, p) {
|
|
58
|
+
let s = '';
|
|
59
|
+
const brow = (x) => `<ellipse cx="${x}" cy="${m === 'ask' ? 66 : 72}" rx="8" ry="5" fill="url(#${p}c)"/>`;
|
|
60
|
+
s += m === 'worry' ? `<path d="M66 72 L82 68" class="${S('cream')}" stroke-width="7" stroke-linecap="round"/><path d="M134 72 L118 68" class="${S('cream')}" stroke-width="7" stroke-linecap="round"/>` : brow(76) + brow(124);
|
|
61
|
+
s += '<g class="ad-ey">';
|
|
62
|
+
if (m === 'joy') s += `<path d="M66 96 Q76 84 86 96" fill="none" class="${S('ink')}" stroke-width="4.5" stroke-linecap="round"/><path d="M114 96 Q124 84 134 96" fill="none" class="${S('ink')}" stroke-width="4.5" stroke-linecap="round"/>`;
|
|
63
|
+
else if (m === 'rest') s += `<path d="M67 94 Q76 100 85 94" fill="none" class="${S('ink')}" stroke-width="4" stroke-linecap="round"/><path d="M115 94 Q124 100 133 94" fill="none" class="${S('ink')}" stroke-width="4" stroke-linecap="round"/>`;
|
|
64
|
+
else {
|
|
65
|
+
const [dx, dy] = { think: [3, -3], worry: [0, 1] }[m] || [0, 0], r = m === 'worry' ? 10 : 11;
|
|
66
|
+
for (const cx of [76, 124]) s += `<circle cx="${cx + dx}" cy="${93 + dy}" r="${r}" class="${F('ink')}"/><circle cx="${cx + dx + 3}" cy="${89 + dy}" r="3.6" class="${F('white')}"/><circle cx="${cx + dx - 3}" cy="${97 + dy}" r="1.6" class="${F('white')}" opacity=".8"/>`;
|
|
67
|
+
}
|
|
68
|
+
if (m === 'think') s += `<circle cx="78" cy="92" r="17" fill="none" class="${S('glass')}" stroke-width="3"/><circle cx="122" cy="92" r="17" fill="none" class="${S('glass')}" stroke-width="3"/><path d="M95 92 Q100 88 105 92" fill="none" class="${S('glass')}" stroke-width="3"/>`;
|
|
69
|
+
s += '</g>';
|
|
70
|
+
const op = m === 'worry' ? '.35' : '.75';
|
|
71
|
+
s += `<ellipse cx="58" cy="114" rx="11" ry="7" class="${F('blush')}" opacity="${op}" filter="url(#${p}b)"/><ellipse cx="142" cy="114" rx="11" ry="7" class="${F('blush')}" opacity="${op}" filter="url(#${p}b)"/>`;
|
|
72
|
+
s += `<path d="M93 106 Q100 102 107 106 Q106 112 100 113 Q94 112 93 106Z" class="${F('ink')}"/>`;
|
|
73
|
+
if (m === 'joy') s += `<path d="M88 117 Q100 113 112 117 Q112 134 100 135 Q88 134 88 117Z" class="${F('mouth')}"/><path d="M92 128 Q100 122 108 128 Q106 135 100 135 Q94 135 92 128Z" class="${F('tongue')}"/>`;
|
|
74
|
+
else if (m === 'ask') s += `<path d="M91 117 Q100 115 109 117 Q108 128 100 129 Q92 128 91 117Z" class="${F('mouth')}"/><path d="M94 125 Q100 121 106 125 Q104 129 100 129 Q96 129 94 125Z" class="${F('tongue')}"/>`;
|
|
75
|
+
else if (m === 'think') s += `<path d="M100 113 L100 118" class="${S('ink')}" stroke-width="2.6" stroke-linecap="round"/><ellipse cx="100" cy="122" rx="3.5" ry="3" class="${F('mouth')}"/>`;
|
|
76
|
+
else if (m === 'worry') s += `<path d="M100 113 L100 118" class="${S('ink')}" stroke-width="2.6" stroke-linecap="round"/><path d="M89 125 Q100 119 111 125" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round"/>`;
|
|
77
|
+
else s += `<path d="M100 113 L100 118 M100 118 Q94 124 88 119 M100 118 Q106 124 112 119" fill="none" class="${S('ink')}" stroke-width="2.8" stroke-linecap="round" stroke-linejoin="round"/>`;
|
|
78
|
+
return s;
|
|
79
|
+
}
|
|
80
|
+
function head(m, p, prop) {
|
|
81
|
+
let h = sprout(m, p) + ears(m, p);
|
|
82
|
+
h += `<path d="M28 98 C 28 54, 60 32, 100 32 C 140 32, 172 54, 172 98 C 172 138, 140 156, 100 156 C 60 156, 28 138, 28 98Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/>`;
|
|
83
|
+
h += `<ellipse cx="74" cy="56" rx="30" ry="14" class="${F('white')}" opacity=".35" filter="url(#${p}b)"/><path d="M40 120 C 50 150, 150 150, 160 120 C 150 160, 50 160, 40 120Z" class="${F('shade')}" opacity=".12" filter="url(#${p}b)"/>`;
|
|
84
|
+
h += `<path d="M36 108 C 44 92, 70 92, 100 102 C 130 92, 156 92, 164 108 C 162 140, 136 154, 100 154 C 64 154, 38 140, 36 108Z" fill="url(#${p}c)"/>`;
|
|
85
|
+
h += face(m, p);
|
|
86
|
+
// AdH5: headphones while a meeting records
|
|
87
|
+
if (prop === 'headphones') h += `<path d="M34 96 C 30 36, 170 36, 166 96" fill="none" class="${S('hp')}" stroke-width="8" stroke-linecap="round"/><rect x="20" y="82" width="20" height="34" rx="9" class="${F('hp')}"/><rect x="160" y="82" width="20" height="34" rx="9" class="${F('hp')}"/>`;
|
|
88
|
+
return h;
|
|
89
|
+
}
|
|
90
|
+
const capsule = (x1, y1, x2, y2, w, p) => `<path d="M${x1} ${y1} L${x2} ${y2}" stroke="${L_HOOD}" stroke-width="${w + 5}" stroke-linecap="round" fill="none"/><path d="M${x1} ${y1} L${x2} ${y2}" stroke="url(#${p}h)" stroke-width="${w}" stroke-linecap="round" fill="none"/>`;
|
|
91
|
+
const paw = (x, y, p, r = 12) => `<circle cx="${x}" cy="${y}" r="${r}" fill="url(#${p}c)" stroke="${L_CREAM}" stroke-width="2.5"/>`;
|
|
92
|
+
const POSES = {
|
|
93
|
+
joy: [[[62, 172], [30, 124]], [[138, 172], [170, 124]]], think: [[[62, 176], [54, 214]], [[136, 174], [118, 140]]],
|
|
94
|
+
ask: [[[62, 176], [54, 214]], [[138, 172], [162, 128]]], worry: [[[64, 178], [86, 206]], [[136, 178], [114, 206]]],
|
|
95
|
+
};
|
|
96
|
+
function body(p) {
|
|
97
|
+
let s = `<g class="ad-tl"><path d="M140 222 C 172 226, 186 196, 172 182 C 160 172, 146 186, 156 196 C 164 204, 152 214, 140 210Z" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3" stroke-linejoin="round"/><path d="M168 186 C 176 194, 172 206, 164 210" fill="none" class="${S('creamhi')}" stroke-width="6" stroke-linecap="round"/></g>`;
|
|
98
|
+
for (const x of [78, 122]) s += `<rect x="${x - 14}" y="214" width="28" height="26" rx="12" fill="url(#${p}f)" stroke="${L_FUR}" stroke-width="3"/><ellipse cx="${x}" cy="240" rx="17" ry="8" fill="url(#${p}c)" stroke="${L_CREAM}" stroke-width="2.5"/>`;
|
|
99
|
+
s += `<path d="M58 160 C 50 182, 50 210, 56 224 C 70 232, 130 232, 144 224 C 150 210, 150 182, 142 160 Z" fill="url(#${p}h)" stroke="${L_HOOD}" stroke-width="3" stroke-linejoin="round"/>`;
|
|
100
|
+
s += `<path d="M74 198 C 74 192, 126 192, 126 198 L 128 218 C 110 222, 90 222, 72 218Z" class="${F('hoodd')}" opacity=".45"/><path d="M100 186 C 94 180, 94 172, 100 168 C 106 172, 106 180, 100 186Z" class="${F('hoodl')}"/>`;
|
|
101
|
+
s += `<path d="M50 150 C 60 170, 140 170, 150 150 C 140 160, 60 160, 50 150Z" class="${F('hoodd')}"/>`;
|
|
102
|
+
return s;
|
|
103
|
+
}
|
|
104
|
+
const strings = (p) => `<path d="M90 160 L88 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="88" cy="184" r="3" fill="url(#${p}c)"/><path d="M110 160 L112 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="112" cy="184" r="3" fill="url(#${p}c)"/>`;
|
|
105
|
+
const mug = () => `<rect x="86" y="190" width="30" height="30" rx="7" class="${F('mug')}" stroke="${L_HOOD}" stroke-width="2.5"/><path d="M116 197 C 125 197, 125 212, 116 212" fill="none" stroke="${L_HOOD}" stroke-width="3"/><path d="M101 198 C 95 204, 97 212, 101 214 C 105 212, 107 204, 101 198Z" class="${F('mugleaf')}"/>`;
|
|
106
|
+
const sparkles = () => [[26, 60, 7], [176, 52, 6], [20, 150, 5], [182, 150, 5]].map(([x, y, r]) => `<path d="M${x} ${y - r} L${x + r * 0.3} ${y - r * 0.3} L${x + r} ${y} L${x + r * 0.3} ${y + r * 0.3} L${x} ${y + r} L${x - r * 0.3} ${y + r * 0.3} L${x - r} ${y} L${x - r * 0.3} ${y - r * 0.3}Z" class="${F('gold')}"/>`).join('');
|
|
107
|
+
function full(m, p, prop) {
|
|
108
|
+
let g = body(p);
|
|
109
|
+
if (m === 'calm' || m === 'rest') {
|
|
110
|
+
g += head(m, p, prop) + strings(p) + capsule(64, 176, 80, 206, 22, p) + capsule(136, 176, 122, 206, 22, p) + paw(82, 210, p, 9) + paw(120, 210, p, 9) + mug();
|
|
111
|
+
return g;
|
|
112
|
+
}
|
|
113
|
+
if (m === 'joy') g += sparkles();
|
|
114
|
+
g += head(m, p, prop) + strings(p) + POSES[m].map(([a, b]) => capsule(a[0], a[1], b[0], b[1], 22, p) + paw(b[0], b[1], p)).join('');
|
|
115
|
+
// AdU4: a magnifier in the raised paw when nothing is found; otherwise "needs you" holds up one card with a tick
|
|
116
|
+
if (m === 'ask' && prop === 'magnifier') g += `<path d="M150 118 L140 132" class="${S('glass')}" stroke-width="6" stroke-linecap="round"/><circle cx="162" cy="104" r="17" class="${F('lens')} ${S('glass')}" stroke-width="5"/>` + paw(146, 128, p);
|
|
117
|
+
else if (m === 'ask') g += `<g transform="rotate(10 168 110)"><rect x="152" y="88" width="34" height="40" rx="6" class="${F('white')} ${S('cardline')}" stroke-width="2"/><path d="M160 106 l5 5 l10 -11" fill="none" class="${S('tick')}" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/></g>` + paw(162, 128, p);
|
|
118
|
+
return g;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/* ── Settings > Adler (AdM5): this computer's settings, kept in localStorage for the first paint and read from /api/settings ── */
|
|
122
|
+
const PREF_DEF = Object.freeze({ 'adler.amount': 'full', 'adler.motion': 'system', 'adler.celebrate': 'real', 'adler.quiet': '22' });
|
|
123
|
+
export const PREF_OPTIONS = Object.freeze({ 'adler.amount': ['full', 'face', 'off'], 'adler.motion': ['system', 'still'], 'adler.celebrate': ['real', 'never'], 'adler.quiet': ['22', 'never'] });
|
|
124
|
+
const PREF_KEY = 'pmos.adler';
|
|
125
|
+
const store = { get(k) { try { return localStorage.getItem(k); } catch { return null; } }, set(k, v) { try { localStorage.setItem(k, v); } catch { /* no storage */ } } };
|
|
126
|
+
let P = (() => { try { return { ...PREF_DEF, ...(JSON.parse(store.get(PREF_KEY) || '{}') || {}) }; } catch { return { ...PREF_DEF }; } })();
|
|
127
|
+
const clean = (o) => { const out = { ...PREF_DEF }; for (const k of Object.keys(PREF_DEF)) if (o && PREF_OPTIONS[k].includes(o[k])) out[k] = o[k]; return out; };
|
|
128
|
+
P = clean(P);
|
|
129
|
+
/** The Adler settings now: { 'adler.amount': full|face|off, 'adler.motion': system|still, 'adler.celebrate': real|never, 'adler.quiet': 22|never } */
|
|
130
|
+
export const prefs = () => ({ ...P });
|
|
131
|
+
function applyPrefs() {
|
|
132
|
+
if (typeof document === 'undefined' || !document.documentElement) return;
|
|
133
|
+
document.documentElement.classList.toggle('ad-still', P['adler.motion'] === 'still');
|
|
134
|
+
}
|
|
135
|
+
export function setPrefs(o) { P = clean({ ...P, ...o }); store.set(PREF_KEY, JSON.stringify(P)); applyPrefs(); if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('adler:prefs', { detail: prefs() })); return prefs(); }
|
|
136
|
+
/** Reads the four settings from GET /api/settings (lib/settings-store.js keeps them for this computer). */
|
|
137
|
+
export async function loadPrefs(get) {
|
|
138
|
+
try {
|
|
139
|
+
const r = get ? await get('/api/settings') : await fetch('/api/settings', { credentials: 'same-origin' }).then((x) => x.json());
|
|
140
|
+
if (r && r.ok && Array.isArray(r.settings)) { const o = {}; for (const s of r.settings) if (s && s.key in PREF_DEF) o[s.key] = s.value; setPrefs(o); }
|
|
141
|
+
} catch { /* the kept copy stands */ }
|
|
142
|
+
return prefs();
|
|
143
|
+
}
|
|
144
|
+
/** One press in Settings > Adler: POST /api/settings, then the page follows at once. → the server's answer */
|
|
145
|
+
export async function savePref(post, key, value) {
|
|
146
|
+
if (!(key in PREF_DEF) || !PREF_OPTIONS[key].includes(value)) return { ok: false, error: 'That is not an Adler setting.' };
|
|
147
|
+
const r = await post('/api/settings', { key, value });
|
|
148
|
+
if (r && r.ok) setPrefs({ [key]: value });
|
|
149
|
+
return r || { ok: false, error: 'Not saved.' };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** After 22:00 (until 05:00) with Quiet after: 22:00, PMOS opens on Adler asleep (AdP4). */
|
|
153
|
+
export const asleep = (now = Date.now()) => { const h = new Date(now).getHours(); return P['adler.quiet'] === '22' && P['adler.amount'] !== 'off' && (h >= 22 || h < 5); };
|
|
154
|
+
const weekOf = (now) => { const d = new Date(now); d.setHours(0, 0, 0, 0); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); return d.toDateString(); };
|
|
155
|
+
/** Celebrating: only for a real event, at most once a week, and never with Celebrations: Never. */
|
|
156
|
+
export const mayCelebrate = (now = Date.now()) => P['adler.celebrate'] === 'real' && store.get('pmos.adler.joy') !== weekOf(now);
|
|
157
|
+
export const celebrated = (now = Date.now()) => store.set('pmos.adler.joy', weekOf(now));
|
|
158
|
+
/** The day's first open of the morning scene (AdP1 vs AdB1: the scene on the first open of the day, the M face after). */
|
|
159
|
+
export function firstOpenToday(key = 'day', now = Date.now()) { const k = 'pmos.adler.first.' + key, d = new Date(now).toDateString(); if (store.get(k) === d) return false; store.set(k, d); return true; }
|
|
160
|
+
|
|
161
|
+
function addCss() {
|
|
162
|
+
if (typeof document === 'undefined' || !document.head) return;
|
|
163
|
+
for (const href of [TOKENS, CSS]) if (!document.querySelector(`link[href="${href}"]`) && !(href === TOKENS && [...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => /\/cozy\.css$/.test(l.getAttribute('href') || '')))) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.append(l); }
|
|
164
|
+
applyPrefs();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* ── the drawings ── */
|
|
168
|
+
const labelAttr = (o, mood, extra) => (o.label === false ? 'aria-hidden="true"' : `role="img" aria-label="${esc(o.label || 'Adler, ' + WORDS[mood] + (extra ? ', ' + extra : ''))}"`);
|
|
169
|
+
/** The plain mood dot Settings > Adler > Off shows where a face would be. */
|
|
170
|
+
const dot = (mood, px, o) => `<span class="ad-dot m-${mood}" style="--ad-px:${px}px" ${labelAttr(o, mood)}></span>`;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Adler. mood: one of MOODS (anything else is handled). size: 's' | 'm' | 'l' or a number of px (the face's side; the figure's height).
|
|
174
|
+
* o: { label: false (beside words that carry the meaning) | 'text', prop: 'headphones' | 'magnifier', cls, id (a fixed prefix) }. Off → the mood dot;
|
|
175
|
+
* Face only → an L figure is drawn as the M face. → HTML string
|
|
176
|
+
*/
|
|
177
|
+
export function adler(mood, size = 'm', o = {}) {
|
|
178
|
+
addCss();
|
|
179
|
+
mood = moodOf(mood);
|
|
180
|
+
const m = INNER[mood], amount = P['adler.amount'];
|
|
181
|
+
let figure = size === 'l' || (typeof size === 'number' && size > 64);
|
|
182
|
+
let px = typeof size === 'number' ? size : SIZES[size] || SIZES.m;
|
|
183
|
+
if (figure && amount !== 'full') { figure = false; px = SIZES.m; }
|
|
184
|
+
if (amount === 'off') return dot(mood, Math.min(px, 24), o);
|
|
185
|
+
// o.id: a fixed prefix for a drawing that is redrawn in place (the chat avatar), so the same state draws the same markup and a
|
|
186
|
+
// redraw that diffs the markup does not replace the node and replay its entrance (premium-viewer-flicker F1)
|
|
187
|
+
const p = o.id ? 'ad' + o.id : nextId(), cls = `ad-svg am m-${m}${o.cls ? ' ' + o.cls : ''}`;
|
|
188
|
+
const extra = o.prop === 'headphones' ? 'listening' : o.prop === 'magnifier' ? 'searching' : '';
|
|
189
|
+
if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop)}</svg>`;
|
|
190
|
+
const w = Math.round(px * 200 / 252);
|
|
191
|
+
return `<svg class="${cls} ad-fig" width="${w}" height="${px}" viewBox="0 0 200 252" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${p}b)"/><g class="ad-br">${full(m, p, o.prop)}</g></svg>`;
|
|
192
|
+
}
|
|
193
|
+
/** AdP6: only his ears and the top of his head, peeking over the floating button. */
|
|
194
|
+
export function adlerPeek(o = {}) {
|
|
195
|
+
addCss();
|
|
196
|
+
if (P['adler.amount'] !== 'full') return '';
|
|
197
|
+
const p = nextId();
|
|
198
|
+
return `<svg class="ad-svg am m-ask ad-peek" width="44" height="22" viewBox="22 4 156 78" overflow="hidden" ${labelAttr({ label: o.label || 'Adler, one call is yours' }, 'needs-you')}>${defs(p)}${head('ask', p)}</svg>`;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const grass = (x, y, s = 1, d = '') => `<g class="env-sway${d}"><path d="M${x} ${y} q -3 -${14 * s} -9 -${20 * s} M${x} ${y} q 1 -${18 * s} 4 -${24 * s} M${x} ${y} q 4 -${10 * s} 11 -${15 * s}" class="${S('grass')}" stroke-width="2.4" fill="none" stroke-linecap="round"/></g>`;
|
|
202
|
+
const fallLeaf = (x, y, d, k) => `<g class="env-leaf${d}"><path d="M${x} ${y} c 4 -6 12 -6 14 0 c -4 6 -12 6 -14 0z" class="${F(k)}"/></g>`;
|
|
203
|
+
export const SCENES = Object.freeze(['morning', 'tea', 'win', 'think', 'rain', 'night', 'plain']);
|
|
204
|
+
/**
|
|
205
|
+
* The XL scene: Adler in his small world. kind: one of SCENES. o: { w (viewBox width, 400), h (260), label, prop }. It scales to its
|
|
206
|
+
* container's width. Face only → the M face; Off → nothing. → HTML string
|
|
207
|
+
*/
|
|
208
|
+
export function adlerScene(kind, mood, o = {}) {
|
|
209
|
+
addCss();
|
|
210
|
+
mood = moodOf(mood);
|
|
211
|
+
if (P['adler.amount'] === 'off') return '';
|
|
212
|
+
if (P['adler.amount'] === 'face') return `<div class="ad-scene-face">${adler(mood, 'm', o)}</div>`;
|
|
213
|
+
if (!SCENES.includes(kind)) kind = 'plain';
|
|
214
|
+
const W = o.w || 400, H = o.h || 260, adh = Math.min(170, H - 60), m = INNER[mood], p = nextId(), gy = H - 34;
|
|
215
|
+
let g = `<svg class="ad-scene env k-${kind}" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMax slice" ${labelAttr(o, mood, kind === 'night' ? 'asleep' : '')}>`;
|
|
216
|
+
g += `<defs><linearGradient id="${p}bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="adg-${kind}0"/><stop offset="1" class="adg-${kind}1"/></linearGradient></defs>`;
|
|
217
|
+
g += `<g class="ad-env"><rect width="${W}" height="${H}" fill="url(#${p}bg)"/>`;
|
|
218
|
+
if (kind === 'morning') g += `<circle class="env-glow ${F('sunglow')}" cx="${W - 80}" cy="62" r="34" opacity=".7"/><circle cx="${W - 80}" cy="62" r="22" class="${F('sun')}"/><g class="env-cloud"><ellipse cx="90" cy="58" rx="34" ry="12" class="${F('white')}" opacity=".9"/><ellipse cx="110" cy="50" rx="20" ry="12" class="${F('white')}" opacity=".9"/></g>`;
|
|
219
|
+
if (kind === 'night') {
|
|
220
|
+
g += `<circle cx="${W - 78}" cy="58" r="22" class="${F('moon')}"/><circle cx="${W - 68}" cy="52" r="20" class="${F('night0')}"/>`;
|
|
221
|
+
[[60, 40], [140, 70], [220, 36], [300, 90], [90, 110]].forEach(([x, y], i) => { g += `<circle class="env-tw${i % 3 ? ' d' + (i % 3 + 1) : ''} ${F('moon')}" cx="${x}" cy="${y}" r="2"/>`; });
|
|
222
|
+
g += `<circle class="env-ff ${F('firefly')}" cx="${W * 0.22}" cy="${gy - 30}" r="3"/><circle class="env-ff d2 ${F('firefly')}" cx="${W * 0.8}" cy="${gy - 50}" r="2.5"/>`;
|
|
223
|
+
}
|
|
224
|
+
if (kind === 'rain') {
|
|
225
|
+
g += `<g class="env-cloud"><ellipse cx="${W / 2 - 8}" cy="40" rx="44" ry="15" class="${F('raincloud')}"/><ellipse cx="${W / 2 + 16}" cy="30" rx="26" ry="16" class="${F('raincloud')}"/></g>`;
|
|
226
|
+
[W / 2 - 30, W / 2, W / 2 + 26].forEach((x, i) => { g += `<path class="env-drop${i ? ' d' + (i + 1) : ''} ${S('drop')}" d="M${x} 56 l0 7" stroke-width="2.4" stroke-linecap="round"/>`; });
|
|
227
|
+
}
|
|
228
|
+
if (kind === 'think') { const cx = W / 2 + adh * 0.42, cy = H - adh - 6; for (let i = 0; i < 3; i++) g += `<circle class="env-dot${i ? ' d' + (i + 1) : ''} ${F('thinkdot')}" cx="${cx + i * 14}" cy="${cy + 18 - i * 6}" r="${4 + i}"/>`; }
|
|
229
|
+
if (kind === 'win') [[W * 0.2, 'leaf2'], [W * 0.35, 'gold'], [W * 0.62, 'leaf2'], [W * 0.78, 'pink'], [W * 0.5, 'gold']].forEach(([x, k], i) => { g += fallLeaf(x, 14, i ? ' d' + (i + 1) : '', k); });
|
|
230
|
+
if (kind !== 'plain') g += `<ellipse cx="${W / 2}" cy="${H + 30}" rx="${W * 0.75}" ry="70" class="${F(kind === 'night' ? 'groundn' : 'ground')}" opacity="${kind === 'night' ? 0.9 : 0.7}"/>` + grass(W * 0.12, gy + 18, 1) + grass(W * 0.86, gy + 14, 0.8, ' d2');
|
|
231
|
+
g += '</g>';
|
|
232
|
+
if (kind === 'night' && m === 'rest') { const zx = W / 2 + adh * 0.25, zy = H - adh + 10; for (let i = 0; i < 3; i++) g += `<text class="env-z${i ? ' d' + (i + 1) : ''} ${F('moon')} ad-z z${i}" x="${zx}" y="${zy}">z</text>`; }
|
|
233
|
+
const aw = Math.round(adh * 200 / 252), x = (W - aw) / 2, y = H - adh - 8, q = nextId();
|
|
234
|
+
g += `<svg x="${x}" y="${y}" width="${aw}" height="${adh}" viewBox="0 0 200 252" overflow="visible" class="am m-${m}" aria-hidden="true">${defs(q)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${q}b)"/><g class="ad-br">${full(m, q, o.prop)}</g></svg>`;
|
|
235
|
+
if (kind === 'tea') { const sc = adh / 252, mx = x + 101 * sc, my = y + 186 * sc; [-6, 0, 6].forEach((dx, i) => { g += `<path class="env-steam${i ? ' d' + (i + 1) : ''} ${S('white')}" d="M${mx + dx} ${my} q -4 -6 0 -12 q 4 -6 0 -12" stroke-width="2.6" fill="none" stroke-linecap="round"/>`; }); }
|
|
236
|
+
return g + '</svg>';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* ── the moods of sentences Claude already says (AdM1-4) ── */
|
|
240
|
+
const HONEST = /\b(not|no longer|couldn[’']?t|could not|can[’']?t|cannot|didn[’']?t|did not|isn[’']?t|wasn[’']?t|won[’']?t|failed|fails|error|broke|stopped|missed|lost|refused|unavailable)\b/i;
|
|
241
|
+
const WORKING = /(…|\.\.\.)\s*$/;
|
|
242
|
+
/** The mood of one sentence: honest when it says something failed, thinking while it runs ("Sending…"), handled otherwise. */
|
|
243
|
+
export function moodOfText(t) {
|
|
244
|
+
const s = String(t || '').trim();
|
|
245
|
+
if (!s) return 'handled';
|
|
246
|
+
if (HONEST.test(s) && !/^(Not now|Undone|No longer at risk)/i.test(s)) return 'honest';
|
|
247
|
+
if (WORKING.test(s)) return 'thinking';
|
|
248
|
+
return 'handled';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Every toast on the page (#toast, #wfToast) carries the S face in the mood of its words. The face is decoration: the words carry it. */
|
|
252
|
+
export function mountToastFaces(doc = typeof document !== 'undefined' ? document : null) {
|
|
253
|
+
if (!doc || typeof MutationObserver === 'undefined' || mountToastFaces.on) return;
|
|
254
|
+
mountToastFaces.on = true;
|
|
255
|
+
addCss();
|
|
256
|
+
const dress = (el) => {
|
|
257
|
+
if (!el.classList.contains('on') || el.querySelector(':scope > .ad-tf')) return;
|
|
258
|
+
const text = [...el.childNodes].filter((n) => !(n.nodeType === 1 && n.matches('button'))).map((n) => n.textContent).join(' ');
|
|
259
|
+
const f = adler(moodOfText(text), 's', { label: false });
|
|
260
|
+
if (!f) return;
|
|
261
|
+
const s = doc.createElement('span'); s.className = 'ad-tf'; s.innerHTML = f; el.prepend(s); el.classList.add('ad-toast');
|
|
262
|
+
};
|
|
263
|
+
const watch = (el) => { if (!el || el.dataset.adWatched) return; el.dataset.adWatched = '1'; new MutationObserver(() => dress(el)).observe(el, { attributes: true, attributeFilter: ['class'], childList: true }); dress(el); };
|
|
264
|
+
const scan = () => ['toast', 'wfToast'].forEach((id) => watch(doc.getElementById(id)));
|
|
265
|
+
scan();
|
|
266
|
+
// a toast host that a page adds later (the shell's #toast is written by script on some pages)
|
|
267
|
+
new MutationObserver(scan).observe(doc.body, { childList: true });
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (typeof document !== 'undefined') addCss();
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
.vzx-aud .aud-sec { width: 100%; height: 100%; overflow: auto; padding: 56px 8vw; background: var(--cz-c-ffffff); color: var(--cz-c-2a2e35); }
|
|
5
5
|
.vzx-aud .aud-sec .vzx-page { margin: 0 auto; font-size: 24px; }
|
|
6
6
|
.vzx-aud .aud-sec .vzx-page h1, .vzx-aud .aud-sec .vzx-page h2, .vzx-aud .aud-sec .vzx-page h3 { font-size: 32px; }
|
|
7
|
-
.vzx-aud .aud-wait { font-size:
|
|
7
|
+
.vzx-aud .aud-wait { font-size: var(--fs-3); color: var(--cz-c-9aa1ab); }
|
|
8
8
|
.vzx-aud .aud-img { max-width: 100%; max-height: 100%; display: block; }
|
|
9
9
|
body.cz.vzx-audw { min-height: 100vh; background: var(--cz-c-17191c); } /* the cozy page ground is light; the audience tab is dark to its edge */
|