* docs: clarify difference between use_context and consume_context
Document the key distinction: use_context is a hook that captures the
context value once on first render and caches it, following the rules
of hooks. consume_context reads directly from the runtime each time
and can be called from anywhere (event handlers, async tasks, etc.).
Fixes#3862
* fix: remove redundant explicit rustdoc link targets
* fix: use plain text for cross-crate use_context reference in rustdoc
- inline mac, windows, linux bundling in the cli
- remove tauri bundle from our dep tree
- trim down the rpm crate for fewer dependencies in tree
- migrate from blacksmith to warpbuild
- move off swc and instead use esbuild via tool
- use dev drives in windows CI
- use fork of nix action for faster caching
- test bundling in CI
- fix asset handling in linux
- add default APPDATA location for webview2 installs for dioxus apps on windows
The file_explorer example had two issues:
1. Used heuristic (contains '.') to detect files vs directories, which is unreliable
2. Tried to enter files as directories when clicked, causing errors
Changes:
- Use path.is_file() for accurate file detection
- Use path.is_dir() check before entering a directory
- Rename shadowed 'path' variable to 'path_display'
Fixes#5368
Co-authored-by: BillionClaw <267901332+BillionClaw@users.noreply.github.com>
* fix: handle empty string in calculator plus-minus button
calc_val() panics on empty string when AC is pressed before the
plus-minus button. Return 0.0 early for empty input.
Fixes#4858
* fix a few ci failures
* fix link check
---------
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
* feat(signals): add WritableResultExt trait
Add WritableResultExt mirroring the existing ReadableResultExt,
providing mutable access to signal values holding Result<T, E>.
Methods:
- as_mut(): returns Result<WritableRef<T>, WritableRef<E>>
- unwrap_mut(): returns WritableRef<T>, panics if Err
Closes#5293
* refactor(signals): use descriptive expect messages in WritableResultExt::as_mut
Replace bare .unwrap() calls with .expect() containing a descriptive
message about the failure mode. This gives better diagnostics if the
Result variant changes between the read and write lock acquisitions.
* switch to a single write to avoid race conditions with sync signals
---------
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
* initial version
* make custom permission work without const-vec change
* wiring up with cli
* yey symbol found
* wip
* holy moly
* proper ui
* cleanup
* okay
* wip cleanup
* reduce boilerplate code into mobile-core
* Delete copilot-instructions.md
* revert hello-world example for low diff
* fix android build in mobile-core
* rename permission to static_permission
* small success with popup location on android
* android popup working
* Refactor permission checks for readability
Improves code formatting in has_location_permission and check_permission functions by splitting long lines and updating function signatures for better readability. No functional changes were made.
* wip consolidate all java files and build from cli instead of build.rs
* few cli cleanups
* wip java_plugin macro
* cleanup cleanup cleanup
* Update java_plugin macro to use full relative file paths
The java_plugin macro now accepts full relative paths for Java files instead of assuming a fixed directory structure. Documentation and usage examples have been updated to reflect this change, improving flexibility and clarity for specifying file locations.
* Improve iOS geolocation permission and retrieval logic
Added checks for authorization status before requesting location permissions and retrieving location data. Now only requests permission if not determined, and attempts to retrieve cached location before starting location updates, improving efficiency and user experience.
* Add ios_plugin macro for iOS framework metadata
Introduces the ios_plugin! macro in mobile-core-macro for declarative iOS framework metadata embedding. Updates mobile-core to re-export the macro and refactors mobile-geolocation to use ios_plugin! instead of manual linker attributes.
* not needed
* simplify the plugin
* rename mobile-core to platform-bridge and mobile-core-macro to platform-bridge-macro
* Refactor metadata serialization buffer initialization
Replaces inline creation of ConstVec with a named EMPTY constant for buffer initialization in metadata serialization. This improves code clarity and maintainability.
* mobile-geolocation out of dioxus
* take the example also out of dioxus
* remove example from cargo toml
* remove demo css
* revert hello-world example
* revert mac.plist
* revert gitignore
* Remove basic usage example for permissions crate
Deleted the basic_usage.rs example file from the permissions crate. This change may be part of a cleanup or refactoring to remove outdated or unnecessary example code.
* Delete plan.md
* remove dups
* cleanup java build
* cleanup permission symbol extraction
* update todo
* small slop of tested permissions in enums for minimum diff
* Refactor symbol extraction into linker_symbols module
Moved generic symbol extraction logic from android_java.rs and permissions.rs into a new linker_symbols.rs module. Updated both files to use the shared utilities for finding symbol offsets, reducing code duplication and improving maintainability.
* wip consolidate ios and macos as darwin
* Add docs and re-export for MainThreadCell and MainThreadMarker
Expanded documentation for MainThreadCell, clarifying usage and safety. Changed visibility of MainThreadCell to public, improved method docs, and re-exported MainThreadMarker in darwin/mod.rs for easier access.
* Update Darwin framework symbol and section names
Changed the framework symbol prefix from '__DARWIN_FRAMEWORK__' to '__DARWIN_FW__' and updated the Mach-O section name from '__darwin_framework' to '__darwin_fw' for compliance with section name length limits and consistency.
* Fix Info.plist path handling for iOS and macOS
Adds comments and corrects the path to Info.plist for iOS and macOS app bundles. For iOS, Info.plist is at the root of the .app bundle, while for macOS it is inside Contents/. Also improves warning message to include the missing path.
* Handle missing permission symbols and web bundle case
Improves permission extraction by returning an empty manifest when no permission symbols are found or when building a web bundle, as permissions are runtime-only in that case. Adds debug logging for missing symbols and ensures robust handling of these scenarios.
* objc2 over framework
* windows, linux, web all permissions are runtime so cleanup
* only include permissions for build time
* cleanup unnecessary test
* more cleanup
* extract shared into dx-macro-helpers
* rc.3 to 0.7.0 for const-serialize
* Add CustomPermissionBuilder and enhance PermissionBuilder for better permission management
- Introduced `CustomPermissionBuilder` for creating custom permissions with platform-specific identifiers.
- Enhanced `PermissionBuilder` to support custom permissions and location permissions with a clear builder pattern.
- Updated documentation and examples in the macro README to reflect new usage patterns for custom and location permissions.
- Improved parsing logic in the macro to handle both builder and direct construction patterns for permissions.
* clippy fixes
* implement const cbor encoding + decoding for basic types
* Add #[used] attribute to linker sections for optimization protection
- Added #[used] attribute to linker sections in both permission and Android plugin macros to prevent the linker from optimizing away symbols, ensuring they are preserved even if unused.
- Created static references to linker sections to enhance defense-in-depth against optimization issues.
* implement map encoding and decoding
* fix map test
* wip unified linker symbol
* cleanup permissions
* pipe java sources with manganis as well
* all tests passing
* dynamically sized arrays
* smaller str encoding
* swap array and list and add more documentation
* move serialization and deserialization for each struct together
* support both legacy and new assets
* bump const serialize version
* fix asset conversion code
* pull out manganis symbol struct from tuble
* test reading old asset versions
* more list/array cleanup and bump rust version
* fix clippy
* Revert "pipe java sources with manganis as well"
This reverts commit ddea9a459d9ac26f3f037a74d9ae0de3edfced67.
* Revert "cleanup permissions"
This reverts commit 7b18500155237403e179f0783cb8903a4f158b80.
* Revert "wip unified linker symbol"
This reverts commit 813e33feddb30d26868f6ac6e6da318402ac138f.
* Revert "Add #[used] attribute to linker sections for optimization protection"
This reverts commit a94a7a3a5e8eee80060de9d66a53aabfcf554f96.
* update cargo lock
* wip permission through assets
* abit cleanup
* fix reexports
* fix assets
* Fix the permissions piping
* some small cleanups
* checkout const-serialize as per #4932 and fix build
* invoking swift as a package
* geolocation package & example dumping for easy testing
* keep geolocation simple for testing
* cleanups
* pipe everything through __ASSETS__ and cleanup
* remove linker_symbols helper file
* example
* re example
* copy build methos into mobile-plugin-build crate
* Add conditional import for dioxus_07 feature
Introduces a conditional import to use the dioxus_07 crate when the corresponding feature is enabled, improving compatibility with different dioxus versions.
* Improve error handling and JNI reference usage
Adds a null check for Objective-C instance initialization in the iOS geolocation plugin to prevent errors on failed allocation. Refactors Android callback to use local JNI references instead of creating unnecessary global references, reducing potential memory leaks.
* revert changes on playwright
* Update dioxus dependency to 0.7.2 in Cargo.lock
Removed dioxus 0.7.1 from dependencies, retaining only dioxus 0.7.2 for the dioxus-cli-optimization-test package.
* small cleanup
* Add legacy const-serialize 0.7 support to dx-macro-helpers
Introduces support for the const-serialize 0.7 format in dx-macro-helpers by adding a new dependency and export, as well as a helper function for serialization with layout padding. Updates manganis to use the new helper for serializing assets in the legacy format, simplifying code and improving maintainability.
* Add helper for legacy and current linker sections
Introduces generate_link_sections_with_legacy in dx-macro-helpers to emit both legacy and current linker sections for compatibility. Refactors manganis-macro to use this new helper, reducing duplication and improving maintainability.
* Fix lints
* Fix clippy and doctest
* Refactor asset bundling and allow large enum variant
Refactored Asset::bundled to use Vec<u8> instead of ConstVec for reading volatile slices, simplifying the code and improving compatibility. Added #[allow(clippy::large_enum_variant)] to SymbolData enum to suppress Clippy warnings about large enum variants.
* Update license URLs in README to use angle brackets
Changed license URLs in the README from parentheses to angle brackets for improved formatting and clarity.
* Fix asset deserialization with correct buffer type
Replaces the use of `bytes.read()` with `ConstReadBuffer::new(bytes.as_ref())` for asset deserialization, ensuring compatibility with the expected deserialization API.
* Refactor geolocation and asset handling for clarity
Removed unnecessary clones in geolocation example event handlers to simplify state management. Updated SymbolDataOrAsset to store SymbolData in a Box for improved memory handling and adjusted related logic. Fixed documentation example in geolocation lib to include PermissionState in the import.
* Update geolocation example and permissions usage docs
Removes unused variables in the geolocation example's App function. Updates the permissions crate documentation to reflect new API usage with PermissionBuilder and LocationPrecision.
* Update permissions-macro to use permissions crate
Switched imports and dev-dependency from permissions_core to permissions in permissions-macro. Updated documentation and examples to reflect the new crate usage.
* rollback const-serialize changes
* move items around (doesn't compile)
* convert gelocation plugin to example
* remove dx-macro-helpers
* we're just gonna full-send linker everything
* rollback desktop changes
* remove gradle
* fix most compile?
* fix dioxus vers
* small cleanups
* add claude design docs
* add ffi macro
* remove
* loads but not linking yet
* fix output leak
* a little bit closer but not quite
* improve android code gen
* sheeeeee works!!!
* small tweaks to demo
* replace ios/android plugin with ffi macro entirely
* simplify ffi module
* simplify again
* condense / rip out some stuff from manganis
* remove types form public api
* wip, permissions
* oops I broke it
* I unbroke it
* move arch doc
* remove extra manifest types
* drop bindgen file
* remove permission
* small cleanup
* remove unsafecall mtm thing
* yoink perms
* wire up manifest
* Add deeplinks
* add schema generation
* update schema
* wip....
* fix recurse limit schema generation
* wip, muck around with schema
* add inline dioxus.toml support
* merge bundle config schemas
* claude my man
* Remove cdecl, annotate ffi
* rename design docs
* wip: live activities
* wip: apple plugin bundling
* wip
* get live activities linking properly
* small cleanups
* remove sidecars
* remove widget
* yoink legacy
* cleanup
* more fixups
* wire up more things to dioxus.toml
* fix workspace join
* final cleanups
* fmt
* final bit of clippy
* ci tweak
* update schema
* fmt, doc
* update schema docs
---------
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
* Refactor cross-tls-crate-dylib configuration and update test output
- Commented out the crate-type configuration in Cargo.toml for cross-tls-crate-dylib.
- Modified the initial value of the thread-local variable FOO from 2.0 to 1.0 in the main.rs test file.
- Updated the output message in main.rs to be more descriptive.
- Added a new field `tls_fixups` to the JumpTable struct in subsecond-types, which will facilitate future runtime TLS sharing.
* ws hotpatch!
* remove old file
* undo core change
* svh
* Enhance rlib path resolution by incorporating -C extra-filename handling
* remove obj diffing
* small cleanups
* obj cache as files
* simplify
* simplify a bit
* dont bother round tripping cache
* extract to helper
* cleanup `build` function
* dont round-trip modified_crates
* make sure to wipe between full
* bit of a cleanup
* use explicit naming
* compact extra method
* fix temp cleanup
* fix warnign
* cleanup
* fmt, clippy
* trim
* works a bit better
* almost...
* it work?
* yay!
* codex tried a thing
* move
* reduce to 1
* remove search
* simplify
* adjust test case
* clippy
* fix: Handle HTTP errors in FromResponseParts
Check for non-success status codes before attempting to decode response
parts. For error responses, parse the JSON error payload and convert it
to a ServerFnError::ServerError.
Also make ErrorPayload fields pub(crate) to allow internal access.
* fixed test name
* fix: replace unwraps with errors in fullstack WebSockets
* refactor: pull the conversions to fullstack `RequestError` up from the core crate
* no breaking changes
---------
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
* docs: fix grammar and typos in comments and documentation
* docs: use British English style for e.g. and i.e. (no trailing comma)
Changed from American English style (e.g.,) to British English style (e.g.)
for consistency with the rest of the codebase."
The `android_runtime_lock` wasn't properly `cfg` guarded in various
places, so it got included on all operating systems, not just Android by
accident. This causes deadlocks when trying to use `muda`.
* Use humantime for build duration formatting in CLI
Replaces manual millisecond formatting with humantime::format_duration for improved readability of build duration logs. Adds humantime as a dependency in Cargo.toml.
* Format build duration with millisecond precision
Changed build duration logging to use millisecond precision instead of default formatting to avoid microsecond/nanosecond noise.
* Refactor duration formatting to use helper function to reduce code duplication.
---------
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Without this patch, simply instantiating the Jumpstart template in fullstack mode and making _any_ hot-patch change would result in a 404 on fetch and a client WASM panic.
This changes the fullstack server static asset routing so that, in debug builds, directories under the `public` tree (including `/wasm`) are served via `tower_http::services::ServeDir` instead of being eagerly expanded into a fixed set of routes at startup.
Today `dioxus_server::DioxusRouterExt::serve_static_assets` walks the `public` directory once at launch via `serve_dir_cached`, registering a separate route for every file it sees. That works fine for pre-baked assets, but it breaks down when dx/subsecond writes new files into `public` during a dev session. In a fullstack web app, wasm hot patches are emitted as timestamped files like `public/wasm/lib<name>-patch-<ts>.wasm`; the CLI tells the browser to fetch `/wasm/lib<name>-patch-<ts>.wasm` immediately, but the fullstack server never registered a route for that path, so the fetch returns 404 even though the file already exists on disk.
Non-fullstack dev builds do not have this problem because the dx devserver serves `public` directly using `ServeDir`, which consults the filesystem at request time. Fullstack dev, by contrast, proxies asset requests to the inner server, and that server only knows about whatever was in `public` at the moment its router was built.
This change narrows the gap by making `serve_static_assets` dynamic for directories in debug builds while preserving the existing behaviour elsewhere:
- For debug builds (`cfg(debug_assertions)`), `serve_dir_cached` now uses `ServeDir::new(&path)` when it encounters a directory. This means `/wasm`, `/assets`, and any other subdirectories are backed by a live directory listing, so new files like wasm patch modules and freshly emitted hashed CSS become immediately visible without restarting the fullstack server or rebuilding its router.
- For non-debug builds, the previous behaviour is preserved: `serve_dir_cached` continues to recurse and register one route per discovered file, still using `ServeFile::precompressed_br()` and `cache_response_forever` for hashed, cache-busted filenames.
This is a no-op for release builds, but in debug fullstack it's necessary for wasm hot patches and other dynamically-created assets that could 404 until the server happened to be restarted. It also aligns fullstack dev behaviour more closely with the plain web devserver, which already uses `ServeDir` for the `public` tree.
* Update repository URL and add README reference
* Fix repository URL and add readme field
Updated repository URL to point to the correct path and added a readme field.
* Update repository URL in Cargo.toml
* Update repository URL in Cargo.toml
* Update repository URL and add readme path
* Fix repository URL in Cargo.toml
---------
Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
* attempt fix for flakey playwright test
* fix link
* disable blitz-shell file dialog
* remove rfd integration in native for now
* undo file-dialog pass-thru in anticipation of blitz-shell update
* upgrade to blacksmith
* blitz-shell bump
* use faster runner
Currently when `serve_subsecond` is used and the user doesn't run the
app with `dx serve --hot-patching`, the function causes the future to be
constantly recreated in a loop. This fixes the behavior so that the
future is awaited once and then `serve_subsecond` returns.
* Enable native for hotdog, file-explorer, and bluetooth-scanner examples
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Fix crash in calculator example
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Add config macro for native
* Add Config struct to dioxus-native
* Re-export dioxus-native as dioxus::native
* Fix calculator example to work with dioxus-native
* Fix calculator_mutable example to work with dioxus-native
---------
Signed-off-by: Nico Burns <nico@nicoburns.com>
* Use native drop handler to push full file paths into element drop handler
* Remove debug code
* fmt
---------
Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This fixes a conflict between dx fmt and cargo fmt (rustfmt). Previously,
dx fmt would add indentation whitespace to blank lines inside RSX blocks,
but cargo fmt removes trailing whitespace from all lines. This made it
impossible for code to satisfy both formatters.
The fix skips adding indentation to empty lines in two places:
1. When indenting formatted RSX blocks inside expressions
2. When reassembling the final formatted output
Fixes#5223
Co-authored-by: Dmitry Minkovsky <dminkovsky@gmail.com>