Commit Graph
42 Commits
Author SHA1 Message Date
Evan Almloff d8d11db403 Boxed and mapped signals preparing for stores (#4413)
This PR contains just the breaking changes required for the upcoming store implementation. It adds two new primitives:

Mutable mapped signals (without a different subscriber list). This lets you scope a writable value and pass it to a child component. It requires two closures to map the immutable and mutable references to the inner signal. With stores, these closures will be derived
Boxed readable and writable values (ReadSignal, and WriteSignal). Any readable or writable types can be converted to a read signal or write signal with the boxed method or built in types are automatically converted into the boxed variants when passing into props


* map signals mutably

* boxed signals

* remove mutable borrow type from boxed writable

* improve map mut example

* restore boxed_mut helper

* make boxed readable/writable types copy

* Move away from the ReadOnlySignal alias in examples

* automatically convert Write

* Fix some tests

* ReadSignal and WriteSignal

* move read only signal alias

* make maps copy

* store prototype

* implement derive macro

* Handle generics in the derive macro

* Make Selector boxable

* derive boxed conversion

* Get rid of store type

* Remove hardcoded type from derive macro

* selector -> store

* Refactor store implementation

* more vec methods

* todo mvc store example

* Implement Storable for HashMap

* fix write

* restore sorting logic in todomvc

* derive readable and writable

* improve todomvc store example

* Result store

* Option store

* collect dead subscribers

* fix clippy and formatting

* recognize some common foreign types automatically

* fix foreign stores in props

* slice and array selectors

* clean up store example

* remove stores

* writable is child owned

* fix typo

* fix clippy

* fix doc tests
2025-07-31 13:19:55 -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
ASR-ASUandEvan Almloff 1dfa1b5e7f Use of async_std::task::sleep instead of tokio::time::sleep in examples (#2912)
* Use of async_std::task::sleep instead of tokio::time::sleep

* Make the clock example run on wasm

* Add control_focus and eval examples to Cargo.toml

* Use web-time on desktop; It just falls back to std on non-wasm platforms

---------

Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
2024-09-03 15:16:37 +00: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
Evan Almloff b3cd4fac10 set up example scaping for docs.rs (#2450) 2024-05-28 13:05:55 -07:00
Jonathan Kelley cfc119cce2 Update more examples, add css for more examples 2024-02-14 13:48:58 -08:00
Jonathan Kelley 8f70a84c70 Use futures_util mutex instead of flume for sending flush lock wakeups 2024-02-02 13:09:26 -08:00
Jonathan Kelley 7c2947a131 Implement effects using reactivecontext 2024-02-01 13:21:52 -08:00
Jonathan Kelley 0c71b95e82 skeleton of use_server_future with reactivity 2024-02-01 13:21:52 -08:00
Jonathan Kelley 6818bbe10a Make use_future take an impl FnMut + 'static, don't include router prelude when we don't need to 2024-01-31 16:33:53 -08:00
Jonathan Kelley 8f07d881a6 Switch todo!() to unreachable!/unimplemented! where it matters 2024-01-31 16:26:20 -08:00
Jonathan Kelley a72c035de4 Fix cargo check on examples 2024-01-30 17:59:57 -08:00
Jonathan Kelley dcdada542b Properly implement wait_for_suspense
Wait_for_suspense now does not call flush_sync, making it
appropriate for deferring effects on the server. Futures will
still run on the server (as needed to progress suspense)
but use_effect / and memo watchers will not run on the server
2024-01-29 14:12:05 -08:00
Evan Almloff 1f88103dca only implement T -> Readonlysignal 2024-01-29 15:57:23 -06:00
Evan Almloff 50e3216d8b convert T into signals automatically 2024-01-29 13:36:39 -06:00
Jonathan Kelley d34538f4da Add memochain example 2024-01-26 22:33:41 -08:00
Jonathan Kelley b0b7de3692 Update signals example 2024-01-24 15:53:39 -08:00
Jonathan Kelley c0522bc152 cargo check all 2024-01-23 16:58:29 -08:00
Jonathan Kelley c8e4c96762 Fix panic in demo 2024-01-23 16:45:58 -08:00
Evan Almloff e65c5f0eb3 depreciate the render macro 2024-01-16 13:18:46 -06:00
Evan Almloff 407a82588a fix more examples 2024-01-16 12:28:21 -06:00
Evan Almloff db35a9b48c add platform specific functions for launching apps for workspaces 2024-01-16 11:45:02 -06:00
Evan Almloff 7e4d2debe0 implement launch builder for the desktop and web platforms 2024-01-16 08:42:16 -06:00
Jonathan Kelley 98bd78de43 Fix issue with mutability in component macro 2024-01-15 23:57:10 -08:00
Jonathan Kelley 8559984e9d and mut bound to mut methods on signals 2024-01-15 23:24:59 -08:00
Jonathan Kelley d88561f973 Adjust impl for signal syntax to allow cloned values 2024-01-15 21:43:30 -08:00
Jonathan Kelley 33bba24867 Experiment with call syntax only working for copy types 2024-01-15 21:12:44 -08:00
Jonathan Kelley 1dde044697 remove cx.render 2024-01-13 21:12:21 -08:00
Jonathan Kelley fae0b08e61 Fix the router and stub out a number of crates to get compiling 2024-01-13 20:51:37 -08:00
Jonathan Kelley d9b84f9f8f Disambiguate expressions in rsx by requiring curlies 2024-01-10 19:33:34 -08:00
Jonathan Kelley 9cdbf81a4b fix clippy lint 2023-10-17 16:06:43 -07:00
Jonathan Kelley 65e21d7874 Change signals example a bit 2023-10-17 15:52:13 -07:00
Jonathan Kelley e819702fc5 Add into_vnode temporary logic for more things
This commit adjusts how rsx! works, making it more forgiving with signals.

Notably, we add the temporaries to if chains too.
2023-10-17 15:42:21 -07:00
Jonathan Kelley 7e2164d6d6 Add toggle 2023-10-15 17:52:01 -07:00
Jonathan Kelley 741bfbc9ac Add toggle to signals example 2023-10-15 17:50:23 -07:00
Jonathan Kelley 14b3fa72e4 Change the semantics of exprs/for loops allocations strategy
This commit adjusts how exprs and for loops are handled within
rsx. This is a breaking change in terms of codegen, but has
slight semantic changes as well.

Now, when exprs/for loops are allocated, they are given a temporary.
The temporary is elided to the <'a> lifetime of the bump, to satisfy
the borrow checker. This fixes issues with signals where exprs/for
loops mapping vecs out of RefCells would be caught up without a
temporary lifetime.
2023-10-15 17:40:56 -07:00
Evan Almloff 190c65b15d fix memo and add tests 2023-08-07 14:31:03 -07:00
Jonathan Kelley 2d8841cf70 Add lazy contexts to signals 2023-07-14 12:52:49 -07:00
Jonathan Kelley 14a1e4145e feat: implement function accessor 2023-01-01 22:57:16 -05:00
Jonathan Kelley fd92079eb3 feat: add recycling of rts in signals 2023-01-01 22:09:08 -05:00
Jonathan Kelley c0315e55f4 chore: more signals methods 2023-01-01 22:02:49 -05:00
Jonathan Kelley 4f9d67fb45 feat: simple signals implementation 2023-01-01 19:57:33 -05:00