Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,13 @@ pub fn build(b: *std.Build) void {
const frontend_examples_step = b.step("test-examples-frontends", "Run frontend example tests");
addExampleTestStep(b, host_cli_exe, frontend_examples_step, "test-example-next", "Run Next example tests", "examples/next", .owned);
addExampleTestStep(b, host_cli_exe, frontend_examples_step, "test-example-react", "Run React example tests", "examples/react", .owned);
addExampleTestStep(b, host_cli_exe, frontend_examples_step, "test-example-solid", "Run Solid example tests", "examples/solid", .owned);
addExampleTestStep(b, host_cli_exe, frontend_examples_step, "test-example-svelte", "Run Svelte example tests", "examples/svelte", .owned);
addExampleTestStep(b, host_cli_exe, frontend_examples_step, "test-example-vue", "Run Vue example tests", "examples/vue", .owned);
addFileContainsCheckStep(b, file_contains_checker, frontend_examples_step, "test-example-frontend-positioning", "Verify frontend example native shell positioning", &.{
.{ .path = "examples/next/README.md", .pattern = "opens the native app shell with WebView content." },
.{ .path = "examples/react/README.md", .pattern = "opens the native app shell with WebView content." },
.{ .path = "examples/solid/README.md", .pattern = "opens the native app shell with WebView content." },
.{ .path = "examples/svelte/README.md", .pattern = "opens the native app shell with WebView content." },
.{ .path = "examples/vue/README.md", .pattern = "opens the native app shell with WebView content." },
});
Expand Down
1 change: 1 addition & 0 deletions changelog.d/solid-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feature: **SolidJS example**: `examples/solid` mirrors the existing React/Vue/Svelte examples (Vite dev server, `zig build run`/`dev`/`test`), for apps that want SolidJS's fine-grained reactivity instead of a virtual DOM. Requested in #57.
1 change: 1 addition & 0 deletions docs/src/app/frontend/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ The repository includes complete frontend examples:

- `examples/next` - Next.js app with `frontend/out` production assets.
- `examples/react` - React app built with Vite.
- `examples/solid` - Solid app built with Vite.
- `examples/svelte` - Svelte app built with Vite.
- `examples/vue` - Vue app built with Vite.

Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ native build # produce a ReleaseFast binary in zig-out/bin/
| `native-shell` | Native toolbar/sidebar/statusbar chrome around a WebView content area. |
| `native-panels` | Split native panels and stacked native controls around WebView content. |
| `browser` | Layered WebViews for isolated page content, engine link flags wired by hand. |
| `next`, `react`, `svelte`, `vue` | Frontend projects with managed install/build/dev-server steps. |
| `next`, `react`, `solid`, `svelte`, `vue` | Frontend projects with managed install/build/dev-server steps. |
| `ui-inbox` | The builder-view inbox; its `-Dmobile` lib step feeds the mobile host shims. |
| `mobile-canvas` | Builds the mobile embed static library consumed by the iOS/Android canvas shims. |

Expand Down
33 changes: 33 additions & 0 deletions examples/solid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Solid Example

A super basic Native SDK example using SolidJS for the frontend and Zig for the native shell.

## Run

```bash
zig build run
```

The build installs frontend dependencies, builds the frontend, and opens the native app shell with WebView content.

## Dev Server

```bash
zig build dev
```

This starts the Solid dev server from `app.zon`, waits for `http://127.0.0.1:5173/`, and launches the native shell with `NATIVE_SDK_FRONTEND_URL`.

## Frontend

- Frontend: `solid`
- Production assets: `frontend/dist`
- Dev URL: `http://127.0.0.1:5173/`

## Using Outside The Repo

This example references the Native SDK via relative path (`../../`). To use it standalone, override the path:

```bash
zig build run -Dnative-sdk-path=/path/to/native-sdk
```
31 changes: 31 additions & 0 deletions examples/solid/app.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.{
.id = "dev.native_sdk.solid-example",
.name = "solid-example",
.display_name = "Solid Example",
.version = "0.1.0",
.platforms = .{ "macos", "linux" },
.permissions = .{},
.capabilities = .{ "webview" },
.frontend = .{
.dist = "frontend/dist",
.entry = "index.html",
.spa_fallback = true,
.dev = .{
.url = "http://127.0.0.1:5173/",
.command = .{ "npm", "--prefix", "frontend", "run", "dev", "--", "--host", "127.0.0.1" },
.ready_path = "/",
.timeout_ms = 30000,
},
},
.security = .{
.navigation = .{
.allowed_origins = .{ "zero://app", "zero://inline", "http://127.0.0.1:5173" },
.external_links = .{ .action = "deny" },
},
},
.web_engine = "system",
.cef = .{ .dir = "third_party/cef/macos", .auto_install = false },
.windows = .{
.{ .label = "main", .title = "Solid Example", .width = 720, .height = 480, .restore_state = true },
},
}
Loading