@tarve/core 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +101 -1
  2. package/README.md +68 -11
  3. package/dist/npm/build.js +830 -84
  4. package/dist/npm/cli.js +1094 -117
  5. package/dist/npm/embedded-assets.js +35 -4
  6. package/dist/npm/index.js +2515 -207
  7. package/dist/npm/native-runtime.json +3 -3
  8. package/dist/npm/node-build.js +865 -0
  9. package/dist/npm/protocol.js +1 -1
  10. package/dist/npm/runtime.js +5 -5
  11. package/dist/types/core/app-metadata.d.ts +49 -0
  12. package/dist/types/core/build.d.ts +21 -0
  13. package/dist/types/core/cli.d.ts +1 -1
  14. package/dist/types/core/esbuild-file-imports.d.ts +8 -0
  15. package/dist/types/core/node-build.d.ts +7 -0
  16. package/dist/types/core/node-dev.d.ts +4 -0
  17. package/dist/types/core/node-target.d.ts +10 -0
  18. package/dist/types/core/runtime-select.d.ts +8 -0
  19. package/dist/types/core/src/app-metadata.d.ts +16 -0
  20. package/dist/types/core/src/app.d.ts +87 -2
  21. package/dist/types/core/src/assets.d.ts +4 -0
  22. package/dist/types/core/src/bridge/binding.d.ts +10 -34
  23. package/dist/types/core/src/canvas.d.ts +161 -0
  24. package/dist/types/core/src/components/image.d.ts +7 -3
  25. package/dist/types/core/src/components/layout.d.ts +4 -3
  26. package/dist/types/core/src/components/pressable.d.ts +2 -2
  27. package/dist/types/core/src/embedded-assets.d.ts +12 -2
  28. package/dist/types/core/src/extra-controls.d.ts +1 -1
  29. package/dist/types/core/src/html-elements.d.ts +26 -0
  30. package/dist/types/core/src/index.d.ts +5 -2
  31. package/dist/types/core/src/inline-text.d.ts +21 -0
  32. package/dist/types/core/src/jsx-runtime.d.ts +175 -4
  33. package/dist/types/core/src/media-element.d.ts +71 -0
  34. package/dist/types/core/src/memo.d.ts +18 -0
  35. package/dist/types/core/src/png.d.ts +29 -0
  36. package/dist/types/core/src/popups.d.ts +3 -2
  37. package/dist/types/core/src/reconciler.d.ts +27 -3
  38. package/dist/types/core/src/test-renderer.d.ts +2 -0
  39. package/dist/types/core/src/theme.d.ts +2 -1
  40. package/dist/types/core/src/virtual-list.d.ts +5 -1
  41. package/dist/types/core/windows-executable.d.ts +16 -0
  42. package/dist/types/protocol/src/index.d.ts +206 -6
  43. package/native/linux-x64/libtarve_native.so +0 -0
  44. package/native/linux-x64/runtime.json +4 -4
  45. package/native/win32-x64/runtime.json +4 -4
  46. package/native/win32-x64/tarve_native.dll +0 -0
  47. package/package.json +11 -2
@@ -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 = 47;
3
+ export declare const PROTOCOL_VERSION = 58;
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. */
@@ -97,7 +97,23 @@ export interface RadialGradient {
97
97
  repeating?: boolean;
98
98
  stops: readonly (GradientStop | string)[];
99
99
  }
100
- export type Gradient = LinearGradient | RadialGradient;
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;
101
117
  export type UserSelect = "auto" | "text" | "none" | "all";
102
118
  export type TextDecoration = "none" | "underline" | "overline" | "line-through";
103
119
  export interface SyntaxTheme {
@@ -175,7 +191,14 @@ export interface Style extends StateStyle {
175
191
  minHeight?: Length;
176
192
  maxWidth?: Length;
177
193
  maxHeight?: Length;
178
- flex?: number;
194
+ /**
195
+ * CSS `flex`: a number is the shorthand `N 1 0` (`flex: 1`), a string any CSS value
196
+ * (`"1 1 176px"`, `"auto"`, `"none"`). Like CSS, items don't shrink below their content
197
+ * unless `minWidth`/`minHeight` is 0.
198
+ */
199
+ flex?: number | string;
200
+ grow?: number;
201
+ basis?: Length | "auto";
179
202
  shrink?: number;
180
203
  aspectRatio?: number;
181
204
  position?: "relative" | "absolute";
@@ -190,8 +213,17 @@ export interface Style extends StateStyle {
190
213
  margin?: Insets;
191
214
  align?: "start" | "center" | "end" | "stretch";
192
215
  justify?: "start" | "center" | "end" | "between";
193
- display?: "flex" | "grid" | "none";
194
- columns?: number;
216
+ /** `block` stacks children and collapses adjacent vertical margins, as CSS block flow does. */
217
+ display?: "flex" | "grid" | "block" | "none";
218
+ /** Grid tracks: a count of equal columns, or a CSS track list such as `"repeat(auto-fill, minmax(176px, 1fr))"`. */
219
+ columns?: number | string;
220
+ /** CSS `grid-column` / `grid-row` placement: `"span 2"`, `2`, `"1 / 3"`. */
221
+ gridColumn?: number | string;
222
+ gridRow?: number | string;
223
+ /** CSS `cursor` keyword; inherited by descendants. */
224
+ 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";
225
+ /** Grid row tracks as a CSS track list (`"auto 1fr"`); rows are implicit when omitted. */
226
+ rows?: number | string;
195
227
  zIndex?: number;
196
228
  borderWidth?: Insets;
197
229
  radius?: number;
@@ -200,6 +232,29 @@ export interface Style extends StateStyle {
200
232
  fontFamily?: string;
201
233
  /** Native retained transitions. Bun sends the target once; Rust owns interpolation. */
202
234
  transition?: MotionTransitions;
235
+ /** Continuous rotation about the centre, one turn per `spin` milliseconds. Rust drives the frames. */
236
+ spin?: number;
237
+ /** CSS text: `font-style`, `letter-spacing`, `word-spacing`, `text-transform`, `white-space`, `text-overflow` and `line-clamp`. */
238
+ fontStyle?: "normal" | "italic" | "oblique";
239
+ letterSpacing?: number;
240
+ wordSpacing?: number;
241
+ /** CSS `font-variant-numeric` (e.g. `"tabular-nums"`, `"slashed-zero"`) and `font-feature-settings` (`'"ss01" 1, "cv11" 1'`). Inherited. */
242
+ fontVariantNumeric?: string;
243
+ fontFeatureSettings?: string;
244
+ /** CSS `scrollbar-width` on scroll boxes and text areas: `none` hides the bar (still scrollable), `thin` narrows it. */
245
+ scrollbarWidth?: "auto" | "thin" | "none";
246
+ textTransform?: "none" | "uppercase" | "lowercase" | "capitalize";
247
+ whiteSpace?: "normal" | "nowrap" | "pre" | "pre-wrap" | "pre-line";
248
+ textOverflow?: "clip" | "ellipsis";
249
+ lineClamp?: number;
250
+ /** CSS `transform: matrix(a, b, c, d, e, f)` with `transform-origin: 0 0`, inside `transform`. */
251
+ transformMatrix?: [number, number, number, number, number, number];
252
+ /** CSS `clip-path: path([nonzero | evenodd,] "<svg path>")` in the box's coordinates. */
253
+ clipPath?: string;
254
+ /** CSS `text-decoration-style`. */
255
+ textDecorationStyle?: "solid" | "double" | "dotted" | "dashed" | "wavy";
256
+ /** CSS `overflow`: `hidden`/`clip` clip children to the box and let it shrink below its content. */
257
+ overflow?: "visible" | "hidden" | "clip";
203
258
  lineHeight?: number;
204
259
  textAlign?: "start" | "center" | "end";
205
260
  taskMarkerColor?: string;
@@ -239,7 +294,7 @@ export interface Style extends StateStyle {
239
294
  active?: StateStyle;
240
295
  disabled?: StateStyle;
241
296
  strokeWidth?: number;
242
- pointerEvents?: "auto" | "block";
297
+ pointerEvents?: "auto" | "block" | "delegate";
243
298
  userSelect?: UserSelect;
244
299
  }
245
300
  export interface Control {
@@ -270,6 +325,7 @@ export interface VirtualListLayout {
270
325
  scrollRequest?: {
271
326
  generation: number;
272
327
  offset: number;
328
+ smooth?: boolean;
273
329
  };
274
330
  }
275
331
  export interface VirtualListMeasurement {
@@ -294,12 +350,25 @@ export type NativeImageSource = {
294
350
  height: number;
295
351
  premultiplied?: boolean;
296
352
  };
353
+ /** A styled range of a text node, in UTF-8 byte offsets; `id` makes it a click target. */
354
+ export interface TextRun {
355
+ start: number;
356
+ end: number;
357
+ id?: string;
358
+ /** Run overrides; `textDecoration` may combine lines ("underline line-through") as in CSS. */
359
+ style: Partial<Omit<Style, "textDecoration">> & {
360
+ textDecoration?: string;
361
+ /** CSS `vertical-align: super | sub`: baseline shift in px, up. */
362
+ baselineShift?: number;
363
+ };
364
+ }
297
365
  export interface NativeNode {
298
366
  id: string;
299
367
  kind: NodeKind;
300
368
  style: Style;
301
369
  children: NativeNode[];
302
370
  text?: string;
371
+ runs?: TextRun[];
303
372
  source?: string;
304
373
  language?: string;
305
374
  path?: string;
@@ -332,6 +401,13 @@ export interface NativeNode {
332
401
  labelledBy?: string[];
333
402
  closeIntercept?: boolean;
334
403
  dragRegion?: boolean;
404
+ /** Interactive nodes only: a press past 4px becomes a pointer drag. */
405
+ draggable?: boolean;
406
+ dropTarget?: boolean;
407
+ /** Native sends a `size` event with the content-box size on first layout and on every change. */
408
+ reportSize?: boolean;
409
+ /** Native sends `pointerMove` events with the pointer's position inside the node while it is over it. */
410
+ reportPointer?: boolean;
335
411
  windowAction?: "minimize" | "toggleMaximize" | "close";
336
412
  /** Optional initial numeric values used only when the native node is first mounted. */
337
413
  motionFrom?: MotionValues;
@@ -367,6 +443,20 @@ export interface SceneDocument {
367
443
  renderer: Renderer;
368
444
  window: WindowOptions;
369
445
  root: NativeNode;
446
+ /** D3D11 MSAA samples: 0 (default) uses a coverage fringe instead; 2, 4 or 8. */
447
+ msaa?: number;
448
+ /** Idle ms after the last frame before the working set is trimmed (Windows); negative: never. */
449
+ memoryTrimDelay?: number;
450
+ /** App font files as base64 (CSS `@font-face`), usable by their family name. */
451
+ fonts?: string[];
452
+ /** Windows app identity (AppUserModelID): names the app in media controls and notifications. */
453
+ appIdentity?: {
454
+ id: string;
455
+ name: string;
456
+ icon?: string;
457
+ };
458
+ /** Window and taskbar icon: base64 PNG, ICO, JPEG or WebP bytes. */
459
+ windowIcon?: string;
370
460
  }
371
461
  export type TreeMutation = {
372
462
  type: "create";
@@ -393,6 +483,20 @@ export interface FileDialogOptions {
393
483
  filters?: FileDialogFilter[];
394
484
  }
395
485
  export type FileDialogMode = "openFile" | "openFiles" | "openFolder" | "saveFile";
486
+ export type WindowAction = "show" | "hide" | "minimize" | "focus";
487
+ export interface NativeTrayMenuItem {
488
+ id?: string;
489
+ label?: string;
490
+ separator?: boolean;
491
+ checked?: boolean;
492
+ disabled?: boolean;
493
+ items?: NativeTrayMenuItem[];
494
+ }
495
+ export interface NativeTrayOptions {
496
+ iconData?: string;
497
+ tooltip?: string;
498
+ menu: NativeTrayMenuItem[];
499
+ }
396
500
  export type NativeCommand = {
397
501
  type: "patch";
398
502
  nodes: NativeNode[];
@@ -406,9 +510,34 @@ export type NativeCommand = {
406
510
  type: "close";
407
511
  } | {
408
512
  type: "cancelCloseRequest";
513
+ } | {
514
+ type: "window";
515
+ action: WindowAction;
516
+ } | {
517
+ type: "tray";
518
+ tray: NativeTrayOptions | null;
519
+ } | {
520
+ type: "systemMedia";
521
+ session: NativeSystemMediaSession | null;
522
+ } | {
523
+ type: "notify";
524
+ title: string;
525
+ body: string;
526
+ } | {
527
+ type: "media";
528
+ id: string;
529
+ action: "load" | "unload" | "play" | "pause" | "seek" | "set";
530
+ src?: string;
531
+ time?: number;
532
+ volume?: number;
533
+ muted?: boolean;
534
+ loop?: boolean;
409
535
  } | {
410
536
  type: "frameOverlay";
411
537
  enabled: boolean;
538
+ } | {
539
+ type: "frameRate";
540
+ maxFps: number | null;
412
541
  } | {
413
542
  type: "focus";
414
543
  id: string;
@@ -417,6 +546,7 @@ export type NativeCommand = {
417
546
  id: string;
418
547
  index: number;
419
548
  offset?: number;
549
+ smooth?: boolean;
420
550
  } | {
421
551
  type: "inspect";
422
552
  requestId: string;
@@ -473,7 +603,11 @@ export interface Snapshot {
473
603
  layouts: number;
474
604
  shapes: number;
475
605
  paints: number;
606
+ /** Frames presented in the last second. */
607
+ fps: number;
476
608
  activeMotions: number;
609
+ /** Glyphs rasterized so far on renderers with their own glyph atlas (D3D11); null elsewhere. */
610
+ glyphRasterizations?: number | null;
477
611
  hovered: string | null;
478
612
  focused: string | null;
479
613
  nodes: NodeSnapshot[];
@@ -485,6 +619,26 @@ export type NativeEvent = {
485
619
  type: "ready" | "closed";
486
620
  } | {
487
621
  type: "closeRequest";
622
+ } | {
623
+ type: "tray";
624
+ action: "click" | "doubleClick";
625
+ } | {
626
+ type: "systemMedia";
627
+ action: "play" | "pause" | "next" | "previous" | "seek";
628
+ time?: number;
629
+ } | {
630
+ type: "trayMenu";
631
+ id: string;
632
+ } | {
633
+ type: "notificationClick";
634
+ } | {
635
+ type: "media";
636
+ id: string;
637
+ event: "loadedmetadata" | "play" | "pause" | "timeupdate" | "seeked" | "ended" | "error";
638
+ time?: number;
639
+ duration?: number | null;
640
+ paused?: boolean;
641
+ message?: string;
488
642
  } | {
489
643
  type: "escape";
490
644
  } | {
@@ -532,11 +686,25 @@ export type NativeEvent = {
532
686
  type: "virtualListLayout";
533
687
  id: string;
534
688
  items: VirtualListMeasurement[];
689
+ } | {
690
+ type: "size";
691
+ id: string;
692
+ width: number;
693
+ height: number;
694
+ } | {
695
+ type: "pointerMove";
696
+ id: string;
697
+ x: number;
698
+ y: number;
699
+ } | {
700
+ type: "pointerLeave";
701
+ id: string;
535
702
  } | {
536
703
  type: "virtualListScrollToItem";
537
704
  id: string;
538
705
  index: number;
539
706
  offset: number;
707
+ smooth?: boolean;
540
708
  } | {
541
709
  type: "virtualListFocus";
542
710
  id: string;
@@ -572,6 +740,26 @@ export type NativeEvent = {
572
740
  type: "hover";
573
741
  id: string;
574
742
  entered: boolean;
743
+ } | {
744
+ type: "dragStart";
745
+ id: string;
746
+ x: number;
747
+ y: number;
748
+ } | {
749
+ type: "dragMove";
750
+ id: string;
751
+ x: number;
752
+ y: number;
753
+ over: string | null;
754
+ } | {
755
+ type: "drop";
756
+ id: string;
757
+ target: string | null;
758
+ x: number;
759
+ y: number;
760
+ } | {
761
+ type: "dragCancel";
762
+ id: string;
575
763
  } | {
576
764
  type: "key";
577
765
  id: string;
@@ -613,3 +801,15 @@ export type NativeEvent = {
613
801
  type: "frame";
614
802
  frames: number;
615
803
  };
804
+ export interface NativeSystemMediaSession {
805
+ title: string;
806
+ artist?: string;
807
+ album?: string;
808
+ artwork?: string;
809
+ playing: boolean;
810
+ duration?: number;
811
+ position?: number;
812
+ canSeek?: boolean;
813
+ canNext?: boolean;
814
+ canPrevious?: boolean;
815
+ }
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.3.0",
4
- "protocolVersion": 47,
3
+ "packageVersion": "0.5.0",
4
+ "protocolVersion": 58,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "3afbaa02c07fe554ac6ca8a2ac82546b8a25ca8eeadee359369edf87f027e9e0",
6
+ "sourceFingerprint": "135482b16423b35aca3a385a5ff00bb9cb4d709d20a95bcf4bac65402fd9b7da",
7
7
  "target": "linux-x64",
8
8
  "nativeName": "libtarve_native.so",
9
- "sha256": "a8d0836ce5cafcdd545a0a1a96830fd5f9185fb741cf22302dee2ddfdfd37ed8"
9
+ "sha256": "d75706d75f285012aff3bee91d194266d7f3da2c0a249d3df22b7b5e64318e66"
10
10
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.3.0",
4
- "protocolVersion": 47,
3
+ "packageVersion": "0.5.0",
4
+ "protocolVersion": 58,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "3afbaa02c07fe554ac6ca8a2ac82546b8a25ca8eeadee359369edf87f027e9e0",
6
+ "sourceFingerprint": "135482b16423b35aca3a385a5ff00bb9cb4d709d20a95bcf4bac65402fd9b7da",
7
7
  "target": "windows-x64",
8
8
  "nativeName": "tarve_native.dll",
9
- "sha256": "d6ec51f5ae61c5240788c657988eaedbd5ec3ea7cd968febea394ce0e5e5d177"
9
+ "sha256": "ce15fb1c234f28c7bdc6da51dbb94fcee2917a970d18dfdc92fceaefeebc8dcf"
10
10
  }
Binary file
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@tarve/core",
3
- "version": "0.3.0",
4
- "description": "Native Bun/TSX GUI with Taffy layout, Parley text and Vello rendering",
3
+ "version": "0.5.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"
@@ -80,5 +85,9 @@
80
85
  },
81
86
  "engines": {
82
87
  "bun": ">=1.4.0"
88
+ },
89
+ "dependencies": {
90
+ "esbuild": "0.25.0",
91
+ "resedit": "3.1.0"
83
92
  }
84
93
  }