codify "platform" into resolution logic, server-fn/fullstack overhaul (#4596)

overhaul dioxus fullstack using a new implementation of server_fn

This PR is a complete rewrite of dioxus fullstack designed to improve compatibility with axum and to fix a number of compilation errors based on feature flag unification plumbing through macros.
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-10-03 18:26:19 -07:00
1 parent 8421c3aef0
commit f2b1c6d97f
424 files changed
+17284 -6624

No files matched your search

@@ -0,0 +1,22 @@
//! A simple example on how to use assets loading from the filesystem.
//!
//! Dioxus provides the asset!() macro which is a convenient way to load assets from the filesystem.
//! This ensures the asset makes it into the bundle through dependencies and is accessible in environments
//! like web and android where assets are lazily loaded using platform-specific APIs.
use dioxus::prelude::*;
static ASSET_PATH: Asset = asset!("/examples/assets/logo.png");
fn main() {
dioxus::launch(app);
}
fn app() -> Element {
rsx! {
div {
h1 { "This should show an image:" }
img { src: ASSET_PATH }
}
}
}
@@ -0,0 +1,31 @@
//! This example shows how to load in custom assets with the use_asset_handler hook.
//!
//! This hook is currently only available on desktop and allows you to intercept any request made by the webview
//! and respond with your own data. You could use this to load in custom videos, streams, stylesheets, images,
//! or any asset that isn't known at compile time.
use dioxus::desktop::{use_asset_handler, wry::http::Response};
use dioxus::prelude::*;
const STYLE: Asset = asset!("/examples/assets/custom_assets.css");
fn main() {
dioxus::LaunchBuilder::desktop().launch(app);
}
fn app() -> Element {
use_asset_handler("logos", |request, response| {
// We get the original path - make sure you handle that!
if request.uri().path() != "/logos/logo.png" {
return;
}
response.respond(Response::new(include_bytes!("../assets/logo.png").to_vec()));
});
rsx! {
Stylesheet { href: STYLE }
h1 { "Dynamic Assets" }
img { src: "/logos/logo.png" }
}
}
+35
View File
@@ -0,0 +1,35 @@
//! This example shows how to add metadata to the page with the Meta component
use dioxus::prelude::*;
fn main() {
dioxus::launch(app);
}
fn app() -> Element {
rsx! {
// You can use the Meta component to render a meta tag into the head of the page
// Meta tags are useful to provide information about the page to search engines and social media sites
// This example sets up meta tags for the open graph protocol for social media previews
document::Meta {
property: "og:title",
content: "My Site",
}
document::Meta {
property: "og:type",
content: "website",
}
document::Meta {
property: "og:url",
content: "https://www.example.com",
}
document::Meta {
property: "og:image",
content: "https://example.com/image.jpg",
}
document::Meta {
name: "description",
content: "My Site is a site",
}
}
}
@@ -0,0 +1,20 @@
//! This example shows how to add metadata to the page with the Meta component
use dioxus::prelude::*;
fn main() {
dioxus::launch(app);
}
fn app() -> Element {
rsx! {
// You can use the Meta component to render a meta tag into the head of the page
// Meta tags are useful to provide information about the page to search engines and social media sites
// This example sets up meta tags for the open graph protocol for social media previews
Meta { property: "og:title", content: "My Site" }
Meta { property: "og:type", content: "website" }
Meta { property: "og:url", content: "https://www.example.com" }
Meta { property: "og:image", content: "https://example.com/image.jpg" }
Meta { name: "description", content: "My Site is a site" }
}
}