@tarve/core 0.2.0 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,46 @@
2
2
 
3
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.
4
4
 
5
+ ## 0.4.0 — 2026-10-01
6
+
7
+ ### Added
8
+ - `bun run smoke:steady-frames`: scrolls a list on every renderer and fails if redrawing already-seen text rasterizes glyphs again. The debug snapshot reports `glyphRasterizations` on D3D11.
9
+ - `bun run bench:compare <exe…>` with `examples/bench.tsx`: compares compiled builds scene by scene (first frame, memory, idle/busy CPU, GPU memory).
10
+ - `examples/gradients.tsx`: linear, radial and conic gradients, repeating patterns, gradient text and gradient borders in every style.
11
+ - `conic-gradient(…)` and `repeating-conic-gradient(…)` (or `{ type: "conic", from, at, stops }`) for `background`, `borderColor` and `foreground`, in state styles too, on D3D11, Vello GPU and the CPU renderer. `from` and stop positions take `deg`, `turn`, `rad`, `grad` or `%`; `at` takes every position form radial gradients accept. Conic gradients with the same stop count transition stop by stop.
12
+
13
+ ### Fixed
14
+ - D3D11: blank glyphs (spaces) are cached like every other glyph. Before, each visible space rebuilt a font scaler on every frame; scrolling a 2,000-row list spent ~13.7 ms per frame in text and now ~1.1 ms.
15
+ - Gradient `borderColor` now paints `dashed`, `dotted` and `double` borders with the gradient instead of its first colour: the style's strokes become one clip over a single gradient fill, on every renderer.
16
+ - CSS colour strings accept all 148 CSS named colours (`lime`, `rebeccapurple`, …), not only the 14 most common.
17
+ - `TextArea` Up/Down keep the column they started from when they pass a shorter line.
18
+ - `Backspace` at the start and `Delete` at the end of an `Input`/`TextArea` no longer emit a `change` event with the unchanged value.
19
+
20
+ ### Changed
21
+ - JSON protocol version 48.
22
+ - The JS-side native shadow tree copies nodes shallowly and shares their styles instead of deep-cloning the whole document on every render. On a 6,000-node tree the copy drops from ~25 ms to ~3.5 ms (first frame and every update), and the second copy of every style object is gone.
23
+ - Renderer fallback (D3D11 → Vello/DX12 → CPU on Windows, Vello → CPU on Linux) is one ordered list shared by startup and device-loss recovery, documented in `PERFORMANCE.md`. Startup errors now name every failed attempt. Removes an unreachable Vulkan-first Vello path on Windows.
24
+ - Compiled executables reuse the extracted native runtime without reading or hashing it on every launch: `tarve build` embeds its SHA-256 and size, and a launch that finds the cached copy at that size uses it directly (the hash is checked when the copy is written). An empty window reaches its first frame in ~52 ms instead of ~80 ms.
25
+
26
+ ## 0.3.0 — 2026-09-30
27
+
28
+ ### Added
29
+ - Gradient backgrounds: `linear-gradient(…)`, `radial-gradient(…)` and their `repeating-` forms as CSS strings or `{ type, angle | to, shape, size, at, repeating, stops }` objects, in state styles too, on D3D11, Vello GPU and the CPU renderer. Stops take `%` or `px` with CSS fix-up of omitted positions; radial gradients take every size keyword, explicit radii and `at` centres in keywords, `%` or `px` (with edge offsets like `right 10px bottom 20%`). Gradients with matching shape and stop count transition stop by stop.
30
+ - `textShadow` blur (`{ blur }` or CSS `"1px 2px 4px #0006"`): glyphs are rasterized, blurred on the CPU and cached as one image per node, so the gaussian matches on every renderer. Blur transitions with the rest of the shadow.
31
+ - Gradient `borderColor` (fills the border ring; solid borders) and gradient `foreground` on `Text` (glyph coverage filled with the gradient, cached per node). Both transition like background gradients.
32
+
33
+ ### Changed
34
+ - JSON protocol version 47.
35
+ - Pointer moves no longer walk the whole tree: transitions advance only on animating nodes, hit testing skips the stacking sort for containers whose children share a z-index, and portal and `transform` lookups are cached per tree update. On a 10,000-node tree a pointer move drops from ~2.6 ms to ~0.5 ms.
36
+ - Windows GPU startup: the D3D11 device (driver load, ~140 ms) is created on a background thread as soon as the app starts, overlapping window creation and the first layout. Apps on the CPU renderer skip it.
37
+ - The D3D11 shaders ship as precompiled DXBC (`native/src/shaders`), so startup no longer loads `d3dcompiler_47.dll` or compiles HLSL (~20 ms). A test fails if `ui.hlsl` changes without regenerating the bytecode.
38
+
39
+ ### Fixed
40
+ - `bun --hot`: editing a file now reloads into the open window. A second `render()` in the same process remounts instead of failing with "Only one native app can be started per process", and under `--hot` `render()` resolves once the window is ready (Bun defers reloads while a top-level `await` is pending) and the process exits when the window closes.
41
+ - Windows: when the session is out of USER/atom memory (`SetPropW` fails with `0x80070008`), the window starts without UI Automation exposure and logs a warning instead of panicking the window thread in the AccessKit subclassing adapter.
42
+ - `InputOTP` focus: clicking now shows the active slot (slots had only a keyboard focus-visible ring), a click maps to the nearest slot instead of the hidden input's text position, and clicking a filled slot selects its character so typing replaces it instead of inserting before the code.
43
+ - Idle memory: the native runtime returns free `mimalloc` pages to the OS once rendering settles (at most every 500 ms). Since 0.2.0 an idle app stayed at its startup peak; a 2,000-row list now idles at ~225 MB instead of ~255 MB.
44
+
5
45
  ## 0.2.0 — 2026-09-29
6
46
 
7
47
  ### Breaking
package/README.md CHANGED
@@ -180,10 +180,12 @@ Every colour property (`background`, `foreground`, `borderColor`, `outlineColor`
180
180
 
181
181
  `transform` translates and scales a node and its subtree about the box centre: `{ x, y, scale, scaleX, scaleY }` or CSS syntax such as `"translateY(-2px) scale(1.02)"`. It is paint-only (layout does not move) but hit testing and hover follow the transformed box, and it transitions like other paint properties. Rotation is not supported yet.
182
182
 
183
- Borders accept `borderStyle` with the same values as `outlineStyle` (`dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`, `none`); non-solid styles apply when all four border widths are equal. Text, button labels, `Input` and `TextArea` accept `textShadow: { x, y, color }`, a solid offset copy of the glyphs; it also works inside state styles such as `hover`. Blurred text shadows are not supported yet.
183
+ Borders accept `borderStyle` with the same values as `outlineStyle` (`dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`, `none`); non-solid styles apply when all four border widths are equal. Text, button labels, `Input` and `TextArea` accept `textShadow: { x, y, blur, color }`, an offset copy of the glyphs (`blur` is the CSS blur radius; 0 is a solid copy, larger values blur it identically on every renderer); it also works inside state styles such as `hover`.
184
184
 
185
185
  `boxShadow` takes `{ x, y, blur, spread, color, inset }` or a list of up to 8 (the first paints on top). `blur` is the CSS blur radius; `spread` grows or shrinks the shadow and its corner radius; `inset` paints inside the padding box. Outer shadows are never drawn under their own box, so translucent backgrounds stay clean. Shadows do not affect layout, work in state styles such as `hover`, and render the same on D3D11, Vello GPU and the CPU renderer.
186
186
 
187
+ `background` also takes a gradient, as a CSS string or an object: `"linear-gradient(135deg, #2563eb, #9333ea 80%)"`, `"linear-gradient(to top right, red, blue)"`, `"radial-gradient(circle at 25% 75%, #fff, #000)"`, `"repeating-linear-gradient(45deg, #000 0 6px, #fff 6px 12px)"`, `"conic-gradient(from 90deg at 30% 50%, red, blue 25%, red)"`, or `{ type: "linear", angle: 135, stops: ["#2563eb", { color: "#9333ea", offset: 0.8 }] }`. Angles accept `deg`, `rad`, `turn` and `grad`. Stop positions take `%` or `px` (object offsets: a number is a 0..1 fraction, strings take `px`/`%`); two positions make a hard stop, omitted ones are spread and positions never go back, as in CSS. Radial gradients take `circle`/`ellipse`, a size keyword (`closest-side`, `closest-corner`, `farthest-side`, `farthest-corner`, the default) or explicit radii (`circle 40px`, `ellipse 50% 20px`; object `size: 40` or `["50%", "20px"]`), and an `at` centre in keywords, percentages or `px`, including edge offsets such as `at right 10px bottom 20%`. Conic gradients take `from <angle>` (0 points up, clockwise) and the same `at` positions; their stops are angles (`deg`, `turn`, `rad`, `grad`) or `%` of a turn (object `{ type: "conic", from: 90, at: { x: 0.3, y: 0.5 }, stops }`, with number offsets as fractions of a turn). `repeating-linear-gradient`, `repeating-radial-gradient` and `repeating-conic-gradient` tile the stop pattern; patterns finer than a pixel paint their average colour. Stop colours accept the same colour syntax and theme tokens. With `transition`, gradients with the same kind, stop count, units, size and repeat mode animate stop by stop; anything else, including colour ↔ gradient, switches instantly, as in CSS. `borderColor` and `foreground` take the same gradients: a gradient border fills the ring between the border and padding boxes, and `dashed`, `dotted` and `double` borders paint their strokes with the gradient (CSS `border-image` would ignore `border-style` and paint a solid ring; Tarve keeps the style; `inset`/`outset`/`groove`/`ridge` shade the first stop), and gradient text on `Text` fills the glyphs with the gradient laid over the text box, like CSS `background-clip: text` (it is rasterized once and cached, so it renders identically everywhere; `Button` labels and icons use the first stop). Other length units (`em`, `rem`, `vw`, `vh`, …) and `calc()` are not supported yet; they are planned for the whole style system rather than for gradients alone.
188
+
187
189
  `hover` styles apply to any node under the pointer and to its ancestors, as CSS `:hover` does; the innermost interactive node still receives events. With `transition`, `opacity`, `radius`, `background`, `foreground`, `borderColor`, `boxShadow` and `textShadow` animate natively both on JS updates and on hover/active/focus/disabled changes, starting from the value on screen:
188
190
 
189
191
  ```tsx
package/dist/npm/build.js CHANGED
@@ -54,7 +54,7 @@ import { basename, dirname, join } from "path";
54
54
 
55
55
  // packages/protocol/src/index.ts
56
56
  var NATIVE_ABI_VERSION = 5;
57
- var PROTOCOL_VERSION = 46;
57
+ var PROTOCOL_VERSION = 48;
58
58
 
59
59
  // packages/core/native-runtime.ts
60
60
  var NATIVE_RUNTIME_MANIFEST_NAME = "runtime.json";
@@ -207,6 +207,11 @@ async function build(options) {
207
207
  if (requireRuntimeManifest) {
208
208
  await assertNativeRuntimeCompatible(library, target, expectedCompatibility);
209
209
  }
210
+ const libraryBytes = await Bun.file(library).bytes();
211
+ const libraryDigest = {
212
+ sha256: new Bun.CryptoHasher("sha256").update(libraryBytes).digest("hex"),
213
+ size: libraryBytes.byteLength
214
+ };
210
215
  const runtime = {
211
216
  name: "tarve-native-runtime",
212
217
  setup(builder) {
@@ -221,7 +226,8 @@ async function build(options) {
221
226
  contents: [
222
227
  `import library from ${JSON.stringify(library)} with { type: "file" };`,
223
228
  `import { materializeAsset } from ${JSON.stringify(assetsModule)};`,
224
- `export function nativePath() { return materializeAsset(library, ${JSON.stringify(config.nativeName)}); }`
229
+ `const digest = ${JSON.stringify(libraryDigest)};`,
230
+ `export function nativePath() { return materializeAsset(library, ${JSON.stringify(config.nativeName)}, digest); }`
225
231
  ].join(`
226
232
  `)
227
233
  }));
package/dist/npm/cli.js CHANGED
@@ -52,7 +52,7 @@ import { basename, dirname, join } from "path";
52
52
 
53
53
  // packages/protocol/src/index.ts
54
54
  var NATIVE_ABI_VERSION = 5;
55
- var PROTOCOL_VERSION = 46;
55
+ var PROTOCOL_VERSION = 48;
56
56
 
57
57
  // packages/core/native-runtime.ts
58
58
  var NATIVE_RUNTIME_MANIFEST_NAME = "runtime.json";
@@ -205,6 +205,11 @@ async function build(options) {
205
205
  if (requireRuntimeManifest) {
206
206
  await assertNativeRuntimeCompatible(library, target, expectedCompatibility);
207
207
  }
208
+ const libraryBytes = await Bun.file(library).bytes();
209
+ const libraryDigest = {
210
+ sha256: new Bun.CryptoHasher("sha256").update(libraryBytes).digest("hex"),
211
+ size: libraryBytes.byteLength
212
+ };
208
213
  const runtime = {
209
214
  name: "tarve-native-runtime",
210
215
  setup(builder) {
@@ -219,7 +224,8 @@ async function build(options) {
219
224
  contents: [
220
225
  `import library from ${JSON.stringify(library)} with { type: "file" };`,
221
226
  `import { materializeAsset } from ${JSON.stringify(assetsModule)};`,
222
- `export function nativePath() { return materializeAsset(library, ${JSON.stringify(config.nativeName)}); }`
227
+ `const digest = ${JSON.stringify(libraryDigest)};`,
228
+ `export function nativePath() { return materializeAsset(library, ${JSON.stringify(config.nativeName)}, digest); }`
223
229
  ].join(`
224
230
  `)
225
231
  }));
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // packages/core/src/embedded-assets.ts
3
3
  import { createHash, randomUUID } from "crypto";
4
- import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
4
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
5
5
  import { tmpdir } from "os";
6
6
  import { basename, dirname, isAbsolute, join, resolve } from "path";
7
7
  var materialized = new Map;
@@ -13,7 +13,7 @@ function nativeAssetPath(source) {
13
13
  }
14
14
  return path;
15
15
  }
16
- function materializeAsset(source, filename) {
16
+ function materializeAsset(source, filename, digest) {
17
17
  if (!filename || filename === "." || filename === ".." || basename(filename) !== filename) {
18
18
  throw new Error("An embedded asset filename must be a simple filename");
19
19
  }
@@ -21,12 +21,22 @@ function materializeAsset(source, filename) {
21
21
  const cached = materialized.get(key);
22
22
  if (cached)
23
23
  return cached;
24
+ if (digest) {
25
+ const path = join(tmpdir(), "tarve-assets", digest.sha256, filename);
26
+ if (sizeOf(path) === digest.size) {
27
+ materialized.set(key, path);
28
+ return path;
29
+ }
30
+ }
24
31
  const bytes = readFileSync(source);
25
32
  const hash = createHash("sha256").update(bytes).digest("hex");
33
+ if (digest && hash !== digest.sha256) {
34
+ throw new Error(`Embedded asset ${filename} does not match its build-time digest; rebuild the executable.`);
35
+ }
26
36
  const directory = join(tmpdir(), "tarve-assets", hash);
27
37
  const path = join(directory, filename);
28
38
  mkdirSync(directory, { recursive: true });
29
- if (!existsSync(path)) {
39
+ if (!existsSync(path) || digest && sizeOf(path) !== digest.size) {
30
40
  const temporary = join(directory, `${filename}.${randomUUID()}.tmp`);
31
41
  try {
32
42
  writeFileSync(temporary, bytes, { flag: "wx" });
@@ -46,6 +56,13 @@ function materializeAsset(source, filename) {
46
56
  materialized.set(key, path);
47
57
  return path;
48
58
  }
59
+ function sizeOf(path) {
60
+ try {
61
+ return statSync(path).size;
62
+ } catch {
63
+ return;
64
+ }
65
+ }
49
66
  export {
50
67
  materializeAsset,
51
68
  nativeAssetPath
package/dist/npm/index.js CHANGED
@@ -35,22 +35,7 @@ function Portal(props) {
35
35
  return container("view", { ...props, portal: true });
36
36
  }
37
37
  // packages/core/src/css-shadow.ts
38
- var NAMED = {
39
- transparent: "#00000000",
40
- black: "#000000",
41
- white: "#ffffff",
42
- red: "#ff0000",
43
- green: "#008000",
44
- blue: "#0000ff",
45
- gray: "#808080",
46
- grey: "#808080",
47
- yellow: "#ffff00",
48
- orange: "#ffa500",
49
- purple: "#800080",
50
- pink: "#ffc0cb",
51
- cyan: "#00ffff",
52
- magenta: "#ff00ff"
53
- };
38
+ var NAMED = Object.fromEntries("aliceblue f0f8ff antiquewhite faebd7 aqua 00ffff aquamarine 7fffd4 azure f0ffff beige f5f5dc bisque ffe4c4 black 000000 blanchedalmond ffebcd blue 0000ff blueviolet 8a2be2 brown a52a2a burlywood deb887 cadetblue 5f9ea0 chartreuse 7fff00 chocolate d2691e coral ff7f50 cornflowerblue 6495ed cornsilk fff8dc crimson dc143c cyan 00ffff darkblue 00008b darkcyan 008b8b darkgoldenrod b8860b darkgray a9a9a9 darkgreen 006400 darkgrey a9a9a9 darkkhaki bdb76b darkmagenta 8b008b darkolivegreen 556b2f darkorange ff8c00 darkorchid 9932cc darkred 8b0000 darksalmon e9967a darkseagreen 8fbc8f darkslateblue 483d8b darkslategray 2f4f4f darkslategrey 2f4f4f darkturquoise 00ced1 darkviolet 9400d3 deeppink ff1493 deepskyblue 00bfff dimgray 696969 dimgrey 696969 dodgerblue 1e90ff firebrick b22222 floralwhite fffaf0 forestgreen 228b22 fuchsia ff00ff gainsboro dcdcdc ghostwhite f8f8ff gold ffd700 goldenrod daa520 gray 808080 green 008000 greenyellow adff2f grey 808080 honeydew f0fff0 hotpink ff69b4 indianred cd5c5c indigo 4b0082 ivory fffff0 khaki f0e68c lavender e6e6fa lavenderblush fff0f5 lawngreen 7cfc00 lemonchiffon fffacd lightblue add8e6 lightcoral f08080 lightcyan e0ffff lightgoldenrodyellow fafad2 lightgray d3d3d3 lightgreen 90ee90 lightgrey d3d3d3 lightpink ffb6c1 lightsalmon ffa07a lightseagreen 20b2aa lightskyblue 87cefa lightslategray 778899 lightslategrey 778899 lightsteelblue b0c4de lightyellow ffffe0 lime 00ff00 limegreen 32cd32 linen faf0e6 magenta ff00ff maroon 800000 mediumaquamarine 66cdaa mediumblue 0000cd mediumorchid ba55d3 mediumpurple 9370db mediumseagreen 3cb371 mediumslateblue 7b68ee mediumspringgreen 00fa9a mediumturquoise 48d1cc mediumvioletred c71585 midnightblue 191970 mintcream f5fffa mistyrose ffe4e1 moccasin ffe4b5 navajowhite ffdead navy 000080 oldlace fdf5e6 olive 808000 olivedrab 6b8e23 orange ffa500 orangered ff4500 orchid da70d6 palegoldenrod eee8aa palegreen 98fb98 paleturquoise afeeee palevioletred db7093 papayawhip ffefd5 peachpuff ffdab9 peru cd853f pink ffc0cb plum dda0dd powderblue b0e0e6 purple 800080 rebeccapurple 663399 red ff0000 rosybrown bc8f8f royalblue 4169e1 saddlebrown 8b4513 salmon fa8072 sandybrown f4a460 seagreen 2e8b57 seashell fff5ee sienna a0522d silver c0c0c0 skyblue 87ceeb slateblue 6a5acd slategray 708090 slategrey 708090 snow fffafa springgreen 00ff7f steelblue 4682b4 tan d2b48c teal 008080 thistle d8bfd8 tomato ff6347 turquoise 40e0d0 violet ee82ee wheat f5deb3 white ffffff whitesmoke f5f5f5 yellow ffff00 yellowgreen 9acd32 transparent 00000000".split(" ").flatMap((word, index, words) => index % 2 === 0 ? [[word, `#${words[index + 1]}`]] : []));
54
39
  function hex2(value) {
55
40
  return Math.round(Math.min(255, Math.max(0, value))).toString(16).padStart(2, "0");
56
41
  }
@@ -166,9 +151,9 @@ function parseTextShadow(value) {
166
151
  const { lengths, color } = parseLayer(layers[0], false);
167
152
  if (lengths.length > 3)
168
153
  throw new TypeError(`Too many lengths in text-shadow: ${value}`);
169
- if ((lengths[2] ?? 0) !== 0)
170
- throw new TypeError("textShadow blur is not supported");
171
- return { x: lengths[0], y: lengths[1], color };
154
+ if ((lengths[2] ?? 0) < 0)
155
+ throw new TypeError("textShadow blur must be >= 0");
156
+ return { x: lengths[0], y: lengths[1], ...lengths[2] ? { blur: lengths[2] } : {}, color };
172
157
  }
173
158
  function parseTransform(value) {
174
159
  let [x, y, scaleX, scaleY] = [0, 0, 1, 1];
@@ -228,6 +213,214 @@ function parseTransform(value) {
228
213
  ...scaleX === scaleY ? scaleX !== 1 ? { scale: scaleX } : {} : { scaleX, scaleY }
229
214
  };
230
215
  }
216
+ var GRADIENT = /^\s*(repeating-)?(linear|radial|conic)-gradient\(/i;
217
+ function angle(token) {
218
+ const match = token.match(/^(-?(?:\d+\.?\d*|\.\d+))(deg|rad|turn|grad)$/);
219
+ if (!match)
220
+ return;
221
+ const value = Number(match[1]);
222
+ return { deg: value, rad: value * 180 / Math.PI, turn: value * 360, grad: value * 0.9 }[match[2]];
223
+ }
224
+ var LENGTH_PERCENT = /^-?(?:\d+\.?\d*|\.\d+)(px|%)$/;
225
+ function position(token) {
226
+ if (token === "0")
227
+ return 0;
228
+ const match = token.match(LENGTH_PERCENT);
229
+ if (!match)
230
+ throw new TypeError(`Gradient positions must be px or %: ${token}`);
231
+ return match[1] === "%" ? Number(token.slice(0, -1)) / 100 : token;
232
+ }
233
+ function parseStop(token) {
234
+ const [color, ...positions] = splitTopLevel(token, /\s/);
235
+ if (!color || positions.length > 2)
236
+ throw new TypeError(`Invalid colour stop: ${token}`);
237
+ return positions.length === 0 ? [{ color }] : positions.map((value) => ({ color, offset: position(value) }));
238
+ }
239
+ function centre(tokens) {
240
+ const invalid = () => new TypeError(`Invalid radial-gradient position: at ${tokens.join(" ")}`);
241
+ const HORIZONTAL = /^(left|right)$/;
242
+ const VERTICAL = /^(top|bottom)$/;
243
+ const KEYWORD = /^(left|right|top|bottom|center)$/;
244
+ const edge = (keyword) => keyword === "left" || keyword === "top" ? 0 : keyword === "center" ? 0.5 : 1;
245
+ const result = {};
246
+ if (tokens.length === 0 || tokens.length > 4)
247
+ throw invalid();
248
+ if (tokens.length <= 2) {
249
+ const loose = [];
250
+ for (const token of tokens) {
251
+ if (HORIZONTAL.test(token)) {
252
+ if (result.x !== undefined)
253
+ throw invalid();
254
+ result.x = edge(token);
255
+ } else if (VERTICAL.test(token)) {
256
+ if (result.y !== undefined)
257
+ throw invalid();
258
+ result.y = edge(token);
259
+ } else if (token === "center")
260
+ loose.push(0.5);
261
+ else
262
+ loose.push(position(token));
263
+ }
264
+ if (tokens.length === 2 && loose.length === 2)
265
+ return { x: loose[0], y: loose[1] };
266
+ if (tokens.length === 2 && loose.length === 1 && !KEYWORD.test(tokens[1]) && result.y !== undefined)
267
+ throw invalid();
268
+ result.x ??= loose.shift() ?? 0.5;
269
+ result.y ??= loose.shift() ?? 0.5;
270
+ return result;
271
+ }
272
+ let index = 0;
273
+ while (index < tokens.length) {
274
+ const keyword = tokens[index];
275
+ if (!KEYWORD.test(keyword))
276
+ throw invalid();
277
+ const next = tokens[index + 1];
278
+ const offset = next !== undefined && !KEYWORD.test(next) ? position(next) : undefined;
279
+ index += offset === undefined ? 1 : 2;
280
+ if (keyword === "center") {
281
+ if (offset !== undefined)
282
+ throw invalid();
283
+ if (result.x === undefined)
284
+ result.x = 0.5;
285
+ else if (result.y === undefined)
286
+ result.y = 0.5;
287
+ else
288
+ throw invalid();
289
+ continue;
290
+ }
291
+ const axis = HORIZONTAL.test(keyword) ? "x" : "y";
292
+ if (result[axis] !== undefined)
293
+ throw invalid();
294
+ const fromEnd = keyword === "right" || keyword === "bottom";
295
+ if (offset === undefined)
296
+ result[axis] = edge(keyword);
297
+ else if (typeof offset === "number")
298
+ result[axis] = fromEnd ? 1 - offset : offset;
299
+ else {
300
+ result[axis] = offset;
301
+ if (fromEnd) {
302
+ if (axis === "x")
303
+ result.xEdge = "right";
304
+ else
305
+ result.yEdge = "bottom";
306
+ }
307
+ }
308
+ }
309
+ result.x ??= 0.5;
310
+ result.y ??= 0.5;
311
+ return result;
312
+ }
313
+ var EXTENT = /^(closest|farthest)-(side|corner)$/;
314
+ function turn(token) {
315
+ if (token === "0")
316
+ return 0;
317
+ if (/^-?(?:\d+\.?\d*|\.\d+)%$/.test(token))
318
+ return Number(token.slice(0, -1)) / 100;
319
+ const degrees = angle(token);
320
+ if (degrees === undefined)
321
+ throw new TypeError(`Conic gradient positions must be angles or %: ${token}`);
322
+ return degrees / 360;
323
+ }
324
+ function parseConicStop(token) {
325
+ const [color, ...positions] = splitTopLevel(token, /\s/);
326
+ if (!color || positions.length > 2)
327
+ throw new TypeError(`Invalid colour stop: ${token}`);
328
+ return positions.length === 0 ? [{ color }] : positions.map((value) => ({ color, offset: turn(value) }));
329
+ }
330
+ function conicHeader(words) {
331
+ if (words[0] !== "from" && words[0] !== "at")
332
+ return;
333
+ const at = words.indexOf("at");
334
+ const before = at < 0 ? words : words.slice(0, at);
335
+ const header = {};
336
+ if (before.length > 0) {
337
+ const degrees = before.length === 2 && before[0] === "from" ? before[1] === "0" ? 0 : angle(before[1]) : undefined;
338
+ if (degrees === undefined)
339
+ throw new TypeError(`Invalid conic-gradient angle: ${words.join(" ")}`);
340
+ if (degrees !== 0)
341
+ header.from = degrees;
342
+ }
343
+ if (at >= 0)
344
+ header.at = centre(words.slice(at + 1));
345
+ return header;
346
+ }
347
+ function parseGradient(value) {
348
+ const match = value.trim().match(/^(repeating-)?(linear|radial|conic)-gradient\(([\s\S]*)\)$/i);
349
+ if (!match)
350
+ throw new TypeError(`Unsupported gradient: ${value}`);
351
+ const repeating = match[1] ? { repeating: true } : {};
352
+ const args = splitTopLevel(match[3], /,/);
353
+ const first = (args[0] ?? "").toLowerCase().trim().split(/\s+/);
354
+ if (match[2].toLowerCase() === "conic") {
355
+ const header = conicHeader(first);
356
+ return { type: "conic", ...header, ...repeating, stops: (header ? args.slice(1) : args).flatMap(parseConicStop) };
357
+ }
358
+ if (match[2].toLowerCase() === "linear") {
359
+ const degrees = first.length === 1 ? angle(first[0]) : undefined;
360
+ if (degrees !== undefined)
361
+ return { type: "linear", angle: degrees, ...repeating, stops: args.slice(1).flatMap(parseStop) };
362
+ if (first[0] === "to") {
363
+ const sides = first.slice(1).sort((a, b) => Number(a === "left" || a === "right") - Number(b === "left" || b === "right"));
364
+ const valid = sides.length >= 1 && sides.length <= 2 && sides.every((side) => /^(top|bottom|left|right)$/.test(side)) && new Set(sides.map((side) => side === "top" || side === "bottom")).size === sides.length;
365
+ if (!valid)
366
+ throw new TypeError(`Invalid gradient direction: ${args[0]}`);
367
+ return { type: "linear", to: sides.join(" "), ...repeating, stops: args.slice(1).flatMap(parseStop) };
368
+ }
369
+ return { type: "linear", ...repeating, stops: args.flatMap(parseStop) };
370
+ }
371
+ const header = first.some((word) => /^(circle|ellipse|at)$/.test(word) || EXTENT.test(word) || LENGTH_PERCENT.test(word));
372
+ if (!header)
373
+ return { type: "radial", ...repeating, stops: args.flatMap(parseStop) };
374
+ const at = first.indexOf("at");
375
+ let shape;
376
+ let extent;
377
+ const lengths = [];
378
+ for (const word of at < 0 ? first : first.slice(0, at)) {
379
+ if (word === "circle" || word === "ellipse")
380
+ shape = word;
381
+ else if (EXTENT.test(word))
382
+ extent = word;
383
+ else if (LENGTH_PERCENT.test(word))
384
+ lengths.push(word);
385
+ else
386
+ throw new TypeError(`Unsupported radial-gradient size: ${word}`);
387
+ }
388
+ if (extent && lengths.length)
389
+ throw new TypeError(`A radial gradient takes an extent keyword or lengths, not both: ${args[0]}`);
390
+ if (lengths.length > 2)
391
+ throw new TypeError(`Too many radial-gradient sizes: ${args[0]}`);
392
+ shape ??= lengths.length === 1 ? "circle" : lengths.length === 2 ? "ellipse" : undefined;
393
+ if (shape === "circle" && (lengths.length > 1 || lengths.some((length) => String(length).endsWith("%")))) {
394
+ throw new TypeError(`A circle takes one px radius: ${args[0]}`);
395
+ }
396
+ if (shape === "ellipse" && lengths.length === 1)
397
+ throw new TypeError(`An ellipse takes two radii: ${args[0]}`);
398
+ const size = extent ?? (lengths.length === 1 ? lengths[0] : lengths.length === 2 ? [lengths[0], lengths[1]] : undefined);
399
+ return {
400
+ type: "radial",
401
+ ...shape ? { shape } : {},
402
+ ...size ? { size } : {},
403
+ ...at >= 0 ? { at: centre(first.slice(at + 1)) } : {},
404
+ ...repeating,
405
+ stops: args.slice(1).flatMap(parseStop)
406
+ };
407
+ }
408
+ function normalizeGradient(gradient, colour) {
409
+ if (gradient.stops.length === 0)
410
+ throw new TypeError("A gradient needs at least one colour stop");
411
+ const conic = gradient.type === "conic";
412
+ const stops = gradient.stops.map((stop) => {
413
+ const { color, offset } = typeof stop === "string" ? { color: stop, offset: undefined } : stop;
414
+ let resolved = offset;
415
+ if (typeof offset === "string") {
416
+ resolved = conic ? turn(offset.trim()) : position(offset.trim());
417
+ } else if (offset !== undefined && !Number.isFinite(offset)) {
418
+ throw new TypeError(`Invalid gradient offset: ${offset}`);
419
+ }
420
+ return resolved === undefined ? { color: colour(color) } : { color: colour(color), offset: resolved };
421
+ });
422
+ return { ...gradient, stops: stops.length === 1 ? [stops[0], { color: stops[0].color }] : stops };
423
+ }
231
424
 
232
425
  // packages/core/src/theme.ts
233
426
  var defaultFocusOutline = {
@@ -407,6 +600,7 @@ function resolveThemeColor(value, selected) {
407
600
  const key = keyByRef.get(value);
408
601
  return key ? selected.colors[key] : value;
409
602
  }
603
+ var PAINT_KEYS = ["background", "foreground", "borderColor"];
410
604
  function resolveShadowColors(style, selected) {
411
605
  if (typeof style.transform === "string")
412
606
  style.transform = parseTransform(style.transform);
@@ -421,6 +615,12 @@ function resolveShadowColors(style, selected) {
421
615
  if (style.textShadow && typeof style.textShadow === "object") {
422
616
  style.textShadow = { ...style.textShadow, color: colour(style.textShadow.color) };
423
617
  }
618
+ for (const key of PAINT_KEYS) {
619
+ const value = style[key];
620
+ const gradient = typeof value === "string" && GRADIENT.test(value) ? parseGradient(value) : value;
621
+ if (gradient && typeof gradient === "object")
622
+ style[key] = normalizeGradient(gradient, colour);
623
+ }
424
624
  const box = typeof style.boxShadow === "string" ? parseBoxShadow(style.boxShadow) : style.boxShadow;
425
625
  if (box !== undefined) {
426
626
  style.boxShadow = Array.isArray(box) ? box.map((shadow) => ({ ...shadow, color: colour(shadow.color) })) : { ...box, color: colour(box.color) };
@@ -428,6 +628,8 @@ function resolveShadowColors(style, selected) {
428
628
  }
429
629
  var COLOR_KEY = /^(background|foreground|color)$|(Color|Background|Foreground|Accent|Rule)$/;
430
630
  function resolveStyleString(key, value, selected) {
631
+ if (PAINT_KEYS.includes(key) && GRADIENT.test(value))
632
+ return value;
431
633
  return resolveThemeColor(COLOR_KEY.test(key) ? cssColor(value) : value, selected);
432
634
  }
433
635
  function resolveThemeStyle(style, selected) {
@@ -502,7 +704,7 @@ function Pressable(props) {
502
704
  }
503
705
  // packages/protocol/src/index.ts
504
706
  var NATIVE_ABI_VERSION = 5;
505
- var PROTOCOL_VERSION = 46;
707
+ var PROTOCOL_VERSION = 48;
506
708
 
507
709
  // packages/core/src/bridge/binding.ts
508
710
  import { dlopen } from "bun:ffi";
@@ -1085,6 +1287,10 @@ function accessibleText2(child, parts = []) {
1085
1287
  }
1086
1288
  return parts.join(" ").replace(/\s+/g, " ").trim();
1087
1289
  }
1290
+ function firstStopColor(gradient) {
1291
+ const stop = gradient.stops[0];
1292
+ return typeof stop === "string" ? stop : stop?.color ?? theme.colors.foreground;
1293
+ }
1088
1294
  function composedContent(child, foreground) {
1089
1295
  if (Array.isArray(child))
1090
1296
  return child.map((item) => composedContent(item, foreground));
@@ -1179,7 +1385,8 @@ function Button({ variant = "default", size = "default", style, disabled, contro
1179
1385
  }
1180
1386
  const label = accessibleText2(children);
1181
1387
  const semanticControl = control ? { ...control, ...control.label || !label ? {} : { label } } : { role: "button", ...label ? { label } : {} };
1182
- const foreground = disabled ? buttonStyle.disabled?.foreground ?? buttonStyle.foreground ?? theme.colors.foreground : buttonStyle.foreground ?? theme.colors.foreground;
1388
+ const paint = disabled ? buttonStyle.disabled?.foreground ?? buttonStyle.foreground ?? theme.colors.foreground : buttonStyle.foreground ?? theme.colors.foreground;
1389
+ const foreground = typeof paint !== "string" ? firstStopColor(paint) : GRADIENT.test(paint) ? firstStopColor(parseGradient(paint)) : paint;
1183
1390
  return _nativeJsx("pressable", {
1184
1391
  ...props,
1185
1392
  children: composedContent(children, foreground),
@@ -5949,6 +6156,8 @@ function compileTree(element, debug = false, renderer = "auto", componentAdapter
5949
6156
  ...focusOutlineOverrides(p.style?.focus),
5950
6157
  ...p.style?.focusVisible
5951
6158
  };
6159
+ if (control?.role === "otpSlot")
6160
+ rawStyle.focus = { ...rawStyle.focusVisible, ...p.style?.focus };
5952
6161
  }
5953
6162
  const style = resolveThemeStyle(rawStyle, selectedTheme);
5954
6163
  for (const key of ["padding", "margin"]) {
@@ -6141,18 +6350,17 @@ function validateFileDialogOptions(options) {
6141
6350
  }
6142
6351
  }
6143
6352
  function nativeShadow(tree, previous) {
6144
- const document = structuredClone(tree.document);
6145
6353
  const nodes = new Map;
6146
- const index = (node) => {
6354
+ const copy = (source) => {
6355
+ const node = { ...source, children: source.children.map(copy) };
6147
6356
  const old = previous?.nodes.get(node.id);
6148
6357
  if ((node.kind === "input" || node.kind === "textarea") && node.value === undefined && old?.kind === node.kind) {
6149
6358
  node.value = old.value;
6150
6359
  }
6151
6360
  nodes.set(node.id, node);
6152
- for (const child of node.children)
6153
- index(child);
6361
+ return node;
6154
6362
  };
6155
- index(document.root);
6363
+ const document = { ...tree.document, root: copy(tree.document.root) };
6156
6364
  return { document, handlers: tree.handlers, nodes };
6157
6365
  }
6158
6366
  function reconciliationCommand(previous, next) {
@@ -6783,22 +6991,23 @@ function createApp(view, options = {}) {
6783
6991
  return app;
6784
6992
  }
6785
6993
  async function render(view, options) {
6786
- const dev = options?.dev ?? envFlag("TARVE_DEV");
6994
+ const hot = process.execArgv.includes("--hot");
6787
6995
  const registry = globalThis;
6788
- const existing = dev ? registry[DEV_APP_KEY] : undefined;
6996
+ const existing = registry[DEV_APP_KEY];
6789
6997
  if (existing) {
6790
6998
  existing.remount(view);
6791
- await existing.closed;
6999
+ if (!hot)
7000
+ await existing.closed;
6792
7001
  return;
6793
7002
  }
6794
7003
  const app = createApp(view, options);
6795
- if (dev) {
6796
- registry[DEV_APP_KEY] = app;
6797
- app.closed.then(() => {
6798
- if (registry[DEV_APP_KEY] === app)
6799
- delete registry[DEV_APP_KEY];
6800
- });
6801
- }
7004
+ registry[DEV_APP_KEY] = app;
7005
+ app.closed.then(() => {
7006
+ if (registry[DEV_APP_KEY] === app)
7007
+ delete registry[DEV_APP_KEY];
7008
+ if (hot)
7009
+ process.exit(0);
7010
+ });
6802
7011
  try {
6803
7012
  await app.ready;
6804
7013
  } catch (error) {
@@ -6806,7 +7015,8 @@ async function render(view, options) {
6806
7015
  delete registry[DEV_APP_KEY];
6807
7016
  throw error;
6808
7017
  }
6809
- await app.closed;
7018
+ if (!hot)
7019
+ await app.closed;
6810
7020
  }
6811
7021
  function pastePayload(event) {
6812
7022
  if (event.files?.length)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.2.0",
4
- "protocolVersion": 46,
3
+ "packageVersion": "0.4.0",
4
+ "protocolVersion": 48,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "f8901ea4961cf0a03100d0de7c068afe8455a458efa5a36babac561fe423dc40"
6
+ "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  // packages/protocol/src/index.ts
3
3
  var NATIVE_ABI_VERSION = 5;
4
- var PROTOCOL_VERSION = 46;
4
+ var PROTOCOL_VERSION = 48;
5
5
  export {
6
6
  NATIVE_ABI_VERSION,
7
7
  PROTOCOL_VERSION
@@ -53,7 +53,7 @@ export interface AppHandle {
53
53
  }
54
54
  export declare function createApp(view: () => VNode, options?: AppOptions): AppHandle;
55
55
  /**
56
- * Renders the app until its window closes. In dev mode a second call in the same
56
+ * Renders the app until its window closes. A second call in the same
57
57
  * process (e.g. a `bun --hot` reload) remounts into the already open window.
58
58
  */
59
59
  export declare function render(view: () => VNode, options?: AppOptions): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { BoxShadow, TextShadow, Transform } from "../../protocol/src/index";
1
+ import type { BoxShadow, Gradient, TextShadow, Transform } from "../../protocol/src/index";
2
2
  /**
3
3
  * CSS colour → "#rrggbbaa". Hex, rgb()/rgba(), hsl()/hsla() and a few names are
4
4
  * converted; theme tokens (`var(--…)`) pass through for theme resolution.
@@ -13,3 +13,8 @@ export declare function parseTextShadow(value: string): TextShadow | undefined;
13
13
  * Functions compose left to right as in CSS; "none" is the identity.
14
14
  */
15
15
  export declare function parseTransform(value: string): Transform;
16
+ export declare const GRADIENT: RegExp;
17
+ /** CSS `linear-gradient(…)` / `radial-gradient(…)` and their `repeating-` forms → gradient object. */
18
+ export declare function parseGradient(value: string): Gradient;
19
+ /** Resolves stop colours and converts `N%` offsets to fractions; px and omitted offsets resolve natively. */
20
+ export declare function normalizeGradient(gradient: Gradient, colour: (value: string) => string): Gradient;
@@ -1,4 +1,14 @@
1
1
  /** Native APIs cannot open Bun's virtual files. Resolve them once before sending the scene. */
2
2
  export declare function nativeAssetPath(source: string): string;
3
- /** Give native libraries a physical path for an asset embedded in a Bun executable. */
4
- export declare function materializeAsset(source: string, filename: string): string;
3
+ /** SHA-256 and byte size of an embedded asset, computed when the executable is built. */
4
+ export interface AssetDigest {
5
+ sha256: string;
6
+ size: number;
7
+ }
8
+ /**
9
+ * Give native libraries a physical path for an asset embedded in a Bun executable.
10
+ * With a build-time `digest`, a launch that finds the extracted copy at the
11
+ * expected size reuses it without reading or hashing the embedded bytes; the
12
+ * full hash check runs only when the copy is written.
13
+ */
14
+ export declare function materializeAsset(source: string, filename: string, digest?: AssetDigest): string;
@@ -30,7 +30,7 @@ export type { ComponentAdapter, ComponentAdapterInput } from "./component-adapte
30
30
  export { theme, Theme, lightTheme, darkTheme, createTheme, buttonVariants } from "./theme";
31
31
  export type { ThemeColors, ThemeFocusOutline, ThemeDefinition, ThemeOverrides, ButtonVariant } from "./theme";
32
32
  export { Style } from "./style";
33
- export type { StateStyle, OutlineStyle, BorderStyle, TextShadow, BoxShadow, Transform, UserSelect, TextDecoration, Renderer, WindowPosition, WindowPositionPreset, FileDialogFilter, FileDialogOptions, ScrollOrientation, ScrollPosition, MotionProperty, NumericMotionProperty, MotionEasing, MotionTransition, MotionTransitions, MotionValues } from "../../protocol/src/index";
33
+ export type { StateStyle, OutlineStyle, BorderStyle, TextShadow, BoxShadow, Transform, Gradient, GradientStop, GradientSide, GradientLength, GradientCentre, RadialExtent, LinearGradient, RadialGradient, ConicGradient, ConicGradientStop, UserSelect, TextDecoration, Renderer, WindowPosition, WindowPositionPreset, FileDialogFilter, FileDialogOptions, ScrollOrientation, ScrollPosition, MotionProperty, NumericMotionProperty, MotionEasing, MotionTransition, MotionTransitions, MotionValues } from "../../protocol/src/index";
34
34
  export type { VNode, Child, PastePayload } from "./jsx-runtime";
35
35
  export { BunFfiBridge, openExternal } from "./bridge";
36
36
  export type { NativeBridge, BunFfiBridgeOptions } from "./bridge";
@@ -1,6 +1,6 @@
1
1
  /** Renderer-independent, versioned messages crossing the C ABI as UTF-8 JSON. */
2
2
  export declare const NATIVE_ABI_VERSION = 5;
3
- export declare const PROTOCOL_VERSION = 46;
3
+ export declare const PROTOCOL_VERSION = 48;
4
4
  export type Renderer = "auto" | "gpu" | "cpu";
5
5
  export type Length = number | `${number}%` | "auto";
6
6
  /** Numeric properties: usable in `motionFrom` and AnimatePresence enter/exit values. */
@@ -31,10 +31,11 @@ export type Insets = number | {
31
31
  export type OutlineStyle = "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "none" | "hidden";
32
32
  /** Same values as OutlineStyle. Non-solid styles apply when all four border widths are equal. */
33
33
  export type BorderStyle = OutlineStyle;
34
- /** Solid offset copy of the text. Blur is not supported. */
34
+ /** Offset copy of the text; `blur` is the CSS blur radius (sigma = blur / 2, max 200), 0 for a solid copy. */
35
35
  export interface TextShadow {
36
36
  x?: number;
37
37
  y?: number;
38
+ blur?: number;
38
39
  color: string;
39
40
  }
40
41
  /** CSS-like box shadow. `blur` is the CSS blur radius (sigma = blur / 2); `inset` paints inside the padding box. */
@@ -54,6 +55,65 @@ export interface BoxShadow {
54
55
  color: string;
55
56
  inset?: boolean;
56
57
  }
58
+ /** Gradient length: a number is px; strings take `px` or `%`. */
59
+ export type GradientLength = number | `${number}px` | `${number}%`;
60
+ /**
61
+ * A colour stop. A number `offset` is a fraction 0..1 of the gradient line (or radial ray);
62
+ * strings take `px` or `%`. Omitted offsets are spread evenly and positions never go back, as in CSS.
63
+ */
64
+ export interface GradientStop {
65
+ color: string;
66
+ offset?: number | `${number}px` | `${number}%`;
67
+ }
68
+ export type GradientSide = "top" | "bottom" | "left" | "right" | "top left" | "top right" | "bottom left" | "bottom right";
69
+ /** CSS `linear-gradient`: `angle` in CSS degrees (0 = to top, 90 = to right, default 180), or `to` a side/corner. */
70
+ export interface LinearGradient {
71
+ type: "linear";
72
+ angle?: number;
73
+ to?: GradientSide;
74
+ repeating?: boolean;
75
+ stops: readonly (GradientStop | string)[];
76
+ }
77
+ /**
78
+ * Radial centre. A number is a fraction of the box; strings take `px` or `%`.
79
+ * `xEdge: "right"` / `yEdge: "bottom"` measure from the far edge (CSS `right 10px bottom 20%`).
80
+ */
81
+ export interface GradientCentre {
82
+ x?: number | `${number}px` | `${number}%`;
83
+ y?: number | `${number}px` | `${number}%`;
84
+ xEdge?: "left" | "right";
85
+ yEdge?: "top" | "bottom";
86
+ }
87
+ export type RadialExtent = "closest-side" | "closest-corner" | "farthest-side" | "farthest-corner";
88
+ /**
89
+ * CSS `radial-gradient`. `at` is the centre as fractions of the box (default 0.5, 0.5).
90
+ * `size` is an extent keyword (default `farthest-corner`), one length (circle radius) or two (ellipse radii).
91
+ */
92
+ export interface RadialGradient {
93
+ type: "radial";
94
+ shape?: "ellipse" | "circle";
95
+ at?: GradientCentre;
96
+ size?: RadialExtent | GradientLength | readonly [GradientLength, GradientLength];
97
+ repeating?: boolean;
98
+ stops: readonly (GradientStop | string)[];
99
+ }
100
+ /** A conic colour stop: a number is a fraction of a turn; strings take `%`, `deg`, `turn`, `rad` or `grad`. */
101
+ export interface ConicGradientStop {
102
+ color: string;
103
+ offset?: number | `${number}%` | `${number}deg` | `${number}turn` | `${number}rad` | `${number}grad`;
104
+ }
105
+ /**
106
+ * CSS `conic-gradient`: `from` in CSS degrees (0 points up, clockwise; default 0) and `at` the centre
107
+ * (default the box centre). Stops sweep one turn clockwise from `from`.
108
+ */
109
+ export interface ConicGradient {
110
+ type: "conic";
111
+ from?: number;
112
+ at?: GradientCentre;
113
+ repeating?: boolean;
114
+ stops: readonly (ConicGradientStop | string)[];
115
+ }
116
+ export type Gradient = LinearGradient | RadialGradient | ConicGradient;
57
117
  export type UserSelect = "auto" | "text" | "none" | "all";
58
118
  export type TextDecoration = "none" | "underline" | "overline" | "line-through";
59
119
  export interface SyntaxTheme {
@@ -97,9 +157,10 @@ export interface TextHighlight {
97
157
  activeColor?: string;
98
158
  }
99
159
  export interface StateStyle {
100
- background?: string;
101
- foreground?: string;
102
- borderColor?: string;
160
+ /** Colour, gradient object, or CSS `linear-gradient(…)` / `radial-gradient(…)` string. */
161
+ background?: string | Gradient;
162
+ foreground?: string | Gradient;
163
+ borderColor?: string | Gradient;
103
164
  borderStyle?: BorderStyle;
104
165
  radius?: number;
105
166
  opacity?: number;
@@ -115,8 +176,8 @@ export interface StateStyle {
115
176
  placeholderBackground?: string;
116
177
  thumbColor?: string;
117
178
  textDecoration?: TextDecoration;
118
- /** Text, button, Input and TextArea text. Solid offset copy; blur is not supported. */
119
- /** Object form, or CSS text-shadow syntax such as "1px 2px #0006" (no blur). */
179
+ /** Text, button, Input and TextArea text. Offset copy, optionally blurred. */
180
+ /** Object form, or CSS text-shadow syntax such as "1px 2px 4px #0006". */
120
181
  textShadow?: TextShadow | string;
121
182
  /** One shadow or up to 8; the first paints on top. Does not affect layout. */
122
183
  boxShadow?: BoxShadow | readonly BoxShadow[] | string;
@@ -429,6 +490,8 @@ export interface Snapshot {
429
490
  shapes: number;
430
491
  paints: number;
431
492
  activeMotions: number;
493
+ /** Glyphs rasterized so far on renderers with their own glyph atlas (D3D11); null elsewhere. */
494
+ glyphRasterizations?: number | null;
432
495
  hovered: string | null;
433
496
  focused: string | null;
434
497
  nodes: NodeSnapshot[];
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.2.0",
4
- "protocolVersion": 46,
3
+ "packageVersion": "0.4.0",
4
+ "protocolVersion": 48,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "f8901ea4961cf0a03100d0de7c068afe8455a458efa5a36babac561fe423dc40",
6
+ "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050",
7
7
  "target": "linux-x64",
8
8
  "nativeName": "libtarve_native.so",
9
- "sha256": "d05e5dfface781780ae122f7910a12c97f3b49e3c877a023c410f310f80bc852"
9
+ "sha256": "26ed8f31b8d1665fbc0619ec6c7efe2b962a0c1ab4002855c455cec28ca854a5"
10
10
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.2.0",
4
- "protocolVersion": 46,
3
+ "packageVersion": "0.4.0",
4
+ "protocolVersion": 48,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "f8901ea4961cf0a03100d0de7c068afe8455a458efa5a36babac561fe423dc40",
6
+ "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050",
7
7
  "target": "windows-x64",
8
8
  "nativeName": "tarve_native.dll",
9
- "sha256": "20143d5b81aa676c1d6b583154f815549bc2439ed836e5025329bf0b5fe2df57"
9
+ "sha256": "9a88b98c21f62e8acc20221450f23d7992d38cd523f0bf12570c446324487316"
10
10
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarve/core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Native Bun/TSX GUI with Taffy layout, Parley text and Vello rendering",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [