Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f123e8ba3e | ||
|
|
bde4614ede | ||
|
|
1b290f19aa | ||
|
|
9ca2e6731b | ||
|
|
77184e46c5 | ||
|
|
7db0aef222 | ||
|
|
c10a6025bc | ||
|
|
17de1e4bfc | ||
|
|
ce0d49e633 | ||
|
|
c23c628597 | ||
|
|
d6750c36f2 | ||
|
|
baa0e60768 | ||
|
|
6425728b02 | ||
|
|
b45cc52456 | ||
|
|
631f15e715 | ||
|
|
3982886e04 | ||
|
|
3c09a1ecd7 | ||
|
|
ec72e936cd | ||
|
|
7491afa4c0 | ||
|
|
cd7bf21f38 | ||
|
|
24ff9e710a | ||
|
|
4e7513041e | ||
|
|
80fa9a73ac | ||
|
|
5d836703e9 | ||
|
|
7742251bb4 | ||
|
|
e9017b29d0 | ||
|
|
7cae309044 | ||
|
|
d549f3edbe | ||
|
|
928cf64d7b | ||
|
|
8b127a0911 | ||
|
|
640b4e3dac | ||
|
|
860ea80793 | ||
|
|
caa900714f | ||
|
|
158fd91d5a | ||
|
|
74eb8fbb43 | ||
|
|
cc731751ac | ||
|
|
32fce42d4f | ||
|
|
9401f34f66 | ||
|
|
3744b2a401 | ||
|
|
245605c359 | ||
|
|
ac209b9ea7 | ||
|
|
9c80f79110 | ||
|
|
d00b148f21 | ||
|
|
eeeeb10c06 | ||
|
|
4e5de9fef1 | ||
|
|
f4cd71a580 | ||
|
|
28424a846d | ||
|
|
3461b49b86 | ||
|
|
069f4c6c26 | ||
|
|
0dea8bc28b | ||
|
|
1b8e50bc5b | ||
|
|
a3df0f3acc | ||
|
|
cbbeb1fd54 | ||
|
|
9b551b591d | ||
|
|
83c24cdba6 | ||
|
|
15c3a22e43 | ||
|
|
389bf25e17 | ||
|
|
1ecc01791a | ||
|
|
b223f2c1cc | ||
|
|
2b7023eb8e | ||
|
|
9c49ec1d12 | ||
|
|
3d82bf36f2 | ||
|
|
4108c80a6b | ||
|
|
eda083bd73 | ||
|
|
c5c1122ae2 | ||
|
|
277b31162f | ||
|
|
0fbdc93884 | ||
|
|
cad98ae6a4 | ||
|
|
ba0d3950d3 | ||
|
|
44bd2bd667 | ||
|
|
681bfb85f9 | ||
|
|
3cd79f2c67 | ||
|
|
8a4e6f05cc | ||
|
|
67e436293f | ||
|
|
0dcd71cc54 | ||
|
|
c96178aae8 | ||
|
|
07d74f6dae | ||
|
|
4daa24b78c | ||
|
|
0e66e40ac3 | ||
|
|
311bcb362f | ||
|
|
0411e4bb8e | ||
|
|
c8a068e343 | ||
|
|
5f9d675daa | ||
|
|
7baf863221 | ||
|
|
0678895719 | ||
|
|
0cf2c54b50 | ||
|
|
9e5c5c2d6e | ||
|
|
92a86b9f25 | ||
|
|
1be70904a3 | ||
|
|
797d7317c3 | ||
|
|
c80e022fe8 | ||
|
|
9e4af21b6d | ||
|
|
fdedbdc392 | ||
|
|
4757cb3e0b | ||
|
|
718572978d | ||
|
|
3ac259c4c2 | ||
|
|
b08079641f | ||
|
|
302939233e | ||
|
|
bd693c1ea9 | ||
|
|
6a509e300c | ||
|
|
ff07bddbec | ||
|
|
681fd26ddf | ||
|
|
b154a5faec | ||
|
|
271113fda8 | ||
|
|
2d80834675 | ||
|
|
73ff84637a | ||
|
|
090a52fd82 | ||
|
|
602b4a8467 |
No files matched your search
@@ -151,7 +151,7 @@ jobs:
|
||||
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
|
||||
x11-xserver-utils python3-gi python3-gi-cairo python3-cairo python3-pil python3-xlib ffmpeg gir1.2-gtk-3.0 gir1.2-atspi-2.0
|
||||
libglib2.0-dev libpango1.0-dev at-spi2-core dbus-x11 gstreamer1.0-plugins-base
|
||||
gstreamer1.0-plugins-good gstreamer1.0-libav cmake nasm meson ninja-build libwebpdemux2 libopus-dev
|
||||
|
||||
@@ -175,6 +175,21 @@ jobs:
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
# The pay-per-import test and the gallery build these examples as
|
||||
# applications of this checkout, as ziran.local.toml does locally.
|
||||
- name: Build the in-tree examples from this checkout
|
||||
if: matrix.shard == 'hosts' || matrix.shard == 'site'
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import os, subprocess
|
||||
from pathlib import Path
|
||||
ziran = Path(os.environ['ZIRAN_ROOT'])
|
||||
settings = f'[overrides]\nkryon = "{Path.cwd()}"\nziran = "{ziran}"\n'
|
||||
for project in ('examples/box', 'examples/button', 'examples/image', 'examples/textfield', 'examples/gallery'):
|
||||
(Path(project) / 'ziran.local.toml').write_text(settings)
|
||||
subprocess.run([str(ziran / 'build/bin/ziran'), 'lock'], cwd=project, check=True)
|
||||
PY
|
||||
|
||||
- name: Keep Google libraries in the gplay edition
|
||||
run: python3 scripts/check-google-free.py --source .
|
||||
|
||||
@@ -232,12 +247,6 @@ jobs:
|
||||
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
|
||||
@@ -248,7 +257,7 @@ jobs:
|
||||
export PATH="$ZIRAN_ROOT/build/bin:$PATH"
|
||||
make site
|
||||
python3 tests/gallery_modules_test.py
|
||||
make site-gallery-test
|
||||
make site-browser-test
|
||||
|
||||
- name: Show how much the compile cache saved
|
||||
if: always()
|
||||
@@ -333,7 +342,7 @@ jobs:
|
||||
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
|
||||
libgl1-mesa-dri libx11-dev libxt-dev libxext-dev libxtst-dev libfontconfig1-dev libfreetype-dev
|
||||
libxkbcommon-x11-0
|
||||
fonts-dejavu-core fonts-wqy-zenhei xvfb xdotool x11-apps x11-utils imagemagick xfwm4
|
||||
dbus-x11 cmake nasm meson ninja-build libwebpdemux2 libopus-dev
|
||||
|
||||
@@ -78,12 +78,15 @@ jobs:
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
import shutil, subprocess
|
||||
import json, shutil, subprocess
|
||||
site = Path('docs/site')
|
||||
output = Path('build/scratch/website-deploy')
|
||||
paths = {Path(p) for p in subprocess.check_output(['git', 'ls-files', '-z', '--', str(site)]).decode().split('\0') if p}
|
||||
paths.add(site / 'gallery-data.js')
|
||||
paths.update((site / 'gallery-sources').rglob('*.zi'))
|
||||
# The build numbers runtime assets; stage every one it lists, since
|
||||
# a newly bundled asset is not tracked yet.
|
||||
paths.update(site / name for _, name in json.loads((site / 'runtime/assets.json').read_text()))
|
||||
for source in paths:
|
||||
destination = output / source.relative_to(site)
|
||||
destination.parent.mkdir(parents=True, exist_ok=True)
|
||||
@@ -152,12 +155,23 @@ jobs:
|
||||
- name: Test the Canvas website
|
||||
env:
|
||||
CHROMIUM: google-chrome
|
||||
# Chrome creates Unix sockets below TMPDIR; keep them clear of the
|
||||
# runner's deeply nested checkout path.
|
||||
KRYON_TEST_RUNTIME: ${{ runner.temp }}
|
||||
run: |
|
||||
export PATH="$GITHUB_WORKSPACE/ziranlang/ziran/build/bin:$PATH"
|
||||
export ZIRAN_ROOT="$GITHUB_WORKSPACE/ziranlang/ziran"
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
YUE_DESKTOP_RECOVERY=0 python3 tests/site_browser_test.py
|
||||
|
||||
- name: Save browser startup diagnostics
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: website-browser-log
|
||||
path: kryonlabs/kryon/build/scratch/site-browser/profile/chromium.log
|
||||
if-no-files-found: ignore
|
||||
|
||||
deploy-production:
|
||||
name: Deploy Kryon Labs
|
||||
needs: verify
|
||||
|
||||
@@ -59,8 +59,19 @@ 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
|
||||
Nothing is imported by default. A program carries only the code for what it
|
||||
imports and uses. A bare window carries the window, its events and
|
||||
presenting; import a frame and you get a frame, import a rectangle and you get
|
||||
a rectangle. Optional features arrive through their import or first use, never
|
||||
through runtime flags. Shared code reaches an optional part through a small
|
||||
slot module (such as `frame_driver`, `image_lookup`, `text_editing` and
|
||||
`scroll_sampling`) that the part's own module fills from its initializer or
|
||||
first use; shared code never imports the part itself. Make generated code
|
||||
smaller by cutting what isn't
|
||||
needed, never by merging files (owner, 2026-11-15).
|
||||
|
||||
One widget concept has one public implementation. `Text.Draw(Text.Props)` and
|
||||
`Image.Draw(Image.Props)` are the intended text and image widget surfaces. Do not
|
||||
add parallel wrappers or expose raw texture draw calls as app widget APIs.
|
||||
|
||||
## Testing and desktop safety
|
||||
|
||||
@@ -40,13 +40,13 @@ KRYON_UI_PATHS := $(foreach directory,$(sort $(shell find src/ui -type d)),--mod
|
||||
ZIRAN_STD_PATH := --module-path $(ZIRAN_DIR)/std $(KRYON_UI_PATHS)
|
||||
KRYON_DIR := $(CURDIR)
|
||||
include mk/zx-player.mk
|
||||
ZIRAN_SOURCES := $(wildcard $(ZIRAN_DIR)/cmd/zir*/*.c \
|
||||
$(ZIRAN_DIR)/cmd/zir*/*.h $(ZIRAN_DIR)/include/*.h \
|
||||
ZIRAN_SOURCES := $(wildcard $(ZIRAN_DIR)/cmd/zir*/*.c $(ZIRAN_DIR)/cmd/zi2*/*.c $(ZIRAN_DIR)/cmd/zx2*/*.c \
|
||||
$(ZIRAN_DIR)/cmd/zir*/*.h $(ZIRAN_DIR)/cmd/zi2*/*.h $(ZIRAN_DIR)/cmd/zx2*/*.h $(ZIRAN_DIR)/include/*.h \
|
||||
$(ZIRAN_DIR)/scripts/* $(ZIRAN_DIR)/std/*.zi $(ZIRAN_DIR)/Makefile)
|
||||
|
||||
SOURCE := $(addprefix src/ui/,$(shell cat src/ui/modules.txt))
|
||||
|
||||
.PHONY: all backends-check check laws test test-focus ziran-test header-check source-check docs-check public-surface-check clean project-toolchain project-test templates-test pixmap-parity-test pixmap-font pixmap-emoji install-user dom-project-test host-keys-test
|
||||
.PHONY: all backends-check check laws test test-focus ziran-test header-check source-check docs-check public-surface-check clean project-toolchain project-test templates-test pixmap-parity-test pixmap-font pixmap-emoji install-user host-keys-test
|
||||
all: source-check $(BUILD_DIR)/libkryon.a backends-check
|
||||
|
||||
# Project command. Its implementation and platform integration are Ziran.
|
||||
@@ -112,6 +112,31 @@ ziran-test: project-toolchain
|
||||
# fetch the same package at the same time, and offline ones find none. A
|
||||
# pinned toolchain this builds uses the plain compilers, not instrumented ones.
|
||||
.PHONY: behavior-tests
|
||||
test: markdown-editor-test
|
||||
|
||||
.PHONY: markdown-editor-test
|
||||
MARKDOWN_TEST_BINDINGS = \
|
||||
--bind kryon/font_metrics:MeasureGlyphWidth=ziran_widget_noop_host:MeasureGlyphWidth \
|
||||
--bind kryon/font_metrics:MeasureGlyphLineHeight=ziran_widget_noop_host:MeasureGlyphLineHeight \
|
||||
--bind kryon/raster_text:RasterText=ziran_widget_noop_host:RasterText \
|
||||
--bind kryon/raster_text:RasterTextClipped=ziran_widget_noop_host:RasterTextClipped \
|
||||
--bind kryon/raster_text:RasterTextRotated=ziran_mesh_noop_host:RasterTextRotated \
|
||||
--bind kryon/raster_shape:RasterRoundedRectangle=ziran_widget_noop_host:RasterRoundedRectangle \
|
||||
--bind kryon/raster_shape:RasterRoundedRectangleOutline=ziran_widget_noop_host:RasterRoundedRectangleOutline \
|
||||
--bind kryon/raster:RasterLine=ziran_widget_noop_host:RasterLine \
|
||||
--bind kryon/paint_queue:RasterImage=ziran_widget_noop_host:RasterImage \
|
||||
--bind kryon/image_raster:ImageWidth=ziran_widget_noop_host:ImageWidth \
|
||||
--bind kryon/image_raster:ImageHeight=ziran_widget_noop_host:ImageHeight \
|
||||
--bind kryon/system_clipboard:SystemClipboardOpenHost=system_clipboard_host:SystemClipboardOpenHost \
|
||||
--bind kryon/system_clipboard:SystemClipboardByteHost=system_clipboard_host:SystemClipboardByteHost \
|
||||
--bind kryon/system_clipboard:SystemClipboardWriteHost=system_clipboard_host:SystemClipboardWriteHost
|
||||
markdown-editor-test:
|
||||
ziran build --project --module-path tests $(MARKDOWN_TEST_BINDINGS) --target=c --root tests --entry markdown_editor_behavior:Main --exe -o build/markdown-editor tests/markdown_editor_behavior.zi
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER HARMONY_DESKTOP_RECOVERY=0 build/markdown-editor/markdown_editor_behavior
|
||||
ziran bundle --project --module-path tests $(MARKDOWN_TEST_BINDINGS) --root tests --entry markdown_editor_behavior:Main -o build/markdown-editor/editor.zx tests/markdown_editor_behavior.zi
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER HARMONY_DESKTOP_RECOVERY=0 ziran run build/markdown-editor/editor.zx
|
||||
|
||||
|
||||
behavior-tests:
|
||||
@env -u CC -u CXX "$(abspath $(ZIRAN_BUILD_DIR))/bin/ziran" fetch
|
||||
@ZIRAN_BIN="$(abspath $(ZIRAN_BUILD_DIR))/bin/ziran" \
|
||||
@@ -122,7 +147,11 @@ behavior-tests:
|
||||
# Run one behavior area without regenerating every UI module and target.
|
||||
test-focus:
|
||||
@test -n "$(TEST)" || { echo 'usage: make test-focus TEST=link_widget' >&2; exit 2; }
|
||||
ifeq ($(TEST),markdown_editor_behavior)
|
||||
@$(MAKE) --no-print-directory markdown-editor-test
|
||||
else
|
||||
@$(MAKE) --no-print-directory ziran-test TEST="$(TEST)" TEST_JOBS="$(TEST_JOBS)"
|
||||
endif
|
||||
|
||||
header-check:
|
||||
sh tools/check-zi-header-free.sh
|
||||
@@ -185,6 +214,16 @@ zx-test: build/bin/kryon zx-player
|
||||
|
||||
test: zx-test zx-reload-test
|
||||
|
||||
# window.zi's bundle runs as native code in the desktop player's window on a
|
||||
# private Xvfb, through `ziran run` and a private host registry.
|
||||
.PHONY: zx-window-test
|
||||
zx-window-test: zx-player
|
||||
@rm -rf build/test/zx-window
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
|
||||
ZIRAN_BIN="$(abspath $(ZIRAN_BIN))" "$(ZIRAN_BIN)" run --target=c tests/zx_window_test.zi -- \
|
||||
"$(abspath build/test/zx-window)" "$(abspath $(PLAYER))"
|
||||
test: zx-window-test
|
||||
|
||||
.PHONY: zx-services-test zx-hosted-test zx-headless-test
|
||||
zx-headless-test: zx-raylib
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
@@ -289,7 +328,6 @@ docs-check:
|
||||
python3 scripts/feature-matrix-html.py --check
|
||||
|
||||
public-surface-check: canvas-hosted-import-test $(BUILD_DIR)/ziran-toolchain.stamp
|
||||
$(ZIRAN_BIN) ir --project --root src/ui -o $(BUILD_DIR)/public/core src/ui/Kryon/module.zi
|
||||
python3 tests/public_surface_test.py
|
||||
|
||||
.PHONY: canvas-hosted-import-test
|
||||
@@ -301,11 +339,11 @@ check: all ziran-test header-check docs-check project-test public-surface-check
|
||||
|
||||
# CI runs make test as parallel jobs on separate machines. The hosts shard takes
|
||||
# every test target not named here, so a new one cannot miss CI.
|
||||
CI_SHARD_ZX := renderer-consumer-test zx-test zx-reload-test zx-services-test zx-hosted-test \
|
||||
zx-headless-test native-text-test native-accessibility-test bundle-preload-test
|
||||
CI_SHARD_ZX := renderer-consumer-test zx-test zx-reload-test zx-window-test zx-services-test zx-hosted-test \
|
||||
zx-headless-test native-text-test native-accessibility-test
|
||||
CI_SHARD_CHECK := check
|
||||
CI_SHARD_WEB := canvas-test canvas-project-test zx-canvas-test zx-raylib-test page-route-project-test dom-project-test \
|
||||
raylib-web-project-test
|
||||
CI_SHARD_WEB := canvas-test canvas-project-test program-entry-project-test zx-canvas-test zx-raylib-test \
|
||||
page-route-project-test raylib-web-project-test
|
||||
.PHONY: test-shard-zx test-shard-check test-shard-web test-shard-hosts
|
||||
test-shard-zx: $(CI_SHARD_ZX)
|
||||
test-shard-check: $(CI_SHARD_CHECK)
|
||||
@@ -320,7 +358,9 @@ test-shard-hosts:
|
||||
.PHONY: push-check
|
||||
push-check:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
|
||||
$(MAKE) --no-print-directory source-check public-surface-check docs-check zx-player desktop-project-test pixmap-gpu-test gamepad-test text-hook-hosts-ir-test
|
||||
$(MAKE) --no-print-directory source-check public-surface-check docs-check zx-player desktop-project-test gamepad-test text-hook-hosts-ir-test
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
|
||||
$(MAKE) --no-print-directory test-focus TEST=ziran_pixmap_gpu_test
|
||||
.PHONY: text-hook-hosts-ir-test
|
||||
text-hook-hosts-ir-test:
|
||||
@ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" sh tests/text_hook_hosts_ir_test.sh
|
||||
@@ -330,6 +370,75 @@ gamepad-test:
|
||||
python3 tests/canvas_gamepad_test.py
|
||||
test: gamepad-test
|
||||
|
||||
# An example's generated C holds only what it imports: an empty window is
|
||||
# the window, its event loop, clearing and presenting; images bring decoders.
|
||||
.PHONY: pay-per-import-test
|
||||
pay-per-import-test:
|
||||
@rm -rf build/test/pay-per-import
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY ZIRAN_BIN="$(ZIRAN_BIN)" \
|
||||
"$(ZIRAN_BIN)" run --target=c --root tests tests/pay_per_import_test.zi
|
||||
test: pay-per-import-test
|
||||
|
||||
# The desktop host's windows on a private Xvfb with real X input: each
|
||||
# window's own events and surface, the sideways wheel, key repeat, window
|
||||
# state, the monitor, embedded pictures and fonts, and the render scale.
|
||||
.PHONY: desktop-windows-test
|
||||
desktop-windows-test:
|
||||
@rm -rf build/test/desktop-windows
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS YUE_DESKTOP_RECOVERY=0 \
|
||||
LDLIBS="-lXtst" "$(ZIRAN_BIN)" run --target=c tests/desktop_windows_test.zi -- build/test/desktop-windows
|
||||
test: desktop-windows-test
|
||||
|
||||
# The desktop audio mixer, SDL sink and asset audio, with no audio device:
|
||||
# SDL's disk driver stands in for one.
|
||||
.PHONY: desktop-audio-test
|
||||
desktop-audio-test:
|
||||
@rm -rf build/test/desktop-audio
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY LDLIBS="-lopus" \
|
||||
"$(ZIRAN_BIN)" run --target=c tests/desktop_audio_test.zi -- build/test/desktop-audio
|
||||
test: desktop-audio-test
|
||||
|
||||
# The static dr_mp3 archive that programs importing audio_decode_mp3 link,
|
||||
# built from the audio package's native/ and its pinned dr_libs source.
|
||||
AUDIO_PACKAGE = $$("$(ZIRAN_BIN)" pkg path audio --offline)
|
||||
MP3_DIR := $(BUILD_DIR)/mp3
|
||||
MP3_A := $(MP3_DIR)/libziran_mp3.a
|
||||
$(MP3_A): ziran.lock
|
||||
@mkdir -p $(MP3_DIR)
|
||||
@cmake -S "$(AUDIO_PACKAGE)/native" -B $(MP3_DIR) -DCMAKE_BUILD_TYPE=Release \
|
||||
-DDR_LIBS_DIR="$$("$(ZIRAN_BIN)" pkg path dr_libs --offline)" > $(MP3_DIR)/configure.log
|
||||
@cmake --build $(MP3_DIR) --target ziran_mp3 > $(MP3_DIR)/build.log
|
||||
|
||||
# MPEG audio streamed through the mixer equals audio/mp3's own decode of the
|
||||
# audio package's fixtures, and plays as asset audio, with no audio device.
|
||||
.PHONY: desktop-audio-mp3-test
|
||||
desktop-audio-mp3-test: $(MP3_A)
|
||||
@rm -rf build/test/desktop-audio-mp3
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY LDLIBS="-L$(MP3_DIR) -lziran_mp3 -lopus -lm" \
|
||||
"$(ZIRAN_BIN)" run --target=c tests/desktop_audio_mp3_test.zi -- \
|
||||
"$(AUDIO_PACKAGE)/tests/fixtures/mp3" build/test/desktop-audio-mp3
|
||||
test: desktop-audio-mp3-test
|
||||
|
||||
# The static stb_vorbis archive that programs importing audio_decode_vorbis
|
||||
# link, built from the audio package's native/ and its pinned stb source.
|
||||
VORBIS_DIR := $(BUILD_DIR)/vorbis
|
||||
VORBIS_A := $(VORBIS_DIR)/libziran_vorbis.a
|
||||
$(VORBIS_A): ziran.lock
|
||||
@mkdir -p $(VORBIS_DIR)
|
||||
@cmake -S "$(AUDIO_PACKAGE)/native" -B $(VORBIS_DIR) -DCMAKE_BUILD_TYPE=Release \
|
||||
-DSTB_DIR="$$("$(ZIRAN_BIN)" pkg path stb --offline)" > $(VORBIS_DIR)/configure.log
|
||||
@cmake --build $(VORBIS_DIR) --target ziran_vorbis > $(VORBIS_DIR)/build.log
|
||||
|
||||
# Ogg Vorbis streamed through the mixer equals audio/vorbis's own decode of
|
||||
# the audio package's fixtures, and plays as asset audio, with no audio device.
|
||||
.PHONY: desktop-audio-vorbis-test
|
||||
desktop-audio-vorbis-test: $(VORBIS_A)
|
||||
@rm -rf build/test/desktop-audio-vorbis
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY LDLIBS="-L$(VORBIS_DIR) -lziran_vorbis -lopus -lm" \
|
||||
"$(ZIRAN_BIN)" run --target=c tests/desktop_audio_vorbis_test.zi -- \
|
||||
"$(AUDIO_PACKAGE)/tests/fixtures/vorbis" build/test/desktop-audio-vorbis
|
||||
test: desktop-audio-vorbis-test
|
||||
|
||||
.PHONY: cursor-api-test
|
||||
cursor-api-test:
|
||||
python3 tests/cursor_api_test.py
|
||||
@@ -339,13 +448,6 @@ test: cursor-api-test
|
||||
canvas-audio-engine-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY sh tests/canvas_audio_engine_zi_test.sh
|
||||
|
||||
.PHONY: dom-spec-test
|
||||
dom-spec-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY sh tests/dom_spec_zi_test.sh
|
||||
@mkdir -p build/scratch/dom-pixels
|
||||
@'$(ZIRAN_BIN)' bundle --root tests $(KRYON_UI_PATHS) --module-path src/backend --module-path '$(ZIRAN_DIR)/std' --entry dom_pixels_test:main -o build/scratch/dom-pixels/pixels.zx tests/dom_pixels_test.zi
|
||||
@test "$$('$(ZIRAN_BIN)' run build/scratch/dom-pixels/pixels.zx)" = 0
|
||||
|
||||
.PHONY: desktop-frame-input-test canvas-frame-input-test
|
||||
desktop-frame-input-test:
|
||||
@python3 tests/host_frame_snapshot_test.py desktop
|
||||
@@ -372,7 +474,7 @@ page-geometry-test: project-toolchain
|
||||
test: page-geometry-test
|
||||
|
||||
.PHONY: canvas-test
|
||||
canvas-test: canvas-frame-input-test web-js-boundary-test canvas-events-test mini-mode-test dom-spec-test canvas-audio-engine-test page-geometry-test
|
||||
canvas-test: canvas-frame-input-test web-js-boundary-test canvas-events-test mini-mode-test canvas-audio-engine-test page-geometry-test
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY sh tests/canvas_backend_test.sh
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/file_picker_browser_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/http_transfer_browser_test.py
|
||||
@@ -390,30 +492,23 @@ canvas-project-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/canvas_project_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/web_simd_page_test.py
|
||||
|
||||
# A program entry (main plus App.Run) built by the project tool for the page
|
||||
# and for the desktop.
|
||||
.PHONY: program-entry-project-test
|
||||
program-entry-project-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/program_entry_project_test.py
|
||||
test: program-entry-project-test
|
||||
|
||||
.PHONY: page-route-project-test
|
||||
page-route-project-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/page_route_project_test.py
|
||||
|
||||
.PHONY: dom-project-test
|
||||
dom-project-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/dom_project_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
YUE_DESKTOP_RECOVERY=0 KRYON_DOM_INTERACTION=1 python3 tests/dom_project_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
YUE_DESKTOP_RECOVERY=0 KRYON_DOM_PRESS=1 python3 tests/dom_project_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
YUE_DESKTOP_RECOVERY=0 KRYON_DOM_PRESS_MOVE=1 python3 tests/dom_project_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
YUE_DESKTOP_RECOVERY=0 KRYON_DOM_IMAGE_DECODE=1 python3 tests/dom_project_test.py
|
||||
|
||||
.PHONY: native-text-test native-accessibility-test bundle-preload-test
|
||||
.PHONY: native-text-test native-accessibility-test
|
||||
native-text-test:
|
||||
@sh tests/native_text_test.sh
|
||||
native-accessibility-test:
|
||||
@sh tests/native_accessibility_test.sh
|
||||
bundle-preload-test:
|
||||
@ZIRAN_ROOT=$(abspath $(ZIRAN_DIR)) ZIRAN_BIN=$(abspath $(ZIRAN_DIR))/build/bin/ziran sh tests/ziran_bundle_preload_test.sh
|
||||
test: native-text-test native-accessibility-test bundle-preload-test
|
||||
test: native-text-test native-accessibility-test
|
||||
|
||||
.PHONY: typeface-source-test
|
||||
typeface-source-test: $(ZI2C_BIN)
|
||||
@@ -515,18 +610,31 @@ desktop-project-test: build/bin/kryon
|
||||
|
||||
.PHONY: desktop-size-test
|
||||
desktop-size-test: build/bin/kryon
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY python3 tests/desktop_size_test.py
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
HARMONY_DESKTOP_RECOVERY=0 python3 tests/desktop_size_test.py
|
||||
|
||||
.PHONY: system-clipboard-linux-test
|
||||
system-clipboard-linux-test: build/bin/kryon
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
python3 tests/system_clipboard_linux_test.py
|
||||
|
||||
# The portable clipboard and PRIMARY API against a bound fixture host.
|
||||
.PHONY: system-clipboard-test
|
||||
system-clipboard-test:
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY ZIRAN_ROOT="$(ZIRAN_DIR)" \
|
||||
ZIRAN_BIN="$(ZIRAN_BIN)" sh tests/system_clipboard_test.sh
|
||||
@echo 'System clipboard and PRIMARY: fixture host, unavailable PRIMARY and buffer limits passed'
|
||||
test: system-clipboard-test
|
||||
|
||||
.PHONY: mime-clipboard-linux-test
|
||||
mime-clipboard-linux-test:
|
||||
@ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/mime_clipboard_linux_test.py
|
||||
test: mime-clipboard-linux-test
|
||||
|
||||
.PHONY: drag-source-linux-test
|
||||
drag-source-linux-test:
|
||||
@ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/drag_source_linux_test.py
|
||||
test: drag-source-linux-test
|
||||
|
||||
.PHONY: window-test
|
||||
window-test: build/bin/kryon
|
||||
@@ -559,7 +667,7 @@ sanitize-test: project-toolchain
|
||||
# so write permission comes back first.
|
||||
BUILD_OUTPUTS := ziran project bin tools test examples sanitize raylib-ziran webp-ziran avif-ziran zx-reload-test zx-raylib zx-native-test zx-android-test \
|
||||
emscripten-cache android-surface-check text-input-platform-test zx-player zx-test zx-canvas zx-canvas-test gallery-zx \
|
||||
accessibility text-shaping performance frame-replay frame-inspect frame-input-replay dom-project
|
||||
accessibility text-shaping performance frame-replay frame-inspect frame-input-replay
|
||||
# Keep prior generated output while an installed or running app may use it.
|
||||
BUILD_OUTPUTS += zib-reload-test zib-raylib zib-native-test zib-android-test \
|
||||
zib-player zib-test zib-canvas zib-canvas-test gallery-zib
|
||||
@@ -593,7 +701,7 @@ pixmap-emoji: project-toolchain
|
||||
pixmap-surface-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY sh tests/pixmap_surface_test.sh
|
||||
|
||||
test: check canvas-test canvas-project-test zx-canvas-test zx-raylib-test page-route-project-test dom-project-test typeface-source-test pixmap-surface-test program-title-test raylib-window-test system-clipboard-linux-test
|
||||
test: check canvas-test canvas-project-test zx-canvas-test zx-raylib-test page-route-project-test typeface-source-test pixmap-surface-test program-title-test raylib-window-test system-clipboard-linux-test
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
@@ -625,76 +733,16 @@ pixmap-mesh-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/pixmap_mesh_test.sh
|
||||
test: pixmap-mesh-test
|
||||
|
||||
.PHONY: pixmap-parallel-test
|
||||
pixmap-parallel-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_pixmap_parallel_test.sh
|
||||
test: pixmap-parallel-test
|
||||
|
||||
.PHONY: pixmap-gpu-test
|
||||
pixmap-gpu-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_pixmap_gpu_test.sh
|
||||
test: pixmap-gpu-test
|
||||
|
||||
# Opt-in SDL3 SDK and real GPU-renderer parity on a private display.
|
||||
.PHONY: sdl3-test
|
||||
sdl3-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
YUE_DESKTOP_RECOVERY=0 ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/sdl3_test.py
|
||||
|
||||
.PHONY: style-cache-test
|
||||
style-cache-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_style_cache_test.sh
|
||||
test: style-cache-test
|
||||
|
||||
.PHONY: tree-style-metadata-test
|
||||
tree-style-metadata-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER sh tests/ziran_tree_style_metadata_test.sh
|
||||
test: tree-style-metadata-test
|
||||
|
||||
.PHONY: css-dom-test
|
||||
css-dom-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 python3 tests/css_dom_browser.py
|
||||
test: css-dom-test
|
||||
|
||||
.PHONY: component-host-test
|
||||
component-host-test: project-toolchain
|
||||
@ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" sh tests/ziran_component_host_test.sh
|
||||
test: component-host-test
|
||||
|
||||
.PHONY: theme-test theme-token-export-test button-theme-raster-test cui-inputs-test cui-overlays-test
|
||||
theme-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_theme_test.sh
|
||||
test: theme-test
|
||||
|
||||
theme-token-export-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_theme_tokens_test.sh
|
||||
test: theme-token-export-test
|
||||
|
||||
button-theme-raster-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_button_theme_raster_test.sh
|
||||
test: button-theme-raster-test
|
||||
|
||||
cui-inputs-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER sh tests/ziran_cui_inputs_test.sh
|
||||
test: cui-inputs-test
|
||||
|
||||
cui-overlays-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 sh tests/ziran_cui_overlays_test.sh
|
||||
test: cui-overlays-test
|
||||
|
||||
.PHONY: style-cache-benchmark
|
||||
style-cache-benchmark: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/style_cache_cost.sh
|
||||
|
||||
.PHONY: video-test
|
||||
video-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER sh tests/ziran_video_linux_test.sh
|
||||
|
||||
.PHONY: image-decode-test
|
||||
image-decode-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER sh tests/ziran_image_decode_linux_test.sh
|
||||
test: image-decode-test
|
||||
|
||||
# Android NDK link of the WebP decoder for every ABI; needs ANDROID_NDK.
|
||||
.PHONY: android-webp-link-test
|
||||
android-webp-link-test: project-toolchain
|
||||
@@ -702,6 +750,14 @@ android-webp-link-test: project-toolchain
|
||||
ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/android_webp_link_test.py \
|
||||
--ndk "$(or $(ANDROID_NDK),$(HOME)/Android/Sdk/ndk/28.2.13676358)"
|
||||
|
||||
# Android NDK configure and raylib build of the kryon:renderer-raylib
|
||||
# artifact project (cmake/renderer-artifact) for arm64; needs ANDROID_NDK.
|
||||
.PHONY: android-renderer-artifact-test
|
||||
android-renderer-artifact-test: project-toolchain
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS \
|
||||
ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/android_renderer_artifact_cmake_test.py \
|
||||
--ndk "$(or $(ANDROID_NDK),$(HOME)/Android/Sdk/ndk/28.2.13676358)"
|
||||
|
||||
.PHONY: raylib-webp-decode-test
|
||||
raylib-webp-decode-test: project-toolchain $(RAYLIB_ARCHIVES)
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER \
|
||||
@@ -709,10 +765,11 @@ raylib-webp-decode-test: project-toolchain $(RAYLIB_ARCHIVES)
|
||||
RAYLIB_LIBS="$(RAYLIB_PLATFORM_LIBS) -lm" sh tests/raylib_webp_decode_test.sh
|
||||
test: raylib-webp-decode-test
|
||||
|
||||
.PHONY: scene-test
|
||||
scene-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS sh tests/ziran_scene_test.sh
|
||||
test: scene-test
|
||||
.PHONY: scene-image-material-test
|
||||
|
||||
scene-image-material-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS HARMONY_DESKTOP_RECOVERY=0 sh tests/scene_image_material_test.sh
|
||||
test: scene-image-material-test
|
||||
|
||||
.PHONY: scene-render-benchmark
|
||||
scene-render-benchmark: project-toolchain
|
||||
@@ -724,6 +781,7 @@ shader-glsl-test: project-toolchain
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" sh tests/shader_glsl_test.sh
|
||||
scene-gpu-test: project-toolchain
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/scene_gpu_test.py
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/scene_gpu_test.py --glx
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/scene_gpu_test.py --async-test
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/scene_gpu_test.py --async-test --saved
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/scene_camera_shift_test.py
|
||||
@@ -732,6 +790,11 @@ scene-gpu-test: project-toolchain
|
||||
scene-camera-shift-test: project-toolchain
|
||||
@ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/scene_camera_shift_test.py
|
||||
|
||||
.PHONY: daylight-test
|
||||
daylight-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS HARMONY_DESKTOP_RECOVERY=0 sh tests/daylight_test.sh
|
||||
test: daylight-test
|
||||
|
||||
.PHONY: shader-scene-test
|
||||
shader-scene-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS HARMONY_DESKTOP_RECOVERY=0 sh tests/shader_scene_test.sh
|
||||
@@ -758,7 +821,6 @@ image-preview-web-test: project-toolchain
|
||||
sh tests/image_preview_web_test.sh
|
||||
test: image-preview-web-test
|
||||
|
||||
|
||||
.PHONY: android-surface-test android-rotation-pixels-test
|
||||
android-surface-test: project-toolchain
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS python3 tests/android_surface_test.py
|
||||
@@ -786,16 +848,12 @@ test: asset-audio-test
|
||||
document-storage-test:
|
||||
@ZIRAN_ROOT="$(abspath $(ZIRAN_DIR))" ZIRAN_BIN="$(ZIRAN_BIN)" python3 tests/document_storage_test.py --browser
|
||||
|
||||
.PHONY: app-files-test
|
||||
app-files-test:
|
||||
@ZIRAN_ROOT="$(abspath $(ZIRAN_DIR))" ZIRAN_BIN="$(ZIRAN_BIN)" sh tests/ziran_app_files_test.sh
|
||||
|
||||
.PHONY: pcm-audio-test
|
||||
pcm-audio-test: $(RAYLIB_A)
|
||||
@ZIRAN_ROOT="$(ZIRAN_DIR)" ZIRAN_BIN="$(ZIRAN_BIN)" RAYLIB_A="$(RAYLIB_A)" \
|
||||
ZIRAN_BUILD_DIR="$(ZIRAN_BUILD_DIR)" python3 tests/media_audio_test.py --browser --pcm
|
||||
|
||||
test: pcm-audio-test document-storage-test app-files-test
|
||||
test: pcm-audio-test document-storage-test
|
||||
|
||||
.PHONY: android-notification-jvm-test
|
||||
android-notification-jvm-test:
|
||||
@@ -821,7 +879,6 @@ test: android-launch-uri-test
|
||||
play-billing-test:
|
||||
@python3 tests/play_billing_test.py
|
||||
|
||||
|
||||
# Optional extensions on the compiled canvas runner retain the bare defaults.
|
||||
.PHONY: canvas-app-hooks-test
|
||||
canvas-app-hooks-test:
|
||||
@@ -836,18 +893,13 @@ rotated-text-test: project-toolchain $(RAYLIB_ARCHIVES)
|
||||
@python3 tests/rotated_text_web_test.py
|
||||
test: rotated-text-test
|
||||
|
||||
.PHONY: cairo-scaled-image-test
|
||||
cairo-scaled-image-test: project-toolchain
|
||||
@sh tests/ziran_cairo_scaled_image_test.sh
|
||||
test: cairo-scaled-image-test
|
||||
|
||||
# Smooth images draw their shared Lanczos copies the same as Pillow on the
|
||||
# pixmap host, Raylib in a private Xvfb window and Canvas in private headless
|
||||
# Firefox; cairo-scaled-image-test checks Cairo's, and
|
||||
# Firefox; the behavior tests check the pixmap host's and Cairo's
|
||||
# (ziran_pixmap_lanczos_test, ziran_cairo_scaled_image_test), and
|
||||
# tests/lanczos_backend_goldens.sh runs all four.
|
||||
.PHONY: lanczos-goldens-test
|
||||
lanczos-goldens-test: project-toolchain $(RAYLIB_ARCHIVES)
|
||||
@sh tests/ziran_pixmap_lanczos_test.sh
|
||||
@RAYLIB_A="$(RAYLIB_A)" WEBP_A="$(WEBP_A)" AVIF_A="$(AVIF_A)" AOM_A="$(AOM_A)" sh tests/raylib_lanczos_test.sh
|
||||
@python3 tests/canvas_lanczos_test.py
|
||||
test: lanczos-goldens-test
|
||||
@@ -897,7 +949,6 @@ avif-benchmark: project-toolchain
|
||||
avif-render-test: project-toolchain $(RAYLIB_ARCHIVES) $(AVIF_SO) $(ZX_RAYLIB_RUNTIME)
|
||||
@sh tests/avif_render_test.sh
|
||||
|
||||
|
||||
.PHONY: bitmap-image-test
|
||||
bitmap-image-test: project-toolchain
|
||||
@ZIRAN_ROOT=$(abspath $(ZIRAN_DIR)) ZIRAN_BIN=$(abspath $(ZIRAN_DIR))/build/bin/ziran sh tests/bitmap_store_test.sh
|
||||
@@ -941,11 +992,6 @@ android-surface-platform-test: project-toolchain
|
||||
@env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS python3 tests/android_surface_platform_test.py
|
||||
test: android-surface-platform-test
|
||||
|
||||
.PHONY: cui-motion-test
|
||||
cui-motion-test: project-toolchain
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u XAUTHORITY -u DBUS_SESSION_BUS_ADDRESS -u SESSION_MANAGER YUE_DESKTOP_RECOVERY=0 sh tests/ziran_cui_motion_test.sh
|
||||
test: cui-motion-test
|
||||
|
||||
.PHONY: android-source-generation-test
|
||||
android-source-generation-test: project-toolchain
|
||||
@python3 tests/android_source_generation_test.py
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
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)`.
|
||||
`kryon/VideoLinux`. Display the returned frame with `Image.Draw(Image.Props)`.
|
||||
Applications own playback controls and access checks; an optional expiring lease
|
||||
revokes both audio and decoded frames when authorization is no longer renewed.
|
||||
`make video-test` checks synthetic moving frames, paused seeking, speed, volume,
|
||||
`make test-focus TEST=ziran_video_linux_test` checks synthetic moving frames, paused seeking, speed, volume,
|
||||
replay and lease revocation with a silent audio sink and no display access.
|
||||
|
||||
Kryon is a UI library written in Ziran. Its source lives under `src/ui/` and
|
||||
@@ -76,11 +76,9 @@ 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.
|
||||
The [hello world example](examples/README.md) is one small Ziran program with
|
||||
an explicit `main`: it imports Kryon's app and text packages, opens a window,
|
||||
and draws the label `Hello, world!`.
|
||||
For Ziran app manifests, the terminal backend, and `kryon run`, see
|
||||
[Ziran projects](docs/PROJECTS.md).
|
||||
Portable desktop profiles build a `.zx` with embedded assets; a downloaded
|
||||
@@ -109,8 +107,7 @@ full website from fixed source revisions before publishing.
|
||||
|
||||
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
|
||||
and Wasm tests. The [open-work plan](plan/README.md) lists
|
||||
the remaining platform-accessibility work.
|
||||
|
||||
Kryon commits land upstream first. Applications then update their
|
||||
@@ -123,6 +120,6 @@ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for the library boundary and
|
||||
status](https://github.com/ziranlang/ziran/blob/master/docs/IMPLEMENTATION_STATUS.md)
|
||||
for language and portable runtime gaps.
|
||||
|
||||
`Widgets` includes `Breadcrumb` for keyed label navigation, with measured
|
||||
`kryon/breadcrumb` serves `Breadcrumb.Draw` for keyed label navigation, with measured
|
||||
ancestors and an accessible, virtualized overflow menu. Applications own
|
||||
selection, focus and navigation; see [the API](docs/API.md#breadcrumbs).
|
||||
|
After Width: | Height: | Size: 847 KiB |
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"project": "Kryon",
|
||||
"request": "One original friendly full-body dragon mascot for the Kryon UI toolkit, in the Ziran capybara's flat warm illustration feel, followed by a pastel-only color revision that preserves the accepted character.",
|
||||
"pastel_follow_up_request": "okay but the colors should be more pastel — for the mascot",
|
||||
"generation_mode": "built-in image_gen",
|
||||
"generation_calls_planned": 1,
|
||||
"conditional_retry_allowed": 1,
|
||||
"generation_calls_completed": 3,
|
||||
"attempt_count": 3,
|
||||
"pastel_edit_calls_planned": 1,
|
||||
"pastel_edit_calls_completed": 1,
|
||||
"retry_reason": "The first attempt had extra body shading and tighter margins, a clear style/composition mismatch; the one permitted retry fixed the flat-ink direction.",
|
||||
"proposals": [
|
||||
{
|
||||
"id": "01-dragon-v1",
|
||||
"version": "v1",
|
||||
"attempt_count": 2,
|
||||
"animal": "Dragon",
|
||||
"direction": "Rounded approachable full-body dragon in three-quarter view, facing right, with a calm warm personality and strong small-icon silhouette.",
|
||||
"prompt": "Use case: logo-brand\nAsset type: final original mascot bitmap for Kryon, a UI toolkit and Ziran sister project; exactly one finished character.\nPrimary request: Create one entirely original friendly cartoon dragon mascot for Kryon. KDE inspiration is limited only to the broad idea of a rounded, approachable open-source cartoon dragon body and shape. This must not copy or trace Konqi and must not reuse Konqi's exact face, anatomy, pose, or proportions.\nScene/backdrop: None. A genuinely transparent square canvas with no background pixels, ground, shadow, border, or decoration.\nSubject: One full-body dragon in three-quarter view, facing right, standing in a relaxed welcoming pose. Big friendly head, short rounded snout, small rounded horns, small wings, a soft row of rounded back spines, four simple grounded feet without claws, and one clear tapering tail. Calm warm expression, small gentle eyes rendered only with earth-brown marks, closed mouth, no teeth. Nothing in its hands.\nStyle/medium: Confident hand-drawn flat illustration in the same visual family as Ziran's capybara mascot: bold deep earth-brown outline of consistent apparent weight, large quiet solid color areas, minimal interior marks, slight purposeful hand-drawn irregularity, calm warm character, strong sticker-like silhouette readable as a tiny website icon. Absolutely flat ink fills: no lighting, highlights, shadows, secondary shades, gray, cream, white fill, texture, or tonal modeling.\nComposition/framing: Center the single complete dragon on a 1:1 square canvas. The entire silhouette should occupy about 72–76% of the canvas width and height, leaving a clean 12–15% transparent border on every side. Every horn, wing, spine, foot, and tail is wholly visible and comfortably clear of the edge. Three-quarter view faces right.\nColor palette: Exactly four visual ink colors and no others except edge antialiasing between them and transparency: jade green #63B190 for the entire body and wings; exactly one continuous lake-blue underside/belly plane #77B7EA; deep earth-brown #502511 for every outline, eye, nostril, and minimal interior mark; one restrained muted light-orange #A48B62 used only on the small horn tips. Do not create light and dark variants of any color. Do not use orange on wings or elsewhere.\nText: NONE.\nConstraints: One original approachable rounded dragon; one character only; genuine alpha transparency; strong readable silhouette; generous clear margins; four flat source-family inks only; exactly one lake-blue belly plane; orange limited to horn tips; eyes use brown with no white eye fill.\nAvoid: Konqi likeness, KDE logo, gear, fire, smoke, teeth, aggressive claws, K monogram, letter-shaped body, props, clothing, scenery, borders, frames, solid or patterned background, gradients, glow, glossy 3D, textures, shading, highlights, drop shadows, extra characters, extra limbs, cropped anatomy. Absolutely no text, letters, numbers, labels, signatures, logos, or watermark anywhere.",
|
||||
"file": null,
|
||||
"transparent_background": true,
|
||||
"status": "removed-at-owner-request",
|
||||
"retained": false,
|
||||
"actual": {
|
||||
"dimensions": [1254, 1254],
|
||||
"mode": "RGBA",
|
||||
"alpha_extrema": [0, 255],
|
||||
"content_bbox_alpha_gt_1": [107, 63, 1125, 1197],
|
||||
"bytes": 877306,
|
||||
"sha256": "aa041bbfe0fa60b97736fff724be5922f6b178607cfab5514b6cc4a17295da89"
|
||||
},
|
||||
"visual_review": {
|
||||
"no_text_verified": true,
|
||||
"transparent_background_verified": true,
|
||||
"not_konqi_copy": true,
|
||||
"style_matches_ziran": true,
|
||||
"original_character": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "02-dragon-v2-pastel",
|
||||
"version": "v2",
|
||||
"attempt_count": 1,
|
||||
"animal": "Dragon",
|
||||
"direction": "Pastel-only color revision of the accepted v1 dragon, preserving the same friendly character, pose, proportions, framing, linework, expression, wings, spines, and transparent background.",
|
||||
"prompt": "Use case: precise-object-edit\nAsset type: pastel color revision of the accepted Kryon dragon mascot bitmap.\nInput images: Image 1 is the sole edit target, the accepted v1 Kryon dragon mascot.\nPrimary request: Change ONLY the four flat ink colors of Image 1 to a softer pastel palette. Do not redraw, reinterpret, restyle, simplify, or add anything.\nColor palette: body pastel mint/jade approximately #A9DCC5; the single existing belly/underside plane pastel sky blue approximately #BCDDF6; the existing horn-tip accents pastel peach approximately #F5C7A1; all existing outline, eye, nostril, and interior marks deep earth-brown/warm cocoa approximately #6B4434. Use at most these four flat visual inks plus edge antialiasing and transparency.\nTransparency: Preserve the genuinely transparent background and all current alpha edges. No background pixels, ground, or shadow.\nInvariants: Preserve the exact same original character, pose, anatomy, proportions, framing, silhouette, linework geometry and apparent weight, expression, gaze, wings, rounded back spines, horns, feet, tail, belly-plane shape, detail placement, canvas dimensions, and transparent margins. Change only colors. Keep every existing element in the exact same position and size. No added or removed details.\nAvoid: gradients, extra shades, texture, highlights, shadows, glow, glossy rendering, new marks, altered outlines, altered anatomy, text, letters, numbers, logos, signatures, or watermark. Do not introduce a Konqi likeness, KDE logo, gear, props, clothing, scenery, border, fire, teeth, or claws.",
|
||||
"file": "mascot-dragon.png",
|
||||
"transparent_background": true,
|
||||
"status": "complete",
|
||||
"actual": {
|
||||
"dimensions": [1254, 1254],
|
||||
"mode": "RGBA",
|
||||
"alpha_extrema": [0, 255],
|
||||
"content_bbox_alpha_gt_1": [107, 64, 1127, 1197],
|
||||
"bytes": 867648,
|
||||
"sha256": "9537921d73713caccd9c991b4998224207f5ad21a079dcebc2f57cfc111daae4"
|
||||
},
|
||||
"target_palette": {
|
||||
"body_pastel_mint_jade": "#A9DCC5",
|
||||
"belly_pastel_sky_blue": "#BCDDF6",
|
||||
"horn_tips_pastel_peach": "#F5C7A1",
|
||||
"outline_warm_cocoa": "#6B4434"
|
||||
},
|
||||
"visual_review": {
|
||||
"exact_character_preserved": true,
|
||||
"pixel_identical_to_v1": false,
|
||||
"transparent_background_verified": true,
|
||||
"no_text_verified": true,
|
||||
"not_konqi_copy": true,
|
||||
"style_matches_ziran": true,
|
||||
"pastel_palette_verified": true,
|
||||
"at_most_four_visual_inks": true,
|
||||
"original_character": true,
|
||||
"notes": "The same accepted character, pose, anatomy, expression, linework design, and framing are preserved. Built-in image editing re-antialiased some edge pixels: the alpha>128 silhouette IoU is 99.53710%, ink-region agreement is 99.69063%, and the content bounding box moved by at most two pixels; v2 is therefore not claimed to be pixel-identical to v1."
|
||||
}
|
||||
}
|
||||
],
|
||||
"validation": {
|
||||
"local_tests": "passed",
|
||||
"tests": [
|
||||
"The retained pastel mascot is a decodable 1254x1254 8-bit RGBA PNG with alpha extrema [0, 255].",
|
||||
"The retained pastel mascot SHA-256 is 9537921d73713caccd9c991b4998224207f5ad21a079dcebc2f57cfc111daae4 and matches its proposal record.",
|
||||
"Visible content above alpha 1 has bounding box [107, 64, 1127, 1197], wholly inside the canvas with transparent clearance on every side.",
|
||||
"OCR returned no text; visual review found no text, letters, numbers, labels, signatures, or watermark.",
|
||||
"Visual and palette review confirmed the same accepted original dragon, no Konqi copy, the Ziran flat warm style, and the requested pastel mint, sky-blue, peach, and warm-cocoa direction."
|
||||
],
|
||||
"scope": "Local validation of the sole retained asset assets/brand/mascot-dragon.png and assets/brand/prompts.json.",
|
||||
"notes": "The earlier darker bitmap was removed at the owner's request; its prompt and digest remain as provenance only. The retained pastel mascot used one built-in image_gen edit call and its generated binary was copied without retouching."
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(KryonRendererArtifact C CXX)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../KryonAndroid.cmake)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/RaylibAndroid.cmake")
|
||||
kryon_android_raylib("${RAYLIB_DIR}" "${WEBP_DIR}" "${AVIF_DIR}" "${AOM_DIR}"
|
||||
"${KRYON_ANDROID_AUDIO_DIR}" "${KRYON_ANDROID_OPUS_DIR}" "${KRYON_ANDROID_SAMPLERATE_DIR}")
|
||||
@@ -0,0 +1,82 @@
|
||||
# The Android build of the `kryon:renderer-raylib` package artifact.
|
||||
#
|
||||
# Kryon's own Android host presents through the platform and needs no
|
||||
# renderer (cmake/KryonAndroid.cmake). Applications that import the raylib
|
||||
# renderer instead link the archives this project produces, which
|
||||
# scripts/renderer_artifact.py builds and describes in renderer.json:
|
||||
#
|
||||
# kryon_android_raylib("${RAYLIB_DIR}" "${WEBP_DIR}" "${AVIF_DIR}" "${AOM_DIR}"
|
||||
# "${AUDIO_DIR}" "${OPUS_DIR}" "${SAMPLERATE_DIR}")
|
||||
#
|
||||
# It defines `raylib`, `kryonwebp`, `avif_static` and, with the audio
|
||||
# package, `opus`.
|
||||
|
||||
include_guard(GLOBAL)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../KryonAndroid.cmake")
|
||||
|
||||
# Compile raylib's Android backend with the module and file-format set Kryon
|
||||
# uses: GLES2 rendering, raudio with OGG, PNG/JPG images, and TTF fonts, plus
|
||||
# Kryon's WebP and AVIF codecs.
|
||||
function(kryon_android_raylib raylib_dir webp_dir avif_dir aom_dir)
|
||||
if(NOT EXISTS "${raylib_dir}/raylib.h")
|
||||
message(FATAL_ERROR "No raylib source at ${raylib_dir}")
|
||||
endif()
|
||||
add_library(raylib STATIC
|
||||
"${raylib_dir}/rcore.c"
|
||||
"${raylib_dir}/rshapes.c"
|
||||
"${raylib_dir}/rtextures.c"
|
||||
"${raylib_dir}/rtext.c"
|
||||
"${raylib_dir}/raudio.c")
|
||||
# rlgl's GLES2 batch holds 2048 quads, a few dozen anti-aliased rounded
|
||||
# shapes, so a phone frame flushed it many times, each upload into the
|
||||
# one vertex buffer the tiling GPU had not drawn yet. A larger batch in
|
||||
# two alternating buffers flushes far less often and waits on neither.
|
||||
target_compile_definitions(raylib PRIVATE
|
||||
PLATFORM_ANDROID
|
||||
GRAPHICS_API_OPENGL_ES2
|
||||
RL_DEFAULT_BATCH_BUFFER_ELEMENTS=8192
|
||||
RL_DEFAULT_BATCH_BUFFERS=2
|
||||
SUPPORT_SCREEN_CAPTURE=0
|
||||
SUPPORT_CUSTOM_FRAME_CONTROL=1
|
||||
SUPPORT_COMPRESSION_API=0
|
||||
SUPPORT_AUTOMATION_EVENTS=0
|
||||
SUPPORT_CLIPBOARD_IMAGE=0
|
||||
SUPPORT_FILEFORMAT_BMP=0
|
||||
SUPPORT_FILEFORMAT_GIF=0
|
||||
SUPPORT_FILEFORMAT_QOI=0
|
||||
SUPPORT_FILEFORMAT_DDS=0
|
||||
SUPPORT_FILEFORMAT_TTF=1
|
||||
SUPPORT_FILEFORMAT_JPG=1
|
||||
SUPPORT_FILEFORMAT_PNG=1
|
||||
SUPPORT_FILEFORMAT_OGG=1
|
||||
SUPPORT_MODULE_RAUDIO=1
|
||||
# src/backend/android_fopen.zi owns the app's __wrap_fopen; raylib's
|
||||
# own APK reader keeps a distinct name so the two never collide.
|
||||
__wrap_fopen=KryonRaylibFopen)
|
||||
# rlgl's per-vertex batching runs for every mesh point each frame; size
|
||||
# optimization made it the hottest code on low-end phones.
|
||||
target_compile_options(raylib PRIVATE -O2 -ffunction-sections -fdata-sections
|
||||
-fno-omit-frame-pointer $<$<NOT:$<CONFIG:Debug>>:-g1>)
|
||||
target_include_directories(raylib PUBLIC
|
||||
"${raylib_dir}" "${KRYON_ANDROID_NATIVE_APP_GLUE_DIR}")
|
||||
kryon_android_codecs("${webp_dir}" "${avif_dir}" "${aom_dir}")
|
||||
target_link_libraries(raylib PUBLIC kryon_android_codecs)
|
||||
set(audio_dir "${ARGV4}")
|
||||
if(NOT audio_dir STREQUAL "")
|
||||
kryon_android_audio("${audio_dir}" "${ARGV5}" "${ARGV6}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Ogg Opus assets in media_audio_raylib decode with audio/opus, which needs
|
||||
# libopus, built from the audio package's pinned sources (`ziran pkg path
|
||||
# audio`, `libopus`, `libsamplerate`) and linked through raylib.
|
||||
function(kryon_android_audio audio_dir opus_dir samplerate_dir)
|
||||
if(NOT EXISTS "${audio_dir}/native/AudioCodecs.cmake")
|
||||
message(FATAL_ERROR "No audio package at ${audio_dir}")
|
||||
endif()
|
||||
include("${audio_dir}/native/AudioCodecs.cmake")
|
||||
ziran_audio_codecs("${opus_dir}" "${samplerate_dir}")
|
||||
# As with raylib, debug builds still need real-time decoding on slow phones.
|
||||
target_compile_options(opus PRIVATE -O2)
|
||||
target_link_libraries(raylib PUBLIC opus)
|
||||
endfunction()
|
||||
@@ -34,8 +34,6 @@ 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
|
||||
|
||||
@@ -17,8 +17,9 @@ library. The compiler and bundle loader have no Kryon-specific branches.
|
||||
| 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
|
||||
inventory is [`src/ui/modules.txt`](../src/ui/modules.txt). Applications import
|
||||
each widget package by name, such as `Text :: #import "kryon/text";`, and the
|
||||
shared core modules they use. Optional packages
|
||||
have separate imports and build targets; the core UI does not import them.
|
||||
|
||||
## Widget and host boundary
|
||||
@@ -31,8 +32,8 @@ 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
|
||||
profiles choose the terminal, desktop, raylib or Canvas2D host;
|
||||
see [BACKENDS.md](BACKENDS.md). A non-graphical Ziran program can
|
||||
import a Kryon policy module without selecting any of these hosts.
|
||||
|
||||
## Build and verification
|
||||
@@ -40,8 +41,8 @@ import a Kryon policy module without selecting any of these hosts.
|
||||
`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
|
||||
portable `.zx` behavior, Canvas2D Wasm effects, and packaged Canvas2D
|
||||
browser applications in private headless Chromium. Desktop and
|
||||
raylib package tests run separately on private Xvfb displays;
|
||||
CI runs them too. `make sanitize-test` repeats the behavior tests with AddressSanitizer and UndefinedBehaviorSanitizer.
|
||||
[FEATURE_MATRIX.md](FEATURE_MATRIX.md) states exactly what those checks cover.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# 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) ->
|
||||
Ziran under `src/ui/`. An application imports the widget packages it uses,
|
||||
such as `Text :: #import "kryon/text";`, and exports `Frame(session: Session, viewport: Rectangle) ->
|
||||
s32`. A selected host under `src/backend/` owns the process entry point,
|
||||
window or terminal, platform input, rasterization, and presentation. Ziran has
|
||||
no special knowledge of Kryon widgets.
|
||||
@@ -67,30 +67,20 @@ in the application.
|
||||
| `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
|
||||
The small application surface selects the host from the compile-time target.
|
||||
Import `kryon/app` and call `App.Run(window, draw)`: C/Linux uses
|
||||
`kryon/host/desktop`, while C/Web uses `kryon/host/web`. Advanced hosts can
|
||||
import those named host packages directly. The desktop implementation uses
|
||||
`cairo_raster.zi` and `desktop_loop.zi`.
|
||||
After `PollDesktop()`, custom loops call `DesktopInputTake(session)` to transfer
|
||||
the next ordered editing action or printable-key/text run into that session.
|
||||
The returned key uses shared codes, including 320–329 for numeric-keypad
|
||||
digits, and carries the modifiers held when that key arrived.
|
||||
Standalone `AppContext` applications use the compiled host
|
||||
`canvas_app_run.zi`.
|
||||
Polygon-clipped images use native Cairo/Canvas path clips. Raylib caches bounded polygon triangulations and draws them directly on the
|
||||
GPU, including all Jungle puzzle pieces. Complex polygons and pixel hosts use
|
||||
clipped spans while preserving the original source mapping.
|
||||
SDL pixel hosts prefer accelerated texture presentation without blocking on
|
||||
@@ -331,7 +321,7 @@ 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,
|
||||
`Image.Draw(Image.Props)` accepts AVIF assets through the same path as PNG/JPEG/WebP,
|
||||
including extensionless names and packaged bundle/APK assets. Raylib hosts opt
|
||||
in with `AVIF_RAYLIB` and the pinned archives; builds without it decode no AVIF
|
||||
and link no codec library. Native hosts
|
||||
@@ -380,7 +370,7 @@ 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
|
||||
Canvas uses the browser AVIF decoder through `PageImageDecode`; supported
|
||||
browsers (Firefox 93+, Chromium 85+, Safari 16.4+) supply their native AVIF
|
||||
implementation. In a browser without AVIF, every AVIF decode fails cleanly:
|
||||
no pixels and zero size, so the image is treated like any undecodable file,
|
||||
@@ -402,7 +392,7 @@ 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
|
||||
qemu-aarch64. `make avif-browser-test` exercises the Canvas image
|
||||
boundary in private headless Firefox, reporting the AVIF capability, and repeats
|
||||
it as a browser without AVIF. `make avif-benchmark [ANDROID_SERIAL=ZE2223BQZT]
|
||||
[AVIF_BENCHMARK_BROWSER=1]` records ms/image, MP/s and peak RSS for libaom,
|
||||
@@ -432,9 +422,9 @@ still; `ImageCompress` keeps animated originals unchanged.
|
||||
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.
|
||||
- The canvas host uses the browser's own WebP decoder.
|
||||
|
||||
`make raylib-webp-decode-test` and `make image-decode-test` decode the
|
||||
`make raylib-webp-decode-test` and `make test-focus TEST=ziran_image_decode_linux_test` decode the
|
||||
`tests/fixtures/webp` pictures natively, `tests/webp_browser_test.py` does the
|
||||
same in headless Chromium, and `make android-webp-link-test` links the
|
||||
decoder for every Android ABI.
|
||||
@@ -510,7 +500,6 @@ LRU budgets, so a large cover and its small marker do not evict each other.
|
||||
| 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
|
||||
@@ -647,13 +636,13 @@ 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 modifiers that were down. Desktop, Canvas and Raylib custom loops call
|
||||
`DesktopInputTake(session)`, `CanvasInputTake(session)` or
|
||||
`RaylibInputTake(session)` before each frame. Each take transfers ordered text
|
||||
to that session and returns the next key with the modifiers retained when the
|
||||
press or repeat arrived, so shortcuts remain intact even when every physical
|
||||
key is released before a frame. `CanvasModifiers()` and the immutable frame
|
||||
snapshot keep their held-state semantics. Other hosts report none.
|
||||
The host calls `BeginFrame` and
|
||||
`EndFrame` around application composition, then presents the resulting
|
||||
paint operations. Widget behavior stays in `src/ui/`.
|
||||
|
||||
@@ -16,7 +16,6 @@ numbers as the platform input phases: start 1, update 2, commit 3, cancel 4.
|
||||
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
|
||||
|
||||
@@ -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,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.
|
||||
@@ -31,8 +31,7 @@ li{margin:.25rem 0}
|
||||
<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>
|
||||
<p>The desktop and raylib project tests run separately with <code>make desktop-project-test</code> and <code>make raylib-project-test</code>; they must use a private Xvfb display. CI runs both on every push in their own job. The Canvas2D project test runs in <code>make test</code> and launches only private headless Chromium.</p>
|
||||
</body></html>
|
||||
@@ -24,10 +24,9 @@ for a target; it does not prove that every native host runs on that target.
|
||||
| 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.
|
||||
private Xvfb display. CI runs both on every push in their own job. The Canvas2D
|
||||
project test runs in `make test` and launches only private headless Chromium.
|
||||
@@ -47,7 +47,7 @@ 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`.
|
||||
`FrameInputField` converts text and composition into a `TextField.Input`.
|
||||
Applications explicitly use the recorded viewport and elapsed time rather
|
||||
than reading wall time. Clipboard reads use the recorded input and clipboard
|
||||
writes appear in the JSON. Rich traces produce format version 2; legacy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# CUI input components
|
||||
# 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`;
|
||||
These six Ziran components cover the selected modern input families without an
|
||||
external compatibility layer. Each render entry is `(Session, Props, *State) -> Result`;
|
||||
each `Apply` function has the same behavior without requiring a building frame.
|
||||
Caller-owned state is plain fixed-size data, including text bytes, so it can be
|
||||
copied or serialized. No component owns global text, focus, clipboard, or
|
||||
@@ -26,7 +26,7 @@ TagInputApply :: (state: *TagInputState,
|
||||
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
|
||||
Commit text on Enter or `TextField.Input.commit`. A nonempty separator also
|
||||
splits committed and pasted text. Spaces can be trimmed, duplicates rejected,
|
||||
and a positive `max_tags` enforced. Backspace on an empty field requests removal
|
||||
of the final tag through `field.backspace_on_empty`; explicit removal is by
|
||||
@@ -133,16 +133,3 @@ 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
|
||||
```
|
||||
@@ -0,0 +1,21 @@
|
||||
# Overlays
|
||||
|
||||
The six overlay families are retained Ziran widgets with caller-owned state and deterministic results. `Apply` functions are pure state transitions suitable to component hosting; widget functions take a `Session`, explicit props and a caller-owned state pointer, then submit popup/modal tree nodes and paint effects. No family owns process-global UI state.
|
||||
|
||||
## Composition
|
||||
|
||||
- `Tooltip(session, props, state)` and `TooltipApply(state, props)` implement hover/focus delay, warm replay, touch/press suppression, truncation-only mode, placement fitting, flipping, clamping and ellipsis text.
|
||||
- `Sheet(session, props, state)` and `SheetApply(state, props)` implement all four sides, clamped min/max size, safe-area insets, scrim/Escape/drag close, deterministic motion and focus wrap/return.
|
||||
- `CommandPalette(session, props, state)` and `CommandPaletteApply(state, props)` implement fuzzy prefix/run/word scoring, stable command order, contiguous group starts, text editing, Up/Down/Enter/Escape, pointer activation and explicit owner takeover.
|
||||
- `HoverCard(session, props, state)` and `HoverCardApply(state, props)` implement open delay, movement tolerance, content grace, interactive action dispatch, focus paths and placement fitting.
|
||||
- `ConfirmPopover(session, props, state)` and `ConfirmPopoverApply(state, props)` implement danger styling, initial confirm focus, Enter/Space confirm, Escape/cancel, outside close and trigger focus return.
|
||||
- `GuidedTour(session, props, state)` and `GuidedTourApply(state, props)` implement target geometry, padded highlight hole, four-band scrim, card fitting, count formatting, Back/Next/Done/Skip and three-focus wrap.
|
||||
|
||||
Each `*StateFor` constructor returns an isolated, serializable state value. Results identify nodes, geometry, interaction outcome and state change; callers supply `now_ms` and retain ownership. Empty `id`, `class_name`, key and action values follow the explicit prop values, while nonpositive geometry/delay fallbacks use the documented defaults in the matching `*_props.zi` module.
|
||||
|
||||
## Styles and semantics
|
||||
|
||||
Every family has typed `StyleData` props with installed selector facts for kind, ID, class, role, state and popup/modal/guide style kind. Caller styles merge over theme/selector values with `MergeValues`; state overrides resolve through `StyleStates`. Light and dark defaults come from `CurrentTheme`, and motion honors duration, multiplier and reduced-motion fields.
|
||||
|
||||
Tree nodes carry style ID/class facts plus interactive, popup, semantic kind, heading and label metadata. Paint uses the real queued raster API; no mock painter or parallel styling protocol exists.
|
||||
|
||||
@@ -20,7 +20,7 @@ kryon run # the default profile; kryon run tui picks another
|
||||
| `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` |
|
||||
| `web` | page: headings, paragraphs, links, a button | `web` (Canvas2D), `desktop` |
|
||||
|
||||
Each template's `src/layout.zi` stacks rows in pixels in a window or browser
|
||||
and in character cells on the terminal host, so one `Frame` serves every
|
||||
@@ -70,18 +70,19 @@ 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:
|
||||
has a window. The app imports the small `kryon/app` runner and only the named
|
||||
widget packages it uses:
|
||||
|
||||
```zi
|
||||
using UI :: #import "Widgets";
|
||||
App :: #import "kryon/app";
|
||||
Text :: #import "kryon/text";
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
text: TextProps
|
||||
text.text = "Hello, Kryon"
|
||||
Text(session, text)
|
||||
return 0
|
||||
main :: () -> s32 {
|
||||
return App.Run(App.Window.{.title="Hello", .width=320, .height=160}, Draw)
|
||||
}
|
||||
|
||||
Draw :: (frame: App.Frame) {
|
||||
Text.Draw(frame, Text.Props.{.text="Hello, world!", .size=32})
|
||||
}
|
||||
```
|
||||
|
||||
@@ -95,7 +96,7 @@ packages: add `https://github.com/kryonlabs/css.git`,
|
||||
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.
|
||||
named imports such as `kryon/text` work in Canvas builds too.
|
||||
|
||||
From the app directory, run:
|
||||
|
||||
@@ -178,7 +179,7 @@ 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
|
||||
`raylib`, `canvas`, `pixmap`, and `android`. Set `default_profile` under `[tool.kryon]` when there
|
||||
are several profiles. `--profile NAME` selects another. `run` asks for a
|
||||
profile when there are several, none is specified, and it runs in a
|
||||
terminal; otherwise it uses the default.
|
||||
@@ -189,7 +190,6 @@ terminal; otherwise it uses the default.
|
||||
| `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) |
|
||||
|
||||
@@ -384,13 +384,13 @@ All four project templates include this profile.
|
||||
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.
|
||||
The player needs SDL2, Cairo and FreeType. `kryon run app.zx` forwards to the
|
||||
same Ziran runner.
|
||||
For a custom install prefix, add its `share/ziran/hosts` directory to
|
||||
`ZIRAN_HOST_PATH` or its `share` directory to `XDG_DATA_DIRS`.
|
||||
|
||||
`assets` is an optional project-relative directory or file, embedded under that
|
||||
same path. Images retain their ordinary `ImageProps.asset_path` values. The
|
||||
same path. Images retain their ordinary `Image.Props.asset_path` values. The
|
||||
player extracts validated resources into a private temporary directory and
|
||||
removes it when the app exits. Exports rebuild resource content on every build,
|
||||
including file removals. A `pixmap` profile also accepts `codegen = "zx"` and
|
||||
@@ -513,7 +513,7 @@ 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
|
||||
Canvas projects resolve package-qualified hosts and bind the selected
|
||||
source through the shared frame capability. Their generator also roots
|
||||
`canvas_raster.zi` and lowers every saved module, preserving raster adapters
|
||||
and browser callbacks. Native profiles select the package-qualified host
|
||||
@@ -536,9 +536,7 @@ 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
|
||||
builds a real Canvas2D project and loads it in private headless Chromium. Do
|
||||
not run graphical tests on the developer's live display.
|
||||
|
||||
### Application-owned hosts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Theme customization
|
||||
|
||||
Kryon uses one modern CUI-inspired style. Light and dark are color modes of
|
||||
Kryon uses one modern style. Light and dark are color modes of
|
||||
that style; applications do not need a style-pack registry or selector.
|
||||
|
||||
Import `kryon/Theme` for theme tokens. `InstallDefaultTheme(dark)` installs
|
||||
|
||||
@@ -7,10 +7,8 @@ small browser effect libraries. The Ziran host implementation remains in
|
||||
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.
|
||||
The browser profile generates from the selected host plus the Canvas raster
|
||||
adapter and without entry pruning. This is not a revival of the removed `.kry` compiler.
|
||||
|
||||
Kryon has no separate JavaScript widget runtime or source-language compiler.
|
||||
The files above are the current web support documentation.
|
||||
@@ -64,9 +64,15 @@ Only this host's event listeners and resize observer are removed on close.
|
||||
A subsequent open creates new input and texture state; cached default font
|
||||
memory is released before closing the canvas.
|
||||
|
||||
A `#canvas` that carries the `data-transparent` attribute has no background:
|
||||
the host clears the window and each frame to alpha 0 instead of Kryon's frame
|
||||
colour, so the page behind it shows wherever the program draws nothing, and
|
||||
widgets draw over it as usual. The editor preview sets it; without it every
|
||||
pixel is opaque.
|
||||
|
||||
Applications that handle Escape as navigation can call `CanvasSetExitKey(0)`
|
||||
through `kryon/Canvas` to disable the host's default Escape-to-exit behavior.
|
||||
Other keys remain available through `CanvasPressedKey`.
|
||||
Ordered keys and text remain available through `CanvasInputTake(session)`.
|
||||
|
||||
Custom Canvas hosts can use `BeginRasterClip(bounds)` and
|
||||
`EndRasterClip(saved)` through `kryon/Canvas` to intersect a rendering scope
|
||||
|
||||
@@ -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.
|
||||
@@ -5,21 +5,21 @@ the same themed buttons, keyboard activation and retained pointer capture as
|
||||
other Kryon controls.
|
||||
|
||||
```ziran
|
||||
props: NavigationBarProps
|
||||
props: Navigation.Props
|
||||
props.key = KeyHash("navigation")
|
||||
props.compact = true
|
||||
props.vertical = true
|
||||
props.bounds = Rectangle.{0.0, 0.0, 88.0, 720.0}
|
||||
props.footer_count = 2
|
||||
props.scroll_offset = navigation_scroll
|
||||
result := NavigationBar(session, props, items[:])
|
||||
result := Navigation.Draw(session, props, items[:])
|
||||
navigation_scroll = result.scroll_offset
|
||||
```
|
||||
|
||||
The last `footer_count` items stay at the bottom of a rail or the trailing
|
||||
edge of a dock. Other items scroll without covering those actions. Supply
|
||||
stable item keys when shortcuts can move. Items carry route IDs, labels,
|
||||
`ImageProps`, optional vector `icon_shape`, selected state and disabled state;
|
||||
`Image.Props`, optional vector `icon_shape`, selected state and disabled state;
|
||||
the application applies `result.clicked_route` to its own routing.
|
||||
|
||||
Set `draggable` to receive `result.drag`, `drag_route` and `drag_bounds` for
|
||||
@@ -28,6 +28,6 @@ shortcut cards. While dragging a card, supply `dragging` and `drag_position`;
|
||||
`-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
|
||||
`Navigation.NavigationBarItem` rules. `class_name` and `item_class_name` let applications
|
||||
customize those faces with their current palette. Compact items use ordinary
|
||||
button hover, focus, press, selection and accessibility behavior.
|
||||
@@ -1,2 +1,2 @@
|
||||
<!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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Apps and showcase — Kryon</title><meta name="description" content="Kryon Labs applications are public, open-source Ziran and Kryon projects with links to their GitHub repositories."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -36,14 +36,3 @@ app and module catalogs, responsive navigation, themes, keyboard focus,
|
||||
legacy routes, and real editor compilation, including rotated text. To retain
|
||||
review images, run `build-queue -- python3 tests/site_browser_test.py
|
||||
--screenshots backup/labs-site/verification` after confirming `backup/` is ignored.
|
||||
|
||||
From the Kryon repository root, `node tests/demo_browser.mjs` starts a local
|
||||
server and private Xvfb/Chromium display. It checks real compilation, rendered
|
||||
pixels, persistent button state, error recovery, source escaping, cancellation,
|
||||
view switching, reset, responsive layout, and lazy loading in embeds. Its
|
||||
screenshots and logs live in `build/scratch/web-preview/`.
|
||||
Pass a deployed editor URL to run the same checks against a live site:
|
||||
|
||||
```sh
|
||||
node tests/demo_browser.mjs https://kryonlabs.com/demo.html
|
||||
```
|
||||
@@ -1,7 +1,11 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/input_protocol"
|
||||
#import "kryon/session"
|
||||
#import "kryon/tree"
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/tree_draw"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/cursor"
|
||||
GuestTheme :: #import "kryon/Theme";
|
||||
#import "app"
|
||||
#import "preview_protocol"
|
||||
@@ -46,7 +50,7 @@ Tick :: () -> s32 {
|
||||
if BeginFrame(preview_session, cast(u64)1, viewport) != FrameStatus.FrameOk { return 1 }
|
||||
height := viewport.height
|
||||
if height < 520.0 { height = 520.0 }
|
||||
scroll := Scroll(preview_session, ScrollProps.{.key = 190000001, .bounds = viewport,
|
||||
scroll := Scroll.Draw(preview_session, Scroll.Props.{.key = 190000001, .bounds = viewport,
|
||||
.content_height = cast(s32)height, .scroll_offset = preview_scroll})
|
||||
preview_scroll = scroll.scroll_offset
|
||||
if Frame(preview_session, scroll.content) != 0 { return 1 }
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
#import "kryon/control_props"
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/style_sheet"
|
||||
preview_theme: s32;
|
||||
preview_installed_theme: s32 = -1;
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Docs — Kryon</title><meta name="description" content="Kryon ownership, public surface, local commands and integration boundaries."><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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Docs — Kryon</title><meta name="description" content="Kryon ownership, public surface, local commands and integration boundaries."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Getting started — Kryon</title><meta name="description" content="Add Kryon to a Ziran project, import widgets, and run the maintained local tests."><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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Getting started — Kryon</title><meta name="description" content="Add Kryon to a Ziran project, import widgets, and run the maintained local tests."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Kryon — Ziran UI system</title><meta name="description" content="Kryon is a reusable Ziran UI library with source-driven controls, charts, overlays and data views."><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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Kryon — Ziran UI system</title><meta name="description" content="Kryon is a reusable Ziran UI library with source-driven controls, charts, overlays and data views."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Modules — Kryon</title><meta name="description" content="The maintained gallery currently builds Kryon widgets, Plot charts, DataViews controls, focused inputs and overlays."><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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Modules — Kryon</title><meta name="description" content="The maintained gallery currently builds Kryon widgets, Plot charts, DataViews controls, focused inputs and overlays."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -1,2 +1,2 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Platforms — Kryon</title><meta name="description" content="Kryon runs through Ziran desktop and Canvas hosts; support varies by backend and target."><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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Platforms — Kryon</title><meta name="description" content="Kryon runs through Ziran desktop and Canvas hosts; support varies by backend and target."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -0,0 +1,92 @@
|
||||
Geist Sans and Geist Mono Font
|
||||
(C) 2023 Vercel, made in collaboration with basement.studio
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is available with a FAQ at: http://scripts.sil.org/OFL and copied below
|
||||
|
||||
-----------------------------------------------------------
|
||||
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 AND 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.
|
||||
@@ -0,0 +1,92 @@
|
||||
Copyright (c) 2016-2018 The Inter Project Authors ([email protected])
|
||||
|
||||
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 AND 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.
|
||||
|
After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 259 KiB |
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 16 KiB |
@@ -1 +1 @@
|
||||
[["/kryon-font.ttf", "runtime/asset-0.bin"], ["/assets/alpine-lake.webp", "runtime/asset-1.bin"], ["/assets/coastal-cliffs.webp", "runtime/asset-2.bin"], ["/assets/fonts/Geist-Medium.ttf", "runtime/asset-3.bin"], ["/assets/fonts/GeistMono-Regular.ttf", "runtime/asset-4.bin"], ["/assets/fonts/Inter-Regular.ttf", "runtime/asset-5.bin"], ["/assets/fonts/LICENSE-Geist.txt", "runtime/asset-6.bin"], ["/assets/fonts/LICENSE-Inter.txt", "runtime/asset-7.bin"], ["/assets/pfp.webp", "runtime/asset-8.bin"]]
|
||||
[["/kryon-font.ttf", "runtime/asset-0.bin"], ["/assets/alpine-lake.webp", "runtime/asset-1.bin"], ["/assets/apps/browser.webp", "runtime/asset-2.bin"], ["/assets/apps/explorer.webp", "runtime/asset-3.bin"], ["/assets/apps/github.webp", "runtime/asset-4.bin"], ["/assets/apps/terminal.webp", "runtime/asset-5.bin"], ["/assets/coastal-cliffs.webp", "runtime/asset-6.bin"], ["/assets/fonts/Geist-Medium.ttf", "runtime/asset-7.bin"], ["/assets/fonts/GeistMono-Regular.ttf", "runtime/asset-8.bin"], ["/assets/fonts/Inter-Regular.ttf", "runtime/asset-9.bin"], ["/assets/fonts/LICENSE-Geist.txt", "runtime/asset-10.bin"], ["/assets/fonts/LICENSE-Inter.txt", "runtime/asset-11.bin"], ["/assets/pfp.webp", "runtime/asset-12.bin"]]
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"updatedAt": "2026-11-05",
|
||||
"updatedAt": "2026-11-12",
|
||||
"source": "https://github.com/kryonlabs/showcase/tree/master/projects",
|
||||
"starPlatforms": [
|
||||
"github"
|
||||
@@ -52,24 +52,24 @@
|
||||
"rank": 2
|
||||
},
|
||||
{
|
||||
"slug": "shelf",
|
||||
"name": "Shelf",
|
||||
"summary": "File explorer for Rill and Taiji OS that also runs as a standalone desktop app.",
|
||||
"slug": "explorer",
|
||||
"name": "Explorer",
|
||||
"summary": "Native Linux file manager with grid, list, compact and split views, image preview and full file operations.",
|
||||
"author": {
|
||||
"name": "KryonLabs",
|
||||
"url": "https://github.com/kryonlabs"
|
||||
},
|
||||
"homepage": "https://github.com/kryonlabs/shelf",
|
||||
"banner": "showcase/shelf-1dcbd10eaaa0.png",
|
||||
"bannerAlt": "Shelf file explorer showcase banner",
|
||||
"homepage": "https://github.com/kryonlabs/explorer",
|
||||
"banner": "showcase/explorer-1dcbd10eaaa0.webp",
|
||||
"bannerAlt": "Explorer file manager showcase banner",
|
||||
"tags": [
|
||||
"files",
|
||||
"desktop",
|
||||
"kryon",
|
||||
"plan9"
|
||||
"file-manager"
|
||||
],
|
||||
"featured": true,
|
||||
"repository": "https://github.com/kryonlabs/shelf",
|
||||
"repository": "https://github.com/kryonlabs/explorer",
|
||||
"stars": 0,
|
||||
"rank": 3
|
||||
},
|
||||
|
||||
|
After Width: | Height: | Size: 22 KiB |
@@ -1,2 +1,2 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Components — Kryon</title><meta name="description" content="Browse real light and dark Ziran component examples with source, APIs, options and status."><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>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Components — Kryon</title><meta name="description" content="Browse real light and dark Ziran component examples with source, APIs, options and status."><link rel="stylesheet" href="current.css?v=2f7ee344c6192e9c"></head><body><input id="kryon-ime" type="text" tabindex="-1" aria-hidden="true" autocomplete="off" autocapitalize="off" spellcheck="false"><div id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Kryon interactive website"></canvas></div><pre id="result" role="status"></pre><noscript>This website runs Ziran through WebAssembly. Enable JavaScript to use the live examples.</noscript><script src="current.js?v=2f7ee344c6192e9c"></script></body></html>
|
||||
@@ -1,108 +1,79 @@
|
||||
.DEFAULT_GOAL := all
|
||||
|
||||
CC ?= cc
|
||||
ZIRAN_DIR ?= $(if $(ZIRAN_ROOT),$(ZIRAN_ROOT),$(shell ziran pkg path ziran))
|
||||
ZIRAN_BIN ?= $(abspath $(ZIRAN_DIR)/build/bin/ziran)
|
||||
ZIRAN_INCLUDE ?= $(abspath $(ZIRAN_DIR)/include)
|
||||
ZIRAN_BIN ?= ziran
|
||||
# Resolve the maintained examples through the ordinary package graph.
|
||||
KRYON_MODULE_ROOTS := $(shell python3 -c 'import tomllib; from pathlib import Path; print(" ".join("../" + root for root in tomllib.loads(Path("../ziran.toml").read_text())["package"]["module_roots"]))')
|
||||
KRYON_MODULE_ARGS := --project --module-path .
|
||||
KRYON_SOURCES := $(foreach root,$(KRYON_MODULE_ROOTS),$(wildcard $(root)/*.zi $(root)/*/module.zi))
|
||||
KRYON_MODULE_ARGS := --project
|
||||
# The demos that the desktop hosts import live in demo/, apart from the
|
||||
# programs here whose names other project modules also use.
|
||||
DEMO_MODULE_ARGS := --module-path demo
|
||||
KRYON_SOURCES := $(shell find ../src/ui ../src/backend -type f -name '*.zi' -print)
|
||||
BUILD_DIR ?= ../build/examples
|
||||
NATIVE_LIB := ../build/ziran/libkryon.a
|
||||
PROGRAMS := hello window
|
||||
NATIVE_PROGRAMS := $(addprefix $(BUILD_DIR)/,$(PROGRAMS))
|
||||
GO_PROGRAMS := $(addsuffix .go.stamp,$(addprefix $(BUILD_DIR)/matrix/,$(PROGRAMS)))
|
||||
WEB_PROGRAMS := $(addsuffix .web.stamp,$(addprefix $(BUILD_DIR)/matrix/,$(PROGRAMS)))
|
||||
ZX_PROGRAMS := $(addsuffix .zx,$(addprefix $(BUILD_DIR)/matrix/,$(PROGRAMS)))
|
||||
|
||||
.PHONY: all test desktop desktop-test desktop-image-test desktop-text-test time-picker time-picker-shots clean
|
||||
all: $(BUILD_DIR)/hello.svg $(BUILD_DIR)/hello.zx
|
||||
|
||||
$(ZIRAN_BIN):
|
||||
$(MAKE) -C $(ZIRAN_DIR) all
|
||||
.PHONY: all test backend-matrix desktop desktop-image-test time-picker time-picker-shots clean
|
||||
all: $(NATIVE_PROGRAMS)
|
||||
|
||||
$(NATIVE_LIB): ../Makefile ../src/ui/modules.txt $(KRYON_SOURCES)
|
||||
$(MAKE) -C .. all
|
||||
|
||||
$(BUILD_DIR)/hello.zx: hello.zi $(KRYON_SOURCES) $(ZIRAN_BIN) ../ziran.toml Makefile
|
||||
$(BUILD_DIR)/image.zx: demo/image_demo.zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)
|
||||
$(ZIRAN_BIN) bundle --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry hello:Frame -o $@ hello.zi
|
||||
|
||||
$(BUILD_DIR)/hello-saved.zx: $(BUILD_DIR)/hello.zx
|
||||
$(ZIRAN_BIN) ir --root . $(KRYON_MODULE_ARGS) \
|
||||
-o $(BUILD_DIR)/ir hello.zi
|
||||
$(ZIRAN_BIN) bundle --root $(BUILD_DIR)/ir \
|
||||
--module-path $(BUILD_DIR)/ir --entry hello:Frame \
|
||||
-o $@ $(BUILD_DIR)/ir/hello.zir
|
||||
cmp $(BUILD_DIR)/hello.zx $@
|
||||
|
||||
$(BUILD_DIR)/image.zx: image_demo.zi $(KRYON_SOURCES) $(ZIRAN_BIN) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)
|
||||
$(ZIRAN_BIN) bundle --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry image_demo:Frame -o $@ image_demo.zi
|
||||
$(ZIRAN_BIN) bundle --root demo $(KRYON_MODULE_ARGS) \
|
||||
--entry image_demo:Frame -o $@ demo/image_demo.zi
|
||||
|
||||
$(BUILD_DIR)/image-saved.zx: $(BUILD_DIR)/image.zx
|
||||
$(ZIRAN_BIN) ir --root . $(KRYON_MODULE_ARGS) \
|
||||
-o $(BUILD_DIR)/image-ir image_demo.zi
|
||||
$(ZIRAN_BIN) ir --root demo $(KRYON_MODULE_ARGS) \
|
||||
-o $(BUILD_DIR)/image-ir demo/image_demo.zi
|
||||
$(ZIRAN_BIN) bundle --root $(BUILD_DIR)/image-ir \
|
||||
--module-path $(BUILD_DIR)/image-ir --entry image_demo:Frame \
|
||||
-o $@ $(BUILD_DIR)/image-ir/image_demo.zir
|
||||
cmp $(BUILD_DIR)/image.zx $@
|
||||
|
||||
$(BUILD_DIR)/text.zx: text_hello.zi $(KRYON_SOURCES) $(ZIRAN_BIN) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)
|
||||
$(ZIRAN_BIN) bundle --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry text_hello:Frame -o $@ text_hello.zi
|
||||
|
||||
$(BUILD_DIR)/text-saved.zx: $(BUILD_DIR)/text.zx
|
||||
$(ZIRAN_BIN) ir --root . $(KRYON_MODULE_ARGS) \
|
||||
-o $(BUILD_DIR)/text-ir text_hello.zi
|
||||
$(ZIRAN_BIN) bundle --root $(BUILD_DIR)/text-ir \
|
||||
--module-path $(BUILD_DIR)/text-ir --entry text_hello:Frame \
|
||||
-o $@ $(BUILD_DIR)/text-ir/text_hello.zir
|
||||
cmp $(BUILD_DIR)/text.zx $@
|
||||
|
||||
$(BUILD_DIR)/hello-native/hello_host.c: hello_host.zi hello.zi $(KRYON_SOURCES) $(ZIRAN_BIN) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/hello-native
|
||||
$(RM) $(BUILD_DIR)/hello-native/*.c $(BUILD_DIR)/hello-native/*.h
|
||||
$(ZIRAN_BIN) build --target=c --root . $(KRYON_MODULE_ARGS) \
|
||||
-o $(BUILD_DIR)/hello-native hello_host.zi
|
||||
|
||||
$(BUILD_DIR)/hello-host: $(BUILD_DIR)/hello-native/hello_host.c Makefile
|
||||
$(CC) -std=c11 -Wall -ffunction-sections -fdata-sections -Wl,--gc-sections \
|
||||
-I$(ZIRAN_INCLUDE) -I$(BUILD_DIR)/hello-native \
|
||||
$(BUILD_DIR)/hello-native/*.c -lm -o $@
|
||||
|
||||
$(BUILD_DIR)/hello.svg: $(BUILD_DIR)/hello-host
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
$(BUILD_DIR)/hello-host > $@
|
||||
|
||||
test: all $(BUILD_DIR)/hello-saved.zx
|
||||
python3 -c 'import xml.etree.ElementTree as ET; root=ET.parse("$(BUILD_DIR)/hello.svg").getroot(); ns="{http://www.w3.org/2000/svg}"; assert root.tag==ns+"svg"; assert [node.text for node in root.iter(ns+"text")]==["Hello, Ziran"]*3+["Clicked!"]; assert len(list(root.iter(ns+"rect")))>=4'
|
||||
|
||||
$(BUILD_DIR)/desktop-hello-native/desktop_hello.c: desktop_hello.zi ../src/backend/desktop_runtime.zi ../src/backend/cairo_raster.zi hello.zi $(KRYON_SOURCES) $(ZIRAN_DIR)/std/c_string.zi $(ZIRAN_BIN) Makefile
|
||||
mkdir -p $(BUILD_DIR)/desktop-hello-native
|
||||
$(RM) $(BUILD_DIR)/desktop-hello-native/*.c $(BUILD_DIR)/desktop-hello-native/*.h
|
||||
$(ZIRAN_BIN) build --target=c --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry desktop_hello:main -o $(BUILD_DIR)/desktop-hello-native desktop_hello.zi
|
||||
|
||||
$(BUILD_DIR)/desktop-image-native/desktop_image.c: desktop_image.zi ../src/backend/desktop_runtime.zi ../src/backend/cairo_raster.zi image_demo.zi $(KRYON_SOURCES) $(ZIRAN_DIR)/std/c_string.zi $(ZIRAN_BIN) Makefile
|
||||
# Kryon's ziran.toml [package] links names the desktop host's system
|
||||
# libraries, so every project C build below links without caller LDLIBS.
|
||||
$(BUILD_DIR)/image-desktop: desktop_image.zi ../src/backend/desktop_runtime.zi ../src/backend/cairo_raster.zi demo/image_demo.zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/desktop-image-native
|
||||
$(RM) $(BUILD_DIR)/desktop-image-native/*.c $(BUILD_DIR)/desktop-image-native/*.h
|
||||
$(ZIRAN_BIN) build --target=c --root . $(KRYON_MODULE_ARGS) \
|
||||
$(ZIRAN_BIN) build --target=c --exe --root . $(KRYON_MODULE_ARGS) $(DEMO_MODULE_ARGS) \
|
||||
--entry desktop_image:main -o $(BUILD_DIR)/desktop-image-native desktop_image.zi
|
||||
cp $(BUILD_DIR)/desktop-image-native/desktop_image $@
|
||||
|
||||
$(BUILD_DIR)/desktop-text-native/desktop_text.c: desktop_text.zi ../src/backend/desktop_runtime.zi ../src/backend/cairo_raster.zi text_hello.zi $(KRYON_SOURCES) $(ZIRAN_DIR)/std/c_string.zi $(ZIRAN_BIN) Makefile
|
||||
mkdir -p $(BUILD_DIR)/desktop-text-native
|
||||
$(RM) $(BUILD_DIR)/desktop-text-native/*.c $(BUILD_DIR)/desktop-text-native/*.h
|
||||
$(ZIRAN_BIN) build --target=c --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry desktop_text:main -o $(BUILD_DIR)/desktop-text-native desktop_text.zi
|
||||
|
||||
$(BUILD_DIR)/desktop-time-picker-native/desktop_time_picker.c: desktop_time_picker.zi time_picker_demo.zi ../src/backend/desktop_runtime.zi ../src/backend/cairo_raster.zi $(KRYON_SOURCES) $(ZIRAN_DIR)/std/c_string.zi $(ZIRAN_BIN) Makefile
|
||||
$(BUILD_DIR)/time-picker-desktop: desktop_time_picker.zi demo/time_picker_demo.zi ../src/backend/desktop_runtime.zi ../src/backend/cairo_raster.zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/desktop-time-picker-native
|
||||
$(RM) $(BUILD_DIR)/desktop-time-picker-native/*.c $(BUILD_DIR)/desktop-time-picker-native/*.h
|
||||
$(ZIRAN_BIN) build --target=c --root . $(KRYON_MODULE_ARGS) \
|
||||
$(ZIRAN_BIN) build --target=c --exe --root . $(KRYON_MODULE_ARGS) $(DEMO_MODULE_ARGS) \
|
||||
--entry desktop_time_picker:main -o $(BUILD_DIR)/desktop-time-picker-native desktop_time_picker.zi
|
||||
cp $(BUILD_DIR)/desktop-time-picker-native/desktop_time_picker $@
|
||||
|
||||
# The desktop host draws with Cairo and Pango and finds fonts with Fontconfig.
|
||||
DESKTOP_LIBS = $(shell pkg-config --libs sdl2 cairo freetype2 pangocairo fontconfig glib-2.0 x11) -lm -lpthread
|
||||
define PROGRAM_RULES
|
||||
$(BUILD_DIR)/$(1): $(1).zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/$(1)-native
|
||||
$(ZIRAN_BIN) build --target=c --exe --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry $(1):main -o $(BUILD_DIR)/$(1)-native $(1).zi
|
||||
cp $(BUILD_DIR)/$(1)-native/$(1) $$@
|
||||
|
||||
$(BUILD_DIR)/matrix/$(1).go.stamp: $(1).zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/matrix/$(1)-go
|
||||
$(ZIRAN_BIN) build --target=go --pkg main --exe --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry $(1):main -o $(BUILD_DIR)/matrix/$(1)-go $(1).zi
|
||||
touch $$@
|
||||
|
||||
$(BUILD_DIR)/matrix/$(1).web.stamp: $(1).zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/matrix/$(1)-web
|
||||
$(ZIRAN_BIN) build --target=c --target-os web --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry $(1):main -o $(BUILD_DIR)/matrix/$(1)-web $(1).zi
|
||||
touch $$@
|
||||
|
||||
$(BUILD_DIR)/matrix/$(1).zx: $(1).zi $(KRYON_SOURCES) ../ziran.toml Makefile
|
||||
mkdir -p $(BUILD_DIR)/matrix
|
||||
$(ZIRAN_BIN) bundle --root . $(KRYON_MODULE_ARGS) \
|
||||
--entry $(1):main -o $$@ $(1).zi
|
||||
endef
|
||||
|
||||
$(foreach program,$(PROGRAMS),$(eval $(call PROGRAM_RULES,$(program))))
|
||||
|
||||
.PHONY: widget-catalog widget-catalog-web
|
||||
widget-catalog:
|
||||
@@ -112,47 +83,17 @@ widget-catalog:
|
||||
widget-catalog-web:
|
||||
python3 ../scripts/build-gallery.py
|
||||
|
||||
$(BUILD_DIR)/hello-desktop: $(BUILD_DIR)/desktop-hello-native/desktop_hello.c Makefile
|
||||
$(CC) -std=c11 -O2 -I$(ZIRAN_INCLUDE) \
|
||||
-I$(BUILD_DIR)/desktop-hello-native \
|
||||
$(BUILD_DIR)/desktop-hello-native/*.c \
|
||||
$(DESKTOP_LIBS) -o $@
|
||||
desktop: $(BUILD_DIR)/hello
|
||||
|
||||
$(BUILD_DIR)/image-desktop: $(BUILD_DIR)/desktop-image-native/desktop_image.c Makefile
|
||||
$(CC) -std=c11 -O2 -I$(ZIRAN_INCLUDE) \
|
||||
-I$(BUILD_DIR)/desktop-image-native \
|
||||
$(BUILD_DIR)/desktop-image-native/*.c \
|
||||
$(DESKTOP_LIBS) -o $@
|
||||
backend-matrix: $(GO_PROGRAMS) $(WEB_PROGRAMS) $(ZX_PROGRAMS)
|
||||
|
||||
$(BUILD_DIR)/text-desktop: $(BUILD_DIR)/desktop-text-native/desktop_text.c Makefile
|
||||
$(CC) -std=c11 -O2 -I$(ZIRAN_INCLUDE) \
|
||||
-I$(BUILD_DIR)/desktop-text-native \
|
||||
$(BUILD_DIR)/desktop-text-native/*.c \
|
||||
$(DESKTOP_LIBS) -o $@
|
||||
|
||||
$(BUILD_DIR)/time-picker-desktop: $(BUILD_DIR)/desktop-time-picker-native/desktop_time_picker.c Makefile
|
||||
$(CC) -std=c11 -O2 -I$(ZIRAN_INCLUDE) \
|
||||
-I$(BUILD_DIR)/desktop-time-picker-native \
|
||||
$(BUILD_DIR)/desktop-time-picker-native/*.c \
|
||||
$(DESKTOP_LIBS) -o $@
|
||||
|
||||
desktop: $(BUILD_DIR)/hello-desktop
|
||||
|
||||
desktop-test: desktop
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
KRYON_CAPTURE_PATH=$(BUILD_DIR)/hello-desktop.png \
|
||||
xvfb-run -a $(BUILD_DIR)/hello-desktop
|
||||
test: all backend-matrix
|
||||
|
||||
desktop-image-test: $(BUILD_DIR)/image-saved.zx $(BUILD_DIR)/image-desktop
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
KRYON_CAPTURE_PATH=$(BUILD_DIR)/image-desktop.png \
|
||||
xvfb-run -a $(BUILD_DIR)/image-desktop
|
||||
|
||||
desktop-text-test: $(BUILD_DIR)/text-saved.zx $(BUILD_DIR)/text-desktop
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY \
|
||||
KRYON_CAPTURE_PATH=$(BUILD_DIR)/text-desktop.png \
|
||||
xvfb-run -a $(BUILD_DIR)/text-desktop
|
||||
|
||||
# The TimePicker example. `make -C examples time-picker` builds it; run
|
||||
# ../build/examples/time-picker-desktop from examples/ to open it.
|
||||
time-picker: $(BUILD_DIR)/time-picker-desktop
|
||||
|
||||
@@ -44,18 +44,25 @@ The desktop host supports `KRYON_CATALOG_SCENE` and `KRYON_CAPTURE_PATH` for
|
||||
repeatable captures. Scrub the inherited display and session environment and
|
||||
use a private `xvfb-run -a` display for all captures and browser checks.
|
||||
|
||||
## Small host probes
|
||||
## Hello world
|
||||
|
||||
The files below exercise custom host contracts and native/portable parity.
|
||||
Their small probe bundles use those test hosts. Use the gallery exports above
|
||||
for complete applications that open in the generic ZX players.
|
||||
`hello.zi` is the complete example: one program with an explicit `main`, one
|
||||
desktop window, and one text label that says `Hello, world!`. It uses named,
|
||||
package-qualified imports so the application boundary stays visible:
|
||||
|
||||
`hello.zi` is a small Ziran application that imports Kryon's ordinary
|
||||
`Button` and pointer modules. It builds a retained tree, handles a press and
|
||||
release, and changes the button label after the click. `hello_host.zi` supplies
|
||||
four raw pointer samples, font measurements, and SVG drawing effects. The
|
||||
application and host are both Ziran source. No window or display server is
|
||||
opened.
|
||||
```zi
|
||||
App :: #import "kryon/app";
|
||||
Text :: #import "kryon/text";
|
||||
|
||||
main :: () -> s32 {
|
||||
window := App.Window.{ .title = "Hello", .width = 320, .height = 160 }
|
||||
return App.Run(window, Draw)
|
||||
}
|
||||
|
||||
Draw :: (frame: App.Frame) {
|
||||
Text.Draw(frame, Text.Props.{ .text = "Hello, world!", .size = 32 })
|
||||
}
|
||||
```
|
||||
|
||||
From the Kryon repository root, with the `ziran` command installed:
|
||||
|
||||
@@ -64,40 +71,20 @@ make -C examples
|
||||
make -C examples test
|
||||
```
|
||||
|
||||
The first command builds `build/examples/hello.zx`, generates and links
|
||||
a native program from the two `.zi` sources, and writes
|
||||
`build/examples/hello.svg`. Open the SVG in an image viewer to see the
|
||||
idle, pressed, released, and clicked frames side by side. The test also bundles
|
||||
the saved `.zir`, verifies that both `.zx` files match, and checks the native
|
||||
host's four-frame click result and SVG content. The portable bundle is built
|
||||
and compared here; its execution is covered by the separate portable runtime
|
||||
tests.
|
||||
Both commands build the native executables at `build/examples/hello` and
|
||||
`build/examples/window`. Run either from `examples/` to open it. `window.zi`
|
||||
is the smallest empty-window program. Neither example contains an image,
|
||||
button, pointer, capture, or test-driver code. Button behavior remains covered
|
||||
by the dedicated button examples and widget regression tests. The `test`
|
||||
target also compiles both programs for Go, C/Web, and portable ZX.
|
||||
|
||||
This example shows the intended application boundary: Ziran compiles only the
|
||||
modules the application imports; Kryon supplies widget decisions; a separate
|
||||
Ziran host supplies raw input, font, and drawing effects. Applications with a
|
||||
window use one of the hosts in [BACKENDS.md](../docs/BACKENDS.md) instead.
|
||||
|
||||
An optional Ziran desktop host links the application with SDL2 and Cairo
|
||||
through declared foreign calls. Build it with `make -C examples desktop`.
|
||||
Run `build/examples/hello-desktop` from `examples/` to interact with its
|
||||
button. Its repeatable four-frame check runs on a private display with
|
||||
`make -C examples desktop-test` and writes
|
||||
`build/examples/hello-desktop.png` without contacting the current
|
||||
desktop display. `make -C examples desktop-image-test` renders the canonical
|
||||
`Image(ImageProps)` with a path-backed PNG and red tint, then writes
|
||||
`make -C examples desktop-image-test` renders the canonical
|
||||
`Image.Draw(Image.Props)` with a path-backed PNG and red tint, then writes
|
||||
`build/examples/image-desktop.png`. The host imports Ziran's generic
|
||||
`c_string` module for safe C string arguments. It handles shapes, text, and
|
||||
path-backed PNG images. Texture handles and other image formats remain open.
|
||||
|
||||
`make -C examples desktop-text-test` renders the plain `Text(TextProps)`
|
||||
example under a private display and saves
|
||||
`build/examples/text-desktop.png`. It also checks that source and saved
|
||||
`.zir` produce the same portable `text.zx`. Run
|
||||
`../build/examples/text-desktop` from `examples/` to open the interactive
|
||||
window, or open `examples/text_hello.zi` in an editor to see its Ziran source.
|
||||
|
||||
`make -C examples time-picker` builds `time_picker_demo.zi`, Kryon's
|
||||
`make -C examples time-picker` builds `demo/time_picker_demo.zi`, Kryon's
|
||||
`TimePicker` without a time, with one, disabled and in a small form, with a
|
||||
Light and Dark switch. Run `../build/examples/time-picker-desktop` from
|
||||
`examples/` to try it with the mouse, touch and keyboard.
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Modal :: #import "kryon/modal";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/control_props"
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -41,18 +46,18 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ActionModal", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ActionModal", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
actions: [2]ActionModalAction
|
||||
actions: [2]Modal.ActionModalAction
|
||||
actions[0].label = "Cancel"; actions[1].label = "Save"; actions[1].tone = ButtonTone.ButtonToneAccent; actions[1].disabled = disabled
|
||||
if !dismissed {
|
||||
answer := ActionModal(session, ActionModalProps.{.title = "Save changes?", .message = "Keep your latest ideas for next time.", .max_width = 420}, actions[:])
|
||||
answer := Modal.ActionModal(session, Modal.ActionModalProps.{.title = "Save changes?", .message = "Keep your latest ideas for next time.", .max_width = 420}, actions[:])
|
||||
if answer.action != 0 { dismissed = true; clicks += 1 }
|
||||
} else {
|
||||
if Button(session, ButtonProps.{.bounds = b, .label = "Open dialog again"}) == 1 { dismissed = false }
|
||||
if Button.Draw(session, Button.Props.{.bounds = b, .label = "Open dialog again"}) == 1 { dismissed = false }
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Alert :: #import "kryon/alert";
|
||||
Button :: #import "kryon/button";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
|
||||
state: AlertState;
|
||||
state: Alert.AlertState;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Alert", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Alert", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
Alert(session, AlertProps.{.disabled = example_disabled, .key = 10, .bounds = bounds, .title = "Changes saved", .description = "Your settings are up to date.", .dismissible = true}, *state)
|
||||
if Button(session, ButtonProps.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 200.0, 160.0, 40.0}, .label = "Show alert"}) != 0 { state.dismissed = false }
|
||||
Alert.Draw(session, Alert.Props.{.disabled = example_disabled, .key = 10, .bounds = bounds, .title = "Changes saved", .description = "Your settings are up to date.", .dismissible = true}, *state)
|
||||
if Button.Draw(session, Button.Props.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 200.0, 160.0, 40.0}, .label = "Show alert"}) != 0 { state.dismissed = false }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Avatar :: #import "kryon/avatar";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Avatar", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Avatar", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
Avatar(session, AvatarProps.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 72.0, 72.0}, .name = "Ada Lovelace", .size = 72.0})
|
||||
Avatar(session, AvatarProps.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x + 90.0, bounds.y, 72.0, 72.0}, .name = "Grace Hopper", .size = 72.0, .square = true})
|
||||
Avatar.Draw(session, Avatar.Props.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 72.0, 72.0}, .name = "Ada Lovelace", .size = 72.0})
|
||||
Avatar.Draw(session, Avatar.Props.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x + 90.0, bounds.y, 72.0, 72.0}, .name = "Grace Hopper", .size = 72.0, .square = true})
|
||||
names := string.["Ada Lovelace", "Grace Hopper", "Katherine Johnson", "Alan Turing"]
|
||||
AvatarGroup(session, AvatarGroupProps.{.key = 12, .bounds = .{bounds.x, bounds.y + 100.0, bounds.width, 56.0}, .size = 48.0, .max_visible = 3}, names[:])
|
||||
Avatar.AvatarGroup(session, Avatar.AvatarGroupProps.{.key = 12, .bounds = .{bounds.x, bounds.y + 100.0, bounds.width, 56.0}, .size = 48.0, .max_visible = 3}, names[:])
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Badge :: #import "kryon/badge";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Badge", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Badge", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
for i: cast(s32)0..4 {
|
||||
Badge(session, BadgeProps.{.disabled = example_disabled, .key = cast(u64)(10 + i), .bounds = .{bounds.x, bounds.y + cast(float32)i * 48.0, 140.0, 36.0}, .text = "Ready", .tone = cast(BadgeTone)i, .dot = true, .solid = i % 2 == 0})
|
||||
Badge.Draw(session, Badge.Props.{.disabled = example_disabled, .key = cast(u64)(10 + i), .bounds = .{bounds.x, bounds.y + cast(float32)i * 48.0, 140.0, 36.0}, .text = "Ready", .tone = cast(Badge.BadgeTone)i, .dot = true, .solid = i % 2 == 0})
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/control_props"
|
||||
#import "kryon/drawing_props"
|
||||
Plot :: #import "plot/PlotWidget";
|
||||
Charts :: #import "plot/Plot";
|
||||
Theme :: #import "kryon/theme";
|
||||
@@ -68,8 +71,8 @@ Prepare :: (session: Session, scene: s32) {
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "BandChart", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "BandChart", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 5
|
||||
InstallStyles(example_input.theme == 2)
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Banner :: #import "kryon/banner";
|
||||
Button :: #import "kryon/button";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
DemoTheme :: #import "kryon/Theme";
|
||||
|
||||
state: BannerState;
|
||||
state: Banner.BannerState;
|
||||
initialized: bool;
|
||||
requested: bool;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Banner", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Banner", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
input := CaptureFrameInput(session)
|
||||
now := cast(float64)input.elapsed_ms / 1000.0
|
||||
if !initialized { state = BannerStateFor(true); initialized = true }
|
||||
BannerAdvance(*state, cast(float32)input.delta_ms / 1000.0, (example_reduced_motion || DemoTheme.CurrentTheme().motion.reduced_motion))
|
||||
result := Banner(session, BannerProps.{.disabled = example_disabled, .key = 10, .bounds = bounds, .text = "A new version is available.", .action = "Update", .dismissible = true}, *state)
|
||||
if !initialized { state = Banner.BannerStateFor(true); initialized = true }
|
||||
Banner.BannerAdvance(*state, cast(float32)input.delta_ms / 1000.0, (example_reduced_motion || DemoTheme.CurrentTheme().motion.reduced_motion))
|
||||
result := Banner.Draw(session, Banner.Props.{.disabled = example_disabled, .key = 10, .bounds = bounds, .text = "A new version is available.", .action = "Update", .dismissible = true}, *state)
|
||||
if result.action { requested = true; state.open = false }
|
||||
if requested { Text(session, TextProps.{.disabled = example_disabled, .key = 12, .bounds = bounds, .text = "Update requested"}) }
|
||||
if Button(session, ButtonProps.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 200.0, 160.0, 40.0}, .label = "Show banner"}) != 0 { state.open = true; requested = false }
|
||||
if requested { Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 12, .bounds = bounds, .text = "Update requested"}) }
|
||||
if Button.Draw(session, Button.Props.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 200.0, 160.0, 40.0}, .label = "Show banner"}) != 0 { state.open = true; requested = false }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -40,18 +42,18 @@ GalleryBounds :: (bounds: Rectangle) -> Rectangle {
|
||||
}
|
||||
|
||||
Label :: (session: Session, value: string, y: float32 = 76.0) {
|
||||
Text(session, TextProps.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
Text.Draw(session, Text.Props.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
}
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Box", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Box", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
|
||||
unused Box(session, BoxProps.{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 164.0}), .fill = .{235, 244, 245, 255}, .border = .{135, 164, 170, 255}, .radius = 12.0})
|
||||
unused Box.Draw(session, Box.Props.{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 164.0}), .fill = .{235, 244, 245, 255}, .border = .{135, 164, 170, 255}, .radius = 12.0})
|
||||
Label(session, "A surface with rounded edges", 118.0)
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -19,14 +19,6 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/libsdl-org/SDL.git"
|
||||
},
|
||||
{
|
||||
"commit": "123a1b9fe5ed2043a4eb3d3c007e9bd4cebfb95d",
|
||||
"dependencies": {},
|
||||
"id": "p365ce414e38bff9a",
|
||||
"name": "image-codec",
|
||||
"ref": "360553150917f352e49e1beb78917370792ccaef",
|
||||
"url": "https://github.com/ziranlang/image-codec.git"
|
||||
},
|
||||
{
|
||||
"commit": "1844042d1ca751e62e61df7617dba19c98588339",
|
||||
"dependencies": {},
|
||||
@@ -36,15 +28,6 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/webmproject/libwebp.git"
|
||||
},
|
||||
{
|
||||
"commit": "af027a528c6e42b44b68fdaa90b13a7c1136d161",
|
||||
"dependencies": {"audio": "pd258d453b63edc1f", "avif": "p872d871f84f2284f", "image_codec": "p365ce414e38bff9a", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db", "libwebp": "p3b3c785a0e17e605", "raylib": "pcc7aa76725f2fb2f", "sdl3": "p16cd0434af3dff7b", "webp": "pbc4a303a61449a44"},
|
||||
"dependency_refs": {"audio": "f5eed1e6c817997d51508f9c3c7b948a0bb4ad0b", "avif": "f84c162594e518cb306bfd0ce41783ad55b6c730", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339", "raylib": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e", "sdl3": "829a65d769d935c4852f8159e964312c0957260a", "webp": "02145a00a1f0df2a111da04a75f3fef260883897"},
|
||||
"id": "p3cf597cf815203c0",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
},
|
||||
{
|
||||
"commit": "1aadfad932c98c069a1204261b1856f81f3bc199",
|
||||
"dependencies": {},
|
||||
@@ -56,13 +39,21 @@
|
||||
},
|
||||
{
|
||||
"commit": "bd278217e2bac754d868b3d6502eac4257658d4b",
|
||||
"dependencies": {"dav1d": "pb24767b9eb34d961", "image_codec": "p365ce414e38bff9a", "libaom": "p74ab3cb6eb3b86fa"},
|
||||
"dependencies": {"dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa"},
|
||||
"dependency_refs": {"dav1d": "54706fc6bc0cdecab7e9593974a4039cc038fca7", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937"},
|
||||
"id": "p5d7d12505a42f7b3",
|
||||
"name": "av1",
|
||||
"ref": "bd278217e2bac754d868b3d6502eac4257658d4b",
|
||||
"url": "https://github.com/ziranlang/av1.git"
|
||||
},
|
||||
{
|
||||
"commit": "360553150917f352e49e1beb78917370792ccaef",
|
||||
"dependencies": {},
|
||||
"id": "p69c0e968ae5735d9",
|
||||
"name": "image-codec",
|
||||
"ref": "360553150917f352e49e1beb78917370792ccaef",
|
||||
"url": "https://github.com/ziranlang/image-codec.git"
|
||||
},
|
||||
{
|
||||
"commit": "b141d9c45db236335351c8a4b2a14b3ade27c937",
|
||||
"dependencies": {},
|
||||
@@ -74,16 +65,25 @@
|
||||
},
|
||||
{
|
||||
"commit": "f84c162594e518cb306bfd0ce41783ad55b6c730",
|
||||
"dependencies": {"av1": "p5d7d12505a42f7b3", "dav1d": "pb24767b9eb34d961", "image_codec": "p365ce414e38bff9a", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db"},
|
||||
"dependencies": {"av1": "p5d7d12505a42f7b3", "dav1d": "pb24767b9eb34d961", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db"},
|
||||
"dependency_refs": {"av1": "bd278217e2bac754d868b3d6502eac4257658d4b", "dav1d": "54706fc6bc0cdecab7e9593974a4039cc038fca7", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199"},
|
||||
"id": "p872d871f84f2284f",
|
||||
"name": "avif",
|
||||
"ref": "f84c162594e518cb306bfd0ce41783ad55b6c730",
|
||||
"url": "https://github.com/ziranlang/avif.git"
|
||||
},
|
||||
{
|
||||
"commit": "02145a00a1f0df2a111da04a75f3fef260883897",
|
||||
"dependencies": {"image_codec": "p69c0e968ae5735d9", "libwebp": "p3b3c785a0e17e605"},
|
||||
"dependency_refs": {"image_codec": "360553150917f352e49e1beb78917370792ccaef", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339"},
|
||||
"id": "pa068bd09450b2a80",
|
||||
"name": "webp",
|
||||
"ref": "02145a00a1f0df2a111da04a75f3fef260883897",
|
||||
"url": "https://github.com/ziranlang/webp.git"
|
||||
},
|
||||
{
|
||||
"commit": "3f888653b6b97010163d824c4cc72476be3214f3",
|
||||
"dependencies": {"kryon": "p3cf597cf815203c0"},
|
||||
"dependencies": {"kryon": "pf9c1f08949b64182"},
|
||||
"dependency_refs": {"kryon": "master"},
|
||||
"id": "pab5377a2950368a2",
|
||||
"name": "plot",
|
||||
@@ -99,18 +99,9 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/videolan/dav1d.git"
|
||||
},
|
||||
{
|
||||
"commit": "570ada03428260435541e7474d4a36afcefccfd6",
|
||||
"dependencies": {"image_codec": "p365ce414e38bff9a", "libwebp": "p3b3c785a0e17e605"},
|
||||
"dependency_refs": {"image_codec": "360553150917f352e49e1beb78917370792ccaef", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339"},
|
||||
"id": "pbc4a303a61449a44",
|
||||
"name": "webp",
|
||||
"ref": "02145a00a1f0df2a111da04a75f3fef260883897",
|
||||
"url": "https://github.com/ziranlang/webp.git"
|
||||
},
|
||||
{
|
||||
"commit": "942fea7809063407e2b4fa9611a2247ab6b3b894",
|
||||
"dependencies": {"kryon": "p3cf597cf815203c0"},
|
||||
"dependencies": {"kryon": "pf9c1f08949b64182"},
|
||||
"dependency_refs": {"kryon": "master"},
|
||||
"id": "pc4c837bf2ac33dfb",
|
||||
"name": "DataViews",
|
||||
@@ -143,16 +134,25 @@
|
||||
"ref": "ddbe48383984d56acd9e1ab6a090c54ca6b735a6",
|
||||
"source": true,
|
||||
"url": "https://github.com/xiph/opus.git"
|
||||
},
|
||||
{
|
||||
"commit": "0fbdc938841475589d21384e441087ca98e2cc11",
|
||||
"dependencies": {"audio": "pd258d453b63edc1f", "avif": "p872d871f84f2284f", "image_codec": "p69c0e968ae5735d9", "libaom": "p74ab3cb6eb3b86fa", "libavif": "p57c0272208aae8db", "libwebp": "p3b3c785a0e17e605", "raylib": "pcc7aa76725f2fb2f", "sdl3": "p16cd0434af3dff7b", "webp": "pa068bd09450b2a80"},
|
||||
"dependency_refs": {"audio": "f5eed1e6c817997d51508f9c3c7b948a0bb4ad0b", "avif": "f84c162594e518cb306bfd0ce41783ad55b6c730", "image_codec": "360553150917f352e49e1beb78917370792ccaef", "libaom": "b141d9c45db236335351c8a4b2a14b3ade27c937", "libavif": "1aadfad932c98c069a1204261b1856f81f3bc199", "libwebp": "1844042d1ca751e62e61df7617dba19c98588339", "raylib": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e", "sdl3": "829a65d769d935c4852f8159e964312c0957260a", "webp": "02145a00a1f0df2a111da04a75f3fef260883897"},
|
||||
"id": "pf9c1f08949b64182",
|
||||
"name": "kryon",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/kryonlabs/kryon.git"
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"data_views": "pc4c837bf2ac33dfb", "kryon": "p3cf597cf815203c0", "plot": "pab5377a2950368a2"},
|
||||
"dependencies": {"data_views": "pc4c837bf2ac33dfb", "kryon": "pf9c1f08949b64182", "plot": "pab5377a2950368a2"},
|
||||
"dependency_refs": {"data_views": "master", "kryon": "master", "plot": "master"},
|
||||
"name": "box"
|
||||
},
|
||||
"toolchain": {
|
||||
"commit": "d4ef3bb7dd15b5fe715cbdbdd34df8fa6592e3e4",
|
||||
"ref": "1d616e3a1761dd4e4a1c5a960c165d30ba16da29",
|
||||
"commit": "d17c7aa1e093066ef03f307a45f6966dd9b29d4b",
|
||||
"ref": "d17c7aa1e093066ef03f307a45f6966dd9b29d4b",
|
||||
"url": "https://github.com/ziranlang/ziran.git"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@ tool = "kryon"
|
||||
|
||||
[toolchain]
|
||||
git = "https://github.com/ziranlang/ziran.git"
|
||||
ref = "1d616e3a1761dd4e4a1c5a960c165d30ba16da29"
|
||||
# Ziran v0.6.0
|
||||
ref = "d17c7aa1e093066ef03f307a45f6966dd9b29d4b"
|
||||
|
||||
[tool.kryon]
|
||||
default_profile = "desktop"
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Breadcrumb :: #import "kryon/breadcrumb";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
|
||||
active: s32 = 2;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Breadcrumb", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Breadcrumb", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
items := BreadcrumbItem.[.{.key = 11, .label = "Home"}, .{.key = 12, .label = "Projects"}, .{.key = 13, .label = "Kryon"}]
|
||||
result := Breadcrumb(session, BreadcrumbProps.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, 44.0}, .active_index = active}, items[:])
|
||||
items := Breadcrumb.BreadcrumbItem.[.{.key = 11, .label = "Home"}, .{.key = 12, .label = "Projects"}, .{.key = 13, .label = "Kryon"}]
|
||||
result := Breadcrumb.Draw(session, Breadcrumb.Props.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, 44.0}, .active_index = active}, items[:])
|
||||
if result.changed { active = result.activated_index }
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Button :: #import "kryon/button";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/control_props"
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "std/number_text"
|
||||
|
||||
clicks: s32;
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1,
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1,
|
||||
.bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0},
|
||||
.text = "Button", .font = 28})
|
||||
.text = "Button", .size = 28})
|
||||
width := (viewport.width - 52.0) * 0.5
|
||||
for tone: cast(s32)0..3 {
|
||||
for emphasis: cast(s32)0..2 {
|
||||
index := tone * 3 + emphasis
|
||||
if Button(session, ButtonProps.{.disabled = example_disabled, .key = cast(u64)(10 + index),
|
||||
if Button.Draw(session, Button.Props.{.disabled = example_disabled, .key = cast(u64)(10 + index),
|
||||
.bounds = .{viewport.x + 20.0 + cast(float32)(index % 2) * (width + 12.0),
|
||||
viewport.y + 72.0 + cast(float32)(index / 2) * 56.0, width, 44.0},
|
||||
.label = "Continue", .tone = cast(ButtonTone)tone,
|
||||
@@ -20,7 +24,7 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
}
|
||||
}
|
||||
digits: [24]u8
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 2,
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 2,
|
||||
.bounds = .{viewport.x + 20.0, viewport.y + 420.0, viewport.width - 40.0, 36.0},
|
||||
.text = FormatInteger(cast(s64)clicks, digits[:])})
|
||||
return 0
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Button :: #import "kryon/button";
|
||||
ButtonGroup :: #import "kryon/button_group";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
|
||||
state: ButtonGroupState;
|
||||
state: ButtonGroup.ButtonGroupState;
|
||||
active: s32;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Button group", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Button group", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
items := ButtonProps.[.{.key = 11, .label = "Left"}, .{.key = 12, .label = "Center"}, .{.key = 13, .label = "Right"}]
|
||||
items := Button.Props.[.{.key = 11, .label = "Left"}, .{.key = 12, .label = "Center"}, .{.key = 13, .label = "Right"}]
|
||||
for index: 0..cast(s32)items.count - 1 { items[index].disabled = example_disabled }
|
||||
result := ButtonGroup(session, ButtonGroupProps.{.key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, 44.0}, .full_width = true}, items[:], *state)
|
||||
result := ButtonGroup.Draw(session, ButtonGroup.Props.{.key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, 44.0}, .full_width = true}, items[:], *state)
|
||||
if result.activated_index >= 0 { active = result.activated_index }
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 14, .bounds = .{bounds.x, bounds.y + 64.0, bounds.width, 36.0}, .text = items[active].label})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 14, .bounds = .{bounds.x, bounds.y + 64.0, bounds.width, 36.0}, .text = items[active].label})
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/control_props"
|
||||
#import "kryon/drawing_props"
|
||||
Plot :: #import "plot/PlotWidget";
|
||||
Charts :: #import "plot/Plot";
|
||||
Theme :: #import "kryon/theme";
|
||||
@@ -70,8 +73,8 @@ Prepare :: (session: Session, scene: s32) {
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "CandleChart", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "CandleChart", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 4
|
||||
InstallStyles(example_input.theme == 2)
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Card :: #import "kryon/card";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -43,16 +46,16 @@ GalleryBounds :: (bounds: Rectangle) -> Rectangle {
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Card", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Card", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
|
||||
variants: [3]CardVariant = .{.CardFilled, .CardElevated, .CardOutlined}
|
||||
variants: [3]Card.CardVariant = .{.CardFilled, .CardElevated, .CardOutlined}
|
||||
for index: cast(s32)0..2 {
|
||||
card_bounds := GalleryBounds(Rectangle.{24.0, 48.0 + cast(float32)index * 82.0, 432.0, 64.0})
|
||||
result := Card(session, CardProps.{.key = cast(u64)(100 + index),
|
||||
result := Card.Draw(session, Card.Props.{.key = cast(u64)(100 + index),
|
||||
.bounds = card_bounds, .variant = variants[index]})
|
||||
Text(session, TextProps.{.bounds = result.content,
|
||||
Text.Draw(session, Text.Props.{.bounds = result.content,
|
||||
.text = ifx index == 0 then "Filled card" else ifx index == 1 then "Elevated card" else "Outlined card"})
|
||||
}
|
||||
return 0
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Carousel :: #import "kryon/carousel";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
|
||||
state: CarouselState;
|
||||
state: Carousel.CarouselState;
|
||||
opened: s32 = -1;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Carousel", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Carousel", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
input := CaptureFrameInput(session)
|
||||
now := cast(float64)input.elapsed_ms / 1000.0
|
||||
items := CarouselItem.[.{.label = "Alpine lake", .portrait = "assets/alpine-lake.webp", .landscape = "assets/alpine-lake.webp", .caption = "A quiet morning in the mountains", .action = "Open"}, .{.label = "Coastal cliffs", .portrait = "assets/coastal-cliffs.webp", .landscape = "assets/coastal-cliffs.webp", .caption = "Follow the trail along the ocean", .action = "Create"}]
|
||||
items := Carousel.CarouselItem.[.{.label = "Alpine lake", .portrait = "assets/alpine-lake.webp", .landscape = "assets/alpine-lake.webp", .caption = "A quiet morning in the mountains", .action = "Open"}, .{.label = "Coastal cliffs", .portrait = "assets/coastal-cliffs.webp", .landscape = "assets/coastal-cliffs.webp", .caption = "Follow the trail along the ocean", .action = "Create"}]
|
||||
for index: 0..cast(s32)items.count - 1 { items[index].disabled = example_disabled }
|
||||
if example_reduced_motion { state.position = cast(float32)state.selected }
|
||||
result := Carousel(session, CarouselProps.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, 320.0}, .now = now, .label = "Places to explore", .previous_label = "Previous", .next_label = "Next", .scale = 1.0}, items[:], *state)
|
||||
result := Carousel.Draw(session, Carousel.Props.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, 320.0}, .now = now, .label = "Places to explore", .previous_label = "Previous", .next_label = "Next", .scale = 1.0}, items[:], *state)
|
||||
if result >= 0 { opened = result }
|
||||
if opened >= 0 { Text(session, TextProps.{.disabled = example_disabled, .key = 2, .bounds = .{bounds.x, bounds.y + 336.0, bounds.width, 36.0}, .text = items[opened].label}) }
|
||||
if opened >= 0 { Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 2, .bounds = .{bounds.x, bounds.y + 336.0, bounds.width, 36.0}, .text = items[opened].label}) }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Checkbox :: #import "kryon/checkbox";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -43,14 +46,14 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Checkbox", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Checkbox", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
checked = Checkbox(session, CheckboxProps.{.key = 10, .bounds = b, .label = "Remember my choice", .checked = checked, .disabled = disabled}).checked
|
||||
checked = Checkbox.Draw(session, Checkbox.Props.{.key = 10, .bounds = b, .label = "Remember my choice", .checked = checked, .disabled = disabled}).checked
|
||||
b.y += 64.0
|
||||
reminder = Checkbox(session, CheckboxProps.{.key = 11, .bounds = b, .label = "Use a gentle reminder", .disabled = disabled, .checked = reminder}).checked
|
||||
reminder = Checkbox.Draw(session, Checkbox.Props.{.key = 11, .bounds = b, .label = "Use a gentle reminder", .disabled = disabled, .checked = reminder}).checked
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
OnboardingChecklist :: #import "kryon/onboarding_checklist";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/onboarding_checklist_task"
|
||||
|
||||
done: [3]bool;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Onboarding checklist", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Onboarding checklist", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
tasks := OnboardingChecklistTask.[.{.id = 1, .title = "Create a project", .done = done[0]}, .{.id = 2, .title = "Add a component", .done = done[1]}, .{.id = 3, .title = "Run the app", .done = done[2]}]
|
||||
result := OnboardingChecklist(session, OnboardingChecklistProps.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, viewport.height - 96.0}, .title = "Get started", .tasks = tasks[:]})
|
||||
result := OnboardingChecklist.Draw(session, OnboardingChecklist.Props.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, viewport.height - 96.0}, .title = "Get started", .tasks = tasks[:]})
|
||||
if result.toggled_index >= 0 && result.toggled_index < 3 { done[result.toggled_index] = !done[result.toggled_index] }
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Collapsible :: #import "kryon/collapsible";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/transition"
|
||||
#import "kryon/tree"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -42,10 +47,10 @@ GalleryBounds :: (bounds: Rectangle) -> Rectangle {
|
||||
details: bool = true;
|
||||
|
||||
Label :: (session: Session, value: string, y: float32 = 76.0) {
|
||||
Text(session, TextProps.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
Text.Draw(session, Text.Props.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
}
|
||||
|
||||
no_headers: []CollapsibleHeader;
|
||||
no_headers: []Collapsible.CollapsibleHeader;
|
||||
|
||||
b: Rectangle;
|
||||
example_motion: TransitionMotionState;
|
||||
@@ -54,20 +59,20 @@ example_motion: TransitionMotionState;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Collapsible", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Collapsible", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
now := cast(float64)CaptureFrameInput(session).elapsed_ms / 1000.0
|
||||
|
||||
b.height = 188.0
|
||||
revealed := Collapsible(session, CollapsibleProps.{.key = 1404, .motion = *example_motion, .now = now, .reduced_motion = example_input.reduced_motion, .bounds = b, .label = "More details", .open = details, .has_open = true, .disabled = disabled}, no_headers)
|
||||
revealed := Collapsible.Draw(session, Collapsible.Props.{.key = 1404, .motion = *example_motion, .now = now, .reduced_motion = example_input.reduced_motion, .bounds = b, .label = "More details", .open = details, .has_open = true, .disabled = disabled}, no_headers)
|
||||
details = revealed.open
|
||||
if revealed.content.height > 0.0 {
|
||||
body := Box(session, BoxProps.{.key = 1405, .bounds = revealed.content})
|
||||
body := Box.Draw(session, Box.Props.{.key = 1405, .bounds = revealed.content})
|
||||
TreeSetChildClip(session, body, revealed.content)
|
||||
TreePushScope(session, body)
|
||||
Text(session, TextProps.{.key = 1406, .bounds = .{revealed.content.x + 12.0, revealed.content.y + 12.0, revealed.content.width - 24.0, 60.0}, .text = "The section is open. Click its header to fold it.", .font = 16})
|
||||
Text.Draw(session, Text.Props.{.key = 1406, .bounds = .{revealed.content.x + 12.0, revealed.content.y + 12.0, revealed.content.width - 24.0, 60.0}, .text = "The section is open. Click its header to fold it.", .size = 16})
|
||||
TreePopScope(session)
|
||||
}
|
||||
return 0
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
ColorPicker :: #import "kryon/color_picker";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -39,16 +42,16 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ColorPicker", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ColorPicker", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
b.height = 208.0
|
||||
props: ColorPickerProps
|
||||
props: ColorPicker.Props
|
||||
props.bounds = b; props.label = "Accent"; props.channels = 4; props.disabled = disabled
|
||||
props.values = color
|
||||
color = ColorPicker(session, props).values
|
||||
color = ColorPicker.Draw(session, props).values
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Layout :: #import "kryon/layout";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/control_props"
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/grid_props"
|
||||
#import "kryon/tree"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -45,19 +52,19 @@ clicks: s32;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Column", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Column", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 36
|
||||
|
||||
props: ColumnProps = .{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 208.0}), .gap = 12, .padding = 8}
|
||||
container: LayoutContainer
|
||||
if scene == 36 { container = Column(session, props) }
|
||||
else if scene == 37 { container = Row(session, props) }
|
||||
else if scene == 38 { container = Stack(session, props) }
|
||||
else if scene == 39 { container = Group(session, props) }
|
||||
else if scene == 48 { container = Screen(session, props) }
|
||||
else { grid := Grid(session, GridProps.{.bounds = props.bounds, .columns = 2, .gap = 12, .padding = 8}); container = grid.container }
|
||||
props: Layout.Props = .{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 208.0}), .gap = 12, .padding = 8}
|
||||
container: Layout.LayoutContainer
|
||||
if scene == 36 { container = Layout.Draw(session, props) }
|
||||
else if scene == 37 { container = Layout.Row(session, props) }
|
||||
else if scene == 38 { container = Layout.Stack(session, props) }
|
||||
else if scene == 39 { container = Layout.Group(session, props) }
|
||||
else if scene == 48 { container = Layout.Screen(session, props) }
|
||||
else { grid := Layout.Grid(session, GridProps.{.bounds = props.bounds, .columns = 2, .gap = 12, .padding = 8}); container = grid.container }
|
||||
if container.opened {
|
||||
first: Rectangle = .{0.0, 0.0, ifx gallery_live then 164.0 * gallery_view.width / 480.0 else 164.0, 44.0}
|
||||
second: Rectangle = first
|
||||
@@ -65,8 +72,8 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
first.x = container.content.x; first.y = container.content.y
|
||||
second.x = first.x; second.y = first.y + 60.0
|
||||
} else if scene == 38 { second = GalleryBounds(Rectangle.{104.0, 112.0, 164.0, 44.0}) }
|
||||
if Button(session, ButtonProps.{.label = "First item", .bounds = first, .disabled = disabled}) == 1 { clicks += 1 }
|
||||
if Button(session, ButtonProps.{.label = "Second item", .bounds = second, .tone = ButtonTone.ButtonToneAccent, .disabled = disabled}) == 1 { clicks += 1 }
|
||||
if Button.Draw(session, Button.Props.{.label = "First item", .bounds = first, .disabled = disabled}) == 1 { clicks += 1 }
|
||||
if Button.Draw(session, Button.Props.{.label = "Second item", .bounds = second, .tone = ButtonTone.ButtonToneAccent, .disabled = disabled}) == 1 { clicks += 1 }
|
||||
unused End(session)
|
||||
}
|
||||
return 0
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
#import "kryon/tooltip"
|
||||
#import "kryon/tooltip_props"
|
||||
#import "kryon/sheet"
|
||||
#import "kryon/sheet_props"
|
||||
#import "kryon/command_palette"
|
||||
#import "kryon/command_palette_props"
|
||||
#import "kryon/hover_card"
|
||||
#import "kryon/hover_card_props"
|
||||
#import "kryon/confirm_popover"
|
||||
#import "kryon/confirm_popover_props"
|
||||
#import "kryon/guided_tour"
|
||||
#import "kryon/guided_tour_props"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
CommandPalette :: #import "kryon/command_palette";
|
||||
ConfirmPopover :: #import "kryon/confirm_popover";
|
||||
GuidedTour :: #import "kryon/guided_tour";
|
||||
HoverCard :: #import "kryon/hover_card";
|
||||
Sheet :: #import "kryon/sheet";
|
||||
Text :: #import "kryon/text";
|
||||
Tooltip :: #import "kryon/tooltip";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/input_protocol"
|
||||
#import "kryon/key_input"
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/tooltip_common"
|
||||
|
||||
WidgetContext :: struct { theme: s32; now: float32; disabled: bool; reduced_motion: bool }
|
||||
@@ -54,21 +54,21 @@ viewport: Rectangle;
|
||||
|
||||
anchor: Rectangle;
|
||||
|
||||
tooltip_state: TooltipState;
|
||||
tooltip_state: Tooltip.TooltipState;
|
||||
|
||||
sheet_state: SheetState;
|
||||
sheet_state: Sheet.SheetState;
|
||||
|
||||
palette_state: CommandPaletteState;
|
||||
palette_state: CommandPalette.CommandPaletteState;
|
||||
|
||||
hover_state: HoverCardState;
|
||||
hover_state: HoverCard.HoverCardState;
|
||||
|
||||
confirm_state: ConfirmPopoverState;
|
||||
confirm_state: ConfirmPopover.ConfirmPopoverState;
|
||||
|
||||
tour_state: GuidedTourState;
|
||||
tour_state: GuidedTour.GuidedTourState;
|
||||
|
||||
commands: [3]CommandPaletteCommand;
|
||||
commands: [3]CommandPalette.CommandPaletteCommand;
|
||||
|
||||
tour_steps: [2]GuidedTourStep;
|
||||
tour_steps: [2]GuidedTour.GuidedTourStep;
|
||||
|
||||
palette_open: bool;
|
||||
|
||||
@@ -84,12 +84,12 @@ Prepare :: (session: Session, scene: s32) {
|
||||
viewport = GalleryBounds(Rectangle.{0.0, 0.0, 480.0, 320.0})
|
||||
anchor = GalleryBounds(Rectangle.{38.0, 128.0, 126.0, 34.0})
|
||||
if !overlays_ready {
|
||||
tooltip_state = TooltipStateFor(700)
|
||||
sheet_state = SheetStateFor()
|
||||
palette_state = CommandPaletteStateFor(701)
|
||||
hover_state = HoverCardStateFor()
|
||||
confirm_state = ConfirmPopoverStateFor()
|
||||
tour_state = GuidedTourStateFor(0)
|
||||
tooltip_state = Tooltip.TooltipStateFor(700)
|
||||
sheet_state = Sheet.SheetStateFor()
|
||||
palette_state = CommandPalette.CommandPaletteStateFor(701)
|
||||
hover_state = HoverCard.HoverCardStateFor()
|
||||
confirm_state = ConfirmPopover.ConfirmPopoverStateFor()
|
||||
tour_state = GuidedTour.GuidedTourStateFor(0)
|
||||
commands[0] = .{.title = "Find component", .group = "Search", .shortcut = "Ctrl+F", .action = 11}
|
||||
commands[1] = .{.title = "Format source", .group = "Edit", .shortcut = "Ctrl+Shift+F", .action = 12}
|
||||
commands[2] = .{.title = "Focus outline", .group = "Accessibility", .action = 13}
|
||||
@@ -103,8 +103,8 @@ Prepare :: (session: Session, scene: s32) {
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "CommandPalette", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "CommandPalette", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 2
|
||||
Prepare(session, scene)
|
||||
@@ -123,30 +123,30 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
tour_steps[1].target = GalleryBounds(Rectangle.{168.0, 180.0, 144.0, 42.0})
|
||||
}
|
||||
viewport = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 208.0})
|
||||
if Button(session, ButtonProps.{.key = 719, .bounds = anchor, .label = "Open palette", .disabled = disabled}) != 0 {
|
||||
if Button.Draw(session, Button.Props.{.key = 719, .bounds = anchor, .label = "Open palette", .disabled = disabled}) != 0 {
|
||||
palette_open = true
|
||||
}
|
||||
input_key := KeyboardTake(session)
|
||||
field_input := TextFieldInputFor(input_key, KeyboardModifiers(session), TypedTextTake(session, typed[:]))
|
||||
palette_input: CommandPaletteInput
|
||||
palette_input: CommandPalette.CommandPaletteInput
|
||||
palette_input.activate_index = -1
|
||||
palette_input.text = field_input
|
||||
palette_input.escape = field_input.escape
|
||||
palette_input.enter = field_input.commit
|
||||
palette_input.up = input_key == KeyUp
|
||||
palette_input.down = input_key == KeyDown
|
||||
props: CommandPaletteProps = .{.key = 720, .owner = 701, .open = palette_open,
|
||||
props: CommandPalette.Props = .{.key = 720, .owner = 701, .open = palette_open,
|
||||
.placeholder = "Search commands", .viewport = viewport, .width = 380.0,
|
||||
.maximum_height = 96.0, .now_ms = 500, .commands = commands[:],
|
||||
.input = palette_input,
|
||||
.disabled = disabled, .surface_style = CommandPaletteSurfaceDefaultStyle(),
|
||||
.item_style = CommandPaletteItemDefaultStyle(),
|
||||
.scrim_style = CommandPaletteSurfaceDefaultStyle()}
|
||||
.disabled = disabled, .surface_style = CommandPalette.CommandPaletteSurfaceDefaultStyle(),
|
||||
.item_style = CommandPalette.CommandPaletteItemDefaultStyle(),
|
||||
.scrim_style = CommandPalette.CommandPaletteSurfaceDefaultStyle()}
|
||||
if gallery_live {
|
||||
props.now_ms = cast(s64)(gallery_now * 1000.0)
|
||||
props.surface_style.motion_reduced = gallery_reduced_motion
|
||||
}
|
||||
palette := CommandPalette(session, props, *palette_state)
|
||||
palette := CommandPalette.Draw(session, props, *palette_state)
|
||||
if palette.close_requested || palette.chosen_index >= 0 { palette_open = false }
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
ConfirmButton :: #import "kryon/confirm_button";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
|
||||
state: ConfirmButtonState;
|
||||
state: ConfirmButton.ConfirmButtonState;
|
||||
confirmed: bool;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Confirm button", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Confirm button", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
input := CaptureFrameInput(session)
|
||||
now := cast(float64)input.elapsed_ms / 1000.0
|
||||
result := ConfirmButton(session, ConfirmButtonProps.{.button = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 220.0, 44.0}, .label = "Delete item"}, .confirm_button = .{.disabled = example_disabled, .label = "Confirm delete"}, .now = cast(float32)now, .timeout = 3.0}, *state)
|
||||
result := ConfirmButton.Draw(session, ConfirmButton.Props.{.button = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 220.0, 44.0}, .label = "Delete item"}, .confirm_button = .{.disabled = example_disabled, .label = "Confirm delete"}, .now = cast(float32)now, .timeout = 3.0}, *state)
|
||||
if result.committed { confirmed = true }
|
||||
label := "Ready"
|
||||
if confirmed { label = "Item deleted" }
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 64.0, bounds.width, 36.0}, .text = label})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 64.0, bounds.width, 36.0}, .text = label})
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,19 +2,18 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
#import "kryon/tooltip"
|
||||
#import "kryon/tooltip_props"
|
||||
#import "kryon/sheet"
|
||||
#import "kryon/sheet_props"
|
||||
#import "kryon/command_palette"
|
||||
#import "kryon/command_palette_props"
|
||||
#import "kryon/hover_card"
|
||||
#import "kryon/hover_card_props"
|
||||
#import "kryon/confirm_popover"
|
||||
#import "kryon/confirm_popover_props"
|
||||
#import "kryon/guided_tour"
|
||||
#import "kryon/guided_tour_props"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
CommandPalette :: #import "kryon/command_palette";
|
||||
ConfirmPopover :: #import "kryon/confirm_popover";
|
||||
GuidedTour :: #import "kryon/guided_tour";
|
||||
HoverCard :: #import "kryon/hover_card";
|
||||
Sheet :: #import "kryon/sheet";
|
||||
Text :: #import "kryon/text";
|
||||
Tooltip :: #import "kryon/tooltip";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/input_protocol"
|
||||
#import "kryon/tree_input"
|
||||
#import "kryon/tooltip_common"
|
||||
|
||||
WidgetContext :: struct { theme: s32; now: float32; disabled: bool; reduced_motion: bool }
|
||||
@@ -54,21 +53,21 @@ viewport: Rectangle;
|
||||
|
||||
anchor: Rectangle;
|
||||
|
||||
tooltip_state: TooltipState;
|
||||
tooltip_state: Tooltip.TooltipState;
|
||||
|
||||
sheet_state: SheetState;
|
||||
sheet_state: Sheet.SheetState;
|
||||
|
||||
palette_state: CommandPaletteState;
|
||||
palette_state: CommandPalette.CommandPaletteState;
|
||||
|
||||
hover_state: HoverCardState;
|
||||
hover_state: HoverCard.HoverCardState;
|
||||
|
||||
confirm_state: ConfirmPopoverState;
|
||||
confirm_state: ConfirmPopover.ConfirmPopoverState;
|
||||
|
||||
tour_state: GuidedTourState;
|
||||
tour_state: GuidedTour.GuidedTourState;
|
||||
|
||||
commands: [3]CommandPaletteCommand;
|
||||
commands: [3]CommandPalette.CommandPaletteCommand;
|
||||
|
||||
tour_steps: [2]GuidedTourStep;
|
||||
tour_steps: [2]GuidedTour.GuidedTourStep;
|
||||
|
||||
overlays_ready: bool;
|
||||
|
||||
@@ -82,12 +81,12 @@ Prepare :: (session: Session, scene: s32) {
|
||||
viewport = GalleryBounds(Rectangle.{0.0, 0.0, 480.0, 320.0})
|
||||
anchor = GalleryBounds(Rectangle.{38.0, 128.0, 126.0, 34.0})
|
||||
if !overlays_ready {
|
||||
tooltip_state = TooltipStateFor(700)
|
||||
sheet_state = SheetStateFor()
|
||||
palette_state = CommandPaletteStateFor(701)
|
||||
hover_state = HoverCardStateFor()
|
||||
confirm_state = ConfirmPopoverStateFor()
|
||||
tour_state = GuidedTourStateFor(0)
|
||||
tooltip_state = Tooltip.TooltipStateFor(700)
|
||||
sheet_state = Sheet.SheetStateFor()
|
||||
palette_state = CommandPalette.CommandPaletteStateFor(701)
|
||||
hover_state = HoverCard.HoverCardStateFor()
|
||||
confirm_state = ConfirmPopover.ConfirmPopoverStateFor()
|
||||
tour_state = GuidedTour.GuidedTourStateFor(0)
|
||||
commands[0] = .{.title = "Find component", .group = "Search", .shortcut = "Ctrl+F", .action = 11}
|
||||
commands[1] = .{.title = "Format source", .group = "Edit", .shortcut = "Ctrl+Shift+F", .action = 12}
|
||||
commands[2] = .{.title = "Focus outline", .group = "Accessibility", .action = 13}
|
||||
@@ -101,8 +100,8 @@ Prepare :: (session: Session, scene: s32) {
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ConfirmPopover", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ConfirmPopover", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 4
|
||||
Prepare(session, scene)
|
||||
@@ -120,23 +119,23 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
tour_steps[0].target = GalleryBounds(Rectangle.{168.0, 112.0, 144.0, 42.0})
|
||||
tour_steps[1].target = GalleryBounds(Rectangle.{168.0, 180.0, 144.0, 42.0})
|
||||
}
|
||||
if !gallery_live { Text(session, TextProps.{.key = 740, .bounds = anchor, .text = "Delete source", .font = 17}) }
|
||||
props: ConfirmPopoverProps = .{.key = 741, .title = "Delete source?",
|
||||
if !gallery_live { Text.Draw(session, Text.Props.{.key = 740, .bounds = anchor, .text = "Delete source", .size = 17}) }
|
||||
props: ConfirmPopover.Props = .{.key = 741, .title = "Delete source?",
|
||||
.description = "This action cannot be undone.", .confirm_label = "Delete",
|
||||
.cancel_label = "Cancel", .anchor = anchor, .viewport = viewport,
|
||||
.placement = .OverlayPlaceBottom, .width = 270.0, .gap = 8.0,
|
||||
.danger = true, .open = true, .now_ms = 500, .disabled = disabled,
|
||||
.style = ConfirmPopoverDefaultStyle(),
|
||||
.confirm_style = ConfirmPopoverConfirmDefaultStyle(true),
|
||||
.cancel_style = ConfirmPopoverDefaultStyle()}
|
||||
.style = ConfirmPopover.ConfirmPopoverDefaultStyle(),
|
||||
.confirm_style = ConfirmPopover.ConfirmPopoverConfirmDefaultStyle(true),
|
||||
.cancel_style = ConfirmPopover.ConfirmPopoverDefaultStyle()}
|
||||
props.focus.anchor_focused = true
|
||||
if gallery_live {
|
||||
if Button(session, ButtonProps.{.key = 739, .bounds = anchor, .label = "Delete source", .disabled = disabled}) != 0 { live_confirm_open = true }
|
||||
if Button.Draw(session, Button.Props.{.key = 739, .bounds = anchor, .label = "Delete source", .disabled = disabled}) != 0 { live_confirm_open = true }
|
||||
props.open = live_confirm_open; props.pointer = live_pointer; props.keys = live_keys
|
||||
props.now_ms = cast(s64)(gallery_now * 1000.0)
|
||||
props.style.motion_reduced = gallery_reduced_motion
|
||||
}
|
||||
confirmed := ConfirmPopover(session, props, *confirm_state)
|
||||
confirmed := ConfirmPopover.Draw(session, props, *confirm_state)
|
||||
if gallery_live && (confirmed.closed || confirmed.confirmed || confirmed.cancelled) { live_confirm_open = false }
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
ContextMenu :: #import "kryon/context_menu";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -41,17 +45,17 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ContextMenu", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "ContextMenu", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
items: [3]ContextMenuItem
|
||||
items: [3]ContextMenu.ContextMenuItem
|
||||
items[0].label = "Open"; items[0].id = 1; items[1].label = "Rename"; items[1].id = 2; items[2].label = "Remove"; items[2].id = 3; items[2].disabled = disabled
|
||||
if dismissed {
|
||||
if Button(session, ButtonProps.{.bounds = b, .label = "Open context menu"}) == 1 { dismissed = false }
|
||||
if Button.Draw(session, Button.Props.{.bounds = b, .label = "Open context menu"}) == 1 { dismissed = false }
|
||||
} else {
|
||||
result := ContextMenu(session, ContextMenuProps.{.open = true, .x = b.x, .y = b.y}, items[:])
|
||||
result := ContextMenu.Draw(session, ContextMenu.Props.{.open = true, .x = b.x, .y = b.y}, items[:])
|
||||
if result.closed { dismissed = true }
|
||||
if result.activated_id > 0 { clicks += 1 }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
CopyButton :: #import "kryon/copy_button";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
|
||||
state: CopyButtonState;
|
||||
state: CopyButton.CopyButtonState;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Copy button", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Copy button", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
input := CaptureFrameInput(session)
|
||||
now := cast(float64)input.elapsed_ms / 1000.0
|
||||
CopyButton(session, CopyButtonProps.{.button = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 240.0, 44.0}, .label = "Copy website address"}, .text = "https://github.com/kryonlabs/kryon", .now = cast(float32)now, .success_label = "Copied", .failure_label = "Copy failed"}, *state)
|
||||
CopyButton.Draw(session, CopyButton.Props.{.button = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 240.0, 44.0}, .label = "Copy website address"}, .text = "https://github.com/kryonlabs/kryon", .now = cast(float32)now, .success_label = "Copied", .failure_label = "Copy failed"}, *state)
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Button :: #import "kryon/button";
|
||||
Countdown :: #import "kryon/countdown";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
DemoTheme :: #import "kryon/Theme";
|
||||
|
||||
state: CountdownState;
|
||||
state: Countdown.CountdownState;
|
||||
ends_at: float64;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Countdown", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Countdown", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
input := CaptureFrameInput(session)
|
||||
now := cast(float64)input.elapsed_ms / 1000.0
|
||||
if ends_at == 0.0 { ends_at = now + 90.0 }
|
||||
remaining := ends_at - now
|
||||
if remaining < 0.0 { remaining = 0.0 }
|
||||
CountdownAdvance(*state, CountdownPartsFor(remaining, true), cast(float32)input.delta_ms / 1000.0, (example_reduced_motion || DemoTheme.CurrentTheme().motion.reduced_motion))
|
||||
props: CountdownProps = .{.key = 10, .bounds = bounds, .seconds_left = remaining, .hide_days = true}
|
||||
Countdown(session, props, *state)
|
||||
if Button(session, ButtonProps.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 200.0, 160.0, 40.0}, .label = "Restart"}) != 0 { ends_at = now + 90.0 }
|
||||
Countdown.CountdownAdvance(*state, Countdown.CountdownPartsFor(remaining, true), cast(float32)input.delta_ms / 1000.0, (example_reduced_motion || DemoTheme.CurrentTheme().motion.reduced_motion))
|
||||
props: Countdown.Props = .{.key = 10, .bounds = bounds, .seconds_left = remaining, .hide_days = true}
|
||||
Countdown.Draw(session, props, *state)
|
||||
if Button.Draw(session, Button.Props.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 200.0, 160.0, 40.0}, .label = "Restart"}) != 0 { ends_at = now + 90.0 }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Button :: #import "kryon/button";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "std/number_text"
|
||||
|
||||
count: s32;
|
||||
@@ -7,9 +10,9 @@ count: s32;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
width := viewport.width - 40.0
|
||||
digits: [24]u8
|
||||
Text(session, TextProps.{.key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 20.0, width, 64.0},
|
||||
.text = FormatInteger(cast(s64)count, digits[:]), .font = 40})
|
||||
if Button(session, ButtonProps.{.key = 2, .bounds = .{viewport.x + 20.0, viewport.y + 104.0, width, 44.0},
|
||||
Text.Draw(session, Text.Props.{.key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 20.0, width, 64.0},
|
||||
.text = FormatInteger(cast(s64)count, digits[:]), .size = 40})
|
||||
if Button.Draw(session, Button.Props.{.key = 2, .bounds = .{viewport.x + 20.0, viewport.y + 104.0, width, 44.0},
|
||||
.label = "Increment"}) != 0 { count += 1 }
|
||||
return 0
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
#import "control_props"
|
||||
#import "drawing_props"
|
||||
#import "geometry"
|
||||
#import "image"
|
||||
#import "image_props"
|
||||
Image :: #import "kryon/image";
|
||||
#import "session"
|
||||
#import "style"
|
||||
#import "style_sheet"
|
||||
#import "tree"
|
||||
#import "tree_draw"
|
||||
|
||||
using ImageFit;
|
||||
using Image.ImageFit;
|
||||
using StyleField;
|
||||
using FrameStatus;
|
||||
|
||||
@@ -33,9 +32,9 @@ Frame :: () -> s32 {
|
||||
rules.items[0] = tint
|
||||
InstallStyleRules(rules)
|
||||
BeginFrame(session, cast(u64)1, Rectangle.{0.0, 0.0, 320.0, 160.0})
|
||||
Image(session, ImageProps.{.class_name = 7, .asset_path = "../docs/site/cursors/arrow.png",
|
||||
Image.Draw(session, Image.Props.{.class_name = 7, .asset_path = "../docs/site/cursors/arrow.png",
|
||||
.alt_text = "Arrow", .bounds = Rectangle.{112.0, 32.0, 96.0, 96.0},
|
||||
.fit = cast(ImageFit)ImageFitStretch})
|
||||
.fit = cast(Image.ImageFit)ImageFitStretch})
|
||||
if EndFrame(session) != cast(FrameStatus)FrameOk { return -1 }
|
||||
return TreeCount(session)
|
||||
}
|
||||
@@ -2,9 +2,17 @@
|
||||
// disabled, and in a small form, in light and dark palettes. The picker
|
||||
// keeps its popup, columns and keyboard column itself; this app keeps only
|
||||
// the times. desktop_time_picker.zi runs it in a window.
|
||||
using UI :: #import "Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
SegmentedControl :: #import "kryon/segmented_control";
|
||||
Text :: #import "kryon/text";
|
||||
TimePicker :: #import "kryon/time_picker";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/text_align"
|
||||
#import "system_theme"
|
||||
#import "time_picker"
|
||||
#import "kryon/time_picker"
|
||||
#import "time_picker_behavior"
|
||||
#import "std/number_text"
|
||||
|
||||
// The current time in minutes after midnight, which the host sets each
|
||||
@@ -31,19 +39,19 @@ DemoSetNow :: (minutes: s32) {
|
||||
|
||||
Label :: (session: Session, key: s32, text: string, bounds: Rectangle,
|
||||
font: s32, muted: bool) {
|
||||
Text(session, TextProps.{.key = cast(u64)key, .bounds = bounds, .text = text, .font = font,
|
||||
.disabled = muted, .wrap = TextWrap.TextWrapNone,
|
||||
Text.Draw(session, Text.Props.{.key = cast(u64)key, .bounds = bounds, .text = text, .size = font,
|
||||
.disabled = muted, .wrap = Text.Wrap.TextWrapNone,
|
||||
.vertical_align = TextAlign.TextAlignCenter})
|
||||
}
|
||||
|
||||
Card :: (session: Session, key: s32, bounds: Rectangle) {
|
||||
props: BoxProps
|
||||
props: Box.Props
|
||||
props.key = cast(u64)key
|
||||
props.bounds = bounds
|
||||
props.fill = StyleTokenColor("surface")
|
||||
props.border = StyleTokenColor("border")
|
||||
props.radius = 10.0
|
||||
Box(session, props)
|
||||
Box.Draw(session, props)
|
||||
}
|
||||
|
||||
// Appends text to the buffer at length and returns the new length.
|
||||
@@ -62,7 +70,7 @@ Picker :: (session: Session, key: s32, label: string, row: Rectangle,
|
||||
value: *s32, actions: bool, disabled: bool) {
|
||||
Label(session, key + 1, label, Rectangle.{row.x, row.y, 200.0, row.height},
|
||||
15, false)
|
||||
props: TimePickerProps
|
||||
props: TimePicker.Props
|
||||
props.key = cast(u64)key
|
||||
props.id = key
|
||||
props.label = label
|
||||
@@ -74,7 +82,7 @@ Picker :: (session: Session, key: s32, label: string, row: Rectangle,
|
||||
props.done_label = "Done"
|
||||
}
|
||||
props.disabled = disabled
|
||||
result: TimePickerResult = TimePicker(session, props)
|
||||
result: TimePickerResult = TimePicker.Draw(session, props)
|
||||
if result.changed {
|
||||
value.* = result.value
|
||||
digits: [8]u8
|
||||
@@ -106,26 +114,26 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
unused SystemPaletteInstall(SystemPaletteFallback(dark))
|
||||
installed = want
|
||||
}
|
||||
background: BoxProps
|
||||
background: Box.Props
|
||||
background.key = cast(u64)1
|
||||
background.bounds = viewport
|
||||
background.fill = StyleTokenColor("canvas")
|
||||
Box(session, background)
|
||||
Box.Draw(session, background)
|
||||
|
||||
width: float32 = viewport.width - 48.0
|
||||
if width > 560.0 { width = 560.0 }
|
||||
x: float32 = viewport.x + (viewport.width - width) * 0.5
|
||||
y: float32 = viewport.y + 24.0
|
||||
Label(session, 2, "Time picker", Rectangle.{x, y, 260.0, 36.0}, 26, false)
|
||||
options: [2]SegmentOption
|
||||
options: [2]SegmentedControl.SegmentOption
|
||||
options[0].key = cast(u64)1
|
||||
options[0].label = "Light"
|
||||
options[1].key = cast(u64)2
|
||||
options[1].label = "Dark"
|
||||
theme: SegmentedControlProps = .{.key = cast(u64)3, .id = 3,
|
||||
theme: SegmentedControl.Props = .{.key = cast(u64)3, .id = 3,
|
||||
.bounds = Rectangle.{x + width - 170.0, y + 2.0, 170.0, 0.0}, .has_selection = true,
|
||||
.selected_index = want}
|
||||
switched: SegmentedControlResult = SegmentedControl(session, theme,
|
||||
switched: SegmentedControl.SegmentedControlResult = SegmentedControl.Draw(session, theme,
|
||||
options[:])
|
||||
if switched.changed { dark = switched.selected_index == 1 }
|
||||
y += 48.0
|
||||
@@ -1,37 +0,0 @@
|
||||
#import "cairo_raster"
|
||||
#import "desktop_runtime"
|
||||
#import "hello"
|
||||
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
if !OpenDesktop() {
|
||||
CloseDesktop()
|
||||
return 1
|
||||
}
|
||||
ok: bool = true
|
||||
if CaptureRequested() {
|
||||
ok = CheckPointerEvents()
|
||||
frame: s32 = 0
|
||||
while frame < 4 && ok {
|
||||
down: bool = frame == 1
|
||||
SetPointerFrame(80.0, 70.0, down, down, frame == 2)
|
||||
BeginDesktopFrame()
|
||||
value: s32 = Frame()
|
||||
expected: s32 = 2
|
||||
if frame >= 2 { expected = 102 }
|
||||
ok = EndDesktopFrame() && value == expected
|
||||
frame += 1
|
||||
}
|
||||
if ok { ok = CaptureConfigured() }
|
||||
} else {
|
||||
while ok && PollDesktop() {
|
||||
BeginDesktopFrame()
|
||||
value: s32 = Frame()
|
||||
ok = EndDesktopFrame() && value >= 0
|
||||
if ok { PauseDesktop() }
|
||||
}
|
||||
}
|
||||
CloseDesktop()
|
||||
if ok { return 0 }
|
||||
return 1
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#import "cairo_raster"
|
||||
#import "desktop_runtime"
|
||||
#import "text_hello"
|
||||
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
if !OpenDesktop() {
|
||||
CloseDesktop()
|
||||
return 1
|
||||
}
|
||||
ok: bool = true
|
||||
if CaptureRequested() {
|
||||
BeginDesktopFrame()
|
||||
ok = Frame() == 2
|
||||
if ok { ok = EndDesktopFrame() }
|
||||
if ok { ok = CaptureConfigured() }
|
||||
} else {
|
||||
while ok && PollDesktop() {
|
||||
BeginDesktopFrame()
|
||||
ok = Frame() == 2
|
||||
if ok { ok = EndDesktopFrame() }
|
||||
if ok { PauseDesktop() }
|
||||
}
|
||||
}
|
||||
CloseDesktop()
|
||||
if ok { return 0 }
|
||||
return 1
|
||||
}
|
||||
@@ -146,8 +146,8 @@ main :: () -> s32 {
|
||||
ok = Scene(session, scene) && CaptureConfigured()
|
||||
} else {
|
||||
while ok && PollDesktop() {
|
||||
KeyboardModifiersSend(session, DesktopModifiers())
|
||||
key: s32 = DesktopPressedKey()
|
||||
key, modifiers := DesktopInputTake(session)
|
||||
KeyboardModifiersSend(session, modifiers)
|
||||
if key != 0 { unused KeyboardSend(session, key) }
|
||||
DemoSetNow(LocalMinutes())
|
||||
ok = Draw(session, PollPointer(), DesktopWheelMove(), key != 0)
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Slider :: #import "kryon/slider";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -42,18 +45,18 @@ GalleryBounds :: (bounds: Rectangle) -> Rectangle {
|
||||
discrete: s32 = 4;
|
||||
|
||||
Label :: (session: Session, value: string, y: float32 = 76.0) {
|
||||
Text(session, TextProps.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
Text.Draw(session, Text.Props.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
}
|
||||
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "DiscreteSlider", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "DiscreteSlider", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
|
||||
discrete = DiscreteSlider(session, DiscreteSliderProps.{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 80.0}), .label = "Step size", .value = discrete, .min = 1, .max = 10, .disabled = disabled}).value
|
||||
discrete = Slider.DiscreteSlider(session, Slider.DiscreteSliderProps.{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 80.0}), .label = "Step size", .value = discrete, .min = 1, .max = 10, .disabled = disabled}).value
|
||||
digits: [16]u8
|
||||
Label(session, FormatInteger(cast(s64)discrete, digits[:]), 180.0)
|
||||
return 0
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Overlay :: #import "kryon/overlay";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -42,7 +46,7 @@ GalleryBounds :: (bounds: Rectangle) -> Rectangle {
|
||||
dismissed: bool;
|
||||
|
||||
Label :: (session: Session, value: string, y: float32 = 76.0) {
|
||||
Text(session, TextProps.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
Text.Draw(session, Text.Props.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
}
|
||||
|
||||
b: Rectangle;
|
||||
@@ -51,15 +55,15 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "DismissibleOverlay", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "DismissibleOverlay", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
if dismissed {
|
||||
if Button(session, ButtonProps.{.bounds = b, .label = "Show overlay again"}) == 1 { dismissed = false }
|
||||
if Button.Draw(session, Button.Props.{.bounds = b, .label = "Show overlay again"}) == 1 { dismissed = false }
|
||||
} else {
|
||||
overlay := DismissibleOverlay(session, DismissibleOverlayProps.{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 188.0}), .view_width = 480, .view_height = 320, .scrim = .{16, 34, 45, 120}})
|
||||
overlay := Overlay.Draw(session, Overlay.Props.{.bounds = GalleryBounds(Rectangle.{24.0, 64.0, 432.0, 188.0}), .view_width = 480, .view_height = 320, .scrim = .{16, 34, 45, 120}})
|
||||
if overlay.panel_node >= 0 { Label(session, "Click outside the panel to dismiss it.", 128.0) }
|
||||
if overlay.closed { dismissed = true }
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
using Demo :: #import "kryon/direction_pad";
|
||||
DirectionPad :: #import "kryon/direction_pad";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "std/number_text"
|
||||
|
||||
steps: s32;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Direction pad", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Direction pad", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
input := CaptureFrameInput(session)
|
||||
now := cast(float64)input.elapsed_ms / 1000.0
|
||||
result := DirectionPad(session, DirectionPadProps.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 180.0, 180.0}, .label = "Move", .now = now})
|
||||
result := DirectionPad.Draw(session, DirectionPad.Props.{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, 180.0, 180.0}, .label = "Move", .now = now})
|
||||
if result.step { steps += 1 }
|
||||
digits: [24]u8
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 192.0, 120.0, 28.0}, .text = "Steps", .font = 14, .vertical_align = .TextAlignCenter})
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 12, .bounds = .{bounds.x + 120.0, bounds.y + 192.0, 60.0, 28.0}, .text = FormatInteger(cast(s64)steps, digits[:]), .font = 14, .align = .TextAlignEnd, .vertical_align = .TextAlignCenter})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 11, .bounds = .{bounds.x, bounds.y + 192.0, 120.0, 28.0}, .text = "Steps", .size = 14, .vertical_align = .TextAlignCenter})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 12, .bounds = .{bounds.x + 120.0, bounds.y + 192.0, 60.0, 28.0}, .text = FormatInteger(cast(s64)steps, digits[:]), .size = 14, .align = .TextAlignEnd, .vertical_align = .TextAlignCenter})
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -39,14 +42,14 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Dropdown", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Dropdown", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
options: [3]DropdownOption
|
||||
options: [3]Dropdown.Option
|
||||
options[0].label = "Morning"; options[1].label = "Afternoon"; options[2].label = "Evening"
|
||||
choice = Dropdown(session, DropdownProps.{.bounds = b, .selected_index = choice, .disabled = disabled}, options[:]).selected_index
|
||||
choice = Dropdown.Draw(session, Dropdown.Props.{.bounds = b, .selected_index = choice, .disabled = disabled}, options[:]).selected_index
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
using UI :: #import "kryon/Widgets";
|
||||
EmptyState :: #import "kryon/empty_state";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/geometry"
|
||||
#import "kryon/session"
|
||||
|
||||
created: bool;
|
||||
#program_export
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
Text(session, TextProps.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Empty state", .font = 28})
|
||||
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Empty state", .size = 28})
|
||||
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
|
||||
if !created {
|
||||
props: EmptyStateProps = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, viewport.height - 96.0}, .title = "No projects yet", .description = "Create your first project.", .action = "Create project"}
|
||||
result := EmptyState(session, props)
|
||||
props: EmptyState.Props = .{.disabled = example_disabled, .key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, viewport.height - 96.0}, .title = "No projects yet", .description = "Create your first project.", .action = "Create project"}
|
||||
result := EmptyState.Draw(session, props)
|
||||
if result.action { created = true }
|
||||
} else { Text(session, TextProps.{.disabled = example_disabled, .key = 11, .bounds = bounds, .text = "Project created"}) }
|
||||
} else { Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 11, .bounds = bounds, .text = "Project created"}) }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
#import "kryon/session"
|
||||
#import "kryon/frame_snapshot"
|
||||
#import "kryon/style_sheet"
|
||||
using UI :: #import "kryon/Widgets";
|
||||
Box :: #import "kryon/box";
|
||||
Fieldset :: #import "kryon/fieldset";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "kryon/system_theme"
|
||||
#import "std/number_text"
|
||||
|
||||
@@ -40,7 +43,7 @@ GalleryBounds :: (bounds: Rectangle) -> Rectangle {
|
||||
}
|
||||
|
||||
Label :: (session: Session, value: string, y: float32 = 76.0) {
|
||||
Text(session, TextProps.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
Text.Draw(session, Text.Props.{.bounds = GalleryBounds(Rectangle.{28.0, y, 420.0, 38.0}), .text = value})
|
||||
}
|
||||
|
||||
b: Rectangle;
|
||||
@@ -49,13 +52,13 @@ b: Rectangle;
|
||||
Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box(session, BoxProps.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text(session, TextProps.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Fieldset", .font = 23})
|
||||
Box.Draw(session, Box.Props.{.key = 9000, .bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.key = 9001, .bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Fieldset", .size = 23})
|
||||
b = Rectangle.{viewport.x + 24.0, viewport.y + 64.0, viewport.width - 48.0, 44.0}
|
||||
disabled := example_input.disabled
|
||||
|
||||
b.height = 188.0
|
||||
Fieldset(session, FieldsetProps.{.bounds = b, .title = "Preferences"})
|
||||
Fieldset.Draw(session, Fieldset.Props.{.bounds = b, .title = "Preferences"})
|
||||
Label(session, "Keep related choices together", 118.0)
|
||||
return 0
|
||||
}
|
||||
|
||||