@tscircuit/3d-viewer 0.0.600 → 0.0.601
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/dist/index.js +11 -4
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -146,6 +146,106 @@ Each component has specific props for defining its characteristics and position
|
|
|
146
146
|
|
|
147
147
|
## Advanced Usage
|
|
148
148
|
|
|
149
|
+
### Non-blocking renderer comparison diagnostics
|
|
150
|
+
|
|
151
|
+
The `Diagnostics/Renderer Parity` stories compare the actual viewer with
|
|
152
|
+
`circuit-json-to-gltf` using the same Circuit JSON and local model assets:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
bun run storybook:comparisons
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This opens `Diagnostics/Renderer Parity / X Rotation` directly instead of
|
|
159
|
+
restoring an unrelated story. The ordinary `bun run storybook` entry point is
|
|
160
|
+
unchanged.
|
|
161
|
+
|
|
162
|
+
Each comparison story automatically displays **both oblique and side geometry**
|
|
163
|
+
once its model geometry loads. Both panels remain visible, with the exact
|
|
164
|
+
unlit/no-texture PNGs, edge maps, red/cyan overlays, and metrics used by the
|
|
165
|
+
browser tests. There are no comparison buttons. Click an image to download its
|
|
166
|
+
full-resolution PNG. Bottom-layer fixtures use cameras below the PCB.
|
|
167
|
+
|
|
168
|
+
circuit-json-to-gltf is a development-only dependency. A Bun preparation step generates
|
|
169
|
+
GLBs and records circuit-json-to-gltf failures; it is not imported into the viewer's
|
|
170
|
+
production bundle or the browser story. Model files are local, not fetched from
|
|
171
|
+
ModelCDN during the tests.
|
|
172
|
+
|
|
173
|
+
`build-storybook` also prepares the fixture data, so the existing `vercel-build`
|
|
174
|
+
entry point publishes working comparison stories. Vercel hosts those static
|
|
175
|
+
stories; Playwright diagnostics run separately in GitHub Actions.
|
|
176
|
+
|
|
177
|
+
The browser suite has two separate roles:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Blocking tests of the matcher itself and deliberate browser mutations
|
|
181
|
+
bun test ./tests/geometry-edge-*.test.ts ./tests/renderer-diagnostic-result.test.ts ./tests/renderer-comparison-*.test.ts ./tests/renderer-usb-mounting.test.ts
|
|
182
|
+
bun run test:renderer-calibration
|
|
183
|
+
|
|
184
|
+
# Diagnostic comparisons: failures are reported but do not gate a completed run
|
|
185
|
+
bun run test:renderer-comparisons
|
|
186
|
+
bunx --no-install playwright show-report
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Install the test browser with `bunx playwright install chromium` if Playwright
|
|
190
|
+
reports that its Chromium executable is missing.
|
|
191
|
+
|
|
192
|
+
CI uses Ubuntu, Node 22, Bun 1.3.14 and the Chromium version paired with the
|
|
193
|
+
pinned Playwright dependency. `playwright install --with-deps chromium`
|
|
194
|
+
installs the Linux browser libraries; captures use software WebGL and require
|
|
195
|
+
no physical GPU. Playwright executes under Node even when launched by a Bun
|
|
196
|
+
package script.
|
|
197
|
+
|
|
198
|
+
A local Node 26 `module.register()` deprecation warning is not a test failure;
|
|
199
|
+
Node 22 is the CI runtime. Vite messages about missing dependency source maps
|
|
200
|
+
(for example `manifold-3d/lib/wasm.js.map`) concern debugger metadata, not a
|
|
201
|
+
missing JavaScript or WebAssembly module. A run ending in `passed` completed
|
|
202
|
+
successfully. Runtime/model-loading errors are still surfaced normally; the
|
|
203
|
+
harness does not blanket-suppress logs.
|
|
204
|
+
|
|
205
|
+
Actual comparisons are ordinary failing Playwright assertions, not skipped or
|
|
206
|
+
automatically approved baselines. The runner retains those failures and their
|
|
207
|
+
artifacts but returns success after a completed diagnostic report, making it
|
|
208
|
+
non-blocking for local gate runners too. Missing reports, global runner errors,
|
|
209
|
+
and interrupted runs still fail. For strict exit behavior, invoke
|
|
210
|
+
`bunx playwright test --project=diagnostics` directly.
|
|
211
|
+
|
|
212
|
+
The CI comparison step additionally has `continue-on-error: true`.
|
|
213
|
+
Dependency setup, matcher/runner unit tests, and browser calibration remain blocking.
|
|
214
|
+
The workflow always uploads the HTML report, geometry images, edge maps, diff
|
|
215
|
+
overlays, metadata, and failure traces.
|
|
216
|
+
|
|
217
|
+
The geometry pass isolates the studied CAD component, preserves its actual
|
|
218
|
+
world placement, and uses neutral unlit surfaces rather than textures/shadows.
|
|
219
|
+
The exported GLB receives only the fixed frame conversion back to project
|
|
220
|
+
coordinates: `P = (-G.x, G.z, G.y)`. Both sides use the same orthographic camera
|
|
221
|
+
and viewport. There is no recentering, image registration, or per-renderer fit.
|
|
222
|
+
|
|
223
|
+
The matcher checks edge coverage in both directions with a 1.5-pixel tolerance
|
|
224
|
+
and at most 1% unmatched edges on each side. It does not average differences
|
|
225
|
+
over the whole PCB image. Browser calibration requires identical geometry to
|
|
226
|
+
match and deliberate X-sign, rotation-order, and 0.2248885 mm origin errors to
|
|
227
|
+
be rejected. Pixel agreement is not a substitute for the existing numerical
|
|
228
|
+
placement tests, and it is not a test of material or normal appearance.
|
|
229
|
+
The calibration case has no exported GLB and compares viewer geometry only, so
|
|
230
|
+
browser-side exporter failures remain in the non-blocking diagnostic stage.
|
|
231
|
+
Diff overlays show unmatched viewer edges in red, unmatched exporter edges in
|
|
232
|
+
cyan, and covered edges in gray.
|
|
233
|
+
|
|
234
|
+
Cases keep rotation, origin inference, format dispatch, and the physical USB
|
|
235
|
+
mounting example separate. Explicit-origin zero/Z cases are controls; missing-origin
|
|
236
|
+
cases retain their original alignment tags. Generated output lives in ignored
|
|
237
|
+
directories, never committed PNG baselines. See
|
|
238
|
+
[`tests/fixtures/renderer-parity/README.md`](tests/fixtures/renderer-parity/README.md)
|
|
239
|
+
for source provenance and the common-board adaptation.
|
|
240
|
+
|
|
241
|
+
Nonzero angle probes use oblique values (for example X=37, Y=30, Z=47, and
|
|
242
|
+
mixed 23/31/47), not quarter turns that can conceal symmetry and axis mistakes.
|
|
243
|
+
Zero angles and the renderer's implicit bottom-layer fallback remain deliberate
|
|
244
|
+
controls. The physical USB mounting fixture is a documented exception: its
|
|
245
|
+
native Z-up mesh requires Z=270 degrees to fit the footprint. Actual tab/hole
|
|
246
|
+
and contact/pad geometry is checked separately. The original USB missing-origin
|
|
247
|
+
input remains a distinct diagnostic, not the mounted pose's zero-angle control.
|
|
248
|
+
|
|
149
249
|
### Custom Component Models
|
|
150
250
|
|
|
151
251
|
You can define custom 3D models for components using the `cadModel` prop:
|
package/dist/index.js
CHANGED
|
@@ -36739,7 +36739,7 @@ import * as THREE23 from "three";
|
|
|
36739
36739
|
// package.json
|
|
36740
36740
|
var package_default = {
|
|
36741
36741
|
name: "@tscircuit/3d-viewer",
|
|
36742
|
-
version: "0.0.
|
|
36742
|
+
version: "0.0.600",
|
|
36743
36743
|
repository: {
|
|
36744
36744
|
type: "git",
|
|
36745
36745
|
url: "https://github.com/tscircuit/3d-viewer"
|
|
@@ -36763,11 +36763,16 @@ var package_default = {
|
|
|
36763
36763
|
prepublish: "npm run build",
|
|
36764
36764
|
preview: "vite preview",
|
|
36765
36765
|
storybook: "storybook dev -p 6006",
|
|
36766
|
-
"build-storybook": "storybook build",
|
|
36766
|
+
"build-storybook": "bun run prepare:renderer-comparisons && storybook build",
|
|
36767
36767
|
"vercel-build": "bun run build-storybook",
|
|
36768
36768
|
format: "biome format . --write",
|
|
36769
36769
|
"format:check": "biome format .",
|
|
36770
|
-
"test:node-bundle": "node ./scripts/load-bundle-in-node.js"
|
|
36770
|
+
"test:node-bundle": "node ./scripts/load-bundle-in-node.js",
|
|
36771
|
+
"prepare:renderer-comparisons": "bun scripts/prepare-renderer-comparisons.ts",
|
|
36772
|
+
"storybook:comparisons": "bun run prepare:renderer-comparisons && bun run storybook --initial-path '/story/diagnostics-renderer-parity--x-rotation'",
|
|
36773
|
+
"test:renderer-comparisons:serve": "bun run prepare:renderer-comparisons && vite --config playwright/vite.config.ts",
|
|
36774
|
+
"test:renderer-calibration": "playwright test --project=calibration",
|
|
36775
|
+
"test:renderer-comparisons": "bun scripts/run-renderer-comparisons.ts"
|
|
36771
36776
|
},
|
|
36772
36777
|
dependencies: {
|
|
36773
36778
|
"@jscad/regl-renderer": "^2.6.12",
|
|
@@ -36791,6 +36796,8 @@ var package_default = {
|
|
|
36791
36796
|
"@chromatic-com/storybook": "^1.9.0",
|
|
36792
36797
|
"@jscad/modeling": "^2.12.5",
|
|
36793
36798
|
"@napi-rs/canvas": "^1.0.9",
|
|
36799
|
+
"@playwright/test": "1.58.2",
|
|
36800
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
36794
36801
|
"@storybook/blocks": "9.0.0-alpha.17",
|
|
36795
36802
|
"@storybook/react-vite": "^9.1.5",
|
|
36796
36803
|
"@tscircuit/alphabet": "^0.0.25",
|
|
@@ -36800,10 +36807,10 @@ var package_default = {
|
|
|
36800
36807
|
"@types/react": "19",
|
|
36801
36808
|
"@types/react-dom": "19",
|
|
36802
36809
|
"@types/three": "^0.165.0",
|
|
36803
|
-
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
36804
36810
|
"@vitejs/plugin-react": "^4.3.4",
|
|
36805
36811
|
"bun-match-svg": "^0.0.9",
|
|
36806
36812
|
"bun-types": "1.2.1",
|
|
36813
|
+
"circuit-json-to-gltf": "0.0.129",
|
|
36807
36814
|
debug: "^4.4.0",
|
|
36808
36815
|
"jscad-electronics": "^0.0.178",
|
|
36809
36816
|
"jscad-planner": "^0.0.13",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.601",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tscircuit/3d-viewer"
|
|
@@ -24,11 +24,16 @@
|
|
|
24
24
|
"prepublish": "npm run build",
|
|
25
25
|
"preview": "vite preview",
|
|
26
26
|
"storybook": "storybook dev -p 6006",
|
|
27
|
-
"build-storybook": "storybook build",
|
|
27
|
+
"build-storybook": "bun run prepare:renderer-comparisons && storybook build",
|
|
28
28
|
"vercel-build": "bun run build-storybook",
|
|
29
29
|
"format": "biome format . --write",
|
|
30
30
|
"format:check": "biome format .",
|
|
31
|
-
"test:node-bundle": "node ./scripts/load-bundle-in-node.js"
|
|
31
|
+
"test:node-bundle": "node ./scripts/load-bundle-in-node.js",
|
|
32
|
+
"prepare:renderer-comparisons": "bun scripts/prepare-renderer-comparisons.ts",
|
|
33
|
+
"storybook:comparisons": "bun run prepare:renderer-comparisons && bun run storybook --initial-path '/story/diagnostics-renderer-parity--x-rotation'",
|
|
34
|
+
"test:renderer-comparisons:serve": "bun run prepare:renderer-comparisons && vite --config playwright/vite.config.ts",
|
|
35
|
+
"test:renderer-calibration": "playwright test --project=calibration",
|
|
36
|
+
"test:renderer-comparisons": "bun scripts/run-renderer-comparisons.ts"
|
|
32
37
|
},
|
|
33
38
|
"dependencies": {
|
|
34
39
|
"@jscad/regl-renderer": "^2.6.12",
|
|
@@ -52,6 +57,8 @@
|
|
|
52
57
|
"@chromatic-com/storybook": "^1.9.0",
|
|
53
58
|
"@jscad/modeling": "^2.12.5",
|
|
54
59
|
"@napi-rs/canvas": "^1.0.9",
|
|
60
|
+
"@playwright/test": "1.58.2",
|
|
61
|
+
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
55
62
|
"@storybook/blocks": "9.0.0-alpha.17",
|
|
56
63
|
"@storybook/react-vite": "^9.1.5",
|
|
57
64
|
"@tscircuit/alphabet": "^0.0.25",
|
|
@@ -61,10 +68,10 @@
|
|
|
61
68
|
"@types/react": "19",
|
|
62
69
|
"@types/react-dom": "19",
|
|
63
70
|
"@types/three": "^0.165.0",
|
|
64
|
-
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
65
71
|
"@vitejs/plugin-react": "^4.3.4",
|
|
66
72
|
"bun-match-svg": "^0.0.9",
|
|
67
73
|
"bun-types": "1.2.1",
|
|
74
|
+
"circuit-json-to-gltf": "0.0.129",
|
|
68
75
|
"debug": "^4.4.0",
|
|
69
76
|
"jscad-electronics": "^0.0.178",
|
|
70
77
|
"jscad-planner": "^0.0.13",
|