Skip to content

SDK Reorganization, Async Callbacks, More Docs #73

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

Merged
merged 29 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
70ac938
progress: reorganization
DogeDark Feb 19, 2025
6dba54c
revision: add dep from rebase
DogeDark Feb 19, 2025
533ce72
progress: dioxus-window, crate meta, examples
DogeDark Feb 19, 2025
14e776d
feat: hydration support theme & window size
DogeDark Feb 19, 2025
ab76a12
progress: improved size & theme
DogeDark Feb 26, 2025
974c88e
progress: improved docs & apis
DogeDark Feb 26, 2025
16dd11c
revision: readd sdk crate
DogeDark Feb 26, 2025
3fd4d38
feat: sleep fn for time crate
DogeDark Feb 27, 2025
f2399b9
fix: ci, storage web
DogeDark Feb 28, 2025
ee6acb5
fix: notification, sync, CI
DogeDark Feb 28, 2025
3bfe314
fix: ci doc test
DogeDark Feb 28, 2025
60c5358
progress: updated main readme
DogeDark Feb 28, 2025
34fe14b
feat: timeout
DogeDark Mar 1, 2025
7fb5265
feat: timeout docs
DogeDark Mar 4, 2025
e9db591
fix: clippy, fmt
DogeDark Mar 4, 2025
6ce21d2
revision: debounce
DogeDark Mar 4, 2025
7311c39
feat: async interval
DogeDark Mar 4, 2025
41fcf3a
revision: readme
DogeDark Mar 6, 2025
e9de516
revision: clippy examples
DogeDark Mar 6, 2025
f0b51b0
fix: sync readme
DogeDark Mar 6, 2025
2caf13a
fix: doc links, remove example readme
DogeDark Mar 6, 2025
e99afd2
revision: use_theme to use_system_theme
DogeDark Mar 6, 2025
2fdd60a
feat: version table for sdk, placeholder util crate
DogeDark Mar 11, 2025
86030dc
fix: fmt
DogeDark Mar 11, 2025
df76a14
merge: scroll
DogeDark Apr 12, 2025
fb1340f
fix: ci
DogeDark Apr 12, 2025
ba6533b
revision: make alpha
DogeDark Apr 18, 2025
73bbf44
revision: final touches
DogeDark Apr 18, 2025
d668e6a
fix: fmt
DogeDark Apr 18, 2025
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
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
branches:
- main
paths:
- sdk/**
- packages/**
- examples/**

pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
paths:
- sdk/**
- packages/**
- examples/**

env:
Expand Down Expand Up @@ -42,5 +42,5 @@ jobs:
- run: rustup target add wasm32-unknown-unknown
- run: rustup component add clippy
- uses: actions/checkout@v3
- run: cargo clippy --package dioxus-sdk --target wasm32-unknown-unknown --tests --features wasm-testing -- -D warnings
- run: cargo clippy --package dioxus-sdk --tests --features desktop-testing -- -D warnings
- run: cargo clippy --workspace --all-targets --exclude *-example --target wasm32-unknown-unknown --tests --all-features -- -D warnings
- run: cargo clippy --workspace --all-targets --tests --all-features -- -D warnings
11 changes: 6 additions & 5 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
branches:
- main
paths:
- sdk/**
- packages/**
- examples/**

pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
paths:
- sdk/**
- packages/**
- examples/**

env:
Expand All @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v3
- run: rustup target add wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- run: cargo build --package dioxus-sdk --verbose --target wasm32-unknown-unknown --no-default-features --features wasm-testing
- run: cargo build --all-targets --workspace --exclude *-example --verbose --target wasm32-unknown-unknown --all-features
# need to run tests here

desktop:
Expand All @@ -39,5 +39,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- run: cargo build --package dioxus-sdk --verbose --no-default-features --features desktop-testing
- run: cargo test --package dioxus-sdk --verbose --no-default-features --features desktop-testing
- run: cargo build --all-targets --workspace --verbose --all-features
- run: cargo test --all-targets --workspace --verbose --all-features
- run: cargo test --workspace --verbose --all-features --doc
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"rust-analyzer.cargo.features": "all",
"rust-analyzer.check.features": "all",
"rust-analyzer.check.allTargets": true,
//"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
}
48 changes: 43 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
[workspace]
resolver = "2"
members = ["sdk", "examples/*"]
members = ["packages/*", "examples/*"]

package.authors = ["Dioxus Labs", "Jonathan Kelley", "DogeDark", "marc2332", "ealmloff"]
package.edition = "2021"
package.license = "MIT OR Apache-2.0"
package.homepage = "https://dioxuslabs.com"
package.repository = "https://github.com/DioxusLabs/sdk/"

[workspace.dependencies]
dioxus-sdk = { path = "./sdk" }
dioxus = { version = "0.6.0" }
dioxus-desktop = { version = "0.6.0" }
dioxus-signals = { version = "0.6.0" }
# Workspace
dioxus-time = { path = "packages/time" }
dioxus-storage = { path = "packages/storage" }
dioxus-geolocation = { path = "packages/geolocation" }
dioxus-notification = { path = "packages/notification" }
dioxus-sync = { path = "packages/sync" }
dioxus-window = { path = "packages/window" }

# Dioxus
dioxus = "0.6.0"
dioxus-signals = "0.6.0"
dioxus-desktop = "0.6.0"
dioxus-config-macro = "0.6.0"

# Deps
cfg-if = "1.0.0"
tokio = "1.43.0"
futures = "0.3.31"
futures-util = "0.3.31"

wasm-bindgen = "0.2.100"
web-sys = "0.3.77"
js-sys = "0.3.77"

# DX Profiles
[profile]

[profile.wasm-dev]
inherits = "dev"
opt-level = 1

[profile.server-dev]
inherits = "dev"

[profile.android-dev]
inherits = "dev"
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<h1>🧰 Dioxus Development Kit 🚀</h1>
<p><strong>A platform agnostic library for supercharging your productivity with Dioxus.</strong></p>
<p><strong>Cross-platform crates for supercharging your productivity with Dioxus.</strong></p>
</div>

<div align="center">
Expand All @@ -23,35 +23,40 @@

-----

<p align="center"><i>This library is still under development. Expect breaking changes!</i></p>
<p align="center"><i>These crates are still under development. Expect breaking changes!</i></p>
<br/>

`dioxus-sdk` is a development kit for Dioxus that provides abstractions for your Dioxus app. Abstractions included are notifications, clipboard, geolocation and storage with more to come!
`dioxus-sdk` is a development kit for Dioxus that provides cross-platform APIs for your Dioxus app. SDK is organized into many different crates accessible through the `dioxus-sdk` crate with the corresponding feature flags.

**Features**
- [x] Geolocation - (Web, Windows)
- [x] Storage - (Web, Desktop)
- [x] Clipboard - (Desktop)
- [x] Notifications - (Desktop)
- [x] Color Scheme - (Web)
- [x] Utility Hooks
- [x] use_channel
- [x] use_window_size
- [x] use_interval
- [x] use_debounce
- [ ] use_timeout
## Features
- `dioxus-storage`
- `dioxus-geolocation` - Web & Windows
- `dioxus-notifications` - Desktop
- `dioxus-window`
- [x] Theme - (Web, Windows, Mac)
- [x] Window Size
- `dioxus-time`
- [x] Sleep
- [x] Intervals
- [x] Debounce
- [x] Timeouts
- `dioxus-sync`
- [x] Channels
- [ ] Camera
- [ ] WiFi
- [ ] Bluetooth

Geolocation example:

```rust
// dioxus-sdk = { version = "*", features = ["geolocation"] }
use dioxus::prelude::*;
use dioxus_sdk::geolocation::{
init_geolocator, use_geolocation, PowerMode
};

fn app() -> Element {
#[component]
fn App() -> Element {
let geolocator = init_geolocator(PowerMode::High).unwrap();
let coords = use_geolocation();

Expand All @@ -69,22 +74,14 @@ fn app() -> Element {
}
```

## Platform Support
### Clipboard

On linux you need the x11 library to use the clipboard abstraction:
```
sudo apt-get install xorg-dev
```

## Usage
You can add `dioxus-sdk` to your application by adding it to your dependencies.
```toml
[dependencies]
dioxus-sdk = { version = "0.6", features = [] }
dioxus-sdk = { version = "0.7", features = [] }
```

## License
This project is dual licensed under the [MIT](./LICENSE-MIT) and [Apache 2.0](./LICENSE-APACHE) licenses.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in `dioxus-sdk` by you, shall be licensed as MIT or Apache 2.0, without any additional terms or conditions.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in `dioxus-sdk` or any of it's crates, by you, shall be licensed as MIT or Apache 2.0, without any additional terms or conditions.
11 changes: 4 additions & 7 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Examples

### [`system_theme`](./system_theme/)
Learn how to use `use_system_theme`.
Learn how to use `use_theme` from `dioxus-window`.

### [`geolocation`](./geolocation/)
Learn how to use the `geolocation` abstraction.
Learn how to use `dioxus-geolocation`.

### [`channel`](./channel/)
Learn how to use the `channel` abstraction.
Learn how to use the `use_channel` hook in `dioxus-sync`.

### [`storage`](./storage/)
Learn how to use the `storage` abstraction.

### [`clipboard`](./clipboard/)
Learn how to use the `clipboard` abstraction.
Learn how to use `dioxus-storage`.
16 changes: 7 additions & 9 deletions examples/channel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[package]
name = "channel"
name = "channel-example"
version = "0.1.0"
edition = "2021"

[dependencies]
dioxus-sdk = { workspace = true, features = ["channel"] }
dioxus = { workspace = true, features = ["web"] }
dioxus = { workspace = true }
dioxus-sync = { workspace = true }


log = "0.4.6"

# WebAssembly Debug
wasm-logger = "0.2.0"
console_error_panic_hook = "0.1.7"
[features]
default = ["desktop"]
web = ["dioxus/web"]
desktop = ["dioxus/desktop"]
42 changes: 0 additions & 42 deletions examples/channel/Dioxus.toml

This file was deleted.

4 changes: 2 additions & 2 deletions examples/channel/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# use_channel

Learn how to use `use_channel`.
Learn how to use `use_channel` from `dioxus-sync`.

Run:

```dioxus serve```
```dx serve```
Binary file removed examples/channel/public/favicon.ico
Binary file not shown.
17 changes: 7 additions & 10 deletions examples/channel/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
use dioxus::prelude::*;
use dioxus_sdk::utils::channel::{use_channel, use_listen_channel};
use dioxus::{logger::tracing::info, prelude::*};
use dioxus_sync::channel::{use_channel, use_listen_channel};

fn main() {
// init debug tool for WebAssembly
wasm_logger::init(wasm_logger::Config::default());
console_error_panic_hook::set_once();

launch(app);
launch(App);
}

fn app() -> Element {
#[component]
fn App() -> Element {
let channel = use_channel::<String>(5);

use_listen_channel(&channel, |message| async {
match message {
Ok(value) => log::info!("Incoming message: {value}"),
Err(err) => log::info!("Error: {err:?}"),
Ok(value) => info!("Incoming message: {value}"),
Err(err) => info!("Error: {err:?}"),
}
});

Expand Down
8 changes: 0 additions & 8 deletions examples/clipboard/Cargo.toml

This file was deleted.

43 changes: 0 additions & 43 deletions examples/clipboard/src/main.rs

This file was deleted.

Loading