@tarve/core 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/README.md +67 -10
  3. package/dist/npm/build.js +823 -83
  4. package/dist/npm/cli.js +1087 -116
  5. package/dist/npm/embedded-assets.js +15 -1
  6. package/dist/npm/index.js +2468 -181
  7. package/dist/npm/native-runtime.json +3 -3
  8. package/dist/npm/node-build.js +865 -0
  9. package/dist/npm/protocol.js +1 -1
  10. package/dist/npm/runtime.js +5 -5
  11. package/dist/types/core/app-metadata.d.ts +49 -0
  12. package/dist/types/core/build.d.ts +21 -0
  13. package/dist/types/core/cli.d.ts +1 -1
  14. package/dist/types/core/esbuild-file-imports.d.ts +8 -0
  15. package/dist/types/core/node-build.d.ts +7 -0
  16. package/dist/types/core/node-dev.d.ts +4 -0
  17. package/dist/types/core/node-target.d.ts +10 -0
  18. package/dist/types/core/runtime-select.d.ts +8 -0
  19. package/dist/types/core/src/app-metadata.d.ts +16 -0
  20. package/dist/types/core/src/app.d.ts +87 -2
  21. package/dist/types/core/src/assets.d.ts +4 -0
  22. package/dist/types/core/src/bridge/binding.d.ts +10 -34
  23. package/dist/types/core/src/canvas.d.ts +161 -0
  24. package/dist/types/core/src/components/image.d.ts +7 -3
  25. package/dist/types/core/src/components/layout.d.ts +4 -3
  26. package/dist/types/core/src/components/pressable.d.ts +2 -2
  27. package/dist/types/core/src/extra-controls.d.ts +1 -1
  28. package/dist/types/core/src/html-elements.d.ts +26 -0
  29. package/dist/types/core/src/index.d.ts +4 -1
  30. package/dist/types/core/src/inline-text.d.ts +21 -0
  31. package/dist/types/core/src/jsx-runtime.d.ts +175 -4
  32. package/dist/types/core/src/media-element.d.ts +71 -0
  33. package/dist/types/core/src/memo.d.ts +18 -0
  34. package/dist/types/core/src/png.d.ts +29 -0
  35. package/dist/types/core/src/popups.d.ts +3 -2
  36. package/dist/types/core/src/reconciler.d.ts +27 -3
  37. package/dist/types/core/src/test-renderer.d.ts +2 -0
  38. package/dist/types/core/src/theme.d.ts +2 -1
  39. package/dist/types/core/src/virtual-list.d.ts +5 -1
  40. package/dist/types/core/windows-executable.d.ts +16 -0
  41. package/dist/types/protocol/src/index.d.ts +187 -5
  42. package/native/linux-x64/libtarve_native.so +0 -0
  43. package/native/linux-x64/runtime.json +4 -4
  44. package/native/win32-x64/runtime.json +4 -4
  45. package/native/win32-x64/tarve_native.dll +0 -0
  46. package/package.json +11 -2
package/CHANGELOG.md CHANGED
@@ -1,6 +1,85 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to `@tarve/core` and `@tarve/react-icons` are documented here. Versions follow [Semantic Versioning](https://semver.org/); before 1.0, minor versions may contain breaking changes.
3
+ All notable changes to `@tarve/core`, `@tarve/react-icons` and `@tarve/headless` are documented here. Versions follow [Semantic Versioning](https://semver.org/); before 1.0, minor versions may contain breaking changes.
4
+
5
+ ## Unreleased
6
+
7
+ ## 0.5.0 — 2026-10-12
8
+
9
+ ### Performance
10
+ - D3D11 draws circles, rounded rectangles with one radius and round SVG dots (zero-length round-capped segments, as dot-matrix charts use) as one quad each from a distance field, instead of flattening, tessellating and feathering an outline. On the Pulse example (eight dot charts refreshed every second) the app process went from ~3.2% to ~1.9% of a core and from ~120 MB to ~77 MB of working set.
11
+ - `@tarve/react-icons` adapters remember their result per icon component and props (`memoizeAdapter`), so an icon on screen runs its React component and serializes its SVG once, not on every update.
12
+
13
+ ### Added
14
+ - App icon and metadata from one place: a `"tarve"` field in `package.json` (`name`, `description`, `publisher`, `copyright`, `icon`, `appId`, per-entry overrides under `apps`) or `tarve build --icon/--publisher/--copyright/--description/--app-id`. `tarve build` writes them into the executable (Bun and Node builds alike: multi-size `.ico`, version info, no Node.js branding) and writes a `.desktop` file with the icon on Linux. `createApp({ icon })` sets the window and taskbar icon (PNG or ICO, Windows and Linux), and `app.tray()` without its own `icon` shows it too; `tarve run`/`dev` and built apps pick the icon, name and app id up from the metadata, so media controls and notifications are named without an explicit `appIdentity`.
15
+ - `<Image src="https://…">` (and `<img>`): the native side fetches and decodes a URL on worker threads the first time the image is painted, so off-screen images are not downloaded, then lays it out with its decoded size. Up to six downloads run at once, newest first; a failed image is tried again when it is shown again; a remote SVG never reads local files through `<image href>`; responses with `Cache-Control: max-age` go to a disk cache. `@tarve/headless` fetches them with `fetch()` and `settle()` waits for them. Apps no longer need `loadImageSource` plus their own visibility tracking; the YouTube Music example dropped its artwork loader and every scroll listener it kept for it.
16
+ - `app.scrollToItem(id, index, offset, { smooth: true })` eases a variable VirtualList to the item on the native motion clock (300–900 ms by distance) and reports each step through `onScroll`; wheeling cancels it. The performance example's 16 ms `setInterval` scroll animation is gone.
17
+ - `inspect().fps`: frames presented in the last second, so a frame-rate meter no longer differences frame counters itself.
18
+ - `<Tooltip>` without `open` is uncontrolled: it shows while its trigger is hovered, one tooltip at a time, so apps no longer track which tip is open. `open` + `onOpenChange` still control it.
19
+ - Intrinsic `<div>` follows more of CSS: `overflow: "auto"`/`"scroll"` makes it a scroll container (vertical; `overflowX` adds the horizontal axis), `display: "flex"` lays children in a row unless `flexDirection` says otherwise, and `alignItems`, `justifyContent` and `borderRadius` alias `align`, `justify` and `radius`. `<img style={{ objectFit }}>` sets its fit. `<label htmlFor>` can point at a `<meter>` or `<progress>`.
20
+ - `fontVariantNumeric` (`tabular-nums`, `slashed-zero`, …) and `fontFeatureSettings` (`'"ss01" 1'`), as in CSS; both inherit. Tabular digits keep live numbers from jittering.
21
+ - `onPointerMove({ x, y })` and `onPointerLeave()` on any element: the pointer's position inside it (DOM `offsetX`/`offsetY`) while it is over the element or its children, for scrubbing charts and other hover readouts. The test renderer's locators gain `hover(offset?)`.
22
+ - `scrollbarWidth: "none" | "thin"` on scroll areas and text areas, as CSS `scrollbar-width`: `none` hides the bar and its hit area, the box still scrolls.
23
+ - `import font from "./Inter.ttf" with { type: "file" }` (and `.otf`, `.woff2`, `.webp`) type-checks.
24
+ - Windows media controls: `app.systemMedia({ title, artist, album, artwork, playing, duration, position, canSeek, canNext, canPrevious, onAction })` shows the current track in the system media flyout and lock screen, and forwards play, pause, next, previous and seek (hardware media keys included) to `onAction`; `null` clears it. The `appIdentity: { id, name, icon? }` option names the app there and in notifications instead of the host executable or "Unknown app".
25
+ - `examples/pulse.tsx`: a clone of the Pulse system monitor with live data a user program can read on Windows without administrator rights: CPU and per-core load, load averages, temperatures, package and GPU power, energy by app, the memory split (app, wired, compressed, cached, free), GPU, disk, network, battery health and cycles, and every process with its program icon. Ships its font and uses Phosphor icons.
26
+ - `app.setMaxFps(fps)` and the `maxFps` option set the animation frame rate (transitions, `spin`, keyframes); `null` follows the display's refresh rate. Animations stay clock-based, so a lower rate draws fewer frames at the same speed. The clock now ticks on a fixed grid: a late frame no longer delays the next one, so 60 fps animations run at 60 instead of ~52. Example: `examples/fps.tsx`. Native protocol v55.
27
+ - `<audio src controls autoPlay loop muted volume>` with the browser's default control bar (play/pause, time, seek, mute) and `onLoadedMetadata`, `onPlay`, `onPause`, `onTimeUpdate`, `onSeeked`, `onEnded`, `onError`. Play after the end starts over, as in `HTMLMediaElement`. `app.media(id)` plays, pauses, seeks and sets volume. MP3, WAV, FLAC, Ogg Vorbis and AAC/MP4 decode in pure Rust (rodio): WASAPI on Windows, ALSA on Linux (`libasound2` at runtime, `libasound2-dev` to build). Without an output device, or with `TARVE_AUDIO=silent`, playback runs on a real-time silent clock so time and `ended` still advance. `bun run smoke:media` checks the lifecycle. Native protocol v54.
28
+ - `<audio src="https://…">` streams: playback starts once the first 256 KB chunk arrives (≈0.15 s on YouTube's CDN), the rest downloads behind it over up to four HTTP range connections (rustls via `ureq`, no system TLS), and a seek fetches the chunk it lands in first. Servers without range support still stream in order. Remote MP4s open unseekable so they start before the file is in; the first seek builds a seekable decoder in the background and then emits `seeked`. A connection that fails mid-way reports `error`, not `ended`.
29
+ - `memo(Component, equal?)`: a component whose compiled subtree is reused while its props are equal (shallowly by default), so an update renders, compiles and diffs only the components whose props changed. Reused subtrees keep their native shadow, so the diff skips them by identity; subtrees tied to a `<label htmlFor>` elsewhere, or containing the `Window`, always recompile. In the YouTube Music example the clock ticking during playback costs 1.4 ms per update instead of 30 ms.
30
+ - `onSize` on any node (a ResizeObserver): native sends the content-box size on first layout and whenever it changes, window resizes included.
31
+ - `VirtualList` without `height` fills its parent (`flex: 1`) and follows its real laid-out height through `onSize`; it needs an `id`. Fixed, variable and windowed lists all support it.
32
+ - A handler that runs inside a `memo` subtree recompiles that subtree on the next render, so components keeping their own state (VirtualList's measured height) stay current.
33
+ - Anonymous nodes are named from their nearest node instead of the root, so scrolling a virtual list sends about 40% fewer bytes per step; memo bookkeeping no longer rescans every compiled node on each cache miss.
34
+ - Decoded images are shared by `key`: a new node showing a cached key reuses the decode, and images no node shows stay decoded (up to 256, 32 MB of CPU pixels; on D3D11 only the texture) so a list row scrolling back or a page reopening decodes nothing. Returning to the YouTube Music home (125 covers): 104–126 ms → 58–68 ms. Byte sources are base64-encoded once per source object. Measured and rejected: a binary bridge for image bytes, which saved under 0.1 ms per cover against 0.35 ms of JPEG decode.
35
+ - `memo` keeps nested memoized components alive from a list recorded at compile time instead of scanning every cache entry on each hit: an update of 2,000 memoized rows went from 19 ms to 3.7 ms of JS.
36
+ - Text measurement is cached per width, and any width at least as wide as the unwrapped line reuses the unwrapped size: a window resize relayouts 2,000 labelled rows in 18 ms instead of 21.5 ms, and 400 wrapped paragraphs in 9 ms instead of 13 ms.
37
+ - `createApp({ headless: true })` (tests, captures, `createTestRenderer`) renders on the CPU unless a `renderer` is given: a hidden window never reaches the screen, so it no longer loads the GPU driver. Empty headless app on Windows: 138 MB → 51 MB working set, first frame 86 ms → 20 ms.
38
+ - Windows: once a window has been idle for `memoryTrimDelay` ms (default 3000) after its last frame, the pages only startup touched (driver and shader setup) are handed back with `EmptyWorkingSet` (the first time even while animating: startup's pages are done with by then; later only after the window has been still that long); they stay committed and return from the standby list if touched. Counter app: 50 MB → 3 MB private working set (Task Manager). `memoryTrimDelay: false` turns it off; `TARVE_TRIM` (ms, 0 = off) overrides it.
39
+ - D3D11 no longer multisamples by default: `msaa: 0` (the default) gives filled and stroked shapes a one-pixel coverage fringe instead, ~30 MB less memory (counter app: 80 → 50 MB private working set, 259 → 229 MB committed). Without MSAA, a rectangle, rounded rectangle or circle clip (`overflow: hidden` with `radius`, gradient fills, nested scroll areas, also rotated, e.g. spinning) is applied in the pixel shader with coverage, as MyGo does; other `clip-path` shapes and hard stops inside gradients stay aliased. `msaa: 2 | 4 | 8` (or `TARVE_MSAA`) brings MSAA back.
40
+ - D3D11 keeps an uploaded image only as its texture: the decoded CPU pixels are released after upload and decoded again from the node if the texture is lost, and fully restored when another renderer takes over. 30 screenshot-sized images: 622 MB → 429 MB working set.
41
+ - `<canvas width height onDraw={ctx => …}>` with the Canvas 2D API: paths (`moveTo`, `lineTo`, `quadraticCurveTo`, `bezierCurveTo`, `arc`, `arcTo`, `ellipse`, `rect`, `roundRect`), `fill` (nonzero/evenodd), `stroke` (width, caps, joins, miter limit, dashes), `fillRect`/`strokeRect`/`clearRect`, linear and radial gradients, `save`/`restore`, `translate`/`rotate`/`scale`/`setTransform`, `globalAlpha` and `fillText`/`strokeText` with the CSS `font` shorthand. Each render records into a vector scene, sharp at any DPI. `bun run test:canvas` compares 10 drawings pixel by pixel with Chromium's canvas.
42
+ - `<sub>` and `<sup>`: `vertical-align: sub | super` with `font-size: smaller`, shifting by Chromium's parent size / 5 + 1px and / 3 + 1px, nesting, and growing the line box (and the lines below it) to contain the shifted text; selection and caret follow. The CSS parity suite checks them against Chromium within 2px.
43
+ - `<input type="color">` (swatch, palette and hex field; values normalize to lowercase `#rrggbb`) and `<input type="time">` (`HH:MM`, 24-hour; invalid entries submit as empty, as in HTML).
44
+ - `display: "block"`: CSS block flow, where adjacent vertical margins collapse (Taffy's block layout). In a flex container margins add up, as in CSS. The CSS parity suite covers collapsing paragraphs and headings (49 layouts).
45
+ - **Breaking:** HTML block elements get the browser's user-agent margins: `<p>` and `<pre>` 1em above and below, `<h1>`–`<h6>` 0.67em–2.33em, lists and `<dl>` 1em, `<blockquote>` 1em 40px. `Text`, `View` and the other components are unchanged; set `margin` to override.
46
+ - `cursor` style (CSS keywords, inherited by descendants). `gridColumn`/`gridRow` placements (`"span 2"`, `"1 / 3"`), and table `colSpan`/`rowSpan`. `<pre>`, `<blockquote>`, `<meter>` and `<abbr title>`. The CSS parity suite covers spanning tables, `pre` and `blockquote` (46 layouts). Native protocol v53.
47
+ - HTML elements: `<input type="checkbox" | "radio" | "range" | "date" | "file">` (radios grouped by `name`; `accept`/`multiple` for files through the native dialog); `<form onSubmit onInvalid>` collecting named values on Enter or a submit button, with `required`, and `<button type="button">` opting out; `<fieldset>`/`<legend>`; `<ul>`, `<ol start>`, `<li>`, `<dl>`/`<dt>`/`<dd>` with the user-agent 40px indent; `<table>` with `caption`/`thead`/`tbody`/`tfoot`/`tr`/`th`/`td` as auto columns with `border-spacing: 2px` and 1px cell padding; `<details>`/`<summary>`. Uncontrolled elements keep their state like the DOM. The CSS parity suite adds lists and a table against Chromium (43 layouts). Bare string children now inherit text style like any text. Example: `examples/html.tsx`.
48
+ - Text properties are inherited like CSS. `fontFamily`, `fontStyle`, `letterSpacing`, `wordSpacing` and `textTransform` reach every text descendant (text, buttons, inputs, Markdown); `color`, `fontSize`, `fontWeight`, `lineHeight`, `textAlign` and `whiteSpace` also reach `Text`/`p`/`span`/headings and `Markdown`, while controls keep their own size, weight and colour. Set them on a `Window` or any container; a node's own value wins. The theme gives the root's initial values; `Code`, `Diff` and `<code>` stay monospace.
49
+ - **Breaking:** text follows CSS `white-space: normal` by default: runs of spaces and newlines collapse to one space and leading/trailing spaces are dropped. Use `whiteSpace: "pre-wrap"` (or `"pre"`/`"pre-line"`) to keep them, or `<br />` for a line break.
50
+ - CSS text and overflow: phrasing elements inside a paragraph (`strong`, `b`, `em`, `i`, `u`, `s`, `del`, `ins`, `code`, `kbd`, `mark`, `small`, nested `span`, `a`, `br`) become styled runs of one text node with Chromium's user-agent styles and relative `bolder`/`smaller`; `<a href>` and `<span onClick>` inside text are click targets. New styles `fontStyle`, `letterSpacing`, `wordSpacing`, `textTransform`, `whiteSpace` (`normal`/`nowrap`/`pre`/`pre-wrap`/`pre-line`), `textOverflow: "ellipsis"`, `lineClamp` and `overflow: "hidden" | "clip"` (clips children and lets the box shrink below its content). Links and clickable spans inside text show the pointer cursor. `fontFaces` in `createApp` options loads app font files like CSS `@font-face`, and variable fonts follow `font-optical-sizing: auto` (the `opsz` axis tracks the font size). The CSS parity suite covers 15 text cases against Chromium with the bundled Inter on every OS, plus two overflow cases; `bun run smoke:text` checks the painted `<mark>`, ellipsis, clamp and clip pixels. Example: `examples/text.tsx`. Native protocol v52.
51
+ - Windows: dragging a window between monitors with different display scaling keeps its size; it grew by the scale ratio on every crossing and could bounce on the boundary. A window with a custom `TitleBar` can be dragged again right after a move.
52
+ - `@tarve/headless`: renders and tests Tarve apps with the WebAssembly build of the native tree, with no window, GPU or native library. `renderToPng`/`renderToRgba`, `createHeadlessApp`, `createHeadlessTestRenderer` (the `TestRenderer` API) and `matchImageSnapshot`. Text uses bundled Inter and JetBrains Mono and time only moves with `advanceMotion`, so a view renders to the same bytes on every machine. CI runs its image snapshots on Linux, Windows and macOS; releases publish it next to `@tarve/core`.
53
+ - `style.spin`: continuous rotation about the centre, one turn per `spin` milliseconds, driven by the native clock. `Spinner` uses it.
54
+ - `destructiveText` theme colour for error text and icons.
55
+ - Pointer drag and drop. `draggable` on `Pressable` turns a press that travels past 4px into a drag (a short press still clicks); `onDragStart`, `onDragMove` and `onDragEnd` report position, the target under the pointer and whether the drag was cancelled (Escape or window blur). Any view with `onDrop`, `onDragEnter` or `onDragLeave` becomes a drop target; the innermost visible target wins, targets inside the dragged node, clipped by a scroll area, disabled or behind a modal are skipped. Example: `examples/drag-and-drop.tsx`. Native protocol v49.
56
+ - System tray and notifications on Windows and Linux: `app.tray({ icon, tooltip, menu, onClick, onDoubleClick, onMenu })` shows a tray icon with a native menu (items, separators, checkmarks, disabled items, submenus); `update()` changes it in place. `app.notify({ title, body, onClick })` shows a desktop notification. `app.show()`, `app.hide()`, `app.minimize()` and `closeBehavior: "hide"` keep an app running in the tray. Windows calls `Shell_NotifyIconW`/`TrackPopupMenu` directly (no new dependency) and re-adds the icon after Explorer restarts. Linux publishes a StatusNotifierItem with dbusmenu (`ksni`) and uses org.freedesktop.Notifications (`notify-rust`), both pure-Rust zbus; KDE, XFCE, Cinnamon, MATE and most wlroots bars show it natively, GNOME needs the AppIndicator extension (the app gets an error event otherwise). `onDoubleClick` maps to middle click on Linux. Icons are read in JS so compiled executables can use imported assets. `bun run smoke:tray` drives the real icon and menu on both systems. Example: `examples/tray.tsx`. Native protocol v50.
57
+ - CSS flex and grid sizing: `flex` accepts the CSS shorthand (`"1 1 176px"`, `"auto"`, `"none"`), plus `grow` and `basis`. Grid `columns` and new `rows` accept CSS track lists, including `repeat(auto-fill, minmax(176px, 1fr))`, `fr`, percentages and `auto`. `bun run test:css-layout` lays out 23 cases in Chromium and in Tarve and fails on any box more than a pixel apart. Native protocol v51.
58
+ - Node.js 26.10+ runtime alongside Bun: the same TSX apps run through `node:ffi`. One CLI for both: `tarve run|dev|build` uses the runtime that launched it (`bunx`/`bun run` → Bun, `npx`/`npm run` → Node 26.10+, or Bun as before on older Node; `--runtime` overrides). Node builds are single-executable apps with the native library and imported assets embedded, the same GUI subsystem and app name/version metadata as Bun builds; `dev` remounts into the same window on edits; `--target linux-x64`/`windows-x64` cross-compiles by downloading (checksum-verified, cached) the matching official Node.js binary, and `--target-executable` supplies one offline. `build({ runtime: "node" })` and `@tarve/core/build-node` expose the same from code. `TestRenderer`, `launchTestProcess` and `readPngRgba` no longer depend on Bun APIs.
59
+
60
+ ### Fixed
61
+ - HTML elements look like a browser's defaults: a `<fieldset>`'s `<legend>` sits on its top border (regular weight, a 1px light grey border), `<meter>` is green and `<progress>` blue in a light grey track (160×16px, as in Chrome; `Progress` takes its fill colour from `style.foreground`), a `<table>` is as wide as its content, and `<details>` uses a chevron where the ▸ glyph had no font.
62
+ - HTML forms: a named `<select>` and `<textarea>` submit with their `<form>` (`name`, `required`, `defaultValue`), like inputs. An uncontrolled `<select>` shows `defaultValue` or its first enabled option and keeps the user's choice; it showed the placeholder and forgot the choice.
63
+ - Text and phrasing elements (`strong`, `code`, `a`, …) inside `<li>`, `<dt>` and `<dd>` flow into one line box, as in CSS; each element was laid out as its own block. A table `<caption>` is centred over the table.
64
+ - `closeBehavior: "hide"` hides the window from its own close button again; the custom title bar's close button closed the app.
65
+ - A column of auto height whose child has `flex: 1` (basis 0) is as tall as its content when its row sits in a sized parent, as in browsers; it came out as if the child were empty. Fixed in a vendored Taffy 0.14 (`native/vendor/taffy`, one change marked "Tarve patch").
66
+ - Headless (hidden) windows lay out as soon as the tree changes, so `onSize` and virtual-list events arrive without waiting for a capture; nodes created after the first render never got `onSize`.
67
+ - Windows (D3D11) without MSAA: a path of many small shapes (an SVG dot matrix) is no longer quadratic in its contour count; 1,800 dots updated once a second went from ~11% to ~2% of a core.
68
+ - Thin dotted underlines (`text-decoration-style: dotted`, `abbr[title]`) draw square dots snapped to device pixels, as browsers do; round 1px dots smeared into a grey line at fractional scales, on the CPU renderer most visibly.
69
+ - Changing an `<Image>`'s byte source (its `cacheKey` or bytes) on an existing node now repaints; the diff ignored `image` and sent nothing.
70
+ - An explicit `minWidth` on an item with numeric `flex` is respected; it was reset to 0. Grid `auto` tracks stretch to fill the container, as in CSS. `DataGrid` rows and sortable headers are square instead of inheriting `Pressable` rounding.
71
+ - `examples/drag-and-drop-view.tsx` used the unsupported `justify: "space-between"` and failed the package smoke typecheck; it now uses `"between"`.
72
+ - A modal opened with the mouse no longer paints the keyboard focus ring on its first control, and closing it no longer rings the trigger.
73
+ - `Tooltip` text no longer wraps to the width of its trigger; `Command` lists no longer clip with group headings; the search field of `Command` and `Combobox` no longer draws a ring across its icon.
74
+ - `Alert`, `Field` errors and failed `Attachment`s use readable destructive text; `Alert` tints an uncoloured icon; `Field` shows the description with the error; `InputGroup` strips its `Input`'s border; `NavigationMenu` triggers show open and current state.
75
+ - `getByRole("button", { name })` finds plain `Button`s.
76
+ - `InputGroup` is clickable across its whole box: presses on the prefix, suffix or padding focus the field (text cursor included), and the group shows a focus border. New style value `pointerEvents: "delegate"` sends presses on a node's own area to its first enabled input or textarea and gives the node that field's focus state.
77
+
78
+ ### Changed
79
+ - Windows (D3D11): 8x MSAA renders through a fixed 256px tile instead of window-sized targets, and each tile is hashed so an unchanged one is reused from the last frame. Memory no longer grows with the window (2560×1400: 369 → 151 MB of working set) and a hover redraws only the tiles it touches (player example: median GPU time per hover frame 3.9 → 1.3 ms). Linear-gradient bands are cut to the shape's box instead of covering ~7× its area, and draws inside a clip only mark the clip's tiles dirty; the tile hash is computed once per command per frame. With 600 spinning gradient squares: tiles redrawn per frame 16 → 12, CPU time per frame 3.2 → 0.85 ms. Output is identical (gradient edges within 1/255).
80
+ - **Breaking:** `flex` follows CSS. `flex: 1` is now `flex: 1 1 0` with CSS's automatic minimum size: the item shrinks when space runs out but not below its content. Before, a numeric `flex` never shrank and could be squeezed below its content. Add `minWidth: 0` (or `minHeight: 0` in a column) where content should be clipped or scroll instead of pushing the layout, as in CSS. Scroll areas already do this.
81
+ - **Breaking:** every flex item shrinks by default (`shrink: 1`, CSS `flex-shrink: 1`), never below its content; sized `Image`s and `Svg`s keep their size like CSS replaced elements. Set `shrink: 0` to keep a fixed size when space runs out.
82
+ - Startup: the native tree takes the startup document's nodes instead of deep-cloning them (~11 ms and ~23 MB less for a 2,000-row list), and the first layout and text shaping run while the prewarmed D3D11 device finishes. First paint of a 2,000-row list on D3D11 drops from ~384 ms to ~349 ms.
4
83
 
5
84
  ## 0.4.0 — 2026-10-01
6
85
 
package/README.md CHANGED
@@ -75,32 +75,37 @@ await app.ready;
75
75
  await app.closed;
76
76
  ```
77
77
 
78
- Run the source directly with Bun:
78
+ Run it with the `tarve` CLI, under Bun or Node.js 26.10+ — the same commands work with either:
79
79
 
80
80
  ```powershell
81
- bun app.tsx
81
+ bunx tarve run app.tsx # Bun
82
+ npx tarve run app.tsx # Node.js
83
+ bunx tarve dev app.tsx # hot reload into the same window (npx tarve dev on Node)
82
84
  ```
83
85
 
86
+ `tarve` uses the runtime that launched it: `bunx`/`bun run` pick Bun, `npx`/`npm run` pick Node (Bun, as before, when Node is older than 26.10). `--runtime bun|node` overrides it. With Bun you can still run the source directly with `bun app.tsx`.
87
+
84
88
  ## Build a standalone executable
85
89
 
86
90
  The package CLI compiles a Tarve application into a standalone executable and embeds the native runtime. Windows produces a `.exe`; Linux produces an ELF executable with no required extension. The target defaults to the current host. Published Tarve packages contain both Windows x64 and Linux x64 native runtimes, so `--target` can switch between those targets without rebuilding Tarve's Rust runtime.
87
91
 
88
92
  ```powershell
89
- bun run tarve build app.tsx --outfile dist/App.exe
93
+ bunx tarve build app.tsx --outfile dist/App.exe # Bun executable
94
+ npx tarve build app.tsx --outfile dist/App.exe # Node.js executable
90
95
  ```
91
96
 
92
97
  ```bash
93
- bun run tarve build app.tsx --outfile dist/App
98
+ bunx tarve build app.tsx --outfile dist/App
94
99
  ```
95
100
 
96
101
  Cross-compile explicitly from either Windows x64 or Linux x64:
97
102
 
98
103
  ```bash
99
- bun run tarve build app.tsx --target windows-x64 --outfile dist/App.exe
100
- bun run tarve build app.tsx --target linux-x64 --outfile dist/App
104
+ bunx tarve build app.tsx --target windows-x64 --outfile dist/App.exe
105
+ npx tarve build app.tsx --target linux-x64 --outfile dist/App
101
106
  ```
102
107
 
103
- The published package already contains both runtimes, so `tarve build` needs no Rust toolchain.
108
+ The published package already contains both runtimes, so `tarve build` needs no Rust toolchain. Both runtimes produce a GUI executable (no console window on Windows) named and versioned after the app (`--name`, `--version`).
104
109
 
105
110
  The build API is also exported:
106
111
 
@@ -115,6 +120,20 @@ await build({
115
120
  });
116
121
  ```
117
122
 
123
+ ## Node.js runtime
124
+
125
+ The same TSX components, desktop APIs, renderer modes and native bridge run on Node.js 26.10+ with the same `tarve run|dev|build` commands; a Node-only project needs neither Bun nor Rust:
126
+
127
+ ```powershell
128
+ npm install @tarve/core
129
+ npx tarve dev app.tsx
130
+ npx tarve build app.tsx --outfile dist/App.exe
131
+ ```
132
+
133
+ `dev` rebuilds TSX and remounts into the same native window when the entry uses `await render(App)`, as with Bun's hot mode. Node builds compile TSX with esbuild and embed the app and native library in a Node.js single-executable application. Node's FFI and single-executable APIs are experimental in Node 26.
134
+
135
+ The shared build API also accepts `build({ entrypoint: "app.tsx", runtime: "node" })` from `@tarve/core/build`, and Node-only tooling can call `buildNode` from `@tarve/core/build-node`. Cross-compiling works as with Bun: `npx tarve build app.tsx --target linux-x64 --outfile dist/App`. The first build for a target downloads the official Node.js binary of the same version as the Node running the build from nodejs.org (or `NODEJS_ORG_MIRROR`), checks it against the release `SHASUMS256.txt` and caches it (`TARVE_CACHE_DIR`, by default `%LOCALAPPDATA%\tarve\cache` or `~/.cache/tarve`). Offline or with a custom Node build, pass it with `--target-executable path/to/node`; it must be the same Node.js version. As with Bun, the packaged native runtime for that target must match the current protocol.
136
+
118
137
  ## Renderers
119
138
 
120
139
  `createApp` accepts `renderer: "auto" | "gpu" | "cpu"`.
@@ -283,9 +302,30 @@ Base numeric style targets participate in native motion. Interactive `hover`, `f
283
302
 
284
303
  `createTextSearchController` and `findRanges` provide search/navigation helpers for `Text`, `Markdown`, `Code`, and `Diff`.
285
304
 
305
+ ## App icon and metadata
306
+
307
+ Name, icon and publisher live in the app's `package.json` under `"tarve"`; `tarve build`, `tarve run` and `tarve dev` read them, and CLI flags (`--name`, `--version`, `--icon`, `--publisher`, `--copyright`, `--description`, `--app-id`) override them.
308
+
309
+ ```json
310
+ {
311
+ "name": "pulse",
312
+ "version": "1.2.0",
313
+ "tarve": {
314
+ "name": "Pulse",
315
+ "description": "System monitor",
316
+ "publisher": "Example Inc.",
317
+ "copyright": "© 2026 Example Inc.",
318
+ "icon": "assets/icon.png",
319
+ "appId": "Example.Pulse"
320
+ }
321
+ }
322
+ ```
323
+
324
+ A monorepo of apps sets per-entry values under `"tarve": { "apps": { "pulse/pulse.tsx": { … } } }`. The icon is a square PNG (256 px or larger) or an `.ico`: on Windows the build writes a multi-size icon and the version info into the `.exe`, for Bun and Node builds alike; on Linux it writes `<App>.desktop` and `<App>.png` beside the binary. At run time the window and taskbar use the same icon, and `appId` names the app in media controls and notifications. `createApp(view, { icon })` sets the window icon directly.
325
+
286
326
  ## Images
287
327
 
288
- `Image` accepts local paths, data URLs, encoded PNG/JPEG/WebP/SVG bytes, and raw RGBA8 pixels. Raw RGBA is sent directly to the native image cache, so live pixel updates do not require a PNG encode/decode round trip.
328
+ `Image` accepts local paths, `http(s)://` URLs, data URLs, encoded PNG/JPEG/WebP/SVG bytes, and raw RGBA8 pixels. Raw RGBA is sent directly to the native image cache, so live pixel updates do not require a PNG encode/decode round trip.
289
329
 
290
330
  ```tsx
291
331
  <Image
@@ -301,7 +341,13 @@ Base numeric style targets participate in native motion. Interactive `hover`, `f
301
341
  />
302
342
  ```
303
343
 
304
- HTTP(S) loading is explicit and asynchronous. `loadImageSource` supports `AbortSignal`, payload limits, and a bounded in-process LRU cache:
344
+ A URL is fetched and decoded natively, off the UI thread, the first time the image is painted, like `loading="lazy"`: covers further down a list or in a closed panel cost nothing until they scroll in. Until then the image shows its `placeholderBackground`; once decoded it lays out again with its intrinsic size. At most six downloads run at once, and responses with `Cache-Control: max-age` are kept in a disk cache (256 MB) so they survive a restart.
345
+
346
+ ```tsx
347
+ <Image src="https://example.com/cover.webp" width={152} height={152} fit="cover" />
348
+ ```
349
+
350
+ To load bytes yourself (for an `AbortSignal`, a payload limit or to process them), `loadImageSource` fetches into a bounded in-process LRU cache:
305
351
 
306
352
  ```tsx
307
353
  const controller = new AbortController();
@@ -429,6 +475,17 @@ test.close();
429
475
 
430
476
  Use `launchTestProcess` to isolate CPU/GPU test runs in child processes. `readPngRgba`, `comparePngCaptures`, and `assertPngMatches` are reusable pixel-regression helpers; Tarve's own visual smoke tests use the same public PNG decoder.
431
477
 
478
+ ### Without a window: `@tarve/headless`
479
+
480
+ [`@tarve/headless`](packages/headless) runs the same tree, layout, text, input and CPU painter compiled to WebAssembly, so tests need no window, GPU or native library and run on any CI machine. Text uses bundled fonts and time only moves with `advanceMotion`, so captures are byte-identical across platforms.
481
+
482
+ ```tsx
483
+ import { createHeadlessTestRenderer, matchImageSnapshot, renderToRgba } from "@tarve/headless";
484
+
485
+ const test = await createHeadlessTestRenderer(App); // the TestRenderer API above
486
+ await matchImageSnapshot(await renderToRgba(App, { scale: 2 }), "__snapshots__/app.png");
487
+ ```
488
+
432
489
  ## Custom title bar
433
490
 
434
491
  Render `TitleBar` inside `Window` to opt into Tarve-managed window chrome:
@@ -530,7 +587,7 @@ bun run studio
530
587
  bun run performance
531
588
  ```
532
589
 
533
- From the repository root, `bun run dev --entry examples/<name>.tsx` runs an example with hot reload and the development tools enabled.
590
+ From the repository root, `bun run dev --entry examples/<name>/<name>.tsx` runs an example with hot reload and the development tools enabled.
534
591
 
535
592
  `setup:examples` builds host-local package staging itself; it does not require the universal publishable tarball.
536
593