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
FC0a: ui/widgets/feathers_counter ports at 0.99994, with feathers' display: caption (a ThemedText), label, label_dim and label_small (Fira Sans in the theme's text colour, which no propagation overrides), and ThemeBackgroundColor, ThemeBorderColor and ThemeTextColor, which colour the one element inside from the UiTheme. A button's caption takes Fira Sans 14 px; the count, a caption outside any widget, keeps Bevy's default font, as in Bevy. A pane background fails the bar; a plain Text caption (298 pixels off, not 15) and no margin (237) pass it and are caught. 97 of 101 ported examples pass
shinyobjectzb269cbc12e5e
diff --git a/bench/bevy-parity/examples.list b/bench/bevy-parity/examples.listindex a630d545..96cabb39 100644--- a/bench/bevy-parity/examples.list+++ b/bench/bevy-parity/examples.list@@ -100,3 +100,4 @@ ui/widgets/vertical_sliderui/widgets/virtual_keyboardui/widgets/standard_widgets_observersui/widgets/standard_widgets+ui/widgets/feathers_counterdiff --git a/bench/bevy-parity/runs.tsv b/bench/bevy-parity/runs.tsvindex 1dcc893b..e3b58f43 100644--- a/bench/bevy-parity/runs.tsv+++ b/bench/bevy-parity/runs.tsv@@ -99,3 +99,4 @@ ui/widgets/vertical_slider - 10ui/widgets/virtual_keyboard - 10ui/widgets/standard_widgets_observers - 10ui/widgets/standard_widgets - 10+ui/widgets/feathers_counter - 10diff --git a/docs/bevy-parity.md b/docs/bevy-parity.mdindex bc8ae445..23131249 100644--- a/docs/bevy-parity.md+++ b/docs/bevy-parity.md@@ -4,7 +4,7 @@ Bevy v0.20.0's examples against their raea TSX ports (docs/control.feature FC0a)don't edit. An example passes when every probed frame passes pixels (SSIM 0.98 and no 32 px tile off by more than 24 of 255) and cost (batch keys andframe time at most 1.25x the example's). Wall time is one machine's, measured in the same run.-Examples: **438**, ported **100**, passing **96**, excluded **16** (docs/bevy-parity/excluded.tsv), left **326**.+Examples: **438**, ported **101**, passing **97**, excluded **16** (docs/bevy-parity/excluded.tsv), left **325**.raea's frame ms is its update's plus the time React takes to step a frame for its 3D (step), which the exampledoesn't pay.@@ -156,6 +156,7 @@ doesn't pay.| ui/widgets/virtual_keyboard | 10 | 0.993705 | 13 | 0 / 0 | 646 / 493 | 5 / 7 | 1 / 1 | 40.167 / 1.441 = 1.441 + 0 | yes | || ui/widgets/standard_widgets_observers | 10 | 0.998736 | 14 | 0 / 0 | 473 / 493 | 5 / 7 | 1 / 1 | 37.156 / 0.873 = 0.873 + 0 | yes | || ui/widgets/standard_widgets | 10 | 0.997647 | 17 | 0 / 0 | 477 / 493 | 5 / 7 | 1 / 1 | 36.07 / 1.095 = 1.095 + 0 | yes | |+| ui/widgets/feathers_counter | 10 | 0.999941 | 1 | 0 / 0 | 493 / 493 | 5 / 7 | 1 / 1 | 37.899 / 0.893 = 0.893 + 0 | yes | |## Excludeddiff --git a/sdk/raea/bench/bevy-parity/ui/widgets/feathers_counter.tsx b/sdk/raea/bench/bevy-parity/ui/widgets/feathers_counter.tsxnew file mode 100644index 00000000..e8736d36--- /dev/null+++ b/sdk/raea/bench/bevy-parity/ui/widgets/feathers_counter.tsx@@ -0,0 +1,31 @@+// Bevy v0.20.0 examples/ui/widgets/feathers_counter.rs in raea's TSX (docs/control.feature FC0a): under feathers' dark+// UiTheme, a full-window node on WINDOW_BG, centred both ways, holding a row of a FeathersButton captioned "-1", the+// count "0" (a caption with 10 px margins each side, outside any widget, so in Bevy's default font, 20 px white) and+// a FeathersButton captioned "+1"; each button's caption is a ThemedText, so in feathers' Fira Sans 14 px,+// BUTTON_TEXT. The buttons change the count only under input. Bevy's Camera2d over the default clear colour is the+// layered <Canvas3D>, in Bevy's default 1280 x 720 window.+import { AbsoluteFill, Composition, registerRoot } from "raea";+import { Canvas3D } from "raea/3d";+import { Node, UiRect, percent, px } from "raea/ui";+import { FeathersButton, ThemeBackgroundColor, ThemedText, UiTheme, caption, create_dark_theme, tokens } from "raea/feathers";++function Shot() {+ return (+ <AbsoluteFill>+ <Canvas3D layered clearColor="rgb(43, 44, 47)" />+ <UiTheme theme={create_dark_theme()}>+ <ThemeBackgroundColor token={tokens.WINDOW_BG}>+ <Node width={percent(100)} height={percent(100)} align_items="Center" justify_content="Center">+ <Node align_items="Center" justify_content="Center">+ <FeathersButton>{caption("-1")}</FeathersButton>+ <ThemedText margin={UiRect.horizontal(px(10))}>0</ThemedText>+ <FeathersButton>{caption("+1")}</FeathersButton>+ </Node>+ </Node>+ </ThemeBackgroundColor>+ </UiTheme>+ </AbsoluteFill>+ );+}++registerRoot(() => <Composition id="main" component={Shot} durationInFrames={11} fps={60} width={1280} height={720} />);diff --git a/sdk/raea/conformance/feathers.test.tsx b/sdk/raea/conformance/feathers.test.tsxindex 111b80aa..c9998673 100644--- a/sdk/raea/conformance/feathers.test.tsx+++ b/sdk/raea/conformance/feathers.test.tsx@@ -72,3 +72,20 @@ describe("EditableText", () => {expect(() => html(<EditableText visible_lines={0} />)).toThrow(/visible_lines/);});});++describe("feathers' display", () => {+ test("label is Fira Sans 14 px in TEXT_MAIN, label_small 11 px, and a caption outside a widget keeps Bevy's font", async () => {+ const { label, label_small, caption } = await import("raea/feathers");+ const l = html(<UiTheme theme={create_dark_theme()}>{label("a")}</UiTheme>);+ expect(l).toContain("Fira Sans");+ expect(l).toMatch(/font-size:\s*14px/);+ expect(html(<UiTheme theme={create_dark_theme()}>{label_small("a")}</UiTheme>)).toMatch(/font-size:\s*11px/);+ expect(html(<UiTheme theme={create_dark_theme()}>{caption("a")}</UiTheme>)).not.toContain("Fira Sans");+ });+ test("ThemeBackgroundColor colours the one element inside from the theme, and refuses anything else", async () => {+ const { ThemeBackgroundColor } = await import("raea/feathers");+ const { Node } = await import("raea/ui");+ expect(html(<UiTheme theme={create_dark_theme()}><ThemeBackgroundColor token={tokens.WINDOW_BG}><Node /></ThemeBackgroundColor></UiTheme>)).toContain("rgba(31, 31, 36, 1)");+ expect(() => html(<ThemeBackgroundColor token={tokens.WINDOW_BG}>{"x" as never}</ThemeBackgroundColor>)).toThrow(/one element/);+ });+});diff --git a/sdk/raea/src/feathers.ts b/sdk/raea/src/feathers.tsindex 8cc4a84b..1d701711 100644--- a/sdk/raea/src/feathers.ts+++ b/sdk/raea/src/feathers.ts@@ -1,4 +1,4 @@// raea/feathers (bevy_feathers, docs/control.feature FC0a): Bevy's widget set, its dark theme and its fonts, drawn by// the page.-export { tokens, palette, create_dark_theme, UiTheme, ThemeContext, ThemedText, context_color, useThemeColor, fonts, size, FeathersButton, VirtualKeyboard, to_border_radius } from "@raea/render/feathers";+export { tokens, palette, create_dark_theme, UiTheme, ThemeContext, ThemedText, context_color, useThemeColor, fonts, size, FeathersButton, VirtualKeyboard, to_border_radius, caption, label, label_dim, label_small, ThemeBackgroundColor, ThemeBorderColor, ThemeTextColor } from "@raea/render/feathers";export type { ThemeToken, ThemeProps, SurfaceLevel, ButtonVariant, RoundedCorners, FeathersButtonProps } from "@raea/render/feathers";diff --git a/sdk/render/src/bevy3d/feathers/display.tsx b/sdk/render/src/bevy3d/feathers/display.tsxnew file mode 100644index 00000000..b60d5f54--- /dev/null+++ b/sdk/render/src/bevy3d/feathers/display.tsx@@ -0,0 +1,55 @@+// bevy_feathers' display (label.rs) and theme.rs's colour components (docs/control.feature FC0a). caption is a+// ThemedText, which takes the font and colour the widget around it propagates (Bevy's defaults outside one); label,+// label_dim and label_small are Text in feathers' own font and the theme's text colour, which no widget's propagation+// overrides (PropagateOver<TextFont>, and ThemeTextColor's PropagateOver<TextColor>). ThemeBackgroundColor,+// ThemeBorderColor and ThemeTextColor colour the one element inside from the UiTheme, as the components do the entity+// they're on.+import { cloneElement, isValidElement, type ReactElement } from "react";+import { Text } from "../ui";+import { fonts, size } from "./constants";+import { ThemedText, useThemeColor } from "./theme";+import { tokens, type ThemeToken } from "./tokens";++/** a ThemedText of `text`. @bevy bevy_feathers::display::caption */+export function caption(text: string): ReactElement {+ return <ThemedText>{text}</ThemedText>;+}++function Label({ text, token, font_size }: { text: string; token: ThemeToken; font_size: { Px: number } }) {+ return <Text font={fonts.REGULAR} font_size={font_size} weight={400} color={useThemeColor(token)}>{text}</Text>;+}++/** `text` in Fira Sans 14 px, TEXT_MAIN. @bevy bevy_feathers::display::label */+export function label(text: string): ReactElement {+ return <Label text={text} token={tokens.TEXT_MAIN} font_size={size.MEDIUM_FONT} />;+}++/** `text` in Fira Sans 14 px, TEXT_DIM. @bevy bevy_feathers::display::label_dim */+export function label_dim(text: string): ReactElement {+ return <Label text={text} token={tokens.TEXT_DIM} font_size={size.MEDIUM_FONT} />;+}++/** `text` in Fira Sans 11 px, TEXT_MAIN. @bevy bevy_feathers::display::label_small */+export function label_small(text: string): ReactElement {+ return <Label text={text} token={tokens.TEXT_MAIN} font_size={size.EXTRA_SMALL_FONT} />;+}++function only(who: string, children: unknown): ReactElement<Record<string, unknown>> {+ if (!isValidElement(children)) throw new TypeError(`${who}: holds one element (a <Node> or <Text>) to colour`);+ return children as ReactElement<Record<string, unknown>>;+}++/** The element inside on the theme's colour for `token`. @bevy bevy_feathers::theme::ThemeBackgroundColor */+export function ThemeBackgroundColor({ token, children }: { token: ThemeToken; children: ReactElement }) {+ return cloneElement(only("ThemeBackgroundColor", children), { background_color: useThemeColor(token) });+}++/** The element inside bordered in the theme's colour for `token`. @bevy bevy_feathers::theme::ThemeBorderColor */+export function ThemeBorderColor({ token, children }: { token: ThemeToken; children: ReactElement }) {+ return cloneElement(only("ThemeBorderColor", children), { border_color: useThemeColor(token) });+}++/** The Text inside in the theme's colour for `token`. @bevy bevy_feathers::theme::ThemeTextColor */+export function ThemeTextColor({ token, children }: { token: ThemeToken; children: ReactElement }) {+ return cloneElement(only("ThemeTextColor", children), { color: useThemeColor(token) });+}diff --git a/sdk/render/src/bevy3d/feathers/index.ts b/sdk/render/src/bevy3d/feathers/index.tsindex 95514ef4..f8e53f10 100644--- a/sdk/render/src/bevy3d/feathers/index.ts+++ b/sdk/render/src/bevy3d/feathers/index.ts@@ -4,3 +4,4 @@ export { palette, create_dark_theme, type ThemeProps, type SurfaceLevel } from "export { UiTheme, ThemeContext, ThemedText, context_color, useThemeColor } from "./theme";export { fonts, size } from "./constants";export { FeathersButton, VirtualKeyboard, to_border_radius, type ButtonVariant, type RoundedCorners, type FeathersButtonProps } from "./controls";+export { caption, label, label_dim, label_small, ThemeBackgroundColor, ThemeBorderColor, ThemeTextColor } from "./display";diff --git a/sdk/skills/raea/reference/sdk.md b/sdk/skills/raea/reference/sdk.mdindex 5c049724..06ae42c3 100644--- a/sdk/skills/raea/reference/sdk.md+++ b/sdk/skills/raea/reference/sdk.md@@ -43,7 +43,7 @@ with a capital, hooks with `use`. A component's props are in its file.## `raea/feathers` (sdk/raea/src/feathers.ts)-`FeathersButton`, `ThemeContext`, `ThemedText`, `UiTheme`, `VirtualKeyboard`, `context_color`, `create_dark_theme`, `fonts`, `palette`, `size`, `to_border_radius`, `tokens`, `useThemeColor`+`FeathersButton`, `ThemeBackgroundColor`, `ThemeBorderColor`, `ThemeContext`, `ThemeTextColor`, `ThemedText`, `UiTheme`, `VirtualKeyboard`, `caption`, `context_color`, `create_dark_theme`, `fonts`, `label`, `label_dim`, `label_small`, `palette`, `size`, `to_border_radius`, `tokens`, `useThemeColor`## `raea/gizmos` (sdk/raea/src/gizmos.ts)