Repository navigation
0.1.0
Apps follow the Windows light or dark mode, can set their own palette,
accent and title bar colors, and restyle live. A new Appearance example
shows the common controls in each theme, and Ui.toggle_switch adds a Fluent
on/off switch. The host now does native work in proportion to what a
change touches, so large windows and fast updates stay smooth. Choice
controls, trees, radios and tabs take their items as children, which
breaks existing calls; see the migration steps below.
Roc compiler
Built and tested with Roc nightly-2026-11-26-890d6c8. Earlier versions may be incompatible.
Use roc version to check your installation.
Download the tested Roc nightly.
Known issues
- With this nightly,
--opt=speedcan miscompileList.mapover a list
of UI elements or signals
(roc-lang/roc#13391). The
app then corrupts its heap or crashes while mounting its window.
speedis the default profile forbuildandpackage, while
windows.roc testandwindows.roc devuse the dev backend, so specs
can pass while a packaged app fails. The platform avoids the
pattern itself. If an app hits it, build with--profile size, or build
the list with a fold, as the platform does, instead ofList.map.
Use this release
The Reading List starter uses this header in src/main.roc. Use the
pf declaration to pin the same platform bundle in your own app.
app [main, native] {
logic: "../logic/main.roc",
pf: platform "https://github.com/lukewilliamboswell/roc-native-windows/releases/download/0.1.0/roc-native-windows-0_1_0-7k7oGJDpq4cGsFsqAZjWUXs1YbQiTJR1uiNWzRc6Sa8v.tar.zst",
}Getting started
With the tested compiler available as roc, run this in PowerShell on Windows x64.
$tool = 'https://github.com/lukewilliamboswell/roc-native-windows/releases/download/0.1.0/windows-0_1_0-9emVuQR1ioEASkcUEt8hDC3uxh1grJfmuTSrrD2VktDg.tar.zst'
roc $tool -- init reading-list
Set-Location reading-list
roc windows.roc -- test --target x64mingw
roc windows.roc -- package --target x64mingwThe init command creates the app and writes windows.roc. Packaging
downloads the matching MSI packager and writes dist/reading-list-x64mingw.msi.
Open the installer and launch Reading List from the Start menu, or start
it with hot reload during development.
roc windows.roc -- dev --target x64mingwUse --target arm64mingw for Windows ARM64. To start with a single-file
Counter, run roc $tool -- init --simple counter from the parent directory.
App manual.
Breaking changes
-
windows.roc runis gone. Usewindows.roc dev, which builds with the
Roc dev backend and relaunches on Ctrl+R.buildandpackagestill
default to--profile speedand now also accept--profile dev.
windows.roc testbuilds its scenario executable with the dev backend
by default; pass--profile sizeor--profile speedto change it. -
Ui.windowtakesappearanceas a signal. Wrap an existing record in
Engine.const(...). Its encoded attribute replacesaccent. -
Choice controls and trees take their items as children, like report
rows, so items kept in anEngine.tablecost only the rows a change
writes. Thechoices,tabs,nodesandexpandedprops are gone.
Wire tags are unchanged, and visible text and accessible names stay
the same.-
Ui.combo_boxandUi.list_boxtake their options as a second
argument:Ui.options(list)for fixed options,Ui.options_s(signal)
for a signal of a list, or
Ui.rows_by(table, sort, |key, row| Ui.option(label, { key: key.map(U64.to_str) }))
for table rows. A table’s keys and sort values must be ordered, such
as numbers.# Before Ui.combo_box({ label: "Theme", choices: Engine.const(themes), selected, on_select }) # After Ui.combo_box({ label: "Theme", selected, on_select }, Ui.options(themes))
-
Ui.tree_viewtakes its nodes as a second argument:
Ui.tree_nodes(nodes, expanded)for the old list and expanded set,
Ui.tree_literal(items, expanded)for a nested fixed tree, or
Ui.tree_node(label, { key, parent, expanded })rows of a table.# Before Ui.tree_view({ label: "Folders", nodes, expanded, selected, on_select, on_expand }) # After Ui.tree_view({ label: "Folders", selected, on_select, on_expand }, Ui.tree_nodes(nodes, expanded))
-
Ui.radio_grouptakes a list ofUi.radio(key, label, { enabled })
as a second argument.Ui.radios(choices)keeps the old fixed radios.
A radio’s label and availability can now change, while its key stays
fixed.# Before Ui.radio_group({ label: "Mode", choices, selected, on_select }) # After Ui.radio_group({ label: "Mode", selected, on_select }, Ui.radios(choices))
-
Ui.tabstakes a list ofUi.tab(key, label)before the page.
Ui.tab_list(choices)keeps the old fixed tabs. A tab’s label can
now change in place.# Before Ui.tabs({ label: "Details", tabs: choices, selected, on_select }, page) # After Ui.tabs({ label: "Details", selected, on_select }, Ui.tab_list(choices), page)
-
Features
- Windows follow the system light or dark mode by default. Set
scheme
toLightorDarkto choose one. Dark windows use dark title bars,
scrollbars and stock controls. palettesets app window, surface and text colors for each scheme, and
captioncolors the title bar. Derived colors keep readable contrast.- Appearance changes restyle a running window, including its dialogs.
- HTTP, Workers and Files have their own themes: a dark "Terminal", a
slate and amber "Ledger" that follows the system mode, and a dark
"Darkroom". Their shaders take theme colors throughparameters. Ui.toggle_switchadds an on/off switch. It takes the same title,
checkedandon_changeasUi.checkboxand reads as a check box
to assistive technology.- Counter now uses the default Windows look. Reading List, which
init
generates, has a warm paper theme with an oxblood accent and a Crimson
Text title. Todos has a cool indigo theme. Both color the title bar and
follow light and dark mode. Ui.buttontakesemphasis : [Standard, Accent]. An accent button
stays a native button with a rounded accent fill. Appearance’s Save
button uses it.- Selected rows in lists, list boxes, trees, grids and dropdowns use the
app’s accent when it sets an accent or palette. - Sliders and progress bars draw an accent fill on a Fluent track in dark
and custom palettes. Column headers, disabled buttons and disabled date
and time fields follow the palette. WindowStartuptakessize : [SystemSize, Size({ width, height })]
for the initial client area in DIP.- Packaged fonts take the weight their file declares, so static Medium
and SemiBold files load. - Native specs can assert how much native work a step causes with
(expect-work (set-window-pos = 0) (invalidate <= 4)). Appearance’s
specs use it to keep slider changes from moving or redrawing the
window. Ui.list_viewandUi.data_gridtakesort : Signal(ctx, [Unsorted, Ascending(Str), Descending(Str)])
to show a sort arrow on a column’s header, also in dark mode. Reading
List shows it when Title sorts the list.Ui.rows_by(table, sort, template)draws every row of an
Engine.tableordered bysortand then by key, for options, report
rows and tree nodes.- Trees hold up to 16,384 nodes, up from 4,096.
- Files keeps its picked files in an
Engine.table, and its Hex preview
format is available once the file’s bytes are read. - The new Appearance example is a theme gallery. Its mode, theme and
toggle switches drive one appearance signal, and a preview of the
common controls, text styles and surfaces restyles live.
Performance
- The host now does native work in proportion to what a change touches,
not to the size of the window. A batch syncs only the nodes it changed,
restyles every control only when the palette changes, and lays the
window out again only when a size can change, reusing every other
measurement. Windows a batch does not touch are not visited. In the
Appearance gallery, a Volume slider tick visits 2 nodes instead of 90
and lays nothing out, and an accent hue tick lays nothing out.
ROC_WINDOWS_FULL_SYNC=1restores the full sync for comparison. windows.roc devlogs any sync whose native work
is out of proportion to its change, naming the counters, the changed
nodes and the time. SetROC_HOST_BUDGET_SENTRY=0to silence it.
(tick-interval MS coalesced)lets specs budget the one sync that
queued completions share, and specs write a JSON-lines work report
with span timings and GDI and USER handle counts.- A change to one control lays out and moves only what it changed. A
column places only its changed children, and the ones after them only
when a height changes, and the controls that kept their place are not
checked again.
Fixes
- Windows taller than about 32,000 pixels show their lower controls when
scrolled. Before, every control past that point piled up at the same
place, and every change moved them all again. - Checkboxes, radio buttons, group boxes and toolbars on tinted panels
now use the panel background instead of a system-colored box. - Resizing a window now keeps styled text and panel borders intact.
This fixes clipped headings and streaks in apps such as Reading List. - Dragging a slider no longer makes the window flicker. Appearance
changes repaint only the controls whose colors change, title bar colors
are written only when they change, unchanged controls are not moved
and custom painters draw off screen first. - Dark text areas, list boxes and dropdowns use dark scrollbars, and dark
list views no longer rule every column. Dark toolbar text is readable. - The main window shows its vertical scrollbar only when content
overflows. - Spec screenshots and recordings now include radio buttons in groups,
list view headers and flat field borders, as on screen. - Cancelled HTTP requests stop at once instead of holding a worker until
their timeout, so a search that cancels a request per keystroke no
longer runs out of workers. More than 32 effects at once now wait in a
queue instead of failing as unavailable, as they already did in specs. - Effect answers that arrive together update the window once, and an
idle app no longer wakes 64 times a second. - Changing an image keeps the old picture until the new one is ready,
and changing a shader texture no longer flashes "Preparing shader
preview". The placeholder uses the window background. - Local storage writes and Save As copies no longer block the window.
Storage writes finish in the background, and the app waits for them on
exit. A failed storage write is reported instead of closing the app. - Texts that share a packaged font, and buttons that share an icon, load
it once.