Skip to content

Commit a076931

Browse files
authored
Merge pull request #73 from DioxusLabs/organization
SDK Reorganization, Async Callbacks, More Docs
2 parents a7b261e + d668e6a commit a076931

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2003
-1437
lines changed

.github/workflows/rust.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ on:
55
branches:
66
- main
77
paths:
8-
- sdk/**
8+
- packages/**
99
- examples/**
1010

1111
pull_request:
1212
types: [opened, synchronize, reopened, ready_for_review]
1313
branches:
1414
- main
1515
paths:
16-
- sdk/**
16+
- packages/**
1717
- examples/**
1818

1919
env:
@@ -42,5 +42,5 @@ jobs:
4242
- run: rustup target add wasm32-unknown-unknown
4343
- run: rustup component add clippy
4444
- uses: actions/checkout@v3
45-
- run: cargo clippy --package dioxus-sdk --target wasm32-unknown-unknown --tests --features wasm-testing -- -D warnings
46-
- run: cargo clippy --package dioxus-sdk --tests --features desktop-testing -- -D warnings
45+
- run: cargo clippy --workspace --all-targets --exclude *-example --target wasm32-unknown-unknown --tests --all-features -- -D warnings
46+
- run: cargo clippy --workspace --all-targets --tests --all-features -- -D warnings

.github/workflows/testing.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
branches:
77
- main
88
paths:
9-
- sdk/**
9+
- packages/**
1010
- examples/**
1111

1212
pull_request:
1313
types: [opened, synchronize, reopened, ready_for_review]
1414
branches:
1515
- main
1616
paths:
17-
- sdk/**
17+
- packages/**
1818
- examples/**
1919

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

3535
desktop:
@@ -39,5 +39,6 @@ jobs:
3939
steps:
4040
- uses: actions/checkout@v3
4141
- uses: Swatinem/rust-cache@v2
42-
- run: cargo build --package dioxus-sdk --verbose --no-default-features --features desktop-testing
43-
- run: cargo test --package dioxus-sdk --verbose --no-default-features --features desktop-testing
42+
- run: cargo build --all-targets --workspace --verbose --all-features
43+
- run: cargo test --all-targets --workspace --verbose --all-features
44+
- run: cargo test --workspace --verbose --all-features --doc

.vscode/settings.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"rust-analyzer.cargo.features": "all",
33
"rust-analyzer.check.features": "all",
4+
"rust-analyzer.check.allTargets": true,
5+
//"rust-analyzer.cargo.target": "wasm32-unknown-unknown",
46
}

Cargo.toml

+52-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,55 @@
11
[workspace]
2-
resolver = "2"
3-
members = ["sdk", "examples/*"]
2+
resolver = "3"
3+
members = ["packages/*", "examples/*"]
4+
5+
package.authors = [
6+
"Dioxus Labs",
7+
"Jonathan Kelley",
8+
"DogeDark",
9+
"marc2332",
10+
"ealmloff",
11+
]
12+
package.edition = "2024"
13+
package.license = "MIT OR Apache-2.0"
14+
package.homepage = "https://dioxuslabs.com"
15+
package.repository = "https://github.com/DioxusLabs/sdk/"
416

517
[workspace.dependencies]
6-
dioxus-sdk = { path = "./sdk" }
7-
dioxus = { version = "0.6.0" }
8-
dioxus-desktop = { version = "0.6.0" }
9-
dioxus-signals = { version = "0.6.0" }
18+
# Workspace
19+
dioxus-sdk = { path = "packages/sdk" }
20+
dioxus-time = { path = "packages/time" }
21+
dioxus-storage = { path = "packages/storage" }
22+
dioxus-geolocation = { path = "packages/geolocation" }
23+
dioxus-notification = { path = "packages/notification" }
24+
dioxus-sync = { path = "packages/sync" }
25+
dioxus-util = { path = "packages/util" }
26+
dioxus-window = { path = "packages/window" }
27+
28+
# Dioxus
29+
dioxus = "0.6.0"
30+
dioxus-signals = "0.6.0"
31+
dioxus-desktop = "0.6.0"
32+
dioxus-config-macro = "0.6.0"
33+
34+
# Deps
35+
cfg-if = "1.0.0"
36+
tokio = "1.43.0"
37+
futures = "0.3.31"
38+
futures-util = "0.3.31"
39+
40+
serde = "1.0.163"
41+
wasm-bindgen = "0.2.100"
42+
web-sys = "0.3.77"
43+
js-sys = "0.3.77"
44+
45+
[profile]
46+
47+
[profile.wasm-dev]
48+
inherits = "dev"
49+
opt-level = 1
50+
51+
[profile.server-dev]
52+
inherits = "dev"
53+
54+
[profile.android-dev]
55+
inherits = "dev"

README.md

+37-27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22
<h1>🧰 Dioxus Development Kit 🚀</h1>
3-
<p><strong>A platform agnostic library for supercharging your productivity with Dioxus.</strong></p>
3+
<p><strong>Cross-platform crates for supercharging your productivity with Dioxus.</strong></p>
44
</div>
55

66
<div align="center">
@@ -23,35 +23,42 @@
2323

2424
-----
2525

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

29-
`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!
29+
`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.
3030

31-
**Features**
32-
- [x] Geolocation - (Web, Windows)
33-
- [x] Storage - (Web, Desktop)
34-
- [x] Clipboard - (Desktop)
35-
- [x] Notifications - (Desktop)
36-
- [x] Color Scheme - (Web)
37-
- [x] Utility Hooks
38-
- [x] use_channel
39-
- [x] use_window_size
40-
- [x] use_interval
41-
- [x] use_debounce
42-
- [ ] use_timeout
31+
## Features
32+
- `dioxus-storage`
33+
- `dioxus-geolocation` - Web & Windows
34+
- `dioxus-notifications` - Desktop
35+
- `dioxus-window`
36+
- [x] Theme - (Web, Windows, Mac)
37+
- [x] Window Size
38+
- `dioxus-time`
39+
- [x] Sleep
40+
- [x] Intervals
41+
- [x] Debounce
42+
- [x] Timeouts
43+
- `dioxus-sync`
44+
- [x] Channels
45+
- `dioxus-util`
46+
- [x] `use_root_scroll`
4347
- [ ] Camera
4448
- [ ] WiFi
4549
- [ ] Bluetooth
4650

4751
Geolocation example:
4852

4953
```rust
50-
use dioxus_sdk::geolocation::{
54+
// dioxus-geolocation= { version = "*" }
55+
use dioxus::prelude::*;
56+
use dioxus_geolocation::{
5157
init_geolocator, use_geolocation, PowerMode
5258
};
5359

54-
fn app() -> Element {
60+
#[component]
61+
fn App() -> Element {
5562
let geolocator = init_geolocator(PowerMode::High).unwrap();
5663
let coords = use_geolocation();
5764

@@ -69,22 +76,25 @@ fn app() -> Element {
6976
}
7077
```
7178

72-
## Platform Support
73-
### Clipboard
74-
75-
On linux you need the x11 library to use the clipboard abstraction:
76-
```
77-
sudo apt-get install xorg-dev
78-
```
79-
8079
## Usage
8180
You can add `dioxus-sdk` to your application by adding it to your dependencies.
8281
```toml
8382
[dependencies]
84-
dioxus-sdk = { version = "0.6", features = [] }
83+
dioxus-sdk = { version = "0.7", features = [] }
8584
```
8685

86+
### Dioxus Compatibility
87+
This table represents the compatibility between this crate and Dioxus versions.
88+
The crate version supports a Dioxus version up until the next crate version in the table.
89+
90+
E.g. if crate version `0.1` supported Dioxus `0.6` and crate version `0.4` supported Dioxus `0.7`, crate versions `0.1`, `0.2`, and `0.3` would support Dioxus `0.6`.
91+
92+
| Crate Version | Dioxus Version |
93+
| ------------- | -------------- |
94+
| 0.7 | 0.6 |
95+
| 0.5 | 0.5 |
96+
8797
## License
8898
This project is dual licensed under the [MIT](./LICENSE-MIT) and [Apache 2.0](./LICENSE-APACHE) licenses.
8999

90-
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.
100+
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.

examples/README.md

-16
This file was deleted.

examples/channel/Cargo.toml

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
[package]
2-
name = "channel"
2+
name = "channel-example"
33
version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
dioxus-sdk = { workspace = true, features = ["channel"] }
8-
dioxus = { workspace = true, features = ["web"] }
7+
dioxus = { workspace = true }
8+
dioxus-sync = { workspace = true }
99

10-
11-
log = "0.4.6"
12-
13-
# WebAssembly Debug
14-
wasm-logger = "0.2.0"
15-
console_error_panic_hook = "0.1.7"
10+
[features]
11+
default = ["desktop"]
12+
web = ["dioxus/web"]
13+
desktop = ["dioxus/desktop"]

examples/channel/Dioxus.toml

-42
This file was deleted.

examples/channel/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# use_channel
22

3-
Learn how to use `use_channel`.
3+
Learn how to use `use_channel` from `dioxus-sync`.
44

55
Run:
66

7-
```dioxus serve```
7+
```dx serve```

examples/channel/public/favicon.ico

-130 KB
Binary file not shown.

examples/channel/src/main.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
use dioxus::prelude::*;
2-
use dioxus_sdk::utils::channel::{use_channel, use_listen_channel};
1+
use dioxus::{logger::tracing::info, prelude::*};
2+
use dioxus_sync::channel::{use_channel, use_listen_channel};
33

44
fn main() {
5-
// init debug tool for WebAssembly
6-
wasm_logger::init(wasm_logger::Config::default());
7-
console_error_panic_hook::set_once();
8-
9-
launch(app);
5+
launch(App);
106
}
117

12-
fn app() -> Element {
8+
#[component]
9+
fn App() -> Element {
1310
let channel = use_channel::<String>(5);
1411

1512
use_listen_channel(&channel, |message| async {
1613
match message {
17-
Ok(value) => log::info!("Incoming message: {value}"),
18-
Err(err) => log::info!("Error: {err:?}"),
14+
Ok(value) => info!("Incoming message: {value}"),
15+
Err(err) => info!("Error: {err:?}"),
1916
}
2017
});
2118

examples/clipboard/Cargo.toml

-8
This file was deleted.

0 commit comments

Comments
 (0)