@floless/app 0.163.0 → 0.164.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/dist/floless-server.cjs +41379 -40421
- package/dist/web/app.css +2 -0
- package/dist/web/chat.css +10 -0
- package/dist/web/chat.js +290 -36
- package/dist/web/commands-filter.js +35 -0
- package/dist/web/commands-shell.js +18 -7
- package/dist/web/commands-steel.js +9 -0
- package/dist/web/model-editor-steel-adapter.js +2 -0
- package/dist/web/project-rfis.js +53 -3
- package/dist/web/steel-3d-view.js +154 -0
- package/dist/web/steel-ai-marks.js +233 -0
- package/dist/web/steel-editor.html +509 -24
- package/dist/web/steel-filter-flo.js +225 -0
- package/dist/web/steel-filter.html +118 -4
- package/dist/web/workspaces.js +137 -20
- package/package.json +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #2926: Flo on the Drawing Filter, showing which part of the drawing the AI is reading.
|
|
3
|
+
*
|
|
4
|
+
* The shell (`filterFloState` in workspaces.js) decides, from the read's own signals, whether Flo is reading,
|
|
5
|
+
* waiting on the person, or off, and passes the sheet pictures the read last asked for. This module only shows
|
|
6
|
+
* that state on the stage. It never decides that work is happening and never invents what is seen: the box is
|
|
7
|
+
* the picture the AI was given, and the bubble's words are the progress record's or the AI's own.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const FLO_PART_NAMES = ['', 'top-left', 'top-middle', 'top-right', 'middle-left', 'middle', 'middle-right',
|
|
11
|
+
'bottom-left', 'bottom-middle', 'bottom-right'];
|
|
12
|
+
/** A look older than this has no box any more: Flo thinks where it is. */
|
|
13
|
+
export const FLO_FRESH_LOOK_MS = 45_000;
|
|
14
|
+
/** Several looks between two polls: Flo visits at most the newest FLO_CATCH_UP, FLO_VISIT_MS each. */
|
|
15
|
+
export const FLO_CATCH_UP = 3;
|
|
16
|
+
export const FLO_VISIT_MS = 2500;
|
|
17
|
+
export const FLO_STORAGE_KEY = 'floless:filter-flo';
|
|
18
|
+
|
|
19
|
+
/** The Filter sheet a look is of: the ONE sheet with its source and page number, else -1 (none, or two). */
|
|
20
|
+
export function floSheetIndex(sheets, look) {
|
|
21
|
+
let found = -1;
|
|
22
|
+
(sheets || []).forEach((sh, i) => {
|
|
23
|
+
if (found === -2 || String(sh?.sourceHash || '').toLowerCase() !== look.sourceHash || sh.pageNumber !== look.pageNumber) return;
|
|
24
|
+
found = found === -1 ? i : -2;
|
|
25
|
+
});
|
|
26
|
+
return found < 0 ? -1 : found;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The part of a sheet a look covered, in the sheet's coordinates. `rect: null` was the sheet's own picture. */
|
|
30
|
+
export function floLookBox(sheet, look, bgRect) {
|
|
31
|
+
if (!look.rect) return bgRect(sheet);
|
|
32
|
+
const w = sheet?.page?.w || 0, h = sheet?.page?.h || 0;
|
|
33
|
+
const [x0, y0, x1, y1] = look.rect;
|
|
34
|
+
return { x: x0 * w, y: y0 * h, w: (x1 - x0) * w, h: (y1 - y0) * h };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Where Flo is looking, in words. `sheet` is the Filter sheet's name, or null when the Filter has none for it. */
|
|
38
|
+
export function floWhere(look, sheet) {
|
|
39
|
+
// The set may be several files, so the page number is of its own file.
|
|
40
|
+
if (!sheet) return `Looking at a page the Filter does not show (page ${look.pageNumber} of its file)`;
|
|
41
|
+
return look.part ? `Looking at the ${FLO_PART_NAMES[look.part]} part of ${sheet}` : `Looking at the whole of ${sheet}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Where Flo stands (its top-left, stage px) beside a box it is reading, and which side its bubble goes.
|
|
46
|
+
* Just above the box's top-left corner; just under it when there is no room above, so neither Flo nor the bubble
|
|
47
|
+
* covers what is being read. Only a box filling the view puts them inside it. `pw`/`ph` are the pilot's size
|
|
48
|
+
* (Flo + bubble), `top`/`bottom` the bands to keep clear.
|
|
49
|
+
*/
|
|
50
|
+
export function floPerch(box, stage, pilot, clear) {
|
|
51
|
+
const { W, H } = stage, { pw, ph, fw } = pilot;
|
|
52
|
+
let x = box.L - 30;
|
|
53
|
+
const above = box.T - ph - 2, below = box.B + 2;
|
|
54
|
+
let y = above >= clear.top ? above : below + ph <= H - clear.bottom ? below : box.T + 8;
|
|
55
|
+
const left = x + pw > W - 8;
|
|
56
|
+
if (left) x = x + fw - pw;
|
|
57
|
+
return { x: Math.max(8, Math.min(W - pw - 8, x)), y: Math.max(clear.top, Math.min(H - clear.bottom - ph, y)), left };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The overlay. `d` is the page's half: its elements and what only it knows.
|
|
62
|
+
* root, scan, pilot, bubble, head, sentence, where, showBtn, answerBtn, toggle, live: the elements;
|
|
63
|
+
* avatar: floAvatar(...)'s handle, or null; stage: the stage element;
|
|
64
|
+
* sheets(), active(), setSheet(i), focusSheets(): the Filter's sheets;
|
|
65
|
+
* toStage(x, y): a sheet point in stage px; bgRect(sheet): where the sheet's own picture lies;
|
|
66
|
+
* clearTop(), clearBottom(): px kept clear (the place bar; the zoom bar and the note above it);
|
|
67
|
+
* ask(): asks the shell to open the question in AI Chat; storage: localStorage or null; now(): ms.
|
|
68
|
+
*/
|
|
69
|
+
export function mountFilterFlo(d) {
|
|
70
|
+
let state = { mode: 'off' };
|
|
71
|
+
let on = true;
|
|
72
|
+
try { on = d.storage?.getItem(FLO_STORAGE_KEY) !== 'off'; } catch { /* private mode: on, the default */ }
|
|
73
|
+
let cur = null, queue = [], tour = 0, freshTimer = 0, leaving = 0, lastSeq = 0, last = null, spoken = '', read = null, unpin = 0;
|
|
74
|
+
|
|
75
|
+
const show = (el, yes) => { el.hidden = !yes; };
|
|
76
|
+
const sheetName = (i) => (i >= 0 ? d.sheets()[i]?.sheet || null : null);
|
|
77
|
+
|
|
78
|
+
function hide() {
|
|
79
|
+
clearTimeout(freshTimer);
|
|
80
|
+
d.avatar?.setMood('idle');
|
|
81
|
+
if (d.root.hidden || leaving) return;
|
|
82
|
+
d.root.classList.add('leaving');
|
|
83
|
+
leaving = setTimeout(() => { leaving = 0; d.root.hidden = true; d.root.classList.remove('leaving'); }, 300);
|
|
84
|
+
}
|
|
85
|
+
function reveal() {
|
|
86
|
+
if (leaving) { clearTimeout(leaving); leaving = 0; d.root.classList.remove('leaving'); }
|
|
87
|
+
d.root.hidden = false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function step() {
|
|
91
|
+
clearTimeout(tour); tour = 0;
|
|
92
|
+
if (!queue.length) return;
|
|
93
|
+
cur = queue.shift();
|
|
94
|
+
render();
|
|
95
|
+
if (queue.length) tour = setTimeout(step, FLO_VISIT_MS);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The state the shell decided. Called on every poll; new looks start a short visit, oldest first. */
|
|
99
|
+
function update(next) {
|
|
100
|
+
state = next && typeof next === 'object' ? next : { mode: 'off' };
|
|
101
|
+
// A picture belongs to the read that asked for it: another read starts with no box. The same read keeps its
|
|
102
|
+
// picture and its visits through a wait or a moment off, so reading resumes where it was.
|
|
103
|
+
if (state.read !== read) { read = state.read; cur = null; queue = []; clearTimeout(tour); tour = 0; }
|
|
104
|
+
if (state.mode === 'reading') {
|
|
105
|
+
const t = d.now(), looks = Array.isArray(state.looks) ? state.looks : [];
|
|
106
|
+
const newest = looks.reduce((m, l) => Math.max(m, l.seq), 0);
|
|
107
|
+
if (looks.length && newest < lastSeq) lastSeq = 0; // the server restarted and numbers looks from 1 again
|
|
108
|
+
const fresh = looks.filter((l) => l.seq > lastSeq && l.ageMs < FLO_FRESH_LOOK_MS).map((l) => ({ ...l, at: t - l.ageMs }));
|
|
109
|
+
lastSeq = Math.max(lastSeq, newest);
|
|
110
|
+
if (fresh.length) {
|
|
111
|
+
queue = fresh.slice(-FLO_CATCH_UP);
|
|
112
|
+
if (!tour) { step(); return; }
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
render();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function render(instant = false) {
|
|
119
|
+
// The switch is there only while a read is live: with nothing to show it would be a control that does nothing.
|
|
120
|
+
d.toggle.hidden = state.mode !== 'reading' && state.mode !== 'waiting';
|
|
121
|
+
const mode = on ? state.mode : 'off';
|
|
122
|
+
const waiting = mode === 'waiting';
|
|
123
|
+
// Said once on the way in (and again only if what it waits on changes), never per poll: the bubble is not a
|
|
124
|
+
// live region.
|
|
125
|
+
const said = waiting ? `Waiting for your answer: ${state.text}` : '';
|
|
126
|
+
if (said !== spoken) { d.live.textContent = said; spoken = said; }
|
|
127
|
+
if (mode !== 'reading' && mode !== 'waiting') { hide(); return; }
|
|
128
|
+
reveal();
|
|
129
|
+
clearTimeout(freshTimer);
|
|
130
|
+
const t = d.now();
|
|
131
|
+
const look = mode === 'reading' && cur && t - cur.at < FLO_FRESH_LOOK_MS ? cur : null;
|
|
132
|
+
const at = look ? floSheetIndex(d.sheets(), look) : -1;
|
|
133
|
+
d.bubble.classList.toggle('waiting', waiting);
|
|
134
|
+
if (waiting) {
|
|
135
|
+
d.head.textContent = 'Waiting for your answer';
|
|
136
|
+
d.sentence.textContent = state.text;
|
|
137
|
+
d.where.textContent = state.chat ? '' : 'Answer it in the terminal where the read is running.';
|
|
138
|
+
} else {
|
|
139
|
+
d.head.textContent = state.label || 'Now:';
|
|
140
|
+
d.sentence.textContent = state.now || '';
|
|
141
|
+
d.where.textContent = look ? floWhere(look, sheetName(at)) : '';
|
|
142
|
+
}
|
|
143
|
+
show(d.where, !!d.where.textContent);
|
|
144
|
+
const away = !!look && at >= 0 && at !== d.active();
|
|
145
|
+
if (away) d.showBtn.textContent = `Show ${sheetName(at)}`;
|
|
146
|
+
show(d.showBtn, away);
|
|
147
|
+
show(d.answerBtn, waiting && !!state.chat);
|
|
148
|
+
if (waiting) { d.avatar?.setMood('yourcall', true); d.avatar?.rest(); }
|
|
149
|
+
else d.avatar?.setMood(look ? 'working' : 'thinking', true);
|
|
150
|
+
place(instant, look, at);
|
|
151
|
+
if (look) freshTimer = setTimeout(() => render(), Math.max(0, cur.at + FLO_FRESH_LOOK_MS - t) + 50);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Puts Flo, its bubble and the box where the state says, in stage px. `instant` while the view moves. */
|
|
155
|
+
function place(instant = false, look = undefined, at = undefined) {
|
|
156
|
+
if (d.root.hidden || d.root.classList.contains('leaving')) return;
|
|
157
|
+
const W = d.stage.clientWidth, H = d.stage.clientHeight;
|
|
158
|
+
if (!W || !H) return;
|
|
159
|
+
if (look === undefined) {
|
|
160
|
+
const t = d.now();
|
|
161
|
+
look = state.mode === 'reading' && cur && t - cur.at < FLO_FRESH_LOOK_MS ? cur : null;
|
|
162
|
+
at = look ? floSheetIndex(d.sheets(), look) : -1;
|
|
163
|
+
}
|
|
164
|
+
if (instant) {
|
|
165
|
+
// Glides come back two frames after the LAST move: one pending at a time, or a pan's earlier frame turns them
|
|
166
|
+
// on under its later ones and Flo trails the drawing.
|
|
167
|
+
d.root.classList.add('instant');
|
|
168
|
+
cancelAnimationFrame(unpin);
|
|
169
|
+
unpin = requestAnimationFrame(() => { unpin = requestAnimationFrame(() => { unpin = 0; d.root.classList.remove('instant'); }); });
|
|
170
|
+
}
|
|
171
|
+
d.bubble.style.maxWidth = `${Math.max(140, Math.min(290, W - 96))}px`;
|
|
172
|
+
const pilot = { pw: d.pilot.offsetWidth || 0, ph: d.pilot.offsetHeight || 0, fw: 46 };
|
|
173
|
+
const clear = { top: d.clearTop(), bottom: d.clearBottom() };
|
|
174
|
+
let p = null, box = null;
|
|
175
|
+
if (state.mode === 'waiting' && on) {
|
|
176
|
+
p = { x: 12, y: Math.max(clear.top, H - clear.bottom - pilot.ph), left: false };
|
|
177
|
+
} else if (look && at >= 0 && at === d.active()) {
|
|
178
|
+
const sh = d.sheets()[at], r = floLookBox(sh, look, d.bgRect);
|
|
179
|
+
const a = d.toStage(r.x, r.y), b = d.toStage(r.x + r.w, r.y + r.h);
|
|
180
|
+
box = { L: Math.max(4, a.x), T: Math.max(4, a.y), R: Math.min(W - 4, b.x), B: Math.min(H - 4, b.y) };
|
|
181
|
+
if (box.R - box.L < 8 || box.B - box.T < 8) box = null; // that part is out of view: no box to draw
|
|
182
|
+
p = floPerch(box || { L: Math.min(Math.max(a.x, 38), W), T: Math.max(a.y, clear.top), B: Math.max(a.y, clear.top) },
|
|
183
|
+
{ W, H }, pilot, clear);
|
|
184
|
+
} else if (look) {
|
|
185
|
+
// Reading a sheet that is not on screen, or a page the Filter has no single sheet for: wait at the top, with a
|
|
186
|
+
// Show button when the Filter has that sheet. The view never moves by itself.
|
|
187
|
+
p = { x: Math.max(8, (W - pilot.pw) / 2), y: clear.top, left: false };
|
|
188
|
+
} else {
|
|
189
|
+
// Between pictures: think where it stood.
|
|
190
|
+
p = last ? { ...last, y: Math.max(clear.top, Math.min(H - clear.bottom - pilot.ph, last.y)) } : { x: 16, y: clear.top, left: false };
|
|
191
|
+
}
|
|
192
|
+
last = p;
|
|
193
|
+
d.pilot.classList.toggle('left', p.left);
|
|
194
|
+
d.pilot.style.transform = `translate(${Math.round(p.x)}px, ${Math.round(p.y)}px)`;
|
|
195
|
+
d.scan.classList.toggle('hide', !box);
|
|
196
|
+
if (box) {
|
|
197
|
+
Object.assign(d.scan.style, { left: `${box.L}px`, top: `${box.T}px`, width: `${box.R - box.L}px`, height: `${box.B - box.T}px` });
|
|
198
|
+
const fx = p.left ? p.x + pilot.pw - pilot.fw / 2 : p.x + pilot.fw / 2, fy = p.y + 30;
|
|
199
|
+
const k = (v) => Math.max(-1, Math.min(1, v / 140));
|
|
200
|
+
d.avatar?.lookAt(k((box.L + box.R) / 2 - fx), k((box.T + box.B) / 2 - fy));
|
|
201
|
+
} else if (state.mode === 'reading') d.avatar?.rest();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function setOn(next) {
|
|
205
|
+
on = !!next;
|
|
206
|
+
d.toggle.setAttribute('aria-pressed', String(on));
|
|
207
|
+
try { d.storage?.setItem(FLO_STORAGE_KEY, on ? 'on' : 'off'); } catch { /* private mode */ }
|
|
208
|
+
render(true);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
d.toggle.setAttribute('aria-pressed', String(on));
|
|
212
|
+
d.toggle.addEventListener('click', () => setOn(!on));
|
|
213
|
+
d.showBtn.addEventListener('click', () => {
|
|
214
|
+
const i = cur ? floSheetIndex(d.sheets(), cur) : -1;
|
|
215
|
+
if (i < 0) return;
|
|
216
|
+
d.setSheet(i);
|
|
217
|
+
render(true);
|
|
218
|
+
d.focusSheets(); // the button is gone now that its sheet is on screen
|
|
219
|
+
});
|
|
220
|
+
d.answerBtn.addEventListener('click', () => d.ask());
|
|
221
|
+
// Pan and hover pass through everything but the buttons.
|
|
222
|
+
for (const el of [d.showBtn, d.answerBtn]) el.addEventListener('pointerdown', (e) => e.stopPropagation());
|
|
223
|
+
|
|
224
|
+
return { update, place: (instant) => place(instant), isOn: () => on };
|
|
225
|
+
}
|
|
@@ -518,6 +518,10 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
518
518
|
12px insets) -- one row at a 290px stage, two rows at 250px, every button fully visible and inside
|
|
519
519
|
the stage in both. Measured above 768px on purpose: below it the harness emulates a touch device,
|
|
520
520
|
where `@media not (hover:hover)` hides Hover info outright and the bar is back to two buttons.
|
|
521
|
+
FOUR BUTTONS while Flo is reading or waiting (#2926 adds Show Flo, hidden otherwise; three on a touch device,
|
|
522
|
+
which hides Hover info): measured 334px on one row in a
|
|
523
|
+
real browser, so by the same arithmetic it first wraps once #stage is narrower than ~358px. Not re-measured at
|
|
524
|
+
the wrap itself.
|
|
521
525
|
On the button rule: min-width:0 and overflow:hidden are ALTERNATIVE ways to defeat a flex item's
|
|
522
526
|
content-based automatic minimum size, not a pair — measured by toggling each, and removing either
|
|
523
527
|
one alone still let the button shrink to 46px, while removing BOTH pinned it at its 86px content
|
|
@@ -531,7 +535,8 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
531
535
|
#zoombar button{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:var(--stage-btn);border-color:var(--stage-ctrl);color:var(--stage-text)}
|
|
532
536
|
#zoombar button:hover{background:var(--stage-btn-hover)}
|
|
533
537
|
/* Hover info is a READ tool, not a framing control -- the divider says so, so the bar reads as the
|
|
534
|
-
framing pair plus
|
|
538
|
+
framing pair plus the canvas tools after it (Hover info, and Show Flo during a read) rather than
|
|
539
|
+
commands of one kind. aria-hidden: it is
|
|
535
540
|
decoration, and the buttons' own names already say what each does. */
|
|
536
541
|
#zoombar .zb-sep{width:1px;align-self:stretch;background:var(--stage-line);flex:none}
|
|
537
542
|
/* Hover info ON. It reuses button.primary's exact fill — the "this is active" language the page
|
|
@@ -630,6 +635,50 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
630
635
|
#hoverNote{position:absolute;left:12px;bottom:58px;max-width:min(360px, calc(100% - 24px));background:var(--stage-panel);border:1px solid var(--stage-line);border-left:3px solid var(--warn);border-radius:0 8px 8px 0;padding:8px 10px;box-shadow:var(--stage-shadow);color:var(--stage-mut);font-size:12px;line-height:1.5;pointer-events:none;z-index:30}
|
|
631
636
|
#hoverNote[hidden]{display:none}
|
|
632
637
|
#hoverNote b{display:block;color:var(--stage-text);font-weight:600;margin-bottom:2px}
|
|
638
|
+
/* #2926: Flo, showing which part of the drawing the AI is reading (web/steel-filter-flo.js). Stage furniture
|
|
639
|
+
only: the stage tokens, the brand outline #focusPlace already draws, and #hoverNote's amber rail for "waiting
|
|
640
|
+
on you" — the rail alone carries the amber, for the reason given above. No new colour. Takes no pointer
|
|
641
|
+
events but its buttons', so panning and Hover info work through it. Hidden means display:none, which also
|
|
642
|
+
stops Flo's animation loop (flo-avatar.js only draws what is on screen). */
|
|
643
|
+
#floToggle[hidden]{display:none}
|
|
644
|
+
#floFx{position:absolute;inset:0;pointer-events:none;overflow:hidden;transition:opacity .3s ease;--flo-glide:cubic-bezier(.22,1,.36,1)}
|
|
645
|
+
#floFx[hidden]{display:none}
|
|
646
|
+
#floFx.leaving{opacity:0}
|
|
647
|
+
#floScan{position:absolute;left:0;top:0;width:0;height:0;border-radius:6px;overflow:hidden;background:color-mix(in srgb,var(--brand) 6%,transparent);transition:left .95s var(--flo-glide),top .95s var(--flo-glide),width .95s var(--flo-glide),height .95s var(--flo-glide),opacity .4s ease}
|
|
648
|
+
#floScan.hide{opacity:0}
|
|
649
|
+
#floScan i{position:absolute;width:16px;height:16px;border:2px solid var(--brand)}
|
|
650
|
+
#floScan i:nth-of-type(1){left:0;top:0;border-right:0;border-bottom:0;border-top-left-radius:6px}
|
|
651
|
+
#floScan i:nth-of-type(2){right:0;top:0;border-left:0;border-bottom:0;border-top-right-radius:6px}
|
|
652
|
+
#floScan i:nth-of-type(3){left:0;bottom:0;border-right:0;border-top:0;border-bottom-left-radius:6px}
|
|
653
|
+
#floScan i:nth-of-type(4){right:0;bottom:0;border-left:0;border-top:0;border-bottom-right-radius:6px}
|
|
654
|
+
/* A slow light down the box, then a rest: it sits over linework people read for half an hour. */
|
|
655
|
+
#floScan span{position:absolute;inset:0;transform:translateY(-100%);background:linear-gradient(to bottom,transparent calc(100% - 46px),color-mix(in srgb,var(--brand) 25%,transparent));animation:flo-sweep 7s linear infinite}
|
|
656
|
+
#floScan.hide span{animation:none}
|
|
657
|
+
@keyframes flo-sweep{36%{transform:translateY(0)}36.1%,100%{transform:translateY(-100%)}}
|
|
658
|
+
#floPilot{position:absolute;left:0;top:0;display:flex;align-items:flex-start;gap:4px;transition:transform 1.1s var(--flo-glide)}
|
|
659
|
+
#floPilot.left{flex-direction:row-reverse}
|
|
660
|
+
#floFx.instant #floPilot,#floFx.instant #floScan{transition:none}
|
|
661
|
+
#floAvatar{flex:none}
|
|
662
|
+
#floAvatar .flo-avatar{display:block;--flo-line:var(--brand);--flo-fill:var(--stage-panel);--flo-hat:var(--stage-text);--flo-hat-line:var(--stage-text);--flo-pulse:var(--stage-text)}
|
|
663
|
+
/* On a light sheet a white hat needs its outline, as app.css gives Flo in the light theme. */
|
|
664
|
+
[data-theme="light"] #floAvatar .flo-avatar{--flo-hat-line:var(--brand)}
|
|
665
|
+
#floDots{position:relative;width:14px;height:40px;flex:none}
|
|
666
|
+
#floDots i{position:absolute;border-radius:50%;background:var(--stage-panel);border:1px solid var(--stage-line)}
|
|
667
|
+
#floDots i:first-child{width:6px;height:6px;left:1px;top:24px}
|
|
668
|
+
#floDots i:last-child{width:9px;height:9px;left:6px;top:12px}
|
|
669
|
+
#floPilot.left #floDots i:first-child{left:7px}
|
|
670
|
+
#floPilot.left #floDots i:last-child{left:-1px}
|
|
671
|
+
#floBubble{max-width:290px;padding:8px 11px;background:var(--stage-panel);border:1px solid var(--stage-line);border-radius:8px;box-shadow:var(--stage-shadow);color:var(--stage-text);font-size:12.5px;line-height:1.45}
|
|
672
|
+
#floBubble.waiting{border-left:3px solid var(--warn);border-radius:0 8px 8px 0}
|
|
673
|
+
#floBubble p{margin:0}
|
|
674
|
+
#floHead{font-weight:600}
|
|
675
|
+
#floBubble.waiting #floHead{display:block;margin-bottom:2px}
|
|
676
|
+
#floBubble.waiting #floNow{display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden}
|
|
677
|
+
#floWhere{display:block;margin-top:3px;color:var(--stage-mut);font-size:12px}
|
|
678
|
+
#floWhere[hidden],#floBubble button[hidden]{display:none}
|
|
679
|
+
#floBubble button{display:block;pointer-events:auto;margin-top:7px;white-space:nowrap;background:var(--stage-btn);border-color:var(--stage-ctrl);color:var(--stage-text)}
|
|
680
|
+
#floBubble button:hover{background:var(--stage-btn-hover)}
|
|
681
|
+
@media (prefers-reduced-motion:reduce){#floFx,#floPilot,#floScan{transition:none}#floScan span{display:none}}
|
|
633
682
|
/* The hovered element's own row in each facet: the checkbox the user is about to untick, lit where it
|
|
634
683
|
sits. Reuses the option-row hover fill and the left-accent idiom .sheet-option.selected already
|
|
635
684
|
carries — no new colour, no new shape. This is the half of the feature that answers the actual
|
|
@@ -820,14 +869,31 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
820
869
|
<p class="hint" style="margin-top:8px;max-width:340px">The AI reading your drawings prepares this filter. Its layers, line weights and colours will appear here automatically when ready.</p>
|
|
821
870
|
</div>
|
|
822
871
|
</div>
|
|
872
|
+
<!-- #2926: Flo, showing which part of the drawing the AI is reading. Below the stage's bars in the stacking
|
|
873
|
+
order, so it never covers them. The bubble is NOT a live region (it changes every few seconds and the
|
|
874
|
+
progress strip already says "Now:"); #floLive says "Waiting for your answer" once, on the way in. -->
|
|
875
|
+
<div id="floFx" hidden>
|
|
876
|
+
<div id="floScan" class="hide" aria-hidden="true"><span></span><i></i><i></i><i></i><i></i></div>
|
|
877
|
+
<div id="floPilot">
|
|
878
|
+
<div id="floAvatar" aria-hidden="true"></div>
|
|
879
|
+
<div id="floDots" aria-hidden="true"><i></i><i></i></div>
|
|
880
|
+
<div id="floBubble">
|
|
881
|
+
<p><b id="floHead"></b> <span id="floNow"></span></p>
|
|
882
|
+
<span id="floWhere" hidden></span>
|
|
883
|
+
<button id="floShow" type="button" data-command-id="filter.flo-show-sheet" data-tip="Show the sheet the AI is reading now" hidden></button>
|
|
884
|
+
<button id="floAnswer" type="button" data-command-id="filter.flo-answer" data-tip="Open the question in AI Chat" hidden>Answer in AI Chat</button>
|
|
885
|
+
</div>
|
|
886
|
+
</div>
|
|
887
|
+
</div>
|
|
823
888
|
<!-- The ONLY fit/zoom controls -- plus, after the divider, Hover info, which is a canvas READ tool
|
|
824
|
-
rather than a framing one (so "only fit/zoom" still holds of the framing pair)
|
|
889
|
+
rather than a framing one (so "only fit/zoom" still holds of the framing pair), and Show Flo while a
|
|
890
|
+
drawing read is live (#2926). Labels stay terse so all of them stay fully legible before the bar's
|
|
825
891
|
max-width cap (see its CSS) starts compressing them in a narrow Workspaces pane — the cap
|
|
826
892
|
means longer text costs legibility, never an overhanging bar. "Zoom steel" not "Steel": a
|
|
827
893
|
bare noun read as a category, not a command. data-tip (never title=) carries the full
|
|
828
894
|
sentence. -->
|
|
829
895
|
<div id="placebar" role="status" aria-live="polite" hidden><span id="placebarText"></span><button id="placebarClear" type="button" data-command-id="filter.place-clear" data-tip="Remove the marked place from this drawing">Clear</button></div>
|
|
830
|
-
<div id="zoombar"><button id="fit2" data-command-id="filter.fit" data-tip="Fit the whole page in view">Fit</button><button id="zoomsteel2" data-command-id="filter.zoom-steel" data-tip="Zoom to fit the steel elements on this sheet">Zoom steel</button><span class="zb-sep" aria-hidden="true"></span><button id="hoverInfo" type="button" aria-pressed="false" data-command-id="filter.hover-info" data-tip="Point at any line or label, shown or switched off, to read its layer, thickness and colour — and light up its rows in the Filters panel. Click a switched-off line to see what to tick to bring it back. Background-only linework, on layers the drawing read never picked up, can’t be read by pointing; click an empty spot to ask the original drawing what is there, where the original drawing is available.">Hover info</button></div>
|
|
896
|
+
<div id="zoombar"><button id="fit2" data-command-id="filter.fit" data-tip="Fit the whole page in view">Fit</button><button id="zoomsteel2" data-command-id="filter.zoom-steel" data-tip="Zoom to fit the steel elements on this sheet">Zoom steel</button><span class="zb-sep" aria-hidden="true"></span><button id="hoverInfo" type="button" aria-pressed="false" data-command-id="filter.hover-info" data-tip="Point at any line or label, shown or switched off, to read its layer, thickness and colour — and light up its rows in the Filters panel. Click a switched-off line to see what to tick to bring it back. Background-only linework, on layers the drawing read never picked up, can’t be read by pointing; click an empty spot to ask the original drawing what is there, where the original drawing is available.">Hover info</button><button id="floToggle" type="button" aria-pressed="true" hidden data-command-id="filter.flo-toggle" data-tip="While a drawing read runs, Flo shows which part of the drawing the AI is reading, and says when it is waiting for your answer">Show Flo</button></div>
|
|
831
897
|
<!-- The hover readout, anchored at the line it names (see #hoverbar's CSS for why it is not docked).
|
|
832
898
|
Hidden until the pointer is on a line with the mode on; hidden again when it leaves the line, or
|
|
833
899
|
when a click opens the popover (which then says the same thing).
|
|
@@ -854,6 +920,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
854
920
|
talk over the hover readout the way a per-target region would. -->
|
|
855
921
|
<div id="hoverNote" aria-hidden="true" hidden><b id="hoverNoteTitle"></b><span id="hoverNoteBody"></span></div>
|
|
856
922
|
<div id="hoverNoteLive" class="sr-only" role="status" aria-live="polite"></div>
|
|
923
|
+
<div id="floLive" class="sr-only" role="status" aria-live="polite"></div>
|
|
857
924
|
</main>
|
|
858
925
|
</div>
|
|
859
926
|
<div id="eye">
|
|
@@ -894,6 +961,9 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
894
961
|
screen's commands first) and forwards `?`/F1 up, because a keydown inside an iframe never
|
|
895
962
|
reaches the shell's own handler. This surface arms nothing, so its snapshot is just its identity — see commands-filter.js. -->
|
|
896
963
|
<script src="filter-guidance.js"></script>
|
|
964
|
+
<!-- #2926: Flo's one drawing module and its mount, as index.html loads them (flo.js first: flo-avatar.js calls it). -->
|
|
965
|
+
<script src="flo.js"></script>
|
|
966
|
+
<script src="flo-avatar.js"></script>
|
|
897
967
|
<script src="commands.js"></script>
|
|
898
968
|
<script src="commands-filter.js"></script>
|
|
899
969
|
<script src="instructor-reporter.js"></script>
|
|
@@ -908,6 +978,9 @@ import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, e
|
|
|
908
978
|
import { checkpointStandard } from './checkpoint-standard.js';
|
|
909
979
|
import { filterAiBlockedLayerKeys, filterAiTouchesUnreadLayer, parseFilterAiProposal } from './filter-ai-proposal.js';
|
|
910
980
|
import { hitIndexBuilder, hitTest, textRunRect } from './steel-filter-hit.js';
|
|
981
|
+
import { mountFilterFlo } from './steel-filter-flo.js';
|
|
982
|
+
// #2926: Flo's overlay, mounted at the end of this module. Declared first because setVB() calls it on every view change.
|
|
983
|
+
let filterFlo = null;
|
|
911
984
|
|
|
912
985
|
const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
913
986
|
// Workspaces use a project-keyed contract; an empty project id is the app-keyed workflow surface.
|
|
@@ -3764,7 +3837,7 @@ eyeNext.onclick = () => { if(identifyShown && identifyShown.i < identifyShown.hi
|
|
|
3764
3837
|
// --- pan/zoom via viewBox; a click (no drag) on an element opens the eyedropper ---
|
|
3765
3838
|
let base = { x:0, y:0, w:1000, h:1000 }, vb = { ...base }, drag = null;
|
|
3766
3839
|
// BOTH svgs, always together: #under (raster + halo) must register 1:1 with the linework on #canvas.
|
|
3767
|
-
function setVB(){ const v = `${vb.x} ${vb.y} ${vb.w} ${vb.h}`; svg.setAttribute('viewBox', v); under.setAttribute('viewBox', v); }
|
|
3840
|
+
function setVB(){ const v = `${vb.x} ${vb.y} ${vb.w} ${vb.h}`; svg.setAttribute('viewBox', v); under.setAttribute('viewBox', v); filterFlo?.place(true); }
|
|
3768
3841
|
svg.addEventListener('wheel', e => {
|
|
3769
3842
|
e.preventDefault();
|
|
3770
3843
|
const r = svg.getBoundingClientRect();
|
|
@@ -4818,6 +4891,47 @@ window.__filterTest = {
|
|
|
4818
4891
|
})();
|
|
4819
4892
|
|
|
4820
4893
|
boot();
|
|
4894
|
+
|
|
4895
|
+
// #2926: Flo, showing which part of the drawing the AI is reading. The shell decides the state from the read's own
|
|
4896
|
+
// signals (filterFloState in workspaces.js) and hands it over on every request poll; this page only shows it.
|
|
4897
|
+
// Mounted after boot() has started, so a fault in this optional overlay never keeps the Filter from loading.
|
|
4898
|
+
{
|
|
4899
|
+
const $ = (id) => document.getElementById(id);
|
|
4900
|
+
const stage = $('stage'), zoombar = $('zoombar');
|
|
4901
|
+
filterFlo = mountFilterFlo({
|
|
4902
|
+
root: $('floFx'), scan: $('floScan'), pilot: $('floPilot'), bubble: $('floBubble'), head: $('floHead'), sentence: $('floNow'),
|
|
4903
|
+
where: $('floWhere'), showBtn: $('floShow'), answerBtn: $('floAnswer'), toggle: $('floToggle'), live: $('floLive'),
|
|
4904
|
+
avatar: typeof window.floAvatar === 'function' ? window.floAvatar($('floAvatar'), { size: 56, mood: 'idle', hat: true }) : null,
|
|
4905
|
+
stage,
|
|
4906
|
+
sheets: () => sheets, active: () => active, setSheet,
|
|
4907
|
+
focusSheets: () => { const t = $('sheetTrigger'); if(t && !$('sheetCombo').hidden) t.focus(); },
|
|
4908
|
+
toStage: (x, y) => {
|
|
4909
|
+
const m = svg.getScreenCTM();
|
|
4910
|
+
if(!m) return { x: 0, y: 0 };
|
|
4911
|
+
const p = new DOMPoint(x, y).matrixTransform(m), r = stage.getBoundingClientRect();
|
|
4912
|
+
return { x: p.x - r.left, y: p.y - r.top };
|
|
4913
|
+
},
|
|
4914
|
+
bgRect,
|
|
4915
|
+
clearTop: () => { const pb = $('placebar'); return pb && !pb.hidden ? pb.offsetTop + pb.offsetHeight + 8 : 12; },
|
|
4916
|
+
clearBottom: () => {
|
|
4917
|
+
const note = $('hoverNote');
|
|
4918
|
+
return 12 + (zoombar ? zoombar.offsetHeight : 0) + 6 + (note && !note.hidden && note.offsetHeight ? note.offsetHeight + 6 : 0);
|
|
4919
|
+
},
|
|
4920
|
+
ask: () => { try { if(window.parent !== window) window.parent.dispatchEvent(new CustomEvent('floless:filter-flo-answer')); } catch { /* no shell */ } },
|
|
4921
|
+
storage: (() => { try { return window.localStorage; } catch { return null; } })(),
|
|
4922
|
+
now: () => Date.now(),
|
|
4923
|
+
});
|
|
4924
|
+
window.flolessFilterFlo = (state) => filterFlo.update(state);
|
|
4925
|
+
// For a real browser pass to read the outcome; it drives nothing.
|
|
4926
|
+
window.__filterTest.flo = () => ({
|
|
4927
|
+
shown: !$('floFx').hidden, on: filterFlo.isOn(), waiting: $('floBubble').classList.contains('waiting'),
|
|
4928
|
+
head: $('floHead').textContent, now: $('floNow').textContent, where: $('floWhere').hidden ? '' : $('floWhere').textContent,
|
|
4929
|
+
show: $('floShow').hidden ? '' : $('floShow').textContent, answer: !$('floAnswer').hidden,
|
|
4930
|
+
box: $('floScan').classList.contains('hide') ? null : ['left', 'top', 'width', 'height'].map((k) => parseFloat($('floScan').style[k])),
|
|
4931
|
+
pilot: $('floPilot').style.transform, live: $('floLive').textContent,
|
|
4932
|
+
});
|
|
4933
|
+
if(typeof ResizeObserver === 'function') new ResizeObserver(() => filterFlo.place(true)).observe(stage);
|
|
4934
|
+
}
|
|
4821
4935
|
</script>
|
|
4822
4936
|
</body>
|
|
4823
4937
|
</html>
|