Commit Graph
29 Commits
Author SHA1 Message Date
waoziandClaude Opus 5.5 15c3a22e43 Bring pictures, text input and scroll devices only with the widgets that use them
The desktop rasterizer loads, decodes and smooth-copies file pictures once
a program first asks a picture's size, which every widget that draws one
does first, so vector icons and managed pixels draw without decoders,
threads or asset paths. LanczosSnap is geometry's RectangleSnap, so a
texture draw no longer reaches the Lanczos cache.

A button reaches file pictures and atlas icons through the new
image_lookup. kryon/image is now image_files, which re-exports the Image
widget (image) and fills the pictures; kryon/icon fills the atlas. Library
code imports image itself, so importing a picture-capable widget registers
nothing. Navigation, copy and confirm buttons and the widget host fill the
lookup where they draw, as they reached pictures before. Props modules that
only name Image.Props import image_props, now also exported; unused image
imports are gone.

The frame and the accessibility host reach text requests and editor focus
through text_editing, which text_request and text_input_platform fill, and
the frame samples scrolls through scroll_sampling, which scroll_device
fills.

Desktop examples (C files, C bytes, executable), before -> after:
button 96, 1 411 582, 448 264 -> 70, 980 794, 342 016
text 95, 1 445 077, 462 504 -> 71, 1 020 207, 356 472
textfield 107, 1 580 157, 514 496 -> 84, 1 166 840, 409 840
make pay-per-import-test checks button and textfield; tests whose programs
no longer reach pictures lose their picture bindings and stubs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 23:10:23 -03:00
waozi ff07bddbec Simplify hello world and package widget APIs 2026-11-13 04:29:23 -03:00
waozi e8c6aa25c1 Integrate components and the public UI surface 2026-11-10 15:37:48 +00:00
waozi cdf4dffb07 Add owned per-frame input snapshots for native and hosted apps 2026-10-30 19:47:02 -03:00
waozi 2839954d91 Host overlays and explicit tree scopes 2026-10-29 00:31:46 -03:00
waozi 5427f011d2 Clip images to retained polygons across rendering hosts 2026-10-28 17:02:27 -03:00
waozi fade061f2e Bundles draw sliders and progress bars through their host
Inner Breeze's practice manuals and settings move into the Practices
package, and they change speeds and durations with sliders and show a hold
with a progress bar. Slider, DiscreteSlider and Progress are now hosted:
the host drags the slider with its own pointer and answers the value, and
paints the progress bar.
2026-10-24 21:10:50 -03:00
waozi 8e2d0bc46b Bundles draw lines, circles, rings and triangles through their host
A portable bundle could draw boxes and icons but no line at an angle, so a
chart's trend lines and dots needed compiled screens. Kryon's shapes are now
hosted like Box: the bundle sends their props and the host fills them with
its renderer's RasterTriangles, which every Kryon renderer provides. The
widget host test stubs that rasterizer, as it draws nothing.
2026-10-24 20:24:00 -03:00
waozi 235f28cda2 Bundles frame form sections and size toggles through their host
A portable form could not draw a fieldset around its sections or place a
toggle at a row's end, because both needed the host's style and font
metrics. Fieldset is now hosted like Box, and the new toggle_measure module
answers the size a toggle needs, from its host as ToggleSize. The host
encodes the answer with the Vector2 encoder, now part of the widget codec.
2026-10-24 20:00:33 -03:00
waozi 2da3b99f87 Bundles draw segmented controls through their host
A portable bundle could not show a row of choices such as Habits' week and
calendar views, so Inner Breeze drew them in compiled screens. Segmented
controls are now hosted like tab bars: the bundle sends its props and up to
32 options and the host draws them with its own widget and style.
2026-10-24 19:27:27 -03:00
waozi 65381f3c1e Share hosted slice validation and scalar field construction 2026-10-24 03:03:21 -03:00
waozi 689a953ca1 Generate deferred widget codecs in consuming modules
Reuse imported storage and discover supplied operations before generating missing codecs from schema metadata. Preserve complete-provider output and exercise partial providers across source and saved native targets. Regenerate the library against the current widget property records.
2026-10-23 18:49:12 -03:00
waozi 00fe5e1130 Share hosted record field decoding and validation 2026-10-23 15:09:13 -03:00
waozi 018e94781b Expose session-scoped pointer samples to hosted apps 2026-10-21 21:55:06 -03:00
waozi 10be25fd4d Support the shared Dropdown widget in hosted app packages 2026-10-20 19:41:26 -03:00
waozi 806fcd20e1 Mark unused codecs in generated widget decoders
A record of scalars and strings decodes without its codec, and hosts that
build Kryon with -Wextra -Werror stopped at the unused parameter.
2026-10-19 19:46:14 -03:00
waozi 909760ace8 Draw a hosted game's TileMap in one host call
A hosted game's board was one host call per cell: Pushy's 240 tiles
were the larger part of its frame on a phone. TileMap now hands the
whole map to the host as one call, which draws it with the native
TileMap. Each picture a cell shows passes the asset policy once, as
each cell's Image did, and the paint is the same: a test compares it
with a direct TileMap. Maps with more than 1024 cells, pictures or
names are still drawn cell by cell. The codec generator now encodes
slices of plain values such as []string and []s32.
2026-10-19 16:15:57 -03:00
waozi ca749f72a5 Let portable apps draw a vector icon on its own with SvgIcon
A symbol beside a name or a coin beside an amount had no hosted widget:
only buttons carried icons. SvgIcon paints a Shape in the caller's color,
and bundles submit it to their host like the other widgets.
2026-10-19 16:05:44 -03:00
waozi 4e1afda0b9 Expose canonical context menus to hosted apps 2026-10-18 18:02:28 -03:00
waozi e450f7bd83 Expose action dialogs to portable apps through the widget host 2026-10-18 15:50:50 -03:00
waozi cca56b47eb Let portable apps open dialogs with ModalFrame
A bundle could draw text, buttons, scrolls and tab bars through its host,
but no dialog, so an app had to fill a whole page instead. ModalFrame is
now a hosted widget: its props and result cross with generated codecs,
its action images pass the host's asset policy, and its open panel is a
scope the bundle Ends, counted with scrolls toward the host's limit.
2026-10-16 02:21:29 -03:00
waozi 01a3ac262a Keep image codecs small: the Image effect decodes a mesh's points itself
Every ImageProps codec held room for 256 mesh points with a codec each,
about 74 KB, and buttons, title bars and every dropdown option embed one,
so hosted widget codecs grew by megabytes. The points now have no room in
the codec: a bundle still sends them, the Image effect validates and
decodes them into one host buffer (up to IMAGE_MESH_POINT_LIMIT), and an
image codec is back to about 2.7 KB.
2026-10-14 20:38:17 -03:00
waozi 197d21f2f8 Draw images warped over a grid of points
ImageProps.mesh holds a columns x rows grid of screen points; Image
stretches the picture across it, two textured triangles per cell, so a
painted limb can bend at its joint like a paper puppet. Mirrored grids
draw (nothing is culled), the bounds still clip, and fit, origin,
rotation and the style radius do not apply. A grid with too few points
draws nothing, and no placeholder covers its bounds.

The paint queue copies the points into per-session blocks when queued,
moves them with their node, and compares them in the retained snapshot,
so a moved vertex repaints and an unchanged grid reuses the frame.

RasterImageMesh draws the grid in every host: raylib (desktop and
Android) sends front-facing textured triangles in one batch, the web
canvas and Cairo draw each triangle through its affine transform under a
clip, the pixmap host and Plan 9 libdraw rasterize pixel centers with a
shared edge rule (bilinear when smooth), and the terminal shows a marker.
The bundle player, zib tool and frame replay bind it, and hosted bundles
send up to 256 points with a plain Image (a per-field slice bound in the
codec generator keeps every ImageProps codec small).

Tests: pixmap mesh test (C, C++, Go, bundles; copy, snapshot reuse,
mirror, bend, clip, seams), Cairo mesh test, RGBA canvas cases, web
canvas pixels and seam at three densities, hosted widget mesh, and a
raylib pixel test on a private Xvfb (make raylib-mesh-pixels-test).
2026-10-14 20:05:57 -03:00
waozi b648eee8c7 Let title bars keep room for controls and draw in portable apps
A TitleBar's trailing_width reserves room at its right for the caller's
own controls, such as an online switch, and the result's trailing_bounds
says where to draw them; the title stays centred clear of them, or takes
what is left on a narrow bar. Portable bundles can now draw a TitleBar
through the widget host, with its leading image and dropdown options
held to the host's asset policy.
2026-10-13 17:35:52 -03:00
waozi 2514568dd9 Add TimePicker for picking a time of day
TimePicker shows a time as 24-hour HH:MM, or a placeholder while no time
is chosen, and opens an hour and a minute column at the current value. A
tap, a finger drag or fling, or the mouse wheel picks and scrolls; Down
opens it, the arrow keys step a column and wrap within it, Left and Right
switch columns, and Enter or Escape closes it. Optional Now and Done
buttons set the current time and close the popup. The time changes as it
is picked, so closing never loses a choice, and the popup stays on screen,
opening above the field when there is no room below. The picker takes the
dropdown's look from every style, light or dark, and portable apps can draw
it through the widget host.

Dropdowns now follow Kryon's light and dark system palettes; a dark palette
left their field and menu light before.

`make -C examples time-picker` builds a window that shows the picker in
each of its states.
2026-10-13 14:38:03 -03:00
waozi 9af484664e Let portable apps draw a Spinbox through the widget host
Hosted bundles can now step numbers with the standard Spinbox. The
regenerated codec also carries TextField's numeric flag, which was
missing from the hosted boundary.
2026-10-12 23:53:19 -03:00
waozi 7870801388 Let bundles use Press through the widget host
A bundle built with KRYON_HOSTED_UI now calls PressHostedHost, and the
widget host draws the press area in the host's frame and returns its press
state, so a hosted app such as Lumi can select messages by holding and
dragging. The generated codec gains PressProps and PressResult.
2026-10-11 00:27:32 -03:00
waozi 63d65c502a Write file imports in generated codecs as #import, file
An application's codec imports its own record files; the generator wrote
them with a space before the comma.
2026-10-11 00:20:25 -03:00
waozi 53ea0fdb87 Host the widgets of a bundle that runs inside another application
An application that runs a .zib inside its own window answered each
widget's HostedHost call with its own codec and dispatcher. Kryon now owns
that host side next to the bundle side: widget_host draws a bundle's widgets
in the frame's session, refuses calls from another frame, foreign records,
texture handles and assets its host's callback rejects, and closes scrolls
the bundle leaves open. WidgetHostSupports lists the calls it answers,
including Toggle.

widget_codec is generated from Kryon's widget records by
scripts/generate-widget-codecs.py, whose --uses option lets an application
generate codecs for its own records on top of Kryon's. hosted_values holds
the shared helpers: fields match by name, so a bundle and its host may be
built against different layouts.
2026-10-11 00:04:50 -03:00