Repository navigation
feat(visual): let an embedded example show its controls - #227
Open
alexgrozav wants to merge 3 commits into
Open
alexgrozav wants to merge 3 commits into
alexgrozav wants to merge 3 commits into
Conversation
An embed takes three optional URL parameters (ADR-0116). controls=true draws the example's controls below it in a shadow root, with the shell's props rule from one shared function. theme sets the colour mode before the first render and takes a theme message from the parent window only. resize=true lays the page out at its natural height and posts that height to the parent. Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
Contributor
Visual report: ✓ passed3 examples on 7 targets. Pixels:
The run uploaded the full report as the |
alexgrozav
marked this pull request as ready for review
November 20, 2026 14:37
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://embed-controls-uxf-906.unframework.dev, https://embed-controls-uxf-906-unframework.blue-water-0397.workers.dev (commit 5a86517)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
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 changed
An example opened by its own URL (
embed.html, ADR-0112) now takes three optional parameters, recorded in ADR-0116, which amends ADR-0112 and ADR-0088:controls=trueshows the example's controls below it, in a shadow root, with the same groups, fields and props rule as the shell's example panel. The rule and the fields now live incontrolKit(src/preview/panel.ts), which the frame imports and the shell writes into its page, so the two can't drift. The shell's rendered CSS is byte-for-byte unchanged.theme=light|darksetsdata-themeandcolor-schemeon the frame's<html>before the first render. The frame then takes{ type: "unframework:embed", kind: "theme", theme }from its parent window only, with exactly those keys.resize=truelays the page out at its natural height and posts{ type: "unframework:embed", kind: "resize", height }to the parent when the height changes.embed.htmland the standalone frame both check the values with one function (embedOptions) and show a message for any other value. Without the parameters, an embed is unchanged, and the shell's frames are unchanged.The docs page's "Embed an example" section, the package README and a changeset (
minor) describe the change. No framework's output changes.How it was tested
embed-options.test.ts(option parsing, the props rule) andframe.browser.test.ts(startFramewith a recording mount).preview-build.test.ts(static site) andpreview.test.ts(dev): controls on seven targets compared with the shell's frames, Astro's static first-props limit in an embed, the panel and its first field in a 300 px and a 150 px iframe, the theme message from a second origin, and the height report alone and with controls, settling with nothing scrolling.test/fixtures/embed, covers Styleframe's[data-theme="dark"]selector, a project's global styles against the panel, and a control that changes the height.Checklist
feat(web): sell the next framework on the homepage.pnpm format:check,pnpm lint,pnpm check-typesandpnpm testpass. The first three pass. Of the tests,pnpm --filter @unframework.dev/visual test(284 tests) andpnpm test:quickpass, and the fullpnpm testdidn't run locally, since no compiler output changes..changeset/embed-controls-uxf-906.md, written by hand in the format of the earlier ones.pnpm --filter web build).