Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

M42b: tabs row left-aligned + experimental label hierarchy

Yuechen Lie3cfa002ecb8
diff --git a/aetheris.client/docs/ui-m42.md b/aetheris.client/docs/ui-m42.md
new file mode 100644
index 00000000..3bdee609
--- /dev/null
+++ b/aetheris.client/docs/ui-m42.md
@@ -0,0 +1,29 @@
+# UI M42 — Rhythm Layout Discipline
+
+## Step 1 audit snapshot
+- Before refactor, `App.tsx` rendered two different trees: `viewer-grid` with left-side cards + secondary viewport, and `main-grid` with viewport left + debug panel right.
+- Refactor point: move both tabs into one shared shell with fixed top bar, shared viewport host placement, and shared right tool rail.
+
+## Before/after summary
+- Before: viewer and modeling demo each had different main layout containers.
+- After: both tabs use one shell (`top-bar` + `main-layout`) with identical viewport location.
+- Before: Viewer controls rendered in a left panel.
+- After: Viewer controls are right-rail tool sections in this order: STEP Import, STEP Export, Inspector.
+- Before: Modeling controls sat in a dark debug panel.
+- After: Modeling controls are right-rail tool sections in this order: notice, create box, body list, translate, boolean, debug/status.
+- Before: heading typography mixed with different weights/sizes.
+- After: section titles use uppercase, lighter weight, and unified spacing rhythm.
+- Before: border/radius treatment varied between sections.
+- After: rail/cards/viewport/top-bar share consistent border thickness and reduced corner radius.
+- Before: spacing varied by section.
+- After: layout rhythm is aligned to an 8px scale via CSS variables.
+
+## Final layout rules
+- Top bar remains stable across tabs with left title, centered tab switcher, and right global actions.
+- Main area is always two columns: centered viewport area + right tool rail.
+- No left-side panel column exists in either tab.
+- Viewport shell uses the same structure and styling in both tabs.
+
+## Deferred follow-up candidates
+- Optional accordion behavior for tool sections was deferred intentionally to avoid feature changes.
+- Fine-grained responsive rail collapsing behavior was deferred beyond M42 scope.
diff --git a/aetheris.client/src/App.css b/aetheris.client/src/App.css
index 08ad6308..a6fe6d9c 100644
--- a/aetheris.client/src/App.css
+++ b/aetheris.client/src/App.css
@@ -1,40 +1,63 @@
.app-shell {
- display: flex;
- flex-direction: column;
+ --layout-space-1: 8px;
+ --layout-space-2: 16px;
+ --layout-space-3: 24px;
+ --layout-space-4: 32px;
+ --layout-rail-width: 380px;
+ --layout-border-weight: var(--ui-stroke);
+ --layout-border-color: hsl(var(--border));
+ --layout-radius: var(--ui-radius);
+
min-height: 100vh;
color: hsl(var(--foreground));
background: linear-gradient(180deg, #faf9f6 0%, #f5f3ed 100%);
}
-.toolbar {
+.top-bar {
+ position: sticky;
+ top: 0;
+ z-index: 10;
display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 16px 24px;
- border-bottom: var(--ui-divider) solid hsl(var(--border));
+ flex-direction: column;
+ border-bottom: var(--layout-border-weight) solid var(--layout-border-color);
background: hsla(var(--card), 0.95);
}
-.toolbar h1 {
+.top-bar__header-row {
+ display: grid;
+ grid-template-columns: auto 1fr;
+ align-items: center;
+ gap: var(--layout-space-2);
+ padding: var(--layout-space-2) var(--layout-space-3);
+ border-bottom: var(--layout-border-weight) solid var(--layout-border-color);
+}
+
+.top-bar__tabs-row {
+ padding: var(--layout-space-1) var(--layout-space-3);
+}
+
+.top-bar__title {
margin: 0;
- font-size: var(--ui-title);
+ font-size: 0.95rem;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: var(--ui-weight-title);
}
-.toolbar-actions {
+.top-bar__tabs,
+.top-bar__actions,
+.stack-row {
display: flex;
- gap: 8px;
+ gap: var(--layout-space-1);
flex-wrap: wrap;
}
-.top-tabs {
- display: flex;
- gap: 8px;
- padding: 12px 24px;
- border-bottom: var(--ui-divider) solid hsl(var(--border));
- background: hsla(var(--card), 0.86);
+.top-bar__tabs {
+ justify-content: flex-start;
+}
+
+.top-bar__actions {
+ justify-content: flex-end;
}
.tab-button {
@@ -48,123 +71,126 @@
}
.experimental-badge {
- font-size: var(--ui-title);
+ font-size: 0.6875rem;
line-height: 1;
- padding: 2px 6px;
- border-radius: var(--ui-radius);
- border: var(--ui-stroke) solid hsl(var(--border));
- background: hsla(var(--muted), 0.8);
+ opacity: 0.68;
+ font-weight: var(--ui-weight-title);
+ letter-spacing: 0.06em;
}
-.viewer-grid {
- flex: 1;
+.main-layout {
+ min-height: calc(100vh - 76px);
display: grid;
- grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
- gap: 16px;
- padding: 16px 24px;
+ grid-template-columns: minmax(0, 1fr) var(--layout-rail-width);
+ gap: var(--layout-space-2);
+ padding: var(--layout-space-2) var(--layout-space-3);
+}
+
+.viewport-column {
+ min-width: 0;
}
-.product-panel {
+.viewport-shell,
+.tool-rail {
+ height: 100%;
+ border: var(--layout-border-weight) solid var(--layout-border-color);
+ border-radius: var(--layout-radius);
+ background: hsl(var(--card));
+}
+
+.viewport-shell {
+ min-height: calc(100vh - 140px);
+ padding: var(--layout-space-2);
+ display: flex;
+ flex-direction: column;
+ gap: var(--layout-space-2);
+}
+
+.tool-rail {
+ padding: var(--layout-space-2);
+ overflow: auto;
display: flex;
flex-direction: column;
- gap: 12px;
+ gap: var(--layout-space-2);
}
-.product-panel section,
-.viewer-secondary,
-.debug-panel section {
- border: var(--ui-stroke) solid hsl(var(--border));
+.tool-section {
+ border: var(--layout-border-weight) solid var(--layout-border-color);
+ border-radius: var(--layout-radius);
background: hsl(var(--card));
- border-radius: var(--ui-radius);
- padding: 16px;
- box-shadow: none;
-}
-
-.product-panel h2,
-.viewer-secondary h2,
-.debug-panel h2,
-.debug-panel h3,
-.product-panel h3 {
- margin: 0 0 12px;
- font-size: var(--ui-title);
- letter-spacing: var(--ui-title-tracking);
+ padding: var(--layout-space-2);
+ display: flex;
+ flex-direction: column;
+ gap: var(--layout-space-1);
+}
+
+.section-title {
+ margin: 0;
+ font-size: 0.8rem;
+ letter-spacing: 0.09em;
text-transform: uppercase;
color: hsl(var(--muted-foreground));
font-weight: var(--ui-weight-title);
}
+.section-title--sub {
+ margin-top: var(--layout-space-2);
+}
+
.audit-panel {
background: linear-gradient(180deg, #fcfbf8, #f8f5ef);
}
.inspector-row {
display: grid;
- gap: 8px;
- margin-bottom: 12px;
+ gap: var(--layout-space-1);
}
-.main-grid {
- flex: 1;
+.form-grid {
display: grid;
- grid-template-columns: minmax(0, 1fr) 360px;
-}
-
-.viewport-shell {
- min-height: calc(100vh - 64px);
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: var(--layout-space-1);
}
-.debug-panel {
- border-left: var(--ui-divider) solid #1e293b;
- padding: 16px;
- background: #0f172a;
- color: #e2e8f0;
- overflow: auto;
+.boolean-grid {
+ grid-template-columns: 1fr;
}
-.debug-panel section {
- margin-bottom: 16px;
+.boolean-actions {
+ margin-bottom: var(--layout-space-1);
}
-.debug-panel ul,
-.product-panel ul {
+.tool-rail ul {
margin: 0;
padding-left: 16px;
word-break: break-word;
}
.demo-notice {
- margin-top: 0;
- margin-bottom: 16px;
- padding: 8px;
- border-radius: var(--ui-radius);
- background: #1e293b;
- border: var(--ui-stroke) solid #334155;
+ margin: 0;
+ padding: var(--layout-space-1);
+ border-radius: var(--layout-radius);
+ border: var(--layout-border-weight) solid var(--layout-border-color);
+ background: hsla(var(--muted), 0.9);
font-size: var(--ui-small);
}
-.form-grid {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 12px;
- margin-bottom: 12px;
-}
-
.form-grid label,
.textarea-label,
-.product-panel label {
+.tool-rail label {
display: flex;
flex-direction: column;
gap: 4px;
font-size: var(--ui-small);
- font-weight: var(--ui-weight-emphasis);
+ font-weight: var(--ui-weight-body);
}
input,
select,
textarea,
button {
- border-radius: var(--ui-radius);
- border: var(--ui-stroke) solid hsl(var(--input));
+ border-radius: var(--layout-radius);
+ border: var(--layout-border-weight) solid hsl(var(--input));
min-height: 34px;
font-family: var(--ui-font-sans);
font-size: var(--ui-text);
@@ -174,17 +200,9 @@ input,
select,
textarea {
padding: 6px 8px;
- font-weight: var(--ui-weight-body);
- color: #e2e8f0;
- background: #020617;
-}
-
-.product-panel input,
-.product-panel textarea,
-.product-panel select {
color: hsl(var(--foreground));
background: #fffdfa;
- border-color: hsl(var(--input));
+ font-weight: var(--ui-weight-body);
}
button {
@@ -194,17 +212,9 @@ button {
font-weight: var(--ui-weight-emphasis);
}
-.boolean-grid {
- grid-template-columns: 1fr;
-}
-
-.boolean-actions {
- margin-bottom: 12px;
-}
-
button.active-row {
- border-color: #38bdf8;
- background: #0c4a6e;
+ border-color: #6f8f8a;
+ background: #ece8dd;
}
button:focus-visible,
@@ -220,11 +230,6 @@ button:disabled {
cursor: not-allowed;
}
-.textarea-label {
- margin-top: 8px;
- margin-bottom: 8px;
-}
-
textarea {
width: 100%;
min-height: 100px;
@@ -239,3 +244,22 @@ textarea {
strong {
font-weight: var(--ui-weight-emphasis);
}
+
+@media (max-width: 1100px) {
+ .top-bar__header-row {
+ grid-template-columns: 1fr;
+ }
+
+ .top-bar__tabs,
+ .top-bar__actions {
+ justify-content: flex-start;
+ }
+
+ .main-layout {
+ grid-template-columns: 1fr;
+ }
+
+ .viewport-shell {
+ min-height: 500px;
+ }
+}
diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsx
index 11505bfc..595cb096 100644
--- a/aetheris.client/src/App.tsx
+++ b/aetheris.client/src/App.tsx
@@ -409,245 +409,252 @@ function App() {
return (
<div className="app-shell">
- <header className="toolbar">
- <h1>STEP 242 Viewer</h1>
- <div className="toolbar-actions">
- <Button type="button" variant="outline" onClick={() => void handleCreateDocument()} disabled={status === 'loading'}>
- Create Document
- </Button>
- <Button type="button" variant="outline" onClick={() => void handleRefreshTessellation()} disabled={!activeBodyId || status === 'loading'}>
- Refresh Tessellation
- </Button>
+ <header className="top-bar">
+ <div className="top-bar__header-row">
+ <div className="top-bar__title">STEP 242 VIEWER</div>
+ <div className="top-bar__actions">
+ <Button type="button" variant="outline" onClick={() => void handleCreateDocument()} disabled={status === 'loading'}>
+ Create Document
+ </Button>
+ <Button type="button" variant="outline" onClick={() => void handleRefreshTessellation()} disabled={!activeBodyId || status === 'loading'}>
+ Refresh Tessellation
+ </Button>
+ </div>
+ </div>
+ <div className="top-bar__tabs-row">
+ <div className="top-bar__tabs" role="tablist" aria-label="Top-level product surface">
+ <Button
+ type="button"
+ role="tab"
+ variant={activeTab === 'viewer' ? 'default' : 'secondary'}
+ aria-selected={activeTab === 'viewer'}
+ className={activeTab === 'viewer' ? 'tab-button active' : 'tab-button'}
+ onClick={() => setActiveTab('viewer')}>
+ STEP 242 Viewer
+ </Button>
+ <Button
+ type="button"
+ role="tab"
+ variant={activeTab === 'modeling-demo' ? 'default' : 'secondary'}
+ aria-selected={activeTab === 'modeling-demo'}
+ className={activeTab === 'modeling-demo' ? 'tab-button active' : 'tab-button'}
+ onClick={() => setActiveTab('modeling-demo')}>
+ <span>Modeling Demo</span> <span className="experimental-badge">(Experimental)</span>
+ </Button>
+ </div>
</div>
</header>
- <div className="top-tabs" role="tablist" aria-label="Top-level product surface">
- <Button
- type="button"
- role="tab"
- variant={activeTab === 'viewer' ? 'default' : 'secondary'}
- aria-selected={activeTab === 'viewer'}
- className={activeTab === 'viewer' ? 'tab-button active' : 'tab-button'}
- onClick={() => setActiveTab('viewer')}>
- STEP 242 Viewer
- </Button>
- <Button
- type="button"
- role="tab"
- variant={activeTab === 'modeling-demo' ? 'default' : 'secondary'}
- aria-selected={activeTab === 'modeling-demo'}
- className={activeTab === 'modeling-demo' ? 'tab-button active' : 'tab-button'}
- onClick={() => setActiveTab('modeling-demo')}>
- Modeling Demo <span className="experimental-badge">Experimental</span>
- </Button>
- </div>
-
- {activeTab === 'viewer' ? (
- <main className="viewer-grid">
- <aside className="product-panel">
- <section>
- <h2>STEP Import</h2>
- <label>
- STEP 242 File
- <input
- type="file"
- accept=".step,.stp,text/plain"
- onChange={(event) => handleStepFileSelection(event.target.files)}
- />
- </label>
- <p>{stepImportSelectionMessage}</p>
- <Button type="button" onClick={() => void handleImportStep()} disabled={!canImportStep}>Import STEP 242</Button>
- <p><strong>Status:</strong> {statusMessage}</p>
- {diagnostics.length === 0 ? null : (
- <ul>
- {diagnostics.map((diagnostic, index) => (
- <li key={`${diagnostic.code}-${index}`}>
- [{diagnostic.severity}] {diagnostic.code}: {diagnostic.message}
- </li>
- ))}
- </ul>
- )}
- </section>
-
- <section>
- <h2>STEP Export</h2>
- <Button type="button" variant="outline" onClick={() => void handleDownloadCanonicalStep()} disabled={!documentId || !activeOccurrence || status === 'loading'}>
- Download Canonical 242
- </Button>
- <Button type="button" variant="outline" onClick={() => void handleExportActiveStep()} disabled={!activeBodyId || status === 'loading'}>
- Export Active (STEP)
- </Button>
- <details>
- <summary>Copy STEP text</summary>
- <label className="textarea-label">
- Canonical STEP Text
- <textarea value={stepExportText} readOnly placeholder="Exported STEP text will appear here." rows={7} />
- </label>
- </details>
- </section>
-
- <section className="audit-panel">
- <h2>Inspector</h2>
- <div className="inspector-row">
- <span>Canonical SHA256</span>
- <code className="mono-value">{stepCanonicalHash ?? 'Not available'}</code>
- <Button type="button" size="sm" variant="outline" onClick={() => void handleCopyCanonicalHash()} disabled={!stepCanonicalHash}>Copy</Button>
- </div>
- {copyHashMessage ? <p>{copyHashMessage}</p> : null}
- <p><strong>Definition ID:</strong> {activeOccurrence?.definitionId ?? 'None'}</p>
- <p><strong>Occurrence ID:</strong> {activeBodyId ?? 'None'}</p>
- <p><strong>Face count:</strong> {tessellation?.facePatches.length ?? 0}</p>
- <p><strong>Edge count:</strong> {tessellation?.edgePolylines.length ?? 0}</p>
- <p><strong>Shell count:</strong> {activeBodyId ? 1 : 0}</p>
- </section>
- </aside>
-
- <section className="viewer-secondary">
- <h2>Viewport (secondary)</h2>
+ <main className="main-layout">
+ <section className="viewport-column">
+ <div className="viewport-shell">
+ <h2 className="section-title">Viewport (secondary)</h2>
<ViewerViewport
sceneData={sceneData}
highlightedFaceId={highlightedFaceId}
highlightedEdgeId={highlightedEdgeId}
onPickRay={(origin, direction) => void handlePickRay(origin, direction)}
/>
- </section>
- </main>
- ) : (
- <main className="main-grid">
- <ViewerViewport
- sceneData={sceneData}
- highlightedFaceId={highlightedFaceId}
- highlightedEdgeId={highlightedEdgeId}
- onPickRay={(origin, direction) => void handlePickRay(origin, direction)}
- />
- <aside className="debug-panel">
- <h2>Modeling Demo (Non-production)</h2>
- <p className="demo-notice">This is a demo environment. Not part of Viewer v0 contract.</p>
- <section>
- <h3>Create Box</h3>
- <div className="form-grid">
- <label>Width <input type="number" value={boxWidth} onChange={(event) => setBoxWidth(event.target.value)} /></label>
- <label>Height <input type="number" value={boxHeight} onChange={(event) => setBoxHeight(event.target.value)} /></label>
- <label>Depth <input type="number" value={boxDepth} onChange={(event) => setBoxDepth(event.target.value)} /></label>
- </div>
- <button type="button" onClick={() => void handleCreateBox()} disabled={!documentId || status === 'loading'}>Create Box</button>
- </section>
-
- <section>
- <h3>Body List</h3>
- {bodyIds.length === 0 ? <p>No occurrences in document.</p> : (
- <ul>
- {bodyIds.map((bodyId) => {
- const occurrence = occurrences.find((item) => item.occurrenceId === bodyId);
- const label = occurrence
- ? `${bodyId} (def ${occurrence.definitionId.slice(0, 8)}, t=[${occurrence.translation.x.toFixed(2)}, ${occurrence.translation.y.toFixed(2)}, ${occurrence.translation.z.toFixed(2)}])`
- : bodyId;
-
- return <li key={bodyId}>
- <button
- type="button"
- className={bodyId === activeBodyId ? 'active-row' : ''}
- onClick={() => void handleSelectBody(bodyId)}
- disabled={status === 'loading'}>
- {label}
- </button>
- </li>;
- })}
- </ul>
- )}
- </section>
-
- <section>
- <h3>Translate Active Body</h3>
- <div className="form-grid">
- <label>X <input type="number" value={tx} onChange={(event) => setTx(event.target.value)} /></label>
- <label>Y <input type="number" value={ty} onChange={(event) => setTy(event.target.value)} /></label>
- <label>Z <input type="number" value={tz} onChange={(event) => setTz(event.target.value)} /></label>
- </div>
- <button type="button" onClick={() => void handleApplyTranslation()} disabled={!activeBodyId || status === 'loading'}>Apply Translation</button>
- </section>
-
- <section>
- <h3>Boolean (Two-Body)</h3>
- <div className="form-grid boolean-grid">
- <label>
- Target Body
- <select value={booleanTargetBodyId} onChange={(event) => setBooleanTargetBodyId(event.target.value)}>
- <option value="">Select target body</option>
- {bodyIds.map((bodyId) => <option key={`target-${bodyId}`} value={bodyId}>{bodyId}</option>)}
- </select>
- </label>
- <label>
- Tool Body
- <select value={booleanToolBodyId} onChange={(event) => setBooleanToolBodyId(event.target.value)}>
- <option value="">Select tool body</option>
- {bodyIds.map((bodyId) => <option key={`tool-${bodyId}`} value={bodyId}>{bodyId}</option>)}
- </select>
- </label>
+ </div>
+ </section>
+
+ <aside className="tool-rail">
+ {activeTab === 'viewer' ? (
+ <>
+ <section className="tool-section">
+ <h2 className="section-title">Step Import</h2>
<label>
- Operation
- <select value={booleanOperation} onChange={(event) => setBooleanOperation(event.target.value as BooleanOperationUi)}>
- <option value="Union">Union</option>
- <option value="Subtract">Subtract</option>
- <option value="Intersect">Intersect</option>
- </select>
+ STEP 242 File
+ <input
+ type="file"
+ accept=".step,.stp,text/plain"
+ onChange={(event) => handleStepFileSelection(event.target.files)}
+ />
</label>
- </div>
- <div className="toolbar-actions boolean-actions">
- <button type="button" onClick={handleUseActiveBodyAsTarget} disabled={!activeBodyId || status === 'loading'}>Use Active as Target</button>
- <button type="button" onClick={handleUseActiveBodyAsTool} disabled={!activeBodyId || status === 'loading'}>Use Active as Tool</button>
- </div>
- <button type="button" onClick={() => void handleExecuteBoolean()} disabled={!canExecuteBoolean}>Execute Boolean</button>
- {bodyIds.length < 2 ? <p>Need at least 2 bodies to run a boolean.</p> : null}
- {booleanTargetBodyId && booleanToolBodyId && booleanTargetBodyId === booleanToolBodyId ? (
- <p>Target and tool must be different body IDs.</p>
- ) : null}
- </section>
-
- <h2>Debug / Status</h2>
- <p><strong>Request status:</strong> {status}</p>
- <p><strong>Message:</strong> {statusMessage}</p>
- <p><strong>Document ID:</strong> {documentId ?? 'None'}</p>
- <p><strong>Active occurrence ID:</strong> {activeBodyId ?? 'None'}</p>
- <p><strong>Occurrence count:</strong> {bodyIds.length}</p>
- <p><strong>Face patches:</strong> {tessellation?.facePatches.length ?? 0}</p>
- <p><strong>Edge polylines:</strong> {tessellation?.edgePolylines.length ?? 0}</p>
- <h3>Pick Diagnostics (active body only)</h3>
- <p><strong>Pick status:</strong> {pickStatus}</p>
- <p><strong>Pick message:</strong> {pickMessage}</p>
- <p><strong>Pick hits:</strong> {pickHits.length}</p>
- {nearestHit ? (
- <ul>
- <li><strong>Kind:</strong> {nearestHit.entityKind}</li>
- <li><strong>Face ID:</strong> {nearestHit.faceId ?? 'n/a'}</li>
- <li><strong>Edge ID:</strong> {nearestHit.edgeId ?? 'n/a'}</li>
- <li><strong>t:</strong> {nearestHit.t.toFixed(5)}</li>
- <li><strong>Point:</strong> ({nearestHit.point.x.toFixed(5)}, {nearestHit.point.y.toFixed(5)}, {nearestHit.point.z.toFixed(5)})</li>
- </ul>
- ) : <p>No nearest hit to display.</p>}
- <h3>Pick Diagnostics</h3>
- {pickDiagnostics.length === 0 ? <p>None</p> : (
- <ul>
- {pickDiagnostics.map((diagnostic, index) => (
- <li key={`pick-${diagnostic.code}-${index}`}>
- [{diagnostic.severity}] {diagnostic.code}: {diagnostic.message}
- </li>
- ))}
- </ul>
- )}
- <h3>Diagnostics</h3>
- {diagnostics.length === 0 ? <p>None</p> : (
- <ul>
- {diagnostics.map((diagnostic, index) => (
- <li key={`${diagnostic.code}-${index}`}>
- [{diagnostic.severity}] {diagnostic.code}: {diagnostic.message}
- </li>
- ))}
- </ul>
- )}
- </aside>
- </main>
- )}
+ <p>{stepImportSelectionMessage}</p>
+ <Button type="button" onClick={() => void handleImportStep()} disabled={!canImportStep}>Import STEP 242</Button>
+ <p><strong>Status:</strong> {statusMessage}</p>
+ {diagnostics.length === 0 ? null : (
+ <ul>
+ {diagnostics.map((diagnostic, index) => (
+ <li key={`${diagnostic.code}-${index}`}>
+ [{diagnostic.severity}] {diagnostic.code}: {diagnostic.message}
+ </li>
+ ))}
+ </ul>
+ )}
+ </section>
+
+ <section className="tool-section">
+ <h2 className="section-title">Step Export</h2>
+ <div className="stack-row">
+ <Button type="button" variant="outline" onClick={() => void handleDownloadCanonicalStep()} disabled={!documentId || !activeOccurrence || status === 'loading'}>
+ Download Canonical 242
+ </Button>
+ <Button type="button" variant="outline" onClick={() => void handleExportActiveStep()} disabled={!activeBodyId || status === 'loading'}>
+ Export Active (STEP)
+ </Button>
+ </div>
+ <details>
+ <summary>Copy STEP text</summary>
+ <label className="textarea-label">
+ Canonical STEP Text
+ <textarea value={stepExportText} readOnly placeholder="Exported STEP text will appear here." rows={7} />
+ </label>
+ </details>
+ </section>
+
+ <section className="tool-section audit-panel">
+ <h2 className="section-title">Inspector</h2>
+ <div className="inspector-row">
+ <span>Canonical SHA256</span>
+ <code className="mono-value">{stepCanonicalHash ?? 'Not available'}</code>
+ <Button type="button" size="sm" variant="outline" onClick={() => void handleCopyCanonicalHash()} disabled={!stepCanonicalHash}>Copy</Button>
+ </div>
+ {copyHashMessage ? <p>{copyHashMessage}</p> : null}
+ <p><strong>Definition ID:</strong> {activeOccurrence?.definitionId ?? 'None'}</p>
+ <p><strong>Occurrence ID:</strong> {activeBodyId ?? 'None'}</p>
+ <p><strong>Face count:</strong> {tessellation?.facePatches.length ?? 0}</p>
+ <p><strong>Edge count:</strong> {tessellation?.edgePolylines.length ?? 0}</p>
+ <p><strong>Shell count:</strong> {activeBodyId ? 1 : 0}</p>
+ </section>
+ </>
+ ) : (
+ <>
+ <section className="tool-section">
+ <h2 className="section-title">Modeling Demo Notice</h2>
+ <p>Modeling Demo (Non-production)</p>
+ <p className="demo-notice">This is a demo environment. Not part of Viewer v0 contract.</p>
+ </section>
+
+ <section className="tool-section">
+ <h2 className="section-title">Create Box</h2>
+ <div className="form-grid">
+ <label>Width <input type="number" value={boxWidth} onChange={(event) => setBoxWidth(event.target.value)} /></label>
+ <label>Height <input type="number" value={boxHeight} onChange={(event) => setBoxHeight(event.target.value)} /></label>
+ <label>Depth <input type="number" value={boxDepth} onChange={(event) => setBoxDepth(event.target.value)} /></label>
+ </div>
+ <button type="button" onClick={() => void handleCreateBox()} disabled={!documentId || status === 'loading'}>Create Box</button>
+ </section>
+
+ <section className="tool-section">
+ <h2 className="section-title">Body List</h2>
+ {bodyIds.length === 0 ? <p>No occurrences in document.</p> : (
+ <ul>
+ {bodyIds.map((bodyId) => {
+ const occurrence = occurrences.find((item) => item.occurrenceId === bodyId);
+ const label = occurrence
+ ? `${bodyId} (def ${occurrence.definitionId.slice(0, 8)}, t=[${occurrence.translation.x.toFixed(2)}, ${occurrence.translation.y.toFixed(2)}, ${occurrence.translation.z.toFixed(2)}])`
+ : bodyId;
+
+ return <li key={bodyId}>
+ <button
+ type="button"
+ className={bodyId === activeBodyId ? 'active-row' : ''}
+ onClick={() => void handleSelectBody(bodyId)}
+ disabled={status === 'loading'}>
+ {label}
+ </button>
+ </li>;
+ })}
+ </ul>
+ )}
+ </section>
+
+ <section className="tool-section">
+ <h2 className="section-title">Translate Active Body</h2>
+ <div className="form-grid">
+ <label>X <input type="number" value={tx} onChange={(event) => setTx(event.target.value)} /></label>
+ <label>Y <input type="number" value={ty} onChange={(event) => setTy(event.target.value)} /></label>
+ <label>Z <input type="number" value={tz} onChange={(event) => setTz(event.target.value)} /></label>
+ </div>
+ <button type="button" onClick={() => void handleApplyTranslation()} disabled={!activeBodyId || status === 'loading'}>Apply Translation</button>
+ </section>
+
+ <section className="tool-section">
+ <h2 className="section-title">Boolean (Two-body)</h2>
+ <div className="form-grid boolean-grid">
+ <label>
+ Target Body
+ <select value={booleanTargetBodyId} onChange={(event) => setBooleanTargetBodyId(event.target.value)}>
+ <option value="">Select target body</option>
+ {bodyIds.map((bodyId) => <option key={`target-${bodyId}`} value={bodyId}>{bodyId}</option>)}
+ </select>
+ </label>
+ <label>
+ Tool Body
+ <select value={booleanToolBodyId} onChange={(event) => setBooleanToolBodyId(event.target.value)}>
+ <option value="">Select tool body</option>
+ {bodyIds.map((bodyId) => <option key={`tool-${bodyId}`} value={bodyId}>{bodyId}</option>)}
+ </select>
+ </label>
+ <label>
+ Operation
+ <select value={booleanOperation} onChange={(event) => setBooleanOperation(event.target.value as BooleanOperationUi)}>
+ <option value="Union">Union</option>
+ <option value="Subtract">Subtract</option>
+ <option value="Intersect">Intersect</option>
+ </select>
+ </label>
+ </div>
+ <div className="stack-row boolean-actions">
+ <button type="button" onClick={handleUseActiveBodyAsTarget} disabled={!activeBodyId || status === 'loading'}>Use Active as Target</button>
+ <button type="button" onClick={handleUseActiveBodyAsTool} disabled={!activeBodyId || status === 'loading'}>Use Active as Tool</button>
+ </div>
+ <button type="button" onClick={() => void handleExecuteBoolean()} disabled={!canExecuteBoolean}>Execute Boolean</button>
+ {bodyIds.length < 2 ? <p>Need at least 2 bodies to run a boolean.</p> : null}
+ {booleanTargetBodyId && booleanToolBodyId && booleanTargetBodyId === booleanToolBodyId ? (
+ <p>Target and tool must be different body IDs.</p>
+ ) : null}
+ </section>
+
+ <section className="tool-section">
+ <h2 className="section-title">Debug/Status</h2>
+ <p><strong>Request status:</strong> {status}</p>
+ <p><strong>Message:</strong> {statusMessage}</p>
+ <p><strong>Document ID:</strong> {documentId ?? 'None'}</p>
+ <p><strong>Active occurrence ID:</strong> {activeBodyId ?? 'None'}</p>
+ <p><strong>Occurrence count:</strong> {bodyIds.length}</p>
+ <p><strong>Face patches:</strong> {tessellation?.facePatches.length ?? 0}</p>
+ <p><strong>Edge polylines:</strong> {tessellation?.edgePolylines.length ?? 0}</p>
+ <h3 className="section-title section-title--sub">Pick Diagnostics (active body only)</h3>
+ <p><strong>Pick status:</strong> {pickStatus}</p>
+ <p><strong>Pick message:</strong> {pickMessage}</p>
+ <p><strong>Pick hits:</strong> {pickHits.length}</p>
+ {nearestHit ? (
+ <ul>
+ <li><strong>Kind:</strong> {nearestHit.entityKind}</li>
+ <li><strong>Face ID:</strong> {nearestHit.faceId ?? 'n/a'}</li>
+ <li><strong>Edge ID:</strong> {nearestHit.edgeId ?? 'n/a'}</li>
+ <li><strong>t:</strong> {nearestHit.t.toFixed(5)}</li>
+ <li><strong>Point:</strong> ({nearestHit.point.x.toFixed(5)}, {nearestHit.point.y.toFixed(5)}, {nearestHit.point.z.toFixed(5)})</li>
+ </ul>
+ ) : <p>No nearest hit to display.</p>}
+ <h3 className="section-title section-title--sub">Pick Diagnostics</h3>
+ {pickDiagnostics.length === 0 ? <p>None</p> : (
+ <ul>
+ {pickDiagnostics.map((diagnostic, index) => (
+ <li key={`pick-${diagnostic.code}-${index}`}>
+ [{diagnostic.severity}] {diagnostic.code}: {diagnostic.message}
+ </li>
+ ))}
+ </ul>
+ )}
+ <h3 className="section-title section-title--sub">Diagnostics</h3>
+ {diagnostics.length === 0 ? <p>None</p> : (
+ <ul>
+ {diagnostics.map((diagnostic, index) => (
+ <li key={`${diagnostic.code}-${index}`}>
+ [{diagnostic.severity}] {diagnostic.code}: {diagnostic.message}
+ </li>
+ ))}
+ </ul>
+ )}
+ </section>
+ </>
+ )}
+ </aside>
+ </main>
</div>
);
}