Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
LR10: kerning across spans, hidden inline words, and a render manifest read as Chrome draws. blitz-dom gave every composition span a border edge (with border-style none a border's computed width is still medium, and inline_edges read the width alone), so each plain span got a spacer box at both ends and parley split the shaping there: a line set a letter a span lost its kerning (AVAWATAVAWAT 632 px, Chrome 578; snapcn's word-flip 5.6 px wide). sdk/ui/parity's p13-text/kerning-spans holds it. blitz-paint doesn't draw a visibility: hidden inline element's glyph runs, though they keep their place (#13: word-flip's strut drew as a fake word). A still drawn again after an all-black first draw replaces its manifest entry instead of adding one (every later frame was listed a place late), and check.sh finds frames by number. A manifest text's ink spans its glyph runs and inline-blocks, not the padding at a line's ends. snapcn 12 -> 17 of 33 (word-flip, text-reveal, text-swell, karaoke-captions, word-captions); P26 unchanged (185 of 215, the same frames at the same SSIM). The web-components guide lists innerHTML and outerHTML as missing
shinyobjectz0f9da0036851
diff --git a/Cargo.lock b/Cargo.lockindex a742c0c0..5060c433 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -14525,6 +14525,7 @@ dependencies = ["blitz-dom","blitz-html","image",+ "parley","raea-core-wire","raea-gpu-device","raea-io-media",diff --git a/bench/layout-reads/check.sh b/bench/layout-reads/check.shindex 513db67d..20a586fb 100755--- a/bench/layout-reads/check.sh+++ b/bench/layout-reads/check.sh@@ -111,8 +111,9 @@ EOFr=$D/raea/frame-0000$i.pngif [ $rr != 0 ] || [ ! -f "$r" ]; then line="$line @$f no frame"; ok=0; continue; fi[ -s "$D/chrome-$f.json" ] || { line="$line @$f no Chrome runs"; ok=0; continue; }- cmp=$(jq -c -n --slurpfile m "$D/manifest.json" --slurpfile c "$D/chrome-$f.json" --argjson i $i \- "\$m[0].frames[\$i].text as \$r | \$c[0] as \$c | $(cat "$BENCH/compare.jq")")+ # the manifest's entry for frame f, by its number (a frame drawn twice has one entry, the last)+ cmp=$(jq -c -n --slurpfile m "$D/manifest.json" --slurpfile c "$D/chrome-$f.json" --argjson f "$f" \+ "([\$m[0].frames[] | select(.frame == \$f)] | last | .text // []) as \$r | \$c[0] as \$c | $(cat "$BENCH/compare.jq")")echo "$cmp" > "$D/compare-$f.json"dssim=$(magick compare -metric SSIM <(magick "$r" -background black -alpha remove png:-) <(magick "$D/chrome-$f.png" -background black -alpha remove png:-) null: 2>&1 | grep -oE '\(([0-9.e-]+)\)' | tr -d '()')read -r paired alone box ink < <(echo "$cmp" | jq -r '[.paired, (.raea_only + .chrome_only | length), (.box * 10 | round / 10), (.ink * 10 | round / 10)] | @tsv')diff --git a/docs/layout-reads.feature b/docs/layout-reads.featureindex 461cdb77..fc24788a 100644--- a/docs/layout-reads.feature+++ b/docs/layout-reads.feature@@ -322,6 +322,28 @@ Feature: Layout reads: a composition measures its text and layout as Chrome doesAnd a composition that measures every frame (karaoke-captions, 300 frames) has its cost per read and per framemeasured and written hereAnd sdk/raea/conformance covers the JS side, and Rust tests cover the call, the wait and the hang guard+ And 11-12, in progress (snapcn: 3 of 33 before LR work, 7 after LR1-LR9, 12 after the usvg and font fixes, 17 now):+ - Kerning across spans. blitz-dom gave every composition span a border edge: with `border-style: none` (the+ initial style) a border's computed width is still `medium`, and inline_edges read the width alone, so each+ plain span got a zero-width spacer box at both ends and parley split its shaping there. "AVAWATAVAWAT" in a+ span a letter was 632 px against 578 written once; Chrome draws both at 578. An app page never showed it+ (Tailwind's preflight sets border-width: 0). sdk/ui/parity's p13-text/kerning-spans holds it. word-flip+ (its typed letters a span each, 5.6 px wide) passes.+ - A visibility: hidden inline element's text isn't drawn (blitz-paint drew every glyph run; only boxes were+ hidden), though it keeps its place: #13's word-flip strut showed as a fake "features".+ - A render manifest's frames: a still that drew all black and was drawn again listed the frame twice (the fed+ render popped the first draw's entry, the still loop didn't), so every later frame was read one place late.+ check.sh now finds each frame by its number. text-reveal and text-swell pass.+ - A manifest text's ink spans its glyph runs and inline-blocks, not the line's whole advance: an inline+ element's padding at a line's end (a caption's word pill) isn't ink. karaoke-captions and word-captions+ pass.+ - Still off (16), not yet traced: announce-title (frame 0's runs), bloom-lockup, capture-reveal (3 runs only+ raea has), font-shuffle, portal-intro, prompt-send, punch-lines, search-typing, status-cycle, text-build,+ text-rewrite, text-select, word-gather, card-rail, hero-launch (a video's frame, not text) and wordmark-cut.+ - P26 with these: 185 of 215 frames at the bar, the same frames at the same SSIM (to six places) as a binary+ before them. The 12 compositions under it are all 3D (classbg, datamaps, paint, planes, texmaps, the four+ volumetric benches, box3d, arena3d) plus css/edit.tsx, which throws before its first commit; the volumetric+ three draw no page text, so the shared tree's 3D work moved them, not this.@needs:LR10Scenario: LR11. Docs, skills, and the issues@@ -331,7 +353,8 @@ Feature: Layout reads: a composition measures its text and layout as Chrome doesAnd 11-12, in progress:- docs/manual/guides/web-components.md: measuring then letting the frame be taken (delayRender, loadFont),what a ref, document and window answer, and what's missing (MutationObserver and IntersectionObserver never- call back, an img's onError never fires, a wrapped Range is one rect, a pass with no page reads 0).+ call back, an img's onError never fires, a wrapped Range is one rect, a pass with no page reads 0, no+ innerHTML or outerHTML).- The skills: the motion router's rule 2 names the web APIs and the modules that install them (raea-skills#50). It merges when 0.1.3 is published, because raea-skills main is what the Claude plugin serves topeople on 0.1.1.diff --git a/docs/manual/guides/web-components.md b/docs/manual/guides/web-components.mdindex 83641272..f393d481 100644--- a/docs/manual/guides/web-components.md+++ b/docs/manual/guides/web-components.md@@ -76,6 +76,7 @@ else throws a SyntaxError, as Chrome's does.call back.- An `<img>`'s `onError` never fires: an image that doesn't load fails the render, naming its src.- `new Image()` has no `naturalWidth` or `naturalHeight` (they stay 0).+- An element has no `innerHTML` or `outerHTML`: read `textContent`, or walk `children` and `childNodes`.- A Range across wrapped lines is one rect, not one per line, and an inline element's `getClientRects()` is one recttoo.- In a pass that draws no page (the sound pass, a 3D pre-pass) every read answers 0, and holds there are released.diff --git a/engine/page/Cargo.toml b/engine/page/Cargo.tomlindex 109e6094..178cf51f 100644--- a/engine/page/Cargo.toml+++ b/engine/page/Cargo.toml@@ -19,6 +19,8 @@ raea-runtime-input = { path = "../../runtime/input" }bevy = { version = "=0.20.0", default-features = false, features = ["std", "default_app", "bevy_render", "bevy_asset", "bevy_image", "bevy_log", "bevy_window", "ui_bevy_render", "bevy_picking", "ui_picking", "bevy_input_focus"] }# the document: stylo's styles, Taffy's and Blitz's layout (floats on, as Chrome lays them out)blitz-dom = { version = "=0.3.0-beta.4", default-features = false, features = ["svg", "woff", "system-fonts", "floats", "text-transform-icu", "complex-scripts"] }+# the laid-out lines' glyph runs, where a render manifest's text has its ink (motion/manifest.rs)+parley = { version = "=0.12.0", default-features = false, features = ["std"] }vello = { version = "=0.11.0", default-features = false, features = ["wgpu"] }wgpu = "=30.0.1"# a page's script host: JS engines, native calls, media, canvas, accessibility recordsdiff --git a/engine/page/src/motion/manifest.rs b/engine/page/src/motion/manifest.rsindex 8f83dd01..f3e46495 100644--- a/engine/page/src/motion/manifest.rs+++ b/engine/page/src/motion/manifest.rs@@ -120,10 +120,27 @@ impl BlitzPage {let (fl, scale) = (node.final_layout(), doc.viewport().scale() as f64);let fx = b.width / (fl.size.width as f64).max(1e-6);let (mut x0, mut x1) = (f64::MAX, f64::MIN);+ // the glyph runs' and inline-blocks' span on each line, inside the line's advance (its trailing spaces+ // hang past it): an inline element's padding at the line's ends (its edge spacers) is its box's, not+ // ink (a caption's padded word pill)for line in l.layout.lines() {let m = line.metrics();- x0 = x0.min(m.offset as f64);- x1 = x1.max((m.offset + m.advance) as f64);+ let (end, mut seen) = ((m.offset + m.advance) as f64, false);+ for item in line.items() {+ let (a, b) = match item {+ parley::PositionedLayoutItem::GlyphRun(g) => (g.offset(), g.offset() + g.advance()),+ parley::PositionedLayoutItem::InlineBox(b)+ if b.kind == parley::InlineBoxKind::InFlow && b.id & parley::InlineBox::EDGE == 0 => (b.x, b.x + b.width),+ _ => continue,+ };+ seen = true;+ x0 = x0.min(a as f64);+ x1 = x1.max((b as f64).min(end));+ }+ if !seen {+ x0 = x0.min(m.offset as f64);+ x1 = x1.max(end);+ }}if x1 > x0 {let left = b.x + ((fl.border.left + fl.padding.left) as f64 + x0 / scale) * fx;diff --git a/runtime/export/src/bevy_frame.rs b/runtime/export/src/bevy_frame.rsindex c753209c..6889db08 100644--- a/runtime/export/src/bevy_frame.rs+++ b/runtime/export/src/bevy_frame.rs@@ -11,6 +11,11 @@ pub(crate) fn snapshot_bevy(world: &mut World, page: &mut raea_runtime_page::Bevlet f = cx.now;let (px, mut pics) = bevy_page_frame(world, page, cx)?;let (px, twice) = raea_gpu_device::check::black_checked(f, px, raea_sys_page::redraw_full, || {+ // the frame drawn again is the same frame: its manifest entry replaces the first draw's, as the fed render's+ // redraw does (a held first frame that's all black was listed twice, each later frame one place late)+ if let Some(m) = cx.manifest.as_mut() {+ m.pop();+ }let (px, again) = bevy_page_frame(world, page, cx)?;pics = again;Ok(px)diff --git a/sdk/ui/parity/cases/p13-text/kerning-spans.tsx b/sdk/ui/parity/cases/p13-text/kerning-spans.tsxnew file mode 100644index 00000000..e02ea17c--- /dev/null+++ b/sdk/ui/parity/cases/p13-text/kerning-spans.tsx@@ -0,0 +1,17 @@+// Kerning across inline elements: a line whose letters are each their own span is as wide as the same line written+// once, as Chrome shapes a run of one font across element boundaries (snapcn's word-flip types its words a letter a+// span; raea's spans broke the shaping at each one, so "AV" lost its kern and the line grew: docs/layout-reads.feature+// LR10).+// proves: react-dom.element.span+// tier: quick+export const steps = [];+const TEXT = "AVAWATAVAWAT Portfolio";+export default function Case() {+ return (+ <div data-testid="root" className="h-full w-full bg-white p-4 text-slate-900" style={{ fontFamily: "Inter", fontSize: 48 }}>+ <div><span data-testid="plain" style={{ whiteSpace: "pre" }}>{TEXT}</span></div>+ <div><span data-testid="spans" style={{ whiteSpace: "pre" }}>{[...TEXT].map((c, i) => <span key={i}>{c}</span>)}</span></div>+ <div><span data-testid="coloured" style={{ whiteSpace: "pre" }}>{[...TEXT].map((c, i) => <span key={i} style={{ color: i % 2 ? "#be123c" : "#0f172a", opacity: 0.9 }}>{c}</span>)}</span></div>+ </div>+ );+}diff --git a/vendor/blitz-dom/src/layout/construct.rs b/vendor/blitz-dom/src/layout/construct.rsindex a83433c5..f0f52692 100644--- a/vendor/blitz-dom/src/layout/construct.rs+++ b/vendor/blitz-dom/src/layout/construct.rs@@ -1432,10 +1432,16 @@ fn inline_edges(node: &Node) -> [bool; 4] {style::values::generics::length::GenericMargin::LengthPercentage(l) => nz(l),_ => false,};+ // a border is there when it has a width and a style: with `border-style: none` (the initial style) its width is+ // still `medium` in the computed values, though it draws and takes nothing, as table.rs's side_width reads it.+ // Counted from the width alone, every plain span had a border edge, and the spacer at each edge split the shaping+ // there, so kerning across spans was lost (snapcn's word-flip, a letter a span, drew 5.6 px wider than Chrome;+ // docs/layout-reads.feature LR10)+ let border = |w: app_units::Au, s: style::values::computed::BorderStyle| !s.none_or_hidden() && w.to_f32_px() != 0.0;[auto_or(&m.margin_left),- nz(&p.padding_left.0) || b.border_left_width.0.to_f32_px() != 0.0,+ nz(&p.padding_left.0) || border(b.border_left_width.0, b.border_left_style),auto_or(&m.margin_right),- nz(&p.padding_right.0) || b.border_right_width.0.to_f32_px() != 0.0,+ nz(&p.padding_right.0) || border(b.border_right_width.0, b.border_right_style),]}diff --git a/vendor/blitz-paint/src/text.rs b/vendor/blitz-paint/src/text.rsindex 75d46f2c..e5840222 100644--- a/vendor/blitz-paint/src/text.rs+++ b/vendor/blitz-paint/src/text.rs@@ -5,6 +5,7 @@ use parley::{Affinity, Cursor, Layout, Line, PositionedLayoutItem, Selection};use peniko::Fill;use std::collections::HashMap;use style::properties::generated::longhands::_moz_osx_font_smoothing::computed_value::T as FontSmoothing;+use style::properties::generated::longhands::visibility::computed_value::T as StyloVisibility;use style::properties::generated::longhands::text_decoration_style::computed_value::T as TextDecorationStyle;use style::values::computed::{Length, LengthPercentage, TextDecorationLength, TextDecorationLine, TextUnderlinePosition,@@ -889,6 +890,13 @@ pub(crate) fn stroke_text<'a>(let font_size = run.font_size();let metrics = run.font_metrics();let style = glyph_run.style();+ // raea: a run whose element is visibility: hidden (or collapse) isn't drawn, though it keeps its place+ // in the line, as Chrome draws it: `visibility` inherits, so the run's own element says (a visible+ // child of a hidden span draws). Blitz hid only boxes, so a hidden inline word drew (#13, word-flip's+ // slot strut)+ if doc.get_node(style.brush.id).and_then(|n| n.primary_styles()).is_some_and(|s| s.get_inherited_box().visibility != StyloVisibility::Visible) {+ continue;+ }let _painting = crate::Painting::enter(style.brush.id);let synthesis = run.synthesis();// raea: a bevy_ui <Text> draws its glyphs upright, as bevy_text does: it takes no synthetic italic'sdiff --git a/vendor/vendor.toml b/vendor/vendor.tomlindex 1a38ed58..4a20a45f 100644--- a/vendor/vendor.toml+++ b/vendor/vendor.toml@@ -63,14 +63,14 @@ exit = "a bevy_ui_widgets release on parley 0.12"path = "vendor/blitz-paint"upstream = "crates.io:0.3.0-beta.4"kind = "patch"-reason = "angled tile gradients, many-tile gradient layers as one brush, text-shadow, ellipsis, inline-box opacity, box-shadow blur as Chrome's; filters by GPU passes (B4a/B4b); z-index boxes clipped by the overflow between them and their stacking context; a range input's thumb; what an element paints at an offset of its own (background position and tiles, box and text shadows, scroll, inline SVG) placed in its own axes under a rotated ancestor (#18); background-clip: text, its background masked by the text of the element and everything in it (#37) as Chrome does, unscrolled; inline text in a scroller scrolled once, not twice (#46); a rounded corner where one side has no width (a left-only border on a rounded box), which drew nothing; a bevy_ui node's box shadow (data-raea-bevy-shadow, its BoxShadowSamples) drawn as bevy_ui draws it: spread by its width and its height and corners by the same ratio, then blurred as box_shadow.wesl blurs it, from a CPU bitmap (render/bevy_shadow.rs); a stacking context's out-of-flow boxes from containing blocks above it kept in its layer and not culled (raea #39); a filter's layer over the boxes the element and its descendants draw (up to the overflow clips in their way), not its border box alone; a filter of opacity() functions alone drawn as the layer's alpha, not as an atlas image (raea #96)"+reason = "angled tile gradients, many-tile gradient layers as one brush, text-shadow, ellipsis, inline-box opacity, box-shadow blur as Chrome's; filters by GPU passes (B4a/B4b); z-index boxes clipped by the overflow between them and their stacking context; a range input's thumb; what an element paints at an offset of its own (background position and tiles, box and text shadows, scroll, inline SVG) placed in its own axes under a rotated ancestor (#18); background-clip: text, its background masked by the text of the element and everything in it (#37) as Chrome does, unscrolled; inline text in a scroller scrolled once, not twice (#46); a rounded corner where one side has no width (a left-only border on a rounded box), which drew nothing; a bevy_ui node's box shadow (data-raea-bevy-shadow, its BoxShadowSamples) drawn as bevy_ui draws it: spread by its width and its height and corners by the same ratio, then blurred as box_shadow.wesl blurs it, from a CPU bitmap (render/bevy_shadow.rs); a stacking context's out-of-flow boxes from containing blocks above it kept in its layer and not culled (raea #39); a filter's layer over the boxes the element and its descendants draw (up to the overflow clips in their way), not its border box alone; a filter of opacity() functions alone drawn as the layer's alpha, not as an atlas image (raea #96); an inline run whose element is visibility: hidden isn't drawn, though it keeps its place in the line (raea #13)"exit = "a Blitz release that draws these"[blitz-dom]path = "vendor/blitz-dom"upstream = "crates.io:0.3.0-beta.4"kind = "patch"-reason = "inline flex/grid baselines, auto table columns, table row rects, inline image load events, SVG text fonts, SVG non-scaling strokes, url() filters; Blitz main's #1244 and #1246; a node removed in a mutation batch dropped from the style, form and title nodes the batch flushes (raea #24); a node in a 3D rendering context (or with a projection) placed again on every resolve, so it follows a preserve-3d parent whose transform a script set (raea #19); a ParseErrorReporter (not_applied.rs) on every author parse, keeping what stylo drops for the render to say once (raea #34); a bevy_text box whose lines are no finite size (an Apple bitmap-only face, which parley scales by a units-per-em of 0) measures 0 by 0, as bevy_text does; a family list ending in ; getBoundingClientRect and the geometry walks stop at a freed containing-block link instead of panicking on its key, and an element in a display: none subtree answers a zero rect (raea #108)"raea-bevy fallback" (bevy_text's FontSource::Family) falls to the collection's fallback families, not to serif nor to the CoreText pick (parley: NO_HOOK_FAMILY); an out-of-flow box painted by the stacking context between it and its containing block, inside its opacity group (raea #39); an SVG's paint properties from CSS written into its serialized source for usvg (raea #45); transform-box: stroke-box as fill-box under non-scaling-stroke, a stylesheet's stroke in the stroke box, and the non-scaling mark on an element with its own id (raea #50); an SVG element's rewritten style attribute without a leading `;` when its own declarations were transforms alone; transform-box: view-box's reference box at the origin of user space, not at the viewBox's x and y; every inline box laid out in full while its line is only measured, since Taffy's measure cache keeps a box's size without its baseline (raea #109)"+reason = "inline flex/grid baselines, auto table columns, table row rects, inline image load events, SVG text fonts, SVG non-scaling strokes, url() filters; Blitz main's #1244 and #1246; a node removed in a mutation batch dropped from the style, form and title nodes the batch flushes (raea #24); a node in a 3D rendering context (or with a projection) placed again on every resolve, so it follows a preserve-3d parent whose transform a script set (raea #19); a ParseErrorReporter (not_applied.rs) on every author parse, keeping what stylo drops for the render to say once (raea #34); a bevy_text box whose lines are no finite size (an Apple bitmap-only face, which parley scales by a units-per-em of 0) measures 0 by 0, as bevy_text does; a family list ending in ; getBoundingClientRect and the geometry walks stop at a freed containing-block link instead of panicking on its key, and an element in a display: none subtree answers a zero rect (raea #108)"raea-bevy fallback" (bevy_text's FontSource::Family) falls to the collection's fallback families, not to serif nor to the CoreText pick (parley: NO_HOOK_FAMILY); an out-of-flow box painted by the stacking context between it and its containing block, inside its opacity group (raea #39); an SVG's paint properties from CSS written into its serialized source for usvg (raea #45); transform-box: stroke-box as fill-box under non-scaling-stroke, a stylesheet's stroke in the stroke box, and the non-scaling mark on an element with its own id (raea #50); an SVG element's rewritten style attribute without a leading `;` when its own declarations were transforms alone; transform-box: view-box's reference box at the origin of user space, not at the viewBox's x and y; every inline box laid out in full while its line is only measured, since Taffy's measure cache keeps a box's size without its baseline (raea #109); an inline element has a border edge only where its border has a style, so a plain span (border-style none, its width still `medium`) doesn't split the shaping at its edges and lose the kerning across them (docs/layout-reads.feature LR10)"exit = "a Blitz release with #1244/#1246 and these"[parley_engine]