Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c26b7ec943 |
No files matched your search
@@ -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"
|
||||
@@ -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
|
||||
@@ -1,364 +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 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'
|
||||
|
||||
- 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
|
||||
|
||||
- name: Test live preview and rendered themes
|
||||
if: matrix.shard == 'web'
|
||||
env:
|
||||
CHROMIUM: google-chrome
|
||||
run: env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY node tests/demo_browser.mjs
|
||||
|
||||
# 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-gallery-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 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
|
||||
@@ -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 }}
|
||||
@@ -1,186 +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 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'))
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
@@ -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 }}
|
||||
@@ -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/
|
||||
@@ -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
|
||||
@@ -1,80 +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.
|
||||
|
||||
One widget concept has one public implementation. `Text(TextProps)` and
|
||||
`Image(ImageProps)` 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.
|
||||
@@ -1,128 +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(ImageProps)`.
|
||||
Applications own playback controls and access checks; an optional expiring lease
|
||||
revokes both audio and decoded frames when authorization is no longer renewed.
|
||||
`make video-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 [Ziran example](examples/README.md) builds a `.zx` that imports Kryon and
|
||||
runs a retained `Button` press and release through a separate Ziran SVG host
|
||||
without a display.
|
||||
The same directory also has a plain `Text(TextProps)` hello world desktop
|
||||
example; `make -C examples desktop-text-test` renders it on a private display.
|
||||
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. Its semantic DOM profile is covered by a separate private
|
||||
headless Chromium document test. 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:
|
||||
|
||||
`Widgets` includes `Breadcrumb` 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.
|
||||
@@ -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,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'.
|
||||
@@ -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".
|
||||
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
@@ -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}")
|
||||
@@ -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:
|
||||
*;
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(KryonRendererArtifact C CXX)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../KryonAndroid.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,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}")
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1,43 +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.
|
||||
|
||||
The DOM host mounts native browser elements. Its private browser test checks
|
||||
an editor in Chromium's accessibility tree as well as editing and focus.
|
||||
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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -1,51 +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). The two public
|
||||
import modules, `Kryon` and `Widgets`, compose that surface. 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, Canvas2D, or semantic
|
||||
DOM 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 and
|
||||
semantic DOM 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.
|
||||
@@ -1,741 +0,0 @@
|
||||
# Kryon hosts
|
||||
|
||||
Kryon's reusable widget, layout, input, and composition code is written in
|
||||
Ziran under `src/ui/`. An application imports the `Kryon` or `Widgets`
|
||||
package module 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 |
|
||||
| `dom` | `src/backend/dom_run.zi` | Semantic DOM layer over the Canvas2D raster host |
|
||||
| `android` | app `src/main.zi` → `android_run.zi` | Android NativeActivity package with direct `ANativeWindow` pixel presentation |
|
||||
|
||||
The desktop host uses `cairo_raster.zi`. Its frame loop is `desktop_loop.zi`:
|
||||
a project host that needs its own window size imports `kryon/desktop_loop`
|
||||
and returns `RunDesktop(width, height)`, and `DesktopStartBeside(marker)`
|
||||
starts a program opened from its build folder where its files are.
|
||||
`DesktopPressedKey()` supplies the frame's last key to ordinary widget loops.
|
||||
Games with several players can drain `DesktopNextKey()` for every key in arrival
|
||||
order after `PollDesktop()`, up to 32 presses per poll. This snapshot is consumed
|
||||
independently from the widget event and resets on the next poll. Numeric-keypad
|
||||
digits use the shared codes 320–329; `DesktopModifiers()` follows the key most
|
||||
recently drained.
|
||||
The DOM host reuses
|
||||
the Canvas raster provider and adds [semantic DOM reconciliation](dom.md).
|
||||
Standalone `AppContext` applications can use the same two presentations with
|
||||
the compiled hosts `canvas_app_run.zi` and `dom_app_run.zi`; the DOM entry
|
||||
reuses the application frame lifecycle while emitting positioned native HTML
|
||||
text, images and buttons with CSS boxes, gradients and clipping. Custom drawing,
|
||||
meshes and texture effects use bounded Canvas tiles in paint order; the full-page
|
||||
Canvas bitmap is not presented in this mode. The ordinary document-layout DOM
|
||||
host remains available for browser flow layout.
|
||||
Polygon-clipped images use native Cairo/Canvas path clips; DOM keeps these
|
||||
custom image shapes in bounded Canvas tiles. 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(ImageProps)` 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/DOM use 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/DOM 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 and DOM hosts use the browser's own WebP decoder.
|
||||
|
||||
`make raylib-webp-decode-test` and `make image-decode-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 |
|
||||
| DOM `<img>` | Scaled by the browser |
|
||||
|
||||
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. The desktop and raylib hosts submit them with
|
||||
`KeyboardModifiersSend` before each frame. Canvas and DOM app hosts submit
|
||||
the modifiers retained with the consumed key press or repeat, so shortcuts
|
||||
remain intact when all physical keys are released before a frame. Custom
|
||||
Canvas loops pair `CanvasPressedKey()` with `CanvasPressedKeyModifiers()`;
|
||||
`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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -1,48 +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.
|
||||
Its pointer parameters are not yet supported by the portable VM.
|
||||
|
||||
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.
|
||||
@@ -1,128 +0,0 @@
|
||||
family status current_kryon_surface exact_parity_gap target_file_and_public_contract meaningful_acceptance_test
|
||||
text extend Text, RichText, Page Heading/Paragraph No CUI last-line balancing contract; missing tabular digits, explicit 1.45 line height, nowrap+tooltip handoff, and direction analysis. src/ui/text_props.zi + text_widget.zi; extend TextProps, no wrapper. Balanced/nowrap/LTR/RTL fixtures produce exact row counts and stable geometry across two frames; ellipsis tooltip exposes full text.
|
||||
icons extend SvgIconProps, Icon module No embedded Lucide name catalog/font roles or exact size/color token mapping. src/ui/svg_icon_props.zi + src/ui/icon.zi; CUI icon pack adapter. Render sampled Lucide names at 12/16/24 px in both modes; unknown names are inert and reported.
|
||||
badge-avatar-and-keycap new No canonical Badge, Avatar, AvatarGroup, or Keycap. Badge tone/dot/solid/icon/size; avatar status/square/deterministic initials color; groups and overlap. src/ui/badge.zi, avatar.zi, keycap.zi. Verify all tones, image/initials/status, deterministic color, group clipping, and semantic labels.
|
||||
card-and-metric partial Card/CardProps Metric delta/label/lower-is-better, spark values, icon, exact padding/min/max and hover/muted/selected variants are absent. src/ui/card_props.zi + src/ui/metric.zi. Card variants and positive/negative/inverted metric fixtures pass style and semantic assertions.
|
||||
image extend Image/ImageProps Kryon already exceeds CUI input formats; CUI parity needs exact radius/tint defaults and raster bounds. src/ui/image_props.zi. PNG/JPEG golden at fit/contain/cover, rounded, tinted, missing asset and alt semantics.
|
||||
button extend Button/ButtonProps Tooltip, shortcut hint, exact CUI variants/sizes/colors, and accessible description/tooltip behavior are absent. src/ui/button_props.zi; extend ButtonProps/ButtonResult. Pointer, Enter, Space, disabled, loading, full-width, icon-leading/trailing and tooltip assertions.
|
||||
icon-button extend Button with icon_only/circle/square Tooltip/shortcut and CUI exact square/circle sizing/variants are absent. src/ui/button_props.zi. All sizes/variants render within exact bounds; accessible name comes from label/tooltip.
|
||||
button-group-copy-and-hold-to-confirm new Button primitives only No group result contract, transient copy success, or hold progress/release/cancel. src/ui/button_group.zi, copy_button.zi, hold_button.zi. Space-held activation fires only at duration; early release restores; copy action emits once and shows success.
|
||||
split-button partial Button split/menu fields + Menu/Dropdown No unified down-arrow menu ownership, menu item icons, or action/menu result split. src/ui/split_button.zi composing Button+Menu. Main and chevron have separate hit areas; Down opens menu, Escape restores focus, choice reports item ID.
|
||||
toggle-group partial SegmentedControl single selection No exclusive=false multi-toggle, icon-only mode, or group value/result. src/ui/toggle_group.zi. Toggle independent values, exclusive clamps to one, disabled items retain values, arrows/Space activate.
|
||||
confirm-button new Button only No armed state, timeout, outside-click disarm, Escape, or confirm result. src/ui/confirm_button.zi. First activation arms, second commits, timeout/Escape/outside click disarms without commit.
|
||||
status-button partial Button loading state No busy/success/error labels, result lifecycle, or terminal-state styling. src/ui/button_props.zi + status_button.zi. Busy suppresses activation; success/error transitions expose one result and accessible state.
|
||||
reactions new No canonical component Reaction groups, counts, user selection, overflow and result events are absent. src/ui/reactions.zi. Add/remove/toggle emits stable reaction IDs, count formatting and aria-pressed are exact.
|
||||
speed-dial new Overlay/Button primitives only No placement, expanded state, outside-click/Escape close, or action result. src/ui/speed_dial.zi. Open/close animation, placement, Escape/outside close and action IDs pass pointer and keyboard tests.
|
||||
theme-switcher-and-toggle partial SystemTheme, ThemePolicy, SetThemeMode No animated light/dark/accent switcher result or mode/accent persistence boundary. src/ui/theme.zi + system_theme.zi. Switch mode/accent; 0.32s OKLab interpolation respects reduced motion and restores custom metrics.
|
||||
user-menu partial Menu, Button No avatar/detail/status user identity contract or compact menu placement. src/ui/user_menu.zi. Identity, status, compact mode, placement, activation and focus restoration pass.
|
||||
swipe-actions strong SwipeRow with short/long actions Most gesture/result behavior exists; exact CUI visual states, defaults and motion need style parity. src/ui/swipe_row_props.zi. Left/right short/long thresholds, vertical-scroll rejection, release/removal and keyboard activation assertions.
|
||||
text-field partial TextField/TextFieldState CUI label/hint/error/clearable/autofocus/search, prefix/suffix and exact undo/redo behavior are not one public surface. src/ui/text_input_props.zi + text_field_widget.zi. Type/edit/select/clipboard/undo/redo, validation and focused-field scroll reveal pass keyboard and touch replays.
|
||||
text-area partial TextArea TextArea has rich editing state; CUI label/hint/error, Ctrl+Enter submit and exact visual rows are absent. src/ui/text_input_props.zi + text_area_widget.zi. Wrap, visual-line arrows, wheel, Enter newline, Ctrl+Enter submit, selection and scroll pass.
|
||||
number-field partial Spinbox integer API only No float/decimal precision, formatted display, suffix, step buttons with Shift x10, or commit/cancel events. src/ui/number_field.zi replacing parallel spinbox use for this concept. Type/buttons/arrows update value within precision; invalid text restores or reports exactly by contract.
|
||||
tag-input new TextField + chips absent No tag array ownership, max count, Enter/comma add, chip remove, Backspace-on-empty result. src/ui/tag_input.zi. Add/remove/duplicate/max-limit behavior and stable caller tag IDs pass.
|
||||
one-time-code new No canonical OTP input No segmented code boxes, auto-advance/backspace, paste/complete result. src/ui/one_time_code.zi. Typing, pasting, backspace, change and completion emit exactly once with accessible code-group semantics.
|
||||
password-strength new TextField secure only No strength algorithm/score/label/colour contract. src/ui/password_strength.zi. Known passwords map to exact score/label/color; secure field behavior remains canonical.
|
||||
inline-edit new Text/TextField primitives only No display-to-edit transition, selected text, save/cancel result. src/ui/inline_edit.zi. Click/Enter edits with selection, Enter/blur saves, Escape restores old value and focus.
|
||||
scrub-field new No canonical component Drag value editing, Shift fine step, formatting and keyboard equivalence absent. src/ui/scrub_field.zi. Pointer drag and arrows change exact values; Shift changes granularity and text remains selectable/read-only correctly.
|
||||
money-field new TextField only No currency symbol/code, decimal/locale formatting, validation or commit semantics. src/ui/money_field.zi. Locale/currency fixtures format, clamp, parse and expose changed/committed without losing caret unexpectedly.
|
||||
prefix-and-suffix partial TextField props No first-class prefix/suffix layout and semantic association. src/ui/text_input_props.zi. Prefix/suffix glyphs never overlap value; hit testing and accessible description are exact.
|
||||
shortcut-recorder new KeyInput only No key-name/localized combo label or recorder capture/clear/cancel behavior. src/ui/shortcut_recorder.zi. Record modifiers+key, Backspace clear, Escape/Tab cancel; labels match platform fixtures.
|
||||
dropzone new No widget contract No file drag/hover/drop, click-browse handoff, accept filter, compact variant or file-list result. src/ui/dropzone.zi + backend file events. Drag hover/leave, drop paths, click request, accept filter and disabled state pass with host stub.
|
||||
avatar-upload new Avatar/Image primitives only No crop/zoom, file pick/drop, preview and commit/cancel boundary. src/ui/avatar_upload.zi. Choose/drop, preview, crop/zoom, commit and cancel preserve or reject the prior image exactly.
|
||||
signature-pad new Canvas/pointer primitives only No stroke capture, pressure/width policy, clear/undo, point export or raster result. src/ui/signature_pad.zi. Recorded points/raster match pointer replay; undo/clear and minimum-stroke validation pass.
|
||||
segmented-control partial SegmentedControl Icons, full-width, CUI sizes/motion and exact arrow wrap behavior are absent. src/ui/segmented_control_props.zi. Selection, wrap, disabled options, icons and style tokens pass pointer/keyboard/semantic checks.
|
||||
checkbox-switch-and-radio partial Checkbox, Toggle, Radio Description/indeterminate and exact CUI states/motion are absent. src/ui/checkbox_props.zi, toggle_props.zi, radio_props.zi. Space toggles each control; tri-state reports indeterminate and label/description semantics.
|
||||
slider partial Slider/DiscreteSlider Range slider, Shift x10, Home/End, value formatting/display and exact thumb/track styles are absent. src/ui/slider_props.zi. Pointer/keyboard single/range edits, clamping, step and formatting pass; vertical variant if CUI documents it.
|
||||
chips-and-rating new No canonical Chip or Rating Icon/disabled chip remove/action and fractional/hover/keyboard rating are absent. src/ui/chip.zi + rating.zi. Chip activation/removal and rating values/arrows/reset produce exact events and aria values.
|
||||
radio-cards new Radio primitives only Grid layout, card content, arrows and selected semantics are absent. src/ui/radio_cards.zi. Arrow navigation across columns, wrap, disabled cards and one selected stable key pass.
|
||||
select-and-combobox partial Dropdown/ListBox Searchable combobox filtering, placeholder/icons, highlight/choose/cancel and async-owner data boundary are absent. src/ui/dropdown_props.zi + combobox.zi. Down opens and moves, typing filters, Enter chooses, Escape closes/restores focus, disabled items skipped.
|
||||
date-picker-and-calendar new No canonical date UI No calendar grid, today, month navigation, selection/activation or locale contract. src/ui/date_picker.zi + month_calendar.zi. Locale month/day fixtures, today, navigation, selection and activation pass keyboard tests.
|
||||
color-picker partial ColorPicker RGBA channels CUI popup presentation, exact channel/alpha controls, token output and accessible value are absent. src/ui/color_picker_props.zi. RGBA sliders produce exact values, clamping, focus order and result changed semantics.
|
||||
multi-select new Dropdown/ListBoxMulti primitives No chips, search, max chips, list Space/Enter selection or caller-owned selection result. src/ui/multi_select.zi. Search, toggle, chips, max chip display, SelectAll-like keyboard behavior and stable IDs pass.
|
||||
date-range-picker new No canonical component Presets, dual-month range, hover preview, minimum/narrow dates and result boundary absent. src/ui/date_range_picker.zi. Forward/back range, same-day policy, presets and keyboard navigation produce exact start/end events.
|
||||
time-picker partial TimePicker Twelve-hour, minute step, wheel/popover behavior, clear/now and exact result timing are incomplete. src/ui/time_picker_props.zi. 12/24-hour parse/format, minute step, now/done/clear and keyboard path pass.
|
||||
wheel-picker-and-time-dial new No canonical widget Momentum drum snapping, rows/loop, joined wheels, arrows/scroll and time dial absent. src/ui/wheel_picker.zi + time_dial.zi. Scroll momentum settles on item; arrows Home/End, loop boundary and joined hour/minute AM/PM pass.
|
||||
ruler-and-histogram-sliders new Slider only No ruler ticks/major marks/unit formatting or histogram range handles/distribution rendering. src/ui/ruler_slider.zi + histogram_slider.zi. Tick layout, snapping, range drag and histogram bounds produce exact values.
|
||||
knob-fader-and-level-meter new Slider only CUI drag geometry, 200-point knob traversal, Shift fine, reset, log/bipolar, ticks, meters, hold/decay absent. src/ui/knob.zi, fader.zi, level_meter.zi. Pointer/keyboard values, reset, log range and 1-8 channel peak/hold/decay fixtures pass.
|
||||
emoji-picker new No canonical widget Unicode order/groups/search/recent/tone/preview and grid keyboard navigation absent. src/ui/emoji_picker.zi with generated data. Search, group traversal, arrows/Home/End, tone and recent selection return exact scalar/name.
|
||||
tabs partial TabBar Variant/icon/full-width look, exact arrow behavior and animated selection are not CUI parity. src/ui/tab_bar_props.zi. Left/Right, wrap, activation, icons, overflow and focus pass; selected geometry stable across resize.
|
||||
sidebar-navigation partial NavigationBar, Collapsible Desktop sidebar sections/groups/badges/collapse and active-item result are not a canonical CUI surface. src/ui/sidebar_navigation.zi. Section/group navigation, badges, selected key, keyboard traversal and collapse preserve scroll.
|
||||
breadcrumb-pagination-and-stepper partial Breadcrumb; no Pagination/Stepper Breadcrumb exists; pagination pages/ellipsis, and stepper current/done/error states/results are absent. src/ui/breadcrumb_props.zi + pagination.zi + stepper.zi. Breadcrumb overflow, page change, disabled pages, step activation and status transitions pass.
|
||||
table-of-contents new Heading/Scroll primitives only No anchor tracking, active heading, scroll sync or link result. src/ui/table_of_contents.zi. Scroll input updates active anchor; activation scrolls target and keyboard traversal is exact.
|
||||
menu-bar new Menu primitives only No bar ownership, mnemonics, Alt/F10 mode, menu traversal or focus restore. src/ui/menu_bar.zi. Alt/F10, mnemonics, Left/Right/Down/Enter/Escape and global Alt-shortcut paths pass.
|
||||
toolbar partial Toolbar Toolbar button label/tooltip/shortcut/toggle, separator/spacer and overflow menu behavior are incomplete. src/ui/toolbar_props.zi. Tabs through buttons, toggles state, overflow opens and shortcuts do not activate disabled actions.
|
||||
document-tabs partial TabBar close/reorder Global Ctrl+Tab/PageDown/PageUp/Ctrl+W, close suppression, reorder and exact focus behavior are incomplete. src/ui/tab_bar_props.zi + document_tabs.zi. Select/reorder/close keyboard paths and global shortcuts report one event and preserve focus.
|
||||
status-bar new No canonical component Status item click/tooltip/tone, progress/spacer/text variants and keyboard order absent. src/ui/status_bar.zi. Items focus/click once, progress updates, spacers layout and tooltips/semantics pass.
|
||||
docking new PanedView only Persistent dock layout, panel open/dirty state, tab strips, drag/drop, save/load and shortcuts absent. src/ui/docking.zi. Serialize/load layout; drag/cancel, close, reorder, cycle and focus shortcuts mutate only reported state.
|
||||
dropdown-and-context-menu partial Dropdown, ContextMenu, Menu Placement, scale/fade motion, trigger/menu keyboard continuity, labels/separators/danger/checked exactness are incomplete. src/ui/dropdown_props.zi + menu_props.zi + context_menu_widget.zi. Down opens, arrows skip disabled/labels, Enter chooses, Escape/outside closes and focus returns to trigger.
|
||||
popover partial Popup/Overlay Placement, width/pad/gap, toggle/close ownership and focus trap/return are not a canonical CUI popover. src/ui/popover_props.zi. Toggle/open/close, placement, Escape/outside, focus restoration and layer clipping pass.
|
||||
tooltip new No canonical tooltip Pointer/focus delay, placement, boundary fitting, truncated-text trigger and reduced motion absent. src/ui/tooltip.zi. Hover/focus shows after exact delay; near viewport edge moves; disabled triggers do not show.
|
||||
dialog partial Modal/ActionModal Description, width, persistent/no-close variants, scrim close and focus lifecycle need exact CUI behavior. src/ui/modal_props.zi. Escape/scrim/close behavior, persistent suppression, accept/cancel focus and result pass.
|
||||
sheet new Overlay/Modal only Side, size, description, drag/scrim close and safe-area behavior absent. src/ui/sheet.zi. Each side opens/clips correctly; Escape/scrim/drag close and focus containment pass.
|
||||
command-palette new No canonical component Fuzzy ranking, groups, keyboard selection, global open ownership and action result absent. src/ui/command_palette.zi. Ranking fixtures, grouping, Up/Down/Enter/Escape and exact action dispatch pass.
|
||||
hover-card new No canonical component Placement, delay, interactive content and boundary fitting absent. src/ui/hover_card.zi. Show/hide delay, pointer movement tolerance, focus path and clipping pass.
|
||||
confirm-popover new Button/Popover primitives only Danger confirmation, focus on confirm, Escape/cancel and outside dismiss absent. src/ui/confirm_popover.zi. Enter confirms, Escape cancels, outside closes without confirm, focus returns to trigger.
|
||||
expandable-text-and-card new No canonical component Line clamping/fade, More/Less result, badge/icon/description card expansion absent. src/ui/expandable_text.zi + expandable_card.zi. Exact clamp threshold, toggle text, focus order and height animation pass.
|
||||
guided-tour new No canonical component Step targeting, blocking, padding, labels/count and keyboard traversal absent. src/ui/guided_tour.zi. Next/back/done/Esc sequences report steps; target geometry, scrim and focus are exact.
|
||||
toast partial Toast Description/tone/duration/action/timer/result ownership and stacking are incomplete. src/ui/toast_props.zi. Action fires once, timer expiry closes, tone/style and multiple toast ordering pass.
|
||||
alert new No canonical component Tone/icon/action/dismiss semantics absent. src/ui/alert.zi. Tone/style, action dispatch, dismiss and focus/semantic role pass.
|
||||
progress-meter-spinner-and-skeleton partial Progress, LoadingIndicator Progress label/value/indeterminate, gauge/meter variants, spinner styles and skeleton shimmer are absent. src/ui/progress_props.zi + meter.zi + skeleton.zi. Indeterminate/terminal animation, aria values and reduced-motion snapshots pass.
|
||||
empty-state new No canonical component Icon/description/action composition and semantics absent. src/ui/empty_state.zi. Layout and action activation pass; description remains accessible.
|
||||
banner-and-countdown new No canonical component Tone/action/dismiss banner and live countdown formatting absent. src/ui/banner.zi + countdown.zi. Dismiss/action events and deterministic time fixtures with compact/hide-days pass.
|
||||
onboarding-checklist new No canonical component Checklist title/description, stable task IDs, progress and completion state absent. src/ui/onboarding_checklist.zi. Toggle tasks, progress, completion and persistence boundary pass.
|
||||
undo-toast partial Toast only No undo action timeout/result contract. src/ui/undo_toast.zi or ToastProps extension. Undo fires once before timeout; expiry emits dismissed without undo.
|
||||
table package-promote DataViews TableView Plain CUI table needs richer cell composition, sort request, striped/compact/selectable style and stable row IDs. src/ui/table_view.zi promoted from data-views, one implementation. Virtualization, sort requests, selection, row/cell events and style parity pass.
|
||||
list-and-tree package-promote DataViews TreeView + ListBox List item subtitle/trailing/avatar and tree expansion/activation/keyboard need exact CUI identity/results. src/ui/tree_view.zi + list_item.zi promoted from data-views. Visible preorder identity, expansion, arrows, activation and clipping pass.
|
||||
accordion partial Collapsible Group open policy, animated height, exact header/body bounds and keyboard focus order are incomplete. src/ui/collapsible_props.zi + accordion.zi. Independent/single-open policy, animation and Space/arrow behavior pass.
|
||||
timeline-and-progress-ring new Shape/Ring primitives only Timeline time/icon/tone/last and ring value/thickness/status are absent. src/ui/timeline.zi + progress_ring.zi. Ordered timeline semantics and ring sweep/reduced motion pass.
|
||||
reorderable-list strong Reorder Drag threshold/auto-scroll/commit exists; CUI row visuals and exact keyboard/motion gaps remain. src/ui/reorder_props.zi. Drag, reorder, cancel and auto-scroll produce exact from/to IDs without duplicated commits.
|
||||
data-grid-and-filter-bar partial-package DataViews TableView Editable cells, spreadsheet selection/cursor/anchor, column filters, checkbox column and commit/cancel are absent. src/ui/data_grid.zi promoted/extended from TableView. Range/Ctrl selection, cursor navigation, double-click/Enter edit, commit/cancel and scroll reveal pass.
|
||||
tree-table-and-path-bar new Only TreeView/TableView concepts Tree grid navigation/selection, sorting/guides, path editing, segment menus and submitted path result absent. src/ui/tree_table.zi + path_bar.zi. Right/Left parent-child behavior, range selection, activation, path parse/submit/cancel pass.
|
||||
file-browser-and-picker new Backend dialogs exist, not CUI widget Places, history/reload, filter, folders/hidden, save/name editing and keyboard browsing absent. src/ui/file_browser.zi + file_picker.zi with host list callback. Stub filesystem navigation, filters, selection, Enter/Backspace/history/F5 and picked path pass.
|
||||
code-block new No canonical widget Language highlighting, title, line numbers/range highlight, scroll and header behavior absent. src/ui/code_block.zi. Token spans, wrapping/scroll, highlight lines and copy semantics if contracted pass.
|
||||
json-viewer new No canonical widget Expand depth, key/value types, paths, selection/copy and virtual scrolling absent. src/ui/json_viewer.zi. Deep fixture expands/collapses, exposes paths and handles invalid input deterministically.
|
||||
markdown-view new Page/RichText primitives only Streaming Markdown, links/tasks/images/headings/code and task result application absent. src/ui/markdown_view.zi. CommonMark fixture and streaming append produce same tree; link/task events stable.
|
||||
code-editor new TextArea only Language editor, undo grouping, tabs/indent, find/go-to, auto-indent, gutter and scroll selection absent. src/ui/code_editor.zi. C-language and Python edit scripts exercise indentation, undo/redo, find, goto and clipboard.
|
||||
diff-viewer new No canonical widget Unified/split modes, folding, context, ignore EOL and change navigation absent. src/ui/diff_viewer.zi. Known diffs produce exact hunks, folds and next/previous/expand commands.
|
||||
property-inspector new No canonical widget Groups, bool/color/enum/float/text/vector rows, scrub fields and keyboard order absent. src/ui/property_inspector.zi. Each property type edits/clamps and reports path-keyed changes; group fold works.
|
||||
log-console new TerminalList partial list behavior only Timestamps, levels, selection range, follow, copy, toolbar and append API absent. src/ui/log_console.zi. Append/virtualize/follow, selection, copy and keyboard navigation pass.
|
||||
terminal new No canonical widget Colored output selection/copy, input history, interrupt, clear and caret-at-prompt absent. src/ui/terminal.zi. Write/printf fixtures, Ctrl+C with/without selection, history and prompt behavior pass.
|
||||
hex-viewer new No canonical widget Row layout, ranges, selection/cursor, edit mode, ASCII column and copy caps absent. src/ui/hex_viewer.zi. Navigation, selection, editing and hex/ASCII copy enforce byte limits and exact cursor.
|
||||
flame-graph new No canonical widget Stack sorting, zoom/pan, span keyboard navigation, fit and selection absent. src/ui/flame_graph.zi. Zoom around pointer, pan and exact keyboard span/parent/child/fit paths pass.
|
||||
curve-editor new No canonical widget Keys, add/remove constraints, drag/nudge, snap, playhead and evaluation absent. src/ui/curve_editor.zi. Add/remove/nudge/snap fixtures and curve evaluation values pass.
|
||||
gradient-editor new No canonical widget Stops, focus/nudge/delete, color picker handoff and evaluation absent. src/ui/gradient_editor.zi. Minimum two-stop rule, exact stop position/color changes and evaluation pass.
|
||||
timeline-editor new No canonical widget Tracks, clips/keys, box selection, zoom/pan, frame snapping, playhead and mutation result absent. src/ui/timeline_editor.zi. Scripted add/select/move/trim/delete/play operations report exact frame mutations.
|
||||
charts partial-package Plot package lines/bars/markers/axes Donut, sparkline, area/stacked/smooth, common label/legend/format/min/max and exact styling are absent. src/ui/chart/{line,bar,donut,sparkline}.zi promoted core chart surface. Golden plots plus axis/format/legend/empty-data behavior pass.
|
||||
heatmap new No canonical widget Matrix labels, min/max/color/format and cell sizing absent. src/ui/heatmap.zi. Matrix values render exact token colors and accessible labels/summaries.
|
||||
calendar-heatmap new No canonical widget Year layout, empty days, color/format/unit and tooltip absent. src/ui/calendar_heatmap.zi. Date range fixtures render exact active/empty cells and value formatting.
|
||||
treemap-and-radar new No canonical widget Treemap squarify/layout and radar axes/series/legend are absent. src/ui/treemap.zi + radar_chart.zi. Known hierarchies/values produce deterministic geometry and labels.
|
||||
funnel-split-bar-and-waffle new No canonical widget Funnel, proportional split bar and waffle cell layouts/formatting are absent. src/ui/funnel.zi, split_bar.zi, waffle.zi. Proportions, rounding remainder, legends and accessible values pass.
|
||||
sankey new No canonical widget Node/link flow layout, labels, formatting and hit targets absent. src/ui/sankey.zi. Small balanced-flow fixture has stable geometry, conservation checks and labels.
|
||||
bar-list-and-activity-rings new No canonical widget Ordered bar list max rows and multi-ring activity/caption/legend absent. src/ui/bar_list.zi + activity_rings.zi. Order/keep-order/max rows, ring sweeps, center/caption and values pass.
|
||||
scatter-and-bubble new Plot package markers only Dedicated scatter/bubble axes, sizing, legends and hit testing absent. src/ui/scatter_chart.zi. Point/bubble positions and sizes match formulas; axis/legend and empty cases pass.
|
||||
radial-gauge new No canonical widget Sweep bands/ticks/target/needle/value semantics absent. src/ui/radial_gauge.zi. Clamped sweep geometry, band/target values and accessible value pass.
|
||||
candlestick-chart partial-package Plot CandleChart OHLC/volume/SMA/EMA Crosshair, pointer zoom/pan, keyboard zoom/fit, overlays and exact up/down tokens are absent. src/ui/candlestick.zi promoted/extended from Plot. OHLC/volume/overlays render and navigation/zoom report exact visible range.
|
||||
kanban-board partial-package DataViews Kanban Column dot/limit/width, keyboard lift/drop/cancel and exact slot result are incomplete. src/ui/kanban.zi promoted from data-views. Drag and keyboard moves return stable card/lane/slot IDs; limits and cancellation pass.
|
||||
week-calendar new No canonical widget Hour range, event drag/resize 15-minute snapping and read-only behavior absent. src/ui/week_calendar.zi. Drag/resize/day-move fixtures produce exact times and mutation events.
|
||||
month-calendar new No canonical component Selected day carry-over, first weekday, locale names, today and Space/Enter/Page navigation absent. src/ui/month_calendar.zi. Month boundaries, today, carry-over and keyboard activation pass.
|
||||
gantt-chart new No canonical widget Task/timeline layout, weekend shading, today marker, drag/resize and keyboard changes absent. src/ui/gantt.zi. Day-width layout and arrow/Shift resize/move produce exact dates.
|
||||
node-editor new No canonical widget Nodes, pins, links, detach, marquee, zoom/pan, minimap and graph mutations absent. src/ui/node_editor.zi. Construct/detach/delete/link graph and zoom/pan/selection keyboard paths pass.
|
||||
chat new No canonical component Message grouping/author/time/status/avatar/markdown and divider/typing behavior absent. src/ui/chat.zi. Group boundaries, status and markdown/link events pass accessibility and layout checks.
|
||||
comments new No canonical component Thread depth/line, likes/edited/badge and reply ownership absent. src/ui/comments.zi. Depth layout and like/reply events use stable IDs; nested semantics pass.
|
||||
presence-counter-and-ticker new No canonical component Presence overlap/spread/idle, counter formatting and ticker motion absent. src/ui/presence.zi, counter.zi, ticker.zi. Presence layout/spread and number/ticker animation reduce to exact static frames.
|
||||
carousel partial Carousel specialized implementation General slide count/drag/flick/wheel/arrows/dots/autoplay/loop/gap API absent. src/ui/carousel_props.zi replacing specialized surface. Index transitions and gestures report one terminal index; autoplay/loop/reduced motion pass.
|
||||
image-compare-and-card-stack new Image primitives only Divider drag/focus and finite card stack visibility/drag behavior absent. src/ui/image_compare.zi + card_stack.zi. Compare position and arrows exact; stack forward/back changes visible order deterministically.
|
||||
image-viewer-and-cropper new Image primitives only Zoom-at-pointer, pan, fit/actual, toolbar/checkerboard and crop aspect/min-size absent. src/ui/image_viewer.zi + cropper.zi. Zoom/pan formulas, double-click, keyboard fit/actual and crop bounds pass.
|
||||
text-effects new Text typing only Shimmer, reveal, typewriter and word rotation timing/caret behavior absent. src/ui/text_effects.zi. Time-driven fixtures produce exact intermediate/final text and honor reduced motion.
|
||||
rolling-numbers new Text only Character roll direction/order/timing and number formatting absent. src/ui/rolling_numbers.zi. Increase/decrease fixtures animate only changed digits and end exact.
|
||||
gradient-text-and-spotlight-cards new Text/Box gradients partial Gradient text span and pointer spotlight/beam card effects absent. src/ui/gradient_text.zi + spotlight.zi. Gradient stops and pointer-position/clipped spotlight produce deterministic pixels.
|
||||
loaders partial LoadingIndicator CUI named loader styles, size/color and reduced-motion fallback absent. src/ui/loading_indicator.zi. Every style has first/final frame and reduced-motion static equivalent.
|
||||
dock new No canonical component Magnification falloff, badges/running indicators, separators and keyboard activation absent. src/ui/dock.zi. Pointer sweep produces exact cosine magnification; Tab/Enter activates and badges layout.
|
||||
control-tiles new Toggle/Grid primitives only Large tile toggle, detail, color, wide/grid sizing and Space/Enter absent. src/ui/control_tile.zi. Activation toggles once, tile fill/layout and aria-pressed pass.
|
||||
now-playing-waveform-and-tab-bar new No canonical component Artwork, morphing play/pause, scrubber, waveform and sliding tab pill absent. src/ui/now_playing.zi, waveform.zi + tab_bar.zi extension. Playback state, scrub value, waveform bars and tab pill geometry pass.
|
||||
reasoning-and-tool-calls new No canonical component Thinking timer/collapse shimmer, tool status/input/output and elapsed semantics absent. src/ui/reasoning.zi + tool_call.zi. State transitions expose exact elapsed/status and collapse event; content remains accessible.
|
||||
agent-plan-and-status new No canonical component Plan rail, running shimmer, progress count and status timeline absent. src/ui/agent_plan.zi + agent_status.zi. Step/status changes update rail/progress exactly and report activation.
|
||||
sources-and-citations new No canonical component Citation chips, domain, hover/source card and open result absent. src/ui/sources.zi + citation.zi. Stable source IDs, hover/focus card and activation pass.
|
||||
composer-and-model-picker new TextArea/Dropdown only Auto-grow max lines, attachments, remove events, model picker, Enter send/Shift+Enter newline absent. src/ui/chat_composer.zi + model_picker.zi. Growth/scroll threshold, attachment removal, model choice and send events pass.
|
||||
suggestions-response-actions-and-context-meter new No canonical component Prompt suggestions, copy/regenerate/vote/share actions and segmented context meter absent. src/ui/prompt_suggestions.zi, response_actions.zi + context_meter.zi. Each action fires once and context segments/values/labels pass.
|
||||
voice-orb new No canonical component Amplitude-driven orb shape/color and idle/listening/speaking states absent. src/ui/voice_orb.zi. Amplitude samples produce deterministic animated frames and reduced-motion static state.
|
||||
|
@@ -1,132 +0,0 @@
|
||||
# CUI-to-Kryon Component Parity Research
|
||||
|
||||
This is research only. It does not change widget implementations or declare CUI as Kryon's default look. The complete family-level deliverable is the 127-row matrix in [`docs/CUI_COMPONENT_PARITY.tsv`](CUI_COMPONENT_PARITY.tsv); this file records evidence, architectural contracts, priorities and cross-cutting acceptance criteria.
|
||||
|
||||
## What is CUI, what is claimed, and what was measured?
|
||||
|
||||
### Takeaway
|
||||
|
||||
CUI is a compact C99 immediate-mode desktop UI library with an unusually broad documented component catalog, an MIT license, and embedded third-party assets. Its public claim of “about 170 components” does not equal the catalog's 127 documented component families or 289 distinct referenced APIs; both numbers are useful but measure different things.
|
||||
|
||||
### Cited Findings
|
||||
|
||||
- **Claimed scope and size:** CUI describes “About 170 components with spring motion and full keyboard support,” Windows/macOS/Linux from one C99 codebase, and a no-dependency core around 240 KB. — [CUI README, stable commit 3d60199](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/README.md#L12-L16)
|
||||
- **Claimed binaries and performance:** the README reports `hello` around 240 KB, the full library around 930 KB, and full-screen build/layout/paint at 0.09–0.75 ms, most under 0.25 ms. — [CUI performance table](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/README.md#L315-L321)
|
||||
- **Claimed platforms:** Win32, Cocoa, X11, and SDL2/GLFW for Wayland or others, with OpenGL or software rendering. Android is not listed. — [CUI platform table](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/README.md#L331-L337)
|
||||
- **Claimed limitations:** no accessibility tree; optional, limited Arabic-script shaping/bidi; inline IME shows committed text but not inline composition. — [CUI stated limitations](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/README.md#L341-L345)
|
||||
- **Catalog measurement:** the generated catalog at this commit contains **14 categories, 127 component families, 343 API references, 289 unique API names, 148 option groups, 811 option fields, 121 keyboard notes, 138 family scene references, 156 top-level scene entries, 240 shots and 6 unlisted entries**. This was measured from [`build/scratch/cui/catalog.json`](../build/scratch/cui/catalog.json) and the extracted [`build/scratch/cui/item-api-map.tsv`](../build/scratch/cui/item-api-map.tsv); it is not a CUI-provided component count.
|
||||
- **Catalog discrepancy:** the GitHub repository description still says about 150 components, while the README and live site say about 170. No generated counter defining “component” was found; 127 is a **documented family measurement**, not a refutation of every API-level counting method. — [CUI repository metadata](https://github.com/yappologistic/CUI/tree/3d60199b253c882da982a56e7cbeae4ce7e2682a) and [component claim](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/README.md#L12-L13)
|
||||
- **Canonical Kryon inventory measurement:** at Kryon commit `a139f22c5eb3c5b97994a727cfca94ab63104d79`, `Widgets/module.zi` has 100 public `using` imports, `WidgetKind` has 56 concrete kinds before the count sentinel, `src/ui` contains 275 `.zi` files, and `src/ui/modules.txt` compiles 225 modules. Many of those files are internals rather than parallel widget APIs. — [Kryon Widgets module](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/Widgets/module.zi#L1-L140), [WidgetKind](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/widget_kind.zi#L2-L59)
|
||||
- **Working-tree caveat:** Kryon already had many unrelated modified and untracked source/test files before this research. This report adds only research documents and does not interpret those active changes as completed or canonical behavior.
|
||||
|
||||
### Inferences
|
||||
|
||||
- Kryon should use “127 documented families / 289 APIs” for exhaustive parity work, while retaining CUI's “~170 components” as a claim. A family can contain several APIs and visual variants.
|
||||
- API-count parity alone would be misleading. CUI parity requires props, result events, retained state, pointer/keyboard behavior, styling, motion, accessibility and host capability contracts.
|
||||
- CUI performance numbers are credible upstream benchmark claims but were **not rerun here**. They must not be presented as Kryon measurements.
|
||||
|
||||
### Gaps
|
||||
|
||||
- No authoritative CUI definition of “component” was found, so an exact reconciliation from 127 families to the claimed ~170 is impossible without choosing a counting rule.
|
||||
- No CUI Android implementation exists to compare; Android work is a Kryon portability requirement, not CUI parity.
|
||||
|
||||
## What exact parity gaps and disjoint implementation contracts emerge?
|
||||
|
||||
### Takeaway
|
||||
|
||||
Kryon already has strong foundations for text, images, buttons, fields, basic controls, menus, modals, scroll/layout, tabs, trees/tables, reorder and swipe behavior. The dominant gaps are specialized inputs, picker surfaces, overlays, editable data grids/editors, chart breadth, planning surfaces, social/media surfaces, motion effects and AI components. The complete status, exact gap, target file/API and acceptance test for every family are in [`docs/CUI_COMPONENT_PARITY.tsv`](CUI_COMPONENT_PARITY.tsv).
|
||||
|
||||
### Cited Findings
|
||||
|
||||
- **Strong or near-existing families include:** text, image, button/icon button, split button, swipe actions, text field/area, segmented control, checkbox/toggle/radio, slider, select, color/time picker, tabs, toolbar, document tabs, dropdown/context menu, popover, dialog, toast, progress/loading, table/list/tree, accordion, reorder, Kanban, candlestick charts and carousel. Their current surfaces and missing behavior are enumerated row-by-row in the matrix. — [`docs/CUI_COMPONENT_PARITY.tsv`](CUI_COMPONENT_PARITY.tsv)
|
||||
- **CUI documents each family with usage, options and keyboard behavior across the two component guides.** — [CUI components](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/docs/components.md#L1-L70) and [more components](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/docs/components-more.md#L1-L80)
|
||||
- **Kryon's ownership rule requires one public widget concept and no wrappers or parallel legacy APIs**, so implementation must extend existing canonical APIs or replace them rather than add CUI facades. — [Kryon repository rules](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/AGENTS.md#L10-L49)
|
||||
- **Linked package coverage:** `css` parses selectors/custom properties/layers/media/keyframes and compiles style packs; `plot` supplies retained lines/bars/markers/axes plus OHLC, volume, SMA/EMA and band charts; `data-views` supplies TableView, TreeView and Kanban with virtualization/keyboard selection and stable IDs. — [CSS README](https://github.com/kryonlabs/css/blob/6aad71c34fffec40ec903cc8f9d5c95f02572d35/README.md#L1-L14), [Plot README](https://github.com/kryonlabs/plot/blob/3f888653b6b97010163d824c4cc72476be3214f3/README.md#L1-L10), [DataViews README](https://github.com/kryonlabs/data-views/blob/942fea7809063407e2b4fa9611a2247ab6b3b894/README.md#L1-L29)
|
||||
- **Package limitations:** Plot does not cover CUI's full chart set; DataViews does not implement CUI's editable data grid or tree table; neither is currently required by Kryon's manifest for every app. The matrix marks these as `package-promote` or `partial-package` rather than pretending dependency presence is parity. — [`docs/CUI_COMPONENT_PARITY.tsv`](CUI_COMPONENT_PARITY.tsv)
|
||||
|
||||
### Contract Rules
|
||||
|
||||
1. **One canonical implementation.** A row marked `extend` modifies the existing props/result/state module. A row marked `new` creates one family module under `src/ui/`. Do not add a CUI wrapper beside a Kryon widget.
|
||||
2. **Standard call shape.** New family APIs use `Family(session, props) -> FamilyResult` or `Family(session, props, state) -> FamilyResult` when state must survive frame boundaries. Borrowed data stays caller-owned; results identify changed data by stable IDs/paths and never take ownership.
|
||||
3. **Explicit event/state split.** Props describe input and presentation; results describe pointer/keyboard mutations; state contains only retained public state. Business actions stay in the application.
|
||||
4. **No hidden host behavior.** Widget behavior/layout/styling/accessibility stays in `src/ui/**/*.zi`. Hosts only provide input, files, fonts, images, clipboard, persistence or raster surface capabilities.
|
||||
5. **Independent module boundaries.** Each matrix family can be compiled and exercised independently, making a family small enough to package as a `.zx` component without dragging unrelated widget code.
|
||||
6. **Replace rather than preserve legacy.** Breaking changes are allowed. Where a promoted DataViews/Plot implementation becomes canonical, retire the parallel package-facing API rather than maintaining two implementations.
|
||||
|
||||
### Prioritized Disjoint Task Groups
|
||||
|
||||
1. **Foundations and safety:** CUI token/theme pack, style continuity, component identity/state migration contract, accessibility semantic contract, and portable input/result codec.
|
||||
2. **Basics/actions/inputs:** text and icon parity; badge/avatar/keycap; metric; button lifecycle variants; specialized text, numeric, tag, OTP, shortcut, file and signature inputs.
|
||||
3. **Selection/pickers/navigation/overlays:** toggle groups, chips/rating/radio cards; date/range/wheel/ruler/knob/emoji pickers; sidebar, menu bar, status bar, docking; popover/tooltip/sheet/palette/hover/tour.
|
||||
4. **Feedback/data:** alert/banner/checklist/undo; promote table/tree/Kanban; implement data grid, tree table/path bar, file browser and all editor/viewer surfaces.
|
||||
5. **Charts/planning/social/motion/AI:** chart core plus missing chart families; calendars/Gantt/node editor; chat/media/motion; AI composition surfaces.
|
||||
6. **Cross-host integration only after family behavior is nonvisual-complete:** Android, Canvas2D/DOM and desktop input/file/raster capability adapters and golden suites.
|
||||
|
||||
### Gaps
|
||||
|
||||
- Exact visual golden tolerances and glyph metrics cannot be finalized until Kryon embeds or selects the matching Inter/Geist/Geist Mono/Lucide assets. The source-derived token and font requirements below are sufficient for contract design.
|
||||
- The renderer/VM strategy is intentionally outside this component report and belongs to the separate rendering/dependency audit.
|
||||
|
||||
## What style, platform, licensing, state and validation contract is required?
|
||||
|
||||
### Takeaway
|
||||
|
||||
A 1:1 default look needs a distinct versioned CUI-compatible semantic token pack, exact Inter/Geist typography, Lucide icons, OKLab theme interpolation, CUI radii/heights/shadows/motion, and website-chrome tokens kept separate from widget defaults. Kryon already has all three requested host families, including Canvas2D without WebGL, but live module replacement needs a new explicit public state/identity boundary.
|
||||
|
||||
### Cited Findings
|
||||
|
||||
- **License:** CUI code is MIT. — [LICENSE](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/LICENSE#L1-L3)
|
||||
- **Embedded licenses:** Inter and Geist are SIL OFL 1.1, Lucide is ISC, generated Unicode 17 data is Unicode License v3, and stb helpers are public domain or MIT. — [THIRD_PARTY.md](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/THIRD_PARTY.md#L5-L13)
|
||||
- **Widget theme colors:** CUI uses neutral light/dark backgrounds, surfaces, foreground/secondary/muted text, border/subtle/strong, success/warning/danger/info, accent variants, control on/glyph/track/thumb, hover/active/scrim/focus and six rotated series colors. The exact light/dark values and eight accents are in `src/cui_theme.c`. — [semantic colors](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/src/cui_theme.c#L128-L234) and [accent table](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/src/cui_theme.c#L106-L124)
|
||||
- **Dimensions and type:** controls use radii 10/14/18, heights 30/36/44, text sizes 11/12/13/15 and headings 36/28/22/17. — [CUI theme scale](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/src/cui_theme.c#L236-L248)
|
||||
- **Shadows and motion:** light resting/raised/floating shadows and darker variants are explicit; reduced motion zeroes the multiplier; theme changes interpolate all colors over 0.32 seconds with ease-out in OKLab. — [shadows/scales](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/src/cui_theme.c#L250-L266) and [theme transition](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/src/cui_theme.c#L268-L329)
|
||||
- **Typography:** Inter Regular/Medium for body/control, Geist Medium for headings 28+, Geist Mono for code, Lucide for icons. — [CUI theming docs](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/docs/theming.md#L75-L96)
|
||||
- **Website agreement:** the live site says its colors are read from the library and confirms control/item/panel/surface radii 10/8/14/18. Its light/dark CSS values match the semantic neutral palette. The site's own 14px body, 56px topbar and 264px sidebar are documentation-chrome values, not widget theme defaults. — [site token agreement](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/web/style.css#L1-L58) and [site body/chrome](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/web/style.css#L91-L123)
|
||||
- **Kryon current metrics differ materially:** radii 4/12/28/999, heights 32/40/48 and font sizes 14/16/22. — [Kryon Metrics](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/theme.zi#L257-L300)
|
||||
- **Kryon style engine already has selector facts and style fields** for kind/name/class/role/tone/emphasis/size/state/validation/orientation/placement and colors, radius, borders, opacity, spacing, font, icons, gradients, material and letter spacing. It lacks the complete CUI semantic token pack, multi-layer elevation tokens, motion duration/multiplier tokens, series rotation, OKLab transition and font-role tokens as first-class installed theme state. — [selector facts](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/style_sheet.zi#L340-L378) and [style merge fields](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/style.zi#L47-L190)
|
||||
- **Host targets:** Kryon's desktop backend is SDL2+Cairo, `raylib` web is WebGL1, and `canvas` is Canvas2D; DOM is a semantic layer over Canvas2D. Android builds use NativeActivity, Android viewport/input policy and shared raylib host. These satisfy desktop, web-without-WebGL and Android targets without making WebGL a component dependency. — [backend table](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/docs/BACKENDS.md#L62-L92) and [Android host](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/docs/BACKENDS.md#L545-L578)
|
||||
- **Current retained identity:** a Kryon node survives only when parent key, widget key and widget kind match. Built-in node state is only `open`, `index`, `offset` and `focus_generation`. — [identity](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/tree.zi#L24-L31) and [WidgetState](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/ui/tree.zi#L240-L247)
|
||||
- **Current `.zx` player retention:** the portable player owns the window; widgets/layout/state execute in the bundle instance; bundle globals/session persist while the same instance runs. No live module-instance replacement or state migration API was found. — [zx player](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/backend/zx_run.zi#L1-L48) and [reusable player](https://github.com/kryonlabs/kryon/blob/a139f22c5eb3c5b97994a727cfca94ab63104d79/src/backend/bundle_player.zi#L1-L8)
|
||||
|
||||
### Required Style Contract
|
||||
|
||||
- Add a versioned **CUI-compatible style pack**, not silently replace Kryon Classic unless the owner later chooses CUI as the global default.
|
||||
- Token groups: backgrounds/surfaces; foreground/text; borders; status; accents; control on/glyph/track/thumb; hover/active/scrim/focus; six series; neutral label tones; radius control/item/panel/surface/small; control heights; text and heading scales; font roles; three two-layer shadow groups; motion durations and multiplier.
|
||||
- Preserve user-customized non-color metrics when switching mode/accent, matching CUI behavior.
|
||||
- Implement exact OKLab interpolation or a precomputed equivalent for the 0.32-second theme transition; reduced motion snaps color state.
|
||||
- Keep website chrome tokens (`14px` site body, topbar/sidebar dimensions, bezel/code palette) outside widget defaults while deriving shared semantic values from the same source.
|
||||
- Package full CSS parsing as optional `kryonlabs/css`; core needs only compiled CUI token/style tables and runtime resolution so components can render without a Git CSS dependency.
|
||||
- Add license manifests for any embedded Inter/Geist/Lucide/Unicode data. Prefer existing Kryon assets for Classic; use CUI-compatible assets only in the CUI pack.
|
||||
|
||||
### Required Portable Component / Hot-Swap Contract
|
||||
|
||||
1. **Stable external identity:** host/component identity is `(owner key, stable component key, public component kind)` and remains constant across implementation replacement. Internal child keys may change without losing public state.
|
||||
2. **Versioned public state:** every component exposes a serializable state schema/version. Public state includes editing cursor/selection/IME, scroll, focus generation, open popup, active item, drag operation, undo stack and animation-neutral semantic state as applicable.
|
||||
3. **Migration and rollback:** replacement declares accepted source versions. Successful migration commits before the first replacement frame; failure leaves the previous instance/frame state available and reports a typed error. A failed next frame cannot destroy already committed state.
|
||||
4. **Private state is disposable:** implementation caches, glyph caches and transient animation phase may reset. Focus, editing value, scroll, open state, public selection and user-visible theme must not.
|
||||
5. **Caller-owned data:** arrays, files, model data and business actions are borrowed by the component and remain outside the hot-swapped module.
|
||||
6. **Stable result ABI:** events use stable component/function IDs and typed codecs; result enums and IDs are part of the public contract.
|
||||
7. **Theme continuity:** installed semantic token generation and user customizations survive replacement.
|
||||
8. **No renderer special case:** component modules emit Kryon tree/style/semantic commands; Canvas, DOM, Cairo and Android hosts render the same command stream.
|
||||
|
||||
### Meaningful Cross-Cutting Acceptance Tests
|
||||
|
||||
- **Style exactness:** compare Cairo pixmap, Canvas2D and Android-safe raster frames for every tone/accent/mode, including theme transition first/middle/last frames and reduced motion.
|
||||
- **Keyboard/focus:** replay the documented CUI key sequence for each family and assert focus, consumed keys, result event and accessibility semantics.
|
||||
- **State retention:** replace a component implementation between frames and assert focused field caret/selection, scroll, open menu, selected tab/item, drag state, undo state and theme survive or migrate exactly.
|
||||
- **Failure rollback:** corrupt/missing replacement modules and failing migration must keep the previous committed frame and report the exact failure.
|
||||
- **Portable bundles:** each family's `.zx` sample runs headless through the pixel player with no renderer-specific imports; required host capabilities are declared explicitly.
|
||||
- **Host matrix:** nonvisual tree/input tests everywhere; exact raster parity on Cairo, Canvas2D and Android stub; desktop window tests only under private Xvfb/Xephyr.
|
||||
- **License:** build fails if any embedded asset lacks its matching license file and generated source provenance.
|
||||
|
||||
### Inferences
|
||||
|
||||
- The safest dependency direction is: core carries a compiled CUI style pack and all canonical component behavior; full CSS remains optional; Plot/DataViews implementations should be promoted only when their family becomes canonical, then removed from the dependency path rather than duplicated.
|
||||
- CUI's lack of an accessibility tree is not parity to preserve. Kryon should keep and extend its semantic/accessibility model while matching CUI's visual and keyboard behavior.
|
||||
- MIT permits reference and porting, but Kryon's own 100%-Ziran rule means the implementation should be authored in Ziran rather than copying C source. Embedded assets must follow their separate licenses.
|
||||
|
||||
### Gaps
|
||||
|
||||
- Exact file-drop, Android file picker, font fallback and clipboard capability adapters need per-family host tests; CUI docs alone do not establish their behavior on Kryon Android/Canvas.
|
||||
- Unicode emoji data size and whether it belongs in core or an optional generated module is a dependency decision not settled by component behavior.
|
||||
- No CUI Android baseline exists, so Android acceptance must compare Kryon hosts to Kryon's own expected command/raster output, not to CUI.
|
||||
@@ -1,148 +0,0 @@
|
||||
# CUI input components
|
||||
|
||||
These six Ziran components cover the selected CUI input families without a CUI
|
||||
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 `TextFieldInput.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.
|
||||
|
||||
## Verification
|
||||
|
||||
`tests/ziran_cui_inputs_test.sh` builds identical source and saved-IR bundles,
|
||||
runs both, generates native C and Go, and checks behavior across all six
|
||||
families. Rendering assertions inspect the retained tree and actual raster
|
||||
providers, including custom one-time-code slot metrics, shortcut font metrics,
|
||||
and inline-edit IME preedit. The command is:
|
||||
|
||||
```sh
|
||||
build-queue -- env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY \
|
||||
-u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
|
||||
sh tests/ziran_cui_inputs_test.sh
|
||||
```
|
||||
@@ -1,46 +0,0 @@
|
||||
|
||||
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.
|
||||
|
||||
## Verification
|
||||
|
||||
`tests/ziran_cui_overlays_test.sh` checks source and saved-IR bundle byte identity, runs both ZX programs, builds and executes generated C and Go from both representations, and exercises behavior, committed tree metadata, custom geometry/font/motion/style IDs and real 480×360 light/dark pixmap raster hashes without a desktop display.
|
||||
|
||||
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.
|
||||
|
||||
## Verification
|
||||
|
||||
`tests/ziran_cui_overlays_test.sh` checks source and saved-IR bundle byte identity, runs both ZX programs, builds and executes generated C and Go from both representations, and exercises behavior, committed tree metadata, custom geometry/font/motion/style IDs and real 480×360 light/dark pixmap raster hashes without a desktop display.
|
||||
@@ -1,272 +0,0 @@
|
||||
# Redesign Kryon around portable Ziran components
|
||||
|
||||
Kryon should match CUI's default quality, then exceed it with one canonical
|
||||
Ziran-authored system: a single semantic token contract, independently
|
||||
replaceable `.zx` families, shared runtime/render/style services, typed state
|
||||
migration, atomic rollback, Android/desktop/Canvas2D hosts, and a static website
|
||||
generated from those components. The verified corpus is **127 documented CUI
|
||||
families**, not an ambiguous “about 170”; the dirty-checkout assessment is
|
||||
**2 strong, 5 extend, 30 partial, 84 new, 2 package-promote, and 4 partial-package**—source findings, not release or parity-test claims
|
||||
([component research](CUI_COMPONENT_RESEARCH.md),
|
||||
[matrix](CUI_COMPONENT_PARITY.tsv)).
|
||||
|
||||
Kryon already has safe whole-bundle replacement and rollback, but not retained
|
||||
or migrated public state for one independently changed component. CUI's sizes
|
||||
and frame timings are upstream claims only; its separate full repaint metric can
|
||||
reach 19 ms. Kryon must publish only its own distributions
|
||||
([runtime research](CUI_RUNTIME_RESEARCH.md),
|
||||
[CUI README](https://github.com/yappologistic/CUI/blob/3d60199b253c882da982a56e7cbeae4ce7e2682a/README.md#L315-L321)).
|
||||
|
||||
## One canonical default removes ambiguity and legacy
|
||||
|
||||
There is one improved default, not a CUI theme beside retained Classic.
|
||||
`src/ui/theme.zi` owns semantic color, radius, type, spacing, motion, focus, and
|
||||
shadow values; customization changes those values and metrics rather than
|
||||
selecting another implementation. Customization spans semantic tokens, typed
|
||||
style properties, selectors/classes/IDs/states, layout and geometry, fonts,
|
||||
borders, motion, and per-component rules. Website chrome consumes a generated
|
||||
bridge; the CSS parser is optional as a dependency, not removed from the product
|
||||
([component research](CUI_COMPONENT_RESEARCH.md),
|
||||
[website research](CUI_WEBSITE_RESEARCH.md)).
|
||||
|
||||
Plot/DataViews families are promoted once into `src/ui/`, imported selectively,
|
||||
and their package-facing duplicates leave the dependency path. There are no
|
||||
parallel widget APIs, theme runtimes, wrappers, or editor stacks: `/demo`
|
||||
redirects after catalog migration and its old implementation/assets are deleted.
|
||||
|
||||
| Decision | Rule | Primary owner |
|
||||
|---|---|---|
|
||||
| Default theme | One CUI-compatible semantic contract | `src/ui/theme.zi` |
|
||||
| Customization | Typed style properties plus optional CSS selectors/rules | `src/ui/theme.zi`, `src/ui/style_sheet.zi`, CSS package |
|
||||
| Component API | One public family concept | `src/ui/**` |
|
||||
| Package promotion | Promote once, remove duplicate surface | `src/ui/**`, `ziran.toml` |
|
||||
| Website examples | Generated static Ziran shots | `docs/site/**`, site scripts |
|
||||
| Superseded editor | Redirect route, delete unused code/assets | `docs/site/**` |
|
||||
|
||||
## Fix the general runtime before scaling components
|
||||
|
||||
The first gate is upstream Ziran, not widget count. Ziran already supports
|
||||
verified bundles, explicit foreign calls, opaque host handles, and module
|
||||
composition. Standalone portable VM instances already have independent state;
|
||||
the composed library/add-on path currently has one independent global-state
|
||||
instance, which cannot host multiple independently replaced UI components.
|
||||
Browser linked code also has one-instance and scalar-subset
|
||||
constraints. Ziran needs general module identity/version metadata, typed ABI and
|
||||
capability negotiation, independent instances, ownership/lifetime checks, state
|
||||
export/import/migration, stale-reference rejection, transactional replacement,
|
||||
partial declaration replacement, loader timing, a production wasm story, and a
|
||||
dev/runtime split ([runtime research](CUI_RUNTIME_RESEARCH.md)).
|
||||
|
||||
### Stage A: baseline and capability audit
|
||||
|
||||
Kryon owns `render_dispatch.zi`, current desktop/pixmap/Canvas/Android hosts,
|
||||
the snapshot/benchmark tests, and new trace fixtures. With no public API change,
|
||||
it adds identical scene/pixel oracles and counters for composition,
|
||||
reconciliation, layout, paint, raster, present, damage, input latency,
|
||||
allocations, and memory. `build-queue -- python3 tests/backend_render_benchmark_test.py`,
|
||||
then the identified snapshot/pixmap/Canvas/Android build gates, must report
|
||||
p50/p95/p99 and counts while pixels match the oracle.
|
||||
|
||||
### Stage B: general component lifecycle
|
||||
|
||||
Ziran goes first in `zir_bundle.c/h`, `zir_zx_host.c/h`, `zir_zx_native.c/h`,
|
||||
`zir_zx_wasm.c/h`, `std/bundle_host.zi`, and bundle/ZX/spec tests. It exposes
|
||||
general identity/version, typed capability compatibility, independent instances,
|
||||
state migration, stale-reference failure, and transactional replacement. No
|
||||
Ziran API learns a Kryon widget name.
|
||||
|
||||
Only then does Kryon consume it through `tools/zx.zi`, `bundle_watch.zi`,
|
||||
`widget_host.zi`, and `widget_codec.zi`. Public state versions editing/IME,
|
||||
scroll, focus, open state, active item, drag, undo, and semantic animation
|
||||
state; caches are disposable and data remains caller-owned. Successful migration
|
||||
commits before the replacement frame; failure preserves the prior frame.
|
||||
|
||||
The Ziran suite must prove two concurrent independent replacements, successful
|
||||
migration, rollback, ABI mismatch rejection, and stale-reference rejection. The
|
||||
Kryon focused test is `python3 tests/zx_reload_test.py`, extended to two
|
||||
components while an unrelated component remains live. It reports verify,
|
||||
instantiate, migrate, resume, and first-frame separately.
|
||||
|
||||
### Stages C–E: presenters and dependency pruning
|
||||
|
||||
Desktop keeps the deterministic pixmap renderer and small SDL
|
||||
window/event/present host. Stage C owns the pixmap/SDL/text/Cairo/desktop files
|
||||
and tests; Cairo/Pango leave only after Unicode, bidi, ligatures, fallback,
|
||||
clipping, caret, density, IME, damage, and presentation match privately. Run
|
||||
`build-queue -- make pixmap-parity-test desktop-native-test`, then Stage A on
|
||||
the same machine.
|
||||
|
||||
Android replaces raylib ownership with a thin NativeActivity/`ANativeWindow`
|
||||
host, not a draw-call substitution. Stage D owns the Android runtime/surface/
|
||||
touch/text/clipboard/file/notification modules, Android glue, and Cmake. It
|
||||
preserves lifecycle, input/IME, clipboard, assets, fonts, timing, and software
|
||||
presentation. Build-only tests precede a private-emulator or designated USB Moto
|
||||
gate; raylib files/artifacts are removed only afterward.
|
||||
|
||||
Web makes Canvas2D required. Stage E owns page/canvas modules, `ziran.toml`,
|
||||
renderer artifacts, and their three tests. The minimal artifact has no WebGL
|
||||
symbol/reference, Node tooling, or development compiler; player, bundle, assets,
|
||||
and wrapper sizes are separate. Run `build-queue -- make zx-canvas-test
|
||||
renderer-artifact-test`, then browser-tier and Stage A web tests.
|
||||
|
||||
## Implement 127 families in serialized waves
|
||||
|
||||
`docs/CUI_COMPONENT_PARITY.tsv` is the issue tracker. Each row already supplies
|
||||
family, status, current surface, exact gap, target file/public contract, and
|
||||
acceptance test. Family workers own only those files. Shared `theme.zi`,
|
||||
`style_sheet.zi`, `ziran.toml`, `src/ui/modules.txt`, codec generators, and
|
||||
fixtures are serialized by the foundation owner to protect the already dirty
|
||||
active tree. Selective imports are mandatory: an app that does not request a
|
||||
family does not carry it.
|
||||
|
||||
### Component waves
|
||||
|
||||
| Wave | Exact initial owners | Focused command and completion definition |
|
||||
|---|---|---|
|
||||
| 0 | `theme.zi`, `style_sheet.zi`, then Stage B Kryon hosts/codecs | `make public-surface-check && python3 tests/cui_theme_contract_test.py`; every mode/accent/custom metric and reduced-motion tree/raster passes; replacement gate above passes |
|
||||
| 1 | Extend `text_props.zi`, `text_widget.zi`, `button_props.zi`, `icon.zi`, `svg_icon_props.zi`, `image_props.zi`; add TSV basics/actions/inputs | `python3 tests/cui_basics_wave_test.py`; geometry, pointer, keyboard, loading/disabled, tooltip, formatting, and accessibility pass row by row |
|
||||
| 2 | Existing selection/navigation/overlay owners plus canonical `date_picker.zi`, `month_calendar.zi`, `tooltip.zi`, and all TSV targets | `python3 tests/cui_controls_overlays_wave_test.py`; keyboard, focus, placement, boundary, delay, drag, locale, and reduced-motion contracts pass |
|
||||
| 3 | Promote `table_view.zi`, `tree_view.zi`, `list_item.zi`, `kanban.zi`, `data_grid.zi` | `make public-surface-check && python3 tests/cui_data_wave_test.py`; stable IDs, virtualization, editing, selection, sorting, filtering, and accessibility pass without a package-only API |
|
||||
| 4 | Create `src/ui/chart/{line,bar,donut,sparkline}.zi`, promote/extend `candlestick.zi`, then remaining chart rows | `python3 tests/cui_chart_wave_test.py`; axes, formatting, legends, empty data, hit testing, goldens, and reduced motion pass |
|
||||
| 5 | Add planning/editors/media/motion/AI rows such as `chat.zi`, `markdown_view.zi`, `code_editor.zi`, `node_editor.zi`, `gantt.zi`, `timeline_editor.zi`, `text_effects.zi` | `python3 tests/cui_advanced_wave_test.py`; layout, content boundaries, keyboard, link/task/media results, virtualization, motion, and capability declarations pass |
|
||||
| 6 | Only affected host adapters from Stages C–E | `make test`, then `make push-check`; host-specific behavior passes after nonvisual tree/input/state/style tests |
|
||||
|
||||
Every command above runs as `build-queue -- <command>`. The `cui_*` Python gates
|
||||
and final performance command are proposed tests; the named `make` targets and
|
||||
existing runtime tests already exist. Ziran Stage B, canonical theme/style
|
||||
foundations, Stage A instrumentation, and disjoint static website metadata/shell
|
||||
work can proceed in parallel. Only `.zx` hot-swap consumer integration waits on
|
||||
the upstream lifecycle API; shared theme, manifest, codec, and module files stay
|
||||
serialized, while family waves follow style/state contract availability.
|
||||
|
||||
New family APIs use `Family(session, props) -> FamilyResult`, or
|
||||
`Family(session, props, state) -> FamilyResult` when public state survives frame
|
||||
boundaries. Props describe input/presentation, results describe typed mutations
|
||||
and actions, state is versioned and serializable, and business behavior remains
|
||||
outside the component. A row marked `extend` changes its current canonical API;
|
||||
a row marked `new` creates one canonical family module. No CUI facade is added.
|
||||
|
||||
## Measure components and complete apps separately
|
||||
|
||||
A component benchmark covers one independently imported family. It reports cold
|
||||
load, verify/instantiate/migrate/resume, first semantic tree, first raster,
|
||||
steady-state frame, memory, and replacement latency. An application benchmark
|
||||
separately accounts for shared runtime, selected modules, production player,
|
||||
fonts, icons, Unicode/emoji data, renderer, wrapper, assets, and application
|
||||
payload. Exact CUI-compatible fonts can increase bytes; the report says so.
|
||||
|
||||
Comparisons must pre-register complete binaries, common scenes, fonts, viewport,
|
||||
DPI, input script, hardware, OS, browser/device, toolchain, optimization flags,
|
||||
run count, warmup, and every deviation. Match or exceed CUI's documented 30
|
||||
warmup and 200 measured frames, preserve failures, and report p50/p95/p99,
|
||||
min/max, standard deviation, allocations, peak RSS, and raw traces. Measure
|
||||
input dispatch, composition, layout, paint, raster, present, end-to-end frame,
|
||||
and replacement independently. Android and no-WebGL web results are Kryon
|
||||
capability results because CUI documents no equivalent target.
|
||||
|
||||
The proposed report entry point is `build-queue -- python3
|
||||
tests/cui_performance_benchmark.py --report build/scratch/cui/performance.json`.
|
||||
Passing means the report exists, every accounting field is present, sample
|
||||
counts or confidence are stated, and correctness oracles pass. It never means
|
||||
every app is under 250 KB or that Ziran output beats C99.
|
||||
|
||||
## Build the website from the winning system
|
||||
|
||||
Primary navigation becomes Overview, Guide, Components, Showcase, Apps, and
|
||||
Docs. `/widgets` remains the stable Components URL; `/components` may redirect
|
||||
to it. The catalog has search, category/module counts, grid/list views, and
|
||||
static light/dark images. It does not import `live-editor.js` or embed a
|
||||
compiler, editable source pane, or preview iframe. `/demo` redirects after
|
||||
migration and its old implementation/assets are deleted.
|
||||
|
||||
`scripts/gallery.py`, `examples/gallery/modules.toml`, and gallery sources
|
||||
enrich every existing and new scene with category, module, honest summary,
|
||||
source path, APIs, options, keyboard note, related entries, and alt text.
|
||||
`scripts/build-gallery.py`, `scripts/build-site.py`, new
|
||||
`examples/gallery/src/catalog-shot.zi`, and `examples/gallery/ziran.toml` render
|
||||
each scene alone using `KRYON_CATALOG_SCENE`/`KRYON_CAPTURE_PATH` under private
|
||||
headless/Xvfb conditions. Stable WebP/PNG outputs go under
|
||||
`docs/site/assets/components/`.
|
||||
|
||||
`widgets.html`, `gallery.css`, `gallery.js`, and generated `gallery-data.js`
|
||||
render cards and compact rows. Site JavaScript handles search, filtering, view
|
||||
switching, theme selection, drawer behavior, and focus management only; it never
|
||||
reimplements widget appearance, state, or behavior. `current.css` and
|
||||
`current.js` consume generated tokens for a 56px topbar, 264px desktop sidebar,
|
||||
880px docs measure, 76ch prose, 860px drawer breakpoint, and 640px compact
|
||||
layout.
|
||||
|
||||
The focused commands are `build-queue -- make site` and
|
||||
`build-queue -- make site-browser-test`. Done means manifest and scene counts
|
||||
match, every image path and alt text resolves, search and filters work, keyboard
|
||||
focus survives view changes, reduced motion is honored, the drawer closes on
|
||||
navigation/scrim/Escape/resize, and no maintained page overflows at 320, 390,
|
||||
768, 1024, or 1366px. The Python test also asserts that no live editor or demo
|
||||
compiler path remains reachable. Cloudflare Pages deployment is owned by
|
||||
`.github/workflows/pages.yml`, not GitHub Pages.
|
||||
|
||||
## Protect active work and report only completed gates
|
||||
|
||||
The Kryon and Ziran worktrees are dirty with unrelated active changes. Workers
|
||||
must preserve them, avoid cleanup/revert, and report shared-file conflicts rather
|
||||
than overwriting. Each coherent feature set completes focused tests, relevant
|
||||
host suites, and integrated local gates before one coherent repository commit.
|
||||
No source-generation-only milestone is committed. Final Kryon gates are
|
||||
`build-queue -- make test` and `build-queue -- make push-check`; upstream Ziran
|
||||
runs its own suite before the Kryon consumer changes.
|
||||
|
||||
The final report distinguishes source inspection, generation, nonvisual tests,
|
||||
private visual tests, native/platform tests, local website tests, Cloudflare
|
||||
deployment, and GitHub CI. It does not call matrix statuses parity-test passes,
|
||||
CUI metrics Kryon measurements, or component counts total app size. These
|
||||
research documents remain uncommitted because implementation has not started.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The dependency order is fixed: audit current hosts, generalize Ziran component
|
||||
identity/state/replacement, prove selective imports, adopt one canonical theme,
|
||||
then consume the 127-row matrix in serialized waves while the website is
|
||||
generated from the same components. Portable `.zx` remains primary and future
|
||||
Ziran self-hosting remains a clean-language goal; C/Go output is never the
|
||||
optimization deliverable. Parallel themes, package duplicates, raylib ownership,
|
||||
Cairo dependence where general text can replace it, WebGL assumptions, and the
|
||||
old website editor are removable obstacles. Kryon's credible advantage is a more
|
||||
customizable, accessible, measurable, portable Ziran system—not another C copy.
|
||||
|
||||
## Execution status
|
||||
|
||||
Research and synthesis are verified. Active implementation sessions are
|
||||
`glm-kryon-canonical-style-foundation` for canonical tokens, typed style, and
|
||||
shared manifest integration; `glm-kryon-zx-component-host-integration` for
|
||||
hot-ZX host integration; `glm-css-css-kryon-typed-style-parity` for typed CSS
|
||||
parity; `glm-kryon-responsive-canvas-no-webgl` for the browser/Canvas runtime;
|
||||
`glm-kryon-android-raylib-free-host` for the Android host; and the
|
||||
`glm-kryon-cui-action-components` plus
|
||||
`glm-kryon-cui-input-components` family waves, and
|
||||
`glm-kryon-kryon-static-catalog-site` for the static catalog. Canonical theme, token-export
|
||||
source/saved-ZX parity, retained Button raster behavior, style-cache parity,
|
||||
and Android source/bundle checks have passed. A short-`TMPDIR` full `make
|
||||
test` currently stops in native `tests/cursor_api_test.py` because its missing
|
||||
asset request never changes the cursor; the backend input owner is diagnosing
|
||||
delivery before any whole-suite rerun.
|
||||
|
||||
The static-site stream has generated the compact seven-page shell, retained
|
||||
redirects including the former API route, and source-driven metadata for all 76
|
||||
gallery scenes—64 original scenes plus the completed input and overlay waves—with
|
||||
152 private-headless light/dark Ziran captures. Capture reuse is invalidated by
|
||||
scene-source hashes, gallery-source hashes, capture-selection logic, and the
|
||||
built gallery binary hash plus canonical exporter source/output hashes. The
|
||||
current private-Chromium gate verifies files, links, redirects, canonical token
|
||||
equality, metadata/source/API/options/status/alt, unique capture contents,
|
||||
search/filter/details, grid/list, themes, keyboard focus, Escape, reduced
|
||||
motion, and no overflow at all required widths. The only equal captures are the
|
||||
inherited `Group` and `Screen` equivalence; the former local-index duplication
|
||||
is gone. Subjective CUI visual comparison and full-bleed-versus-crop acceptance
|
||||
remain unverified.
|
||||
|
||||
All 127-family parity remains incomplete. No original-Kryon redesign milestone
|
||||
is complete. No commit, push, deployment,
|
||||
integrated platform validation, or performance result is complete yet. Remaining
|
||||
backend/component work includes portable replacement/state migration, all
|
||||
component-family waves, package promotion, presenter/raylib/dependency pruning,
|
||||
and meaningful platform/performance validation before coherent per-repo commits.
|
||||
@@ -1,513 +0,0 @@
|
||||
# Kryon runtime research against CUI
|
||||
|
||||
Date: 2026-11-08
|
||||
Scope: platform/rendering architecture, dependency and size inventory, performance
|
||||
boundaries, and the general Ziran work needed for small, hot-swappable `.zx`
|
||||
components. Component parity and website design are separate research tasks.
|
||||
|
||||
This is a research report, not a benchmark result and not an implementation. No
|
||||
Kryon build, browser run, desktop run, Android run, or performance test was run
|
||||
for this report. Existing artifacts were only inspected for identity, size, and
|
||||
freshness.
|
||||
|
||||
## Evidence snapshot
|
||||
|
||||
- Kryon worktree: `a139f22c5eb3c5b97994a727cfca94ab63104d79`, dirty with
|
||||
unrelated active work. Counts and file state below are a research snapshot,
|
||||
not a clean release claim.
|
||||
- Ziran worktree: `acb15f2ae465a2b3b62881cf48313fab8774d854`, dirty.
|
||||
- CSS package worktree: `6aad71c34fffec40ec903cc8f9d5c95f02572d35`, clean.
|
||||
- Kryon snapshot inventory: 275 `src/ui/*.zi` modules, 177
|
||||
`src/backend/*.zi` modules, and about 105,000 source lines in the researched
|
||||
set. `src/ui/widget_kind.zi:2` defines 56 semantic widget kinds (values 0
|
||||
through 55); `WidgetKindCount` is a sentinel, not a 57th widget. This is not
|
||||
a component-count comparison because CUI and Kryon do not define “component”
|
||||
identically.
|
||||
|
||||
## CUI claims, in CUI's own terms
|
||||
|
||||
The relevant primary sources are the
|
||||
[README](https://github.com/yappologistic/CUI/blob/master/README.md#L311-L325),
|
||||
[performance methodology](https://github.com/yappologistic/CUI/blob/master/docs/performance.md),
|
||||
[benchmark source](https://github.com/yappologistic/CUI/blob/master/tests/bench.c),
|
||||
[integration guide](https://github.com/yappologistic/CUI/blob/master/docs/integration.md),
|
||||
and [rendering guide](https://github.com/yappologistic/CUI/blob/master/docs/rendering.md).
|
||||
|
||||
- **Components:** CUI's README advertises about 170 built-in components. The
|
||||
owner's “about 160” recollection is close, but 170 is the figure to quote.
|
||||
- **Codebase/dependencies:** CUI describes one C99 codebase with no required
|
||||
dependencies. This report did not audit every optional platform library or
|
||||
prove that the claim holds at every commit.
|
||||
- **Size:** “Complete app” in the integration guide means the stripped
|
||||
MinSizeRel `hello` executable, reported at about 240 KB. The complete library
|
||||
build is reported at about 930 KB. These are CUI's definitions and build
|
||||
configuration, not interchangeable with Kryon's current project bundles.
|
||||
- **Frame timing:** CUI reports `cui_frame` build/layout/paint at 0.09–0.75 ms,
|
||||
with most results below 0.25 ms. Its full software repaint is a separate
|
||||
metric: 3.4–19 ms at 2480×1640 with four threads. Quoting only the sub-0.25 ms
|
||||
figure as “rendering” would be dishonest.
|
||||
- **Benchmark method:** CUI's documented suite uses warmup and measured frames,
|
||||
randomized input, soak behavior, software rasterization loops, a shared
|
||||
cloud x86-64 machine, and allocation/memory checks. Its benchmark source uses
|
||||
30 warmup and 200 measured frames; any Kryon comparison must disclose all
|
||||
differences rather than borrow those numbers.
|
||||
- **Platform:** CUI's platform table covers Windows, macOS, and Linux desktop.
|
||||
Its live web documentation uses WebGL2. No Android target and no no-WebGL web
|
||||
path was found in the primary documentation. This is a platform opportunity,
|
||||
not evidence that Kryon is faster or smaller.
|
||||
- **Rendering model:** CUI produces a triangle draw list for one shader and has
|
||||
a software reference renderer. It is a compact, explicit rendering boundary;
|
||||
its numbers still cannot be transferred to Kryon's retained tree, damage, and
|
||||
presenter work without running the same scenes on the same hardware.
|
||||
|
||||
No performance or size superiority over C99/CUI is claimed here. In particular,
|
||||
there is no current evidence that Ziran-generated code is faster or smaller than
|
||||
CUI. The immediate objective is a coherent, testable architecture; only the
|
||||
pre-registered procedure below can support comparative claims.
|
||||
|
||||
## Current Kryon architecture
|
||||
|
||||
### Portable UI core
|
||||
|
||||
Kryon already keeps widget behavior, composition, layout, input routing, and
|
||||
paint production in Ziran:
|
||||
|
||||
- `src/ui/tree.zi:113` keeps committed and submitted tree state separate.
|
||||
- `src/ui/tree.zi:308` uses fixed label storage rather than per-label heap
|
||||
allocation.
|
||||
- `src/ui/tree_draw.zi:28` records frame input and damage.
|
||||
- `src/ui/paint_queue.zi:113` owns paint pools and snapshots.
|
||||
- `src/ui/paint_queue.zi:1571` retains draw data and damage information.
|
||||
|
||||
These are the right assets to preserve. They provide frame-boundary ownership
|
||||
and bounded storage, but they are not yet a measured CUI competitor.
|
||||
|
||||
### Web without WebGL
|
||||
|
||||
A maintained Canvas2D path already exists:
|
||||
|
||||
- `src/backend/page_core.zi:516` selects Canvas2D contexts.
|
||||
- `src/backend/canvas_frame.zi:114` retains frame damage and presentation work.
|
||||
- `src/backend/canvas_raster.zi:323` can raster triangles through Canvas2D.
|
||||
- `src/backend/page_texture.zi:338` has a non-WebGL texture fallback.
|
||||
- `src/backend/page_mesh.zi:138` contains the only observed WebGL-oriented image
|
||||
mesh path and can be made optional or removed for a Canvas2D-only gate.
|
||||
|
||||
This is stronger than CUI's documented live-web position because it does not
|
||||
require WebGL. It is not yet evidence of better speed: Canvas2D performance and
|
||||
its CPU/GPU backing depend on the browser and device.
|
||||
|
||||
### Desktop
|
||||
|
||||
The current desktop path combines:
|
||||
|
||||
- SDL window/events through `src/backend/Desktop/module.zi:1`,
|
||||
`src/backend/desktop_runtime.zi:1`, and `src/backend/desktop_loop.zi`.
|
||||
- Cairo rasterization and host text through `src/backend/cairo_raster.zi:43`.
|
||||
- SDL pixel presentation through `src/backend/pixmap_sdl.zi:1`.
|
||||
- The deterministic portable rasterizer in `src/backend/pixmap.zi`, including
|
||||
damage clipping, row parallelism, and caller-owned buffers.
|
||||
- Bundled-font raster text in `src/backend/pixmap_text.zi:6`, with fixed glyph
|
||||
and edge scratch arrays at `src/backend/pixmap_text.zi:29`.
|
||||
|
||||
Cairo currently provides convenient host FreeType/Pango shaping. Removing Cairo
|
||||
is possible only after a general text capability can preserve metrics, Unicode,
|
||||
bidi, ligatures, fallback faces, clipping, and IME caret behavior. The existing
|
||||
host contracts are `src/ui/font_metrics.zi:3` and `src/ui/raster_text.zi:6`.
|
||||
|
||||
### Android and raylib
|
||||
|
||||
Raylib is not merely one optional renderer on Android. It is structural:
|
||||
|
||||
- `ziran.toml:9` pins raylib as a source dependency.
|
||||
- `ziran.toml:280` defines the raylib renderer artifact and many codec/font
|
||||
outputs.
|
||||
- `src/backend/android_run.zi:6` documents raylib NativeActivity owning the
|
||||
window.
|
||||
- `src/backend/android_surface.zi:98` reads raylib `CORE` state.
|
||||
- `cmake/KryonAndroid.cmake:167` links `raylib`, Android, log, OpenSLES, EGL,
|
||||
and GLESv2 and wraps lifecycle, EGL, and asset file access.
|
||||
- The researched source has 156 direct raylib bindings across eight backend
|
||||
files, including `src/backend/android_run.zi`,
|
||||
`src/backend/android_surface.zi`, `src/backend/raylib_run.zi`,
|
||||
`src/backend/raylib_runtime.zi`, `src/backend/raylib_frame_render.zi`,
|
||||
`src/backend/bundle_raylib.zi`, `src/backend/audio_sink_raylib.zi`, and
|
||||
`src/backend/media_audio_raylib.zi`.
|
||||
|
||||
Complete removal requires replacing NativeActivity/window ownership,
|
||||
`ANativeWindow` presentation, lifecycle, EGL or software presentation, touch,
|
||||
key, IME, clipboard, asset access, fonts, image decode, audio, notifications,
|
||||
secondary windows where applicable, timing, error reporting, and tests. A
|
||||
draw-call substitution is insufficient.
|
||||
|
||||
### Styling
|
||||
|
||||
CSS remains separable:
|
||||
|
||||
- The CSS package parses a documented closed subset and installs values into
|
||||
Kryon's typed style table. It is whole-or-not-at-all at parse time.
|
||||
- Compiled style packs can populate the same typed table without the parser.
|
||||
- Package-owned files are under `kryonlabs/packages/css/src`; its parser,
|
||||
vocabulary, migration, and sheet code should stay optional.
|
||||
|
||||
The smallest dependency strategy is therefore compiled style packs in the core
|
||||
surface and the CSS parser as an optional package, not a runtime requirement.
|
||||
|
||||
### Existing `.zx` behavior
|
||||
|
||||
Kryon already has safe whole-app replacement:
|
||||
|
||||
- `tools/zx.zi:398` opens and prepares a replacement before switching.
|
||||
- `src/backend/bundle_watch.zi:1` keeps immutable bundles and rejects incomplete
|
||||
pointers.
|
||||
- `tests/zx_reload_test.py:38` verifies immutable hashes/sequences and rejects
|
||||
rollback.
|
||||
- Replacement is frame-boundary atomic, but the new module instance starts with
|
||||
fresh global state.
|
||||
|
||||
The hosted protocol is different from independently swappable components:
|
||||
`src/backend/widget_host.zi:1` exposes a fixed generated widget-call surface and
|
||||
`src/backend/widget_codec.zi:1` implements its bounded value codec. It does not
|
||||
provide independent component identity, version negotiation, state migration, or
|
||||
replacement.
|
||||
|
||||
## Ziran capabilities and missing general contracts
|
||||
|
||||
Verified current Ziran behavior in `/mnt/storage/Projects/ziranlang/ziran/docs/ZX.md`:
|
||||
|
||||
- Saved IR and bundle capabilities are verified. Foreign-call signatures are
|
||||
explicit, and native hosts can inspect and bind required capabilities
|
||||
(`docs/ZX.md:71`–`99`).
|
||||
- Handles are opaque and host-owned; mutable slices are copied back only after
|
||||
successful synchronous calls (`docs/ZX.md:106`–`118`).
|
||||
- Bundle instances retain their own globals (`docs/ZX.md:124`).
|
||||
- Partial modules can compose disjoint declarations, but composed library and
|
||||
add-on code execute with one independent global-state instance
|
||||
(`docs/ZX.md:173`).
|
||||
- Linux/Android native execution currently uses checked generated C plus a
|
||||
TinyCC cache (`docs/ZX.md:217`).
|
||||
- Browser linked code and the wasm tier have important one-instance and scalar
|
||||
subset restrictions (`docs/ZX.md:255`).
|
||||
|
||||
General upstream work required, with no Kryon widget names or UI special cases:
|
||||
|
||||
1. Stable module/component identity and semantic version metadata.
|
||||
2. Typed capability and ABI compatibility across replacement, including record
|
||||
and procedure revisions.
|
||||
3. Independent instance state for multiple components, not one global state per
|
||||
composed library/add-on.
|
||||
4. Explicit host/component ownership rules and opaque handle lifetime checks.
|
||||
5. State export, import, migration, rollback, and stale-reference prevention.
|
||||
6. Pause/resume or transactional replacement at a safe program boundary.
|
||||
7. Partial-module composition with declaration replacement that preserves
|
||||
unrelated declarations.
|
||||
8. Loader overhead instrumentation: verify, instantiate, initialize, migrate,
|
||||
resume, and first-frame timings.
|
||||
9. A production wasm/linking story that removes the current one-instance and
|
||||
scalar-subset barriers for multi-component UIs.
|
||||
10. Explicit dev-runtime/runtime split so TinyCC and compiler machinery are not
|
||||
shipped with a minimal production player.
|
||||
|
||||
Likely Ziran owners are `zir_bundle.c/h`, `zir_zx_host.c/h`,
|
||||
`zir_zx_native.c/h`, `zir_zx_wasm.c/h`, `std/bundle_host.zi`, and the existing
|
||||
bundle/ZX tests under `tests/`. Exact implementation files must be selected from
|
||||
a clean Ziran tree when work starts; this dirty research snapshot does not
|
||||
authorize edits there.
|
||||
|
||||
## Existing size evidence
|
||||
|
||||
The following files were inspected, not rebuilt or executed. They are existing,
|
||||
uncommitted outputs and are not performance evidence:
|
||||
|
||||
| Artifact | Raw bytes | gzip bytes | Interpretation |
|
||||
|---|---:|---:|---|
|
||||
| `build/bin/kryon` | 51,264 | 21,966 | Project tool only; not a complete app. |
|
||||
| `build/bin/zx` | 6,103,208 | 1,797,521 | Development/player runtime; compiler machinery makes size inference invalid. |
|
||||
| `build/zx-raylib/zx` | 13,477,224 | 4,539,453 | Raylib development player; not a minimal production target. |
|
||||
| Canvas player wasm | 2,790,458 | 1,076,379 | Current no-WebGL-capable web baseline, not minimized. |
|
||||
| Canvas player HTML | 956 | 589 | Wrapper only. |
|
||||
| Project options bundle | 106,986 | 24,891 | Options payload, not whole app. |
|
||||
| Hello bundle | 604,104 | 168,584 | Bundle bytes, not host/runtime size. |
|
||||
|
||||
At inspection, no relevant source file was newer than the latest artifacts
|
||||
checked. Freshness is not correctness or optimization. A future minimal target
|
||||
must report executable/wasm plus required assets and host wrapper as separate
|
||||
numbers under the pre-registered size definition.
|
||||
|
||||
## Bottleneck inventory
|
||||
|
||||
These are evidence-backed structural risks, not measured hotspots:
|
||||
|
||||
- **Reload state:** whole-app replacement reinitializes module globals, losing
|
||||
UI/application state and making component-level hot replacement impossible
|
||||
without the Ziran lifecycle work.
|
||||
- **Layout and tree work:** fixed storage prevents per-widget allocator churn,
|
||||
but overflow and reconciliation costs at large trees remain unmeasured.
|
||||
- **Paint snapshot/copy:** retained pools and damage are promising, but the
|
||||
number of copied commands, snapshots, and damage rectangles needs counters and
|
||||
traces before optimization.
|
||||
- **Raster:** `src/backend/pixmap.zi` has deterministic integer raster,
|
||||
parallel rows, and clipping. Full repaint and text-heavy damage costs need
|
||||
device measurements.
|
||||
- **Text:** fixed glyph caches are predictable but can thrash with many type
|
||||
faces, scripts, or subpixel positions. Cairo removal must not regress shaping
|
||||
correctness.
|
||||
- **Web present:** Canvas2D removes the WebGL requirement, but browser command
|
||||
conversion, `ImageData` uploads, compositing, and damage merging must be
|
||||
measured independently.
|
||||
- **Android present:** `src/backend/render_dispatch.zi:221` already overlaps
|
||||
render work, but raylib owns the surrounding event/present lifecycle. That
|
||||
overlap is not enough to assess input latency.
|
||||
- **Dependencies:** codecs, audio, optional GPU, and the CSS parser can all be
|
||||
decoupled. Font/image support and platform capability definitions are the
|
||||
actual functional tradeoffs.
|
||||
- **Development payload:** TinyCC/compiler-inclusive players dwarf the claimed
|
||||
production app target. Production and development outputs need separate size
|
||||
gates.
|
||||
|
||||
## Smallest coherent Ziran-first architecture
|
||||
|
||||
### 1. Shared portable core
|
||||
|
||||
Keep behavior, tree reconciliation, layout, input, accessibility, styling
|
||||
contracts, and paint production in `.zi`. The output to every presenter is a
|
||||
bounded retained display list plus damage and presentation metadata. Widget
|
||||
behavior never moves into a browser, Android, SDL, or Cairo host.
|
||||
|
||||
### 2. General host capability ABI
|
||||
|
||||
Define one typed, non-UI-specific platform surface:
|
||||
|
||||
- window lifecycle and visibility;
|
||||
- pointer, key, wheel, touch, text, IME, and composition events;
|
||||
- font metrics, shaping, caret measurement, and glyph rasterization;
|
||||
- image decode and cache lifetime;
|
||||
- clipboard, files, and notifications;
|
||||
- presentation timing, vsync where available, and frame pacing;
|
||||
- optional audio and secondary-window capabilities.
|
||||
|
||||
Presenters implement only drawing/presentation. Kryon consumes capabilities as
|
||||
ordinary Ziran imports; Ziran does not learn widget names.
|
||||
|
||||
### 3. Platform presenters
|
||||
|
||||
- **Web:** Canvas2D is the required path. Keep command translation and retained
|
||||
damage; make WebGL mesh generation optional and exclude it from the minimal
|
||||
gate. Use the deterministic pixmap renderer as a pixel oracle, and only add a
|
||||
shared `ImageData` presenter if Canvas2D measurements justify it.
|
||||
- **Desktop:** use the shared pixmap renderer and a small SDL window/event/present
|
||||
host initially. Remove Cairo only after the general text capability reaches
|
||||
parity. Direct Wayland/X11 can be a later measured decision, not a prerequisite.
|
||||
- **Android:** replace raylib with a thin NativeActivity/`ANativeWindow` host.
|
||||
Start with software presentation through the shared renderer; add EGL/GPU only
|
||||
behind the same presenter interface if measurements require it.
|
||||
|
||||
SDL is therefore optional but initially useful on desktop. Raylib and Cairo are
|
||||
removable. The CSS parser is optional. Codec dependencies become format-specific
|
||||
capabilities rather than global requirements.
|
||||
|
||||
### 4. `.zx` components
|
||||
|
||||
After the Ziran lifecycle work, a Kryon component is a small verified module with
|
||||
typed props/events, semantic identity/version, independent state, and a
|
||||
frame-boundary transaction. State belongs to the component or its declared host
|
||||
capability, never to a globally shared module slot. Whole-app reload remains the
|
||||
fallback during migration.
|
||||
|
||||
### 5. Self-hosting boundary
|
||||
|
||||
Self-hosting Ziran/Kryon is a long-term goal, not a prerequisite for this
|
||||
architecture and not a performance claim. The immediate system still uses the
|
||||
Ziran compiler for development and emits verified bundles or native code for
|
||||
production. A self-hosted compiler should be justified by workflow and dependency
|
||||
goals after minimal runtime and reload measurements exist.
|
||||
|
||||
## Removable versus essential
|
||||
|
||||
### Essential
|
||||
|
||||
- `src/ui/*`: retained tree, layout, input, widget behavior, accessibility, and
|
||||
style contracts.
|
||||
- `src/backend/pixmap*`: deterministic software raster, density, blend, image,
|
||||
and bundled text foundations.
|
||||
- `src/backend/canvas_frame.zi`, `canvas_raster.zi`, and the non-WebGL portions
|
||||
of `page_core.zi`/`page_texture.zi`.
|
||||
- General host capability definitions and platform event/lifecycle adapters.
|
||||
- Font metrics/shaping contracts and compiled style packs.
|
||||
- `tools/zx.zi` and `bundle_watch.zi` for verified reload, once generalized.
|
||||
|
||||
### Removable or optional
|
||||
|
||||
- All `src/backend/*raylib*` modules, `mk/raylib-library.mk`,
|
||||
`mk/zx-raylib.mk`, `cmake/KryonAndroid.cmake` raylib/EGL wrapping, and the
|
||||
`renderer-raylib` artifact after Android replacement lands.
|
||||
- `src/backend/cairo_raster.zi` after host text parity and desktop pixmap
|
||||
presentation are proven.
|
||||
- `src/backend/page_mesh.zi` and WebGL texture paths in the Canvas2D-only target.
|
||||
- CSS parser package; compiled style packs remain.
|
||||
- AVIF/WebP/AOM/Opus/audio/image dependencies when the corresponding optional
|
||||
capability is absent.
|
||||
- TinyCC/compiler-inclusive player components in production artifacts.
|
||||
- Legacy compatibility wrappers, if any are found during implementation; the
|
||||
owner accepts breaking changes.
|
||||
|
||||
## Staged implementation contracts
|
||||
|
||||
Each later stage depends on the earlier gate. Every build command must use the
|
||||
shared build queue. Visual or window tests must use a private display and must
|
||||
not touch the owner's live desktop.
|
||||
|
||||
### Stage A — baseline and capability audit
|
||||
|
||||
**Owner:** Kryon.
|
||||
**Files:** `src/backend/render_dispatch.zi`, desktop/pixmap/canvas/Android host
|
||||
files, `tests/host_frame_snapshot_test.*`, `tests/backend_render_benchmark_test.py`,
|
||||
`tests/gpui_render_benchmark_test.py`, and new benchmark manifest/trace fixtures
|
||||
under `tests/`.
|
||||
**API:** no public API change. Add counters and identical scene/oracle fixtures.
|
||||
**Done:** one command reports p50/p95/p99 and counts for composition, layout,
|
||||
paint, raster, present, damage, input queue latency, allocation, and peak memory
|
||||
on desktop headless; pixel output matches the oracle. Existing Canvas2D, pixmap,
|
||||
and Android build gates still pass.
|
||||
**Tests:** targeted snapshot, pixmap parity, canvas build, and Android build-only
|
||||
tests through `build-queue`; no device run in this stage.
|
||||
|
||||
### Stage B — general Ziran component lifecycle
|
||||
|
||||
**Owner:** Ziran first, then Kryon.
|
||||
**Ziran files:** `zir_bundle.c/h`, `zir_zx_host.c/h`, `zir_zx_native.c/h`,
|
||||
`zir_zx_wasm.c/h`, `std/bundle_host.zi`, and focused additions under
|
||||
`tests/bundle_*`, `tests/zx_*`, and `tests/spec/`.
|
||||
**Kryon files:** only after the Ziran API lands: `tools/zx.zi`,
|
||||
`src/backend/bundle_watch.zi`, `src/backend/widget_host.zi`,
|
||||
`src/backend/widget_codec.zi`, and reload tests.
|
||||
**API:** general module identity/version, typed capability compatibility,
|
||||
independent instances, state export/import/migration, safe stale-reference
|
||||
failure, and pause/resume or transactional replace. No Kryon widget special case.
|
||||
**Done:** Ziran tests prove two independent replacements concurrently, state
|
||||
migration success and rollback, ABI mismatch rejection, stale-reference rejection,
|
||||
and browser/native constraints. Kryon whole-app reload remains unchanged until
|
||||
this gate is green.
|
||||
**Tests:** Ziran bundle/ZX integration suite plus a Kryon two-component reload
|
||||
test that preserves unrelated component state and measures verify/instantiate/
|
||||
migrate/resume/first-frame separately.
|
||||
|
||||
### Stage C — desktop pixmap presenter and Cairo removal
|
||||
|
||||
**Owner:** Kryon.
|
||||
**Files:** `src/backend/pixmap.zi`, `pixmap_sdl.zi`, `pixmap_text.zi`,
|
||||
`cairo_raster.zi`, `desktop_runtime.zi`, `desktop_loop.zi`, font/text contracts,
|
||||
and `tests/pixmap_*`, `tests/ziran_desktop_*`, text/IME tests.
|
||||
**API:** desktop consumes the shared host capability ABI; public widget APIs do
|
||||
not change.
|
||||
**Done:** SDL window/event/present host uses only the shared pixmap renderer;
|
||||
Cairo and Pango are absent from the target link; text, clipping, IME, density,
|
||||
damage, and presentation tests pass on a private display.
|
||||
**Tests:** existing pixmap parity and desktop native tests, Unicode/bidi/
|
||||
ligature/fallback/caret tests, frame snapshot equality where deterministic, and
|
||||
Stage A benchmark on the same desktop hardware.
|
||||
|
||||
### Stage D — Android NativeActivity replacement and raylib removal
|
||||
|
||||
**Owner:** Kryon, with any generic platform capability fixed upstream in Ziran.
|
||||
**Files:** `src/backend/android_run.zi`, `android_surface.zi`,
|
||||
`android_touch.zi`, `android_text_editor.zi`, `android_clipboard.zi`,
|
||||
`android_fopen.zi`, `android_bundle_run.zi`, relevant notification/JNI modules,
|
||||
`templates/droid/src/android_glue.zi`, `cmake/KryonAndroid.cmake`, and Android
|
||||
tests under `tests/`.
|
||||
**API:** same host capability ABI; optional GPU presenter is not exposed as a
|
||||
widget API.
|
||||
**Done:** NativeActivity and `ANativeWindow` lifecycle, input/touch/IME,
|
||||
clipboard, assets, fonts/images, software presentation, and timing work without
|
||||
raylib. APK/link metadata no longer contains raylib or its license payload.
|
||||
**Tests:** first an integrated Android build-only gate; then an explicit private
|
||||
emulator or designated USB Moto device gate covering cold start, pause/resume,
|
||||
rotation, touch, IME, clipboard, damage, frame pacing, and Stage A metrics.
|
||||
Only after those pass remove all raylib files/artifacts and run the full gate.
|
||||
|
||||
### Stage E — Canvas2D-only web and dependency pruning
|
||||
|
||||
**Owner:** Kryon, plus upstream Ziran wasm work where needed.
|
||||
**Files:** `src/backend/page_core.zi`, `page_mesh.zi`, `page_texture.zi`,
|
||||
`canvas_frame.zi`, `canvas_raster.zi`, `ziran.toml`, CMake renderer artifact
|
||||
files, and `tests/zx_canvas_test.py`, `tests/renderer_artifact_test.py`,
|
||||
`tests/renderer_web_probe.zi`.
|
||||
**API:** Canvas2D is the supported baseline; WebGL remains optional at most.
|
||||
**Done:** minimal web artifact contains no WebGL API/symbol/reference, no Node
|
||||
tooling, and no dev compiler; Canvas2D damage and deterministic oracle tests
|
||||
pass. Production player, project bundle, assets, and wrapper are reported as
|
||||
separate sizes.
|
||||
**Tests:** artifact inspection, Canvas2D behavior in the existing non-live-desktop
|
||||
harness, wasm/browser tier tests from Ziran, and Stage A web benchmark on the
|
||||
chosen browser/device. Finally prune unused codecs/audio/legacy exports and rerun
|
||||
desktop, Android, and web gates.
|
||||
|
||||
## Apples-to-apples benchmark procedure
|
||||
|
||||
No comparative number may be published until this procedure is pre-registered
|
||||
and run.
|
||||
|
||||
1. **Define binaries exactly.** Compare complete runnable applications, not a
|
||||
library archive with a bundle or a development player. For each target report
|
||||
executable/wasm, required wrapper/JS, required assets/fonts, compressed
|
||||
transfer, installed APK size, and strip/LTO/optimization flags.
|
||||
2. **Match features and scenes.** Use only a common primitive scene set that both
|
||||
systems can express identically: fixed viewport/DPI, identical fonts and
|
||||
Unicode text, colors, images, widget geometry, scroll/input scripts, and frame
|
||||
count. Any unsupported feature removes that scene from both sides, not just
|
||||
the slower side. Separately report a full Kryon stress scene as Kryon-only.
|
||||
3. **Use identical hardware and environment.** Name computer model, OS/kernel,
|
||||
CPU/governor, memory, power state, browser version, Android device/API level,
|
||||
thermal state, battery/power connection, viewport scale, and background load.
|
||||
Never mix CUI's cloud x86-64 result with a local phone result.
|
||||
4. **Use a pre-registered order.** Match or exceed CUI's 30 warmup and 200
|
||||
measured frames, randomize input order deterministically, repeat enough runs
|
||||
for variance, discard no failures silently, and save raw traces.
|
||||
5. **Measure boundaries separately:** app input timestamp to event dispatch;
|
||||
composition/reconciliation; layout; paint/display-list production; raster;
|
||||
present/composite; end-to-end frame; reload verify/instantiate/migrate/
|
||||
resume/first-frame. Never compare CUI's frame-only metric with Kryon raster
|
||||
or present time.
|
||||
6. **Report distributions:** p50, p95, p99, min/max, standard deviation, failures,
|
||||
allocations, peak RSS, cache misses where available, CPU energy only if the
|
||||
device counter is trustworthy. Averages alone are insufficient.
|
||||
7. **Check correctness under load.** Use deterministic pixel oracles, input-state
|
||||
oracles, soak tests, randomized input, rotation/configuration changes on
|
||||
Android, and reload rollback. Performance of wrong pixels is invalid.
|
||||
8. **Run each platform on that platform.** Desktop C/CUI versus Kryon on desktop;
|
||||
browser Canvas2D Kryon on the selected browser/device; Android Kryon on a named
|
||||
device. CUI has no documented Android/no-WebGL target, so those are Kryon
|
||||
capability results rather than cross-system wins.
|
||||
9. **Publish limitations.** State compiler/toolchain versions, feature subset,
|
||||
unsupported scenes, and every deviation from CUI's published methodology.
|
||||
|
||||
## Current uncertainty
|
||||
|
||||
- No fresh performance benchmark was run; all existing timings are CUI's, not
|
||||
Kryon's.
|
||||
- No fresh build was run; artifact freshness does not prove current-source
|
||||
correctness.
|
||||
- The dirty Kryon/Ziran worktrees may change host tests and desktop behavior
|
||||
before implementation.
|
||||
- CUI's dependency and performance claims were verified against its primary
|
||||
docs/source, not rebuilt in this environment.
|
||||
- Android IME, clipboard, notification, audio, image, and multi-window scope
|
||||
needs a product decision before exact raylib replacement size can be predicted.
|
||||
- Canvas2D browser backing and phone thermal behavior are unknown until tested
|
||||
on named devices.
|
||||
- General component state migration semantics need an upstream Ziran design;
|
||||
no current API should be assumed stable.
|
||||
- The long-term self-hosting path is intentionally separate from the minimal
|
||||
runtime plan and has no size/performance evidence yet.
|
||||
|
||||
## Recommendation
|
||||
|
||||
Do not port CUI's renderer into Kryon and do not add UI-specific loader rules to
|
||||
Ziran. Preserve Kryon's retained tree, bounded paint pools, damage model, and
|
||||
deterministic pixmap renderer; make Canvas2D the required web presenter; keep SDL
|
||||
only as the initial desktop shell; replace raylib's Android ownership with a thin
|
||||
NativeActivity host; make Cairo and the CSS parser removable; and first fix the
|
||||
general Ziran module-instance/version/state lifecycle. Establish the benchmark
|
||||
and pixel oracle before changing hot paths. Only that sequence can credibly aim
|
||||
to exceed CUI on Android, no-WebGL web, desktop responsiveness, and hot-swappable
|
||||
Ziran components without making unsupported C-versus-Ziran claims.
|
||||
@@ -1,673 +0,0 @@
|
||||
# Kryon website CUI parity research
|
||||
|
||||
Status: research and redesign specification only. No implementation, local build,
|
||||
commit, push, release, or deployment was performed.
|
||||
|
||||
## Scope and conclusions
|
||||
|
||||
The owner's goal is a Kryonlabs website at least as good as
|
||||
[CUI](https://yappologistic.github.io/CUI/), with CUI-like default component
|
||||
appearance, then stronger customization and coverage. The owner explicitly does
|
||||
not require the website's component catalog to include a live-preview editor.
|
||||
|
||||
The true website owner is this repository, `kryonlabs/kryon`, not
|
||||
`kryonlabs/github`. The maintained website source is `docs/site/`; its build
|
||||
inputs include the gallery sources and site scripts. The Cloudflare Pages
|
||||
deployment defined by `.github/workflows/pages.yml` publishes the prepared
|
||||
`docs/site` tree for project `kryon` from `master` under `kryonlabs.com`; this
|
||||
is not a GitHub Pages deployment.
|
||||
|
||||
CUI looks stronger for six concrete reasons:
|
||||
|
||||
1. Its overview immediately proves the component system with visual examples.
|
||||
2. Its documentation is dense but readable: a small UI type scale, a separate
|
||||
long-form reading scale, narrow prose measure, and compact section spacing.
|
||||
3. Its surfaces are disciplined: neutral light and dark palettes, hairline
|
||||
borders, restrained radius and control scales, and shadows only on floating
|
||||
layers.
|
||||
4. Its catalog is an information system, not a demo list: category counts,
|
||||
search, honest summaries, APIs, options, scenes, guides, and showcases.
|
||||
5. Its navigation stays persistent and predictable while fitting both desktop
|
||||
documentation and mobile drawer patterns.
|
||||
6. Its component presentation is generated by the actual system, so the page is
|
||||
product proof rather than CSS mockups.
|
||||
|
||||
Kryon's present site is an accessible warm editorial brochure, but not a compact
|
||||
product documentation system. It uses oversized display type, a taller header,
|
||||
wider gutters, decorative card shadows, generic gallery notes, and a one-at-a-
|
||||
time live editor. Those choices make the product feel less systematic and less
|
||||
component-rich than CUI.
|
||||
|
||||
## Primary evidence
|
||||
|
||||
### CUI
|
||||
|
||||
- Live site: <https://yappologistic.github.io/CUI/>
|
||||
- Primary repository: <https://github.com/yappologistic/CUI>
|
||||
- Source branch: `master`
|
||||
- Relevant primary files:
|
||||
- `web/site/index.html`
|
||||
- `web/site/style.css`
|
||||
- `web/site/responsive.css`
|
||||
- `web/site/js/app.js`
|
||||
- `web/site/js/responsive.js`
|
||||
- `docs/design.md`
|
||||
- `docs/theming.md`
|
||||
- `docs/components.md`
|
||||
|
||||
The catalog data parsed from CUI's `catalog.js` contains:
|
||||
|
||||
- 14 categories.
|
||||
- 127 documented component entries.
|
||||
- 127 entries with documentation, API, and scene fields.
|
||||
- 111 entries with options.
|
||||
- 12 showcases.
|
||||
- 9 guides.
|
||||
|
||||
Guide coverage and section counts:
|
||||
|
||||
| Guide | Sections |
|
||||
|---|---:|
|
||||
| Getting started | 9 |
|
||||
| Layout | 12 |
|
||||
| Theming | 6 |
|
||||
| Icons | 3 |
|
||||
| Custom components | 6 |
|
||||
| Integration | 7 |
|
||||
| Rendering | 3 |
|
||||
| Performance and memory | 3 |
|
||||
| Design principles | 9 |
|
||||
|
||||
Category counts:
|
||||
|
||||
| Category | Entries |
|
||||
|---|---:|
|
||||
| Basics | 5 |
|
||||
| Actions | 12 |
|
||||
| Inputs | 14 |
|
||||
| Selection | 5 |
|
||||
| Pickers | 10 |
|
||||
| Navigation | 9 |
|
||||
| Overlays | 10 |
|
||||
| Feedback | 7 |
|
||||
| Data display | 21 |
|
||||
| Charts | 10 |
|
||||
| Planning | 5 |
|
||||
| Conversation/media | 6 |
|
||||
| Motion | 7 |
|
||||
| AI interfaces | 6 |
|
||||
|
||||
CUI's overview is persuasive because it leads with component proof and concrete
|
||||
claims: approximately 160 components, approximately 250 KB, under 0.25 ms per
|
||||
frame, Windows/macOS/Linux support, and zero dependencies. It then presents a
|
||||
short learning path, theming proof, design principles, and states that previews
|
||||
are drawn by CUI itself. Kryon must only publish equivalent metrics after a
|
||||
reproducible local benchmark exists.
|
||||
|
||||
### Kryon
|
||||
|
||||
Canonical repository and branch:
|
||||
|
||||
```text
|
||||
/mnt/storage/Projects/kryonlabs/kryon
|
||||
git@github.com:kryonlabs/kryon.git
|
||||
master
|
||||
```
|
||||
|
||||
Relevant website surfaces:
|
||||
|
||||
- `docs/site/index.html`
|
||||
- `docs/site/apps.html`
|
||||
- `docs/site/modules.html`
|
||||
- `docs/site/widgets.html`
|
||||
- `docs/site/docs.html`
|
||||
- `docs/site/getting-started.html`
|
||||
- `docs/site/renderers.html`
|
||||
- `docs/site/demo.html`
|
||||
- `docs/site/current.css`
|
||||
- `docs/site/current.js`
|
||||
- `docs/site/gallery.css`
|
||||
- `docs/site/gallery.js`
|
||||
- `docs/site/gallery-data.js`
|
||||
- `scripts/site-metadata.py`
|
||||
- `scripts/build-site.py`
|
||||
- `scripts/gallery.py`
|
||||
- `scripts/build-gallery.py`
|
||||
- `examples/gallery/modules.toml`
|
||||
- `examples/gallery/src/desktop.zi`
|
||||
- `tests/site_browser_test.py`
|
||||
- `.github/workflows/pages.yml`
|
||||
|
||||
Ownership evidence:
|
||||
|
||||
- `.github/workflows/pages.yml` is triggered by `docs/site/**`, gallery
|
||||
sources, Kryon source, manifests, site scripts, and site tests.
|
||||
- `scripts/build-site.py` invokes site metadata generation, the site demo build,
|
||||
the demo preview build, and gallery generation.
|
||||
- The Pages workflow deploys the prepared `docs/site` tree.
|
||||
- Canonical site URLs throughout the source use `https://kryonlabs.com/...`.
|
||||
|
||||
Maintained routes:
|
||||
|
||||
- `/`
|
||||
- `/apps`
|
||||
- `/modules`
|
||||
- `/widgets`
|
||||
- `/docs`
|
||||
- `/getting-started`
|
||||
- `/renderers`
|
||||
- `/demo`
|
||||
|
||||
Superseded routes include `/showcase`, `/live-examples`, `/api`, `/matrices`,
|
||||
`/language`, and eventually `/demo`. They may redirect, but the owner does not
|
||||
require parallel legacy implementations.
|
||||
|
||||
Current gallery generation has 64 scenes: 55 Kryon entries, 6 Plot entries, and
|
||||
3 DataViews entries. Most current notes are generic. The current page lacks
|
||||
CUI-level summaries, API names, options, keyboard behavior, related entries,
|
||||
and searchable card metadata. `docs/site/gallery.js` imports the live editor;
|
||||
the homepage embeds the mini demo. This directly conflicts with the owner's
|
||||
preference for a component catalog without live preview.
|
||||
|
||||
Existing static/private-capture foundations:
|
||||
|
||||
- `scripts/gallery.py` already generates `gallery-data.js`, staged `.zi`
|
||||
sources, and the catalog registry.
|
||||
- `examples/README.md` documents `KRYON_CATALOG_SCENE` and
|
||||
`KRYON_CAPTURE_PATH`.
|
||||
- `examples/gallery/src/desktop.zi` can render a selected scene and capture it.
|
||||
- `docs/site/assets/previews/README.md` documents real private Xvfb/headless
|
||||
Chromium captures and states that they are real implementations.
|
||||
- `tests/site_browser_test.py` is a Python private headless site test covering
|
||||
maintained pages, links, images, metadata, themes, focus, and 320–1366px
|
||||
layouts.
|
||||
|
||||
## CUI design language
|
||||
|
||||
### Typography
|
||||
|
||||
| Context | Font | Size and line height |
|
||||
|---|---|---|
|
||||
| Site UI/body | Inter 400 | 14px / 1.55 |
|
||||
| Long-form docs | Documentation body | 16px / 1.75 |
|
||||
| Prose measure | Long-form text | 76ch maximum |
|
||||
| General heading 1 | Geist 500 | 32px |
|
||||
| General heading 2 | Geist 500 | 22px |
|
||||
| General heading 3 | Geist 500 | 15px |
|
||||
| Home heading 1 | Geist 500 | 56px |
|
||||
|
||||
Kryon should use the CUI scale for the product site even if long-form guides use
|
||||
the larger reading scale. Manrope/Newsreader may remain as brand accents, but
|
||||
not at the current brochure scale.
|
||||
|
||||
### Layout and density
|
||||
|
||||
| Element | CUI value |
|
||||
|---|---:|
|
||||
| Topbar | 56px |
|
||||
| Persistent sidebar | 264px |
|
||||
| Standard docs maximum width | 880px |
|
||||
| Docs horizontal padding | 32–48px |
|
||||
| Bottom page padding | 112px |
|
||||
| Component grid | `repeat(auto-fill, minmax(230px, 1fr))` |
|
||||
| Component grid gap | 14px |
|
||||
| Card body padding | 12/14/14px |
|
||||
| Card title | 14px |
|
||||
| Card summary | 12.5px, two-line clamp |
|
||||
| Compact row padding | 9/8px |
|
||||
| Compact row text | 13–13.5px |
|
||||
|
||||
Card thumbnails are 16:9. Resting cards use hairline borders, radius 18, and no
|
||||
shadow. Compact list rows omit thumbnails and expose title, summary, and API
|
||||
columns.
|
||||
|
||||
Spacing follows a four-point grid:
|
||||
|
||||
- 4px micro steps.
|
||||
- 16px inside a group.
|
||||
- 24px between related regions.
|
||||
- 32–48px between major sections.
|
||||
|
||||
### Radius and controls
|
||||
|
||||
Radius scale:
|
||||
|
||||
| Surface | Radius |
|
||||
|---|---:|
|
||||
| Marks | 6px |
|
||||
| Rows/items | 8px |
|
||||
| Controls | 10px |
|
||||
| Panels | 14px |
|
||||
| Surfaces/dialogs | 18px |
|
||||
|
||||
Control heights:
|
||||
|
||||
- Small: 30px.
|
||||
- Medium: 36px.
|
||||
- Large: 44px.
|
||||
|
||||
These website densities must not be independent CSS: they need a shared semantic
|
||||
token contract with the actual Kryon widget theme. `src/ui/theme.zi` currently
|
||||
uses materially different values, including 4/12/28px radii and 32/40/48px
|
||||
controls.
|
||||
|
||||
### Color
|
||||
|
||||
Light:
|
||||
|
||||
| Token | Value |
|
||||
|---|---|
|
||||
| `base/bg/surface` | `#ffffff` |
|
||||
| `surface-muted` | `#f8f8f8` |
|
||||
| `surface-sunk/bezel` | `#f3f3f3` |
|
||||
| `foreground` | `#0b0b0b` |
|
||||
| `secondary` | `#585858` |
|
||||
| `muted` | `#767676` |
|
||||
| `border` | `#e3e3e3` |
|
||||
| `subtle-border` | `#f0f0f0` |
|
||||
| `strong-border` | `#949494` |
|
||||
| `focus` | `#1f7dcfe6` |
|
||||
| `success` | `#00774d` |
|
||||
| `warning` | `#9f6202` |
|
||||
| `danger` | `#c9302d` |
|
||||
|
||||
Dark:
|
||||
|
||||
| Token | Value |
|
||||
|---|---|
|
||||
| `base/bg` | `#121212` |
|
||||
| `surface` | `#181818` |
|
||||
| `surface-muted` | `#1f1f1f` |
|
||||
| `surface-sunk` | `#0e0e0e` |
|
||||
| `foreground` | `#f2f2f2` |
|
||||
| `secondary` | `#b4b4b4` |
|
||||
| `muted` | `#8c8c8c` |
|
||||
| `border` | `#2b2b2b` |
|
||||
| `subtle-border` | `#222222` |
|
||||
| `strong-border` | `#676767` |
|
||||
| `focus` | `#55adffe6` |
|
||||
|
||||
CUI accent pairs:
|
||||
|
||||
| Accent | Light | Dark |
|
||||
|---|---|---|
|
||||
| Neutral | `#353535` | `#bebebe` |
|
||||
| Violet | `#7747ff` | `#a78bff` |
|
||||
| Blue | `#0562ef` | `#6ba3ff` |
|
||||
| Green | `#00864b` | `#53dca6` |
|
||||
| Amber | `#f3ad20` | `#ffcb62` |
|
||||
| Orange | `#c25300` | `#ffad5e` |
|
||||
| Coral | `#d1403a` | `#ff9386` |
|
||||
| Rose | `#d23286` | `#ff8bc5` |
|
||||
|
||||
Primary CUI site actions are neutral rather than colorful. Kryon should retain
|
||||
one intentional green accent, preferably the CUI-compatible green pair above,
|
||||
while making neutral text, borders, and surfaces carry the interface.
|
||||
|
||||
Resting cards must use borders, not shadows. Only menus, popovers, dialogs,
|
||||
toasts, and other floating layers cast shadows.
|
||||
|
||||
### Motion
|
||||
|
||||
| Purpose | Duration |
|
||||
|---|---:|
|
||||
| Highlight | 100ms |
|
||||
| Hover | 140ms |
|
||||
| State | 180ms |
|
||||
| Enter | 260ms |
|
||||
| Exit | 160ms |
|
||||
|
||||
Easing: `cubic-bezier(0.22, 1, 0.36, 1)`.
|
||||
|
||||
`prefers-reduced-motion: reduce` must disable drawer/scrim and decorative
|
||||
movement.
|
||||
|
||||
### Responsive behavior
|
||||
|
||||
At widths below 860px:
|
||||
|
||||
- Sidebar becomes a drawer.
|
||||
- Drawer width is `min(300px, 86vw)`.
|
||||
- It closes on navigation, scrim press, Escape, or resizing back above 860px.
|
||||
- Scrim and drawer animation are removed under reduced motion.
|
||||
|
||||
At widths below 640px:
|
||||
|
||||
- Page margins are 16–20px.
|
||||
- Stage padding is reduced.
|
||||
- Filter chips scroll horizontally without creating page overflow.
|
||||
- Option-table rows stack.
|
||||
- Component cards remain full-width with 16:9 thumbnails.
|
||||
|
||||
No maintained route may have horizontal overflow from 320 through 1366px.
|
||||
|
||||
## Kryon redesign specification
|
||||
|
||||
### Information architecture
|
||||
|
||||
Primary navigation:
|
||||
|
||||
1. Overview: `/`
|
||||
2. Guide: `/getting-started`
|
||||
3. Components: `/widgets`
|
||||
4. Showcase: `/showcase`
|
||||
5. Apps: `/apps`
|
||||
6. Docs: `/docs`
|
||||
|
||||
This is the smallest stable-URL route. Add `components.html` only as an alias
|
||||
or redirect to `widgets.html`; do not fork duplicate content. Redirect `/demo`
|
||||
to the component catalog after migration and remove the superseded live-editor
|
||||
implementation and assets once no maintained route references them.
|
||||
|
||||
Guide sections:
|
||||
|
||||
1. Getting started.
|
||||
2. Layout and composition.
|
||||
3. Theming and customization.
|
||||
4. Component/API patterns.
|
||||
5. Platform integration and renderers.
|
||||
6. Design principles.
|
||||
7. Performance and status.
|
||||
|
||||
Existing `/modules` and `/renderers` should remain reachable from Docs rather
|
||||
than competing as primary navigation. Superseded URLs may redirect, but no
|
||||
parallel legacy page or editor should remain merely to preserve an old route.
|
||||
|
||||
### Homepage anatomy
|
||||
|
||||
1. Compact product header, not an oversized editorial hero.
|
||||
2. Above the fold: a neutral panel containing several real static component
|
||||
thumbnails, proving breadth immediately.
|
||||
3. Fact strip with only reproducible Kryon facts: component count, supported
|
||||
platforms, renderer families, dependency policy, and package/runtime size if
|
||||
measured. Do not copy CUI performance claims.
|
||||
4. Six-step learning path matching the primary guide sections.
|
||||
5. Theme/customization proof using real generated light/dark component images.
|
||||
6. Compact module coverage summary for Kryon UI, Plot, and DataViews.
|
||||
7. Design principles and integration preview.
|
||||
|
||||
No homepage live editor or compiler iframe.
|
||||
|
||||
### Components page anatomy
|
||||
|
||||
Top:
|
||||
|
||||
- Title and one-sentence purpose.
|
||||
- Text search.
|
||||
- Category/module chips with counts.
|
||||
- Grid/list toggle.
|
||||
- Light/dark preview toggle where both assets exist.
|
||||
|
||||
Grid card:
|
||||
|
||||
- 16:9 generated component image.
|
||||
- Component title.
|
||||
- Module badge.
|
||||
- Category badge.
|
||||
- Two-line honest summary.
|
||||
- API names when available.
|
||||
- Source link.
|
||||
- Keyboard note when meaningful.
|
||||
|
||||
Compact row:
|
||||
|
||||
- No thumbnail.
|
||||
- Title and summary.
|
||||
- Module/category.
|
||||
- APIs/options.
|
||||
- Source and detail actions.
|
||||
|
||||
Detail presentation:
|
||||
|
||||
- Larger light/dark generated images, initially on the same page rather than
|
||||
creating per-component routes.
|
||||
- Source and source module.
|
||||
- Purpose and composition notes.
|
||||
- Public API names.
|
||||
- Options and defaults.
|
||||
- Keyboard and accessibility behavior.
|
||||
- Related components.
|
||||
- No parallel interactive editor route.
|
||||
|
||||
The catalog must not import `live-editor.js` or embed a compiler/preview iframe.
|
||||
|
||||
### Better-than-CUI customization page
|
||||
|
||||
Use real generated Ziran scenes, not CSS mockups, to demonstrate:
|
||||
|
||||
- Light/dark base themes.
|
||||
- One intentional accent and semantic status colors.
|
||||
- Radius scale changes.
|
||||
- Compact/normal/dense layouts.
|
||||
- Font family and scale changes.
|
||||
- Border and focus-ring overrides.
|
||||
- Component-specific token overrides.
|
||||
- State preservation examples once hot-swappable `.zx` component contracts are
|
||||
implemented.
|
||||
|
||||
Theme documentation should expose one semantic token table and show the same
|
||||
token names in website and widget source. Avoid presenting arbitrary CSS as if
|
||||
the native widget system supports it.
|
||||
|
||||
### Static demo strategy
|
||||
|
||||
Preferred architecture:
|
||||
|
||||
1. Gallery sources remain the canonical component presentation definitions.
|
||||
2. A Ziran catalog-shot host renders a selected scene without catalog chrome.
|
||||
3. Private Xvfb/headless captures emit deterministic WebP or PNG images for
|
||||
each entry and requested theme.
|
||||
4. Images are written under `docs/site/assets/components/`.
|
||||
5. `gallery-data.js` records image paths, summaries, APIs, options, keyboard
|
||||
behavior, module, category, source path, and alt text.
|
||||
6. `docs/site/gallery.js` renders static cards from that manifest.
|
||||
|
||||
Captures must use a private display, scrub inherited display/auth/session
|
||||
variables, and touch only their own processes. The owner did not request visible
|
||||
desktop capture or mouse control.
|
||||
|
||||
## Smallest implementation architecture
|
||||
|
||||
The work should remain source-driven in this repository and avoid a new client
|
||||
framework or Node dependency.
|
||||
|
||||
### Contract 1: enrich component metadata
|
||||
|
||||
Owning files:
|
||||
|
||||
- `scripts/gallery.py`
|
||||
- `examples/gallery/modules.toml`
|
||||
- `examples/gallery/src/**`
|
||||
- `docs/site/gallery-data.js` (generated)
|
||||
|
||||
Requirements:
|
||||
|
||||
- Preserve every current gallery scene.
|
||||
- Add category, module, summary, API, options, keyboard note, source path,
|
||||
related entries, and alt text to the manifest.
|
||||
- Keep generated output reproducible and stable.
|
||||
- Make every metadata field optional at first, but require summary and image.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- Generated manifest count matches scene count.
|
||||
- Every entry has category, module, nonempty summary, source path, alt text,
|
||||
and at least one image.
|
||||
- No generated source path or image is missing from the output tree.
|
||||
|
||||
### Contract 2: generate static component shots
|
||||
|
||||
Owning files:
|
||||
|
||||
- `scripts/gallery.py`
|
||||
- `scripts/build-gallery.py`
|
||||
- `scripts/build-site.py`
|
||||
- `examples/gallery/src/catalog-shot.zi` (new)
|
||||
- `examples/gallery/src/desktop.zi`
|
||||
- `examples/gallery/ziran.toml`
|
||||
- `docs/site/assets/components/**` (generated)
|
||||
|
||||
Requirements:
|
||||
|
||||
- Create a Ziran scene host dedicated to catalog shots.
|
||||
- Select scene and theme through the existing private capture mechanism.
|
||||
- Emit at least light images for every entry; add dark images when a scene is
|
||||
theme-aware.
|
||||
- Prefer stable filenames based on module and scene identity rather than hashes.
|
||||
- Keep generated assets ignored if the Pages workflow regenerates them, or
|
||||
committed only if the current site deployment requires checked-in assets.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- Every manifest image exists.
|
||||
- Every output image is referenced exactly once by the manifest.
|
||||
- Generated manifest paths resolve on the local static site.
|
||||
- Capture runs only under private Xvfb/headless conditions.
|
||||
- Existing public live demo assets are not required by the catalog page.
|
||||
|
||||
### Contract 3: redesign global shell and tokens
|
||||
|
||||
Owning files:
|
||||
|
||||
- `docs/site/current.css`
|
||||
- `docs/site/current.js`
|
||||
- all maintained HTML pages
|
||||
|
||||
Requirements:
|
||||
|
||||
- Consume a generated CSS custom-property bridge from one canonical Ziran token
|
||||
contract; do not hand-maintain a second website-only token definition.
|
||||
- Implement CUI typography, spacing, radius, control heights, border, focus,
|
||||
motion, and shadow rules.
|
||||
- Reduce topbar to 56px and persistent desktop sidebar to 264px.
|
||||
- Cap docs prose at 76ch and normal content at 880px.
|
||||
- Use 860px as mobile navigation breakpoint and 640px as compact-content
|
||||
breakpoint.
|
||||
- Preserve the current accessibility contrast or improve it.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- Every maintained page consumes the generated bridge from the canonical Ziran
|
||||
contract.
|
||||
- No page-specific duplicate color/type system remains.
|
||||
- Keyboard focus remains visible in both themes.
|
||||
- Reduced-motion test disables drawer/scrim and decorative animation.
|
||||
|
||||
### Contract 4: build the static component catalog
|
||||
|
||||
Owning files:
|
||||
|
||||
- `docs/site/widgets.html`
|
||||
- `docs/site/gallery.css`
|
||||
- `docs/site/gallery.js`
|
||||
- `docs/site/gallery-data.js` (generated)
|
||||
|
||||
Requirements:
|
||||
|
||||
- Replace one-at-a-time live preview with searchable card/list catalog.
|
||||
- Render category/module counts.
|
||||
- Implement text search, grid/list toggle, and theme asset toggle.
|
||||
- Keep filters as horizontal scroll chips under 640px.
|
||||
- Provide no compiler, editable source pane, or preview iframe.
|
||||
- Link every entry to its staged source.
|
||||
- Implement page search, filtering, and view switching in site-shell code only;
|
||||
component appearance and product behavior remain generated from Ziran scenes.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- `widgets.html` does not import `live-editor.js`.
|
||||
- Every component image has descriptive alt text.
|
||||
- Search and filters match title, summary, category, module, API, and options.
|
||||
- Grid/list switch preserves current filters and focus.
|
||||
- Cards and rows are fully keyboard reachable.
|
||||
|
||||
### Contract 5: rewrite maintained pages
|
||||
|
||||
Owning files:
|
||||
|
||||
- `docs/site/index.html`
|
||||
- `docs/site/apps.html`
|
||||
- `docs/site/modules.html`
|
||||
- `docs/site/docs.html`
|
||||
- `docs/site/getting-started.html`
|
||||
- `docs/site/renderers.html`
|
||||
- `docs/site/showcase.html`
|
||||
- `docs/site/current.js`
|
||||
|
||||
Requirements:
|
||||
|
||||
- Apply the primary navigation and guide structure.
|
||||
- Replace brochure hero with compact product proof.
|
||||
- Remove homepage live-demo promotion.
|
||||
- Redirect superseded editor routes and remove `demo.html`, `live-editor.js`,
|
||||
demo compiler assets, and related build outputs after references are migrated.
|
||||
- Keep Apps, Modules, Showcase, Docs, and Renderers content rather than
|
||||
deleting useful material.
|
||||
- Ensure superseded URLs redirect without retaining parallel implementations.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- Primary navigation is identical on every maintained page.
|
||||
- No maintained page promotes live preview as the main path.
|
||||
- All maintained links and redirects pass the Python site test.
|
||||
- Page metadata remains unique and valid.
|
||||
|
||||
### Contract 6: private headless validation
|
||||
|
||||
Owning files:
|
||||
|
||||
- `tests/site_browser_test.py`
|
||||
- `scripts/build-site.py`
|
||||
- `.github/workflows/pages.yml`
|
||||
|
||||
Requirements:
|
||||
|
||||
- Extend the existing Python private headless browser test instead of adding
|
||||
Node/npm/npx.
|
||||
- Validate catalog metadata and assets.
|
||||
- Validate links, metadata, focus, theme switching, filters, grid/list, mobile
|
||||
drawer, Escape/scrim behavior, reduced motion, and no horizontal overflow.
|
||||
- Assert no live-editor import, demo compiler asset, or superseded editor route
|
||||
remains reachable from maintained pages.
|
||||
- Keep capture helpers outside the browser test unless an explicit integration
|
||||
test is added.
|
||||
|
||||
Acceptance:
|
||||
|
||||
- Gallery generation succeeds.
|
||||
- Site build succeeds.
|
||||
- Every gallery entry has complete manifest data and assets.
|
||||
- Components page contains no live-editor import or compiler iframe.
|
||||
- Maintained pages pass link/metadata/theme/focus checks.
|
||||
- Layouts pass 320, 390, 768, 1024, and 1366px checks without overflow.
|
||||
- Drawer closes on navigation, scrim, Escape, and crossing back above 860px.
|
||||
- Reduced motion removes decorative animation.
|
||||
|
||||
## Shared theme requirements for component/runtime work
|
||||
|
||||
The website redesign cannot be completed as isolated CSS. The parent's
|
||||
component and renderer work should treat these as shared requirements:
|
||||
|
||||
- Actual widget defaults and website demos must consume one canonical Ziran
|
||||
semantic token contract; generated CSS custom properties are a bridge, not a
|
||||
second source of truth.
|
||||
- Adopt CUI-compatible neutral light/dark surfaces.
|
||||
- Use one intentional Kryon accent.
|
||||
- Ensure control edges meet non-text contrast requirements.
|
||||
- Move toward radius 6/8/10/14/18 and control heights 30/36/44.
|
||||
- Use a four-point spacing grid.
|
||||
- Preserve accessible focus and reduced-motion behavior.
|
||||
- Keep component presentations small, portable `.zx` definitions so a future
|
||||
hot-swap path and static catalog can use the same source.
|
||||
- Do not hardcode a separate website-only component appearance or move widget
|
||||
behavior into handwritten website JavaScript.
|
||||
|
||||
These requirements do not themselves define renderer internals, component APIs,
|
||||
or hot-swap implementation; those remain with the sibling research tasks.
|
||||
|
||||
## Verification status
|
||||
|
||||
This document records research only. No files were built, no tests were run, no
|
||||
deployment was checked, and no repository state was cleaned or reverted.
|
||||
Implementation acceptance checks above are the local requirements for the later
|
||||
implementation task.
|
||||
@@ -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.
|
||||
@@ -1,38 +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="">Web DOM</td><td class=""><code>src/backend/dom_run.zi</code></td><td class="">Headless Chromium checks incremental updates, native Unicode editing, reorder focus, CSS styles, responsive sizing and browser accessibility</td><td class="part">🧪 hybrid host with opt-in native CSS layout for document widgets</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 and semantic DOM project tests run in <code>make test</code> and launch only private headless Chromium.</p>
|
||||
</body></html>
|
||||
@@ -1,33 +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 |
|
||||
| Web DOM | `src/backend/dom_run.zi` | Headless Chromium checks incremental updates, native Unicode editing, reorder focus, CSS styles, responsive sizing and browser accessibility | 🧪 hybrid host with opt-in native CSS layout for document widgets |
|
||||
| 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 and semantic DOM
|
||||
project tests run in `make test` and launch only private headless Chromium.
|
||||
@@ -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 `TextFieldInput`.
|
||||
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.
|
||||
@@ -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.
|
||||
@@ -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/`.
|
||||
@@ -1,597 +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` | semantic page: headings, paragraphs, links, a button | `web` (DOM), `canvas`, `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 `Kryon` for the small core
|
||||
surface or `Widgets` for all core widgets:
|
||||
|
||||
```zi
|
||||
using UI :: #import "Widgets";
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
text: TextProps
|
||||
text.text = "Hello, Kryon"
|
||||
Text(session, text)
|
||||
return 0
|
||||
}
|
||||
```
|
||||
|
||||
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
|
||||
imports such as `kryon/Widgets` work in Canvas and DOM 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`, `dom`, `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) |
|
||||
| `dom` | semantic DOM page | Emscripten with Asyncify; see [DOM host](dom.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. `ziran run --vm app.zx` selects
|
||||
portable execution. `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 `ImageProps.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 and DOM 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.
|
||||
`make dom-project-test` builds a real semantic DOM project and checks its
|
||||
mounted tags and attributes in another private headless Chromium process. 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.
|
||||
@@ -1,19 +0,0 @@
|
||||
# Theme customization
|
||||
|
||||
Kryon uses one modern CUI-inspired 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.
|
||||
@@ -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.
|
||||
@@ -1,16 +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 semantic DOM profile adds a real browser document layer over that
|
||||
Canvas raster host; see [Semantic DOM browser host](dom.md). Both browser
|
||||
profiles generate 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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -1,133 +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.
|
||||
|
||||
Applications that handle Escape as navigation can call `CanvasSetExitKey(0)`
|
||||
through `kryon/Canvas` to disable the host's default Escape-to-exit behavior.
|
||||
Other keys remain available through `CanvasPressedKey`.
|
||||
|
||||
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.
|
||||
@@ -1,65 +0,0 @@
|
||||
# Browser document host
|
||||
|
||||
Select `backend = "dom"` in a Kryon profile. The host builds Ziran through
|
||||
Emscripten and reconciles successful committed trees into browser elements.
|
||||
Retained generation IDs preserve element identity. Unchanged text, attributes,
|
||||
styles and order stay untouched; reordering uses `moveBefore` where available
|
||||
and restores focus/selection when falling back to insertion. Nested absolute
|
||||
positions are relative to their parents. Container labels use ARIA instead
|
||||
of replacing their children with text.
|
||||
|
||||
Native button activation, editor focus, input, selection and browser IME
|
||||
return to Kryon's shared session/widget logic. Applications still own values,
|
||||
apply ordinary returned edits, and retain cursor/anchor state. Browser UTF-16
|
||||
selection offsets convert to grapheme-aligned UTF-8 byte offsets. Multiple
|
||||
inputs to one editor coalesce before a frame; another editor waits for the
|
||||
session's current request. Read-only and disabled controls use native
|
||||
properties. Password values travel through a private presentation callback,
|
||||
never the semantic tree or capture snapshots; password copy/cut is blocked.
|
||||
Native edit requests are bounded to 64 KiB.
|
||||
|
||||
The default remains an absolutely positioned, transparent semantic overlay
|
||||
on Canvas2D. Canvas applications compiled through `canvas_app_run.zi` can
|
||||
select the equivalent entry `dom_app_run.zi`; that host keeps the AppContext
|
||||
lifecycle, storage, input and Canvas frame, then reconciles the additional
|
||||
semantic elements. Consequently canvas-heavy apps normally use slightly more
|
||||
memory and CPU in DOM mode, not less. For document widgets, call this before
|
||||
the first frame:
|
||||
|
||||
```ziran
|
||||
Dom :: #import "kryon/Dom";
|
||||
// css is an application-owned CSS string, optionally exported by the CSS package.
|
||||
Dom.UseDocumentLayout(css)
|
||||
```
|
||||
|
||||
This hides the owned canvas and presents native elements in normal browser
|
||||
flow. CSS supplies responsive widths, layout and appearance. Supported kinds
|
||||
are Screen, Text, Paragraph, Page, Section, Link, Image, Button, TextField,
|
||||
TextArea, Group, Column, Row, Stack and Grid. Other kinds reject the frame so
|
||||
canvas-only content cannot disappear silently. Browser layout geometry is
|
||||
owned by CSS; the core retained geometry remains the application's submitted
|
||||
layout. Prefer native identity activation over canvas hit tests in this mode.
|
||||
|
||||
DOM elements carry `data-kryon-widget` names and hashed `data-kryon-class`
|
||||
values for supported styled text and controls. The separate CSS package
|
||||
exports `ExportCSS(source, path, environment, output)` and `StyleClass(name)`.
|
||||
The exporter scopes selectors to `#kryon-dom-root`, maps widget, class and
|
||||
state selectors to those attributes, and writes rules in Kryon's priority
|
||||
order so the browser ranks them as native hosts do. Environment media queries
|
||||
are decided for the given environment; viewport queries stay for the browser.
|
||||
Check its `ok` result before attaching output. Unresolved imports and
|
||||
attribute selectors fail explicitly; see the CSS package for its subset.
|
||||
|
||||
The DOM root and private presentation handles are removed at close. A
|
||||
text/semantics-only test snapshot omits secure values. Verification runs a
|
||||
new headless Chromium process with desktop variables removed:
|
||||
|
||||
```sh
|
||||
python3 tests/dom_project_test.py
|
||||
KRYON_DOM_INTERACTION=1 python3 tests/dom_project_test.py
|
||||
```
|
||||
|
||||
The second check uses the CSS package and verifies no DOM mutations during unchanged
|
||||
frames, Unicode editing, identity/focus/caret after reorder, button routing,
|
||||
responsive sizing, password redaction and a native editor in the browser's
|
||||
accessibility tree. Neither test uses the owner's desktop or browser profile.
|
||||
@@ -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: NavigationBarProps
|
||||
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 := NavigationBar(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,
|
||||
`ImageProps`, 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
|
||||
`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.
|
||||
@@ -1,5 +0,0 @@
|
||||
/*
|
||||
Cache-Control: public, max-age=0, must-revalidate
|
||||
|
||||
/showcase-data.json
|
||||
Cache-Control: public, max-age=0, must-revalidate
|
||||
@@ -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>© 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 +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>
|
||||
|
Before Width: | Height: | Size: 3.7 KiB |
@@ -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 development surfaces for the widget, chart and data-view packages."><link rel="stylesheet" href="current.css?v=129720eec9d272d5"></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=129720eec9d272d5"></script></body></html>
|
||||
@@ -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`.
|
||||
@@ -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 |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |