Commit Graph
65 Commits
Author SHA1 Message Date
Jonathan Kelley f2b1c6d97f 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.
2025-10-03 18:26:19 -07:00
Jonathan Kelley 4f1d039bad clean up prelude (#4416)
* clear away prelude on dioxus

* clippy

* wip - drop prelude from dioxus-html

* docs clippy

* wip

* more fixe

* delete all preludes

* doc...

* better export

* merge some imports

* fewer global imports

* global incremental renderer

* fix cargo doc
2025-07-16 16:04:13 -07:00
Evan AlmloffandJonathan Kelley 519ec9d294 Move the document trait into a separate crate (#3035)
* add a default head method through eval
* remove the old document trait
* implement document for each platform
* pull out document into a dedicated crate to cut down on shared dependencies
---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-14 10:33:37 -07:00
Evan Almloff cda8bb24f1 Remove native and web features from dioxus-html (#3006)
* remove native and web features from dioxus-html

* Fix downcasting web events

* Fix desktop with tokio disabled
2024-10-10 13:35:59 -07:00
Evan Almloff 176e67e5b7 switch to a Document trait and introduce Script/Head/Style/Meta components (#2635)
* switch to a Document trait and introduce Script/Head/Style/Meta components

* Fix desktop title

* Insert special elements into the head during the inital SSR render

* Make all head component attributes optional

* hydrate head elements

* improve the server streaming head warning

* Document fullstack head hydration approach

* deduplicate head elements by href

* move Link into head::Link

* document head components

* add meta and title examples

* Fix a few doc examples

* fix formatting

* Add title to playwright tests

* serde is optional on web, but it is enabled by hydrate

* remove leftover console log
2024-07-17 20:54:03 -05:00
Evan AlmloffandJonathan Kelley 022e4ad203 Suspense boundaries/out of order streaming/anyhow like error handling (#2365)
* create static site generation helpers in the router crate

* work on integrating static site generation into fullstack

* move ssg into a separate crate

* integrate ssg with the launch builder

* simplify ssg example

* fix static_routes for child routes

* move CLI hot reloading websocket code into dioxus-hot-reload

* fix some unused imports

* use the same hot reloading websocket code for fullstack

* fix fullstack hot reloading

* move cli hot reloading logic into the hot reload crate

* ssg example working with dx serve

* add more examples

* fix clippy

* switch to a result for Element

* fix formatting

* fix hot reload doctest imports

* fix axum imports

* add show method to error context

* implement retaining nodes during suspense

* fix unterminated if statements

* communicate between tasks and suspense boundaries

* make suspense placeholders easier to use

* implement IntoDynNode and IntoVNode for more wrappers

* fix clippy examples

* fix rsx tests

* add streaming html utilities to the ssr package

* unify hydration and non-hydration ssr cache

* fix router with Result Element

* don't run server doc tests

* Fix hot reload websocket doc examples

* simple apps working with fullstack streaming

* fix preloading wasm

* Report errors encountered while streaming

* remove async from incremental renderer

* document new VirtualDom suspense methods

* make streaming work with incremental rendering

* fix static site generation

* document suspense structs

* create closure type; allow async event handlers in props; allow shorthand event handlers

* test forwarding event handlers with the shorthand syntax

* fix clippy

* fix imports in spawn async doctest

* fix empty rsx

* fix async result event handlers

* fix mounting router in multiple places

* Fix task dead cancel race condition

* simplify diffing before adding suspense

* fix binary size increase

* fix attribute diffing

* more diffing fixes

* create minimal fullstack feature

* smaller fullstack bundles

* allow mounting nodes that are already created and creating nodes without mounting them

* fix hot reload feature

* fix replacing components

* don't reclaim virtual nodes

* client side suspense working!

* fix CLI

* slightly smaller fullstack builds

* fix multiple suspended scopes

* fix merge errors

* yield back to tokio every few polls to fix suspending on many tasks at once

* remove logs

* document suspense boundary and update suspense example

* fix ssg

* make streaming optional

* fix some router and core tests

* fix suspense example

* fix serialization with out of order server futures

* add incremental streaming hackernews demo

* fix hackernews demo

* fix root hackernews redirect

* fix formatting

* add tests for suspense cases

* slightly smaller binaries

* slightly smaller

* improve error handling docs

* fix errors example link

* fix doc tests

* remove log file

* fix ssr cache type inference

* remove index.html

* fix ssg render template

* fix assigning ids on elements with dynamic attributes

* add desktop feature to the workspace examples

* remove router static generation example; ssg lives in the dioxus-static-generation package

* add a test for effects during suspense

* only run effects on mounted nodes

* fix multiple suspense roots

* fix node iterator

* fix closures without arguments

* fix dioxus-core readme doctest

* remove suspense logs

* fix scope stack

* fix clippy

* remove unused suspense boundary from hackernews

* assert that launch never returns for better compiler errors

* fix static generation launch function

* fix web renderer

* pass context providers into server functions

* add an example for FromContext

* clean up DioxusRouterExt

* fix server function context

* fix fullstack desktop example

* forward CLI serve settings to fullstack

* re-export serve config at the root of fullstack

* forward env directly instead of using a guard

* just set the port in the CLI for fullstack playwright tests

* fix fullstack dioxus-cli-config feature

* fix launch server merge conflicts

* fix fullstack launch context

* Merge branch 'main' into suspense-2.0

* fix fullstack html data

* remove drop virtual dom feature

* add a comment about only_write_templates binary size workaround

* remove explicit dependencies from use_server_future

* make ErrorContext and SuspenseContext more similar

* Tweak: small tweaks to tomls to make diff smaller

* only rerun components under suspense after the initial placeholders are sent to the client

* add module docs for suspense

* keep track of when suspense boundaries are resolved

* start implementing JS out of order streaming

* fix core tests

* implement the server side of suspense with js

* fix streaming ssr with nested suspense

* move streaming ssr code into fullstack

* revert minification changes

* serialize server future data as the html streams

* start loading scripts wasm immediately instead of defering the script

* very basic nested suspense example working with minimal html updates

* clean up some suspense/error docs

* fix hydrating nested pending server futures

* sort resolved boundaries by height

* Fix disconnecting clients while streaming

* fix static generation crate

* don't insert extra divs when hydrating streamed chunks

* wait to swap in the elements until they are hydrated

* remove inline streaming script

* hackernews partially working

* fix spa mode

* banish the open shadow dom

* fix removing placeholder

* set up streaming playwright test

* run web playwright tests on 9999 to avoid port conflicts with other local servers

* remove suspense nodes if the suspense boundary is replaced before the suspense resolves on the server

* ignore hydration of removed suspense boundaries

* use path based indexing to fix hydrating suspense after parent suspense with child is removed

* re-export dioxus error

* remove resolved suspense divs if the suspense boundary has been removed

* Fix client side initialized server futures

* ignore comment nodes while traversing nodes in core to avoid lists getting swapped out with suspense

* Pass initial hydration data to the client

* hide pre nodes

* don't panic if reclaiming an element fails

* fix scope stack when polling tasks

* improve deserialization out of length message

* Ok(VNode::placeholder()) -> VNode::empty()

* fix typo in rsx usage

* restore testing changes from suspense example

* clean up some logs and comments

* fix playwright tests

* clean up more changes in core

* clean up core tests

* remove anymap dependency

* clean up changes to hooks

* clean up changes in the router, rsx, and web

* revert changes to axum-hello-world

* fix use_server_future

* fix clippy in dioxus-core

* check that the next or previous node exist before checking if we should ignore them

* fix formatting

* fix suspense playwright test

* remove unused suspense code

* add more suspense playwright tests

* add more docs for error boundaries

* fix suspense core tests

* fix ErrorBoundary example

* remove a bunch of debug logging in js

* fix router failure_external_navigation

* use absolute paths in the interpreter build.rs

* strip '\r' while hashing ts files

* add a wrapper with a default error boundary and suspense boundary

* restore hot reloading

* ignore non-ts files when hashing

* sort ts files before hashing them

* fix rsx tests

* fix fullstack doc tests

* fix core tests

* fix axum auth example

* update suspense hydration diagram

* longer playwright build limit

* tiny fixes - spelling, formatting

* update diagram link

* remove comment and template nodes for suspense placeholders

* remove comment nodes as we hydrate text

* simplify hackernews example

* clean up hydrating text nodes

* switch to a separate environment variable for the base path for smaller binaries

* clean up file system html trait

* fix form data

* move streaming code into fullstack

* implement serialize and deserialize for CapturedError

* remove waits in the nested suspense playwright spec

* force sequential fullstack builds for CI

* longer nested suspense delay for CI

* fix --force-sequential flag

* wait to launch server until client build is done

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-01 20:50:36 -07:00
Evan AlmloffandJonathan Kelley 2523581cf4 Autocomplete rsx (#2421)
* autocomplete rsx

* hide the completions module

* fix autocomplete for identifiers that start with a raw identifier

* add field completion hints for props

* remove extra import

* Revert "add field completion hints for props"

This reverts commit 194899c73783e0f9b5d601d53365746d838f2048.

* fix autocomplete inside raw expressions

* fix autofmt

* feat: just use regular ifmt if it's compatible

reuses the tokens for ifmt so RA provides its HIR lowering on simple formatted strings

* fix merging ifmt strings

* add a better error message for components called like functions

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-05-22 07:24:50 -05:00
Evan Almloff 194c9d43e3 fix merge 2024-01-08 14:51:35 -06:00
Evan Almloff e5df83ceec Merge branch 'master' into pr/atty303/1349 2024-01-06 08:52:37 -06:00
Evan Almloff dccfba12d8 Merge branch 'master' into events-2 2024-01-04 19:02:00 -06:00
Evan Almloff afb258b658 Fix elements and attributes mapping for dx translate 2024-01-03 15:18:27 -06:00
Evan Almloff 77d53df532 Merge branch 'master' into pr/atty303/1349 2023-10-31 13:39:20 -05:00
ealmloff 5bb06b9719 Merge branch 'master' into events-2 2023-10-30 15:37:29 -05:00
Leonard 2d1234c3d1 Include README and Dioxus logo in package docs (#1536)
* Include README in docs.rs and add Dioxus logo

* Update README.md
2023-10-10 10:52:48 -05:00
Evan Almloff b60671e0fe fix non extending attributes 2023-09-27 10:02:49 -05:00
Evan Almloff a9bb04722f split the point interaction trait into smaller traits for touch compatibility 2023-09-12 10:01:53 -05:00
Evan Almloff df222c121a port examples to new events 2023-09-01 15:38:55 -05:00
Evan Almloff b54f7dd5d2 fix no default features on the web renderer 2023-08-25 21:28:44 -05:00
Evan Almloff ca1a502714 use an event converter for bundle splitting 2023-08-25 21:03:03 -05:00
Evan Almloff 299b123446 trait based event system 2023-08-25 17:02:48 -05:00
Evan Simkowitz bad30786e2 address comments 2023-08-23 22:09:39 -04:00
Evan Simkowitz 56095116e2 Fix tests 2023-08-23 17:58:43 -04:00
Evan Simkowitz e0f42f8173 Fix rink 2023-08-23 13:31:42 -04:00
Evan Simkowitz cc3f60dd2f Adding PointInteraction trait, etc. 2023-08-22 23:29:24 -04:00
Miles MurgawandEvan Almloff 6210c6fefe Convert use_eval to use send/recv system (#1080)
* progress: reworked

don't run this, it'll kill your web browser

* feat: use_eval but with comms

* revision: async recv & recv_sync

* revision: use_eval

* revision: standard eval interface

* revision: use serde_json::Value instead of JsValue

* revision: docs

* revision: error message

* create: desktop eval (wip)

* fix: desktop eval

* revision: wrap use_eval in Rc<RefCell<_>>

* fix: fmt, clippy

* fix: desktop tests

* revision: change to channel system

- fixes clippy errors
- fixes playwright tests

* fix: tests

* fix: eval example

* fix: fmt

* fix: tests, desktop stuff

* fix: tests

* feat: drop handler

* fix: tests

* fix: rustfmt

* revision: web promise/callback system

* fix: recv error

* revision: IntoFuture, functionation

* fix: ci

* revision: playwright web

* remove: unescessary code

* remove dioxus-html from public examples

* prototype-patch

* fix web eval

* fix: rustfmt

* fix: CI

* make use_eval more efficient

* implement eval for liveview as well

* fix playwright tests

* fix clippy

* more clippy fixes

* fix clippy

* fix stack overflow

* fix desktop mock

* fix clippy

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2023-07-21 17:36:25 -05:00
Evan Almloff 9fa912bb59 create native file engine bindings for TUI/Blitz 2023-04-20 10:12:11 -05:00
Evan Almloff a42ed7d445 create hot-reload-context flag 2022-12-23 15:08:44 -06:00
Evan Almloff e5a5850354 merge master 2022-12-20 20:48:28 -06:00
Evan Almloff 493ee1cb3f Merge branch 'upstream' into fix-hot-reloading 2022-12-19 21:17:22 -06:00
Evan Almloff 4364a4b511 handle updating templates better 2022-12-19 19:28:44 -06:00
Jon Kelley 5ac9b595ea Revert "fix: liveview interpreter using new templates" 2022-12-16 14:20:05 -08:00
Jonathan Kelley e256fe1079 wip: add html event type 2022-12-14 19:07:33 -08:00
Jonathan Kelley 85657d3906 feat: rip out mutations for templates 2022-12-01 00:46:15 -05:00
Jonathan Kelley 18d6b1ad6f feat: get web working properly 2022-11-30 17:21:10 -05:00
Jonathan Kelley 8caabb97d8 wip: more work on html 2022-11-15 16:51:22 -08:00
Jonathan Kelley 47d0f51e00 wip: overhaul event system 2022-11-15 16:05:22 -08:00
Reinis Mazeiks 765baf6e48 Rename module input to avoid naming conflict with element of the same name
Not sure if this was supposed to be allowed, but it was causing https://github.com/rust-lang/rust/issues/96934
2022-05-11 13:47:58 +03:00
Reinis Mazeiks 3fec31fe50 Use keyboard_types instead of bespoke ModifierSet 2022-05-07 10:05:52 +03:00
Reinis Mazeiks 2ef332085c Refactor: move input types to separate module 2022-05-07 09:39:53 +03:00
Reinis Mazeiks 6a5a3f47cc Remove allow(deprecated) to bring back the warnings 2022-05-07 00:59:12 +03:00
Reinis Mazeiks 0dbd3e370e Rusty MouseData API 2022-05-06 23:54:07 +03:00
Aster 8d42191d7a Add From trait to convert web_sys Events to html Data 2022-02-12 20:57:13 +08:00
Jonathan Kelley 95bd17e38f wip: more raw ptrs 2021-11-05 18:02:44 -04:00
Jonathan Kelley 601078f9cf fix: desktop and mobile 2021-10-22 01:16:39 -04:00
Jonathan Kelley cfc24f5451 feat: support innerhtml 2021-10-18 18:07:19 -04:00
Jonathan Kelley 285b33dd38 docs: update readme 2021-10-12 02:00:09 -04:00
Jonathan Kelley 4a4c7afca7 feat: shared state mechanisms 2021-10-11 15:35:20 -04:00
Jonathan Kelley da4423c141 bugs: fix web list issue 2021-10-10 22:27:08 -04:00
Jonathan Kelley 51e20052d9 polish: and publish 2021-09-24 20:53:58 -04:00
Jonathan Kelley 823adc0834 polish: clean up the web module 2021-09-24 20:11:30 -04:00