Commit Graph
582 Commits
Author SHA1 Message Date
Evan Almloff d890cc72ac Fix mounted event after initial hydration (#3480)
* trigger queued mounted events immediately after hydrating

* add a playwright test to prevent regressions
2025-01-07 19:52:27 -08:00
Evan AlmloffandJonathan Kelley d41ab3a756 Fix hydration of suspense fragments that contain text nodes (#3287)
* Fix hydration of suspense fragments that contain text nodes

* fix release builds

* disable link deduplication

* restore meta tag deduplication

* Add a test for the failed hydration case

* make changes to the document trait non-breaking

* remove info log from server future hook

* restore default implementation - this was also a breaking change

* fix semver breakage

* clean up server_future

* Cleanup unused code

* fix clippy

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2025-01-07 19:47:23 -08:00
Miles Murgaw 273b70e9d6 Dioxus Playground Hot Reload Support (#3098)
* feat: playground hr support

* feat: playground hot-reload support

* revision: playground hot reloading
2025-01-07 13:07:58 -08:00
Yongkie WiyogoandYongkie Wiyogo 0a72cbac5b Fix compiler error in examples/fullstack-auth (#3359)
Co-authored-by: Yongkie Wiyogo <6004558-ywiyogo@users.noreply.gitlab.com>
2025-01-07 13:00:54 -08:00
Liigo Zhuang 26132cfc59 Keep rebuilding toast alive until dismissed manually or there's a build error (#3455) 2024-12-26 12:42:26 -05:00
Evan Almloff ecf8d16f3e Fix event closure invoked recursively (#3405) 2024-12-20 12:01:31 -08:00
Evan Almloff aab1258f0e remove the file engine feature in the html crate (#3392) 2024-12-20 12:00:03 -08:00
Evan Almloff d89ab3cfad Always run toast eval inside the runtime (#3313) 2024-12-10 16:47:51 -08:00
Evan Almloff b643461129 Fix hot reloading stylesheets with an existing query parameter and deduplicate random query param (#3315) 2024-12-09 09:09:57 -08:00
Jonathan Kelley 66a50240bc Update all docs links to 0.6, release 0.6 (#3225)
* update doc links to 0.6
* add new splash pages for crates
* update keyword features
* remove some unnecessary links
2024-12-06 19:15:15 -08:00
Jonathan Kelley 7d490dc3bd feat: integrate dioxus-logger inline (#3302)
* feat: integrate dioxus-logger inline

* remove log/simple logger references

* fix: add dioxus-data-id-0 to root elements to not emit errors internally

* drop config.toml and use cargo.toml profiles instead

* make clippy happy with the unit value lint

* feat: better presentation for logging
2024-12-06 16:27:05 -08:00
79a2f023e7 Add the onvisible event handler to Element (#2911)
* Add the `onvisible` event using the IntersectionObserver

* Add a visible example

This example is based on https://codepen.io/ryanfinni/pen/VwZeGxN

* Remove web-sys CustomEvent feature for html package

* update js bindings and hash

* Use dioxus doc instead of lorem ipsum

* Fix clippy warning

* Add get_target method to the event data

* Make `get_time` return an Instant instead of a f64

* fix merge conflicts, compilinga

* remove target

* small nits

* serialzie as time_ms

* fix timing, works on desktop

* remove latent nits, fix hash

* box size clippy

* fix browserlist cargo.lock

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-12-02 13:51:27 -08:00
igor f257529bec chore(web): bump web-sys & js-sys to 0.3.70 (#3256) 2024-11-27 10:45:36 +03:00
Evan Almloff 3d62fbf021 Fix base path on web and fullstack (#3247)
* Create a crate for constant serialization of config structs for manganis

* use SerializeConst for the image asset builder

* switch to a declarative macro for assets

* clean up asset macro a bit

* add serializable options for each asset type

* serialize const vec

* Add unique path formatting

* implement the new manganis macro

* optimize assets in the CLI

* Fix clippy

* Fix assets with dioxus formattable

* reduce fuzzing test limits

* use the new syntax in examples

* fix formatting

* Final doc and test pass on const-serialize

* fix avif support

* Fix manganis doc tests

* cache asset optimization

* Split out asset and bundled asset

* make hash pointer width independent

* remove const serialize cargo lock

* Fix manganis macro docs

* all tests passing

* add constvec::is_empty method to fix clippy lint

* remove nasm feature

* simplify test_rsplit_once test so typos passes

* fix range syntax for stable

* revert example change from clippy fix

* remove dioxus-static-site-generation workspace dependency

* always accept unix paths

* fix windows path seperator

* fix folder asset hash

* Optimize assets in a blocking task

* Fix asset options docs

* Document Asset and BundledAsset

* move manganis back into it's own folder

* simplify the linker macro a bit

* add more docs to AssetParser expansion

* fix manganis core doc test

* add image format helpers

* Fill in new cargo.tomls

* fix folders with explicit options

* Split by  both unix and windows path separators and take the smallest one

* fix string length

* Fix base path on web and fullstack

* Fix assets with base path

* fix fullstack base route with trailing slash

* fix clippy
2024-11-27 10:40:55 +03:00
Ryo Hirayama e1457744f0 Fix hydration race condition (#3240)
* Fix mount_to_root

* Remove WebsysDom.mount
2024-11-26 18:43:02 +01:00
Chris Rogus 1b54cb95a0 fix the downcast for formdata try_as_web_event (#3227) 2024-11-16 19:20:51 -05:00
Jonathan Kelley ac3e33af46 cli json output, dx bundle fix, dx serve --platform android, race condition, drop ssg platform (#3186)
* clean up logging to avoid random extra trace

* fix race condition with updates

* properly wire up verbose

* fix bundling (macos) and logging

* Add structured output

* clean up clap names

* extract out wire format

* switch structured key to json

* fix random println, fallback to `dioxus/platform`

* clean up logging for run/build

* clean up logging around project

* remove manual exits

* fix tokio runtime for mobile

* rework dog app

* rip out ssg

* Switch dioxus/axum to dioxus/server

* add android template inline

* pre restructure for bundle prep

* add the whole res directory

* Better theme for the app

* remove mobile demo now that most apps work natively

* self-referential android

* only use deep linking for assets

* fix imports for android

* clippy, fixup ios and android

* I'm not boxing compiler message you can't make me

* fix clippy on unix
2024-11-12 09:01:01 -05:00
Evan Almloff 5186d8dded Fix as web event (#3178) 2024-11-06 23:53:56 -05:00
Evan AlmloffandJonathan Kelley 281087469a Move the history provider into the context (#3048)
* move history providers into a separate crate

* start moving route providers into the renderers

* clean up intoroutable

* remove into routable

* fix router tests

* Provide history providers in each renderer

* implement nested routers

* move the lens out of the history crate

* re-export dioxus history trait in the prelude

* also re-export the history function

* fix history doctests

* some light cleanups

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-31 12:44:04 -07:00
Chris RogusandMatt Hunzinger e5a1a62644 use DragEvent not MouseEvent for drag events (#3137)
* use DragEvent not MouseEvent for drag events

* Simplify drag events and remove WebDragData struct

* use DragEvent not MouseEvent for drag events

* re-add the web_sys event reference for drag + mouse data

* remove now vestigial impls for MouseEvent

---------

Co-authored-by: Matt Hunzinger <matthunz2@gmail.com>
2024-10-31 09:44:27 -05:00
Ahmet Kaan GÜMÜŞ d3404bd13a fix: 🔒 removed the line that exposes file structure of web server (#3118)
in web/src/lib there is a line that says "Starting up" to the browser console. This is leaking information about server file structure.
Related: https://github.com/DioxusLabs/dioxus/issues/3117
2024-10-28 00:28:19 -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 AlmloffandJonathan Kelley baf5a95cae Fix cloned rsx double drop (#2839)
* Implement Rc generational pointers

* Clean up error handling a bit

* start adding tests

* Simplify a few types

* Separate Rc and normal generational boxes

* Add tests for rc drop and read

* Move over the pointer instead of the data in ReadOnlySignal props

* Fix panic on ref drop and release mode builds

* final rc signal cleanup

* use rc generational boxes for event handlers as well

* add a regression test for read only signal cloning

* merge main

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-14 09:23:09 -07:00
Evan AlmloffandJonathan Kelley 20d146d9bd Simplify the launch builder (#2967)
* improve documentation for the fullstack server context

* Add a section about axum integration to the crate root docs

* make serve_dioxus_application accept the cfg builder directly

* remove unused server_fn module

* improve fullstack config docs

* improve documentation for the server function macro

* fix axum router extension link

* Fix doc tests

* Fix launch builder

* Simplify the launch builder

* don't re-export launch in the prelude

* refactor fullstack launch

* Fix fullstack launch builder

* Update static generation with the new builder api

* fix some formatting/overly broad launch replacements

* fix custom menu example

* fix fullstack/static generation examples

* Fix static generation launch

* A few small formatting fixes

* Fix a few doc tests

* implement LaunchConfig for serve configs

* fix fullstack launch with separate web and server launch methods

* fix check with all features

* dont expose inner core module

* clippy and check

* fix readme

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-10-10 16:00:58 -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
igor d3e1ba415f feat(web): using None instead of Element (#3012)
Can mount the Dioxus component into every node.
As `Element` and `ShadowRoot` are `Node` we can
now mount a dioxus component into a shadow root.
2024-09-30 07:02:06 -05:00
Jonathan Kelley fd9229a768 Change file-engine to be file_engine for consistency 2024-09-17 17:49:06 -07:00
Jonathan Kelley 3fb1f739d1 Simplify cli-config, hotreload -> devtools (drop to 0 deps, fast compile times) (#2975)
* simplify cli-config crate
* clean up configs
* add devtools crate, update cargo imports
* fix serve addr, fix websocket proxy issue
* add comment about opt profiles
* rename hot-reload to devtools
2024-09-17 17:18:23 -07:00
Jonathan Kelley 143ad749ea Split out isrg from ssr and reorient build graph to make interpreter build 2x faster (#2969)
* split out isrg and core-types to speed up interpreter build
2024-09-16 16:49:06 -07:00
Jonathan Kelley c5f00bf7d4 Chore: remove old cruft in web crate (#2957) 2024-09-13 12:54:28 -07:00
Jonathan Kelley c7124e41fb Add space between rsx and exclamation point (#2956) 2024-09-13 08:31:39 -05:00
Miles MurgawandJonathan Kelley 8d68886310 CLI Fixes & Tweaks (#2846)
Fixes scrolling on vscode using simple fix
 Adds scroll modifier, scroll at 5 lines per scroll while holding shift key.
 Adds error handling for manganis failure that still lets the build run.
 Revises TUI rendering code.
 Move TUI "info bars" to the bottom of the terminal.
 Revised logging system with tracing
 Working [c] clear keybind. This has been removed.
 Removal of [h] hide keybind text (it does nothing)
 Some opinionated cleanups and renames to make tui logic easier to understand.
 Rolling log file & maybe add some more "internal" logging. Closes CLI Rolling Log File #2764
 Removes log tabs. Closes CLI: Color-code logs and get rid of tabs #2857
 Combines info bars.
 Working and good text selection.
 Print launch URL in console.
 Handle log lines properly and add formatting.
 Move MessageSource to a more reasonable location.
 Add some background styling to powerline (info bar) - Tried this and it doesn't look the greatest.
 Log Filtering
 Final Cleaning & Changes - I could do this forever
 Test Linux

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-09-13 01:34:19 -07:00
Jonathan Kelley 4963aa3118 fix autofmt: don't panic when writing blocks out without a srcfile (#2854)
* fix: don't panic when writing blocks out
* also fix serialization for hotreload
* fix windows line endings
2024-08-16 21:55:30 -07:00
ASR-ASUandEvan Almloff 2f49a89638 Add the onresize event handler to Element (#2479)
* Add the capability to handle resize event for web target

* Add the capability to handle resize event for desktop target

* Return all the sizes, not just the first one

* Fix conversion from platform to generic ResizedData for liveview

* Update the generated interpreter js code base

* Fix clippy warnings

* Fix inconsistent use of block_size and inline_size

* Rename `onresized` event to `onresize`

* Remove the the special-casing logic from the binding logic

* Propagating the resize events using CustomEvent

* Fix case convention in core ts

* revert changes to unified bindings

* Cleanup as suggested

* add a resize example

* Fix desktop resize events

* remove tracing from resize example

* use the raw resize entry so we can downcast on web

* remove unused ResizeEventDetail

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2024-08-15 01:23:49 +00:00
Evan Almloff cab573eefd Synchronous prevent default (#2792)
* add prevent default methods to the event

* sync prevent default almost working

* sync prevent default working

* Move event handling into the runtime

* update core tests

* restore desktop file dialog

* implement prevent default on web

* add a hint about the new prevent default method

* fix web prevent default

* Fix CTRL+click on links

* fix values memorize in place test

* Fix a few more tests

* Add a playwright test for sync prevent default

* Fix core doc tests

* create a deprecated VirtualDom::handle_event

* fix macos imports in desktop

* Fix onmounted event

* Fix liveview support

* switch to RefCell for metadata

* Remove println

* remove prevent default attribute

* remove web specific link behavior

* Fix liveview links

* more liveview fixes for link

* Fix merge conflicts

* Fix clippy

* use the new prevent default in the file upload example
2024-08-13 11:57:54 -07:00
Jonathan KelleyandEvan Almloff 0de3bf7aeb Fix nested rsx expansion by not using template titles (#2799)
* Fix nested rsx expansion by not using template titles

* fix writers with nameless templates

* fix clippy

* dont commit vscode fix

* fix release mode, pull out __template_name

* fix axum_desktop

* Fix core tests

* Make most fields of HotReloadedTemplate public for testing

* wip: formatting, compare all diff cases

* slightly smarter diffing for dynamic nodes

* add a comment about generic node diffing

* clean up mutations a bit

* fix load template

* simplify maybe_rebuild

* Restore write mutations flag in web

* write_mutations -> skip_mutations

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2024-08-13 01:59:04 +00:00
Evan Almloff 37ea8ab906 Fix suspense diffing (#2789)
* Fix suspense placeholders after creating a node
* add nested suspense client side core test
* fix resolve suspense
2024-08-06 13:54:58 -07:00
Evan Almloff b0a2e2418c Bubble errors from the server to the client on suspense boundaries (#2772)
* Bubble errors from the server to the client on suspense boundaries

* make resolving suspense boundaries O(n)
2024-08-02 19:01:55 -07:00
Miles Murgaw 3003362b52 remove: changelog.md (#2776) 2024-08-02 23:29:28 +00:00
Miles Murgaw f42ca65931 Fix Links & Add Link Checker (#2769)
* feat: link checker
2024-08-02 10:46:18 -07:00
Matt Hunzinger 4bf71111c8 Refactor WebEventExt (#2707)
* Create WebEventExt::try_as_web_event and refactor
* Inline and adjust error message
* Inline downcast methods
2024-07-31 13:01:25 -07:00
Evan Almloff 34bdcd15cf Switch to a pool of dynamic values for hot reloading (#2705)
* create the dynamic value pool

* assign ids to dynamic formatted segments

* separate the rendering and literal pools

* rsx output compiles again

* more examples compiling with new rsx expansion

* update template body explanation

* all workspace examples compile

* fix formatted segments in keys

* start hot reload diffing

* fix component literal hot reloading

* start integrate new hot reloading with the CLI

* simple hot reloads working

* Fix hot reloading blocks with components

* implement hot reloading for if chains

* Fix hot reloading after a template requires a full rebuild

* Fix hot reloading any attribute values

* remove unsafe from hot reload utils

* Fix hot reloading empty rsx

* add more hot reloading tests

* reorganize hot reload module

* fix web hydration

* fix empty rsx nodes in autoformatting

* fix tests

* remove path sorting logic from core

* make template names more consistent in debug mode

* fix quote_as_hot_reload_literal for explicitly typed literals

* fix can_be_shorthand for string literals

* fix formatted single dynamic expression

* Fix usize component properties and playwright tests

* remove default implementation for TemplateBody

* add a bunch more comments for diffing, scoring and why this scoring system is optimal
2024-07-30 17:16:27 +00:00
Miles Murgaw bd58a92441 CLI: Toasts & Tweaks (#2702)
* progress: cli toasts

* forgot the html

* progress: toasts

* revision: don't open splash on desktop

* fix: fmt, spellcheck
2024-07-25 14:38:45 -07:00
Evan Almloff bd484842bd Fix playwright tests (#2695) 2024-07-24 12:48:30 -07:00
Tristan F.andJonathan Kelley 9167cd9dec fix most typos, add crate-ci/typos to CI (#2653)
* fix most typos, add crate-ci/typos to CI

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
2024-07-23 17:49:33 -07:00
Miles Murgaw 4ccd9ffe19 revision: use JSON compatible serializer (#2592) 2024-07-23 14:36:37 -07:00
Evan Almloff e794be5d78 Improve warnings when trying to update outside of pending suspense boundaries on the server (#2575)
* Improve warnings when trying to update outside of pending suspense boundaries on the server

* remove suspense resolve log
2024-07-17 19:32:33 -07:00
88af3e7eff Hotreloading of for/if/body, formatted strings, literals, component props, nested rsx, light CLI rewrite, cli TUI (#2258)
Hotreload the contents of for loops, if chains, component bodies, props, attributes, and any literals discovered in rsx!
Add a TUI renderer to the CLI.
Improve the CLI build system to be async and parallel.
Refactor RSX to allow partial expansion of expressions.
Merge autofmt implementations for consistency.
Merge the representation of elements and components under the hood.
Add a diagnostics system for rsx for improved error messages.
Drop interprocess and move to websockets for communication between the CLI and the server.
Assign IDs to nodes and attributes in a stable way to be used in non compiler contexts.
Add hotreloading to any body of component/for loop/if chain/etc.

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Liam Mitchell <liamkarlmitchell@gmail.com>
2024-07-17 19:11:18 -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 Almloff 4cab834640 switch to comments as placeholder nodes (#2579) 2024-07-02 15:31:18 -07:00