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
37 changes: 19 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ depinfo = { path = "packages/depinfo", version = "0.7.0-alpha.3" }
warnings = { version = "0.2.1" }

# blitz
blitz-dom = { version = "=0.1.0-alpha.5", default-features = false }
blitz-net = { version = "=0.1.0-alpha.5" }
blitz-paint = { version = "=0.1.0-alpha.5" }
blitz-traits = { version = "=0.1.0-alpha.5" }
blitz-shell = { version = "=0.1.0-alpha.5", default-features = false }
blitz-dom = { version = "=0.1.0-rc.1", default-features = false }
blitz-net = { version = "=0.1.0-rc.1" }
blitz-paint = { version = "=0.1.0-rc.1" }
blitz-traits = { version = "=0.1.0-rc.1" }
blitz-shell = { version = "=0.1.0-rc.1", default-features = false }
anyrender = { version = "0.5", default-features = false }
anyrender_vello = { version = "0.5", default-features = false }
wgpu = { version = "24.0" }

# a fork of pretty please for tests - let's get off of this if we can!
Expand Down
14 changes: 7 additions & 7 deletions examples/native-headless-in-bevy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ publish = false
tracing = ["dep:tracing-subscriber", "dioxus-native-dom/tracing"]

[dependencies]
anyrender_vello = "0.4.1"
async-std = "1.13"
bevy = { version = "0.16" }
dioxus = { workspace = true }
dioxus-native-dom = { workspace = true }
blitz-dom = { workspace = true, default-features = true }
blitz-paint = { workspace = true, default-features = true }
blitz-traits = { workspace = true, default-features = true }
anyrender_vello = { workspace = true }
wgpu = { workspace = true }
tracing-subscriber = { workspace = true, optional = true }
bevy = { version = "0.16" }
async-std = "1.13"
crossbeam-channel = "0.5"
dioxus = { workspace = true }
dioxus-native-dom = { path = "../../packages/native-dom" }
paste = "1.0"
rustc-hash = "1"
tracing-subscriber = { workspace = true, optional = true }
vello = "0.5"
wgpu = { workspace = true }

16 changes: 8 additions & 8 deletions examples/native-headless-in-bevy/src/dioxus_in_bevy_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use bevy::{
};

use anyrender_vello::{CustomPaintSource, VelloScenePainter};
use blitz_dom::Document as _;
use blitz_dom::{Document as _, DocumentConfig};
use blitz_paint::paint_scene;
use blitz_traits::events::{
BlitzKeyEvent, BlitzMouseButtonEvent, KeyState, MouseEventButton, MouseEventButtons, UiEvent,
Expand Down Expand Up @@ -49,7 +49,7 @@ impl<UIProps: std::marker::Send + std::marker::Sync + std::clone::Clone + 'stati
// The viewport will be set in setup_ui after we get the window size
let vdom = VirtualDom::new_with_props(self.ui, self.props.clone());
// FIXME add a NetProvider
let mut dioxus_doc = DioxusDocument::new(vdom, None);
let mut dioxus_doc = DioxusDocument::new(vdom, DocumentConfig::default());
dioxus_doc.initial_build();
dioxus_doc.resolve();

Expand Down Expand Up @@ -258,7 +258,7 @@ fn update_ui(
if let (Some(texture), Some(mut vello_renderer)) = ((*cached_texture).as_ref(), vello_renderer)
{
// Poll the vdom
dioxus_doc.poll(std::task::Context::from_waker(&waker));
dioxus_doc.poll(Some(std::task::Context::from_waker(&waker)));

// Refresh the document
dioxus_doc.resolve();
Expand Down Expand Up @@ -383,7 +383,7 @@ fn handle_mouse_events(
for cursor_event in cursor_moved.read() {
mouse_state.x = cursor_event.position.x;
mouse_state.y = cursor_event.position.y;
dioxus_doc.handle_event(UiEvent::MouseMove(BlitzMouseButtonEvent {
dioxus_doc.handle_ui_event(UiEvent::MouseMove(BlitzMouseButtonEvent {
x: mouse_state.x,
y: mouse_state.y,
button: Default::default(),
Expand All @@ -408,7 +408,7 @@ fn handle_mouse_events(
match event.state {
ButtonState::Pressed => {
mouse_state.buttons |= buttons_blitz;
dioxus_doc.handle_event(UiEvent::MouseDown(BlitzMouseButtonEvent {
dioxus_doc.handle_ui_event(UiEvent::MouseDown(BlitzMouseButtonEvent {
x: mouse_state.x,
y: mouse_state.y,
button: button_blitz,
Expand All @@ -418,7 +418,7 @@ fn handle_mouse_events(
}
ButtonState::Released => {
mouse_state.buttons &= !buttons_blitz;
dioxus_doc.handle_event(UiEvent::MouseUp(BlitzMouseButtonEvent {
dioxus_doc.handle_ui_event(UiEvent::MouseUp(BlitzMouseButtonEvent {
x: mouse_state.x,
y: mouse_state.y,
button: button_blitz,
Expand Down Expand Up @@ -495,10 +495,10 @@ fn handle_keyboard_events(

match key_state {
KeyState::Pressed => {
dioxus_doc.handle_event(UiEvent::KeyDown(blitz_key_event));
dioxus_doc.handle_ui_event(UiEvent::KeyDown(blitz_key_event));
}
KeyState::Released => {
dioxus_doc.handle_event(UiEvent::KeyUp(blitz_key_event));
dioxus_doc.handle_ui_event(UiEvent::KeyUp(blitz_key_event));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/native-headless/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ tracing = ["dep:tracing-subscriber", "dioxus-native-dom/tracing"]

[dependencies]
dioxus = { workspace = true, default-features = false, features = ["html", "hooks", "signals"] }
dioxus-native-dom = { path = "../../packages/native-dom" }
anyrender_vello = "0.4.1"
dioxus-native-dom = { workspace = true }
anyrender_vello = { workspace = true }
vello = "0.5"
rustc-hash = "1"
futures-util = { workspace = true }
Expand Down
15 changes: 10 additions & 5 deletions examples/native-headless/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! (this example is not really intended to be run as-is, and requires you to fill
//! in the missing pieces)
use anyrender_vello::{wgpu_context::WGPUContext, CustomPaintSource, VelloScenePainter};
use blitz_dom::Document as _;
use blitz_dom::{Document as _, DocumentConfig};
use blitz_paint::paint_scene;
use blitz_traits::{
events::{BlitzMouseButtonEvent, MouseEventButton, MouseEventButtons, UiEvent},
Expand Down Expand Up @@ -49,8 +49,13 @@ fn main() {
// Create the dioxus virtual dom and the dioxus-native document
// It is important to set the width, height, and scale factor on the document as these are used for layout.
let vdom = VirtualDom::new(app);
let mut dioxus_doc = DioxusDocument::new(vdom, None);
dioxus_doc.set_viewport(Viewport::new(WIDTH, HEIGHT, SCALE_FACTOR, COLOR_SCHEME));
let mut dioxus_doc = DioxusDocument::new(
vdom,
DocumentConfig {
viewport: Some(Viewport::new(WIDTH, HEIGHT, SCALE_FACTOR, COLOR_SCHEME)),
..Default::default()
},
);

// Setup a WGPU Device and Queue
//
Expand Down Expand Up @@ -95,7 +100,7 @@ fn main() {
// =============

// Poll the vdom
dioxus_doc.poll(Context::from_waker(&waker));
dioxus_doc.poll(Some(Context::from_waker(&waker)));

// Create a `VelloScenePainter` to paint into
let mut custom_paint_sources =
Expand Down Expand Up @@ -151,7 +156,7 @@ fn main() {
buttons: MouseEventButtons::Primary, // keep track of all pressed buttons
mods: Modifiers::empty(), // ctrl, alt, shift, etc
});
dioxus_doc.handle_event(event);
dioxus_doc.handle_ui_event(event);

// Trigger a poll via your event loop (or wait for next frame)
}
Expand Down
7 changes: 5 additions & 2 deletions packages/native-dom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ autofocus = []

[dependencies]
# Blitz dependencies
blitz-dom = { version = "=0.1.0-alpha.5", default-features = false }
blitz-traits = { version = "=0.1.0-alpha.5" }
blitz-dom = { workspace = true, default-features = false }
blitz-traits = { workspace = true }

# DioxusLabs dependencies
dioxus-core = { workspace = true }
Expand All @@ -35,6 +35,9 @@ tracing = { workspace = true, optional = true }
rustc-hash = { workspace = true }
futures-util = { workspace = true }

[dev-dependencies]
dioxus = { workspace = true }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Loading
Loading