From 3a565334e4867bed07e96c7a3c194ca848ac58ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Sat, 26 Jul 2025 21:42:31 +0200 Subject: [PATCH 1/2] feat: add action call --- Cargo.lock | 7 +- Cargo.toml | 1 + examples/dioxus-axum/Cargo.toml | 4 +- examples/leptos-axum/Cargo.toml | 2 +- examples/leptos-axum/src/app.rs | 19 ++++- examples/leptos-axum/src/lib.rs | 9 ++- examples/leptos-axum/src/main.rs | 7 +- packages/core/shield/src/action.rs | 10 ++- packages/core/shield/src/form.rs | 50 ++++++------ packages/core/shield/src/method.rs | 8 +- packages/core/shield/src/shield.rs | 53 ++++++++++-- packages/core/shield/src/shield_dyn.rs | 37 ++++++++- .../integrations/shield-axum/src/extract.rs | 6 +- .../shield-axum/src/routes/action.rs | 27 +++---- .../shield-dioxus-axum/Cargo.toml | 2 +- .../shield-dioxus-axum/src/integration.rs | 2 +- .../integrations/shield-dioxus/Cargo.toml | 7 +- .../integrations/shield-dioxus/src/lib.rs | 1 + .../shield-dioxus/src/routes/action.rs | 31 ++++++- .../integrations/shield-leptos/Cargo.toml | 2 + .../integrations/shield-leptos/src/lib.rs | 4 + .../integrations/shield-leptos/src/router.rs | 12 +++ .../integrations/shield-leptos/src/routes.rs | 3 + .../shield-leptos/src/routes/action.rs | 80 +++++++++++++++++++ .../styles/shield-bootstrap/src/dioxus.rs | 31 ++----- .../shield-bootstrap/src/dioxus/form.rs | 41 ++++++++++ .../shield-bootstrap/src/dioxus/input.rs | 33 ++++++++ .../styles/shield-bootstrap/src/leptos.rs | 41 ++-------- .../shield-bootstrap/src/leptos/form.rs | 22 +++++ .../shield-bootstrap/src/leptos/input.rs | 33 ++++++++ 30 files changed, 460 insertions(+), 125 deletions(-) create mode 100644 packages/integrations/shield-leptos/src/router.rs create mode 100644 packages/integrations/shield-leptos/src/routes.rs create mode 100644 packages/integrations/shield-leptos/src/routes/action.rs create mode 100644 packages/styles/shield-bootstrap/src/dioxus/form.rs create mode 100644 packages/styles/shield-bootstrap/src/dioxus/input.rs create mode 100644 packages/styles/shield-bootstrap/src/leptos/form.rs create mode 100644 packages/styles/shield-bootstrap/src/leptos/input.rs diff --git a/Cargo.lock b/Cargo.lock index 10c6efc..33259f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5402,6 +5402,8 @@ version = "0.0.4" dependencies = [ "async-trait", "dioxus", + "dioxus-server", + "serde_json", "shield", ] @@ -5410,7 +5412,7 @@ name = "shield-dioxus-axum" version = "0.0.4" dependencies = [ "async-trait", - "dioxus", + "dioxus-server", "shield", "shield-axum", "shield-dioxus", @@ -5489,6 +5491,7 @@ dependencies = [ "leptos_meta", "leptos_router", "shield", + "shield-bootstrap", "shield-leptos", "shield-leptos-axum", "shield-memory", @@ -5520,7 +5523,9 @@ version = "0.0.4" dependencies = [ "async-trait", "leptos", + "leptos_router", "serde", + "serde_json", "shield", ] diff --git a/Cargo.toml b/Cargo.toml index f80c162..f2aa27f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ bon = "3.3.2" chrono = "0.4.39" console_error_panic_hook = "0.1.2" dioxus = "0.7.0-alpha.1" +dioxus-server = { version = "0.7.0-alpha.1", default-features = false } futures = "0.3.31" http = "1.2.0" leptos = "0.8.0-beta" diff --git a/examples/dioxus-axum/Cargo.toml b/examples/dioxus-axum/Cargo.toml index 68f891e..6ef10ff 100644 --- a/examples/dioxus-axum/Cargo.toml +++ b/examples/dioxus-axum/Cargo.toml @@ -10,7 +10,6 @@ repository.workspace = true version.workspace = true [features] -default = ["server"] # TODO: Enabling these triggers multiple RustSec advisories. # desktop = ["dioxus/desktop"] # mobile = ["dioxus/mobile"] @@ -22,13 +21,14 @@ server = [ "dep:tokio", "dep:tower-sessions", "dioxus/server", + "shield-dioxus/server", "shield-memory/method-oidc", ] web = ["dioxus/web"] [dependencies] axum = { workspace = true, optional = true } -dioxus = { workspace = true, features = ["router", "fullstack"] } +dioxus = { workspace = true, features = ["fullstack", "router"] } shield.workspace = true shield-bootstrap = { workspace = true, features = ["dioxus"] } shield-dioxus.workspace = true diff --git a/examples/leptos-axum/Cargo.toml b/examples/leptos-axum/Cargo.toml index ea2a753..884d6ff 100644 --- a/examples/leptos-axum/Cargo.toml +++ b/examples/leptos-axum/Cargo.toml @@ -44,7 +44,7 @@ leptos_axum = { workspace = true, optional = true } leptos_meta.workspace = true leptos_router.workspace = true shield.workspace = true -# shield-bootstrap = { workspace = true, features = ["leptos"] } +shield-bootstrap = { workspace = true, features = ["leptos"] } shield-leptos.workspace = true shield-leptos-axum = { workspace = true, features = [ "utoipa", diff --git a/examples/leptos-axum/src/app.rs b/examples/leptos-axum/src/app.rs index 9841806..9dcf9a6 100644 --- a/examples/leptos-axum/src/app.rs +++ b/examples/leptos-axum/src/app.rs @@ -1,11 +1,12 @@ use leptos::prelude::*; use leptos_meta::{MetaTags, Title, provide_meta_context}; use leptos_router::{ - components::{Route, Router, Routes}, + components::{Outlet, ParentRoute, Router, Routes}, path, }; +use shield_leptos::ShieldRouter; -use crate::home::HomePage; +// use crate::home::HomePage; pub fn shell(options: LeptosOptions) -> impl IntoView { view! { @@ -14,6 +15,14 @@ pub fn shell(options: LeptosOptions) -> impl IntoView { + + + @@ -35,7 +44,11 @@ pub fn App() -> impl IntoView {
- + // + + + +
diff --git a/examples/leptos-axum/src/lib.rs b/examples/leptos-axum/src/lib.rs index 85a43a3..341cff1 100644 --- a/examples/leptos-axum/src/lib.rs +++ b/examples/leptos-axum/src/lib.rs @@ -4,10 +4,17 @@ mod home; #[cfg(feature = "hydrate")] #[wasm_bindgen::prelude::wasm_bindgen] pub fn hydrate() { + use leptos::prelude::provide_context; + use shield_bootstrap::BootstrapLeptosStyle; + use crate::app::*; console_error_panic_hook::set_once(); wasm_tracing::set_as_global_default(); - leptos::mount::hydrate_body(App); + leptos::mount::hydrate_body(|| { + provide_context(BootstrapLeptosStyle::default().context()); + + App() + }); } diff --git a/examples/leptos-axum/src/main.rs b/examples/leptos-axum/src/main.rs index d7c7d0c..043a0b8 100644 --- a/examples/leptos-axum/src/main.rs +++ b/examples/leptos-axum/src/main.rs @@ -4,9 +4,13 @@ async fn main() { use std::sync::Arc; use axum::{Router, middleware::from_fn, routing::get}; - use leptos::config::{LeptosOptions, get_configuration}; + use leptos::{ + config::{LeptosOptions, get_configuration}, + context::provide_context, + }; use leptos_axum::{LeptosRoutes, generate_route_list}; use shield::{Shield, ShieldOptions}; + use shield_bootstrap::BootstrapLeptosStyle; use shield_examples_leptos_axum::app::*; use shield_leptos_axum::{AuthRoutes, ShieldLayer, auth_required, provide_axum_integration}; use shield_memory::{MemoryStorage, User}; @@ -74,6 +78,7 @@ async fn main() { routes, move || { provide_axum_integration::(); + provide_context(BootstrapLeptosStyle::default().context()); }, { let leptos_options = leptos_options.clone(); diff --git a/packages/core/shield/src/action.rs b/packages/core/shield/src/action.rs index 5a5c469..406e84f 100644 --- a/packages/core/shield/src/action.rs +++ b/packages/core/shield/src/action.rs @@ -13,7 +13,15 @@ use crate::{ pub struct ActionForms { pub id: String, pub name: String, - pub forms: Vec
, + pub forms: Vec, +} + +// TODO: Think of a better name. +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct ActionProviderForm { + pub method_id: String, + pub provider_id: Option, + pub form: Form, } #[async_trait] diff --git a/packages/core/shield/src/form.rs b/packages/core/shield/src/form.rs index 4304357..d30802e 100644 --- a/packages/core/shield/src/form.rs +++ b/packages/core/shield/src/form.rs @@ -1,11 +1,11 @@ use serde::{Deserialize, Serialize}; -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct Form { pub inputs: Vec, } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct Input { pub name: String, pub label: Option, @@ -13,7 +13,7 @@ pub struct Input { pub value: Option, } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub enum InputType { Button(InputTypeButton), Checkbox(InputTypeCheckbox), @@ -68,16 +68,16 @@ impl InputType { } } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeButton {} -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeCheckbox { pub checked: Option, pub required: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeColor { pub alpha: Option, pub autocomplete: Option, @@ -85,7 +85,7 @@ pub struct InputTypeColor { pub list: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeDate { pub autocomplete: Option, pub list: Option, @@ -96,7 +96,7 @@ pub struct InputTypeDate { pub step: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeDatetimeLocal { pub autocomplete: Option, pub list: Option, @@ -107,7 +107,7 @@ pub struct InputTypeDatetimeLocal { pub step: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeEmail { pub autocomplete: Option, pub list: Option, @@ -121,20 +121,20 @@ pub struct InputTypeEmail { pub size: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeFile { pub accept: Option, pub multiple: Option, pub required: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeHidden { pub autocomplete: Option, pub required: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeImage { pub alt: Option, pub height: Option, @@ -142,7 +142,7 @@ pub struct InputTypeImage { pub width: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeMonth { pub autocomplete: Option, pub list: Option, @@ -153,7 +153,7 @@ pub struct InputTypeMonth { pub step: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeNumber { pub autocomplete: Option, pub list: Option, @@ -165,7 +165,7 @@ pub struct InputTypeNumber { pub step: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypePassword { pub autocomplete: Option, pub maxlength: Option, @@ -177,13 +177,13 @@ pub struct InputTypePassword { pub size: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeRadio { pub checked: Option, pub required: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeRange { pub autocomplete: Option, pub list: Option, @@ -192,10 +192,10 @@ pub struct InputTypeRange { pub step: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeReset {} -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeSearch { pub autocomplete: Option, pub list: Option, @@ -208,10 +208,10 @@ pub struct InputTypeSearch { pub size: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeSubmit {} -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeTel { pub autocomplete: Option, pub list: Option, @@ -224,7 +224,7 @@ pub struct InputTypeTel { pub size: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeText { pub autocomplete: Option, pub list: Option, @@ -237,7 +237,7 @@ pub struct InputTypeText { pub size: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeTime { pub autocomplete: Option, pub list: Option, @@ -248,7 +248,7 @@ pub struct InputTypeTime { pub step: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeUrl { pub autocomplete: Option, pub list: Option, @@ -261,7 +261,7 @@ pub struct InputTypeUrl { pub size: Option, } -#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] pub struct InputTypeWeek { pub autocomplete: Option, pub list: Option, diff --git a/packages/core/shield/src/method.rs b/packages/core/shield/src/method.rs index c230037..ef2e5bf 100644 --- a/packages/core/shield/src/method.rs +++ b/packages/core/shield/src/method.rs @@ -35,7 +35,9 @@ pub trait ErasedMethod: Send + Sync { fn erased_action_by_id(&self, action_id: &str) -> Option>; - async fn erased_providers(&self) -> Result>, ShieldError>; + async fn erased_providers( + &self, + ) -> Result, Box)>, ShieldError>; async fn erased_provider_by_id( &self, @@ -69,11 +71,11 @@ macro_rules! erased_method { async fn erased_providers( &self, - ) -> Result>, ShieldError> { + ) -> Result, Box)>, ShieldError> { self.providers().await.map(|providers| { providers .into_iter() - .map(|provider| Box::new(provider) as Box) + .map(|provider| ($crate::Provider::id(&provider), Box::new(provider) as Box)) .collect() }) } diff --git a/packages/core/shield/src/shield.rs b/packages/core/shield/src/shield.rs index 1a2146f..501c63b 100644 --- a/packages/core/shield/src/shield.rs +++ b/packages/core/shield/src/shield.rs @@ -4,8 +4,9 @@ use futures::future::try_join_all; use tracing::warn; use crate::{ - action::ActionForms, error::ShieldError, method::ErasedMethod, options::ShieldOptions, - session::Session, storage::Storage, user::User, + ActionError, ActionProviderForm, MethodError, ProviderError, Request, action::ActionForms, + error::ShieldError, method::ErasedMethod, options::ShieldOptions, session::Session, + storage::Storage, user::User, }; #[derive(Clone)] @@ -51,7 +52,12 @@ impl Shield { .map(|provider| provider.erased_providers()), ) .await - .map(|providers| providers.into_iter().flatten().collect::>()) + .map(|providers| { + providers + .into_iter() + .flat_map(|providers| providers.into_iter().map(|(_, provider)| provider)) + .collect::>() + }) } pub async fn provider_by_id( @@ -86,14 +92,18 @@ impl Shield { } action_name = Some(name); - for provider in method.erased_providers().await? { + for (provider_id, provider) in method.erased_providers().await? { if !action.erased_condition(&*provider, session.clone())? { continue; } let form = action.erased_form(provider); - forms.push(form); + forms.push(ActionProviderForm { + method_id: method.erased_id(), + provider_id, + form, + }); } } @@ -103,6 +113,39 @@ impl Shield { forms, }) } + + pub async fn call( + &self, + action_id: &str, + method_id: &str, + provider_id: Option<&str>, + session: Session, + request: Request, + ) -> Result<(), ShieldError> { + let method = + self.method_by_id(method_id) + .ok_or(ShieldError::Method(MethodError::NotFound( + method_id.to_owned(), + )))?; + + let action = method + .erased_action_by_id(action_id) + .ok_or(ShieldError::Action(ActionError::NotFound( + action_id.to_owned(), + )))?; + + let provider = + method + .erased_provider_by_id(provider_id) + .await? + .ok_or(ShieldError::Provider(ProviderError::NotFound( + provider_id.map(ToOwned::to_owned), + )))?; + + action.erased_call(provider, session, request).await?; + + Ok(()) + } } #[cfg(test)] diff --git a/packages/core/shield/src/shield_dyn.rs b/packages/core/shield/src/shield_dyn.rs index 6f49655..3459b51 100644 --- a/packages/core/shield/src/shield_dyn.rs +++ b/packages/core/shield/src/shield_dyn.rs @@ -3,7 +3,8 @@ use std::{any::Any, sync::Arc}; use async_trait::async_trait; use crate::{ - action::ActionForms, error::ShieldError, session::Session, shield::Shield, user::User, + action::ActionForms, error::ShieldError, request::Request, session::Session, shield::Shield, + user::User, }; #[async_trait] @@ -15,6 +16,15 @@ pub trait DynShield: Send + Sync { action_id: &str, session: Session, ) -> Result; + + async fn call( + &self, + action_id: &str, + method_id: &str, + provider_id: Option<&str>, + session: Session, + request: Request, + ) -> Result<(), ShieldError>; } #[async_trait] @@ -30,6 +40,18 @@ impl DynShield for Shield { ) -> Result { self.action_forms(action_id, session).await } + + async fn call( + &self, + action_id: &str, + method_id: &str, + provider_id: Option<&str>, + session: Session, + request: Request, + ) -> Result<(), ShieldError> { + self.call(action_id, method_id, provider_id, session, request) + .await + } } pub struct ShieldDyn(Arc); @@ -50,4 +72,17 @@ impl ShieldDyn { ) -> Result { self.0.action_forms(action_id, session).await } + + pub async fn call( + &self, + action_id: &str, + method_id: &str, + provider_id: Option<&str>, + session: Session, + request: Request, + ) -> Result<(), ShieldError> { + self.0 + .call(action_id, method_id, provider_id, session, request) + .await + } } diff --git a/packages/integrations/shield-axum/src/extract.rs b/packages/integrations/shield-axum/src/extract.rs index a832f58..fd44e75 100644 --- a/packages/integrations/shield-axum/src/extract.rs +++ b/packages/integrations/shield-axum/src/extract.rs @@ -33,7 +33,7 @@ impl FromRequestParts for ExtractSession { .cloned() .map(ExtractSession) .ok_or(ShieldError::Configuration(ConfigurationError::Invalid( - "Can't extract Shield. Is `ShieldLayer` enabled?".to_owned(), + "Can't extract Shield session. Is `ShieldLayer` enabled?".to_owned(), ))) .map_err(RouteError::from) } @@ -51,7 +51,7 @@ impl FromRequestParts for ExtractU .cloned() .map(ExtractUser) .ok_or(ShieldError::Configuration(ConfigurationError::Invalid( - "Can't extract Shield. Is `ShieldLayer` enabled?".to_owned(), + "Can't extract Shield user. Is `ShieldLayer` enabled?".to_owned(), ))) .map_err(RouteError::from) } @@ -68,7 +68,7 @@ impl FromRequestParts for UserRequ .get::>() .cloned() .ok_or(ShieldError::Configuration(ConfigurationError::Invalid( - "Can't extract Shield. Is `ShieldLayer` enabled?".to_owned(), + "Can't extract Shield user. Is `ShieldLayer` enabled?".to_owned(), ))) .and_then(|user| user.ok_or(ShieldError::Unauthorized)) .map(UserRequired) diff --git a/packages/integrations/shield-axum/src/routes/action.rs b/packages/integrations/shield-axum/src/routes/action.rs index fe2cd68..88dc885 100644 --- a/packages/integrations/shield-axum/src/routes/action.rs +++ b/packages/integrations/shield-axum/src/routes/action.rs @@ -3,7 +3,7 @@ use axum::{ extract::{Path, Query}, }; use serde_json::Value; -use shield::{ActionError, MethodError, ProviderError, Request, ShieldError, User}; +use shield::{Request, User}; use crate::{ExtractSession, ExtractShield, RouteError, path::ActionPathParams}; @@ -19,23 +19,16 @@ pub async fn action( Query(query): Query, Form(form_data): Form, ) -> Result<(), RouteError> { - let method = shield - .method_by_id(&method_id) - .ok_or(ShieldError::Method(MethodError::NotFound(method_id)))?; + // TODO: Check if this action supports the HTTP method (GET/POST)? - let action = method - .erased_action_by_id(&action_id) - .ok_or(ShieldError::Action(ActionError::NotFound(action_id)))?; - - // TODO: Check if this action supports the HTTP method (GET/POST). - - let provider = method - .erased_provider_by_id(provider_id.as_deref()) - .await? - .ok_or(ShieldError::Provider(ProviderError::NotFound(provider_id)))?; - - action - .erased_call(provider, session, Request { query, form_data }) + shield + .call( + &method_id, + &action_id, + provider_id.as_deref(), + session, + Request { query, form_data }, + ) .await?; Ok(()) diff --git a/packages/integrations/shield-dioxus-axum/Cargo.toml b/packages/integrations/shield-dioxus-axum/Cargo.toml index efaf4c6..c7fdbee 100644 --- a/packages/integrations/shield-dioxus-axum/Cargo.toml +++ b/packages/integrations/shield-dioxus-axum/Cargo.toml @@ -14,7 +14,7 @@ utoipa = ["shield-axum/utoipa"] [dependencies] async-trait.workspace = true -dioxus = { workspace = true, features = ["server"] } +dioxus-server = { workspace = true, default-features = true } shield.workspace = true shield-axum.workspace = true shield-dioxus.workspace = true diff --git a/packages/integrations/shield-dioxus-axum/src/integration.rs b/packages/integrations/shield-dioxus-axum/src/integration.rs index ecf5e84..3b421bd 100644 --- a/packages/integrations/shield-dioxus-axum/src/integration.rs +++ b/packages/integrations/shield-dioxus-axum/src/integration.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use async_trait::async_trait; -use dioxus::prelude::extract; +use dioxus_server::extract; use shield::{Session, ShieldDyn, User}; use shield_axum::{ExtractSession, ExtractShield}; diff --git a/packages/integrations/shield-dioxus/Cargo.toml b/packages/integrations/shield-dioxus/Cargo.toml index c8750a2..710b741 100644 --- a/packages/integrations/shield-dioxus/Cargo.toml +++ b/packages/integrations/shield-dioxus/Cargo.toml @@ -8,7 +8,12 @@ license.workspace = true repository.workspace = true version.workspace = true +[features] +server = ["dioxus/server"] + [dependencies] async-trait.workspace = true -dioxus = { workspace = true, features = ["router"] } +dioxus = { workspace = true, features = ["fullstack", "router"] } +dioxus-server = { workspace = true, default-features = true } +serde_json.workspace = true shield.workspace = true diff --git a/packages/integrations/shield-dioxus/src/lib.rs b/packages/integrations/shield-dioxus/src/lib.rs index 254ffc7..e97cbd7 100644 --- a/packages/integrations/shield-dioxus/src/lib.rs +++ b/packages/integrations/shield-dioxus/src/lib.rs @@ -5,4 +5,5 @@ mod style; pub use integration::*; pub use router::*; +pub use routes::call; pub use style::*; diff --git a/packages/integrations/shield-dioxus/src/routes/action.rs b/packages/integrations/shield-dioxus/src/routes/action.rs index f37f76e..eab75f6 100644 --- a/packages/integrations/shield-dioxus/src/routes/action.rs +++ b/packages/integrations/shield-dioxus/src/routes/action.rs @@ -1,5 +1,7 @@ use dioxus::prelude::*; -use shield::ActionForms; +use dioxus_server::{FromContext, extract}; +use serde_json::Value; +use shield::{ActionForms, Request}; use crate::{DioxusIntegrationDyn, ErasedDioxusStyle}; @@ -36,3 +38,30 @@ async fn forms(action_id: String) -> Result { Ok(forms) } + +#[server] +pub async fn call( + action_id: String, + method_id: String, + provider_id: Option, +) -> Result<(), ServerFnError> { + let FromContext(integration): FromContext = extract().await?; + let shield = integration.extract_shield().await; + let session = integration.extract_session().await; + + shield + .call( + &action_id, + &method_id, + provider_id.as_deref(), + session, + // TODO: Support request input. + Request { + query: Value::Null, + form_data: Value::Null, + }, + ) + .await?; + + Ok(()) +} diff --git a/packages/integrations/shield-leptos/Cargo.toml b/packages/integrations/shield-leptos/Cargo.toml index b485b3b..a6cc38b 100644 --- a/packages/integrations/shield-leptos/Cargo.toml +++ b/packages/integrations/shield-leptos/Cargo.toml @@ -11,5 +11,7 @@ version.workspace = true [dependencies] async-trait.workspace = true leptos.workspace = true +leptos_router.workspace = true serde.workspace = true +serde_json.workspace = true shield.workspace = true diff --git a/packages/integrations/shield-leptos/src/lib.rs b/packages/integrations/shield-leptos/src/lib.rs index c1c91b6..5e1179b 100644 --- a/packages/integrations/shield-leptos/src/lib.rs +++ b/packages/integrations/shield-leptos/src/lib.rs @@ -1,7 +1,11 @@ mod context; mod integration; +mod router; +mod routes; mod style; pub use context::*; pub use integration::*; +pub use router::*; +pub use routes::*; pub use style::*; diff --git a/packages/integrations/shield-leptos/src/router.rs b/packages/integrations/shield-leptos/src/router.rs new file mode 100644 index 0000000..43b1272 --- /dev/null +++ b/packages/integrations/shield-leptos/src/router.rs @@ -0,0 +1,12 @@ +use leptos::prelude::*; +use leptos_router::{MatchNestedRoutes, components::Route, path}; + +use crate::routes::Action; + +#[component(transparent)] +pub fn ShieldRouter() -> impl MatchNestedRoutes + Clone { + view! { + + } + .into_inner() +} diff --git a/packages/integrations/shield-leptos/src/routes.rs b/packages/integrations/shield-leptos/src/routes.rs new file mode 100644 index 0000000..8bd911f --- /dev/null +++ b/packages/integrations/shield-leptos/src/routes.rs @@ -0,0 +1,3 @@ +mod action; + +pub use action::*; diff --git a/packages/integrations/shield-leptos/src/routes/action.rs b/packages/integrations/shield-leptos/src/routes/action.rs new file mode 100644 index 0000000..3ecdd28 --- /dev/null +++ b/packages/integrations/shield-leptos/src/routes/action.rs @@ -0,0 +1,80 @@ +use leptos::prelude::*; +use leptos_router::{hooks::use_params, params::Params}; +use shield::ActionForms; + +use crate::ErasedLeptosStyle; + +#[derive(Params, PartialEq)] +struct ActionParams { + action_id: Option, +} + +#[component] +pub fn Action() -> impl IntoView { + let params = use_params::(); + let action_id = move || { + params + .read() + .as_ref() + .ok() + .and_then(|params| params.action_id.clone()) + .expect("TODO: Properly handle missing param.") + }; + + let resource = Resource::new(action_id, forms); + let style = expect_context::(); + + view! { + + {move || resource.get().map(|response| match response { + Ok(forms) => style.render(&forms), + Err(err) => format!("{err:?}").into_any() + })} + + } +} + +#[server] +async fn forms(action_id: String) -> Result { + use crate::expect_server_integration; + + let integration = expect_server_integration(); + let shield = integration.extract_shield().await; + let session = integration.extract_session().await; + + let forms = shield.action_forms(&action_id, session).await?; + + Ok(forms) +} + +#[server] +pub async fn call( + action_id: String, + method_id: String, + provider_id: Option, +) -> Result<(), ServerFnError> { + use serde_json::Value; + use shield::Request; + + use crate::expect_server_integration; + + let integration = expect_server_integration(); + let shield = integration.extract_shield().await; + let session = integration.extract_session().await; + + shield + .call( + &action_id, + &method_id, + provider_id.as_deref(), + session, + // TODO: Support request input. + Request { + query: Value::Null, + form_data: Value::Null, + }, + ) + .await?; + + Ok(()) +} diff --git a/packages/styles/shield-bootstrap/src/dioxus.rs b/packages/styles/shield-bootstrap/src/dioxus.rs index d8bd247..8cc2087 100644 --- a/packages/styles/shield-bootstrap/src/dioxus.rs +++ b/packages/styles/shield-bootstrap/src/dioxus.rs @@ -1,7 +1,12 @@ +mod form; +mod input; + use dioxus::prelude::*; use shield::ActionForms; use shield_dioxus::{DioxusStyle, ErasedDioxusStyle}; +use crate::dioxus::form::Form; + #[derive(Default)] pub struct BootstrapDioxusStyle {} @@ -22,29 +27,9 @@ impl DioxusStyle for BootstrapDioxusStyle { } for form in &action.forms { - form { - for input in &form.inputs { - div { - class: "mb-3", - - if let Some(label) = &input.label { - label { - class: "form-label", - - strong { - "{label}" - } - } - } - - input { - class: "form-control", - name: input.name.clone(), - type: input.r#type.as_str(), - value: input.value.clone(), - } - } - } + Form { + action_id: action.id.clone(), + form: form.clone(), } } } diff --git a/packages/styles/shield-bootstrap/src/dioxus/form.rs b/packages/styles/shield-bootstrap/src/dioxus/form.rs new file mode 100644 index 0000000..0020108 --- /dev/null +++ b/packages/styles/shield-bootstrap/src/dioxus/form.rs @@ -0,0 +1,41 @@ +use dioxus::{logger::tracing::info, prelude::*}; +use shield::ActionProviderForm; +use shield_dioxus::call; + +use crate::dioxus::input::FormInput; + +#[derive(Clone, PartialEq, Props)] +pub struct FormProps { + action_id: String, + form: ActionProviderForm, +} + +#[component] +pub fn Form(props: FormProps) -> Element { + rsx! { + form { + onsubmit: { + move |event| { + let action_id = props.action_id.clone(); + let method_id = props.form.method_id.clone(); + let provider_id = props.form.provider_id.clone(); + + event.prevent_default(); + + async move { + info!("{:?}", event); + + let result = call(action_id, method_id, provider_id).await; + info!("{:?}", result); + } + } + }, + + for input in props.form.form.inputs { + FormInput { + input: input + } + } + } + } +} diff --git a/packages/styles/shield-bootstrap/src/dioxus/input.rs b/packages/styles/shield-bootstrap/src/dioxus/input.rs new file mode 100644 index 0000000..916eb98 --- /dev/null +++ b/packages/styles/shield-bootstrap/src/dioxus/input.rs @@ -0,0 +1,33 @@ +use dioxus::prelude::*; +use shield::Input; + +#[derive(Clone, PartialEq, Props)] +pub struct FormInputProps { + input: Input, +} + +#[component] +pub fn FormInput(props: FormInputProps) -> Element { + rsx! { + div { + class: "mb-3", + + if let Some(label) = &props.input.label { + label { + class: "form-label", + + strong { + "{label}" + } + } + } + + input { + class: "form-control", + name: props.input.name, + type: props.input.r#type.as_str(), + value: props.input.value.clone(), + } + } + } +} diff --git a/packages/styles/shield-bootstrap/src/leptos.rs b/packages/styles/shield-bootstrap/src/leptos.rs index b4b30c0..ce598af 100644 --- a/packages/styles/shield-bootstrap/src/leptos.rs +++ b/packages/styles/shield-bootstrap/src/leptos.rs @@ -1,7 +1,12 @@ +mod form; +mod input; + use leptos::prelude::*; -use shield::{ActionForms, Input}; +use shield::ActionForms; use shield_leptos::{ErasedLeptosStyle, LeptosStyle}; +use crate::leptos::form::Form; + #[derive(Default)] pub struct BootstrapLeptosStyle {} @@ -11,36 +16,6 @@ impl BootstrapLeptosStyle { } } -impl BootstrapLeptosStyle { - fn render_form_input(&self, input: &Input) -> impl IntoView { - view! { -
- {self.render_label(input)} - {self.render_input(input)} -
- } - } - - fn render_label(&self, input: &Input) -> Option { - input.label.as_ref().map(|label| { - view! { - - } - }) - } - - fn render_input(&self, input: &Input) -> impl IntoView { - view! { - - } - } -} - impl LeptosStyle for BootstrapLeptosStyle { fn render(&self, action: &ActionForms) -> AnyView { view! { @@ -48,9 +23,7 @@ impl LeptosStyle for BootstrapLeptosStyle {

{action.name.clone()}

{action.forms.iter().map(|form| view! { - - {form.inputs.iter().map(|input| self.render_form_input(input)).collect_view()} - +
}).collect_view()} } diff --git a/packages/styles/shield-bootstrap/src/leptos/form.rs b/packages/styles/shield-bootstrap/src/leptos/form.rs new file mode 100644 index 0000000..ca41597 --- /dev/null +++ b/packages/styles/shield-bootstrap/src/leptos/form.rs @@ -0,0 +1,22 @@ +use leptos::prelude::*; +use shield::ActionProviderForm; +use shield_leptos::Call; + +use crate::leptos::input::FormInput; + +#[component] +pub fn Form(action_id: String, form: ActionProviderForm) -> impl IntoView { + let call = ServerAction::::new(); + + view! { + + + + + + {form.form.inputs.into_iter().map(|input| view! { + + }).collect_view()} + + } +} diff --git a/packages/styles/shield-bootstrap/src/leptos/input.rs b/packages/styles/shield-bootstrap/src/leptos/input.rs new file mode 100644 index 0000000..5306b6e --- /dev/null +++ b/packages/styles/shield-bootstrap/src/leptos/input.rs @@ -0,0 +1,33 @@ +use leptos::prelude::*; +use shield::Input; + +#[component] +pub fn FormInput(input: Input) -> impl IntoView { + view! { +
+
+ } +} + +#[component] +fn Label(label: Option) -> impl IntoView { + label.map(|label| { + view! { + + } + }) +} + +#[component] +fn Control(input: Input) -> impl IntoView { + view! { + + } +} From b8dbcee99876215288ca13328250a9852baf0d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Mon, 18 Aug 2025 20:54:29 +0200 Subject: [PATCH 2/2] fix: add workaround for Dioxus server extract --- .github/workflows/ci.yml | 4 +- Cargo.lock | 484 ++++++++++++------ Cargo.toml | 14 +- examples/axum/Cargo.toml | 4 +- examples/dioxus-axum/clippy.toml | 8 - .../shield-dioxus-axum/Cargo.toml | 2 +- .../integrations/shield-dioxus/Cargo.toml | 1 - .../shield-dioxus/src/routes/action.rs | 78 ++- 8 files changed, 387 insertions(+), 208 deletions(-) delete mode 100644 examples/dioxus-axum/clippy.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c259bb..2ea1902 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: run: cargo binstall -y --force cargo-deny cargo-machete cargo-sort - name: Lint - run: cargo clippy --all-features --locked + run: cargo clippy --locked - name: Check dependencies run: cargo deny check @@ -86,4 +86,4 @@ jobs: run: cargo binstall -y sea-orm-cli - name: Test - run: cargo test --all-features --locked + run: cargo test --locked diff --git a/Cargo.lock b/Cargo.lock index 33259f2..f8c1ade 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -451,12 +451,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-once-cell" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288f83726785267c6f2ef073a3d83dc3f9b81464e9f99898240cced85fce35a" - [[package]] name = "async-stream" version = "0.3.6" @@ -830,6 +824,12 @@ dependencies = [ "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-if" version = "1.0.1" @@ -963,6 +963,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1003,9 +1013,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const-serialize" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46e124eb5cc64de7c7f22d84c0aa373314bc857152b3dfa1c1f75a694346d111" +checksum = "6c02a1f46ffe1c6f05edf568a7d8e2ab477c75a6ec5f33d2b83ce54fc3f096ca" dependencies = [ "const-serialize-macro", "serde", @@ -1013,9 +1023,9 @@ dependencies = [ [[package]] name = "const-serialize-macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16638ae95facb33c7d4df8423ac3b46658ce481bd740f1f723169798f75e85da" +checksum = "1da74b91de7c3426afaed28ed514bc4cd39821eeecf9f32dc424023310a63ae4" dependencies = [ "proc-macro2", "quote", @@ -1438,10 +1448,11 @@ dependencies = [ [[package]] name = "dioxus" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8449dc3173e919f7721518f418cc73400e3a0cb758b61a132c0da24ffff362" +checksum = "1c5e29983134d7b38f2d4578afc649ce5df744d9a7e13a1b1a983376f1056f41" dependencies = [ + "dioxus-asset-resolver", "dioxus-cli-config", "dioxus-config-macro", "dioxus-config-macros", @@ -1459,6 +1470,7 @@ dependencies = [ "dioxus-server", "dioxus-signals", "dioxus-ssr", + "dioxus-stores", "dioxus-web", "dioxus_server_macro", "manganis", @@ -1467,20 +1479,37 @@ dependencies = [ "warnings", ] +[[package]] +name = "dioxus-asset-resolver" +version = "0.7.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b6782436b323a84b4d9f90cf2365b35a1cdb918191221f71865dcc2e70016b6" +dependencies = [ + "jni", + "js-sys", + "manganis-core", + "ndk", + "ndk-context", + "ndk-sys", + "thiserror 2.0.15", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "dioxus-cli-config" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a835b354643a8ed31e875c7b5b041b49a58bc473e41bc4c0139171aae081026" +checksum = "b8cec511d8a05ed60071bb0088f07ec40325faf27a608fa19d65befdd842b57f" dependencies = [ "wasm-bindgen", ] [[package]] name = "dioxus-config-macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b5cc31e1c4adcdd15e53e0ef3caa478af99a8c1f8db5b8712bfd5ca32f6268e" +checksum = "b0711887c38dcebd391bfa5a0759c79ffcc5b0c21ee120cf3d99c42346eb626d" dependencies = [ "proc-macro2", "quote", @@ -1488,15 +1517,15 @@ dependencies = [ [[package]] name = "dioxus-config-macros" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab65feae7ce502a169f8e96d5df96f922ba639616a083ec0bc45ccec1991e9d9" +checksum = "349cae693022df3af125c9f794aef0ffec97f2e1d01c252d883149e7ca7a0324" [[package]] name = "dioxus-core" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2d47ba93db31ce3b73e9871c7e1aacb2e6e50c50e5e73818858823f8a6a46f" +checksum = "07b55eccaa5c4f35f1755ea18a5716fe8ecba60ff1f25c52be6ceda2e6a52eb6" dependencies = [ "const_format", "dioxus-core-types", @@ -1516,9 +1545,9 @@ dependencies = [ [[package]] name = "dioxus-core-macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "557d0be92d07f795c7129ee620402afe2b09b549cc886d5a7a15dce8d93b0e88" +checksum = "9280f81c8d58863b3077f1b7ca097e2f2b28d30a5aa02a656fbf72b0aee1bd9f" dependencies = [ "convert_case 0.8.0", "dioxus-rsx", @@ -1529,15 +1558,15 @@ dependencies = [ [[package]] name = "dioxus-core-types" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d374253362f3f661a94670bda4a4742cf5323ffabe1c96392b4e575e9f78490" +checksum = "f0ef2a94b4ceb8f7a39f56a539d07e82b0358a49a0b95028ad48635975df29d7" [[package]] name = "dioxus-devtools" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4840f7842d45297e6db1f43059feb02a2e398d783088e11e99f9728867a21b15" +checksum = "60af4e129968ab1713471ed0b29c3eefa4e8e09252429487d7a581e93c7ecfe5" dependencies = [ "dioxus-cli-config", "dioxus-core", @@ -1554,9 +1583,9 @@ dependencies = [ [[package]] name = "dioxus-devtools-types" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d80438473905fee94c026e574cf743745573415658174e18318ce194f420c2" +checksum = "64274704b6a8d018112473cdce0b3db1dcccfa79bde445223592fe4e396ff5ef" dependencies = [ "dioxus-core", "serde", @@ -1565,9 +1594,9 @@ dependencies = [ [[package]] name = "dioxus-document" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda5977c05cfb1e16b5762f1c5df0e20f780f4ad0534e0e3332a5448f7ec7d90" +checksum = "11c7f4ff62a842c026c74b9782dd9117a2310ec52de69d858a9e54b96b3bac15" dependencies = [ "dioxus-core", "dioxus-core-macro", @@ -1584,25 +1613,27 @@ dependencies = [ [[package]] name = "dioxus-fullstack" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6053fc12060779d21aada9502d54af4793ec073ca3411387cde5f049af7c8e1c" +checksum = "819981e8aa811d9b81ac3135a8a74db2f1fa7510473c3251f98eceb2c710632e" dependencies = [ "base64 0.22.1", "bytes", "ciborium", + "dioxus-core", "dioxus-devtools", + "dioxus-document", "dioxus-fullstack-hooks", "dioxus-fullstack-protocol", "dioxus-history", "dioxus-interpreter-js", - "dioxus-lib", "dioxus-server", "dioxus-web", "dioxus_server_macro", "futures-channel", "futures-util", "generational-box", + "http 1.3.1", "serde", "server_fn", "tracing", @@ -1611,9 +1642,9 @@ dependencies = [ [[package]] name = "dioxus-fullstack-hooks" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51dd88171e1b818fff7c2b0659a742fc9c276a7ad0da9bc7f659d7f9512a53ef" +checksum = "ef5fad61b2821b8f26c8498834920d617449d0b866aaac01b95284237f76e9d5" dependencies = [ "dioxus-core", "dioxus-fullstack-protocol", @@ -1626,9 +1657,9 @@ dependencies = [ [[package]] name = "dioxus-fullstack-protocol" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dedf8707be09f66eebe2631e75bad5cea5c6835debc3f752b4636121ca33986" +checksum = "b2f266ad9e20be14b8899f2133dd942131f03e6749650e65e2aaec2c7f8a4bc1" dependencies = [ "base64 0.22.1", "ciborium", @@ -1639,9 +1670,9 @@ dependencies = [ [[package]] name = "dioxus-history" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4e91b8b3546330ddeed65d532c0bf538c99233a54105eea62ddbee900f904c" +checksum = "18e9e34323717a78ea3f8ba5072ff484744a656e8d422932c19937b67f45113e" dependencies = [ "dioxus-core", "tracing", @@ -1649,9 +1680,9 @@ dependencies = [ [[package]] name = "dioxus-hooks" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f0a1be0db90c9ea5ef0614908f070270d3bff013f10d620533ce29f3c0ead5" +checksum = "ab776b9a156765cc7dd7876891c98b9ab06b1f995d33ff169b06ef4f23cfd437" dependencies = [ "dioxus-core", "dioxus-signals", @@ -1666,9 +1697,9 @@ dependencies = [ [[package]] name = "dioxus-html" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4523bf2cb70fbf8369d56caadf3fc56fe1b4f817faea26e25449714a3e699a85" +checksum = "073e5b69a7b66e9cbb49530df8c4cf86bf2aff3322ba86a3d722f9d58cd9c54b" dependencies = [ "async-trait", "dioxus-core", @@ -1691,9 +1722,9 @@ dependencies = [ [[package]] name = "dioxus-html-internal-macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c427cff078fea6c2b24362f1a061b26a646b41466b4faf0f9aabcabe3b6f4b" +checksum = "162beea862dc888897a0b527db08724ede0f09e59fe081ab39caa0b085f40e10" dependencies = [ "convert_case 0.8.0", "proc-macro2", @@ -1703,9 +1734,9 @@ dependencies = [ [[package]] name = "dioxus-interpreter-js" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ec2dad59e5e62c426ebbb924deeb7d4e5d75404f74b55a25540634192c5d30" +checksum = "bd2ef3fe9bddfcac6d2ccf123d4834b5c3d97e6f2be8fcbfc4943226d9d7d4fe" dependencies = [ "dioxus-core", "dioxus-core-types", @@ -1722,9 +1753,9 @@ dependencies = [ [[package]] name = "dioxus-isrg" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "334eab221c41fc1d7b0eae3c8fbd2f9659c51f5f690d95eb03a6613c44cb76d1" +checksum = "9de299631d53fbde53d86609884a5b2bae65d9c1d86c78a79b7d2254b9ba1771" dependencies = [ "chrono", "http 1.3.1", @@ -1735,28 +1766,11 @@ dependencies = [ "walkdir", ] -[[package]] -name = "dioxus-lib" -version = "0.7.0-alpha.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3340a7eeebc207010d27dcf2b347c748dfd6a8605dc3624019f0c7a06e0d5d8b" -dependencies = [ - "dioxus-config-macro", - "dioxus-core", - "dioxus-core-macro", - "dioxus-document", - "dioxus-history", - "dioxus-hooks", - "dioxus-html", - "dioxus-rsx", - "dioxus-signals", -] - [[package]] name = "dioxus-liveview" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81368daff72f054a71a9e7dd9ae2e9ea9c0b81a59684306cceddc14bf5fe9120" +checksum = "f90ea4ac81b0c239f00c70a06d1433135babca3412817d4c21a1a188964e5a7f" dependencies = [ "axum", "dioxus-cli-config", @@ -1782,9 +1796,9 @@ dependencies = [ [[package]] name = "dioxus-logger" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fff817841604303874337760beae1b5e1e8405ef92160229f8ac00e59943741" +checksum = "6d39a7c4d1f848fa62d0e605aabce921cc8a95ccea3d17101a840d216471adb7" dependencies = [ "console_error_panic_hook", "dioxus-cli-config", @@ -1795,15 +1809,19 @@ dependencies = [ [[package]] name = "dioxus-router" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1407fe9efc73196704e362a07e0c2c2f70158bab255dedeee49a964a8cf32bdb" +checksum = "6260ba0131670716b7410bc6b2eba13cc7677ba133c9678b5508214a7a2a1794" dependencies = [ "dioxus-cli-config", + "dioxus-core", + "dioxus-core-macro", "dioxus-fullstack-hooks", "dioxus-history", - "dioxus-lib", + "dioxus-hooks", + "dioxus-html", "dioxus-router-macro", + "dioxus-signals", "percent-encoding", "rustversion", "tracing", @@ -1812,9 +1830,9 @@ dependencies = [ [[package]] name = "dioxus-router-macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff755fd06ac6e3b5d6bc1f2a43c4fbd9dd610de3fe5dd6e6b6685e7d8c88082" +checksum = "b71f2013d2871815f6e84478198c5f458c735f053703a800a9ac684b98de2cfa" dependencies = [ "base16", "digest", @@ -1827,9 +1845,9 @@ dependencies = [ [[package]] name = "dioxus-rsx" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b133bd25890d95e71cd1d9610006ac381980864ce8557c8afaf7939fef489a" +checksum = "ee08e1302f384a54d97b762eddb57cf3b7335b08b176e136c1d9631b5c71ff18" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", @@ -1839,9 +1857,9 @@ dependencies = [ [[package]] name = "dioxus-server" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf761acb3dc6b8efa8f0e2230c0f871aa90799317b4cec5a1896c3ef974557" +checksum = "1116ed485980f0df75d9251dd216e325e059d71fe1ef823ee967105aa4d4be48" dependencies = [ "async-trait", "axum", @@ -1850,14 +1868,18 @@ dependencies = [ "ciborium", "dashmap", "dioxus-cli-config", + "dioxus-core", + "dioxus-core-macro", "dioxus-devtools", + "dioxus-document", "dioxus-fullstack-hooks", "dioxus-fullstack-protocol", "dioxus-history", + "dioxus-html", "dioxus-interpreter-js", "dioxus-isrg", - "dioxus-lib", "dioxus-router", + "dioxus-signals", "dioxus-ssr", "enumset", "futures-channel", @@ -1885,9 +1907,9 @@ dependencies = [ [[package]] name = "dioxus-signals" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ba3afcb142d1cb95b099c06ab2e6b82d54cf165f2d51801c4393cded0d81d09" +checksum = "d1d0e70a8da969c0404f5ef8cf6f47042bea55608b582079f3ea3d9fff46125c" dependencies = [ "dioxus-core", "futures-channel", @@ -1901,9 +1923,9 @@ dependencies = [ [[package]] name = "dioxus-ssr" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d642476161fbb123808071ceb36fd7f871130e52495ce855b7b9538647f5a30" +checksum = "21c377da1f2ea708be1112dd61189d6dcd19c8db25208b750c3849f760fa854d" dependencies = [ "askama_escape", "dioxus-core", @@ -1911,11 +1933,34 @@ dependencies = [ "rustc-hash 2.1.1", ] +[[package]] +name = "dioxus-stores" +version = "0.7.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5494e5aa7333f3be918741eeb6bfb4d1cbf28d25035a2a3c2c5bcebdc27b0b68" +dependencies = [ + "dioxus-core", + "dioxus-signals", + "dioxus-stores-macro", +] + +[[package]] +name = "dioxus-stores-macro" +version = "0.7.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecb7365b1a587a9f2340cf8f925a00b997d8d31b4ee25ecb21ca8bdf99c2c33" +dependencies = [ + "convert_case 0.8.0", + "proc-macro2", + "quote", + "syn 2.0.104", +] + [[package]] name = "dioxus-web" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d99c0e715e69a4df91b9c976b0f3a2b801070532a7e0a234d60e72796257d7ec" +checksum = "34eb4f341b0203f7b1fe1804d4561a19a399bf7fa4821a5b87cff5fd89d834bd" dependencies = [ "async-trait", "dioxus-cli-config", @@ -1946,9 +1991,9 @@ dependencies = [ [[package]] name = "dioxus_server_macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf52bbd615bbb143ec6c1595233ce683324e5e6e90045b33b23004f7005ffe1" +checksum = "2a032e9eaa291ded578b6c368ba35dd18d052e1cbcf2395244e555edd1767e61" dependencies = [ "proc-macro2", "quote", @@ -2118,7 +2163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2352,9 +2397,9 @@ dependencies = [ [[package]] name = "generational-box" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7614274b2b7e58f11fd586adec596b90582b1e5d4383287ce727d671aac8eac9" +checksum = "cb058e0358ff765e719ab3e61629c5090fedb6a6ccf66479de21440a33d7f084" dependencies = [ "parking_lot", "tracing", @@ -3046,6 +3091,28 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "jobserver" version = "0.1.33" @@ -3084,9 +3151,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lazy-js-bundle" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76fb91c51001c2669299e378aaff2f871c3405fd5eca5c4a95699254e337986d" +checksum = "e22c4abc3d491546025db72681ed8b1ff0e6e77d67f196460179b027d591b6ff" [[package]] name = "lazy_static" @@ -3099,9 +3166,9 @@ dependencies = [ [[package]] name = "leptos" -version = "0.8.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20adc17f0584e5f605a31444179bae17c399a2d160bf19eb3da701a1f6e7cb8e" +checksum = "6c202a7897aa73c90ac4ce73713512d871f75e79847558d9e88f778659b164dc" dependencies = [ "any_spawner", "base64 0.22.1", @@ -3124,7 +3191,6 @@ dependencies = [ "rustc_version", "send_wrapper", "serde", - "serde_json", "serde_qs", "server_fn", "slotmap", @@ -3134,16 +3200,14 @@ dependencies = [ "typed-builder", "typed-builder-macro", "wasm-bindgen", - "wasm-bindgen-futures", - "wasm_split_helpers", "web-sys", ] [[package]] name = "leptos_actix" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25938e6b35529837ffd083037d1313864fdb335b464d076af20dc492cd0f48d7" +checksum = "47b7818439e4fc125009624182f993d7e9132d7a11f0a9d6ba3dee98984320b3" dependencies = [ "actix-files", "actix-http", @@ -3167,9 +3231,9 @@ dependencies = [ [[package]] name = "leptos_axum" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e720f7b3cf828b4fbb96145716c9af8edccbeacfb8b808d28687f8a8f175800" +checksum = "a84872a7df15ec047f8b27b27e35354752a8cc62ab8b789e3dc9d4ed5613bcea" dependencies = [ "any_spawner", "axum", @@ -3237,9 +3301,9 @@ dependencies = [ [[package]] name = "leptos_integration_utils" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea02f77bee8de1e9dd4c7ef1c401dd3a1afef8dab6e240af6f7d6f73403a259f" +checksum = "51059fee81537ba299323e2b58c9d721f66fd8a2d42df710a020efbdfb8efae2" dependencies = [ "futures", "hydration_context", @@ -3252,9 +3316,9 @@ dependencies = [ [[package]] name = "leptos_macro" -version = "0.8.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824b74d70dd505e5fe32952150325275050febb0d0bd7ac8b8efc50a69ec95" +checksum = "8e32ae8783d4b64838167e026ef773dbc53399e9e6658e9c2f65e0ce67a5ccec" dependencies = [ "attribute-derive", "cfg-if", @@ -3275,9 +3339,9 @@ dependencies = [ [[package]] name = "leptos_meta" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d489e38d3f541e9e43ecc2e3a815527840345a2afca629b3e23fcc1dd254578" +checksum = "ef0521aeb2e73cbae8e6278287da485020b971e0b2cd471c5de5eb8cbcaa8802" dependencies = [ "futures", "indexmap 2.9.0", @@ -3290,9 +3354,9 @@ dependencies = [ [[package]] name = "leptos_router" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3991de30a9cce8082e8c0d729744c8f6ffd66a828629806bf1332cb624123c75" +checksum = "e1b6df1b107c301bd39c114768a1196a8dfcbdae869364b3f0247e3f554b503a" dependencies = [ "any_spawner", "either_of", @@ -3327,9 +3391,9 @@ dependencies = [ [[package]] name = "leptos_server" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38acbf32649a4b127c8d4ccaed8fb388e19a746430a0ea8f8160e51e28c36e2d" +checksum = "26851048e161998b8f9fb3261a833ec64df2a2669ea95f360c54b7f47a1e07cb" dependencies = [ "any_spawner", "base64 0.22.1", @@ -3358,7 +3422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3479,9 +3543,9 @@ dependencies = [ [[package]] name = "manganis" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ef9f58c311468650835cd59fa4df4781de86ff85584fd0af8f871b83ed412b" +checksum = "105544bc1d466decccab19427eddb801b6e575bb4907410eb4fed604ed78d358" dependencies = [ "const-serialize", "manganis-core", @@ -3490,9 +3554,9 @@ dependencies = [ [[package]] name = "manganis-core" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b87d087bfd7381da41fa26028d83b07056d20830ea77f18d376d91cd1bc29d3" +checksum = "6d71ef461824c58f3d260c1f548f7a8aee2e0b6b805a503d15f8535a3a6272d7" dependencies = [ "const-serialize", "dioxus-cli-config", @@ -3502,9 +3566,9 @@ dependencies = [ [[package]] name = "manganis-macro" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468f091cf869b5d778780055f8fccc12320daf9d97a74225ba27fba66fc6113" +checksum = "06115a15f5d7bf6fcfee1b6979155cc51ab21ce7f06d907f6435d24175778f9e" dependencies = [ "dunce", "macro-string", @@ -3657,6 +3721,36 @@ dependencies = [ "tempfile", ] +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags", + "jni-sys", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys", +] + [[package]] name = "next_tuple" version = "0.1.0" @@ -3746,13 +3840,35 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.104", +] + [[package]] name = "oauth2" version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51e219e79014df21a225b1860a479e2dcd7cbd9130f4defd4bd0e191ea31d67d" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "chrono", "getrandom 0.2.16", "http 1.3.1", @@ -4295,7 +4411,7 @@ dependencies = [ "once_cell", "socket2 0.5.10", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4400,6 +4516,12 @@ dependencies = [ "getrandom 0.3.3", ] +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + [[package]] name = "reactive_graph" version = "0.2.5" @@ -4760,7 +4882,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.4.15", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4773,7 +4895,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5236,9 +5358,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36dab1d4cbc272e15f4475d18e90a59488d1d1efe4e7db3f71b73a43d8c5f02b" +checksum = "9c27fbd25ecc066481e383e2ed62ab2480e708aa3fe46cba36e95f58e61dfd04" dependencies = [ "actix-web", "actix-ws", @@ -5280,9 +5402,9 @@ dependencies = [ [[package]] name = "server_fn_macro" -version = "0.8.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b381389c2307b4b83ce70516c0408d99727ab9f73645e065bb51e6be09cb2f6b" +checksum = "b9d530c872590473016016679c94e3bddf47372941fc924f687ffd11a1778a71" dependencies = [ "const_format", "convert_case 0.8.0", @@ -5295,9 +5417,9 @@ dependencies = [ [[package]] name = "server_fn_macro_default" -version = "0.8.5" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63eb08f80db903d3c42f64e60ebb3875e0305be502bdc064ec0a0eab42207f00" +checksum = "ca7abc92ed696648275ed9ff171131a83d571af11748593dc2e6eb6a4e22a5b9" dependencies = [ "server_fn_macro", "syn 2.0.104", @@ -5402,7 +5524,6 @@ version = "0.0.4" dependencies = [ "async-trait", "dioxus", - "dioxus-server", "serde_json", "shield", ] @@ -6005,9 +6126,9 @@ checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" [[package]] name = "subsecond" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9884adf2ac9e1f7ee7924be9130e000619fb10ecaa108ba39f20ba773e9ab4" +checksum = "b14ed4d86ab065ffbfdb994fd3e44daf5244b02cb643bd52949d74b703f36605" dependencies = [ "js-sys", "libc", @@ -6024,9 +6145,9 @@ dependencies = [ [[package]] name = "subsecond-types" -version = "0.7.0-alpha.3" +version = "0.7.0-rc.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cacd233c591f4f27a52b436d38156ce13e666d3da74cf26bf44777a330475f4" +checksum = "275920a8a5634e47e12253971db85946798795bbe4d9dfc1debf23533d823983" dependencies = [ "serde", ] @@ -6153,7 +6274,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix 1.0.7", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -7031,31 +7152,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "wasm_split_helpers" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50e0e45d0d871605a21fc4ee93a5380b7bdc41b5eda22e42f0777a4ce79b65c" -dependencies = [ - "async-once-cell", - "or_poisoned", - "wasm_split_macros", -] - -[[package]] -name = "wasm_split_macros" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f8a7f0bf54b0129a337aadfe8b716d843689f69c75b2a6413a0cff2e0d00982" -dependencies = [ - "base16", - "digest", - "quote", - "sha2", - "syn 2.0.104", - "wasm-bindgen", -] - [[package]] name = "web-sys" version = "0.3.77" @@ -7117,7 +7213,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -7185,6 +7281,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -7212,6 +7317,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -7243,6 +7363,12 @@ dependencies = [ "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -7255,6 +7381,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7267,6 +7399,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7285,6 +7423,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7297,6 +7441,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7309,6 +7459,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -7321,6 +7477,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/Cargo.toml b/Cargo.toml index f2aa27f..85aade0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,15 +20,15 @@ axum = "0.8.1" bon = "3.3.2" chrono = "0.4.39" console_error_panic_hook = "0.1.2" -dioxus = "0.7.0-alpha.1" -dioxus-server = { version = "0.7.0-alpha.1", default-features = false } +dioxus = "0.7.0-rc.0" +dioxus-server = { version = "0.7.0-rc.0" } futures = "0.3.31" http = "1.2.0" -leptos = "0.8.0-beta" -leptos_actix = "0.8.0-beta" -leptos_axum = "0.8.0-beta" -leptos_meta = "0.8.0-beta" -leptos_router = "0.8.0-beta" +leptos = "0.8.3" +leptos_actix = "0.8.3" +leptos_axum = "0.8.3" +leptos_meta = "0.8.3" +leptos_router = "0.8.3" sea-orm = "1.1.2" sea-orm-migration = "1.1.2" secrecy = "0.10.3" diff --git a/examples/axum/Cargo.toml b/examples/axum/Cargo.toml index ca292b9..440531e 100644 --- a/examples/axum/Cargo.toml +++ b/examples/axum/Cargo.toml @@ -10,14 +10,14 @@ repository.workspace = true version.workspace = true [dependencies] -axum = { workspace = true } +axum.workspace = true shield.workspace = true shield-axum = { workspace = true, features = ["utoipa"] } shield-memory = { workspace = true, features = ["method-oidc"] } shield-oidc = { workspace = true, features = ["native-tls"] } time = "0.3.37" tokio = { workspace = true, features = ["rt-multi-thread"] } -tower-sessions = { workspace = true } +tower-sessions.workspace = true tracing.workspace = true tracing-subscriber.workspace = true utoipa.workspace = true diff --git a/examples/dioxus-axum/clippy.toml b/examples/dioxus-axum/clippy.toml deleted file mode 100644 index 40456af..0000000 --- a/examples/dioxus-axum/clippy.toml +++ /dev/null @@ -1,8 +0,0 @@ -await-holding-invalid-types = [ - "generational_box::GenerationalRef", - { path = "generational_box::GenerationalRef", reason = "Reads should not be held over an await point. This will cause any writes to fail while the await is pending since the read borrow is still active." }, - "generational_box::GenerationalRefMut", - { path = "generational_box::GenerationalRefMut", reason = "Write should not be held over an await point. This will cause any reads or writes to fail while the await is pending since the write borrow is still active." }, - "dioxus_signals::Write", - { path = "dioxus_signals::Write", reason = "Write should not be held over an await point. This will cause any reads or writes to fail while the await is pending since the write borrow is still active." }, -] diff --git a/packages/integrations/shield-dioxus-axum/Cargo.toml b/packages/integrations/shield-dioxus-axum/Cargo.toml index c7fdbee..c5cbbb0 100644 --- a/packages/integrations/shield-dioxus-axum/Cargo.toml +++ b/packages/integrations/shield-dioxus-axum/Cargo.toml @@ -14,7 +14,7 @@ utoipa = ["shield-axum/utoipa"] [dependencies] async-trait.workspace = true -dioxus-server = { workspace = true, default-features = true } +dioxus-server.workspace = true shield.workspace = true shield-axum.workspace = true shield-dioxus.workspace = true diff --git a/packages/integrations/shield-dioxus/Cargo.toml b/packages/integrations/shield-dioxus/Cargo.toml index 710b741..559f535 100644 --- a/packages/integrations/shield-dioxus/Cargo.toml +++ b/packages/integrations/shield-dioxus/Cargo.toml @@ -14,6 +14,5 @@ server = ["dioxus/server"] [dependencies] async-trait.workspace = true dioxus = { workspace = true, features = ["fullstack", "router"] } -dioxus-server = { workspace = true, default-features = true } serde_json.workspace = true shield.workspace = true diff --git a/packages/integrations/shield-dioxus/src/routes/action.rs b/packages/integrations/shield-dioxus/src/routes/action.rs index eab75f6..52a1c3d 100644 --- a/packages/integrations/shield-dioxus/src/routes/action.rs +++ b/packages/integrations/shield-dioxus/src/routes/action.rs @@ -1,9 +1,7 @@ use dioxus::prelude::*; -use dioxus_server::{FromContext, extract}; -use serde_json::Value; -use shield::{ActionForms, Request}; +use shield::ActionForms; -use crate::{DioxusIntegrationDyn, ErasedDioxusStyle}; +use crate::ErasedDioxusStyle; #[derive(Clone, PartialEq, Props)] pub struct ActionProps { @@ -28,40 +26,68 @@ pub fn Action(props: ActionProps) -> Element { } } +// TODO: Figure out a way to access `FromContext` and `extract` without `dioxus/server` feature. + #[server] async fn forms(action_id: String) -> Result { - let FromContext(integration): FromContext = extract().await?; - let shield = integration.extract_shield().await; - let session = integration.extract_session().await; + #[cfg(feature = "server")] + { + use dioxus::prelude::{FromContext, extract}; + + use crate::integration::DioxusIntegrationDyn; + + let FromContext(integration): FromContext = extract().await?; + let shield = integration.extract_shield().await; + let session = integration.extract_session().await; - let forms = shield.action_forms(&action_id, session).await?; + let forms = shield.action_forms(&action_id, session).await?; + + Ok(forms) + } - Ok(forms) + #[cfg(not(feature = "server"))] + { + Ok(ActionForms { + id: action_id.clone(), + name: action_id, + forms: vec![], + }) + } } +#[cfg_attr(not(feature = "server"), allow(unused_variables))] #[server] pub async fn call( action_id: String, method_id: String, provider_id: Option, ) -> Result<(), ServerFnError> { - let FromContext(integration): FromContext = extract().await?; - let shield = integration.extract_shield().await; - let session = integration.extract_session().await; - - shield - .call( - &action_id, - &method_id, - provider_id.as_deref(), - session, - // TODO: Support request input. - Request { - query: Value::Null, - form_data: Value::Null, - }, - ) - .await?; + #[cfg(feature = "server")] + { + use dioxus::prelude::{FromContext, extract}; + use serde_json::Value; + use shield::Request; + + use crate::integration::DioxusIntegrationDyn; + + let FromContext(integration): FromContext = extract().await?; + let shield = integration.extract_shield().await; + let session = integration.extract_session().await; + + shield + .call( + &action_id, + &method_id, + provider_id.as_deref(), + session, + // TODO: Support request input. + Request { + query: Value::Null, + form_data: Value::Null, + }, + ) + .await?; + } Ok(()) }