@floless/app 0.137.3 → 0.138.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.
Files changed (47) hide show
  1. package/dist/floless-server.cjs +47890 -27033
  2. package/dist/internal-workflows/floless-rfi-gmail-send/.floless-owner.json +1 -0
  3. package/dist/internal-workflows/floless-rfi-gmail-send/floless-rfi-gmail-send.flo +32 -0
  4. package/dist/schemas/steel.model.v2.schema.json +218 -27
  5. package/dist/skills/floless-app-knowledge/SKILL.md +5 -2
  6. package/dist/skills/floless-app-rfi/SKILL.md +410 -0
  7. package/dist/skills/floless-app-routines/SKILL.md +7 -2
  8. package/dist/skills/floless-app-routines/references/routines-api.md +14 -5
  9. package/dist/skills/floless-app-steel-model/SKILL.md +34 -32
  10. package/dist/skills/floless-app-steel-takeoff/SKILL.md +498 -34
  11. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +6 -6
  12. package/dist/skills/floless-app-tweak-contract/SKILL.md +6 -2
  13. package/dist/templates/floless-workspace-knowledge.flo +20 -4
  14. package/dist/templates/steel-model.flo +27 -15
  15. package/dist/web/app.css +559 -131
  16. package/dist/web/app.js +216 -54
  17. package/dist/web/aware.js +982 -128
  18. package/dist/web/checkpoint-standard.js +218 -0
  19. package/dist/web/commands-filter.js +23 -0
  20. package/dist/web/commands-shell.js +237 -5
  21. package/dist/web/commands-steel.js +172 -47
  22. package/dist/web/connection-review-client.js +2 -2
  23. package/dist/web/display-units.js +243 -0
  24. package/dist/web/grid-core.js +474 -58
  25. package/dist/web/grid-display.js +344 -0
  26. package/dist/web/index.html +106 -66
  27. package/dist/web/instructor-reporter.js +5 -0
  28. package/dist/web/instructor.js +175 -33
  29. package/dist/web/json-schema-subset.js +145 -25
  30. package/dist/web/steel-3d-core.js +237 -151
  31. package/dist/web/steel-3d-view.js +366 -113
  32. package/dist/web/steel-catalog-picker.js +98 -15
  33. package/dist/web/steel-detail-refs.js +1 -1
  34. package/dist/web/steel-editor.html +6479 -921
  35. package/dist/web/steel-filter.html +404 -57
  36. package/dist/web/steel-model-adapter.js +1 -1
  37. package/dist/web/steel-model-commands.js +72 -66
  38. package/dist/web/steel-model-v2-client-validation.js +10 -3
  39. package/dist/web/steel-model-v2-commands.js +269 -77
  40. package/dist/web/steel-model-v2-projection.js +18 -17
  41. package/dist/web/steel-plan-transform.js +52 -9
  42. package/dist/web/steel-plan-view-id.js +1 -7
  43. package/dist/web/steel-read-confidence.js +454 -5
  44. package/dist/web/steel-units.js +39 -0
  45. package/dist/web/steel-view-generation.js +21 -7
  46. package/dist/web/workspaces.js +2178 -497
  47. package/package.json +5 -1
@@ -20,27 +20,47 @@
20
20
  linework on it, so nothing there justifies a dark ground and #empty follows the theme. */
21
21
  :root{
22
22
  color-scheme:dark; /* so the UA-drawn bits we do not style (selection, the pre-CSS canvas) agree */
23
- --bg:#0f172a;--panel:#1e293b;--line:#334155;--text:#e2e8f0;--mut:#94a3b8;--brand:#3b82f6;
23
+ /* THESE ARE THE SHELL'S TOKENS, re-expressed under this page's names. A standalone page cannot
24
+ load app.css, so the values are copied from its Block 2 (the floless-web brand overrides) rather
25
+ than approximated — this page used to sit a whole step lighter than the shell (--panel #1e293b
26
+ against the shell's --surface #131a25, --bg #0f172a against #020817), which is why the Drawing
27
+ Filter tab read as a different colour from the Knowledge tab beside it. Name-for-name:
28
+ --panel = --surface --line/--ctrl-border = --border-strong
29
+ --btn = --surface-2 --btn-hover = --surface-3
30
+ --mut = --text-muted --brand = --accent
31
+ Keep them in step if app.css's Block 2 ever moves. */
32
+ --bg:hsl(222.2 84% 4.9%);--panel:hsl(217.2 32.6% 11%);--line:hsl(217.2 32.6% 17.5%);
33
+ --text:hsl(210 40% 98%);--mut:hsl(215 20.2% 65.1%);--brand:hsl(217.2 91.2% 59.8%);
24
34
  --brand-ink:#fff; /* text/glyphs on a --brand fill */
25
- --brand-hover:#2f6fe0;
26
- --btn:#334155; /* secondary button fill, and the option-row hover that matches it */
27
- --btn-hover:#475569;
28
- --ctrl-border:#475569; /* button, field and checkbox borders */
29
- --scroll:#475569;--scroll-hover:#5b6b85;
35
+ --brand-hover:hsl(213 94% 68%);
36
+ --btn:hsl(217.2 32.6% 17.5%); /* secondary button fill, and the option-row hover that matches it */
37
+ --btn-hover:hsl(217.2 32.6% 22%);
38
+ --ctrl-border:hsl(217.2 32.6% 17.5%); /* button, field and checkbox borders */
39
+ --scroll:hsl(217.2 32.6% 17.5%);--scroll-hover:hsl(217.2 16% 45%);
40
+ /* The SHELL's --ui stack verbatim (web/app.css :root). This page used to say
41
+ `system-ui,-apple-system,...`, which resolves to Segoe UI on Windows while the shell resolves
42
+ to Inter — so the Filters pane and the References pane beside it were set in different
43
+ typefaces. Same stack, same order, or they diverge again on whichever machine has Inter. */
44
+ --ui: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
45
+ --text-dim: hsl(217.2 16% 45%); /* the shell's --text-dim; the pane rail's seam is mixed from it */
46
+ --pane-collapsed: 36px; /* the shell's folded-pane width — keep in step with app.css */
47
+ --grip-h: 32px; /* the shell's pane-grip height — keep in step with app.css */
30
48
  --shadow-lg:0 8px 24px rgba(0,0,0,.5); /* popovers */
31
49
  /* The tooltip keeps its own, SMALLER treatment on purpose: it is the same control on four surfaces
32
50
  (steel-editor.html, vector-editor.html, vector-3d.html all ship 0 8px 22px), so folding it into
33
51
  --shadow-lg would silently de-sync this one page from the other three. */
34
52
  --shadow-tip:0 8px 22px rgba(0,0,0,.5);
35
- --warn:#f59e0b;--ok:#34d399;--err:#f87171;
36
- --cyan:#22d3ee;--cyan-soft:rgba(34,211,238,.10);
37
- --empty-bg:#0f172a; /* the empty state covers the stage — in dark, the stage's own colour */
53
+ --warn:hsl(38 92% 50%);--ok:hsl(142 71% 45%);--err:hsl(0 62.8% 50%);
54
+ --cyan:#22d3ee;--cyan-soft:rgba(34,211,238,.10); /* this page's own snap accent; the shell has no counterpart */
55
+ --empty-bg:hsl(222.2 84% 4.9%); /* the empty state covers the stage — in dark, the stage's own colour */
38
56
  /* THE DARK ISLAND. The stage keeps its own furniture, in BOTH themes: a light zoom bar over a dark
39
57
  drawing would put --text (near-black in light) on a --btn fill nobody re-tinted, and its shadow
40
58
  would vanish. Pinning them here is also what makes the dark region read as a deliberate viewer
41
59
  rather than a pane that failed to repaint. */
42
- --stage:#0f172a;--stage-text:#e2e8f0;--stage-panel:#1e293b;--stage-line:#334155;
43
- --stage-btn:#334155;--stage-btn-hover:#475569;--stage-ctrl:#475569;
60
+ Their VALUES track the dark palette above, so the island reads as the app's dark rather than the
61
+ older, lighter one it was pinned to. */
62
+ --stage:hsl(222.2 84% 4.9%);--stage-text:hsl(210 40% 98%);--stage-panel:hsl(217.2 32.6% 11%);--stage-line:hsl(217.2 32.6% 17.5%);
63
+ --stage-btn:hsl(217.2 32.6% 17.5%);--stage-btn-hover:hsl(217.2 32.6% 22%);--stage-ctrl:hsl(217.2 32.6% 17.5%);
44
64
  --stage-shadow:0 4px 14px rgba(0,0,0,.45);
45
65
  --banner-shadow:0 -4px 18px rgba(0,0,0,.45); /* the conflict bar, thrown UPWARD from the page foot */
46
66
  }
@@ -49,14 +69,26 @@
49
69
  value here is app.css's own light token or the -700/-800 stop of a ramp it already uses on light. */
50
70
  [data-theme="light"]{
51
71
  color-scheme:light;
52
- --bg:#fff;--panel:#f1f5f9;--line:#cbd5e1;--text:#0f172a;--mut:#475569;--brand:#2563eb;
53
- --brand-hover:#1d4ed8;
54
- --btn:#e2e8f0;--btn-hover:#cbd5e1;--ctrl-border:#94a3b8;
55
- --scroll:#cbd5e1;--scroll-hover:#94a3b8;
72
+ /* app.css's [data-theme="light"] block, name-for-name as in :root above. --panel is WHITE here,
73
+ the same as --bg, because the shell's light --surface is: its panes and canvas are both white and
74
+ separated by --border, not by a fill. Matching that is the point. */
75
+ --bg:hsl(0 0% 100%);--panel:hsl(0 0% 100%);--line:hsl(214.3 31.8% 82%);
76
+ --text:hsl(222.2 84% 4.9%);--mut:hsl(215.4 16.3% 46.9%);--brand:hsl(221.2 83.2% 53.3%);
77
+ --brand-hover:hsl(217.2 91.2% 59.8%);
78
+ --text-dim: hsl(215.4 16.3% 60%);
79
+ --pane-collapsed: 36px;
80
+ --grip-h: 32px;
81
+ /* Same stack in both themes — a typeface is not a colour. Declared rather than inherited so the
82
+ "every :root token has a light value" guard can see it stated. */
83
+ --ui: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
84
+ --btn:hsl(210 40% 96.1%);--btn-hover:hsl(214.3 31.8% 91.4%);--ctrl-border:hsl(214.3 31.8% 82%);
85
+ --scroll:hsl(214.3 31.8% 82%);--scroll-hover:hsl(215.4 16.3% 60%);
56
86
  --shadow-lg:0 8px 24px rgba(15,23,42,.14);--shadow-tip:0 8px 22px rgba(15,23,42,.14);
57
- /* Every state colour steps DOWN the ramp, amber included. Amber 500 measures 1.96:1 on --panel,
58
- and --warn is the "Unsaved ●" dot — the only signal that work is at risk — so keeping it would
59
- have hidden exactly the state a user must not miss. app.css's light block does the same
87
+ /* THE ONE DELIBERATE DIVERGENCE from app.css's light block, kept when the rest of this page was
88
+ aligned to it. Every state colour steps DOWN the ramp, amber included. Amber 500 — which is what
89
+ app.css's light --warn is — measures 1.96:1 on --panel, and --warn is the "Unsaved ●" dot, the
90
+ only signal that work is at risk, so adopting the shell's value would have hidden exactly the
91
+ state a user must not miss. app.css's light block darkens in the same direction
60
92
  (`.trace .lvl.warn { color: #d97706 }`); this goes one stop further to clear AA at 11-12px. */
61
93
  --warn:#b45309;--ok:#15803d;--err:#b91c1c;
62
94
  --cyan:#155e75;--cyan-soft:rgba(21,94,117,.10);
@@ -72,16 +104,28 @@
72
104
  *::-webkit-scrollbar-corner{background:transparent}
73
105
  *{box-sizing:border-box}
74
106
  html,body{height:100%}
75
- body{margin:0;background:var(--bg);color:var(--text);font:13px system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;display:flex;flex-direction:column;overflow:hidden}
76
- header{display:flex;align-items:center;gap:14px;padding:8px 14px;background:var(--panel);border-bottom:1px solid var(--line);flex:none}
77
- header b{font-size:14px} header .sp{flex:1}
107
+ body{margin:0;background:var(--bg);color:var(--text);font:13px var(--ui);display:flex;flex-direction:column;overflow:hidden}
108
+ /* Same 46px band the shell step surfaces use (app.css, the shared step-header rule): the two sit in
109
+ the same tab strip and were 46px vs 43px vs 51px with three different type sizes between them. */
110
+ header{display:flex;align-items:center;gap:14px;height:46px;padding:0 14px;background:var(--panel);border-bottom:1px solid var(--line);flex:none}
111
+ header b{font-size:13px;font-weight:600} header .sp{flex:1}
78
112
  .stat{color:var(--mut);font-size:12px} .stat b{color:var(--text)}
79
113
  .stat.dirty b{color:var(--warn)} .stat.saved b{color:var(--ok)} .stat.err b{color:var(--err)}
114
+ /* A project that never stated a steel catalogue. Its OWN name rather than borrowing `.dirty`: the
115
+ amber is right but "dirty" means unsaved work at risk, and a class name that lies about what the
116
+ DOM state is costs the next reader more than the rule saves. Not `.err` (nothing failed), not
117
+ `.conflict` (that chip is clickable and this has nothing behind it), not `.required-step` (reserved
118
+ for the one mandatory action on this page). Reuses the existing --warn token; no new colour. */
119
+ .stat.unstated b{color:var(--warn)}
120
+ /* `hidden` works today because `.stat` declares no `display` — but `.stat.required-step` beside it
121
+ already needed this exact rule, and an author `display` beats the UA rule by origin. Cheap belt so a
122
+ future `.stat` layout change cannot silently strand a visible chip claiming a standard we do not know. */
123
+ .stat[hidden]{display:none}
80
124
  /* Save conflict — the model moved under us. Needs its OWN rule: the other states colour a nested <b>,
81
125
  and this text has none, so without this it rendered in muted grey, indistinguishable from idle. Same
82
126
  cyan "non-default, click to act" chip the sibling editors use — no new colour. */
83
127
  .stat.conflict{color:var(--cyan);border:1px solid var(--cyan);background:var(--cyan-soft);border-radius:4px;padding:1px 6px;cursor:pointer}
84
- button{background:var(--btn);color:var(--text);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 10px;cursor:pointer;font:13px system-ui}
128
+ button{background:var(--btn);color:var(--text);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 10px;cursor:pointer;font:13px var(--ui)}
85
129
  button:hover{background:var(--btn-hover)} button:disabled,button[aria-disabled="true"]{opacity:.5;cursor:default}
86
130
  button[aria-disabled="true"]:hover{background:var(--btn)}
87
131
  button.primary{background:var(--brand);border-color:var(--brand);color:var(--brand-ink)} button.primary:hover{background:var(--brand-hover)}
@@ -116,7 +160,7 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
116
160
  the exact signature the QA pass matched on when it caught the <select>, and leaving it reading `auto`
117
161
  would make the next such pass re-raise a defect that is gone. NOT the same case as the checkbox
118
162
  below, whose appearance:none is load-bearing (drop it and a white native box comes back). */
119
- .sheet-trigger{display:inline-flex;align-items:center;gap:6px;min-width:200px;max-width:320px;-webkit-appearance:none;appearance:none;background:var(--bg);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 8px;font:600 13px system-ui}
163
+ .sheet-trigger{display:inline-flex;align-items:center;gap:6px;min-width:200px;max-width:320px;-webkit-appearance:none;appearance:none;background:var(--bg);border:1px solid var(--ctrl-border);border-radius:6px;padding:5px 8px;font:600 13px var(--ui)}
120
164
  .sheet-trigger:hover,.sheet-trigger.open{background:var(--bg);border-color:var(--brand)}
121
165
  .sheet-trigger-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
122
166
  .sheet-caret{color:var(--mut);flex:none;transition:transform .15s}
@@ -135,7 +179,7 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
135
179
  /* A <div role=option>, not a <button> — deliberately NOT focusable, as the shared .wf-option is. Focus
136
180
  must stay on the trigger for aria-activedescendant to mean anything, and a focusable row also left
137
181
  focus on <body> when the row was clicked and then hidden. So this needs its own cursor/font. */
138
- .sheet-option{display:block;width:100%;cursor:pointer;background:transparent;border:none;border-left:2px solid transparent;border-radius:4px;padding:6px 8px;text-align:left;font:13px system-ui;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
182
+ .sheet-option{display:block;width:100%;cursor:pointer;background:transparent;border:none;border-left:2px solid transparent;border-radius:4px;padding:6px 8px;text-align:left;font:13px var(--ui);color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
139
183
  .sheet-option:hover,.sheet-option.highlighted{background:var(--btn)}
140
184
  /* Left-border accent for the current sheet — the shared .wf-option.selected convention, not a tick glyph. */
141
185
  .sheet-option.selected{border-left-color:var(--brand);color:var(--brand)}
@@ -205,7 +249,64 @@ button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
205
249
  #tooltip{position:fixed;z-index:100;background:var(--panel);border:1px solid var(--line);border-radius:6px;padding:5px 8px;font-size:11.5px;line-height:1.35;color:var(--text);pointer-events:none;max-width:260px;box-shadow:var(--shadow-tip);opacity:0;transition:opacity .12s}
206
250
  #tooltip.show{opacity:1}
207
251
  #app{display:flex;flex:1;min-height:0}
208
- #panel{width:300px;flex:0 0 300px;background:var(--panel);border-right:1px solid var(--line);padding:14px;overflow-y:auto;display:flex;flex-direction:column;gap:18px}
252
+ /* THE FILTERS PANEL AND ITS RAIL — the shell's pane idiom (web/app.css `.pane-rail`/`.panel-toggle`),
253
+ re-expressed in this page's own token names because a standalone page does not load app.css. Close to
254
+ the shell's geometry (its rail is 13px): an 11px rail carrying a 2px seam and an 11px grip, var(--grip-h)
255
+ tall, the grip breaking the seam in the middle. Collapsing eases the panel's width over 260ms.
256
+ `--panel-w` is registered so the width can be TRANSITIONED at all: an unregistered custom property
257
+ cannot be interpolated, so the ease would hold its start value and the panel would jump. */
258
+ @property --panel-w { syntax:'<length>'; inherits:true; initial-value:300px; }
259
+ #app{--panel-w:300px}
260
+ #app:not(.resizing){transition:--panel-w .26s cubic-bezier(.2,.6,.2,1)}
261
+ #app.panel-shut{--panel-w:0px !important}
262
+ @media (prefers-reduced-motion:reduce){#app:not(.resizing),#panel,#panelStub{transition:none}}
263
+ /* A 14px RIGHT BORDER in the panel's own colour, not a margin. This panel is itself the scroller, so
264
+ padding cannot move its scrollbar — the thumb sits at the panel's own right edge whatever the
265
+ padding is. A margin does move it, but it moves the panel's BACKGROUND with it, which opened a
266
+ 14px strip of the stage's darker background between the panel and its rail. A border sits outside
267
+ the padding box, so the scrollbar is inset by it while the border itself paints --panel: the
268
+ background runs unbroken to the rail and only the thumb steps back. box-sizing:border-box (the * rule)
269
+ keeps the border inside --panel-w, so the column width and the rail's position are unchanged. */
270
+ #panel{width:var(--panel-w);flex:0 0 var(--panel-w);border-right:14px solid var(--panel);background:var(--panel);padding:14px;overflow-y:auto;display:flex;flex-direction:column;gap:18px;transition:padding .26s cubic-bezier(.2,.6,.2,1),border-right-width .26s cubic-bezier(.2,.6,.2,1),opacity .18s cubic-bezier(.2,.6,.2,1)}
271
+ /* The stub takes the panel's place when it is shut, so the vertical label sits in the folded strip. */
272
+ /* Label at the TOP, not centred — the shell's collapsed panes read their label from the top of the
273
+ strip (web/app.css `.collapsed-stub`, padding:14px 0), and a centred one here made the two
274
+ surfaces disagree about where a folded pane announces itself. */
275
+ #panelStub{display:flex;flex:none;width:0;background:var(--panel);flex-direction:column;align-items:center;justify-content:flex-start;padding-top:14px;overflow:hidden;transition:width .26s cubic-bezier(.2,.6,.2,1)}
276
+ #app.panel-shut #panelStub{width:var(--pane-collapsed)}
277
+ #app.panel-shut #panel{opacity:0;padding:0;border-right-width:0;overflow:hidden}
278
+ /* --text-dim, not --mut: the shell's collapsed panes label themselves in --text-dim, and --mut is a
279
+ step lighter — so a folded Filters strip read brighter than the Narrative strip beside it. */
280
+ #panelStub .vlabel{writing-mode:vertical-rl;transform:rotate(180deg);font-size:10px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.2em;white-space:nowrap;user-select:none}
281
+ #panelRail{position:relative;flex:none;width:11px;margin-left:-5px;margin-right:-6px;z-index:6;display:flex;align-items:center;justify-content:center;pointer-events:none;align-self:stretch}
282
+ #panelRail>*{pointer-events:auto}
283
+ /* Full rail width, toned down against the grip so the handle still reads as a control on the bar. */
284
+ /* A 2px separator on the seam — see the shell's .pane-rail::before. Filling the whole 11px rail
285
+ made a foreign stripe; filling it in --panel to blend removed the pane's edge entirely. */
286
+ #panelRail::before{content:"";position:absolute;top:0;bottom:0;left:50%;width:2px;transform:translateX(-50%);background:color-mix(in srgb, var(--text-dim) 45%, var(--btn-hover));transition:background .12s}
287
+ /* Hover and drag look the same: the 2px seam turns --brand and the handle behind it takes a soft wash.
288
+ Only the seam goes solid — flooding the whole full-height handle with --brand every time the pointer
289
+ crosses the divider is far louder than "you are over a control" needs to be. */
290
+ #panelRail:has(#panelGrip:hover)::before,#panelRail:has(#panelResize:hover)::before{background:var(--brand)}
291
+ #panelRail:has(#panelResize.dragging)::before{background:var(--brand)}
292
+ #panelResize{position:absolute;inset:0;cursor:ew-resize;background:transparent;transition:background .12s}
293
+ #panelResize:hover{background:rgba(59,130,246,.15)}
294
+ #panelResize.dragging{background:rgba(59,130,246,.15)}
295
+ /* Keyboard focus lights the seam as hover does, and rings the divider itself — inside its 11px, since a
296
+ ring offset outward would be clipped by the panel on one side and the drawing on the other. */
297
+ #panelRail:has(#panelResize:focus-visible)::before{background:var(--brand)}
298
+ #panelResize:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
299
+ #app.panel-shut #panelResize{display:none}
300
+ /* Borderless, so the grip is a lighter SEGMENT of the bar rather than a block sitting on it. The
301
+ fill must differ from the bar's (--line): --btn is the same colour as --line on this page, which
302
+ is exactly what made this control read as an outline and nothing else. */
303
+ #panelGrip{position:relative;z-index:7;width:11px;height:var(--grip-h);padding:0;display:flex;align-items:center;justify-content:center;
304
+ background:color-mix(in srgb, var(--text-dim) 60%, var(--btn-hover));border:0;border-radius:5px;color:var(--text);cursor:pointer}
305
+ #panelGrip:hover{background:var(--brand)}
306
+ #panelGrip:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
307
+ #panelGrip svg{width:13px;height:13px;display:block;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;transition:transform .18s ease}
308
+ #app.panel-shut #panelGrip svg{transform:rotate(180deg)}
309
+ @media (prefers-reduced-motion:reduce){#panelGrip svg{transition:none}}
209
310
  #panel h2{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut);margin:0 0 8px;display:flex;align-items:center;justify-content:space-between}
210
311
  .acts{display:inline-flex;gap:4px}
211
312
  .acts button{font-size:11px;padding:2px 7px;background:transparent;border-color:var(--line);color:var(--mut)}
@@ -280,6 +381,8 @@ footer{margin-top:auto;border-top:1px solid var(--line);padding-top:12px}
280
381
  #empty .empty-body[hidden]{display:none}
281
382
  body.publication-blocked header > :not(b),
282
383
  body.publication-blocked #panel,
384
+ body.publication-blocked #panelRail,
385
+ body.publication-blocked #panelStub,
283
386
  body.publication-blocked #canvas,
284
387
  body.publication-blocked #zoombar{display:none}
285
388
  body.publication-blocked #stage{display:flex}
@@ -367,6 +470,16 @@ body.publication-blocked #empty{position:static;flex:1}
367
470
  </div>
368
471
  </div>
369
472
  <span id="src" class="stat"></span>
473
+ <!-- Which steel catalogue the read will resolve against, and the units this project displays in.
474
+ LEFT of the flex spacer on purpose: everything left of `.sp` describes what you are looking at,
475
+ everything right of it is the save lifecycle. This is the first kind, and it must not crowd the
476
+ Save button or the required-step cue beside it.
477
+ Deliberately NOT a live region, unlike its three neighbours (#saved, #saveRequiredStatus and
478
+ #empty). It repaints when another tab switches units, but that is the echo of an action the user
479
+ took somewhere else, not feedback about anything happening here — announcing it would talk over
480
+ the "Ready — press Save filter" prompt. Note `role=status` would NOT have been the neutral
481
+ choice: it carries an implicit aria-live=polite. No role at all is what #src beside it does. -->
482
+ <span id="standardStat" class="stat" hidden></span>
370
483
  <span class="sp"></span>
371
484
  <span id="saved" class="stat" role="status" aria-live="polite" aria-atomic="true"></span>
372
485
  <span id="saveRequiredStatus" class="stat required-step" role="status" aria-live="polite" tabindex="-1" hidden>Ready — press Save filter</span>
@@ -410,6 +523,20 @@ body.publication-blocked #empty{position:static;flex:1}
410
523
  <span id="count"></span>
411
524
  </footer>
412
525
  </aside>
526
+ <!-- The rail between the filter panel and the drawing: the shell's `.pane-rail` idiom, re-expressed
527
+ in this page's tokens because a standalone page does not load app.css. It carries BOTH the drag
528
+ and the collapse grip, and it spans only this page — which is what keeps it under the Drawing
529
+ Filter tab rather than running the height of the window. -->
530
+ <!-- STUB BEFORE RAIL, and the order is load-bearing. These are flex items, so DOM order IS left-to-
531
+ right: with the rail first, a collapsed panel put it at the far-left edge of the page, where its
532
+ negative-margin pull hung outside the iframe and the grip was sliced in half. Stub first keeps the rail on
533
+ the boundary with the drawing in BOTH states — the panel's right edge when open, the stub's
534
+ when shut. -->
535
+ <div id="panelStub" aria-hidden="true"><span class="vlabel">Filters</span></div>
536
+ <div id="panelRail">
537
+ <div id="panelResize" role="separator" tabindex="0" aria-orientation="vertical" aria-controls="panel" aria-label="Resize Filters panel" data-command-id="filter.panel-resize" data-tip="Drag to resize · double-click to reset"></div>
538
+ <button data-command-id="filter.panel-collapse" type="button" id="panelGrip" aria-controls="panel" aria-expanded="true" aria-label="Collapse Filters panel" data-tip="Collapse Filters panel"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="m10 3-5 5 5 5"/></svg></button>
539
+ </div>
413
540
  <main id="stage">
414
541
  <svg id="canvas" preserveAspectRatio="xMidYMid meet">
415
542
  <image class="bg"></image>
@@ -486,6 +613,7 @@ body.publication-blocked #empty{position:static;flex:1}
486
613
 
487
614
  <script type="module">
488
615
  import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, countShown, liveOverlayElements, bgRect, textFontSize, applySelToFilter, hasUnsupportedSingleSheetFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, dismissibleFacetValues, FACET_DIMS, FACET_DIM_BY_CONTROL, MODE_ORDER, facetKey, NOTE_TEXT } from './steel-filter-core.js';
616
+ import { checkpointStandard } from './checkpoint-standard.js';
489
617
 
490
618
  const APP_ID = new URLSearchParams(location.search).get('app') || '';
491
619
  // Workspaces use a project-keyed contract; an empty project id is the app-keyed workflow surface.
@@ -529,6 +657,133 @@ let parseWarned = false; // latch, so a broken stream cannot spam the console
529
657
  let checkpointSaveBlocked = false; // a half-completed checkpoint must reload before it can be retried safely
530
658
  let saveInFlight = false; // parent checkpoint polling must not re-enable Save during the queued write
531
659
 
660
+ /**
661
+ * The project's steel catalogue and display units, stated where the last human stop is.
662
+ *
663
+ * WHY HERE AND WHY READ-ONLY. The catalogue is chosen once, when the project is created, and is
664
+ * immutable afterwards by design — `server/project-environment.test.ts` asserts the ABSENCE of any
665
+ * setter, route or PATCH that could change it. So there is deliberately no control here. What the
666
+ * checkpoint adds is the last cheap moment to NOTICE: a wrong catalogue costs one new project before
667
+ * the read and every resolved member after it.
668
+ *
669
+ * `displayUnitsPref` is a plain cache of the project's preference. It is never written back, and it is
670
+ * never read by anything but this chip.
671
+ */
672
+ let displayUnitsPref = null;
673
+
674
+ /**
675
+ * Repaint the chip. Safe to call at any time, including before the contract has loaded.
676
+ *
677
+ * `C` IS PASSED AS SCALARS, NEVER AS ITSELF. `save()` assigns `C.filter = F` and then PUTs
678
+ * `JSON.stringify(C)` — the whole document round-trips through this page — so anything that writes to
679
+ * `C` on the way to the screen is a permanent storage write. Handing `checkpointStandard` the two
680
+ * fields it needs keeps that impossible rather than merely discouraged.
681
+ */
682
+ function renderStandardStat(){
683
+ const el = document.getElementById('standardStat');
684
+ if(!el) return;
685
+ // `!!C` is the "has the contract actually loaded" input, and it is load-bearing. This header is a
686
+ // SIBLING of the stage, so it stays on screen through every early return — a 204 before the first
687
+ // bake, a 402 when a subscription lapses, a 500. On all of them `C` is still null and the
688
+ // environment is undefined for reasons that say nothing about the project, so the chip must render
689
+ // nothing rather than announce that a UK job has no catalogue.
690
+ const line = checkpointStandard({
691
+ hasProject: !!PROJECT,
692
+ contractLoaded: !!C,
693
+ environment: C ? C.environment : undefined,
694
+ displayUnits: displayUnitsPref,
695
+ });
696
+ if(!line){ el.hidden = true; el.replaceChildren(); el.removeAttribute('data-tip'); return; }
697
+ el.className = 'stat' + (line.unstated ? ' unstated' : '');
698
+ // Assembled from DOM nodes rather than innerHTML, and the nested <b> is what the `.stat.*` rules
699
+ // colour — the same shape `setSaved` below uses, for the same two reasons.
700
+ el.replaceChildren();
701
+ el.append(line.lead);
702
+ const b = document.createElement('b');
703
+ b.textContent = line.emphasis;
704
+ el.append(b, line.tail);
705
+ // The immutability sentence, for readers the tooltip never reaches: `data-tip` fires on pointerover
706
+ // only and this chip is not focusable, so a keyboard or screen-reader user would otherwise get the
707
+ // fact and no answer to "then how do I change it?".
708
+ const note = document.createElement('span');
709
+ note.className = 'sr-only';
710
+ note.textContent = ' ' + line.note;
711
+ el.append(note);
712
+ // A document that STATES an environment this build cannot resolve ('EU' today) lands in the same
713
+ // arm as one that states nothing. The sentence is deliberately written to be true of both, but the
714
+ // two are different facts and only one of them is a data problem -- so it leaves a trace here rather
715
+ // than being indistinguishable forever.
716
+ if(line.unstated && C && C.environment !== undefined){
717
+ console.warn('steel-filter: this model states a steel environment the app cannot resolve', C.environment);
718
+ }
719
+ // `data-tip`, never `title` — a native tooltip renders in the light OS style against this dark theme,
720
+ // and a CI guard fails the build for one.
721
+ el.setAttribute('data-tip', line.tip);
722
+ el.hidden = false;
723
+ }
724
+
725
+ /**
726
+ * Read the project's display-unit preference.
727
+ *
728
+ * Failure is deliberately quiet and NON-FATAL: the units half of the chip falls back to the shared
729
+ * default and the standard half — the half that actually matters before a read — still shows. Taking
730
+ * the header down because a preference lookup 500'd would be a worse trade than a slightly wrong unit
731
+ * label. Projectless surfaces never call this: with no project there is no server-side preference, and
732
+ * the chip renders nothing at all.
733
+ */
734
+ async function loadDisplayUnits(){
735
+ if(!PROJECT) return;
736
+ try {
737
+ const res = await fetch('/api/projects/' + encodeURIComponent(PROJECT) + '/display-units');
738
+ if(!res.ok) throw new Error('HTTP ' + res.status);
739
+ const body = await res.json();
740
+ displayUnitsPref = body && body.displayUnits;
741
+ } catch(e){
742
+ // NAMED, not swallowed, and `displayUnitsPref` is deliberately LEFT NULL. The editor reaches the
743
+ // same endpoint and its comment is the argument: "a metric job that silently reads imperial
744
+ // because one fetch failed is exactly the wrong number this epic exists to stop". It resolves to
745
+ // the default because it must render dimensions; this chip does not have to say anything, so it
746
+ // says nothing about units rather than a system nobody chose. The standard half is unaffected.
747
+ //
748
+ // This was the only branch in this file that failed with no trace in any channel, which also made
749
+ // it invisible to the repo's own E2E signal -- a QA run that hits it passes with a clean console
750
+ // while showing the wrong unit.
751
+ console.warn('steel-filter: could not read this project’s display units', e);
752
+ }
753
+ }
754
+
755
+ /**
756
+ * Take a units frame if this is one, and report whether it was taken.
757
+ *
758
+ * Handled BEFORE `liveUpdateAction`, exactly as the editor does it, rather than by teaching that
759
+ * function a new verb: it is the tested decision procedure for CONTRACT changes and answers
760
+ * reload-or-banner, which is not the question a display preference asks. This frame changes no
761
+ * document and must never trigger either.
762
+ *
763
+ * A NAMED FUNCTION so a test can run it. As an inline block inside `es.onmessage` the only thing a test
764
+ * could do was match its source text, and a review sweep showed exactly what that misses: removing the
765
+ * `return`, calling the wrong field off the frame, or dropping the repaint all left the source
766
+ * assertions green while the behaviour broke.
767
+ *
768
+ * REPAINTS ONLY A CHIP THAT IS ALREADY SHOWN, never creates one. `C` is assigned before three
769
+ * `showEmpty()` early returns, so on those screens the chip is deliberately absent — and repainting
770
+ * unconditionally made a units switch in another tab POP it into the header of an empty state, so two
771
+ * people on the same screen saw different headers depending on whether a frame happened to arrive.
772
+ */
773
+ function displayUnitsFrameHandled(m){
774
+ if(!displayUnitsFrameMatches(m)) return false;
775
+ displayUnitsPref = m.displayUnits;
776
+ const chip = document.getElementById('standardStat');
777
+ if(chip && !chip.hidden) renderStandardStat();
778
+ return true;
779
+ }
780
+
781
+ /** Is this frame a units switch for THIS app and THIS project? Total: junk answers false. */
782
+ function displayUnitsFrameMatches(m){
783
+ return !!m && typeof m === 'object' && m.type === 'display-units-changed'
784
+ && m.appId === APP_ID && ((m.project || '') === PROJECT);
785
+ }
786
+
532
787
  function setSaved(state){
533
788
  // The state→(class, label) map is `statChip` in steel-filter-core.js, where it is table-tested.
534
789
  const { cls, text, badge } = statChip(state);
@@ -598,7 +853,7 @@ function showChangedBanner(message, opts){
598
853
  // by not being the page's own surface. Its SHADOW is themed, because that one is not a choice: an
599
854
  // 18px black glow thrown up a white page is the artifact, not the emphasis.
600
855
  bar.style.cssText = 'position:fixed;bottom:0;left:0;right:0;z-index:50;display:flex;align-items:center;gap:10px;'
601
- + 'padding:10px 16px;background:#1e40af;color:#e0f2fe;font:13px system-ui;border-top:1px solid #3b82f6;'
856
+ + 'padding:10px 16px;background:#1e40af;color:#e0f2fe;font:13px var(--ui);border-top:1px solid #3b82f6;'
602
857
  + 'box-shadow:var(--banner-shadow)';
603
858
  const msg = document.createElement('span'); msg.style.cssText = 'flex:1';
604
859
  msg.textContent = message
@@ -606,7 +861,7 @@ function showChangedBanner(message, opts){
606
861
  + 'Reload and reapply your changes.';
607
862
  const reload = document.createElement('button');
608
863
  reload.setAttribute('data-command-id', 'filter.reload');
609
- reload.style.cssText = 'background:#3b82f6;color:#fff;border:1px solid #60a5fa;border-radius:6px;padding:5px 12px;cursor:pointer;font:13px system-ui';
864
+ reload.style.cssText = 'background:#3b82f6;color:#fff;border:1px solid #60a5fa;border-radius:6px;padding:5px 12px;cursor:pointer;font:13px var(--ui)';
610
865
  reload.textContent = '↻ Reload';
611
866
  // No local draft in this surface, so a plain reload is already safe (unlike the steel editor, whose
612
867
  // restoreSaved() would re-overlay the conflicting draft).
@@ -620,7 +875,7 @@ function showChangedBanner(message, opts){
620
875
  const dismiss = document.createElement('button');
621
876
  dismiss.setAttribute('data-command-id', 'filter.dismiss-message');
622
877
  dismiss.setAttribute('aria-label', 'Dismiss message');
623
- dismiss.style.cssText = 'background:transparent;color:#93c5fd;border:1px solid #3b82f6;border-radius:6px;padding:5px 10px;cursor:pointer;font:13px system-ui';
878
+ dismiss.style.cssText = 'background:transparent;color:#93c5fd;border:1px solid #3b82f6;border-radius:6px;padding:5px 10px;cursor:pointer;font:13px var(--ui)';
624
879
  dismiss.textContent = '✕';
625
880
  // Dismissing hides the bar but must not erase the FACT that the view is behind — otherwise the only
626
881
  // trace is gone and the next Save fails with a 412 the user has no way to have anticipated. It must
@@ -884,6 +1139,9 @@ function initLiveUpdates(){
884
1139
  if(!parseWarned){ parseWarned = true; console.warn('steel-filter: unparseable SSE frame — ignoring'); }
885
1140
  return;
886
1141
  }
1142
+ // A display preference, not a document change. Repaint the chip and stop: `liveUpdateAction`
1143
+ // decides reload-or-banner for CONTRACT writes, and this frame must trigger neither.
1144
+ if(displayUnitsFrameHandled(m)) return;
887
1145
  const a = liveUpdateAction(m, {
888
1146
  appId: APP_ID, project: PROJECT, ownWrites, dirty,
889
1147
  // "a filter is RENDERED", not "a `filter` key exists" — `sel` is set only by initFromFilter(), so it
@@ -1007,10 +1265,37 @@ async function bootOnce(){
1007
1265
  }
1008
1266
  const norm = normalizeFilter(F);
1009
1267
  sheets = norm.sheets; active = norm.active;
1010
- if(!F || !sheets.some(s => Array.isArray(s.elements) && s.elements.length)){ showEmpty(); return; }
1268
+ // No filter at all IS "nobody has prepared this yet", and the bare empty state says so correctly.
1269
+ if(!F){ showEmpty(); return; }
1270
+ // A filter that WAS prepared and legitimately carries nothing is a different thing, and the bare
1271
+ // empty state tells that user to "ask your terminal AI to prepare the Drawing Filter" — about a
1272
+ // filter their AI already prepared. There is no way out of that loop: re-baking reproduces the same
1273
+ // empty screen, and nothing on it distinguishes "not started" from "started and found nothing".
1274
+ //
1275
+ // This is the same failure the 402/500 branch above was given its own copy to avoid, quoted there:
1276
+ // a bare showEmpty() is "indistinguishable from a project simply awaiting its first bake". This was
1277
+ // the one branch in boot still doing it, and #1015 made it newly REACHABLE — a sheet whose vector
1278
+ // content is entirely fills that paint nothing now emits zero elements where it previously emitted
1279
+ // hundreds of thousands of phantom ones. A raster-only sheet lands here for the same reason.
1280
+ if(!sheets.some(s => Array.isArray(s.elements) && s.elements.length)){
1281
+ showEmpty('This drawing set has nothing to filter.', false,
1282
+ 'Your terminal AI read this drawing set and found no vector linework or text on any sheet — a scan with no drawn lines reads this way. If that looks wrong, ask it to re-read the source file.');
1283
+ return;
1284
+ }
1011
1285
  document.getElementById('empty').classList.remove('show');
1012
1286
  document.getElementById('src').textContent = (C.source && C.source.name) ? ('· ' + C.source.name) : '';
1013
1287
  initFromFilter();
1288
+ // AFTER `initFromFilter`, deliberately. `boot()` wraps this in try/finally with no catch, so a
1289
+ // cosmetic throw ahead of the functional call would leave a mandatory checkpoint rendering nothing,
1290
+ // with no message. Nothing here can throw today -- the formatter is proven total -- but the ordering
1291
+ // costs nothing and stops a future cosmetic defect taking the page down with it.
1292
+ renderStandardStat();
1293
+ // Not awaited: the standard half is already correct from `C`, and the units half fills in when the
1294
+ // preference lands. `.catch` because the derived promise is otherwise discarded, so the day this
1295
+ // repaint acquires a throwing DOM call it would surface as an unhandled rejection nobody sees.
1296
+ loadDisplayUnits()
1297
+ .then(renderStandardStat)
1298
+ .catch((e) => console.warn('steel-filter: could not repaint the standard chip', e));
1014
1299
  // Only once there is actually a rendered view to explain — see takeUpdateNote.
1015
1300
  if(note) showUpdateNote();
1016
1301
  }
@@ -1950,9 +2235,9 @@ function setSignoffMode(problem){
1950
2235
  const body = document.createElement('p'); body.textContent = copy.body;
1951
2236
  signoffNotice.append(heading, body);
1952
2237
  // Approve held focus when it was pressed, and it has just been HIDDEN — leaving focus on a hidden
1953
- // control drops it on <body>. Reload is the only action that can make this checkpoint retryable, so
1954
- // put focus there; Close remains available only to dismiss the explanation.
1955
- signoffReload.focus();
2238
+ // control drops it on <body>. Focus Reload when saved work can be refreshed, or Close when
2239
+ // the unsaved selection must be kept for another Save attempt.
2240
+ (signoffReload.hidden ? signoffCloseBtn : signoffReload).focus();
1956
2241
  }
1957
2242
 
1958
2243
  let signoffCoveredSurfaces = [];
@@ -2038,19 +2323,19 @@ function setSignoffApproveGate(){
2038
2323
  */
2039
2324
  async function runSignoffPreview(){
2040
2325
  const seq = ++signoffPreviewSeq;
2041
- let previewRefusal = 'steel-exclusion-preview-unavailable';
2042
- signoffPreview = null;
2043
- signoffPreviewState = 'pending';
2044
- renderSignoffTotal();
2045
- setSignoffApproveGate();
2046
- const body = { mode: F.mode, layers: [], thicknesses: [], colors: [] };
2047
- for(const dim of MODE_ORDER){
2048
- const d = FACET_DIMS[dim];
2049
- body[d.control] = ((F && F[d.control]) || []).map(row => ({ [d.rowKey]: row[d.rowKey], on: row.on === true }));
2050
- }
2051
- const controller = new AbortController();
2052
- const timer = setTimeout(() => controller.abort(), SIGNOFF_PREVIEW_TIMEOUT_MS);
2326
+ let timer;
2053
2327
  try {
2328
+ signoffPreview = null;
2329
+ signoffPreviewState = 'pending';
2330
+ renderSignoffTotal();
2331
+ setSignoffApproveGate();
2332
+ const body = { mode: F.mode, layers: [], thicknesses: [], colors: [] };
2333
+ for(const dim of MODE_ORDER){
2334
+ const d = FACET_DIMS[dim];
2335
+ body[d.control] = ((F && F[d.control]) || []).map(row => ({ [d.rowKey]: row[d.rowKey], on: row.on === true }));
2336
+ }
2337
+ const controller = new AbortController();
2338
+ timer = setTimeout(() => controller.abort(), SIGNOFF_PREVIEW_TIMEOUT_MS);
2054
2339
  const res = await fetch(`/api/projects/${encodeURIComponent(PROJECT)}/revision-requests/${encodeURIComponent(revisionRequest)}/exclusion-preview`, {
2055
2340
  method: 'POST', headers: { 'content-type': 'application/json' },
2056
2341
  body: JSON.stringify(body), signal: controller.signal,
@@ -2067,33 +2352,34 @@ async function runSignoffPreview(){
2067
2352
  const payload = await res.json();
2068
2353
  if(seq !== signoffPreviewSeq) return; // a newer open superseded this one
2069
2354
  // The reply is CHECKED, not assumed, and the check is here rather than at the point of use.
2070
- // `renderSignoffTotal` runs after this function's try/catch, so a missing `potentialLines` threw
2071
- // out of the async function as an unhandled rejection: state stayed 'ok', the total kept reading
2072
- // "Working out…", the approve gate was never released, and the dialog became a dead end escapable
2073
- // only by Cancel. Fail-closed, but SILENTLY — which is the one thing the fail-closed rule forbids.
2074
- // A malformed reply is a failed preview, and the failed state already says what to do about it.
2355
+ // A malformed reply is a failed preview, and the failed state says what to do about it.
2075
2356
  const counts = payload && payload.potentialLines;
2076
2357
  const usable = !!payload && typeof payload.manifestHash === 'string' && typeof payload.controlsHash === 'string'
2077
2358
  && !!counts && Number.isFinite(counts.model) && Number.isFinite(counts.evidence);
2078
2359
  if(!usable) throw new Error('exclusion preview reply is missing the figures the approval binds to');
2079
2360
  signoffPreview = payload;
2080
2361
  signoffPreviewState = 'ok';
2362
+ renderSignoffTotal();
2363
+ setSignoffApproveGate();
2081
2364
  } catch(e){
2082
- if(seq !== signoffPreviewSeq) return;
2083
- console.error('exclusion preview failed', e);
2084
- signoffPreviewState = 'failed';
2085
- // A named refusal keeps its own sentence; a network drop, a timeout or an unrecognised code falls
2086
- // to the generic one, which is the honest answer for "we do not know why".
2087
- previewRefusal = (e && e.signoffCode) || 'steel-exclusion-preview-unavailable';
2365
+ failSignoffPreview(seq, e);
2088
2366
  } finally {
2089
2367
  clearTimeout(timer);
2090
2368
  }
2369
+ }
2370
+
2371
+ // Every current preview failure uses the same recovery, including preparation and rendering errors.
2372
+ function failSignoffPreview(seq, error){
2091
2373
  if(seq !== signoffPreviewSeq) return;
2374
+ console.error('exclusion preview failed', error);
2375
+ signoffPreview = null;
2376
+ signoffPreviewState = 'failed';
2092
2377
  renderSignoffTotal();
2093
2378
  setSignoffApproveGate();
2094
2379
  // No figures means no approval to submit — the two binding hashes come from this reply. Say so, and
2095
2380
  // offer the actions that can actually help, instead of an Approve the server would refuse.
2096
- if(signoffPreviewState === 'failed'){ signoffOutcome = previewRefusal; setSignoffMode(signoffOutcome); }
2381
+ signoffOutcome = (error && error.signoffCode) || 'steel-exclusion-preview-unavailable';
2382
+ setSignoffMode(signoffOutcome);
2097
2383
  }
2098
2384
 
2099
2385
  function openSignOff(values){
@@ -2145,10 +2431,11 @@ function openSignOff(values){
2145
2431
  setSignoffMode(null);
2146
2432
  coverSignoffBackground();
2147
2433
  signoffOverlay.hidden = false;
2148
- void runSignoffPreview();
2149
2434
  // Cancel takes focus, not Approve: a stray Enter must not fire the consequential action before the
2150
2435
  // list has been read.
2151
2436
  signoffCancel.focus();
2437
+ const previewSeq = signoffPreviewSeq + 1;
2438
+ void runSignoffPreview().catch(error => failSignoffPreview(previewSeq, error));
2152
2439
  }
2153
2440
 
2154
2441
  function closeSignOff(){
@@ -2552,6 +2839,66 @@ window.__filterTest = {
2552
2839
  document.addEventListener('pointerdown', hide, true); // a click hides the tip immediately
2553
2840
  })();
2554
2841
 
2842
+ /* ── Filters panel rail: collapse + resize ───────────────────────────────────────────────────────
2843
+ The shell's pane behaviour, scoped to this page so it folds within the Drawing Filter step rather
2844
+ than the window. State persists per browser, like the shell's own pane widths. */
2845
+ (function(){
2846
+ const app=document.getElementById('app'), grip=document.getElementById('panelGrip'), handle=document.getElementById('panelResize');
2847
+ if(!app||!grip||!handle) return;
2848
+ const LS='floless:filter-panel', MIN=220, MAX=520, DEFAULT=300; // DEFAULT is #app's --panel-w; keep them in step
2849
+ let shut=false, width=null;
2850
+ try{ const s=JSON.parse(localStorage.getItem(LS)||'{}'); shut=!!s.shut; if(typeof s.width==='number') width=s.width; }catch{ /* private mode */ }
2851
+ const save=()=>{ try{ localStorage.setItem(LS, JSON.stringify({shut,width})); }catch{ /* private mode */ } };
2852
+ // The shell's dividers report their width as a value (app.js syncValue). A separator the keyboard can move
2853
+ // has to, or a screen reader announces nothing when it moves. With no stored width it reports DEFAULT, not
2854
+ // the computed variable: straight after a reset --panel-w is still transitioning, so reading it announced
2855
+ // the width the panel was leaving.
2856
+ const syncValue=()=>{
2857
+ const w=Math.round(width ?? DEFAULT);
2858
+ handle.setAttribute('aria-valuemin',String(MIN)); handle.setAttribute('aria-valuemax',String(MAX));
2859
+ handle.setAttribute('aria-valuenow',String(w)); handle.setAttribute('aria-valuetext',w+' pixels');
2860
+ };
2861
+ function reflect(){
2862
+ app.classList.toggle('panel-shut', shut);
2863
+ if(width!=null) app.style.setProperty('--panel-w', width+'px');
2864
+ const label=(shut?'Expand':'Collapse')+' Filters panel';
2865
+ grip.setAttribute('aria-expanded', String(!shut));
2866
+ grip.setAttribute('aria-label', label);
2867
+ grip.dataset.tip=label;
2868
+ syncValue();
2869
+ }
2870
+ // pointerdown, not click, would kill the button's own activation — the grip listens for click and
2871
+ // the drag surface is a separate element, so the two never fight over the same gesture.
2872
+ grip.addEventListener('click', ()=>{ shut=!shut; save(); reflect(); });
2873
+ handle.addEventListener('mousedown', e=>{
2874
+ if(shut) return;
2875
+ e.preventDefault();
2876
+ const startX=e.clientX, startW=document.getElementById('panel').getBoundingClientRect().width;
2877
+ handle.classList.add('dragging'); app.classList.add('resizing'); document.body.style.userSelect='none';
2878
+ const onMove=ev=>{ width=Math.max(MIN,Math.min(MAX,startW+(ev.clientX-startX))); app.style.setProperty('--panel-w', width+'px'); };
2879
+ const onUp=()=>{ handle.classList.remove('dragging'); app.classList.remove('resizing'); document.body.style.userSelect='';
2880
+ document.removeEventListener('mousemove',onMove); document.removeEventListener('mouseup',onUp); save(); syncValue(); };
2881
+ document.addEventListener('mousemove',onMove); document.addEventListener('mouseup',onUp);
2882
+ });
2883
+ handle.addEventListener('dblclick', ()=>{ width=null; app.style.removeProperty('--panel-w'); save(); syncValue(); });
2884
+ // The keyboard path the shell's own dividers have: the arrows step the width, Shift steps further, Enter
2885
+ // restores the default. Shut, the divider is display:none, so it cannot take focus at all.
2886
+ handle.addEventListener('keydown', e=>{
2887
+ const isArrow=e.key==='ArrowLeft'||e.key==='ArrowRight', isReset=e.key==='Enter';
2888
+ if(!isArrow&&!isReset) return;
2889
+ e.preventDefault(); e.stopPropagation();
2890
+ if(isReset){ width=null; app.style.removeProperty('--panel-w'); }
2891
+ else{
2892
+ const from=width ?? document.getElementById('panel').getBoundingClientRect().width;
2893
+ width=Math.max(MIN,Math.min(MAX,from+(e.key==='ArrowRight'?1:-1)*(e.shiftKey?40:12)));
2894
+ app.style.setProperty('--panel-w', width+'px');
2895
+ }
2896
+ save();
2897
+ syncValue();
2898
+ });
2899
+ reflect();
2900
+ })();
2901
+
2555
2902
  boot();
2556
2903
  </script>
2557
2904
  </body>