Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Refactor UI into viewer-first and modeling demo tabs

Yuechen Li962a70037fd5
diff --git a/aetheris.client/src/App.css b/aetheris.client/src/App.css
index 23dc64dc..3b33217b 100644
--- a/aetheris.client/src/App.css
+++ b/aetheris.client/src/App.css
@@ -7,21 +7,22 @@
display: flex;
flex-direction: column;
min-height: 100vh;
- color: #e2e8f0;
- background: #020617;
+ color: #0f172a;
+ background: #f1f5f9;
}
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
- padding: 0.75rem 1rem;
- border-bottom: 1px solid #1e293b;
+ padding: 0.85rem 1.25rem;
+ border-bottom: 1px solid #cbd5e1;
+ background: #ffffff;
}
.toolbar h1 {
margin: 0;
- font-size: 1.1rem;
+ font-size: 1.2rem;
}
.toolbar-actions {
@@ -29,6 +30,84 @@
gap: 0.5rem;
}
+.top-tabs {
+ display: flex;
+ gap: 0.6rem;
+ padding: 0.75rem 1.25rem;
+ border-bottom: 1px solid #dbe4f0;
+ background: #f8fafc;
+}
+
+.tab-button {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.4rem;
+ background: #e2e8f0;
+ border-color: #cbd5e1;
+ color: #0f172a;
+}
+
+.tab-button.active {
+ background: #2563eb;
+ color: #ffffff;
+ border-color: #1d4ed8;
+}
+
+.experimental-badge {
+ font-size: 0.7rem;
+ padding: 0.1rem 0.35rem;
+ border-radius: 999px;
+ background: rgba(15, 23, 42, 0.15);
+}
+
+.viewer-grid {
+ flex: 1;
+ display: grid;
+ grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
+ gap: 1rem;
+ padding: 1rem 1.25rem 1.25rem;
+}
+
+.product-panel {
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+}
+
+.product-panel section {
+ border: 1px solid #dbe4f0;
+ background: #ffffff;
+ border-radius: 10px;
+ padding: 0.85rem;
+}
+
+.product-panel h2 {
+ margin-top: 0;
+ font-size: 1rem;
+}
+
+.audit-panel {
+ background: #f8fafc;
+}
+
+.inspector-row {
+ display: grid;
+ gap: 0.35rem;
+ margin-bottom: 0.4rem;
+}
+
+.viewer-secondary {
+ border: 1px solid #dbe4f0;
+ background: #ffffff;
+ border-radius: 10px;
+ padding: 0.75rem;
+}
+
+.viewer-secondary h2 {
+ margin-top: 0;
+ font-size: 0.95rem;
+}
+
.main-grid {
flex: 1;
display: grid;
@@ -43,6 +122,7 @@
border-left: 1px solid #1e293b;
padding: 1rem;
background: #0f172a;
+ color: #e2e8f0;
overflow: auto;
}
@@ -57,12 +137,22 @@
border-bottom: 1px solid #1e293b;
}
-.debug-panel ul {
+.debug-panel ul,
+.product-panel ul {
margin: 0;
padding-left: 1rem;
word-break: break-word;
}
+.demo-notice {
+ margin-top: -0.35rem;
+ margin-bottom: 1rem;
+ padding: 0.5rem;
+ border-radius: 8px;
+ background: #1e293b;
+ border: 1px solid #334155;
+}
+
.form-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -85,6 +175,12 @@ input {
background: #020617;
}
+.product-panel input {
+ color: #0f172a;
+ background: #ffffff;
+ border-color: #cbd5e1;
+}
+
select {
border-radius: 4px;
border: 1px solid #334155;
@@ -109,6 +205,13 @@ button {
background: #1e293b;
}
+.product-panel button,
+.toolbar button {
+ color: #0f172a;
+ background: #e2e8f0;
+ border-color: #cbd5e1;
+}
+
button.active-row {
border-color: #38bdf8;
background: #0c4a6e;
@@ -138,8 +241,14 @@ textarea {
resize: vertical;
}
+.product-panel textarea {
+ color: #0f172a;
+ background: #ffffff;
+ border-color: #cbd5e1;
+}
+
.mono-value {
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
word-break: break-all;
user-select: all;
}
diff --git a/aetheris.client/src/App.tsx b/aetheris.client/src/App.tsx
index 7e3656c7..6fded7b3 100644
--- a/aetheris.client/src/App.tsx
+++ b/aetheris.client/src/App.tsx
@@ -12,8 +12,8 @@ import {
tessellateBody,
translateBody,
type BooleanOperation,
- type DiagnosticDto,
type BodyOccurrenceSummaryDto,
+ type DiagnosticDto,
type PickHitDto,
type TessellationResponseDto,
} from './api/aetherisApi';
@@ -22,6 +22,7 @@ import { mapTessellationToRenderData } from './viewer/tessellationMapper';
type RequestStatus = 'idle' | 'loading' | 'success' | 'error';
type BooleanOperationUi = 'Union' | 'Subtract' | 'Intersect';
+type TopLevelTab = 'viewer' | 'modeling-demo';
const BOOLEAN_OP_TO_API: Record<BooleanOperationUi, BooleanOperation> = {
Union: 'union',
@@ -30,6 +31,7 @@ const BOOLEAN_OP_TO_API: Record<BooleanOperationUi, BooleanOperation> = {
};
function App() {
+ const [activeTab, setActiveTab] = useState<TopLevelTab>('viewer');
const [documentId, setDocumentId] = useState<string | null>(null);
const [bodyIds, setBodyIds] = useState<string[]>([]);
const [occurrences, setOccurrences] = useState<BodyOccurrenceSummaryDto[]>([]);
@@ -55,6 +57,7 @@ function App() {
const [stepImportFile, setStepImportFile] = useState<File | null>(null);
const [stepCanonicalHash, setStepCanonicalHash] = useState<string | null>(null);
const [stepImportSelectionMessage, setStepImportSelectionMessage] = useState('No file selected.');
+ const [copyHashMessage, setCopyHashMessage] = useState('');
const maxStepFileSizeBytes = 5 * 1024 * 1024;
@@ -99,7 +102,7 @@ function App() {
const handleCreateDocument = useCallback(async () => {
await runAction('Create document', async () => {
- const created = await createDocument('Basic Modeling UI M19');
+ const created = await createDocument('STEP 242 Viewer UI');
setDocumentId(created.documentId);
setBodyIds([]);
setActiveBodyId(null);
@@ -116,6 +119,7 @@ function App() {
setStepImportFile(null);
setStepCanonicalHash(null);
setStepImportSelectionMessage('No file selected.');
+ setCopyHashMessage('');
});
}, [runAction]);
@@ -196,7 +200,6 @@ function App() {
});
}, [activeBodyId, documentId, runAction]);
-
const activeOccurrence = useMemo(
() => occurrences.find((item) => item.occurrenceId === activeBodyId) ?? null,
[activeBodyId, occurrences]);
@@ -217,6 +220,7 @@ function App() {
const exported = await exportDefinitionStep(documentId, activeOccurrence.definitionId);
setStepExportText(exported.stepText);
setStepCanonicalHash(exported.canonicalHash);
+ setCopyHashMessage('');
});
}, [activeBodyId, activeOccurrence, documentId, runAction]);
@@ -243,6 +247,19 @@ function App() {
});
}, [activeOccurrence, documentId, runAction]);
+ const handleCopyCanonicalHash = useCallback(async () => {
+ if (!stepCanonicalHash) {
+ return;
+ }
+
+ try {
+ await navigator.clipboard.writeText(stepCanonicalHash);
+ setCopyHashMessage('Copied');
+ } catch {
+ setCopyHashMessage('Clipboard unavailable');
+ }
+ }, [stepCanonicalHash]);
+
const handleImportStep = useCallback(async () => {
if (!documentId || !stepImportFile) {
return;
@@ -277,6 +294,7 @@ function App() {
setPickMessage(`Imported occurrence ${imported.occurrenceId} is now active.`);
setPickDiagnostics([]);
setPickHits([]);
+ setCopyHashMessage('');
});
}, [documentId, maxStepFileSizeBytes, refreshSummaryAndActiveTessellation, runAction, stepImportFile]);
@@ -391,7 +409,7 @@ function App() {
return (
<div className="app-shell">
<header className="toolbar">
- <h1>Aetheris Modeling UI (M20)</h1>
+ <h1>STEP 242 Viewer</h1>
<div className="toolbar-actions">
<button type="button" onClick={() => void handleCreateDocument()} disabled={status === 'loading'}>
Create Document
@@ -402,165 +420,231 @@ function App() {
</div>
</header>
- <main className="main-grid">
- <ViewerViewport
- sceneData={sceneData}
- highlightedFaceId={highlightedFaceId}
- highlightedEdgeId={highlightedEdgeId}
- onPickRay={(origin, direction) => void handlePickRay(origin, direction)}
- />
- <aside className="debug-panel">
- <h2>Modeling Controls</h2>
- <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>
+ <div className="top-tabs" role="tablist" aria-label="Top-level product surface">
+ <button
+ type="button"
+ role="tab"
+ aria-selected={activeTab === 'viewer'}
+ className={activeTab === 'viewer' ? 'tab-button active' : 'tab-button'}
+ onClick={() => setActiveTab('viewer')}>
+ STEP 242 Viewer
+ </button>
+ <button
+ type="button"
+ role="tab"
+ 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" onClick={() => void handleDownloadCanonicalStep()} disabled={!documentId || !activeOccurrence || status === 'loading'}>
+ Download Canonical 242
+ </button>
+ <button type="button" 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" 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>
+ <ViewerViewport
+ sceneData={sceneData}
+ highlightedFaceId={highlightedFaceId}
+ highlightedEdgeId={highlightedEdgeId}
+ onPickRay={(origin, direction) => void handlePickRay(origin, direction)}
+ />
</section>
-
- <section>
- <h3>Body List</h3>
- {bodyIds.length === 0 ? <p>No occurrences in document.</p> : (
+ </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>
+ <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="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>
- {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>;
- })}
+ <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>
)}
- </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>
- <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="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>
-
-
- <section>
- <h3>STEP I/O</h3>
- <button type="button" onClick={() => void handleExportActiveStep()} disabled={!activeBodyId || status === 'loading'}>
- Export Active (STEP)
- </button>
- <button type="button" onClick={() => void handleDownloadCanonicalStep()} disabled={!documentId || !activeOccurrence || status === 'loading'}>
- Download Canonical 242
- </button>
- <label className="textarea-label">
- Exported STEP
- <textarea value={stepExportText} readOnly placeholder="Exported STEP text will appear here." rows={7} />
- </label>
- <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>
- </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>
- <p><strong>Canonical SHA256:</strong> <code className="mono-value">{stepCanonicalHash ?? 'Not available'}</code></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>
+ <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>
+ )}
</div>
);
}
diff --git a/aetheris.client/src/__tests__/App.test.tsx b/aetheris.client/src/__tests__/App.test.tsx
index 53529c27..45147578 100644
--- a/aetheris.client/src/__tests__/App.test.tsx
+++ b/aetheris.client/src/__tests__/App.test.tsx
@@ -72,6 +72,48 @@ describe('App STEP file upload flow', () => {
cleanup();
});
+ it('uses viewer tab as default and hides modeling controls until demo tab is selected', () => {
+ render(<App />);
+
+ expect(screen.getByRole('tab', { name: /STEP 242 Viewer/i }).getAttribute('aria-selected')).toBe('true');
+ expect(screen.queryByText('Create Box')).toBeNull();
+
+ fireEvent.click(screen.getByRole('tab', { name: /Modeling Demo/i }));
+
+ expect(screen.getByText('Modeling Demo (Non-production)')).toBeTruthy();
+ expect(screen.getByRole('button', { name: 'Create Box' })).toBeTruthy();
+ });
+
+ it('keeps canonical hash visible from viewer inspector', async () => {
+ apiMocks.importStep.mockResolvedValue({
+ documentId: 'doc-1',
+ definitionId: 'def-2',
+ occurrenceId: 'occ-2',
+ name: 'Imported',
+ diagnostics: [],
+ });
+ apiMocks.exportDefinitionStep.mockResolvedValue({
+ documentId: 'doc-1',
+ definitionId: 'def-2',
+ stepText: 'ISO-10303-21;',
+ canonicalHash: 'hash-123',
+ diagnostics: [],
+ });
+
+ render(<App />);
+
+ fireEvent.click(screen.getByRole('button', { name: 'Create Document' }));
+ await screen.findByText(/Create document complete/i);
+
+ const fileInput = screen.getByLabelText('STEP 242 File') as HTMLInputElement;
+ const file = new File(['ISO-10303-21;DATA;'], 'part.stp', { type: 'text/plain' });
+ fireEvent.change(fileInput, { target: { files: [file] } });
+
+ fireEvent.click(screen.getByRole('button', { name: 'Import STEP 242' }));
+
+ await screen.findByText('hash-123');
+ });
+
it('updates local file selection state when a file is chosen', async () => {
render(<App />);
@@ -145,9 +187,12 @@ describe('App STEP file upload flow', () => {
fireEvent.click(screen.getByRole('button', { name: 'Create Document' }));
await screen.findByText(/Create document complete/i);
+
+ fireEvent.click(screen.getByRole('tab', { name: /Modeling Demo/i }));
fireEvent.click(screen.getByRole('button', { name: 'Create Box' }));
await screen.findByText(/Create box complete/i);
+ fireEvent.click(screen.getByRole('tab', { name: /STEP 242 Viewer/i }));
fireEvent.click(screen.getByRole('button', { name: 'Export Active (STEP)' }));
await screen.findByText('hash-initial');
@@ -204,8 +249,10 @@ describe('App STEP file upload flow', () => {
fireEvent.click(screen.getByRole('button', { name: 'Create Document' }));
await screen.findByText(/Create document complete/i);
+ fireEvent.click(screen.getByRole('tab', { name: /Modeling Demo/i }));
fireEvent.click(screen.getByRole('button', { name: 'Create Box' }));
await screen.findByText(/Create box complete/i);
+ fireEvent.click(screen.getByRole('tab', { name: /STEP 242 Viewer/i }));
fireEvent.click(screen.getByRole('button', { name: 'Download Canonical 242' }));
diff --git a/docs/milestones.md b/docs/milestones.md
index 4bfa92e9..b516d901 100644
--- a/docs/milestones.md
+++ b/docs/milestones.md
@@ -269,3 +269,12 @@
- [x] Use deterministic file naming (`aetheris-{definitionId}.step`) with no timestamp/random suffixes.
- [x] Keep backend canonical hash authoritative and visible in the inspector without extra state mutation during download.
- [x] Add client tests covering export call wiring, downloaded Blob byte/text parity, deterministic filename behavior, canonical-hash stability, and `ApiError` propagation.
+
+## M30 — Viewer UI Refactor
+
+- [x] Promote **STEP 242 Viewer** as the default/authoritative v0 product surface with tab-local React state and no routing dependency.
+- [x] Move modeling/editing operations into a dedicated **Modeling Demo** tab clearly labeled **Experimental** and **Non-production**.
+- [x] Re-prioritize viewer information architecture around STEP import/export and read-only inspection (canonical hash, definition/occurrence IDs, face/edge/shell counts), with viewport presented as secondary.
+- [x] Remove Debug/Status from the primary viewer surface and keep diagnostics/debug detail in the Modeling Demo tab.
+- [x] Keep STEP import/export and canonical hash behavior functionally unchanged while restructuring only frontend layout/presentation.
+- [x] Add frontend tests for tab switching, viewer vs modeling control visibility, and canonical hash visibility in the Viewer tab.