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.
@@ -0,0 +1,311 @@
1
+ /* pm/ask-here-ctx.js — what the PM pressed, in PMOS's words (initiative ask-anywhere, A528). Pure: it reads only an element's attributes,
2
+ * tag, text and parents, so Node tests it on a small fake tree (ask-here.test.js) and the page runs it on the real one.
3
+ *
4
+ * resolve(el, { scope?, page? }) → ctx | null
5
+ * ctx = { page, section, record: { kind, id, title, via } | null, field, value, control, at }
6
+ * page 'Work · Lendly · Initiatives' the page's words (the caller passes them; pageWords() reads the document)
7
+ * section 'Initiatives' the nearest labelled block
8
+ * record the nearest thing with an id: a stamped data-ask="kind:id" first, then the ids the pages already write
9
+ * (data-wkopen, data-gl-kr …), then an id inside the same row, then scope (the open popup's or Viewer's item)
10
+ * field 'Next milestone' the column, the label, data-ask-field, or the chart part
11
+ * value 'Beta to 5% of users' what the element shows (its label for an icon button)
12
+ * at 'paragraph 2' | 'slide 4' a place inside a document or a deck (data-ask-at)
13
+ * widen(ctx) → ctx one level out: field → record → section → page (↑ on the Ask card); null at the page
14
+ * level(ctx) → 'field' | 'record' | 'section' | 'page'
15
+ * target(ctx) → { id, kind, title, subject, say, facts } for page-chat.js itemTarget, or null at section/page level
16
+ * crumbs(ctx) → [record words, field words] the card's top line shows
17
+ *
18
+ * The proof (A528, /mnt/project-files/ask-anywhere/proof/README.md) found the screen alone names the record on 15–32% of clicks, so the
19
+ * renderers stamp data-ask; the attribute table below is the floor for anything not stamped yet. */
20
+
21
+ /** Attributes that carry a record's id, in the order they are tried at one element. kind null: the value says it ("task:T-12"). */
22
+ export const IDS = [
23
+ ['data-ask', null],
24
+ ['data-wkopen', 'initiative'], ['data-wkstage', 'initiative'], ['data-wkbar', 'initiative'], ['data-line-ini', 'initiative'],
25
+ ['data-gl-ini', 'initiative'], ['data-gl-link', 'initiative'], ['data-gl-kr', 'key result'],
26
+ ['data-hm-prodopen', 'product'], ['data-po-id', 'product'],
27
+ ['data-key', null], ['data-id', null],
28
+ ];
29
+ /** "prefix:id" values: the prefix names the kind. Anything else in data-key / data-id is not trusted as an id. */
30
+ export const PREFIX = {
31
+ board: 'initiative', init: 'initiative', ini: 'initiative', initiative: 'initiative', task: 'task', pop: null, ms: 'milestone', milestone: 'milestone',
32
+ p: 'product', product: 'product', prog: 'program', program: 'program', doc: 'document', document: 'document', kr: 'key result', goal: 'goal',
33
+ jira: 'ticket', ticket: 'ticket', mtg: 'meeting', meeting: 'meeting', ev: 'event', event: 'event', slide: 'slide', deck: 'deck',
34
+ };
35
+ const ROW_TAGS = new Set(['TR', 'LI', 'ARTICLE']);
36
+ const ROW_ROLES = new Set(['row', 'listitem', 'article']);
37
+ const SECTION_TAGS = new Set(['SECTION', 'ARTICLE', 'ASIDE', 'DIALOG', 'TABLE', 'NAV', 'MAIN']);
38
+ const CONTROL_TAGS = new Set(['BUTTON', 'A', 'SELECT', 'INPUT', 'TEXTAREA']);
39
+
40
+ const clean = (s) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim();
41
+ const clip = (s, n = 90) => { const t = clean(s); return t.length > n ? t.slice(0, n - 1) + '…' : t; };
42
+ const attr = (n, k) => (n && typeof n.getAttribute === 'function' ? n.getAttribute(k) : null);
43
+ const tag = (n) => String((n && n.tagName) || '').toUpperCase();
44
+ const up = (n) => (n && n.parentElement) || null;
45
+ const kids = (n) => (n && n.children ? Array.from(n.children) : []);
46
+ const text = (n) => clean(n && n.textContent);
47
+ const isRow = (n) => ROW_TAGS.has(tag(n)) || ROW_ROLES.has(attr(n, 'role')) || / pm-li /.test(' ' + (attr(n, 'class') || '') + ' ');
48
+ const isTop = (n) => !n || tag(n) === 'BODY' || tag(n) === 'HTML';
49
+
50
+ /** The record an id attribute names, or null. */
51
+ export function idOf(name, kind, v) {
52
+ const s = clean(v);
53
+ if (s.length < 2) return null;
54
+ if (name === 'data-ask') { // the stamp: "kind:id", the kind in plain words ("key result:o1::kr2"); a known short prefix is read as its kind
55
+ const i = s.indexOf(':'); if (i < 1 || i === s.length - 1) return null;
56
+ const k = s.slice(0, i).trim().toLowerCase();
57
+ return { kind: PREFIX[k] || k, id: s.slice(i + 1) };
58
+ }
59
+ const m = /^([a-z][a-z-]*):(.+)$/i.exec(s);
60
+ if (m && Object.prototype.hasOwnProperty.call(PREFIX, m[1].toLowerCase())) {
61
+ const k = PREFIX[m[1].toLowerCase()];
62
+ if (k === null) return idOf(name, kind, m[2]); // pop:task:T-1 → task:T-1
63
+ return { kind: kind || k, id: m[2] };
64
+ }
65
+ if (kind) return { kind, id: s };
66
+ if (/^[A-Z][A-Z0-9]{1,9}-\d{1,6}$/.test(s)) return { kind: 'ticket', id: s };
67
+ return null;
68
+ }
69
+ /** The record one element carries itself, or null. */
70
+ export function idAt(n) {
71
+ for (const [name, kind] of IDS) {
72
+ const v = attr(n, name); if (v == null) continue;
73
+ const r = idOf(name, kind, v); if (r) return { ...r, via: name };
74
+ }
75
+ return null;
76
+ }
77
+ function findIn(n, depth = 0) { // an id on something inside a row (the Line writes it on the name button, not the row)
78
+ if (depth > 6) return null;
79
+ for (const c of kids(n)) { const r = idAt(c) || findIn(c, depth + 1); if (r) return r; }
80
+ return null;
81
+ }
82
+ function titleOf(n) {
83
+ const named = attr(n, 'data-ask-title') || attr(n, 'aria-label');
84
+ if (named) return clip(named, 80);
85
+ const walk = (x, d) => { // the first strong-looking child: a link, a heading, a name button
86
+ for (const c of kids(x)) {
87
+ if (/^(A|BUTTON|H1|H2|H3|H4|STRONG|B|TH)$/.test(tag(c)) && text(c)) return text(c);
88
+ const r = d < 4 ? walk(c, d + 1) : ''; if (r) return r;
89
+ }
90
+ return '';
91
+ };
92
+ return clip(walk(n, 0) || text(n), 80);
93
+ }
94
+ function labelOf(n) {
95
+ const l = attr(n, 'aria-label');
96
+ if (l) return clean(l);
97
+ const by = attr(n, 'aria-labelledby');
98
+ if (by && n.ownerDocument && n.ownerDocument.getElementById) { const h = n.ownerDocument.getElementById(by.split(/\s+/)[0]); if (h) return text(h); }
99
+ const walk = (x, d) => { for (const c of kids(x)) { if (/^H[1-4]$/.test(tag(c)) || tag(c) === 'CAPTION') return text(c); const r = d < 2 ? walk(c, d + 1) : ''; if (r) return r; } return ''; };
100
+ return walk(n, 0);
101
+ }
102
+ /** The column header above a table cell: the th at the same index in the table's head row. */
103
+ function headerOf(td) {
104
+ const tr = up(td); if (!tr) return '';
105
+ const i = kids(tr).indexOf(td);
106
+ let t = up(tr); while (t && tag(t) !== 'TABLE') t = up(t);
107
+ if (!t) return '';
108
+ const head = kids(t).find((c) => tag(c) === 'THEAD');
109
+ const row = head && kids(head).find((c) => tag(c) === 'TR');
110
+ const th = row && kids(row)[i];
111
+ return th ? text(th) : '';
112
+ }
113
+ function fieldAt(n) {
114
+ const f = attr(n, 'data-ask-field'); if (f) return clean(f);
115
+ if (tag(n) === 'TD') return headerOf(n);
116
+ if (tag(n) === 'DD') { let p = n.previousElementSibling; if (p && tag(p) === 'DT') return text(p); }
117
+ if (tag(n) === 'LABEL') return clip(text(n), 40);
118
+ if (attr(n, 'data-wkstage')) return 'Stage';
119
+ if (attr(n, 'data-wkbar')) return 'Timeline';
120
+ return '';
121
+ }
122
+
123
+ /** Where a press sits inside a document that has no data-ask-at: the heading above it and its paragraph number under that heading
124
+ * ("Risks · paragraph 2"). Only blocks are counted, so the place stays the same when the words inside change. */
125
+ const BLOCK = new Set(['P', 'LI', 'BLOCKQUOTE', 'PRE', 'TABLE', 'FIGURE', 'UL', 'OL']);
126
+ const HEAD = /^H[1-6]$/;
127
+ const BLOCK_WORD = { P: 'paragraph', LI: 'list item', BLOCKQUOTE: 'quote', PRE: 'code', TABLE: 'table', FIGURE: 'figure', UL: 'list', OL: 'list' };
128
+ export function placeOf(el, root) {
129
+ let b = el;
130
+ while (b && b !== root && !BLOCK.has(tag(b)) && !HEAD.test(tag(b))) b = up(b);
131
+ if (!b || b === root) return '';
132
+ if (HEAD.test(tag(b))) return clip(text(b), 60);
133
+ let item = 0;
134
+ if (tag(b) === 'LI') { const l = up(b); item = kids(l).indexOf(b) + 1; b = l; }
135
+ while (up(b) && up(b) !== root && !kids(up(b)).some((k) => HEAD.test(tag(k)))) b = up(b); // climb to the level the headings sit on
136
+ let n = 0, head = '';
137
+ for (let p = b; p; p = p.previousElementSibling) {
138
+ if (HEAD.test(tag(p))) { head = clip(text(p), 50); break; }
139
+ if (BLOCK.has(tag(p)) && (p === b || tag(p) === tag(b))) n++;
140
+ }
141
+ const word = item ? 'list item' : BLOCK_WORD[tag(b)] || 'paragraph';
142
+ return [head, `${word} ${item || n}`].filter(Boolean).join(' · ');
143
+ }
144
+ /** What the PM pressed. scope: { kind, id, title } of the popup or Viewer the element sits in (the caller finds it). */
145
+ export function resolve(el, o = {}) {
146
+ if (!el || isTop(el)) return null;
147
+ let record = null, field = '', section = '', control = '', at = '', rowAt = null;
148
+ for (let n = el; n && !isTop(n); n = up(n)) {
149
+ if (!control && CONTROL_TAGS.has(tag(n))) control = clip(attr(n, 'aria-label') || attr(n, 'title') || text(n) || attr(n, 'placeholder'), 60);
150
+ if (!field) field = fieldAt(n);
151
+ if (!at) at = clean(attr(n, 'data-ask-at'));
152
+ if (!record) {
153
+ const r = idAt(n);
154
+ if (r) record = { ...r, title: titleOf(n) };
155
+ else if (isRow(n) && !rowAt) { const r2 = findIn(n); if (r2) record = { ...r2, via: r2.via + ' (row)', title: titleOf(n) }; rowAt = n; }
156
+ }
157
+ if (!section && (SECTION_TAGS.has(tag(n)) || /^(region|dialog)$/.test(attr(n, 'role') || ''))) section = clip(labelOf(n), 60);
158
+ if (record && section) break;
159
+ }
160
+ if (!at && record && /^(document|meeting note)$/.test(record.kind)) {
161
+ let root = el; while (root && !isTop(root) && attr(root, 'data-ask') == null) root = up(root);
162
+ if (root && !isTop(root)) at = placeOf(el, root);
163
+ }
164
+ if (!record && o.scope && o.scope.id) record = { kind: clean(o.scope.kind).toLowerCase() || 'item', id: String(o.scope.id), title: clip(o.scope.title || '', 80), via: 'scope' };
165
+ const value = clip(attr(el, 'aria-label') || attr(el, 'title') || text(el) || (el.value || ''), 120);
166
+ return { page: clean(o.page || ''), section, record, field: clean(field), value, control, at };
167
+ }
168
+ export function level(c) { return !c ? 'page' : c.record && (c.field || c.at) ? 'field' : c.record ? 'record' : c.section ? 'section' : 'page'; }
169
+ /** One level out. */
170
+ export function widen(c) {
171
+ const l = level(c);
172
+ if (l === 'field') return { ...c, field: '', at: '', value: c.record.title || c.value };
173
+ if (l === 'record') return { ...c, record: null, field: '', at: '', value: '' };
174
+ if (l === 'section') return { ...c, section: '', record: null, field: '', at: '', value: '' };
175
+ return null;
176
+ }
177
+ /** The card's top line: the record, then the field and its value (or the place in a document). */
178
+ export function crumbs(c) {
179
+ const l = level(c);
180
+ if (l === 'page') return [c.page || 'This page'];
181
+ if (l === 'section') return [c.section];
182
+ const rec = c.record.title || c.record.id;
183
+ if (l === 'record') return [rec];
184
+ const v = c.value && c.value !== rec ? c.value : '';
185
+ return [rec, [c.field || c.at, v].filter(Boolean).join(' · ')];
186
+ }
187
+ /** The chat target's item (page-chat.js itemTarget): its own conversation per record, with what was pressed as facts. */
188
+ export function target(c) {
189
+ const l = level(c);
190
+ if (l === 'page' || l === 'section') return null;
191
+ const facts = [['Kind', c.record.kind], ['Id', c.record.id], ['Page', c.page], ['Section', c.section]];
192
+ if (l === 'field') { if (c.field) facts.push(['Field', c.field]); if (c.at) facts.push(['Place', c.at]); facts.push(['Shows', c.value]); }
193
+ const subject = l === 'field' ? [c.field || c.at, c.value].filter(Boolean).join(': ') : '';
194
+ return {
195
+ id: c.record.id, kind: c.record.kind.replace(/\s+/g, '-'), title: c.record.title || c.record.id, subject,
196
+ say: 'The PM pressed ' + (l === 'field' ? (c.field || c.at || 'part') + ' of ' : '') + 'the ' + c.record.kind + ' "' + (c.record.title || c.record.id) + '" on ' + (c.page || 'this page') + '. Read that record with pmos before you answer.',
197
+ facts: facts.filter((f) => clean(f[1])),
198
+ };
199
+ }
200
+ /** The words for the chat when nothing narrower than a section or the page was pressed. */
201
+ export function hereWords(c) { return [c && c.page, c && c.section].filter(Boolean).join(' · '); }
202
+
203
+ /* ── the card's ✦ questions and its one picker (done test R4). Questions are things PMOS answers from records; a change is offered only
204
+ * as the card catalog's own action (one pmos command with Undo), never a new write path. ── */
205
+ const Q = {
206
+ 'task': { '': ['Where does it stand?', 'What is blocking it?', 'Write its description'], due: ['Will it land on this date?', 'What slips if it moves?', 'Why this date?'],
207
+ owner: ['What else is this person carrying?', 'Who else could do it?', 'Where does it stand?'], status: ['Why is it in this state?', 'What moves it on?', 'Who is waiting on it?'] },
208
+ 'milestone': { '': ['Will it land on time?', 'What is still open?', 'What slips if it moves?'], due: ['Will it land on this date?', 'What slips if it moves?', 'Why this date?'] },
209
+ 'initiative': { '': ['Where does it stand?', 'What is blocking it?', 'What should I do next?'], stage: ['Is it ready for the next stage?', 'What does this stage still need?', 'How long has it been here?'],
210
+ due: ['Will it land on this date?', 'What slips if it moves?', 'What is still open?'], milestone: ['Will this milestone land on time?', 'What is still open for it?', 'What slips if it moves?'] },
211
+ 'key result': { '': ['Where does this number come from?', 'Which initiative moves it most?', 'Is it on pace?'] },
212
+ 'goal': { '': ['Which initiatives serve it?', 'Is it on track?', 'What is missing?'] },
213
+ 'product': { '': ['What needs me on this product?', 'What moved this week?', 'What is at risk?'] },
214
+ 'document': { '': ['Summarise it in three lines', 'Is it still true?', 'What does it decide?'], place: ['Is this still true?', 'Who must agree to it?', 'Say it in one line'] },
215
+ 'slide': { '': ['What is this slide saying?', 'Where does this number come from?', 'Is it still true?'] },
216
+ 'ticket': { '': ['Is it in step with PMOS?', 'Where does it stand?', 'Who is on it?'] },
217
+ 'meeting': { '': ['What should I settle in it?', 'What is owed to me?', 'Draft the agenda'] },
218
+ 'event': { '': ['What should I settle in it?', 'What is owed to me?', 'Draft the agenda'] },
219
+ };
220
+ const SECTION_Q = ['What needs me here?', 'What changed here this week?', 'Explain this part'];
221
+ /** The field kind a column or label is: due, owner, status, stage, milestone, or '' */
222
+ export function fieldKind(f) {
223
+ const s = clean(f).toLowerCase();
224
+ if (!s) return '';
225
+ if (/^(due|date|due date|finish|end|check by|target)$/.test(s) || /\bdue\b|\bdate\b/.test(s)) return 'due';
226
+ if (/owner|assignee|who/.test(s)) return 'owner';
227
+ if (/^stage$|workflow/.test(s)) return 'stage';
228
+ if (/status|state/.test(s)) return 'status';
229
+ if (/milestone/.test(s)) return 'milestone';
230
+ return '';
231
+ }
232
+ /** Three ✦ questions for what was pressed. */
233
+ export function questionsOf(c) {
234
+ const l = level(c);
235
+ if (l === 'page' || l === 'section') return SECTION_Q.slice();
236
+ const k = Q[c.record.kind] || null;
237
+ if (!k) return ['What is this?', 'Where does it stand?', 'What should I do about it?'];
238
+ const fk = l === 'field' ? (c.at ? 'place' : fieldKind(c.field)) : '';
239
+ return (k[fk] || k['']).slice(0, 3);
240
+ }
241
+ const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
242
+ const iso = (d) => d.toISOString().slice(0, 10);
243
+ const label = (d) => `${DOW[d.getUTCDay()]} ${d.getUTCDate()} ${MON[d.getUTCMonth()]}`;
244
+ function addWorkdays(d, n) { const x = new Date(d.getTime()); let k = 0; while (k < n) { x.setUTCDate(x.getUTCDate() + 1); if (x.getUTCDay() % 6) k++; } return x; }
245
+ /** The picker for a pressed due date of a task or milestone: the card catalog's "Move the date" with three dates, the current one kept
246
+ * 2, 5 and 10 working days after the due date (after today when the date has passed), the first recommended. row: /api/card-rows' row. null when
247
+ * the press is not a task's date, or the row has no date to move. today: 'YYYY-MM-DD'. */
248
+ export function datePick(c, row, today) {
249
+ if (level(c) !== 'field' || fieldKind(c.field) !== 'due' || !row || row.found === false) return null;
250
+ const kind = row.kind || c.record.kind;
251
+ if (!/^(task|subtask|milestone)$/.test(kind) || !/^\d{4}-\d{2}-\d{2}$/.test(String(row.due || ''))) return null;
252
+ const t = new Date(String(today).slice(0, 10) + 'T00:00:00Z'), due = new Date(row.due + 'T00:00:00Z');
253
+ if (isNaN(t) || isNaN(due)) return null;
254
+ // three later dates, never today's own date again (a press that moves nothing is no choice): from the due date when it is ahead, else from today
255
+ const base = due >= t ? due : t;
256
+ const opts = [addWorkdays(base, 2), addWorkdays(base, 5), addWorkdays(base, 10)];
257
+ const options = opts.map((d) => ({ value: iso(d), label: label(d) }));
258
+ return { kind: kind === 'subtask' ? 'task' : kind, id: row.id, action: 'Move the date', question: 'Move ' + (row.title || row.id) + '?', fields: [{ flag: 'due', options, recommended: 0 }] };
259
+ }
260
+
261
+ /** True when a right-click should keep the browser's own menu: a text field, a real link, selected text, the terminal, the Ask card itself,
262
+ * or Shift held (the way back to the browser's menu anywhere). o: { selected: string, shift: boolean }. Works on real elements (closest). */
263
+ export function nativeMenu(el, o = {}) {
264
+ if (!el || typeof el.closest !== 'function') return true;
265
+ if (o.shift || String(o.selected || '').trim()) return true;
266
+ if (el.closest('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .ah-card, video, audio')) return true;
267
+ const a = el.closest('a[href]');
268
+ if (a) { const h = String(a.getAttribute('href') || ''); if (h && h !== '#' && !/^javascript:/i.test(h)) return true; }
269
+ return false;
270
+ }
271
+
272
+ /** The presses that open the Ask card (cozy-nav.js mountNav calls it once per page). A right-click outside nativeMenu's places opens it at
273
+ * the pointer; a phone's long-press (LONG_MS still, under MOVE_PX of movement) opens it as a sheet and eats the click that follows. The
274
+ * card's own module loads on the first press (load: () => import('./ask-here.js')), so a page that is never pressed pays nothing. */
275
+ export const LONG_MS = 600, MOVE_PX = 10;
276
+ /** Places where a press and hold already means something (pick rows, drag to order, tick a check): a long-press there is theirs. */
277
+ export const HOLDS = '[data-pw-row], [data-iv-edit][data-drag], [data-iv-check], .bk-i, [data-po-list] [data-po-id], .gl-tip';
278
+ export function wire(document, load) { // the page's own document (a test passes a stand-in)
279
+ if (!document || !document.defaultView || document.__askHere) return false;
280
+ document.__askHere = true;
281
+ const win = document.defaultView;
282
+ const sel = () => { try { return String(win.getSelection ? win.getSelection() : ''); } catch { return ''; } };
283
+ document.addEventListener('contextmenu', (e) => {
284
+ if (e.defaultPrevented || nativeMenu(e.target, { selected: sel(), shift: e.shiftKey })) return;
285
+ e.preventDefault();
286
+ const x = e.clientX, y = e.clientY, el = e.target;
287
+ load().then((M) => M.open(el, { x, y, sheet: false })).catch(() => null);
288
+ });
289
+ let t = null, at = null, fired = false;
290
+ const stop = () => { if (t) { clearTimeout(t); t = null; } };
291
+ document.addEventListener('touchstart', (e) => {
292
+ stop(); fired = false;
293
+ if (!e.touches || e.touches.length !== 1) return;
294
+ const p = e.touches[0], el = e.target;
295
+ if (nativeMenu(el, { selected: sel() }) || (el.closest && el.closest(HOLDS))) return;
296
+ at = { x: p.clientX, y: p.clientY };
297
+ t = setTimeout(() => {
298
+ t = null;
299
+ if (document.querySelector('.gl-tip:not([hidden])')) return; // the glossary showed a word's meaning on this press
300
+ fired = true;
301
+ try { if (win.navigator && win.navigator.vibrate) win.navigator.vibrate(10); } catch { /* no buzz */ }
302
+ load().then((M) => M.open(el, { x: at.x, y: at.y, sheet: win.innerWidth <= 760 })).catch(() => null);
303
+ }, LONG_MS);
304
+ }, { passive: true });
305
+ document.addEventListener('touchmove', (e) => { const p = e.touches && e.touches[0]; if (t && p && at && Math.hypot(p.clientX - at.x, p.clientY - at.y) > MOVE_PX) stop(); }, { passive: true });
306
+ document.addEventListener('touchend', (e) => { stop(); if (fired) { fired = false; e.preventDefault(); } });
307
+ document.addEventListener('touchcancel', stop, { passive: true });
308
+ // the long-press opened the card: the click the lift would make is not a press on the row
309
+ document.addEventListener('click', (e) => { if (fired) { fired = false; e.preventDefault(); e.stopPropagation(); } }, true);
310
+ return true;
311
+ }
@@ -0,0 +1,36 @@
1
+ /* pm/ask-here.css — the Ask card a right-click or a long-press opens (initiative ask-anywhere; canvas Exploring 3 page askclick, boards
2
+ * AcA, AcA1–AcA5, agreed by Wawan 2026-11-25). Komorebi tokens only. The chat inside is Home's own (cozy-home.css). */
3
+ .ah-ring { outline: 2px solid var(--cz-ok); outline-offset: 2px; border-radius: 6px; box-shadow: 0 0 0 6px var(--cz-okbg); }
4
+ .ah-card { position: fixed; left: var(--bd-ahx, 8px); top: var(--bd-ahy, 8px); z-index: 2147483000; width: 392px; max-width: calc(100vw - 16px); max-height: min(640px, calc(100vh - 16px)); display: flex; flex-direction: column;
5
+ background: var(--cz-card); color: var(--cz-ink); border-radius: 8px; box-shadow: var(--cz-lift), 0 0 0 1px var(--cz-hair);
6
+ font-family: var(--cz-sans); font-size: var(--fs-body); line-height: var(--lh-body); overflow: hidden; }
7
+ .ah-hd { display: flex; align-items: center; gap: 2px; padding: 10px 6px 6px 12px; }
8
+ .ah-crumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
9
+ .ah-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 6px; background: var(--cz-well); font-size: var(--fs-meta);
10
+ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
11
+ .ah-chip.now { background: var(--cz-okbg); box-shadow: inset 0 0 0 1px var(--cz-ok); }
12
+ .ah-chip .k { color: var(--cz-ink3); }
13
+ .ah-sep { color: var(--cz-ink3); font-size: var(--fs-meta); }
14
+ .ah-icb { width: 32px; height: 32px; flex: none; border: 0; border-radius: 8px; background: none; color: var(--cz-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
15
+ @media (hover: hover) { .ah-icb:hover, .ah-sug button:hover { background: var(--cz-well); } }
16
+ .ah-icb:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
17
+ .ah-icb[disabled] { opacity: .35; cursor: default; }
18
+ .ah-bd { padding: 2px 12px 8px; display: flex; flex-direction: column; gap: 8px; overflow: auto; min-height: 0; }
19
+ .ah-sug { display: flex; flex-direction: column; gap: 2px; }
20
+ .ah-sug button { all: unset; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--cz-ink); font-size: var(--fs-body); }
21
+ .ah-sug button:focus-visible { outline: 2px solid var(--cz-blue); }
22
+ .ah-sug svg { color: var(--cz-ok); flex: none; }
23
+ .ah-chat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--cz-hair); }
24
+ .ah-chat > .hm-chat { flex: 1 1 auto; min-height: 0; padding: 4px 12px 10px; }
25
+ .ah-chat > .hm-chat > .hm-reopen, .ah-chat [data-hm-scope] { display: none; }
26
+ .ah-chat .hm-log { max-height: 280px; }
27
+ .ah-chat.quiet .hm-log, .ah-chat.quiet .hm-chd, .ah-chat.quiet .hm-sug, .ah-chat.quiet .hm-plw { display: none; } /* before a question: only the box */
28
+ .ah-card .cc-card, .ah-card .cc-pick { margin: 0; }
29
+ /* a phone: the same card as a sheet from the bottom, 44 px targets (board AcA5Phone) */
30
+ .ah-card.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; max-width: none; max-height: 80vh; border-radius: 8px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
31
+ .ah-card.sheet .ah-icb { width: 44px; height: 44px; }
32
+ .ah-card.sheet .ah-sug button { min-height: 44px; }
33
+ .ah-grab { width: 40px; height: 5px; border-radius: 6px; background: var(--cz-hair); margin: 8px auto 0; display: none; }
34
+ .ah-card.sheet .ah-grab { display: block; }
35
+ @media (prefers-reduced-motion: no-preference) { .ah-card { animation: ah-in 160ms cubic-bezier(.2,.7,.2,1); } }
36
+ @keyframes ah-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@@ -0,0 +1,195 @@
1
+ /* pm/ask-here.js — ask PMOS about anything you press (initiative ask-anywhere, A528; canvas Exploring 3 page askclick, boards AcA and
2
+ * AcA1–AcA5, agreed by Wawan 2026-11-25: "Agreed" on A with the card catalog).
3
+ *
4
+ * A right-click (a long-press on a phone, cozy-nav.js wires both and loads this module on the first press) opens one small Ask card beside
5
+ * what was pressed:
6
+ * top line what PMOS understood (pm/ask-here-ctx.js): the record, then the field and its value. ↑ steps out one level
7
+ * (field → record → section → page), ⤢ moves the talk into the one full chat (page-chat.js openAbout), × or Esc closes.
8
+ * the record its card catalog row, live (chat-cards.js, GET /api/card-rows) with the catalog's own buttons; a pressed due date of a task
9
+ * or a milestone brings the catalog's "Move the date" picker. Every press is one pmos command with Undo (action-run.js).
10
+ * ✦ lines three questions for that kind of thing and field; one press asks it.
11
+ * the chat the one chat of the page (page-chat.js box(): the same element and conversation the popup shows), opened on the record's own
12
+ * conversation (itemTarget: pop:<kind>:<id>, its first message carries what was pressed); answers come back with live cards.
13
+ * One chat at a time: the chat element is borrowed and put back where it was when the card closes.
14
+ *
15
+ * open(el, { x, y, sheet }) → true when a card opened close() isOpen() */
16
+ import * as C from './ask-here-ctx.js';
17
+ import { cardsUi } from './chat-cards.js';
18
+ import { runAction, routeOf } from './action-run.js';
19
+ import { tellCards } from './card-log.js';
20
+ import { pmGet, pmPost } from './http.js';
21
+ import { noteUse } from './use-log.js';
22
+
23
+ const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
24
+ const P = (d) => `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="${d}"/></svg>`;
25
+ const I = { up: 'M12 19V5M6 11l6-6 6 6', expand: 'M14 4h6v6M10 20H4v-6M20 4l-7 7M4 20l7-7', x: 'M6 6l12 12M18 6L6 18', star: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z' };
26
+ const S = { card: null, ctx: null, el: null, ring: null, ws: '', chat: null, chatEl: null, home: null, CU: null, row: undefined, today: '', key: 0, off: null };
27
+ const toast = (m) => { const t = document.getElementById('toast'); if (!t) return; t.textContent = m; t.classList.add('on'); setTimeout(() => t.classList.remove('on'), 4200); };
28
+
29
+ function sheet() {
30
+ const href = new URL('./ask-here.css', import.meta.url).href;
31
+ if (![...document.querySelectorAll('link[rel="stylesheet"]')].some((l) => l.href === href)) { const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l); }
32
+ }
33
+ /** The page's words: its title without "PMOS ·", and the switch tab that is on. */
34
+ export function pageWords(doc = document) {
35
+ const name = String(doc.title || '').replace(/^PMOS\s*[·|–-]\s*/i, '').replace(/\s*[·|–-]\s*PMOS\s*$/i, '').trim();
36
+ const tab = doc.querySelector('[role=tab][aria-selected="true"], [data-bksw][aria-pressed="true"], [data-bksw].on');
37
+ const t = tab ? String(tab.textContent || '').replace(/\s+/g, ' ').trim() : '';
38
+ return [name, t && t !== name ? t : ''].filter(Boolean).join(' · ');
39
+ }
40
+ /** The workspace the pressed thing belongs to: a data-ws / data-ask-ws on it or around it, else the page's ?ws=. */
41
+ function wsOf(el) {
42
+ const w = el.closest('[data-ask-ws],[data-ws],[data-gl-ws],[data-line-ws]');
43
+ const v = w && (w.getAttribute('data-ask-ws') || w.getAttribute('data-ws') || w.getAttribute('data-gl-ws') || w.getAttribute('data-line-ws'));
44
+ return v || new URLSearchParams(location.search).get('ws') || '';
45
+ }
46
+ /** The open popup's or Viewer's item, when the press is inside it (the proof: exact on 27 of 27 presses). */
47
+ function scopeOf(el) {
48
+ if (!el.closest('.cz-vw, .cz-pop-card, [role=dialog]')) return null;
49
+ try { const c = window.czViewer && window.czViewer.current && window.czViewer.current(); return c && c.id ? { kind: c.kind, id: c.id, title: c.title } : null; } catch { return null; }
50
+ }
51
+ /** The element the record lives on, to ring: the pressed cell when a field was named, else the row or card. */
52
+ function ringOf(el, ctx) {
53
+ if (C.level(ctx) === 'field') return el.closest('td,th,dd,[data-ask-field],[data-ask-at],p,li,button,a,span') || el;
54
+ return el.closest('[data-ask],tr,[role=listitem],.pm-li,li,article,section') || el;
55
+ }
56
+
57
+ export const isOpen = () => !!S.card;
58
+ export function close() {
59
+ if (!S.card) return;
60
+ if (S.ring) S.ring.classList.remove('ah-ring');
61
+ putChatBack();
62
+ if (S.ro) { S.ro.disconnect(); S.ro = null; }
63
+ S.card.remove(); S.card = null; S.ring = null; S.ctx = null;
64
+ if (S.off) { S.off(); S.off = null; }
65
+ }
66
+ function putChatBack() {
67
+ if (!S.chatEl || !S.home) return;
68
+ const { parent, next } = S.home;
69
+ if (parent && parent.isConnected) parent.insertBefore(S.chatEl, next && next.parentNode === parent ? next : null); else S.chatEl.remove();
70
+ S.home = null;
71
+ }
72
+
73
+ export async function open(el, o = {}) {
74
+ if (!el || el.nodeType !== 1) return false;
75
+ close();
76
+ sheet();
77
+ const ctx = C.resolve(el, { scope: scopeOf(el), page: pageWords() });
78
+ if (!ctx) return false;
79
+ S.ctx = ctx; S.el = el; S.ws = wsOf(el); S.row = undefined; S.key += 1; S.today = new Date().toISOString().slice(0, 10);
80
+ const card = document.createElement('section');
81
+ card.className = 'ah-card' + (o.sheet ? ' sheet' : '');
82
+ card.setAttribute('role', 'dialog'); card.setAttribute('aria-label', 'Ask PMOS about this');
83
+ document.body.appendChild(card); S.card = card;
84
+ if (!S.CU) S.CU = cardsUi({ pmGet, pmPost, toast, redraw: () => drawRecord(), runAction, routeOf, tellCards, ws: () => S.ws });
85
+ draw();
86
+ place(o);
87
+ // the row, the picker and the chat arrive after the card opens: keep it on the screen as it grows
88
+ if (typeof ResizeObserver === 'function') { const ro = new ResizeObserver(() => place(o)); ro.observe(card); S.ro = ro; }
89
+ wireCard(card);
90
+ noteUse('ask-here-open');
91
+ return true;
92
+ }
93
+
94
+ function draw() {
95
+ const card = S.card, ctx = S.ctx; if (!card || !ctx) return;
96
+ const cr = C.crumbs(ctx).map((t, i, a) => (i ? '<span class="ah-sep" aria-hidden="true">›</span>' : '') + `<span class="ah-chip${i === a.length - 1 ? ' now' : ''}">${esc(t)}</span>`).join('');
97
+ const top = C.level(ctx) === 'page';
98
+ card.innerHTML = '<div class="ah-grab" aria-hidden="true"></div>'
99
+ + `<div class="ah-hd"><div class="ah-crumb" aria-label="What PMOS understood">${cr}</div>`
100
+ + `<button type="button" class="ah-icb" data-ah="up" aria-label="Ask about the bigger part instead" title="Ask about the bigger part instead"${top ? ' disabled' : ''}>${P(I.up)}</button>`
101
+ + `<button type="button" class="ah-icb" data-ah="full" aria-label="Open in the full chat" title="Open in the full chat">${P(I.expand)}</button>`
102
+ + `<button type="button" class="ah-icb" data-ah="x" aria-label="Close" title="Close">${P(I.x)}</button></div>`
103
+ + '<div class="ah-bd"><div class="ah-rec" id="ahRec"></div>'
104
+ + `<div class="ah-sug" id="ahSug">${C.questionsOf(ctx).map((q) => `<button type="button" data-ah-q="${esc(q)}">${P(I.star)}${esc(q)}</button>`).join('')}</div></div>`
105
+ + '<div class="ah-chat quiet" id="ahChat"></div>';
106
+ ring();
107
+ drawRecord();
108
+ mountChat();
109
+ }
110
+ function ring() {
111
+ if (S.ring) S.ring.classList.remove('ah-ring');
112
+ S.ring = null;
113
+ if (C.level(S.ctx) === 'page' || C.level(S.ctx) === 'section' || !S.el || !S.el.isConnected) return;
114
+ S.ring = ringOf(S.el, S.ctx); if (S.ring) S.ring.classList.add('ah-ring');
115
+ }
116
+ /** The record as its card catalog row, and the field's picker (only the kinds chat-cards.js draws: task, subtask, milestone, initiative). */
117
+ function drawRecord() {
118
+ const box = S.card && S.card.querySelector('#ahRec'); if (!box) return;
119
+ const ctx = S.ctx, l = C.level(ctx);
120
+ if (l === 'page' || l === 'section' || !/^(task|subtask|milestone|initiative)$/.test(ctx.record.kind)) { box.innerHTML = ''; return; }
121
+ let text = '```pmos-card ' + JSON.stringify({ kind: ctx.record.kind, ids: [ctx.record.id] }) + '```';
122
+ if (S.row === undefined) readRow();
123
+ const pick = S.row ? C.datePick(ctx, S.row, S.today) : null;
124
+ if (pick) text += '\n```pmos-pick ' + JSON.stringify(pick) + '```';
125
+ const sp = S.CU.split(text);
126
+ box.innerHTML = S.CU.html(sp, 'ah' + S.key);
127
+ }
128
+ function readRow() {
129
+ S.row = null;
130
+ const ctx = S.ctx, k = S.key;
131
+ pmGet('/api/card-rows?kind=' + encodeURIComponent(ctx.record.kind) + '&ids=' + encodeURIComponent(ctx.record.id) + (S.ws ? '&ws=' + encodeURIComponent(S.ws) : ''))
132
+ .then((r) => { if (k !== S.key) return; S.row = r && r.ok && Array.isArray(r.rows) ? (r.rows[0] || null) : null; drawRecord(); })
133
+ .catch(() => null);
134
+ }
135
+ /** The chat target: the record's own conversation with what was pressed, or Ask PMOS over the page at section and page level. */
136
+ async function targetOf() {
137
+ const M = await import('./page-chat.js');
138
+ const t = C.target(S.ctx);
139
+ return (t && M.itemTarget(t, S.ws || undefined)) || M.cosTarget(C.hereWords(S.ctx), S.ws || undefined);
140
+ }
141
+ async function mountChat() {
142
+ const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
143
+ const M = await import('./page-chat.js');
144
+ const { el, chat } = await M.box();
145
+ if (!S.card || !holder.isConnected) return;
146
+ if (!S.home && el.parentNode && !S.card.contains(el)) S.home = { parent: el.parentNode, next: el.nextSibling };
147
+ S.chatEl = el; S.chat = chat;
148
+ holder.appendChild(el);
149
+ chat.open(await targetOf());
150
+ }
151
+ function ask(q) {
152
+ const holder = S.card && S.card.querySelector('#ahChat'); if (!holder) return;
153
+ holder.classList.remove('quiet');
154
+ const sug = S.card.querySelector('#ahSug'); if (sug) sug.hidden = true;
155
+ const ta = holder.querySelector('textarea'), form = holder.querySelector('form.hm-box');
156
+ if (!ta || !form) return;
157
+ ta.value = q; ta.dispatchEvent(new Event('input', { bubbles: true }));
158
+ form.requestSubmit();
159
+ }
160
+ async function full() {
161
+ const t = await targetOf();
162
+ close();
163
+ noteUse('ask-here-full');
164
+ const M = await import('./page-chat.js');
165
+ return M.openAbout(t);
166
+ }
167
+ function place(o) {
168
+ const card = S.card; if (!card || o.sheet) return;
169
+ const r = card.getBoundingClientRect(), W = innerWidth, H = innerHeight;
170
+ const x = Number.isFinite(o.x) ? o.x : W / 2, y = Number.isFinite(o.y) ? o.y : H / 3;
171
+ let left = Math.min(Math.max(8, x - 40), W - r.width - 8), top = y + 14;
172
+ if (top + r.height > H - 8) top = Math.max(8, y - r.height - 14);
173
+ card.style.setProperty('--bd-ahx', Math.round(left) + 'px'); card.style.setProperty('--bd-ahy', Math.round(top) + 'px');
174
+ }
175
+ // one click listener on the document for every card (a card's own buttons are real <button>s; the listener only routes them)
176
+ let routed = false;
177
+ function wireCard() {
178
+ if (routed) return; routed = true;
179
+ document.addEventListener('click', async (e) => {
180
+ const card = S.card; if (!card || !e.target || !e.target.closest || !card.contains(e.target)) return;
181
+ const b = e.target.closest('button'); if (!b) return;
182
+ if (S.CU && S.CU.owns(b)) { e.preventDefault(); await S.CU.press(b); return; }
183
+ const a = b.getAttribute('data-ah');
184
+ if (a === 'x') { close(); return; }
185
+ if (a === 'full') { full(); return; }
186
+ if (a === 'up') { const w = C.widen(S.ctx); if (w) { S.ctx = w; S.row = undefined; S.key += 1; noteUse('ask-here-widen'); putChatBack(); draw(); } return; }
187
+ const q = b.getAttribute('data-ah-q'); if (q) { noteUse('ask-here-question'); ask(q); }
188
+ });
189
+ card.addEventListener('input', (e) => { if (e.target && e.target.matches('textarea')) card.querySelector('#ahChat').classList.remove('quiet'); });
190
+ const esc = (e) => { if (e.key === 'Escape' && S.card) { e.stopPropagation(); close(); } };
191
+ const outside = (e) => { if (S.card && !S.card.contains(e.target) && !e.target.closest('.cz-pop-card, .cz-vw, [data-esc-layer]')) close(); };
192
+ window.addEventListener('keydown', esc, true);
193
+ setTimeout(() => document.addEventListener('pointerdown', outside, true), 0);
194
+ S.off = () => { window.removeEventListener('keydown', esc, true); document.removeEventListener('pointerdown', outside, true); };
195
+ }
@@ -391,7 +391,7 @@ function rowHtml(t, gk, cols = COLS) {
391
391
  jira: `<span class="c-jira">${jira}</span>`, epic: `<span class="c-epic">${epic}</span>`, ini: `<span class="c-ini">${ini}</span>`, who: `<span class="c-who">${whoHtml(t)}</span>`,
392
392
  state: `<span class="c-state bk-s${s.tone ? ' ' + s.tone : ''}${gk === 'take' ? ' tk' : ''}" title="${esc(s.text + (s.note ? ' · ' + s.note : ''))}"><i class="bk-dot ${s.dot}"></i>${s.tone === 'late' && gk === 'take' ? `<em class="lt">${esc(s.text)}</em>` : esc(s.text)}${s.note ? `<em> · ${esc(s.note)}</em>` : ''}</span>`,
393
393
  };
394
- return `<div class="bk-r bk-i${ck ? ' sel' : ''}" role="row" data-bk="${esc(u)}">`
394
+ return `<div class="bk-r bk-i${ck ? ' sel' : ''}" role="row" data-bk="${esc(u)}" data-ask="${t.milestone ? 'milestone' : 'task'}:${esc(t.id)}" data-ask-title="${esc(t.title)}" data-ask-ws="${esc(t.ws)}">`
395
395
  + `<span class="c-ck"><input type="checkbox" class="bk-ck" data-bkck="${esc(u)}" aria-label="Tick ${esc(t.title)}"${ck ? ' checked' : ''}></span>`
396
396
  + `<span class="c-n bk-n">${icon}<button type="button" class="bk-t" data-bkopen="${esc(u)}" title="${esc(t.title)}">${esc(t.title)}</button></span>`
397
397
  + cols.map((c) => cell[c]).join('')
@@ -90,6 +90,14 @@ export const markOf = (type, tone) => `<i class="evp-k ${MARK[type] || 'evp-rd'}
90
90
  export const markHtml = (x) => markOf(typeOf(x), x.tone);
91
91
  const STAR = (w = 14) => svg(ICON.spark, w).replace('class="pm-ic"', 'class="pm-ic pm-star"');
92
92
 
93
+ /** What a right-click on a date row names (initiative ask-anywhere): the milestone, task, initiative end or ticket behind the date. */
94
+ const ASK_OF = { ms: 'milestone', task: 'task', end: 'initiative' };
95
+ function askOf(x) {
96
+ const k = String(x.key || ''), i = k.indexOf(':'), pre = k.slice(0, i), rest = k.slice(i + 1);
97
+ if (pre === 'jira') return ` data-ask="ticket:${esc(rest)}" data-ask-title="${esc(x.title)}"`;
98
+ if (ASK_OF[pre]) { const [ws, , id] = rest.split('|'); if (id) return ` data-ask="${ASK_OF[pre]}:${esc(id)}" data-ask-title="${esc(x.title)}" data-ask-ws="${esc(ws)}"`; }
99
+ return ` data-ask="date:${esc(k)}" data-ask-title="${esc(x.title)}"`;
100
+ }
93
101
  /** The Suggestion part for one date, under its row (Coming up: only where a date is at risk). */
94
102
  function sugLine(x) {
95
103
  const s = x.suggest;
@@ -148,7 +156,7 @@ export function rowHtml(x, o = {}) {
148
156
  const late = x.group === 'late' ? -between(today, x.date) : 0;
149
157
  const badge = late > 0 ? `<span class="pm-badge alert">${late} ${plural(late, 'day', 'days')} late</span>` : ''; // at risk shows as the mark's tone and, where PMOS has a fix, the Suggestion under the row
150
158
  const kindWord = TYPE_WORD[typeOf(x)];
151
- return `<div class="evp-r${o.child ? ' evp-kid' : ''}${x.fixed ? ' fixed' : ''}${o.busy && o.busy.has(x.key) ? ' busy' : ''} pm-li" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}" aria-label="${esc(kindWord)}">`
159
+ return `<div class="evp-r${o.child ? ' evp-kid' : ''}${x.fixed ? ' fixed' : ''}${o.busy && o.busy.has(x.key) ? ' busy' : ''} pm-li" data-key="${esc(x.key)}" data-kind="${esc(x.kind)}" data-type="${esc(typeOf(x))}"${askOf(x)} aria-label="${esc(kindWord)}">`
152
160
  + `<span class="evp-d ${x.tone || ''}"><b>${esc(d.b)}</b>${d.s || x.fixed ? `<small>${esc(d.s)}${x.fixed ? (d.s ? ' · ' : '') + 'fixed' : ''}</small>` : ''}</span>${markHtml(x)}${whatHtml(x, o, fixLine)}`
153
161
  + `${badge}${actsHtml(x, o, fixLine)}</div>${srcHtml(x, o)}${x.suggest && !fixLine ? sugLine(x) : ''}`;
154
162
  }
@@ -44,6 +44,7 @@ import { fabLabel, bannerOf } from './cozy-evmodel.js';
44
44
  import { mountToastFaces, loadPrefs } from './cozy-adler.js';
45
45
  import './draft-keep.js'; // forms-keep-drafts: every text box on every page keeps a draft until sent, saved or cleared
46
46
  import { pmPost } from './http.js'; // Adler (batch 16 item 2): every toast carries his S face; Settings > Adler is read once
47
+ import { wire as askHere } from './ask-here-ctx.js'; // ask-anywhere (A528): only the small resolver loads with the page; the card loads on the first press
47
48
  import { startUseLog } from './use-log.js'; // bet A466: every page mounts the menu, so the menu starts the local use log (this computer only)
48
49
  import { startActionKeys } from './action-keys.js'; // bet A477: y o s p z act on the item under the pointer, ? lists the keys
49
50
  import { startGlossary } from './glossary.js'; // bet A386: a product's own words show their meaning on hover (a long press on a phone)
@@ -205,6 +206,7 @@ export function mountNav(here, doc = document, opts = {}) {
205
206
  doc.body.appendChild(w);
206
207
  mountToastFaces(doc); loadPrefs();
207
208
  startUseLog(doc);
209
+ askHere(doc, () => import('./ask-here.js')); // ask-anywhere: a right-click (a phone: a long-press) asks PMOS about what was pressed
208
210
  startActionKeys(doc);
209
211
  startFocusMode(doc);
210
212
  startGlossary(doc);