-
v0.4.0
Stablereleased this
2026-11-02 20:54:30 +01:00 | 81 commits to main since this release0.4 takes forma past the desktop window. The app API moves into a crate of
its own, forma-app, so that oneAppruns under more than one runner:
forma-winit on the desktop and now in a browser (WebGPU, else WebGL2), and
the new forma-android on Android phones. A phone gets the touch-first UI it
needs - momentum and overscroll, long presses, text selected by touch,
swipes and swipe actions, a bottom sheet, a page stack, an app bar, bottom
navigation, a pager, pull to refresh, wheel pickers - and the pieces of a
password manager: a screen kept out of screenshots, incognito keyboards, a
secret copied for a while, keys unlocked by a fingerprint, and filling
other apps' logins. Themes are made from a few colors or a theme file,
checked by a contrast report, and get variants, text roles, named styles
and themes for part of a window; the bundled themes pass the report.
forma's controls, overlays, sections and trees move by default, jumps of a
view glide, and charts move to new data, all of it on the theme's times
and with reduced motion keeping fades. There are a property grid, a
navigation list and a log viewer, and behind the neweditorsfeature a
zoomable canvas, a node graph editor, curve and gradient editors and a diff
viewer. On Linux files drop onto windows on Wayland and at the right place
on X11, files and text are dragged out to other apps, dock panels float
into windows of their own, an open window is raised on Wayland, and a whole
app is tested withAppHarness. It breaks the API, so that later releases
need not: the migration guide shows every
break with code before and after. 0.2's names, deprecated since 0.3.0, are
gone. The minimum Rust version stays 1.90 for the libraries; the
repository's examples need 1.92, for their profiler (puffin 0.20).0.4 is tested by hand on Linux under KDE Plasma on Wayland, and on Android
on a phone; the rest of whatdocs/hand-checks-0.4.mdlists - X11, other
desktops, browsers, older Android versions - was checked only as far as
each change's own work went. It compiles for macOS and Windows, and CI
checks that it does, but nothing has been run there.forma-android is experimental: its own API - what only Android has - may
change in a minor version until 1.0. It runs from Android 10 (API 29), on
android-activity 0.6 with GameActivity 4.4.0. An app starts from the
template incrates/forma-android/template/, whose README names the files
an app copies again with each forma version.New dependencies, under MIT or Apache-2.0:
- forma-wgpu: wgpu's
noopfeature off the web (forGpu::noop) and its
webglfeature on wasm32, which addswgpu-core-deps-wasm. - forma-app: forma-ui, forma-wgpu and
thiserror, all in the tree before;
serde_json,dirsandresvgmove here from forma-winit, behind the
same features, andimage(PNG only) behindclipboard. On wasm32
web-sys. - forma-android, on Android only (elsewhere it only re-exports forma-app):
android-activity0.6 withgame-activity,ndk0.9,jni0.22,
raw-window-handle,libc,serdeandserde_json, which winit and
forma had in the tree already, andaccesskit_android0.9 with
accesskit, for TalkBack. accesskit_android bringscesu8and a second
jni(0.21). The crate embeds the DEX of its own Java helper, compiled
fromcrates/forma-android/java/under forma's license. - forma-winit: forma-app, whatever its features; with
runon Linux and
the BSDswayland-client0.31 andwayland-protocols0.32, in the tree
already through winit; on wasm32wasm-bindgen,wasm-bindgen-futures
andweb-sys, the versions winit and wgpu have.
With every feature on, on every target, that makes three crates 0.3.1 did
not have -accesskit_android,cesu8andwgpu-core-deps-wasm- and two
second versions,jni0.21 andwindows-sys0.45, both through
accesskit_android.Not in 0.4: running on macOS and Windows and the fixes it brings, among
them watching the clipboard and keeping a window out of screenshots there;
a pass with a real screen reader on the desktop, Orca included; the
upgrade to winit 0.31.
Drags between the app's windows work on X11 only: Wayland tells an app
nothing of where its windows are. In a browser there is no screen reader
(AccessKit has no web adapter), no input method composition, and the
system's reduced motion, high contrast and accent color are not read. On
Android an emoji needs forma'sbundled-emoji(the system's emoji font is
COLRv1, which forma cannot draw yet); autofill offers no inline
suggestions in the keyboard; a mouse wheel scrolls at once rather than
gliding. A heatmap and a sparkline do not move to new data, a grouped
table's groups open and close at once, and folds in a text area do not
move. The README lists what else is known.forma-ui
Changed (breaking)
Event::Commandcarriesmodifiers, the keys held when the claimed key
was pressed, asEvent::Clickeddoes: a pattern that names the
variant's fields addsmodifiersor...Ui::command_modifiersand
Ui::command_modifiers_each, new in 0.3.1, are gone: the event says the
same.Theme,TreeNode,MarkdownStyleandDockLayoutare
#[non_exhaustive], so later releases add to them without a break.
Their fields stay public to read and assign, but outside forma none is
built with a struct literal: aThemestarts from a bundled one
(Theme::dark()and the others, orDefault) and has its parts
assigned; aTreeNodecomes fromTreeNode::leaf,branchorlazy, a
MarkdownStylefromDefault, aDockLayoutfromDockLayout::newor
Default.- 0.2's names, deprecated since 0.3.0, are gone:
CalendarParts(use
DateCalendarParts),EditorEventandEditorParts
(MarkdownEditorEvent,MarkdownEditorParts),ViewerEventand
ViewerParts(ImageViewerEvent,ImageViewerParts),RangeEventand
RangeParts(RangeSliderEvent,RangeSliderParts),SplitEventand
SplitParts(SplitButtonEvent,SplitButtonParts), inwidgetsand
in their widget's module.planning::CalendarParts, the calendar view's
parts, stays.
Changed
- Motion by default (ADR 0116, 0117). forma's widgets look as before
at rest, but move on the way: all of it on the theme's times
(Metrics::motion_short,motion_mediumandmotion_long, 100, 200
and 300 ms), slowed by the motion scale, turned off byStyle::stillon
a subtree or byMetrics::STILL, and with reduced motion only fading.
Only the drawing moves: what a click hits, what the accessibility tree
says and what the getters return is the new state at once (ADR 0039).
An app that wants none of it setsMetrics::STILLon its theme, or
Style::still()on its root panel. A test that reads the draw list, an
offset ornext_wakeupright after a change lets the manual clock run
past the motion (Harness::advance), or usesMetrics::STILL; the
migration guide says which waits.- Reduced motion keeps fades.
Ui::set_reduced_motion(true)made every
change immediate; now only movement is - an offset, a slide, a widget
sliding in or out. Colors and opacities still fade, in the theme's
motion_shortat most, and an entrance that slides and fades keeps
its fade. Turning it on still ends what is moving, at its target. - The controls: hover and press fade in (
Pace::Short) and out in one
and a half times as long, on buttons of every variant, flat rows,
clickable panels, checkboxes, switches, slider thumbs and splitters; a
switch's knob slides; a checkbox's mark and a radio button's dot grow
and fade in; a slider's thumb, a range slider's knobs and a progress
bar's fill glide to a value set by a press on the track, a key or a
rebuild (a drag follows at once); the selected tab's, a segmented
control's and a navigation bar's marker slides to the one chosen.
Hover and press are no longer drawn at once. - The overlays fade and move a few pixels as they come (
Pace::Medium)
and fade as they go (Pace::Short): menus and submenus, list popups,
completion, the chooser, the command palette, the date picker's
calendar, the color picker, the find bar, a popover, tooltips, a
dialog or sheet (its scrim fades, its card rises), and toasts, which
slide in from the window's edge while those above slide up for them.
An overlay takes input at its place from the frame it appears. An
app's own popups do not move unless givenStyle::enterand
Style::leave. - Sections and trees open and close by drawing: a
Collapsible's body
and aPropertyGridgroup's are uncovered while what follows slides
down, a tree's or a tree table's new rows fade in under the rows
sliding away, and their chevrons crossfade between the closed and the
open icon. A chevron is two icons now, one at opacity 0, and a tree's
rows are keyed by their nodes rather than their index, so a node's row
stays the same widget when rows open above it; the rows of a tree view
and a tree table slide when they move. - Jumps of the view glide over
Pace::Medium: a list's, a table's, a
tree's and a log viewer's selection moved out of view, a text area's
page keys and Ctrl+Home and Ctrl+End,VirtualList::scroll_to,
LogViewer::scroll_to,FindBar::reveal, a screen reader's "scroll
into view", the keyboard coming up over the focused field, and Tab,
which now scrolls the focus into view. The offset itself moves, so
hit testing sees where the view is. A trackpad, a finger, the scroll
bar andUi::set_scroll_offsetmove at once, as before, and stop a
glide where it is.Ui::scroll_into_viewis public, and glides. - forma's widgets that moved before take the theme's paces: a drawer
(300 ms, was 220), a popover and a wizard's page (200 ms, were 150),
a page stack's and a pager's slides (300 ms, were 250), a tab bar's
and a kanban board's moves (200 and 300 ms eased, were a spring). A
widget'sStyle::transitionalso fades a change of its border color
and of its newStyle::opacity. - A layout with nothing to lay out again lays nothing out, so a frame
where only a color or an opacity fades costs its drawing (1.19 ms to
0.02 ms for 6000 widgets on the benchmark's machine). A widget a
layout slide moves is culled where it is drawn instead of not at all
(a sliding list of 6000 widgets: 5.21 ms to 1.33 ms a frame). A widget
drawn at opacity 0 is not drawn at all.Ui::request_redrawmakes the
next layout a full one. - The toast stack's root spans the window's height, the toasts at its
foot, and lets the pointer through where there is no toast.
- Reduced motion keeps fades.
- The bundled themes pass the contrast report (ADR 0114, amended). The
dark theme draws the text and ticks on its accent in its background
color instead of white (5.41:1 on the accent, was 3.28:1): a primary
button's text, a checked box's tick, a chosen radio's dot and an on
switch's knob are dark. Both themes have a stronger field outline,
which a standard button, a checkbox, a radio and an unchecked switch
share (dark#646871, was#3F434D; light#90949C, was#C5C9D2),
and placeholders a step stronger (dark#717683, light#7F848E); the
light theme's accent is a step deeper (#2568D7, was#2B6EDE), with
its hover, focus ring, selection and selected row. An app that wants the
old look sets the old colors on its theme. - The text on a fill -
on_accent,control_markand the newon_danger- is white or the theme's background (in a light theme its text),
whichever holds more against the fill, inTheme::from_colors,
Theme::high_contrastand for a palette saved withouton_danger.
- is white or the theme's background (in a light theme its text),
Theme::with_accentderives the accent's states as the bundled themes
have them: the hover shade keeps the accent's hue, the dark theme's
focus ring is the hover shade at 90 %, its selected rows take 24 % of
the accent instead of 28 %. An app that sets its own accent sees a
slightly different hover, focus ring and selected row.- forma's components use variants instead of colors of their own: a
dialog's default button and a wizard's Next and Finish arePrimary, a
dialog's destructive answerDanger, a toolbar's and an app bar's
buttonsSubtle, andToolbar::with_emphasismaps to them. So the text
on a danger fill ison_danger(dark in the dark theme), a primary
button under the pointer isaccent_hoverrather than the accent with
the hover overlay, and so is a segment that is on.Ui::foreground_of
reports a variant's text color. - The shadows forma's widgets draw take the theme's levels
(Metrics::shadow_small,shadow_medium,shadow_large) in the new
Palette::shadow: a dialog, a sheet and the chooser the large one, a
popover, toasts, completion and menus the medium one (menus were 4/10,
now 4/12), the floating button and lifted planning entries the small
one. A theme with a level at strength 0 turns its shadows off. - forma's widgets take their text from the theme's text roles where the
size and weight they set are a role's: a dialog's title isHeading, an
app bar'sTitle, tooltips, error messages, the command palette's
descriptions and a wizard's step numbersCaption, Markdown code blocks
Code. The look is unchanged, but an app that sets only
theme.text.sizeno longer changes these: it sets the roles too
(theme.text.heading.sizeand the others). The small texts' floor of
10 px is gone with it. - The
Highlightercolors code by the theme's syntax colors
(Palette::syntax), not syntect'sbase16-eighties.darkand
InspiredGitHub;follow_ui_theme(the default) means the palette's
colors, and a new UI theme recolors the text at the nextupdate.
highlight_strtakes the bundled dark or light theme's, by the
background. Every color is still held to 7:1 against the background.
For the old look,set_theme("base16-eighties.dark")or
set_theme("InspiredGitHub"). - In a high-contrast theme a track is drawn as an outline around the
surface, with its fill solid over it, so the filled part stands out by
its own contrast against the surface (12.53:1 in the dark one, was
1.60:1 against the track): a slider, a range slider (now 8 px tall
there), a progress bar and a busy bar. A spinner's ring is a third as
wide as its arc there. The standard themes draw as before. - The focus ring shows only while the user drives with the keyboard (ADR
0096): Tab, an arrow, Home, End, Page Up or Page Down turn it on, a
press of the pointer or a touch turns it off, and every other key and
way the focus moves (Ui::focus, a dialog opening,refocus) leaves it
as it was. Before,Ui::focusalways showed it, and a dialog opened by
a shortcut after a click showed it on its default button. A range
slider's knob, the date picker's cursor day and the editors' current
item are marked only while the keys drive too, and a table's column
chooser opens on its first entry only then. - Lists, tables, trees, tree tables, the kanban board, the calendar and
the timeline no longer shade their whole area under the pointer: only
the row, card or entry under it shows it. - forma's widgets build with the theme of the place they are built into
(Ui::theme_of) and its popups with the theme of where they were
opened from, which is the window's unless a scoped theme is used. - Popups - menus, toasts, a selection's toolbar - are placed inside the
part of the window the system does not cover (Ui::set_insets). With no
insets, as on the desktop, nothing changes. - A finger outside an open popup puts it away and does nothing else: no
tap, no scroll of what is under it, as on Android. - A finger dragged along a focused single-line field whose text runs past
its width scrolls the text sideways. - A
DrawerfromSide::Bottomwithoutwith_sizeorwith_detentsis
as tall as its content (up to the window), not 280 pixels;
.with_size(280.0)keeps the old size. A finger on a modal drawer's
scrim waits to see whether it taps (and closes the drawer) or drags it,
instead of closing it at once. TagInputis 220 pixels wide unless set otherwise, asPasswordField
andSearchFieldare; it was 320.- Toasts show by their kind unless set otherwise: info and success for
four seconds as before, warnings for six and errors for eight;
Toasts::with_duration(d)still sets one time for every kind. Toasts::pushandpush_messagetake&impl Timekeeperinstead of
&mut Ui, so a callback with no window open pushes a toast with its
Context; calls with a&mut Uicompile as before. A toast asks to be
woken when it goes, so it goes on time in whichever window shows it.
Added
PropertyGrid<K>andProperty<K>: an app's properties as names and
editors in two columns, in groups that open and close (ADR 0094). Each
property is made by its value's type -text,number,integer,
bool,color,choice,date- and edited with forma's own field,
number field, checkbox, color picker, select or date picker; text is
checked with a form's rules and the app refuses a value with
set_error. It reportsPropertyGridEvent::Changed { key, value }with
aPropertyValue, andToggled. Tab goes through headers and editors,
Up and Down from row to row, Left and Right close and open a group; a
screen reader hears each editor by its property's name.NavigationList<K>andNavigationItem<K>: the sections of a settings
window down its side, in groups, one selected by a click, the arrows,
Home, End or typing; heard as a list box.NavigationList::compact()is
a rail, icons over short labels in a column 72 pixels wide.
NavigationItem::badgeandBadge(Dot,Count) mark an item there
and on the navigation bar.LogViewer: the lines of a log the app pushes (push,push_level),
on a virtual list, so a million lines cost what a screenful does, with
a cap that drops the oldest (ADR 0097). ANSI escape codes color and
style them, every color held to 4.5:1 against what is behind it; it
follows new lines while at the end, with a "Jump to latest" button;
set_filterandset_min_levelnarrow it; lines are selected by
pointer and keys and copied as plain text; lines keep their numbers
through drops.Palette::ansi: the 16 colors escape codes name.Table::with_striped_rows()andPalette::row_stripe;Style::unshaded()
for a clickable container that shows no hover or press;
PaintCx::is_focus_visible()for a custom widget.- The
editorsfeature andforma::editors(ADR 0095): components that
show data the app owns and report what the user does for the app to
apply, each reporting a drag once, when it is let go, so one undo step
per report is one per drag.ZoomCanvas<K>andCanvasItem: the app's items as boxes on an
unbounded plane that the user pans, zooms (the wheel, a pinch,+,
-), fits, selects (with a rectangle too) and drags, snapping to a
Grid, with a minimap.CanvasEvent::{Selected, Activated, Moved, Deleted}.NodeEditor<K>, withEditorNode,Port,WireandPortRef: a
node graph on the same canvas, ports joined by dragging or clicking
one and then the other (only of the same kind), wires with reroute
points; from the keyboard too, and to a screen reader as nodes and
their ports.NodeEditorEvent::{Selected, Activated, Moved, Connected, Deleted, Rerouted}.CurveEditorandCurveKey: a cubic Hermite curve through keys with
tangent handles (curve_valuereads it);GradientEditorand
GradientStop: color stops on a strip (gradient_colorreads it).DiffViewer: what changed from one text to another, side by side or
inline, the words that changed marked,diff_linesworking the
changes out with Myers' algorithm (no new crate),nandpgoing
from change to change.Viewport: a view onto an unbounded plane, for an app's own custom
widget.
- Files dragged in from outside:
InputEvent::FileHoverMoved(position),
for a platform that says where the drag is while it holds the pointer;
it moves the drop's target, not the hover. - Dragging out of the window (ADR 0099):
DragData(files, text, any
MIME type, whether the other app may move it) andUi::offer_drag(source, data)onEvent::DragStartedlet a drag leave the window, and
Event::DraggedOut { source, action }says how it ended. For runners:
Ui::take_drag_out()andInputEvent::DragOutEnded. - Floating dock panels (ADR 0109):
DockLayout::floating, saved with the
layout (a layout saved by 0.3 loads with none), turned on with
DockArea::set_floating. A panel floats from its tab's new menu (Float,
Dock, Close), withDockArea::float, or by letting its tab go outside
the window, and docks back from the menu, withdock_back, or by
dragging the tab back (X11); the app opens a window per float and builds
it withDockArea::build_float.DockArea::dropped_from_windowmoves a
tab let go over another window.Ui::last_drop, and for runners
Ui::live_drag,set_visiting_draganddrop_visiting_drag. Timekeeper: what tells a component the time outside a frame,
implemented byUi,Clockand forma-app'sContext.- What a phone's system tells a window:
Ui::set_insets(Insets)(the
bars, a cutout, the keyboard, and withInsets::gesturesthe edges the
system takes swipes from) andUi::insets;Style::safe_area()and
safe_area_sides, which keep a panel's content clear of them, the
focused field scrolled above the keyboard with 16 px to spare;
Ui::set_text_scalefor the user's font size;Ui::back()and
takes_back(), Back closing the topmost popup first.
Fonts::load_system_font_filesloads fonts from a list of files. - Touch first (ADR 0106, 0107).
Metrics::for_touch(),Metrics::TOUCH
andTheme::for_touch(): controls 48 pixels tall, larger checkboxes, a
wider splitter, longer scrollbar thumbs, menu rows a finger tells apart,
and with themMetrics::scrollbars_fade(scrollbars only while
scrolling) andMetrics::min_touch_target(a finger beside a widget
presses the nearest one).- A long press asks for the context menu (
Event::ContextRequested) or
shows the tooltip of what it holds;Ui::take_long_presstells a
runner to vibrate. - Momentum: a flick goes on scrolling and slows down; a finger stops it
and taps nothing. A finger lifted after resting 40 ms flicks nothing.
Overscroll: past the end the content pulls against a rubber band and
springs back. A row a finger rests on shows pressed after a tenth of a
second, and nothing is drawn hovered under a finger. - Text selected by touch: a long press or a double tap selects a word,
with forma's two handles and a toolbar that cuts, copies, pastes and
selects all; a tap puts a handle under the caret for a few seconds.
Handles show only where the field shows. - Swipes:
Style::touch_swipe(Axes), the first move past the tap slop
deciding who gets the touch, reported asEvent::Swipewith a
SwipePhase(andWidgetInput::Swipe);Ui::feel_tick()and
take_tick()for a tick as a swipe crosses a threshold. SwipeActions<A>: a row with actions on either side, uncovered by a
swipe; past half the row and past the actions the first action
stretches over the row and runs when let go, a flick only opens or
closes. Each action is as wide as its label needs, and the same
actions are the row's context menu.Style::pull_to_refresh(),Event::RefreshRequested,
Ui::set_refreshingandis_refreshing: a list pulled down past
64 pixels asks to refresh, with forma's spinner until the app is done.- The bottom sheet:
Drawer::with_detents(Detent::Height,
Fraction,Content) withdetent()andset_detent; an open
drawer follows a finger and settles on a detent or closes;
Drawer::with_handle();Drawer::with_edge_swipe()opens a side
drawer from its edge where the system leaves it to the app;
DrawerEvent::DetentandOpened. A toast is swiped away sideways
(ToastEvent::Dismissed).Edges, forInsets::gestures. PageStack<K>: pages pushed and popped with a slide, replaced or
reset to one (reset_to, for a navigation bar's destinations) with a
fade, the pages under the top kept built with their state, answering
Back.AppBar<A>withNavigation(None,Menu,Back): the bar at the
top, with a title, a toolbar for its actions, the status bar's inset
(and a strip in its color while it moves away), moving away and back
with a scroll container, pixel for pixel, and with
with_search(SearchField)a search that opens in the bar.NavigationBar<K>: up to five items along the bottom, above the
navigation bar's inset, heard as tabs.Pager<K>: pages side by side, swiped one at a time with a rubber
band at the ends, with dots, the neighbors built and hidden.FloatingButton: the screen's main action, a round accent button in
the end corner, moving above the navigation bar and the keyboard;
extended()shows its label.TimePicker::with_wheel()andDatePicker::with_wheel(): columns a
finger scrolls and flicks, snapping to an item; each a spin button to
a screen reader.Toasts::set_bottom_room(px): room under the toasts for an app's own
navigation bar or floating button. Toasts keep clear of the insets.Style::private_input()andUi::ime_private(): a field that asks
the on-screen keyboard not to learn from it;Ui::edit_as_user(edit)
for a runner that hands a field an input method's edits.
- A long press asks for the context menu (
- Theming (ADR 0114).
forma::contrast(a, b)andTheme::contrast_report(): every pair of
colors forma draws text or a mark with that falls short of WCAG 2
(4.5:1 for text, 3:1 for marks and placeholders; 7:1 and 4.5:1 in a
high-contrast theme), asContrastIssues.Theme::from_colors(ThemeColors): a whole theme from a background, a
text color and an accent (and the status colors), by the recipe the
bundled themes are made with.Theme::high_contrast(): a theme lifted
to the high-contrast themes' promise, each color moved only as far as
it has to.- With
serde,ThemeFile: a theme as a designer writes it - a base
and only what differs (colors as hex, metrics, text and its roles,
fonts, named styles,high_contrast), unknown keys refused -
resolved withThemeFile::resolveinto the theme and its report, or a
ThemeErrorsaying where. Variant(Standard,Primary,Danger,Subtle,Outline) and
Style::variant: how a button is filled and its text colored, from the
palette.Palette::on_dangerandPalette::shadow.- The theme's tokens:
Metrics::shadow_small,shadow_mediumand
shadow_large(ShadowToken),motion_short,motion_mediumand
motion_long,spacingandMetrics::space(step);Metrics::COMPACT,
a denser preset. A theme saved before 0.4 reads with the default
tokens and the bundled colors that fit it. - Text roles:
TextRole(Body,Caption,Label,Heading,
Title,Code),RoleStyle(size, line height, weight, font) for
each inTextStyle, andStyle::text_role. SyntaxColorsandPalette::syntax: twelve colors code is
highlighted in, at 7:1 in every bundled theme;
Highlighter::highlight_with.- Named styles (ADR 0115):
StylePatch,StyleSheet,Ui::set_styles,
forma's 23 names informa::style_names(button,toolbar.button,
table.row, ...), andStyle::class("app.card")for an app's own; a
theme file'sstyles. - Scoped themes:
Ui::add_theme,set_scoped_theme,remove_theme,
scoped_themeandStyle::theme(id): a widget and what is inside it
drawn and laid out in another theme;Ui::theme_ofandtheme_id_of.
- Motion (ADR 0116, 0117).
PaceandMetrics::transition(pace), an ease-out over the theme's
times;Metrics::STILL, a theme whose own widgets do not move.Ui::set_motion_scale(scale): every motion takes that many times as
long; 0 makes every change immediate.Ui::animateandPaintCx::animate: a value a component, an app or
a custom widget's drawing moves toward a target, asking for frames
itself;Change(Movement,Fade) says what reduced motion does
with it.Style::opacity,Style::children_stagger(step),Style::still()
andStyle::reveal(pace), which draws a widget's height changing,
what follows it sliding.Ui::scroll_to(id, offset)andUi::scroll_target(id);
InputEvent::WheelSteps(delta), a notched wheel's steps, which glide
and add up;Harness::wheel.Plot::with_transitionandPieChart::with_transition: a chart's
bars, points and slices move to new data, the axes with them.Stats::skipped_layouts.
- Phrases:
ChooseColor,Sections,JumpToLatest,FloatPanel,
DockPanel,Cut,Copy,Paste,SelectAll,OpenMenu,
Navigation,BadgeDot,BadgeCount,DrawerHandle,Pages,
PageOf,Day,Month,Year,DayPeriod.
Fixed
- A scroll container under a hidden widget (
Style::hidden,
Ui::set_visible(id, false)) lost its scroll offset; it keeps it for
when it is shown again. - With frozen columns, the outline of the cell the keyboard is on had no
left side in the first column that scrolls. - A click on a navigation list's row drew the focus ring around the whole
list. forma::from_hexpanicked on non-ASCII text cut inside a character; it
returnsNonefor any non-ASCII text.
forma-wgpu
Changed (breaking)
Gpu::request(andGpu::headless,Gpu::for_surfaceand
SurfaceRenderer::new) asks for WebGL2's limits, raised to the
adapter's texture size and alignments, instead of wgpu's defaults, so a
device with only those - OpenGL ES on Android phones and the emulator,
WebGL2 in a browser - is taken instead of refused. An app that runs its
own pipelines on forma's device and needs more (compute, storage
buffers) requests its own device and builds theGpufrom it.
Added
Gpu::noop(): a device that needs no graphics adapter and draws
nothing, for tests of an app that registers images.- WebGL2 on wasm32, beside WebGPU.
Fixed
- The quad shader took a derivative after branches that return, which
browsers' WebGPU refuses: with WebGPU the page stayed black.
forma-app
New: the app API out of forma-winit (ADR 0098), so that more than one
runner runs the same app. forma-winit re-exports all of it under the
names it had (see forma-winit for what breaks). It depends on forma-ui
and forma-wgpu and on no platform crate, and builds for the web and
Android.Added
App,Frame,Context,Settings,WindowSettings,WindowState,
WindowIcon,WindowKey,ExitWhen,Waker,Task,SettingsFile,
OsClipboard, and the services' types - notifications, the tray,
hotkeys, printing, watching the clipboard, file dialogs, recent
documents, one instance at a time, the system's settings - behind
features of the same names as forma-winit's.testing::AppHarness<A: App>(ADR 0092): runs an app asrundoes -
launched,start, the builds,update,woken, the windows opening
and closing, in the same order - with every window a formaHarness, on
a manual clock. It opens windows, feeds input, asks to close, resizes,
advances the clock (stopping at each wakeup), answers file dialogs
(dialog,close_dialog), sends Back, suspends and resumes, hands drags
between windows, and reports titles, attention, activation and whether a
window is kept out of screenshots.Context::now,clock,with_clock,advance_clockanddispatch:
the app's clock, the system's inrun.Contextimplements
Timekeeper.FileRef(ADR 0108): a file the user handed to the app, read and
written the same way on the desktop, Android and the web -name,
path(on the desktop),read,read_bytes,read_to_string,
write(aFileWriterthat puts what was written in the file's place
as it finishes),write_bytes,keep;FileRef::from_path, and
FileRef::memoryfor tests.KeptFileandContext::restore_file: a
file reached again in a later run.App::suspended,resumedandsave_state(ADR 0102): the app went
into the background, where the system may stop it withoutexiting,
came back, and should save now. Desktop runners never call them.App::back_requestedandBackResponse(ADR 0104): the platform's
Back while the app says it can go back (Context::set_can_go_back).App::dropped_from_window(frame, WindowDrop): a drag let go over
another window of the app;Frame::screen_point(at).Context::data_dir()andcache_dir(): the app's own directories.
Context::open_url(url), withOpenError, which moved here and has an
Unsupportedcase.Context::keep_screen_on,set_orientation
(Orientation),multiple_windows,touch_firstandhaptic(Haptic)
(Press,LongPress,Tick).Context::rebuild_window(key): one
window built again, not all.Frame::set_title.- Screens kept out of screenshots, recordings and the app switcher:
WindowSettings::secure,Settings::secureandFrame::set_secure,
failing withSecureErrorwhere the platform cannot. - Watching the clipboard reads any type a copy offers as it is
(ClipboardFormat::Bytes(type),ClipboardOffer::bytes) and says how
large each type read was (ClipboardOffer::size). - Secrets copied for a while (ADR 0112):
OsClipboard::set_secret_text_until(text, at)takes the copy off the
clipboard atatif it still holds it (cleared all the same where the
clipboard cannot be read to tell), also while the app is stopped on
Android;OsClipboard::secret_expiry();App::clipboard_expiry_failed. - The
device-keysfeature (ADR 0110):Context::device_key(name), a
DeviceKeythat the system keeps and uses only right after the user's
fingerprint or PIN, sealing a small secret (create,delete,seal,
open, each prompt's texts the app's), answered through
App::device_key_doneas aKeyOutcome;Context::device_keys_ready;
Sealed, the sealed secret's format;Opened, zeroed when dropped;
MemoryDeviceKeysfor tests. - The
autofillfeature (ADR 0111):AutofillHandler, plain Rust that
an app implements to fill other apps' and web pages' login forms from
its vault and save what is typed -FillRequest(withlogin(),
forma's guess at the login form),FillAnswer,Dataset,Lockedand
Unlock,SaveRequest,SaveAnswer- built and tested on Linux with
FillRequest::for_test. SystemSettings::motion_scale, which the default
App::system_settings_changedpasses on withUi::set_motion_scale.- For runners,
forma_app::host:Host(every method defaulting to "the
platform does not have it"),WindowHost,RunnerContext,Sinkand
HostEvent, the app's directories (set_app_dirs,AppDirs::new),
files,clipboard(timed secrets),device_keys, and the accessors a
runner shows a file dialog, a tray icon or a notification with.
Changed
- The default
Appcallbacks that report a failure start their line with
forma:, notforma-winit:, and write it to the browser's console on
wasm32. SettingsFileis documented to load inApp::launched(on Android the
runner says where the app's files are only as it starts) and to save in
App::save_stateas well asexiting.
forma-android
New and experimental: runs forma apps on Android, on android-activity with
GameActivity, from Android 10 (API 29) (ADR 0101). On other targets it
only re-exports forma-app.Added
forma_android::run(android, settings, app)runs anAppin an
activity, asforma_winit::runruns it on the desktop;AndroidAppand
the app API are re-exported, andandroid_app(&frame)reaches the
activity. One screen: another window never opens, and
App::window_closedsays so.- Drawing with Vulkan, or OpenGL ES where Vulkan is missing and on the
emulator, following rotation and split screen; the display's density as
the scale; light and dark mode; the system's fonts, for every script. - Touch, a pen with its pressure, a mouse and a hardware keyboard. The app
is touch first: the standard themes come with the touch metrics, and a
long press or a swipe's tick vibrates. - The app's lifecycle:
suspendedandsave_stategoing to the
background,resumedcoming back, the screen and its state kept while
there is no window. - Edge to edge on every version, the bars transparent: the screen's
Ui
hears the insets - the bars, a cutout, the keyboard, the system's
gesture edges - and the bars' icons follow the theme's background. - The on-screen keyboard, through a Java helper embedded in the library:
shown for a field that takes text, with its hints (digits for a number,
no learning and no suggestions for a password or a private field, a
line break in a text area), typing, composing, swipe typing and
corrections reaching the field, the keyboard's caret saying where an
edit is. - Back: the topmost popup first, then the app while it can go back
(App::back_requested), then the system, from Android 10 on. The volume
keys, a headset's and the media keys go to the system. - The clipboard, as
Context::clipboardand in the fields - text, HTML,
and secrets marked sensitive - and timed secret copies, cleared by an
alarm also while the app is in the background or stopped. - The user's font size and the system's settings: reduced motion, high
contrast (the theme follows), the accent color from Android 12 on, and
the animator duration scale as the motion scale. - File dialogs show the system's picker (the Storage Access Framework):
open, open many, save and a folder, a document kept across restarts with
FileRef::keep. Context::data_dir,cache_dirandSettingsFilein the app's own
storage;Context::open_urlthrough an intent;keep_screen_onand
set_orientation.- TalkBack: forma's accessibility tree, through accesskit_android.
- A screen kept out of screenshots (
FLAG_SECURE) from its settings and
Frame::set_secure; a screen asked to be kept out that cannot be is not
shown, andrunstops withRunError::Secure. - Device keys, in the Android Keystore with the system's
BiometricPrompt. - Autofill: an autofill service and its unlock activity, which hand
Android's requests to the app'sAutofillHandler, named with
forma_android::autofill_handler!;autofill::is_enabled(frame)and
autofill::ask_to_enable(frame)(AutofillSettingsError). template/: an app that runs on the desktop (cargo run) and on
Android, with a Gradle project that builds it with cargo-ndk and takes
the app's id and name as properties. Its manifest keeps the app out of
backups, declaresUSE_BIOMETRIC, the clipboard's receiver and, with
-Pforma.autofill=true, the autofill service; its README names what an
app keeps and copies again with each version.examples/mobile/, forma-mobile: one app for a phone and the desktop
that shows every phone feature of 0.4, autofill included.scripts/dex.shcompiles the Java helper into the committed DEX, and
--checkfails if it differs.
forma-winit
Changed (breaking)
- The app API is forma-app's, re-exported under the names it had: an app
that imports fromforma_winitkeeps compiling, apart from what
follows. forma-app, and with it forma-wgpu, is a dependency whatever the
features, so forma-winit withoutrunbuilds wgpu. App::unhandledgets anUnhandledinstead of winit'sWindowEvent:
event.inputis the event in forma's words, and
forma_winit::window_event(event)is winit's.Frame::window()isforma_winit::window(&frame), anOption(None
for a window that is not winit's).Frame::set_titlesets a title
without it.OsClipboard::newandfor_displaycome from the trait
OsClipboardExt, andContext::recent_documentsfrom
RecentDocumentsExt: each has to be in scope.App::dialog_closedhands outOption<Vec<FileRef>>instead of paths.
A save through aFileRefreplaces the file at once (written beside it
and renamed over it), wherestd::fs::writewrote it in place.Attentionis non-exhaustive: amatchon it needs a_arm. A level
added later asks as strongly as winit can.
Changed
Context::activateraises an open window on Wayland, with the
activation token it is given, through xdg-activation on a connection of
forma's own beside winit's (ADR 0093). It fails with
ActivateError::Unsupportedonly without a token or without
xdg-activation.Frame::print_pdfgives the print dialog its window as the parent on
Wayland too, through xdg-foreign.- A notched mouse wheel's steps are sent as
InputEvent::WheelSteps, which
glide; a trackpad's pixels stayInputEvent::Scroll. Code of an app's
own that matchesScrollinWinitInput's events sees a wheel as
WheelStepsnow. OpenErroris there without theopenfeature too.
Added
forma_winit::window(&frame),window_event(&event),OsClipboardExt,
RecentDocumentsExt, andforma_winit::forma_app, the app API with its
hostmodule.- Files dragged in from other apps drop onto windows on Wayland, through a
data device of forma's own on its connection. - Drags out of a window to other apps (ADR 0099), on Wayland and X11 (the
source side of XDND), once a drag with an offer leaves the window;
Escape calls it off. - Drags between the app's own windows on X11 (ADR 0109), calling
App::dropped_from_window;Frame::screen_pointon X11, Windows and
macOS. runin a browser (ADR 0100): it draws into the page's canvas (or one
it adds), with WebGPU or WebGL2, one window, the window's title the
page's. Theclipboardfeature there is the browser's clipboard, text
only;open_urlopens a new tab; file dialogs show the browser's chooser
and save as a download; the other services say they are not there.
stderr and panics go to the console.tools/web/build.shbuilds an
example for the browser and serves it.runtakes a timed secret off the clipboard at its time, with or
without a window, and as the app ends.- The
editorsanddevice-keysfeatures, forma-ui's and forma-app's;
device keys answerUnsupportedon the desktop and in a browser. - A window opened with
WindowSettings::secureopens as before and says
on stderr that it cannot be kept out of screenshots there. - The gallery: a Settings page (the property grid and navigation list), a
Log page, Canvas, Nodes, Curves and Diff pages (with undo), a Styles
page, a Theme page (a theme editor with a live preview, the contrast
report and theme files), a Text roles page, a Motion page with a speed
factor and reduced motion, button variants on the Controls page, and on
the System page a drop zone, a file and text to drag out, and a secret
copied for 10 seconds. Its panels float, and it runs in a browser.
Fixed
- On X11 files dragged in from another app drop on the widget they are
let go over, and its highlight follows them; before, they dropped where
the pointer was before the drag. - forma-winit builds for macOS and Windows with the
printfeature
again.
Downloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads
- forma-wgpu: wgpu's