Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leptos_dom v2 #119

Merged
merged 488 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
488 commits
Select commit Hold shift + click to select a range
d44c7f1
remove `Transition` `DynChild` workaround
jquesada2016 Dec 11, 2022
b9e8777
Update `<For/>` API
gbj Dec 11, 2022
109863c
Update SSR benchmark code to new APIs
gbj Dec 11, 2022
811449d
stopped `DynChild` from panicking when nested `DynChild` run within t…
jquesada2016 Dec 11, 2022
86d5f4c
Update `<For/>` in example
gbj Dec 12, 2022
2389cec
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 12, 2022
9bc8492
removed impl of `IntoView` for `&str` and replaced with `&'static str…
jquesada2016 Dec 12, 2022
ff21f38
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 12, 2022
88435af
Update `counter-isomorphic`example
gbj Dec 12, 2022
073bd75
Add .gitignore
gbj Dec 12, 2022
c481e46
Update `counter-isomorphic`
gbj Dec 12, 2022
c4cc3e9
Merge in changes from `main`
gbj Dec 12, 2022
fcae17e
Streamline streaming SSR
gbj Dec 12, 2022
37ab7b3
Fix imports when in SSR mode so we don't run wasm-bindgen code
gbj Dec 12, 2022
c4eeb4f
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 12, 2022
4a1d16b
Properly reset ID in streaming
gbj Dec 12, 2022
9c0d813
Resolve issue with scope disposal panicking because it can't find run…
gbj Dec 12, 2022
9dbbb26
made `is_server` and helpers `const fn` and added `View::into_html_el…
jquesada2016 Dec 12, 2022
5881fb9
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 12, 2022
0b11a8d
fixed compilation on non-CSR targets
jquesada2016 Dec 12, 2022
035f929
Merge class prop back into A component
gbj Dec 12, 2022
1804a65
Merge in updates to meta package
gbj Dec 12, 2022
8a0e56a
Properly namespace Fragment when used
gbj Dec 12, 2022
6b6c54e
Updating hackernews example
gbj Dec 12, 2022
b06a4ba
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 12, 2022
e2ef293
added `IntoFragment` trait for all `IntoIterator` and also impl `From…
jquesada2016 Dec 12, 2022
582cd7d
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 12, 2022
ce5355d
impl `IntoView` for `Vec<impl IntoView>
jquesada2016 Dec 12, 2022
2c9eff3
impl `IntoView` for all `std` types that made sense
jquesada2016 Dec 12, 2022
99ff73c
applied fix per gbj's suggested
jquesada2016 Dec 12, 2022
a75cbee
started working on component macro
jquesada2016 Dec 13, 2022
e499c88
Consolidating hydration key generation
gbj Dec 13, 2022
58d2ce1
Use `Scope`-based hydration key generation
gbj Dec 13, 2022
9233598
Don't overwrite `MetaContext` from integration
gbj Dec 13, 2022
069fc88
Update SSR support for `Suspense`/`Transition`
gbj Dec 13, 2022
657de9d
Remove log
gbj Dec 13, 2022
10799c3
Properly dispose
gbj Dec 13, 2022
8efb288
Properly set hydration key
gbj Dec 13, 2022
5ca169a
Properly handle `Scope` when creating component children
gbj Dec 13, 2022
286c951
Merge branch 'leptos_dom_v2' into leptos_dom_v2_component
jquesada2016 Dec 13, 2022
39e809f
initial impl of `component` macro with inline doc comments and `Typed…
jquesada2016 Dec 13, 2022
4134d2f
Working on `router` example
gbj Dec 13, 2022
cac1187
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 13, 2022
eeaccfc
moved fn block into `Component::new`
jquesada2016 Dec 13, 2022
5aab8e4
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 13, 2022
cc0bf20
Use the correct identifier for `cx` here
gbj Dec 13, 2022
5e06eb1
Correct use of `cx`
gbj Dec 13, 2022
4c12388
reverted to redeclaring the component fn within itself
jquesada2016 Dec 13, 2022
caa919b
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 13, 2022
a7a3585
now tracking scope name
jquesada2016 Dec 13, 2022
21178b1
Correct definitions of `is_browser` and `is_server`
gbj Dec 14, 2022
f17c7fd
Remove duplicated `window_event_listener`
gbj Dec 14, 2022
f6acecd
Fix Wasm import URL in integrations
gbj Dec 14, 2022
621122a
Fix Suspense/Transition SSR
gbj Dec 14, 2022
b37a36a
allowing clippy lint for too many arguments on components
jquesada2016 Dec 14, 2022
e1836af
Fix `.wasm` location in integration
gbj Dec 14, 2022
fee0f54
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 14, 2022
6e4448d
SSR work with missing node IDs
gbj Dec 14, 2022
e3e0460
Disable SSR macr until node ID generation is done
gbj Dec 14, 2022
adee33a
initial impl of `#[prop()]`
jquesada2016 Dec 14, 2022
5f95776
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 14, 2022
218c4d3
moved body back inside itself to allow forwarding attributes
jquesada2016 Dec 14, 2022
c463579
Round 1 of `next_hydration_key()`
gbj Dec 15, 2022
3ef64bd
<Suspense/> streaming and hydration issue
gbj Dec 15, 2022
01013b0
Implement classes in SSR macro path
gbj Dec 15, 2022
1b0aa4d
Disable macro SSR until I've added IDs
gbj Dec 15, 2022
416e1a6
Change `start` to `hydrate` in example
gbj Dec 15, 2022
9eadac9
added `HydrationCtx` helpers and fixed a couple bugs with the hydrati…
jquesada2016 Dec 15, 2022
3b99d2d
added tracing support to `component` macro
jquesada2016 Dec 15, 2022
422233e
removed some HydrationCtx things and improved tracing for `DynChild`
jquesada2016 Dec 15, 2022
ce9aec2
started porting router to `#[component]`
jquesada2016 Dec 15, 2022
1aaacba
ported `ActionForm`
jquesada2016 Dec 15, 2022
5405dcd
ported MultiActionForm
jquesada2016 Dec 15, 2022
0a8b516
ported `A`
jquesada2016 Dec 15, 2022
34697b7
fixed form components to take `children(cx)` directly instead of a cl…
jquesada2016 Dec 15, 2022
610e38a
fixed `Coutlet` from being a double component
jquesada2016 Dec 15, 2022
8adf910
ported `Routes`
jquesada2016 Dec 15, 2022
5603fac
ported `Route`
jquesada2016 Dec 15, 2022
3e508b1
impl `#[component(transparent)]`
jquesada2016 Dec 15, 2022
a591d54
changed router to directly return children, rather than a closure to …
jquesada2016 Dec 15, 2022
04f331d
Fix missing HTML
gbj Dec 16, 2022
a253d22
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 16, 2022
fefca82
Minimal tracing to show order of rendering
gbj Dec 16, 2022
c6d30a7
FIx issues I introduced to SSR while logging this
gbj Dec 16, 2022
01252b8
Fix `<Suspense/>` SSR
gbj Dec 16, 2022
e6e71cb
Remove extra logging
gbj Dec 16, 2022
1826d4b
Remove extra logging
gbj Dec 16, 2022
b83cf4d
Clean up Suspense SSR
gbj Dec 16, 2022
688b0a6
started fine-tunning `view` macro spans
jquesada2016 Dec 16, 2022
5a44f9e
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 16, 2022
cd178c5
using `format_ident` instead of `Ident::new`
jquesada2016 Dec 16, 2022
6cfd2ba
added prop docs to props builder
jquesada2016 Dec 16, 2022
d65fde1
Fix `Link` in SSR
gbj Dec 16, 2022
4823e0e
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 16, 2022
abc117b
annotated `For` with `#[component]`
jquesada2016 Dec 16, 2022
df517ea
Add transition support
gbj Dec 16, 2022
64c29b1
Remove unused import
gbj Dec 16, 2022
4e8ad64
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 16, 2022
ae16c2f
prepending `::` to `leptos` imports
jquesada2016 Dec 16, 2022
aa71e1f
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 16, 2022
9c6aaed
Fix issue of `<Routes/>` mismatch
gbj Dec 17, 2022
df41e4d
FIxes for Suspense/Hydration
gbj Dec 17, 2022
e140549
now removing `id` and `leptos-hk` from elements
jquesada2016 Dec 17, 2022
234e1cd
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 17, 2022
d071a7c
added `HydrationCtx` helper methods for forcebly adding `leptos-hk`, …
jquesada2016 Dec 17, 2022
3195ab4
Get `Suspense`/`Transition` hydration working
gbj Dec 18, 2022
d79d4c4
fixed `Fragment::lazy` that should take `FnOnce
jquesada2016 Dec 18, 2022
c0a407b
Fix `--release` builds
gbj Dec 18, 2022
e8aaa77
Remove now-unused hydration stuff from `Scope`
gbj Dec 18, 2022
eb573bf
Remove `HydrationKey` from `leptos_reactive`
gbj Dec 18, 2022
a845bf1
Clear warnings
gbj Dec 18, 2022
c635adb
Fix Suspense & Transition, hopefully for last time (lol)
gbj Dec 18, 2022
fc89214
Update `parent-child` example
gbj Dec 18, 2022
9d37077
printing html as it is being streamed to client
jquesada2016 Dec 18, 2022
eccbc42
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 18, 2022
83c8f8b
Clear warnings in `#[component]` macro
gbj Dec 19, 2022
c103c8f
Suppress warnings about unused `Scope` variable in components
gbj Dec 19, 2022
51b0ec3
Clear warnings in `view` macro
gbj Dec 19, 2022
da4b46e
Clear warnings and improve `#[cfg]` readability
gbj Dec 19, 2022
5ee8b20
Clear warnings
gbj Dec 19, 2022
557bd25
Clear warnings
gbj Dec 19, 2022
c63c872
Clear warnings in `router` example
gbj Dec 19, 2022
f2553c1
changed from using `<template />` to using custom element names and f…
jquesada2016 Dec 19, 2022
d692084
Fix tests in `counter` example
gbj Dec 19, 2022
8be33cc
Updating `todo-app-sqlite` example (todo: fix hydration)
gbj Dec 19, 2022
36099c1
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 19, 2022
58748af
Fix `_ref` API in macro
gbj Dec 20, 2022
df8e50e
Update TodoMVC example
gbj Dec 20, 2022
9a2035f
Relocate `view-tests` into `leptos_dom`
gbj Dec 20, 2022
065d6b3
Fix workspace
gbj Dec 20, 2022
79712ac
Fixes for `<Suspense/>` hydration
gbj Dec 20, 2022
7ca131c
Work on hydration examples
gbj Dec 20, 2022
2f218e7
Small changes to examples
gbj Dec 21, 2022
e57b6e0
Tidy up `<Suspense/>`
gbj Dec 21, 2022
ae82395
Remove some hydration key element increments
gbj Dec 21, 2022
66ac7d2
Fix hydration of `<Routes/>`
gbj Dec 21, 2022
532f5c5
Add types for HTML elements
gbj Dec 22, 2022
351389c
Correct types in SSR
gbj Dec 22, 2022
ce84632
Update `NodeRef` to be generic over typed HTML elements
gbj Dec 22, 2022
34b4917
updated component doc formatting
jquesada2016 Dec 22, 2022
7c25cd9
Use `#[component]` macro for core components, deleting `leptos_core` …
gbj Dec 22, 2022
d2ba8f5
exporting everything from `matching`
jquesada2016 Dec 22, 2022
aa9f8f2
renamed `element` to `view` on `<Route />` and `RouteDefinition`
jquesada2016 Dec 22, 2022
ac16d34
Fix scoping issue by manually creating `Component` in `Suspense`
gbj Dec 23, 2022
fdf17af
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 23, 2022
79ac501
Make `<Suspense/>` properly reactive again (i.e., shows fallback betw…
gbj Dec 23, 2022
6cf5d0a
`<Route element=...` => `view=...`
gbj Dec 23, 2022
42eef28
Fix `Transition` in new hydration model
gbj Dec 23, 2022
d158c34
Transition back to `Transition` in `hackernews`
gbj Dec 23, 2022
89aa02a
Update `counter` example
gbj Dec 23, 2022
0bf52c9
Make sure `--debug` is noted in examples so hydration matches
gbj Dec 23, 2022
a5d7563
fixed `DynChild` panicking when expected text is not there
jquesada2016 Dec 23, 2022
b62568b
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 23, 2022
8037915
reintroduced panic in `DynChild`
jquesada2016 Dec 23, 2022
3d160ed
Merge in changes to `leptos_reactive` from `main`
gbj Dec 23, 2022
c89930a
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 23, 2022
0f31e92
Transparent `<For/>`
gbj Dec 23, 2022
fa87bc6
added `transparent` to `<For />
jquesada2016 Dec 23, 2022
feb7961
Created `shared_context` by default in SSR
gbj Dec 23, 2022
558b13d
Fix merged `leptos_reactive` so that resources are streamed properly
gbj Dec 23, 2022
d95dc18
Fix merged `leptos_reactive` so that resources are streamed properly
gbj Dec 23, 2022
6354b79
Use `Transition` in example
gbj Dec 23, 2022
590ec40
Final `Suspense` fix?
gbj Dec 23, 2022
a648f08
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 23, 2022
5def2a7
impl `View::on` and renamed `IntoElement` to `ElementDescriptor`
jquesada2016 Dec 23, 2022
c96965a
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 23, 2022
6ce90fa
revert default build target
jquesada2016 Dec 23, 2022
7ee0c01
fixed non-web builds
jquesada2016 Dec 23, 2022
4839bfb
Tailwind example ported
gbj Dec 23, 2022
f17f651
Clean up example
gbj Dec 23, 2022
2499755
Merge `main` integrations in
gbj Dec 23, 2022
f20c74f
SSR changes to support integrations
gbj Dec 23, 2022
629ac01
merge `todo-app-sqlite-axum`
gbj Dec 23, 2022
232776f
Add example to `Cargo.toml`
gbj Dec 23, 2022
8e1c165
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 23, 2022
d1ece97
added all `svg` elements
jquesada2016 Dec 23, 2022
d78ee8c
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 23, 2022
ef846e7
added all `math` elements
jquesada2016 Dec 23, 2022
2d97790
fixed imports on non-web
jquesada2016 Dec 23, 2022
8092bf1
untoggled `wasm32` target
jquesada2016 Dec 23, 2022
7028dd8
fixed `math` namespace
jquesada2016 Dec 23, 2022
8639410
fixed name collision within components so that recursion is possible
jquesada2016 Dec 23, 2022
ae506fc
fixed name mismatch
jquesada2016 Dec 23, 2022
a4740d6
Remove `web` by default
gbj Dec 23, 2022
48e1d6c
Recursive components allowed
gbj Dec 23, 2022
af68da0
Remove `web` by default
gbj Dec 23, 2022
a474759
Only stream `Resources` if they're under a `Suspense` to fix renderin…
gbj Dec 23, 2022
8c4dcbe
Fix paths for imports
gbj Dec 23, 2022
d3f2cae
Fix SVG warnings
gbj Dec 24, 2022
b3da8a5
Fix SVG warning fix
gbj Dec 24, 2022
bf9587c
Attempt at `Transition`
gbj Dec 24, 2022
479c11e
MUCH better solution to hydration mismatch when resources read not un…
gbj Dec 24, 2022
fc062e6
fixed the type of `math` elements
jquesada2016 Dec 24, 2022
623bb7c
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 24, 2022
e057787
Update docs
gbj Dec 25, 2022
86df770
chores: getting tests fixed, etc.
gbj Dec 26, 2022
5540bb8
Bump version to `0.1.0-alpha`
gbj Dec 26, 2022
2048e89
Remove dev-dependency (for `cargo publish` reasons)
gbj Dec 26, 2022
8a8c004
Remove version of dev-deps
gbj Dec 26, 2022
469a65a
Remove dev-deps for publish
gbj Dec 26, 2022
a55ce8f
Fix deps
gbj Dec 26, 2022
98e3f5a
Remove dev-deps for publish
gbj Dec 26, 2022
0e437ca
Update README
gbj Dec 26, 2022
38ef93d
Fix deps
gbj Dec 26, 2022
9dc30da
Fix component children example in docs
gbj Dec 26, 2022
2bd0c38
Properly detect and namespace SVG/MathML
gbj Dec 26, 2022
85b72f5
added support for moving views around in the DOM
jquesada2016 Dec 26, 2022
6cd136e
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 26, 2022
d42b79b
now using a shared marker to check if a component has already been mo…
jquesada2016 Dec 26, 2022
a15b3dd
now using a shared marker to check if a `Each` has already been mount…
jquesada2016 Dec 26, 2022
a5351dd
fixed broken `cfg`
jquesada2016 Dec 26, 2022
f1a148c
Remove errant `Clone` bound on `Signal<T>` by implementing explicitly
gbj Dec 26, 2022
ebd7080
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 26, 2022
3179b2a
Remove duplicate
gbj Dec 26, 2022
6077966
Streaming SSR for `<Suspense/>` in release mode
gbj Dec 26, 2022
c712cc8
chore: `clippy`
gbj Dec 26, 2022
ab2d554
now only adding event handlers `Some(_)` and `FnMut`; called `cargo f…
jquesada2016 Dec 27, 2022
04e3e7a
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 27, 2022
8b81425
explicit handler type to help compiler type inference
jquesada2016 Dec 27, 2022
b3c4c77
now unwrapping type when documenting a field which has `#[prop(strip_…
jquesada2016 Dec 27, 2022
a3f090c
added `LazyView` to fix `view!` macro move dilema
jquesada2016 Dec 28, 2022
4dd5768
fixed move dilema on component children
jquesada2016 Dec 28, 2022
4467d06
fixed duplicate imports on web
jquesada2016 Dec 28, 2022
55b27f7
Fix `<Meta/>` tag hydration lookup
gbj Dec 28, 2022
0e179d0
component move fix would break scope continuity
jquesada2016 Dec 28, 2022
3c1e1e1
component move fix would break scope continuity
jquesada2016 Dec 28, 2022
dac69b9
Port `hackernews-axum`
gbj Dec 28, 2022
0da8d01
added `clone:` to components in `view!` macro to help with move dilemmaa
jquesada2016 Dec 28, 2022
494deef
maybe possibly perhaps fixed broken tracing dep
jquesada2016 Dec 28, 2022
e3c4e9f
chores: fix failing tests, update docs, suppress warnings
gbj Dec 28, 2022
f30310a
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 28, 2022
4e1753f
moved `#[component]` tracing support behind a `tracing` feature flag
jquesada2016 Dec 28, 2022
4340fbf
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
jquesada2016 Dec 28, 2022
57c72c0
impl `HtmlElement::inner_html` for web targets, SSR still TODO
jquesada2016 Dec 28, 2022
f3b62bc
impl `HtmlElement::inner_html` for SSR
jquesada2016 Dec 28, 2022
50ba796
Fix `leptos_server` tests
gbj Dec 28, 2022
63f680f
Merge branch 'main' into pr/119
gbj Dec 28, 2022
d64ca36
Fix merge
gbj Dec 28, 2022
a2f85fe
Update Readme
gbj Dec 28, 2022
f09ded4
Merge branch 'leptos_dom_v2' of https://github.com/jquesada2016/lepto…
gbj Dec 28, 2022
fd2a2bd
Fixing merge issues
gbj Dec 28, 2022
4b1fce4
Revert "Merge branch 'main' into pr/119"
gbj Dec 28, 2022
e842413
Fix TOML
gbj Dec 28, 2022
28bb3f8
made `ev::undelegated` lowercase to match the rest of the event names
jquesada2016 Dec 28, 2022
8acbc57
fixed broken `undelegated` type
jquesada2016 Dec 28, 2022
63e70db
removed `EventHandler` trait
jquesada2016 Dec 28, 2022
67c5eda
removed clone bount on the type argument of `SignalSetter`
jquesada2016 Dec 29, 2022
c44693e
Use `#[component]` macro for `leptos_meta` to generate docs
gbj Dec 29, 2022
e595d35
Fix CSS location for `hackernews-axum`
gbj Dec 29, 2022
0145b01
impl `IntoView` for `&View`
jquesada2016 Dec 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ blob.rs
Cargo.lock
**/*.rs.bk
.DS_Store
.leptos.kdl
30 changes: 1 addition & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ members = [
# core
"leptos",
"leptos_dom",
"leptos_core",
"leptos_config",
"leptos_macro",
"leptos_reactive",
Expand All @@ -30,8 +29,6 @@ members = [
"examples/todomvc",
"examples/todo-app-sqlite",
"examples/todo-app-sqlite-axum",
"examples/todo-app-cbor",
"examples/view-tests",

# book
"docs/book/project/ch02_getting_started",
Expand All @@ -46,29 +43,4 @@ lto = true
opt-level = 'z'

[workspace.metadata.cargo-all-features]
skip_feature_sets = [
[
"csr",
"ssr",
],
[
"csr",
"hydrate",
],
[
"ssr",
"hydrate",
],
[
"serde",
"serde-lite",
],
[
"serde-lite",
"miniserde",
],
[
"serde",
"miniserde",
],
]
skip_feature_sets = [["csr", "ssr"], ["csr", "hydrate"], ["ssr", "hydrate"]]
86 changes: 16 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
**Please note:** This framework is in active development. I'm keeping it in a cycle of 0.0.x releases at the moment to indicate that it’s not even ready for its 0.1.0. Active work is being done on documentation and features, and APIs should not necessarily be considered stable. At the same time, it is more than a toy project or proof of concept, and I am actively using it for my own application development.

<img src="https://raw.githubusercontent.com/gbj/leptos/main/docs/logos/logo.svg" alt="Leptos Logo" style="width: 100%; height: auto; display: block; margin: auto;">

[![crates.io](https://img.shields.io/crates/v/leptos.svg)](https://crates.io/crates/leptos)
Expand All @@ -12,7 +10,7 @@
use leptos::*;

#[component]
pub fn SimpleCounter(cx: Scope, initial_value: i32) -> Element {
pub fn SimpleCounter(cx: Scope, initial_value: i32) -> impl IntoView {
// create a reactive signal with the initial value
let (value, set_value) = create_signal(cx, initial_value);

Expand All @@ -22,7 +20,7 @@ pub fn SimpleCounter(cx: Scope, initial_value: i32) -> Element {
let decrement = move |_| set_value.update(|value| *value -= 1);
let increment = move |_| set_value.update(|value| *value += 1);

// this JSX is compiled to an HTML template string for performance
// create user interfaces with the declarative `view!` macro
view! {
cx,
<div>
Expand Down Expand Up @@ -54,17 +52,6 @@ Leptos is a full-stack, isomorphic Rust web framework leveraging fine-grained re
- **Fine-grained reactivity**: The entire framework is build from reactive primitives. This allows for extremely performant code with minimal overhead: when a reactive signal’s value changes, it can update a single text node, toggle a single class, or remove an element from the DOM without any other code running. (_So, no virtual DOM!_)
- **Declarative**: Tell Leptos how you want the page to look, and let the framework tell the browser how to do it.

## Getting Started

The best way to get started with a Leptos project right now is to use the [`cargo-leptos`](https://github.com/akesson/cargo-leptos) build tool and our [starter template](https://github.com/leptos-rs/start).

```bash
cargo install cargo-leptos
cargo leptos new --git https://github.com/leptos-rs/start
cd [your project name]
cargo leptos watch
```

## Learn more

Here are some resources for learning more about Leptos:
Expand All @@ -76,55 +63,14 @@ Here are some resources for learning more about Leptos:

## `nightly` Note

Most of the examples assume you’re using `nightly` Rust.
To set up your rustup toolchain using nightly and
add the ability to compile Rust to WebAssembly:

```
rustup toolchain install nightly
rustup default nightly
rustup target add wasm32-unknown-unknown
```


If you’re on stable, note the following:
Most of the examples assume you’re using `nightly` Rust. If you’re on stable, note the following:

1. You need to enable the `"stable"` flag in `Cargo.toml`: `leptos = { version = "0.0", features = ["stable"] }`
1. You need to enable the `"stable"` flag in `Cargo.toml`: `leptos = { version = "0.1.0-alpha", features = ["stable"] }`
2. `nightly` enables the function call syntax for accessing and setting signals. If you’re using `stable`,
you’ll just call `.get()`, `.set()`, or `.update()` manually. Check out the
[`counters-stable` example](https://github.com/gbj/leptos/blob/main/examples/counters-stable/src/main.rs)
for examples of the correct API.

## Benchmarks

### Server-Side Rendering

I’ve created a benchmark comparing Leptos’s HTML rendering on the server to [Tera](https://github.com/Keats/tera), [Yew](https://github.com/yewstack/yew), and [Sycamore](https://github.com/sycamore-rs/sycamore). You can find the benchmark [here](https://github.com/gbj/leptos/tree/main/benchmarks) and run it yourself using `cargo bench`. Leptos renders HTML roughly as fast as Tera, and scales well as templates become larger. It's significantly faster than the server-side HTML rendering done by similar frameworks.

<details>
<summary>Click to show results</summary>
<table>
<thead>
<tr><td><em>ns/iter</em></td><td>Tera</td><td>Leptos</td><td>Yew</td><td>Sycamore</td></tr>
</thead>
<tbody>
<tr><td>3 Counters</td><td align="right">3,454</td><td align="right">5,666</td><td align="right">34,984</td><td align="right">32,412</td></tr>
<tr><td>TodoMVC (no todos)</td><td align="right">2,396</td><td align="right">5,561</td><td align="right">38,725</td><td align="right">68,749</td></tr>
<tr><td>TodoMVC (1000 todos)</td><td align="right">3,829,447</td><td align="right">3,077,907</td><td align="right">5,125,639</td><td align="right">19,448,900</td></tr>
<tr><td><em>Average</em></td><td align="right">1.08</td><td align="right">1.65</td><td align="right">6.25</td><td align="right">9.36</td></tr>
</tbody>
</table>
</details>

### Client-Side Rendering

The gold standard for testing raw rendering performance for front-end web frameworks is the [js-framework-benchmark](https://github.com/krausest/js-framework-benchmark). The official results list Leptos as the fastest Rust/Wasm framework, slightly slower than SolidJS and significantly faster than popular JS frameworks like Svelte, Preact, and React.

<details>
<summary>Click to show results</summary>
<img width="913" alt="js-framework-benchmark results" src="https://user-images.githubusercontent.com/286622/198388168-d21e938b-5d59-4000-b373-91b48f1ec4d3.png">
</details>

## FAQs

### Can I use this for native GUI?
Expand Down Expand Up @@ -158,17 +104,17 @@ There are some practical differences that make a significant difference:
- **Read-write segregation:** Leptos, like Solid, encourages read-write segregation between signal getters and setters, so you end up accessing signals with tuples like `let (count, set_count) = create_signal(cx, 0);` _(If you prefer or if it's more convenient for your API, you can use `create_rw_signal` to give a unified read/write signal.)_
- **Signals are functions:** In Leptos, you can call a signal to access it rather than calling a specific method (so, `count()` instead of `count.get()`) This creates a more consistent mental model: accessing a reactive value is always a matter of calling a function. For example:

```rust
let (count, set_count) = create_signal(cx, 0); // a signal
let double_count = move || count() * 2; // a derived signal
let memoized_count = create_memo(cx, move |_| count() * 3); // a memo
// all are accessed by calling them
assert_eq!(count(), 0);
assert_eq!(double_count(), 0);
assert_eq!(memoized_count(), 0);

// this function can accept any of those signals
fn do_work_on_signal(my_signal: impl Fn() -> i32) { ... }
```
```rust
let (count, set_count) = create_signal(cx, 0); // a signal
let double_count = move || count() * 2; // a derived signal
let memoized_count = create_memo(cx, move |_| count() * 3); // a memo
// all are accessed by calling them
assert_eq!(count(), 0);
assert_eq!(double_count(), 0);
assert_eq!(memoized_count(), 0);

// this function can accept any of those signals
fn do_work_on_signal(my_signal: impl Fn() -> i32) { ... }
```

- **Signals and scopes are `'static`:** Both Leptos and Sycamore ease the pain of moving signals in closures (in particular, event listeners) by making them `Copy`, to avoid the `{ let count = count.clone(); move |_| ... }` that's very familiar in Rust UI code. Sycamore does this by using bump allocation to tie the lifetimes of its signals to its scopes: since references are `Copy`, `&'a Signal<T>` can be moved into a closure. Leptos does this by using arena allocation and passing around indices: types like `ReadSignal<T>`, `WriteSignal<T>`, and `Memo<T>` are actually wrapper for indices into an arena. This means that both scopes and signals are both `Copy` and `'static` in Leptos, which means that they can be moved easily into closures without adding lifetime complexity.
13 changes: 7 additions & 6 deletions benchmarks/src/ssr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use test::Bencher;

#[bench]
fn leptos_ssr_bench(b: &mut Bencher) {
use leptos::*;

b.iter(|| {
use leptos::*;

_ = create_scope(create_runtime(), |cx| {
#[component]
fn Counter(cx: Scope, initial: i32) -> Element {
fn Counter(cx: Scope, initial: i32) -> impl IntoView {
let (value, set_value) = create_signal(cx, initial);
view! {
cx,
Expand All @@ -28,16 +28,16 @@ fn leptos_ssr_bench(b: &mut Bencher) {
<Counter initial=2/>
<Counter initial=3/>
</main>
};
}.into_view(cx).render_to_string(cx);

assert_eq!(
rendered,
"<main data-hk=\"0-0\"><h1>Welcome to our benchmark page.</h1><p>Here's some introductory text.</p><!--#--><div data-hk=\"0-2-0\"><button>-1</button><span>Value: <!--#-->1<!--/-->!</span><button>+1</button></div><!--/--><!--#--><div data-hk=\"0-3-0\"><button>-1</button><span>Value: <!--#-->2<!--/-->!</span><button>+1</button></div><!--/--><!--#--><div data-hk=\"0-4-0\"><button>-1</button><span>Value: <!--#-->3<!--/-->!</span><button>+1</button></div><!--/--></main>"
"<main><h1>Welcome to our benchmark page.</h1><p>Here's some introductory text.</p><div><button>-1</button><span>Value: <!>1<template id=\"_3\"></template>!</span><button>+1</button></div><template id=\"_1\"></template><div><button>-1</button><span>Value: <!>2<template id=\"_2\"></template>!</span><button>+1</button></div><template id=\"_0\"></template><div><button>-1</button><span>Value: <!>3<template id=\"_2\"></template>!</span><button>+1</button></div><template id=\"_0\"></template></main>"
);
});
});
}

/*
#[bench]
fn tera_ssr_bench(b: &mut Bencher) {
use tera::*;
Expand Down Expand Up @@ -194,3 +194,4 @@ fn yew_ssr_bench(b: &mut Bencher) {
});
});
}
*/
Loading