Commit Graph
1485 Commits
Author SHA1 Message Date
waozi 2ebfaccb6e Read Android window insets without Java, and load fonts from the APK
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.
2026-10-13 02:18:30 -03:00
waozi bbd4ccf498 Measure a canvas application's room in the browser with browser_viewport
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.
2026-10-11 11:18:52 -03:00
waozi 27f3f1e05c Pick documents and scan QR codes on Android with android_picker
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.
2026-10-11 11:11:50 -03:00
waozi c00ef4c224 Read browser WebSocket events with page_socket
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.
2026-10-11 10:58:48 -03:00
waozi 86254a5453 Hand finished files to the user with file_export
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.
2026-10-11 10:55:05 -03:00
waozi 5d41090b1c Edit Android text through the input method's snapshots
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.
2026-10-11 10:40:19 -03:00
waozi 9d7a3093b1 Download files to disk with file_download
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.
2026-10-11 10:24:50 -03:00
waozi 5dfe1c6717 Describe Kryon as fully on Ziran in its docs and site
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.
2026-10-11 10:12:56 -03:00
waozi bd021734d7 Write the secondary window probe in Ziran
Kryon has no C sources; the probe that drives real SDL windows beside a
raylib window is now a Ziran program with the same checks.
2026-10-11 10:12:31 -03:00
waozi c2755c9d14 Add HTTP transfers and raylib secondary windows
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.
2026-10-11 10:11:17 -03:00
waozi 20e8ee86ad Add file picking, window close, idle time, notification and raylib log services
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.
2026-10-11 10:00:36 -03:00
waozi afd7e8198f Open links with open_uri and describe the whole Android app glue
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.
2026-10-11 09:45:56 -03:00
waozi fe37943f21 Run a bundle inside a host application with hosted_app
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.
2026-10-11 00:23:19 -03:00
waozi 53ea0fdb87 Host the widgets of a bundle that runs inside another application
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.
2026-10-11 00:04:50 -03:00
waozi ab3e1c7e02 Expose owned-window focus to native and portable applications 2026-10-09 10:03:54 -03:00
waozi 214415b321 Add a first-class Android target as an installable APK
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.
2026-10-08 03:18:27 -03:00
waozi 1919b54eb2 Add compact navigation docks with anchored actions and card dragging 2026-10-08 02:10:40 -03:00
waozi 30d956b04d Improve text, accessibility, replay, profiling and browser presentation 2026-10-07 18:41:41 -03:00
waozi 2ac6b21b03 Present rasterized SDL frames without redundant GPU surfaces 2026-10-06 10:00:09 -03:00
waozi 9b7ee6274b Retain TextArea wrapping for stable font metrics 2026-10-06 01:52:35 -03:00
waozi 23f3bc199a Enable default native raster workers through Ziran
Keep ordered paint barriers, serial portable output and aliased image semantics. Verify native and portable pixels, worker lifecycle and package-host defaults.
2026-10-06 01:22:17 -03:00
waozi f89d8969c5 Rename Terminal references for the KryonLabs repository move 2026-10-04 17:53:16 -03:00
waozi 78d5465265 Use current application terminology on retired reference pages 2026-10-04 02:41:19 -03:00
waozi 2c360aebdd Export, render and install downloadable Zib applications 2026-10-04 01:54:15 -03:00
waozi 896741ae39 Render missing Raylib glyphs with system font fallback 2026-10-03 05:34:03 -03:00
waozi 491ccbb08b Update TaijiOS application repository links 2026-10-02 13:11:28 -03:00
waozi a735dab6cc Show a loading message while the website preview compiles 2026-10-01 14:10:58 -03:00
waozi f00dbb2d4f Restore preview themes and fix the test toolchain harnesses 2026-10-01 13:39:56 -03:00
waozi f0abca9f39 Integrate the live editor into the Kryon homepage 2026-10-01 12:17:27 -03:00
waozi 9aa0353567 Add editable Kryon source and live browser preview 2026-10-01 11:58:42 -03:00
waozi 0658dd16c9 Fix overlapping slider and progress in the canvas demo 2026-10-01 00:46:20 -03:00
waozi bf8e298a30 Load PNG assets in the native Plan 9 image provider 2026-09-30 23:23:08 -03:00
waozi 639aae9964 Theme embedded widget demo for Waozi 2026-09-30 22:05:30 -03:00
waozi 8b67588dcb Avoid waiting twice in externally scheduled canvas frames 2026-09-30 21:12:13 -03:00
waozi b2d09cf78f Add a live Ziran widget demo to Kryon Labs 2026-09-30 20:53:17 -03:00
waozi fa1fc25911 Let application profiles choose their own Ziran host 2026-09-30 17:27:50 -03:00
waozi c3f944650b Name the package kryon, in lower case
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.
2026-09-30 15:35:16 -03:00
waozi b9ba4a864b Draw text in Kryon's font on every host
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.
2026-09-30 15:30:25 -03:00
waozi 7242c7e8e4 Render frames headlessly, identically on every Ziran target
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).
2026-09-30 14:58:22 -03:00
waozi 488d840f01 Add the kryon command and four project templates
`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.
2026-09-30 14:23:46 -03:00
waozi 84fa544090 Name the shared key codes and map them to text field input
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.
2026-09-30 01:31:27 -03:00
waozi 2a00c369d1 Move KSS into its own package
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.
2026-09-29 20:56:26 -03:00
waozi 8e4e277dd8 Let a project link one static archive from its own tree
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.
2026-09-29 20:49:28 -03:00
waozi 0525f80226 Build browser profiles through the package map
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.
2026-09-29 20:36:20 -03:00
waozi 2e74cf287b Move Plot, the data views, and Syntax into their own packages
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.
2026-09-29 19:47:57 -03:00
waozi 6690be9d3c Run the desktop hosts, sanitizers, and seeded KSS fuzzing in CI
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.
2026-09-29 17:18:03 -03:00
waozi 0357a06bc4 Use Ziran packages for raylib source 2026-09-28 19:14:59 -03:00
waozi 60e3dbd1f7 Define TextFormat and TraceLog in Ziran; remove the C shim 2026-09-28 18:16:26 -03:00
waozi 17838eca6d Zoom every window the raylib runner opens
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.
2026-09-28 18:08:34 -03:00
waozi 69742c610c Remove all handwritten JavaScript: canvas hosts now run in Ziran on the web bridge
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.
2026-09-28 18:03:25 -03:00