Compare commits

..
Author SHA1 Message Date
waozi c26b7ec943 Fix web build: include <stddef.h> for NULL in platform_thread.c
platform_thread.c uses NULL but only included <stdlib.h> under _WIN32.
On native, <pthread.h> (pulled in by platform.h) transitively provides
NULL, so the build passed. Emscripten's stricter header setup under
-DUI_EMBEDDED_ONLY does not, causing:

  error: use of undeclared identifier 'NULL'

Add the standard <stddef.h> include unconditionally.
2026-07-26 10:58:16 -05:00
2656 changed files with 46189 additions and 268583 deletions

No files matched your search

-39
View File
@@ -1,39 +0,0 @@
name: Compile cache
description: >-
Reuses C objects through ccache and Emscripten's generated system libraries
between runs. Run it after the setup action, which installs ccache.
inputs:
key:
description: Separates the jobs' caches, since each compiles different programs.
required: true
runs:
using: composite
steps:
- name: Name today's compiler cache
id: day
shell: bash
run: echo "day=$(date -u +%F)" >> "$GITHUB_OUTPUT"
# One entry a day per job keeps the repository's 10 GB cache allowance safe.
- name: Restore C objects
uses: actions/cache@v6
with:
path: ~/.ccache
key: ccache-${{ runner.os }}-${{ inputs.key }}-${{ steps.day.outputs.day }}
restore-keys: ccache-${{ runner.os }}-${{ inputs.key }}-
- name: Restore Emscripten system libraries
uses: actions/cache@v6
with:
path: |
kryon/build/emscripten-cache
kryon/build/ziran/emscripten-cache
key: emscripten-cache-${{ inputs.key }}-6.0.6
- name: Compile through the cache
shell: bash
run: |
echo /usr/lib/ccache >> "$GITHUB_PATH"
{
echo "CCACHE_DIR=$HOME/.ccache"
echo "CCACHE_MAXSIZE=150M"
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE"
echo "CCACHE_NOHASHDIR=true"
} >> "$GITHUB_ENV"
-30
View File
@@ -1,30 +0,0 @@
name: Google-free Android editions
description: >-
Fails when a normal or F-Droid APK, or a Gradle file their builds read,
holds a Google library; only the -gplay edition may (scripts/check-google-free.py).
inputs:
packages:
description: APKs (or globs) of the normal and -fdroid editions to search.
default: ''
source:
description: Folder whose Gradle files are checked as F-Droid scans them; empty skips it.
default: '.'
expect-google:
description: "'true' when the packages are -gplay: fail unless Play Billing is found, proving the search works."
default: 'false'
runs:
using: composite
steps:
- shell: bash
env:
PACKAGES: ${{ inputs.packages }}
SOURCE: ${{ inputs.source }}
EXPECT_GOOGLE: ${{ inputs.expect-google }}
run: |
set -euo pipefail
arguments=()
if [ -n "$SOURCE" ]; then arguments+=(--source "$SOURCE"); fi
if [ "$EXPECT_GOOGLE" = true ]; then arguments+=(--expect-google); fi
# Globs in PACKAGES expand here; a glob matching nothing stays as
# written and fails as a missing file.
python3 "$GITHUB_ACTION_PATH/../../../scripts/check-google-free.py" "${arguments[@]}" $PACKAGES
-373
View File
@@ -1,373 +0,0 @@
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
# Several sessions push master many times an hour, longer apart than a run
# takes; cancelling on master left no finished run. Only pull requests
# replace their older runs.
concurrency:
group: ci-${{ github.ref }}-${{ github.event_name == 'pull_request' && 'pr' || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
ZIRAN_ROOT: ${{ github.workspace }}/ziran
jobs:
# A broken host link fails here in minutes, before the long jobs start.
push-check:
name: Source rules and host links
runs-on: ubuntu-latest
outputs:
code: ${{ steps.changes.outputs.code }}
defaults:
run:
working-directory: kryon
steps:
- name: Checkout Kryon
uses: actions/checkout@v7
with:
path: kryon
- name: Name the checked-out Kryon commit master
run: git checkout -B master
# Every job that builds the AVIF decoder needs Meson and Ninja for dav1d,
# and on x86-64 nasm for dav1d's and libaom's SIMD; arm64 builds assemble
# with the C compiler.
- name: Set up the locked Ziran, its packages and the build tools
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryon
path: ziran
fetch: true
recommends: true
packages: >-
build-essential python3 ripgrep pkg-config libsdl2-dev libcairo2-dev libglib2.0-dev
libpango1.0-dev libdrm-dev libgbm-dev libegl-dev libgles-dev libegl-mesa0
libgl1-mesa-dri libx11-dev libxt-dev libxext-dev libfontconfig1-dev libfreetype-dev
libxkbcommon-x11-0
libcurl4-openssl-dev fonts-dejavu-core fonts-wqy-zenhei xvfb xdotool x11-apps x11-utils
imagemagick xfwm4 dbus-x11 cmake nasm meson ninja-build libwebpdemux2
- name: Prepare locked toolchain ref
run: git -C "$ZIRAN_ROOT" checkout -B master
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.x'
- name: Source rules and host links
run: make push-check
# A push touching only prose or the site skips the long jobs: this job
# still checks the docs, and the Pages workflow tests the site. Anything
# unknown runs everything.
- name: Decide whether the long jobs apply
id: changes
env:
GH_TOKEN: ${{ github.token }}
BEFORE: ${{ github.event.before }}
run: |
code=true
if [ "$GITHUB_EVENT_NAME" = push ] && files=$(gh api "repos/$GITHUB_REPOSITORY/compare/$BEFORE...$GITHUB_SHA" --jq '.files[].filename'); then
count=$(printf '%s\n' "$files" | grep -c . || true)
other=$(printf '%s\n' "$files" | grep -vE '^docs/|\.md$' || true)
if [ "$count" -gt 0 ] && [ "$count" -lt 300 ] && [ -z "$other" ]; then code=false; fi
fi
echo "code=$code" >> "$GITHUB_OUTPUT"
test-macos-zx:
name: macOS native ZX build and display-free execution
needs: push-check
if: needs.push-check.outputs.code == 'true'
runs-on: macos-latest
defaults:
run:
working-directory: kryon
steps:
- name: Checkout Kryon
uses: actions/checkout@v7
with:
path: kryon
# The locked compiler comes prebuilt, and the package checkouts cached.
- name: Set up the locked Ziran and fetch packages
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryon
path: ziran
fetch: true
- name: Install the AVIF decoder's dav1d build tools
run: brew install meson ninja $([ "$RUNNER_ARCH" = X64 ] && echo nasm)
# No GUI launch or screenshot can reach a runner's inherited display.
- name: Build native player and execute the portable VM with CPU pixels
run: |
export PATH="$ZIRAN_ROOT/build/bin:$PATH"
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
make zx-headless-test
build/zx-raylib/zx --check build/scratch/zx-headless/app.zx
test-linux:
name: Ziran library and host tests (${{ matrix.shard }})
needs: push-check
if: needs.push-check.outputs.code == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [zx, check, web, site, hosts]
defaults:
run:
working-directory: kryon
steps:
- name: Checkout Kryon
uses: actions/checkout@v7
with:
path: kryon
# Template tests serve the checkouts through local Git URLs and use
# their master refs.
- name: Name the checked-out Kryon commit master
run: git checkout -B master
# The locked compiler comes prebuilt, the package checkouts cached, and
# Ubuntu packages from the canonical archive.
- name: Set up the locked Ziran, its packages and the build tools
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryon
path: ziran
fetch: true
recommends: true
packages: >-
build-essential ccache python3 ripgrep xvfb pkg-config libsdl2-dev libcairo2-dev
libfreetype-dev libfontconfig1-dev libcurl4-openssl-dev libdrm-dev libgbm-dev
libegl-dev libgles-dev libegl-mesa0 libgl1-mesa-dri imagemagick xclip xdotool
libxkbcommon-x11-0
x11-xserver-utils python3-gi python3-gi-cairo python3-cairo python3-pil python3-xlib ffmpeg gir1.2-gtk-3.0 gir1.2-atspi-2.0
libglib2.0-dev libpango1.0-dev at-spi2-core dbus-x11 gstreamer1.0-plugins-base
gstreamer1.0-plugins-good gstreamer1.0-libav cmake nasm meson ninja-build libwebpdemux2 libopus-dev
# SDL3's GPU renderer needs Vulkan even on a software-only runner.
- name: Install native host test tools
if: matrix.shard == 'hosts'
run: sudo apt-get install -y libvulkan-dev mesa-vulkan-drivers libx11-dev libxext-dev libxtst-dev xauth libgtk-3-dev
# Template tests serve this checkout through local Git URLs and use
# the manifest's master ref. Keep that ref at the locked commit.
- name: Prepare locked toolchain ref
run: git -C "$ZIRAN_ROOT" checkout -B master
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.x'
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '22'
# The pay-per-import test and the gallery build these examples as
# applications of this checkout, as ziran.local.toml does locally.
- name: Build the in-tree examples from this checkout
if: matrix.shard == 'hosts' || matrix.shard == 'site'
run: |
python3 - <<'PY'
import os, subprocess
from pathlib import Path
ziran = Path(os.environ['ZIRAN_ROOT'])
settings = f'[overrides]\nkryon = "{Path.cwd()}"\nziran = "{ziran}"\n'
for project in ('examples/box', 'examples/button', 'examples/image', 'examples/textfield', 'examples/gallery'):
(Path(project) / 'ziran.local.toml').write_text(settings)
subprocess.run([str(ziran / 'build/bin/ziran'), 'lock'], cwd=project, check=True)
PY
- name: Keep Google libraries in the gplay edition
run: python3 scripts/check-google-free.py --source .
- name: Check submodule URLs
run: sh scripts/check-submodule-urls.sh
# The Canvas2D and DOM tests compile to Wasm with emscripten and run
# in private headless Chrome; the tests look for ~/emsdk.
- name: Restore emsdk
id: emsdk
uses: actions/cache@v6
with:
path: ~/emsdk
key: emsdk-${{ runner.os }}-6.0.6
- name: Install emsdk
if: steps.emsdk.outputs.cache-hit != 'true'
working-directory: .
run: |
git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
~/emsdk/emsdk install 6.0.6
~/emsdk/emsdk activate 6.0.6
- name: Keep compile results between runs
uses: ./kryon/.github/actions/compile-cache
with:
key: ${{ matrix.shard }}
# The behavior suite executes the Windows storage regression under Wine.
- name: Install Windows storage test tools
if: matrix.shard == 'check'
run: sudo apt-get install -y gcc-mingw-w64-x86-64 wine wine64
- name: Test opt-in SDL3 GPU renderer on a private display
if: matrix.shard == 'hosts'
env:
LIBGL_ALWAYS_SOFTWARE: '1'
run: |
set -- /usr/share/vulkan/icd.d/lvp_icd*.json
test -f "$1"
export VK_DRIVER_FILES="$1"
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 make sdl3-test
- name: Build and test
if: matrix.shard != 'site'
env:
CHROMIUM: google-chrome
run: env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 make test-shard-${{ matrix.shard }}
- name: Check repeatable frame workloads
if: matrix.shard == 'hosts'
run: python3 tools/performance.py --budget-ms 64
- name: Test SVG example
if: matrix.shard == 'hosts'
run: env -u DISPLAY -u WAYLAND_DISPLAY make -C examples test
# The whole site is rebuilt from this checkout, so the live editor's
# embedded examples match the gallery under test. Nothing is deployed.
- name: Build and test the widget gallery
if: matrix.shard == 'site'
env:
CHROMIUM: google-chrome
run: |
export PATH="$ZIRAN_ROOT/build/bin:$PATH"
make site
python3 tests/gallery_modules_test.py
make site-browser-test
- name: Show how much the compile cache saved
if: always()
run: ccache --show-stats || true
test-sanitizers:
name: Behavior tests under AddressSanitizer and UndefinedBehaviorSanitizer
needs: push-check
if: needs.push-check.outputs.code == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: kryon
steps:
- name: Checkout Kryon
uses: actions/checkout@v7
with:
path: kryon
# Template tests serve the checkouts through local Git URLs and use
# their master refs.
- name: Name the checked-out Kryon commit master
run: git checkout -B master
# The locked compiler comes prebuilt, the package checkouts cached, and
# Ubuntu packages from the canonical archive.
- name: Set up the locked Ziran, its packages and the build tools
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryon
path: ziran
fetch: true
recommends: true
packages: >-
build-essential python3 python3-pil ripgrep ffmpeg pkg-config libsdl2-dev
libcairo2-dev libglib2.0-dev libpango1.0-dev libfreetype-dev libfontconfig1-dev
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-libav cmake
nasm meson ninja-build libwebpdemux2
- name: Prepare locked toolchain ref
run: git -C "$ZIRAN_ROOT" checkout -B master
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.x'
- name: Install Windows storage test tools
run: sudo apt-get install -y gcc-mingw-w64-x86-64 wine wine64 xvfb xauth
- name: Run the behavior tests with sanitized C
run: env -u DISPLAY -u WAYLAND_DISPLAY make sanitize-test TEST_JOBS=4
test-desktop-hosts:
name: Desktop and raylib hosts on private Xvfb
needs: push-check
if: needs.push-check.outputs.code == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: kryon
steps:
- name: Checkout Kryon
uses: actions/checkout@v7
with:
path: kryon
# Template tests serve the checkouts through local Git URLs and use
# their master refs.
- name: Name the checked-out Kryon commit master
run: git checkout -B master
# The locked compiler comes prebuilt, the package checkouts cached, and
# Ubuntu packages from the canonical archive.
- name: Set up the locked Ziran, its packages and the build tools
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryon
path: ziran
fetch: true
recommends: true
packages: >-
build-essential python3 pkg-config libsdl2-dev libcairo2-dev libglib2.0-dev
libpango1.0-dev libdrm-dev libgbm-dev libegl-dev libgles-dev libegl-mesa0
libgl1-mesa-dri libx11-dev libxt-dev libxext-dev libxtst-dev libfontconfig1-dev libfreetype-dev
libxkbcommon-x11-0
fonts-dejavu-core fonts-wqy-zenhei xvfb xdotool x11-apps x11-utils imagemagick xfwm4
dbus-x11 cmake nasm meson ninja-build libwebpdemux2 libopus-dev
- name: Prepare locked toolchain ref
run: git -C "$ZIRAN_ROOT" checkout -B master
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25.x'
# Each test starts its own display with xvfb-run -a; none may reach a
# real one.
- name: Desktop host
run: env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY make desktop-project-test
- name: Desktop frame input snapshots
run: make desktop-frame-input-test
- name: Raylib host
run: env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY make raylib-project-test
- name: Raylib font coverage, collections and frame pipeline
run: |
RAYLIB_A="$PWD/build/raylib-ziran/libraylib.a" \
RAYLIB_LIBS="$(pkg-config --libs sdl2 libdrm gbm egl glesv2) -ldl -lpthread -lm" \
make raylib-typeface-test raylib-trace-test raylib-secondary-window-test raylib-frame-pixels-test raylib-frame-input-test
+124
View File
@@ -0,0 +1,124 @@
name: Netlify
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: netlify-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Site
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Packages
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y build-essential cmake cmark zlib1g-dev zip
- name: Set Up Emscripten
run: |
set -euo pipefail
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
"$HOME/emsdk/emsdk" install latest
"$HOME/emsdk/emsdk" activate latest
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
echo "$HOME/emsdk" >> "$GITHUB_PATH"
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
- name: Build Site
run: |
set -euo pipefail
make docs-site CMAKE=/usr/bin/cmake
test -f build/site/index.html
test -f build/site/api.html
test -f build/site/icons/kryon.png
test -f build/site/icons/c.png
test ! -f build/site/API.md
- name: Upload Site Artifact
uses: actions/upload-artifact@v4
with:
name: kryon-site
path: build/site
if-no-files-found: error
deploy-preview:
name: Deploy Preview
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'pull_request'
steps:
- name: Download Site Artifact
uses: actions/download-artifact@v4
with:
name: kryon-site
path: build/site
- name: Install Netlify CLI
run: npm install --global netlify-cli
- name: Deploy Preview To Netlify
run: |
set -euo pipefail
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
test -n "$auth_token" || { echo "::error::NETLIFY_AUTH_TOKEN is empty or missing"; exit 1; }
test -n "$site_id" || { echo "::error::NETLIFY_SITE_ID is empty or missing; use the Netlify Site ID, not the site URL"; exit 1; }
netlify deploy \
--dir build/site \
--alias "pr-${{ github.event.pull_request.number }}" \
--message "Preview ${{ github.event.pull_request.number }}" \
--auth "$auth_token" \
--site "$site_id"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
deploy-production:
name: Deploy Production
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
steps:
- name: Download Site Artifact
uses: actions/download-artifact@v4
with:
name: kryon-site
path: build/site
- name: Install Netlify CLI
run: npm install --global netlify-cli
- name: Deploy Production To Netlify
run: |
set -euo pipefail
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
test -n "$auth_token" || { echo "::error::NETLIFY_AUTH_TOKEN is empty or missing"; exit 1; }
test -n "$site_id" || { echo "::error::NETLIFY_SITE_ID is empty or missing; use the Netlify Site ID, not the site URL"; exit 1; }
netlify deploy \
--dir build/site \
--prod \
--message "Production ${{ github.sha }}" \
--auth "$auth_token" \
--site "$site_id"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
-200
View File
@@ -1,200 +0,0 @@
name: Cloudflare Pages
on:
push:
branches: [master]
paths:
- docs/site/**
- examples/gallery/**
- src/**
- mk/**
- ziran.toml
- scripts/gallery.py
- scripts/build-gallery.py
- scripts/build-site.py
- scripts/site-metadata.py
- tests/site_browser_test.py
- ziran.lock
- tests/portable_format_runtime.cjs
- .github/workflows/pages.yml
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
browser-runtime:
name: Build ZX website
runs-on: ubuntu-latest
env:
MAKEFLAGS: -j2
defaults:
run:
working-directory: kryonlabs/kryon
steps:
- uses: actions/checkout@v7
with:
path: kryonlabs/kryon
# The locked compiler comes prebuilt.
- name: Set up the locked Ziran
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryonlabs/kryon
path: ziranlang/ziran
packages: python3-pil
- uses: actions/setup-node@v6
with:
node-version: '22'
- uses: emscripten-core/setup-emsdk@v15
with:
version: '6.0.6'
- name: Select these source revisions
run: |
python3 - <<'PY'
from pathlib import Path
import os
import subprocess
root = Path(os.environ['GITHUB_WORKSPACE'])
settings = '[overrides]\nkryon = "' + str(root / 'kryonlabs/kryon') + '"\nziran = "' + str(root / 'ziranlang/ziran') + '"\n'
for project in ('.', 'docs/site/demo', 'examples/gallery'):
(Path(project) / 'ziran.local.toml').write_text(settings)
# An override can add dependency edges absent from the saved
# consumer lock. Resolve the selected checkout before building.
subprocess.run([str(root / 'ziranlang/ziran/build/bin/ziran'), 'lock'],
cwd=project, check=True)
PY
- name: Build and verify portable browser assets
run: |
export PATH="$GITHUB_WORKSPACE/ziranlang/ziran/build/bin:$PATH"
export ZIRAN_ROOT="$GITHUB_WORKSPACE/ziranlang/ziran"
python3 scripts/build-site.py
node tests/portable_format_runtime.cjs
ZIRAN_PLAYGROUND_RUNTIME="$PWD/docs/site/runtime/playground-runtime.js" node "$GITHUB_WORKSPACE/ziranlang/ziran/tests/web_bundle_runtime.cjs"
- name: Stage public website files
run: |
python3 - <<'PY'
from pathlib import Path
import json, shutil, subprocess
site = Path('docs/site')
output = Path('build/scratch/website-deploy')
paths = {Path(p) for p in subprocess.check_output(['git', 'ls-files', '-z', '--', str(site)]).decode().split('\0') if p}
paths.add(site / 'gallery-data.js')
paths.update((site / 'gallery-sources').rglob('*.zi'))
# The build numbers runtime assets; stage every one it lists, since
# a newly bundled asset is not tracked yet.
paths.update(site / name for _, name in json.loads((site / 'runtime/assets.json').read_text()))
for source in paths:
destination = output / source.relative_to(site)
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source, destination)
PY
- uses: actions/upload-artifact@v6
with:
name: kryon-website
path: kryonlabs/kryon/build/scratch/website-deploy/
if-no-files-found: error
verify:
name: Website
needs: browser-runtime
runs-on: ubuntu-latest
defaults:
run:
working-directory: kryonlabs/kryon
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
path: kryonlabs/kryon
- uses: actions/download-artifact@v6
with:
name: kryon-website
path: kryonlabs/kryon/docs/site
# The portable source test invokes the locked compiler directly.
- name: Set up the locked Ziran
uses: ziranlang/ziran/.github/actions/setup@4135e07fae33bcd0c00dd66b5716fdfe19c1fca5
with:
project: kryonlabs/kryon
path: ziranlang/ziran
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Install private display tools
timeout-minutes: 10
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3 python3-pil
# Test and deploy the same runtime built from the locked compiler.
- name: Check static site assets
run: |
test -f docs/site/index.html
test -f docs/site/demo.html
test -f docs/site/assets/widgets.html
test -f docs/site/runtime/playground-runtime.js
test -f docs/site/runtime/playground-runtime.wasm
test -f docs/site/demo-theme.js
test -f docs/site/current.css
test -f docs/site/favicon.svg
test -f docs/site/favicon-32.png
test -f docs/site/og.png
test -f docs/site/assets/brand/mark.svg
test -f docs/site/widgets.html
test -f docs/site/gallery-data.js
test -f docs/site/gallery-sources/kryon/0.zi
- name: Test the Canvas website
env:
CHROMIUM: google-chrome
# Chrome creates Unix sockets below TMPDIR; keep them clear of the
# runner's deeply nested checkout path.
KRYON_TEST_RUNTIME: ${{ runner.temp }}
run: |
export PATH="$GITHUB_WORKSPACE/ziranlang/ziran/build/bin:$PATH"
export ZIRAN_ROOT="$GITHUB_WORKSPACE/ziranlang/ziran"
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
YUE_DESKTOP_RECOVERY=0 python3 tests/site_browser_test.py
- name: Save browser startup diagnostics
if: failure()
uses: actions/upload-artifact@v6
with:
name: website-browser-log
path: kryonlabs/kryon/build/scratch/site-browser/profile/chromium.log
if-no-files-found: ignore
deploy-production:
name: Deploy Kryon Labs
needs: verify
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
path: kryonlabs/kryon
- uses: actions/download-artifact@v6
with:
name: kryon-website
path: kryonlabs/kryon/docs/site
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy kryonlabs/kryon/docs/site --project-name=kryon --branch=master
+154 -20
View File
@@ -1,40 +1,174 @@
name: Release
on:
push:
branches:
- master
tags:
- "v*"
paths:
- "include/kryon_version.h"
workflow_dispatch:
inputs:
version:
description: "Release version, for example v0.1.0"
required: true
type: string
prerelease:
description: "Mark the GitHub release as a prerelease"
required: false
default: false
type: boolean
permissions:
contents: write
concurrency:
group: kryon-release
cancel-in-progress: false
jobs:
tag:
name: Tag new version
create-tag:
name: Create Release Tag
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/heads/')
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create the release for a new VERSION
env:
GH_TOKEN: ${{ github.token }}
submodules: recursive
- name: Resolve Version
id: version
run: |
set -eu
VERSION=$(cat VERSION)
TAG="v$VERSION"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "$TAG already exists, nothing to release"
set -euo pipefail
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
tag="${{ inputs.version }}"
else
tag="$(sed -n 's/^#define KRYON_VERSION_STRING "\([^"]*\)".*/\1/p' include/kryon_version.h)"
fi
case "$tag" in
v[0-9]*.[0-9]*.[0-9]*) ;;
*) echo "Version must look like v0.1.0" >&2; exit 1 ;;
esac
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
echo "Tag $tag already exists; nothing to release."
echo "tag=" >> "$GITHUB_OUTPUT"
exit 0
fi
NOTES=$(awk -v v="$VERSION" '$0 ~ "^## \\[" v "\\]" {found=1; next} found && /^## / {exit} found' CHANGELOG.md)
test -n "$NOTES"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Ensure CHANGELOG Entry
if: steps.version.outputs.tag != ''
run: |
set -euo pipefail
tag="${{ steps.version.outputs.tag }}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Kryon $VERSION"
git push origin "$TAG"
gh release create "$TAG" --title "Kryon $VERSION" --notes "$NOTES"
# If the entry already exists (hand-written by a maintainer), use it as-is.
if grep -q "^## $tag " CHANGELOG.md; then
echo "CHANGELOG entry for $tag already present."
exit 0
fi
# Otherwise generate one from commits since the most recent tag.
prev_tag="$(git describe --tags --abbrev=0 2>/dev/null || true)"
date="$(date +%Y-%m-%d)"
range="${prev_tag:+$prev_tag..}HEAD"
range="${range:-HEAD}"
{
printf '## %s - %s\n\n' "$tag" "$date"
printf '### Changed\n\n'
git log "$range" --no-merges --pretty=format:'- %s' \
| sed -E 's/^- ([a-z])/- \u\1/'
printf '\n\n'
} > /tmp/new_entry.md
# Insert the generated block immediately after the "# Changelog" heading.
cp CHANGELOG.md CHANGELOG.md.bak
awk -v entry=/tmp/new_entry.md '
FNR==1 && /^# Changelog/ {
print
while ((getline line < entry) > 0) print line
next
}
{ print }
' CHANGELOG.md.bak > CHANGELOG.md
rm -f CHANGELOG.md.bak
git add CHANGELOG.md
git commit -m "Update CHANGELOG for $tag" || echo "No CHANGELOG changes to commit."
git push origin "HEAD:${GITHUB_REF_NAME}"
- name: Create And Push Tag
if: steps.version.outputs.tag != ''
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
git push origin "${{ steps.version.outputs.tag }}"
build-release:
name: Build Release Artifacts
runs-on: ubuntu-latest
needs: create-tag
if: always() && (startsWith(github.ref, 'refs/tags/') || needs.create-tag.outputs.tag != '')
steps:
- name: Resolve Tag
id: ref
run: |
set -euo pipefail
if [ -n "${{ needs.create-tag.outputs.tag }}" ]; then
tag="${{ needs.create-tag.outputs.tag }}"
else
tag="${GITHUB_REF_NAME}"
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.tag }}
submodules: recursive
fetch-depth: 0
- name: Install Packages
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y build-essential cmake libssl-dev pkg-config zlib1g-dev libzstd-dev libbrotli-dev libsdl2-dev libdrm-dev libgbm-dev libegl1-mesa-dev libgles2-mesa-dev
- name: Build And Test
run: |
set -euo pipefail
make clean CMAKE=/usr/bin/cmake
make all CMAKE=/usr/bin/cmake
make test CMAKE=/usr/bin/cmake
- name: Package Static Library
run: |
set -euo pipefail
make dist-static CMAKE=/usr/bin/cmake VERSION="${{ steps.ref.outputs.tag }}"
make check-static-package CMAKE=/usr/bin/cmake VERSION="${{ steps.ref.outputs.tag }}"
archive="$(find dist -maxdepth 1 -type f -name kryon-*-static.tar.gz | head -n 1)"
test -n "$archive"
echo "KRYON_STATIC_ARCHIVE=$archive" >> "$GITHUB_ENV"
- name: Upload Static Library Artifact
uses: actions/upload-artifact@v4
with:
name: kryon-static-library-${{ steps.ref.outputs.tag }}
path: ${{ env.KRYON_STATIC_ARCHIVE }}
if-no-files-found: error
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.ref.outputs.tag }}
name: Kryon ${{ steps.ref.outputs.tag }}
prerelease: ${{ github.event_name == 'workflow_dispatch' && inputs.prerelease || false }}
files: ${{ env.KRYON_STATIC_ARCHIVE }}
-25
View File
@@ -2,38 +2,13 @@
*.o
*.so
*.dll
*.pyc
*~
*.tmp
__pycache__/
ziran.local.toml
.zcode
.kryon-ide-state
# Local managed session state
/.yue/
# Test-owned scratch and logs
/work/
# Build output
build/
dist/
backup/
assets/fonts/*
!assets/fonts/LiberationSans-Regular.ttf
!assets/fonts/LiberationMono-Regular.ttf
!assets/fonts/LICENSE-Liberation
!assets/fonts/DejaVuSans.ttf
!assets/fonts/LICENSE-DejaVu
!assets/fonts/NotoSansSymbols-Regular.ttf
!assets/fonts/NotoSansSymbols2-Regular.ttf
!assets/fonts/LICENSE-Noto
tools/otfchop/otfchop
.wrangler/
# Gallery metadata and editable snippets are generated from examples/gallery.
/docs/site/gallery-data.js
/docs/site/gallery-sources/
+15
View File
@@ -0,0 +1,15 @@
[submodule "vendor/raylib"]
path = vendor/raylib
url = https://github.com/raysan5/raylib.git
[submodule "vendor/liboqs"]
path = vendor/liboqs
url = https://github.com/open-quantum-safe/liboqs.git
[submodule "vendor/curl"]
path = vendor/curl
url = https://github.com/curl/curl.git
[submodule "vendor/cmark-gfm"]
path = vendor/cmark-gfm
url = https://github.com/github/cmark-gfm.git
[submodule "vendor/clay"]
path = vendor/clay
url = https://github.com/nicbarker/clay.git
-91
View File
@@ -1,91 +0,0 @@
# Kryon repository rules
Kryon is a reusable UI library authored in Ziran. The Ziran language,
compiler, `.zir` representation, `.zx` format, and portable runtime live in
the separate Ziran repository (`~/Projects/ziranlang/ziran`). Kryon's reusable widgets
live in `src/ui/<component>/`, shared UI infrastructure stays in `src/ui/`,
its hosts live in `src/backend/*.zi`, and the
`kryon` project tool in `src/project/*.zi`.
## 100% Ziran rule
- Kryon's handwritten implementation, platform integration, and maintained
examples must be written in current Ziran (`.zi`). Do not add or expand
handwritten C, C++, Go, or other language implementations inside Kryon.
Generated native output under `build/` is an output of Ziran, not source.
- Use the latest Ziran syntax and APIs directly. Do not add compatibility
wrappers, aliases, fallback runtimes, or old-syntax paths for Ziran in Kryon.
When Ziran lacks a general capability, implement it in Ziran first and
import it as an ordinary language capability. Do not add UI special cases to
Ziran.
- The library, hosts, project tool, and examples are all Ziran. Python and
shell scripts are build and test tooling, and `templates/droid/` is the
Android project scaffold an app build copies; keep widget and host behavior
out of them.
## Source and build
- Make changes in this upstream repository on `master`. Commit and push here
before a downstream application updates its `ziran.lock` (or, for an app
that still vendors Kryon, its clean `vendor/kryon` pointer).
- Never create or work in temporary Kryon or Ziran checkouts, clones, or
worktrees. Edit the root repositories on `master`; reserve temporary
directories for disposable test outputs only.
- `src/ui/modules.txt` lists the core modules compiled into `libkryon.a`.
`*_laws.zi` files throughout `src/ui/` are proved by `make laws`, and optional modules such as
`Window`, `Media`, `Video`, `Clock`, and `Service` are package exports in
`ziran.toml`. A checker pass alone does not establish native or portable
readiness.
- Run `make push-check` before pushing: it takes minutes and links the hosts a
shared backend change can break. CI runs it before its long jobs.
- `make test` is the current Kryon gate. It builds the checked Ziran library
and runs Ziran source, saved-IR, and bundle behavior tests without a display.
- Put one-off experiment builds in `build/scratch/<name>/`, never in new
top-level `build/` directories. `make clean-scratch` removes scratch output
that has been idle for a day; `BUILD_OUTPUTS` in the Makefile lists the
directories that targets and tests own.
- Use direct domain names for APIs. Do not restore the removed KIR compiler,
`.kry` runtime, or `.krb` loader as compatibility paths.
## UI ownership
Author reusable widget behavior, composition, layout, interaction, styling,
accessibility, and UI tree decisions in `.zi`. Platform hosts may gather OS
input, manage windows, load fonts and images, rasterize, and store data. Host
code must not independently choose widget behavior.
An application imports Kryon as an ordinary Ziran library. The Ziran compiler
and portable loader must never recognize Kryon widget names specially. An
application that does not import Kryon needs no Kryon code or graphical host.
Keep app-specific screens, assets, copy, workflows, and state in the app repo.
Nothing is imported by default. A program carries only the code for what it
imports and uses. A bare window carries the window, its events and
presenting; import a frame and you get a frame, import a rectangle and you get
a rectangle. Optional features arrive through their import or first use, never
through runtime flags. Shared code reaches an optional part through a small
slot module (such as `frame_driver`, `image_lookup`, `text_editing` and
`scroll_sampling`) that the part's own module fills from its initializer or
first use; shared code never imports the part itself. Make generated code
smaller by cutting what isn't
needed, never by merging files (owner, 2026-11-15).
One widget concept has one public implementation. `Text.Draw(Text.Props)` and
`Image.Draw(Image.Props)` are the intended text and image widget surfaces. Do not
add parallel wrappers or expose raw texture draw calls as app widget APIs.
## Testing and desktop safety
Test changed modules through all relevant generated targets and portable
bundles. Use focused behavior tests for decisions that could diverge across
targets. Do not treat code generation alone as proof that a host or app works.
Never run tests or binaries that can send X/Wayland requests against the
developer's live desktop. Use a private Xvfb/Xephyr display for any visual or
window-management test, and scope window effects to processes Kryon owns.
Never touch the inherited display or `/tmp/.X11-unix/X0` during cleanup.
## Bend
When using Bend, run `bend guide`, keep important rules in `LAWS.bend`, run
`bend PROOF.bend` before committing, and parallelize the code where possible.
+81 -985
View File
File diff suppressed because it is too large. Load diff
+290 -973
View File
File diff suppressed because it is too large. Load diff
+126 -102
View File
@@ -1,125 +1,149 @@
# Kryon
Linux desktop and portable hosts can decode local videos with synchronized audio
using the optional GStreamer service exported as `kryon/Video` and
`kryon/VideoLinux`. Display the returned frame with `Image.Draw(Image.Props)`.
Applications own playback controls and access checks; an optional expiring lease
revokes both audio and decoded frames when authorization is no longer renewed.
`make test-focus TEST=ziran_video_linux_test` checks synthetic moving frames, paused seeking, speed, volume,
replay and lease revocation with a silent audio sink and no display access.
Kryon is a small C support library for raylib-style applications. It keeps a
raylib-compatible public surface available through `kryon.h`, then adds the
pieces shared by downstream apps: UI controls, Tk-style toolkit widgets, layout
helpers, text rendering, themes, embedded assets, locale loading, file dialogs,
desktop tray support, runtime asset downloads, and Lyra account/sync helpers.
Kryon is a UI library written in Ziran. Its source lives under `src/ui/` and
imports Ziran modules normally. The Ziran compiler, `.zir` representation, and
`.zx` bundle format belong to the separate
[Ziran](https://github.com/ziranlang/ziran) repository. Kryon has no
`.kry` runtime or language compiler.
## Layout
## Build
- `include/` - public headers, including `kryon.h` and generated raylib
compatibility declarations
- `src/` - Kryon implementation files, with reusable UI modules under `src/ui/`
- `icons/` and `pfp/` - PNG icon inputs embedded into `src/ui/ui_icon_assets.c`
- `themes/` - built-in theme files for the runtime theme loader
- `fonts/noto/` - bundled Noto Sans TTF/OTF font assets
- `mk/` - Make fragments for native, web, Android, Windows, packaging, and
vendored dependency builds
- `scripts/` - asset embedding, icon embedding, raylib preparation, and boundary
check helpers
- `examples/` - small programs that exercise Kryon UI features
- `tests/` - focused C tests for account, sync, and transition helpers
- `vendor/raylib`, `vendor/curl`, `vendor/liboqs` - source submodules used by
downstream app builds
Install the `ziran` command first (`make install-user` in a
[Ziran](https://github.com/ziranlang/ziran) checkout), then build Kryon:
## Building
```sh
Kryon builds with the repository Makefile:
```bash
make
```
On FreeBSD, use the repository `makefile` entrypoint. It delegates to the GNU
Make build while keeping `make` as the command downstream apps can run:
```bash
make bsd-check
```
Run the focused tests with:
```bash
make test
```
The Makefile builds against the Ziran revision locked in `ziran.lock`, found
with `ziran pkg path ziran`. To build against a local Ziran checkout, name it
in an ignored `ziran.local.toml` `[overrides]` table or set `ZIRAN_ROOT`.
Build a distributable static-library archive with:
`make` checks the modules listed in [src/ui/modules.txt](src/ui/modules.txt),
writes checked `.zir`, generates C and Go, and compiles the native outputs
from Ziran source.
The current C archive is `build/ziran/libkryon.a`; C headers are generated
from Ziran declarations into `build/ziran/c/`. Kryon has no handwritten
source headers. Hosts provide declared
effects such as raster lines, and `CompositionQueue` carries raw IME events to
the checked text widgets.
```bash
make dist-static
```
Charts, tables, trees, and source coloring are separate Git packages that
depend on Kryon: [Plot](https://github.com/kryonlabs/plot),
[DataViews](https://github.com/kryonlabs/data-views) (`TableView` and
`TreeView`), and [Syntax](https://github.com/ziranlang/syntax). Add one with
`ziran add URL` and import it as `plot/Plot`, `data_views/TableView`, or
`syntax/Syntax`. Kryon exports the building blocks such packages draw with
(`session`, `tree`, `surface`, `paint_queue`, `style`, and the others listed
in `ziran.toml`); see [writing a widget package](docs/API.md#widget-packages).
The archive is an extracted SDK layout. It contains `libkryon.a`,
`libraylib.a`, vendored static dependency libraries, public headers, API docs,
example consumers, CMake and pkg-config metadata, third-party notices, a package
manifest, and the submodule revisions used to build it. Validate it with:
Style sheets are the separate [CSS](https://github.com/kryonlabs/css)
package: it parses and formats a subset of CSS, installs the rules, and ships
the classic, lightfield, and material style packs. Kryon keeps the rule table and
style resolution, so an app that builds its rules in code needs no parser.
```bash
make check-static-package
```
The optional [Game2D](https://github.com/kryonlabs/game2d) Ziran package owns
the raylib game API. Kryon keeps its geometry, drawing values, UI primitives,
and raylib UI host. Kryon exports `geometry` and `drawing_props` so Game2D can
share their types without pulling in widget modules. The raylib game adapter
uses a C ABI and does not support native Go.
`libkryon.a` stays focused on Kryon object files. Companion libraries are shipped
beside it and linked through `lib/pkgconfig/kryon.pc`. OpenSSL is still treated
as an external system/toolchain dependency unless explicit OpenSSL static library
paths are supplied at build time.
`make test` builds the test host and runs the Ziran source, saved-IR, and
portable bundle tests with four concurrent jobs. Set `TEST_JOBS=1` to run them
serially or `TEST_JOBS=8` on a larger machine. For a quick edit loop, use
`make test-focus TEST=link_widget`; the filter matches test script names and
skips the full library rebuild. Test subprocesses have no display access.
`make sanitize-test` runs the behavior tests with AddressSanitizer and
UndefinedBehaviorSanitizer. Keep one-off experiments in `build/scratch/`;
`make clean-scratch` removes that and any other `build/` entry that no target
writes, once it has been idle for a day.
See [composition input](docs/COMPOSITION_INPUT.md) for the checked IME event
contract and host queue lifetime.
See [cursor input](docs/CURSOR.md) for the checked cursor decision and platform
effect contract.
See [style picker](docs/STYLE_PICKER.md) for caller-owned pack selection.
See [zoom](docs/ZOOM.md) for Ctrl and mouse-wheel zoom of a whole application.
See [clipboard state](docs/CLIPBOARD.md) for the portable clipboard value and
host effect contract.
See [frame replay](docs/FRAME_REPLAY.md) for committed UI and paint capture
with scripted input on a headless host.
The [hello world example](examples/README.md) is one small Ziran program with
an explicit `main`: it imports Kryon's app and text packages, opens a window,
and draws the label `Hello, world!`.
For Ziran app manifests, the terminal backend, and `kryon run`, see
[Ziran projects](docs/PROJECTS.md).
Portable desktop profiles build a `.zx` with embedded assets; a downloaded
file launches with `ziran run app.zx` after installing the desktop provider. See [Zx applications](docs/PROJECTS.md#zx-applications).
## Releases
## Website and widget gallery
Kryon releases are tag-driven. Run the `Release` GitHub Actions workflow with a
version such as `v0.1.0`; the workflow validates the version, creates and pushes
the annotated tag, checks out that tag, builds and tests Kryon, packages the
static-library archive, uploads it as an artifact, and attaches it to the GitHub
release. Pushing a `v*` tag manually uses the same build-and-publish path.
`make site` rebuilds the initial Canvas demo, the browser compiler and preview
host, and the widget gallery into `docs/site/`. Emscripten is required; activate
emsdk or set `EMCC`. `make site-gallery` builds only the gallery, and
`make site-gallery-test` prepares editable examples and exercises the gallery in
a private Chromium/Xvfb session.
## Integration
The gallery at `widgets.html` uses the example package in `examples/gallery/`.
Its core scenes are shared by the desktop, web and review hosts. Examples are
grouped by installed module and category, including core UI and 2D drawing.
Optional package integrations are registered only while their dependencies
are declared. Each selected example includes editable Ziran source and a live
preview, using the same compiler and editor as `demo.html`. Plot and DataViews
supply the additional charts, tree and Kanban; TableView's entry identifies its
current API-only status. `make site` generates the scene metadata and editable
snippets directly from these examples. The Pages workflow builds and tests the
full website from fixed source revisions before publishing.
To integrate Kryon into your project:
## Current status
1. Add `include/` to your header search paths
2. Include `kryon.h` for the raylib-compatible API plus Kryon modules
3. Compile Kryon sources from `src/` and `src/ui/`, or use the `mk/` fragments
to let Kryon assemble source lists and platform flags
4. Use `scripts/embed-icons.sh` and `scripts/embed-assets.sh` when your app
needs custom embedded icons, locale files, fonts, themes, or image/audio
assets
5. Include `mk/vendor.mk` when your app enables curl or liboqs-backed features
The [feature matrix](docs/FEATURE_MATRIX.md) records package and host coverage.
The Canvas2D browser host is covered by private headless Chromium, WebAudio,
and Wasm tests. The [open-work plan](plan/README.md) lists
the remaining platform-accessibility work.
Applications should keep build artifacts in their own build directories, but
the dependency source of truth and common build recipes should live under Kryon.
For TLS-enabled curl builds, `mk/vendor.mk` passes the `OPENSSL_*` make
variables through to the vendored curl CMake build.
Kryon commits land upstream first. Applications then update their
`ziran.lock` with Ziran's package commands; an app that still vendors Kryon
moves only its clean `vendor/kryon` submodule pointer. This repository's tests
verify Kryon itself, not every downstream application build.
## App Builds
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the library boundary and
[Ziran's implementation
status](https://github.com/ziranlang/ziran/blob/master/docs/IMPLEMENTATION_STATUS.md)
for language and portable runtime gaps.
Kryon owns the app command surface through `kryon-app`. From an app repository:
`kryon/breadcrumb` serves `Breadcrumb.Draw` for keyed label navigation, with measured
ancestors and an accessible, virtualized overflow menu. Applications own
selection, focus and navigation; see [the API](docs/API.md#breadcrumbs).
```sh
kryon-app build native
kryon-app build web
kryon-app build android-debug
kryon-app package appimage
kryon-app preview
```
App `project.kryon` files should use `target` entries that call `kryon-app`
rather than embedding platform-specific build commands directly. Existing app
Makefiles can remain as backend glue while repeated native, web, Android, and
packaging logic moves into Kryon `mk/` fragments.
## Preview Projects
Kryon IDE can host richer project previews without requiring the project to be
rewritten as `.kry` screens. A project can add `project.kryon` metadata such as
`preview_size`, `preview_asset_root`, and `preview_scene`, then provide a
`build_live` command that builds `build/kryon/live_preview.so`. The live module
continues to expose the normal `CreateKryonLivePreview`/`AppHost` entry point,
and can optionally expose `CreateKryonPreviewHost` for future scene/layer editing
metadata. This keeps gameplay or simulation code in the app while letting Kryon
IDE select scenes, draw interactive previews, and eventually edit shared preview
layers.
## Conventions
Kryon follows raylib-style C conventions where practical: lowercase module
filenames, simple C structs, and public functions named like raylib APIs
(`InitWindow`, `DrawTexture`, `BeginUIFrame`, `DrawUIButton`). Internal helpers
stay private to `src/` unless a downstream app needs the API in `include/`.
## Documentation
- `docs/API.md` documents the public API.
- `docs/site/` contains the static documentation website.
- `docs/AGENTS.md` documents how downstream apps should use Kryon, including
modal/input capture and submodule update rules.
## Toolkit Direction
The `ui_tk.h` layer is Kryon's pragmatic Tk replacement surface. It stays in the
raylib style: one direct struct-and-call path per widget, caller-owned state,
immediate-mode drawing, and no builder objects or scripting runtime. The numbered
examples `09_geometry` through `18_accessibility` demonstrate each toolkit
feature family.
## Kry Language Direction
`docs/KRY_LANGUAGE_PLAN.md` describes the migration path for making `.kry` a
C-close, C-transpiled app language with direct C interoperability. The goal is
for apps to move product UI and screen controllers into Kry while keeping native
platform, storage, and performance-sensitive code in C.
+12 -10
View File
@@ -1,14 +1,16 @@
# Third-Party Notices
The Kryon static package includes third-party code pinned by its package lock.
The Kryon static package includes third-party code built from the repository
submodules listed in `SUBMODULES.txt`.
- raylib: zlib/libpng license, see `LICENSE` in the locked raylib source package.
- raylib: zlib/libpng license, see `vendor/raylib/LICENSE` in the source tree.
- liboqs: MIT license, see `vendor/liboqs/LICENSE.txt` in the source tree.
- curl/libcurl: curl license, see `vendor/curl/COPYING` in the source tree.
- cmark-gfm: BSD-style license, see `vendor/cmark-gfm/COPYING` in the source tree.
- Clay: zlib/libpng license, see `vendor/clay/LICENSE.md` in the source tree.
- Noto fonts: SIL Open Font License 1.1, see `fonts/noto/LICENSE.txt` in the source tree.
- Liberation Sans: SIL Open Font License 1.1, see `assets/fonts/LICENSE-Liberation`.
`src/backend/pixmap_font.zi` holds outlines of its Latin glyphs for the
pixmap host.
- MingCute Core icons: Apache License 2.0, see
`licenses/mingcute/LICENSE.txt` in the source tree. Kryon embeds only the
selected, renamed monochrome subset used by its UI in `icons/ui.webp`.
Apache 2.0 does not grant rights to third-party trademarks depicted by some
brand icons; applications remain responsible for appropriate trademark use.
OpenSSL is not vendored into the package by default. When `kryon.pc` lists
`-lssl -lcrypto`, those libraries are expected to come from the target system or
from paths supplied with `OPENSSL_ROOT_DIR`, `OPENSSL_SSL_LIBRARY`, and
`OPENSSL_CRYPTO_LIBRARY` at build time.
-1
View File
@@ -1 +0,0 @@
0.4.0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 847 KiB

-91
View File
@@ -1,91 +0,0 @@
{
"project": "Kryon",
"request": "One original friendly full-body dragon mascot for the Kryon UI toolkit, in the Ziran capybara's flat warm illustration feel, followed by a pastel-only color revision that preserves the accepted character.",
"pastel_follow_up_request": "okay but the colors should be more pastel — for the mascot",
"generation_mode": "built-in image_gen",
"generation_calls_planned": 1,
"conditional_retry_allowed": 1,
"generation_calls_completed": 3,
"attempt_count": 3,
"pastel_edit_calls_planned": 1,
"pastel_edit_calls_completed": 1,
"retry_reason": "The first attempt had extra body shading and tighter margins, a clear style/composition mismatch; the one permitted retry fixed the flat-ink direction.",
"proposals": [
{
"id": "01-dragon-v1",
"version": "v1",
"attempt_count": 2,
"animal": "Dragon",
"direction": "Rounded approachable full-body dragon in three-quarter view, facing right, with a calm warm personality and strong small-icon silhouette.",
"prompt": "Use case: logo-brand\nAsset type: final original mascot bitmap for Kryon, a UI toolkit and Ziran sister project; exactly one finished character.\nPrimary request: Create one entirely original friendly cartoon dragon mascot for Kryon. KDE inspiration is limited only to the broad idea of a rounded, approachable open-source cartoon dragon body and shape. This must not copy or trace Konqi and must not reuse Konqi's exact face, anatomy, pose, or proportions.\nScene/backdrop: None. A genuinely transparent square canvas with no background pixels, ground, shadow, border, or decoration.\nSubject: One full-body dragon in three-quarter view, facing right, standing in a relaxed welcoming pose. Big friendly head, short rounded snout, small rounded horns, small wings, a soft row of rounded back spines, four simple grounded feet without claws, and one clear tapering tail. Calm warm expression, small gentle eyes rendered only with earth-brown marks, closed mouth, no teeth. Nothing in its hands.\nStyle/medium: Confident hand-drawn flat illustration in the same visual family as Ziran's capybara mascot: bold deep earth-brown outline of consistent apparent weight, large quiet solid color areas, minimal interior marks, slight purposeful hand-drawn irregularity, calm warm character, strong sticker-like silhouette readable as a tiny website icon. Absolutely flat ink fills: no lighting, highlights, shadows, secondary shades, gray, cream, white fill, texture, or tonal modeling.\nComposition/framing: Center the single complete dragon on a 1:1 square canvas. The entire silhouette should occupy about 72–76% of the canvas width and height, leaving a clean 12–15% transparent border on every side. Every horn, wing, spine, foot, and tail is wholly visible and comfortably clear of the edge. Three-quarter view faces right.\nColor palette: Exactly four visual ink colors and no others except edge antialiasing between them and transparency: jade green #63B190 for the entire body and wings; exactly one continuous lake-blue underside/belly plane #77B7EA; deep earth-brown #502511 for every outline, eye, nostril, and minimal interior mark; one restrained muted light-orange #A48B62 used only on the small horn tips. Do not create light and dark variants of any color. Do not use orange on wings or elsewhere.\nText: NONE.\nConstraints: One original approachable rounded dragon; one character only; genuine alpha transparency; strong readable silhouette; generous clear margins; four flat source-family inks only; exactly one lake-blue belly plane; orange limited to horn tips; eyes use brown with no white eye fill.\nAvoid: Konqi likeness, KDE logo, gear, fire, smoke, teeth, aggressive claws, K monogram, letter-shaped body, props, clothing, scenery, borders, frames, solid or patterned background, gradients, glow, glossy 3D, textures, shading, highlights, drop shadows, extra characters, extra limbs, cropped anatomy. Absolutely no text, letters, numbers, labels, signatures, logos, or watermark anywhere.",
"file": null,
"transparent_background": true,
"status": "removed-at-owner-request",
"retained": false,
"actual": {
"dimensions": [1254, 1254],
"mode": "RGBA",
"alpha_extrema": [0, 255],
"content_bbox_alpha_gt_1": [107, 63, 1125, 1197],
"bytes": 877306,
"sha256": "aa041bbfe0fa60b97736fff724be5922f6b178607cfab5514b6cc4a17295da89"
},
"visual_review": {
"no_text_verified": true,
"transparent_background_verified": true,
"not_konqi_copy": true,
"style_matches_ziran": true,
"original_character": true
}
},
{
"id": "02-dragon-v2-pastel",
"version": "v2",
"attempt_count": 1,
"animal": "Dragon",
"direction": "Pastel-only color revision of the accepted v1 dragon, preserving the same friendly character, pose, proportions, framing, linework, expression, wings, spines, and transparent background.",
"prompt": "Use case: precise-object-edit\nAsset type: pastel color revision of the accepted Kryon dragon mascot bitmap.\nInput images: Image 1 is the sole edit target, the accepted v1 Kryon dragon mascot.\nPrimary request: Change ONLY the four flat ink colors of Image 1 to a softer pastel palette. Do not redraw, reinterpret, restyle, simplify, or add anything.\nColor palette: body pastel mint/jade approximately #A9DCC5; the single existing belly/underside plane pastel sky blue approximately #BCDDF6; the existing horn-tip accents pastel peach approximately #F5C7A1; all existing outline, eye, nostril, and interior marks deep earth-brown/warm cocoa approximately #6B4434. Use at most these four flat visual inks plus edge antialiasing and transparency.\nTransparency: Preserve the genuinely transparent background and all current alpha edges. No background pixels, ground, or shadow.\nInvariants: Preserve the exact same original character, pose, anatomy, proportions, framing, silhouette, linework geometry and apparent weight, expression, gaze, wings, rounded back spines, horns, feet, tail, belly-plane shape, detail placement, canvas dimensions, and transparent margins. Change only colors. Keep every existing element in the exact same position and size. No added or removed details.\nAvoid: gradients, extra shades, texture, highlights, shadows, glow, glossy rendering, new marks, altered outlines, altered anatomy, text, letters, numbers, logos, signatures, or watermark. Do not introduce a Konqi likeness, KDE logo, gear, props, clothing, scenery, border, fire, teeth, or claws.",
"file": "mascot-dragon.png",
"transparent_background": true,
"status": "complete",
"actual": {
"dimensions": [1254, 1254],
"mode": "RGBA",
"alpha_extrema": [0, 255],
"content_bbox_alpha_gt_1": [107, 64, 1127, 1197],
"bytes": 867648,
"sha256": "9537921d73713caccd9c991b4998224207f5ad21a079dcebc2f57cfc111daae4"
},
"target_palette": {
"body_pastel_mint_jade": "#A9DCC5",
"belly_pastel_sky_blue": "#BCDDF6",
"horn_tips_pastel_peach": "#F5C7A1",
"outline_warm_cocoa": "#6B4434"
},
"visual_review": {
"exact_character_preserved": true,
"pixel_identical_to_v1": false,
"transparent_background_verified": true,
"no_text_verified": true,
"not_konqi_copy": true,
"style_matches_ziran": true,
"pastel_palette_verified": true,
"at_most_four_visual_inks": true,
"original_character": true,
"notes": "The same accepted character, pose, anatomy, expression, linework design, and framing are preserved. Built-in image editing re-antialiased some edge pixels: the alpha>128 silhouette IoU is 99.53710%, ink-region agreement is 99.69063%, and the content bounding box moved by at most two pixels; v2 is therefore not claimed to be pixel-identical to v1."
}
}
],
"validation": {
"local_tests": "passed",
"tests": [
"The retained pastel mascot is a decodable 1254x1254 8-bit RGBA PNG with alpha extrema [0, 255].",
"The retained pastel mascot SHA-256 is 9537921d73713caccd9c991b4998224207f5ad21a079dcebc2f57cfc111daae4 and matches its proposal record.",
"Visible content above alpha 1 has bounding box [107, 64, 1127, 1197], wholly inside the canvas with transparent clearance on every side.",
"OCR returned no text; visual review found no text, letters, numbers, labels, signatures, or watermark.",
"Visual and palette review confirmed the same accepted original dragon, no Konqi copy, the Ziran flat warm style, and the requested pastel mint, sky-blue, peach, and warm-cocoa direction."
],
"scope": "Local validation of the sole retained asset assets/brand/mascot-dragon.png and assets/brand/prompts.json.",
"notes": "The earlier darker bitmap was removed at the owner's request; its prompt and digest remain as provenance only. The retained pastel mascot used one built-in image_gen edit call and its generated binary was copied without retouching."
}
}
Binary file not shown.
-78
View File
@@ -1,78 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: DejaVu fonts
Upstream-Author: Stepan Roh <[email protected]> (original author),
see /usr/share/doc/fonts-dejavu-core/AUTHORS for full list
Source: https://dejavu-fonts.github.io/
Files: *
Copyright: Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved.
Bitstream Vera is a trademark of Bitstream, Inc.
DejaVu changes are in public domain.
License: bitstream-vera
Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:
.
The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.
.
The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".
.
This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.
.
The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.
.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.
.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.
Files: debian/*
Copyright: (C) 2005-2006 Peter Cernak <[email protected]>
(C) 2006-2011 Davide Viti <[email protected]>
(C) 2011-2013 Christian Perrier <[email protected]>
(C) 2013 Fabian Greffrath <[email protected]>
License: GPL-2+
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version.
.
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more
details.
.
You should have received a copy of the GNU General Public
License along with this package; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Boston, MA 02110-1301 USA
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
/usr/share/common-licenses/GPL-2'.
-130
View File
@@ -1,130 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Liberation Fonts
Source: https://github.com/liberationfonts
Files: *
Copyright:
Digitized data copyright (c) 2010 Google Corporation with Reserved Font Arimo, Tinos and Cousine.
Copyright (c) 2012 Red Hat, Inc. with Reserved Font Name Liberation.
License: SIL-OFL-1.1
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
.
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
.
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
worldwide development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to provide
a free and open framework in which fonts may be shared and improved in
partnership with others.
.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves.
The fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
.
.
.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such.
This may include source files, build scripts and documentation.
.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
.
"Original Version" refers to the collection of Font Software components
as distributed by the Copyright Holder(s).
.
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting ? in part or in whole ?
any of the components of the Original Version, by changing formats or
by porting the Font Software to a new environment.
.
"Author" refers to any designer, engineer, programmer, technical writer
or other person who contributed to the Font Software.
.
.
PERMISSION & CONDITIONS
.
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
.
1) Neither the Font Software nor any of its individual components,in
Original or Modified Versions, may be sold by itself.
.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
.
5) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this license, and must not be distributed
under any other license. The requirement for fonts to remain under
this license does not apply to any document created using the Font
Software.
.
.
.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
.
.
.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.
.
Files: debian/*
Copyright:
2008 Alan Baghumian <[email protected]>
2008-2018 Holger Levsen <[email protected]>
2009-2012 Christian Perrier <[email protected]>
2011-2023 Fabian Greffrath <[email protected]>
2018 Rene Engelhard <[email protected]>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
-278
View File
@@ -1,278 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Noto
Upstream-Contact: https://github.com/googlei18n/noto-fonts/issues
http://groups.google.com/group/noto-font
Source: https://github.com/googlei18n/noto-fonts
Files: *
Copyright:
2010,2012-2020, Google Inc.
2015-2020, Google LLC.
License-Grant:
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
License: OFL-1.1
Files:
debian/*
Copyright:
2013-2020, Jonas Smedegaard <[email protected]>
2020, Purism, SPC
2013, Vasudev Kamath <[email protected]>
License-Grant:
This program is free software;
you can redistribute it and/or modify it
under the terms of the GNU General Public License
as published by the Free Software Foundation;
either version 3, or (at your option) any later version.
License: GPL-3+
Files:
debian/NotoMono/NotoMono-Regular.ttf
Copyright:
2007, Google Inc.
License-Grant:
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
License: OFL-1.1
License: OFL-1.1
PREAMBLE
.
The goals of the Open Font License (OFL) are to stimulate
worldwide development of collaborative font projects,
to support the font creation efforts
of academic and linguistic communities,
and to provide a free and open framework
in which fonts may be shared and improved
in partnership with others.
.
The OFL allows the licensed fonts to be used, studied,
modified and redistributed freely
as long as they are not sold by themselves.
The fonts, including any derivative works,
can be bundled, embedded,
redistributed and/or sold with any software
provided that any reserved names are not used
by derivative works.
The fonts and derivatives, however,
cannot be released under any other type of license.
The requirement for fonts to remain under this license
does not apply to any document
created using the fonts or their derivatives.
.
DEFINITIONS
.
"Font Software" refers to the set of files
released by the Copyright Holder(s) under this license
and clearly marked as such.
This may include source files, build scripts and documentation.
.
"Reserved Font Name" refers to any names specified as such
after the copyright statement(s).
.
"Original Version" refers to the collection
of Font Software components
as distributed by the Copyright Holder(s).
.
"Modified Version" refers to any derivative
made by adding to, deleting, or substituting --
in part or in whole --
any of the components of the Original Version,
by changing formats
or by porting the Font Software to a new environment.
.
"Author" refers to any designer, engineer, programmer,
technical writer or other person
who contributed to the Font Software.
.
PERMISSION & CONDITIONS
.
Permission is hereby granted, free of charge,
to any person obtaining a copy of the Font Software,
to use, study, copy, merge, embed, modify, redistribute,
and sell modified and unmodified copies of the Font Software,
subject to the following conditions:
.
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions,
may be sold by itself.
.
2) Original or Modified Versions of the Font Software
may be bundled, redistributed and/or sold with any software,
provided that each copy contains the above copyright notice
and this license.
These can be included either as stand-alone text files,
human-readable headers or in the appropriate
machine-readable metadata fields within text or binary files
as long as those fields can be easily viewed by the user.
.
3) No Modified Version of the Font Software may use
the Reserved Font Name(s)
unless explicit written permission is granted
by the corresponding Copyright Holder.
This restriction only applies to the primary font name
as presented to the users.
.
4) The name(s) of the Copyright Holder(s)
or the Author(s) of the Font Software
shall not be used to promote,
endorse or advertise any Modified Version,
except to acknowledge the contribution(s)
of the Copyright Holder(s) and the Author(s)
or with their explicit written permission.
.
5) The Font Software,
modified or unmodified, in part or in whole,
must be distributed entirely under this license,
and must not be distributed under any other license.
The requirement for fonts to remain under this license
does not apply to any document
created using the Font Software.
.
TERMINATION
.
This license becomes null and void
if any of the above conditions are not met.
.
DISCLAIMER
.
THE FONT SOFTWARE IS PROVIDED "AS IS",
WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO
ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT.
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT,
INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF THE USE OR INABILITY TO USE
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
License: GPL-3+
License-Reference: /usr/share/common-licenses/GPL-3
# Noto Color Emoji (used to generate src/backend/pixmap_emoji.zi)
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: noto-emoji
Source: https://github.com/googlefonts/noto-emoji
Files-Excluded: fonts/*.ttf
Files: *
Copyright: 2013-2017 Google Inc.
Arjen Nienhuis <[email protected]>
License: Apache-2.0
Files: fonts/*
Copyright: 2013-2017 Google Inc.
Arjen Nienhuis <[email protected]>
License: SIL-1.1
License: Apache-2.0
Licensed under the Apache License, Version 2.0
https://www.apache.org/licenses/
.
On Debian systems, the complete text of the Apache License can be found in
/usr/share/common-licenses/Apache-2.0'.
License: SIL-1.1
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
.
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
.
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to provide
a free and open framework in which fonts may be shared and improved in
partnership with others.
.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
.
DEFINITIONS
.
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
.
"Original Version" refers to the collection of Font Software components
as distributed by the Copyright Holder(s).
.
"Modified Version" refers to any derivative made by adding to,deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software
to a new environment.
.
"Author" refers to any designer, engineer, programmer, technical writer
or other person who contributed to the Font Software.
.
PERMISSION & CONDITIONS
.
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
.
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or in
the appropriate machine-readable metadata fields within text or binary
files as long as those fields can be easily viewed by the user.
.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
.
5) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this license, and must not be distributed
under any other license. The requirement for fonts to remain under this
license does not apply to any document created using the Font Software.
.
TERMINATION
.
This license becomes null and void if any of the above conditions are
not met.
.
DISCLAIMER
.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-24
View File
@@ -1,24 +0,0 @@
# Platform selection only; decoder sources, flags and targets belong to avif.
include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/ImagePackages.cmake")
# dav1d is the default AV1 decoder and libaom the explicit oracle. DAV1D_DIR
# or KRYON_DAV1D_DIR select the pinned dav1d source; otherwise it comes from
# the same locked package graph as avif.
function(kryon_avif_decoder avif_dir aom_dir)
kryon_image_package(package avif)
include("${package}/native/ZiranAvif.cmake")
if(DEFINED DAV1D_DIR AND NOT DAV1D_DIR STREQUAL "")
set(dav1d_dir "${DAV1D_DIR}")
elseif(NOT "$ENV{KRYON_DAV1D_DIR}" STREQUAL "")
set(dav1d_dir "$ENV{KRYON_DAV1D_DIR}")
else()
kryon_ziran_package_path(dav1d_dir dav1d)
endif()
set(shared)
if(NOT ANDROID AND NOT WIN32 AND NOT APPLE)
# Cairo lazily opens the same self-contained library as before.
set(shared BUILD_SHARED_BRIDGE SHARED_TARGET_NAME kryonavif)
endif()
ziran_avif_add_native(AVIF_SOURCE "${avif_dir}" AOM_SOURCE "${aom_dir}" DAV1D_SOURCE "${dav1d_dir}" ${shared})
endfunction()
-52
View File
@@ -1,52 +0,0 @@
# Resolve codec-owned build entry points through the ordinary package graph.
# Callers can pass KRYON_AVIF_PACKAGE_DIR / KRYON_WEBP_PACKAGE_DIR when building
# a renderer artifact from a consumer's locked dependency graph.
include_guard(GLOBAL)
# Locked checkout of any package or pinned source dependency in Kryon's graph.
function(kryon_ziran_package_path output name)
if(DEFINED ZIRAN_BIN AND NOT ZIRAN_BIN STREQUAL "")
set(ziran "${ZIRAN_BIN}")
elseif(NOT "$ENV{ZIRAN_BIN}" STREQUAL "")
set(ziran "$ENV{ZIRAN_BIN}")
elseif(DEFINED ZIRAN_DIR AND NOT ZIRAN_DIR STREQUAL "")
set(ziran "${ZIRAN_DIR}/build/bin/ziran")
elseif(NOT "$ENV{ZIRAN_TOOLCHAIN_ROOT}" STREQUAL "")
set(ziran "$ENV{ZIRAN_TOOLCHAIN_ROOT}/build/bin/ziran")
elseif(NOT "$ENV{ZIRAN_DIR}" STREQUAL "")
set(ziran "$ENV{ZIRAN_DIR}/build/bin/ziran")
elseif(NOT "$ENV{ZIRAN}" STREQUAL "")
set(ziran "$ENV{ZIRAN}")
else()
set(ziran ziran)
endif()
get_filename_component(project "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/.." ABSOLUTE)
set(locked --locked)
if(EXISTS "${project}/ziran.local.toml")
set(locked)
endif()
execute_process(COMMAND "${ziran}" pkg path "${name}" ${locked}
WORKING_DIRECTORY "${project}"
RESULT_VARIABLE status OUTPUT_VARIABLE directory
ERROR_VARIABLE diagnostic OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT status EQUAL 0)
message(FATAL_ERROR "Cannot resolve ${name} package: ${diagnostic}")
endif()
set(${output} "${directory}" PARENT_SCOPE)
endfunction()
function(kryon_image_package output name)
string(TOUPPER "${name}" upper)
set(selection "KRYON_${upper}_PACKAGE_DIR")
if(DEFINED ${selection} AND NOT "${${selection}}" STREQUAL "")
set(directory "${${selection}}")
elseif(NOT "$ENV{${selection}}" STREQUAL "")
set(directory "$ENV{${selection}}")
else()
kryon_ziran_package_path(directory "${name}")
endif()
if(NOT EXISTS "${directory}/ziran.toml")
message(FATAL_ERROR "No ${name} package at ${directory}; run ziran fetch")
endif()
set(${output} "${directory}" PARENT_SCOPE)
endfunction()
-140
View File
@@ -1,140 +0,0 @@
# Android NDK build helpers for Kryon apps.
#
# An app's droid/app/src/main/cpp/CMakeLists.txt generates its Ziran C sources
# and then uses these helpers for the parts every Kryon Android app shares:
#
# include("${KRYON_DIR}/cmake/KryonAndroid.cmake")
# kryon_android_reproducible_paths("${REPO_ROOT}") # before dependency targets
# kryon_android_codecs("${WEBP_DIR}" "${AVIF_DIR}" "${AOM_DIR}")
# add_library(main SHARED ${APP_SOURCES})
# kryon_android_app(main) # glue, size flags, system libs
#
# The helpers only set what is common; apps add their own definitions,
# include directories, and libraries to `main` as usual.
include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/WebP.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/AVIF.cmake")
set(KRYON_ANDROID_NATIVE_APP_GLUE_DIR
"${ANDROID_NDK}/sources/android/native_app_glue")
# Apply to every target in this directory and its children, including native
# dependencies. Debug paths enter the linker's build ID before Gradle strips
# the APK library; normalizing only the final app target is insufficient.
# Keep debug information and build IDs so retained crash symbols still match.
function(kryon_android_reproducible_paths source_root)
get_filename_component(source_root "${source_root}" ABSOLUTE)
# NDK clang accepts these flags for C/C++ and preprocessed assembly.
# NASM/Yasm use -f for their object format and cannot receive them.
add_compile_options(
"$<$<COMPILE_LANGUAGE:C,CXX,ASM>:-fdebug-compilation-dir=.>"
"$<$<COMPILE_LANGUAGE:C,CXX,ASM>:-ffile-prefix-map=${source_root}=.>"
"$<$<COMPILE_LANGUAGE:C,CXX,ASM>:-ffile-prefix-map=${ANDROID_NDK}=./ndk>"
"$<$<COMPILE_LANGUAGE:C,CXX,ASM>:-ffile-prefix-map=${CMAKE_BINARY_DIR}=./build/android>")
endfunction()
# Build the image codecs Kryon's platform-native Android host uses. Software
# presentation needs no graphics, audio, or renderer dependency.
function(kryon_android_codecs webp_dir)
if(NOT EXISTS "${webp_dir}/CMakeLists.txt")
message(FATAL_ERROR "No libwebp source at ${webp_dir}")
endif()
kryon_webp_decoder("${webp_dir}")
set(avif_dir "${ARGV1}")
set(aom_dir "${ARGV2}")
if(avif_dir STREQUAL "")
set(avif_dir "$ENV{KRYON_ANDROID_AVIF_DIR}")
endif()
if(aom_dir STREQUAL "")
set(aom_dir "$ENV{KRYON_ANDROID_AOM_DIR}")
endif()
kryon_avif_decoder("${avif_dir}" "${aom_dir}")
add_library(kryon_android_codecs INTERFACE)
target_link_libraries(kryon_android_codecs INTERFACE
kryonwebp ziran_avif::static)
endfunction()
# Turn a shared library into a Kryon NativeActivity payload: add the NDK's
# native_app_glue, optimize for speed, keep symbols hidden, garbage-collect unused
# sections, align for 16 KB page devices, route fopen() through Kryon's APK
# asset reader, retain native crash symbols, and link Android's system APIs.
function(kryon_android_app target)
if(NOT ZI2C_BIN)
find_program(ZI2C_BIN NAMES zi2c REQUIRED)
endif()
set(thread_source "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../src/backend/android_thread.zi")
set(thread_generated "${CMAKE_CURRENT_BINARY_DIR}/kryon-android-thread")
add_custom_command(
OUTPUT "${thread_generated}/android_thread.c" "${thread_generated}/android_thread.h"
COMMAND "${ZI2C_BIN}" --no-main
--root "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../src/backend"
-o "${thread_generated}" "${thread_source}"
DEPENDS "${thread_source}" "${ZI2C_BIN}"
VERBATIM)
# The NDK's glue is compiled from a copy in the build tree. Its own path
# carries the NDK's install location into the object and module names,
# which ThinLTO hashes into symbols, so builds on other machines differ.
set(glue_source "${CMAKE_CURRENT_BINARY_DIR}/kryon-native-app-glue/android_native_app_glue.c")
configure_file("${KRYON_ANDROID_NATIVE_APP_GLUE_DIR}/android_native_app_glue.c"
"${glue_source}" COPYONLY)
target_sources(${target} PRIVATE
"${thread_generated}/android_thread.c"
"${glue_source}")
# Only the NativeActivity-owned app thread receives this stack policy.
# The generated configurator calls libc normally; other thread creators retain
# their own attributes and defaults.
set_property(SOURCE "${glue_source}"
APPEND PROPERTY COMPILE_DEFINITIONS pthread_attr_setdetachstate=ConfigureNativeThread)
target_include_directories(${target} PRIVATE
"${KRYON_ANDROID_NATIVE_APP_GLUE_DIR}")
target_compile_definitions(${target} PRIVATE
PLATFORM_ANDROID ANDROID_BUILD=1 _DEFAULT_SOURCE _GNU_SOURCE
_FILE_OFFSET_BITS=64)
target_compile_options(${target} PRIVATE
-O2 -ffunction-sections -fdata-sections -fvisibility=hidden
-fno-omit-frame-pointer $<$<NOT:$<CONFIG:Debug>>:-g1>)
target_link_options(${target} PRIVATE
-Wl,--gc-sections
-Wl,-z,max-page-size=16384
-Wl,-z,common-page-size=16384
# Kryon serves fopen() from APK assets through __wrap_fopen.
-Wl,--wrap=fopen
-Wl,--wrap=fopen64)
# Gradle strips the packaged library. Keep this original, with line
# information, so native startup failures can be symbolicated.
target_link_libraries(${target} PUBLIC android log atomic dl m)
endfunction()
# Adopt Kryon's canonical Android host for a shared-library target whose
# generated sources include the application's main and android_glue modules
# (created by scripts/android_scaffold.py). KRYON_ANDROID_HOST selects
# Kryon's own platform keyboard implementation; an application that supplies
# its own JNI glue, like one with a custom SetPlatformTextKeyboardVisible,
# must not call this. The library exposes Android's entry points and the
# notification JNI callbacks that Android resolves on receiver/service startup.
function(kryon_android_host target)
target_compile_definitions(${target} PRIVATE KRYON_ANDROID_HOST=1)
foreach(source IN LISTS ARGN)
get_filename_component(source_name "${source}" NAME)
if(source_name STREQUAL "main.c")
# Kryon's NativeActivity glue calls android_main directly. The
# scaffold's argv-style main remains the stable application ABI.
set_source_files_properties("${source}"
PROPERTIES COMPILE_OPTIONS "-ffreestanding")
elseif(source_name STREQUAL "android_glue.c" OR
source_name MATCHES "(^|_)(android_notifications|notification_push)\\.c$")
# The VM locates this exported entry before native methods are
# registered through it. Notification receivers and push services
# also locate their JNI callbacks after a cold process start.
# Package-generated sources carry an identity prefix.
set_source_files_properties("${source}"
PROPERTIES COMPILE_OPTIONS "-fvisibility=default")
endif()
endforeach()
target_link_options(${target} PRIVATE
"-Wl,--version-script,${CMAKE_CURRENT_FUNCTION_LIST_DIR}/libmain.map.txt"
"-Wl,--no-undefined-version")
set_property(TARGET ${target} APPEND PROPERTY LINK_DEPENDS
"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/libmain.map.txt")
endfunction()
-9
View File
@@ -1,9 +0,0 @@
# Keep the renderer's archive name while consuming the package-owned recipe.
include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/ImagePackages.cmake")
function(kryon_webp_decoder webp_dir)
kryon_image_package(package webp)
include("${package}/native/WebP.cmake")
ziran_webp_decoder(kryonwebp "${webp_dir}")
endfunction()
-4
View File
@@ -1,4 +0,0 @@
cmake_minimum_required(VERSION 3.22)
project(KryonAVIF C CXX)
include(${CMAKE_CURRENT_LIST_DIR}/../AVIF.cmake)
kryon_avif_decoder("${AVIF_DIR}" "${AOM_DIR}")
-12
View File
@@ -1,12 +0,0 @@
{
global:
# Android loads the NativeActivity entry and registers JNI methods.
ANativeActivity_onCreate;
android_main;
JNI_OnLoad;
# Receivers and optional push services can start without an Activity.
Java_org_kryonlabs_notifications_NotificationReceiver_*;
Java_org_kryonlabs_notifications_push_*;
local:
*;
};
-5
View File
@@ -1,5 +0,0 @@
cmake_minimum_required(VERSION 3.22)
project(KryonRendererArtifact C CXX)
include("${CMAKE_CURRENT_LIST_DIR}/RaylibAndroid.cmake")
kryon_android_raylib("${RAYLIB_DIR}" "${WEBP_DIR}" "${AVIF_DIR}" "${AOM_DIR}"
"${KRYON_ANDROID_AUDIO_DIR}" "${KRYON_ANDROID_OPUS_DIR}" "${KRYON_ANDROID_SAMPLERATE_DIR}")
@@ -1,82 +0,0 @@
# The Android build of the `kryon:renderer-raylib` package artifact.
#
# Kryon's own Android host presents through the platform and needs no
# renderer (cmake/KryonAndroid.cmake). Applications that import the raylib
# renderer instead link the archives this project produces, which
# scripts/renderer_artifact.py builds and describes in renderer.json:
#
# kryon_android_raylib("${RAYLIB_DIR}" "${WEBP_DIR}" "${AVIF_DIR}" "${AOM_DIR}"
# "${AUDIO_DIR}" "${OPUS_DIR}" "${SAMPLERATE_DIR}")
#
# It defines `raylib`, `kryonwebp`, `avif_static` and, with the audio
# package, `opus`.
include_guard(GLOBAL)
include("${CMAKE_CURRENT_LIST_DIR}/../KryonAndroid.cmake")
# Compile raylib's Android backend with the module and file-format set Kryon
# uses: GLES2 rendering, raudio with OGG, PNG/JPG images, and TTF fonts, plus
# Kryon's WebP and AVIF codecs.
function(kryon_android_raylib raylib_dir webp_dir avif_dir aom_dir)
if(NOT EXISTS "${raylib_dir}/raylib.h")
message(FATAL_ERROR "No raylib source at ${raylib_dir}")
endif()
add_library(raylib STATIC
"${raylib_dir}/rcore.c"
"${raylib_dir}/rshapes.c"
"${raylib_dir}/rtextures.c"
"${raylib_dir}/rtext.c"
"${raylib_dir}/raudio.c")
# rlgl's GLES2 batch holds 2048 quads, a few dozen anti-aliased rounded
# shapes, so a phone frame flushed it many times, each upload into the
# one vertex buffer the tiling GPU had not drawn yet. A larger batch in
# two alternating buffers flushes far less often and waits on neither.
target_compile_definitions(raylib PRIVATE
PLATFORM_ANDROID
GRAPHICS_API_OPENGL_ES2
RL_DEFAULT_BATCH_BUFFER_ELEMENTS=8192
RL_DEFAULT_BATCH_BUFFERS=2
SUPPORT_SCREEN_CAPTURE=0
SUPPORT_CUSTOM_FRAME_CONTROL=1
SUPPORT_COMPRESSION_API=0
SUPPORT_AUTOMATION_EVENTS=0
SUPPORT_CLIPBOARD_IMAGE=0
SUPPORT_FILEFORMAT_BMP=0
SUPPORT_FILEFORMAT_GIF=0
SUPPORT_FILEFORMAT_QOI=0
SUPPORT_FILEFORMAT_DDS=0
SUPPORT_FILEFORMAT_TTF=1
SUPPORT_FILEFORMAT_JPG=1
SUPPORT_FILEFORMAT_PNG=1
SUPPORT_FILEFORMAT_OGG=1
SUPPORT_MODULE_RAUDIO=1
# src/backend/android_fopen.zi owns the app's __wrap_fopen; raylib's
# own APK reader keeps a distinct name so the two never collide.
__wrap_fopen=KryonRaylibFopen)
# rlgl's per-vertex batching runs for every mesh point each frame; size
# optimization made it the hottest code on low-end phones.
target_compile_options(raylib PRIVATE -O2 -ffunction-sections -fdata-sections
-fno-omit-frame-pointer $<$<NOT:$<CONFIG:Debug>>:-g1>)
target_include_directories(raylib PUBLIC
"${raylib_dir}" "${KRYON_ANDROID_NATIVE_APP_GLUE_DIR}")
kryon_android_codecs("${webp_dir}" "${avif_dir}" "${aom_dir}")
target_link_libraries(raylib PUBLIC kryon_android_codecs)
set(audio_dir "${ARGV4}")
if(NOT audio_dir STREQUAL "")
kryon_android_audio("${audio_dir}" "${ARGV5}" "${ARGV6}")
endif()
endfunction()
# Ogg Opus assets in media_audio_raylib decode with audio/opus, which needs
# libopus, built from the audio package's pinned sources (`ziran pkg path
# audio`, `libopus`, `libsamplerate`) and linked through raylib.
function(kryon_android_audio audio_dir opus_dir samplerate_dir)
if(NOT EXISTS "${audio_dir}/native/AudioCodecs.cmake")
message(FATAL_ERROR "No audio package at ${audio_dir}")
endif()
include("${audio_dir}/native/AudioCodecs.cmake")
ziran_audio_codecs("${opus_dir}" "${samplerate_dir}")
# As with raylib, debug builds still need real-time decoding on slow phones.
target_compile_options(opus PRIVATE -O2)
target_link_libraries(raylib PUBLIC opus)
endfunction()
-6
View File
@@ -1,6 +0,0 @@
# Standalone build of Kryon's WebP codec archive for native desktop hosts and
# renderer artifacts: cmake -S cmake/webp -B BUILD -DWEBP_DIR=LIBWEBP_SOURCE
cmake_minimum_required(VERSION 3.22)
project(KryonWebP C)
include(${CMAKE_CURRENT_LIST_DIR}/../WebP.cmake)
kryon_webp_decoder("${WEBP_DIR}")
+4540
View File
File diff suppressed because it is too large. Load diff
+105
View File
@@ -0,0 +1,105 @@
#ifndef KRYON_KC_INTERNAL_H
#define KRYON_KC_INTERNAL_H
#include <stddef.h>
enum {
KC_PATH_MAX = 1024,
KC_TEXT_MAX = 1024 * 1024,
KC_NAME_MAX = 128,
KC_INCLUDE_MAX = 64,
KC_USE_MAX = 32,
KC_CALL_MAX = 64,
KC_CONST_MAX = 64,
KC_DEFINE_MAX = 64,
KC_TYPE_MAX = 256,
KC_RAW_MAX = 1024,
KC_STATE_MAX = 128,
KC_BODY_MAX = 512,
KC_BODY_LINE_MAX = 1024,
};
typedef struct KryFunction {
char screen[KC_NAME_MAX];
char args[512];
char return_type[KC_NAME_MAX];
char guard[KC_BODY_LINE_MAX];
int exact_name;
int is_public;
int global_name;
char calls[KC_CALL_MAX][512];
char body[KC_BODY_MAX][KC_BODY_LINE_MAX];
int body_line[KC_BODY_MAX];
int call_count;
int body_count;
} KryFunction;
typedef struct KryFile {
char *path;
const char *root;
char *text;
char app_title[256];
int app_width;
int app_height;
int app_fps;
int app_font_examples;
char app_theme[KC_NAME_MAX];
int app_dark_mode;
int no_main;
char raw[KC_RAW_MAX][KC_BODY_LINE_MAX];
char public_types[KC_TYPE_MAX][KC_BODY_LINE_MAX];
char private_types[KC_TYPE_MAX][KC_BODY_LINE_MAX];
char state[KC_STATE_MAX][KC_BODY_LINE_MAX];
char public_globals[KC_STATE_MAX][KC_BODY_LINE_MAX];
char globals[KC_STATE_MAX][KC_BODY_LINE_MAX];
char includes[KC_INCLUDE_MAX][KC_PATH_MAX];
char include_guards[KC_INCLUDE_MAX][KC_BODY_LINE_MAX];
char const_names[KC_CONST_MAX][KC_NAME_MAX];
char const_exprs[KC_CONST_MAX][KC_BODY_LINE_MAX];
char define_names[KC_DEFINE_MAX][KC_NAME_MAX];
char define_values[KC_DEFINE_MAX][KC_BODY_LINE_MAX];
char define_guards[KC_DEFINE_MAX][KC_BODY_LINE_MAX];
char module[KC_NAME_MAX];
char module_file[KC_NAME_MAX];
char use_aliases[KC_USE_MAX][KC_NAME_MAX];
char use_modules[KC_USE_MAX][KC_NAME_MAX];
KryFunction *functions;
int raw_count;
int public_type_count;
int private_type_count;
int state_count;
int public_global_count;
int global_count;
int include_count;
int const_count;
int define_count;
int use_count;
int function_count;
int function_cap;
int current_line;
KryFunction *current;
} KryFile;
typedef struct KryMacroFrame {
char condition[KC_BODY_LINE_MAX];
char excluded[KC_BODY_LINE_MAX];
} KryMacroFrame;
void add_raw_line(KryFile *file, const char *line);
void add_type_line(KryFile *file, int is_public, const char *fmt, ...);
void add_state_line(KryFile *file, const char *line);
void expand_compile_expr(char *dst, size_t dst_size, const KryFile *file,
const char *src);
void add_guard_line(KryFile *file, const char *guard, int is_public_type,
int is_type, int is_state);
void add_guard_end(KryFile *file, int is_public_type, int is_type,
int is_state);
void combine_compile_guards(char *dst, size_t dst_size, const char *left,
const char *right);
void current_macro_guard(char *dst, size_t dst_size,
const KryMacroFrame *macros, int macro_count);
void append_macro_excluded(char *dst, size_t dst_size, const char *current,
const char *next);
#endif
+74
View File
@@ -0,0 +1,74 @@
#include "kc_internal.h"
#include <stdio.h>
#include <string.h>
void
add_guard_line(KryFile *file, const char *guard, int is_public_type,
int is_type, int is_state)
{
char line[KC_BODY_LINE_MAX];
if(guard == NULL || guard[0] == '\0')
return;
snprintf(line, sizeof(line), "#if %s", guard);
if(is_type)
add_type_line(file, is_public_type, "%s", line);
else if(is_state)
add_state_line(file, line);
else
add_raw_line(file, line);
}
void
add_guard_end(KryFile *file, int is_public_type, int is_type, int is_state)
{
if(is_type)
add_type_line(file, is_public_type, "#endif");
else if(is_state)
add_state_line(file, "#endif");
else
add_raw_line(file, "#endif");
}
void
combine_compile_guards(char *dst, size_t dst_size, const char *left,
const char *right)
{
const char *a = left != NULL ? left : "";
const char *b = right != NULL ? right : "";
if(a[0] == '\0') {
snprintf(dst, dst_size, "%s", b);
} else if(b[0] == '\0') {
snprintf(dst, dst_size, "%s", a);
} else {
snprintf(dst, dst_size, "(%s) && (%s)", a, b);
}
}
void
current_macro_guard(char *dst, size_t dst_size, const KryMacroFrame *macros,
int macro_count)
{
char guard[KC_BODY_LINE_MAX] = "";
for(int i = 0; i < macro_count; i++) {
char next[KC_BODY_LINE_MAX];
combine_compile_guards(next, sizeof(next), guard,
macros[i].condition);
snprintf(guard, sizeof(guard), "%s", next);
}
snprintf(dst, dst_size, "%s", guard);
}
void
append_macro_excluded(char *dst, size_t dst_size, const char *current,
const char *next)
{
if(current == NULL || current[0] == '\0')
snprintf(dst, dst_size, "%s", next);
else
snprintf(dst, dst_size, "(%s) || (%s)", current, next);
}
+5429
View File
File diff suppressed because it is too large. Load diff
-41
View File
@@ -1,41 +0,0 @@
# Accessibility
Kryon's retained tree owns semantic labels, kinds, hierarchy, identity,
selection, editable values and focus. Platform actions return through the
same session and widget behavior used by pointer and keyboard input. Tab and
Shift+Tab traverse eligible controls; Enter and Space activate focused
controls while editors keep their normal key handling. Modal scopes reject
outside focus, activation and edit requests.
The Linux desktop host now exposes an optional AT-SPI bridge through GIO.
It registers the application with the accessibility bus, uses retained
generations for object paths, reconciles reordered and removed objects, and
provides Accessible, Application, Component, Action, Text and EditableText
interfaces where applicable. State/name/text changes refresh the AT-SPI
cache. Callbacks run on the UI thread between frames. An unavailable bus does
not prevent an ordinary desktop app from opening.
Text offsets use Unicode scalar counts in AT-SPI and UTF-8 bytes in Kryon.
Requests that would split a grapheme cluster are rejected. Read-only editors
omit EditableText. Passwords expose neither plaintext nor text length or
selection. Edit requests are queued; the widget applies its existing limits
and returns a caller-owned edit for the application to accept. A successful
platform request acknowledges the queue rather than promising application
acceptance. Each request and text read is limited to 64 KiB.
Custom Linux hosts can import `kryon/AccessibilityLinux`, call
`AccessibilityOpen`, poll between frames, synchronize after successful
commits and close before disposing the session. Supply the window's
client-area screen position with `AccessibilityOrigin`; the desktop host
updates it from its own SDL window. The default origin is (0, 0).
`sh tests/native_accessibility_test.sh` builds source and saved-IR fixtures
and drives them through real libatspi on private Xvfb and DBus sessions. It
checks discovery, identity after reorder, focus, Unicode text/selection,
readonly and disabled controls, modal blocking and password redaction.
These checks establish the implemented protocol paths, not complete Orca or
other screen-reader usability. Text boundary/extents methods, list Selection,
table interfaces, and Windows/macOS/mobile accessibility remain unverified
or unsupported. Raylib, Canvas2D and terminal hosts do not currently
provide the Linux bridge automatically.
+162
View File
@@ -0,0 +1,162 @@
# Kryon Agent Guide
This document is for agents and maintainers using Kryon inside applications such as
Inbe. It describes the behavior Kryon owns, what application code should keep, and
how to update downstream projects without editing vendored copies by hand.
## Role
Kryon is a small immediate-mode UI layer on top of raylib. Applications should use
Kryon for shared UI behavior instead of duplicating pointer capture, modal backdrop,
button, tab, scroll, text input, theme, and DPI logic in each project.
Keep application code focused on product state and domain behavior. Move repeated UI
interaction rules into Kryon when more than one screen or project needs them.
## Frame Lifecycle
Call `BeginUIFrame(width, height, dpi)` once at the start of a normal
screen-space UI frame. If the application uses a transformed UI camera, call
`InitUI(width, height, dpi)` and then `SetUIFrame(camera)` instead. Kryon sanitizes
invalid cameras before using them; a zero-initialized `Camera2D` is treated as
`GetUIDefaultCamera()` so pointer input does not silently break.
Beginning a frame resets per-frame interaction state:
- input blocking
- modal capture state from the previous frame
- input clip stack
- focus registrations
- pointer gesture state
- clip state
Do not persist `ui_set_input_blocked` or input clips across frames. Register them again
while rendering the UI that needs them. Modal capture is registered while drawing the
modal and Kryon carries it into the next frame. Until the current frame registers the
modal bounds again, Kryon captures all pointer input so controls underneath the modal
cannot receive clicks before the modal is drawn.
## Input Capture
Every clickable Kryon control should gate pointer interaction through
`UIInputCapturesClick(point)` or the lower-level helpers already used inside Kryon.
That keeps scroll drags, dropdowns, modal backdrops, and explicit input blockers from
leaking clicks to the screen underneath.
Use these APIs by responsibility:
- `UIInputCapturesClick(point)`: normal public check for app or component code.
- `ui_base_input_captures_click(point, include_pointer_drag)`: internal/specialized
components that need to decide whether pointer dragging should count as capture.
- `ui_set_input_blocked(blocked)`: full-frame blocking for overlays that should stop
all controls for the rest of the frame.
- `SetUIModalCapture(bounds)`: modal-specific capture that blocks background
clicks, then allows controls inside the active modal rectangle after the modal
registers its bounds. It applies immediately and to the next frame.
## Modal Rules
Kryon modal helpers own backdrop capture:
- `DrawUIActionModal`
- `DrawUIModal`
- `DrawUIModal3Button`
- `DrawUIModalFrame`
When an application uses one of those helpers, it should not add separate outside-click
guards or duplicate backdrop blocking. The helper registers the modal bounds for the
current frame and the next frame.
Prefer `DrawUIActionModal` for title, message, and action-button dialogs. It measures
button labels, fits text inside buttons, and wraps actions into multiple rows when
localized labels do not fit. Prefer `DrawUIModalFrame` for custom modal content.
Use manual
`SetUIModalCapture` only for specialized overlays that cannot use the shared modal
frame.
When an application draws a custom modal manually, it must call
`SetUIModalCapture((Rectangle){x, y, w, h})` immediately after calculating the modal
rectangle and before drawing modal controls. This prevents clicks outside the modal from
activating the underlying screen, prevents controls underneath the modal from receiving
clicks before the modal is drawn, and keeps buttons, sliders, dropdowns, and text fields
inside the modal usable.
Do not manage modal click blocking in application-level route code. The application
should decide whether a modal is open and what state changes happen after a modal
button is clicked; Kryon should decide whether pointer input is captured.
## Custom Modal Pattern
```c
int modal_w = ScaleUIPx(320);
int modal_h = ScaleUIPx(240);
int modal_x = (view_width - modal_w) / 2;
int modal_y = (view_height - modal_h) / 2;
SetUIModalCapture((Rectangle){
(float)modal_x, (float)modal_y, (float)modal_w, (float)modal_h
});
DrawRectangle(0, 0, view_width, view_height, (Color){0, 0, 0, 180});
DrawRectangle(modal_x, modal_y, modal_w, modal_h, GetThemeSurface());
```
Before this call on a frame following an active modal, Kryon captures all pointer input.
After this call, normal Kryon controls inside the rectangle remain clickable because
their hit tests are inside the active modal bounds. Controls outside the rectangle see
the click as captured in the current frame and the next frame.
## What To Move Into Kryon
Move behavior into Kryon when it is general UI behavior rather than product behavior:
- repeated modal shell drawing or backdrop capture
- repeated button hit testing, hover, disabled, and focus handling
- repeated scroll clipping or scrollbar handling
- repeated dropdown open/capture behavior
- repeated text input editing and platform text input activation
- repeated theme color derivation or DPI scaling helpers
Keep behavior in the app when it is domain-specific:
- navigation route selection
- practice/session state machines
- settings persistence
- app-specific copy and locale keys
- app-specific icons and assets
- business rules for confirmation or cancellation
## File Dialog Backends
Kryon owns desktop file dialog backend selection. Applications should call
`LoadFileDialog`, `SaveFileDialog`, or `SelectFileDialogFolder` instead of invoking
desktop-specific picker commands directly.
The default backend order is `zenity`, then `kdialog`, then `yad`. For local
diagnostics and packaging checks, `KRYON_FILE_DIALOG_BACKEND` can be set to `auto`,
`zenity`, `kdialog`, `yad`, or `none`.
Do not add permanent app dependencies on an XFCE-specific picker. If a downstream app
needs different desktop behavior, add the backend support in Kryon first, then update
the downstream submodule pointer.
## Downstream Submodule Workflow
Applications should vendor Kryon as a git submodule. Do not edit
`vendor/kryon` directly for permanent changes.
Use this flow:
1. Edit the real Kryon repository.
2. Commit and push Kryon.
3. In the downstream app, update the `vendor/kryon` submodule to the pushed commit.
4. Commit the downstream app's submodule pointer and any app code needed to use the new
Kryon API.
This keeps Kryon reusable and prevents project-local vendor edits from diverging.
## Documentation Rules
Keep `docs/API.md` as the public API reference. Keep this guide as the operational
guidance for agents and maintainers. Documentation in Kryon should describe current
APIs, current behavior, and the expected downstream workflow.
+1476 -2310
View File
File diff suppressed because it is too large. Load diff
+91
View File
@@ -0,0 +1,91 @@
# Kryon App Build Plan
Goal: Kryon owns the repeatable build and packaging flow for every Kryon app.
App repositories should provide app metadata, native sources, `.kry` sources, and
assets. Kryon should provide the compiler, runtime, dependency builds, packaging
helpers, IDE preview hooks, and diagnostics.
## App Contract
Each app should define one project file, `project.kryon`, with the portable
metadata Kryon needs:
- app id, name, title, version, license, maintainer, website, categories
- source roots for C and `.kry`
- asset roots for images, sounds, fonts, locales, and generated embedded assets
- platform knobs such as Android id/activity, Linux desktop metadata, package
names, and signing-key variables
- build feature flags such as file dialog, tray, sync, audio, and web runtime
The app repo may keep small glue files for platform entry points, but target
selection, dependency build rules, generated Kryon C output, and package layout
should come from Kryon.
## Unified Commands
Kryon should expose one command surface for all apps:
- `kryon build native`
- `kryon build web`
- `kryon build android-debug`
- `kryon build android-release`
- `kryon package linux`
- `kryon package appimage`
- `kryon package deb`
- `kryon package rpm`
- `kryon package flatpak`
- `kryon package snap`
- `kryon package click`
- `kryon package windows`
- `kryon preview`
- `kryon test`
Makefiles in app repos should become thin wrappers that call these commands.
## Build Ownership
Kryon owns:
- strict `.kry` parsing and file:line:column diagnostics
- generated C and headers under the app build directory
- runtime source selection for native, web, Windows, Click, and Android
- Raylib, curl, liboqs, and other shared vendor build rules
- embedded asset generation
- Linux desktop files, icons, metainfo, AppImage, deb, rpm, Flatpak, Snap, and
Click packaging helpers
- Android CMake, Gradle property generation, APK/AAB assembly hooks, and asset
copy helpers
- web/WASM HTML, JS, data-file generation, cache busting, and smoke-test hooks
- Podman-backed Linux packaging where host tools are missing or platform
isolation is needed
Apps own:
- product code and app-specific C modules
- `.kry` pages, widgets, and screens
- translations and media assets
- app metadata values in `project.kryon`
- optional platform-specific shims that cannot be generalized cleanly
## Migration Phases
1. Rename old build variables and paths from Flint to Kryon in every app.
`vendor/kryon` is the only runtime submodule path.
2. Keep app Makefiles working, but make them use `KRYON_DIR` and Kryon-owned
`mk/*.mk` includes exclusively.
3. Move repeated Makefile logic from Inbe into Kryon `mk/app.mk`,
`mk/android.mk`, `mk/web.mk`, and `mk/package-linux.mk`.
4. Add a Kryon CLI wrapper that reads `project.kryon` and invokes the shared
make fragments with normalized variables.
5. Convert app Makefiles to compatibility shims, then remove duplicated app-side
package/build rules.
6. Make the IDE use the same build graph for preview/run so errors from manual
build, auto preview, and package targets use one diagnostic format.
7. Add template checks so new Kryon apps start with the unified layout.
## Vendor Rule
Vendored Kryon directories are pinned dependencies. App builds must not modify
files under `vendor/kryon`. Regenerated Kryon runtime assets, generated icon
tables, and shared packaging helpers must be changed in the root Kryon
repository, committed there, and consumed by updating the app submodule pointer.
-52
View File
@@ -1,52 +0,0 @@
# Kryon architecture
Kryon supplies reusable UI behavior as Ziran modules. Ziran owns the source
language, checker, standard library, `.zir`, `.zx`, code generation, and
portable execution. Applications import Kryon only when they need its UI
library. The compiler and bundle loader have no Kryon-specific branches.
## Source ownership
| Location | Responsibility |
| --- | --- |
| `src/ui/*.zi` | Widget APIs, retained tree, layout, input decisions, styling, text, accessibility policy, and paint commands |
| `src/backend/*.zi` | Terminal and window hosts: platform observations, native bindings, rasterization, and presentation |
| `src/project/*.zi` | Kryon project tool that builds an app through Ziran |
| `tests/*_host.zi` | Ziran behavior-test hosts; not part of the library or application hosts |
| Application repositories | Screens, assets, translations, product data, and workflows |
| Game2D repository | Optional game API; Kryon determines its shared raylib revision when both packages are used |
All maintained implementation files under `src/` are `.zi`. The core module
inventory is [`src/ui/modules.txt`](../src/ui/modules.txt). Applications import
each widget package by name, such as `Text :: #import "kryon/text";`, and the
shared core modules they use. Optional packages
have separate imports and build targets; the core UI does not import them.
## Widget and host boundary
The host observes input and submits it to a `Session`. Kryon widget modules
decide focus, hit testing, layout, semantics, styling, and paint commands.
The host supplies system effects such as windows, terminal output, font and
image loading, rasterization, and storage. A host should not implement a
second set of widget decisions.
An application exports `Frame(session: Session, viewport: Rectangle) -> s32`.
The selected host calls it between `BeginFrame` and `EndFrame`. Package
profiles choose the terminal, desktop, raylib or Canvas2D host;
see [BACKENDS.md](BACKENDS.md). A non-graphical Ziran program can
import a Kryon policy module without selecting any of these hosts.
## Build and verification
`make` checks the Ziran modules, writes `.zir`, generates C and Go,
compiles native objects, and creates a C archive from generated source.
`make test` exercises the checked library through source, saved `.zir`, and
portable `.zx` behavior, Canvas2D Wasm effects, and packaged Canvas2D
browser applications in private headless Chromium. Desktop and
raylib package tests run separately on private Xvfb displays;
CI runs them too. `make sanitize-test` repeats the behavior tests with AddressSanitizer and UndefinedBehaviorSanitizer.
[FEATURE_MATRIX.md](FEATURE_MATRIX.md) states exactly what those checks cover.
Ziran's generic capabilities should be added to Ziran and imported here.
Kryon-specific compiler cases, compatibility runtimes, and app-specific
screens do not belong in this repository.
-730
View File
@@ -1,730 +0,0 @@
# Kryon hosts
Kryon's reusable widget, layout, input, and composition code is written in
Ziran under `src/ui/`. An application imports the widget packages it uses,
such as `Text :: #import "kryon/text";`, and exports `Frame(session: Session, viewport: Rectangle) ->
s32`. A selected host under `src/backend/` owns the process entry point,
window or terminal, platform input, rasterization, and presentation. Ziran has
no special knowledge of Kryon widgets.
Select a host with a profile in the application's `ziran.toml`:
```toml
[tool.kryon]
default_profile = "desktop"
[tool.kryon.profiles.desktop]
backend = "desktop"
```
Run `ziran tool kryon build` or `ziran tool kryon run` from the application.
See [Ziran projects](PROJECTS.md) for the complete package manifest.
MediaAudio's Raylib and Canvas providers support individual voice Pause/Resume.
Raylib uses Pause/ResumeMusicStream and Pause/ResumeAudioStream, and reports
GetMusicTimePlayed for asset music. Canvas retains music offsets against the
AudioContext clock and re-creates only that voice's source on explicit Resume;
paused PCM retains at most two immutable buffers and their remaining offsets.
No owner pauses the shared context. See [MediaAudio](API.md) for capability
bits and position availability. Native tests use Raylib/miniaudio's paced null
backend; browser tests use a disposable muted headless context and trusted gesture.
Ogg Opus assets decode through the `audio` package on native Linux and Windows;
those targets link `-lopus -lm` (the `renderer-raylib` artifact ships a static
`lib/libopus.a`). Android portable guests use the platform `MediaPlayer`
service through JNI instead of carrying an audio codec.
## Renderer artifacts in build scripts
The package exports `renderer-raylib`, `renderer-desktop` and `renderer-web`
artifacts for the supported native and browser targets. Request them through
`ziran pkg artifact kryon:NAME --platform OS-ARCH-ABI`, using the application's
package wrapper and locked graph. Ziran's `scripts/ziran_artifacts.py` verifies
the descriptor and its declared outputs; see its package guide for the Python
`Artifact` and `request` API.
Kryon's `scripts/renderer_artifact.py` provides the renderer-specific consumer
functions alongside its provider. Load it from the resolved `pkg path kryon`
directory and call `renderer_metadata(artifact)` with that verified artifact.
It validates the renderer/platform combination, compile/link argument types,
resources, include directories and virtual preload mounts, then returns
metadata with absolute paths. Every archive, resource, JavaScript library and
preload must be a declared artifact output. Paths resolve beside that
artifact, regardless of the build script's working directory.
`renderer_link(metadata, preloads=True)` returns ordered linker arguments,
including JavaScript libraries and browser preloads. Set `preloads=False`
when a host supplies those files separately. `compile_flags`, `defines` and
`include_directories` remain separate metadata fields for the host compiler
or CMake invocation. Application editions, asset lists and output names stay
in the application.
## Available hosts
| Profile backend | Ziran entry | Presentation |
| --- | --- | --- |
| `terminal` | `src/backend/terminal_run.zi` | 80 × 24 terminal cells via `terminal.zi` |
| `desktop` | `src/backend/desktop_run.zi` | SDL2 window with Cairo raster |
| `raylib` | `src/backend/raylib_run.zi` | raylib SDL2/OpenGL ES 2 window |
| `raylib` with `platform = "web"` | `src/backend/raylib_run.zi` | raylib WebGL 1 page with Emscripten and Asyncify; see [raylib in the browser](#raylib-in-the-browser) |
| `canvas` | `src/backend/canvas_run.zi` | Canvas2D page with Emscripten and Asyncify |
| `android` | app `src/main.zi` → `android_run.zi` | Android NativeActivity package with direct `ANativeWindow` pixel presentation |
The small application surface selects the host from the compile-time target.
Import `kryon/app` and call `App.Run(window, draw)`: C/Linux uses
`kryon/host/desktop`, while C/Web uses `kryon/host/web`. Advanced hosts can
import those named host packages directly. The desktop implementation uses
`cairo_raster.zi` and `desktop_loop.zi`.
After `PollDesktop()`, custom loops call `DesktopInputTake(session)` to transfer
the next ordered editing action or printable-key/text run into that session.
The returned key uses shared codes, including 320–329 for numeric-keypad
digits, and carries the modifiers held when that key arrived.
Standalone `AppContext` applications use the compiled host
`canvas_app_run.zi`.
Polygon-clipped images use native Cairo/Canvas path clips. Raylib caches bounded polygon triangulations and draws them directly on the
GPU, including all Jungle puzzle pieces. Complex polygons and pixel hosts use
clipped spans while preserving the original source mapping.
SDL pixel hosts prefer accelerated texture presentation without blocking on
vertical refresh. `SDL_RENDER_DRIVER` retains explicit driver selection,
including `software`; hosts without an accelerated driver use software
presentation automatically. Pixel rasterization remains on CPU workers.
Desktop windows become visible only after their first complete frame has
been uploaded and presented. A failed initial upload or copy leaves the
window hidden until presentation succeeds.
The `image_preview` module also supplies `ImageCompress` for smaller upright
JPEG copies. It keeps transparent and animated originals intact and returns
no replacement when encoding would increase file size.
## raylib in the browser
A `raylib` profile with `platform = "web"` builds the same raylib host, or a
project's own raylib host, as a WebGL page. raylib's `PLATFORM_WEB` library
(GLFW through Emscripten, OpenGL ES 2 on WebGL 1, with `rmodels` and `raudio`)
builds once into `build/raylib-web/`, and the generated program is compiled
with `PLATFORM_WEB` defined, so no POSIX threads are used.
```toml
[tool.kryon.profiles.web]
backend = "raylib"
platform = "web"
host = "src/host.zi" # optional custom raylib host
assets = "assets" # mounted at /assets
preload = "client/bin/textures@textures mods"
```
| Key | Meaning |
| --- | --- |
| `platform` | `web` builds a browser page. It needs `backend = "raylib"` with c99 codegen; `library`, `static_archive` and `native_artifacts` are rejected. |
| `host` | A project host as for native raylib. The default is `raylib_run.zi`. |
| `assets` | One project directory, mounted at its own relative path. |
| `preload` | Space-separated project directories, `DIR` or `DIR@MOUNT`, mounted at `/DIR` or `/MOUNT`. It needs `platform = "web"`. |
`ziran tool kryon build --profile web` writes `index.html`, `index.js`,
`index.wasm` and, when files are preloaded, `index.data` to
`build/NAME-PROFILE/`. A new build replaces the directory only after the link
succeeds. Serve that directory over HTTP, not `file://`, so the page can fetch
its module and data. Copy it as a whole, for example to a site's `play/`
directory. The page's working directory is `/`, so relative asset paths
resolve as they do from the project directory on the desktop. Kryon's UI font
is preloaded at `/kryon-font.ttf`. The page's `<title>` and raylib's window
title come from `[tool.kryon.install] name` or else the package name. The page
records how the program ended in `document.body.dataset.kryon` (`exit CODE` or
`abort REASON`).
The program keeps its ordinary blocking loop. Emscripten's ASYNCIFY suspends
the program inside `PollRaylib()`: raylib's web `WindowShouldClose()` sleeps
12 ms, which returns to the browser so it can present the frame and deliver
input. The frame rate therefore depends on that sleep. Kryon sets raylib's
target FPS to 0 in the page, because a frame limit would spin the browser's
only thread. A custom host follows these rules:
- Call `OpenRaylib(width, height, title, flags)` once. Pass
`FLAG_WINDOW_RESIZABLE` (4, the default) so the canvas follows the browser
window, and keep the result of `RaylibViewport()` per frame rather than the
opening size.
- Loop on `while PollRaylib() { ... }` from `main` or a procedure called
directly by it. Each frame calls `PollRaylib()` once. Do not wait, sleep or
spin anywhere else in the loop.
- Inside a frame call `RaylibFrameInputBegin(session)`, then
`BeginRaylibFrame()`. Draw the world after it: clear the background, then
call `BeginMode3D`, the 3D drawing and `EndMode3D`. Then call
`BeginFrame(session, ...)`, the app's `Frame`, `EndFrame`,
`FrameInputEnd(session)` and `EndRaylibFrame()`. Kryon paints above
whatever the host drew earlier in the frame.
- Use only GLES2/WebGL 1 features: no geometry shaders, `#version 100`
shaders, and power-of-two textures when mipmaps or repeat wrapping are
needed.
- Read files through the preloaded mounts. Writes stay in the page's memory
file system and are lost on reload.
- Leave out native-only libraries: threads, `#system_library` libraries other
than raylib, libc and libm, and `RunRaylibAppFrame` worker pipelines. WebP assets
decode with the `webp` package's authored still-image engine; AVIF assets
do not decode in this host.
- Return from `main` to end the page. `CloseRaylib()` releases the WebGL
context.
`make raylib-web-project-test` builds such a host, with a 3D cube under a
Kryon `Box` and `Image`, and checks the page in private headless Chromium.
## Experimental SDL3 GPU renderer
Custom Linux x86_64 GNU hosts can import `kryon/pixmap_sdl3` and
`kryon/pixmap_sdl3_gpu`. This is an opt-in rendering prototype, rather than a
new project profile: the host supplies an SDL3 window, input loop and
presentation. Existing desktop, SDL2 and Raylib profiles keep their behavior.
The handwritten renderer is Ziran; SDL3 supplies the GPU API and shaders.
Kryon's `native-sdl3` artifact builds static SDL 3.4.18 from its pinned official
source package. No Git submodule or global SDL3 installation is needed. Build
prerequisites are a GNU C toolchain, CMake, pkg-config, Python 3.11+, X11
development headers and Vulkan headers/loader. Running requires an SDL3 GPU
device, which may be software. On Debian/Ubuntu the additional test packages
are `libvulkan-dev mesa-vulkan-drivers libx11-dev libxext-dev libxtst-dev xvfb xauth`.
From the Kryon checkout, with Ziran available:
```sh
build-queue -- env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY \
-u DBUS_SESSION_BUS_ADDRESS make sdl3-test
```
This resolves and builds the locked SDK through Ziran, verifies its declared
outputs, and runs shared scene, geometry adapter and real private-Xvfb renderer
tests. Package metadata and the generated import smoke test stay under ignored
`work/sdl3-integration`; there is
no copied source checkout or hard-coded SDK cache key. The Linux CI hosts job
runs the same target with Mesa's software Vulkan device. Missing GPU support
fails the test instead of skipping it.
A host's minimal rendering sequence uses the ordinary package exports:
```zi
Sdl3 :: #import "kryon/pixmap_sdl3";
Sink :: #import "kryon/pixmap_sdl3_gpu";
// After SDL3 initialization and window creation, on the window's thread:
renderer := Sdl3.CreatePixmapSdl3Renderer(window)
// Check renderer != null, then Sink.PixmapSdl3Open(renderer).
// Create and retain a target with Sink.PixmapSdl3CreateTarget(width, height).
// Record normal pixmap painting, then check Sink.PixmapSdl3Draw().
// Copy the target to the window with SDL_RenderTexture and SDL_RenderPresent.
// Close the sink before destroying host-owned targets, renderer and window.
```
`CreatePixmapSdl3Renderer` explicitly requests SDL's `gpu` renderer and returns
null on failure, without trying another renderer. Inspect
`PixmapSdl3DescribeRenderer(renderer)` for the renderer name, API, device name
and driver information; its strings are borrowed until renderer destruction.
A `gpu` renderer using `vulkan` does not establish hardware acceleration.
The verified local device was **llvmpipe LLVM 19.1.7 / Mesa 25.0.7**, a software
Vulkan implementation. These tests establish rendering behavior, not hardware
performance.
The sink shares `pixmap_gpu`'s clipped geometry, glyph atlas, paint order and
single active recorder. Image publications and sink calls must use the renderer
thread. After a failed draw, close/open and repaint fully; after an SDL render
device reset, call `PixmapSdl3DeviceLost`, recreate the host-owned target and
repaint fully. The sink does not destroy host-owned render targets.
The CPU parity tests cover five scenes and three frames each. Blending has small
rounding differences (observed maximum channel difference 3). Exact nearest
texel ties in the 1.25× zoom scene can choose the adjacent texel, as in the SDL2
reference; the test accepts only analytically identified checker boundaries
within the image and clip. The shared sampler is therefore not byte-exact at
those ties. SDL3 also converts byte colors to float colors in 1536-vertex chunks,
which can add draw calls; this does not establish a speedup over SDL2 or Raylib.
See the executable lifecycle example in
[`tests/sdl3_renderer_host_test.zi`](../tests/sdl3_renderer_host_test.zi).
After `make sdl3-test`, the separate comparison harness is available with
`build-queue -- python3 tests/backend_render_benchmark.py --smoke`. It records
device identity, parity and raw samples under ignored
`work/backend-render-benchmark`. The test-only Raylib adapter currently fails
the zoom scene's pixel oracle, so the comparison returns status 2 and excludes
that scene's Raylib timings. This does not make the SDL3 integration test fail.
For SDL2 versus SDL3 on a physical AMD GPU under Linux, use the explicit
hardware mode (choose the render node from `/sys/class/drm/renderD*/device`):
```sh
build-queue -- env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY \
-u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 \
python3 tests/backend_render_benchmark.py --mode hardware \
--device /dev/dri/renderD129 --trials 5 --frames 1200 --warmup 240 \
--output work/backend-render-benchmark/hardware.json
```
Hardware mode uses SDL2 offscreen EGL/OpenGL and SDL3 offscreen Vulkan with
a headless surface, without the desktop compositor. It removes inherited
software-driver overrides and selects Mesa's Vulkan device by vendor/device
ID. Selection is only a request: both hosts must report a physical renderer
and nonzero Linux DRM graphics-engine execution on the requested PCI device.
The report records that device's render node, PCI address, vendor/device IDs,
kernel driver, renderer/API and Mesa versions. A mismatched device, software
renderer, missing execution evidence or failed pixel oracle blocks hardware
timing. This qualification currently requires AMD's Linux DRM counters; it
does not infer acceleration from the Vulkan API name. Raylib is excluded
from this hardware comparison. The default software mode still forces
llvmpipe on private Xvfb; `--backends sdl2 sdl3` restricts its smoke test.
Every selected backend must pass all 120 frames of all five 480×320 scenes
before hardware timing starts, using the same channel tolerance and narrow
checker-boundary rule described above. Parity exercises presentation as well
as target readback. Repeated trials randomize backend order per scene and
record CPU compose/submit/present p50/p95, individual frame samples, per-trial
drained wall throughput and load averages. Drained wall throughput includes
the final synchronous readback and CPU conversion; it is not a GPU timestamp
measurement. Offscreen results do not measure visible-window/compositor
performance, and other running workloads and GPU clock changes remain
uncontrolled. No backend default or SDL2 software fallback is changed.
The 2026-11-02 hardware run used AMD Radeon Graphics
(RAPHAEL_MENDOCINO), `/dev/dri/renderD129`, PCI `0000:7a:00.0`,
vendor/device `1002:13c0`, kernel `amdgpu`, Mesa 25.0.7. SDL2 used
radeonsi OpenGL 4.6; SDL3 used RADV Vulkan. Both passed 600 parity frames,
with zero failures after the specified checker-boundary allowance. Five
randomized trials per scene used 1,200 timed frames and 240 warmup frames.
Median drained frames/s, SDL2 then SDL3, were:
- Text: 7,709 / 7,115 (SDL3 −7.7%).
- Images: 2,819 / 2,894 (+2.7%).
- Shapes: 4,047 / 4,794 (+18.5%).
- Scroll: 8,270 / 6,633 (−19.8%).
- Zoom: 9,829 / 7,406 (−24.7%).
These are scene-specific observations from this machine, with trial spread
and concurrent workloads; the small image difference does not establish a
general advantage. The old forced-software comparison is not hardware
evidence. Raw frame samples and DRM counters are in ignored
`work/backend-render-benchmark/hardware.json`; the compact
`hardware-summary.json` includes every trial's throughput and CPU latency
p50/p95. Load averages were approximately 6.3/6.1/5.9 at both ends of the run.
## AVIF images
Native AVIF and WebP decoding is supplied by the standalone Ziran `avif`,
`webp` and `image_codec` packages. Kryon selects the platform engine and adapts
caller-owned straight RGBA8 into host pixels, surfaces and textures. Codec
parsing, native ABI and frame composition belong to those packages. The current
native engines explicitly bridge pinned external libraries; this integration
makes no authored AV1 decoder or performance claim.
Content routing uses the packages' bounded prefix predicates; their decoders
perform complete container validation. Kryon's CMake entry points consume the
packages' shared native build recipes and retain the existing target names and
archive locations. Package directories come from `ziran pkg path`; renderer
artifacts pass their resolved dependency paths explicitly. Custom CMake hosts
can set `KRYON_AVIF_PACKAGE_DIR` and `KRYON_WEBP_PACKAGE_DIR` to those paths.
The adapters allocate the final host buffer once. AVIF probes metadata, then
revalidates and decodes the same immutable encoded buffer into that storage;
this repeats bounded metadata parsing without copying a full owned output.
Failed decode, cancellation and changed output dimensions release the buffer
before publishing any pixels. Browser codecs and pixel-renderer inputs retain
their existing paths.
`Image.Draw(Image.Props)` accepts AVIF assets through the same path as PNG/JPEG/WebP,
including extensionless names and packaged bundle/APK assets. Raylib hosts opt
in with `AVIF_RAYLIB` and the pinned archives; builds without it decode no AVIF
and link no codec library. Native hosts
decode with the locked libavif 1.3 and dav1d, its assembly selected at run time
for the CPU (x86 SSE2 to AVX-512, ARMv7 and AArch64 NEON); Android 9 requires
no OS AVIF support. libaom is linked as the explicit comparison oracle, never
as a fallback. The still-image API shows the first complete frame of a
sequence. The ARMv7 oracle keeps libaom's portable kernels, because the locked
AOM/NDK combination emits unaligned NEON loads which fault on real Android
hardware; dav1d's own NEON runs there. The ARMv7 device suite covers both Debug
and Release, including the original large YUV420 crash input and background
image loading.
8/10/12-bit color and monochrome decode to straight 8-bit RGBA; alpha and
container clean aperture, rotation and mirroring are preserved. The renderer
then premultiplies for Cairo or composites normally in Raylib. HDR tone mapping
and ICC display color management are outside the existing 8-bit image surface.
Encoded files are limited to 256 MiB, dimensions to 32768 per axis and pixel
count to 67,108,864 (a 256 MiB RGBA buffer). These are independent axis/count
limits, permitting wide images below the pixel budget. Invalid/truncated
containers, invalid crops and oversized images return no image. 4:2:0 frames
of at least 8 MiP and other frames of at least 2 MiP decode on the process's
usable cores, capped at 4 threads; smaller frames use one, because threading
slowed them by up to 2.7x on the Moto. Thread count never changes output
bytes. Only the first decoded frame is retained.
| target | engine | proof |
|---|---|---|
| Linux x86-64 | dav1d, SSE2..AVX-512 | executed: strict parity, benchmark |
| Android armeabi-v7a | dav1d NEON | executed on the USB Moto (MT6765, Android 9): parity, benchmark |
| Android arm64-v8a | dav1d NEON, dotprod, i8mm | static build under qemu-user: strict parity |
| Android x86, x86_64 | dav1d SSSE3..AVX-512 | static build on the x86-64 host: strict parity |
| Linux AArch64 | dav1d NEON, dotprod, i8mm | qemu-user: strict parity |
| Windows, macOS | dav1d via the same recipe | unverified here |
`mk/raylib-library.mk` builds `AVIF_A`, `AOM_A` and Linux `AVIF_SO` beside the
existing renderer archives; `AVIF_A` contains dav1d. Building it needs Meson,
Ninja and, on x86, NASM; `ZIRAN_AVIF_TOOLS` can name a directory holding the
avif package's pinned Meson/Ninja. `kryon_android_codecs(webp, avif, aom)`
links the static codec for each ABI; older scaffolds receive the source paths
through `KRYON_ANDROID_AVIF_DIR`, `KRYON_ANDROID_AOM_DIR` and `KRYON_DAV1D_DIR`
(otherwise dav1d comes from the locked package graph). The Raylib artifact
includes the static codec archives. The desktop artifact includes the
self-contained `libkryonavif.so`; `renderer_link` retains it as a runtime
dependency so application packaging tools carry it into their lib directory.
Cairo also searches beside the executable and its `lib`/`../lib` directories;
`KRYON_AVIF_LIBRARY` can select an explicit codec file for custom hosts.
Canvas uses the browser AVIF decoder through `PageImageDecode`; supported
browsers (Firefox 93+, Chromium 85+, Safari 16.4+) supply their native AVIF
implementation. In a browser without AVIF, every AVIF decode fails cleanly:
no pixels and zero size, so the image is treated like any undecodable file,
while PNG, JPEG and WebP keep working. Ship a fallback format for such
browsers. The pure pixel renderer accepts decoded pixel buffers through
`PixmapSetImage`, as for other formats.
`make avif-decode-test` runs independent RGBA goldens from source and saved IR,
and checks dav1d (automatic, 1 and 8 threads) and the libaom oracle against the
strict libavif digests in `tests/avif_strict_digests.zi`, tolerance 0. The
independent goldens keep small documented tolerances: ±1 for 10/12-bit and
grayscale (8-bit rounding of the source pattern), ±4 premultiplied (unpremultiply
rounding) and ±3 for Jungle title samples (YUV420 conversion versus Pillow).
`make avif-render-test` checks real Cairo and private-display Raylib rendering,
including a portable bundle using the public Image widget. `make android-avif-test
ANDROID_NDK=... ANDROID_SERIAL=ZE2223BQZT` builds all four ABIs and runs the
ARMv7 strict-parity/golden-pixel tests on the Android 9 USB Moto, asserting each
ABI's dav1d assembly. `make avif-cross-test [AVIF_CROSS_ROOT=...] [ANDROID_NDK=...]`
runs the strict parity test for Linux AArch64 and static Android arm64-v8a
under qemu-user (Cortex-A53 and every emulated feature) and Android x86/x86_64
on the host; `AVIF_CROSS_ROOT` is a prefix holding the AArch64 GCC and
qemu-aarch64. `make avif-browser-test` exercises the Canvas image
boundary in private headless Firefox, reporting the AVIF capability, and repeats
it as a browser without AVIF. `make avif-benchmark [ANDROID_SERIAL=ZE2223BQZT]
[AVIF_BENCHMARK_BROWSER=1]` records ms/image, MP/s and peak RSS for libaom,
dav1d threads and SIMD tiers, and Firefox, in `build/scratch/avif-benchmark`.
The headless package suite, `build-queue -- sh tests/image_integration.sh`,
resolves real native artifacts and tests source and saved IR under ASan, UBSan
and leak detection, including adapter failure cleanup. With development-only
package overrides, set `ZIRAN_ROOT` and `ZIRAN_BIN` to the rebuilt toolchain.
## WebP images
Images, image previews and app media files accept WebP wherever they accept
PNG or JPEG, recognized by the file's `RIFF`/`WEBP` signature rather than
its name. Lossy, lossless and alpha pictures decode to straight RGBA. An
animated WebP decodes to its first complete frame, since Kryon images are
still; `ImageCompress` keeps animated originals unchanged.
- The raylib and Android hosts decode through `webp_image.zi` with libwebp's
decoder and animation demuxer, built from the locked `libwebp` source
package into the static `kryonwebp` archive (`cmake/WebP.cmake`, no
encoder or threads). Images above 67108864 pixels are refused. The static
adapter retains its 2147483647-byte input cap; Cairo retains its 256 MiB
encoded-file budget.
`mk/raylib-library.mk` builds it as `WEBP_A` beside `RAYLIB_A`;
`kryon_android_codecs` builds it for each ABI; the `renderer-raylib`
artifact lists `lib/libkryonwebp.a` in its archives.
- The desktop (Cairo) host loads the system libwebp demuxer
(`libwebpdemux.so.2`) on first use, like its other optional codecs.
- The canvas host uses the browser's own WebP decoder.
`make raylib-webp-decode-test` and `make test-focus TEST=ziran_image_decode_linux_test` decode the
`tests/fixtures/webp` pictures natively, `tests/webp_browser_test.py` does the
same in headless Chromium, and `make android-webp-link-test` links the
decoder for every Android ABI.
The PNG byte and pixel rules are Ziran in `png.zi`. PNG supports all standard
color types and depths, transparency, all five filters, and Adam7 interlace.
Sixteen-bit samples use their high byte; ancillary color profiles and gamma
are ignored. `tests/ziran_png_test.sh` compares independent reference pixels
for 33 fixtures through source and saved IR in bundles, C and Go, including
malformed streams and bounded decoder output.
The raylib host uses `raylib_runtime.zi` and the raylib revision pinned as a
Ziran source dependency. The canvas host uses its dedicated `canvas_raster.zi` provider over
a Canvas2D browser ABI; see [Canvas2D browser host](canvas.md). Backend build
dependencies and link flags live in `mk/ziran-project.mk`. Platform calls are
declared with Ziran foreign imports; handwritten host implementation is
Ziran.
On Linux, the Raylib host resolves system typefaces and missing characters
through [Fontconfig](https://fontconfig.pages.freedesktop.org/fontconfig/fontconfig-devel/).
Measurement and drawing use the same fallback face and advances. TrueType and
OpenType collections are extracted into owned standalone font bytes following
the [OpenType table and checksum rules](https://learn.microsoft.com/en-us/typography/opentype/spec/otff).
Glyph atlases remain available for later frames, and queued text is flushed
before replacing an atlas.
Missing characters are checked against the source before rebuilding an atlas.
Text measurement refreshes the base atlas; cached drawing sizes refresh only
when used, so a new character cannot rebuild every cached zoom at once.
`make raylib-typeface-test` decodes real fonts and checks mixed Latin/CJK text,
supplementary characters, collection bounds and checksums, retained sources,
and disposal in C from source and saved IR. It replaces only graphics
submission and texture allocation, so it needs no display and does not verify
rendered pixels. Supply `RAYLIB_A` for an existing Raylib archive (and
`RAYLIB_LIBS` for its link flags); Fontconfig and an installed CJK outline font
are required. Whole-application captures still require a private display.
Browser projects save the selected `_run` host and `canvas_raster.zi` as
generation roots without entry pruning. This keeps both the host `main` and
the raster adapters available to the paint queue. Native projects continue
through the ordinary package entry route.
## Smooth images (Lanczos)
A smooth picture (`.smooth = true`) is shown at the device pixels it
covers through one shared cache, `src/backend/lanczos_cache.zi`. The copy is
std/resample's Lanczos-3, which gives the same bytes as Pillow's
`Image.resize(size, LANCZOS, box)`. It is computed over premultiplied
pixels and drawn pixel for pixel. The key is the picture's content, its
revision, the source rectangle, the device-pixel size and the session.
Until a copy is ready, the backend draws the previous copy of the same
picture stretched, or uses its own filter if there is none. The finished
copy replaces it in one step. A changed or released picture forgets its
copies. Distinct sizes of the same source and revision coexist within the
LRU budgets, so a large cover and its small marker do not evict each other.
- Only axis-aligned draws under a plain translation are cached. Rotation,
scaled transforms, meshes, polygon strips and render targets keep the
backend's own filter. A whole-pixel draw at the source's own size needs no
copy.
- Limits: a copy is at most 4096 pixels per side and 4,194,304 pixels; all
copies together take at most 64 MiB, and one session at most 32 MiB.
- Like Pillow, filtering works on the stored sRGB bytes, not in linear
light.
- Copies are made on a worker thread with a std/parallel pool in builds
with `POSIX_THREADS`, `ANDROID_BUILD` or `KRYON_FRAME_THREADS`. A browser
build without threads makes a slice of rows each frame instead (about two
million filter taps). Other builds keep the backend's filter.
| Backend | Lanczos copy |
| --- | --- |
| Desktop/Cairo | Cached surface, drawn 1:1 |
| Raylib | Uploaded texture; the CPU copy is freed after upload |
| pixmap and SDL3 GPU | A copy slot drawn 1:1 (threaded builds only, `PIXMAP_LANCZOS`), so the CPU rows and GPU hosts show the same bytes |
| Canvas | Ziran resampler in slices, from the texture's pixels read back, then uploaded |
Firefox has no `imageSmoothingQuality`. Canvas therefore does not rely on
it, and still sets it to `high` for upright smooth draws that it does not
cache; meshes and images that the draw or a camera turns keep the browser's
default.
The cached Canvas copy matches Pillow for opaque pictures. Translucent
pictures differ by the browser's 8-bit premultiplied blend, up to about
3.5 levels on average.
A web profile's page carries two builds of the program: one compiled with
`-msimd128` and a baseline one. A small script in the page starts the
SIMD128 build where `WebAssembly.validate` accepts a SIMD probe module, so
Canvas copies use std/resample's SIMD128 kernels, and the baseline build
elsewhere. Both builds give the same bytes. The page stays one file, and the
font is carried once for both builds (`mk/web-page.sh`).
`tests/web_simd_page_test.py`, part of `make canvas-project-test`, checks
this in headless Firefox and Chromium.
A host that sleeps between events calls `PixmapLanczosPending` or
`LanczosSetWake` so it draws again when a copy finishes. The desktop loop
already does this by pushing a wake event. `PixmapLanczosWait` and
`LanczosWait` finish the current copy; captures use them so every
smooth picture is final.
`make lanczos-goldens-test` (part of `make test`) compares Cairo, pixmap,
Raylib on a private Xvfb display and Canvas in headless Firefox against
Pillow goldens. `make lanczos-benchmark` times Kryon against Pillow,
Pillow-SIMD, libvips and stb_image_resize2. It reports ms per output
megapixel, extra peak memory and PSNR against a float64 reference, on
x86-64 and over ADB on an ARMv7 phone. It writes
`build/scratch/lanczos-bench/receipt.md`. The comparison libraries are
test-only oracles.
## Android host
`backend = "android"` builds an installable APK instead of a native binary.
Add the profile and the application id to `ziran.toml`:
```toml
[tool.kryon.profiles.android]
backend = "android"
[tool.kryon.android]
package = "com.example.app"
min_sdk = "21" # optional, 21 by default
abis = "arm64-v8a" # optional, arm64-v8a by default
```
`kryon build --profile android` generates a `droid/` Gradle project beside
the application sources on the first build (never overwriting existing
files), then assembles a debug APK through the Android Gradle plugin, the
NDK, and CMake. `kryon run --profile android` additionally installs and
launches it on a connected device through adb, and `kryon check --profile
android` checks the whole Zi graph with the Android defines. The build needs
a JDK, the Android SDK with NDK `28.2.13676358` and CMake `3.22.1`
(`ANDROID_HOME`, default `$HOME/Android/Sdk`), and the locked `libwebp`,
`libavif` and `libaom` source packages. Scaffolds pass their source roots to
`kryon_android_codecs`; the packaged host links no renderer or audio library.
A custom raylib Android host defines `KRYON_RAYLIB_HOST` during Ziran generation.
This selects raylib's pointer and clipboard exports while retaining Android
platform services. Direct touch consumers call `AndroidPointerFrame()` and
`AndroidSecondarySample()` from `android_touch`; those samples do not replace
the selected renderer's generic input exports.
JNI also selects raylib's `GetAndroidApp()` for this host, so private files,
Java calls and process preparation use the raylib-owned NativeActivity.
Before initializing graphics, custom hosts can read the announced native window
with `GetAndroidPendingSurfaceSize(width, height)` from `android_surface`. It
returns positive dimensions without consuming or acknowledging lifecycle commands.
Once EGL is current, surface synchronization reads its drawing-buffer extent.
If raylib's fixed buffer request no longer matches the native window after
picture-in-picture, synchronization releases that request. Subsequent EGL
buffers follow the native window size; software hosts use the native window.
The same synchronization maps window-local touch samples into the decorated
surface, including replayed quick taps and logical zoom.
At runtime a `NativeActivity` subclass owns the Java side: it reports window
insets, display cutouts, IME state, density, dark mode and orientation
through JNI natives registered by the generated `src/android_glue.zi`, and
forwards soft-keyboard text as codepoint, backspace and enter events. The
generated `src/main.zi` delegates to `AndroidRunMain`, which owns Android's
looper and lifecycle, drives the session with the current Ziran VM and Pixmap
runtime, and applies Kryon's Android viewport policies to the session-owned
text input queue. `Frame` always receives the safe area, clear
of the system bars and cutouts; a backdrop meant to run behind them draws into
`AndroidWindowBounds()`. Applications with their own JNI surface
keep their own `JNI_OnLoad` and call `AndroidJniOnLoad` with their activity
class to add the canonical natives. An application without Java code, a plain
`NativeActivity`, calls `PollAndroidWindowInsets` once per frame instead: it
reads the system bar, keyboard and cutout insets from the window through JNI
a few times a second, and stops once Java reports them.
The generation runs `ziran ir --project` for the whole graph, so application
module names may repeat Kryon module names; every package is prefixed in the
emitted C. `tests/ziran_android_device_test.sh` checks the device protocol
headlessly with the Java side stubbed.
`android_device.AndroidRequestOrientation(policy)` queues an ActivityInfo
screen-orientation policy through `requestOrientation(int)` in the scaffold
activity, which calls `setRequestedOrientation` on the UI thread. Custom
activities must provide that method. `AndroidOrientationSensor` (4) permits
sensor portrait and landscape; `AndroidOrientationSensorLandscape` (6) keeps
landscape. The caller owns route policy and deduplication. A true result means
the Java call succeeded, not that the OS has applied a rotation. Configuration
observations still use `AndroidOrientation()` and are independent of requests.
Android runs the native host loop on NativeActivity's app thread. Each poll
drains lifecycle and input events, snapshots the current touch/key state,
runs one VM frame through Pixmap, and presents the damaged viewport by locking
and unlocking `ANativeWindow`; there is no EGL, OpenGL ES or second render
thread. Rotation, surface destruction and redraw requests invalidate the
retained bitmap, while consecutive quiet frames can pace at 100 ms instead of
16 ms until the next event. Pausing stops presentation and platform media;
resuming restores the existing guest state.
Touch, pointer, soft-keyboard and hardware-key events are consumed only inside
that frame boundary, so guest code receives a stable input snapshot and no
platform callback reenters the VM. The same viewport transform maps single
and secondary pointers into guest coordinates.
Portable ZX images are decoded before a guest is activated and retained in two
bounded host slots. PNG, WebP and AVIF use native codecs; JPEG can use the
platform decoder and all camera images apply EXIF orientation. A valid
replacement promotes candidate pixels only after its services and images load;
an invalid document leaves the previous guest, pixels and private data intact.
MediaPlayer reads a private file written from bundle bytes and supports the
portable play, pause, resume, stop, gain and completion surface.
## Frame and input ownership
A host polls platform input and submits it to the session before calling the
application's `Frame`. The application and widgets consume generic session
input such as `KeyboardTake`, `TypedCodepointTake`,
`PointerWheelTake`, and pointer state. `KeyboardModifiers` reports
Shift, Control, and Alt keys as `KeyModifierShift`, `KeyModifierControl`, and
`KeyModifierAlt` bits, so a shortcut such as Ctrl+S is a key press read with
the modifiers that were down. Desktop, Canvas and Raylib custom loops call
`DesktopInputTake(session)`, `CanvasInputTake(session)` or
`RaylibInputTake(session)` before each frame. Each take transfers ordered text
to that session and returns the next key with the modifiers retained when the
press or repeat arrived, so shortcuts remain intact even when every physical
key is released before a frame. `CanvasModifiers()` and the immutable frame
snapshot keep their held-state semantics. Other hosts report none.
The host calls `BeginFrame` and
`EndFrame` around application composition, then presents the resulting
paint operations. Widget behavior stays in `src/ui/`.
The terminal host renders one frame when input or output is redirected. With
a TTY, it submits ASCII and UTF-8 text to the same session input API as the
window hosts and ignores terminal escape sequences. The project test drives
this through a private PTY. The other hosts can capture a frame with
`KRYON_CAPTURE_PATH`; the graphical integration tests run on private Xvfb
displays. Run `make test` for the library, browser, and typeface gates, plus
`make desktop-project-test` and `make raylib-project-test` for graphical
capture and input.
Never run graphical tests against the developer's live display.
The SDL/Cairo desktop host also exposes `DesktopSetTitle(title)` and
`DesktopTakeDroppedFile(output)` through `Desktop`. A file-manager drop queues
up to sixteen complete UTF-8 paths (4095 bytes each), only for the host's own
window. The application consumes and opens them during `Frame`; an output
buffer that is too small leaves the next path queued. Text drops are ignored.
## Portable programmable scene rendering
`scene_render` executes `shader` material programs in Ziran on CPU before
presentation. Cairo, Raylib (including WebAssembly), and Android's
ANativeWindow/Pixmap host consume the resulting managed bitmap through the
standard Image surface. These hosts do not need a shader-language bridge.
This interface does not claim GPU execution, GLSL compilation, vertex-shader
execution or GPU performance. See [programmable scene materials](API.md#programmable-scene-materials)
for binding ownership, colour space, clipping, alpha and explicit scratch release.
Programs and pictures contain no context-bound handles. Recreate the host
presentation context as usual; keep or re-upload the owned bitmap and render
again as needed. Shader discard affects colour rendering, not depth-map shadows.
Host lifecycle tests must verify bitmap re-upload after teardown; checking a
shader declaration alone does not establish host execution.
The physical-device regression `make shader-android-test` executes Ziran shader
materials and the Pixmap-to-ANativeWindow presentation path on the USB Moto. It
uses a private offscreen AImageReader window, verifies posted RGBA pixels,
clipping, alpha and binding changes, and destroys/recreates that window while
keeping the CPU program and bitmap alive. It does not launch or alter an owner
app. `make shader-web-test` exercises the corresponding Raylib WebGL presentation
inside a private headless browser. These targets also load a real PNG through
`kryon/image_pixels`; activity-bound Android asset/JNI decoding is a separate
application integration responsibility.
Native scene frames can render on the shared Ziran range-worker capability
when source generation enables `POSIX_THREADS`. Immutable transformed geometry
and ordered triangle commands are prepared once; each lane clears, draws and
resolves disjoint rows, joining once per frame. The scene owns its pool
separately from the presentation raster; `RenderSceneRelease` joins and
closes it. This is CPU row parallelism and does not change texture resolution,
four-sample coverage, shader operations or draw ordering. WebAssembly without
pthread support retains the same serial implementation. Application code must
keep all borrowed material inputs unchanged through the render call.
## Optional native GPU scene rendering
`kryon/scene_gpu` is an explicit native EGL/GLES3 host for the same Scene and
material APIs. It renders offscreen with four MSAA samples, depth-map shadows,
retained geometry/programs/textures and an Image readback bridge. It creates no
window and preserves the caller's current graphics context. Link only consumers
of this module with `-lEGL -lGLESv2 -lGLX -lm`; core UI and `scene_render` imports retain
their existing portable and WebAssembly dependencies.
`kryon/shader_glsl` supplies portable material translation used by this host.
The translator alone has no EGL dependency. GPU execution uses highp floats
and hardware coverage, so it has pixel tolerances relative to the binary64 CPU
oracle. Capability failures are explicit; the separate `SceneGpuRenderOrCPU`
call permits a full-quality CPU frame and reports `accelerated=false`.
Probe/render/resource counters must establish acceleration and retained upload
behavior before reporting GPU timing. A module export or successful link alone
does not establish application integration or deployment.
See [GPU scene APIs](API.md#portable-glsl-translation-and-optional-native-gpu-rendering)
for ownership, lifecycle, capability requirements and local test targets.
## Custom application entry
Applications that own their frame lifecycle import `kryon/application_entry`
and export `KryonApplicationMain(argc: s32, argv: **u8) -> s32` with
`#program_export "KryonApplicationMain"`. The adapter owns `main`: native
hosts forward their exact command line and browser hosts pass `(0, null)`.
The callback retains initialization, frame scheduling and shutdown policy;
Android's NativeActivity host can call the same native entry. Do not define
an additional application `main` when importing this adapter.
-24
View File
@@ -1,24 +0,0 @@
# Repository boundaries
| Owner | Code and data |
| --- | --- |
| Ziran | Language, compiler, standard library, `.zir`, `.zx`, and generic host capabilities |
| Kryon | Reusable Ziran UI modules, widget decisions, and UI hosts |
| Game2D | Optional game API and game behavior using Kryon's selected raylib backend |
| Applications | Screens, copy, translations, assets, data storage, migrations, and product workflows |
Kryon is imported by applications. It is not linked into programs that never
import it, and the Ziran compiler does not special case widgets. A generic
capability missing from the language belongs in Ziran. A reusable UI choice
belongs in Kryon. A product-specific behavior belongs in the application.
Kryon's graphical host owns platform windows, input events, and presentation.
Its widget modules own focus, pointer capture, layout, semantics, and paint
decisions. The host may call native libraries through declared Ziran foreign
bindings, but must not duplicate widget policy.
Make upstream Kryon changes on `master` and commit them there. A downstream
app picks them up by updating its `ziran.lock`, or, if it still vendors
Kryon, by moving its clean `vendor/kryon` submodule pointer. Never edit
Kryon's source inside an application. See [ARCHITECTURE.md](ARCHITECTURE.md)
for source modules and [PROJECTS.md](PROJECTS.md) for package use.
-18
View File
@@ -1,18 +0,0 @@
# Clipboard state
`src/ui/clipboard.zi` is a checked, portable UI value module. Applications
keep a `ClipboardState` and own the bytes referenced by its strings. A platform
host supplies system clipboard observations with `ClipboardObserve` and reads
`ClipboardPendingWrite` to apply requested OS writes. After a successful OS
write, it calls `ClipboardWriteCompleted`. Pending writes take precedence over
older host observations.
`ClipboardCopySelection` updates the primary selection and requests a system
write for nonempty text. Copying an empty selection clears the primary value
without erasing the current system value. `ClipboardRead` selects system,
primary, or primary with system fallback. The checked text widgets return
copy, cut, and paste intents; the application handles those intents using this
state and its platform host.
OSC 52 and bracketed paste are terminal protocols. The Terminal application
implements them; Kryon does not.
-105
View File
@@ -1,105 +0,0 @@
# Kryon portable components
A Kryon component is a separately bundled Ziran entry plus its declared host
capabilities. `ComponentHost` owns stable namespace/name identities and up to
sixteen live components. All components share the host's retained tree, input
session, style state, paint queue and renderer. Their owned widget state stays
inside each ZX instance.
## Lifecycle
Open a component with `ComponentHostOpen`, run slots together with
`ComponentHostFrame`, and replace one with:
```ziran
ComponentHostReplace :: (host: *ComponentHost, id: u64, zx: []u8) -> bool
```
`ComponentHostAcquire`, `ComponentHostHandleValid`,
`ComponentHostCloseHandle`, `ComponentHostLiveBytes` and `ComponentHostClose`
complete the public lifecycle. Ziran's bundle-component ABI checks code and
capability identity. Kryon additionally records each admitted capability's
typed ABI descriptor per slot.
Replacement opens the candidate outside the live registry, checks its typed
ABI, and migrates its owned state. Verification composes the migrated candidate
on a private session and commits its tree/paint queue without flushing any
raster effects. Staged text editors return clipboard intents without reading or
writing the system clipboard, and staging does not bind audio services. The
active tree, focus, input and framebuffer stay untouched.
The validation frame's state changes are discarded before Ziran atomically
commits replacement. Each component has a stable retained-tree scope, so local
widget keys may repeat in different components. All sixteen slots may be live
while a replacement is staged. A failed ABI, initialization, schema, resource or
verification candidate is closed and the old component remains runnable.
Unrelated slots keep their state and handles. A successful replacement
invalidates old handles.
`COMPONENT_CAPABILITY_HOST`, `COMPONENT_CAPABILITY_INPUT`,
`COMPONENT_CAPABILITY_WIDGET` and `COMPONENT_CAPABILITY_TREE` are independent
grants. A component that imports only text therefore does not carry button or
renderer code merely because another slot uses them.
State migration matches portable global values by module and name. Scalars
move directly; the recursive matcher also supports matching owned strings,
fixed arrays and nested records by field name and type. Borrowed pointers and
slices are rejected. The replacement's `component_schema_version` in its entry module is retained
and must meet the slot's minimum version. Other matching globals migrate. New globals keep their initialized values.
The counter test fixtures preserve a nested record, an owned string and a fixed
array as well as scalar state; the replacement keeps its new initialized
suffix field.
`ComponentHostLiveBytes` returns Ziran's owned portable-value payload bytes.
It is not immutable code bytes, bundle bytes, renderer memory or process RSS.
## Local integration test
Replacement versions, status guests, and deliberate failures live under
`tests/fixtures/component_*`. They are test inputs, separate from the public
component usage examples.
Run `build-queue -- env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_component_host_test.sh`.
The test builds each selective guest from both source and saved IR and compares
ZX bytes. A native Ziran host runs two live components into the retained tree
and CPU pixmap renderer. It checks interaction, nested-state migration,
ABI/init/schema/resource and migrated-frame rejection, unchanged pixels/focus/
queued input on rollback, staged clipboard isolation with a live-copy positive
control, independent local keys, stale handles and replacement
with every registry slot occupied. It reports bundle/gzip size, swap/frame time,
owned-value bytes and process peak RSS. These are local native/portable-VM
results; they do not establish Android device integration.
## Browser integration test
Run `build-queue -- env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 PYTHONDONTWRITEBYTECODE=1 python3 tests/component_browser_test.py`.
The dedicated Zi/Wasm host uses the production `ComponentHost`, `WidgetHost`,
Canvas2D renderer and canonical Ziran browser runtime. A disposable headless
Chromium profile receives actual pointer and key events. WebGL is disabled and
all WebGL context requests are counted. Source and saved-IR guest bundles must
match byte for byte.
The test proves migrated state, old-handle invalidation, independent B text
input after swapping A, focus and queued-input continuity, and unchanged live
pixel hashes through ABI/schema/resource/initialization/truncation and migrated
render rejection. The same clipboard-copy candidate is accepted with initial
state and rejected with changed state, proving the render verifier executed.
Staging performs zero clipboard calls; a normal editor copy reaches the real
browser clipboard API as a positive control. It reports measured browser swap
time and owned-value bytes. No visible desktop or Browser MCP is used.
## Caller-owned widget state
TagInput, OneTimeCode, InlineEdit, ScrubField, MoneyField and ShortcutRecorder,
and Tooltip, Sheet, CommandPalette, HoverCard, ConfirmPopover and GuidedTour
share their canonical native composition with hosted guests. The boundary
passes typed props and owned state values and returns both updated state and
the widget result. No caller pointer crosses the boundary. Command, tour and
initial-tag slices are decoded into bounded host storage. SheetBegin/SheetEnd
also preserve the host scope stack for caller-composed content.
The component tests edit all six input states, exercise all six overlays, then
reject a clipboard-producing candidate and migrate those records to a second
ZX version. The native CPU renderer and actual Canvas2D browser host both use
this fixture. State storage bounds are validated before composition; hosted
TagInput currently permits 32 tags, matching its 2048-byte storage at 64 bytes
per tag. Android device coverage for this fixture remains pending.
-47
View File
@@ -1,47 +0,0 @@
# Composition input
Kryon's checked `TextField` and `TextArea` accept raw composition events in
`props.input.composition_event`. They return the next `CompositionState` and,
for a commit, a normal byte-range edit. The caller owns the committed text and
applies that edit before the next frame.
`composition_input.zi` exposes `SampleComposition()` as an ordinary Ziran
library function. It calls the platform's `PollComposition` capability and
returns a `CompositionSample`. Convert an available sample with
`CompositionEventForSample(sample)` and pass it to the focused text widget.
An unavailable sample converts to a no-op event. Events have the same phase
numbers as the platform input phases: start 1, update 2, commit 3, cancel 4.
`src/backend/composition_queue.zi` implements a single-threaded queue for up
to 16 pending events. `BeginCompositionFrame`, `SubmitComposition`, and
`TakeComposition` manage ordering, owned byte copies, and UTF-8 truncation.
The queue is tested from source and saved `.zir` on C and Go targets.
Portable applications bind `composition_input:PollComposition` to an ordinary
Ziran provider with `ziran bundle --bind`; the checked test uses this route for
source and saved `.zx` execution. A native platform host may implement the
same `PollComposition() -> CompositionSample` function directly. The returned
text must stay alive while the caller uses it. A caller that retains
`CompositionState.text` must copy the bytes into its own storage before the
provider releases them. Kryon owns composition decisions, preedit paint, and
commit ranges; platform adapters own event delivery.
## Graphemes and native shaping
TextField and TextArea cursor movement, deletion, selection boundaries and
wrapping use the standard library's Unicode 17 grapheme segmentation. This
keeps combining accents, family emoji, modifiers, regional-indicator flags
and Indic joins intact, including joins across preedit segments. Existing
`max_codepoints` limits continue to count Unicode scalars.
The native Cairo host uses Pango for shaping, bidirectional placement and
font fallback. Caret measurement uses the full shaped line rather than a
separately shaped prefix. `tests/native_text_test.sh` checks combining marks,
Arabic joining, Hebrew caret/hit positions and text longer than the former
1,024-byte draw limit through source/saved IR and C.
Logical Left/Right movement is still by grapheme order. Mixed bidirectional
selection uses a single highlight rectangle, and separately styled preedit
runs are not shaped as one joined run. Pixmap, raylib and other hosts retain
their own font/rendering capabilities; Cairo shaping does not imply all-host
bidirectional support.
-17
View File
@@ -1,17 +0,0 @@
# Cursor input
`src/ui/cursor.zi` owns cursor shape choice and priority. An application keeps
one `CursorFrame` per window. At the start of a frame, call
`CursorBeginFrame(state)`. For hovered widgets, call `CursorRequest(state,
shape)`, optionally using `CursorShapeForWidget(kind, disabled)` to choose the
shape. The latest request at the highest priority wins; resize shapes outrank
clickable, text, and disabled shapes. At the end, call `CursorEndFrame(state)`
and retain `decision.state`. When `decision.apply` is true, the application
applies `decision.state.applied` to its own cursor API.
No Kryon host callback is required. The platform maps the requested shape to
its own cursor API; it does not decide which widget gets which shape. The
default, text, clickable, resize, and disabled shape numbers are 0, 2, 4,
5–9, and 10.
This checked path is ordinary Ziran and returns only values.
-37
View File
@@ -1,37 +0,0 @@
<!DOCTYPE html>
<!-- Generated by scripts/feature-matrix-html.py. DO NOT EDIT MANUALLY. -->
<html><head><meta charset="utf-8">
<title>Kryon Feature Matrix</title>
<style>
body{font-family:system-ui,sans-serif;max-width:1100px;margin:2rem auto;padding:0 1rem;color:#1a1a1a;background:#fafafa}
h1{border-bottom:3px solid #333;padding-bottom:.4rem} h2{margin-top:2.2rem;border-bottom:1px solid #ccc;padding-bottom:.25rem}
h3{margin-top:1.6rem;color:#333}
table{border-collapse:collapse;margin:1rem 0;font-size:.92rem;width:100%}
th,td{border:1px solid #bbb;padding:.42rem .6rem;text-align:left;vertical-align:top}
th{background:#2b2b2b;color:#fff;position:sticky;top:0}
tr:nth-child(even) td{background:#f2f2f2}
td.ok{background:#d9f2dd !important} td.part{background:#fdeebc !important}
td.no{background:#fbd5d2 !important} td.na{background:#e8e8e8 !important;color:#888}
code{background:#eee;padding:.08rem .3rem;border-radius:3px;font-size:.85em}
pre{background:#222;color:#ddd;padding:1rem;border-radius:6px;overflow-x:auto}
li{margin:.25rem 0}
</style></head><body>
<h1>Kryon feature matrix</h1>
<p>This table describes the maintained Ziran library and hosts. Kryon is imported by a Ziran application; it is not a language or a built-in Ziran runtime. Ziran owns compilation and portable <code>.zx</code> execution. See <a href="ARCHITECTURE.md">ARCHITECTURE.md</a> and <a href="BACKENDS.md">BACKENDS.md</a> for the module and host boundaries.</p>
<h2>Library packages</h2>
<table>
<tr><th>Package</th><th>Ziran source</th><th>Native code generation</th><th>Package verification</th></tr>
<tr><td class="">Core UI (<code>src/ui</code>)</td><td class="ok">✅ <code>.zi</code> modules listed in <code>modules.txt</code> and two public import modules</td><td class="ok">✅ C and Go generation in <code>make</code></td><td class="ok">✅ <code>make test</code> builds the library and runs source, saved <code>.zir</code>, and <code>.zx</code> behavior tests</td></tr>
</table>
<p>The generated C archive is a build output of Ziran source. Behavior tests use Ziran hosts in <code>tests/*_host.zi</code>. Code generation verifies that a module lowers for a target; it does not prove that every native host runs on that target.</p>
<h2>Application hosts</h2>
<table>
<tr><th>Backend</th><th>Implementation</th><th>Input and presentation verification</th><th>Current status</th></tr>
<tr><td class="">Terminal</td><td class=""><code>src/backend/terminal_run.zi</code></td><td class="">Private PTY project test covers ASCII, UTF-8, invalid input, and escape sequences</td><td class="ok">✅ supported</td></tr>
<tr><td class="">Desktop</td><td class=""><code>src/backend/desktop_run.zi</code></td><td class="">Private Xvfb project test covers image capture, keyboard, UTF-8 text, and wheel input</td><td class="ok">✅ supported on the tested Linux host</td></tr>
<tr><td class="">Raylib</td><td class=""><code>src/backend/raylib_run.zi</code></td><td class="">Private Xvfb project test covers image capture and input</td><td class="ok">✅ supported on the tested Linux host</td></tr>
<tr><td class="">Web Canvas</td><td class=""><code>src/backend/canvas_run.zi</code></td><td class="">Headless Chromium checks Canvas2D pixels, clips, input, textures, fonts, lifecycle, WebAudio, and file behavior</td><td class="ok">✅ supported through Emscripten on the tested browser</td></tr>
<tr><td class="">Android</td><td class="">app <code>src/main.zi</code> + <code>src/backend/android_run.zi</code></td><td class=""><code>tests/ziran_android_device_test.sh</code> checks the device text, lifecycle, and inset protocol with the Java side stubbed; a manual emulator run verifies install, rendering, touch, and back</td><td class="ok">✅ supported through NativeActivity with raylib OpenGL ES 2</td></tr>
</table>
<p>The desktop and raylib project tests run separately with <code>make desktop-project-test</code> and <code>make raylib-project-test</code>; they must use a private Xvfb display. CI runs both on every push in their own job. The Canvas2D project test runs in <code>make test</code> and launches only private headless Chromium.</p>
</body></html>
-32
View File
@@ -1,32 +0,0 @@
# Kryon feature matrix
This table describes the maintained Ziran library and hosts. Kryon is
imported by a Ziran application; it is not a language or a built-in Ziran
runtime. Ziran owns compilation and portable `.zx` execution. See
[ARCHITECTURE.md](ARCHITECTURE.md) and [BACKENDS.md](BACKENDS.md) for the
module and host boundaries.
## Library packages
| Package | Ziran source | Native code generation | Package verification |
| --- | --- | --- | --- |
| Core UI (`src/ui`) | ✅ `.zi` modules listed in `modules.txt` and two public import modules | ✅ C and Go generation in `make` | ✅ `make test` builds the library and runs source, saved `.zir`, and `.zx` behavior tests |
The generated C archive is a build output of Ziran source. Behavior tests use
Ziran hosts in `tests/*_host.zi`. Code generation verifies that a module lowers
for a target; it does not prove that every native host runs on that target.
## Application hosts
| Backend | Implementation | Input and presentation verification | Current status |
| --- | --- | --- | --- |
| Terminal | `src/backend/terminal_run.zi` | Private PTY project test covers ASCII, UTF-8, invalid input, and escape sequences | ✅ supported |
| Desktop | `src/backend/desktop_run.zi` | Private Xvfb project test covers image capture, keyboard, UTF-8 text, and wheel input | ✅ supported on the tested Linux host |
| Raylib | `src/backend/raylib_run.zi` | Private Xvfb project test covers image capture and input | ✅ supported on the tested Linux host |
| Web Canvas | `src/backend/canvas_run.zi` | Headless Chromium checks Canvas2D pixels, clips, input, textures, fonts, lifecycle, WebAudio, and file behavior | ✅ supported through Emscripten on the tested browser |
| Android | app `src/main.zi` + `src/backend/android_run.zi` | `tests/ziran_android_device_test.sh` checks the device text, lifecycle, and inset protocol with the Java side stubbed; a manual emulator run verifies install, rendering, touch, and back | ✅ supported through NativeActivity with raylib OpenGL ES 2 |
The desktop and raylib project tests run separately with
`make desktop-project-test` and `make raylib-project-test`; they must use a
private Xvfb display. CI runs both on every push in their own job. The Canvas2D
project test runs in `make test` and launches only private headless Chromium.
-66
View File
@@ -1,66 +0,0 @@
# Frame capture, replay and inspection
`EndFrameCapture(session)` commits a frame and records its retained nodes and
resolved paint commands before emitting raster effects. It replaces
`EndFrame(session)` in a capture-enabled application. Bind the capture
capabilities declared in `frame_capture.zi`, including `RecordFrameFailure`.
A rejected frame reports its status, message, widget key and kind and emits no
raster effects. Ordinary `EndFrame()` needs no capture bindings.
Run a portable bundle with:
```sh
tools/frame-replay.sh app.zx app trace.txt capture.json
tools/frame-inspect.sh capture.json 3 1
tools/frame-inspect.sh --diff baseline.json candidate.json
```
The inspector prints a frame's inputs and nodes, or a selected node with its
paint commands, colors, font sizes and clips. Comparison reports the first
changed JSON field, ignores object key order and preserves exact integer
identities. Exit codes are 0 for matching/valid frames, 1 for differences or
rejected frames, and 2 for invalid arguments or files. Files are limited to
64 MiB each.
The entry takes no arguments, returns an integer, and samples exactly one
input record per frame. Existing entries may keep a module-local
`PollPointer() -> PointerFrame`. Five-column traces remain supported:
```
x y down pressed released
```
For keyboard, text, composition, wheel, resize, clipboard and time, declare a
module-local `PollFrameInput() -> FrameInput` and use the twenty-column format:
```
x y down pressed released secondary_down secondary_pressed secondary_released key modifiers wheel width height elapsed_ms text_hex ime_phase ime_cursor ime_selection ime_hex clipboard_hex
```
Boolean fields are 0 or 1. Modifiers use Shift=1, Control/Command=2, Alt=4.
Key codes are the same codes accepted by `KeyboardSend`. Composition phases
are none=0, start=1, update=2, commit=3, cancel=4. Composition cursor and
selection lengths count UTF-8 bytes. Text, composition and clipboard payloads
are hexadecimal UTF-8 bytes, with `-` for empty; each payload is bounded to
256 bytes. Coordinates and wheel values must be finite; the viewport is
positive and elapsed milliseconds nonnegative. Blank lines and `#` comments
are accepted. A trace holds at most 1,024 samples within 1 MiB.
`FrameInputApply` supplies session pointer, key, modifier and wheel inputs;
`FrameInputField` converts text and composition into a `TextField.Input`.
Applications explicitly use the recorded viewport and elapsed time rather
than reading wall time. Clipboard reads use the recorded input and clipboard
writes appear in the JSON. Rich traces produce format version 2; legacy
pointer traces keep version 1.
Capture includes focus, read-only state, selection and committed editor text.
Secure editor values, lengths and selections are redacted. A document larger
than 64 KiB retains its length but omits its full value from the capture.
The application still owns state and applies the edits returned by widgets.
Replay uses fixed font measurements and a headless raster sink, so it checks
UI decisions rather than platform-specific pixels or font fallback.
`tests/ziran_frame_capture_test.sh` and `tests/ziran_frame_input_test.sh`
compare source and saved-IR bundles and exercise edits, IME, clipboard,
resizing, rejection diagnostics and inspection. The runners use locked,
stable build directories and scrub the desktop environment.
-135
View File
@@ -1,135 +0,0 @@
# Input components
These six Ziran components cover the selected modern input families without an
external compatibility layer. Each render entry is `(Session, Props, *State) -> Result`;
each `Apply` function has the same behavior without requiring a building frame.
Caller-owned state is plain fixed-size data, including text bytes, so it can be
copied or serialized. No component owns global text, focus, clipboard, or
shortcut state.
All compositions submit real retained-tree nodes, resolve the installed theme
and stylesheet through the current style facts, and use the existing field, box,
text, paint, and session primitives. IDs, style classes, disabled state, focus,
bounds, and supported font/geometry/motion metrics remain customizable. A
disabled component neither accepts text nor keeps focus.
## Tag input
```ziran
TagInput :: (session: Session, props: TagInputProps,
state: *TagInputState) -> TagInputResult
TagInputApply :: (state: *TagInputState,
props: TagInputProps) -> TagInputResult
```
`TagInputState` owns up to 64 tags and their stable caller IDs, the editable
text, selection, scroll, and focus. Initial IDs can be supplied through
`TagInputStateInit`; newly entered tags receive stable generated IDs.
Commit text on Enter or `TextField.Input.commit`. A nonempty separator also
splits committed and pasted text. Spaces can be trimmed, duplicates rejected,
and a positive `max_tags` enforced. Backspace on an empty field requests removal
of the final tag through `field.backspace_on_empty`; explicit removal is by
`remove_index` or stable `remove_id`. Results distinguish add, remove, duplicate
rejection, maximum count, removed ID, and number added. The group, chips, remove
buttons, and nested field all honor disabled state and stylesheet cascade.
## One-time code
```ziran
OneTimeCode :: (session: Session, props: OneTimeCodeProps,
state: *OneTimeCodeState) -> OneTimeCodeResult
OneTimeCodeApply :: (state: *OneTimeCodeState,
props: OneTimeCodeProps) -> OneTimeCodeResult
```
The state owns 1–12 alphanumeric slots, the cursor, focus, and prior completion.
Typed characters insert at the cursor and advance it. Left/right move, Backspace
deletes backward, and paste replaces all slots after filtering invalid bytes.
Escape blurs and reports cancellation. Completion is emitted only when the code
becomes full after a real change; it is not repeated by later frames or input.
Masked rendering shows `*`. This is only an input component and performs no
authentication or delivery.
Slots use the canonical 44×52 default, optional six-digit grouping, current
control radius, and display font. Width, height, radius, both gaps, and font
size are explicit style metrics. The group, every slot, and every character are
real retained nodes.
## Inline edit
```ziran
InlineEdit :: (session: Session, props: InlineEditProps,
state: *InlineEditState) -> InlineEditResult
InlineEditApply :: (state: *InlineEditState,
props: InlineEditProps) -> InlineEditResult
```
Activation selects the current value for replacement. Normal text and paste
edits update state directly; IME composition is forwarded to the nested field.
Enter or blur commits the edited bytes. Escape cancels by restoring the backup
taken at activation and leaves editing mode. Disabled props close editing and
reject input. Results expose the nested field result, editing, commit, cancel,
and whether the committed value changed.
## Scrub field
```ziran
ScrubField :: (session: Session, props: ScrubFieldProps,
state: *ScrubFieldState) -> ScrubFieldResult
ScrubFieldApply :: (state: *ScrubFieldState,
props: ScrubFieldProps) -> ScrubFieldResult
```
Arrow-left/right, arrow-up/down, and horizontal drag use the same step. Shift
selects fine or coarse behavior: by default the non-shift direction moves ten
steps while Shift moves one tenth. `fine_divisor` and `coarse_multiplier`
replace those ratios when positive. Values round to `precision` and clamp to
the supplied bounds. Activation enters text mode, commit parses/clamps/rounds,
and Escape restores the pre-edit value. Results distinguish ordinary change,
drag start, commit, and cancel.
The label, editable value, and suffix are retained child nodes. Height is an
explicit metric; the remaining visual contract starts at current control
metrics and can be overridden by ID/class stylesheet rules.
## Money field
```ziran
MoneyField :: (session: Session, props: MoneyFieldProps,
state: *MoneyFieldState) -> MoneyFieldResult
MoneyFieldApply :: (state: *MoneyFieldState,
props: MoneyFieldProps) -> MoneyFieldResult
```
The state owns a `float64` value and the focused edit bytes. Blurred display
uses the selected decimal separator, optional grouping, optional currency
prefix/suffix, precision, and minus-or-parentheses negative style. Gaining focus
changes to a plain round-trippable edit string; commit parses grouping and
either negative notation, rounds, clamps, and returns to formatted display.
Escape cancels. Results expose validity as well as commit/cancel/change.
Both comma-decimal and period-decimal conventions are supported. The last period
or comma is decimal; earlier punctuation is grouping. No locale service is
hidden in widget state.
## Shortcut recorder
```ziran
ShortcutRecorder :: (session: Session, props: ShortcutRecorderProps,
state: *ShortcutRecorderState) -> ShortcutRecorderResult
ShortcutRecorderApply :: (state: *ShortcutRecorderState,
props: ShortcutRecorderProps) -> ShortcutRecorderResult
```
Activation records only while this widget is focused. A supported key plus
modifiers is accepted, including `Ctrl+Enter`; bare Escape cancels recording,
bare Backspace or Delete clears the shortcut, and bare Tab exits recording.
Unknown or out-of-range keys/chords report `unsupported` without changing the
prior shortcut. Blur, outside press, and disabled also stop recording. This
component never installs a global accelerator or consumes another owner's input.
The state owns the key, modifier mask, focus/recording flags, and its fixed
label buffer. Width, height, and font size have explicit metrics; animation
uses the current theme motion duration and installed style cascade.
+116
View File
@@ -0,0 +1,116 @@
# Kry Language
Kry is C-close app code for Kryon. `kc` emits readable `.c` and `.h` files
that are compiled by the normal C toolchain; there is no VM, runtime package
system, or hidden ownership model.
## Style
- Small files, clear names, and plain data flow.
- Explicit module prefixes for generated C symbols.
- Direct C-compatible pointers, field access, labels, and cleanup `goto`.
- Compile-time modules only.
- Raw C escape hatches only for platform or third-party edges.
## Declarations
```kry
#module "practice.session"
#output "session_impl"
#import "app.h"
#import <stddef.h>
#import "private_dep.h" #private
#pragma "GCC diagnostic push"
SessionTimer :: struct {
elapsed: float
running: bool
}
SessionMode :: enum {
SESSION_IDLE,
SESSION_ACTIVE,
}
#enum {
SESSION_FLAG_DIRTY = 1,
}
#enum #private {
SESSION_LOCAL_FLAG = 1,
}
TickCallback :: int (*)(float) #type
LocalSize :: unsigned long #type #private
session_count :: int #global #export
local_counter :: int = 7 #global
platform_ping :: (value: int, tag: const char*) -> int #extern
platform_log :: (level: int, text: const char*, ...) -> void #extern
win_entry :: (hwnd: void*) -> int #extern #storage "__declspec(dllimport)" #abi "__stdcall"
weak_hook :: () -> void #extern #attr "__attribute__((weak))"
session_update :: (app: InbeApp*, dt: float) -> int {
if !app->session.running {
return 0
}
result := breath_step(&app->breath, dt)
if result.done {
goto done
}
done:
return 1
}
session_entry :: (app: InbeApp*) #export {
session_update(app, 0.0f)
}
```
## Rules
- `#module "name"` sets the compile-time module name and generated C symbol
prefix. Dots become underscores.
- `#output "basename"` changes only the generated file basename.
- `#import "path.h"` emits a public include in the generated header.
- `#import <system.h>` and `#import "path.h" #private` emit source-only
includes.
- `alias :: #import "module/path"` imports another Kry module and binds a
compile-time alias for qualified calls.
- `name :: (...) -> Ret { ... }` defines a function. Inside a module, the
generated C symbol is module-prefixed by default.
- `#export` keeps the exact C ABI name and emits the declaration publicly.
- `#private` keeps a function or type alias source-local.
- `#global` creates a file-level variable; add `#export` for a public `extern`.
- `#extern` declares an external C function without defining it.
- External declarations accept precise interop tags when the platform ABI needs
them: `#storage "..."` before the return type, `#abi "..."` before the
function name, and `#attr "..."` after the parameter list.
- `...` is allowed as the final parameter of an external declaration.
- `#intrinsic "web"` emits a Kryon-owned platform wrapper for supported web
operations.
- `#pragma "text"` and `#error "message"` emit guarded C preprocessor
directives for compiler and platform integration.
Kry statements are deliberately minimal — declarations, assignments, calls,
and control flow. There are no widget keywords and no bespoke sugar verbs:
- `name := expr` for inferred locals.
- `name: Type = expr` or `name: Type` for typed locals.
- `name = expr` assignments (including compound `+=`, `%=`, `&=`, ...).
- plain function calls (any call used as a statement is a draw call and is
automatically wrapped with source-inspection metadata for click-to-source).
- `if`, `else if`, `else`, `while`, `for`, `switch`, `case`, `default`,
labels, `goto`, `break`, `continue`, `guard`, and `return`.
- `c line` for raw C glue and `unused expr` to silence unused-value warnings.
Widgets are ordinary library functions (WidgetText, WidgetRect, WidgetLine,
WidgetBackground, WidgetButton) declared in `ui_widgets.h`; the compiler
treats them exactly like any other call. Input handling is plain control
flow: `if (UIKeyPressed(KEY_A)) { ... }`, `if (UIKeyDown(KEY_A)) { ... }`.
Event-style blocks (`button ... {`, `on key ... {`, `event ... {`) and
arithmetic/declaration sugar (`advance x by N`, `clamp_min`, `c_rect`,
`texture`, `set_theme`) were removed in favor of their direct equivalents.
-21
View File
@@ -1,21 +0,0 @@
# Overlays
The six overlay families are retained Ziran widgets with caller-owned state and deterministic results. `Apply` functions are pure state transitions suitable to component hosting; widget functions take a `Session`, explicit props and a caller-owned state pointer, then submit popup/modal tree nodes and paint effects. No family owns process-global UI state.
## Composition
- `Tooltip(session, props, state)` and `TooltipApply(state, props)` implement hover/focus delay, warm replay, touch/press suppression, truncation-only mode, placement fitting, flipping, clamping and ellipsis text.
- `Sheet(session, props, state)` and `SheetApply(state, props)` implement all four sides, clamped min/max size, safe-area insets, scrim/Escape/drag close, deterministic motion and focus wrap/return.
- `CommandPalette(session, props, state)` and `CommandPaletteApply(state, props)` implement fuzzy prefix/run/word scoring, stable command order, contiguous group starts, text editing, Up/Down/Enter/Escape, pointer activation and explicit owner takeover.
- `HoverCard(session, props, state)` and `HoverCardApply(state, props)` implement open delay, movement tolerance, content grace, interactive action dispatch, focus paths and placement fitting.
- `ConfirmPopover(session, props, state)` and `ConfirmPopoverApply(state, props)` implement danger styling, initial confirm focus, Enter/Space confirm, Escape/cancel, outside close and trigger focus return.
- `GuidedTour(session, props, state)` and `GuidedTourApply(state, props)` implement target geometry, padded highlight hole, four-band scrim, card fitting, count formatting, Back/Next/Done/Skip and three-focus wrap.
Each `*StateFor` constructor returns an isolated, serializable state value. Results identify nodes, geometry, interaction outcome and state change; callers supply `now_ms` and retain ownership. Empty `id`, `class_name`, key and action values follow the explicit prop values, while nonpositive geometry/delay fallbacks use the documented defaults in the matching `*_props.zi` module.
## Styles and semantics
Every family has typed `StyleData` props with installed selector facts for kind, ID, class, role, state and popup/modal/guide style kind. Caller styles merge over theme/selector values with `MergeValues`; state overrides resolve through `StyleStates`. Light and dark defaults come from `CurrentTheme`, and motion honors duration, multiplier and reduced-motion fields.
Tree nodes carry style ID/class facts plus interactive, popup, semantic kind, heading and label metadata. Paint uses the real queued raster API; no mock painter or parallel styling protocol exists.
-132
View File
@@ -1,132 +0,0 @@
# Repeatable performance checks
`python3 tools/performance.py` builds an optimized native, display-free runner
and measures four workloads at 960 × 600 pixels: a scrolling 10,000-item list,
an 8 KiB wrapped Unicode document, 144 images, and 20 idle controls. Each has
10 warmup frames followed by 60 measured frames. Reported values include
submission, combined commit/raster and total median/p95 times, nodes, paint
commands, raster emissions, damage pixels, workers and runner peak RSS.
The idle workload must emit zero unchanged paint commands.
Use a same-machine baseline for a regression gate:
```sh
python3 tools/performance.py --output backup/performance-baseline.json
python3 tools/performance.py --baseline backup/performance-baseline.json --max-regression 0.20
```
Comparison rejects mismatched hardware, compiler command, optimization,
viewport, warmup or requested worker count. A p95 regression fails when it
exceeds the percentage and adds more than 0.2 ms. `--budget-ms 64` provides an
absolute p95 ceiling for every workload; CI uses this generous ceiling to
catch large regressions across shared runners. Local baselines give a tighter
check on fixed hardware. The JSON retains check results and failures.
The build directory is stable and locked for the whole run. Desktop variables
are scrubbed. RSS comes from the native runner's `/proc/self/status` VmHWM
after the measured frames. Unlike a launcher's `wait4` high-water mark, it
excludes the Python process's memory before exec. Schema 2 baselines use this
measurement; capture a new baseline when migrating from schema 1. The timings
exclude warmup; the runner CPU-seconds counter includes initialization and all
warmup/measured frames, and excludes compilation and the Python launcher. Timings
cover the pixmap pipeline, not native window presentation, asset decoding,
screen-reader overhead, process idle wakeups or GPU/browser rendering.
The widget review harness measures actual public controls, rather than mock
faces. It includes all 54 core gallery scenes plus light and dark system-palette
compositions. Each interactive scene captures resting, disabled, hover, keyboard
focus and held-press states, using the same 480 × 320 viewport.
```sh
build-queue -- taskset -c 2 python3 tools/widget-review.py before --backend pixmap
build-queue -- taskset -c 2 python3 tools/widget-review.py before --backend desktop
# Change the shared library only after both baselines finish.
build-queue -- taskset -c 2 python3 tools/widget-review.py after --backend pixmap
build-queue -- taskset -c 2 python3 tools/widget-review.py after --backend desktop
build-queue -- taskset -c 2 python3 tools/widget-review.py compare --backend pixmap
build-queue -- taskset -c 2 python3 tools/widget-review.py compare --backend desktop
build-queue -- taskset -c 2 python3 tools/widget-review.py recheck --backend pixmap --trials 7
build-queue -- taskset -c 2 python3 tools/widget-review.py recheck --backend desktop --trials 7
```
The stable executables and disposable generated C live under
`build/scratch/widget-review/`. Captures, bounded per-frame CSV, JSON metrics and
comparison PNGs live under ignored `backup/material-widgets/`. Each backend has
its own `comparison-BACKEND/grid-overview.png` and full-size state comparisons.
A second baseline replaces the previous baseline, so preserve any earlier study
before starting another. Builds must run through the shared build queue.
Use `--output-dir backup/material-widgets/navbar` or
`--output-dir backup/material-widgets/perf` for an independent study; this also
selects that study's fixture image. `--scenes 20` limits a capture to the
NavigationBar. Keep previous studies in place instead of reusing their output
directory. The normal executable paths stay stable.
Cairo retains up to eight owned Pango layouts for alternating labels and font
sizes; long editor runs share one slot. Layouts are released when the raster
closes or resizes. Retained paint text uses 512-byte snapshot blocks, so a short
frame initially reserves 4 KiB instead of 32 KiB while larger frames still grow
without truncation. Pixmap fills opaque spans in bounded groups of four pixels;
the translucent rounding and coverage remain unchanged. Validate memory with
both peak heap allocation and RSS: small heap savings need not reduce the
process's resident high-water mark on every run.
Both hosts run 10 warmup and 120 measured frames for **each** state and mode.
Retained mode tests that unchanged frames emit no raster commands. Forced repaint
invalidates the paint snapshot before every frame and includes widget composition,
commit, rasterization and, for desktop, SDL texture upload/presentation. Timings
include monotonic wall time and process CPU time. They are CPU-side measurements,
not GPU timestamps or input latency. The desktop uses SDL's software presentation
on private Xvfb; the pixmap uses its actual CPU raster and bundled font outlines.
The fixture image is identical on both hosts.
Runner `/proc/self/status` supplies peak and steady RSS after warmup/measurement;
it excludes the Python launcher. Steady RSS can exceed an earlier high-water
sample by a page when the status reader itself faults a page. Startup is the
in-process interval from runner entry through its first complete frame, including
host setup and font work, but excluding the OS executable loader and compilation.
Binary size and its SHA-256 are recorded with the samples. The text reservation
counter covers reusable frame-owned label/path storage, not total memory.
The comparison JSON gives medians across scene/state cases and the largest
observed process high-water RSS across both modes. It flags per-case timing
increases above both 5% and 0.025 ms for investigation; repeat flagged cases to
distinguish reproducible costs from shared-machine variation. `recheck` runs each
flagged case three more times with the recorded after executable (verified by
SHA-256), preserves the initial samples, and fails for a confirmed increase in
the median of the repeats. Raw repeats and their summary stay beside the captures.
Use `recheck --backend desktop --trials 7` for a longer investigation on a noisy
shared machine; this keeps the same threshold and records all seven trials.
For close comparisons pin both phases to the same single allowed CPU core, as
above, to avoid migrations between differently loaded cores.
Idle CPU covers a 200 ms quiet interval with five 40 ms sleeps and, on desktop,
its ordinary event poll; no frames are submitted in that interval. Together with
zero retained raster emissions this tests the harness's idle behavior, rather
than claiming that every downstream application's event loop sleeps. No renderer
thread, timer or animation is added by the default style. CPU affinity is recorded.
All captures use private Xvfb with inherited display/auth/session variables scrubbed
and desktop recovery disabled. This does not measure Android hardware, a physical
GPU, a desktop compositor, browser behavior or terminal-cell fidelity.
The GPUI reference uses the same five 480 × 320 scene families in a disposable
Cargo project pinned to GPUI 0.2.2 and libc 0.2.186. Its default measurement
covers GPUI `TestAppContext` root render/layout/prepaint/paint only; it does not
execute GPU work, present a frame or include compositor wall time, and therefore
is not interchangeable with Kryon's compose-only or hardware presentation phases.
```sh
build-queue -- python3 tests/gpui_render_benchmark.py \
--trials 3 --warmup 120 --frames 120 \
--output work/backend-render-benchmark/gpui-render-benchmark.json
build-queue -- python3 tests/gpui_render_benchmark.py --gpu-probe \
--device /dev/dri/renderD129 --trials 3 --warmup 120 --frames 120 \
--output work/backend-render-benchmark/gpui-render-benchmark-gpu.json
```
The second command starts a private headless Weston GL instance on the selected
AMD render node. GPUI 0.2.2 currently requires the Wayland `wl_seat` global;
headless Weston has no seat, so the report records the exact client unwrap
limitation instead of presenting an unsupported CPU-to-GPU comparison. Generated
Cargo inputs remain under `build/scratch/gpui-render-benchmark`, while reports and
logs remain under ignored `work/backend-render-benchmark/`.
-595
View File
@@ -1,595 +0,0 @@
# Ziran projects with Kryon
Kryon is a Ziran package. Application source imports its public modules, and
the selected Kryon host links the application's `Frame` function. No UI syntax
or widget handling is built into the Ziran compiler.
## Start a project
Install `ziran` (`make install-user` in the Ziran repository) and the `kryon`
command (`make install-user` here), then:
```sh
kryon new hello # a desktop app; kryon new hello --template tui
cd hello
kryon run # the default profile; kryon run tui picks another
```
| Template | What it starts | Profiles |
| --- | --- | --- |
| `app` (default) | counter with buttons, a step slider, and progress | `desktop`, `tui`, `web` (canvas) |
| `tui` | keyboard-driven task list | `tui`, `desktop` |
| `pages` | Home, Library, and Settings behind a tab row, sharing state | `desktop`, `tui`, `web` (canvas) |
| `web` | page: headings, paragraphs, links, a button | `web` (Canvas2D), `desktop` |
Each template's `src/layout.zi` stacks rows in pixels in a window or browser
and in character cells on the terminal host, so one `Frame` serves every
profile. `kryon init --template tui` adds a template to an existing package:
Ziran merges it into `ziran.toml`, keeps the package's own values, and never
overwrites a file, so a command-line program keeps its `main` and gains a
window.
`kryon` is a front door to `ziran`: `kryon new` and `kryon init` are
`ziran new` and `ziran init` with Kryon's templates (`--template NAME` for
Kryon's, or any `SOURCE[:NAME]`), `kryon run|build|check|profiles` is
`ziran tool kryon …`, and `kryon install` is `ziran install`. Each project
therefore runs the Kryon its `ziran.lock` pins, whatever version of the
`kryon` command is installed. `KRYON_TEMPLATES=DIR` takes the templates from
a local Kryon checkout.
## Package manifest
A Kryon application is a Ziran package whose `ziran.toml` hands its program
to Kryon:
```toml
[package]
name = "Example"
entry = "src/app.zi"
module_roots = ["src"]
tool = "kryon"
[toolchain]
git = "https://github.com/ziranlang/ziran.git"
ref = "master"
[dependencies.kryon]
git = "https://github.com/kryonlabs/kryon.git"
ref = "master"
[tool.kryon]
default_profile = "desktop"
[tool.kryon.profiles.desktop]
backend = "desktop"
```
`tool = "kryon"` makes `ziran run`, `ziran build`, `ziran check`, and
`ziran install` the same as the `kryon` commands. The build binds the host's
frame capability to the selected source's exported `Frame` function. The source
can have any module filename, such as `button.zi`; no `app.zi` alias or reverse
module bridge is needed. `[tool.kryon] entry` selects the source with `Frame`
when it differs from the package entry, as in a command-line package that also
has a window. The app imports the small `kryon/app` runner and only the named
widget packages it uses:
```zi
App :: #import "kryon/app";
Text :: #import "kryon/text";
main :: () -> s32 {
return App.Run(App.Window.{.title="Hello", .width=320, .height=160}, Draw)
}
Draw :: (frame: App.Frame) {
Text.Draw(frame, Text.Props.{.text="Hello, world!", .size=32})
}
```
Style sheets, charts, tables, trees, and source coloring are separate Git
packages: add `https://github.com/kryonlabs/css.git`,
`https://github.com/kryonlabs/plot.git`,
`https://github.com/kryonlabs/data-views.git`, or
`https://github.com/ziranlang/syntax.git` with `ziran add` and import
`css/Css`, `plot/Plot`, `data_views/TableView`, `data_views/TreeView`, or
`syntax/Syntax`. Kryon exports `geometry`, `drawing_props`, and the other
building blocks listed in `ziran.toml` for code that needs those primitives
without importing the widget catalog. Native and browser profiles resolve
imports the same way, so an app's Git dependencies and package-qualified
named imports such as `kryon/text` work in Canvas builds too.
From the app directory, run:
```sh
kryon check
kryon build
kryon run desktop # or: kryon run --profile desktop, ziran run desktop
kryon profiles # the profiles, their hosts, and the default
```
Commit `ziran.lock` to pin exact package and toolchain revisions. `ziran
fetch` fills the shared cache. For local development, `ziran.local.toml` can
override the Kryon and Ziran roots; it is not the published dependency
manifest. See the [Ziran package
guide](https://github.com/ziranlang/ziran/blob/master/docs/PACKAGES.md)
for lock, cache, and override details.
## Profiles and hosts
### Foreign renderer artifacts
Builders can request Kryon's foreign libraries and standard resources through
the generic Ziran artifact API (toolchain revision 5461202417d48e2b31122354419179b262d7530c
or later):
```sh
ziran pkg artifact kryon:renderer-raylib --platform linux-x86_64-gnu --locked
CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar \
ziran pkg artifact kryon:renderer-raylib --platform windows-x86_64-mingw --locked
ziran pkg artifact kryon:renderer-desktop --platform linux-x86_64-gnu --locked
ziran pkg artifact kryon:renderer-web --platform emscripten-wasm32-emscripten --locked
```
Omit `--locked` when using `ziran.local.toml` overrides. Success stdout is one
absolute `artifact.tsv` path. Verify its declared SHA-256 output rows and resolve
their paths beside that descriptor. `renderer.json` has schema 1, the artifact
and platform, ordered `archives` and `link_flags`, `compile_flags`, Ziran
`defines`, `include_directories`, and `resources`. Paths in those fields are
relative to the descriptor directory; system flags are argv tokens. Pass archive
paths after application objects, followed by `link_flags`. Pass compile flags
and resolved include directories when compiling native code; pass defines to
Ziran's ordinary compiler invocation. No generated Ziran source tree or object
list is part of this contract.
Every recipe includes `resources/kryon-font.ttf` and its Liberation license.
`renderer-raylib` also includes `lib/libraylib.a`, the four public Raylib headers
under `include/`, and the Raylib license. Linux uses SDL2/GLES2; Windows uses
RGFW/OpenGL 1.1. Both preserve JPEG, TrueType and audio support. Linux
`renderer-desktop` declares the existing SDL/Cairo/FreeType/Pango/Fontconfig/GIO
system dependencies rather than redistributing system libraries.
`renderer-web` supplies `web/ziran_web.js` from the selected Ziran toolchain,
`js_libraries`, browser link flags and `preload_files` entries (`path`, `mount`)
for the standard font at `/kryon-font.ttf`. Feed these to Emscripten's
`--js-library` and `--preload-file` arguments. Game resources remain separate.
The Raylib recipe also accepts `android-aarch64-bionic` and
`android-armv7-bionic`. Set `[tool.kryon.renderer] android_ndk` to the installed
NDK directory and `android_api` to a decimal API level (default 21, minimum 21).
Set `CC` to that ABI/API's NDK clang executable so compiler identity is keyed,
for example `aarch64-linux-android21-clang`. This foreign Raylib artifact recipe
is independent of Kryon's Android app host and retains its GLES2, image, font
and audio options.
NativeActivity glue, the application shared library, edition, packaging and
signing remain with the app packaging build. Unsupported recipe/platform pairs
fail explicitly. Other hosts and architectures are not yet provider targets.
Widget and renderer Ziran code remains ordinary `kryon/...` imports. These
artifacts do not provide a separately compiled Ziran component ABI: the current
generic artifact API stages provider files but does not define such a language
component interface. Builders must not rewrite generated C/H or reconstruct a
private module/object list to manufacture one.
Run `make renderer-artifact-test` for real outputs, hashes, dirty isolation and
a maintained Raylib renderer compiled and run on private Xvfb. Add `--cross`
to `python3 tests/renderer_artifact_test.py` for installed MinGW and Android
toolchains. After pushing, `--clean --revision COMMIT` uses normal immutable
package resolution and requires two independent consumers to receive the exact
same descriptor. A dirty canonical provider deliberately cannot prove reuse.
Define each profile under `[tool.kryon.profiles.NAME]`. It requires `backend`;
`codegen` defaults to `c99`. Supported backends are `terminal`, `desktop`,
`raylib`, `canvas`, `pixmap`, and `android`. Set `default_profile` under `[tool.kryon]` when there
are several profiles. `--profile NAME` selects another. `run` asks for a
profile when there are several, none is specified, and it runs in a
terminal; otherwise it uses the default.
| Backend | Host | Requirements |
| --- | --- | --- |
| `terminal` | 80 × 24 terminal cells | TTY for interactive input; redirected output renders once |
| `desktop` | SDL2 window with Cairo raster | SDL2, Cairo, and FreeType development libraries |
| `raylib` | raylib SDL2/OpenGL ES 2 window | the locked raylib source package and SDL2, DRM, EGL, GLESv2 |
| `canvas` | Canvas2D browser page | Emscripten with Asyncify; see [Canvas host](canvas.md) |
| `pixmap` | headless 960 × 600 frame printed as a PPM image | nothing; `kryon run shot > frame.ppm` |
| `android` | installable APK through a generated `droid/` Gradle project and direct NativeActivity host | a JDK, the Android SDK with NDK `28.2.13676358` and CMake `3.22.1`, the locked codec source packages, and `[tool.kryon.android] package`; see [Android host](BACKENDS.md#android-host) |
The SDL desktop host presents its already rasterized pixels through the
software renderer and an unaccelerated window surface by default. Custom
SDL pixel hosts can import `kryon/pixmap_sdl` and call
`CreatePixmapRenderer(window)` on the window's owner thread before creating
their texture. The host retains ownership of its window, renderer, texture
and input loop; its raster workers are independent of this presentation choice.
Explicit `SDL_RENDER_DRIVER` and `SDL_FRAMEBUFFER_ACCELERATION` environment
preferences, or normal/override priority SDL hints, take precedence. The
helper leaves other hosts and their graphics APIs untouched.
Such a host can also paint on the GPU by importing `kryon/pixmap_sdl_gpu`.
`PixmapGpuOpen(renderer)` records the same paint commands as textured triangles,
including text and terminal cells through a glyph atlas, and returns false on a software renderer or software GL
driver, where the host keeps uploading pixels. While it is on, create the
presented texture with `PixmapGpuCreateTarget(width, height)` and call
`PixmapGpuDraw()` instead of uploading damage, then copy and present as usual.
`KRYON_PIXMAP_GPU=0` keeps CPU painting; `=1` also uses a software GL driver.
For a custom **SDL3** host, the experimental exports are `kryon/pixmap_sdl3`
and `kryon/pixmap_sdl3_gpu`; they require an SDL3 window and explicit `gpu`
renderer. There is no `backend = "sdl3"` profile. From an application's package
graph, request the pinned SDK with:
```sh
ziran pkg artifact kryon:native-sdl3 --platform linux-x86_64-gnu --locked
```
Use `--locked` when there is no `ziran.local.toml`. With local overrides, run
`ziran lock` after the overridden package advances before requesting artifacts.
The native artifact is
currently Linux x86_64 GNU only. Verify the returned descriptor with Ziran's
`Artifact` API; `Artifact.link_flags()` supplies the ordered static linker
arguments. Verify and extract `Artifact.output("resources/SDL3-headers.tar")`
into the consumer's build area for the complete include directory. The loose
SDK headers are not all declared outputs, so use the verified archive for
compilation. This SDK is native support for custom hosts, not a replacement
renderer selection for an existing desktop profile. See
[experimental SDL3 usage and tests](BACKENDS.md#experimental-sdl3-gpu-renderer).
These settings live only in `ziran.toml`. Kryon declares them under
`[options]` in its own `ziran.toml`. Ziran checks the application's
`[tool.kryon]` tables against that declaration, merges `ziran.local.toml` over
them, and hands the kryon tool the result, so a typo is reported with its file
and line. To try another default profile on one machine, set it in the ignored
`ziran.local.toml`:
Native C profiles also link every system library declared in the root
`[package].links` list, in manifest order. Use system basenames such as
`links = ["gtk-3", "gdk-3", "gio-2.0", "gdk_pixbuf-2.0"]`; the build uses the
system linker's normal search paths. Portable and browser profiles do not
consume this list.
`static_archive` links one project-relative `.a` file directly. The project's
own build prepares the archive, and Kryon adds that exact path as both a build
dependency and linker input. This is for reproducible source-package artifacts;
it performs no `-l` lookup and never selects an operating-system package. The
path cannot be absolute or lexically escape the project directory. Kryon also
resolves the archive and rejects a symlink that leaves the project or a
non-regular file. Browser profiles reject the setting instead of silently
omitting it. `library` remains the existing system-library escape hatch and
should be avoided by reproducible applications.
Native `c99` profiles can instead request dependency-owned foreign support
with `native_artifacts` and an explicit `native_platform`:
```toml
[tool.kryon.profiles.desktop]
backend = "desktop"
native_artifacts = "kryon:renderer-raylib"
native_platform = "linux-x86_64-gnu"
```
This adds Raylib's foreign support, for example for `MediaAudio`, to the
existing SDL/Cairo profile. It keeps that profile's host and rendering path.
Use space-separated `package:artifact` selections for several providers.
Selections come from the application's resolved package graph; no cache
paths or prebuilt archive copies belong in its manifest. The toolchain must
provide Ziran's [shared artifact consumer](https://github.com/ziranlang/ziran/commit/ee86330414a2febb0135d86506b505af5e6a660b).
Each build requests and verifies the artifacts before linking, so changed
provider inputs or local overrides cannot leave an old executable in place.
Kryon's renderer metadata or a provider's ordered `link.txt` supplies its
archives and prerequisite/system link arguments. These appear after the
application objects and before the profile's existing system libraries.
Provider failures, malformed metadata and digest mismatches fail the build;
the existing executable is replaced only after the complete link succeeds.
These options require a native `c99` profile; browser, Android and portable
profiles use their existing target-specific packaging paths. Compile options
and application asset packaging remain the selected profile's responsibility.
```toml
[tool.kryon]
default_profile = "tui"
```
## Zx applications
Desktop, raylib, Canvas and Android profiles can package an ordinary `Frame`
application as the same portable program with its resources:
```toml
[tool.kryon.profiles.portable]
backend = "desktop"
codegen = "zx"
assets = "assets"
```
Use `backend = "canvas"` with `codegen = "zx"` for the same portable app
and a browser player. The build writes both `.zx` and `.html` files; serve
the HTML with its generated JavaScript and WebAssembly files. The browser
shell interprets the bundle and uses Canvas2D for rendering. It includes a
file picker for opening another downloaded ZX without recompiling its UI.
Unsupported required services are reported before replacing the running app.
`backend = "raylib"` with `codegen = "zx"` builds a generic native player
beside the bundle. `make zx-raylib` builds that player directly; pass a ZX
path to it or use `--check FILE.zx` to validate without opening a window.
Images are decoded directly from the bundle, with no resource extraction.
The native player carries its host font beside the executable. Linux uses
SDL/GLES; Windows and macOS use GLFW/OpenGL. HTTP uses libcurl; install its
development package or supply `ZX_RAYLIB_HTTP_LIBS` for your target.
Cross builds can supply
`ZX_RAYLIB_CC`, `ZX_RAYLIB_AR`, `ZX_RAYLIB_OBJCOPY`,
`ZX_RAYLIB_ARCHIVE`, `ZX_RAYLIB_DEFINES` and `ZX_RAYLIB_LIBS`.
Use a separate `ZX_RAYLIB_DIR` for each target. macOS uses the same renderer
and has platform build settings, but has not been executed in this checkout.
An Android profile with `codegen = "zx"` builds its portable guest first,
then packages `app.zx`, the VM and the raylib-free native host into the APK. Its
`Frame` is not compiled into native application code. The canonical scaffold
handles display density, safe-area insets, touch, hardware/soft-keyboard input
and graphics restoration without resetting bundle state. It also registers a
ZX file opener: Android document URIs are copied into private cache and
validated before replacing the running app. Invalid files retain the current
instance. Existing customized Android scaffolds must adopt the updated
Gradle/CMake and activity/manifest glue to use this profile.
`make zx-android-test` builds ARM64, ARMv7 and x86-64 shells. Runtime testing
uses `python3 tests/zx_android_test.py --serial emulator-NNNN` and accepts
only an explicitly selected disposable emulator.
`make zx-canvas` builds a generic browser player with no embedded app.
`ZX_CANVAS_BUNDLE=/absolute/path/app.zx` optionally embeds a default app.
A same-origin relative `?bundle=path/app.zx` opens a hosted download.
The browser player supports ordinary `Frame` bundles and standalone
`AppContext` apps, drawing, input, fonts, embedded images and the browser
clipboard. Native, Android and browser players provide packed audio,
asynchronous HTTP audio/text and a monotonic clock. Requests accept only
HTTP/HTTPS; guest paths cannot read host files. Android ZX scaffolds include
a network manifest overlay; ordinary native builds do not use that overlay.
Standalone `AppContext` apps use the existing lifecycle and hosted widget
contracts. They receive a private document directory per declared app ID,
wall time, local time offset, locale, embedded assets and clipboard services.
Native apps save on close; browser apps save periodically to IndexedDB and
restore on reload. Native documents live under `$XDG_DATA_HOME/kryon/apps`
(or `$HOME/.local/share/kryon/apps`), `%LOCALAPPDATA%/kryon/apps` on Windows,
and Android's private application storage. `KRYON_APP_DATA` can select a
different native parent directory. Account/device services that the host
does not provide return the existing explicit unavailable response.
`make gallery-zx` exports every enabled gallery example with its full source
behavior and embedded assets under `build/gallery-zx/`; `index.json` maps
example IDs to their bundle paths. The entire gallery also has a `portable`
profile. The website build stages both these downloads and the generic
browser player; generating them does not publish the website.
The exporter and player use the gallery's configured Ziran toolchain, including
its lock or local override. A ZX's embedded IR format must match its player;
the installed compiler on `PATH` can use a different format.
`make gallery-zx-test` validates and renders all exported examples on a
private X server. `make zx-canvas-test` checks that the desktop and browser
bundles are identical and exercises browser startup, images, clicks, Unicode,
resizing, file replacement and rejection of invalid files.
`make zx-services-test` exercises real media and HTTP on native and browser
players. `make zx-hosted-test` checks hosted widgets, packed images and
document persistence. `make zx-headless-test` runs VM drawing, packed PNG,
retained input and Unicode without a display. The Android service and hosted
tests require `--android-serial emulator-NNNN` and `--serial emulator-NNNN`
respectively and verify the disposable `KryonZx` AVD before installing.
Custom native hosts can load `kryon/bundle_player`, prepare embedded assets,
attach `kryon/bundle_raster` callbacks and then start the instance. This lets
initializers use the selected renderer and assets. `PlayerFrameNative` runs
inside the caller's ordinary frame. `PlayerFrame` retains the CPU-surface
route for hosts that supply pixel buffers.
`kryon build portable` writes `build/<package-name>-portable.zx`.
All four project templates include this profile.
`kryon run portable` builds it and launches the reusable desktop player.
After downloading that file, `ziran run app.zx` works without the app's source,
manifest, lock, or compiler-generated native code. Install the player with
`make install-user` in Kryon; this also registers the provider with Ziran.
The player needs SDL2, Cairo and FreeType. `kryon run app.zx` forwards to the
same Ziran runner.
For a custom install prefix, add its `share/ziran/hosts` directory to
`ZIRAN_HOST_PATH` or its `share` directory to `XDG_DATA_DIRS`.
`assets` is an optional project-relative directory or file, embedded under that
same path. Images retain their ordinary `Image.Props.asset_path` values. The
player extracts validated resources into a private temporary directory and
removes it when the app exits. Exports rebuild resource content on every build,
including file removals. A `pixmap` profile also accepts `codegen = "zx"` and
runs through the display-free Ziran interpreter.
The desktop player supplies shapes, text, path-backed PNG images, window
visibility/close handling, clipboard, pointer buttons, wheel, modifiers,
keyboard and Unicode input. App globals and retained sessions persist between
frames. Unsupported capabilities fail before a window opens. Native library
and static archive settings cannot be linked into a portable program.
Applications with custom native storage, audio, pointer casts or C callbacks
must first give those effects portable host interfaces. The desktop player
does not yet replace these application-specific hosts.
`make zx-test` exports a package-qualified app, copies only its Zx file to a
download folder, and checks embedded images, installation, native pixel parity,
persistent click state, keyboard/Unicode input, malformed files and missing
capabilities on private displays. All four starter apps also have their Zx
pixels compared with native output.
`kryon install` also installs a Zx profile: its portable program goes to
`share/kryon/<bin>/app.zx`, and a reusable native player at `bin/<bin>` launches
it. The usual desktop menu and autostart settings apply. Embedded files need
no source checkout after installation.
### Apps shared between harnesses
An app can import `kryon/app_context` and `kryon/app_protocol` instead of a
product's host API. On `APP_IDENTIFY` it calls `AppIdentity(id, minimum_api)`
and `AppDescribe(name, icon)`, then returns `APP_PROTOCOL`. It draws hosted
Kryon widgets on `APP_FRAME`, handles its own state, and saves pending changes
on `APP_SAVE`. A supervising harness supplies `AppContext`, its service
allowlist and callbacks from `kryon/app_context_host`. Identification cannot
read or write user data. A bundle requiring a newer interface is rejected
before its first frame.
`AppSupports(name)` queries optional services; `AppService(name, request)`
returns `{"status":"unavailable"}` when the harness does not grant one.
`AppSupports("kryon.input.desktop")` is true when the device's main input is
a keyboard and mouse: native desktop hosts answer yes, Android and the web
no, and a harness that runs inside another host passes the question on.
Older hosts answer no, so an app keeps its touch behaviour there.
An app that imports `kryon/app_theme` follows the host's theme:
`AppThemeColor(token, fallback)` returns the host stylesheet's colour for
`canvas`, `surface`, `border`, `text`, `accent` or `link`, and `fallback` for
a token the host lacks or on a host older than the module.
An app with a look of its own, such as a game, imports `kryon/widget_palette`
instead: `WidgetPaletteUse(session, palette)` asks the host to draw the
widgets that follow in that palette's colours (as `SystemPalette`), until the
host's frame for the app ends. A host that is itself a bundle passes the
palette on to the host that draws, so it needs a host with the call.
Imports alone do not grant storage, network, clipboard or secret access.
Hosts keep those permissions and account boundaries. `DocumentRead`,
`DocumentStatus` and `DocumentWrite` distinguish missing files from read
errors; an app must preserve a document it cannot read.
The desktop player runs this contract directly. Its local provider uses
private documents under `$XDG_DATA_HOME/kryon/apps/<id>` (or
`~/.local/share/kryon/apps/<id>`), exclusive app-directory locking, atomic
writes, the clipboard, embedded locales and a desktop image picker. Set
`KRYON_APP_DATA` to choose another private app directory. Harnesses can
provide their own account-scoped storage and sync through the same calls.
Local documents do not automatically sync between different harnesses.
For example, Inner Breeze's `diary.zx` runs in its original harness,
Werkzeug's `werk --bundle diary.zx`, or `ziran run diary.zx`; it does not
load `inbe.zx`. Werkzeug's Calculator uses the same interface. Apps that
need device secrets or timed clipboard ownership still require a harness
that supplies those capabilities. The common player currently has a Linux
desktop provider; hosted app release watching is not supported yet.
## Installing
`kryon install` (or `ziran install`) builds one profile and installs it for
the current user:
```toml
[package]
tool = "kryon"
[install]
bin = "example"
[tool.kryon.install]
profile = "desktop" # default: default_profile
name = "Example" # menu and window name; default: package name
comment = "What it does"
icon = "assets/icon.png"
categories = "Utility;"
working_directory = "." # start in the project directory
autostart = true # also start at login
autostart_env = "EXAMPLE_HIDDEN=1"
```
Every window and browser page is named after the app: this `name`, or else
the package name. A build keeps it beside the program as
`build/NAME-PROFILE.title`, an install as `share/kryon/example/app.title`,
and a page in its HTML `<title>`. A ZX player names a bundle by the `.title`
beside it or by its file name, and a program without a title by its own file
name.
The program is copied to `~/.local/bin/example` (or `--prefix DIR`). The copy
replaces the old file in one step, so a running copy is never touched and
later builds in `build/` do not change the installed program. The icon goes to
`share/pixmaps/`. To use the desktop's icon theme instead, set
`icon_name = "system-file-manager"` and omit `icon`; the launcher stores that
theme name and copies no asset. The two options are mutually exclusive.
The menu entry goes to `share/applications/example.desktop`, and
with `autostart` the login entry to `~/.config/autostart/example.desktop`.
Setting `autostart = false` removes an autostart entry that `ziran install`
wrote earlier. Browser profiles cannot be installed.
The raylib profile builds its static raylib dependency in Kryon's `build/`
directory. The Kryon host chooses and owns that backend. Game code belongs in
the separate Game2D package; applications using both should rely on Kryon's
selected backend and raylib revision.
The project binary is `build/<package-name>-<profile>`. Checked Ziran modules
are saved in `build/generated/<profile>/ir/` as `.zir`; generated C is in
`build/generated/<profile>/c/`. `ziran inspect FILE.zir` displays a saved
module.
Canvas projects resolve package-qualified hosts and bind the selected
source through the shared frame capability. Their generator also roots
`canvas_raster.zi` and lowers every saved module, preserving raster adapters
and browser callbacks. Native profiles select the package-qualified host
entry as well. The saved IR carries the frame binding into native and portable
builds.
Every host draws text in Kryon's font, Liberation Sans
(`assets/fonts/LiberationSans-Regular.ttf`): a `font`-pixel line box from the
top of the ascent to the bottom of the descent, glyphs at their unhinted
widths. The desktop host loads it from `KRYON_FONT_PATH`, which
`kryon run` sets, else from the system's copy. The `pixmap` host rasterizes
the font's outlines with integer arithmetic, so every Ziran target prints the
same bytes for the same frame, and its text matches the desktop window's. It
renders two frames and prints the second, for screenshots in documentation and
CI without a display. `make pixmap-parity-test` builds every template and
example for C, Go, and the portable runner and checks that
all three images match; `build/pixmap-parity/grid.png` shows them side by side.
`tools/image_tools.zi`, compiled to C, compares two PPM images, converts
them to PNG, and lays out such grids.
Kryon's `make desktop-project-test` and `make raylib-project-test` exercise the graphical hosts on private Xvfb
displays, including keyboard and Unicode text input. `make canvas-project-test`
builds a real Canvas2D project and loads it in private headless Chromium. Do
not run graphical tests on the developer's live display.
### Application-owned hosts
A profile can name an application's own Ziran host when it supplies additional
platform capabilities, such as private storage or clipboard handling:
```toml
[tool.kryon.profiles.desktop]
backend = "desktop"
host = "src/desktop.zi"
```
The host exports `main` and imports the application's widgets and platform
modules. Kryon builds and runs that program with the profile's backend libraries.
The host must be a `.zi` file inside the project, including when reached through
a symlink. Profiles without `host` use Kryon's standard host.
## Native asset directories
A native profile's `assets = "assets"` ships that directory's contents beside
its built executable as `PROGRAM.assets/`. `ziran install` copies the contents
to `PREFIX/share/kryon/BIN/assets/`. The install keeps no dependency on the
source checkout or its working directory. Undeclaring assets removes only the
product's managed snapshot on the next build/install.
Packaged asset directories use mode 755 and data files (including the prefix
marker) use 644, even with a private source mode or caller umask. The install
creates missing product directories with mode 755 and executable files with 755;
desktop entries, icons and title metadata use 644. Existing directories are
never made more permissive: callers wanting a shared installation must supply
a prefix whose existing ancestors allow users to traverse it. An existing
private prefix remains private. Custom installers can use
`scripts/make-install-dirs.sh DIR...` and
`scripts/copy-native-assets.sh SOURCE DESTINATION ORIGINAL_PREFIX` for the same
directory-boundary and asset snapshot behavior.
Native Image and ReadAppAsset lookup first preserves an accessible literal
relative file and every absolute path. Packaged lookup then accepts paths
relative to the declared directory (`icons/ui.webp`) and its original project
prefix (`assets/icons/ui.webp`). Missing files keep their original path/error
behavior. Paths containing parent traversal or drive names are never redirected.
Web preloads, ZX bundled assets and Android APK lookup retain their existing routes.
Custom native hosts can import `kryon/app_asset_path` and call
`ResolveAppAsset(path: string, output: []u8) -> string`. Use a separate 4096-byte
buffer: a resolved path borrows it; an unchanged path borrows the original text.
`ResolveAppAssetForExecutable(path, executable, output)` supplies an explicit
executable for hosts/tests. Neither changes the process working directory.
The standard Cairo and Raylib image loaders use this resolver automatically;
a custom asset-reader callback still has exclusive ownership of its resources.
A host embedding another UI packages that UI's referenced files under its own
declared asset directory, retaining their logical names. For example, an embedded
Shelf's `ImageForIcon` needs `icons/ui.webp` under the Rill host's declared assets;
Rill's executable and install prefix determine the runtime location.
View File
Whitespace-only changes.
-19
View File
@@ -1,19 +0,0 @@
# Theme customization
Kryon uses one modern style. Light and dark are color modes of
that style; applications do not need a style-pack registry or selector.
Import `kryon/Theme` for theme tokens. `InstallDefaultTheme(dark)` installs
the default palette, metrics, fonts, shadows and motion. `SetThemeMode(dark)`
changes the palette and keeps installed metrics, fonts and motion settings.
It resets palette colors, so reapply custom accents after changing modes.
Use `WithAccent(theme, accent, on_accent, accent_strong, accent_subtle)` and
`InstallTheme(theme)` to customize colors. `ThemePolicy` and `ResolveDark`
support system, light and dark preferences. `SetReducedMotion` controls motion.
Typed style rules and optional CSS remain available for application-specific
colors and control styling, using the same components and interaction behavior.
The former style-picker gallery route remains a single-style example so
existing links continue to open.
-24
View File
@@ -1,24 +0,0 @@
# Native raster workers
Native C source builds use Ziran's `POSIX_THREADS` capability to
parallelize large pixel clears, rounded fills and decoded images by default.
The renderer reuses `std/parallel_linux` workers; `ZIRAN_PAR_THREADS` selects
1–64 lanes, with four by default. Small damaged regions stay on their owner to
avoid worker wake overhead. Portable bundles and other platforms keep the
same pixel algorithms without requiring pthreads.
The frame owner submits paint in order, prepares glyph caches and keeps the
surface, clipping and image assets immutable during each raster operation.
Workers write disjoint rows and complete before the next paint starts.
Decoded images that overlap the output surface retain serial ordering.
This does not make UI trees or application state safe for concurrent mutation.
`PixmapEndInto` releases the borrowed surface after all work has completed.
Call `PixmapCloseWorkers` before unloading the host or its library; workers
otherwise remain idle between frames. `PixmapWorkerCount` reports the actual
number of lanes, including the frame owner. Thread creation failures reduce
the pool to the lanes available and preserve complete rendering.
Run `sh tests/ziran_pixmap_parallel_test.sh` to compare large native rasters at 1,
4 and 8 lanes, including clipping, transparency, rotation, retained damage,
aliased image storage, guard pixels, pool shutdown and restart.
-14
View File
@@ -1,14 +0,0 @@
# Web host status
Kryon's current web host is the Canvas2D backend in `src/backend/`.
Applications compile Ziran to C, then Emscripten links that generated C with
small browser effect libraries. The Ziran host implementation remains in
`.zi`; JavaScript supplies only browser effects that Ziran foreign imports
declare. See [BACKENDS.md](BACKENDS.md) and
[Canvas2D browser host](canvas.md).
The browser profile generates from the selected host plus the Canvas raster
adapter and without entry pruning. This is not a revival of the removed `.kry` compiler.
Kryon has no separate JavaScript widget runtime or source-language compiler.
The files above are the current web support documentation.
-19
View File
@@ -1,19 +0,0 @@
# Widget verification
Each widget has a Ziran implementation under `src/ui/` and should have a
focused behavior test for its public values, retained state, and input
decisions. Tests that only verify code generation do not prove behavior.
The current `make test` gate builds the core and optional packages and runs
the `tests/ziran_*` behavior suite through the relevant source, saved `.zir`,
portable `.zx`, and native targets. Package project tests verify imports and
terminal host behavior. `make desktop-project-test` and
`make raylib-project-test` verify graphical
capture and input on private Xvfb displays.
For an affected widget, check the interaction that changed through the
session and selected host. Input widgets need focus, editing, Unicode, and
selection cases; collection widgets need selection, scrolling, and
activation cases; image and text widgets need paint and clipping cases.
An untested host or platform remains unverified even when another target
passes. [FEATURE_MATRIX.md](FEATURE_MATRIX.md) records supported hosts.
-69
View File
@@ -1,69 +0,0 @@
# Zoom
`src/ui/zoom.zi` zooms a whole application the way a browser page zoom does.
Ctrl and the mouse wheel step one factor for the session; Ctrl with plus,
minus, or zero steps or resets it. The factor scales the entire application,
not one container, so it is a single number the host or the application
applies once.
Kryon makes the decisions and the host supplies raw observations. Each frame
the host passes the wheel movement and the held modifiers:
```zi
consumed := ZoomWheel(session, platform, wheel, KeyboardModifiers(session))
if consumed { wheel = 0.0 } // Ctrl+wheel is zoom, not scrolling
```
`ZoomWheel` returns true when the wheel belongs to zoom, so the application
must not also scroll with it. Positive movement zooms in. Whole notches step
the factor, and the small movements of a touchpad add up until they reach a
notch. `ZoomKey(session, platform, key, modifiers)` does the same for the
keyboard shortcuts. Read the result with `ZoomFactor(session)` (`1.0` is
100%).
## The prop
`ZoomProps` configures a session with `ZoomConfigure(session, props)`. Its zero
value is the default, so an application that never configures zoom gets it:
| Field | Default | Meaning |
| --- | --- | --- |
| `mode` | `ZoomModeAuto` | `Auto` zooms on desktop windows only. `On` zooms on every platform. `Off` never zooms. |
| `factor` | 1.0 | Starting factor. |
| `minimum` | 0.5 | Lowest factor. |
| `maximum` | 3.0 | Highest factor. |
| `step` | 0.1 | One notch. The factor always lands on a whole number of steps. |
Automatic mode leaves a browser alone, because the page already zooms with the
same keys, and leaves touch screens alone, because they have no wheel. Pass
the platform as the `DPIPlatform` the host already reports for `ResolveDPI`.
`ZoomSet(session, factor)` restores a saved preference and returns the factor
after clamping and snapping; `ZoomReset(session)` returns to the starting
factor.
## Applying the factor
The factor scales the whole application, widget text included, so a host
applies it as a render scale rather than asking each screen to scale itself.
A host that lays out in logical units passes the factor to the DPI state:
`ZoomDPI(state, factor)` makes the render scale the display density times the
zoom, and the layout is the view divided by it. A zoom below 100% lays out a
larger area and a zoom above it a smaller one, and `ResolveDPI` keeps the zoom
across resizes and density changes. Inbe does this: it stores the factor as
its UI scale setting, so the wheel and the Appearance slider drive one value,
and hands that setting to `ZoomDPI` each frame.
A host that draws an application unchanged applies the factor as a render
scale and divides pointer positions and the viewport by it. Kryon's raylib
runner does this for every application it runs, with no application code:
`ZoomWheel` and `ZoomKey` run before each frame, the wheel and the shortcut
keys they consume never reach the application, and `RaylibSetZoom` scales the
frame, so layout reflows to the smaller viewport as a browser page does and
text is rebaked at its scaled size to stay sharp. `KRYON_ZOOM=1.5` starts a
window at 150%; the native ZX player draws a bundle at that density too.
An application imports the module as `Zoom` (and `DPI` for the platform enum)
from the Kryon package. To opt out, or to force zoom on every platform, call
`ZoomConfigure(session, props)` with `mode` set to `ZoomModeOff` or
`ZoomModeOn`; the default `ZoomProps` is automatic.
-139
View File
@@ -1,139 +0,0 @@
# Canvas2D browser host
A browser integration roots `src/backend/canvas_raster.zi` with the selected
host and defines `PLATFORM_WEB`. Generate native sources with Ziran, then link
them with Emscripten, and Ziran's Web bridge:
```
--js-library $ZIRAN_DIR/web/ziran_web.js
-sEXPORTED_RUNTIME_METHODS=FS
-sASYNCIFY -sSINGLE_FILE=1 -sEXIT_RUNTIME=1 -sENVIRONMENT=web
```
Kryon contains no JavaScript or C. The browser hosts (`page_core.zi`,
`page_paint.zi`, `page_texture.zi`, `page_font.zi`, `page_events.zi`,
`page_files.zi`, `page_input.zi`, `page_mesh.zi`, `canvas_audio_host.zi`, `dom_host.zi`) are
written in Ziran and reach the page through `std/web.zi`; the one JavaScript
file is the generic, Kryon-agnostic bridge in the Ziran repository.
The page uses a Canvas2D context with a drawing preference that survives
occasional pixel reads. When WebGL is available, `Image` meshes share
a private surface around their visible bounds and transfer to the page together.
Indexed grids reuse shared vertices, and small size changes reuse the drawing
buffer. Texture changes retain their painter order within the batch. Other
paint, clipping, target changes, readback and presentation flush that batch
in order. Without WebGL, the same API uses the Canvas2D triangle painter.
Ordinary sprites without local rotation or mirroring draw directly in the
current camera coordinates. They preserve the caller's opacity and sampling
without copying the complete canvas state for each tile. Opacity alone does
not allocate a tinted texture.
The UI host retains its existing back buffer. It compares checked paint plans,
keeps unchanged pixels and clears/replays only the damaged region. Session,
viewport, display-density, background and raster-resource changes repaint as
needed. Ordinary host paint and custom emitters use complete painting. Text
measurement leaves retained pixels intact. This adds no extra full-size surface.
The dedicated `canvas_raster.zi` provider
calls the Canvas modules directly, so retained widgets use the same paint
queue, font selection, and clipping path as the native host. Project builds do
not pass an entry to IR or C generation: the selected `_run` module owns
`main`, while `canvas_raster.zi` remains reachable as a second root for raster
and typeface adapters.
`RequestWindowClose` is currently a raw browser host capability. An application
may declare it against `host_api`; the host records the request and observes it
on the next poll so the current frame can finish committing.
Ziran owns frame timing, image memory, font atlas packing, text layout, file
callbacks, audio decoding and conversion, resource APIs, and every call into
the browser's events, Canvas2D, FontFace, WebAudio, clipboard, and Emscripten
filesystem. Asynchronous browser calls carry
Emscripten async metadata and require Asyncify.
`EndDrawing` yields to the next browser frame for ordinary canvas loops. An
application using `emscripten_set_main_loop` must call
`SetExternalFramePacing(true)` before starting that loop, so only the callback
scheduler waits for frames. `SetTargetFPS` then adjusts that scheduler's RAF
interval; it does not suspend `EndDrawing`. Opening a window resets this mode.
The host finds `#canvas` and fills its `#canvas-frame` container when one is
present, otherwise the canvas parent. It draws at the canvas's own CSS size, so
a frame padded for safe-area insets still matches where touches land, and maps
pointer positions through the canvas's shown box. Include UTF-8 metadata in
HTML shells, including shells using Emscripten's single-file Wasm output.
Only this host's event listeners and resize observer are removed on close.
A subsequent open creates new input and texture state; cached default font
memory is released before closing the canvas.
A `#canvas` that carries the `data-transparent` attribute has no background:
the host clears the window and each frame to alpha 0 instead of Kryon's frame
colour, so the page behind it shows wherever the program draws nothing, and
widgets draw over it as usual. The editor preview sets it; without it every
pixel is opaque.
Applications that handle Escape as navigation can call `CanvasSetExitKey(0)`
through `kryon/Canvas` to disable the host's default Escape-to-exit behavior.
Ordered keys and text remain available through `CanvasInputTake(session)`.
Custom Canvas hosts can use `BeginRasterClip(bounds)` and
`EndRasterClip(saved)` through `kryon/Canvas` to intersect a rendering scope
with an outer viewport, restoring the previous clip afterward.
Images are RGBA8 (`format = 7`). Individual pixel allocations are limited to
64 MiB and 16384 pixels per dimension. Tint caching retains at most 32 entries
and 16 MiB of pixels; releasing or updating a texture invalidates its cached
copies. Frame input queues hold at most 1024 events. Audio streams enqueue at
most two pending buffers and report their actual readiness.
Mesh acceleration retains at most 32 source textures and 16 MiB of source
pixels; its drawing surface is limited to four million pixels and the device's
own limits. Texture updates refresh cached pixels. A lost context releases
its resources and invalidates retained paint before the next frame.
Browser window position, monitor selection, and native window icons have no
corresponding operation on the embedded canvas. Fullscreen and pointer lock
requests remain subject to browser gesture permissions.
## Focused checks
```
tests/canvas_backend_test.sh
python3 tests/canvas_audio_test.py
sh tests/canvas_text_os_wasm_test.sh
python3 tests/canvas_project_test.py
```
The first command compiles the complete host and checks real pixels in a new
headless Chromium process. It covers camera and nested clipping, UTF-8 input,
texture updates and render targets, asynchronous PNG round trips, a real TTF
font, frame yielding, and close/reopen ownership. Mesh pixels, sampling,
opacity and texture updates run at three display densities with acceleration
both available and unavailable; the accelerated runs also lose and recreate
their graphics context. It scrubs desktop display
variables and controls only its own browser process. The other tests verify
WebAudio and text/file behavior with deterministic browser-effect fixtures. The
project test builds a real application manifest through Ziran, loads the
resulting single-file page in private headless Chromium, and checks its exit.
`EMCC`, `CHROMIUM`, `ZIRAN_DIR`, and `ZIRAN_BUILD_DIR` can select installed
tools. `ZIRAN_RUNNER` optionally wraps focused compiler calls in a caller's
serialization script; do not set it when that script already holds its lock
around the entire test.
## Canvas host performance
Before changing the host or Ziran browser bridge, preserve a compiled baseline:
```sh
python3 tests/canvas_performance.py build/scratch/canvas-performance/before
# Apply the change, then compile the same workload again.
python3 tests/canvas_performance.py build/scratch/canvas-performance/after
node tests/canvas_performance.mjs build/scratch/canvas-performance/before \
build/scratch/canvas-performance/after build/scratch/canvas-performance/result.json
```
The runner uses private headless Chromium profiles and interleaves nine samples
per version after warmup. Each sample draws fifty frames of a 512-sprite tile
board, followed by pixel readback. An independent pixel oracle checks the
ordinary board; rotated sprites must match the baseline. Receipts preserve raw
timings and artifact hashes. This measures warm Canvas host throughput on one
shared machine; it does not establish a whole-game frame rate or a speedup on
other devices. The builder refuses to replace an existing compiled artifact.
-33
View File
@@ -1,33 +0,0 @@
# Compact navigation
`NavigationBar` can compose a compact vertical rail or horizontal dock using
the same themed buttons, keyboard activation and retained pointer capture as
other Kryon controls.
```ziran
props: Navigation.Props
props.key = KeyHash("navigation")
props.compact = true
props.vertical = true
props.bounds = Rectangle.{0.0, 0.0, 88.0, 720.0}
props.footer_count = 2
props.scroll_offset = navigation_scroll
result := Navigation.Draw(session, props, items[:])
navigation_scroll = result.scroll_offset
```
The last `footer_count` items stay at the bottom of a rail or the trailing
edge of a dock. Other items scroll without covering those actions. Supply
stable item keys when shortcuts can move. Items carry route IDs, labels,
`Image.Props`, optional vector `icon_shape`, selected state and disabled state;
the application applies `result.clicked_route` to its own routing.
Set `draggable` to receive `result.drag`, `drag_route` and `drag_bounds` for
shortcut cards. While dragging a card, supply `dragging` and `drag_position`;
`drop_index` reports the insertion slot among the scrolling shortcuts, or
`-1` outside their viewport. Footer actions are never insertion slots.
The surface resolves `NavigationBar` style rules and buttons resolve
`Navigation.NavigationBarItem` rules. `class_name` and `item_class_name` let applications
customize those faces with their current palette. Compact items use ordinary
button hover, focus, press, selection and accessibility behavior.
-5
View File
@@ -1,5 +0,0 @@
/*
Cache-Control: public, max-age=0, must-revalidate
/showcase-data.json
Cache-Control: public, max-age=0, must-revalidate
+38
View File
@@ -0,0 +1,38 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kryon API Reference</title>
<meta name="description" content="Kryon runtime and UI API reference rendered from the canonical markdown documentation.">
<meta name="theme-color" content="#f3f1ea">
<link rel="icon" type="image/png" sizes="16x16" href="icons/kryon.png">
<link rel="apple-touch-icon" href="icons/kryon.png">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="content">
<header class="hero compact">
<img class="hero-icon" src="icons/kryon.png" width="96" height="96" alt="Kryon">
<h1>API</h1>
<p class="tagline">Runtime and widget reference</p>
</header>
<nav class="site-nav" aria-label="Primary">
<a href="index.html">Home</a>
<a href="index.html#features">Features</a>
<a href="index.html#start">Start</a>
<a href="api.html">API</a>
</nav>
<main class="api-reference">
{{ API_BODY }}
</main>
<footer>
<p>&copy; 2026 Kryon Labs | <a href="https://waozi.xyz" target="_blank" rel="noopener">Made by Waozi</a></p>
</footer>
</div>
<script src="highlight.js"></script>
</body>
</html>
-1
View File
@@ -1 +0,0 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="refresh" content="0;url=docs.html"><title>API docs moved</title></head><body><a href="docs.html">API docs moved</a></body></html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

-2
View File
@@ -1,2 +0,0 @@
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Apps and showcase — Kryon</title><meta name="description" content="Kryon Labs applications are public, open-source Ziran and Kryon projects with links to their GitHub repositories."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
-13
View File
@@ -1,13 +0,0 @@
# Kryon Labs mark
`mark.svg` is a clean vector reconstruction of Proposal 01, Modular K, from
the exploratory Kryon Labs logo rasters generated on 2026-09-26. The original
proposals, exact prompts, and provenance are retained in the local Kryon Labs
profile archive under `work/branding/logo-proposals/2026-09-26/`; they are not
tracked site assets. The reconstruction keeps the selected block geometry and
colors without the raster texture or wordmark baked into the proposal image.
The site uses the mark in its header and footer. `favicon.svg` adds an ivory
backplate for browser tabs; `favicon-32.png`, `favicon.ico`, and
`apple-touch-icon.png` are raster versions of it. `og.svg` is the editable social
card source for `og.png`.
-6
View File
@@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Kryon Labs mark">
<rect x="32" y="22" width="144" height="134" fill="#a65234"/>
<rect x="32" y="175" width="144" height="314" fill="#24302c"/>
<path d="M192 175 310 22h170L298 256H192Z" fill="#395e48"/>
<path d="M192 274h106l182 215H298L192 382Z" fill="#395e48"/>
</svg>

Before

Width:  |  Height:  |  Size: 389 B

File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Loaded 100 of 2656 files, more files were not shown because too many files have changed in this diff. Show more