@floless/app 0.138.2 → 0.139.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.
Files changed (109) hide show
  1. package/autostart.mjs +6 -2
  2. package/desktop-access-production-manifest.mjs +7 -0
  3. package/dist/floless-server.cjs +157207 -70887
  4. package/dist/schemas/model.continuation.v1.schema.json +19 -0
  5. package/dist/schemas/model.continuation.v2.schema.json +19 -0
  6. package/dist/schemas/model.query-response.v1.schema.json +95 -0
  7. package/dist/schemas/model.query-response.v2.schema.json +80 -0
  8. package/dist/schemas/model.query.v1.schema.json +87 -0
  9. package/dist/schemas/model.query.v2.schema.json +87 -0
  10. package/dist/schemas/model.snap-candidate.v1.schema.json +48 -0
  11. package/dist/schemas/model.snap-constraint.v1.schema.json +18 -0
  12. package/dist/schemas/model.snap-query.v1.schema.json +24 -0
  13. package/dist/schemas/model.snap-result.v1.schema.json +33 -0
  14. package/dist/schemas/model.snapshot.v1.schema.json +136 -0
  15. package/dist/schemas/revit.model.v1.schema.json +24 -0
  16. package/dist/schemas/steel.model.v2.schema.json +45 -6
  17. package/dist/skills/floless-app-approval/SKILL.md +19 -5
  18. package/dist/skills/floless-app-bridge/SKILL.md +19 -6
  19. package/dist/skills/floless-app-knowledge/SKILL.md +22 -1
  20. package/dist/skills/floless-app-new-workflow/SKILL.md +31 -27
  21. package/dist/skills/floless-app-new-workflow/references/build-and-verify.md +13 -12
  22. package/dist/skills/floless-app-onboarding/SKILL.md +3 -3
  23. package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +16 -9
  24. package/dist/skills/floless-app-steel-model/SKILL.md +11 -2
  25. package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +95 -0
  26. package/dist/skills/floless-app-steel-takeoff/SKILL.md +142 -21
  27. package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +19 -0
  28. package/dist/skills/floless-app-tweak-contract/SKILL.md +42 -8
  29. package/dist/skills/floless-app-vectorize/SKILL.md +19 -6
  30. package/dist/skills/floless-app-workflows/SKILL.md +30 -3
  31. package/dist/skills/floless-app-workflows/references/workspace-data.md +77 -4
  32. package/dist/templates/floless-workspace-model-report.flo +77 -0
  33. package/dist/templates/revit-model.flo +111 -0
  34. package/dist/web/app.css +415 -177
  35. package/dist/web/app.js +302 -51
  36. package/dist/web/aware.js +1357 -1032
  37. package/dist/web/chat.css +692 -0
  38. package/dist/web/chat.js +2651 -0
  39. package/dist/web/commands-revit.js +42 -0
  40. package/dist/web/commands-shell.js +531 -70
  41. package/dist/web/commands-steel.js +344 -146
  42. package/dist/web/commands.js +1 -1
  43. package/dist/web/index.html +283 -77
  44. package/dist/web/instructor.js +217 -36
  45. package/dist/web/left-pane.js +636 -0
  46. package/dist/web/model-artifact-loader.js +75 -0
  47. package/dist/web/model-authoring-gestures.js +141 -0
  48. package/dist/web/model-cad-tools.js +20 -0
  49. package/dist/web/model-clip-gesture.js +148 -0
  50. package/dist/web/model-clip-list.js +156 -0
  51. package/dist/web/model-clip-session.js +274 -0
  52. package/dist/web/model-clip-three-overlay.js +295 -0
  53. package/dist/web/model-clip-three-preview.js +59 -0
  54. package/dist/web/model-editor-contract.js +519 -0
  55. package/dist/web/model-editor-revit-adapter.js +139 -0
  56. package/dist/web/model-editor-shell.js +271 -0
  57. package/dist/web/model-editor-state-recovery.js +44 -0
  58. package/dist/web/model-editor-steel-adapter.js +415 -0
  59. package/dist/web/model-editor.css +268 -0
  60. package/dist/web/model-frame.js +192 -0
  61. package/dist/web/model-inspector.js +128 -0
  62. package/dist/web/model-measure.js +390 -0
  63. package/dist/web/model-navigation-controls.js +246 -0
  64. package/dist/web/model-orientation-overlay.js +217 -0
  65. package/dist/web/model-panel-bridge.js +230 -0
  66. package/dist/web/model-pointer-dock.js +164 -0
  67. package/dist/web/model-revit-module.js +83 -0
  68. package/dist/web/model-selection-coordinator.js +151 -0
  69. package/dist/web/model-selection-tools.js +290 -0
  70. package/dist/web/model-snap-contract.js +267 -0
  71. package/dist/web/model-snapping.js +497 -0
  72. package/dist/web/model-spatial-panel.js +294 -0
  73. package/dist/web/model-spatial-tools.js +249 -0
  74. package/dist/web/model-tree.js +47 -0
  75. package/dist/web/model-viewport-lighting.js +166 -0
  76. package/dist/web/model-viewport-revit-adapter.js +1224 -0
  77. package/dist/web/model-viewport-state.js +505 -0
  78. package/dist/web/model-viewport-steel-adapter.js +150 -0
  79. package/dist/web/model-viewport-toolbar.js +516 -0
  80. package/dist/web/model-viewport.js +717 -0
  81. package/dist/web/panels.js +8 -15
  82. package/dist/web/renderers.js +3 -0
  83. package/dist/web/revit-editor.css +35 -0
  84. package/dist/web/revit-editor.html +74 -0
  85. package/dist/web/revit-editor.js +845 -0
  86. package/dist/web/steel-3d-core.js +16 -44
  87. package/dist/web/steel-3d-view.js +1384 -633
  88. package/dist/web/steel-canvas-guidance.js +3 -1
  89. package/dist/web/steel-editor.html +2145 -1255
  90. package/dist/web/steel-filter.html +5 -1
  91. package/dist/web/steel-model-v2-commands.js +80 -3
  92. package/dist/web/steel-split-view.js +5 -39
  93. package/dist/web/steel-view-generation.js +107 -17
  94. package/dist/web/vector-3d.html +12 -0
  95. package/dist/web/workspaces.js +2154 -283
  96. package/distribution-profile-active.mjs +2 -0
  97. package/distribution-profile-production.mjs +47 -0
  98. package/distribution-profile-shared.mjs +8 -0
  99. package/distribution-profile.mjs +18 -0
  100. package/distribution-resource-inventory.mjs +81 -0
  101. package/launch.mjs +18 -10
  102. package/log.mjs +2 -1
  103. package/managed-runtime-policy.mjs +104 -0
  104. package/model-reader-policy-active.mjs +7 -0
  105. package/network-policy-active.mjs +6 -0
  106. package/package.json +17 -2
  107. package/post-update-marker.mjs +3 -1
  108. package/rvt-production-uat-authority.mjs +60 -0
  109. package/teardown.mjs +4 -3
@@ -0,0 +1,415 @@
1
+ /*
2
+ * model-editor-steel-adapter.js — Steel's binding to the shared editor contract.
3
+ *
4
+ * FIRST MEMBER ONLY: the command-id binding and Steel's capability declaration. No DOM, no calls
5
+ * into `steel-editor.html`'s closure, no markup moved. The plan is explicit that the facade is
6
+ * introduced BEFORE anything is extracted, and this is the half that can exist without touching a
7
+ * 17,500-line page — which is exactly why it lands first and alone.
8
+ *
9
+ * WHY A BINDING AT ALL. The shared toolbar speaks `model.*` so a second editor can render the same
10
+ * chrome; Steel's live vocabulary is `steel.*` and is referenced by the instructor registry, the
11
+ * command guards, and the page's own `data-command-id` attributes. Renaming those to `model.*` would
12
+ * be a large rename of working code for no behaviour — so the two vocabularies are BOUND instead,
13
+ * and `server/model-editor-contract.test.ts` proves the binding still hits real markup.
14
+ *
15
+ * THE PRIMARY ID IS THE ONE THE USER ACTIVATES. For a menu that is the menu's own button, not its
16
+ * items: pinning every option here would make the binding fail the day Steel gains a sixth display
17
+ * mode, which is a legitimate change this file has no business refusing.
18
+ */
19
+
20
+ /*
21
+ * RE-EXPORTED through this binding rather than imported on its own, for the reason model-editor-shell.js
22
+ * records: boot() destructures a fixed list the harness pattern-matches, so a new binding is five
23
+ * coordinated edits and ~113 harness tests of blast radius. This costs none.
24
+ */
25
+ export { createEntityKeyRegistry } from './model-viewport-state.js';
26
+ export { createModelSelectionCoordinator } from './model-selection-coordinator.js';
27
+ export { createModelAuthoringGestures } from './model-authoring-gestures.js';
28
+
29
+ /** Common command id → the `data-command-id` Steel actually carries in its 3D toolbar. */
30
+ export const STEEL_COMMAND_BINDING_V1 = Object.freeze({
31
+ 'model.projection': 'steel.projection#toggle',
32
+ 'model.fit': 'steel.fit-3d',
33
+ 'model.fit-selection': 'steel.fit-selection',
34
+ 'model.display-mode': 'steel.toolbar-menu#display mode',
35
+ 'model.visibility': 'steel.toolbar-menu#visibility',
36
+ 'model.isolate': 'steel.isolate',
37
+ 'model.ghost-unselected': 'steel.ghost-unselected',
38
+ 'model.hide-selected': 'steel.hide-selected',
39
+ 'model.show-all': 'steel.show-all',
40
+ 'model.clip': 'steel.toolbar-menu#clip',
41
+ 'model.work-plane': 'steel.toolbar-menu#working plane',
42
+ 'model.work-area': 'steel.toolbar-menu#working area',
43
+ });
44
+
45
+ /**
46
+ * Steel's domain-only toolbar contribution — the 3D label menu. It is NOT a common control and must
47
+ * never be promoted into one: reference lines, mark labels and property labels are facts about
48
+ * steel members, and a Revit toolbar showing them would be describing something that is not there.
49
+ */
50
+ export const STEEL_TOOLBAR_CONTRIBUTIONS_V1 = Object.freeze(['steel.toolbar-menu#3D label']);
51
+
52
+ /** Steel supports every common command current master exposes; nothing is gated. */
53
+ export function steelCapabilityEntries() {
54
+ const out = Object.create(null);
55
+ for (const id of Object.keys(STEEL_COMMAND_BINDING_V1)) {
56
+ out[id] = { supported: true, availability: 'available' };
57
+ }
58
+ return out;
59
+ }
60
+
61
+ /* ───────────────────────────────────────────────────────────────────────────────────────────────
62
+ * THE MOUNT SEAM
63
+ *
64
+ * `createSteelAdapter({ viewport, editorBridge })` is how the page gets a facade over its 3D view.
65
+ *
66
+ * WHY IT TAKES BOTH. `viewport` is Steel's 3D module — the page → view seam. `editorBridge` is the
67
+ * other direction: services the EDITOR provides, of which the common toolbar needs exactly one today
68
+ * (Saved views opens a panel, which no viewport can do). Keeping them separate is what lets a fake
69
+ * non-Steel provider pass the conformance tests without implementing page behaviour.
70
+ *
71
+ * WHY `viewport` MAY BE A FUNCTION. The plan pins the mount sequence, and an earlier draft named an
72
+ * impossible one. `main()` runs long before `Steel3DView.init(stage3d, view3dApi)`, which does not
73
+ * happen until the first 3D activation. So the adapter is mounted in `main()` holding a way to REACH
74
+ * the viewport, and resolves it on every use; `isReady()` answers false until init has run, and a
75
+ * command issued before then is refused rather than queued into nothing.
76
+ *
77
+ * NO DOM HERE, DELIBERATELY. This file translates verbs, and `server/model-editor-facade.test.ts`
78
+ * fails the build if it acquires a page reference. A "provider-neutral" facade that reaches for an
79
+ * element id is not an interface a second editor can implement.
80
+ * ─────────────────────────────────────────────────────────────────────────────────────────────── */
81
+
82
+ import { createModelEditorFacade } from './model-editor-contract.js';
83
+
84
+ /**
85
+ * Steel's 3D verbs, expressed as the neutral viewport interface.
86
+ *
87
+ * The mapping is where Steel's history shows: `showAllGroups` is Steel's name for show-all,
88
+ * `setClipMode(null)` is how a clip pick is cancelled, and `workAreaFromSelection` reports whether it
89
+ * found a selection to work from. Those names stay Steel's — renaming 190 members to match a shared
90
+ * vocabulary would be a large rename of working code for no behaviour, which the plan rejects. What
91
+ * the shell sees is this side.
92
+ */
93
+ function steelViewportProvider(resolve) {
94
+ const v = () => resolve();
95
+ return {
96
+ isReady: () => { const x = v(); return !!(x && x.isReady && x.isReady()); },
97
+ dispose: () => v().dispose(),
98
+ rebuild: (fit) => v().rebuild(fit),
99
+ suspend: () => v().hide(),
100
+ resume: () => v().show(),
101
+
102
+ projection: () => v().projection(),
103
+ displayMode: () => v().mode(),
104
+ clipMode: () => v().clipMode(),
105
+ workPlaneInfo: () => v().workPlaneInfo(),
106
+ workAreaState: () => v().workAreaState(),
107
+ lightingState: () => v().lightingState(),
108
+ ghostUnselected: () => v().ghostUnselected(),
109
+ getState: () => v().getState(),
110
+ subscribe: (listener) => v().subscribe(listener),
111
+ setLighting: (value) => v().setLighting(value),
112
+
113
+ setProjection: (mode) => v().setProjection(mode),
114
+ setDisplayMode: (mode) => v().setDisplayMode(mode),
115
+ fitAll: () => v().frameAll(),
116
+ fitSelection: () => v().frameSelection(),
117
+
118
+ isolateSelected: () => v().isolateSelected(),
119
+ toggleGhostUnselected: () => v().toggleGhostUnselected(),
120
+ hideSelected: () => v().hideSelected(), // returns the count, which the page toasts
121
+ showAll: () => v().showAllGroups(),
122
+
123
+ armClip: (kind) => v().setClipMode(kind),
124
+ cancelClip: () => v().setClipMode(null),
125
+ clearClips: () => v().clearClips(),
126
+
127
+ armWorkPlanePick: (kind) => v().armWorkPlanePick(kind),
128
+ setWorkPlane: ({ plane, offsetMm }) => v().setWorkPlanePrincipal(plane, offsetMm),
129
+ setWorkPlaneVisible: (on) => v().toggleWorkPlaneVisible(on),
130
+ clearWorkPlane: () => v().clearWorkPlane(),
131
+
132
+ // `all` and `selection` are one command with a payload rather than two verbs, because they are one
133
+ // control to the user. The BOOLEAN comes back rather than being handled here: "define from
134
+ // selection" falls back to the whole model when nothing is selected, and that fallback is the
135
+ // page's decision to keep, not a rule to bury in a translation layer.
136
+ setWorkArea: (from) => (from === 'all' ? !!v().workAreaSetAll() : !!v().workAreaFromSelection()),
137
+ toggleWorkArea: () => v().workAreaToggle(),
138
+ toggleWorkAreaWhole: () => v().workAreaSetWhole(),
139
+
140
+ setSelection: ({ ids }) => v().setSelection(ids),
141
+ commitSelection: (commit) => v().commitSelection(commit),
142
+ };
143
+ }
144
+
145
+ /**
146
+ * Mount the common-toolbar facade over Steel.
147
+ *
148
+ * `viewport` is Steel's 3D view, or a function returning it once it exists. `editorBridge` carries the
149
+ * editor-owned actions — `openSavedViews` today, and `onStaleRebuild` if the page wants to hear about
150
+ * a bake that failed after the view was already gone.
151
+ */
152
+ /** @param {{ viewport: any, editorBridge?: any }} options */
153
+ export function createSteelAdapter({ viewport, editorBridge = {} }) {
154
+ if (!viewport) {
155
+ throw new Error('createSteelAdapter: no viewport. Pass Steel3DView, or a function returning it — '
156
+ + 'mounting before it exists is expected, mounting with no way to reach it is a bug.');
157
+ }
158
+ const resolve = typeof viewport === 'function' ? viewport : () => viewport;
159
+ const facade = createModelEditorFacade({
160
+ provider: () => (resolve() ? steelViewportProvider(resolve) : null),
161
+ host: editorBridge,
162
+ });
163
+ // These operations are intentionally Steel-owned rather than additions to the neutral viewport
164
+ // contract. The page still reaches them through this one adapter, while a Revit or future provider
165
+ // never has to implement connection selection, Steel clip handles, or a Steel local frame.
166
+ const invoke = (method, args = [], fallback = undefined) => {
167
+ const target = resolve();
168
+ return target && typeof target[method] === 'function' ? target[method](...args) : fallback;
169
+ };
170
+ const steel = Object.freeze({
171
+ clearReferenceSelection: () => invoke('selectReference', [null]),
172
+ setSelectedClips: (ids) => invoke('setSelectedClips', [ids]),
173
+ selectClip: (id, event) => invoke('selectClip', [id, event]),
174
+ selectedClips: () => invoke('selectedClips', [], []),
175
+ clips: () => invoke('getClips', [], []),
176
+ mountClipList: (host) => invoke('mountClipList', [host], null),
177
+ selectWholeConn: (id) => invoke('selectWholeConn', [id]),
178
+ clearConnSel: () => invoke('clearConnSel'),
179
+ toggleRefLine: () => invoke('setRefLine', [!invoke('refLine', [], false)]),
180
+ frameArmed: () => !!invoke('frameArmed', [], false),
181
+ framePicking: () => !!invoke('framePicking', [], false),
182
+ framePickStep: () => invoke('framePickStep', [], 0),
183
+ repickFrame3d: () => invoke('repickFrame3d'),
184
+ // Arm / disarm the 3D local-frame tool through the facade. The takeover coordination (#1413) — Grid
185
+ // lines and the member-end review disarm it, and it disarms itself when it yields — routes here, not
186
+ // to the raw viewport, so the seam ratchet keeps shrinking. invoke() no-ops before the view exists.
187
+ armFrame3d: (on) => invoke('armFrame3d', [on]),
188
+ disarmFrame3d: () => invoke('disarmFrame3d'),
189
+ teklaDragging: () => !!invoke('teklaDragging', [], false),
190
+ refMeasureArmed: () => !!invoke('refMeasureState', [], {}).armed,
191
+ // A placed detail is Steel-owned. Keep its live opacity preview behind this adapter so the
192
+ // editor never reaches the raw viewport outside its declared seam.
193
+ setDetailOpacity: (id, opacity) => invoke('setDetailOpacity', [id, opacity], false),
194
+ groupState: () => invoke('groupState', [], { hidden: [], solo: [] }),
195
+ // The renderer's own answer to "is anything hidden, isolated or ghosted?", read at the moment it
196
+ // notifies. The Objects-pane Show all needs this rather than the controller's Ghost flag (or the
197
+ // toolbar mark painted from it), which Show all clears only after the renderer has notified.
198
+ hasVisibilityTreatment: () => !!invoke('hasVisibilityTreatment', [], false),
199
+ selectionHiddenIds: () => invoke('selectionHiddenIds', [], []),
200
+ connHiddenIds: () => invoke('connHiddenIds', [], []),
201
+ setGroupsHidden: (keys, hidden) => invoke('setGroupsHidden', [keys, hidden]),
202
+ setIdsHidden: (ids, hidden) => invoke('setIdsHidden', [ids, hidden]),
203
+ // The Plane button's corner mark (#1403). wire3DBar re-renders the whole bar, so it re-applies this.
204
+ reflectWpBar: () => invoke('reflectWpBar'),
205
+ // A saved view's cut depth (the Properties panel): the scene's bounds, a section cut's camera and clips, and the
206
+ // clips on screen. Null while the 3D layer is still being built. setClipState may throw; the caller reports it.
207
+ sceneBounds: () => invoke('sceneBounds', [], null),
208
+ sectionViewState: (box, direction, label) => invoke('sectionViewState', [box, direction, label], null),
209
+ clipState: () => invoke('clipState', [], null),
210
+ setClipState: (state) => invoke('setClipState', [state]),
211
+ });
212
+ return Object.freeze({ ...facade, steel });
213
+ }
214
+
215
+ /* ───────────────────────────────────────────────────────────────────────────────────────────────
216
+ * THE RENDER PLAN
217
+ *
218
+ * ONE object, consumed by four things: the page that fills the toolbar container, the renderer that turns it
219
+ * into markup, and BOTH static guards. Plan review round 2 caught the earlier design shipping two
220
+ * lists — a renderer taking caller-supplied ids beside a separately derived enumeration — which lets
221
+ * a guard validate one list while the page renders another. That is precisely the drift
222
+ * `model-editor-contract.js` was written to prevent, so there is one artifact and everything reads it.
223
+ *
224
+ * COMMAND IDS ARRIVE RESOLVED. The renderer never sees `model.*`; it is handed Steel's own
225
+ * `data-command-id` strings and emits them without knowing what they mean. That is what keeps the
226
+ * renderer neutral by construction rather than by good intentions — it cannot acquire a domain
227
+ * vocabulary without someone adding one on purpose.
228
+ *
229
+ * THIS FILE MAY NAME STEEL ELEMENT IDS. It is Steel's adapter; `m3dProjBtn` is Steel knowledge and
230
+ * belongs here rather than in the shared renderer. What it still may not do is TOUCH the page —
231
+ * `server/model-editor-facade.test.ts` fails the build if any page-global or element lookup appears
232
+ * appearing here, and that guard is the one that matters.
233
+ * ─────────────────────────────────────────────────────────────────────────────────────────────── */
234
+
235
+ import { capabilityMap, resolveToolbar, toolbarClusters } from './model-editor-contract.js';
236
+ import { toolbarCarriers } from './model-viewport-toolbar.js';
237
+
238
+ /**
239
+ * Where Steel's own menu sits in the bar, and whether a rule precedes it.
240
+ *
241
+ * `after: 'views'` is a declared anchor, not a promise the anchor exists: a read-only provider with
242
+ * no Saved views drops that group entirely, and `toolbarClusters` then falls back to the nearest
243
+ * surviving group rather than dropping the contribution. A module's menu must not vanish because of
244
+ * an unrelated capability.
245
+ */
246
+ export const STEEL_CONTRIBUTION_SLOTS_V1 = Object.freeze([
247
+ Object.freeze({ id: 'steel.labels', after: 'views', separatorBefore: true }),
248
+ ]);
249
+
250
+ /** The common controls, in the presentation the page carries today. */
251
+ const CONTROLS = Object.freeze({
252
+ 'model.projection': {
253
+ kind: 'button', el: 'm3dProjBtn', label: 'Perspective', data: { 'data-proj': 'persp' },
254
+ tip: 'Perspective — click for orthographic true scale',
255
+ },
256
+ 'model.fit': { kind: 'button', el: 'm3dFit', cmd: 'steel.fit-3d', label: 'Fit', tip: 'Fit all to view (Home)' },
257
+ 'model.fit-selection': {
258
+ kind: 'button', el: 'm3dFitSel', cmd: 'steel.fit-selection', label: 'Zoom sel',
259
+ tip: 'Zoom to selected — frame just the selected members (Alt+Z)',
260
+ },
261
+ 'model.display-mode': {
262
+ // The min-width is the affordance most easily lost in this move: reflectMode() rewrites this
263
+ // label live and "Realistic ▾" is far wider than "Solid ▾", so without a floor every mode switch
264
+ // shoves Isolate/Views/Clip sideways. It travels with the CONTROL rather than as a
265
+ // page-scoped element rule, because a second editor's display-mode trigger needs the same floor and
266
+ // cannot inherit a Steel element selector.
267
+ kind: 'menu', aria: true, el: 'm3dModeBtn', menu: 'm3dMode', label: 'Solid', data: { 'data-mode': 'solid' },
268
+ tip: 'Display mode — solid, wireframe, see-through (X-ray) or realistic materials',
269
+ items: [
270
+ { kind: 'item', cmd: 'steel.display-mode#a solid shaded model', data: { 'data-mode': 'solid' }, class: 'on', role: 'menuitemradio', checked: true, label: 'Solid', tip: 'Solid shaded model' },
271
+ { kind: 'item', cmd: 'steel.display-mode#a wireframe', data: { 'data-mode': 'wire' }, role: 'menuitemradio', checked: false, label: 'Wire', tip: 'Wireframe — edges only' },
272
+ { kind: 'item', cmd: 'steel.display-mode#see-through X-ray', data: { 'data-mode': 'xray' }, role: 'menuitemradio', checked: false, label: 'X-ray', tip: 'See-through — reveal hidden parts' },
273
+ { kind: 'item', cmd: 'steel.display-mode#realistic materials', data: { 'data-mode': 'realistic' }, role: 'menuitemradio', checked: false, label: 'Realistic', tip: 'Realistic — real material finishes (steel, concrete, timber…)' },
274
+ { kind: 'item', cmd: 'steel.display-mode#realistic with shadows', data: { 'data-mode': 'shadowed' }, role: 'menuitemradio', checked: false, label: 'Shadowed', tip: 'Realistic with cast shadows — more depth, at a cost to frame rate' },
275
+ { kind: 'divider' },
276
+ { kind: 'item', cmd: 'steel.lighting', el: 'm3dLighting', data: { 'data-lighting': 'open' }, label: 'Lighting…', tip: 'Adjust sunlight direction and model brightness' },
277
+ ],
278
+ },
279
+ 'model.visibility': {
280
+ // The wrapper ships hidden and `updateIsolateBtn()` reveals it. That is "nothing is selected
281
+ // right now", a DIFFERENT axis from capability absence — `capabilityMap` has `availability`
282
+ // for it — and Task 2 preserves Steel's mechanism rather than merging the two.
283
+ kind: 'menu', el: 'm3dIso', menu: 'm3dIsoMenu', wrap: 'm3dIsoWrap', aria: true,
284
+ label: 'Visibility ▾', tip: 'Show, isolate, ghost, or hide model objects',
285
+ items: [
286
+ { cap: 'model.show-all', kind: 'item', cmd: 'steel.show-all', role: 'menuitem', data: { 'data-vis': 'show-all' }, hidden: true, label: 'Show all', tip: 'Restore every hidden or isolated object' },
287
+ { cap: 'model.show-all', kind: 'divider', mark: 'data-vis-divider', hidden: true },
288
+ { cap: 'model.isolate', kind: 'item', cmd: 'steel.isolate', role: 'menuitem', data: { 'data-vis': 'isolate' }, label: 'Isolate selected', tip: 'Show only the selected objects (Esc to restore)' },
289
+ { cap: 'model.ghost-unselected', kind: 'toggle', cmd: 'steel.ghost-unselected', data: { 'data-vis': 'ghost' }, checked: false, label: 'Ghost unselected', tip: 'Fade everything except the current selection' },
290
+ { cap: 'model.hide-selected', kind: 'item', cmd: 'steel.hide-selected', role: 'menuitem', data: { 'data-vis': 'hide' }, label: 'Hide selected', tip: 'Hide the selected objects' },
291
+ ],
292
+ },
293
+ 'model.saved-views': {
294
+ kind: 'button', el: 'm3dViewsBtn', cmd: 'steel.saved-views', label: 'Views',
295
+ tip: 'Saved views — save, switch, and manage named viewpoints',
296
+ },
297
+ 'model.clip': {
298
+ kind: 'menu', aria: true, el: 'm3dClip', menu: 'm3dClipMenu', label: 'Clip ▾',
299
+ tip: 'Clip planes and boxes — section your model to see inside',
300
+ items: [
301
+ { kind: 'item', cmd: 'steel.clip-plane', data: { 'data-clip': 'plane' }, label: 'Add clip plane…', tip: 'Click a model face to cut the view there (Shift+X)' },
302
+ { kind: 'item', cmd: 'steel.clip-box', data: { 'data-clip': 'box' }, label: 'Add clip box…', tip: 'Click two corners, then a height, to cut away everything outside (Shift+B)' },
303
+ { kind: 'divider' },
304
+ { kind: 'item', cmd: 'steel.clip-clear', data: { 'data-clip': 'clear' }, class: 'mdanger', label: 'Clear all clips', tip: 'Remove every clip' },
305
+ ],
306
+ },
307
+ 'model.work-plane': {
308
+ kind: 'menu', aria: true, el: 'm3dWp', menu: 'm3dWpMenu', label: '◇ Plane ▾',
309
+ tip: 'Working plane — every 3D pick (Move/Copy, next: drawing) lands on it. Set it from a face, 3 points, or a global XY, XZ or YZ plane.',
310
+ items: [
311
+ { kind: 'item', cmd: 'steel.work-plane-face', data: { 'data-wp': 'face' }, role: 'menuitemradio', checked: false, label: 'Pick face…', tip: "One click on any face — yours or a reference model's — the plane lands on it" },
312
+ { kind: 'item', cmd: 'steel.work-plane-3pt', data: { 'data-wp': '3pt' }, role: 'menuitemradio', checked: false, label: 'Pick 3 points…', tip: 'Three snapped points: origin, X direction, a point on the Y side' },
313
+ // The five plane-KIND options (face, 3 points, XY, XZ, YZ) are ONE exclusive choice: reflectWpMenu marks
314
+ // the one that produced the plane that is set (#1396). This rule is `role=none` because a separator would
315
+ // split them into two announced radio sets, and the XY/XZ/YZ row carries no group role for the same reason.
316
+ // "Reset to level" has no role: it defines no plane, it clears one.
317
+ { kind: 'divider', role: 'none' },
318
+ { kind: 'label', text: 'Global plane + offset' },
319
+ {
320
+ kind: 'row', class: 'wpprow', items: [
321
+ { kind: 'item', cmd: 'steel.work-plane-principal#the horizontal XY plane', data: { 'data-wpp': 'xy' }, role: 'menuitemradio', checked: false, label: 'XY', tip: 'Horizontal plane at the offset elevation' },
322
+ { kind: 'item', cmd: 'steel.work-plane-principal#the vertical XZ plane', data: { 'data-wpp': 'xz' }, role: 'menuitemradio', checked: false, label: 'XZ', tip: 'Vertical plane facing Y, offset along Y' },
323
+ { kind: 'item', cmd: 'steel.work-plane-principal#the vertical YZ plane', data: { 'data-wpp': 'yz' }, role: 'menuitemradio', checked: false, label: 'YZ', tip: 'Vertical plane facing X, offset along X' },
324
+ { kind: 'input', cmd: 'steel.work-plane-offset', ariaLabel: 'Working plane offset', el: 'm3dWpOff', inputmode: 'decimal', placeholder: "16'-6", tip: 'Offset along the plane normal (ft-in)' },
325
+ ],
326
+ },
327
+ { kind: 'divider' },
328
+ { kind: 'toggle', cmd: 'steel.work-plane-show', el: 'm3dWpShow', checked: false, label: 'Show plane', tip: 'Show or hide the reference plane surface' },
329
+ { kind: 'item', cmd: 'steel.work-plane-reset', data: { 'data-wp': 'reset' }, label: 'Reset to level', tip: "Back to the active plan's level" },
330
+ ],
331
+ },
332
+ 'model.work-area': {
333
+ kind: 'menu', aria: true, el: 'm3dWork', menu: 'm3dWorkMenu', label: 'Work area ▾',
334
+ tip: 'Working area — bound the view to a box',
335
+ items: [
336
+ { kind: 'item', cmd: 'steel.work-area-set#the whole model', data: { 'data-wa': 'all' }, label: 'Set to all objects', tip: 'Bound the work area to the whole model' },
337
+ { kind: 'item', cmd: 'steel.work-area-set#the current selection', data: { 'data-wa': 'sel' }, label: 'Define from selection', tip: 'Bound the work area to the current selection' },
338
+ { kind: 'divider' },
339
+ { kind: 'toggle', cmd: 'steel.work-area-show', el: 'm3dWorkOn', checked: false, label: 'Show work area', tip: 'Show or hide the work-area box' },
340
+ { kind: 'toggle', cmd: 'steel.work-area-whole', el: 'm3dWorkWhole', checked: true, hidden: true, label: 'Show whole parts', tip: 'When ON, any part that touches the work area is shown in full — nothing gets cut. When OFF, the work area slices parts cleanly at its box faces (a section cut).' },
341
+ ],
342
+ },
343
+ });
344
+
345
+ /** Steel's own menu — reference lines and the shared property-label controls. Never a common control. */
346
+ const CONTRIBUTIONS = Object.freeze({
347
+ 'steel.labels': [{
348
+ // The contribution's own id is STEEL_TOOLBAR_CONTRIBUTIONS_V1's single member; stated here
349
+ // because a contribution has no `model.*` control to bind through.
350
+ kind: 'menu', el: 'm3dView', menu: 'm3dViewMenu', aria: true, label: 'Labels', semantic: 'steel.labels',
351
+ icon: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8.6 2.3H13a.7.7 0 0 1 .7.7v4.4a1 1 0 0 1-.3.7l-5.6 5.6a1 1 0 0 1-1.4 0L2.3 9.6a1 1 0 0 1 0-1.4l5.6-5.6a1 1 0 0 1 .7-.3z"/><circle cx="10.9" cy="5.1" r="1"/></svg>',
352
+ cmd: STEEL_TOOLBAR_CONTRIBUTIONS_V1[0],
353
+ tip: 'Show or hide reference lines and property labels on the 3D model',
354
+ items: [
355
+ {
356
+ kind: 'toggle', cmd: 'steel.show-labels#reference lines', el: 'm3dRef', checked: false,
357
+ label: 'Ref line', tip: "Show each member's reference line (centreline)",
358
+ },
359
+ {
360
+ kind: 'section', el: 'm3dPlSection', class: 'pl-section', items: [
361
+ {
362
+ kind: 'row', class: 'pl-header', items: [
363
+ { kind: 'toggle', cmd: 'steel.property-label-visibility#View', el: 'm3dPropLabels', checked: true, ariaLabel: 'Property labels in 3D', label: '', tip: 'Show or hide labels here without losing their settings. The 2D plan, the 3D default and each saved 3D view have their own switch and choice of members; the properties shown are shared.' },
364
+ { kind: 'disclosure', cmd: 'steel.property-label-settings#View', el: 'm3dPlDisclosure', class: 'pl-disclosure', controls: 'm3dPlScope', label: 'Property labels', tip: 'Choose which members have property labels' },
365
+ ],
366
+ },
367
+ { kind: 'context', el: 'm3dPlContext', class: 'pl-context' },
368
+ {
369
+ kind: 'scope', el: 'm3dPlScope', class: 'pl-scope', revealBy: 'm3dPlDisclosure', hidden: true, items: [
370
+ { kind: 'toggle', cmd: 'steel.property-label-all#View', el: 'm3dPlAll', checked: true, label: 'For all', tip: 'Label every member, whatever is selected. Turning it on switches off For selected and On selection.' },
371
+ { kind: 'toggle', cmd: 'steel.property-label-selected#View', el: 'm3dPlSelected', checked: false, label: 'For selected', tip: 'Capture the current selection. Turn off and on to capture a new selection.' },
372
+ { kind: 'note', el: 'm3dPlPinned', class: 'pl-note' },
373
+ { kind: 'toggle', cmd: 'steel.property-label-live#View', el: 'm3dPlOnSelection', checked: false, label: 'On selection', tip: 'Labels follow the current selection; combines with For selected' },
374
+ ],
375
+ },
376
+ ],
377
+ },
378
+ ],
379
+ }],
380
+ });
381
+
382
+ /**
383
+ * The plan for a given capability set — Steel's own by default.
384
+ *
385
+ * A menu ITEM can be dropped by capability too (`cap`), which is what makes the Visibility menu
386
+ * shrink honestly rather than opening onto rows that dispatch into nothing. An item carrying no
387
+ * `cap` is presentation — a rule, a caption — and survives as long as its menu does, except for the
388
+ * Show-all divider, which is tied to the item it separates.
389
+ */
390
+ export function steelRenderPlan(entries = steelCapabilityEntries()) {
391
+ const resolved = resolveToolbar(capabilityMap(entries));
392
+ const clusters = toolbarClusters(resolved, STEEL_CONTRIBUTION_SLOTS_V1).map((cluster) => {
393
+ if (cluster.kind === 'contribution') return { ...cluster, controls: CONTRIBUTIONS[cluster.id] ?? [] };
394
+ return {
395
+ ...cluster,
396
+ controls: cluster.controls.map((control) => {
397
+ const d = CONTROLS[control.id];
398
+ if (!d) {
399
+ throw new Error(`steelRenderPlan: no descriptor for "${control.id}" — the specification `
400
+ + 'declares a control this module never taught the renderer to draw.');
401
+ }
402
+ // The TRIGGER's own command id comes from the binding that already exists, never repeated
403
+ // in the descriptor: two spellings of "which Steel command is this control" is the drift
404
+ // this module is built to avoid, and `model-editor-contract.test.ts` already proves the
405
+ // binding hits real markup.
406
+ const withCmd = { ...d, semantic: control.id, cmd: d.cmd ?? STEEL_COMMAND_BINDING_V1[control.id] };
407
+ if (!control.items) return withCmd;
408
+ const live = new Set(control.items);
409
+ return { ...withCmd, items: d.items.filter((item) => !item.cap || live.has(item.cap)) };
410
+ }),
411
+ };
412
+ });
413
+ const plan = { schema: 'floless.model-toolbar-plan/v1', clusters };
414
+ return Object.freeze({ ...plan, carriers: Object.freeze(toolbarCarriers(plan)) });
415
+ }