@tarve/core 0.1.1 → 0.2.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 +45 -0
- package/README.md +69 -65
- package/dist/npm/build.js +1 -1
- package/dist/npm/cli.js +1 -1
- package/dist/npm/index.js +224 -13
- package/dist/npm/native-runtime.json +3 -3
- package/dist/npm/protocol.js +1 -1
- package/dist/types/core/src/css-shadow.d.ts +15 -0
- package/dist/types/core/src/index.d.ts +1 -1
- package/dist/types/core/src/theme.d.ts +2 -0
- package/dist/types/protocol/src/index.d.ts +39 -3
- package/native/linux-x64/libtarve_native.so +0 -0
- package/native/linux-x64/runtime.json +4 -4
- package/native/win32-x64/runtime.json +4 -4
- package/native/win32-x64/tarve_native.dll +0 -0
- package/package.json +2 -49
- package/PERFORMANCE.md +0 -82
- package/RELEASE.md +0 -72
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
## 0.2.0 — 2026-09-29
|
|
6
|
+
|
|
7
|
+
### Breaking
|
|
8
|
+
- `hover` styles now also apply to ancestors of the hovered node and to non-interactive nodes, like CSS `:hover`. Containers with a `hover` style that never activated before will now react.
|
|
9
|
+
- Unsupported colour strings in colour properties throw when the view is compiled instead of painting black.
|
|
10
|
+
- State styles with a matching `transition` now animate instead of switching instantly, and emit `motionComplete`.
|
|
11
|
+
- JSON protocol version 46: `@tarve/core` 0.2.0 requires its bundled native runtime (as always, runtimes are not mixed across versions).
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- `transform`: translate/scale about the box centre (object or CSS `translate*()`/`scale*()` syntax), applied to the whole subtree on every renderer, followed by hit testing and hover, and animatable with `transition` (e.g. a hover lift).
|
|
15
|
+
- CSS colours in every colour property: `rgb()`/`rgba()`, `hsl()`/`hsla()`, short hex and common names. Unsupported colour strings now throw instead of silently rendering black.
|
|
16
|
+
- CSS syntax for shadows: `boxShadow: "0 8px 24px -4px rgba(0,0,0,.2), inset 0 1px 0 #fff"` and `textShadow: "1px 2px #0006"`, including `rgb()`/`hsl()` colours and theme tokens. Shadow objects also accept those colour formats.
|
|
17
|
+
- `hover` styles apply to every node under the pointer and its ancestors (CSS `:hover`), not only interactive nodes.
|
|
18
|
+
- Native transitions for `background`, `foreground`, `borderColor`, `boxShadow` and `textShadow`, and state-driven transitions: hover/active/focus/disabled changes animate `opacity`, `radius`, colours and shadows from the value on screen. No frames are scheduled once a transition ends.
|
|
19
|
+
- `boxShadow`: `{ x, y, blur, spread, color, inset }` or a list of up to 8, in base and state styles. Analytic gaussian blur on D3D11, Vello GPU and the CPU renderer; outer shadows are clipped out of their own box; `inset` paints inside the padding box.
|
|
20
|
+
- `borderStyle` (`dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`, `none`) on any node with a uniform border width.
|
|
21
|
+
- `textShadow: { x, y, color }` on text, button labels, `Input` and `TextArea`, including state styles such as `hover` (solid offset; no blur). Protocol version is now 46.
|
|
22
|
+
- Linux accessibility: the AccessKit bridge now runs on Linux through AT-SPI, so screen readers such as Orca can read and drive Tarve apps.
|
|
23
|
+
- Word-wise editing in `Input`/`TextArea`: `Ctrl+←/→` (Option on macOS) moves by word, with `Shift` to select; `Ctrl+Backspace`/`Ctrl+Delete` delete a word.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Faster native runtime: `mimalloc` allocator and `FxHash` maps cut native tree update time by ~40% on a 6,000-node tree.
|
|
27
|
+
- Syntax highlight cache uses an O(1) LRU.
|
|
28
|
+
- Text highlight search no longer depends on the `regex` crate.
|
|
29
|
+
|
|
30
|
+
## 0.1.2 — 2026-09-28
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- `@tarve/react-icons` is published alongside `@tarve/core`.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- The published `package.json` contains only consumer-facing fields.
|
|
37
|
+
|
|
38
|
+
## 0.1.1 — 2026-09-28
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
- Package renamed from `tarve` to `@tarve/core`. The CLI command is still `tarve`.
|
|
42
|
+
|
|
43
|
+
## 0.1.0 — 2026-09-28
|
|
44
|
+
|
|
45
|
+
Initial release: native Windows x64 and Linux x64 runtime with JSX components, Taffy layout, Parley text, Vello and D3D11 rendering, rich markdown/code/diff, native text editing with undo/redo, motion transitions, Windows accessibility, file dialogs, global hotkeys and standalone executable builds.
|
package/README.md
CHANGED
|
@@ -8,39 +8,33 @@ Tarve turns a TSX tree into a retained native interface. It does not use a brows
|
|
|
8
8
|
>
|
|
9
9
|
> **Runtime:** Bun 1.4+
|
|
10
10
|
>
|
|
11
|
-
> **Package:** `tarve`
|
|
11
|
+
> **Package:** [`@tarve/core`](https://www.npmjs.com/package/@tarve/core) (CLI: `tarve`)
|
|
12
12
|
>
|
|
13
13
|
> **License:** Apache-2.0
|
|
14
14
|
|
|
15
15
|
## Highlights
|
|
16
16
|
|
|
17
|
-
- Native TSX UI with a dedicated
|
|
17
|
+
- Native TSX UI with a dedicated `@tarve/core` JSX runtime.
|
|
18
18
|
- Retained Taffy Flexbox/Grid layout with incremental property and structural updates.
|
|
19
|
-
- Parley text shaping, selection, clipboard,
|
|
19
|
+
- Parley text shaping, selection, clipboard (text, files, images), IME composition, native undo/redo, and Unicode-aware editing.
|
|
20
20
|
- Native Windows D3D11/DXGI renderer with Vello/WGPU fallback; Linux uses Vello/WGPU. Both platforms provide a `vello_cpu + softbuffer` CPU renderer.
|
|
21
21
|
- shadcn-inspired components and semantic light/dark theme tokens.
|
|
22
22
|
- Native Markdown, syntax-highlighted Code, and Diff leaves designed for large documents.
|
|
23
23
|
- Fixed-height, measured variable-height, and externally windowed `VirtualList` modes.
|
|
24
|
-
-
|
|
24
|
+
- Accessibility through AccessKit: UI Automation on Windows and AT-SPI on Linux.
|
|
25
25
|
- Global hotkeys, native file dialogs, custom title bars, window positioning, and standalone Windows/Linux builds.
|
|
26
|
-
- Event-driven Bun/native bridge with no continuous idle polling.
|
|
26
|
+
- Event-driven Bun/native bridge with no continuous idle polling: an idle window presents zero frames.
|
|
27
|
+
- Development mode with in-window runtime error overlay, same-window remount under `bun --hot`, and a native frame-time graph.
|
|
27
28
|
|
|
28
29
|
## Installation
|
|
29
30
|
|
|
30
31
|
For a published package:
|
|
31
32
|
|
|
32
33
|
```powershell
|
|
33
|
-
bun add tarve
|
|
34
|
+
bun add @tarve/core
|
|
34
35
|
bun add -d typescript @types/bun
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
To consume the package directly from this repository before registry publication:
|
|
38
|
-
|
|
39
|
-
```powershell
|
|
40
|
-
bun run pack
|
|
41
|
-
bun add ./dist/tarve-0.1.0.tgz
|
|
42
|
-
```
|
|
43
|
-
|
|
44
38
|
Use this TypeScript configuration:
|
|
45
39
|
|
|
46
40
|
```json
|
|
@@ -106,22 +100,7 @@ bun run tarve build app.tsx --target windows-x64 --outfile dist/App.exe
|
|
|
106
100
|
bun run tarve build app.tsx --target linux-x64 --outfile dist/App
|
|
107
101
|
```
|
|
108
102
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Each staged native runtime carries compatibility metadata containing its target, native ABI, JSON protocol version, source fingerprint, and binary hash. Cross-compilation validates that metadata before embedding the runtime, so a stale Linux `.so` cannot be combined with newer JavaScript (or vice versa). After native/protocol changes, rebuild the affected runtime on that OS with `bun run package:native` before cross-compiling from the other OS.
|
|
112
|
-
|
|
113
|
-
To build the Linux runtime on Ubuntu or WSL, install the native toolchain once:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
apt-get update
|
|
117
|
-
apt-get install -y build-essential pkg-config libx11-dev libxkbcommon-dev libxkbcommon-x11-0 libwayland-dev libegl1-mesa-dev libfontconfig1-dev curl ca-certificates
|
|
118
|
-
curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
|
|
119
|
-
source "$HOME/.cargo/env"
|
|
120
|
-
cargo --version
|
|
121
|
-
bun run package:native
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Rustup installs Cargo per user. If you switch between a normal WSL user and `root`, install/activate Rust for the user that actually runs `bun run package:native`, or run the build from the same user where Rustup was installed.
|
|
103
|
+
The published package already contains both runtimes, so `tarve build` needs no Rust toolchain.
|
|
125
104
|
|
|
126
105
|
The build API is also exported:
|
|
127
106
|
|
|
@@ -156,7 +135,7 @@ An explicit renderer in `createApp` takes precedence over `TARVE_RENDERER`. `WGP
|
|
|
156
135
|
|
|
157
136
|
## Components
|
|
158
137
|
|
|
159
|
-
Tarve exports native primitives and higher-level controls from the main
|
|
138
|
+
Tarve exports native primitives and higher-level controls from the main `@tarve/core` entry point.
|
|
160
139
|
|
|
161
140
|
| Area | Components |
|
|
162
141
|
| --- | --- |
|
|
@@ -197,6 +176,27 @@ function App() {
|
|
|
197
176
|
}
|
|
198
177
|
```
|
|
199
178
|
|
|
179
|
+
Every colour property (`background`, `foreground`, `borderColor`, `outlineColor`, rich-content and diff colours, state styles and the window background) accepts hex (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`), `rgb()`/`rgba()`, `hsl()`/`hsla()`, common names such as `transparent` or `white`, and theme tokens. Unsupported colour strings throw when the view is compiled instead of rendering black.
|
|
180
|
+
|
|
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
|
+
|
|
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.
|
|
184
|
+
|
|
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
|
+
|
|
187
|
+
`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
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<Column style={{
|
|
191
|
+
background: "#ffffff",
|
|
192
|
+
boxShadow: { y: 2, blur: 6, color: "#0f172a22" },
|
|
193
|
+
hover: { background: "#eff6ff", boxShadow: { y: 14, blur: 28, color: "#2563eb44" } },
|
|
194
|
+
transition: { all: { duration: 220, easing: "easeOut" } },
|
|
195
|
+
}} />
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Both shadows also accept CSS syntax: `boxShadow: "inset 0 1px 2px rgba(0,0,0,.2), 0 8px 24px -4px #0003"` and `textShadow: "1px 2px #0006"` (or `"none"`). Lengths are `px` or unitless `0`; colours may be hex, `rgb()`/`rgba()`, `hsl()`/`hsla()`, a few names or theme tokens. Invalid strings throw when the view is compiled. Shadow lists of different lengths interpolate against transparent layers. `motionFrom` and AnimatePresence `enter`/`exit` accept numeric properties only.
|
|
199
|
+
|
|
200
200
|
Create derived themes with `createTheme` or `Theme.create`. Theme tokens cover surfaces, foregrounds, borders, focus outlines, selection, caret, scrollbars, modal overlays, rich-content colors, and control states.
|
|
201
201
|
|
|
202
202
|
## Native motion
|
|
@@ -368,7 +368,7 @@ Native text search and copy operate on the mounted logical window. A retained ed
|
|
|
368
368
|
|
|
369
369
|
Editors keep a native per-field undo/redo history (`Ctrl+Z`, `Ctrl+Y` / `Ctrl+Shift+Z`) that coalesces continuous typing or deletion into word-sized steps and resets when a controlled value changes externally. `onSubmit(value)` fires on Enter for `Input`; `TextArea` submits on `Ctrl/Cmd+Enter`, or on Enter with `submitOnEnter` (Shift+Enter then inserts a newline). The caret blinks after activity and settles solid after 10 s idle, so a focused editor schedules no idle frames. When the clipboard holds no text, `Ctrl+V` delivers files or a bitmap to the focused element's `onPaste` as `{ kind: "files", files }` or `{ kind: "image", width, height, rgba }`.
|
|
370
370
|
|
|
371
|
-
On Windows, Tarve projects the native tree through AccessKit/UI Automation with roles, names, values, states, actions, focus, text ranges, selection, scroll ranges, live regions, and field relationships. Linux
|
|
371
|
+
On Windows, Tarve projects the native tree through AccessKit/UI Automation with roles, names, values, states, actions, focus, text ranges, selection, scroll ranges, live regions, and field relationships. On Linux, the same AccessKit tree is exposed over AT-SPI (D-Bus) for screen readers such as Orca; it activates only when an assistive technology connects.
|
|
372
372
|
|
|
373
373
|
## Desktop APIs
|
|
374
374
|
|
|
@@ -481,14 +481,41 @@ const app = createApp(App, {
|
|
|
481
481
|
|
|
482
482
|
Recoverable callback, listener, hotkey, bridge, request, dialog, and update failures are reported through `onError`. A failed native update keeps the last confirmed tree.
|
|
483
483
|
|
|
484
|
+
## Development tools
|
|
485
|
+
|
|
486
|
+
Run an app in development mode with hot reload:
|
|
487
|
+
|
|
488
|
+
```powershell
|
|
489
|
+
$env:TARVE_DEV = "1"; bun --hot app.tsx
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
```bash
|
|
493
|
+
TARVE_DEV=1 bun --hot app.tsx
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
With `dev: true` (or `TARVE_DEV=1`):
|
|
497
|
+
|
|
498
|
+
- **Same-window remount:** when `bun --hot` re-evaluates the entry, `render()` remounts the new view into the already open window instead of opening a new one. `app.remount(view)` does the same explicitly and resets component state.
|
|
499
|
+
- **Runtime error overlay:** render, event-handler, listener, and hotkey errors replace the view with an in-window overlay (source, message, scrollable stack). *Dismiss* renders the app again; saving a fix remounts it. Errors during the first render still reject `ready`.
|
|
500
|
+
|
|
501
|
+
Independently of dev mode, the native frame-time overlay draws the CPU cost of the last 120 presented frames against a 16.7 ms budget line:
|
|
502
|
+
|
|
503
|
+
```tsx
|
|
504
|
+
const app = createApp(App, { frameOverlay: true }); // or TARVE_FRAME_OVERLAY=1
|
|
505
|
+
app.setFrameOverlay(false);
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Neither tool schedules frames on its own, so an idle window still presents zero frames. The graph refreshes on the next repaint.
|
|
509
|
+
|
|
484
510
|
## Examples
|
|
485
511
|
|
|
486
|
-
The `examples/` directory is an independent Bun consumer project using only public Tarve APIs.
|
|
512
|
+
The [`examples/`](https://github.com/omarcosr/tarve/tree/main/examples) directory in the repository is an independent Bun consumer project using only public Tarve APIs. From a clone:
|
|
487
513
|
|
|
488
514
|
```powershell
|
|
489
515
|
bun run setup:examples
|
|
490
516
|
cd examples
|
|
491
517
|
bun run check
|
|
518
|
+
bun run basic
|
|
492
519
|
bun run counter
|
|
493
520
|
bun run components
|
|
494
521
|
bun run forms
|
|
@@ -496,54 +523,31 @@ bun run intrinsics
|
|
|
496
523
|
bun run large-list
|
|
497
524
|
bun run rich-content
|
|
498
525
|
bun run diff
|
|
526
|
+
bun run motion
|
|
527
|
+
bun run studio
|
|
528
|
+
bun run performance
|
|
499
529
|
```
|
|
500
530
|
|
|
531
|
+
From the repository root, `bun run dev --entry examples/<name>.tsx` runs an example with hot reload and the development tools enabled.
|
|
532
|
+
|
|
501
533
|
`setup:examples` builds host-local package staging itself; it does not require the universal publishable tarball.
|
|
502
534
|
|
|
503
535
|
All example UI copy and example documentation is written in English.
|
|
504
536
|
|
|
505
|
-
##
|
|
506
|
-
|
|
507
|
-
Building the native library requires Bun 1.4+ and Rust stable.
|
|
508
|
-
|
|
509
|
-
On Windows x64, install Visual Studio Build Tools with C++ tooling and the Windows SDK and use the `x86_64-pc-windows-msvc` Rust target.
|
|
510
|
-
|
|
511
|
-
On Debian/Ubuntu Linux x64, install the native build dependencies first:
|
|
512
|
-
|
|
513
|
-
```bash
|
|
514
|
-
sudo apt install build-essential pkg-config libx11-dev libxkbcommon-dev \
|
|
515
|
-
libxkbcommon-x11-0 libwayland-dev libegl1-mesa-dev libfontconfig1-dev
|
|
516
|
-
```
|
|
537
|
+
## Platform notes
|
|
517
538
|
|
|
518
539
|
Linux file dialogs use the XDG desktop portal through `rfd`. Opening external links uses `xdg-open` when available and falls back to `gio open`.
|
|
519
540
|
|
|
520
541
|
On WSLg, Tarve prefers winit's X11 backend when `DISPLAY` is available; native Linux keeps winit's normal Wayland/X11 auto-selection. This avoids WSLg-specific Wayland `Broken pipe` event-loop failures without changing backend selection on ordinary Linux desktops.
|
|
521
542
|
|
|
522
|
-
|
|
523
|
-
bun install
|
|
524
|
-
bun run build:native
|
|
525
|
-
bun run check
|
|
526
|
-
bun run test
|
|
527
|
-
```
|
|
528
|
-
|
|
529
|
-
`bun run package:local` stages JS, declarations, and the native runtime for the current host for local development. `bun run package` is the publishable universal package gate and requires both Windows x64 and Linux x64 runtimes. The release pipeline documented in `RELEASE.md` assembles both runtimes into the same npm artifact. Tarve does not sign binaries; sign the executables you build with `tarve build` using your own certificate.
|
|
530
|
-
|
|
531
|
-
Run the full package, executable, accessibility, and visual release gate with:
|
|
532
|
-
|
|
533
|
-
```powershell
|
|
534
|
-
bun run verify
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
Additional project documentation:
|
|
543
|
+
## Contributing
|
|
538
544
|
|
|
539
|
-
- [
|
|
540
|
-
- [Performance measurements](PERFORMANCE.md)
|
|
541
|
-
- [Release process](RELEASE.md)
|
|
545
|
+
Building Tarve from source, the test and smoke-test gates, and the release process are documented in [CONTRIBUTING.md](https://github.com/omarcosr/tarve/blob/main/CONTRIBUTING.md). Project notes: [production readiness](https://github.com/omarcosr/tarve/blob/main/PRODUCTION.md), [performance measurements](https://github.com/omarcosr/tarve/blob/main/PERFORMANCE.md), [release process](https://github.com/omarcosr/tarve/blob/main/RELEASE.md).
|
|
542
546
|
|
|
543
547
|
## Current scope
|
|
544
548
|
|
|
545
|
-
Tarve is pre-1.0 and currently targets **Windows x64 and Linux x64**. The current application bootstrap model uses one native app/window lifetime per process; multi-window support is not yet part of the public runtime model.
|
|
549
|
+
Tarve is pre-1.0 and currently targets **Windows x64 and Linux x64**. The current application bootstrap model uses one native app/window lifetime per process; multi-window support is not yet part of the public runtime model.
|
|
546
550
|
|
|
547
551
|
## License
|
|
548
552
|
|
|
549
|
-
Tarve is licensed under the [Apache License 2.0](LICENSE).
|
|
553
|
+
Tarve is licensed under the [Apache License 2.0](https://github.com/omarcosr/tarve/blob/main/LICENSE).
|
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 =
|
|
57
|
+
var PROTOCOL_VERSION = 46;
|
|
58
58
|
|
|
59
59
|
// packages/core/native-runtime.ts
|
|
60
60
|
var NATIVE_RUNTIME_MANIFEST_NAME = "runtime.json";
|
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 =
|
|
55
|
+
var PROTOCOL_VERSION = 46;
|
|
56
56
|
|
|
57
57
|
// packages/core/native-runtime.ts
|
|
58
58
|
var NATIVE_RUNTIME_MANIFEST_NAME = "runtime.json";
|
package/dist/npm/index.js
CHANGED
|
@@ -34,6 +34,201 @@ function Column(props) {
|
|
|
34
34
|
function Portal(props) {
|
|
35
35
|
return container("view", { ...props, portal: true });
|
|
36
36
|
}
|
|
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
|
+
};
|
|
54
|
+
function hex2(value) {
|
|
55
|
+
return Math.round(Math.min(255, Math.max(0, value))).toString(16).padStart(2, "0");
|
|
56
|
+
}
|
|
57
|
+
function channel(token, scale) {
|
|
58
|
+
const value = token.endsWith("%") ? Number(token.slice(0, -1)) / 100 * scale : Number(token);
|
|
59
|
+
if (!Number.isFinite(value))
|
|
60
|
+
throw new TypeError(`Invalid colour channel: ${token}`);
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
function alpha(token) {
|
|
64
|
+
if (token === undefined)
|
|
65
|
+
return 1;
|
|
66
|
+
return Math.min(1, Math.max(0, channel(token, 1)));
|
|
67
|
+
}
|
|
68
|
+
function hslToRgb(h, s, l) {
|
|
69
|
+
const k = (n) => (n + h / 30) % 12;
|
|
70
|
+
const a = s * Math.min(l, 1 - l);
|
|
71
|
+
const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
72
|
+
return [f(0) * 255, f(8) * 255, f(4) * 255];
|
|
73
|
+
}
|
|
74
|
+
function cssColor(value) {
|
|
75
|
+
const input = value.trim().toLowerCase();
|
|
76
|
+
if (input.startsWith("var("))
|
|
77
|
+
return value.trim();
|
|
78
|
+
if (Object.hasOwn(NAMED, input))
|
|
79
|
+
return NAMED[input];
|
|
80
|
+
if (/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(input)) {
|
|
81
|
+
const digits = input.slice(1);
|
|
82
|
+
return digits.length <= 4 ? `#${[...digits].map((d) => d + d).join("")}` : input;
|
|
83
|
+
}
|
|
84
|
+
const fn = input.match(/^(rgba?|hsla?)\((.*)\)$/);
|
|
85
|
+
if (!fn)
|
|
86
|
+
throw new TypeError(`Unsupported colour: ${value}`);
|
|
87
|
+
const [body, slash] = fn[2].split("/").map((part) => part.trim());
|
|
88
|
+
const parts = body.split(/[\s,]+/).filter(Boolean);
|
|
89
|
+
const a = alpha(slash ?? parts[3]);
|
|
90
|
+
if (parts.length < 3)
|
|
91
|
+
throw new TypeError(`Unsupported colour: ${value}`);
|
|
92
|
+
const [r, g, b] = fn[1].startsWith("rgb") ? [channel(parts[0], 255), channel(parts[1], 255), channel(parts[2], 255)] : hslToRgb(Number.parseFloat(parts[0]), channel(parts[1], 1), channel(parts[2], 1));
|
|
93
|
+
return `#${hex2(r)}${hex2(g)}${hex2(b)}${hex2(a * 255)}`;
|
|
94
|
+
}
|
|
95
|
+
function splitTopLevel(value, separator) {
|
|
96
|
+
const parts = [];
|
|
97
|
+
let depth = 0;
|
|
98
|
+
let current = "";
|
|
99
|
+
for (const character of value) {
|
|
100
|
+
if (character === "(")
|
|
101
|
+
depth++;
|
|
102
|
+
if (character === ")")
|
|
103
|
+
depth--;
|
|
104
|
+
if (depth === 0 && separator.test(character)) {
|
|
105
|
+
if (current.trim())
|
|
106
|
+
parts.push(current.trim());
|
|
107
|
+
current = "";
|
|
108
|
+
} else {
|
|
109
|
+
current += character;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (current.trim())
|
|
113
|
+
parts.push(current.trim());
|
|
114
|
+
return parts;
|
|
115
|
+
}
|
|
116
|
+
function length(token) {
|
|
117
|
+
const match = token.match(/^(-?(?:\d+\.?\d*|\.\d+))(px)?$/);
|
|
118
|
+
if (!match)
|
|
119
|
+
return;
|
|
120
|
+
const number = Number(match[1]);
|
|
121
|
+
if (match[2] === undefined && number !== 0)
|
|
122
|
+
return;
|
|
123
|
+
return number;
|
|
124
|
+
}
|
|
125
|
+
function parseLayer(layer, allowInset) {
|
|
126
|
+
let inset = false;
|
|
127
|
+
let color;
|
|
128
|
+
const lengths = [];
|
|
129
|
+
for (const token of splitTopLevel(layer, /\s/)) {
|
|
130
|
+
if (token.toLowerCase() === "inset" && allowInset && !inset) {
|
|
131
|
+
inset = true;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const value = length(token);
|
|
135
|
+
if (value !== undefined) {
|
|
136
|
+
lengths.push(value);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (color !== undefined)
|
|
140
|
+
throw new TypeError(`Unexpected token in shadow: ${token}`);
|
|
141
|
+
color = cssColor(token);
|
|
142
|
+
}
|
|
143
|
+
if (lengths.length < 2)
|
|
144
|
+
throw new TypeError(`A shadow needs x and y offsets: ${layer}`);
|
|
145
|
+
return { lengths, color: color ?? "#000000", inset };
|
|
146
|
+
}
|
|
147
|
+
function parseBoxShadow(value) {
|
|
148
|
+
if (value.trim().toLowerCase() === "none")
|
|
149
|
+
return [];
|
|
150
|
+
return splitTopLevel(value, /,/).map((layer) => {
|
|
151
|
+
const { lengths, color, inset } = parseLayer(layer, true);
|
|
152
|
+
if (lengths.length > 4)
|
|
153
|
+
throw new TypeError(`Too many lengths in box-shadow: ${layer}`);
|
|
154
|
+
const [x, y, blur = 0, spread = 0] = lengths;
|
|
155
|
+
if (blur < 0)
|
|
156
|
+
throw new RangeError(`box-shadow blur must not be negative: ${layer}`);
|
|
157
|
+
return { x, y, blur, spread, color, ...inset ? { inset: true } : {} };
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function parseTextShadow(value) {
|
|
161
|
+
if (value.trim().toLowerCase() === "none")
|
|
162
|
+
return;
|
|
163
|
+
const layers = splitTopLevel(value, /,/);
|
|
164
|
+
if (layers.length !== 1)
|
|
165
|
+
throw new TypeError("textShadow supports a single shadow");
|
|
166
|
+
const { lengths, color } = parseLayer(layers[0], false);
|
|
167
|
+
if (lengths.length > 3)
|
|
168
|
+
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 };
|
|
172
|
+
}
|
|
173
|
+
function parseTransform(value) {
|
|
174
|
+
let [x, y, scaleX, scaleY] = [0, 0, 1, 1];
|
|
175
|
+
const input = value.trim();
|
|
176
|
+
if (input.toLowerCase() === "none")
|
|
177
|
+
return {};
|
|
178
|
+
const pattern = /([a-zA-Z]+)\(([^)]*)\)/g;
|
|
179
|
+
let consumed = "";
|
|
180
|
+
for (const match of input.matchAll(pattern)) {
|
|
181
|
+
consumed += match[0];
|
|
182
|
+
const name = match[1];
|
|
183
|
+
const args = match[2].split(/[\s,]+/).filter(Boolean);
|
|
184
|
+
const px = (token) => {
|
|
185
|
+
const number = token === undefined ? 0 : length(token);
|
|
186
|
+
if (number === undefined)
|
|
187
|
+
throw new TypeError(`Unsupported transform length: ${token}`);
|
|
188
|
+
return number;
|
|
189
|
+
};
|
|
190
|
+
const factor = (token) => {
|
|
191
|
+
const number = Number(token);
|
|
192
|
+
if (token === undefined || !Number.isFinite(number) || number === 0)
|
|
193
|
+
throw new TypeError(`Invalid scale: ${token}`);
|
|
194
|
+
return number;
|
|
195
|
+
};
|
|
196
|
+
switch (name) {
|
|
197
|
+
case "translate":
|
|
198
|
+
x += scaleX * px(args[0]);
|
|
199
|
+
y += scaleY * px(args[1]);
|
|
200
|
+
break;
|
|
201
|
+
case "translateX":
|
|
202
|
+
x += scaleX * px(args[0]);
|
|
203
|
+
break;
|
|
204
|
+
case "translateY":
|
|
205
|
+
y += scaleY * px(args[0]);
|
|
206
|
+
break;
|
|
207
|
+
case "scale": {
|
|
208
|
+
const sx = factor(args[0]);
|
|
209
|
+
scaleX *= sx;
|
|
210
|
+
scaleY *= args[1] === undefined ? sx : factor(args[1]);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
case "scaleX":
|
|
214
|
+
scaleX *= factor(args[0]);
|
|
215
|
+
break;
|
|
216
|
+
case "scaleY":
|
|
217
|
+
scaleY *= factor(args[0]);
|
|
218
|
+
break;
|
|
219
|
+
default:
|
|
220
|
+
throw new TypeError(`Unsupported transform function: ${name}() (translate and scale only)`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (consumed.replace(/\s/g, "") !== input.replace(/\s/g, ""))
|
|
224
|
+
throw new TypeError(`Invalid transform: ${value}`);
|
|
225
|
+
return {
|
|
226
|
+
...x !== 0 ? { x } : {},
|
|
227
|
+
...y !== 0 ? { y } : {},
|
|
228
|
+
...scaleX === scaleY ? scaleX !== 1 ? { scale: scaleX } : {} : { scaleX, scaleY }
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
37
232
|
// packages/core/src/theme.ts
|
|
38
233
|
var defaultFocusOutline = {
|
|
39
234
|
outlineWidth: 2,
|
|
@@ -212,13 +407,37 @@ function resolveThemeColor(value, selected) {
|
|
|
212
407
|
const key = keyByRef.get(value);
|
|
213
408
|
return key ? selected.colors[key] : value;
|
|
214
409
|
}
|
|
410
|
+
function resolveShadowColors(style, selected) {
|
|
411
|
+
if (typeof style.transform === "string")
|
|
412
|
+
style.transform = parseTransform(style.transform);
|
|
413
|
+
const colour = (value) => resolveThemeColor(cssColor(value), selected);
|
|
414
|
+
if (typeof style.textShadow === "string") {
|
|
415
|
+
const parsed = parseTextShadow(style.textShadow);
|
|
416
|
+
if (parsed)
|
|
417
|
+
style.textShadow = parsed;
|
|
418
|
+
else
|
|
419
|
+
delete style.textShadow;
|
|
420
|
+
}
|
|
421
|
+
if (style.textShadow && typeof style.textShadow === "object") {
|
|
422
|
+
style.textShadow = { ...style.textShadow, color: colour(style.textShadow.color) };
|
|
423
|
+
}
|
|
424
|
+
const box = typeof style.boxShadow === "string" ? parseBoxShadow(style.boxShadow) : style.boxShadow;
|
|
425
|
+
if (box !== undefined) {
|
|
426
|
+
style.boxShadow = Array.isArray(box) ? box.map((shadow) => ({ ...shadow, color: colour(shadow.color) })) : { ...box, color: colour(box.color) };
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
var COLOR_KEY = /^(background|foreground|color)$|(Color|Background|Foreground|Accent|Rule)$/;
|
|
430
|
+
function resolveStyleString(key, value, selected) {
|
|
431
|
+
return resolveThemeColor(COLOR_KEY.test(key) ? cssColor(value) : value, selected);
|
|
432
|
+
}
|
|
215
433
|
function resolveThemeStyle(style, selected) {
|
|
216
434
|
const resolved = { ...style };
|
|
217
435
|
for (const key of Object.keys(resolved)) {
|
|
218
436
|
const value = resolved[key];
|
|
219
437
|
if (typeof value === "string")
|
|
220
|
-
resolved[key] =
|
|
438
|
+
resolved[key] = resolveStyleString(key, value, selected);
|
|
221
439
|
}
|
|
440
|
+
resolveShadowColors(resolved, selected);
|
|
222
441
|
for (const state of ["hover", "focus", "focusVisible", "active", "disabled"]) {
|
|
223
442
|
const value = style[state];
|
|
224
443
|
if (!value)
|
|
@@ -227,9 +446,10 @@ function resolveThemeStyle(style, selected) {
|
|
|
227
446
|
for (const key of Object.keys(next)) {
|
|
228
447
|
const stateValue = next[key];
|
|
229
448
|
if (typeof stateValue === "string") {
|
|
230
|
-
next[key] =
|
|
449
|
+
next[key] = resolveStyleString(key, stateValue, selected);
|
|
231
450
|
}
|
|
232
451
|
}
|
|
452
|
+
resolveShadowColors(next, selected);
|
|
233
453
|
resolved[state] = next;
|
|
234
454
|
}
|
|
235
455
|
return resolved;
|
|
@@ -282,7 +502,7 @@ function Pressable(props) {
|
|
|
282
502
|
}
|
|
283
503
|
// packages/protocol/src/index.ts
|
|
284
504
|
var NATIVE_ABI_VERSION = 5;
|
|
285
|
-
var PROTOCOL_VERSION =
|
|
505
|
+
var PROTOCOL_VERSION = 46;
|
|
286
506
|
|
|
287
507
|
// packages/core/src/bridge/binding.ts
|
|
288
508
|
import { dlopen } from "bun:ffi";
|
|
@@ -922,15 +1142,6 @@ function composedContent(child, foreground) {
|
|
|
922
1142
|
}
|
|
923
1143
|
};
|
|
924
1144
|
}
|
|
925
|
-
if (child.type === "icon") {
|
|
926
|
-
return {
|
|
927
|
-
...child,
|
|
928
|
-
props: {
|
|
929
|
-
...props,
|
|
930
|
-
style: { foreground, ...props.style }
|
|
931
|
-
}
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
1145
|
const children = props.children === undefined ? undefined : composedContent(props.children, foreground);
|
|
935
1146
|
if (children === undefined)
|
|
936
1147
|
return child;
|
|
@@ -5702,7 +5913,7 @@ function compileTree(element, debug = false, renderer = "auto", componentAdapter
|
|
|
5702
5913
|
height: p.height ?? 820,
|
|
5703
5914
|
minWidth: p.minWidth ?? 780,
|
|
5704
5915
|
minHeight: p.minHeight ?? 580,
|
|
5705
|
-
background:
|
|
5916
|
+
background: resolveStyleString("background", p.style?.background ?? theme.colors.background, selectedTheme),
|
|
5706
5917
|
decorations: true,
|
|
5707
5918
|
resizable: p.resizable ?? true,
|
|
5708
5919
|
position: p.position ?? "center",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "0.
|
|
4
|
-
"protocolVersion":
|
|
3
|
+
"packageVersion": "0.2.0",
|
|
4
|
+
"protocolVersion": 46,
|
|
5
5
|
"nativeAbiVersion": 5,
|
|
6
|
-
"sourceFingerprint": "
|
|
6
|
+
"sourceFingerprint": "f8901ea4961cf0a03100d0de7c068afe8455a458efa5a36babac561fe423dc40"
|
|
7
7
|
}
|
package/dist/npm/protocol.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BoxShadow, TextShadow, Transform } from "../../protocol/src/index";
|
|
2
|
+
/**
|
|
3
|
+
* CSS colour → "#rrggbbaa". Hex, rgb()/rgba(), hsl()/hsla() and a few names are
|
|
4
|
+
* converted; theme tokens (`var(--…)`) pass through for theme resolution.
|
|
5
|
+
*/
|
|
6
|
+
export declare function cssColor(value: string): string;
|
|
7
|
+
/** CSS `box-shadow` syntax: "inset 0 1px 2px rgba(0,0,0,.2), 0 8px 24px #0003" or "none". */
|
|
8
|
+
export declare function parseBoxShadow(value: string): BoxShadow[];
|
|
9
|
+
/** CSS `text-shadow` syntax for one solid shadow: "1px 2px #0006". Blur must be 0. */
|
|
10
|
+
export declare function parseTextShadow(value: string): TextShadow | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* CSS `transform` syntax limited to translate/scale: "translateY(-2px) scale(1.02)".
|
|
13
|
+
* Functions compose left to right as in CSS; "none" is the identity.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseTransform(value: string): Transform;
|
|
@@ -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, UserSelect, TextDecoration, Renderer, WindowPosition, WindowPositionPreset, FileDialogFilter, FileDialogOptions, ScrollOrientation, ScrollPosition, MotionProperty, MotionEasing, MotionTransition, MotionTransitions, MotionValues } from "../../protocol/src/index";
|
|
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";
|
|
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";
|
|
@@ -86,6 +86,8 @@ export declare const theme: {
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
export declare function resolveThemeColor(value: string, selected: ThemeDefinition): string;
|
|
89
|
+
/** Theme token or CSS colour (hex, rgb(), hsl(), names) for colour keys; other strings unchanged. */
|
|
90
|
+
export declare function resolveStyleString(key: string, value: string, selected: ThemeDefinition): string;
|
|
89
91
|
export declare function resolveThemeStyle(style: Style, selected: ThemeDefinition): Style;
|
|
90
92
|
export type ButtonVariant = "default" | "secondary" | "outline" | "ghost" | "destructive";
|
|
91
93
|
export declare const buttonVariants: Record<ButtonVariant, Style>;
|
|
@@ -1,9 +1,12 @@
|
|
|
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 =
|
|
3
|
+
export declare const PROTOCOL_VERSION = 46;
|
|
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. */
|
|
7
|
+
export type NumericMotionProperty = "width" | "height" | "top" | "right" | "bottom" | "left" | "opacity" | "radius";
|
|
8
|
+
/** Colour and shadow properties also transition on hover/active/focus/disabled changes. */
|
|
9
|
+
export type MotionProperty = NumericMotionProperty | "background" | "foreground" | "borderColor" | "boxShadow" | "textShadow" | "transform";
|
|
7
10
|
export type MotionEasing = "linear" | "ease" | "easeIn" | "easeOut" | "easeInOut";
|
|
8
11
|
export interface MotionTransition {
|
|
9
12
|
/** Duration in milliseconds. Defaults to 200 when omitted. */
|
|
@@ -13,7 +16,7 @@ export interface MotionTransition {
|
|
|
13
16
|
easing?: MotionEasing;
|
|
14
17
|
}
|
|
15
18
|
export type MotionTransitions = Partial<Record<MotionProperty | "all", MotionTransition>>;
|
|
16
|
-
export type MotionValues = Partial<Record<
|
|
19
|
+
export type MotionValues = Partial<Record<NumericMotionProperty, number>>;
|
|
17
20
|
export type NodeKind = "window" | "titlebar" | "view" | "row" | "column" | "text" | "markdown" | "code" | "diff" | "button" | "image" | "svg" | "scroll" | "input" | "textarea" | "pressable" | "slider" | "splitter";
|
|
18
21
|
export type SvgElementName = "path" | "circle" | "ellipse" | "g" | "line" | "polygon" | "polyline" | "rect";
|
|
19
22
|
export type SvgAttributeValue = string | number;
|
|
@@ -26,6 +29,31 @@ export type Insets = number | {
|
|
|
26
29
|
left?: number;
|
|
27
30
|
};
|
|
28
31
|
export type OutlineStyle = "dotted" | "dashed" | "solid" | "double" | "groove" | "ridge" | "inset" | "outset" | "none" | "hidden";
|
|
32
|
+
/** Same values as OutlineStyle. Non-solid styles apply when all four border widths are equal. */
|
|
33
|
+
export type BorderStyle = OutlineStyle;
|
|
34
|
+
/** Solid offset copy of the text. Blur is not supported. */
|
|
35
|
+
export interface TextShadow {
|
|
36
|
+
x?: number;
|
|
37
|
+
y?: number;
|
|
38
|
+
color: string;
|
|
39
|
+
}
|
|
40
|
+
/** CSS-like box shadow. `blur` is the CSS blur radius (sigma = blur / 2); `inset` paints inside the padding box. */
|
|
41
|
+
/** Paint-time translate/scale about the box centre. Hit testing follows it; layout does not. */
|
|
42
|
+
export interface Transform {
|
|
43
|
+
x?: number;
|
|
44
|
+
y?: number;
|
|
45
|
+
scale?: number;
|
|
46
|
+
scaleX?: number;
|
|
47
|
+
scaleY?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface BoxShadow {
|
|
50
|
+
x?: number;
|
|
51
|
+
y?: number;
|
|
52
|
+
blur?: number;
|
|
53
|
+
spread?: number;
|
|
54
|
+
color: string;
|
|
55
|
+
inset?: boolean;
|
|
56
|
+
}
|
|
29
57
|
export type UserSelect = "auto" | "text" | "none" | "all";
|
|
30
58
|
export type TextDecoration = "none" | "underline" | "overline" | "line-through";
|
|
31
59
|
export interface SyntaxTheme {
|
|
@@ -72,6 +100,7 @@ export interface StateStyle {
|
|
|
72
100
|
background?: string;
|
|
73
101
|
foreground?: string;
|
|
74
102
|
borderColor?: string;
|
|
103
|
+
borderStyle?: BorderStyle;
|
|
75
104
|
radius?: number;
|
|
76
105
|
opacity?: number;
|
|
77
106
|
outlineWidth?: number;
|
|
@@ -86,6 +115,13 @@ export interface StateStyle {
|
|
|
86
115
|
placeholderBackground?: string;
|
|
87
116
|
thumbColor?: string;
|
|
88
117
|
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). */
|
|
120
|
+
textShadow?: TextShadow | string;
|
|
121
|
+
/** One shadow or up to 8; the first paints on top. Does not affect layout. */
|
|
122
|
+
boxShadow?: BoxShadow | readonly BoxShadow[] | string;
|
|
123
|
+
/** Object form, or CSS syntax such as "translateY(-2px) scale(1.02)" (translate/scale only). */
|
|
124
|
+
transform?: Transform | string;
|
|
89
125
|
}
|
|
90
126
|
export interface Style extends StateStyle {
|
|
91
127
|
width?: Length;
|
|
Binary file
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "0.
|
|
4
|
-
"protocolVersion":
|
|
3
|
+
"packageVersion": "0.2.0",
|
|
4
|
+
"protocolVersion": 46,
|
|
5
5
|
"nativeAbiVersion": 5,
|
|
6
|
-
"sourceFingerprint": "
|
|
6
|
+
"sourceFingerprint": "f8901ea4961cf0a03100d0de7c068afe8455a458efa5a36babac561fe423dc40",
|
|
7
7
|
"target": "linux-x64",
|
|
8
8
|
"nativeName": "libtarve_native.so",
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "d05e5dfface781780ae122f7910a12c97f3b49e3c877a023c410f310f80bc852"
|
|
10
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "0.
|
|
4
|
-
"protocolVersion":
|
|
3
|
+
"packageVersion": "0.2.0",
|
|
4
|
+
"protocolVersion": 46,
|
|
5
5
|
"nativeAbiVersion": 5,
|
|
6
|
-
"sourceFingerprint": "
|
|
6
|
+
"sourceFingerprint": "f8901ea4961cf0a03100d0de7c068afe8455a458efa5a36babac561fe423dc40",
|
|
7
7
|
"target": "windows-x64",
|
|
8
8
|
"nativeName": "tarve_native.dll",
|
|
9
|
-
"sha256": "
|
|
9
|
+
"sha256": "20143d5b81aa676c1d6b583154f815549bc2439ed836e5025329bf0b5fe2df57"
|
|
10
10
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarve/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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": [
|
|
@@ -31,17 +31,13 @@
|
|
|
31
31
|
"bin": {
|
|
32
32
|
"tarve": "./dist/npm/cli.js"
|
|
33
33
|
},
|
|
34
|
-
"workspaces": [
|
|
35
|
-
"packages/*"
|
|
36
|
-
],
|
|
37
34
|
"files": [
|
|
35
|
+
"CHANGELOG.md",
|
|
38
36
|
"dist/npm",
|
|
39
37
|
"dist/types",
|
|
40
38
|
"native/win32-x64",
|
|
41
39
|
"native/linux-x64",
|
|
42
40
|
"README.md",
|
|
43
|
-
"PERFORMANCE.md",
|
|
44
|
-
"RELEASE.md",
|
|
45
41
|
"LICENSE"
|
|
46
42
|
],
|
|
47
43
|
"os": [
|
|
@@ -82,49 +78,6 @@
|
|
|
82
78
|
},
|
|
83
79
|
"./package.json": "./package.json"
|
|
84
80
|
},
|
|
85
|
-
"scripts": {
|
|
86
|
-
"dev": "bun scripts/dev.ts",
|
|
87
|
-
"dev:example": "bun scripts/dev.ts --entry examples/basic.tsx",
|
|
88
|
-
"build": "bun scripts/build.ts --release",
|
|
89
|
-
"build:exe": "bun scripts/build.ts --exe",
|
|
90
|
-
"build:example": "bun scripts/build.ts --exe --entry examples/basic.tsx",
|
|
91
|
-
"build:native": "bun scripts/build.ts",
|
|
92
|
-
"package": "bun scripts/package.ts",
|
|
93
|
-
"package:local": "bun scripts/package.ts --local",
|
|
94
|
-
"package:native": "bun scripts/package.ts --native-only",
|
|
95
|
-
"prepack": "bun scripts/prepack.ts",
|
|
96
|
-
"pack": "bun pm pack --ignore-scripts --destination dist",
|
|
97
|
-
"start:example": "bun run setup:examples && bun examples/basic.tsx",
|
|
98
|
-
"check": "bun node_modules/typescript/bin/tsc --noEmit",
|
|
99
|
-
"lint": "cargo clippy --manifest-path native/Cargo.toml --all-targets -- -D warnings",
|
|
100
|
-
"setup:examples": "bun scripts/setup-examples.ts",
|
|
101
|
-
"install:examples": "bun install --cwd examples --frozen-lockfile",
|
|
102
|
-
"verify": "bun scripts/verify.ts",
|
|
103
|
-
"release:check": "bun run verify",
|
|
104
|
-
"release:policy": "bun scripts/release-policy.ts",
|
|
105
|
-
"release:build": "bun scripts/release.ts",
|
|
106
|
-
"version:check": "bun scripts/version-policy.ts --check",
|
|
107
|
-
"version:set": "bun scripts/version-policy.ts --set",
|
|
108
|
-
"test": "bun test packages/core && cargo test --manifest-path native/Cargo.toml",
|
|
109
|
-
"test:package-clean": "bun test scripts/package-output.test.ts",
|
|
110
|
-
"test:release-policy": "bun test scripts/version-policy.test.ts scripts/release-policy.test.ts",
|
|
111
|
-
"test:visual": "bun run setup:examples && bun scripts/visual-regression.tsx",
|
|
112
|
-
"smoke": "bun run build:native && bun run setup:examples && bun scripts/smoke.ts",
|
|
113
|
-
"smoke:controls": "bun run build:native && bun run setup:examples && bun scripts/smoke-controls.ts",
|
|
114
|
-
"smoke:virtual-list": "bun run build:native && bun run setup:examples && bun scripts/smoke-virtual-list.ts",
|
|
115
|
-
"smoke:rich-content": "bun run build:native && bun scripts/smoke-rich-content.ts",
|
|
116
|
-
"smoke:motion": "bun run build:native && bun scripts/smoke-motion.tsx",
|
|
117
|
-
"smoke:editor": "bun run build:native && bun scripts/smoke-editor.tsx",
|
|
118
|
-
"smoke:devtools": "bun run build:native && bun scripts/smoke-devtools.ts",
|
|
119
|
-
"smoke:accessibility": "bun run build:native && powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/smoke-accessibility.ps1",
|
|
120
|
-
"smoke:exe": "bun scripts/smoke-exe.ts",
|
|
121
|
-
"smoke:package": "bun scripts/smoke-package.ts",
|
|
122
|
-
"bench": "bun scripts/benchmark.tsx"
|
|
123
|
-
},
|
|
124
|
-
"devDependencies": {
|
|
125
|
-
"@types/bun": "^1.4.2",
|
|
126
|
-
"typescript": "^7.0.2"
|
|
127
|
-
},
|
|
128
81
|
"engines": {
|
|
129
82
|
"bun": ">=1.4.0"
|
|
130
83
|
}
|
package/PERFORMANCE.md
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# Performance measurements
|
|
2
|
-
|
|
3
|
-
Run `bun run build` followed by `bun run bench`. The benchmark uses the host Rust release library, opens a real GPU-backed window, and writes `work/benchmark.json`.
|
|
4
|
-
|
|
5
|
-
## Current measurement
|
|
6
|
-
|
|
7
|
-
Windows x64, Bun 1.4.1, AMD Ryzen 7 9800X3D. The workload contains 2,000 rows / 6,005 native nodes; 67 nodes are visible. Each row contains text and an interactive button. The benchmark discards five warm-up samples and collects 60 samples for each operation.
|
|
8
|
-
|
|
9
|
-
| Operation | Original full-tree update | Current property patch |
|
|
10
|
-
| --- | ---: | ---: |
|
|
11
|
-
| State update, median | 35.92 ms | 11.96 ms |
|
|
12
|
-
| State update, p95 | 42.41 ms | 14.51 ms |
|
|
13
|
-
| Scroll, median | 1.13 ms | 0.92 ms |
|
|
14
|
-
| Scroll, p95 | 1.97 ms | 1.09 ms |
|
|
15
|
-
| New frames while idle | 0 | 0 |
|
|
16
|
-
|
|
17
|
-
These are input/update dispatch to native frame-notification times, including Bun/FFI and presentation scheduling. They are not photon latency, universal FPS guarantees, or results from other hardware. Recent update runs on the same machine have ranged from 11.79 to 15.37 ms median, so the current value is one run rather than a fixed performance promise. In that run, TSX tree construction took 5.78 ms median and diffing took 1.54 ms median. The first window took 562 ms. The earlier patch implementation once measured 8.57 ms median; repeatability across machines remains unverified.
|
|
18
|
-
|
|
19
|
-
A previous fixed-height `VirtualList` run with 50,000 records kept at most 97 native layout nodes during initial view, mid-list scroll and bottom-list interaction in the real-window smoke test. The current example uses 500 records and taller padded rows. Native scroll events trigger updates for virtual lists; ordinary `Scroll` elements paint directly without rebuilding the TSX tree. A virtual list waits for the updated visible rows before scheduling its next frame.
|
|
20
|
-
|
|
21
|
-
## Memory
|
|
22
|
-
|
|
23
|
-
### Native Windows D3D11 GPU renderer
|
|
24
|
-
|
|
25
|
-
Windows x64, Bun 1.4.2, Ryzen 7 9800X3D, Counter 620x520, usando o mesmo pacote release local para os três modos. Cada processo estabilizou por 4 s; CPU foi amostrada por mais 3 s. A linha D3D11 é o caminho normal de `renderer: "gpu"`/`"auto"` no Windows sem `WGPU_BACKEND`; a linha DX12 força o renderer legado com `WGPU_BACKEND=dx12`.
|
|
26
|
-
|
|
27
|
-
| Renderer | Working set | Private bytes | Threads | Handles | CPU idle (um core) |
|
|
28
|
-
| --- | ---: | ---: | ---: | ---: | ---: |
|
|
29
|
-
| **D3D11/DXGI nativo** | **82.2 MB** | 309.7 MB | 79 | 596 | **0.52%** |
|
|
30
|
-
| Vello/WGPU DX12 legado | 172.1 MB | 493.9 MB | 39 | 519 | 1.04% |
|
|
31
|
-
| vello_cpu + softbuffer | 48.1 MB | 139.6 MB | 26 | 270 | 0.00% |
|
|
32
|
-
|
|
33
|
-
Uma execução D3D11 imediatamente anterior mediu 85.4 MB de working set e 0.00% de um core no mesmo Counter, portanto 82.2 MB deve ser tratado como uma amostra e não como promessa fixa. No run comparativo, o processo D3D11 carregou `d3d11.dll` sem `d3d12.dll` nem `vulkan-1.dll`; ao forçar o legado DX12, `d3d12.dll` apareceu e o working set ficou ~90 MB maior.
|
|
34
|
-
|
|
35
|
-
O backend D3D11 renderiza para um target BGRA associado ao flip-model swapchain, usa buffers de vértices/índices pequenos com crescimento sob demanda, atlas R8 de glifos limitado a quatro páginas de 1024x1024, cache de imagens limitado ao display list retido e MSAA 4x quando suportado (fallback 2x/1x). Não há os grandes buffers intermediários do Vello Classic nem o custo-base do `wgpu + D3D12` no caminho padrão do Windows. O renderer legado permanece disponível como fallback se a criação D3D11 falhar e como escape hatch explícito via `WGPU_BACKEND`.
|
|
36
|
-
|
|
37
|
-
No mesmo PC, um probe separado do GPUix 0.10.0 ficou em ~94.3 MB de working set vazio e ~95.8–97.6 MB com a UI de teste. Esses números são apenas contexto local: processos, drivers e workloads diferentes não tornam isso uma garantia de que Tarve sempre usará menos memória.
|
|
38
|
-
|
|
39
|
-
### Low-memory CPU renderer
|
|
40
|
-
|
|
41
|
-
Windows x64, Bun 1.4.2, Counter 620x520 executado a partir do pacote local no renderer CPU. O backend pode ser selecionado por `createApp(App, { renderer: "cpu" })`; `TARVE_RENDERER=cpu` continua disponível quando o app usa `renderer: "auto"`. A medição abaixo foi feita na revisão anterior do bridge, ainda com polling FFI não bloqueante de 4 ms, após o app estabilizar em idle; portanto ela é um limite histórico conservador e ainda não foi refeita após o wakeup event-driven:
|
|
42
|
-
|
|
43
|
-
| Metric | CPU renderer |
|
|
44
|
-
| --- | ---: |
|
|
45
|
-
| Working set | **46.9 MB** |
|
|
46
|
-
| Private bytes | 134.5 MB |
|
|
47
|
-
| Threads | 24 |
|
|
48
|
-
| CPU idle | **0.39% de um core** (~0.024% do CPU total de 16 threads) |
|
|
49
|
-
|
|
50
|
-
Esse modo mantém o Bun como runtime principal e continua suportando TypeScript/TSX, APIs Bun e pacotes npm. A redução vem de duas mudanças: o pump de eventos não cria mais um segundo Bun Worker, e o renderer `vello_cpu + softbuffer` evita inicializar `wgpu + Vello GPU`. O backend GPU continua disponível e permanece o padrão. Uma configuração explícita em `createApp` tem prioridade sobre `TARVE_RENDERER`; `"auto"` preserva o override por env para desenvolvimento/CI.
|
|
51
|
-
|
|
52
|
-
`JSCallback({ threadsafe: true })` foi retestado no Bun 1.4.2 como wake-only, inclusive com lifetime one-shot e FIFO continuando em `tarve_poll_event()`. Probes mínimos com `Bun.sleep()` não reproduziram o problema histórico, mas isso se mostrou um falso negativo: no app empacotado real, medido externamente pelo Windows (`Get-Process`/tempo de CPU do processo), o callback mantém aproximadamente um core inteiro ocupado em idle. O `Counter` ficou em ~98.9% de um core (~6.18% do CPU total de 16 threads) e o showcase `components` em ~103.7% de um core (~6.48% total). Após repackar exatamente os mesmos apps com o wakeup por named pipe, o `Counter` caiu para ~0.39% de um core (~0.024% total) e o showcase ficou em 0% na mesma janela de medição. Por isso o bridge de produção permanece no named pipe: ele só sinaliza a transição da FIFO de vazia para não vazia, enquanto o payload continua sendo drenado via FFI. Não há polling periódico nem Worker dedicado.
|
|
53
|
-
|
|
54
|
-
Os números abaixo são medições históricas do renderer GPU Vello/WGPU e usam um método diferente (executáveis standalone), portanto não devem ser tratados como comparação A/B direta com a tabela D3D11 atual.
|
|
55
|
-
|
|
56
|
-
Windows x64 measurements after 1.8 s idle, using the standalone release executables and Vulkan:
|
|
57
|
-
|
|
58
|
-
| Example | Working set | Private bytes |
|
|
59
|
-
| --- | ---: | ---: |
|
|
60
|
-
| Counter | ~203 MB | ~537 MB |
|
|
61
|
-
| Basic | ~207–215 MB | ~597 MB |
|
|
62
|
-
|
|
63
|
-
Before requesting wgpu's memory-oriented allocation strategy and limiting Vello shader initialization to one thread, the Counter executable measured about 266 MB working set / 842 MB private bytes. In an isolated Bun process, the old dedicated event Worker added roughly 15–16 MB working set and about 40 MB private bytes. It has since been removed: native events remain in a FIFO queue, a Windows named pipe wakes the Bun event loop only when work arrives, and the main runtime then drains the queue with non-blocking FFI calls.
|
|
64
|
-
|
|
65
|
-
## Implemented
|
|
66
|
-
|
|
67
|
-
- Stable IDs retain Taffy nodes and layout caches across updates and resizes.
|
|
68
|
-
- The native tree stores each node once, with child IDs instead of recursively duplicated subtrees.
|
|
69
|
-
- Property-only updates send only changed nodes across the bridge. Structural changes use a full replacement while preserving IDs/state.
|
|
70
|
-
- Layout, text and paint invalidation remain separate; hover and scrolling do not recalculate layout.
|
|
71
|
-
- Paint and hit testing discard subtrees outside the current clipping region.
|
|
72
|
-
- Local asset extraction is cached per process. No filesystem reads are required for those assets during subsequent tree updates.
|
|
73
|
-
- Decoded image cache entries are released when the corresponding image nodes leave the retained tree.
|
|
74
|
-
- On Windows, `renderer: "gpu"` uses the native D3D11/DXGI renderer by default: flip-model BGRA swapchain, grow-on-demand geometry buffers, Lyon tessellation, nested stencil clipping, bounded Swash glyph atlases, retained image resources, MSAA and direct DXGI presentation. If D3D11 initialization/recovery fails, Tarve falls back to Vello/WGPU over DX12.
|
|
75
|
-
- The legacy Windows Vello/WGPU path still requests wgpu's memory-oriented allocation strategy and uses one Vello shader-initialization thread. Defining `WGPU_BACKEND` explicitly selects this path for development/diagnostics.
|
|
76
|
-
- `createApp(App, { renderer: "cpu" })` selects a single-threaded `vello_cpu + softbuffer` path that shares the same tree/text/control paint traversal and supports captures, images, clipping and text. `"gpu"` explicitly selects GPU; `"auto"` keeps the GPU default and honors `TARVE_RENDERER` for development/CI overrides.
|
|
77
|
-
- Clean software redraws reuse retained softbuffer pixels when possible, avoiding another full-frame vello_cpu rasterization and RGBA flattening pass when content did not change.
|
|
78
|
-
- The native event loop sleeps when idle. Native events are queued FIFO; a Windows named pipe sends one wake signal when the queue transitions from empty to non-empty, then the Bun main runtime drains it with non-blocking FFI calls. There is no periodic bridge poll, dedicated Bun event Worker or cross-thread JS callback.
|
|
79
|
-
|
|
80
|
-
## Remaining work
|
|
81
|
-
|
|
82
|
-
Timed scrolling/transitions, complex input/overlays, sustained virtual-list interaction latency and multiple Windows/GPU configurations need their own measurements and regression gates before the overall production-readiness objective is complete.
|
package/RELEASE.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Tarve release policy
|
|
2
|
-
|
|
3
|
-
Tarve currently ships for **Windows x64 and Linux x64**. The release process is intentionally fail-closed: a release tag must match the product version, and the complete verification gate must pass. The npm package stages both native runtimes so `tarve build --target windows-x64|linux-x64` can cross-compile application executables.
|
|
4
|
-
|
|
5
|
-
The npm artifact is universal across those two targets: Linux CI builds `libtarve_native.so`, Windows CI builds `tarve_native.dll`, and packaging only proceeds after both are staged. Each runtime includes compatibility metadata with its target, protocol/ABI versions, source fingerprint, and binary hash. Packaging rejects missing, stale, mismatched, or modified runtimes before publishing.
|
|
6
|
-
|
|
7
|
-
## License and distribution
|
|
8
|
-
|
|
9
|
-
- Tarve is licensed under the **Apache License 2.0**. The canonical license text is in `LICENSE`, and package manifests use the SPDX identifier `Apache-2.0`.
|
|
10
|
-
- `@tarve/core-internal` and `@tarve/protocol` are private workspace packages for repository organization, but inherit the same Apache-2.0 license.
|
|
11
|
-
- The native Rust crate declares `license = "Apache-2.0"` and remains `publish = false`; it is distributed as part of Tarve rather than as an independent crates.io package.
|
|
12
|
-
- The automated release-policy gate rejects license drift between the root package, workspace packages, native crate, and the canonical `LICENSE` file.
|
|
13
|
-
- The release workflow publishes GitHub release artifacts and then publishes the same verified npm tarball to the npm registry (see *npm publishing* below).
|
|
14
|
-
|
|
15
|
-
## Version policy
|
|
16
|
-
|
|
17
|
-
There are three independent version domains:
|
|
18
|
-
|
|
19
|
-
1. **Product SemVer** — one version shared by the root npm package, `@tarve/core-internal`, `@tarve/protocol`, their workspace entries in `bun.lock`, `native/Cargo.toml` and the `tarve_native` entry in `Cargo.lock`.
|
|
20
|
-
2. **JSON protocol version** — a monotonically increasing integer used by serialized TS/Rust messages. It is currently **v45** and is independent from package SemVer.
|
|
21
|
-
3. **Native C ABI version** — a monotonically increasing integer for exported FFI function compatibility. It is currently **v5** and is independent from both product SemVer and the JSON protocol.
|
|
22
|
-
|
|
23
|
-
Use the version tool rather than editing manifests independently:
|
|
24
|
-
|
|
25
|
-
```powershell
|
|
26
|
-
bun run version:check
|
|
27
|
-
bun run version:set -- 0.2.0
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
`bun run release:policy` rejects product-version drift, license-policy drift, protocol mismatches and ABI mismatches.
|
|
31
|
-
|
|
32
|
-
## Code signing
|
|
33
|
-
|
|
34
|
-
Tarve is a framework, not an end-user application, so the Tarve release does **not** Authenticode-sign its native runtimes. Signing is the responsibility of each application author: sign the executable produced by `tarve build` with your own certificate (for example `signtool sign /fd SHA256 /tr <timestamp-url> /td SHA256 dist/App.exe`). The published npm tarball is instead protected by npm provenance and by the SHA-256 hashes in `dist/release-manifest.json`.
|
|
35
|
-
|
|
36
|
-
## Release procedure
|
|
37
|
-
|
|
38
|
-
1. Update the product version with `bun run version:set -- <semver>`.
|
|
39
|
-
2. Commit the version change and run `bun run release:check`.
|
|
40
|
-
3. Create an annotated or lightweight tag exactly matching `v<semver>`, for example `v0.2.0`.
|
|
41
|
-
4. Push the commit and tag.
|
|
42
|
-
5. `.github/workflows/release.yml` verifies that the tag points to a commit reachable from the default branch, reruns the full release gate, packs the universal npm tarball, verifies that it contains exactly the staged Windows and Linux runtimes, emits SHA-256 hashes in `dist/release-manifest.json`, uploads the artifacts and creates the GitHub release.
|
|
43
|
-
|
|
44
|
-
Prerelease SemVer tags such as `v0.2.0-beta.1` are published as GitHub prereleases.
|
|
45
|
-
|
|
46
|
-
## npm publishing
|
|
47
|
-
|
|
48
|
-
The `npm-publish` job in `.github/workflows/release.yml` runs only after the Windows release job succeeds. It publishes `@tarve/core` from the exact `dist/tarve-core-<version>.tgz` produced and verified by `release:build` (it never repacks), with npm provenance attestation:
|
|
49
|
-
|
|
50
|
-
- stable versions go to the `latest` dist-tag; prerelease versions (`0.2.0-beta.1`) go to `next`;
|
|
51
|
-
- the job is fail-closed: it refuses to run without the `NPM_TOKEN` secret, verifies the tarball name matches the tag, and skips nothing silently;
|
|
52
|
-
- publishing requires the `npm` GitHub environment, so a required reviewer can gate the registry step.
|
|
53
|
-
|
|
54
|
-
One-time setup:
|
|
55
|
-
|
|
56
|
-
1. The package is published under the `tarve` npm organization (the unscoped name `tarve` is rejected by npm as too similar to `tar`). Owners need 2FA enabled.
|
|
57
|
-
2. Create a granular **automation** access token with read-and-write access to the `@tarve` scope (organization `tarve`) and store it as the `NPM_TOKEN` secret of the `npm` GitHub environment.
|
|
58
|
-
3. Optionally add required reviewers to the `npm` environment.
|
|
59
|
-
|
|
60
|
-
To inspect what would be published locally, stage both native runtimes, then:
|
|
61
|
-
|
|
62
|
-
```powershell
|
|
63
|
-
bun run package
|
|
64
|
-
bun run pack
|
|
65
|
-
npm publish --dry-run (Get-ChildItem dist/tarve-core-*.tgz).FullName
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
For a local release rehearsal (both runtimes staged):
|
|
69
|
-
|
|
70
|
-
```powershell
|
|
71
|
-
bun run release:build -- --tag v0.1.0
|
|
72
|
-
```
|