@tarve/core 0.5.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 (109) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +54 -2
  3. package/dist/npm/build.js +714 -138
  4. package/dist/npm/cli.js +1013 -161
  5. package/dist/npm/embedded-assets.js +7 -2
  6. package/dist/npm/index.js +3096 -1084
  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 +299 -5
  11. package/dist/npm/protocol.js +1 -1
  12. package/dist/npm/txiki/fetch.ts +228 -0
  13. package/dist/npm/txiki/intl-data.ts +7 -0
  14. package/dist/npm/txiki/intl.test.ts +53 -0
  15. package/dist/npm/txiki/intl.ts +249 -0
  16. package/dist/npm/txiki/prelude.ts +132 -0
  17. package/dist/npm/txiki/runtime.ts +6 -0
  18. package/dist/npm/txiki/shims/buffer.ts +112 -0
  19. package/dist/npm/txiki/shims/child-process.ts +151 -0
  20. package/dist/npm/txiki/shims/crypto.ts +30 -0
  21. package/dist/npm/txiki/shims/events.ts +75 -0
  22. package/dist/npm/txiki/shims/fs-promises.ts +77 -0
  23. package/dist/npm/txiki/shims/fs.ts +231 -0
  24. package/dist/npm/txiki/shims/module.ts +8 -0
  25. package/dist/npm/txiki/shims/net.ts +69 -0
  26. package/dist/npm/txiki/shims/os.ts +72 -0
  27. package/dist/npm/txiki/shims/path.ts +4 -0
  28. package/dist/npm/txiki/shims/timers-promises.ts +9 -0
  29. package/dist/npm/txiki/shims/zlib.ts +9 -0
  30. package/dist/npm/txiki/tjs.d.ts +58 -0
  31. package/dist/npm/txiki/unavailable.ts +10 -0
  32. package/dist/types/core/build.d.ts +5 -2
  33. package/dist/types/core/jsx-compile.d.ts +7 -0
  34. package/dist/types/core/src/advanced-controls.d.ts +1 -1
  35. package/dist/types/core/src/app/element-events.d.ts +18 -0
  36. package/dist/types/core/src/app/media.d.ts +15 -0
  37. package/dist/types/core/src/app/requests.d.ts +25 -0
  38. package/dist/types/core/src/app/shadow.d.ts +7 -0
  39. package/dist/types/core/src/app/stats.d.ts +12 -0
  40. package/dist/types/core/src/app/tray.d.ts +40 -0
  41. package/dist/types/core/src/app-metadata.d.ts +2 -0
  42. package/dist/types/core/src/app.d.ts +29 -27
  43. package/dist/types/core/src/bridge/index.d.ts +1 -1
  44. package/dist/types/core/src/chat-controls.d.ts +2 -1
  45. package/dist/types/core/src/components/button.d.ts +1 -1
  46. package/dist/types/core/src/components/glass.d.ts +52 -0
  47. package/dist/types/core/src/components/icon.d.ts +1 -1
  48. package/dist/types/core/src/components/image.d.ts +1 -1
  49. package/dist/types/core/src/components/layout.d.ts +1 -1
  50. package/dist/types/core/src/components/pressable.d.ts +1 -1
  51. package/dist/types/core/src/components/rich-content.d.ts +1 -1
  52. package/dist/types/core/src/components/scroll.d.ts +2 -2
  53. package/dist/types/core/src/components/svg.d.ts +1 -1
  54. package/dist/types/core/src/components/titlebar.d.ts +15 -1
  55. package/dist/types/core/src/components/window.d.ts +21 -1
  56. package/dist/types/core/src/components.d.ts +2 -0
  57. package/dist/types/core/src/css-shadow.d.ts +1 -1
  58. package/dist/types/core/src/desktop-controls.d.ts +2 -2
  59. package/dist/types/core/src/embedded-assets.d.ts +3 -2
  60. package/dist/types/core/src/extra-controls.d.ts +1 -1
  61. package/dist/types/core/src/form-controls.d.ts +1 -1
  62. package/dist/types/core/src/index.d.ts +20 -11
  63. package/dist/types/core/src/inline-text.d.ts +7 -3
  64. package/dist/types/core/src/intrinsic-style.d.ts +1 -1
  65. package/dist/types/core/src/jsx-runtime.d.ts +10 -4
  66. package/dist/types/core/src/media-element.d.ts +3 -4
  67. package/dist/types/core/src/memo.d.ts +10 -0
  68. package/dist/types/core/src/motion.d.ts +1 -1
  69. package/dist/types/core/src/popups.d.ts +1 -1
  70. package/dist/types/core/src/protocol.d.ts +6 -0
  71. package/dist/types/core/src/reconciler/diff.d.ts +11 -0
  72. package/dist/types/core/src/reconciler/intrinsics.d.ts +24 -0
  73. package/dist/types/core/src/reconciler.d.ts +10 -11
  74. package/dist/types/core/src/render-scope.d.ts +8 -0
  75. package/dist/types/core/src/style.d.ts +1 -1
  76. package/dist/types/core/src/tailwind-palette.d.ts +1 -0
  77. package/dist/types/core/src/tailwind.d.ts +8 -0
  78. package/dist/types/core/src/test-renderer.d.ts +1 -1
  79. package/dist/types/core/src/text-search.d.ts +1 -1
  80. package/dist/types/core/src/theme.d.ts +8 -1
  81. package/dist/types/core/src/updates.d.ts +87 -0
  82. package/dist/types/core/src/virtual-list.d.ts +3 -1
  83. package/dist/types/core/txiki/fetch.d.ts +1 -0
  84. package/dist/types/core/txiki/intl-data.d.ts +6 -0
  85. package/dist/types/core/txiki/intl.d.ts +92 -0
  86. package/dist/types/core/txiki/prelude.d.ts +1 -0
  87. package/dist/types/core/txiki/runtime.d.ts +2 -0
  88. package/dist/types/core/txiki/shims/buffer.d.ts +37 -0
  89. package/dist/types/core/txiki/shims/child-process.d.ts +46 -0
  90. package/dist/types/core/txiki/shims/crypto.d.ts +16 -0
  91. package/dist/types/core/txiki/shims/events.d.ts +21 -0
  92. package/dist/types/core/txiki/shims/fs-promises.d.ts +41 -0
  93. package/dist/types/core/txiki/shims/fs.d.ts +44 -0
  94. package/dist/types/core/txiki/shims/module.d.ts +5 -0
  95. package/dist/types/core/txiki/shims/net.d.ts +22 -0
  96. package/dist/types/core/txiki/shims/os.d.ts +52 -0
  97. package/dist/types/core/txiki/shims/path.d.ts +3 -0
  98. package/dist/types/core/txiki/shims/timers-promises.d.ts +7 -0
  99. package/dist/types/core/txiki/shims/zlib.d.ts +11 -0
  100. package/dist/types/core/txiki/unavailable.d.ts +5 -0
  101. package/dist/types/core/txiki-build.d.ts +23 -0
  102. package/dist/types/core/updates-build.d.ts +35 -0
  103. package/dist/types/protocol/src/index.d.ts +159 -8
  104. package/native/linux-x64/libtarve_native.so +0 -0
  105. package/native/linux-x64/runtime.json +4 -4
  106. package/native/win32-x64/runtime.json +4 -4
  107. package/native/win32-x64/tarve_native.dll +0 -0
  108. package/package.json +3 -2
  109. /package/dist/types/core/{app-metadata.d.ts → package-metadata.d.ts} +0 -0
@@ -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 = 58;
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;
@@ -209,10 +259,19 @@ export interface Style extends StateStyle {
209
259
  direction?: "row" | "row-reverse" | "column" | "column-reverse";
210
260
  wrap?: boolean;
211
261
  gap?: number;
262
+ /** CSS `row-gap` / `column-gap`; each falls back to `gap`. */
263
+ rowGap?: number;
264
+ columnGap?: number;
212
265
  padding?: Insets;
213
- margin?: Insets;
214
- align?: "start" | "center" | "end" | "stretch";
215
- justify?: "start" | "center" | "end" | "between";
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";
216
275
  /** `block` stacks children and collapses adjacent vertical margins, as CSS block flow does. */
217
276
  display?: "flex" | "grid" | "block" | "none";
218
277
  /** Grid tracks: a count of equal columns, or a CSS track list such as `"repeat(auto-fill, minmax(176px, 1fr))"`. */
@@ -226,7 +285,7 @@ export interface Style extends StateStyle {
226
285
  rows?: number | string;
227
286
  zIndex?: number;
228
287
  borderWidth?: Insets;
229
- radius?: number;
288
+ radius?: CornerRadius;
230
289
  fontSize?: number;
231
290
  fontWeight?: number;
232
291
  fontFamily?: string;
@@ -255,8 +314,9 @@ export interface Style extends StateStyle {
255
314
  textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | "wavy";
256
315
  /** CSS `overflow`: `hidden`/`clip` clip children to the box and let it shrink below its content. */
257
316
  overflow?: "visible" | "hidden" | "clip";
317
+ /** Line height as a multiple of the font size (CSS unitless `line-height`), not px. */
258
318
  lineHeight?: number;
259
- textAlign?: "start" | "center" | "end";
319
+ textAlign?: "start" | "center" | "end" | "justify";
260
320
  taskMarkerColor?: string;
261
321
  taskMarkerCheckColor?: string;
262
322
  markdownCodeBackground?: string;
@@ -293,8 +353,37 @@ export interface Style extends StateStyle {
293
353
  focusVisible?: StateStyle;
294
354
  active?: StateStyle;
295
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`. */
296
385
  strokeWidth?: number;
297
- pointerEvents?: "auto" | "block" | "delegate";
386
+ pointerEvents?: "auto" | "block" | "delegate" | "none";
298
387
  userSelect?: UserSelect;
299
388
  }
300
389
  export interface Control {
@@ -413,11 +502,21 @@ export interface NativeNode {
413
502
  motionFrom?: MotionValues;
414
503
  }
415
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
+ }
416
514
  export interface ScrollPosition {
417
515
  x: number;
418
516
  y: number;
419
517
  maxX: number;
420
518
  maxY: number;
519
+ source: ScrollSource;
421
520
  }
422
521
  export type WindowPositionPreset = "top-left" | "top" | "top-right" | "left" | "center" | "right" | "bottom-left" | "bottom" | "bottom-right";
423
522
  export type WindowPosition = WindowPositionPreset | {
@@ -437,7 +536,18 @@ export interface WindowOptions {
437
536
  debug?: boolean;
438
537
  /** Test/runtime option: keep the native desktop window hidden. */
439
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;
440
548
  }
549
+ /** Stacking: `alwaysOnBottom` keeps the window under every other one, like a desktop widget. */
550
+ export type WindowLevel = "normal" | "alwaysOnTop" | "alwaysOnBottom";
441
551
  export interface SceneDocument {
442
552
  version: number;
443
553
  renderer: Renderer;
@@ -513,6 +623,9 @@ export type NativeCommand = {
513
623
  } | {
514
624
  type: "window";
515
625
  action: WindowAction;
626
+ } | {
627
+ type: "windowLevel";
628
+ level: WindowLevel;
516
629
  } | {
517
630
  type: "tray";
518
631
  tray: NativeTrayOptions | null;
@@ -550,6 +663,10 @@ export type NativeCommand = {
550
663
  } | {
551
664
  type: "inspect";
552
665
  requestId: string;
666
+ } | {
667
+ type: "stats";
668
+ requestId: string;
669
+ reset?: boolean;
553
670
  } | {
554
671
  type: "resize";
555
672
  width: number;
@@ -615,6 +732,35 @@ export interface Snapshot {
615
732
  height: number;
616
733
  scale: number;
617
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
+ }
618
764
  export type NativeEvent = {
619
765
  type: "ready" | "closed";
620
766
  } | {
@@ -682,6 +828,7 @@ export type NativeEvent = {
682
828
  offsetY?: number;
683
829
  maxX?: number;
684
830
  maxY?: number;
831
+ source?: ScrollSource;
685
832
  } | {
686
833
  type: "virtualListLayout";
687
834
  id: string;
@@ -777,6 +924,10 @@ export type NativeEvent = {
777
924
  type: "inspect";
778
925
  requestId: string;
779
926
  snapshot: Snapshot;
927
+ } | {
928
+ type: "stats";
929
+ requestId: string;
930
+ stats: NativeStats;
780
931
  } | {
781
932
  type: "captured";
782
933
  requestId: string;
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.5.0",
4
- "protocolVersion": 58,
3
+ "packageVersion": "0.6.0",
4
+ "protocolVersion": 59,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "135482b16423b35aca3a385a5ff00bb9cb4d709d20a95bcf4bac65402fd9b7da",
6
+ "sourceFingerprint": "825110f6accde0e1d2ba89c4fc78d571b652ed43539596aacf82851f8e880e29",
7
7
  "target": "linux-x64",
8
8
  "nativeName": "libtarve_native.so",
9
- "sha256": "d75706d75f285012aff3bee91d194266d7f3da2c0a249d3df22b7b5e64318e66"
9
+ "sha256": "53defd6a0fe13692fc0035b58dc84f4ce6a18b1d64ee94ac68a732faf6f277a0"
10
10
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.5.0",
4
- "protocolVersion": 58,
3
+ "packageVersion": "0.6.0",
4
+ "protocolVersion": 59,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "135482b16423b35aca3a385a5ff00bb9cb4d709d20a95bcf4bac65402fd9b7da",
6
+ "sourceFingerprint": "825110f6accde0e1d2ba89c4fc78d571b652ed43539596aacf82851f8e880e29",
7
7
  "target": "windows-x64",
8
8
  "nativeName": "tarve_native.dll",
9
- "sha256": "ce15fb1c234f28c7bdc6da51dbb94fcee2917a970d18dfdc92fceaefeebc8dcf"
9
+ "sha256": "24d55e8bf097e5df4674fd8840217f0e90694f3dcecab0b3cb08297879f70fd5"
10
10
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarve/core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
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": [
@@ -84,7 +84,8 @@
84
84
  "./package.json": "./package.json"
85
85
  },
86
86
  "engines": {
87
- "bun": ">=1.4.0"
87
+ "bun": ">=1.4.0",
88
+ "node": ">=26.10.0"
88
89
  },
89
90
  "dependencies": {
90
91
  "esbuild": "0.25.0",