@tarve/core 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +80 -1
  2. package/README.md +67 -10
  3. package/dist/npm/build.js +823 -83
  4. package/dist/npm/cli.js +1087 -116
  5. package/dist/npm/embedded-assets.js +15 -1
  6. package/dist/npm/index.js +2468 -181
  7. package/dist/npm/native-runtime.json +3 -3
  8. package/dist/npm/node-build.js +865 -0
  9. package/dist/npm/protocol.js +1 -1
  10. package/dist/npm/runtime.js +5 -5
  11. package/dist/types/core/app-metadata.d.ts +49 -0
  12. package/dist/types/core/build.d.ts +21 -0
  13. package/dist/types/core/cli.d.ts +1 -1
  14. package/dist/types/core/esbuild-file-imports.d.ts +8 -0
  15. package/dist/types/core/node-build.d.ts +7 -0
  16. package/dist/types/core/node-dev.d.ts +4 -0
  17. package/dist/types/core/node-target.d.ts +10 -0
  18. package/dist/types/core/runtime-select.d.ts +8 -0
  19. package/dist/types/core/src/app-metadata.d.ts +16 -0
  20. package/dist/types/core/src/app.d.ts +87 -2
  21. package/dist/types/core/src/assets.d.ts +4 -0
  22. package/dist/types/core/src/bridge/binding.d.ts +10 -34
  23. package/dist/types/core/src/canvas.d.ts +161 -0
  24. package/dist/types/core/src/components/image.d.ts +7 -3
  25. package/dist/types/core/src/components/layout.d.ts +4 -3
  26. package/dist/types/core/src/components/pressable.d.ts +2 -2
  27. package/dist/types/core/src/extra-controls.d.ts +1 -1
  28. package/dist/types/core/src/html-elements.d.ts +26 -0
  29. package/dist/types/core/src/index.d.ts +4 -1
  30. package/dist/types/core/src/inline-text.d.ts +21 -0
  31. package/dist/types/core/src/jsx-runtime.d.ts +175 -4
  32. package/dist/types/core/src/media-element.d.ts +71 -0
  33. package/dist/types/core/src/memo.d.ts +18 -0
  34. package/dist/types/core/src/png.d.ts +29 -0
  35. package/dist/types/core/src/popups.d.ts +3 -2
  36. package/dist/types/core/src/reconciler.d.ts +27 -3
  37. package/dist/types/core/src/test-renderer.d.ts +2 -0
  38. package/dist/types/core/src/theme.d.ts +2 -1
  39. package/dist/types/core/src/virtual-list.d.ts +5 -1
  40. package/dist/types/core/windows-executable.d.ts +16 -0
  41. package/dist/types/protocol/src/index.d.ts +187 -5
  42. package/native/linux-x64/libtarve_native.so +0 -0
  43. package/native/linux-x64/runtime.json +4 -4
  44. package/native/win32-x64/runtime.json +4 -4
  45. package/native/win32-x64/tarve_native.dll +0 -0
  46. package/package.json +11 -2
@@ -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 = 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. */
@@ -191,7 +191,14 @@ export interface Style extends StateStyle {
191
191
  minHeight?: Length;
192
192
  maxWidth?: Length;
193
193
  maxHeight?: Length;
194
- 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";
195
202
  shrink?: number;
196
203
  aspectRatio?: number;
197
204
  position?: "relative" | "absolute";
@@ -206,8 +213,17 @@ export interface Style extends StateStyle {
206
213
  margin?: Insets;
207
214
  align?: "start" | "center" | "end" | "stretch";
208
215
  justify?: "start" | "center" | "end" | "between";
209
- display?: "flex" | "grid" | "none";
210
- 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;
211
227
  zIndex?: number;
212
228
  borderWidth?: Insets;
213
229
  radius?: number;
@@ -216,6 +232,29 @@ export interface Style extends StateStyle {
216
232
  fontFamily?: string;
217
233
  /** Native retained transitions. Bun sends the target once; Rust owns interpolation. */
218
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";
219
258
  lineHeight?: number;
220
259
  textAlign?: "start" | "center" | "end";
221
260
  taskMarkerColor?: string;
@@ -255,7 +294,7 @@ export interface Style extends StateStyle {
255
294
  active?: StateStyle;
256
295
  disabled?: StateStyle;
257
296
  strokeWidth?: number;
258
- pointerEvents?: "auto" | "block";
297
+ pointerEvents?: "auto" | "block" | "delegate";
259
298
  userSelect?: UserSelect;
260
299
  }
261
300
  export interface Control {
@@ -286,6 +325,7 @@ export interface VirtualListLayout {
286
325
  scrollRequest?: {
287
326
  generation: number;
288
327
  offset: number;
328
+ smooth?: boolean;
289
329
  };
290
330
  }
291
331
  export interface VirtualListMeasurement {
@@ -310,12 +350,25 @@ export type NativeImageSource = {
310
350
  height: number;
311
351
  premultiplied?: boolean;
312
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
+ }
313
365
  export interface NativeNode {
314
366
  id: string;
315
367
  kind: NodeKind;
316
368
  style: Style;
317
369
  children: NativeNode[];
318
370
  text?: string;
371
+ runs?: TextRun[];
319
372
  source?: string;
320
373
  language?: string;
321
374
  path?: string;
@@ -348,6 +401,13 @@ export interface NativeNode {
348
401
  labelledBy?: string[];
349
402
  closeIntercept?: boolean;
350
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;
351
411
  windowAction?: "minimize" | "toggleMaximize" | "close";
352
412
  /** Optional initial numeric values used only when the native node is first mounted. */
353
413
  motionFrom?: MotionValues;
@@ -383,6 +443,20 @@ export interface SceneDocument {
383
443
  renderer: Renderer;
384
444
  window: WindowOptions;
385
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;
386
460
  }
387
461
  export type TreeMutation = {
388
462
  type: "create";
@@ -409,6 +483,20 @@ export interface FileDialogOptions {
409
483
  filters?: FileDialogFilter[];
410
484
  }
411
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
+ }
412
500
  export type NativeCommand = {
413
501
  type: "patch";
414
502
  nodes: NativeNode[];
@@ -422,9 +510,34 @@ export type NativeCommand = {
422
510
  type: "close";
423
511
  } | {
424
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;
425
535
  } | {
426
536
  type: "frameOverlay";
427
537
  enabled: boolean;
538
+ } | {
539
+ type: "frameRate";
540
+ maxFps: number | null;
428
541
  } | {
429
542
  type: "focus";
430
543
  id: string;
@@ -433,6 +546,7 @@ export type NativeCommand = {
433
546
  id: string;
434
547
  index: number;
435
548
  offset?: number;
549
+ smooth?: boolean;
436
550
  } | {
437
551
  type: "inspect";
438
552
  requestId: string;
@@ -489,6 +603,8 @@ export interface Snapshot {
489
603
  layouts: number;
490
604
  shapes: number;
491
605
  paints: number;
606
+ /** Frames presented in the last second. */
607
+ fps: number;
492
608
  activeMotions: number;
493
609
  /** Glyphs rasterized so far on renderers with their own glyph atlas (D3D11); null elsewhere. */
494
610
  glyphRasterizations?: number | null;
@@ -503,6 +619,26 @@ export type NativeEvent = {
503
619
  type: "ready" | "closed";
504
620
  } | {
505
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;
506
642
  } | {
507
643
  type: "escape";
508
644
  } | {
@@ -550,11 +686,25 @@ export type NativeEvent = {
550
686
  type: "virtualListLayout";
551
687
  id: string;
552
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;
553
702
  } | {
554
703
  type: "virtualListScrollToItem";
555
704
  id: string;
556
705
  index: number;
557
706
  offset: number;
707
+ smooth?: boolean;
558
708
  } | {
559
709
  type: "virtualListFocus";
560
710
  id: string;
@@ -590,6 +740,26 @@ export type NativeEvent = {
590
740
  type: "hover";
591
741
  id: string;
592
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;
593
763
  } | {
594
764
  type: "key";
595
765
  id: string;
@@ -631,3 +801,15 @@ export type NativeEvent = {
631
801
  type: "frame";
632
802
  frames: number;
633
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.4.0",
4
- "protocolVersion": 48,
3
+ "packageVersion": "0.5.0",
4
+ "protocolVersion": 58,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050",
6
+ "sourceFingerprint": "135482b16423b35aca3a385a5ff00bb9cb4d709d20a95bcf4bac65402fd9b7da",
7
7
  "target": "linux-x64",
8
8
  "nativeName": "libtarve_native.so",
9
- "sha256": "26ed8f31b8d1665fbc0619ec6c7efe2b962a0c1ab4002855c455cec28ca854a5"
9
+ "sha256": "d75706d75f285012aff3bee91d194266d7f3da2c0a249d3df22b7b5e64318e66"
10
10
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "packageVersion": "0.4.0",
4
- "protocolVersion": 48,
3
+ "packageVersion": "0.5.0",
4
+ "protocolVersion": 58,
5
5
  "nativeAbiVersion": 5,
6
- "sourceFingerprint": "88a3db06f209de36404cb56cd43fd0ad0f53644c481fc3afd175940eaa701050",
6
+ "sourceFingerprint": "135482b16423b35aca3a385a5ff00bb9cb4d709d20a95bcf4bac65402fd9b7da",
7
7
  "target": "windows-x64",
8
8
  "nativeName": "tarve_native.dll",
9
- "sha256": "9a88b98c21f62e8acc20221450f23d7992d38cd523f0bf12570c446324487316"
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.4.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
  }