A plain NativeActivity has no Java to report its insets, so Kryon laid
such an app out under the navigation bar: Werkzeug's bottom buttons sat
behind the 3-button bar on a Moto e6 play. PollAndroidWindowInsets reads
the system bar, keyboard and cutout insets from the decor view's root
insets through JNI a few times a second (getInsetsIgnoringVisibility on
Android 11 and newer, stable insets before) and stops once Java reports
them. The JNI table gains GetFieldID, GetIntField and
CallStaticIntMethodA; tests/ziran_android_jni_test.sh checks them
against the NDK on every ABI.
A font file packed in the APK did not load by its relative path, because
raylib's FileExists cannot see APK assets although its file loader can.
Android 9 and older cannot name a system font, so such an app fell back
to raylib's pixel font. The typeface loader now also accepts a path the
file loader can read.
The visual viewport, narrowed to the canvas frame, the canvas's parent or
the canvas, measured in Zi through the web bridge; and a debounce that
resizes only once a new size has held for two frames with no pointer
down. Moved from Inner Breeze's JavaScript and web window code so raylib
web builds share it.
The activity's document picker and camera scanner answer later, so a
numbered request is opened and polled each frame; each answer is taken
once by the request that asked, and a newer request replaces one still
waiting. Moved from Inner Breeze so other Android applications get it.
page_socket opens a WebSocket through the web bridge and queues its text
messages for polling each frame. Binary or oversized messages, a full
queue, or no open after ten seconds close the socket, and URLs with
credentials are refused; a token travels as the second subprotocol. A
headless-browser test runs against a small local WebSocket server. It
replaces Inner Breeze's JavaScript socket.
ExportBytes and ExportFile download a file in the browser, through a
blob link built on the web bridge, or open Android's share sheet through
the activity's shareFile. A headless-browser test checks the downloaded
names and bytes. It comes from Inner Breeze's data and account export.
fseek and ftell take a C long, 32 bits on wasm and 32-bit Android, so
file_export and file_download now declare it as isize.
android_text_editor lets an activity's input connection edit the focused
field as UTF-8 snapshots through TextRequest, so composition, autocorrect
and suggestions work. Stale revisions, a replaced field's late edits and
edits after blur are refused. android_device's text input calls it, and
falls back to code points when the activity has no input connection. It
comes from Inner Breeze.
The Android test host no longer replaces dlsym, which AddressSanitizer
needs at startup; the real one finds no raylib state either, so the
Android device tests now also pass under the sanitizers.
file_download fetches a large file, such as music or an app package, to a
path while the application keeps drawing; the file appears there only
once complete. Linux and BSD desktops run curl as a child process, the
browser streams fetch's body into the page's file system through the web
bridge, and Android asks the activity, whose callbacks the application
binds to FileDownloadNative*. Native and headless-browser tests download
from a local server. It comes from Inner Breeze.
Build instructions install the ziran command and use the toolchain locked
in ziran.lock instead of a ../ziran sibling checkout. Downstream apps pick up
Kryon changes through ziran.lock. Terminal owns OSC 52 and bracketed paste.
The website no longer calls the migration underway, and its status page
lists the Android host, Zib desktop apps and opt-in DOM CSS layout.
The obsolete files (shell.nix, .ini themes, old site images, the duplicate
API redirect) were removed in 827eae3d, which picked up these staged
deletions.
http_transfer runs HTTP requests while the application keeps drawing:
curl on a detached worker thread on desktops, the activity's transport on
Android, and fetch through the web bridge in the browser. A cancelled
transfer never writes into the caller's buffer, answers that do not fit
fail instead of arriving cut, and only http and https URLs are accepted.
Native and headless-browser tests run against a local server.
raylib_secondary_window gives a raylib application on SDL up to three
extra windows, each drawing its own Kryon tree into a render texture that
is copied to the window, so the main OpenGL context stays current. Its
probe runs on a private Xvfb display.
Both come from Inner Breeze.
These come from Inner Breeze so any Kryon application can use them:
- file_picker: zenity on Linux and BSD, Windows' common dialog, and the
browser's file chooser through the web bridge, which copies the chosen
file into the page's file system. A browser test answers the chooser in
headless Chromium; a fake zenity checks the arguments natively.
- window_close: close requests for the application's own SDL or Win32
window.
- idle_time: session idle time from Mutter or the freedesktop screen saver
over D-Bus, and whether the session is Wayland.
- notification_desktop: the notification host for Linux and BSD through
notify-send.
- raylib_trace: raylib's log to the console or logcat with routine notes
dropped, or to a log file for Windows applications without a console.
open_uri opens a URI with the platform's handler: the desktop opener as a
child process, Windows' shell, Plan 9's plumber, an Android ACTION_VIEW
intent or a new browser tab through the web bridge. It moves here from
Inner Breeze so any Kryon application can open links.
android_jni's NativeAndroidApp now carries every field of the glue's
android_app, including the command pipe, and AndroidInternalDataPath
returns the app's files folder. A test checks the layouts against the NDK
headers for all four Android ABIs.
Applications that run another .zib in their window each opened the
bundle, checked its capabilities, bound them, limited its steps and kept a
working instance through restarts. hosted_app does that once:
HostedAppStart asks the host about every capability and binds them to one
HostCall with field names matched, HostedAppRun runs under a step limit and
marks a trap as failed, HostedAppRestart closes the old instance only once
the new one passes the host's handshake, and HostedAppAsset finds a packed
asset by its exact path.
An application that runs a .zib inside its own window answered each
widget's HostedHost call with its own codec and dispatcher. Kryon now owns
that host side next to the bundle side: widget_host draws a bundle's widgets
in the frame's session, refuses calls from another frame, foreign records,
texture handles and assets its host's callback rejects, and closes scrolls
the bundle leaves open. WidgetHostSupports lists the calls it answers,
including Toggle.
widget_codec is generated from Kryon's widget records by
scripts/generate-widget-codecs.py, whose --uses option lets an application
generate codecs for its own records on top of Kryon's. hosted_values holds
the shared helpers: fields match by name, so a bundle and its host may be
built against different layouts.
An android profile now builds a real Android application from the same
sources as the desktop: the kryon tool scaffolds a droid/ Gradle project
beside the application on the first build and assembles a debug APK with
the NDK. The canonical host (android_run) drives the session over
raylib's NativeActivity backend with the shared viewport policies; a
generated NativeActivity reports insets, cutouts, IME state, density,
dark mode and orientation through JNI natives written in Ziran, forwards
soft-keyboard text through the session-owned input queue, and an
unconsumed back key finishes the activity. Generation runs the whole Zi
graph through ziran ir --project so application module names may repeat
Kryon module names.
The package called itself Kryon while `ziran add kryonlabs/kryon`, the
repository, the kryon command, and import paths such as kryon/Widgets are
lower case, and applications were split between [dependencies.Kryon] and
[dependencies.kryon]. The package, templates, docs, messages, and tests now
use kryon: `[dependencies.kryon]`, `[tool.kryon]`, `tool = "kryon"`, and
`ziran tool kryon`. Ziran matches a package by name without case, so
[dependencies.Kryon] keeps working, but its [tool.X] table must use the
same spelling. The core module keeps its name, Kryon.
The desktop and libdraw hosts never chose a font, so Cairo drew text in the
system's default sans (Noto Sans here), while raylib and the browser hosts
used Kryon's Liberation Sans and the pixmap host bitmap glyphs. Text
differed in face, width, and line breaks from host to host.
- The Cairo hosts load assets/fonts/LiberationSans-Regular.ttf through
FreeType (KRYON_FONT_PATH, which `kryon run` sets, else the system's
copy, else fontconfig by name) and lay glyphs out at their unhinted widths
with gray anti-aliasing, as a browser does.
- The pixmap host rasterizes Liberation Sans outlines itself: contours with
implied on-curve points, quadratics flattened in 1/256 pixel, non-zero
winding coverage from five sub-scanlines with exact spans, all integer.
It places every glyph where Cairo does, and every Ziran target still
prints the same bytes. tools/outline_font.zi, run as Python, extracts the
outlines of 207 Latin glyphs (`make pixmap-font`); Terminus is gone.
libdraw finds plan9port without a fixed sibling path: the installed one
$PLAN9 names, or, when a project adds plan9port as a source package, one
Kryon builds once in its build directory; without either it says how to
add it. The kryon tool now builds its Ziran toolchain only when it is
missing, as ziran builds a pinned one, instead of remaking it on every run.
The pixmap backend paints a frame into a 960 x 600 pixel buffer with integer
arithmetic -- anti-aliased rounded fills and outlines from 4 x 4 samples,
Bresenham lines, Terminus Font bitmap text, image placeholders -- and prints
it as a PPM image. Every template gains a `shot` profile, so
`kryon run shot > frame.ppm` takes a screenshot without a display.
Because the raster has no floating point and no platform library, every
target prints the same bytes. `make pixmap-parity-test` builds each template
and example from one saved IR for C, C++, Go, Rust, Python, and the portable
runner, requires all six images to equal C's, and writes
build/pixmap-parity/grid.png. All seven programs match on all six targets.
tools/image_tools.zi, built for Python with zi2py, compares PPM images (pixel
count, largest channel delta, bounding box, red diff image), writes PNG, and
lays out labeled contact sheets. tools/pixmap_glyphs.zi, also run as Python,
turns the Terminus console fonts into src/backend/pixmap_font.zi
(`make pixmap-font`); the glyphs are OFL-licensed (licenses/Terminus-OFL.txt).
`kryon new hello` starts a Kryon application and `kryon run` runs it.
Outside `ziran tool Kryon`, the kryon command is a front door to ziran:
new and init are `ziran new`/`ziran init` with Kryon's templates, run,
build, check, and profiles are `ziran tool Kryon ...`, and install is
`ziran install`, so every project runs the Kryon its lock pins whatever
kryon is installed. `make install-user` installs it.
Templates, listed under [templates] in ziran.toml:
- app: a counter with buttons, a step slider, and progress (default)
- tui: a keyboard-driven task list for the terminal
- pages: Home, Library, and Settings behind tabs, sharing state
- web: a semantic page (headings, paragraphs, links) for the DOM host
Each template sets `tool = "Kryon"`, so `ziran run` works too, and lays
out rows in pixels in a window and in cells on the terminal host, so one
Frame serves every profile. `kryon init --template tui` adds a template to
an existing package without replacing its own entry; `[tool.Kryon] entry`
names the window's module.
Also: `kryon run desktop` takes the profile positionally, `kryon profiles`
lists profiles and marks the default, run asks for a profile only on a
terminal, `check` defines PLATFORM_WEB for browser profiles as `build`
does, and the static archive test finds Ziran in the org layout.
Hosts now agree on key codes, so Kryon names them (KeyEnter, KeyBackspace,
KeyLeft, ...) next to the modifier bits. TypedTextTake collects a frame's
typed codepoints as UTF-8, and TextFieldInputFor turns a key, modifiers, and
typed text into a focused TextField's input, which apps each wrote by hand.
Style sheet parsing, formatting, the style packs, and their tests now
live in kryonlabs/kss, which depends on Kryon. Kryon keeps the rule
table and style resolution, so an app that builds its rules in code no
longer carries a parser; apps that read .kss text add the KSS package
and import kss/Kss or kss/SystemStyle.
A profile's static_archive names a project-relative .a file that Kryon
adds as a build dependency and linker input. It rejects absolute paths,
paths or symlinks that leave the project, non-regular files, and browser
profiles, so reproducible builds never pick up a system library.
Canvas and DOM builds now check and save the app with `ziran ir
--project`, like native builds, so an app's Git dependencies and
package-qualified imports such as Kryon/Widgets work on the web too.
Browser routing is exported as PageRoute for apps that read or push
the page route.
PlotWidget now lives in kryonlabs/plot, TableView and TreeView in
kryonlabs/data-views, and the Ziran, C, and Make tokenizer in
ziranlang/syntax, which no longer depends on Kryon. Apps add them with
`ziran add URL` and import plot/Plot, data_views/TableView, or
syntax/Syntax.
Kryon exports the building blocks those packages draw with (session,
tree, surface, paint_queue, style, style_sheet, widget_kind, and the
rest), so a widget package imports kryon/NAME instead of reaching into
Kryon's source directories. The API guide describes writing one.
CI ran only `make test`, so the desktop, raylib, and libdraw hosts that
the feature matrix calls supported were never checked automatically.
A new job installs SDL, Cairo, Mesa, and the X tools, builds plan9port
once (cached), and runs the three project tests, each on its own private
Xvfb display with DISPLAY, WAYLAND_DISPLAY, and XAUTHORITY removed.
`make sanitize-test` repeats the behavior tests with every C and C++
program they build compiled under AddressSanitizer and
UndefinedBehaviorSanitizer, through $CC/$CXX wrappers; CI runs it in a
parallel job. The main job also fuzzes KSS with the run number as seed,
so each run adds sheets, and keeps a failing sheet as an artifact.
The runner now feeds the wheel and modifiers through zoom each frame, keeps
the Ctrl wheel and the zoom shortcut keys from the application, and draws
at the resulting factor: the modelview is scaled after BeginDrawing so the
clip code, which reads that matrix to place scissors, stays correct; the
viewport and pointer are reported in scaled space so layout reflows to the
smaller viewport; and fonts are baked at the size they reach the screen.
KRYON_ZOOM sets the starting factor. The Zoom and DPI modules are exported
for applications with their own frame loop.
The raylib project test checks a capture at 200% and a real Ctrl plus wheel
on a private display.
The canvas window, drawing, textures, fonts, input, files, clipboard, drop and gamepad hosts are Zi modules (page_*.zi) calling the browser through std/web.zi. Kryon links only Ziran's generic ziran_web.js and a small C varargs shim. The JS budget test becomes a zero-JS boundary test.