@tarve/core 0.4.0 → 0.6.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 (122) hide show
  1. package/CHANGELOG.md +126 -1
  2. package/README.md +121 -12
  3. package/dist/npm/build.js +1401 -85
  4. package/dist/npm/cli.js +1940 -117
  5. package/dist/npm/embedded-assets.js +22 -3
  6. package/dist/npm/index.js +5274 -975
  7. package/dist/npm/jsx-dev-runtime.js +1268 -0
  8. package/dist/npm/jsx-runtime.js +1268 -0
  9. package/dist/npm/native-runtime.json +3 -3
  10. package/dist/npm/node-build.js +1159 -0
  11. package/dist/npm/protocol.js +1 -1
  12. package/dist/npm/runtime.js +5 -5
  13. package/dist/npm/txiki/fetch.ts +228 -0
  14. package/dist/npm/txiki/intl-data.ts +7 -0
  15. package/dist/npm/txiki/intl.test.ts +53 -0
  16. package/dist/npm/txiki/intl.ts +249 -0
  17. package/dist/npm/txiki/prelude.ts +132 -0
  18. package/dist/npm/txiki/runtime.ts +6 -0
  19. package/dist/npm/txiki/shims/buffer.ts +112 -0
  20. package/dist/npm/txiki/shims/child-process.ts +151 -0
  21. package/dist/npm/txiki/shims/crypto.ts +30 -0
  22. package/dist/npm/txiki/shims/events.ts +75 -0
  23. package/dist/npm/txiki/shims/fs-promises.ts +77 -0
  24. package/dist/npm/txiki/shims/fs.ts +231 -0
  25. package/dist/npm/txiki/shims/module.ts +8 -0
  26. package/dist/npm/txiki/shims/net.ts +69 -0
  27. package/dist/npm/txiki/shims/os.ts +72 -0
  28. package/dist/npm/txiki/shims/path.ts +4 -0
  29. package/dist/npm/txiki/shims/timers-promises.ts +9 -0
  30. package/dist/npm/txiki/shims/zlib.ts +9 -0
  31. package/dist/npm/txiki/tjs.d.ts +58 -0
  32. package/dist/npm/txiki/unavailable.ts +10 -0
  33. package/dist/types/core/build.d.ts +24 -0
  34. package/dist/types/core/cli.d.ts +1 -1
  35. package/dist/types/core/esbuild-file-imports.d.ts +8 -0
  36. package/dist/types/core/jsx-compile.d.ts +7 -0
  37. package/dist/types/core/node-build.d.ts +7 -0
  38. package/dist/types/core/node-dev.d.ts +4 -0
  39. package/dist/types/core/node-target.d.ts +10 -0
  40. package/dist/types/core/package-metadata.d.ts +49 -0
  41. package/dist/types/core/runtime-select.d.ts +8 -0
  42. package/dist/types/core/src/advanced-controls.d.ts +1 -1
  43. package/dist/types/core/src/app/element-events.d.ts +18 -0
  44. package/dist/types/core/src/app/media.d.ts +15 -0
  45. package/dist/types/core/src/app/requests.d.ts +25 -0
  46. package/dist/types/core/src/app/shadow.d.ts +7 -0
  47. package/dist/types/core/src/app/stats.d.ts +12 -0
  48. package/dist/types/core/src/app/tray.d.ts +40 -0
  49. package/dist/types/core/src/app-metadata.d.ts +18 -0
  50. package/dist/types/core/src/app.d.ts +89 -2
  51. package/dist/types/core/src/assets.d.ts +4 -0
  52. package/dist/types/core/src/bridge/binding.d.ts +10 -34
  53. package/dist/types/core/src/bridge/index.d.ts +1 -1
  54. package/dist/types/core/src/canvas.d.ts +161 -0
  55. package/dist/types/core/src/chat-controls.d.ts +2 -1
  56. package/dist/types/core/src/components/button.d.ts +1 -1
  57. package/dist/types/core/src/components/glass.d.ts +52 -0
  58. package/dist/types/core/src/components/icon.d.ts +1 -1
  59. package/dist/types/core/src/components/image.d.ts +8 -4
  60. package/dist/types/core/src/components/layout.d.ts +5 -4
  61. package/dist/types/core/src/components/pressable.d.ts +3 -3
  62. package/dist/types/core/src/components/rich-content.d.ts +1 -1
  63. package/dist/types/core/src/components/scroll.d.ts +2 -2
  64. package/dist/types/core/src/components/svg.d.ts +1 -1
  65. package/dist/types/core/src/components/titlebar.d.ts +15 -1
  66. package/dist/types/core/src/components/window.d.ts +21 -1
  67. package/dist/types/core/src/components.d.ts +2 -0
  68. package/dist/types/core/src/css-shadow.d.ts +1 -1
  69. package/dist/types/core/src/desktop-controls.d.ts +2 -2
  70. package/dist/types/core/src/embedded-assets.d.ts +3 -2
  71. package/dist/types/core/src/extra-controls.d.ts +2 -2
  72. package/dist/types/core/src/form-controls.d.ts +1 -1
  73. package/dist/types/core/src/html-elements.d.ts +26 -0
  74. package/dist/types/core/src/index.d.ts +23 -11
  75. package/dist/types/core/src/inline-text.d.ts +25 -0
  76. package/dist/types/core/src/intrinsic-style.d.ts +1 -1
  77. package/dist/types/core/src/jsx-runtime.d.ts +182 -5
  78. package/dist/types/core/src/media-element.d.ts +70 -0
  79. package/dist/types/core/src/memo.d.ts +28 -0
  80. package/dist/types/core/src/motion.d.ts +1 -1
  81. package/dist/types/core/src/png.d.ts +29 -0
  82. package/dist/types/core/src/popups.d.ts +4 -3
  83. package/dist/types/core/src/protocol.d.ts +6 -0
  84. package/dist/types/core/src/reconciler/diff.d.ts +11 -0
  85. package/dist/types/core/src/reconciler/intrinsics.d.ts +24 -0
  86. package/dist/types/core/src/reconciler.d.ts +33 -10
  87. package/dist/types/core/src/render-scope.d.ts +8 -0
  88. package/dist/types/core/src/style.d.ts +1 -1
  89. package/dist/types/core/src/tailwind-palette.d.ts +1 -0
  90. package/dist/types/core/src/tailwind.d.ts +8 -0
  91. package/dist/types/core/src/test-renderer.d.ts +3 -1
  92. package/dist/types/core/src/text-search.d.ts +1 -1
  93. package/dist/types/core/src/theme.d.ts +10 -2
  94. package/dist/types/core/src/updates.d.ts +87 -0
  95. package/dist/types/core/src/virtual-list.d.ts +8 -2
  96. package/dist/types/core/txiki/fetch.d.ts +1 -0
  97. package/dist/types/core/txiki/intl-data.d.ts +6 -0
  98. package/dist/types/core/txiki/intl.d.ts +92 -0
  99. package/dist/types/core/txiki/prelude.d.ts +1 -0
  100. package/dist/types/core/txiki/runtime.d.ts +2 -0
  101. package/dist/types/core/txiki/shims/buffer.d.ts +37 -0
  102. package/dist/types/core/txiki/shims/child-process.d.ts +46 -0
  103. package/dist/types/core/txiki/shims/crypto.d.ts +16 -0
  104. package/dist/types/core/txiki/shims/events.d.ts +21 -0
  105. package/dist/types/core/txiki/shims/fs-promises.d.ts +41 -0
  106. package/dist/types/core/txiki/shims/fs.d.ts +44 -0
  107. package/dist/types/core/txiki/shims/module.d.ts +5 -0
  108. package/dist/types/core/txiki/shims/net.d.ts +22 -0
  109. package/dist/types/core/txiki/shims/os.d.ts +52 -0
  110. package/dist/types/core/txiki/shims/path.d.ts +3 -0
  111. package/dist/types/core/txiki/shims/timers-promises.d.ts +7 -0
  112. package/dist/types/core/txiki/shims/zlib.d.ts +11 -0
  113. package/dist/types/core/txiki/unavailable.d.ts +5 -0
  114. package/dist/types/core/txiki-build.d.ts +23 -0
  115. package/dist/types/core/updates-build.d.ts +35 -0
  116. package/dist/types/core/windows-executable.d.ts +16 -0
  117. package/dist/types/protocol/src/index.d.ts +344 -11
  118. package/native/linux-x64/libtarve_native.so +0 -0
  119. package/native/linux-x64/runtime.json +4 -4
  120. package/native/win32-x64/runtime.json +4 -4
  121. package/native/win32-x64/tarve_native.dll +0 -0
  122. package/package.json +13 -3
@@ -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 = 48;
3
+ export declare const PROTOCOL_VERSION = 59;
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. */
@@ -28,6 +28,21 @@ export type Insets = number | {
28
28
  bottom?: number;
29
29
  left?: number;
30
30
  };
31
+ /** A margin side: px, a percentage of the container, or `"auto"` (CSS auto margins centre a box or push it aside). */
32
+ export type MarginSide = number | `${number}%` | "auto";
33
+ export type Margins = MarginSide | {
34
+ top?: MarginSide;
35
+ right?: MarginSide;
36
+ bottom?: MarginSide;
37
+ left?: MarginSide;
38
+ };
39
+ /** Corner radii: a number rounds every corner; an object names each (missing corners are square). */
40
+ export type CornerRadius = number | {
41
+ topLeft?: number;
42
+ topRight?: number;
43
+ bottomRight?: number;
44
+ bottomLeft?: number;
45
+ };
31
46
  export type OutlineStyle = "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "none" | "hidden";
32
47
  /** Same values as OutlineStyle. Non-solid styles apply when all four border widths are equal. */
33
48
  export type BorderStyle = OutlineStyle;
@@ -40,12 +55,21 @@ export interface TextShadow {
40
55
  }
41
56
  /** CSS-like box shadow. `blur` is the CSS blur radius (sigma = blur / 2); `inset` paints inside the padding box. */
42
57
  /** Paint-time translate/scale about the box centre. Hit testing follows it; layout does not. */
58
+ /**
59
+ * Paint-time transform about the box's origin (its centre unless `originX`/`originY`, fractions
60
+ * of the box, say otherwise): translate, scale, `rotate` and `skewX`/`skewY` in degrees.
61
+ */
43
62
  export interface Transform {
44
63
  x?: number;
45
64
  y?: number;
46
65
  scale?: number;
47
66
  scaleX?: number;
48
67
  scaleY?: number;
68
+ rotate?: number;
69
+ skewX?: number;
70
+ skewY?: number;
71
+ originX?: number;
72
+ originY?: number;
49
73
  }
50
74
  export interface BoxShadow {
51
75
  x?: number;
@@ -156,13 +180,39 @@ export interface TextHighlight {
156
180
  color?: string;
157
181
  activeColor?: string;
158
182
  }
183
+ /**
184
+ * Liquid-glass material: what is behind the box shows through blurred and bent at the
185
+ * edges, under the box's `background` colour as a tint. The D3D11 renderer paints it;
186
+ * other renderers paint the tint alone.
187
+ */
188
+ export interface GlassMaterial {
189
+ /** Blur radius in px of what is behind the box (CSS `backdrop-filter: blur()`), 0–64. */
190
+ blur: number;
191
+ /** Colour saturation of the blurred backdrop; 1 leaves it, iOS uses about 1.6. */
192
+ saturate?: number;
193
+ /** How far in px the backdrop bends along the rounded edge (the lens), 0 for none. */
194
+ refraction?: number;
195
+ /** Brightness 0–1 of the rim, the edge reflections and the sheen. */
196
+ highlight?: number;
197
+ /** How much the flat part enlarges the backdrop, as a thick lens does: 0–0.3 (0.06 is iOS-like). */
198
+ magnify?: number;
199
+ /**
200
+ * Boxes painted in one frame with the same key fuse like drops of liquid: their
201
+ * shapes join smoothly where they come within `blend` px of each other.
202
+ */
203
+ merge?: string;
204
+ /** How far apart in px two merged boxes start bridging. Default 0 (touching). */
205
+ blend?: number;
206
+ }
159
207
  export interface StateStyle {
208
+ /** Liquid-glass material behind the box; `background` is its tint. */
209
+ glass?: GlassMaterial;
160
210
  /** Colour, gradient object, or CSS `linear-gradient(…)` / `radial-gradient(…)` string. */
161
211
  background?: string | Gradient;
162
212
  foreground?: string | Gradient;
163
213
  borderColor?: string | Gradient;
164
214
  borderStyle?: BorderStyle;
165
- radius?: number;
215
+ radius?: CornerRadius;
166
216
  opacity?: number;
167
217
  outlineWidth?: number;
168
218
  outlineColor?: string;
@@ -191,7 +241,14 @@ export interface Style extends StateStyle {
191
241
  minHeight?: Length;
192
242
  maxWidth?: Length;
193
243
  maxHeight?: Length;
194
- flex?: number;
244
+ /**
245
+ * CSS `flex`: a number is the shorthand `N 1 0` (`flex: 1`), a string any CSS value
246
+ * (`"1 1 176px"`, `"auto"`, `"none"`). Like CSS, items don't shrink below their content
247
+ * unless `minWidth`/`minHeight` is 0.
248
+ */
249
+ flex?: number | string;
250
+ grow?: number;
251
+ basis?: Length | "auto";
195
252
  shrink?: number;
196
253
  aspectRatio?: number;
197
254
  position?: "relative" | "absolute";
@@ -202,22 +259,64 @@ export interface Style extends StateStyle {
202
259
  direction?: "row" | "row-reverse" | "column" | "column-reverse";
203
260
  wrap?: boolean;
204
261
  gap?: number;
262
+ /** CSS `row-gap` / `column-gap`; each falls back to `gap`. */
263
+ rowGap?: number;
264
+ columnGap?: number;
205
265
  padding?: Insets;
206
- margin?: Insets;
207
- align?: "start" | "center" | "end" | "stretch";
208
- justify?: "start" | "center" | "end" | "between";
209
- display?: "flex" | "grid" | "none";
210
- columns?: number;
266
+ margin?: Margins;
267
+ align?: "start" | "center" | "end" | "stretch" | "baseline";
268
+ /** CSS `justify-content`: `around` and `evenly` are `space-around` / `space-evenly`. */
269
+ justify?: "start" | "center" | "end" | "between" | "around" | "evenly" | "stretch";
270
+ /** CSS `align-self`, `align-content`, `justify-items`, `justify-self`. */
271
+ alignSelf?: "start" | "center" | "end" | "stretch" | "baseline";
272
+ alignContent?: "start" | "center" | "end" | "stretch" | "between" | "around" | "evenly";
273
+ justifyItems?: "start" | "center" | "end" | "stretch";
274
+ justifySelf?: "start" | "center" | "end" | "stretch";
275
+ /** `block` stacks children and collapses adjacent vertical margins, as CSS block flow does. */
276
+ display?: "flex" | "grid" | "block" | "none";
277
+ /** Grid tracks: a count of equal columns, or a CSS track list such as `"repeat(auto-fill, minmax(176px, 1fr))"`. */
278
+ columns?: number | string;
279
+ /** CSS `grid-column` / `grid-row` placement: `"span 2"`, `2`, `"1 / 3"`. */
280
+ gridColumn?: number | string;
281
+ gridRow?: number | string;
282
+ /** CSS `cursor` keyword; inherited by descendants. */
283
+ cursor?: "auto" | "default" | "pointer" | "text" | "vertical-text" | "move" | "grab" | "grabbing" | "not-allowed" | "no-drop" | "wait" | "progress" | "help" | "crosshair" | "copy" | "alias" | "context-menu" | "cell" | "zoom-in" | "zoom-out" | "col-resize" | "row-resize" | "ew-resize" | "ns-resize" | "nesw-resize" | "nwse-resize" | "all-scroll";
284
+ /** Grid row tracks as a CSS track list (`"auto 1fr"`); rows are implicit when omitted. */
285
+ rows?: number | string;
211
286
  zIndex?: number;
212
287
  borderWidth?: Insets;
213
- radius?: number;
288
+ radius?: CornerRadius;
214
289
  fontSize?: number;
215
290
  fontWeight?: number;
216
291
  fontFamily?: string;
217
292
  /** Native retained transitions. Bun sends the target once; Rust owns interpolation. */
218
293
  transition?: MotionTransitions;
294
+ /** Continuous rotation about the centre, one turn per `spin` milliseconds. Rust drives the frames. */
295
+ spin?: number;
296
+ /** CSS text: `font-style`, `letter-spacing`, `word-spacing`, `text-transform`, `white-space`, `text-overflow` and `line-clamp`. */
297
+ fontStyle?: "normal" | "italic" | "oblique";
298
+ letterSpacing?: number;
299
+ wordSpacing?: number;
300
+ /** CSS `font-variant-numeric` (e.g. `"tabular-nums"`, `"slashed-zero"`) and `font-feature-settings` (`'"ss01" 1, "cv11" 1'`). Inherited. */
301
+ fontVariantNumeric?: string;
302
+ fontFeatureSettings?: string;
303
+ /** CSS `scrollbar-width` on scroll boxes and text areas: `none` hides the bar (still scrollable), `thin` narrows it. */
304
+ scrollbarWidth?: "auto" | "thin" | "none";
305
+ textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
306
+ whiteSpace?: "normal" | "nowrap" | "pre" | "pre-wrap" | "pre-line";
307
+ textOverflow?: "clip" | "ellipsis";
308
+ lineClamp?: number;
309
+ /** CSS `transform: matrix(a, b, c, d, e, f)` with `transform-origin: 0 0`, inside `transform`. */
310
+ transformMatrix?: [number, number, number, number, number, number];
311
+ /** CSS `clip-path: path([nonzero | evenodd,] "<svg path>")` in the box's coordinates. */
312
+ clipPath?: string;
313
+ /** CSS `text-decoration-style`. */
314
+ textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | "wavy";
315
+ /** CSS `overflow`: `hidden`/`clip` clip children to the box and let it shrink below its content. */
316
+ overflow?: "visible" | "hidden" | "clip";
317
+ /** Line height as a multiple of the font size (CSS unitless `line-height`), not px. */
219
318
  lineHeight?: number;
220
- textAlign?: "start" | "center" | "end";
319
+ textAlign?: "start" | "center" | "end" | "justify";
221
320
  taskMarkerColor?: string;
222
321
  taskMarkerCheckColor?: string;
223
322
  markdownCodeBackground?: string;
@@ -254,8 +353,37 @@ export interface Style extends StateStyle {
254
353
  focusVisible?: StateStyle;
255
354
  active?: StateStyle;
256
355
  disabled?: StateStyle;
356
+ /** Marks a `group`: descendants' `groupHover` applies while this box is hovered (Tailwind's `group`). */
357
+ group?: boolean;
358
+ /** Applied while an ancestor marked `group` is hovered (`group-hover:`). */
359
+ groupHover?: StateStyle;
360
+ /** Applied while this box or a descendant has focus (CSS `:focus-within`). */
361
+ focusWithin?: StateStyle;
362
+ /**
363
+ * Position among the parent's element children: `first`, `last`, `odd`, `even` (1-based, as CSS
364
+ * `:nth-child`). Folded by the reconciler; the native tree never sees these keys.
365
+ */
366
+ first?: Omit<Style, "dark">;
367
+ last?: Omit<Style, "dark">;
368
+ odd?: Omit<Style, "dark">;
369
+ even?: Omit<Style, "dark">;
370
+ /**
371
+ * Window-width breakpoints (Tailwind's: 640, 768, 1024, 1280, 1536 CSS px, min-width), folded by the
372
+ * reconciler against the window's current size; the app re-renders when the width crosses one.
373
+ */
374
+ sm?: Omit<Style, "dark">;
375
+ md?: Omit<Style, "dark">;
376
+ lg?: Omit<Style, "dark">;
377
+ xl?: Omit<Style, "dark">;
378
+ "2xl"?: Omit<Style, "dark">;
379
+ /**
380
+ * Overrides applied when the window theme is dark (its background luminance below 0.5),
381
+ * like Tailwind's `dark:`. The reconciler folds them in; the native tree never sees the key.
382
+ */
383
+ dark?: Omit<Style, "dark">;
384
+ /** `none` lets the pointer fall through this box and its children, as CSS `pointer-events: none`. */
257
385
  strokeWidth?: number;
258
- pointerEvents?: "auto" | "block";
386
+ pointerEvents?: "auto" | "block" | "delegate" | "none";
259
387
  userSelect?: UserSelect;
260
388
  }
261
389
  export interface Control {
@@ -286,6 +414,7 @@ export interface VirtualListLayout {
286
414
  scrollRequest?: {
287
415
  generation: number;
288
416
  offset: number;
417
+ smooth?: boolean;
289
418
  };
290
419
  }
291
420
  export interface VirtualListMeasurement {
@@ -310,12 +439,25 @@ export type NativeImageSource = {
310
439
  height: number;
311
440
  premultiplied?: boolean;
312
441
  };
442
+ /** A styled range of a text node, in UTF-8 byte offsets; `id` makes it a click target. */
443
+ export interface TextRun {
444
+ start: number;
445
+ end: number;
446
+ id?: string;
447
+ /** Run overrides; `textDecoration` may combine lines ("underline line-through") as in CSS. */
448
+ style: Partial<Omit<Style, "textDecoration">> & {
449
+ textDecoration?: string;
450
+ /** CSS `vertical-align: super | sub`: baseline shift in px, up. */
451
+ baselineShift?: number;
452
+ };
453
+ }
313
454
  export interface NativeNode {
314
455
  id: string;
315
456
  kind: NodeKind;
316
457
  style: Style;
317
458
  children: NativeNode[];
318
459
  text?: string;
460
+ runs?: TextRun[];
319
461
  source?: string;
320
462
  language?: string;
321
463
  path?: string;
@@ -348,16 +490,33 @@ export interface NativeNode {
348
490
  labelledBy?: string[];
349
491
  closeIntercept?: boolean;
350
492
  dragRegion?: boolean;
493
+ /** Interactive nodes only: a press past 4px becomes a pointer drag. */
494
+ draggable?: boolean;
495
+ dropTarget?: boolean;
496
+ /** Native sends a `size` event with the content-box size on first layout and on every change. */
497
+ reportSize?: boolean;
498
+ /** Native sends `pointerMove` events with the pointer's position inside the node while it is over it. */
499
+ reportPointer?: boolean;
351
500
  windowAction?: "minimize" | "toggleMaximize" | "close";
352
501
  /** Optional initial numeric values used only when the native node is first mounted. */
353
502
  motionFrom?: MotionValues;
354
503
  }
355
504
  export type ScrollOrientation = "vertical" | "horizontal" | "both";
505
+ /**
506
+ * What moved a scroll container: input (wheel, scrollbar, keyboard, assistive
507
+ * technology), the app (scrollToItem, including each step of a smooth one), or
508
+ * layout (rows above the anchor changed height).
509
+ */
510
+ export type ScrollSource = "user" | "program" | "layout";
511
+ export interface ScrollInfo {
512
+ source: ScrollSource;
513
+ }
356
514
  export interface ScrollPosition {
357
515
  x: number;
358
516
  y: number;
359
517
  maxX: number;
360
518
  maxY: number;
519
+ source: ScrollSource;
361
520
  }
362
521
  export type WindowPositionPreset = "top-left" | "top" | "top-right" | "left" | "center" | "right" | "bottom-left" | "bottom" | "bottom-right";
363
522
  export type WindowPosition = WindowPositionPreset | {
@@ -377,12 +536,37 @@ export interface WindowOptions {
377
536
  debug?: boolean;
378
537
  /** Test/runtime option: keep the native desktop window hidden. */
379
538
  visible?: boolean;
539
+ level?: WindowLevel;
540
+ /** No taskbar button or task switcher entry (Windows; Linux on X11). */
541
+ skipTaskbar?: boolean;
542
+ /** A desktop widget `columns` × `rows` cells (the icon grid on Windows; 80 × 100 cells on Linux). */
543
+ desktopWidget?: DesktopWidget;
544
+ }
545
+ export interface DesktopWidget {
546
+ columns: number;
547
+ rows: number;
380
548
  }
549
+ /** Stacking: `alwaysOnBottom` keeps the window under every other one, like a desktop widget. */
550
+ export type WindowLevel = "normal" | "alwaysOnTop" | "alwaysOnBottom";
381
551
  export interface SceneDocument {
382
552
  version: number;
383
553
  renderer: Renderer;
384
554
  window: WindowOptions;
385
555
  root: NativeNode;
556
+ /** D3D11 MSAA samples: 0 (default) uses a coverage fringe instead; 2, 4 or 8. */
557
+ msaa?: number;
558
+ /** Idle ms after the last frame before the working set is trimmed (Windows); negative: never. */
559
+ memoryTrimDelay?: number;
560
+ /** App font files as base64 (CSS `@font-face`), usable by their family name. */
561
+ fonts?: string[];
562
+ /** Windows app identity (AppUserModelID): names the app in media controls and notifications. */
563
+ appIdentity?: {
564
+ id: string;
565
+ name: string;
566
+ icon?: string;
567
+ };
568
+ /** Window and taskbar icon: base64 PNG, ICO, JPEG or WebP bytes. */
569
+ windowIcon?: string;
386
570
  }
387
571
  export type TreeMutation = {
388
572
  type: "create";
@@ -409,6 +593,20 @@ export interface FileDialogOptions {
409
593
  filters?: FileDialogFilter[];
410
594
  }
411
595
  export type FileDialogMode = "openFile" | "openFiles" | "openFolder" | "saveFile";
596
+ export type WindowAction = "show" | "hide" | "minimize" | "focus";
597
+ export interface NativeTrayMenuItem {
598
+ id?: string;
599
+ label?: string;
600
+ separator?: boolean;
601
+ checked?: boolean;
602
+ disabled?: boolean;
603
+ items?: NativeTrayMenuItem[];
604
+ }
605
+ export interface NativeTrayOptions {
606
+ iconData?: string;
607
+ tooltip?: string;
608
+ menu: NativeTrayMenuItem[];
609
+ }
412
610
  export type NativeCommand = {
413
611
  type: "patch";
414
612
  nodes: NativeNode[];
@@ -422,9 +620,37 @@ export type NativeCommand = {
422
620
  type: "close";
423
621
  } | {
424
622
  type: "cancelCloseRequest";
623
+ } | {
624
+ type: "window";
625
+ action: WindowAction;
626
+ } | {
627
+ type: "windowLevel";
628
+ level: WindowLevel;
629
+ } | {
630
+ type: "tray";
631
+ tray: NativeTrayOptions | null;
632
+ } | {
633
+ type: "systemMedia";
634
+ session: NativeSystemMediaSession | null;
635
+ } | {
636
+ type: "notify";
637
+ title: string;
638
+ body: string;
639
+ } | {
640
+ type: "media";
641
+ id: string;
642
+ action: "load" | "unload" | "play" | "pause" | "seek" | "set";
643
+ src?: string;
644
+ time?: number;
645
+ volume?: number;
646
+ muted?: boolean;
647
+ loop?: boolean;
425
648
  } | {
426
649
  type: "frameOverlay";
427
650
  enabled: boolean;
651
+ } | {
652
+ type: "frameRate";
653
+ maxFps: number | null;
428
654
  } | {
429
655
  type: "focus";
430
656
  id: string;
@@ -433,9 +659,14 @@ export type NativeCommand = {
433
659
  id: string;
434
660
  index: number;
435
661
  offset?: number;
662
+ smooth?: boolean;
436
663
  } | {
437
664
  type: "inspect";
438
665
  requestId: string;
666
+ } | {
667
+ type: "stats";
668
+ requestId: string;
669
+ reset?: boolean;
439
670
  } | {
440
671
  type: "resize";
441
672
  width: number;
@@ -489,6 +720,8 @@ export interface Snapshot {
489
720
  layouts: number;
490
721
  shapes: number;
491
722
  paints: number;
723
+ /** Frames presented in the last second. */
724
+ fps: number;
492
725
  activeMotions: number;
493
726
  /** Glyphs rasterized so far on renderers with their own glyph atlas (D3D11); null elsewhere. */
494
727
  glyphRasterizations?: number | null;
@@ -499,10 +732,59 @@ export interface Snapshot {
499
732
  height: number;
500
733
  scale: number;
501
734
  }
735
+ /** Milliseconds of one phase over its recent samples (the last 600 frames or updates). */
736
+ export interface PhaseSummary {
737
+ count: number;
738
+ p50: number;
739
+ p95: number;
740
+ p99: number;
741
+ max: number;
742
+ }
743
+ /** Process memory: resident (Task Manager "Memory", Linux VmRSS) and private (Windows commit, Linux anonymous RSS). */
744
+ export interface MemoryReading {
745
+ workingSetMb: number;
746
+ privateMb: number;
747
+ }
748
+ export interface NativeStats {
749
+ /**
750
+ * apply: a JS update applied to the retained tree; layout: layout and text measurement;
751
+ * paint: recording the frame; present: rasterize and present (includes vsync waits);
752
+ * frame: motion, layout and paint together; gpu: GPU execution of a frame (D3D11 only,
753
+ * count 0 elsewhere). Null in the browser build.
754
+ */
755
+ phases: Record<"apply" | "layout" | "paint" | "present" | "frame" | "gpu", PhaseSummary> | null;
756
+ /** Memory after each startup stage (start, tree, window, graphics, firstFrame) and now. */
757
+ memory: {
758
+ stages: (MemoryReading & {
759
+ label: string;
760
+ })[];
761
+ current: MemoryReading | null;
762
+ } | null;
763
+ }
502
764
  export type NativeEvent = {
503
765
  type: "ready" | "closed";
504
766
  } | {
505
767
  type: "closeRequest";
768
+ } | {
769
+ type: "tray";
770
+ action: "click" | "doubleClick";
771
+ } | {
772
+ type: "systemMedia";
773
+ action: "play" | "pause" | "next" | "previous" | "seek";
774
+ time?: number;
775
+ } | {
776
+ type: "trayMenu";
777
+ id: string;
778
+ } | {
779
+ type: "notificationClick";
780
+ } | {
781
+ type: "media";
782
+ id: string;
783
+ event: "loadedmetadata" | "play" | "pause" | "timeupdate" | "seeked" | "ended" | "error";
784
+ time?: number;
785
+ duration?: number | null;
786
+ paused?: boolean;
787
+ message?: string;
506
788
  } | {
507
789
  type: "escape";
508
790
  } | {
@@ -546,15 +828,30 @@ export type NativeEvent = {
546
828
  offsetY?: number;
547
829
  maxX?: number;
548
830
  maxY?: number;
831
+ source?: ScrollSource;
549
832
  } | {
550
833
  type: "virtualListLayout";
551
834
  id: string;
552
835
  items: VirtualListMeasurement[];
836
+ } | {
837
+ type: "size";
838
+ id: string;
839
+ width: number;
840
+ height: number;
841
+ } | {
842
+ type: "pointerMove";
843
+ id: string;
844
+ x: number;
845
+ y: number;
846
+ } | {
847
+ type: "pointerLeave";
848
+ id: string;
553
849
  } | {
554
850
  type: "virtualListScrollToItem";
555
851
  id: string;
556
852
  index: number;
557
853
  offset: number;
854
+ smooth?: boolean;
558
855
  } | {
559
856
  type: "virtualListFocus";
560
857
  id: string;
@@ -590,6 +887,26 @@ export type NativeEvent = {
590
887
  type: "hover";
591
888
  id: string;
592
889
  entered: boolean;
890
+ } | {
891
+ type: "dragStart";
892
+ id: string;
893
+ x: number;
894
+ y: number;
895
+ } | {
896
+ type: "dragMove";
897
+ id: string;
898
+ x: number;
899
+ y: number;
900
+ over: string | null;
901
+ } | {
902
+ type: "drop";
903
+ id: string;
904
+ target: string | null;
905
+ x: number;
906
+ y: number;
907
+ } | {
908
+ type: "dragCancel";
909
+ id: string;
593
910
  } | {
594
911
  type: "key";
595
912
  id: string;
@@ -607,6 +924,10 @@ export type NativeEvent = {
607
924
  type: "inspect";
608
925
  requestId: string;
609
926
  snapshot: Snapshot;
927
+ } | {
928
+ type: "stats";
929
+ requestId: string;
930
+ stats: NativeStats;
610
931
  } | {
611
932
  type: "captured";
612
933
  requestId: string;
@@ -631,3 +952,15 @@ export type NativeEvent = {
631
952
  type: "frame";
632
953
  frames: number;
633
954
  };
955
+ export interface NativeSystemMediaSession {
956
+ title: string;
957
+ artist?: string;
958
+ album?: string;
959
+ artwork?: string;
960
+ playing: boolean;
961
+ duration?: number;
962
+ position?: number;
963
+ canSeek?: boolean;
964
+ canNext?: boolean;
965
+ canPrevious?: boolean;
966
+ }
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.4.0",
4
- "protocolVersion": 48,
3
+ "packageVersion": "0.6.0",
4
+ "protocolVersion": 59,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050",
6
+ "sourceFingerprint": "825110f6accde0e1d2ba89c4fc78d571b652ed43539596aacf82851f8e880e29",
7
7
  "target": "linux-x64",
8
8
  "nativeName": "libtarve_native.so",
9
- "sha256": "26ed8f31b8d1665fbc0619ec6c7efe2b962a0c1ab4002855c455cec28ca854a5"
9
+ "sha256": "53defd6a0fe13692fc0035b58dc84f4ce6a18b1d64ee94ac68a732faf6f277a0"
10
10
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.4.0",
4
- "protocolVersion": 48,
3
+ "packageVersion": "0.6.0",
4
+ "protocolVersion": 59,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050",
6
+ "sourceFingerprint": "825110f6accde0e1d2ba89c4fc78d571b652ed43539596aacf82851f8e880e29",
7
7
  "target": "windows-x64",
8
8
  "nativeName": "tarve_native.dll",
9
- "sha256": "9a88b98c21f62e8acc20221450f23d7992d38cd523f0bf12570c446324487316"
9
+ "sha256": "24d55e8bf097e5df4674fd8840217f0e90694f3dcecab0b3cb08297879f70fd5"
10
10
  }
Binary file
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tarve/core",
3
- "version": "0.4.0",
4
- "description": "Native Bun/TSX GUI with Taffy layout, Parley text and Vello rendering",
3
+ "version": "0.6.0",
4
+ "description": "Native Bun/Node.js TSX GUI with Taffy layout, Parley text and Vello rendering",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
7
7
  "gui",
8
8
  "desktop",
9
9
  "native",
10
10
  "bun",
11
+ "node",
11
12
  "tsx",
12
13
  "jsx",
13
14
  "ui",
@@ -69,6 +70,10 @@
69
70
  "types": "./dist/types/core/build.d.ts",
70
71
  "default": "./dist/npm/build.js"
71
72
  },
73
+ "./build-node": {
74
+ "types": "./dist/types/core/node-build.d.ts",
75
+ "default": "./dist/npm/node-build.js"
76
+ },
72
77
  "./protocol": {
73
78
  "types": "./dist/types/protocol/src/index.d.ts",
74
79
  "default": "./dist/npm/protocol.js"
@@ -79,6 +84,11 @@
79
84
  "./package.json": "./package.json"
80
85
  },
81
86
  "engines": {
82
- "bun": ">=1.4.0"
87
+ "bun": ">=1.4.0",
88
+ "node": ">=26.10.0"
89
+ },
90
+ "dependencies": {
91
+ "esbuild": "0.25.0",
92
+ "resedit": "3.1.0"
83
93
  }
84
94
  }