refactor(desktop): push the transcript diagram theme through a Cmd - #1406
Draft
tonyfettes wants to merge 1 commit into
Draft
refactor(desktop): push the transcript diagram theme through a Cmd#1406tonyfettes wants to merge 1 commit into
tonyfettes wants to merge 1 commit into
Conversation
#1379 rendered the effective theme as `data-transcript-theme` on the transcript root and watched that attribute with the content MutationObserver so Mermaid could re-render on a theme switch: the DOM used as a message bus between the root and the component's subscription. Rabbita never re-runs a component's `subscriptions` on an input-only change, so the theme cannot reach the diagram mount through `Input` or the subscription payload. Deliver it the way the file editor already receives it instead: `Theme::apply` batches `@transcript_component.apply_theme`, which updates a package-level registry of live transcript mounts. A mount registers in its constructor, reads the current value there, and unregisters on dispose, so the command and the first mount may run in either order. `Input` loses `dark_mode`, the view no longer renders the attribute, the observer no longer filters on it, and the e2e asserts the root `data-theme` projection the theme command writes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018f26rE1L4kzBf5ddeqn99i
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.
Why
#1379 rendered the effective theme as
data-transcript-themeon the transcript root and watched that attribute with the contentMutationObserverso Mermaid diagrams could re-render on a theme switch. That is the DOM used as a message bus between the root and the component's subscription, the pattern the last few transcript PRs have been removing.Rabbita never re-runs a component's
subscriptionson an input-only change ("Changing the input alone does not send a message, runupdate, or refresh subscriptions"), so the theme cannot reach the diagram mount throughInputor the subscription payload either.What
Theme::applybatches@transcript_component.apply_theme(dark)next to the existing@fileeditor.apply_theme, the same Cmd-push shape the file editor already uses for an imperative widget outside Model.transcript_theme: the current value plus a registry of live transcript mounts. A mount registers in its constructor and reads the current value there, unregisters on dispose, so the command and the first mount may run in either order. Only Mermaid is re-rendered; Diago SVGs follow the palette through CSS variables.Input.dark_modeand its three call sites, the rendereddata-transcript-themeattribute, theattribute_filterentry, theget_attributeread-back, and the per-diagrammut dark_mode.data-themeprojection written by the theme command instead of a component-rendered attribute.Verification
moon check --target jsmoon test --target jsforfrontend/transcript/component(21) andfrontend(467)transcript_diagrams.spec.jsin Chromium: 6 passed, including the dark-mode re-render casepkg.generated.mbtisynced from the js_buildartifact; the diff is exactly the removeddark_mode?and the addedapply_theme🤖 Generated with Claude Code
https://claude.ai/code/session_018f26rE1L4kzBf5ddeqn99i