Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target/
/demo/dist/
/demo/target/
/demo-desktop/src-tauri/target/
**/*.rs.bk
*.pdb
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ members = [
"crates/rangular-parser",
"crates/rangular-runtime",
]
exclude = ["demo"]
exclude = ["demo", "demo-desktop/src-tauri"]
resolver = "2"

[workspace.package]
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SHELL := /bin/bash
ROOT := $(abspath .)
DEMO := $(ROOT)/demo
DESKTOP := $(ROOT)/demo-desktop/src-tauri
CARGO ?= cargo
TRUNK := env -u NO_COLOR $(HOME)/.cargo/bin/trunk
CLIPPY_FLAGS := -D warnings -D clippy::all -D clippy::pedantic -D clippy::nursery
Expand All @@ -22,6 +23,7 @@ TAG ?= dev

.PHONY: help check test lint format format-check clean ci no-panic \
demo demo-build demo-check \
demo-desktop demo-desktop-build \
docker-build docker-build-dev docker-run \
docker-push-dev-hub docker-push-dev-ghcr-personal docker-push-dev-ghcr-itc

Expand All @@ -40,6 +42,8 @@ help:
@echo " make demo Trunk serve → http://$(DEMO_ADDR):$(DEMO_PORT)/"
@echo " make demo-build Trunk release dist in demo/"
@echo " make demo-check fmt + clippy on demo wasm target"
@echo " make demo-desktop Tauri window (reuses :$(DEMO_PORT) if already up)"
@echo " make demo-desktop-build Tauri release bundles"
@echo ""
@echo "Docker (browser SPA for Render):"
@echo " make docker-build Build $(HUB_IMAGE):$(APP_VERSION)"
Expand Down Expand Up @@ -86,6 +90,21 @@ demo-build:
demo-check: format-check
cd $(DEMO) && $(CARGO) clippy --target wasm32-unknown-unknown --all-targets -- $(CLIPPY_FLAGS)

demo-desktop:
@if pgrep -f 'rangular-demo-desktop' >/dev/null 2>&1; then \
echo "rangular-demo-desktop already running - reuse that window"; \
exit 0; \
fi
@if ss -tlnp 2>/dev/null | grep -q ':$(DEMO_PORT) '; then \
echo "Port $(DEMO_PORT) in use - Tauri will attach without starting Trunk"; \
cd $(DESKTOP) && $(CARGO) tauri dev --config '{"build":{"beforeDevCommand":""}}'; \
else \
cd $(DESKTOP) && $(CARGO) tauri dev; \
fi

demo-desktop-build:
cd $(DESKTOP) && $(CARGO) tauri build

docker-build:
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) docker build --pull --network=host \
-f $(DOCKERFILE) -t $(HUB_IMAGE):$(APP_VERSION) $(ROOT)
Expand Down
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
Write markup in familiar `.html` / `.scss`, keep state and handlers in Rust, and
render with [Leptos](https://leptos.dev/) in the browser (CSR / Trunk / wasm).

**Live:** [https://rangular.interchouette.net](https://rangular.interchouette.net)

If you know Angular component files, you will feel at home. If you know Rust,
you keep ownership of the real logic. **[rangular](https://github.com/Interchouette-ITC/rangular)**
sits between the two: a **versioned subset**, not a full Angular port, with
Expand Down Expand Up @@ -237,26 +239,25 @@ Pin a commit (`rev`) or use a local path checkout: see
[`docs/SPEC.md`](docs/SPEC.md): Leptos CSR / wasm. Native desktop widget toolkits
(egui, iced, GTK, and similar) are **out of scope**.

### Want Angular-like on the desktop?
### Shipping a desktop app with rangular

[Angust](https://github.com/TudorOrban/Angust) was proposing that path: native /
desktop-oriented components and HTML templates. Look there, and at the
[Angular Rust](https://github.com/angular-rust) ecosystem, if you want widgets
outside a webview.
[Tauri](https://v2.tauri.app/) hosts a **webview**. Your UI is still a web app: a
Leptos + Trunk build that uses rangular components can run inside that webview
the same way it runs in Chrome. rangular still speaks DOM / wasm, not egui /
iced / GTK.

### Shipping a desktop app with rangular
In-repo shell (same SPA as the browser demo):

[Tauri](https://v2.tauri.app/) (and similar shells) host a **webview**. Your UI
is still a web app: a Leptos + Trunk build that uses
**[rangular](https://github.com/Interchouette-ITC/rangular)** components can run
inside that webview the same way it runs in Chrome.
```bash
make demo-desktop
make demo-desktop-build # Linux deb/AppImage, Windows NSIS
```

**[rangular](https://github.com/Interchouette-ITC/rangular)** still speaks DOM /
wasm, not egui / iced / GTK.
Details: [`demo-desktop/README.md`](demo-desktop/README.md).

```mermaid
flowchart TB
subgraph shell ["Desktop shell e.g. Tauri"]
subgraph shell ["Desktop shell Tauri"]
subgraph webview [Webview]
ui["Leptos CSR + rangular"]
end
Expand All @@ -279,7 +280,7 @@ docker pull interchouette/rangular-demo:latest
docker run --rm -p 8080:8080 interchouette/rangular-demo:latest
```

Live: https://rangular.interchouette.net/
Live: [https://rangular.interchouette.net](https://rangular.interchouette.net)

Details: [`demo/README.md`](demo/README.md).

Expand Down
40 changes: 40 additions & 0 deletions demo-desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Desktop demo (Tauri)

Thin [Tauri](https://v2.tauri.app/) 2 shell around the same Trunk / Leptos CSR SPA
in [`../demo/`](../demo/). No `invoke` commands: the webview loads the wasm
demo only.

Stack: **Tauri → Leptos → rangular**.

## Run

```bash
make demo-desktop
```

Opens a native window pointed at `http://127.0.0.1:4180/` (Trunk). If that port
is already serving the browser demo, the shell reuses it.

Release bundles (Linux `deb` / AppImage, Windows NSIS):

```bash
make demo-desktop-build
```

Artifacts under `demo-desktop/src-tauri/target/release/bundle/`.

## Linux dependencies

Build/run needs WebKitGTK 4.1 and GTK development packages (distro names vary),
for example on Debian/Ubuntu:

```bash
sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev
```

Also: Rust stable or nightly, [`trunk`](https://trunkrs.dev/) 0.21.x, and
`cargo install tauri-cli --version '^2'`.

## Icons

Generated from `docs/assets/logo-256.png` via `cargo tauri icon`.
4 changes: 4 additions & 0 deletions demo-desktop/src-tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target/
/gen/schemas
/icons/ios/
/icons/android/
Loading
Loading