Skip to content

Commit 93fdee8

Browse files
authored
feat: add dioxus support (#12)
1 parent f17f89f commit 93fdee8

File tree

10 files changed

+1073
-33
lines changed

10 files changed

+1073
-33
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Generated by Cargo
22
# will have compiled files and executables
3-
/target/
3+
**/target/**
44

55
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
66
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
77
Cargo.lock
88

99
# These are backup files generated by rustfmt
1010
**/*.rs.bk
11-
**/dist/*
11+
**/dist/*

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ exclude = ["assets", "examples"]
1515
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1616

1717
[dependencies]
18-
web-sys = { version = "0.3.64", default-features = false }
18+
web-sys = { version = "0.3", default-features = false }
1919
yew = { version = "0.21.0", default-features = false, optional = true }
20+
dioxus = { version = "0.5", optional = true }
2021

2122
[dev-dependencies]
2223
regex = "1.10.2"
2324
serde = { version = "1.0.193", features = ["derive"] }
2425

2526
[features]
26-
yew = ["dep:yew"]
27+
yew = ["dep:yew", ]
28+
dio = ["dioxus", ]
2729

2830
[profile.release]
2931
opt-level = "z"

examples/dioxus/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "input-rs-dioxus-example"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]
7+
dioxus = { version = "0.5.6", features = ["web"] }
8+
input-rs = { path = "../../", features = ["dio"] }
9+
dioxus-logger = "0.5.1"
10+
regex = "1.11.1"

examples/dioxus/Dioxus.toml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[application]
2+
3+
# App (Project) Name
4+
name = "input-rs"
5+
6+
# Dioxus App Default Platform
7+
# desktop, web
8+
default_platform = "web"
9+
10+
# `build` & `serve` dist path
11+
out_dir = "dist"
12+
13+
# resource (assets) file folder
14+
asset_dir = "assets"
15+
16+
[web.app]
17+
18+
# HTML title tag content
19+
title = "input-rs"
20+
21+
[web.watcher]
22+
23+
# when watcher trigger, regenerate the `index.html`
24+
reload_html = true
25+
26+
# which files or dirs will be watcher monitoring
27+
watch_path = ["src", "assets"]
28+
29+
# include `assets` in web platform
30+
[web.resource]
31+
32+
# CSS style file
33+
style = [
34+
# online cdn.
35+
"https://unpkg.com/[email protected]/dist/tailwind.min.css"
36+
]
37+
38+
# Javascript code file
39+
script = [
40+
# online cdn.
41+
"https://kit.fontawesome.com/8f223ead6e.js"
42+
]
43+
44+
[web.resource.dev]
45+
46+
# Javascript code file
47+
# serve: [dev-server] only
48+
script = []

examples/dioxus/README.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# 📚 Input RS Dioxus Tailwind Components
2+
3+
## 🛠️ Pre-requisites:
4+
5+
### 🐧 **Linux Users**
6+
7+
1. **Install [`rustup`](https://www.rust-lang.org/tools/install)**:
8+
9+
```sh
10+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
11+
```
12+
13+
1. Install [`Dioxus CLI`](https://dioxuslabs.com/learn/0.5/getting_started):
14+
15+
```sh
16+
cargo install dioxus-cli
17+
```
18+
19+
### 🪟 **Windows Users**
20+
21+
1. **Download and install `rustup`**: Follow the installation instructions [here](https://www.rust-lang.org/tools/install).
22+
23+
1. **Install [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install)**: Open PowerShell as administrator and run:
24+
25+
```sh
26+
wsl --install
27+
```
28+
29+
1. **Reset Network Stack**: In PowerShell (administrator mode), run:
30+
31+
```sh
32+
netsh int ip reset all
33+
netsh winsock reset
34+
```
35+
36+
1. **Install Linux packages in WSL**: Once inside your WSL terminal, update and install required dependencies:
37+
38+
```sh
39+
sudo apt update
40+
sudo apt install build-essential pkg-config libudev-dev
41+
```
42+
43+
1. Install [`Dioxus CLI`](https://dioxuslabs.com/learn/0.5/getting_started):
44+
45+
```sh
46+
cargo install dioxus-cli
47+
```
48+
49+
## 🚀 Building and Running
50+
51+
1. Fork/Clone the GitHub repository.
52+
53+
```sh
54+
git clone https://github.com/opensass/input-rs
55+
```
56+
57+
1. Navigate to the application directory.
58+
59+
```sh
60+
cd input-rs/examples/dioxus
61+
```
62+
63+
1. Run the client:
64+
65+
```sh
66+
dx serve --port 3000
67+
```
68+
69+
Navigate to http://localhost:3000 to explore the landing page.

0 commit comments

Comments
 (0)