slides: add the embed element to the bento/embed shape - #424
Open
johanhal wants to merge 1 commit into
Open
Conversation
An `embed` element { type:'embed', app, view, doc?, url?, live? } per the
2026-08-19 decision: the static `view` (svg markup or an asset) always
paints through the same sanitiser the svg element uses; `doc` is the
source; a sandboxed live iframe (no allow-same-origin, no top navigation,
no referrer) is opt-in and exists only when `app` is `web`, `url` is
http(s), remoteSrcBlocked(url) is false and navigator.onLine is true, and
drops back to the view on error. validate() reports a missing view as an
error and a remote view or live-without-url as warnings; untrusted.ts
gates paste and CRDT shape; the editor gets an Embed panel with a
"Capture view" picker. Strings in every catalog. Rig: scripts/test-embed.ts.
Motivation: today an unknown element type loads, survives a round trip
and renders as an empty positioned box with no finding, so a deck from a
build that has this element degrades silently in this one.
johanhal
added a commit
to betamobility/slides
that referenced
this pull request
Sep 8, 2026
…without R2 (#2) README gains a Beta "Releasing" section (dated versions and why, gh set-default, Pages direct upload, the .html 308) and links the two upstream PRs (nyblnet#423, nyblnet#424). AGENTS.md's upstream-merge conflict list adds slides/package.json and CHANGELOG.md. wrangler.toml drops the R2 binding per plan U2: binding it means a paid subscription on the account, which is the maintainer's decision, and the inline fallback is upstream-supported. Claude-Session: https://claude.ai/code/session_01SQN76RTkurkAAxMMvnwfbt Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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.
slides: add the
embedelement to the bento/embed shapedocs/DECISIONS.md(2026-08-19) settledbento/embedas one shape for every app: a staticviewalways present, thedocsource always present, a sandboxedliveiframe opt-in.type/has the consumer side;slides/does not. This adds it to slides, written to that shape so lifting it into the kernel later is a move, not a redesign.model.ts:EmbedElement { type:'embed', app, view, doc?, url?, live?, w, h }in theSlideElementunion;modelkeys.generated.tsregenerated (build-modelkeys.mjslearns the interface name).render.ts: onecase 'embed'.view(inline<svg>or anasset:key) paints throughsanitizeSvg, the svg element's path. The live frame exists only on a live surface (liveMedia, which present mode already passes), so the editor canvas paints the view and a repaint never re-navigates the author's URL. Whenliveis true,appisweb,urlis http(s),remoteSrcBlocked(url)is false andnavigator.onLineis true, asandbox="allow-scripts allow-forms"iframe withreferrerPolicy="no-referrer"is layered over the view; its error handler removes it. Both kinds of offline (the privacy switch and network absence) therefore show the view, andtest-offline.tsstays green because the only network decision goes throughkernel/src/net.ts.validate.ts:embed-missing-view(error),embed-remote-viewandembed-live-no-url(warnings).untrusted.ts,clipboard.ts: paste and CRDT shape gates; asset views travel and remap on key collision.panels.ts: an Embed section withurl,live, and a "Capture view" picker that interns an SVG, or a raster wrapped as<svg><image href="data:…">, as the view. A sandboxed cross-origin frame cannot be screenshotted, which is the point of the sandbox, so the view is supplied, not captured.Why now: today an unknown element type loads, survives a round trip and renders as an empty, correctly positioned box, with no finding from
validate()and a silent drop on paste (render.tsrenderElementhas no default;validate.tslooks the type up inMODEL_KEYS.elementand finds nothing). A deck authored in a build that has this element degrades silently in this one. With the element known, it paints its view everywhere.Verified:
tsc -b,build-modelkeys.mjs --check,build-i18n.mjs --checkand coverage,test-offline.ts,test-sanitize.ts(two added cases),test-validate.ts,test-clipboard.ts,test-sync.ts,test-ci-registered.ts,npm run build:single,shell-gate.mjs, andscripts/test-embed.ts(59 checks: node half plus headless Chrome with a request log proving the frame is requested only when allowed).