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: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
- name: Scaffold and test frontend templates
run: |
set -euo pipefail
for frontend in next vite react svelte vue; do
for frontend in next vite react svelte vue angular; do
app=".zig-cache/scaffold-${frontend}"
rm -rf "$app"
./zig-out/bin/zero-native init "$app" --frontend "$frontend"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ Framework-specific starter examples live in `examples/`:
- `examples/react`
- `examples/svelte`
- `examples/vue`
- `examples/angular`

Each example is a complete zero-native app with `app.zon`, a Zig shell, and a minimal frontend project. Run one with `zig build run` from its directory.

Expand Down
1 change: 1 addition & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ pub fn build(b: *std.Build) void {
addExampleTestStep(b, frontend_examples_step, "test-example-react", "Run React example tests", "examples/react");
addExampleTestStep(b, frontend_examples_step, "test-example-svelte", "Run Svelte example tests", "examples/svelte");
addExampleTestStep(b, frontend_examples_step, "test-example-vue", "Run Vue example tests", "examples/vue");
addExampleTestStep(b, frontend_examples_step, "test-example-angular", "Run Angular example tests", "examples/angular");

const mobile_examples_step = b.step("test-examples-mobile", "Verify mobile example project layouts");
addLayoutCheckStep(b, mobile_examples_step, "test-example-ios-layout", "Verify iOS example layout", &.{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/app/cli/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The `zero-native` CLI provides project scaffolding, validation, packaging, and d
</thead>
<tbody>
<tr>
<td><code>zero-native init [path] --frontend &lt;next|vite|react|svelte|vue&gt;</code></td>
<td><code>zero-native init [path] --frontend &lt;next|vite|react|svelte|vue|angular&gt;</code></td>
<td>Scaffold a new zero-native project with the specified frontend. Omit <code>path</code> to scaffold into the current directory.</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/app/quick-start/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ zero-native init my_app --frontend next
cd my_app
```

Frontend options: `next`, `vite`, `react`, `svelte`, `vue`.
Frontend options: `next`, `vite`, `react`, `svelte`, `vue`, `angular`.

This scaffolds a complete zero-native project:

Expand Down
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ out/
dist/
next-env.d.ts
package-lock.json
.angular/

# Local iOS build products.
Libraries/
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Use these examples as a progressive path through zero-native:
- `hello` is the smallest desktop shell with inline HTML.
- `webview` demonstrates bridge commands, built-in window APIs, security policy, automation, and optional CEF.
- `browser` is a vanilla no-build shell that uses layered WebViews for isolated page content on macOS and Linux system WebViews.
- `react`, `svelte`, `vue`, and `next` show framework projects with managed frontend assets and dev-server workflows.
- `react`, `svelte`, `vue`, `angular`, and `next` show framework projects with managed frontend assets and dev-server workflows.
- `ios` and `android` show how mobile hosts link the zero-native C ABI from `libzero-native.a`.

Start with `hello`, then move to `webview` when you need native commands or WebView policy. Use `browser` when you want to see layered native WebViews, and use a framework example when building a real frontend.
33 changes: 33 additions & 0 deletions examples/angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Angular Example

A super basic zero-native example using Angular 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 WebView shell.

## Dev Server

```bash
zig build dev
```

This starts the Angular dev server from `app.zon`, waits for `http://127.0.0.1:4200/`, and launches the native shell with `ZERO_NATIVE_FRONTEND_URL`.

## Frontend

- Frontend: `angular` (Angular 20)
- Production assets: `frontend/dist`
- Dev URL: `http://127.0.0.1:4200/`

## Using Outside The Repo

This example references zero-native via relative path (`../../`). To use it standalone, override the path:

```bash
zig build run -Dzero-native-path=/path/to/zero-native
```
32 changes: 32 additions & 0 deletions examples/angular/app.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.{
.id = "dev.zero_native.angular-example",
.name = "angular-example",
.display_name = "Angular Example",
.version = "0.1.0",
.icons = .{ "assets/icon.icns" },
.platforms = .{ "macos", "linux" },
.permissions = .{},
.capabilities = .{ "webview" },
.frontend = .{
.dist = "frontend/dist",
.entry = "index.html",
.spa_fallback = true,
.dev = .{
.url = "http://127.0.0.1:4200/",
.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:4200" },
.external_links = .{ .action = "deny" },
},
},
.web_engine = "system",
.cef = .{ .dir = "third_party/cef/macos", .auto_install = false },
.windows = .{
.{ .label = "main", .title = "Angular Example", .width = 720, .height = 480, .restore_state = true },
},
}
Binary file added examples/angular/assets/icon.icns
Binary file not shown.
Loading