create-pmos 0.813.0 → 0.815.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 +41 -45
- 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 +40 -2
- package/workspace/guide/home.md +1 -0
- package/workspace/guide/layout.md +12 -0
- package/workspace/lib/capture-file.js +68 -0
- package/workspace/lib/routes-today-log.js +54 -1
- package/workspace/lib/today-log.js +30 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/ask-here-ctx.js +311 -0
- package/workspace/public/pm/ask-here.css +36 -0
- package/workspace/public/pm/ask-here.js +195 -0
- package/workspace/public/pm/bd-backlog.js +1 -1
- package/workspace/public/pm/cozy-events-view.js +9 -1
- package/workspace/public/pm/cozy-nav.js +2 -0
- package/workspace/public/pm/cozy-today-app.js +45 -0
- package/workspace/public/pm/cozy-today-page.css +1 -0
- package/workspace/public/pm/cozy-today-view.js +21 -5
- package/workspace/public/pm/home-app.js +7 -1
- package/workspace/public/pm/premium-library.js +3 -1
- package/workspace/public/pm/premium-vw-doc.js +1 -1
- package/workspace/public/pm/premium-vw-slides.js +7 -2
- package/workspace/test-lists/ask-anywhere.json +9 -0
- package/workspace/test-lists/capture-to-initiative.json +9 -0
|
@@ -453,6 +453,49 @@ export function mountToday(ctx) {
|
|
|
453
453
|
try { i.showPicker(); } catch { /* the field itself is the chooser */ }
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
+
/* capture-to-initiative (A537): a line PMOS filed by itself is said once, with Undo (Not filed). The chip's press lists where else it
|
|
457
|
+
* could go, the clearest first, and Not filed. Each filing is one captureFiled line in the local use log; a change is captureRefiled. */
|
|
458
|
+
const fileTo = async (key, ws, ini) => {
|
|
459
|
+
const r = await ctx.pmPost('/api/today-log/file', { key, day: day(), ws: ws || null, ini: ini || null }).catch(() => null);
|
|
460
|
+
if (!r || !r.ok) { ctx.toast((r && r.error) || 'Where it is filed did not change.'); return null; }
|
|
461
|
+
const e = X.log.entries.find((x) => x.key === key);
|
|
462
|
+
if (e) { if (r.filed) e.filed = r.filed; else delete e.filed; }
|
|
463
|
+
draw();
|
|
464
|
+
return r;
|
|
465
|
+
};
|
|
466
|
+
function filedSay(key, f) {
|
|
467
|
+
noteUse('captureFiled');
|
|
468
|
+
ctx.toastUndo('Filed to ' + f.title + (f.stage ? ' · ' + f.stage : '') + '.', async () => { const u = await fileTo(key, null, null); return u || { ok: false }; });
|
|
469
|
+
}
|
|
470
|
+
async function chooseFile(r, btn) {
|
|
471
|
+
document.querySelectorAll('.td-dp').forEach((x) => x.remove());
|
|
472
|
+
const cur = r.ref && r.ref.filed;
|
|
473
|
+
const got = await ctx.pmGet('/api/today-log/choices?text=' + encodeURIComponent(r.title || '')).catch(() => null);
|
|
474
|
+
const list = ((got && got.ranked) || []).filter((c) => !(cur && c.ws === cur.ws && c.id === cur.ini));
|
|
475
|
+
const box = document.createElement('div');
|
|
476
|
+
box.className = 'td-dp td-fp'; box.setAttribute('role', 'dialog'); box.setAttribute('aria-label', 'Where this line is filed: ' + r.title);
|
|
477
|
+
box.innerHTML = list.map((c) => `<button type="button" class="pm-btn ghost" data-ws="${TP.esc(c.ws)}" data-ini="${TP.esc(c.id)}">${TP.esc(c.title)}</button>`).join('')
|
|
478
|
+
+ (cur ? '<button type="button" class="pm-btn ghost" data-ini="">Not filed</button>' : '');
|
|
479
|
+
if (!box.innerHTML) { ctx.toast('PMOS found no open initiative to file it to.'); return; }
|
|
480
|
+
document.body.appendChild(box);
|
|
481
|
+
const b = btn.getBoundingClientRect();
|
|
482
|
+
box.style.top = Math.min(innerHeight - box.offsetHeight - 12, b.bottom + 6) + 'px'; box.style.left = Math.max(12, b.right - box.offsetWidth) + 'px';
|
|
483
|
+
const close = () => { box.remove(); removeEventListener('pointerdown', out, true); if (btn.isConnected) btn.focus(); };
|
|
484
|
+
const out = (e) => { if (!box.contains(e.target)) close(); };
|
|
485
|
+
addEventListener('pointerdown', out, true);
|
|
486
|
+
box.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.stopPropagation(); close(); } });
|
|
487
|
+
box.addEventListener('click', async (e) => {
|
|
488
|
+
const c = e.target.closest('button'); if (!c) return;
|
|
489
|
+
close();
|
|
490
|
+
const res = await fileTo(r.key, c.dataset.ws, c.dataset.ini);
|
|
491
|
+
if (!res) return;
|
|
492
|
+
noteUse('captureRefiled');
|
|
493
|
+
const back = cur ? () => fileTo(r.key, cur.ws, cur.ini) : () => fileTo(r.key, null, null);
|
|
494
|
+
ctx.toastUndo(res.filed ? 'Filed to ' + res.filed.title + (res.filed.stage ? ' · ' + res.filed.stage : '') + '.' : 'Not filed.', async () => (await back()) || { ok: false });
|
|
495
|
+
});
|
|
496
|
+
const f = box.querySelector('button'); if (f) f.focus();
|
|
497
|
+
}
|
|
498
|
+
|
|
456
499
|
// j k with any Today row's item open in the popup: the next or previous row opens in its place (↑ ↓ too in the one-mention popup)
|
|
457
500
|
document.addEventListener('keydown', (e) => {
|
|
458
501
|
if (!on() || !X.last || e.metaKey || e.ctrlKey || e.altKey || (e.key !== 'j' && e.key !== 'k')) return;
|
|
@@ -558,6 +601,7 @@ export function mountToday(ctx) {
|
|
|
558
601
|
if (act === 'q-remind') { remindQuestion(r.ref); return; }
|
|
559
602
|
if (act === 'open') { open(r); return; }
|
|
560
603
|
if (act === 'date') { chooseDate(r, b); return; }
|
|
604
|
+
if (act === 'file') { chooseFile(r, b); return; } // capture-to-initiative: the filed chip's change
|
|
561
605
|
if (X.busy.has(key)) return;
|
|
562
606
|
X.busy.add(key); b.disabled = true;
|
|
563
607
|
try {
|
|
@@ -585,6 +629,7 @@ export function mountToday(ctx) {
|
|
|
585
629
|
i.value = '';
|
|
586
630
|
draw();
|
|
587
631
|
const j = document.getElementById('tdCap'); if (j) j.focus();
|
|
632
|
+
if (r.entry.filed) filedSay(r.entry.key, r.entry.filed);
|
|
588
633
|
});
|
|
589
634
|
}
|
|
590
635
|
/* The capture box's mic on a phone (PhoneTodayDS: "type or speak"): the browser's own speech recognition, where it has one, writes the
|
|
@@ -82,6 +82,7 @@ button.td-ev:focus-visible { outline: none; box-shadow: var(--glow); }
|
|
|
82
82
|
/* the date chooser beside a row (set a date) */
|
|
83
83
|
.td-dp { position: fixed; z-index: 80; display: flex; align-items: center; gap: 6px; padding: var(--space-8); border-radius: var(--radius-md); background: var(--card); box-shadow: var(--lift); }
|
|
84
84
|
.td-dp input { font: inherit; color: var(--ink); background: var(--well); border: 0; border-radius: var(--radius-sm); padding: 6px var(--space-8); color-scheme: light dark; }
|
|
85
|
+
.td-fp { flex-direction: column; align-items: stretch; max-height: 50vh; overflow-y: auto; }
|
|
85
86
|
|
|
86
87
|
/* ── Today on a phone (phone design, boards Ph2_today, Ph2_todayzero, Ph2_recdone; pm/cozy-today-view.js phonePageHtml) ──
|
|
87
88
|
* One column on the white page, a 16 px gutter, no cards and no boxes: hairlines between the parts. Home's list is not drawn on today.html;
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
|
|
19
19
|
import { dashModel as lineDash, dashHtml as lineDashHtml } from './line-view.js'; // quiet-rows-line: Your move ends with the line's dashed line
|
|
20
20
|
import { groupsHtml as questionGroups, phoneGroupsHtml as phoneQuestionGroups } from './open-questions-view.js'; // open-questions-today (A420)
|
|
21
|
+
|
|
22
|
+
/** What a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself. */
|
|
23
|
+
function askOf(r) {
|
|
24
|
+
if (r.ini) return ` data-ask="initiative:${esc(r.ini)}" data-ask-title="${esc(r.work || r.ini)}"${r.ws ? ` data-ask-ws="${esc(r.ws)}"` : ''}`;
|
|
25
|
+
return ` data-ask="today item:${esc(r.key)}" data-ask-title="${esc(r.title || r.text || '')}"`;
|
|
26
|
+
}
|
|
21
27
|
export const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
22
28
|
const svg = (d, w = 15, sw = 1.9) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
|
|
23
29
|
/** The system's icon (pm-ic: stroke, size and caps come from the part). */
|
|
@@ -81,13 +87,13 @@ export function rowHtml(r, o = {}) {
|
|
|
81
87
|
const title = opens ? `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(t)}${r.members ? ic(I.more, 14) : ''}</button>` : `<span class="t td-t">${esc(t)}</span>`;
|
|
82
88
|
const first = r.first && !r.done && r.src === 'own' ? '<span class="pm-badge blue">First</span>' : '';
|
|
83
89
|
// capture-words-to-fields: what the words gave, as chips, with the one press that takes the reading off
|
|
84
|
-
const chips = readChips(r);
|
|
90
|
+
const chips = readChips(r) + fileChip(r);
|
|
85
91
|
// what PMOS did on it, from records (round 3 point 13): a small ✦ with the count; its words on hover and for a screen reader
|
|
86
92
|
const did = r.did && r.did.length && !r.done ? `<span class="td-did" title="${esc('PMOS did: ' + r.did.join('; '))}" aria-label="${esc('PMOS did: ' + r.did.join('; '))}"><b aria-hidden="true">✦</b>${r.did.length}</span>` : '';
|
|
87
93
|
const why = r.member ? '' : whyLine(r);
|
|
88
94
|
const w = why || did ? `<span class="w td-rs">${did}${esc(why)}</span>` : '';
|
|
89
95
|
const late = lateOf(r);
|
|
90
|
-
const row = `<div class="${cls}" data-key="${esc(r.key)}"><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
|
|
96
|
+
const row = `<div class="${cls}" data-key="${esc(r.key)}"${askOf(r)}><span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${w}</span>`
|
|
91
97
|
+ `${first}${chips}${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}${acts ? `<span class="acts td-a">${acts}</span>` : ''}</div>`;
|
|
92
98
|
const sug = r.drop ? sugHtml('PMOS suggests: drop it from your log.', ['drop', 'Drop it'], ['keep', 'Keep it'], r.key) : '';
|
|
93
99
|
const lk = r.looks && !r.done ? sugHtml('Looks answered: ' + (r.looks.who ? r.looks.who + ' replied' : 'someone replied') + ' “' + r.looks.text + '”. Close it?', ['lk-yes', 'Yes, close it: it is answered'], ['lk-no', 'No, it still waits on me'], r.key) : '';
|
|
@@ -113,6 +119,16 @@ function readChips(r) {
|
|
|
113
119
|
+ ib('plain', 'Undo what PMOS read: keep the line as you typed it', I.undo, r.key, '', 'outline') + '</span>';
|
|
114
120
|
}
|
|
115
121
|
|
|
122
|
+
/** capture-to-initiative: where PMOS filed a line you typed, as a chip (the initiative and its stage), with the one press that changes it
|
|
123
|
+
* (another initiative, or Not filed). '' for a line not filed. r.ref.filed: lib/today-log.js filedOf. */
|
|
124
|
+
export function fileChip(r) {
|
|
125
|
+
const f = r && r.src === 'own' && !r.done && r.ref && r.ref.filed;
|
|
126
|
+
if (!f || !f.ini) return '';
|
|
127
|
+
const say = '↳ ' + f.title + (f.stage ? ' · ' + f.stage : '');
|
|
128
|
+
return `<span class="td-rd td-fl" role="group" aria-label="${esc('Filed to ' + f.title + (f.stage ? ', ' + f.stage : ''))}"><span class="pm-badge">${esc(say)}</span>`
|
|
129
|
+
+ ib('file', 'Change where this line is filed', I.more, r.key, ' aria-haspopup="dialog"', 'outline') + '</span>';
|
|
130
|
+
}
|
|
131
|
+
|
|
116
132
|
/** A tracker sync Suggestion (tracker-sync-on-today, board TrackerSyncDesk): ✓ takes Jira's value on all, ✕ keeps PMOS's, the arrow opens
|
|
117
133
|
* the differences, each with its own ✓. x: cozy-today-model.js syncSuggest()[i]. */
|
|
118
134
|
function syncHtml(x) {
|
|
@@ -132,7 +148,7 @@ export function overviewHtml(O) {
|
|
|
132
148
|
let said = esc(O.said || '');
|
|
133
149
|
for (const x of O.refs || []) {
|
|
134
150
|
const t = esc(x.text), at = said.indexOf(t);
|
|
135
|
-
if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}">${t}</button>` + said.slice(at + t.length);
|
|
151
|
+
if (at >= 0) said = said.slice(0, at) + `<button type="button" class="td-ln" data-td="open" data-key="${esc(x.key)}"${askOf(x)}>${t}</button>` + said.slice(at + t.length);
|
|
136
152
|
}
|
|
137
153
|
const sug = (O.suggest || []).map((x) => (x.act === 'sync' ? syncHtml(x) : sugHtml(x.text, ['ov-yes', x.text], ['ov-no', 'Keep them: ' + x.text], x.key, 'td-ovs'))).join('');
|
|
138
154
|
return `<section class="td-ov pm-block" aria-label="Overview"><h2 class="pm-h-sm pm-row">${ic(I.spark, 16, 'pm-star')}Overview</h2>${said ? `<p>${said}</p>` : ''}${sug}</section>`;
|
|
@@ -161,7 +177,7 @@ export function moveRowHtml(r, n, o = {}) {
|
|
|
161
177
|
// what the PM typed opens nothing: its words are the whole of it
|
|
162
178
|
const title = r.src === 'own' ? `<span class="t td-t">${esc(r.title)}</span>`
|
|
163
179
|
: `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? ic(I.more, 14) : ''}</button>`;
|
|
164
|
-
return `<div class="td-li pm-li ym-r${n === 1 ? ' now' : ''}" data-key="${esc(r.key)}"><span class="ym-n pm-meta" aria-hidden="true">${n}</span>`
|
|
180
|
+
return `<div class="td-li pm-li ym-r${n === 1 ? ' now' : ''}" data-key="${esc(r.key)}"${askOf(r)}><span class="ym-n pm-meta" aria-hidden="true">${n}</span>`
|
|
165
181
|
+ `<span class="td-kind" role="img" aria-label="${esc(kl)}">${ic(kd)}</span><span class="txt">${title}${meta ? `<span class="w td-rs">${esc(meta)}</span>` : ''}`
|
|
166
182
|
+ `<span class="w td-rs ym-why">${ic(I.spark, 13, 'pm-star')}${esc(r.why || '')}</span></span>${late ? `<span class="pm-badge alert">${esc(late)}</span>` : ''}`
|
|
167
183
|
+ `<span class="acts td-a">${moveAct(r)}${ib('tomorrow', 'Put off a day: ' + r.title, I.tomorrow, r.key)}</span></div>`
|
|
@@ -335,7 +351,7 @@ export function phoneRowHtml(r, o = {}) {
|
|
|
335
351
|
: fx ? `<span class="tdp-pro">${svg(PI.spark, 13, 1.9)}<span>${esc(fx)}</span></span>` : '';
|
|
336
352
|
const dot = rowDot(r, o), dl = r.done ? 'Done' : dot === 'alert' ? 'Late' : dot === 'blue' ? 'For today' : 'Can wait';
|
|
337
353
|
const say = sw.right ? ` aria-describedby="tdpHint"` : '';
|
|
338
|
-
return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
|
|
354
|
+
return `<li class="tdp-r${r.done ? ' done' : ''}${r.first && !r.done ? ' first' : ''}" data-key="${esc(r.key)}"${askOf(r)}${sw.right ? ` data-sw-right="${sw.right}"` : ''}${sw.left ? ` data-sw-left="${sw.left}"` : ''}${say}>`
|
|
339
355
|
+ (r.done ? `<span class="tdp-b" role="img" aria-label="Done">${svg(I.done, 13, 2)}</span>` : `<i class="tdp-dot ${dot}" role="img" aria-label="${dl}"></i>`)
|
|
340
356
|
+ `<div class="tdp-x">${title}${meta ? `<small class="tdp-m">${meta}</small>` : ''}${fix}</div></li>`;
|
|
341
357
|
}
|
|
@@ -350,13 +350,19 @@ function tileHtml(r) {
|
|
|
350
350
|
if (r.kind === 'update') return `<span class="hm-tile">${SVG(I.doc, 14)}</span>`;
|
|
351
351
|
return `<span class="hm-tile">${SVG(ROW_ICON[r.icon] || I.chat, 14)}</span>`;
|
|
352
352
|
}
|
|
353
|
+
// what a right-click on a Today row names (initiative ask-anywhere): its initiative when it has one, else the row itself
|
|
354
|
+
function askOf(r) {
|
|
355
|
+
const ir = r.ini && r.ini !== 'product' ? iniRowOf(r.ini) : null;
|
|
356
|
+
if (ir) return ` data-ask="initiative:${esc(r.ini)}" data-ask-title="${esc(ir.title || r.ini)}"${r.ws ? ` data-ask-ws="${esc(r.ws)}"` : ''}`;
|
|
357
|
+
return ` data-ask="today item:${esc(r.id)}" data-ask-title="${esc(r.name || '')}"`;
|
|
358
|
+
}
|
|
353
359
|
function rowHtml(r, o = {}) {
|
|
354
360
|
const sel = S.sel === r.id;
|
|
355
361
|
const end = r.kind === 'session' && r.sid ? `<button type="button" class="hm-x" data-hm-end="${esc(r.id)}" aria-label="End ${esc(r.name)}" title="End this session">${SVG(I.x, 14, 2)}</button>`
|
|
356
362
|
: r.kind === 'need' && r.row ? `<button type="button" class="hm-x" data-hm-end="${esc(r.id)}" aria-label="Put off ${esc(r.name)} until tomorrow" title="Put off until tomorrow">${SVG(I.x, 14, 2)}</button>` : '';
|
|
357
363
|
const chip = r.chip ? `<button type="button" class="hm-kc${r.chip.loud ? ' loud' : ''}" data-hm-kids="${esc(r.id)}" aria-expanded="${S.kids.has(r.id)}" aria-label="${esc(r.chip.text)} in ${esc(r.name)}. Show">${esc(r.chip.text)}${SVG(S.kids.has(r.id) ? I.down : I.chev, 12, 2.2)}</button>` : '';
|
|
358
364
|
const kids = r.kids && S.kids.has(r.id) ? `<div class="hm-kids" role="group" aria-label="In ${esc(r.name)}">${r.kids.map((k) => rowHtml(k, { kid: true })).join('') || '<p class="hm-none">Nothing here now.</p>'}</div>` : '';
|
|
359
|
-
return `<div class="hm-r${sel ? ' sel' : ''}${o.kid ? ' kid' : ''} st-${esc(r.state)}" data-id="${esc(r.id)}">`
|
|
365
|
+
return `<div class="hm-r${sel ? ' sel' : ''}${o.kid ? ' kid' : ''} st-${esc(r.state)}" data-id="${esc(r.id)}"${askOf(r)}>`
|
|
360
366
|
+ `<button type="button" class="hm-rm" data-hm-sel="${esc(r.id)}"${sel ? ' aria-current="true"' : ''}><i class="hm-dot ${dotCls(r.state)}" aria-hidden="true"></i>${tileHtml(r)}`
|
|
361
367
|
+ `<span class="hm-rt"><b>${r.kind === 'ini' ? SM.nameHtml(r.board, r.name) : esc(r.name)}</b><em>${esc(r.hint || '')}</em></span></button>${chip}${end}</div>${kids}`;
|
|
362
368
|
}
|
|
@@ -39,6 +39,8 @@ const ICON = {
|
|
|
39
39
|
proto: 'M4 5h16v12H4zM9 20h6',
|
|
40
40
|
checks: 'M4 6.5l2 2 3.5-3.5M4 13.5l2 2 3.5-3.5M13 7h7M13 14h7M13 19h7',
|
|
41
41
|
};
|
|
42
|
+
// what a right-click on a row names (initiative ask-anywhere): the item, in plain words
|
|
43
|
+
const ASK_KIND = { meeting: 'meeting note', link: 'link', proto: 'prototype', checks: 'checklist' };
|
|
42
44
|
const PEN = 'M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17zM13.5 6.5l3 3', CLEAR = 'M4 6h16M7 12h10M10 18h4', RELOAD = 'M20 12a8 8 0 1 1-2.3-5.7M20 4v5h-5';
|
|
43
45
|
const CHEV_D = 'M6 9l6 6 6-6', CHEV_R = 'M9 6l6 6-6 6', TICK = 'M5 12.5l4.5 4.5L19 7.5', X = 'M6 6l12 12M18 6L6 18', PART = 'M7 12h10';
|
|
44
46
|
const SPARK = 'M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z', OPEN = 'M14 4h6v6M20 4l-9 9M18 14v5H5V6h5';
|
|
@@ -219,7 +221,7 @@ function rowHtml(r, i, sub = false, shelf = '') {
|
|
|
219
221
|
if (!aboutText(x) && x.kind === 'meeting' && x.suggest) {
|
|
220
222
|
why += ` · <button type="button" class="lb-sg" data-lb-link="${esc(x.id)}" title="PMOS suggests: this note is about ${esc(x.suggest.title)}. Press to link it">${svg(SPARK, 'pm-star')}<span>${esc(x.suggest.title)}?</span></button>`;
|
|
221
223
|
}
|
|
222
|
-
return `<div class="pm-li lb-i${sub ? ' nest' : ''}${S.pick === x.id ? ' now' : ''}" role="listitem" data-lb-i="${i}" aria-label="${esc(label)}">`
|
|
224
|
+
return `<div class="pm-li lb-i${sub ? ' nest' : ''}${S.pick === x.id ? ' now' : ''}" role="listitem" data-lb-i="${i}" data-ask="${ASK_KIND[x.kind] || 'document'}:${esc(x.path || x.id)}" data-ask-title="${esc(x.name)}" aria-label="${esc(label)}">`
|
|
223
225
|
+ `<span class="pm-meta lb-mi">${svg(ICON[x.kind] || ICON.doc)}</span>`
|
|
224
226
|
+ `<span class="txt">${nameHtml(shown, older)}<span class="w">${why}</span></span>${badge(r)}${actsHtml(x)}</div>`;
|
|
225
227
|
}
|
|
@@ -327,7 +327,7 @@ function makePage(d, ctx) {
|
|
|
327
327
|
if (!el || !el.isConnected) return;
|
|
328
328
|
const keepScroll = el.scrollTop;
|
|
329
329
|
const reading = P.mode === 'read' && !ctx.host && P.text != null && !P.err && !openProp();
|
|
330
|
-
el.innerHTML = `<div class="vwdoc${reading ? ' rdw pm-reads' : ''}">${pageHtml()}</div>`;
|
|
330
|
+
el.innerHTML = `<div class="vwdoc${reading ? ' rdw pm-reads' : ''}" data-ask="document:${esc(d.path)}" data-ask-title="${esc(d.title || String(d.path).split('/').pop())}"${baseWs() ? ` data-ask-ws="${esc(baseWs())}"` : ''}>${pageHtml()}</div>`;
|
|
331
331
|
el.scrollTop = keepScroll;
|
|
332
332
|
if (reading) wireReading(el, el, d.path); else if (P.mode === 'read') tocOf();
|
|
333
333
|
if (P.mode === 'edit') startEdit();
|
|
@@ -41,10 +41,12 @@ function chartSvg(e) {
|
|
|
41
41
|
if (e.kind === 'line') {
|
|
42
42
|
const P = d.map((x, i) => [bw * i + bw / 2, Y(+x[1] || 0)]);
|
|
43
43
|
g += `<polyline class="sl-line" points="${P.map((p) => p.join(',')).join(' ')}"/>` + P.map((p, i) => `<circle class="sl-pt" cx="${p[0]}" cy="${p[1]}" r="8"/>${lab(p[0], p[1] - 16, d[i][1])}`).join('');
|
|
44
|
-
} else g += d.map((x, i) => { const y = Y(+x[1] || 0); return `<rect class="sl-bar${i === d.length - 1 ? ' last' : ''}" x="${bw * i + bw * 0.17}" y="${y}" width="${bw * 0.66}" height="${Math.max(0, h - B - y)}" rx="6"/>${lab(bw * i + bw / 2, y - 10, x[1])}`; }).join('');
|
|
44
|
+
} else g += d.map((x, i) => { const y = Y(+x[1] || 0); return `<rect class="sl-bar${i === d.length - 1 ? ' last' : ''}" data-ask-field="Chart bar" aria-label="${esc(x[0] + ' · ' + x[1])}" x="${bw * i + bw * 0.17}" y="${y}" width="${bw * 0.66}" height="${Math.max(0, h - B - y)}" rx="6"/>${lab(bw * i + bw / 2, y - 10, x[1])}`; }).join('');
|
|
45
45
|
g += d.map((x, i) => `<text class="sl-axl" x="${bw * i + bw / 2}" y="${h - 8}" text-anchor="middle">${esc(x[0])}</text>`).join('');
|
|
46
46
|
return `<svg viewBox="0 0 ${w} ${h}" role="img" aria-label="${esc((e.kind === 'line' ? 'Line' : 'Bar') + ' chart: ' + d.map((x) => x[0] + ' ' + x[1]).join(', '))}">${g}</svg>`;
|
|
47
47
|
}
|
|
48
|
+
// what a right-click on a part of a slide names (initiative ask-anywhere)
|
|
49
|
+
const PART = { title: 'Title', text: 'Text', chart: 'Chart', table: 'Table', img: 'Image' };
|
|
48
50
|
function elHtml(e, ws, edit) {
|
|
49
51
|
const inner = e.t === 'text' ? `<div class="sl-tx">${e.html}</div>`
|
|
50
52
|
: e.t === 'chart' ? chartSvg(e)
|
|
@@ -52,7 +54,7 @@ function elHtml(e, ws, edit) {
|
|
|
52
54
|
: e.t === 'img' ? (e.src ? `<img src="${esc(asset(ws, e.src))}" alt="${esc(e.alt || '')}" data-src="${esc(e.src)}">` : `<div class="sl-ph">${I('img')}<span>${edit ? 'Double-click to choose an image' : 'No image'}</span></div>`)
|
|
53
55
|
: `<div class="sl-sh f-${e.fill || 'acc'}${e.round ? ' dot' : ''}"></div>`;
|
|
54
56
|
const cls = `sl-it t-${e.t}${e.role ? ' r-' + e.role : ''}${e.align && e.align !== 'left' ? ' a-' + e.align : ''}${e.color ? ' c-' + e.color : ''}`;
|
|
55
|
-
return `<div class="${cls}" data-id="${e.id || ''}" data-g="${e.x},${e.y},${e.w},${e.h}">${inner}${edit ? ['nw', 'ne', 'sw', 'se'].map((h) => `<i class="sl-hdot h-${h}" data-h="${h}"></i>`).join('') : ''}</div>`;
|
|
57
|
+
return `<div class="${cls}" data-id="${e.id || ''}" data-ask-field="${PART[e.t === 'text' && e.k === 'title' ? 'title' : e.t] || 'Shape'}" data-g="${e.x},${e.y},${e.w},${e.h}">${inner}${edit ? ['nw', 'ne', 'sw', 'se'].map((h) => `<i class="sl-hdot h-${h}" data-h="${h}"></i>`).join('') : ''}</div>`;
|
|
56
58
|
}
|
|
57
59
|
export function slideHtml(s, theme, ws, edit) {
|
|
58
60
|
return `<div class="sl-cv${edit ? ' ed' : ''}" data-th="${esc(theme)}">${s.els.map((e) => elHtml(e, ws, edit)).join('')}${edit ? '<i class="sl-guide gv"></i><i class="sl-guide gh"></i>' : ''}</div>`;
|
|
@@ -273,6 +275,9 @@ const railName = (s, k) => { const t = s.els.find((e) => e.t === 'text' && e.k =
|
|
|
273
275
|
function drawStage(S) {
|
|
274
276
|
const st = S.$('.sl-stage');
|
|
275
277
|
st.innerHTML = slideHtml(cur(S), S.deck.theme, S.ws, !S.ro);
|
|
278
|
+
// the slide is the record a right-click names (initiative ask-anywhere): the deck's path and the slide's number
|
|
279
|
+
st.dataset.ask = 'slide:' + S.path + '#' + (S.i + 1); st.dataset.askTitle = String(S.path).split('/').pop() + ' · slide ' + (S.i + 1);
|
|
280
|
+
if (S.ws) st.dataset.askWs = S.ws;
|
|
276
281
|
fit(st); place(st);
|
|
277
282
|
if (S.sel) { const n = node(S, S.sel); if (n) n.classList.add('sel'); else S.sel = null; }
|
|
278
283
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Ask PMOS about anything you click (initiative ask-anywhere, A528, done test planning/done-tests/ask-anywhere.md R1-R3): pm/ask-here-ctx.js names the pressed record, field and value on a fake tree, steps out with ↑, and hands page-chat.js itemTarget the facts. No server, network or browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"ask-here.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"ask-here.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "A typed Today line filed to its initiative (initiative capture-to-initiative, done test C1-C5, N1-N3): the pure pick, the fold, the page's chip and picker, and the add/file/choices routes on a scratch server. No browser, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"capture-file.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"capture-file.test.js": 25
|
|
8
|
+
}
|
|
9
|
+
}
|