feat(editor): add God Mode code panels and fix large-site crashes - #486
Open
flyingwebie wants to merge 1 commit into
Open
feat(editor): add God Mode code panels and fix large-site crashes#486flyingwebie wants to merge 1 commit into
flyingwebie wants to merge 1 commit into
Conversation
God Mode is a per-user editor mode for structure editors: it replaces the
properties sidebar with a Code Dock of three panels.
- HTML panel — an editable projection of the selection or the whole page.
Edits apply live through a uid-preserving import, so node identity,
metadata, and collab state survive an edit. Destructive or stale applies
ask for confirmation. The cursor syncs selection back, with breadcrumbs.
- CSS panel — an editor over the style-rule registry.
- JS panel — edits the page script, an ordinary page-scoped code asset.
Each panel formats with Prettier, offers context-aware completions (classes,
tokens, data fields), and expands into a full-size editor. Enable it under
Settings -> Preferences; toggle with Cmd+Shift+G.
Alongside it, three fixes:
- Fixed the site editor crashing the tab ("Aw, Snap") on large sites. Every
live HTML apply rewrote the whole projected subtree into the collaboration
document and the undo history retained each rewrite; separately, connecting
to the collaboration server re-assembled the whole site once per page doc
instead of once, so a 20-page site did seconds of blocked work and hundreds
of megabytes of allocation at load. An apply now writes only what changed,
and the site is assembled once on connect.
- Made the toolbar's "N code errors" status a button that opens the first
error's file in the Code Editor. It was a passive label, and the Problems
list only appeared once a script file was already open.
- Fixed publish validation failing with `Could not resolve "<package>"` for a
declared dependency. The runtime dependency cache lives in the OS temp dir
and temp cleaners delete package files by age while leaving the
install-complete marker behind, so the server kept trusting an emptied
cache. A cache now counts as installed only while every locked package is
on disk, and a reaped one is reinstalled on demand. `RUNTIME_CACHE_DIR`
moves the cache to a persistent path.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
What
Adds God Mode, a per-user editor mode for structure editors that replaces the properties sidebar with a Code Dock of three panels, and fixes three bugs found while building it.
The Code Dock
importProjectionHtml), so node identity, metadata, and collab state survive an edit; nodes without auidare new, nodes whoseuiddisappears are deleted. Destructive or stale applies ask for confirmation. The cursor syncs selection back, with breadcrumbs.Each panel formats with Prettier, offers context-aware completions (classes, tokens, data fields), and expands into a full-size editor. Enable under Settings → Preferences; toggle with
⌘⇧G.The page tree and style-rule registry stay the single source of truth — the panels are projections, never separate storage.
Fixes
file:line:column. Before, the count was a passive label and the Problems list only appeared once a script file was already open.Could not resolve "<package>"for a dependency the site declares. The runtime dependency cache lives in the OS temp dir; temp cleaners delete package files by age while leaving the install-complete marker behind, so the server kept trusting an emptied cache. A cache now counts as installed only while every locked package is on disk, and a reaped one is reinstalled on demand. New optionalRUNTIME_CACHE_DIRmoves the cache to a persistent path (documented in.env.example; must not sit underUPLOADS_DIR, which is served publicly).Why
Structure editors want direct code control over a page without leaving the visual editor or giving up the page tree as the source of truth. Building the HTML projection surfaced the collab/undo memory blowup, which affected large sites regardless of God Mode.
Impact
RUNTIME_CACHE_DIR. No schema changes, no migrations.@core/cssProjectionand the projection import/render paths (RenderConfig.projection,importProjectionHtml). Both are barrel-exported and covered by the deep-import gate.Docs
docs/features/god-mode.mddocs/editor.md,docs/features/publisher.md,docs/features/html-import.md,docs/features/site-shell.md,docs/features/editor-preferences.md,docs/server.md,docs/README.mdCHANGELOG.mdentry filed under## Unreleased— happy to fold it into whichever version you cut.Verification
New tests cover the code-editor panels, uid-preserving projection import, CSS projection, stylesheet edit planning, the connect-scope change, and the dependency-cache reap path. The
codemirror-lazy-onlyandbundle-size-budgetsarchitecture gates were updated for the new lazy chunks.Notes
Branched from current
main. Two dependencies added:prettier(panel formatting) andbabel-plugin-react-compiler(previously relied on transitively — now declared explicitly).