Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dioxus support #12

Merged
merged 1 commit into from
Dec 6, 2024
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Generated by Cargo
# will have compiled files and executables
/target/
**/target/**

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

# These are backup files generated by rustfmt
**/*.rs.bk
**/dist/*
**/dist/*
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ exclude = ["assets", "examples"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
web-sys = { version = "0.3.64", default-features = false }
web-sys = { version = "0.3", default-features = false }
yew = { version = "0.21.0", default-features = false, optional = true }
dioxus = { version = "0.5", optional = true }

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

[features]
yew = ["dep:yew"]
yew = ["dep:yew", ]
dio = ["dioxus", ]

[profile.release]
opt-level = "z"
Expand Down
10 changes: 10 additions & 0 deletions examples/dioxus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "input-rs-dioxus-example"
version = "0.1.0"
edition = "2021"

[dependencies]
dioxus = { version = "0.5.6", features = ["web"] }
input-rs = { path = "../../", features = ["dio"] }
dioxus-logger = "0.5.1"
regex = "1.11.1"
48 changes: 48 additions & 0 deletions examples/dioxus/Dioxus.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[application]

# App (Project) Name
name = "input-rs"

# Dioxus App Default Platform
# desktop, web
default_platform = "web"

# `build` & `serve` dist path
out_dir = "dist"

# resource (assets) file folder
asset_dir = "assets"

[web.app]

# HTML title tag content
title = "input-rs"

[web.watcher]

# when watcher trigger, regenerate the `index.html`
reload_html = true

# which files or dirs will be watcher monitoring
watch_path = ["src", "assets"]

# include `assets` in web platform
[web.resource]

# CSS style file
style = [
# online cdn.
"https://unpkg.com/[email protected]/dist/tailwind.min.css"
]

# Javascript code file
script = [
# online cdn.
"https://kit.fontawesome.com/8f223ead6e.js"
]

[web.resource.dev]

# Javascript code file
# serve: [dev-server] only
script = []
69 changes: 69 additions & 0 deletions examples/dioxus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 📚 Input RS Dioxus Tailwind Components

## 🛠️ Pre-requisites:

### 🐧 **Linux Users**

1. **Install [`rustup`](https://www.rust-lang.org/tools/install)**:

```sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

1. Install [`Dioxus CLI`](https://dioxuslabs.com/learn/0.5/getting_started):

```sh
cargo install dioxus-cli
```

### 🪟 **Windows Users**

1. **Download and install `rustup`**: Follow the installation instructions [here](https://www.rust-lang.org/tools/install).

1. **Install [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install)**: Open PowerShell as administrator and run:

```sh
wsl --install
```

1. **Reset Network Stack**: In PowerShell (administrator mode), run:

```sh
netsh int ip reset all
netsh winsock reset
```

1. **Install Linux packages in WSL**: Once inside your WSL terminal, update and install required dependencies:

```sh
sudo apt update
sudo apt install build-essential pkg-config libudev-dev
```

1. Install [`Dioxus CLI`](https://dioxuslabs.com/learn/0.5/getting_started):

```sh
cargo install dioxus-cli
```

## 🚀 Building and Running

1. Fork/Clone the GitHub repository.

```sh
git clone https://github.com/opensass/input-rs
```

1. Navigate to the application directory.

```sh
cd input-rs/examples/dioxus
```

1. Run the client:

```sh
dx serve --port 3000
```

Navigate to http://localhost:3000 to explore the landing page.
Loading
Loading