feat(view): the preview is just the site — remove the editor bridge #242

Merged
dominik.polakovics merged 1 commit from afk/241 into main 2026-10-12 23:06:05 +02:00

Closes #241

What changes

The View module is now a plain preview of the site. Accordions, buttons and links in it work natively, and nothing in it navigates the editor. Editing starts from the Page module.

App (web/src)

  • Bridge removed. bridge.ts and its tests are deleted. Also gone: the hello handshake and message listener, click-to-edit (handleBridgeSelect), preview→tree sync (onPreviewNavigate, lookupPageByPath, buildPermalinkMap, samePreviewPath), and the reveal fetch (childPathToOrdinal). The Page module's hover → highlight plumbing goes too (PageContent, PageScreen, ElementCard, LayoutGrid, gridContext, EntryEditor, UnusedContent).
  • Tree activation (decision 3). TreePane gains onActivate. The shell records each click as a {page, seq} activation (ctx.pageActivation / ctx.onPageActivate), separate from the selection. selection.selectPage keeps its same-page no-op.
    • The View module turns activations made while it is mounted into preview URLs.
    • PreviewPane loads on every activation. When the URL is unchanged it reloads through the iframe ref.
    • A pendingOwnLoad flag, cleared on each iframe load, means a click that also changes the selection loads the page once, whichever signal arrives first.
  • Preview button (decision 4). The view target is permalinkForPage(...) + elementAnchor(uid) when the route carries element, so the browser scrolls to the element natively. return navigation is unchanged.

Theme

  • ce-bridge.js is deleted.
  • The hugo.IsServer block (.ce-highlight style + script) is removed from baseof.html.
  • ce/attrs.html emits only the id="c-<uid>" anchor.
  • The bridge comments in slot.html and l10n/script.html are removed.

Deviation from the issue: ce/path.html is kept

The read-only deckle-hosted repo's contact-form and appointments bundles call partial "ce/path.html" for their fallback form key on content without a uid. Deleting it would break those bundles on every new site. It stays as a theme-only helper and its comment is rewritten: the editor never uses it, and no client-side ordinal code remains. The theme README, theme-contract.md item 4 and add-element still document it for that use.

Go tests and docs

  • internal/theme tests:
    • Removed: the hugo.IsServer test and the bridge-marker tests.
    • The production-hygiene test now forbids only HAHAHUGOSHORTCODE.
    • Added TestSlotAnchorsInProduction.
    • doc.go is rewritten.
  • Theme README: assets, inheritance, l10n note and "Editor integration" are updated.
  • Root README: the live-preview paragraph and the slot note are updated.
  • Skills: redo-theme (SKILL and theme-contract, whose items were renumbered with their references fixed), add-element/element-contract, migrate-site and verify-site (the Preview-button check replaces click-to-select, the leak grep is dropped, the anchor check stays).
  • AGENTS.md mentions none of this and is untouched.

Verification

  • web: tsc --noEmit is clean. npm test passes 115 files / 2828 tests. npm run build succeeds.
  • New tests:
    • PreviewPaneSync: exactly one load in either signal order, a reload after browsing away, no double load while a load is pending, the fragment target.
    • ViewModule (full app): a click on the already-selected page, an activation from before mount being ignored, the Preview button giving …/#c-<uid>.
    • TreePaneModes: onActivate fires.
  • go vet ./... and go test -count=1 ./... pass, with hugo v0.167.0 for the theme integration tests.
  • harness init followed by harness check: "ok: no problems found".
  • A production hugo build of testdata/library-site has 27 id="c-…" anchors and no data-ce-, ce-bridge or ce-highlight.
  • Not done: the manual in-editor click-through, since no browser was available in this run.

🤖 Generated with Claude Code

Closes #241 ## What changes The View module is now a plain preview of the site. Accordions, buttons and links in it work natively, and nothing in it navigates the editor. Editing starts from the Page module. ### App (`web/src`) - **Bridge removed.** `bridge.ts` and its tests are deleted. Also gone: the hello handshake and message listener, click-to-edit (`handleBridgeSelect`), preview→tree sync (`onPreviewNavigate`, `lookupPageByPath`, `buildPermalinkMap`, `samePreviewPath`), and the reveal fetch (`childPathToOrdinal`). The Page module's hover → highlight plumbing goes too (PageContent, PageScreen, ElementCard, LayoutGrid, gridContext, EntryEditor, UnusedContent). - **Tree activation (decision 3).** `TreePane` gains `onActivate`. The shell records each click as a `{page, seq}` activation (`ctx.pageActivation` / `ctx.onPageActivate`), separate from the selection. `selection.selectPage` keeps its same-page no-op. - The View module turns activations made while it is mounted into preview URLs. - `PreviewPane` loads on every activation. When the URL is unchanged it reloads through the iframe ref. - A `pendingOwnLoad` flag, cleared on each iframe `load`, means a click that also changes the selection loads the page once, whichever signal arrives first. - **Preview button (decision 4).** The view target is `permalinkForPage(...) + elementAnchor(uid)` when the route carries `element`, so the browser scrolls to the element natively. `return` navigation is unchanged. ### Theme - `ce-bridge.js` is deleted. - The `hugo.IsServer` block (`.ce-highlight` style + script) is removed from `baseof.html`. - `ce/attrs.html` emits only the `id="c-<uid>"` anchor. - The bridge comments in `slot.html` and `l10n/script.html` are removed. ### Deviation from the issue: `ce/path.html` is kept The read-only `deckle-hosted` repo's `contact-form` and `appointments` bundles call `partial "ce/path.html"` for their fallback form key on content without a uid. Deleting it would break those bundles on every new site. It stays as a theme-only helper and its comment is rewritten: the editor never uses it, and no client-side ordinal code remains. The theme README, `theme-contract.md` item 4 and `add-element` still document it for that use. ### Go tests and docs - `internal/theme` tests: - Removed: the `hugo.IsServer` test and the bridge-marker tests. - The production-hygiene test now forbids only `HAHAHUGOSHORTCODE`. - Added `TestSlotAnchorsInProduction`. - `doc.go` is rewritten. - Theme README: assets, inheritance, l10n note and "Editor integration" are updated. - Root README: the live-preview paragraph and the slot note are updated. - Skills: `redo-theme` (SKILL and theme-contract, whose items were renumbered with their references fixed), `add-element/element-contract`, `migrate-site` and `verify-site` (the Preview-button check replaces click-to-select, the leak grep is dropped, the anchor check stays). - `AGENTS.md` mentions none of this and is untouched. ## Verification - `web`: `tsc --noEmit` is clean. `npm test` passes 115 files / 2828 tests. `npm run build` succeeds. - New tests: - `PreviewPaneSync`: exactly one load in either signal order, a reload after browsing away, no double load while a load is pending, the fragment target. - `ViewModule` (full app): a click on the already-selected page, an activation from before mount being ignored, the Preview button giving `…/#c-<uid>`. - `TreePaneModes`: `onActivate` fires. - `go vet ./...` and `go test -count=1 ./...` pass, with hugo v0.167.0 for the theme integration tests. - `harness init` followed by `harness check`: "ok: no problems found". - A production `hugo` build of `testdata/library-site` has 27 `id="c-…"` anchors and no `data-ce-`, `ce-bridge` or `ce-highlight`. - Not done: the manual in-editor click-through, since no browser was available in this run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(view): the preview is just the site — remove the editor bridge
All checks were successful
ci / build-and-test (pull_request) Successful in 19m9s
ci / release (pull_request) Has been skipped
12d4ead2a6
The View module is now a plain preview: clicks, toggles, forms and links
in it behave as on the published site, and nothing in it navigates the
editor.

App: bridge.ts and its tests are gone, along with the handshake, the
message listener, click-to-edit, preview→tree sync, the reveal fetch and
the Page module's hover → highlight plumbing. A tree click is now also
recorded as a page activation (a seq'd signal next to the URL-backed
selection, whose same-page no-op stays). The View module reloads the
clicked page on every activation, even when it is already selected,
without double-loading when the click also changes the selection. The
element form's Preview button lands on `<address>#c-<uid>` via
elementAnchor, and the browser scrolls natively.

Theme: ce-bridge.js, the hugo.IsServer block in baseof.html and the
data-ce-* markers in ce/attrs.html are removed. The id="c-<uid>" anchor
stays in every build. ce/path.html is kept as a plain theme helper,
because the deckle-hosted contact-form and appointments bundles derive
their fallback form key from it.

Go tests, the theme README, the root README and the redo-theme,
add-element, migrate-site and verify-site skills are updated to match.

Closes #241

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

PASS. Signal: CI aggregate success (ci / build-and-test: web npm build + npm test, go vet, go test ./... with hugo v0.167.0; release skipped on PRs). Conventions: Conventional Commits title, Closes #241, branch level with main. Scope matches #241: bridge removed on both sides; tree activation reloads via onActivate/pageActivation with a single-load guard; the Preview button opens address + elementAnchor(uid), reusing the existing helper (no second owner). Deviation: ce/path.html is kept. It is documented and justified: deckle-hosted's contact-form and appointments bundles call it, and add-element/SKILL.md:145 documents it as the form-key fallback. Docs and skills are updated per CLAUDE.md; the renumbered theme-contract item references were verified.

[autoland] verdict: pass PASS. Signal: CI aggregate success (ci / build-and-test: web npm build + npm test, go vet, go test ./... with hugo v0.167.0; release skipped on PRs). Conventions: Conventional Commits title, Closes #241, branch level with main. Scope matches #241: bridge removed on both sides; tree activation reloads via onActivate/pageActivation with a single-load guard; the Preview button opens address + elementAnchor(uid), reusing the existing helper (no second owner). Deviation: ce/path.html is kept. It is documented and justified: deckle-hosted's contact-form and appointments bundles call it, and add-element/SKILL.md:145 documents it as the form-key fallback. Docs and skills are updated per CLAUDE.md; the renumbered theme-contract item references were verified.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/deckle!242
No description provided.