Skip to content

feat(ui): Force 3D — experimental Threlte view mode (closes #103)#104

Merged
fedorovvvv merged 2 commits into
developfrom
feat/force-3d-view
May 7, 2026
Merged

feat(ui): Force 3D — experimental Threlte view mode (closes #103)#104
fedorovvvv merged 2 commits into
developfrom
feat/force-3d-view

Conversation

@fedorovvvv
Copy link
Copy Markdown
Collaborator

Summary

Adds a new Force 3D view mode (last in the dropdown, badged
experimental) that renders the artifact dependency graph in a Threlte v8
canvas, simulating positions with d3-force-3d. Chunk is lazy-loaded so
non-3D users pay zero bundle bytes.

Closes #103.

Why

The 2D Force view collapses dense workspaces (~80+ artifacts) into hairballs
where cluster topology becomes illegible. The 3D layout separates orthogonal
sub-graphs spatially. Reference: vasturiano/3d-force-graph; visual style
adapted to Forgeplan tokens (kind colors, status emissive glow, R_eff →
sphere radius).

What changed

  • shared/config/ui-prefs.tsGraphViewMeta.badge? + force3d entry last.
  • shared/ui/select — pill badge next to label.
  • widgets/dependency-graph-3d/ — new widget: Threlte canvas, scene,
    NodeMesh, sim builder, theme adapter, d3-force-3d ambient types.
  • widgets/dependency-graph/ui/DependencyGraph.svelte — lazy await import('@/widgets/dependency-graph-3d') only when view === 'force3d'.
  • widgets/dependency-graph/ui/ForceView.svelte — TODO marker for the
    future in-Force-mode 2D ↔ 3D switch (PRD-022 growth vision).
  • template/package.json@threlte/core, @threlte/extras, three,
    d3-force-3d to deps; @types/three to devDeps.

Forgeplan

  • PRD-022 active — Standard depth, problem / FRs / NFRs / acceptance.
  • RFC-019 active — Option A (Threlte v8 + d3-force-3d) chosen vs
    vanilla Three, the reference 3d-force-graph wrapper, and r3f.
  • EVID-027 active — smoke test (verdict: supports, CL: 3, type: test),
    R_eff = 1.00, overall grade A on both PRD and RFC.

Test plan

  • npm run check — 0 errors / 0 warnings (2105 files).
  • npm run build — production build passes; dependency-graph-3d chunk
    lives in its own client chunk; verified the homepage entry only
    references it via dynamic import('../chunks/...').
  • Browser smoke (Chromium MCP) — Force 3D last in dropdown with
    EXPERIMENTAL badge, 3D scene renders 123 nodes / 104 edges, orbit
    drag rotates camera, theme reactivity (light + dark) confirmed.
  • Performance trace (NFR-001 first-frame, NFR-002 fps p50) — deferred
    to a follow-up EvidencePack alongside the in-mode 2D ↔ 3D switch.

🤖 Generated with Claude Code

fedorovvvv and others added 2 commits May 8, 2026 01:19
Adds a new view mode `force3d` last in the GRAPH_VIEWS dropdown with an
EXPERIMENTAL badge. Renders the same artifact dependency graph as 2D Force
in a Three.js scene via Threlte v8, simulating positions with d3-force-3d.
The chunk is lazy-loaded behind `view === 'force3d'` so non-3D users pay
zero bytes.

What ships:
- shared/config/ui-prefs.ts: GraphViewMeta gains optional `badge`; new
  `force3d` entry registered last.
- shared/ui/select: Select renders a pill-style badge next to the label
  (used by Force 3D, available to any future entry).
- widgets/dependency-graph-3d: new widget — Threlte canvas + d3-force-3d
  simulation, OrbitControls, kind-colored spheres (R_eff sized), edge
  segments, theme reactivity (light + dark via data-theme observer).
  Initial layout uses a phyllotaxis sphere (radius 50) so the simulation
  starts spread out, then forces shape clusters.
- widgets/dependency-graph/ui/DependencyGraph.svelte: lazy-import branch
  for Force 3D — no Three.js / Threlte in the main bundle.
- widgets/dependency-graph/ui/ForceView.svelte: TODO marker for the
  growth-vision in-Force-mode 2D ↔ 3D switch.

Forgeplan trail (full Standard pipeline, R_eff = 1.00 / grade A):
- PRD-022 — problem, FRs / NFRs, acceptance, risk register
- RFC-019 — Option A (Threlte + d3-force-3d) chosen vs three alternatives
- EVID-027 — smoke test with structured fields (verdict / CL / type)

Refs: PRD-022 RFC-019 EVID-027

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The experimental single-file ESM bundle inlines all runtime deps. Force 3D
adds Three.js + Threlte (~2.4 MB unzipped). Non-3D users still pay 0 bytes
in the legacy `dist/` shape (lazy chunk), but the experimental shape can't
code-split — so the floor moves to 6M. Documented in RFC-019.

Refs: PRD-022 RFC-019

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fedorovvvv fedorovvvv merged commit c60fd77 into develop May 7, 2026
3 checks passed
@fedorovvvv fedorovvvv deleted the feat/force-3d-view branch May 7, 2026 21:26
fedorovvvv added a commit that referenced this pull request May 8, 2026
…105)

Reverts #104 in full as requested.

`git revert -m 1 c60fd77` undoes:

- Removes `template/src/widgets/dependency-graph-3d/` (Force 3D widget).
- Drops `force3d` from `GRAPH_VIEWS` + `GraphView` union.
- Restores `Select.svelte` (no badge support).
- Drops `three`, `@threlte/core`, `@threlte/extras`, `d3-force-3d`,
`@types/three` from `template/package.json`.
- Restores `template/package-lock.json`.
- Removes `// TODO(force-mode-2d3d-switch)` from `ForceView.svelte`.
- Restores `scripts/build.mjs` `DIST_EXPERIMENTAL_MAX_BYTES` to `3 *
1024 * 1024` (the 3M → 6M bump bundled in PR #104 is reverted in the
same commit).
- Removes `.forgeplan/prds/PRD-022`, `.forgeplan/rfcs/RFC-019`,
`.forgeplan/evidence/EVID-027`.

Issue #103 will be reopened after merge — the feature is no longer in
the codebase, so its tracking issue should reflect that.

## Test plan

- [x] `npm run check` — 0 errors / 0 warnings (1047 files, matches
pre-#104 baseline).
- [ ] CI matrix (ubuntu / macos / windows) green.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant