app: cherry-pick rune's pause and sound fixes onto the checkout

Rune comes from app/vendor/rune now, a checkout of 63ad0209 on branch
ported, carrying the four commits of upstream issues 1320 (a pause while
a clip is layered holds the layer's picture and time) and 1325 (a video's
sound is read ahead of the clock and leads it). Both were written against
eb9f1104 and ported across the refactors since. The faults are the first
two and the third in docs/rune-upstream.md; the app's workarounds in
review.rs stay until the fixes arrive upstream.
This commit is contained in:
vhaudiquet committed 2026-11-22 22:16:30 +01:00
1 parent 80fef698ce
commit 5bf262b82b
3795 files changed
+663463 -28

No files matched your search

+3 -18
View File
@@ -2771,7 +2771,6 @@ dependencies = [
[[package]]
name = "rune"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"accesskit",
"accesskit_macos",
@@ -2839,7 +2838,6 @@ dependencies = [
[[package]]
name = "rune-core"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"js-sys",
"libc",
@@ -2858,7 +2856,6 @@ dependencies = [
[[package]]
name = "rune-edit"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"js-sys",
"parley",
@@ -2872,7 +2869,6 @@ dependencies = [
[[package]]
name = "rune-gpu"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"blake3",
"bytemuck",
@@ -2899,7 +2895,6 @@ dependencies = [
[[package]]
name = "rune-highlights"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"unicode-ident",
"wasmparser",
@@ -2908,7 +2903,6 @@ dependencies = [
[[package]]
name = "rune-image"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"blake3",
"image",
@@ -2925,7 +2919,6 @@ dependencies = [
[[package]]
name = "rune-kit"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"icu_normalizer",
"rune",
@@ -2937,7 +2930,6 @@ dependencies = [
[[package]]
name = "rune-media"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"ash",
"block2 0.6.2",
@@ -2966,12 +2958,10 @@ dependencies = [
[[package]]
name = "rune-motion"
version = "0.1.0"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
[[package]]
name = "rune-notify"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"block2 0.6.2",
"objc2 0.6.5",
@@ -2983,7 +2973,6 @@ dependencies = [
[[package]]
name = "rune-spell"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"js-sys",
"objc2-app-kit 0.3.2",
@@ -3002,7 +2991,6 @@ dependencies = [
[[package]]
name = "rune-staging"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"wgpu",
"windows",
@@ -3011,7 +2999,6 @@ dependencies = [
[[package]]
name = "rune-taffy"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"stacker",
"taffy",
@@ -3020,7 +3007,6 @@ dependencies = [
[[package]]
name = "rune-text"
version = "0.0.1"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
dependencies = [
"bytemuck",
"fontique",
@@ -3036,7 +3022,7 @@ dependencies = [
"rustc-hash 2.1.3",
"skrifa",
"swash",
"tiny-skia-path 0.11.4 (git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d)",
"tiny-skia-path 0.11.4",
"unicode-segmentation",
"wasm-bindgen",
"windows",
@@ -3682,8 +3668,6 @@ dependencies = [
[[package]]
name = "tiny-skia-path"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"
dependencies = [
"arrayref",
"bytemuck",
@@ -3693,7 +3677,8 @@ dependencies = [
[[package]]
name = "tiny-skia-path"
version = "0.11.4"
source = "git+https://github.com/anomalyco/rune?rev=63ad0209edc9a3a7d2208b7f6c66f9e353da315d#63ad0209edc9a3a7d2208b7f6c66f9e353da315d"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93"
dependencies = [
"arrayref",
"bytemuck",
+6 -4
View File
@@ -14,9 +14,9 @@ path = "src/main.rs"
winresource = "0.1"
[dependencies]
rune = { git = "https://github.com/anomalyco/rune", rev = "63ad0209edc9a3a7d2208b7f6c66f9e353da315d" }
rune-kit = { git = "https://github.com/anomalyco/rune", rev = "63ad0209edc9a3a7d2208b7f6c66f9e353da315d" }
rune-notify = { git = "https://github.com/anomalyco/rune", rev = "63ad0209edc9a3a7d2208b7f6c66f9e353da315d" }
rune = { path = "vendor/rune/crates/rune" }
rune-kit = { path = "vendor/rune/crates/rune-kit" }
rune-notify = { path = "vendor/rune/crates/rune-notify" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
@@ -38,7 +38,9 @@ windows = { version = "0.62", features = [
"Win32_System_Threading",
] }
# Rune is patched in the workspace that builds it. A dependency's `[patch]` doesn't apply to
# Rune comes from a local checkout of the pinned rev, carrying two cherry-picked patches
# (anomalyco/rune issues 1320 and 1325) on branch `ported`.
# Rune's other crates are patched in the workspace that builds it. A dependency's `[patch]` doesn't apply
# the app that depends on it, so these three copies (from rune's own vendor/) are repeated here.
[patch.crates-io]
wgpu-hal = { path = "vendor/wgpu-hal" }
+16
View File
@@ -0,0 +1,16 @@
# Use rustc's bundled rust-lld on Windows MSVC instead of link.exe (zero extra installs).
# On Rust 1.90+, x86_64-unknown-linux-gnu already defaults to rust-lld; `-C linker-features=+lld`
# remains unstable on Rust 1.99.1, so Linux and macOS use their toolchain defaults.
[target.x86_64-pc-windows-msvc]
linker = "rust-lld"
[target.aarch64-pc-windows-msvc]
linker = "rust-lld"
# Opt-in local developer shortcuts (default-members fast paths and wasm/webgl checks).
[alias]
lint = "clippy --lib --bins --tests"
lint-all = "clippy --workspace --all-targets"
check-wasm = "check -p rune --no-default-features --target wasm32-unknown-unknown"
check-webgl = "check -p rune --no-default-features --features webgl --target wasm32-unknown-unknown"
test-fast = "test -p rune -p rune-mermaid -p rune-kit --features rune-kit/markdown,rune-kit/mermaid"
+17
View File
@@ -0,0 +1,17 @@
# Text Rune compiles in, hashes or runs is LF in every checkout, whatever core.autocrlf says: the
# precompiled shaders are keyed to the WGSL's bytes (crates/rune/build.rs also reads CRLF as LF,
# for checkouts made before this file), and a shell script with CRLF doesn't run.
*.wgsl text eol=lf
*.luau text eol=lf
*.json text eol=lf
*.jsonl text eol=lf
*.mmd text eol=lf
*.vert text eol=lf
*.frag text eol=lf
*.sh text eol=lf
# Precompiled shaders and raw pixel data, never converted.
*.dxbc binary
*.metallib binary
*.rgba binary
*.bin binary
+110
View File
@@ -0,0 +1,110 @@
#!/usr/bin/env bash
# Mints a short-lived Cloudflare token for the current release job from the token issuer
# (anomalyco/secrets). Run after aws-actions/configure-aws-credentials has assumed
# arn:aws:iam::604439173067:role/github/opencode-release: the Lambda identifies the role from the
# SigV4 signature and mints only the `opencode/release` token. No repo, stage, permission or TTL
# is sent in the request, and the token is pinned to the runner's IP for 30 minutes.
#
# Step-scoped by default: the token goes to $GITHUB_OUTPUT and only steps that list
# `CLOUDFLARE_API_TOKEN: ${{ steps.<id>.outputs.token }}` in their env receive it.
set -euo pipefail
set +x
url=${CLOUDFLARE_TOKEN_URL:-https://kjivkui2evldapbok5fhrrl6oy0fctkp.lambda-url.us-east-1.on.aws/}
account=${CLOUDFLARE_ACCOUNT_ID:-15d29c8639fd3733b1b5486a2acfd968}
# One argv value, never a line in curl's config: a newline in an override must not be able to
# inject curl options or move the AWS credentials into Basic auth.
url_pattern='^https://[a-z0-9]+\.lambda-url\.us-east-1\.on\.aws/$'
if ! [[ "$url" =~ $url_pattern ]]; then
echo "::error::CLOUDFLARE_TOKEN_URL is not the token issuer's function URL." >&2
exit 1
fi
case "$account" in
*[!0-9a-f]*|"")
echo "::error::CLOUDFLARE_ACCOUNT_ID must be a 32-character lowercase hex id." >&2
exit 1
;;
esac
if [ ${#account} -ne 32 ]; then
echo "::error::CLOUDFLARE_ACCOUNT_ID must be a 32-character lowercase hex id." >&2
exit 1
fi
for name in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN; do
if [ -z "${!name:-}" ]; then
echo "::error::$name is not set; run aws-actions/configure-aws-credentials first." >&2
exit 1
fi
done
# The response is captured, never streamed: it contains the token. AWS credentials go to curl
# through stdin, not argv, so they stay out of `ps` and any trace of this script.
response=$(
printf 'user = "%s:%s"\nheader = "x-amz-security-token: %s"\n' \
"$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY" "$AWS_SESSION_TOKEN" |
curl --config - \
--proto '=https' --proto-redir '=https' \
--aws-sigv4 "aws:amz:us-east-1:lambda" \
--request POST --url "$url" \
--fail-with-body --silent --show-error --max-time 20
)
token=$(printf '%s' "$response" | jq -er 'if (.token | type) == "string" then .token else error("token") end' 2>/dev/null)
expires=$(printf '%s' "$response" | jq -er 'if (.expires_on | type) == "string" then .expires_on else error("expires_on") end' 2>/dev/null)
# Validate before any output. No error below includes the token value.
case "$token" in
""|*[[:space:]]*)
echo "::error::The token issuer returned an invalid token." >&2
exit 1
;;
esac
if [ ${#token} -lt 8 ] || [ ${#token} -gt 512 ]; then
echo "::error::The token issuer returned an invalid token length." >&2
exit 1
fi
case "$expires" in
""|*[[:space:]]*)
echo "::error::The token issuer returned an invalid expires_on." >&2
exit 1
;;
esac
iso_pattern='^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z$'
if ! printf '%s' "$response" | jq -e --arg re "$iso_pattern" '(.expires_on | type) == "string" and (.expires_on | test($re))' > /dev/null; then
echo "::error::The token issuer returned an invalid expires_on." >&2
exit 1
fi
if ! [[ "$expires" =~ $iso_pattern ]]; then
echo "::error::The token issuer returned an invalid expires_on." >&2
exit 1
fi
# GitHub masks the exact string everywhere after this, including accidental traces and our own
# error messages. This is the first output that contains it.
printf '::add-mask::%s\n' "$token"
if [ -n "${GITHUB_OUTPUT:-}" ]; then
{
printf 'token=%s\n' "$token"
printf 'expires_on=%s\n' "$expires"
} >> "$GITHUB_OUTPUT"
elif [ -n "${GITHUB_ENV:-}" ]; then
printf 'CLOUDFLARE_API_TOKEN=%s\n' "$token" >> "$GITHUB_ENV"
fi
# Verify immediately, with the token on curl's stdin rather than argv. A runner whose Cloudflare
# egress address differs from the address Lambda saw (IPv4 vs IPv6, or a different NAT address)
# fails here instead of part way through an upload.
verify_url="https://api.cloudflare.com/client/v4/accounts/$account/tokens/verify"
if ! verify=$(printf 'header = "Authorization: Bearer %s"\nurl = "%s"\n' "$token" "$verify_url" |
curl --config - --proto '=https' --proto-redir '=https' --silent --show-error --fail-with-body --max-time 20); then
echo "::error::Cloudflare rejected the freshly minted token. The runner's egress IP to Cloudflare may differ from the IP Lambda saw (IPv4 vs IPv6 or a different NAT address). Use a runner with stable egress." >&2
exit 1
fi
if ! printf '%s' "$verify" | jq -e '.success == true and .result.status == "active"' > /dev/null; then
echo "::error::Cloudflare did not report the freshly minted token as active." >&2
exit 1
fi
echo "::notice::Cloudflare token ready; expires $expires"
+23
View File
@@ -0,0 +1,23 @@
name: file size
# The Rust file-size and folder-shape check (scripts/file-size.sh), per pull request and per push
# to dev: a few seconds on Linux. It ran inside macos-tests.yml until that moved to a schedule.
on:
push:
branches: [dev]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
concurrency:
group: file-size-${{ github.ref }}
cancel-in-progress: true
jobs:
size:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: bash scripts/file-size.sh
+74
View File
@@ -0,0 +1,74 @@
name: macOS tests
# On a schedule and on request, never per pull request or per push (the owner's decision,
# 2026-11-12): the test job takes over an hour on a Mac runner, Mac runners are scarce and shared
# across the organisation, and changes merge straight after their pull request, so a run per
# change (twice: the pull request, then the push to dev) was mostly cancelled or ignored. Every six
# hours, `changes` (a Linux job) starts the Mac job only when dev is on a commit no run has tested
# to the end yet; workflow_dispatch always tests. The Rust file-size check that also ran here
# runs per pull request in file-size.yml.
on:
schedule:
- cron: "41 */6 * * *"
workflow_dispatch:
permissions:
contents: read
actions: read
# One run at a time: a newer run cancels an older one still testing.
concurrency:
group: macos-tests
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
outputs:
test: ${{ steps.check.outputs.test }}
steps:
- id: check
env:
GH_TOKEN: ${{ github.token }}
EVENT: ${{ github.event_name }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
# The commit the last run that finished its tests (green or red) tested: rerunning the
# same commit tells nothing new. A cancelled run doesn't count.
last=$(gh api "repos/$REPO/actions/workflows/macos-tests.yml/runs?branch=dev&per_page=50" \
--jq "[.workflow_runs[] | select(.id != $RUN_ID and (.conclusion == \"success\" or .conclusion == \"failure\"))][0].head_sha // empty" || true)
if [ "$EVENT" = schedule ] && [ "$last" = "$SHA" ]; then
echo "test=false" >> "$GITHUB_OUTPUT"
echo "dev is still at ${SHA:0:9}, which the last run tested." >> "$GITHUB_STEP_SUMMARY"
else
echo "test=true" >> "$GITHUB_OUTPUT"
fi
test:
needs: changes
if: needs.changes.outputs.test == 'true'
runs-on: blacksmith-6vcpu-macos-latest
timeout-minutes: 90
env:
# One job per core: serial builds ran past the timeout with no cache, so no cache was ever saved.
CARGO_BUILD_JOBS: 3
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_TEST_STRIP: debuginfo
steps:
- uses: actions/checkout@v5
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
# The virtual Metal adapter does not expose TIMESTAMP_QUERY. Keep the
# shader freshness, pipeline, rendering, font and menu tests enabled.
- run: >-
cargo test -p rune -p rune-core -p rune-edit -p rune-gpu -p rune-image -p rune-media -p rune-spell -p rune-text -p rune-kit
--features rune/test-gpu-counters,rune-gpu/test-gpu-counters,rune-kit/markdown,rune-kit/mermaid --no-fail-fast --
--skip metal::compute_tests::passes_sample_timestamps_at_their_boundaries
# Kept outside the main invocation above so rune-ref (`libm/force-soft-floats`, `serde/derive`)
# and rune-i18n (`icu_provider/sync`) do not alter the core feature set.
- run: cargo test -p rune-ref
- run: cargo test -p rune-i18n
+50
View File
@@ -0,0 +1,50 @@
name: site
# Deploys the docs site in site/. dev deploys https://dev.anoma.ly/team/rune, production deploys https://anoma.ly/team/rune.
on:
push:
branches: [dev, production]
paths:
- "site/**"
- ".github/workflows/site.yml"
concurrency:
group: site-${{ github.ref_name }}
cancel-in-progress: false
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'dev' && 'dev' || 'release' }}
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@v5
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: arn:aws:iam::604439173067:role/github/rune-${{ github.ref_name == 'dev' && 'dev' || 'release' }}
role-session-name: site-${{ github.run_id }}
aws-region: us-east-1
- uses: actions/setup-node@v5
with:
node-version: 22
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- name: Cloudflare token
id: cloudflare-token
run: bash "$GITHUB_WORKSPACE/.github/release/cloudflare-token.sh"
env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
- run: bun run deploy:${{ github.ref_name == 'production' && 'production' || 'dev' }}
env:
CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
+129
View File
@@ -0,0 +1,129 @@
name: www
# The public page in www/ is the Rune app in www/app. CI builds it to wasm, has the native build write its static
# HTML (`--html`), and deploys: dev to https://dev.anoma.ly/rune, production to https://anoma.ly/rune. Rune itself is
# the page, so a push that changes crates/ deploys it too. Pull requests build the dev page and deploy nothing, and
# only for a change to the page's own files: a change to crates/ merges straight after its pull request, and the
# push to dev builds it then, so building it twice told nothing. A newer push to dev replaces a dev deploy still
# running; production always finishes.
on:
push:
branches: [dev, production]
paths:
- "www/**"
- "crates/**"
- "scripts/web-build.sh"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- ".github/workflows/www.yml"
pull_request:
paths:
- "www/**"
- "scripts/web-build.sh"
- "rust-toolchain.toml"
- ".github/workflows/www.yml"
concurrency:
group: www-${{ github.head_ref || github.ref_name }}
cancel-in-progress: ${{ github.ref_name != 'production' }}
permissions:
contents: read
env:
BINARYEN_VERSION: "133"
MODE: ${{ github.ref_name == 'production' && 'production' || 'dev' }}
CARGO_INCREMENTAL: "0"
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref_name == 'dev' && 'dev' || 'release' }}
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: www
steps:
- uses: actions/checkout@v5
# Pull requests build and deploy nothing, so they never assume the role.
- name: Configure AWS credentials
if: github.event_name == 'push'
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
with:
role-to-assume: arn:aws:iam::604439173067:role/github/rune-${{ github.ref_name == 'dev' && 'dev' || 'release' }}
role-session-name: www-${{ github.run_id }}
aws-region: us-east-1
# rust-toolchain.toml picks the toolchain. rust-src is installed up front: otherwise rustup fetches it mid-build
# from parallel rustc calls, which race and fail.
- name: Rust toolchain
working-directory: .
run: |
rustup toolchain install
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- uses: Swatinem/rust-cache@v2
with:
shared-key: www
save-if: ${{ github.event_name == 'push' }}
- name: wasm-bindgen version from Cargo.lock
id: bindgen
working-directory: .
run: echo "version=$(grep -A1 '^name = "wasm-bindgen"$' Cargo.lock | sed -n 's/^version = "\(.*\)"/\1/p')" >> "$GITHUB_OUTPUT"
- uses: taiki-e/install-action@v2
with:
tool: wasm-bindgen@${{ steps.bindgen.outputs.version }}
- uses: actions/cache@v4
id: binaryen
with:
path: ~/.binaryen
key: binaryen-${{ env.BINARYEN_VERSION }}
- name: Install binaryen
if: steps.binaryen.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.binaryen
curl -fsSL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-x86_64-linux.tar.gz" \
| tar -xz -C ~/.binaryen --strip-components=1
- run: echo "$HOME/.binaryen/bin" >> "$GITHUB_PATH"
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
# The native app (tests and the `--html` export) links winit's keyboard library. Its packages are cached, so a
# run doesn't need the Ubuntu mirrors (on 2026-11-11 the runners couldn't resolve them for over an hour, and
# every run failed here); a run that must fetch them retries.
- uses: actions/cache@v4
id: debs
with:
path: ~/.debs
key: debs-libxkbcommon-${{ runner.os }}-${{ runner.arch }}-${{ env.ImageOS }}
- name: Native libraries
run: |
if [ "${{ steps.debs.outputs.cache-hit }}" != true ]; then
mkdir -p ~/.debs
for attempt in 1 2 3; do
sudo apt-get -o Acquire::Retries=3 update &&
(cd ~/.debs && apt-get -o Acquire::Retries=3 download libxkbcommon-dev libxkbcommon0) && break
[ "$attempt" = 3 ] && exit 1
sleep $((attempt * 20))
done
fi
sudo dpkg -i ~/.debs/*.deb
- name: Test the page
working-directory: .
run: cargo test -p rune-www
- name: Build
run: bun run build --mode "$MODE"
- name: Cloudflare token
id: cloudflare-token
if: github.event_name == 'push'
run: bash "$GITHUB_WORKSPACE/.github/release/cloudflare-token.sh"
env:
CLOUDFLARE_TOKEN_URL: ${{ vars.CLOUDFLARE_TOKEN_URL }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
- name: Deploy
if: github.event_name == 'push'
run: bunx cf deploy --prebuilt --mode "$MODE"
env:
CLOUDFLARE_API_TOKEN: ${{ steps.cloudflare-token.outputs.token }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
+17
View File
@@ -0,0 +1,17 @@
target/
perf/autoresearch/
perf/kit-diff/
perf/live-values/
perf/live-edit/
/REVIEW-TO-PARENT.md
*-FROM-PARENT.md
.DS_Store
demo/**/*.mp4
demo/**/*-strip.png
!demo/fx/glow-strip.png
!demo/fx/motion-quarter-speed.mp4
!demo/opencode/switch-strip.png
/captures/
/.lab-output/
__pycache__/
*.pyc
+71
View File
@@ -0,0 +1,71 @@
<!-- tallow -->
# Rune
A Rust GPU UI framework (wgpu, winit) for apps that feel like SwiftUI on iOS at 120 Hz on Mac, Windows, Linux, web and iOS. Views are plain Rust. Apps pin `dev` revs.
## Layout
- Core crates: `crates/rune`: layout, runtime, renderer, windows, overlays, dev tooling. `crates/rune-core`: foundation primitives (colour, tokens, themes, shapes, state machines, clocks, tasks, tracked reads, growth, live values, latest-wins requests, marks, dirs, prefs; no GPU or windowing). `crates/rune-gpu`: GPU adapter selection, backend dispatch, device error logging, native Apple Metal backend and analytic GPU springs. `crates/rune-image`: content-addressed image decoding, linear-light mips, pixel buffers, SVG/AVIF codecs, OS app icons and placement math. `crates/rune-spell`: platform spellchecking (Windows `ISpellChecker`, macOS `NSSpellChecker`, web Hunspell). `crates/rune-media`: video and audio playback, zero-copy native surfaces (IOSurface, D3D shared textures, dmabufs), and audio recording. `crates/rune-text`: text shaping, layout, font discovery, glyph rasterization and icons. `crates/rune-edit`: the text editing model (`TextEdit`, keys and modifiers, IME composition, undo history, rich text and its HTML form). `crates/rune-motion`: springs and transitions.
- Layering: `rune-motion`, `rune-staging` and `rune-taffy` have no Rune dependencies; `rune-core` depends on `rune-motion`; `rune-gpu` depends on `rune-motion` (and `rune-staging` under `metal-backend`); `rune-image` and `rune-spell` depend on `rune-core`; `rune-text` depends on `rune-core`, `rune-image` and `rune-motion`; `rune-edit` depends on `rune-core` and `rune-text`; `rune-media` depends on `rune-core`, `rune-gpu`, `rune-image` and `rune-staging`; `crates/rune` depends on all of them (plus optional `procwatch`) and re-exports their public APIs so apps depend on `rune` only. Above `rune` sit `rune-kit` (also `rune-motion` and optional `rune-highlights`, `rune-mermaid`), `rune-mermaid`, `rune-knobs`, `rune-luau` and optional `rune-ref`; beside it sit `rune-fx` (`rune-motion`, `rune-staging`), `rune-light` (`rune-staging`), `rune-mac` (`rune-notify`) and `rune-perf` (`procwatch`).
- Companion crates: `crates/rune-kit`: components. `crates/rune-mermaid`: Mermaid diagrams (flowcharts, sequence and state diagrams). `crates/rune-i18n`: message catalogs generated from JSON, CLDR plurals and numbers, the system's languages. `crates/rune-fx`, `crates/rune-light`: effects. `crates/rune-ref`: reference renderer. `crates/procwatch`: an app's own memory and CPU (footprint, counting allocator, gauges, warnings, loopback JSON); libc only, no Rune dependency.
- `examples/`: apps and labs. `themes/`: themes. `site/`: the docs site (see `site/README.md`).
- `vendor/winit`: winit as published plus `vendor/winit.patch` (Windows: no TaskbarList COM call when a window is made, and system DLLs loaded with `LOAD_LIBRARY_SEARCH_SYSTEM32`; and `WindowExtWayland::content_corner_radius`, the radius a client-side frame leaves the content's bottom corners to), through `[patch.crates-io]`. When winit is bumped, run `scripts/vendor-winit.sh <new version>` (Git Bash on Windows) and update the `[patch.crates-io]` rev in apps that build Rune.
- `vendor/sctk-adwaita`: sctk-adwaita as published plus `vendor/sctk-adwaita.patch` (the client-side frame's one-point border follows the window's rounded bottom corners, and `content_corner_radius` says what radius the content leaves them), through `[patch.crates-io]`. When it is bumped, run `scripts/vendor-sctk-adwaita.sh <new version>` (Git Bash on Windows) and update the `[patch.crates-io]` rev in apps that build Rune.
- `vendor/tiny-skia-path`: tiny-skia-path as published plus `vendor/tiny-skia-path.patch` (Skia's own conic splitting and stroker steps, so icons stroke as Chromium's Skia strokes them), a plain path dependency of `crates/rune-text`, not a patch (resvg keeps the published one). When it is bumped, run `scripts/vendor-tiny-skia-path.sh <new version>` (Git Bash on Windows).
- `vendor/wgpu-hal`: wgpu-hal as published plus `vendor/wgpu-hal.patch` (`dx12::Instance::expose_adapter`, FXC loaded on first compile, and Windows system DLLs loaded with `LOAD_LIBRARY_SEARCH_SYSTEM32`), through `[patch.crates-io]`. When wgpu is bumped, run `scripts/vendor-wgpu-hal.sh <new wgpu-hal version>` (Git Bash on Windows) and update the `[patch.crates-io]` rev in apps that build Rune.
- `PLAN.md`: direction and milestones. `research/`: notes behind decisions. `demo/`: images the docs show.
## Commands
- `cargo test -p rune -p rune-mermaid -p rune-kit --features rune-kit/markdown,rune-kit/mermaid`
- `cargo check --workspace --all-targets`
- `bash scripts/check-local.sh` runs opt-in local checks (file sizes, folder shape, public-repo hygiene, `cargo check`, `cargo clippy --lib --bins`; supports `--wasm`, `--all`, `--tests`).
- Cargo aliases in `.cargo/config.toml`: `cargo lint`, `cargo lint-all`, `cargo check-wasm`, `cargo check-webgl`, and `cargo test-fast`.
- Tests that count GPU work or need wgpu's no-op backend are behind features so plain builds don't compile those backends: add `--features rune/test-gpu-counters,rune-gpu/test-gpu-counters` (and `rune/test-gpu-noop` on Linux) to run them. `rune-ref` and `rune-i18n` are not default members: test them with `-p`.
- Tests run in debug. `--release` is incremental, for looking at an app. Benchmarks use `--profile perf`; the runtime bench scripts refuse other builds.
- CI's macOS tests (`.github/workflows/macos-tests.yml`) run on a schedule and on `workflow_dispatch`, not per pull request or push: the owner's decision on 2026-11-12. Don't add those triggers back; run the workflow by hand when a change needs it.
## Changes
- Work on `dev`. `production` deploys the site.
- `dev` is fast-forward-only: never force-push or rewrite it. Apps pin its revs, so a rewrite breaks every app's build on a clean fetch.
- For any change that can move an app's output or break its build, add `changelog/unreleased/<YYYY-MM-DD>-<slug>.md` with one top-level bullet, in the style of the `CHANGELOG.md` entries. `scripts/changelog-fold` folds them into `## dev`.
- Keep Rust files under 800 non-test lines (`#[cfg(test)]` code excluded); 1,500 is a hard cap. The point is to stop god files and edit collisions, not to chop a file that reads fine as one piece. Older files over the cap are listed in `scripts/file-size-exceptions.txt` with ceilings that only go down. Run `scripts/file-size.sh` to check.
- Keep folders shaped by capability: `x.rs` or `x/` beside two or more `x_*.rs` (or three or more `x_*.rs` alone) means move them into `x/`; a folder over 40 source files warns and over 60 is an error (tests aren't counted; `examples/`, `benches/` and `bin/` are skipped). `scripts/folder-shape.sh` runs inside `scripts/file-size.sh`; old violations are in `scripts/folder-shape-exceptions.txt` with ceilings that only go down.
- Put tests in a sibling `tests.rs` or `*_tests.rs`, and keep any test file or module under 1,000 lines.
- Before adding to a file over the cap, move the area you touch into its own module, in its own PR.
- A feature owns its state, keys and registrations so it plugs in with one line. New runtime state goes in the owning subsystem's struct, not a flat `Runtime` field.
- In `lib.rs`, keep `mod` and `pub use` lists one item per line, sorted.
- Apps build these types as literals, so adding a pub field breaks them: `AppSpec`, `Env`, `Elevation`, `PaletteSeed`, `OverlaySpec`, `TextStyle`, `RunOptions`, `ScrollSpec`, `Span`, `ByteFrame`, `SurfaceDraw`, `LayerSpec`. Add a builder method instead.
## State
- Behaviour with modes or phases (hover delays, drags, IME composition, scroll modes, requests and retries) is an explicit state machine: one `enum State` whose variants carry only the data valid in them, and one `fn step(state: &mut State, event: Event) -> Effects<Effect>` (`rune::machine`) that returns effects instead of performing them. No clusters of booleans, `Option`s and timestamps whose combinations encode the mode.
- Timers are events: a timed variant stores its `Attempt` and due time on `Tx::clock`/the runtime clock, the caller turns its effect into `Tx::wake_at`, and `poll` (or the runtime's frame) feeds the timer back into `step`. An answer whose attempt the state no longer holds changes nothing.
## Performance
App-side rules live in "Launching fast" in `crates/rune/README.md` and the "Launch fast" docs page. In examples and in Rune itself:
- Start slow work (network, indexing, status items) from `on_ready`, after the first frame. Land state that arrives just after launch with `tx.instant()`, so the first second stays still.
- `poll` returns true only when visible state changed, and a loop stops asking for frames when its work ends. An idle window draws nothing.
- Read sizes with `Cx::layout_size` or `Cx::layout_with`, not whole rects, so a scroll doesn't rebuild the view every frame. A handler that only moves a live value (scroll, zoom, a transform) calls `Tx::live_only()`.
- Build only mounted rows: `virtual_rows`, with row content built inside its closure; `memo` for rows that rarely change.
- Bound every cache in entries and in bytes, counting decoded pixels, not encoded size.
- Take numbers from `--profile perf`. Compare paired, alternating runs by median, keep outliers, and say what a headless number leaves out (GPU upload, presentation).
- A motion change passes `scripts/motion-audit` with its scenario added. Fix a finding in Rune rather than allowing it.
- No file I/O in the frame loop: never read, stat, write, sync or rename a file on the UI thread during frames, input or animation. On Windows each open and `MoveFileExW` rename runs antivirus filter callbacks and can fail with a sharing violation.
- No background rewrite churn: diagnostics and logs (`rune-perf`, traces) keep one open handle and write a summary on an incident or at shutdown, never on a repeating timer while idle.
- Keep persistence APIs free of `std::fs` and `PathBuf` so `wasm32` targets can back them with browser storage.
## This repo is public
Everything pushed stays public in history. Before committing, run `git diff --cached | rg -n '/Users/|/private/var/|\.ts\.net|ses_[A-Za-z0-9]{20}'` and keep these out:
- secrets, tokens and credential file contents;
- home folder and temp paths, machine names and tailnet hostnames. Write repo-relative paths, and use `host.example.ts.net` in tests;
- session IDs, chat or Slack links, and quotes from private sessions, chats or calls;
- teammates' names attached to their plans, opinions or internal discussions, and private repos or branches;
- quotes of, or citations to, internal guides and rules. Say what the code does and why on its own terms;
- agent handoff notes (`REVIEW-TO-PARENT.md` and similar), raw evidence, logs and benchmark dumps;
- generated videos and strips nothing links to. Commit the stills a doc shows.
+3239
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -0,0 +1 @@
@AGENTS.md
Generated Vendored
+6406
View File
File diff suppressed because it is too large. Load diff
+292
View File
@@ -0,0 +1,292 @@
[workspace]
resolver = "3"
members = [
"crates/rune",
"crates/rune-core",
"crates/rune-edit",
"crates/rune-gpu",
"crates/rune-image",
"crates/rune-media",
"crates/rune-spell",
"crates/rune-text",
"crates/rune-ref",
"crates/rune-motion",
"crates/rune-i18n",
"crates/rune-staging",
"crates/rune-kit",
"crates/rune-highlights",
"crates/rune-fx",
"crates/rune-light",
"crates/procwatch",
"crates/rune-register",
"crates/rune-knobs",
"crates/rune-mac",
"crates/rune-notify",
"crates/rune-mermaid",
"crates/rune-perf",
"crates/rune-luau",
"crates/rune-taffy",
"themes/opencode",
"examples/hello",
"examples/web-hello",
"examples/web-showcase",
"www/app",
"examples/todo",
"examples/settings",
"examples/playground",
"examples/knobs",
"examples/kit-gallery",
"examples/background",
"examples/live-values",
"examples/shapes",
"examples/overlay",
"examples/overlay-lab",
"examples/lab",
"examples/showreel",
"examples/video-player",
"examples/video-tiles",
"examples/cursed-settings",
"examples/drag-out",
"examples/sketch",
"examples/drop-files",
"examples/rich-clipboard",
"examples/matched",
"examples/launcher",
"examples/glass-card",
"examples/glass-panel",
"examples/frosted-bar",
"examples/odometer",
"examples/motion-bento",
"examples/motion-bento/chaos",
"examples/site-scenes",
"examples/luau-panel",
]
# Default cargo check/test targets: the core framework, libraries and theme.
# Excludes examples/*, www/app, rune-luau (C++ Luau build via cc/mlua), rune-notify/rune-mac
# (WinRT features on `windows`), rune-ref (`libm/force-soft-floats` and `serde/derive`), and
# rune-i18n (`icu_provider/sync`, `writeable/default`, `smallvec/const_generics`); pass
# `--workspace` to check everything.
default-members = [
"crates/rune",
"crates/rune-core",
"crates/rune-edit",
"crates/rune-gpu",
"crates/rune-image",
"crates/rune-media",
"crates/rune-spell",
"crates/rune-text",
"crates/rune-motion",
"crates/rune-staging",
"crates/rune-kit",
"crates/rune-highlights",
"crates/rune-fx",
"crates/rune-light",
"crates/procwatch",
"crates/rune-register",
"crates/rune-knobs",
"crates/rune-mermaid",
"crates/rune-perf",
"crates/rune-taffy",
"themes/opencode",
]
exclude = ["tools/rune-dev-guard", "tools/ratex-math-wasm", "tools/ratex-math-wasm/pack", "vendor/accesskit_macos", "vendor/accesskit_windows", "vendor/parley_engine", "vendor/sctk-adwaita", "vendor/tiny-skia-path", "vendor/wgpu-hal", "vendor/winit"]
# wgpu-hal as published plus `vendor/wgpu-hal.patch`: `dx12::Instance::expose_adapter` (a `wgpu::Adapter` for the
# one adapter Rune picks through DXGI, with no device made on the others, `crates/rune-gpu/src/pick.rs`), FXC loaded on
# the first compile rather than with the instance (Rune's uber shader is precompiled), partial presents
# (`Surface::set_present_rects`: `Present1` dirty rectangles on a sequential flip-model swap chain, for
# `render::damaged`), Windows system DLLs (`d3d12.dll`, `dxgi.dll`, `dcomp.dll`, `d3dcompiler_47.dll`,
# `opengl32.dll`) loaded with `LOAD_LIBRARY_SEARCH_SYSTEM32`, a removed D3D12 device's work left
# pending rather than read as finished (`Device::reached`; Rune sees the removal through
# `rune_gpu::health::removed`), and GPU-written drain markers (`WriteBufferImmediate`) on software
# adapters (`DXGI_ADAPTER_FLAG_SOFTWARE`, WARP) so releasing a removed WARP device or unconfiguring
# its surface waits until queued command lists finish executing instead of freeing resources under
# its worker threads (`DrainTracker`; hardware adapters pay zero marker cost, while skipping
# `ExecuteCommandLists` and `allocator.Reset()` once removed on every adapter). Re-made by
# `scripts/vendor-wgpu-hal.sh <version>` when wgpu is bumped. An app that builds Rune patches it too:
# a dependency's `[patch]` doesn't apply to the workspace that depends on it.
[patch.crates-io]
wgpu-hal = { path = "vendor/wgpu-hal" }
# winit as published plus `vendor/winit.patch`: on Windows a new window isn't added again to the
# taskbar it's already on (that took CoInitializeEx and a TaskbarList COM object, about 7,800 µs
# and nine shell DLLs, before every window's first frame), a window given a position is made there, so it is
# born at that display's scale instead of crossing to it and being resized, and Windows system DLLs
# (`uxtheme.dll`, `user32.dll`, `shcore.dll`, `ntdll.dll`) load via `LoadLibraryExA` with
# `LOAD_LIBRARY_SEARCH_SYSTEM32`; and
# `WindowExtWayland::content_corner_radius` tells an app the radius its content leaves its bottom
# corners to while a client-side frame rounds the window (see `vendor/sctk-adwaita`). Re-made by
# `scripts/vendor-winit.sh <version>` when winit is bumped; apps that build Rune patch it too.
winit = { path = "vendor/winit" }
# sctk-adwaita as published plus `vendor/sctk-adwaita.patch`: the visible one-point border a
# Wayland client-side frame draws follows the window's rounded bottom corners, as the headerbar it
# draws above them rounds the top two, instead of drawing a square L over the shadow's rounded
# cut-out; and `AdwaitaFrame::content_corner_radius` says what radius the content's own bottom
# corners take, for the app to clear outside (`window/surface/corners.rs`). Re-made by
# `scripts/vendor-sctk-adwaita.sh <version>` when sctk-adwaita is bumped; apps that build Rune
# patch it too.
sctk-adwaita = { path = "vendor/sctk-adwaita" }
# parley_engine as published plus `vendor/parley_engine.patch`: UAX #9 rule L1 for a paragraph's
# trailing whitespace and isolates (BidiTest.txt 770,241 of 770,241; 644,283 without it), and
# shaping that stops redoing work from the same inputs: an analyzer keeps the ICU segmenters it
# made, and a run's or a style's font metrics are made once per font instance and size (14% off
# a text's shaping, layouts identical). Re-made by `scripts/vendor-parley-engine.sh <version>` when parley is bumped; apps that build
# Rune patch it too.
parley_engine = { path = "vendor/parley_engine" }
# accesskit_windows as published plus `vendor/accesskit_windows.patch`: headings and landmarks reach
# UI Automation (HeadingLevel, LandmarkType, LocalizedLandmarkType), which Narrator's and NVDA's
# heading and landmark navigation read; and a field past Rune's 64 KiB text-run limit keeps its text
# pattern, its lines answered from its value when a reader asks (`src/long_text.rs`). Re-made by
# `scripts/vendor-accesskit-windows.sh <version>`
# when AccessKit is bumped; apps that build Rune patch it too.
accesskit_windows = { path = "vendor/accesskit_windows" }
# accesskit_macos as published plus `vendor/accesskit_macos.patch`: headings reach NSAccessibility as
# AppKit's `AXHeading` with their level as the value (the published role, `Heading`, is none VoiceOver
# knows), so VoiceOver's rotor and VO-Command-H find them and say their level; and the accessibility
# children, focused element and hit test leave the adapter alone off the main thread, which AppKit
# calls them on while the process queries itself, so they answer from the superclass instead of
# racing or panicking on the main thread's borrow; and a field past Rune's 64 KiB text-run limit keeps
# its line, string and selection ranges, answered from its value when a reader asks. Re-made by
# `scripts/vendor-accesskit-macos.sh <version>` when AccessKit is bumped; apps that build Rune patch it too.
accesskit_macos = { path = "vendor/accesskit_macos" }
[workspace.package]
edition = "2024"
license = "MIT"
[workspace.dependencies]
# Internal workspace crates.
procwatch = { path = "crates/procwatch" }
rune = { path = "crates/rune", default-features = false }
rune-core = { path = "crates/rune-core" }
rune-edit = { path = "crates/rune-edit" }
rune-fx = { path = "crates/rune-fx" }
rune-gpu = { path = "crates/rune-gpu", default-features = false }
rune-highlights = { path = "crates/rune-highlights" }
rune-image = { path = "crates/rune-image", default-features = false }
rune-kit = { path = "crates/rune-kit", default-features = false }
rune-knobs = { path = "crates/rune-knobs" }
rune-light = { path = "crates/rune-light" }
rune-luau = { path = "crates/rune-luau" }
rune-media = { path = "crates/rune-media", default-features = false }
rune-mermaid = { path = "crates/rune-mermaid" }
rune-motion = { path = "crates/rune-motion" }
rune-notify = { path = "crates/rune-notify" }
rune-ref = { path = "crates/rune-ref" }
rune-spell = { path = "crates/rune-spell" }
rune-staging = { path = "crates/rune-staging" }
rune-taffy = { path = "crates/rune-taffy" }
rune-text = { path = "crates/rune-text", default-features = false }
rune-theme-opencode = { path = "themes/opencode" }
# Shared external crates.
blake3 = "1"
block2 = "0.6"
bytemuck = { version = "1.25", features = ["derive"] }
half = "2"
image = { version = "0.25", default-features = false }
js-sys = "0.3"
libc = "0.2"
miniz_oxide = { version = "0.9", default-features = false, features = ["with-alloc"] }
objc2 = "0.6"
objc2-app-kit = { version = "0.3", default-features = false }
objc2-core-foundation = { version = "0.3", default-features = false }
objc2-core-graphics = { version = "0.3", default-features = false }
objc2-core-video = { version = "0.3", default-features = false }
objc2-foundation = { version = "0.3", default-features = false }
objc2-metal = { version = "0.3", default-features = false }
parley = { version = "0.12", default-features = false }
parley_engine = { version = "0.12", default-features = false }
png = "0.18"
pollster = "1"
resvg = { version = "0.45", default-features = false }
rustc-hash = "2"
serde = "1"
serde_json = "1"
skrifa = "0.44"
swash = "0.2.10"
taffy = { version = "0.15", default-features = false }
tiny-skia = { version = "0.11", default-features = false, features = ["std", "simd"] }
unicode-segmentation = "1.13"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
wasmi = { version = "1.1", default-features = false }
web-sys = "0.3"
wgpu = { version = "~30.0.1", default-features = false }
wgpu-naga-bridge = "~30.0.1"
windows = "0.62"
windows-core = "0.62"
windows-sys = "0.61"
winit = { version = "0.30.13", default-features = false }
zeroize = "1.8"
# Full debug info for the workspace crates made a single `rune` test build use 18-23 GB of RAM;
# line tables keep backtraces and file:line in panics at a fraction of that.
[profile.dev]
debug = "line-tables-only"
[profile.dev.package."*"]
debug = false
[profile.release]
codegen-units = 16
incremental = true
# Keep the optional `math` sandbox interpreter compact (saves ~558 KiB in FAT-LTO release builds
# with zero effect on the UI thread since math typesets on a background worker and caches results).
[profile.release.package.wasmi]
opt-level = "z"
[profile.release.package.wasmi_core]
opt-level = "z"
[profile.release.package.wasmi_ir]
opt-level = "z"
[profile.release.package.wasmi_collections]
opt-level = "z"
[profile.release.package.wasmparser]
opt-level = "z"
# Benchmarks and perf numbers. Same codegen as release, without incremental, which can move
# frame timings. The runtime bench scripts refuse binaries built with any other profile.
[profile.perf]
inherits = "release"
opt-level = 3
codegen-units = 16
lto = false
debug = false
incremental = false
# `cargo bench` inherits release; scripts/check-reference-instructions.sh compares its instruction
# counts across revisions.
[profile.bench]
incremental = false
[profile.rune-hot]
inherits = "dev"
debug = 0
incremental = true
[profile.rune-hot.package.png]
opt-level = 3
[profile.rune-hot.package.fdeflate]
opt-level = 3
[workspace.lints.rust]
# shared-lints begin
unsafe_op_in_unsafe_fn = "deny"
unused_must_use = "deny"
# shared-lints end
unsafe_code = "deny" # pure-Rust crates use #![forbid(unsafe_code)]; FFI/SIMD leaf modules opt in locally
[workspace.lints.clippy]
# shared-lints begin
await_holding_lock = "deny"
await_holding_refcell_ref = "deny"
dbg_macro = "deny"
disallowed_methods = "deny"
disallowed_types = "deny"
expect_used = "warn"
let_underscore_must_use = "deny"
todo = "warn"
undocumented_unsafe_blocks = "deny"
unwrap_used = "warn"
# shared-lints end
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Anomaly
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+617
View File
@@ -0,0 +1,617 @@
# Rune: plan
*Research notes behind every claim are in [`research/`](research/). Numbers marked "target" are commitments to
measure against, not results.*
## The short version
Rune is a Rust UI framework with its own renderer, text, layout, state,
animation and platform shells, built to feel like SwiftUI-on-iOS at 120 Hz and to be written and checked by agents.
**Direction:** Rune apps carry **their own design language on every
platform, Mac included**, rather than imitating each OS. Rune itself bakes in no brand: it ships a token-driven theming
system, and OpenCode's theme is the first theme built on it and the reference example. The flagship test is
**recreating OpenCode Desktop** in Rune and raising its bar, which makes Windows and Linux
first-class from the start. Native stays where it's behaviour, not looks: text input/IME, accessibility, window
management, clipboard, scroll momentum. A Rust component library with the same names as `@opencode/ui`, gallery
and screenshot tests, and Hex Settings as the first real screen fold in here instead of becoming a second stack on
Slint.
| Layer | Pick | Instead of |
|---|---|---|
| Language | Rust (2024), thin `objc2`/Swift shims on Apple | Zig, C++, Swift, Mojo |
| GPU | wgpu on every platform first (one backend ships Mac, Windows, Linux and web); a raw Metal backend later only where a measured need shows up (live-resize sync, IOSurface video), via wgpu-hal escape hatches first | Raw Metal first, Vulkan/D3D12 by hand |
| Renderer | One instanced "uber-quad" SDF pass + glyph atlas + Slug for big/animated text and icons + `vello_gpu` sparse strips for complex vectors; soft-edge masks in-shader on every clip | Full compute Vello, Skia, MSAA path textures |
| Look | Unbranded core with a token-driven theming system (semantic tokens, themes with light/dark, runtime switching, codegen); the same look on every platform. OpenCode's theme (from `@opencode/ui`) is the first theme and the main example, kept outside the core | A theme baked into the framework; per-OS native look; Liquid Glass as the base (it's an optional Apple extra) |
| Text | Parley + HarfRust + skrifa + fontique, GPUI-style two-tier line cache, kitlangton/gpui glyph dilation | CoreText-only, cosmic-text |
| Text editing / IME | Zed's `sum_tree` + rope; each platform's own text protocol, implemented directly (`NSTextInputClient`, `UITextInput`, …) | winit's IME, a hidden native text field |
| Layout | Taffy (flex, grid, block) on Rune's own node arena, plus a sum-tree height index for huge lists | Own layout engine, SwiftUI-style proposals |
| State | Keyed retained tree rebuilt from plain view functions; typed models; reads subscribe; handlers queued with `&mut` | Signals, GPUI entities, immediate mode |
| Animation | Render thread owns the presented tree; every property is an analytic spring track (duration + bounce, SwiftUI's formula) that retargets with velocity | Animating through view re-renders on the main thread |
| Accessibility | AccessKit, and the same tree is the agent inspector's tree | Own a11y bridges |
| Shells | winit to start (the prototype runs on it); own thin shells per platform (borrowing from Zed's Apache-2.0 `gpui_macos`/`gpui_windows`/`gpui_linux`/`gpui_ios`/`gpui_web`) as soon as text input lands, because winit's IME is incomplete | winit forever, SDL3 |
| Hot reload | Tokens and live literals with no rebuild (≤ 100 ms), subsecond hot-patching for structural Rust edits on Mac (~1 s measured, goal 300 ms), **split-process dev mode** for the iPhone (renderer on the phone, app code on the Mac) | A view DSL interpreter, code loading on the device |
| Platform order | macOS + Windows + Linux together (one wgpu backend) → web (docs site, demos) → iOS → Android | |
**Top three risks:** text input and text quality (IME on three desktops, then iOS `UITextInput`), matching
OpenCode Desktop's Chromium-rendered look closely enough (text above all), and sheer scope.
**First milestones:** Rune's theming system plus an OpenCode theme generated from `@opencode/ui` as its first
consumer, and a component gallery styled by it; Hex's Settings as the first real screen on Mac, Windows and Linux; then OpenCode Desktop's main screens.
A docs/marketing site comes first to explain it.
---
## 1. Why build this at all
Kit has rebuilt the same small surfaces three times in ten days:
the Scrawl pill went GPUI → hand-written Metal → SwiftUI helper process, the launcher app went GPUI → SwiftUI with a
Core Animation glass morph, and Hex's native branch stalled because Hex also ships on Windows and Linux. Each time,
the reasons were the same:
1. **No backdrop or glass.** GPUI draws one forward pass into one layer; Liquid Glass only exists in the window server.
2. **Animation waited behind the main thread.** The Metal pill dropped 85 frames on finish until it got its own
display-link thread.
3. **Windows and focus were wrong for HUDs and launchers** (late focus events, Dock policy, no non-activating panels,
per-frame window resizes).
4. **Text looked thin and colours were off,** and unseen glyphs stalled the first frame by ~13 ms.
5. **No springs or layout animation,** so every app hand-rolled them.
6. **Upstream was frozen** at 0.2.2 for Kit's apps, so every fix lived in a fork.
Upstream GPUI has since moved a lot: Zed's tree at `5447804` has `gpui_ios`, `gpui_web`, a wgpu backend,
`spring.rs`, AccessKit and subsecond hot reload (verified in a clone). It still redraws the whole window every dirty
frame, has no layer compositing or group opacity, runs animations by re-rendering views on the main thread, and
panics on re-entrant entity borrows ([01](research/01-gpui-zed-warp.md)). Those are the exact things that sent Kit
to Apple frameworks, and they're architectural. **Verdict: don't fork GPUI; start fresh and lift its best parts**
(rope/sum_tree, BoundsTree, line layout cache, the macOS/iOS IME code, the web textarea bridge, the shader fixes in
Kit's fork) under its Apache-2.0 licence.
## 2. Tenets
1. **Feel is the product.** 120 Hz, interruptible springs, nothing pops, jumps or hard-clips. Kit's motion rules
are runtime defaults, not discipline.
2. **Animation never runs through app code.** Views state targets; the render thread animates.
3. **Everything observable.** Every frame, node, layout rect, spring and timing can be queried, traced and replayed.
The agent's view of the app is the same tree as accessibility's.
4. **One way to do things.** Small explicit APIs, no macro DSL for views, errors that say how to fix.
5. **Native behaviour, one look.** Text input, accessibility, scroll momentum, clipboard and window behaviour are
native per platform. Controls, type, motion and materials come from the app's theme, the same on every platform,
Mac included. The framework ships no brand of its own.
6. **Owned, not wrapped.** Depend on foundational crates (Taffy, Parley, AccessKit), never on another UI framework.
7. **Optimise for performance, correctness, speed of change and prototyping; not for human readability**.
Agents write and maintain the code, so:
- **Fast path plus reference path.** Each hard subsystem (layout, text, renderer, springs) has a slow, obviously
correct reference implementation (CPU, no tricks) and a fast one (SoA, SIMD, `unsafe` where measured, specialised,
duplicated). Every change differential-tests the fast one against the reference on generated inputs. Correctness
comes from the reference and the oracles, not from the fast code being easy to read.
- **Data-oriented everything:** flat arenas indexed by ids, struct-of-arrays, no `Rc`/`RefCell`, zero allocation
per frame (enforced by a counting allocator in tests), precomputed tables, pipelines built ahead of time.
- **Specialise by codegen, not by generics.** Generated, repetitive, per-component code is fine; deep trait towers
and proc-macro DSLs are not, because they slow compiles and bury errors. Debug builds stay type-erased and fast
to compile; release builds specialise.
- **Edits are safe because checks are instant:** invariants as `debug_assert`s everywhere, scenes, goldens,
motion/layout lint and exact perf counters run on every change, so an agent sees breakage in seconds.
- **Comments state invariants and intent for the next agent,** not prose for a human reader.
- **Perf is measured by counts** (instructions, instances, glyphs, layout nodes, allocations) so gates are exact
and bisectable; wall-clock numbers come from reserved hardware.
- **Prototypes are cheap and throwaway:** live literals, scenes, the playground and hot reload make trying ten variants
faster than debating one.
## 3. Architecture
```
┌──────────────────────── dev only: same protocol over USB/Wi-Fi ────────────────────────┐
│ │
┌────────────────┴─────────────────────────────┐ commands: tree diff, ┌──────────────────────┴─────────────────────────┐
│ APP SIDE (platform main thread by default) │ layout rects, targets, │ RENDER THREAD (display-link paced) │
│ │ springs, text runs │ │
│ models (typed state, keyed by stable ids) │ ───────────────────────────────▶ │ presented tree (what's on screen right now) │
│ view fns → keyed El tree → diff │ │ property tracks: analytic springs, retarget │
│ Taffy layout at the *target* state │ ◀─────────────────────────────── │ presence (exiting nodes), layout edge tracks │
│ Parley shaping, line cache │ events: hits, gestures, │ scroll physics, drag bindings (1:1, local) │
│ handlers: queued, get &mut model │ settles, presented-frame ids│ scene build → instance buffers │
│ AccessKit tree updates │ │ encode (Metal / wgpu) → present │
└──────────────┬───────────────────────────────┘ └──────────────┬─────────────────────────────────┘
│ platform calls │ CATransaction: Metal drawable +
┌──────────────┴───────────────────────────────┐ ┌───────────────┴────────────────────────────────┐
│ SHELL (per platform) │ │ NATIVE LAYERS (Apple) │
│ windows/panels, menus, clipboard, DnD, │ │ NSGlassEffectView / UIGlassEffect underlays, │
│ IME protocol, a11y adapter, lifecycle │ │ AVPlayerLayer, MapKit; masks driven per frame │
└──────────────────────────────────────────────┘ └────────────────────────────────────────────────┘
background pool: image decode, big-paragraph shaping, vector flattening, file IO
inspector socket (dev + test builds): tree, rects, a11y, source locations, springs, timings, traces, input injection
```
The one boundary that matters is the **command channel between the app side and the render thread**. It carries
tree diffs, target layout rects, shaped text runs and spring targets one way, and hits, gesture results, settles and
presented-frame ids the other. Three things fall out of making it a real, serializable protocol:
- **Animations survive a busy app.** When one value animates, the app side does no work at all: no view re-run, no
layout, no diff ([06](research/06-reactivity-animation.md)).
- **The iPhone hot-reload path.** In dev, the channel can run over USB: the renderer runs on the phone and the app
side runs on the Mac, where subsecond hot-patches it (§5).
- **Agents and tests get the same stream.** Recording the channel gives deterministic replay, frame traces and an
inspector for free (§6).
## 4. Each layer
### 4.1 Language: Rust
Rust is the only option with production text, layout and accessibility crates (Taffy, Parley, HarfRust, fontations,
AccessKit), no GC, reach to every target including wasm, and a working hot-patcher (subsecond). Agents write it well;
the borrow checker is the main cost, which the state model below is designed around (no `RefCell` re-entry, no
borrows held across async). Zig lacks the ecosystem and a dependable incremental patch path on Mach-O; Swift is great
on Apple and weak everywhere else; C++ gives up safety and agent reliability for nothing; Mojo isn't a UI language
yet ([04 §1](research/04-language-gpu-renderer.md)). Swift is used only for thin host pieces Apple exposes no other
way (SwiftUI-only glass morphing, the `RuneView` representable).
### 4.2 GPU API: wgpu everywhere, raw Metal on Apple only where measured
wgpu runs on every platform, since the desktop trio ships together. Zed's own move from blade to wgpu in 2026 is
the evidence that it's good enough ([04 §2](research/04-language-gpu-renderer.md),
[01](research/01-gpui-zed-warp.md)). A raw Metal (`objc2-metal`) backend behind a thin internal trait is a later
optimization, added only where measurements show wgpu falls short: precompiled `.metallib` (no shader compile at
launch), `IOSurface` zero-copy video, framebuffer fetch for cheap group opacity on Apple silicon, and exact control
of `CAMetalLayer` presentation (`presentsWithTransaction`, drawable count). Rejected: hand-written Vulkan/D3D12 (Zed
just deleted theirs).
### 4.3 Renderer
A typical frame is one render pass. Six primitives, all instanced, all clipped by a GPU clip table that gives
rounded clips **and soft gradient edges per side for free**, so "no hard edges" costs nothing extra
([04 §3](research/04-language-gpu-renderer.md)):
| Primitive | Does |
|---|---|
| `UberQuad` | rounded/squircle rects, borders, analytic Gaussian shadows (inner/outer), Oklab gradients with dithering, surface material |
| `AtlasSprite` | body text from a greyscale glyph atlas, images, emoji |
| `Slug` | big, rotating or scaling text and icons straight from Bézier curves (patent dedicated to the public domain on 2026-03-17; reference shaders MIT/Apache) |
| `SparseStrips` | complex vector art via `vello_gpu` (Linebender moved compute Vello to `research/` in 2026) |
| `Backdrop` | in-app blur/saturate of what's already drawn (dual Kawase, scissored), with Scrawl's peak-alpha boost for legible blurred text |
| `NativeSurface` | zero-copy video and camera frames |
Plus: offscreen layers only when needed (group opacity with blur, cached complex subtrees), dirty-rect scissoring
for idle-ish frames, linear-light blending, Display P3, and dithering on every gradient and shadow (Kit's GPUI fork (`kitlangton/gpui`)
fixes, now partly upstream).
**Frame pacing and latency.** `CADisplayLink` with `preferredFrameRateRange` up to 120 while anything animates, zero
ticks at rest. Discrete input (key, click) draws immediately instead of waiting for the next tick, with at most two
drawables in flight. Animation time is the display link's *target* timestamp, so a late frame still lands on the
right pose. `CAMetalDisplayLink` is suspect: one 2026 measurement shows windowed macOS scheduling it 3–5 refreshes
ahead ([04 §4](research/04-language-gpu-renderer.md)); spike S3 checks this before we rely on either.
### 4.4 Compositing with native layers (Apple)
*Optional now that Rune carries OpenCode's look on every platform; kept for Kit's Mac surfaces (M4).*
Rune can't draw Liquid Glass: the shaders that sample behind the window live in the window server. So the Apple
shell composes **native underlays and overlays** with Rune's Metal layer: a system glass view sits behind a
transparent region of the Metal layer, and its shape is driven by a mask layer that the render thread updates in the
same `CATransaction` as the drawable (`presentsWithTransaction`). This is how Scrawl's Metal pill already hosts
`NSGlassEffectView`, and the launcher's CA glass recipe is the fallback material backend
([11 §2](research/11-platform-shells.md)). Popovers, HUDs and pills use a
fixed, transparent, max-size surface with shape hit-testing, never per-frame window resizes.
Two caveats: glass *morphing* between shapes is SwiftUI-only on iOS, and NSViews are main-thread objects. Spike S2
measures whether a glass underlay can track a Rune-animated shape at 120 Hz with the main thread blocked.
### 4.5 Text
- **Fonts and shaping:** HarfRust (pure-Rust HarfBuzz port), skrifa/fontations (hinting, variable fonts, COLRv1),
fontique (system fonts and fallback), plus SF's tracking tables on Apple.
- **Layout:** Parley for bidi, line breaking, rich text and inline boxes, wrapped in GPUI's two-tier cache (shaped
runs separate from wrap points), so resizing a container never re-shapes text
([05](research/05-text-ime-a11y-layout.md)). Overflow is a soft fade mask by default, never an ellipsis.
- **Rasterizing:** greyscale atlas, 4× horizontal subpixel positioning, and the kitlangton/gpui luminance glyph dilation
that fixed "thin text" by matching macOS font smoothing. Text under a scale animation switches to Slug outlines so
springs never re-rasterize glyphs every frame.
- **Quality bar:** a side-by-side diff against CoreText on the same strings (spike S5). If Rune text doesn't match
native on a Retina Mac, nothing else matters.
### 4.6 Text editing and IME
Zed's `sum_tree` and rope for storage (O(log n) UTF-8↔UTF-16 offsets, large files). Each platform's real protocol,
implemented directly: `NSTextInputClient` (with `doCommandBySelector:` for Kit's key bindings), `UITextInput` plus
`UITextInteraction` on iOS (selection handles, loupe, autocorrect, dictation, marked text), `InputConnection` on
Android, TSF on Windows, `text-input-v3` on Wayland, and a sliding-window hidden `<textarea>` on the web (Zed's
`gpui_web` approach) with `EditContext` where available. This is the single riskiest area; Flutter's iOS text shim is
3,400 lines and still feels off ([03](research/03-flutter-apple-rive-figma.md)).
### 4.7 Layout
Taffy (flexbox, grid, block) running over Rune's own node arena through its traversal traits, so there's one tree,
not two. Agents already know flexbox. Huge lists use a sum tree of row heights (cached or estimated) and build views
only for visible rows plus overscan. Layout runs once, at the *target* state; layout animation is the render thread's
job (§4.9). Rejected: an own engine (no gain worth the cost), SwiftUI-style proposals (agents know it less well, and
it's harder to make incremental).
### 4.8 State
A keyed retained tree rebuilt from plain view functions ([06 §1](research/06-reactivity-animation.md)):
```rust
fn pill(cx: &mut Cx, rec: &Model<Recorder>) -> El {
let r = cx.read(rec); // reading subscribes this view; no notify() to forget
row().key("pill")
.padding(tok::space::S2).gap(tok::space::S1)
.shape(Shape::Capsule)
.material(Material::Glass)
.motion(tok::motion::MORPH) // layout + shape changes animate on this spring
.child(dot().key("dot").fill(tok::color::RECORD).present(r.recording)) // exits animate, then unmount
.child(text(r.elapsed()).key("time").style(tok::type_::MONO_CAPTION))
.on_press(rec, |r, _| r.stop()) // queued between frames, gets &mut Recorder
}
```
- App state lives in typed `Model<T>`s in a store, outside any view, keyed by stable ids. That's what lets state
survive hot patches.
- Views return a type-erased `El` (fast compiles, small generics surface). Keys are explicit.
- Handlers never run inside render, so there's no double-borrow panic.
- High-frequency values (audio meters, scroll offset, drag position) never go through models; they bind straight to
render properties.
Rejected: fine-grained signals (state lost on reload, reads outside tracking silently do nothing), GPUI's entities
(re-render on the main thread for animation, re-entrancy panics), immediate mode (rebuilds everything every frame;
fine for tools, wrong for feel).
### 4.9 Animation, a first-class primitive
- **Springs** are `Spring::new(duration, bounce)` with ω = 2π/duration and ζ = 1 − bounce, exactly SwiftUI's
parameterisation (the launcher's convention differs by ~20%; Rune standardises). Default tokens come from
Kit's motion presets.
- **Every property is a track** of analytic segments `{t0, x0, v0, target, spring}`: position and velocity are exact
at any time, so retargeting samples `(x, v)` at the presentation time and starts a new segment. This is
Psychopomp's model generalised.
- **Layout animation** animates each *edge* of a node whose frame changed, one spring per axis. A stationary edge
gets no track so it can't jiggle; width can lead with a faster X spring; shapes, borders and shadows are drawn at
the presented size, so there's no scale distortion. Both edges snap to 1/64 px.
- **Presence:** removing a keyed node moves it to *exiting*; it leaves flow, plays its exit and unmounts only once its
opacity has settled at 0. A key that returns mid-exit revives from where it is.
- **Gestures:** drags apply 1:1 on the render thread (no animation on Kit's own hand); release hands velocity to a
spring. Scroll physics are per platform (iOS: 0.998/ms deceleration, 0.55 rubber band; macOS: the OS's momentum
phases).
- **Kit's rules as defaults:** nothing animates on first mount, direct manipulation is instant, reduced motion swaps
travel for a short fade per property class, blur only on things entering or leaving in place, soft masks on every
clip.
- **One clock** with time scale (slow-mo), pause and manual stepping, shared by tests, traces and the inspector. The
render thread emits motion-trace JSONL natively, with exact "this was animated on purpose" flags.
## 5. Hot reload
Goal: edit to pixels in under 300 ms with state kept, on the Mac and on a connected iPhone. Today that's reachable
for tokens, literals and shaders; structural Rust edits measure about a second.
Code loading on a physical iPhone is a dead end for now. Subsecond explicitly excludes physical iOS devices; JIT and
loading code signed after install aren't available without a debugger; InjectionNext's device support has an
unresolved 2026 failure report; Kit's HotReloadKit is simulator- and Mac-only for the same reasons
([07](research/07-hot-reload.md)). So Rune layers it:
Views stay plain Rust; there is no separate view language.
| Layer | What changes | How | Target (edit → presented frame) |
|---|---|---|---|
| 0. Tokens and knobs | colours, spacing, type, springs, any `Tunable` | token file watched; render thread re-resolves live, in-flight springs retarget | ≤ 50 ms Mac, ≤ 100 ms iPhone |
| 1. Live literals | any edit that only changes literals in view code (a number, colour, string, spring, enum variant) | Xcode-Previews-style: in dev builds a macro gives each literal in a view function a `file:line:col` id; the watcher re-parses the saved file and, if only literals changed, pushes the new values down the token channel. No compile. | ≤ 100 ms Mac and iPhone |
| 2. Shaders | Metal/WGSL | rebuild the one pipeline at runtime in dev | ≤ 150 ms |
| 3. Rust on the Mac | structural edits: view functions, handlers, layout, logic | subsecond hot-patching through `dx` (the same path upstream GPUI now uses); models live outside patched code, so state stays | **measured ~1 s** (989 ms median, S1); goal ≤ 300 ms |
| 4. Rust on the iPhone | the same edits | **split-process dev mode** (below) | layer 3 + one USB round trip *(spike S4)* |
| 5. Everything else | struct layout changes, new deps | full rebuild; models restored from a snapshot keyed by id, incompatible ones reset | ≤ 2 s Mac incremental (1.85 s measured for a tiny crate); device install as fast as Xcode allows |
**What spike S1 found** ([08](research/08-spike-hot-patch.md)). Subsecond 0.7.10 hot-patches a plain Rust binary
with no Dioxus UI, keeping main-owned state across ten edits: 989 ms median, 1,150 ms p95 from save to new output
(826 ms to patch applied; the CLI's own patch time was 687 ms median), on an M2 Max build worker at background
priority. A normal incremental rebuild was 1.85 s, and cold 71 s. It also found traps Rune's integration has to
close: a single-reference closure capture silently kept running old code (use `HotFn::current(f).call(args)` at
explicit boundaries), statics and thread locals reset on patch, cached `Box<dyn Trait>` objects keep their old
methods, and adding a struct field isn't detected. So the ≤ 300 ms target holds for layers 0–2, which cover
most tuning edits; structural Rust edits are about a second. Getting those under 300 ms is M1 work: measure at
foreground priority on the Mac, keep each app's views in a tiny leaf crate, use the fastest linker, and try the
cranelift backend for dev builds. Patch boundaries are Rune's view functions and handlers, not arbitrary code; a
type change in a model triggers the snapshot-and-restore path instead of a silent patch. Layer 3 ships as the
opt-in `hot` feature and `scripts/rune-dev` (see "Live Rust editing" in [`crates/rune/README.md`](crates/rune/README.md)).
**Split-process dev mode.** In dev builds the iPhone runs a generic Rune "player": shell, renderer, render thread,
animation, text rasterizing, scroll and drag physics. The app side (models, views, layout, shaping) runs on the Mac
as an ordinary process that subsecond can patch, and talks to the phone over the same command channel the two
threads already use (§3), across USB. Because animation, scrolling and drags run on the phone, feel is local; only
discrete state changes cross the cable (~1–3 ms each way over USB, to be measured). Platform services the app calls
(haptics, camera, keyboard, permissions) go through Rune's capability interfaces, which are injected anyway for
deterministic tests, and in dev mode are proxied to the phone. React Native's old remote JS debugging ran app code on
the desktop the same way; the difference here is that the protocol is the one Rune ships in production between
threads, not a debug-only bridge. Release builds are a single native binary with no player and no socket.
What it can't do: measure real on-device app-side performance (use a native build for that), or exercise iOS-only
code paths in the app side without the capability proxy. Both are acceptable for a dev loop.
State rules (from React Fast Refresh and Flutter): model state survives any patch whose type is unchanged; view-local
state keyed by explicit string keys survives; a changed struct layout resets only the affected models (or migrates
via a declared function); each reload is applied atomically and acknowledged by its first presented frame id, which
is what the latency numbers measure.
## 6. Agent tooling
Agents need to build UI, look at it, and prove it works without a person. Built in from the first commit
([09](research/09-agent-native-and-perf-targets.md)):
- **Scenes.** Every component registers named scenes (states with fixture data and fake services), like
`scrawl lab pill tap-then-area`. Scenes render in the real app, offscreen in tests, and in a gallery.
- **Headless, deterministic rendering.** Offscreen Metal (and wgpu) with pinned fonts, fixed clock, seeded randomness
and a recorded environment manifest. Two pixel lanes: exact hashes on a pinned worker, and per-platform baselines
with explicit tolerances. Failures save expected/actual/diff plus the tree.
- **Inspector protocol** (versioned JSON over a socket, CLI and GUI are clients): query nodes by role/key/text,
layout rects, styles, a11y roles, the source `file:line` of the view that made each node, live springs and their
tokens, per-phase timings, and input injection with exact timestamps.
- **Time control:** pause, step, scale, seek. `settle` with a deadline that lists what's still pending, instead of
"wait until idle".
- **Traces:** motion-trace JSONL from the render thread (no recorder needed), the internal layout linter's rules ported to the layout
tree, Perfetto/Tracy spans per phase, presented-frame ids.
- **Auditing:** `App::playground` lists every scene and page inside the running app, live, with light/dark,
sizes and reduced motion; tunables are plain constants edited under hot reload.
- **APIs agents can't misuse:** no notify to forget, no borrows across `await`, explicit keys, errors with fixes
("`Text` has no key inside a dynamic list; add `.key(id)`"), `llms.txt`, and examples that are also tests.
The CLI, sketched:
```
mk run [--device iphone] [--split] # app with hot reload; --split = split-process dev mode on the phone
mk scenes / mk snap <scene> [--at 0.25s] # list scenes; render one to PNG + tree JSON, deterministic
mk inspect <query> # e.g. mk inspect 'role=button text~"Stop"' → rects, source, springs
mk trace <scene> --script tap.json # motion-trace JSONL + frame timings; mk lint runs motion/layout rules
mk run --playground [scene] # open the app in its playground
mk bench <workload> # the perf workloads in §8, with machine manifest
```
## 6b. Guarantees and built-in motion debugging
Things few UI libraries promise, which owning the whole stack and a deterministic clock make possible. Each one is
checked automatically, not by eye.
**Motion you can prove is smooth (Kit's motion toolkit, built in).** Everything Kit's motion tooling does today
with external recorders becomes part of the runtime, because Rune owns every presented value on every frame:
- The motion linter's rules (pop-in/out, opacity/size/shape snaps, jumps, reversals, jitter, clip snaps, overlaps,
flicker, hitches, fade cutoffs, stop-dead, velocity snaps) run live in debug builds, every frame, with the node, its
spring token and the source `file:line` in the finding; in tests they are hard failures.
- Animated properties can only change through tracks, so a one-frame jump can't be written; a node can't unmount at
opacity > 0; persistent items can't blur; stationary edges are two-edge snapped to 1/64 px.
- A motion-inspector overlay (an idea from a private iOS client): live presented rects, velocities, active springs and their
tokens, intent flags, hitch markers, drawn over the app; toggled by a key or the inspector.
- Render-time slow motion and frame stepping (true time scale, not stretched video), plus `rune trace` → motion-trace
JSONL, frame strips and slowed before/after clips produced from deterministic
replays, so a fix is shown with evidence before Kit looks.
- Every hitch is charged to the named interval and node that caused it (HitchProbe-style), with the phase
(view, layout, shaping, encode, GPU) that ran long.
**Other guarantees, in rough order of how soon:**
| Guarantee | How it's checked |
|---|---|
| **Instant first frame.** The first frame is rendered at build time (per appearance and common window size) and shown the moment the process starts; the live tree takes over invisibly once ready. Target: pixels in ≤ 50 ms from process start on a cold launch. | Launch timestamps in CI; a golden diff between the pre-rendered and the first live frame must be zero (no visible handoff). |
| **No dropped frames by budget.** Each scene's cost (instances, glyphs, layout nodes, shaping, allocations) is counted exactly; CI fails if a scene exceeds the 8.33 ms budget model for the reference device. | Exact counters, bisectable; wall-clock confirmation on reserved hardware. |
| **Zero cost at rest.** No ticks, no GPU submissions, no wake-ups once settled. | Counters over a 10 s idle sample. |
| **Real contrast.** Text contrast is checked against the actual composited pixels behind each glyph (after blur and glass), in every theme. | Per-scene accessibility pass. |
| **No clipped text, any locale or size.** Every scene is fuzzed across window sizes, text scale, long German, RTL, CJK, light/dark; fails on overflow, overlap, hard clips, tap targets < 44 pt, off-spine alignment (layout-linter rules). | Scene fuzzing in CI. |
| **Every pixel traces to code.** Any pixel → node → `file:line` → commit; screenshot diffs explain themselves. | Inspector query; PR visual diffs. |
| **Bug reports are replays.** Sessions record inputs and timing (KB, not video) and replay to identical pixels; Scrawl attaches one. | Replay determinism test on every change. |
| **Same pixels on every platform** for the canonical lane, from a CPU reference renderer that the GPU path is diffed against. | Differential renderer tests. |
## 6c. Research round 2: tricks to use
Six more notes ([12](research/12-research-rendering.md)–[17](research/17-research-perf-architecture.md)), aimed
at cutting-edge work that suits agent-maintained code. Web search was down for most of these agents, so many sources
were recalled rather than re-read; each note marks which. Cite-check before relying on a number.
**Adopt now**
- **Sample every animation at the display's target presentation time**, never "now". Frame-time *variance* hurts
perceived smoothness more than average fps (12 ms variation is noticeable, 4 ms barely); with analytic springs a
late frame is a time gap, not a velocity jump ([15](research/15-research-motion-perception.md)).
- **Smoothness metrics from the frame trace:** position error against the ideal analytic value, hitch-time ratio,
cadence deviation, velocity continuity at retarget, plus a jitter fuzzer in CI ([15]).
- **Late-latched input on the render thread** with Android's resampling constants, the impulse velocity estimator
(least-squares as reference), tuned on a recorded gesture corpus. Hand springs measured velocity, never predicted
([13](research/13-research-latency-startup.md), [15]).
- **Text under motion:** snap y, ¼-px x phases while moving, end the track at the analytic settle time to avoid
shimmer; spatial springs may overshoot, opacity/colour springs never do ([15]).
- **CPU reference renderer:** `crates/rune-ref` evaluates Rune's own instance formulas on the CPU, the exact lane
with hash goldens; GPU lanes get per-channel tolerances, because the WGSL spec allows FMA fusion and
reassociation, so GPU bit-exactness can't be promised ([24](research/24-reference-renderer.md),
[12](research/12-research-rendering.md), [14](research/14-research-determinism-verification.md)).
- **Differential fuzzing of fast vs reference** from one structured scene generator (Vello's
`cpu_gpu_differential` fuzz target is the model), plus metamorphic and model-based tests from the same generator
([14]).
- **App-level record/replay** (inputs, clock, RNG, a state hash per frame, periodic keyframes for seeking); `rr`
doesn't run on macOS ([14]). The command channel becomes a byte SPSC ring that doubles as the replay log
([17](research/17-research-perf-architecture.md)).
- **Exact CI gates:** instruction counts (gungraun) and allocation counts on Linux, shuttle for the app↔render
thread handoff, Miri on every PR ([14]).
- **Pixel provenance:** the CPU renderer also writes a node-id buffer, so pixel diffs blame a node and its
`file:line`; a semantic diff (tree, rects, springs) runs before the pixel diff ([14]).
- **Per-node dirty classes** (Unreal Slate's model) with early cutoff: one measured case went 34 ms → 0.35 ms for
10k widgets ([17]). A **per-frame arena** built into `El`'s lifetime, with a counting-allocator test ([17]).
- **Blur and shadows:** Jimenez-style pyramid backdrop blur with a fractional radius (an animated radius never
steps), capped radius with upscale; closed-form blurred rounded rects and shadows; Oklab with deterministic dither
([12]).
- **Startup:** precompiled shaders / Metal binary archive and parallel init so device, fonts and pipelines stay off
the first-frame path; the first-frame layer of §6b with a bit-identical handoff gate; order-file/PGO layout trained
on replayed command streams ([13], [17]).
- **Compile speed:** no debug info for dependencies (22–30% faster clean builds in one measured project); skip
Cranelift on Apple for now (unwinding/ABI gaps) ([17]).
- **Agents:** one component catalog generated from the Rust definitions (schema, `llms.txt`, validator, prompt),
props that accept only theme tokens, a single `rune check` (build → render scene → layout/motion lint → tree
diff → fixes keyed to source), a compact text tree with stable ids derived from keys ("tap n17"), and a small
Rune-Bench of 30–50 scenes measuring first-try correctness ([16](research/16-research-agent-generative-ui.md)).
**Spike**
- **Springs evaluated on the GPU.** Two notes reached this independently ([12], [17]): instances reference
transform/clip/effect property nodes (Chromium's property trees) whose analytic spring tracks a shader evaluates,
so an animating frame costs the CPU about one uniform write regardless of how many things move. Verified against
the CPU evaluator. Spiked as opt-in translation/opacity tracks in `crates/rune-gpu/src/springs.rs`.
- Liquid-glass lens in our own shader (SDF height field, refraction, dispersion, smooth-union morphing) ([12]).
- Word-level FLIP when text reflows during a resize ([15]); Slug for scale-animated text ([12]).
- Runtime-generated UI: an A2UI-shaped protocol (flat ids, separate data model, patches) on the command channel, with
validate-then-commit, budgets and capability grants ([16]).
- Perceptual diffs (NVIDIA FLIP) and Kani on core invariants ([14]).
**Effects: motion blur and friends.** Research [15] said motion blur isn't needed at 120 Hz,
but Kit wants it as an effect, and Rune can do it better than anyone because every track is analytic: true
**shutter motion blur** samples a node's exact position/scale/opacity at several instants inside the frame's shutter
interval (sample count scaled by on-screen speed, zero cost at rest) and accumulates them, instead of guessing from
velocity; a cheap directional blur along the analytic velocity is the fallback for big surfaces. Shutter angle is a
motion token and a knob, so Kit tunes it live (and can say where it belongs: flings, page/camera moves, flights like
the timeline's send flight). Kit's "persistent items never blur" rule is about Gaussian blur during reorders;
motion blur is a separate, opt-in effect that Kit judges by eye. Same family, all spikes: liquid-glass lensing, glow
that cools rather than cuts, feathered streaming-text reveal (from Desktop's timeline-motion branch), soft edge masks
everywhere.
**Skip:** GPU-driven indirect draws and partial present for now ([12]); synthetic motion blur at 120 Hz (maybe for
flings only) ([15]); process snapshot/restore for GPU state ([13]).
**Open:** whether wgpu exposes enough Metal present control and framebuffer fetch, or the Apple shell must own
`CAMetalLayer` and a raw Metal backend sooner ([12], [13]).
## 7. The design language
Rune ships a design system, not just primitives:
- **Theming is a framework feature; no theme is baked in.** Rune defines a semantic token schema (background
layers, text, icon, border, accent, status colours; space, radius, type scale, elevation, materials, motion) and
components read only semantic tokens. A theme supplies values for light and dark, can be switched at runtime (every
colour retargets on a spring), can be derived from seed colours, and can be loaded from data (for hot reload and
user themes) or generated as Rust constants. Colour in OKLCH/P3. A lint fails on raw style literals in app code.
The core ships one plain neutral default so examples render.
- **OpenCode's theme is the first consumer and the main example,** in its own crate outside the core
(`themes/opencode` or an example): generated from `@opencode/ui`'s theme (`packages/ui/src/theme`:
`desktop-theme.schema.json`, 36 themes with seed colours; the `--v2-*` semantic tokens in `styles/tokens/`), the
same source that feeds Tailwind on the web. The pipeline's output should be a Rune theme,
not changes to Rune. Motion tokens default to Kit's motion presets.
- **Components are generic and themable.** The OpenCode example kit can mirror `@opencode/ui`'s names and variants
(card, list, popover, context-menu, hover-card, text-field, collapsible, scroll-view, …) so screens port from the
Solid app by name, and its screenshot tests diff each component against its web story.
- **Materials:** in-app blur and tinted surfaces everywhere; system Liquid Glass on Apple only as an optional extra
via underlays.
- **Motion:** Kit's palette (instant, snappy, default, calm, smooth, morph, playful, slow) as named tokens with
enter/exit pairs; transitions as primitives (morph one surface, width leads, soft exits).
- **Components** grown from dogfooding, not designed up front: capsule/pill, chips, list rows with selection, search
field, menus and command palette, tray/popover morph, toast/HUD, sheet, segmented control, keycap. Each with scenes,
a11y, reduced motion and knobs.
## 8. Performance targets
Reference devices get pinned before any number becomes a gate (a 120 Hz Apple-silicon Mac and a ProMotion iPhone,
never a developer's desk display). CI runs deterministic correctness on every change and performance on reserved hardware
([09 §C](research/09-agent-native-and-perf-targets.md)).
| Metric | Target |
|---|---|
| Mac hello app, fresh process → first presented frame | p50 ≤ 150 ms, p95 ≤ 200 ms live; ≤ 50 ms with the pre-rendered first frame (§6b) |
| iPhone hello, app entry → first present | p95 ≤ 250 ms |
| Event → presented frame (software, 120 Hz) | p50 ≤ 8.3 ms, p95 ≤ 16.7 ms; app-side dispatch → submit p95 ≤ 4 ms |
| Physical key → photon (Mac, photodiode rig) | p95 ≤ 35 ms, compared against native AppKit on the same rig |
| App-side work while one value animates | zero (no view, layout or diff) |
| 1,000 spring-animated quads at 120 Hz, Mac and iPhone | CPU p95 ≤ 4 ms, GPU p95 ≤ 4 ms, < 0.1% missed presents |
| Effects scene (Scrawl and launcher glass morph, blur, masks, shadows) | same budget |
| 1M-row list (fixed and variable height) | list CPU p95 ≤ 1 ms / 2 ms, first viewport ≤ 100 ms, ≤ 200 realized rows |
| 100 MB text file (Mac) | first usable viewport p95 ≤ 250 ms, peak extra memory ≤ 2.5× file size |
| At rest | zero animation ticks and zero GPU submissions |
| Idle memory | Mac ≤ 50 MiB RSS, iPhone ≤ 40 MiB footprint |
| Binary | Mac stripped arm64 hello ≤ 5 MiB |
| Reload: tokens / live literals / structural Rust edit on Mac / same on iPhone split | ≤ 50 ms / ≤ 100 ms / ≤ 300 ms goal (≈ 1 s measured) / Mac + USB |
| Incremental compile after a view edit | ≤ 2 s on the build worker |
## 9. Risks
1. **Text input and text quality.** Desktop IME on three platforms comes first now; iOS `UITextInput` (selection handles, loupe, autocorrect, dictation, marked text)
is where custom-rendered frameworks most visibly fail, and text that's a shade thinner than CoreText reads as
cheap. Mitigation: implement the native protocols directly from day one of each platform, borrow Zed's macOS/iOS
code, and gate on a CoreText side-by-side diff.
2. **Matching OpenCode Desktop's look.** The bar is a Chromium-rendered app (the reason Slint with Skia was
considered). Text rendering on Windows/Linux, shadows, gradients and borders must be indistinguishable from the web kit
or better. Mitigation: per-component screenshot diffs against the `@opencode/ui` stories, rendered by headless
Chromium beside Rune's headless renderer. (Native glass sync is now an optional-extra risk, spike S2.)
3. **Scope.** Renderer, text, IME, a11y, six shells, tooling: this is years of work for a human team. Mitigation:
agents write it, but only inside the verification harness (scenes, goldens, traces, perf gates) built first;
ship one real surface at a time and delete the old one each time; depend on Taffy/Parley/AccessKit instead of
rewriting them.
4. **Accessibility** on every platform (AccessKit's iOS and Android adapters are young). Use the a11y tree as the
inspector tree so it's exercised by every agent test.
5. **Platform feel drift** (scroll, menus, focus rings change each OS release). Keep those native or measured against
native, as Flutter does with its scroll-physics overlay test.
6. **Split-process dev mode** is new. If S4 fails, fall back to subsecond in the simulator plus token/knobs reload on
the device, and fast full installs.
## 10. Milestones
**M0 — Spikes (1–2 weeks).** Each answers one question with a number.
| Spike | Question | Where |
|---|---|---|
| S1 hot patch | edit → patched function running, with state, via subsecond in a non-Dioxus Rust binary | **done:** works; 989 ms median, 1,150 ms p95 ([08](research/08-spike-hot-patch.md)) |
| S1b fast patch | same edit at foreground priority, views in a leaf crate, fastest linker, cranelift: can it reach 300 ms? | build Mac |
| S2 glass sync | can an `NSGlassEffectView` underlay track a render-thread-animated shape at 120 Hz with the main thread blocked, no edge glitches? | GUI test Mac, recorded off the desk display |
| S3 pacing | `CADisplayLink` vs `CAMetalDisplayLink` latency and stability; immediate draw on input; event → present numbers | **probe built:** `CVDisplayLink` and `CADisplayLink` both tick at 120 Hz; Rune paces one submission per tick ([native-pacing](scripts/native-pacing/README.md)) |
| S4 split mode | renderer on an iPhone, app side on the Mac over USB: round-trip latency and edit → pixels | build Mac + an iPhone |
| S5 text | Parley + atlas + dilation vs CoreText, pixel diff on 200 strings at 1× and 2× | **done:** raster and blend calibrated against CoreText ([23](research/23-text-quality.md)) |
**M0.5 — Rendering smoke test (now).** Before any of the theming or component work: one small window (a settings
panel) that proves the basics render correctly. Rounded rects, borders, shadows, soft edges, crisp text that isn't
thin, correct Retina scale, a few springs, clicks. Checked by headless `--snap` renders and frame sequences, then
by Kit on a real window.
**M1 — Theming, gallery, docs site (now).** Rune's token
schema and theme system, with the OpenCode theme generated from `@opencode/ui` as its first consumer; core tree, Taffy, springs and presence, wgpu renderer (`UberQuad` + atlas text with
dilation), winit window, scenes, `--snap` headless goldens, inspector, motion traces, playground. A gallery of the
first components with the same names as the web kit, each diffed against its web story. A docs/marketing site that
explains Rune with headless-rendered stills first and live WebGPU demos once the web build works. The settings demo
being built now is the seed.
**M2 — Hex Settings on Mac, Windows and Linux.** The first real screen. Forms, toggles, keycap recorder, lists,
text field (own shells start here: `NSTextInputClient`, TSF, `text-input-v3`), AccessKit, CI goldens on all three.
Replaces GPUI for that screen in Hex.
**M3 — OpenCode Desktop's main screens.** Sidebar and session list, the streaming transcript (markdown, code blocks,
tool pills), composer, diff view, command palette, popovers and menus, at 120 Hz with Kit's motion. Done when it looks
like OpenCode Desktop side by side and feels clearly better, on all three desktops. This is the flagship test.
It runs against **real data**: a live mode connects to the OpenCode server (by default `127.0.0.1:4096`, with basic auth
read from local config and never printed), lists real projects and
sessions, renders real transcripts, follows the event stream as turns arrive, and can send a prompt when Kit types one
in the composer. Not every feature, just enough to use it. Rules: agents building and testing it only use read-only
GETs and never send prompts or create sessions on the live server (never `GET /api/experimental/session/stats`);
goldens and committed fixtures are synthetic, never real session content; screenshots of real sessions stay local.
**M4 — Kit's Mac surfaces.** Scrawl pill (zero motion-linter findings, no more dropped frames than the Metal pill, Kit
picks it blind), the launcher's tray and panel, Scrawl review/Settings. Optional Liquid Glass underlays here (spike S2).
**M5 — Web.** The same app in the browser over WebGPU (docs site demos, knobs, gpu-gallery).
**M6 — iOS.** iOS shell, `UITextInput`, `RuneView` for embedding in SwiftUI, split-process dev mode; first surface
embedded in the private iOS client. **M7 — Android.**
## 11. Where Rune fits at Anomaly
One native stack for every Anomaly product, themed with OpenCode's design language (as a theme, not baked in). OpenCode Desktop is the flagship
test: recreate it and raise the bar, so every app built on Rune inherits that quality, the way Zed built GPUI for Zed
(but with the compositing, animation and text Zed's lacks). Hex Settings is the first real screen, then Hex, Scrawl
and the launcher, then the private iOS client one embedded surface at a time. Psychopomp should share Rune's spring, timeline and text
primitives rather than duplicate them. Because agents write Rune apps against scenes, an inspector and
deterministic goldens, it fits "build infinite software": every new app starts with the design language, motion and
verification harness already in place.
## 12. Open questions
1. App side on the platform main thread (default) or its own thread? Needs S3's latency numbers.
2. How far to lean on Core Animation for simple transform/opacity animations (the launcher's "promote to render server") vs
always animating on our own render thread.
3. Glass morphing on iOS needs SwiftUI: host a tiny SwiftUI glass container per morph, or accept static glass shapes
with our own morph on top?
4. Does Rune eventually *replace* OpenCode Desktop's Electron app, or ship beside it? M3 decides with evidence.
5. Text on Windows/Linux: grayscale everywhere, or ClearType-style subpixel where the web kit has it?
## 13. Web target status
The first experimental M5 target is implemented: winit 0.30 owns a single canvas, rAF and
ResizeObserver; GPU initialization is asynchronous, and a sliding textarea supplies text
services. It runs on the main thread without SharedArrayBuffer. See [WEB.md](WEB.md) and
`examples/web-hello`. Real-device Safari keyboard verification, accessibility mirroring,
WebGL fallback and EditContext remain follow-up work.
+66
View File
@@ -0,0 +1,66 @@
# Rune
A native GPU-rendered Rust UI framework for macOS, Windows, Linux and the web, with its own renderer, text, layout and springs.
Every app can run headless, so an agent can render to PNG, dump the element tree and drive it with scripted input.
<p align="center">
<a href="demo/rune.mp4">
<img src="demo/rune-poster.png" alt="Rune in motion: real apps, rune-kit components and GPU effects" width="100%">
</a>
</p>
<p align="center">
<img src="demo/opencode/session-top.png" alt="A coding agent app built with Rune" width="100%">
</p>
<p align="center">
<img src="demo/light/chat.png" alt="Lit chat interface" width="49%">
<img src="demo/kit/diff-split-dark.png" alt="Split diff component" width="49%">
</p>
<p align="center">
<img src="demo/fx/liquid-metal.png" alt="Liquid metal effect" width="49%">
<img src="demo/settings-dark.png" alt="Settings window" width="49%">
</p>
```rust
fn view(s: &State, _: &mut Cx<State>) -> El {
let t = tok::theme(true);
let label = text(if s.on { "Lights on" } else { "Lights off" })
.font(type_::TITLE).color(t.text);
let knob = el().key("knob").size(18.0, 18.0).radius(9.0).fill(t.knob)
.absolute(if s.on { 18.0 } else { 2.0 }, 2.0);
let switch = el().key("switch").role("switch").label("Lights").checked(s.on)
.focusable(true).size(38.0, 22.0).radius(11.0)
.fill(if s.on { tok::accent(0, true) } else { t.control_off })
.motion(motion::SNAPPY)
.on_press(|s: &mut State| s.on = !s.on)
.child(knob);
col().w_full().h_full().center().gap(16.0).fill(t.bg).child(label).child(switch)
}
```
## Use it with your agent
Give your coding agent this repo. Have it start from [`examples/hello`](examples/hello) and [`crates/rune/README.md`](crates/rune/README.md), then check its own work headlessly by rendering PNGs and inspecting the element tree.
> Build me a <thing> with Rune (github.com/anomalyco/rune). Start from examples/hello and check your work headlessly.
## Add it
```toml
rune = { git = "https://github.com/anomalyco/rune", rev = "<dev rev>" }
```
Rune is pre-release. Pin a rev of `dev`; `dev` is never rewritten.
On Windows, the MSVC toolchain (`x86_64-pc-windows-msvc`, rustup's default) needs only the Visual Studio C++ build tools rustup asks for. The GNU toolchain (`x86_64-pc-windows-gnu`) also needs MinGW-w64's binutils on `PATH`: `windows-link` (under `parking_lot`, `libloading`, `windows-core` and `windows-sys`, so under every Windows UI crate) imports with `raw-dylib`, rustc makes those import libraries with `dlltool` on GNU targets, and the `dlltool` in rustup's `rust-mingw` can't run without an `as` it doesn't ship ([rust-lang/rust#140704](https://github.com/rust-lang/rust/issues/140704)). Without binutils the build stops at `windows-result` with `error calling dlltool 'dlltool.exe': program not found`. Install [MSYS2](https://www.msys2.org), run `pacman -S mingw-w64-ucrt-x86_64-binutils`, and put `C:\msys64\ucrt64\bin` on `PATH` (or build with `RUSTFLAGS=-Cdlltool=C:\msys64\ucrt64\bin\dlltool.exe`).
[Docs](crates/rune/README.md) · [Components](crates/rune-kit/README.md) · [Examples](examples) · [Changelog](CHANGELOG.md)
## Contributing
We don't take pull requests. Have your agent [open an issue](https://github.com/anomalyco/rune/issues)
describing the bug or idea, and our agents usually turn it around fast.
MIT, © Anomaly.
+24
View File
@@ -0,0 +1,24 @@
# Third-Party Notices
Rune incorporates the third-party assets and libraries listed below. Original copyright notices and license texts are preserved for attribution and redistribution compliance.
---
## 1. KaTeX Math Fonts (`crates/rune-kit/assets/math/katex-fonts.pack.deflate`, feature `rune-kit/math`)
Bundled from `ratex-katex-fonts 0.1.16` (origin: KaTeX, `https://github.com/KaTeX/KaTeX`). Verbatim notices and the full SIL Open Font License 1.1 text are shipped in `crates/rune-kit/assets/math/FONT_NOTICE.txt` and `crates/rune-kit/assets/math/OFL.txt`.
- **KaTeX Fonts** (20 TrueType faces with Reserved Font Names `KaTeX_*`: `KaTeX_AMS-Regular`, `KaTeX_Caligraphic-Bold`, `KaTeX_Caligraphic-Regular`, `KaTeX_Fraktur-Bold`, `KaTeX_Fraktur-Regular`, `KaTeX_Main-Bold`, `KaTeX_Main-BoldItalic`, `KaTeX_Main-Italic`, `KaTeX_Main-Regular`, `KaTeX_Math-BoldItalic`, `KaTeX_Math-Italic`, `KaTeX_SansSerif-Bold`, `KaTeX_SansSerif-Italic`, `KaTeX_SansSerif-Regular`, `KaTeX_Script-Regular`, `KaTeX_Size1-Regular`, `KaTeX_Size2-Regular`, `KaTeX_Size3-Regular`, `KaTeX_Size4-Regular`, `KaTeX_Typewriter-Regular`)
- License: **SIL Open Font License, Version 1.1** (`crates/rune-kit/assets/math/OFL.txt`)
- Copyright (c) 2009–2010 Design Science, Inc.
- Copyright (c) 2014–2018 Khan Academy (KaTeX)
---
## 2. Sandboxed LaTeX Display-Math Typesetter (`crates/rune-kit/assets/math/ratex-math.wasm.deflate`, feature `rune-kit/math`)
Built reproducibly from `tools/ratex-math-wasm/` (`scripts/build-math-wasm.sh`):
- **RaTeX** (`ratex-parser`, `ratex-layout`, `ratex-types`, `ratex-font`, `ratex-lexer` `0.1.16`, `https://github.com/erweixin/RaTeX`) — **MIT License**
- **unicode-normalization** (`0.1.26`, compiled inside `ratex-math.wasm`, `https://github.com/unicode-rs/unicode-normalization`) — **(MIT OR Apache-2.0) AND Unicode-3.0**
- **wasmi** (`wasmi`, `wasmi_core`, `wasmi_ir`, `wasmi_collections` `1.1.0`, native host interpreter, `https://github.com/wasmi-labs/wasmi`) — **MIT OR Apache-2.0**
+296
View File
@@ -0,0 +1,296 @@
# Run a Rune app in the browser
Rune's experimental web target renders one canvas through WebGPU. It uses the same Rust
views, layout, glyph atlas and shaders as native. GPU initialization is asynchronous; the
runtime stays on the browser's main thread and requests frames only while work is pending.
## Build the example
Install the wasm target, Python 3.11 or newer, and the wasm-bindgen CLI version in Cargo.lock:
```sh
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.129 --locked
scripts/web-build.sh web-hello --out target/web
```
Serve the entire output folder over HTTPS, including `snippets/`. A local HTTP server on
`localhost` also works for development. The host must serve `.wasm` as `application/wasm`.
No application server, SharedArrayBuffer, COOP or COEP headers are required.
`--opt` additionally runs an installed `wasm-opt -Oz`; the default build does not need it.
A release build drops the wasm's function-name section, so a panic's stack shows offsets
instead of Rust names; `--names` keeps it for profiling, and `--dev` builds always keep it.
The script prints the raw and gzip wasm sizes. Configure gzip or Brotli on the static host
to get the corresponding transfer size.
```text
usage: web-build.sh PACKAGE [--example NAME] [--out DIR] [--opt] [--dev] [--watch] [--no-html] [--names]
```
The script builds with the toolchain's own cargo (`rustup which cargo`), not a `cargo` wrapper
on `PATH` that might build on another machine, and stops with a message if the wasm isn't in
the local target folder afterwards. Set `CARGO` to pick the cargo binary.
The example is a scrollable message list with a composer, Send and Copy last. Its title
opens an external link. Refreshing resets the in-memory messages.
## Edit and reload
`--dev` builds fast instead of small: the debug profile without debug info, with dependencies
(Rune included) at opt-level 1 and your package unoptimized, in its own `web-dev` target folder
so it never rebuilds the release cache. It skips `--opt`. The wasm is about twice the release
size; don't ship it. On `web-hello`, a one-line change rebuilds in about 2 s, against 12 s for
a release build.
`--watch` rebuilds whenever a file in a workspace member changes (polling, no extra tools), and
the page reloads itself after each successful build. Serve the folder from a second terminal:
```sh
scripts/web-build.sh web-hello --dev --watch
python3 -m http.server 8000 -d target/web # then open http://localhost:8000
```
WebGPU works over plain HTTP on `localhost`; from another machine the page needs HTTPS. In
watch mode the script writes `reload.js`, which polls `.stamp` in the same folder and reloads
when a build changes it, and the generated page cache-busts `app.js` and `app_bg.wasm`. A
failed build leaves the page as it was. Each build stages its files in `.next` and renames them
into place, so a page loading mid-build gets one build's `app.js` and `app_bg.wasm`. Reloading
resets the app's state.
## Your own page
The script writes `index.html` only if there is none, or if the existing one still has the
`generated by rune web-build.sh` comment, so a page of your own (with `App::canvas_id` and
`fit_content_height`, say) is kept. Delete that comment line to keep edits to the generated
page. `--no-html` never writes `index.html`. To reload your own page in watch mode, add
`<script src="reload.js"></script>` while developing.
## Give your app a wasm entrypoint
Add a `cdylib` target and a wasm-only wasm-bindgen dependency:
```toml
[lib]
crate-type = ["cdylib", "rlib"]
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "0.2"
```
Export a start function that calls the usual Rune entrypoint:
```rust,ignore
#[cfg_attr(target_arch = "wasm32", wasm_bindgen::prelude::wasm_bindgen(start))]
pub fn start() {
rune::run(AppSpec::new("My app", (390.0, 760.0), State::default, view));
}
```
From your app's workspace, run `path/to/rune/scripts/web-build.sh your-package`. The script
selects one cdylib, or one binary if there is no cdylib. `--example NAME` selects a Cargo
example. Disable Rune's `dev`, `hot` and `native-file-dialog` features on wasm. Move native
filesystem, process and thread dependencies behind target conditions in your app too.
Use `rune::time::Instant` for deadlines passed to Rune; it is `std::time::Instant` on native.
## Luau scripts
An app that hosts Luau with `rune-luau` builds for the web too: Luau's C++ compiles with
[WASI SDK](https://github.com/WebAssembly/wasi-sdk) (33 or newer) against WASI libc, using
WebAssembly exception handling. Unpack the SDK and point `WASI_SDK_PATH` at it; `web-build.sh`
then sets the C and C++ compilers for the wasm target, and `rune-luau` links the SDK's C runtime
and defines the WASI calls libc makes inside the module, so the page loads like any other
Rune app. Luau runs as its interpreter there.
```sh
WASI_SDK_PATH=$HOME/wasi-sdk-34.0 scripts/web-build.sh luau-panel --out target/web-luau
node examples/luau-panel/web-proof.mjs target/web-luau target/web-luau-proof
```
Browsers with exception handling run it: current Chrome, Edge, Firefox and Safari.
## Mount in a page
By default Rune appends its own canvas, covers the viewport and stops the body scrolling.
`App::canvas_id("id")` mounts onto a `<canvas id="id">` the page already has instead:
```rust,ignore
// Inline in an article, as tall as its content; the page keeps scrolling.
App::new(spec).canvas_id("chart").fit_content_height().try_run()?;
// Full screen inside a single-page app's route, which owns the canvas.
App::new(spec).canvas_id("route-canvas").full_viewport().try_run()?;
```
Inline, the canvas is as wide as its parent and as tall as `AppSpec::size` (or its content with
`fit_content_height`, when vertical wheel and touch pans scroll the page); safe-area insets
are zero and the title doesn't touch `document.title`. With `full_viewport` the canvas is fixed to
the visual viewport like Rune's own, so an ancestor with a `transform` or `filter` would
become its containing block; mount it outside one.
`AppHandle::quit` unmounts the app when its route goes away: the loop stops, the GPU device is
destroyed, Rune's listeners come off the page, and the body style and title it changed go back.
Rune removes a canvas it made; a passed-in canvas stays, with its own style and attributes
back, for the page to remove. One app runs per page at a time. An app started while another is
quitting mounts once that one has gone, so a route can swap apps in the same tick:
```rust,ignore
let handle = app.handle(); // keep it with the route
App::new(spec).canvas_id("route-canvas").full_viewport().try_run()?; // after handle.quit()
```
## A whole web page
`App::web_document()` makes the app the page itself, for a marketing site, docs or an article.
The root lays out at its natural height and the browser scrolls the document, so trackpad
momentum, the scroll bar, Page Down, Space, find-in-page, anchors and back/forward are the
browser's own. The canvas stays fixed to the viewport and draws the band the page is scrolled to;
a scroll moves only that band and rebuilds nothing.
Above the canvas Rune keeps a DOM mirror of the scene: landmarks (`role("main")`,
`role("region")`, `role("navigation")`, `role("contentinfo")`), headings with their level,
paragraphs, links and images, each at its element's place. Keys become element ids, so
`#views` scrolls to the element keyed `views`. Its text is transparent but real, so the browser
selects and copies it, and screen readers, crawlers and link previews read it. An element with
`El::href(url)` is an `<a href>`: middle-click, Cmd-click and Copy Link work, and a plain click
opens it in the same tab. Tab moves through the mirror's links and buttons; a press on one runs
the element's handler. The page tints selections and focus rings with `--rune-selection` and
`--rune-focus`, and sets the mirror's fonts with `--rune-sans` and `--rune-mono`, so match them
to the fonts the app draws with.
### A static first frame
`--html out.html` lays the app out without a GPU, lets entrance motion land, and writes the
scene as HTML and CSS: each element's flexbox style, paint and text, with the same tags the
mirror uses. The browser draws that page before the wasm arrives, and a reader without WebGPU
(or with scripts off) keeps a readable page:
```sh
cargo run -p site -- --html dist/index.html --html-widths 360,640,1000 --html-template index.html
```
Each width in `--html-widths` lays the page out again; the narrowest is the base and each wider
one adds a `@media (min-width)` block where it differs, so the layout holds between the widths
taken. `--html-template` fills `<!-- rune:css -->` and `<!-- rune:body -->` in a page that
carries your meta tags. When Rune's first frame is on screen it removes the exported elements
(`[data-rune-static]`), keeping the section at the top of the window where it was, and the
canvas dispatches a bubbling `runepresent` event. An image is exported as `<img>` when its
pixels came from `ImageCache::url` or `ImageCache::file`; shapes become inline SVG. Grid layout
and effects drawn by shaders (`rune-fx`, materials) aren't exported; give such an element a
fill to stand in for it.
## Images
`ImageCache::url` fetches an image and lets the browser decode it with its own codecs
(`createImageBitmap`, off the main thread), so WebP, AVIF and anything else the browser reads
work, turned upright by EXIF orientation. The pixels land through the same mip path as
`ImageCache::rgba` and the cache's waker draws the frame. `ImageCache::file` does the same on
web with its path as a URL relative to the page, so one call loads a bundled asset in both
builds:
```rust,ignore
let logo = cache.file("assets/logo.webp", 48.0, env.scale); // disk on native, fetched on web
let avatar = cache.url(&user.avatar_url, 32.0, env.scale); // size and scale matter for SVG only
```
SVG (by `Content-Type` or a `.svg`/`.svgz` path) rasterizes with Rune's renderer at the size
asked for. Images over 8192 pixels a side are refused before their pixels are read, and a
failed request or a cross-origin image without CORS headers resolves to `Image::error`.
`Cursor::Image` sets the canvas's CSS `cursor` to the PNG at 2x (`image-set(url(blob:…) 2x)`),
so the browser decodes it and draws it at its size in points on any display.
## Fonts and browser input
Web includes Inter Regular and IBM Plex Mono Regular (the `embedded-fonts` feature). There is
no system-font discovery. `App::font_url("fonts/brand.ttf")` fetches a TrueType or OpenType
font (not WOFF2) alongside GPU setup, before the first frame, and adds it to `AppSpec::fonts`;
on native it reads the same path from disk. Point the page's `@font-face` at the same file so the
browser downloads it once, and build with `default-features = false` to drop the embedded fonts.
Set `AppSpec::fonts` to static font bytes and `AppSpec::families` to your sans/mono family
names for branding, additional weights, emoji and scripts outside the default fonts.
For example, extend a static slice of `rune_theme_opencode::FONTS` with
`include_bytes!("assets/NotoColorEmoji.ttf")` and the CJK fonts your app needs, then assign
the combined slice to `spec.fonts`. Keep the theme's sans/mono family names in `spec.families`.
Missing emoji and CJK glyphs display fallback boxes; they do not trigger font downloads.
The embedded Inter is cut to Latin, Greek and Cyrillic text (Latin-1, Latin Extended-A, modern
Greek, Cyrillic, punctuation, arrows and the Mac's key symbols), under half its size. Once the
first frame is up the app fetches the full faces, `Inter-Regular.ttf`, `Inter-Medium.ttf` and
`Inter-SemiBold.ttf`, from beside `app.js`; `scripts/web-build.sh` copies them there. Text the
cut covers draws the same before and after; other text (Vietnamese, polytonic Greek, Cyrillic
beyond Russian, Ukrainian, Belarusian, Serbian, Macedonian and Bulgarian) draws in fallback
fonts or boxes until they arrive, and stays that way, with a console warning, on a host that
doesn't serve them.
In a Mac's browser text draws with macOS font smoothing (`FontSmoothing::On`), as Safari,
Chrome and Firefox draw the page's own text there, and without it elsewhere, iPhone and iPad
included. `App::font_smoothing` sets it either way.
Rust supplies the hidden textarea with up to 512 UTF-16 units on each side of the selection,
expanding for the selected range, and skips unchanged mirrors. Browser input events supply replacements; Rune validates the mirrored
context and converts window-relative UTF-16 positions to UTF-8 boundaries before editing.
Composition holds the mirror stable until commit and replaces the composing word's range.
Mobile `beforeinput` line breaks use Rune's Enter rules: submit, or Shift/Alt+Enter newline
in a multiline field. A completed touch tap focuses the editor synchronously;
a pan scrolls instead, with momentum and a damped edge return.
Secure fields use an `<input type="password">` with autocomplete, autocorrect and spellcheck
disabled. It receives only new keystrokes and is emptied after every input; the model's
secret is never mirrored into the DOM. Leaving a field returns focus to the canvas so
shortcuts and Tab keep working. Continuous pointer movement and wheel events wait for rAF.
`Tx::copy` and `Tx::request_paste` use the browser clipboard. Call them from a user input
handler: permission and transient-activation rules still apply. Native Paste events work
without an asynchronous clipboard read. Secret-copy requests report failure because the
browser cannot promise native clipboard-history exclusion or conditional timed clearing.
`rune::web::open_url` accepts HTTP(S) and mail links and opens a tab with `noopener,noreferrer`.
Call it from a user input handler. `Tx::open_url_same_tab` (or `rune::web::open_url_same_tab`)
replaces the page instead, and takes links relative to the page (`/notes/42`). A single-page
app routes those itself with `App::same_tab_router`: it gets the absolute URL of each link on
the page's origin and returns true when it handled it; otherwise, and for other origins, the
browser loads the link with `location.assign`.
```rust,ignore
App::new(spec).same_tab_router(|href| router.push(href)) // true: routed with pushState
tx.open_url_same_tab("/notes/42")?; // from a handler
```
`Cx::safe_area()` returns top/right/bottom/left insets in
points (zero on native). Apply them inside a full-canvas background. The canvas follows
`visualViewport` when a software keyboard reduces the visible height. Keep the generated
page's `viewport-fit=cover` meta tag and the textarea's 16 px font size.
## Scope and verification
This target needs WebGPU. It has no WebGL fallback (a page made with `--html` stays readable
without it), overlays,
extra windows, native menus, drag-out, native audio/video, networking layer or hot patching.
Native configuration types remain source-compatible, but their desktop host paths are not
used on wasm. Unsupported window requests warn in the console; Show/Open are ignored.
The document title follows `AppSpec::title`, and hidden tabs report `is_visible() == false`.
The functional proof uses headless Chromium and Playwright:
```sh
node scripts/web-smoke.mjs target/web target/web-proof
```
Install Playwright with its Chromium browser first. `PLAYWRIGHT_MODULE` and `CHROMIUM_PATH`
can select an existing installation. `WEB_ENGINE=webkit` tries an installed Playwright WebKit
and reports whether it has a WebGPU adapter. The proof checks GPU errors, idle rAF requests
and submissions, touch
focus and momentum, Unicode edits, a long sliding context, predictive replacement,
composition, selection, paste, copied model text, link isolation, theme and viewport resize.
In Chromium it also installs Playwright's fake clock after the app has started and checks that
a touch fling waits for `clock.runFor` instead of finishing in real time: Rune reads the page's
current `performance.now()` on every frame, so a capture can step it frame by frame.
The `?input-proof` fixture adds password input, Tab/Escape focus, mobile Enter, recomposition,
same-field focus stability, continuous-input coalescing and visibility regression checks.
Its mobile DPR check exercises the Safari-style CSS-size fallback because Chromium device
emulation does not scale `devicePixelContentBoxSize`. This is not a real iPhone keyboard,
dictation, autocorrect or Safari WebGPU test; those still need device verification.
The shell follows PLAN's winit-first approach, retaining winit 0.30's rAF and ResizeObserver
implementation. Unlike research/11's proposed custom shell, it adds a document-aware
textarea beside winit rather than replacing winit. This also defers PLAN's proposed switch
to an owned shell when text input lands. WebGL fallback and EditContext from that research
remain later work.
@@ -0,0 +1,10 @@
- **A box centred in a painted parent stays centred on the device grid.** Rounding each edge on
its own put a compact `Switch`'s knob 2 px from the top of its track and 3 px from the bottom
at 1.25× (and the same for every `ControlSize` at some fractional scale): its 2 pt inset is
2.5 px. Pixel snapping now gives a box whose resting edges are centred in its parent's equal
whole-pixel gaps to the parent's snapped edges, and lets its size round by up to a pixel to
make room: the Small knob draws 19 px in a 25 px track, 3 px from each edge. Only a parent
that paints something (a fill, border, gradient, or hover or press colour) counts, so a box
centred in a plain row keeps its own rounding. It is decided at rest, so a box gliding into
or out of a centred spot, or one whose parent grows or shrinks around it, eases between the
two roundings with no jump.
@@ -0,0 +1 @@
- **Wayland overlays set their cursor.** A layer-shell overlay never set one, so the pointer kept whatever cursor it arrived with, such as a terminal's I-beam over a card. It now shows the runtime's cursor through cursor-shape-v1, as a window does, and the arrow off its hit areas.
@@ -0,0 +1,6 @@
- **A finger can tap a Wayland layer-shell overlay.** The overlay bound `wl_pointer` and `wl_keyboard`
but never `wl_touch`, so cards and buttons drawn on a layer surface ignored a touchscreen even
though the compositor offered touch. A touch on the surface now acts as the primary button: down
presses where the finger landed, motion follows it, and up releases and clears hover, so a tap
clicks and a drag off a button doesn't. A touch the compositor cancels (a system gesture) leaves
before it releases, so it never counts as a click. One finger at a time; extra fingers are ignored.
@@ -0,0 +1,11 @@
- **An opt-in native Metal backend on macOS.** Build with the `metal-backend` feature and launch
with `RUNE_GPU_BACKEND=metal`, and Rune draws through its own Metal backend, plugged in under
wgpu's API through wgpu's `custom` backend. wgpu stays the default everywhere: without the
variable, or without the feature, nothing changes. It covers what Rune itself draws, in windows,
overlays and headless renders, with the same pixels as wgpu: render pipelines from WGSL, buffers,
the common 8-, 10-, 16- and 32-bit colour formats, samplers, copies and presentation. It doesn't
cover yet: `NativeSurface` video (it needs wgpu's backend and says so once on stderr), compute,
query sets and timestamps, render bundles, indirect and mesh draws, multisampling, depth and
stencil, more than four colour targets, ray tracing, shaders other than WGSL, and iOS. A
compositor that needs those stays on wgpu; reaching one on Metal panics with its name rather than
drawing wrong.
@@ -0,0 +1,7 @@
- **A Metal frame is one command buffer, submitted and presented where it was drawn.** On
`RUNE_GPU_BACKEND=metal`, overlays submit and present on their own thread instead of handing
the frame to a present thread, which only paid off for wgpu's costlier submit. A
`Queue::write_buffer` to a buffer that only submitted work still reads takes a spare storage
instead of a staged copy, so a compositor writing a uniform each frame adds no command buffer.
`examples/window_scroll_cost.rs` scrolls a real window and prints its CPU, instructions and
Metal calls per frame; `scripts/motion-audit` records a sticky-header scroll.
@@ -0,0 +1,9 @@
- **Uploads write in place on Metal, and only the instances that changed.** On
`RUNE_GPU_BACKEND=metal`, buffer writes through `Staging` and `Queue::write_buffer` go straight
into the buffer's shared memory; while the GPU may still read the old bytes, a spare brought up
to date takes the buffer's place, so a frame records no copy and allocates no buffer.
`rune_staging::set_direct` registers such a writer, and `Stats::direct` counts its writes. On
every backend, `Renderer::prepare` writes each span of instances that changed instead of
everything from the first to the last, so a frame where a few far-apart instances move uploads
only those. `examples/upload_bench.rs` also prints the instructions a frame ran (`kinstr`), which
a busy machine leaves unchanged.
@@ -0,0 +1,4 @@
- **App installs keep the bundle present.** `scripts/mac-app` shares a per-target
lock with HiveMind, stages each install separately, and atomically exchanges
bundles. A failed launch or missing Rune ready receipt restores the previous
bundle; interrupted installs retain both complete bundles for recovery.
@@ -0,0 +1 @@
- Growth stacks: when a commit changes the gap above a row's contents and the row's height with it (a row that stops sitting close to the one above it), the contents now slide as the row's growth opens instead of on their own spring. In a list pinned to its end, where the row moves by what it grows, contents whose place doesn't change hold still on every frame, instead of sinking about half a point and coming back. A `Tx::launch` flight that has as good as landed (within a quarter of a device pixel of its place, held up only by its springs' settle tails) and that a commit would re-aim now lands and rides its row, instead of setting off on a new path that lags the scroll under it and sinks a few points.
@@ -0,0 +1 @@
- The motion audit no longer reports a `dog-leg` for an element whose own move is straight against its moving parent, as a chevron that slides along its row while the list scrolls: its path bends on screen only by the parent's motion. An L-shaped move of its own, on a moving parent or a still one, is still reported.
@@ -0,0 +1 @@
- **Effect slots carry their tag and a payload to the compositor.** `EffectSite::mark` is the slot's `El::effect` tag, so a hook no longer needs `Runtime::marks` (or `track_marks`), and `El::effect_data([f32; 4])` sets four floats the hook reads as `EffectSite::data`, bit for bit. Both ride in the slot's record (`border[0..2]` and `uv`), so a removed element keeps the payload it was last built with through its exit fade while its replacement enters beside it, with no bookkeeping in the app. `compose::Compositor` documents the pattern: draw through `Renderer::draw_with`, keep resources per mark, drop a mark's once a frame passes without it. The slot's rect and `scale` follow `El::scale`, `El::offset` and a transition's scale and offset; under `El::rotate` the slot stays upright inside a turned layer.
@@ -0,0 +1,10 @@
- **`El::enter_delay` holds a whole entrance.** A new element waits the given seconds at its
transition's insertion effect, then offset, scale, blur, opacity and reveal play together on one
progress, so a staggered list (`.enter_delay(Stagger::new(0.05).delay(i, n))`; `Stagger` and
`StaggerFrom` are now re-exported) no longer shows rows sliding before they fade. It takes its
place in layout at once, runs on the element's and the window's time scale, and keeps its
delay under Reduce Motion, where the entrance is the short fade. The first frame, instant and
settle commits, hidden windows and rows out of sight ignore it; removed while it waits, a row
that fades in goes at once. A window that only waits for a delayed start, from `enter_delay` or
a delayed `Anim`, draws nothing and wakes once when it starts, and the store no longer samples
such tracks every frame.
@@ -0,0 +1,8 @@
- **`El::fold_glide(spring)`: a growth-stack row that folds like a disclosure.** Its height
changes glide on its own spring in place of the stack's, for the spring's own time however far
they go (no `WHOLE_REACH` stretch, no `Tx::motion` floor), and keep their velocity when
reversed mid-glide. Only what shows of the row moves: shutting, the part below the window goes
at once; opening, the spring carries the row to the window's edge and the rest lands there, so
a 2,000 pt group shuts as fast as a 200 pt one. Its feather rides the spring and ends with it.
Implies `El::arrives_whole`. The growth-stack builders (`growth`, `streaming`,
`arrives_whole`) moved from `el.rs` to `el/growth.rs`.
@@ -0,0 +1 @@
- **`Tx::set_font_families(sans, mono)` switches the fonts behind `Family::Sans` and `Family::Mono` while the app runs**, for a UI or code font picker. Every window and overlay follows on its next frame, and one opened later starts in the new families. Each drops the layouts and glyph runs shaped in the old families, re-runs memoized subtrees and re-measures every text, then draws one frame. `rune::text::measure` and `ink` follow too, and so do rune-kit's table column widths and rune-mermaid's diagram layouts. A cache of measured sizes outside Rune should key on the new `rune::text::font_epoch()`. A missing family falls back as it does at launch, and asking for the families already in place does nothing. `Runtime::set_font_families` and `Runtime::font_families` do the same outside a handler. A 50 KB Markdown note re-shapes in about 34 ms. Apps change nothing.
@@ -0,0 +1 @@
- **`App::gpu_backend(GpuBackend::Metal)` turns on the native Metal backend from code.** An app launched from Finder can't set `RUNE_GPU_BACKEND`, so the choice now lives on the app, with Rune's `metal-backend` feature. `RUNE_GPU_BACKEND=wgpu` or `=metal` still overrides it without a rebuild. It applies process-wide from the call on, and a `prewarm_gpu` already running on the other backend starts over on the chosen one, so calling `prewarm_gpu` first in `main` keeps working. Without the feature it says so once and draws with wgpu; off macOS it does nothing.
@@ -0,0 +1,4 @@
- **`El::hover_alone`: a hover target that keeps the row around it unlit.** While the pointer is
on an element marked `hover_alone`, the elements it sits inside show no hover overlay and
their `group_*` styles rest, as if the pointer had left them; back on the row they light
again. For a face or button inside a hoverable row. Paint only, with no commit.
@@ -0,0 +1,7 @@
- **Commits under `El::hover_motion_within` no longer copy every node's visuals.** Each node
inherited the pair by writing it into its own visuals, which gave every node below such a
root (the docs suggest setting it on the root) its own copy of the rarely-set visual fields
on every commit, and sent apply down its shadow and gradient path for all of them. The pair
now rides beside the visuals. A 2,300-element card's commit drops from 1.9 to 1.6 ms
headless, and a long board card's committing frames from about 11 to 9 ms. Removed nodes
that drew nothing are also matched against the last build in step instead of through two hash maps.
@@ -0,0 +1 @@
- Debug builds warn once on stderr about three more slow patterns: a `poll` that returns true for 30 frames in a row while nothing on screen changes, a window that draws 120 frames within 2 s with no input, motion or visible change (naming what woke it, such as a `wake_after` loop), and a launch whose `main` setup, `init` and first view take over 100 ms before the first frame (naming the slowest part and pointing to `on_ready`). `RUNE_PERF_WARN=0` silences them; release builds are unchanged.
@@ -0,0 +1 @@
- **Images decode on up to four threads.** An `ImageCache` runs one decoder per core, up to four, instead of one, so a small image queued behind a large one no longer waits for it, and a view opening on several images decodes them side by side. Completion order between images is no longer the order they were queued.
@@ -0,0 +1 @@
- **`ImageCache::url` loads an image by URL; on web the browser fetches and decodes it.** Decoding uses `createImageBitmap` off the main thread, so WebP and AVIF work on web, and the pixels land through the same mip path as `ImageCache::rgba`, with the cache's waker drawing the frame. On web `ImageCache::file` now fetches its path relative to the page instead of failing. Native `url` takes a path or `file:` URL and refuses network URLs (Rune has no HTTP client); native `file` is unchanged.
@@ -0,0 +1 @@
- **`rune::embed::LayerHost` and `target_os = "ios"` builds.** `LayerHost::from_core_animation_layer` mounts a `Runtime` and Metal `Renderer` (with optional `LayerHost::with_compositor` effect-slot passes) onto an existing `CAMetalLayer` (for UIKit, SwiftUI and AppKit views that own their own window and display link), sharing one `Gpu` across hosts with `embed::prewarm()`. `rune` now builds cleanly for `aarch64-apple-ios` and `aarch64-apple-ios-sim` (skipping `arboard` on iOS/Android and walking `/System/Library/Fonts` for Apple symbol, SF Mono, emoji and CJK fallbacks).
@@ -0,0 +1 @@
- **`rune-kit`, `rune-mermaid` and `rune-theme-opencode` no longer turn on Rune's default features.** They depend on `rune` with `default-features = false`, since none of them uses `dbus`, `embedded-fonts`, `ogg-audio` or `svg`. Before, Cargo's feature unification turned all four back on for any app that used one of these crates, so an app that set `default-features = false` on `rune` to leave out symphonia, opuscule, resvg or zbus still built them. An app that depends on `rune` with its defaults is unchanged; an app that reached Rune only through these crates and relied on a default feature now adds `rune` with that feature itself.
@@ -0,0 +1 @@
- A `Tx::launch` flight whose ancestor springs to a new place in a later commit (a panel pinned to the window's bottom that grows as a row is added) now lands and rides it if it has as good as landed, or heads for its new place from where it's drawn, instead of jumping to where the ancestor will end up (a 33 pt one-frame jump for a row at rest in a growing panel).
@@ -0,0 +1,4 @@
- **Linux finds fallback fonts through fontconfig too, and ⎋ draws on stock Ubuntu.** Symbol,
emoji, CJK and script fallbacks are also looked up among the files `fc-list` names, so fonts
outside the XDG font directories (NixOS's store paths) are found. DejaVu Sans Mono follows
DejaVu Sans in the symbol fallbacks, since DejaVu Sans has no ⎋ (U+238B).
@@ -0,0 +1 @@
- **`rune::text::with_families` scopes `measure` to one thread.** Tests that switch font families (`Tx::set_font_families`) shared one process-wide set, so they had to run one at a time. `let _g = rune::text::with_families(sans, mono);` makes `measure`, `advance`, `ink` and `font_epoch` on this thread use those families until the guard drops; guards nest, and a headless window's switch under a guard moves only that thread. Real apps are unchanged: one switch still moves every thread.
@@ -0,0 +1 @@
- **`memo(id, ..)` warns in debug builds when its root already had a different key.** The memo still keys its root `id`, as before, but a closure returning `col().key("foo")` inside `memo("bar", ..)` now prints one stderr warning per call site saying `"foo"` was replaced, instead of silently breaking `find("foo")`. `RUNE_PERF_WARN=0` silences it; release builds are unchanged.
@@ -0,0 +1 @@
- **Mermaid edge labels follow hover.** On flowcharts, state and class diagrams, a node's hover now lights its edges' labels too (text and backing, in the hover colour), and pointing at an edge (within 8 pt of its line) or at its label lights that edge and its label. Nodes still win where they overlap; nothing in the API changed (t1058).
@@ -0,0 +1 @@
- **Mermaid draws ER diagrams, gantt charts and pie charts.** `erDiagram` entities are attribute tables (type, name, keys, comment) joined in crow's-foot notation, symbolic or worded, with labels. `gantt` reads `dateFormat`, `axisFormat`, `tickInterval`, sections, `done`/`active`/`crit`/`milestone`/`vert` tasks, durations, `after`/`until` links, `excludes` and `inclusiveEndDates`, on a calendar-aligned time axis. `pie` draws slices with percentages and a legend, with values under `showData`. Charts colour their series from a palette that follows the diagram's light or dark surface. These three no longer fall back to source (t1058).
@@ -0,0 +1 @@
- **Mermaid diagrams draw what they can read instead of falling back to source.** A statement that doesn't parse is skipped and the rest draws; a shape opener without its closer (`B[/items split view]`) is a plain rectangle with the text as written; subgraphs, composite states, frames and class bodies left open close at the end; unknown `@{ shape: … }` names are rectangles. Only an unknown diagram type, a source where nothing reads, or one past the size bounds (400 items, nesting 8 deep, now also for sequence frames) still falls back. Also adds `classDiagram`, sequence `box` groups and `rect` bands, `@{ shape, label }` nodes, edges to subgraph ids, `linkStyle` and diagram titles (front-matter `title:` or a `title` line), on one shared layered renderer for flowchart, state and class diagrams (t1058).
@@ -0,0 +1 @@
- **Mermaid draws mindmaps, timelines, user journeys, git graphs and quadrant charts.** `mindmap` nests by indentation and splits its branches to either side of the root, each in its own colour, with the square, rounded, circle, bang, cloud and hexagon shapes. `timeline` draws periods and their events by section, running top to bottom when they don't fit across. `journey` draws tasks under their sections with a face for each score and a legend of actors. `gitGraph` draws a lane per branch with merges, cherry-picks, tags and the reverse and highlight commit types, left to right or (`TB:`/`BT:`) down and up. `quadrantChart` draws the four named quadrants, axis ends and styled points. These no longer fall back to source (t1058).
@@ -0,0 +1 @@
- **rune-kit Markdown: a Mermaid chart that can't be drawn shows only its code block.** The "Diagram not supported" caption under it is gone, along with its `hint` element.
@@ -0,0 +1 @@
- **Mermaid flowcharts draw every node shape, and sequence and state diagrams fill their gaps.** Flowcharts add `(((double circle)))`, every v11 `@{ shape: … }` name and alias (documents, stacked shapes, cylinders, braces, markers, bang, cloud and the rest), and edge ids (`A e1@--> B`); `[\lean left\]` and `[\inverted trapezoid/]` now draw as their own shapes instead of copying `[/text/]` and `[/text\]`. Sequence diagrams add `create` and `destroy`, `autonumber` with a start, step or `off`, and v11 participant types (boundary, control, entity, database, collections, queue). State diagrams draw notes, split composites into `--` regions, and treat a state named before its `state X {` as that composite (t1058).
@@ -0,0 +1 @@
- **Mermaid draws XY charts, sankey, block, requirement and C4 diagrams.** `xychart-beta` draws bar and line series over category or numeric axes, upright or `horizontal`. `sankey-beta` reads CSV rows and draws columns of nodes joined by bands as thick as their flow. `block-beta` lays blocks out in `columns` with spans, `space`, nested groups, block arrows and edges. `requirementDiagram` draws requirements and elements with their fields, joined by the seven relationship kinds. `C4Context`, `C4Container`, `C4Component`, `C4Dynamic` and `C4Deployment` draw people, systems, containers and components (stores as cylinders, queues on their side, external ones in grey) in nested boundaries, with relationships and their technology. These no longer fall back to source (t1058).
@@ -0,0 +1 @@
- **rune-fx and rune-light run on the native Metal backend.** It gains compute passes and timestamps at pass boundaries (`TIMESTAMP_QUERY`), as wgpu's Metal backend has them, and new textures read as zero as wgpu promises (a fill's backdrop read garbage before). Simulated fire matches wgpu's frame for frame. A frame of 16 rune-fx layers with 4 backdrop blurs commits 1 command buffer instead of wgpu's 65 and takes 55% fewer instructions to record and submit (1.65 million against 3.69); rune-light with glass commits 1 instead of 31 or 47, with 53–55% fewer. `Device::poll` on Metal no longer reports an empty queue while a completion callback is still waiting, which could stall video timing.
@@ -0,0 +1 @@
- **The native Metal backend sets up as fast as wgpu.** Its adapter lists the Mac's GPUs with `MTLCopyAllDevices`, as wgpu-hal does, instead of `MTLCreateSystemDefaultDevice`, which connects to the window server to find the main display's GPU. A headless run's GPU setup (adapter, device, renderer and offscreen target) takes 7.5 ms instead of 16.1 (wgpu: 7.6), and a launch's `prewarm_gpu` thread finishes about 8 ms sooner. On a Mac with two GPUs the backend now picks the integrated one unless asked for `HighPerformance`, as wgpu does, and `enumerate_adapters` lists every GPU.
@@ -0,0 +1 @@
- **The native Metal backend loads a precompiled uber shader.** With `metal-backend` on and the backend picked, `Renderer::new` loads `uber_native.metallib` (the MSL that backend emits, compiled ahead) instead of translating WGSL and compiling Metal source. The first renderer takes 0.9 ms and 7.1 million instructions instead of 4.0 ms and 40 million on a warm shader cache, 90 ms instead of 222 ms on a cold one (the first launch after an install or update), and each later renderer 0.2 ms instead of 2.6 ms. The WGSL path stays the fallback, and `RUNE_DISABLE_METALLIB=1` still selects it. Shader edits now need `--features metal-backend` on the freshness test, and `scripts/precompile-metal-shaders.sh` rewrites both libraries.
@@ -0,0 +1 @@
- **Video plays on the native Metal backend.** `NativeSurface` frames from CoreVideo (AVPlayer, VideoToolbox, IOSurfaces) import without a copy through a `CVMetalTextureCache` made on the backend's own device, where they were inert before. Each plane's CoreVideo texture stays alive while any bind group or command buffer using it is, as on wgpu. A 1080p NV12 frame with GPU timing on both backends takes about 1.05 million instructions to import, draw and submit (2.15 million on wgpu), and 1.95 million through its timing readback (4.3 million on wgpu).
@@ -0,0 +1 @@
- **Delayed hover opens in a window that isn't key.** `on_hover_change` with `hover_delays` (tooltips, hover cards) no longer stays shut while the window is unfocused: blur still ends a shown hover and cancels a wait, and the pointer's next move over the window starts the wait again, as undelayed hover and hover styles already did. Clicks are unchanged; the first click on a background window still focuses it and acts. A window or overlay that ignores the mouse (`click_through`, `OverlayInput::None`) hears no hover; `OverlayInput::Regions` is the opt-in for an overlay that passes clicks through but still hovers (t1136).
@@ -0,0 +1 @@
- A page of rows prepended while a virtual list sits at its very top (its top padding showing) no longer pushes the reader's rows down as the new rows measure: the list anchors to the first visible row with a measured height, not a row still at its estimate.
@@ -0,0 +1 @@
- **Hidden prewarmed overlays no longer blank Mission Control.** On macOS, `OverlayOptions::exclude_from_capture` (and `MacWindowOptions::exclude_from_capture` on a nonactivating panel) now applies only while the overlay is shown. A prewarmed panel stays ordered in at alpha zero on every Space while hidden, and its `sharingType` none blanked every Space's thumbnail. The panel now turns `sharingType` none before a show's alpha starts rising and back to read-only once a hide's fade-out finishes; a show during that fade keeps it excluded. `OverlayHandle::set_exclude_from_capture` while hidden records the request for the next show, and `capture_exclusion()` still reports `Requested`. Apps that toggled exclusion around every show and hide can drop that. Windows already hides overlays with `SW_HIDE`, so nothing changes there.
@@ -0,0 +1 @@
- **Apps can build their own popovers from the kit's pieces.** New `rune_kit::popover` has `anchored` (mount a surface next to a keyed trigger, flipping and fitting to the window), `raised` (the popover surface style), `fit_scroll` (a long list that scrolls inside a fitted surface) and `anchor_rect` (the pure geometry: where a surface of a given size goes beside a trigger rect in a window, flipped and clamped). `rune::anchor_rect` is the same geometry for an `El::anchored` side and align. Apps no longer need local copies of the kit's private helpers. (t886)
@@ -0,0 +1,6 @@
- **`on_ready` runs for a window launched out of sight.** A window launched covered, occluded,
on another Space or hidden by the system (`open -g`) could go without a drawn first frame until
it was uncovered, so `App::on_ready`, and the live work an app starts there, never ran. It now
runs at the first frame skipped for being off screen, or a second after the window opens when
no frame comes at all. A window on screen still runs it after its first frame, and
`WindowHandle::is_ready` still waits for a drawn one.
@@ -0,0 +1,7 @@
- **A launcher can wait for readiness.** With `RUNE_READY_DIR` set, the process writes
`$RUNE_READY_DIR/<bundle id>.<pid>` right after its first `on_ready` returns (the main bundle's
identifier on macOS, else the executable's name), as one line of JSON:
`{"pid":123,"bundle_id":"com.example.app","ready_ms":412,"rune":"0.1.0"}`, `ready_ms` counted
from the process's start. It makes the directory 0700 if missing, writes through a renamed
temporary file, and removes the file when the process exits normally; one left by a killed
process names a PID that isn't running. Without the variable nothing is written.
@@ -0,0 +1,11 @@
- **Programmatic scrolls pick their spring, and an app's own glide holds hover.**
`Tx::scroll_to_with(key, x, y, spring)` glides like `Tx::scroll_to` on the given spring; a
request sent mid-glide keeps its speed, as `scroll_to` already did, so ↑/↓ key repeat keeping a
selection in view scrolls as one motion on a quicker spring than `GLIDE`. `scroll_to` itself is
unchanged. A viewport an app moves with `Tx::scroll_to_instant` (or `scroll_to_x`, `scroll_to_y`,
`scroll_key_to`) now counts as moving layout for that frame and the next, so hover under a
still pointer holds while an app steps its own glide frame by frame, as it does during a glide,
and resolves once at the pointer after the last step. A single instant jump under a still pointer now
re-hovers a frame later than before. A held hover whose row the scroll carried out of view lets go at once
instead of fading where nothing shows. The new `scroll_keys` example and its
`scripts/motion-audit` scenario hold ↓ at 30 Hz key repeat.
@@ -0,0 +1,5 @@
- **`Cx::selection_rects` finds selected text inside a reused `memo`.** A commit that reused
the memo holding the selection moved its nodes out of the last build before the view's
layout reads settled, so the boxes came back empty and a menu placed over the selection
never showed. Since commits under `El::hover_motion_within` started reusing memos, this hit
every app that sets it on its root. The selection is now read by path before the measure.
@@ -0,0 +1 @@
- **Scroll commit warnings, `RUNE_COMMIT_BUDGET_MS` and `El::scroll_anchor`.** Debug builds warn once per source when something commits the view on most frames of a scroll, which a scroll itself never needs, and name it: `poll`, a handler with its element and where it was set (`on_hover`, `on_hover_change`, `on_pointer_move`, `on_layout`, `on_drawn_layout` and `on_visible_rows` now record their call site), or the `Cx::layout` / `Cx::window_layout` read that moved. They also warn when an app steps a viewport with an instant scroll on 8 committing frames in a row, and when one hover handler commits for 8 different elements. `RUNE_COMMIT_BUDGET_MS=N` prints a line for each commit over `N` ms in any build, with view, layout, text and apply times and what made the frame commit, at most once a second. `El::scroll_anchor()` keeps the row at the top of a scroll viewport where it is when a commit changes the content above it, like CSS `overflow-anchor`. rune-kit's table and tree viewports and header cells no longer commit on every frame of an outer page's scroll, and a diff view's code lines no longer commit for each line the pointer crosses. `scripts/app-audit` checks for `window_layout`, layout and hover handlers without `live_only`, and instant scrolls stepped by `wake_after`. The README and the docs site's Fast apps page have a "Smooth scrolling" section.
@@ -0,0 +1 @@
- **`glyphs::STAR` and `glyphs::STAR_FILLED`.** Two five-point star icons on the 16 pt grid, outline and filled, drawn with the same 1 pt stroke and round joins as the other glyphs. They are not `Glyphs` slots: `icon(&glyphs::STAR, 16.0)`. (t886)
@@ -0,0 +1 @@
- **An `El::on_key_up` on any element hears releases while nothing is focused.** Only a handler on the root (or the open modal's root) fired, so one on a stage or other nested element never did. With no focus, the release is now offered to every element with a handler, deepest first and confined to the open modal, until one takes it; a focused element, and the element focused when the key went down, still hear it first.
@@ -0,0 +1,8 @@
- **Layout reads don't follow scrolling.** `Cx::layout`, `layout_with`, `layout_size` and
`memo::layout` now give where layout puts an element with every scroll viewport at its
origin, so a view reading a row inside a scrolling list no longer re-runs every frame of the
scroll; a commit that moves or resizes the element still re-runs it. A view that needs where
the window shows the element now, after scrolling, reads `Cx::window_layout` or
`window_layout_with` (and `memo::window_layout`). `El::on_layout` still reports after scrolling,
and the new `El::on_layout_tx` takes a `Tx`, so a handler that only moves live values says
`Tx::live_only` and a scroll runs no view.
@@ -0,0 +1,7 @@
- **What mounts out of sight enters at once.** An element new under one that drew nothing last
frame and still lies outside the window or its clips (a ticking digit in a row scrolled out of
view, or in a virtual list's overscan) skips its entrance, as its exit already did, so nothing
animates where nobody sees it. A matched element still flies to its match.
- **Colours out of sight land at once.** A node that drew nothing last frame and still lies
outside the window or its clips lands its colour, hover and blur changes instead of fading them
where nobody sees them (a list's selected row scrolled out of view when focus moves away).
@@ -0,0 +1,5 @@
- **A video scrolling across a clip edge no longer commits.** A list holding a video re-ran its
views each time the video scrolled into or out of sight, because only drawn videos counted
toward the state views read. Every video counts now, drawn or not, so a pure scroll stays
live-only. Frames are still pulled only while the video draws, and one scrolling back into
sight shows its current frame.
@@ -0,0 +1 @@
- `scripts/web-build.sh` stages each build in `$out/.next` and renames the files into place, so a page that loads mid-build no longer mixes `app.js` and `app_bg.wasm` from different builds (a `LinkError`); `--dev` skips the gzip size report.
@@ -0,0 +1 @@
- **`scripts/web-build.sh`: `--dev`, `--watch` and `--no-html`, and it keeps your own page.** `--dev` builds the debug profile without debug info, with dependencies at opt-level 1, in a `web-dev` target folder, skipping `--opt` (about 2 s for a one-line change to `web-hello`, against 12 s for release). `--watch` rebuilds when a workspace member's files change, and the generated page reloads itself through a `reload.js` that polls `.stamp`. `index.html` is now written only if it is missing or still carries the generated-by comment; `--no-html` never writes it. The script builds with the toolchain's own cargo (`rustup which cargo`, or `CARGO`) instead of a `cargo` on `PATH`, and says so if the wasm is missing afterwards.
@@ -0,0 +1 @@
- **`App::full_viewport` covers the browser viewport from a canvas the page passed in.** `App::canvas_id` still mounts inline at the parent's width, as before; adding `.full_viewport()` gives that canvas what Rune's own canvas gets: fixed to the visual viewport, body scrolling off, `Cx::safe_area` insets and `document.title` from the window title. For a single-page app's full-screen route. `fit_content_height` wins over it. The body lock now sets its three properties instead of replacing the body's inline style.
@@ -0,0 +1 @@
- **Web: `Tx::open_url_same_tab`, `App::same_tab_router` and unmount on `AppHandle::quit`.** `open_url_same_tab` replaces the page instead of opening a tab, taking page-relative links on web; a link on the page's origin goes to the app's router first (a single-page app pushes history and returns true), else `location.assign` loads it. Native opens it as `open_url` does. On web, `AppHandle::quit` now unmounts cleanly: the GPU device is destroyed, listeners come off, the body style, title and a passed-in canvas's style and attributes are restored, and an app started while another quits mounts once it has gone. `Runtime::take_url_requests` lists same-tab links with the rest.
@@ -0,0 +1 @@
- **Overlays show on GNOME Wayland through XWayland.** When the Wayland compositor has no layer-shell (Mutter), an overlay that takes no input (no pointer regions, no keys) now opens as an override-redirect ARGB X11 window on XWayland with an empty input shape, at its edge of the primary display (or the pointer's), instead of reporting `Availability::Unavailable`. Its scale comes from `Xft.dpi`. The rest of the app stays on Wayland; without `DISPLAY` nothing changes.
@@ -0,0 +1 @@
- **`El::drawn_rect_into(&Live<[f32; 4]>)` writes where each frame draws an element into a live value, with no handler and no commit.** It tracks every frame the element moves, through a scroll, a glide (`Tx::scroll_to`) and springs, where `on_drawn_layout` reports only once motion rests and commits unless its handler says `Tx::live_only`. An element bound to the value with `live_rect` follows a frame behind.
@@ -0,0 +1 @@
- **A fold's moving edge feathers shutting as well as opening.** An `El::fold_glide` row used to feather its bottom edge only while it opened; shutting, the edge was a hard cut. Now the edge softens both ways. The feather grows over the first ~50 ms of motion, holds steady through a reversal, and thins to nothing as the glide lands, so nothing is faded at rest. The top edge isn't feathered, so a header above the fold stays sharp. The new `El::fold_feather(pt)` sets one fold's feather depth, overriding its stack's `StreamEdge::mask_max`.
@@ -0,0 +1 @@
- **`rune-fx` builds an effect's pipeline the first time a frame draws it.** `FxRenderer::new` and `add_format` no longer build all eight effect families in both blends up front, along with the mask pyramid and backdrop blur passes. Each pipeline for a format and blend is built the first time a layer draws with it, and those one `prepare` needs are built in parallel. On a cold Metal shader cache on macOS, a renderer that adds a layer format and draws one glow reaches its first frame in 71 ms instead of 1.80 s: `new` takes 0.1 ms instead of 919, and `add_format` takes no time instead of 865. Warm, that's 6.2 ms instead of 7.9. Each family, blend or format a later frame draws for the first time costs 20 to 150 ms on a cold cache, once. Pixels are unchanged.
@@ -0,0 +1 @@
- **A virtual list keeps the rows still on screen mounted while a fold glides open over them, and the motion gate stops counting one-shots and toggled lists as loops.** A list windowed by the open fold's full height while it still glided, so a view that ran again mid-glide unmounted the rows under it at full opacity two frames before the fold covered them. The window now also keeps the rows drawn inside the viewport on the last frame, within an overscan of it. In `rune::motion_gate::check`, a phase that rests at 1 (a `.sequence` that played out, such as a one-shot fade) is no longer a loop: it isn't checked for `loop-jump`, and what it does after isn't hidden. A track without a phase loops only when it turns back on its own, not within half a second of an input, so a list toggled again and again no longer hides every finding in it. `loop-jump` also catches a loop back from a blink of up to 0.1 s off its rhythm, and an opacity dip that one input starts and another reverses is no longer a `flicker`.
@@ -0,0 +1 @@
- `ElementInfo::scrolling` (and `MotionElement::SCROLLING`) is now true for content a glide carries (`Tx::scroll_to`, `scroll_to_with`, `scroll_to_bottom`), not only under a wheel, trackpad or its momentum. Motion checks that exempt scrolling content (jerk, jumps) now exempt a glide too.
@@ -0,0 +1 @@
- **The debug `Tx::live_only` check no longer reports a virtual list's overscan after the viewport grows.** A scroll pane that got taller without a commit (a sibling pane hid) keeps its mounted rows, since they still cover the viewport. The check's forced commit used to pick the overscan again for the new height and report the rows it built below the viewport as `added element`, though the handler changed nothing. That commit now keeps each virtual list's mounted rows, as skipping it would have, and compares every one of them, so a live-only handler that changes a row mounted below the viewport is still named. Release builds are unchanged.
@@ -0,0 +1 @@
- **The debug `Tx::live_only` check names what the view built differently.** Its warning used to say only that the view built something else after a live-only handler. It now names the first element that differs and how: its layout rect, fill, border, opacity, radius, text, text colour or style, pills, rings, strikes or highlights, with both values when they're short (a rect, a colour, the first 40 characters of text), or an element added, removed or moved. For example: `rune: on_key called Tx::live_only, but the view built something else after it: text of "#0/heard" went from "1" to "2"`. It warns once per handler, element and property, and `Runtime::live_only_warnings` returns the warnings so a test can assert there are none. The check also no longer blames a live-only handler for state changed in the same frame by an `on_selection_change` handler (a text selection dragged across hover rows) or by a hover change a menu released. Release builds are unchanged.
@@ -0,0 +1 @@
- **A streaming `Markdown` no longer flashes markup at its tail.** With `Markdown::streaming` on, an emphasis, strong, strike or code span that's open draws as already styled and never shows its `**`, `_`, `~~` or `` ` ``: `**Settings ›` draws "Settings ›" in bold until the closer arrives. Markers at the very end (`and **`) wait for the next character, which says whether they open, close or are text. Only an opener at a word's start counts, so `2 * 3`, `snake_case`, `~5` and a URL's underscores stay as written, and a `* ` that becomes a bullet never shows as a star. A trailing `| File` line now draws nothing until it's a table (two cells, or a delimiter row) or the next line shows it isn't, so a table's header no longer lays out as a full-width paragraph and then shrinks. A finished document parses exactly as before.
@@ -0,0 +1 @@
- `rune::text::measure_with(text, spans, style, max_width, RichLayoutOptions)` measures text with layout options, so text drawn with `El::wrap_anywhere` can be measured to the lines it takes; `measure` is `measure_with` with the default options.
@@ -0,0 +1 @@
- Mermaid flowcharts lay out more cleanly. An edge to a subgraph stops on the subgraph's border instead of running inside it to its first node. Edges route around subgraph titles, and where an edge still has to cross a title or another edge's label, the line breaks around the text the way it does around its own label. A subgraph's title sits the same distance above its first row whichever way the chart runs. Rank gaps grow so edges leave a node or subgraph steeply instead of in a squeezed S. An edge label sits on the line only where the line runs straight through it. Node and edge labels wrap into even lines with no lone last word. Cylinders take Mermaid's rim proportions, with only the top rim's front drawn across the body. A left-to-right chart that would shrink below 78% to fit turns top-down, as before; that threshold is now the named `TURN_BELOW`.
@@ -0,0 +1 @@
- **Mermaid lines, outlines and arrowheads no longer brighten where they overlap, and the default diagram look is quieter.** Rune draws each stroke segment as its own capsule, so a translucent line blended twice at every joint: curves got beads, rounded node corners came out brighter than their sides, and a line got brighter under its own arrowhead (in dark, a line of luma 154 reached 207 at joints and heads). `rune-mermaid` now gives every translucent stroke, and every arrowhead in a line's colour, the opaque colour it would show over the fills beneath it (the card, a subgraph tint, a node), so overlaps paint the same colour twice; tints and bands keep their alpha. This applies to every diagram type. The default look changes with it: the card is the page colour with a hairline instead of a lighter slab, nodes are `layer_01` with a 0.2 outline, lines are 0.42 of the text colour, edge and message labels are muted, subgraph outlines are 0.7 of a node outline (they were 0.45 of the text colour, brighter than nodes), subgraph titles are medium weight instead of semibold, and a cylinder's top is a shade off its side so it reads without an outline. `DiagramStyle::neutral` and `MarkdownStyle::from_kit` both change; goldens with diagrams move in colour only. Keep `diagram_surface`'s fill opaque: ink is flattened over it.
@@ -0,0 +1 @@
- **Mermaid diagrams stream in.** A ```` ```mermaid ```` fence still arriving in a `Markdown` is now a diagram drawn from its complete lines, not a code block that turns into one when it closes: with `Markdown::streaming` on, nothing shows until the first lines read, then each new node fades and grows in, each edge or message draws on from its source to its target with its arrowhead landing last, frames fade in, and what's already there glides to its new place. Closing the fence moves nothing. A finished diagram still shows whole the frame it mounts. Each node, edge and frame is now its own element keyed by what it is (a flowchart node by its Mermaid id), and `rune_mermaid::render_streaming` and `rune_mermaid::may_draw` are new. Underneath, `Transition::draw()` and `Shape::drawn(t)` trace a shape's strokes on along their length, each fill fading in as the line reaches it; under Reduce Motion the shape is drawn whole.
@@ -0,0 +1 @@
- **Rune's Metal backend loads every built-in pipeline precompiled, on macOS and iOS.** Backdrop and layer blur, video, transparent windows, springs, `rune-fx` and `rune-light` take their functions from `builtin_native.metallib` (`builtin_native_ios.metallib` and `builtin_native_ios_sim.metallib` on iOS, where the uber shader comes from it too) instead of naga and Metal's MSL compiler. On a cold shader cache on macOS, a first layer blur takes 45 ms instead of 727, `FxRenderer::new` 1.26 s instead of 3.63 and `LightRenderer::new` 127 ms instead of 1.39 s. On the iOS simulator, a cold first frame takes 243 ms instead of 430. Warm, `FxRenderer::new` takes 1.2 ms instead of 32.5 on macOS, because a built-in shader's WGSL is no longer parsed. App shaders, such as `rune-fx` custom fills and `Compositor` WGSL, compile at runtime as before. The library adds about 540 KB to a macOS or iOS binary built with `metal-backend`, which is on by default. After changing a built-in shader or its bind group layout, run `scripts/precompile-metal-shaders.sh` on a Mac. Until then, that pipeline compiles at runtime, and rune-light's `builtin_shaders` test fails under `RUNE_GPU_BACKEND=metal`.
@@ -0,0 +1 @@
- **macOS apps now draw with Rune's native Metal backend by default.** `metal-backend` is one of Rune's default features, and an app that doesn't choose a backend draws with it, `prewarm_gpu()` included, with no restart. To keep wgpu, call `App::gpu_backend(GpuBackend::Wgpu)` (and `rune::prewarm_gpu_on(GpuBackend::Wgpu)` first in `main`), or launch with `RUNE_GPU_BACKEND=wgpu`; an app built with `default-features = false` keeps wgpu unless it adds the feature. `GpuBackend::default()` is still `Wgpu`. Pipelines made with `layout: None` now work on the native backend (it derives the layout from the shaders, as wgpu does), and a compositor that asks for a feature the backend lacks gets a wgpu device unless the app chose Metal. What the backend doesn't implement (depth and stencil, multisampling, indirect draws, render bundles, more than four colour targets, non-WGSL shaders) panics with a message naming the opt-out. wgpu's `custom` feature is now turned on for macOS alone, so Linux, Windows, web and iOS builds are unchanged. iOS keeps wgpu.
@@ -0,0 +1 @@
- **Rune's native Metal backend (`metal-backend`) runs on iOS.** An app embedding an `embed::LayerHost` opts in with `rune::prewarm_gpu_on(GpuBackend::Metal)` before its first host, or `RUNE_GPU_BACKEND=metal`; wgpu stays the default. The surface takes a UIKit view or a `CAMetalLayer`, picks iOS's MSL version, and keeps the drawable timeout (iOS has no occlusion check or display-sync switch). On the iOS simulator the backend's tests pass and a scrolling list renders the same pixels as wgpu's, with about 36% fewer instructions and CPU per frame; launch and first-frame time are unchanged, since iOS still compiles shaders at run time on both backends. A new `embed_cost` example measures it.
@@ -0,0 +1 @@
- **Icons, vector shapes, fills, fitted images and text decorations share one sub-pixel placement rule (`t1193`).** Concentric elements in the same box no longer shift or change area against one another when scaled, anchored to a zoomed target, gliding on a spring, or swapping between `canvas` and `icon`. Icons pad their atlas masks with a 1-texel transparent border and sample filtered from the box's centre and exact scaled side whenever fractional, scaled or turned, while keeping direct whole-pixel texel loads at unscaled rest; point-sized `Shape`s centre in their snapped rect; zoomed `El::anchored` overlays open their own pixel-snap layer so their resting fills snap to whole device pixels; and text glide now runs on both axes (`1/6 px` horizontal and vertical phases on top of each glyph's resting pen, so headings above `33⅓ ppem` glide across as smoothly as body copy, along with pill icons, spans, list markers and carets). Output at unscaled rest is unchanged.
@@ -0,0 +1 @@
- **`rune::prewarm_gpu_on(backend)` starts the GPU prewarm on the chosen backend.** An app on `GpuBackend::Metal` called `prewarm_gpu()` before `App::gpu_backend`, so the prewarm started on wgpu and restarted on Metal. The new function chooses the backend first, then starts, and a later `App::gpu_backend` with the same backend changes nothing. `RUNE_GPU_LOG=1` now names the backend that draws, `wgpu` or `rune backend`.
@@ -0,0 +1 @@
- **A timer frame that draws nothing new no longer starts the display link, and overlays skip it too.** A resting window's timer frame used to start the macOS display link before finding it would draw what was on screen, then stop it again: a link start and stop on every wake. It now builds the frame first when the stopped link would draw at once anyway, and starts the link only when the frame draws. Overlays had no such skip: every `wake_after` presented a full frame, even when `poll` returned false. A resting overlay's timer frame now builds before taking a drawable and presents nothing when its pixels match the last frame. For a 30 Hz `wake_after` that changes nothing on screen, an overlay went from about 19 presents a second and 4.6% CPU to none and 0.7%. Frames that draw (motion, input, a wake that changes something, live resize) are paced as before.
@@ -0,0 +1 @@
- **The motion gate fails a scroll that runs the view.** A new `scroll-commit` finding is reported when an app's `poll`, a handler or a layout read commits on 6 or more of a scroll's frames and at least a quarter of them; a cell that scrolls this way needs a fix or an `Allow` row. Debug builds' scroll-commit warning now names the file and line of a `Cx::layout`, `layout_with`, `layout_size`, `window_layout` or `window_layout_with` read that moved.
@@ -0,0 +1 @@
- The debug "blocked on the main thread" warning no longer counts time spent waiting for a core: Linux subtracts the thread's run-queue wait, and other Unix systems skip it while the load average is at or above the core count, so a busy machine stops reporting callbacks that only wrote a map; the message names the wait when there was one.
@@ -0,0 +1 @@
- **A streamed surface or `pixels_fit` image can stick to a corner, and hold still while it waits for a resized frame.** `El::surface_anchor(Align, Align)` chooses which edges `Fit`'s spare space and `Fill`'s crop are measured from (centred by default, so nothing moves), and `El::surface_unscaled(true)` draws one texel per device pixel instead of scaling to the box. With both, the last frame of a resized panel stays pinned top-left: a bigger box shows a gap on the right and bottom, a smaller one crops those edges, until the frame at the new size arrives. `SurfaceFit` is unchanged.
@@ -0,0 +1 @@
- **Text glides with its box instead of stepping a pixel at a time.** Pixel snapping glides a moving box between device pixels, but its glyphs still rounded their baselines to whole pixels, so a card drifting a few pixels on a slow spring drew its words jumping a whole pixel against its edges. A gliding box's text now lays out from the box's nearest whole pixel and draws the rest of the distance with glyph masks rasterized at quarter-pixel vertical phases, hinted as at rest. In a 2× card drifting 5 px, the ink's offset from the card's edge varied by about 1 px before and 0.25 px now; it was already within 0.15 px across. Each glyph adds at most three masks while it moves. Text at rest, including a glide's last frame, draws byte for byte as before. Icons and list markers still sit on whole pixels.
@@ -0,0 +1 @@
- macOS: a double click on an empty spot in a full-size-content titlebar now takes the titlebar double-click action (zoom, minimise or nothing, per System Settings), as a native titlebar does. AppKit already dragged the window from there, but the double click went nowhere unless the spot was a `.window_drag()` region. Windows using `Chrome::drag_regions` are unchanged.
@@ -0,0 +1 @@
- **Closing a window no longer waits on interaction timing.** With timing on, a window's runtime waited for its last rollup to reach the collector as it closed, freezing the main thread for at least 100 ms. It now queues the rollup and moves on; the event loop waits once, as the app exits. Timing on now costs within 1% of off in `examples/interaction_cost` (wheel 0.160 → 0.069 ms a frame), where it had cost up to 2×: macOS ran the thread that just slept on a slower core for the frames after.
@@ -0,0 +1,7 @@
- **Retained no-second-tree layout store (`rune-taffy`).** `Runtime` now drives Taffy 0.15's
layout solver directly from 216-byte dense `RetainedSlot`s (`LayoutStore`), embedding a 64-byte
`CompactStyle` directly on `El` (shrinking `El` by 488 B across `view` and `MemoCache`), pairing
each slot with a 96-byte `CompactCache` and 32-byte `BoxLayout`, and syncing children through
flat double-buffered arenas without per-container `Vec` allocations. On a 500-row list this cuts
retained layout heap by 80% (5.52 MB to 1.10 MB; 5.51 MB to 35 KB after shrinking to 12 rows),
and on a 1,000-row theme-stack rebuild benchmark drops `commit` p50 by 15% and rebuild p50 by 0.62 ms.
Loaded 100 of 3795 files, more files were not shown because too many files have changed in this diff. Show more