Repository navigation
refactor: split the viewer out of the Claude artifact host - #35
Merged
Merged
Conversation
The artifact host's UI (space and view switcher, parameter controls, map view, side panel) moves to src/viewer as a host-neutral Viewer, so other hosts, such as a self-contained HTML page, can reuse it. The snapshot type moves to core, and the artifact's loader returns it instead of restating it. Card labels for the artifact's comment mode become a cardLabel option the artifact host passes. Module boundary tests keep the viewer free of host code and keep hosts unimported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019XphpeFwEYm8K11SoT9ewz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Rog · project thread
First step toward a self-contained HTML render of a space's map views. The artifact host's UI moves into a host-neutral viewer, so a second host (an inline HTML page) can reuse it without picking up Claude artifact concepts.
Changes
src/viewer/Viewer.tsxandviewer.css: the space and view switcher, parameter controls, map view and side panel. These come fromsrc/artifact/main.tsxandpage.css, with theart-classes renamed toviewer-.cardLabeloption: the viewer applies an accessible name to each card when a host passes one. The artifact host passes the comment-mode label ([<index>] <title> · <view>), so its behaviour is unchanged.src/core/snapshot.ts:SpaceSnapshotnow lives here as a type, so browser hosts can use it. The artifact loader returns it, and the duplicateLoadedSpacetype is gone (nameis nowspace). There is no public API change.structured-context/browser, and no module may import the artifact host.docs/architecture.mdandAGENTS.mdare updated to match.Verification
bun test,bun run typecheckandbun run lintpass.launch-playbookfixture and loaded it in Playwright. Cards carried[1] 04 Sustain · strategy-tree-style labels, 44 edges were drawn, selecting a node opened the panel with a warning, and the console showed no errors.bun run buildbuilds the library, but this sandbox couldn't run the finalbuild-artifact-pagestep because its network blocks jsDelivr. That step only changed the CSS path it reads.Generated by Claude Code