truemap-cli 0.3.0 → 0.5.1

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/src/ui/sdk.js CHANGED
@@ -24,21 +24,155 @@
24
24
  const style = document.createElement('style');
25
25
  style.textContent = `
26
26
  [data-tm-mark="changed"] { outline: 2px dashed var(--tm-changed, #a2690a) !important; outline-offset: 3px; }
27
- [data-tm-mark="broken"] { outline: 2px dashed var(--tm-broken, #b03a2e) !important; outline-offset: 3px; }
27
+ [data-tm-mark="broken"] { outline: 2px dashed var(--tm-broken, #c0392b) !important; outline-offset: 3px; }
28
28
  svg [data-tm-mark] { outline: none !important; }
29
+ .tm-diagram .tm-node[data-tm-mark] { outline: none !important; }
30
+ .tm-diagram .tm-node[data-tm-mark]::before { content: ""; position: absolute; top: 7px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--tm-changed, #a35f00); box-shadow: 0 0 0 2px var(--tm-paper, #fff); }
31
+ .tm-diagram .tm-node[data-tm-mark="broken"]::before { background: var(--tm-broken, #c0392b); }
29
32
  html[data-tm-annotate] body { cursor: default; }
30
33
  html[data-tm-annotate] [data-tm-hover] { cursor: pointer; }
31
34
  html[data-tm-annotate] a, html[data-tm-annotate] label { cursor: pointer; }
32
- @keyframes tm-flash { 0%,100% { outline-color: transparent } 35% { outline-color: var(--tm-route, #2453c4) } }
33
- [data-tm-flash] { outline: 2px solid var(--tm-route, #2453c4) !important; outline-offset: 4px; animation: tm-flash 1.1s ease 2; }
35
+ @keyframes tm-flash { 0%,100% { outline-color: transparent } 35% { outline-color: var(--tm-route, #141413) } }
36
+ [data-tm-flash] { outline: 2px solid var(--tm-route, #141413) !important; outline-offset: 4px; animation: tm-flash 1.1s ease 2; }
34
37
  @media (prefers-reduced-motion: reduce) { [data-tm-flash] { animation: none; } }
35
- ::highlight(tm-note) { background-color: color-mix(in oklab, var(--tm-route, #2453c4) 20%, transparent); }
38
+ ::highlight(tm-note) { background-color: color-mix(in oklab, var(--tm-route, #141413) 20%, transparent); }
39
+ /* Every box can be opened: click shows its code and connections. */
40
+ .tm-node, .tm-step, [data-src] { cursor: pointer; }
41
+ .tm-node:focus-visible, .tm-step:focus-visible { outline: 2px solid var(--tm-route, #141413); outline-offset: 3px; }
42
+ /* The agent points at the map: everything else steps back. */
43
+ html[data-tm-focusing] .tm-node:not([data-tm-focus]), html[data-tm-focusing] .tm-step:not([data-tm-focus]) { opacity: .34; }
44
+ html[data-tm-focusing] .tm-wire:not(.is-focus), html[data-tm-focusing] .tm-wire-head:not(.is-focus) { opacity: .16; }
45
+ html[data-tm-focusing] .tm-wire-label:not(.is-focus) { opacity: 0; }
46
+ .tm-node, .tm-step, .tm-wire, .tm-wire-head, .tm-wire-label { transition: opacity .18s ease, stroke .12s ease, fill .12s ease; }
47
+ @media (prefers-reduced-motion: reduce) { .tm-node, .tm-step, .tm-wire, .tm-wire-head, .tm-wire-label { transition: none; } }
36
48
  `;
37
49
  (document.head || document.documentElement).appendChild(style);
38
50
 
39
- const drawWires = () => window.truemapWires?.draw();
51
+ const drawWires = () => { window.truemapDiagram?.draw(); window.truemapWires?.draw(); markWires(); };
40
52
  let wireTimer = null;
41
- const scheduleWires = () => { clearTimeout(wireTimer); wireTimer = setTimeout(() => { drawWires(); placePins(); }, 40); };
53
+ const scheduleWires = () => { clearTimeout(wireTimer); wireTimer = setTimeout(() => { drawWires(); placePins(); placePlanAct(); }, 40); };
54
+
55
+ // ---------- focus: the agent (or a chat link) points at boxes ----------
56
+ let focusSet = []; let focusNote = null; let hotBox = null;
57
+ function findItems(items) {
58
+ const all = [...document.querySelectorAll('[data-src], .tm-node[id], .tm-step[id]')];
59
+ const out = [];
60
+ for (const it of items || []) {
61
+ const s = String(it);
62
+ const el = (/^[\w-]+$/.test(s) && document.getElementById(s))
63
+ || all.find((x) => x.getAttribute('data-src') === s)
64
+ || (!s.includes('#') && all.find((x) => (x.getAttribute('data-src') || '').split('#')[0].replace(/\/$/, '') === s.replace(/\/$/, '')))
65
+ || all.find((x) => (x.getAttribute('data-src') || '').endsWith(`#${s.split('#').pop()}`) && s.includes('#'));
66
+ if (el && !out.includes(el)) out.push(el);
67
+ }
68
+ return out;
69
+ }
70
+ // Classes on wires follow the focused / hovered boxes; re-applied after every redraw.
71
+ function markWires() {
72
+ const ids = new Set(focusSet.map((e) => e.id).filter(Boolean));
73
+ const hot = hotBox?.id;
74
+ for (const w of document.querySelectorAll('.tm-wire, .tm-wire-head')) {
75
+ const { from, to } = w.dataset;
76
+ w.classList.toggle('is-focus', ids.has(from) && ids.has(to));
77
+ w.classList.toggle('is-hot', !!hot && (from === hot || to === hot));
78
+ }
79
+ for (const w of document.querySelectorAll('.tm-dg-edge, .tm-dg-head, .tm-dg-label')) {
80
+ w.classList.toggle('is-focus', ids.has(w.dataset.from) && ids.has(w.dataset.to));
81
+ }
82
+ // labels are placed afresh for what is now visible
83
+ window.truemapWires?.labels?.({ hot: hot || null, focus: [...ids] });
84
+ }
85
+ // Brings elements into view by scrolling the page itself; scrollIntoView would also scroll a map's own
86
+ // clipped box sideways and hide part of it.
87
+ function reveal(els, how = 'center') {
88
+ const rs = els.filter((el) => el.isConnected).map((el) => el.getBoundingClientRect());
89
+ if (!rs.length) return;
90
+ const top = Math.min(...rs.map((r) => r.top)); const bottom = Math.max(...rs.map((r) => r.bottom));
91
+ const smooth = matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth';
92
+ if (how === 'nearest' && top >= 8 && bottom <= innerHeight - 8) return;
93
+ const dy = bottom - top > innerHeight - 80 ? top - 60 : (top + bottom) / 2 - innerHeight / 2;
94
+ window.scrollBy({ top: dy, behavior: smooth });
95
+ }
96
+ function applyFocus(items, note, who, scroll = 'center', transient = false) {
97
+ clearFocus(false);
98
+ for (const btn of document.querySelectorAll('[data-tm-flow]')) btn.setAttribute('aria-pressed', 'false');
99
+ focusSet = findItems(items);
100
+ focusNote = note ? { text: String(note), who: who || 'Agent' } : null;
101
+ if (focusSet.length) {
102
+ document.documentElement.setAttribute('data-tm-focusing', '');
103
+ for (const el of focusSet) el.setAttribute('data-tm-focus', '');
104
+ if (scroll) reveal(focusSet, scroll);
105
+ } else if (focusNote) window.scrollTo({ top: 0 });
106
+ // the page scrolls smoothly to the group: place the note again once it has settled
107
+ markWires(); paintRings(); setTimeout(paintRings, 350); setTimeout(paintRings, 900);
108
+ post({ type: 'focus-state', count: focusSet.length, transient });
109
+ }
110
+ function clearFocus(repaint = true) {
111
+ document.documentElement.removeAttribute('data-tm-focusing');
112
+ for (const el of document.querySelectorAll('[data-tm-focus]')) el.removeAttribute('data-tm-focus');
113
+ if (repaint) for (const btn of document.querySelectorAll('[data-tm-flow]')) btn.setAttribute('aria-pressed', 'false');
114
+ const had = focusSet.length;
115
+ focusSet = []; focusNote = null;
116
+ markWires(); if (repaint) paintRings();
117
+ if (had && repaint) post({ type: 'focus-state', count: 0 });
118
+ }
119
+
120
+ // ---------- peek: click a box to see what it is in the code ----------
121
+ const boxSel = '.tm-node, .tm-step, .tm-card[data-src], [data-src]';
122
+ function boxInfo(el) {
123
+ const txt = (sel) => clean(el.querySelector(sel)?.textContent, 300);
124
+ const nameOf = (n) => clean(n.getAttribute('data-name') || n.querySelector?.('.tm-node-title,b,strong,h3,h4')?.textContent || n.textContent, 60);
125
+ // Same label rules as the map: underscores are spaces, \_ is a real underscore.
126
+ const viaOf = (s) => s.replace(/\\_/g, '\u0001').replace(/_/g, ' ').replace(/\u0001/g, '_');
127
+ const to = [];
128
+ for (const spec of (el.getAttribute('data-to') || '').split(/[\s,]+/).filter(Boolean)) {
129
+ const [id, ...lab] = spec.split(':'); const n = document.getElementById(id);
130
+ if (n) to.push({ id, label: nameOf(n), via: viaOf(lab.join(':')) });
131
+ }
132
+ const from = [];
133
+ if (el.id) {
134
+ for (const n of document.querySelectorAll('[data-to]')) {
135
+ const spec = n.getAttribute('data-to').split(/[\s,]+/).find((x) => x.split(':')[0] === el.id);
136
+ if (spec && n.id) from.push({ id: n.id, label: nameOf(n), via: viaOf(spec.split(':').slice(1).join(':')) });
137
+ }
138
+ }
139
+ const href = el.matches('a[href]') ? el.getAttribute('href') : (el.querySelector('a[href$=".html"], a[href*=".html#"]')?.getAttribute('href') || '');
140
+ const det = el.querySelector(':scope > .tm-detail');
141
+ const detail = det ? [...det.querySelectorAll(':scope > p:not(.tm-why), :scope > ul > li, :scope > ol > li')].slice(0, 14).map((n) => ({ t: n.tagName === 'LI' ? 'li' : 'p', text: clean(n.textContent, 500) })) : [];
142
+ return {
143
+ id: el.id || '', label: clean(el.getAttribute('data-name'), 60) || labelOf(el), tag: clean(el.getAttribute('data-tag'), 60), plan: el.getAttribute('data-plan') || '', detail,
144
+ sub: txt('.tm-node-sub'), desc: det ? '' : txt('.tm-node-desc') || (el.matches('.tm-node,.tm-step') ? '' : clean(el.innerText, 300)),
145
+ src: el.closest('[data-src]')?.getAttribute('data-src') || '', href: /^[\w./-]+\.html?(#[\w-]*)?$/i.test(href) ? href : '',
146
+ ext: el.classList.contains('is-ext'), to, from, mark: el.getAttribute('data-tm-mark') || '', planNote: clean(el.getAttribute('data-plan-note'), 400), why: clean(el.getAttribute('data-why') || det?.querySelector('.tm-why')?.textContent, 600),
147
+ };
148
+ }
149
+ let selected = null;
150
+ function select(el) {
151
+ if (selected === el) return;
152
+ selected?.removeAttribute('data-tm-selected');
153
+ selected = el || null; selected?.setAttribute('data-tm-selected', '');
154
+ // the selected box's own lines stay lit while its inspector is open
155
+ for (const w of document.querySelectorAll('.tm-dg-edge, .tm-dg-head, .tm-dg-label')) w.classList.toggle('is-sel', !!el?.id && (w.dataset.from === el.id || w.dataset.to === el.id));
156
+ if (!el && document.activeElement?.matches?.('.tm-node, .tm-step')) document.activeElement.blur();
157
+ }
158
+ // Click a box: a small card beside it with what it is and a comment field, so your eyes stay on the map.
159
+ // If the inspector is already open on the right, it follows the box.
160
+ function openBox(box) {
161
+ // a second click on the selected box lets go of it
162
+ if (selected === box) { select(null); post({ type: 'deselect' }); return; }
163
+ select(box);
164
+ post({ type: 'peek-if-open', page: pagePath(), box: boxInfo(box) });
165
+ }
166
+ function cardFor(box) {
167
+ select(box);
168
+ const existing = [...notes.values()].find((n) => n.el === box);
169
+ openCard({ target: box, noteId: existing?.id || null });
170
+ }
171
+ function peek(el) {
172
+ select(el);
173
+ const r = el.getBoundingClientRect();
174
+ post({ type: 'peek', page: pagePath(), box: boxInfo(el), rect: { l: r.left, t: r.top, r: r.right, b: r.bottom }, sy: scrollY });
175
+ }
42
176
 
43
177
  // ---------- annotate ----------
44
178
  const INTERACTIVE = 'a[href],button,input,select,textarea,label,summary,[contenteditable],[role=button]';
@@ -117,6 +251,29 @@
117
251
  rings.appendChild(d);
118
252
  };
119
253
  for (const n of notes.values()) if (n.el && n.el !== card?.target) ring(n.el, 'noted');
254
+ for (const el of focusSet) if (!el.closest('.tm-diagram')) ring(el, 'agent'); // diagram boxes get the highlighter instead
255
+ if (focusNote) {
256
+ mount();
257
+ const b = document.createElement('div'); b.className = 'bubble'; b.setAttribute('role', 'note');
258
+ b.innerHTML = '<div class="bubble-who"></div><div class="bubble-text"></div><button class="bubble-x" type="button" aria-label="Dismiss">×</button>';
259
+ b.querySelector('.bubble-who').textContent = focusNote.who;
260
+ b.querySelector('.bubble-text').textContent = focusNote.text;
261
+ b.querySelector('.bubble-x').onclick = (ev) => { ev.stopPropagation(); clearFocus(); post({ type: 'focus-cleared' }); };
262
+ rings.appendChild(b);
263
+ // The note sits beside the whole lit group (never on one of its boxes): right of it, else below it.
264
+ const vw = document.documentElement.clientWidth; const w = 300;
265
+ const live = focusSet.filter((el) => el.isConnected).map(extentOf);
266
+ if (live.length) {
267
+ const g = { l: Math.min(...live.map((x) => x.left)), t: Math.min(...live.map((x) => x.top)), r: Math.max(...live.map((x) => x.left + x.width)), b: Math.max(...live.map((x) => x.top + x.height)) };
268
+ // right of the group if there is room; otherwise above it (the page's own controls usually sit below
269
+ // a map); below it only when there is no room above.
270
+ const fitsRight = g.r + 14 + w < scrollX + vw - 8;
271
+ const bh = b.offsetHeight || 90;
272
+ const above = g.t - bh - 12 > scrollY + 4;
273
+ b.style.left = `${fitsRight ? g.r + 14 : Math.max(scrollX + 8, Math.min(g.l, scrollX + vw - w - 8))}px`;
274
+ b.style.top = `${fitsRight ? g.t : above ? g.t - bh - 12 : g.b + 12}px`;
275
+ } else { b.style.left = `${scrollX + vw - 320}px`; b.style.top = `${scrollY + 16}px`; }
276
+ }
120
277
  if (card?.target) ring(card.target, 'active');
121
278
  else if (annotating && hovered) ring(hovered, 'hover');
122
279
  }
@@ -135,44 +292,117 @@
135
292
  shadow.innerHTML = `<style>
136
293
  :host { all: initial; }
137
294
  * { box-sizing: border-box; }
138
- .card { position: absolute; width: 340px; background: #fff; color: #17202b; border: 1px solid #c2c8c1; border-radius: 10px;
139
- box-shadow: 0 12px 32px -12px rgba(23,32,43,.28); font: 14px/1.45 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; padding: 12px; }
140
- .what { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0 2px 8px; }
295
+ .card { position: absolute; z-index: 10; width: 360px; background: #fff; color: #141413; border: 1px solid #d2d2cb; border-radius: 10px;
296
+ box-shadow: 0 12px 32px -12px rgba(20,20,19,.28); font: 14px/1.45 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; padding: 12px; }
297
+ .what { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0 2px 6px; }
298
+ .card.viewing { width: 320px; }
299
+ .card.viewing textarea, .card.viewing .suggest, .card.viewing [data-act="add"], .card.viewing [data-act="cancel"], .card.viewing .hint { display: none; }
300
+ .card:not(.viewing) [data-act="comment"] { display: none; }
301
+ .card.viewing .foot { justify-content: flex-start; margin-top: 4px; }
302
+ .card.viewing .sum { margin-bottom: 6px; }
303
+ .sum { margin: 0 2px 10px; font-size: 13px; line-height: 1.45; color: #4a4a45; }
304
+ .sum .flag { margin-top: 4px; font-size: 12px; color: #a35f00; }
305
+ @media (prefers-color-scheme: dark) { .sum { color: #c4c4bd; } .sum .flag { color: #e0a548; } }
141
306
  .what b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
142
- .what code { font: 11.5px "IBM Plex Mono", ui-monospace, Consolas, monospace; color: #8a939e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
143
- textarea { width: 100%; min-height: 72px; max-height: 220px; resize: none; font: inherit; color: inherit; background: #f6f7f4; border: 1px solid #dde1db; border-radius: 7px; padding: 9px 10px; outline: none; }
144
- textarea:focus { border-color: #2453c4; background: #fff; }
307
+ .what code { font: 11.5px "Commit Mono", ui-monospace, Consolas, monospace; color: #9a9a92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
308
+ textarea { width: 100%; min-height: 72px; max-height: 220px; resize: none; font: inherit; color: inherit; background: #fafaf9; border: 1px solid #e6e6e1; border-radius: 7px; padding: 9px 10px; outline: none; }
309
+ textarea:focus { border-color: #141413; background: #fff; }
145
310
  .suggest { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 2px 0; }
146
- .suggest button { all: unset; cursor: pointer; font-size: 12.5px; color: #2453c4; }
311
+ .suggest button { all: unset; cursor: pointer; font-size: 12.5px; color: #141413; }
147
312
  .suggest button:hover { text-decoration: underline; text-underline-offset: 3px; }
148
313
  .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
149
- .hint { flex: 1; font-size: 11.5px; color: #8a939e; line-height: 1.3; }
150
- .btn { all: unset; cursor: pointer; font: 500 13px/1 "IBM Plex Sans", system-ui, sans-serif; padding: 8px 11px; border-radius: 6px; color: #5b6573; }
151
- .btn:hover { background: #eef0ec; color: #17202b; }
152
- .btn.primary { background: #2453c4; color: #fff; }
153
- .btn.primary:hover { background: #1b3f96; }
154
- .btn.danger { color: #b03a2e; }
155
- .btn:focus-visible { outline: 2px solid #2453c4; outline-offset: 2px; }
156
- .ring { position: absolute; border: 1.5px solid #2453c4; border-radius: 8px; pointer-events: none; }
314
+ .foot .btn { white-space: nowrap; }
315
+ .foot [data-act="details"] { padding-left: 2px; text-decoration: underline; text-underline-offset: 3px; }
316
+ .hint { flex: 1; font-size: 11.5px; color: #9a9a92; line-height: 1.3; }
317
+ .btn { all: unset; cursor: pointer; font: 500 13px/1 "Instrument Sans", system-ui, sans-serif; padding: 8px 11px; border-radius: 6px; color: #6c6c65; }
318
+ .btn:hover { background: #f2f2ef; color: #141413; }
319
+ .btn.primary { background: #141413; color: #fff; }
320
+ .btn.primary:hover { background: #3a3a36; }
321
+ .btn.danger { color: #c0392b; }
322
+ .btn:focus-visible { outline: 2px solid #141413; outline-offset: 2px; }
323
+ .ring { position: absolute; border: 1.5px solid #141413; border-radius: 8px; pointer-events: none; }
157
324
  .ring.active { border-width: 2px; }
158
- .ring.noted { border-color: rgba(36, 83, 196, .5); }
159
- @media (prefers-color-scheme: dark) { .ring { border-color: #7ea3ff; } .ring.noted { border-color: rgba(126, 163, 255, .55); } }
160
- .pin { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #2453c4; color: #fff;
161
- font: 600 11px/20px "IBM Plex Mono", ui-monospace, Consolas, monospace; text-align: center; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(23,32,43,.25); }
162
- .select-btn { position: absolute; all: unset; position: absolute; cursor: pointer; background: #17202b; color: #fff; font: 500 12.5px/1 "IBM Plex Sans", system-ui, sans-serif; padding: 7px 10px; border-radius: 6px; box-shadow: 0 6px 18px -8px rgba(23,32,43,.5); }
163
- .select-btn:hover { background: #2453c4; }
325
+ .ring.agent { border: 2px solid #141413; border-radius: 9px; }
326
+ .bubble { position: absolute; width: 300px; background: #141413; color: #fafaf9; border-radius: 10px; padding: 10px 30px 11px 12px; box-shadow: 0 14px 34px -14px rgba(20,20,19,.5); font: 13.5px/1.5 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; pointer-events: auto; }
327
+ .bubble-who { font-size: 11.5px; font-weight: 600; color: #ffe27a; margin-bottom: 3px; }
328
+ .bubble-text { white-space: pre-wrap; }
329
+ .bubble-x { all: unset; position: absolute; top: 6px; right: 8px; cursor: pointer; color: #a0a098; font-size: 16px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
330
+ .bubble-x:hover { color: #fff; background: rgba(255,255,255,.1); }
331
+ .ring.noted { border-color: rgba(20, 20, 19, .35); }
332
+ @media (prefers-color-scheme: dark) { .ring { border-color: #f2f2ee; } .ring.noted { border-color: rgba(242, 242, 238, .45); } }
333
+ .pin { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #ffe27a; color: #141413;
334
+ font: 600 11px/20px "Commit Mono", ui-monospace, Consolas, monospace; text-align: center; cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(20,20,19,.25); }
335
+ .select-btn { position: absolute; all: unset; position: absolute; cursor: pointer; background: #141413; color: #fff; font: 500 12.5px/1 "Instrument Sans", system-ui, sans-serif; padding: 7px 10px; border-radius: 6px; box-shadow: 0 6px 18px -8px rgba(20,20,19,.5); }
336
+ .select-btn:hover { background: #141413; }
337
+ @media (prefers-color-scheme: dark) {
338
+ .card { background: #1b1b1a; color: #f2f2ee; border-color: #44443f; box-shadow: 0 12px 32px -12px rgba(0,0,0,.6); }
339
+ textarea { background: #161615; border-color: #2f2f2c; }
340
+ textarea:focus { background: #161615; border-color: #f2f2ee; }
341
+ .suggest button { color: #f2f2ee; }
342
+ .btn { color: #a0a098; } .btn:hover { background: #252523; color: #f2f2ee; }
343
+ .btn.primary { background: #f2f2ee; color: #141413; }
344
+ .pin { border-color: #161615; }
345
+ }
346
+ .planact { position: absolute; display: flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid #d2d2cb; border-radius: 999px; box-shadow: 0 8px 22px -10px rgba(20,20,19,.4); pointer-events: auto; z-index: 3; animation: pa-in .22s cubic-bezier(.2,.8,.3,1.2) both; }
347
+ @keyframes pa-in { from { opacity: 0; transform: translateY(4px) scale(.92); } to { opacity: 1; transform: none; } }
348
+ .planact button { all: unset; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; color: #141413; transition: transform .12s ease, background-color .12s ease; }
349
+ .planact button:hover { background: #f2f2ef; transform: scale(1.1); }
350
+ .planact button.ok { background: #141413; color: #fff; }
351
+ .planact button.ok:hover { background: #3a3a36; }
352
+ .planact button:focus-visible { outline: 2px solid #141413; outline-offset: 2px; }
353
+ .planact svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
354
+ .planact .wait { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #2f7a4f; }
355
+ .planact .wait.revise { color: #6c6c65; animation: pa-pulse 1.4s ease-in-out infinite; }
356
+ @keyframes pa-pulse { 50% { opacity: .35; } }
357
+ @media (prefers-reduced-motion: reduce) { .planact, .planact .wait.revise { animation: none; } .planact button { transition: none; } }
164
358
  @media (prefers-color-scheme: dark) {
165
- .card { background: #191d23; color: #edf0f3; border-color: #3d4651; box-shadow: 0 12px 32px -12px rgba(0,0,0,.6); }
166
- textarea { background: #121519; border-color: #2a3039; }
167
- textarea:focus { background: #121519; border-color: #7ea3ff; }
168
- .suggest button { color: #7ea3ff; }
169
- .btn { color: #9ba4af; } .btn:hover { background: #1f242b; color: #edf0f3; }
170
- .btn.primary { background: #2453c4; color: #fff; }
171
- .pin { border-color: #121519; }
359
+ .planact { background: #1b1b1a; border-color: #44443f; }
360
+ .planact button { color: #f2f2ee; } .planact button:hover { background: #252523; }
361
+ .planact button.ok { background: #f2f2ee; color: #141413; }
362
+ .planact .wait { color: #7cc49c; }
172
363
  }
173
- </style><div id="rings"></div><div id="pins"></div><div id="slot"></div>`;
364
+ </style><div id="rings"></div><div id="pins"></div><div id="slot"></div><div id="planact"></div>`;
365
+ { const st = shadow.querySelector('style'); if (typeof tmThemeable === 'function') st.textContent = tmThemeable(st.textContent, { host: true }); }
366
+ const applyTheme = (t) => {
367
+ if (t === 'light' || t === 'dark') document.documentElement.setAttribute('data-theme', t); else document.documentElement.removeAttribute('data-theme');
368
+ host.classList.toggle('tm-dark', t === 'dark'); host.classList.toggle('tm-light', t === 'light');
369
+ };
370
+ applyTheme(document.documentElement.getAttribute('data-theme'));
174
371
  const pinsEl = shadow.getElementById('pins');
175
372
  const slot = shadow.getElementById('slot');
373
+ const planActEl = shadow.getElementById('planact');
374
+ let planNow = null;
375
+ const ICON = {
376
+ ok: '<svg viewBox="0 0 16 16"><path d="M3 8.5 6.5 12 13 4.5"/></svg>',
377
+ no: '<svg viewBox="0 0 16 16"><path d="M4 4l8 8M12 4l-8 8"/></svg>',
378
+ ask: '<svg viewBox="0 0 16 16"><path d="M3 3.5h10v7H7.5L4.5 13v-2.5H3z"/></svg>',
379
+ };
380
+ // The plan's actions sit next to the boxes it adds or changes, where your eyes already are.
381
+ function placePlanAct() {
382
+ planActEl.innerHTML = '';
383
+ const p = planNow;
384
+ if (!p || !['review', 'revise', 'approved'].includes(p.status)) return;
385
+ const els = [...document.querySelectorAll('[data-plan]')].filter((el) => el.isConnected && el.getBoundingClientRect().width);
386
+ if (!els.length) return;
387
+ mount();
388
+ const rs = els.map((el) => el.getBoundingClientRect());
389
+ const u = { l: Math.min(...rs.map((r) => r.left)) + scrollX, t: Math.min(...rs.map((r) => r.top)) + scrollY, r: Math.max(...rs.map((r) => r.right)) + scrollX, b: Math.max(...rs.map((r) => r.bottom)) + scrollY };
390
+ const box = document.createElement('div'); box.className = 'planact'; box.setAttribute('role', 'group'); box.setAttribute('aria-label', 'Plan');
391
+ if (p.status === 'review') box.innerHTML = `<button class="ok" data-pa="approve" title="Approve the plan" aria-label="Approve the plan">${ICON.ok}</button><button data-pa="reject" title="Reject the plan" aria-label="Reject the plan">${ICON.no}</button><button data-pa="ask" title="Ask or comment on the plan" aria-label="Ask or comment on the plan">${ICON.ask}</button>`;
392
+ else box.innerHTML = p.status === 'revise' ? `<span class="wait revise" title="Waiting for the revised plan">${ICON.ask}</span>` : `<span class="wait" title="Approved">${ICON.ok}</span>`;
393
+ box.title = p.title;
394
+ planActEl.appendChild(box);
395
+ const vw = document.documentElement.clientWidth; const w = box.offsetWidth; const h = box.offsetHeight;
396
+ let left = u.r + 10; let top = u.t - h / 2;
397
+ if (left + w > scrollX + vw - 8) { left = Math.max(scrollX + 8, u.r - w); top = u.t - h - 14; }
398
+ if (top < scrollY + 4) top = u.b + 10;
399
+ box.style.left = `${left}px`; box.style.top = `${top}px`;
400
+ box.onclick = (e) => {
401
+ const act = e.target.closest('[data-pa]')?.dataset.pa; if (!act) return;
402
+ if (act === 'ask') { const r = box.getBoundingClientRect(); openCard({ text: p.title, rect: docRect(r), planComment: true }); return; }
403
+ post({ type: 'plan-act', act });
404
+ };
405
+ }
176
406
  rings = shadow.getElementById('rings');
177
407
  const mount = () => { if (!host.isConnected) document.body.appendChild(host); };
178
408
 
@@ -192,24 +422,40 @@
192
422
  }
193
423
  function docRect(r) { return { left: r.left + scrollX, top: r.top + scrollY, right: r.right + scrollX, bottom: r.bottom + scrollY, width: r.width, height: r.height }; }
194
424
 
195
- function openCard({ target = null, text = null, rect, noteId = null }) {
425
+ function openCard({ target = null, text = null, rect, noteId = null, planComment = false, view = false }) {
196
426
  closeCard(); hideSelectBtn(); mount(); setHover(null);
197
427
  const existing = noteId ? notes.get(noteId) : null;
198
428
  const sel = getSelection();
199
429
  const range = existing ? existing.range || null : (text && sel?.rangeCount ? sel.getRangeAt(0).cloneRange() : null);
200
- const label = existing?.label || (target ? labelOf(target) : clean(text, 60));
430
+ const label = existing?.label || (target ? clean(target.getAttribute('data-name'), 60) || labelOf(target) : clean(text, 60));
201
431
  const src = existing?.src ?? (target ? target.closest('[data-src]')?.getAttribute('data-src') || '' : (text && rangeSrc()) || '');
202
432
  const el = document.createElement('div');
203
- el.className = 'card'; el.setAttribute('role', 'dialog'); el.setAttribute('aria-label', 'Comment');
204
- el.innerHTML = `<div class="what"><b></b><code></code></div><textarea rows="3"></textarea>
433
+ el.className = view ? 'card viewing' : 'card'; el.setAttribute('role', 'dialog'); el.setAttribute('aria-label', view ? 'About this box' : 'Comment');
434
+ el.innerHTML = `<div class="what"><b></b><code></code></div><div class="sum"></div><textarea rows="3"></textarea>
205
435
  <div class="suggest"></div>
206
- <div class="foot"><span class="hint"></span>${existing ? `<button class="btn danger" data-act="remove" type="button">${T.remove}</button>` : `<button class="btn" data-act="cancel" type="button">${T.cancel}</button>`}<button class="btn primary" data-act="add" type="button">${existing ? T.save : T.add}</button></div>`;
436
+ <div class="foot">${view ? '<button class="btn primary" data-act="comment" type="button" title="Or double-click the box">Comment</button>' : ''}${target ? '<button class="btn" data-act="details" type="button">Details</button>' : ''}<span class="hint"></span>${existing ? `<button class="btn danger" data-act="remove" type="button">${T.remove}</button>` : `<button class="btn" data-act="cancel" type="button">${T.cancel}</button>`}<button class="btn primary" data-act="add" type="button">${planComment ? 'Send' : existing ? T.save : T.add}</button></div>`;
207
437
  el.querySelector('b').textContent = text ? `“${label}”` : label;
208
- el.querySelector('code').textContent = src;
209
- el.querySelector('.hint').textContent = T.hint;
438
+ el.querySelector('code').textContent = target?.getAttribute('data-tag') || src;
439
+ // what it is, in a line or two; what a plan or a change says about it
440
+ if (target) {
441
+ const det = target.querySelector(':scope > .tm-detail');
442
+ const first = clean(det?.querySelector('p')?.textContent || target.querySelector('.tm-node-desc')?.textContent || '', 220);
443
+ const extra = [
444
+ target.getAttribute('data-plan-note') && `Plan: ${clean(target.getAttribute('data-plan-note'), 160)}`,
445
+ target.getAttribute('data-plan') === 'new' && 'New in this plan',
446
+ target.getAttribute('data-tm-delta') && `Changed: ${target.getAttribute('data-tm-delta')} lines`,
447
+ target.getAttribute('data-tm-mark') && (target.getAttribute('data-tm-mark') === 'broken' ? 'No longer matches the code' : 'The code changed since this box was checked'),
448
+ ].filter(Boolean);
449
+ const sumEl = el.querySelector('.sum');
450
+ sumEl.textContent = first;
451
+ for (const x of extra) { const d = document.createElement('div'); d.className = 'flag'; d.textContent = x; sumEl.appendChild(d); }
452
+ if (!first && !extra.length) sumEl.remove();
453
+ } else el.querySelector('.sum').remove();
454
+ el.querySelector('.hint').textContent = ''; el.querySelector('[data-act="add"]').title = T.hint;
210
455
  const ta = el.querySelector('textarea'); ta.placeholder = T.placeholder; ta.value = existing?.text || '';
211
456
  const sug = el.querySelector('.suggest');
212
- if (!existing) for (const [lbl, prompt] of T.suggest) {
457
+ if (planComment) { el.querySelector('b').textContent = `Plan: ${label}`; ta.placeholder = 'Ask a question or say what should change'; }
458
+ if (!existing && !planComment) for (const [lbl, prompt] of T.suggest) {
213
459
  const b = document.createElement('button'); b.type = 'button'; b.textContent = lbl;
214
460
  b.onclick = () => { ta.value = prompt; ta.focus(); };
215
461
  sug.appendChild(b);
@@ -217,7 +463,7 @@
217
463
  slot.appendChild(el);
218
464
  // position: below the target, kept inside the viewport
219
465
  const r = rect || docRect(target.getBoundingClientRect());
220
- const w = 340; const vw = document.documentElement.clientWidth;
466
+ const w = 360; const vw = document.documentElement.clientWidth;
221
467
  let left = Math.min(Math.max(8 + scrollX, r.left), scrollX + vw - w - 12);
222
468
  let top = r.bottom + 10;
223
469
  const h = el.offsetHeight || 220;
@@ -242,7 +488,9 @@
242
488
  };
243
489
  el.addEventListener('click', (e) => {
244
490
  const act = e.target.closest('[data-act]')?.dataset.act;
245
- if (act === 'add') finish(false);
491
+ if (act === 'add') finish(planComment);
492
+ else if (act === 'details') peek(target);
493
+ else if (act === 'comment') { el.classList.remove('viewing'); el.setAttribute('aria-label', 'Comment'); ta.focus({ preventScroll: true }); }
246
494
  else if (act === 'cancel') closeCard();
247
495
  else if (act === 'remove') { removeNote(noteId, true); closeCard(); }
248
496
  });
@@ -250,7 +498,8 @@
250
498
  if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); closeCard(); }
251
499
  else if (e.key === 'Enter' && !e.shiftKey && !e.isComposing && e.keyCode !== 229) { e.preventDefault(); finish(e.ctrlKey || e.metaKey); }
252
500
  });
253
- setTimeout(() => ta.focus({ preventScroll: true }), 0);
501
+ if (!view) setTimeout(() => ta.focus({ preventScroll: true }), 0);
502
+ else el.addEventListener('keydown', (e) => { if (e.key === 'Escape') { e.preventDefault(); closeCard(); } });
254
503
  }
255
504
 
256
505
  function rangeSrc() {
@@ -309,18 +558,53 @@
309
558
  return t.closest('a.tm-node,a.tm-link') || pickTarget(t);
310
559
  }
311
560
  document.addEventListener('mousemove', (e) => {
312
- if (!annotating || card) return;
313
561
  const t = e.target instanceof Element ? e.target : null;
562
+ if (!annotating) {
563
+ // Reading mode: hovering a box lights up its own wires.
564
+ const box = t?.closest('.tm-map .tm-node, .tm-blueprint .tm-node') || null;
565
+ if (box !== hotBox) { hotBox = box; markWires(); }
566
+ return;
567
+ }
568
+ if (card) return;
314
569
  setHover(annotTarget(t));
315
570
  }, { passive: true });
316
- document.addEventListener('mouseleave', () => setHover(null));
571
+ document.addEventListener('mouseleave', () => { setHover(null); if (hotBox) { hotBox = null; markWires(); } });
317
572
 
318
573
  document.addEventListener('click', (e) => {
319
574
  if (!e.isTrusted) return;
320
575
  if (e.composedPath().includes(host)) return;
321
576
  const t = e.target instanceof Element ? e.target : null;
322
577
  if (card) { closeCard(); if (!annotating) return; }
323
- if (!annotating || !t) return;
578
+ if (!t) return;
579
+ // A flow button lights up a whole path across the map (works in both modes).
580
+ const flow = t.closest('[data-tm-flow]');
581
+ if (flow) {
582
+ e.preventDefault(); e.stopPropagation();
583
+ const ids = flow.getAttribute('data-tm-flow').split(/[\s,]+/).filter(Boolean);
584
+ const same = focusSet.length && ids.every((id) => focusSet.some((el) => el.id === id));
585
+ if (same) clearFocus(); else applyFocus(ids, flow.getAttribute('data-note') || '', clean(flow.textContent, 60));
586
+ for (const b of document.querySelectorAll('[data-tm-flow]')) b.setAttribute('aria-pressed', String(!same && b === flow));
587
+ return;
588
+ }
589
+ if (!annotating) {
590
+ // A box opens the inspector (what it is, its code, its connections). Real links and controls inside work as usual.
591
+ const box = t.closest(boxSel);
592
+ const inner = t.closest('a[href],button,input,select,textarea,label,summary,.tm-ask,[role=tab]');
593
+ if (String(getSelection?.() || '').trim().length > 1) return;
594
+ if (!box) {
595
+ // Empty space: back to the plain map.
596
+ if (!inner) {
597
+ if (focusSet.length || focusNote) { clearFocus(); post({ type: 'focus-cleared' }); }
598
+ if (selected) { select(null); post({ type: 'deselect' }); }
599
+ for (const fig of document.querySelectorAll('figure.tm-diagram[data-flow]')) window.truemapDiagram?.setFlow(fig, null);
600
+ }
601
+ return;
602
+ }
603
+ if (inner && inner !== box && box.contains(inner)) return;
604
+ e.preventDefault(); e.stopPropagation();
605
+ openBox(box);
606
+ return;
607
+ }
324
608
  if (String(getSelection?.() || '').trim().length > 1) return;
325
609
  const el = annotTarget(t);
326
610
  if (!el) return;
@@ -329,6 +613,17 @@
329
613
  openCard({ target: el, noteId: existing?.id || null });
330
614
  }, true);
331
615
 
616
+ // A double click on a box goes straight to writing a comment (a single click only looks).
617
+ document.addEventListener('dblclick', (e) => {
618
+ if (!e.isTrusted || e.composedPath().includes(host)) return;
619
+ const t = e.target instanceof Element ? e.target : null;
620
+ const box = t?.closest(boxSel);
621
+ if (!box || t.closest('a[href],button,input,select,textarea,label,summary,.tm-ask,[role=tab]')) return;
622
+ e.preventDefault();
623
+ getSelection()?.removeAllRanges();
624
+ cardFor(box);
625
+ }, true);
626
+
332
627
  document.addEventListener('mouseup', (e) => {
333
628
  if (!e.isTrusted || e.composedPath().includes(host)) return;
334
629
  setTimeout(() => {
@@ -341,13 +636,15 @@
341
636
  });
342
637
  document.addEventListener('selectionchange', () => { if (!String(getSelection() || '').trim()) hideSelectBtn(); });
343
638
 
639
+ // Escape anywhere in the page closes the inspector and the workspace's menus.
640
+ document.addEventListener('mouseup', (e) => { if (e.button === 3 || e.button === 4) { e.preventDefault(); post({ type: 'nav', dir: e.button === 3 ? 'back' : 'forward' }); } }, true);
344
641
  document.addEventListener('keydown', (e) => {
642
+ if (e.key === 'Escape') { select(null); post({ type: 'press' }); for (const fig of document.querySelectorAll('figure.tm-diagram[data-flow]')) window.truemapDiagram?.setFlow(fig, null); }
643
+ if (e.altKey && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) { e.preventDefault(); post({ type: 'nav', dir: e.key === 'ArrowLeft' ? 'back' : 'forward' }); return; }
345
644
  const typing = e.target instanceof Element && e.target.closest('input,textarea,select,[contenteditable]');
346
645
  if (e.key === 'Escape' && card) { closeCard(); return; }
347
- if (e.key === 'Escape' && annotating && !typing && !e.defaultPrevented && !e.composedPath().includes(host)) { post({ type: 'annotate-off' }); return; }
348
- if (!typing && !e.composedPath().includes(host) && !e.ctrlKey && !e.metaKey && !e.altKey && e.key.toLowerCase() === 'a') {
349
- post({ type: 'toggle-annotate' });
350
- }
646
+ if (e.key === 'Escape' && (focusSet.length || focusNote)) { clearFocus(); post({ type: 'focus-cleared' }); return; }
647
+ if ((e.key === 'Enter' || e.key === ' ') && !annotating && e.target instanceof Element && e.target.matches?.('.tm-node, .tm-step') && !typing) { e.preventDefault(); cardFor(e.target); return; }
351
648
  });
352
649
 
353
650
  // ---------- decisions: <form class="tm-ask" data-tm-ask="question"> ----------
@@ -378,6 +675,7 @@
378
675
  window.addEventListener('message', (e) => {
379
676
  if (e.source !== parentWin || e.origin !== PARENT || !e.data || !e.data.__truemap) return;
380
677
  const d = e.data;
678
+ if (d.type === 'theme') { applyTheme(d.theme); return; }
381
679
  if (d.type === 'marks') {
382
680
  document.querySelectorAll('[data-tm-mark]').forEach((el) => el.removeAttribute('data-tm-mark'));
383
681
  for (const m of d.items || []) {
@@ -407,6 +705,51 @@
407
705
  else if (n?.rect) window.scrollTo({ top: n.rect.top - innerHeight / 3, behavior: 'smooth' });
408
706
  } else if (d.type === 'scroll') {
409
707
  window.scrollTo(0, d.y || 0);
708
+ } else if (d.type === 'focus') {
709
+ applyFocus(d.items, d.note, d.who, d.scroll === undefined ? 'center' : d.scroll, !!d.transient);
710
+ } else if (d.type === 'select') {
711
+ select(d.id ? document.getElementById(d.id) : null);
712
+ } else if (d.type === 'plan') {
713
+ planNow = d.plan || null;
714
+ // A plan drawn on the map: what it touches, adds (dashed, in its group) and removes.
715
+ for (const el of document.querySelectorAll('[data-plan-overlay], [data-plan-revised]')) { el.removeAttribute('data-plan'); el.removeAttribute('data-plan-note'); el.removeAttribute('data-plan-overlay'); el.removeAttribute('data-plan-revised'); }
716
+ clearFocus();
717
+ const p = d.plan;
718
+ document.documentElement.toggleAttribute('data-tm-plan', !!p);
719
+ const fig = document.querySelector('figure.tm-diagram');
720
+ if (fig && window.truemapDiagram?.setGhosts) window.truemapDiagram.setGhosts(fig, p ? p.add : []);
721
+ else if (p) post({ type: 'plan-unsupported' }); // an old-format map: the plan can't be drawn on it
722
+ const markPlan = (box, kind, note) => {
723
+ const el = findItems([box])[0];
724
+ if (!el || el.getAttribute('data-plan') === 'new') return;
725
+ el.setAttribute('data-plan', kind); el.setAttribute('data-plan-overlay', ''); if (note) el.setAttribute('data-plan-note', note);
726
+ };
727
+ if (p) { for (const t of p.touch || []) markPlan(t.box, 'change', t.what); for (const r of p.remove || []) markPlan(r.box, 'remove', r.why); }
728
+ for (const id of p?.revised || []) findItems([id])[0]?.setAttribute('data-plan-revised', '');
729
+ setTimeout(placePlanAct, 60);
730
+ for (const b of document.querySelectorAll('.tm-node, .tm-step')) { if (!b.hasAttribute('tabindex') && !b.matches('a[href]')) b.setAttribute('tabindex', '0'); }
731
+ markWires();
732
+ } else if (d.type === 'changes') {
733
+ // Review mode: changed boxes carry their +/- lines; the rest of the map goes quiet.
734
+ document.documentElement.toggleAttribute('data-tm-changes', !!d.on);
735
+ for (const el of document.querySelectorAll('[data-tm-change], [data-tm-unbuilt]')) { el.removeAttribute('data-tm-change'); el.removeAttribute('data-tm-delta'); el.removeAttribute('data-tm-unbuilt'); el.removeAttribute('data-tm-new'); }
736
+ for (const u of d.unbuilt || []) { const el = findItems([u.src || u.box, u.box])[0]; if (el) el.setAttribute('data-tm-unbuilt', ''); }
737
+ const names = [];
738
+ for (const it of d.items || []) {
739
+ for (const el of document.querySelectorAll('[data-src]')) {
740
+ if (el.getAttribute('data-src') !== it.src) continue;
741
+ el.setAttribute('data-tm-change', '');
742
+ el.setAttribute('data-tm-delta', (it.isNew ? 'New ' : '') + (it.add == null ? 'binary' : [it.add ? '+' + it.add : '', it.del ? '−' + it.del : ''].filter(Boolean).join(' ') || '±0'));
743
+ el.toggleAttribute('data-tm-new', !!it.isNew);
744
+ names.push({ src: it.src, name: clean(el.getAttribute('data-name'), 60) || labelOf(el) });
745
+ }
746
+ }
747
+ if (names.length) post({ type: 'changes-names', items: names });
748
+ } else if (d.type === 'open-box') {
749
+ const el = d.id ? document.getElementById(d.id) : [...document.querySelectorAll('[data-src]')].find((x) => x.getAttribute('data-src') === d.src);
750
+ if (el) { reveal([el], 'nearest'); select(el); peek(el); }
751
+ } else if (d.type === 'clear-focus') {
752
+ clearFocus();
410
753
  } else if (d.type === 'highlight') {
411
754
  const el = [...document.querySelectorAll('[data-src]')].find((x) => x.getAttribute('data-src') === d.src);
412
755
  if (el) { el.scrollIntoView({ block: 'center', behavior: 'smooth' }); el.setAttribute('data-tm-flash', ''); setTimeout(() => el.removeAttribute('data-tm-flash'), 2400); }
@@ -422,8 +765,14 @@
422
765
  // Rings follow their element when anything scrolls, including a map scrolling sideways.
423
766
  document.addEventListener('scroll', () => { if (rings && (hovered || card || notes.size)) { placePins(); } }, { capture: true, passive: true });
424
767
 
768
+ window.truemapDiagram?.interact();
425
769
  const ready = () => {
426
770
  drawWires();
771
+ // index.html#runs: arriving from a draft's box link lights that box on the map
772
+ const hashId = decodeURIComponent((location.hash || '').slice(1));
773
+ if (hashId && /^[\w-]+$/.test(hashId) && document.getElementById(hashId)) setTimeout(() => applyFocus([hashId], '', '', 'center'), 250);
774
+ // Boxes are reachable from the keyboard too.
775
+ for (const b of document.querySelectorAll('.tm-node, .tm-step')) { if (!b.hasAttribute('tabindex') && !b.matches('a[href]')) b.setAttribute('tabindex', '0'); }
427
776
  if ('ResizeObserver' in window) new ResizeObserver(scheduleWires).observe(document.body);
428
777
  document.fonts?.ready?.then(scheduleWires);
429
778
  const meta = document.querySelector('meta[name="truemap-annotate"]')?.getAttribute('content');