Compare commits

..

1 Commits
v0.8.0 ... 3890

Author SHA1 Message Date
Greg Johnston
d7dfb33153 fix(examples): broken favicons in hackernews examples (closes #3890) 2025-04-27 15:30:00 -04:00
34 changed files with 174 additions and 261 deletions

44
Cargo.lock generated
View File

@@ -263,7 +263,7 @@ dependencies = [
[[package]]
name = "any_spawner"
version = "0.3.0"
version = "0.3.0-rc3"
dependencies = [
"async-executor",
"futures",
@@ -1781,7 +1781,7 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"
[[package]]
name = "leptos"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"any_spawner",
"base64",
@@ -1833,7 +1833,7 @@ dependencies = [
[[package]]
name = "leptos_actix"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"actix-files",
"actix-http",
@@ -1859,7 +1859,7 @@ dependencies = [
[[package]]
name = "leptos_axum"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"any_spawner",
"axum",
@@ -1883,7 +1883,7 @@ dependencies = [
[[package]]
name = "leptos_config"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"config",
"regex",
@@ -1897,7 +1897,7 @@ dependencies = [
[[package]]
name = "leptos_dom"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"js-sys",
"leptos",
@@ -1914,7 +1914,7 @@ dependencies = [
[[package]]
name = "leptos_hot_reload"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"anyhow",
"camino",
@@ -1930,7 +1930,7 @@ dependencies = [
[[package]]
name = "leptos_integration_utils"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"futures",
"hydration_context",
@@ -1943,7 +1943,7 @@ dependencies = [
[[package]]
name = "leptos_macro"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"attribute-derive",
"cfg-if",
@@ -1963,7 +1963,7 @@ dependencies = [
"rustc_version",
"serde",
"server_fn",
"server_fn_macro 0.8.0",
"server_fn_macro 0.8.0-rc3",
"syn 2.0.100",
"tracing",
"trybuild",
@@ -1973,7 +1973,7 @@ dependencies = [
[[package]]
name = "leptos_meta"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"futures",
"indexmap",
@@ -1988,7 +1988,7 @@ dependencies = [
[[package]]
name = "leptos_router"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"any_spawner",
"either_of",
@@ -2013,7 +2013,7 @@ dependencies = [
[[package]]
name = "leptos_router_macro"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"leptos_macro",
"leptos_router",
@@ -2025,7 +2025,7 @@ dependencies = [
[[package]]
name = "leptos_server"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"any_spawner",
"base64",
@@ -2759,7 +2759,7 @@ dependencies = [
[[package]]
name = "reactive_graph"
version = "0.2.0"
version = "0.2.0-rc3"
dependencies = [
"any_spawner",
"async-lock",
@@ -2782,7 +2782,7 @@ dependencies = [
[[package]]
name = "reactive_stores"
version = "0.2.0"
version = "0.2.0-rc3"
dependencies = [
"any_spawner",
"dashmap",
@@ -2801,7 +2801,7 @@ dependencies = [
[[package]]
name = "reactive_stores_macro"
version = "0.2.0"
version = "0.2.0-rc3"
dependencies = [
"convert_case 0.8.0",
"proc-macro-error2",
@@ -3298,7 +3298,7 @@ dependencies = [
[[package]]
name = "server_fn"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"actix-web",
"actix-ws",
@@ -3361,7 +3361,7 @@ dependencies = [
[[package]]
name = "server_fn_macro"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"const_format",
"convert_case 0.8.0",
@@ -3374,9 +3374,9 @@ dependencies = [
[[package]]
name = "server_fn_macro_default"
version = "0.8.0"
version = "0.8.0-rc3"
dependencies = [
"server_fn_macro 0.8.0",
"server_fn_macro 0.8.0-rc3",
"syn 2.0.100",
]
@@ -3570,7 +3570,7 @@ dependencies = [
[[package]]
name = "tachys"
version = "0.2.0"
version = "0.2.0-rc3"
dependencies = [
"any_spawner",
"async-trait",

View File

@@ -40,40 +40,40 @@ members = [
exclude = ["benchmarks", "examples", "projects"]
[workspace.package]
version = "0.8.0"
version = "0.8.0-rc3"
edition = "2021"
rust-version = "1.76"
[workspace.dependencies]
convert_case = "0.8"
throw_error = { path = "./any_error/", version = "0.3.0" }
any_spawner = { path = "./any_spawner/", version = "0.3.0" }
any_spawner = { path = "./any_spawner/", version = "0.3.0-rc3" }
const_str_slice_concat = { path = "./const_str_slice_concat", version = "0.1" }
either_of = { path = "./either_of/", version = "0.1.5" }
hydration_context = { path = "./hydration_context", version = "0.3.0" }
itertools = "0.14.0"
leptos = { path = "./leptos", version = "0.8.0" }
leptos_config = { path = "./leptos_config", version = "0.8.0" }
leptos_dom = { path = "./leptos_dom", version = "0.8.0" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.8.0" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.8.0" }
leptos_macro = { path = "./leptos_macro", version = "0.8.0" }
leptos_router = { path = "./router", version = "0.8.0" }
leptos_router_macro = { path = "./router_macro", version = "0.8.0" }
leptos_server = { path = "./leptos_server", version = "0.8.0" }
leptos_meta = { path = "./meta", version = "0.8.0" }
leptos = { path = "./leptos", version = "0.8.0-rc3" }
leptos_config = { path = "./leptos_config", version = "0.8.0-rc3" }
leptos_dom = { path = "./leptos_dom", version = "0.8.0-rc3" }
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.8.0-rc3" }
leptos_integration_utils = { path = "./integrations/utils", version = "0.8.0-rc3" }
leptos_macro = { path = "./leptos_macro", version = "0.8.0-rc3" }
leptos_router = { path = "./router", version = "0.8.0-rc3" }
leptos_router_macro = { path = "./router_macro", version = "0.8.0-rc3" }
leptos_server = { path = "./leptos_server", version = "0.8.0-rc3" }
leptos_meta = { path = "./meta", version = "0.8.0-rc3" }
next_tuple = { path = "./next_tuple", version = "0.1.0" }
oco_ref = { path = "./oco", version = "0.2.0" }
or_poisoned = { path = "./or_poisoned", version = "0.1.0" }
reactive_graph = { path = "./reactive_graph", version = "0.2.0" }
reactive_stores = { path = "./reactive_stores", version = "0.2.0" }
reactive_stores_macro = { path = "./reactive_stores_macro", version = "0.2.0" }
reactive_graph = { path = "./reactive_graph", version = "0.2.0-rc3" }
reactive_stores = { path = "./reactive_stores", version = "0.2.0-rc3" }
reactive_stores_macro = { path = "./reactive_stores_macro", version = "0.2.0-rc3" }
rustversion = "1"
serde_json = "1.0.0"
server_fn = { path = "./server_fn", version = "0.8.0" }
server_fn_macro = { path = "./server_fn_macro", version = "0.8.0" }
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", version = "0.8.0" }
tachys = { path = "./tachys", version = "0.2.0" }
server_fn = { path = "./server_fn", version = "0.8.0-rc3" }
server_fn_macro = { path = "./server_fn_macro", version = "0.8.0-rc3" }
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", version = "0.8.0-rc3" }
tachys = { path = "./tachys", version = "0.2.0-rc3" }
trybuild = "1"
typed-builder = "0.21.0"
thiserror = "2.0.12"

View File

@@ -1,6 +1,6 @@
[package]
name = "any_spawner"
version = "0.3.0"
version = "0.3.0-rc3"
authors = ["Greg Johnston"]
license = "MIT"
readme = "../README.md"

View File

@@ -26,17 +26,12 @@ pub async fn file_and_error_handler(
.map(|h| h.to_str().unwrap_or("none"))
.unwrap_or("none")
.to_string();
let static_result = get_static_file(uri.clone(), accept_encoding).await;
let res = get_static_file(uri.clone(), accept_encoding).await.unwrap();
match static_result {
Ok(res) => {
if res.status() == StatusCode::OK {
res.into_response()
} else {
(StatusCode::NOT_FOUND, "Not found.").into_response()
}
}
Err(e) => e.into_response(),
if res.status() == StatusCode::OK {
res.into_response()
} else {
(StatusCode::NOT_FOUND, "Not found.").into_response()
}
}

View File

@@ -47,7 +47,7 @@ pub fn Stories() -> impl IntoView {
let stories = Resource::new(
move || (page(), story_type()),
move |(page, story_type)| async move {
fetch_stories(story_type, page).await.ok()
fetch_stories(category(&story_type), page).await.ok()
},
);
let (pending, set_pending) = signal(false);

View File

@@ -10,11 +10,7 @@ crate-type = ["cdylib", "rlib"]
console_error_panic_hook = "0.1.7"
futures = "0.3.30"
http = "1.1"
leptos = { path = "../../leptos", features = [
"tracing",
"islands",
"islands-router",
] }
leptos = { path = "../../leptos", features = ["tracing", "islands"] }
leptos_router = { path = "../../router" }
server_fn = { path = "../../server_fn", features = ["serde-lite"] }
leptos_axum = { path = "../../integrations/axum", features = [

View File

@@ -10,9 +10,19 @@ pub async fn goto_path(client: &Client, path: &str) -> Result<()> {
Ok(())
}
pub async fn add_text(client: &Client, text: &str) -> Result<String> {
fill_input(client, text).await?;
get_label(client).await
}
pub async fn fill_input(client: &Client, text: &str) -> Result<()> {
let textbox = find::input(client).await;
textbox.send_keys(text).await?;
Ok(())
}
pub async fn get_label(client: &Client) -> Result<String> {
let label = find::label(client).await;
Ok(label.text().await?)
}

View File

@@ -9,3 +9,13 @@ pub async fn input(client: &Client) -> Element {
textbox
}
pub async fn label(client: &Client) -> Element {
let label = client
.wait()
.for_element(Locator::Css("p"))
.await
.expect("");
label
}

View File

@@ -14,7 +14,7 @@ async fn i_open_the_app(world: &mut AppWorld) -> Result<()> {
#[given(regex = "^I add a text as (.*)$")]
async fn i_add_a_text(world: &mut AppWorld, text: String) -> Result<()> {
let client = &world.client;
action::fill_input(client, text.as_str()).await?;
action::add_text(client, text.as_str()).await?;
Ok(())
}

View File

@@ -20,7 +20,7 @@ async fn i_see_the_label_of_the_input_is(
world: &mut AppWorld,
text: String,
) -> Result<()> {
sleep(Duration::from_millis(500)).await;
sleep(Duration::from_millis(50)).await;
let client = &world.client;
check::text_on_element(client, "p", &text).await?;

View File

@@ -4,7 +4,7 @@ authors = ["Greg Johnston"]
license = "MIT"
repository = "https://github.com/leptos-rs/leptos"
description = "Axum integrations for the Leptos web framework."
version = "0.8.0"
version = "0.8.0-rc3"
rust-version.workspace = true
edition.workspace = true

View File

@@ -99,7 +99,6 @@ trace-component-props = [
"leptos_dom/trace-component-props",
]
delegation = ["tachys/delegation"]
islands-router = ["tachys/mark_branches"]
[build-dependencies]
rustc_version = "0.4.1"

View File

@@ -28,8 +28,6 @@
for(const child of node.children) {
traverse(child);
};
// un-set the "most recent children"
MOST_RECENT_CHILDREN_CB = undefined;
}
}
}

View File

@@ -107,19 +107,21 @@ pub fn HydrationScripts(
.unwrap_or_default();
let root = root.unwrap_or_default();
view! {
<link rel="modulepreload" href=format!("{root}/{pkg_path}/{js_file_name}.js") nonce=nonce.clone()/>
<link
rel="preload"
href=format!("{root}/{pkg_path}/{wasm_file_name}.wasm")
r#as="fetch"
r#type="application/wasm"
crossorigin=nonce.clone().unwrap_or_default()
/>
<script type="module" nonce=nonce>
{format!("{script}({root:?}, {pkg_path:?}, {js_file_name:?}, {wasm_file_name:?});{islands_router}")}
</script>
}
use_context::<IslandsRouterNavigation>().is_none().then(|| {
view! {
<link rel="modulepreload" href=format!("{root}/{pkg_path}/{js_file_name}.js") nonce=nonce.clone()/>
<link
rel="preload"
href=format!("{root}/{pkg_path}/{wasm_file_name}.wasm")
r#as="fetch"
r#type="application/wasm"
crossorigin=nonce.clone().unwrap_or_default()
/>
<script type="module" nonce=nonce>
{format!("{script}({root:?}, {pkg_path:?}, {js_file_name:?}, {wasm_file_name:?});{islands_router}")}
</script>
}
})
}
/// If this is provided via context, it means that you are using the islands router and

View File

@@ -357,38 +357,25 @@ impl ToTokens for Model {
// add island wrapper if island
let component = if is_island {
let is_server = cfg!(feature = "ssr");
let hydrate_fn_name = hydrate_fn_name.as_ref().unwrap();
if is_server {
quote! {
{
// if we're on the server, and inside another island already,
// *don't* add a <leptos-island> (this will hydrate them both separately)
if ::leptos::context::use_context::<::leptos::reactive::owner::IsHydrating>()
.map(|h| h.0)
.unwrap_or(false) {
::leptos::either::Either::Left(
quote! {
{
if ::leptos::context::use_context::<::leptos::reactive::owner::IsHydrating>()
.map(|h| h.0)
.unwrap_or(false) {
::leptos::either::Either::Left(
#component
)
} else {
::leptos::either::Either::Right(
::leptos::tachys::html::islands::Island::new(
stringify!(#hydrate_fn_name),
#component
)
} else {
::leptos::either::Either::Right(
::leptos::tachys::html::islands::Island::new(
stringify!(#hydrate_fn_name),
#component
)
#island_serialized_props
)
}
#island_serialized_props
)
}
}
} else {
quote! {
::leptos::tachys::html::islands::Island::new(
stringify!(#hydrate_fn_name),
#component
)
#island_serialized_props
}
}
} else {
component

View File

@@ -1,6 +1,6 @@
[package]
name = "leptos_meta"
version = "0.8.0"
version = "0.8.0-rc3"
authors = ["Greg Johnston"]
license = "MIT"
repository = "https://github.com/leptos-rs/leptos"

View File

@@ -7,9 +7,6 @@ use leptos::{
/// Injects an [`HTMLLinkElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement) into the document
/// head that loads a stylesheet from the URL given by the `href` property.
///
/// Note that this does *not* work with the `cargo-leptos` `hash-files` feature: if you are using file
/// hashing, you should use [`HashedStylesheet`](crate::HashedStylesheet).
///
/// ```
/// use leptos::prelude::*;
/// use leptos_meta::*;

View File

@@ -1,6 +1,6 @@
[package]
name = "reactive_graph"
version = "0.2.0"
version = "0.2.0-rc3"
authors = ["Greg Johnston"]
license = "MIT"
readme = "../README.md"

View File

@@ -26,7 +26,7 @@ use std::{
/// to more complex data structures. Instead, it allows you to provide a signal-like API for wrapped types
/// without exposing the original type directly to users.
pub struct ArcMappedSignal<T> {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: &'static Location<'static>,
#[allow(clippy::type_complexity)]
try_read_untracked: Arc<
@@ -44,7 +44,7 @@ pub struct ArcMappedSignal<T> {
impl<T> Clone for ArcMappedSignal<T> {
fn clone(&self) -> Self {
Self {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: self.defined_at,
try_read_untracked: self.try_read_untracked.clone(),
try_write: self.try_write.clone(),
@@ -67,7 +67,7 @@ impl<T> ArcMappedSignal<T> {
U: Send + Sync + 'static,
{
Self {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: Location::caller(),
try_read_untracked: {
let this = inner.clone();
@@ -110,7 +110,7 @@ impl<T> ArcMappedSignal<T> {
impl<T> Debug for ArcMappedSignal<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut partial = f.debug_struct("ArcMappedSignal");
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
partial.field("defined_at", &self.defined_at);
partial.finish()
}
@@ -118,11 +118,11 @@ impl<T> Debug for ArcMappedSignal<T> {
impl<T> DefinedAt for ArcMappedSignal<T> {
fn defined_at(&self) -> Option<&'static Location<'static>> {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
{
Some(self.defined_at)
}
#[cfg(not(any(debug_assertions, leptos_debuginfo)))]
#[cfg(not(debug_assertions))]
{
None
}
@@ -228,7 +228,7 @@ where
/// to more complex data structures. Instead, it allows you to provide a signal-like API for wrapped types
/// without exposing the original type directly to users.
pub struct MappedSignal<T, S = SyncStorage> {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: &'static Location<'static>,
inner: StoredValue<ArcMappedSignal<T>, S>,
}
@@ -246,7 +246,7 @@ impl<T> MappedSignal<T> {
U: Send + Sync + 'static,
{
Self {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: Location::caller(),
inner: {
let this = ArcRwSignal::from(inner);
@@ -269,7 +269,7 @@ impl<T> Clone for MappedSignal<T> {
impl<T> Debug for MappedSignal<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut partial = f.debug_struct("MappedSignal");
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
partial.field("defined_at", &self.defined_at);
partial.finish()
}
@@ -277,11 +277,11 @@ impl<T> Debug for MappedSignal<T> {
impl<T> DefinedAt for MappedSignal<T> {
fn defined_at(&self) -> Option<&'static Location<'static>> {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
{
Some(self.defined_at)
}
#[cfg(not(any(debug_assertions, leptos_debuginfo)))]
#[cfg(not(debug_assertions))]
{
None
}
@@ -352,7 +352,7 @@ where
#[track_caller]
fn from(value: ArcMappedSignal<T>) -> Self {
MappedSignal {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: Location::caller(),
inner: StoredValue::new(value),
}

View File

@@ -118,7 +118,7 @@ where
#[track_caller]
fn from(value: ArcWriteSignal<T>) -> Self {
WriteSignal {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: Location::caller(),
inner: ArenaItem::new_with_storage(value),
}
@@ -132,7 +132,7 @@ where
#[track_caller]
fn from_local(value: ArcWriteSignal<T>) -> Self {
WriteSignal {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: Location::caller(),
inner: ArenaItem::new_with_storage(value),
}

View File

@@ -11,8 +11,7 @@ pub mod read {
},
signal::{
guards::{Mapped, Plain, ReadGuard},
ArcMappedSignal, ArcReadSignal, ArcRwSignal, MappedSignal,
ReadSignal, RwSignal,
ArcReadSignal, ArcRwSignal, ReadSignal, RwSignal,
},
traits::{
DefinedAt, Dispose, Get, Read, ReadUntracked, ReadValue, Track,
@@ -808,16 +807,6 @@ pub mod read {
}
}
impl<T> From<MappedSignal<T>> for Signal<T>
where
T: Clone + Send + Sync + 'static,
{
#[track_caller]
fn from(value: MappedSignal<T>) -> Self {
Self::derive(move || value.get())
}
}
impl<T> From<RwSignal<T, LocalStorage>> for Signal<T, LocalStorage>
where
T: 'static,
@@ -850,16 +839,6 @@ pub mod read {
}
}
impl<T> From<ArcMappedSignal<T>> for Signal<T>
where
T: Clone + Send + Sync + 'static,
{
#[track_caller]
fn from(value: ArcMappedSignal<T>) -> Self {
MappedSignal::from(value).into()
}
}
impl<T> From<ArcRwSignal<T>> for Signal<T, LocalStorage>
where
T: Send + Sync + 'static,

View File

@@ -1,6 +1,6 @@
[package]
name = "reactive_stores"
version = "0.2.0"
version = "0.2.0-rc3"
authors = ["Greg Johnston"]
license = "MIT"
readme = "../README.md"

View File

@@ -39,7 +39,7 @@ where
#[track_caller]
fn deref_field(self) -> DerefedField<Self> {
DerefedField {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: Location::caller(),
inner: self,
}
@@ -51,7 +51,7 @@ where
#[derive(Debug, Copy, Clone)]
pub struct DerefedField<S> {
inner: S,
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: &'static Location<'static>,
}
@@ -92,11 +92,11 @@ where
<S::Value as Deref>::Target: Sized + 'static,
{
fn defined_at(&self) -> Option<&'static Location<'static>> {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
{
Some(self.defined_at)
}
#[cfg(not(any(debug_assertions, leptos_debuginfo)))]
#[cfg(not(debug_assertions))]
{
None
}

View File

@@ -759,7 +759,7 @@ where
{
fn from(value: ArcStore<T>) -> Self {
Self {
#[cfg(any(debug_assertions, leptos_debuginfo))]
#[cfg(debug_assertions)]
defined_at: value.defined_at,
inner: ArenaItem::new_with_storage(value),
}

View File

@@ -1,6 +1,6 @@
[package]
name = "reactive_stores_macro"
version = "0.2.0"
version = "0.2.0-rc3"
authors = ["Greg Johnston"]
license = "MIT"
readme = "../README.md"

View File

@@ -1,6 +1,6 @@
[package]
name = "leptos_router"
version = "0.8.0"
version = "0.8.0-rc3"
authors = ["Greg Johnston", "Ben Wishovich"]
license = "MIT"
readme = "../README.md"

View File

@@ -418,7 +418,7 @@ impl RenderHtml for MatchedRoute {
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
) {
if mark_branches && escape {
if mark_branches {
buf.open_branch(&self.0);
}
self.1.to_html_with_buf(
@@ -428,7 +428,7 @@ impl RenderHtml for MatchedRoute {
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch(&self.0);
}
}
@@ -443,7 +443,7 @@ impl RenderHtml for MatchedRoute {
) where
Self: Sized,
{
if mark_branches && escape {
if mark_branches {
buf.open_branch(&self.0);
}
self.1.to_html_async_with_buf::<OUT_OF_ORDER>(
@@ -453,7 +453,7 @@ impl RenderHtml for MatchedRoute {
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch(&self.0);
}
}

View File

@@ -1,6 +1,6 @@
[package]
name = "leptos_router_macro"
version = "0.8.0"
version = "0.8.0-rc3"
authors = ["Greg Johnston", "Ben Wishovich"]
license = "MIT"
readme = "../README.md"

View File

@@ -1,6 +1,6 @@
[package]
name = "tachys"
version = "0.2.0"
version = "0.2.0-rc3"
authors = ["Greg Johnston"]
license = "MIT"
readme = "../README.md"
@@ -186,7 +186,6 @@ reactive_graph = ["dep:reactive_graph", "dep:any_spawner"]
reactive_stores = ["reactive_graph", "dep:reactive_stores"]
sledgehammer = ["dep:sledgehammer_bindgen", "dep:sledgehammer_utils"]
tracing = ["dep:tracing"]
mark_branches = []
[package.metadata.cargo-all-features]
denylist = ["tracing", "sledgehammer"]

View File

@@ -358,7 +358,6 @@ where
} else if curr_position != Position::Current {
cursor.sibling();
}
position.set(Position::NextChild);
if let Some(on_hydrate) = self.on_hydrate {
use crate::{

View File

@@ -84,27 +84,22 @@ where
*self.0.borrow_mut() = node;
}
/// Advances to the next placeholder node and returns it
/// Advances to the next placeholder node.
pub fn next_placeholder(
&self,
position: &PositionState,
) -> crate::renderer::types::Placeholder {
//crate::dom::log("looking for placeholder after");
//Rndr::log_node(&self.current());
self.advance_to_placeholder(position);
let marker = self.current();
crate::renderer::types::Placeholder::cast_from(marker.clone())
.unwrap_or_else(|| failed_to_cast_marker_node(marker))
}
/// Advances to the next placeholder node.
pub fn advance_to_placeholder(&self, position: &PositionState) {
if position.get() == Position::FirstChild {
self.child();
} else {
self.sibling();
}
let marker = self.current();
position.set(Position::NextChild);
crate::renderer::types::Placeholder::cast_from(marker.clone())
.unwrap_or_else(|| failed_to_cast_marker_node(marker))
}
}

View File

@@ -392,12 +392,10 @@ impl RenderHtml for AnyView {
) {
#[cfg(feature = "ssr")]
{
let type_id = if mark_branches && escape {
format!("{:?}", self.type_id)
} else {
Default::default()
};
if mark_branches && escape {
let type_id = mark_branches
.then(|| format!("{:?}", self.type_id))
.unwrap_or_default();
if mark_branches {
buf.open_branch(&type_id);
}
(self.to_html)(
@@ -408,7 +406,7 @@ impl RenderHtml for AnyView {
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch(&type_id);
}
}
@@ -438,14 +436,6 @@ impl RenderHtml for AnyView {
{
#[cfg(feature = "ssr")]
if OUT_OF_ORDER {
let type_id = if mark_branches && escape {
format!("{:?}", self.type_id)
} else {
Default::default()
};
if mark_branches && escape {
buf.open_branch(&type_id);
}
(self.to_html_async_ooo)(
self.value,
buf,
@@ -454,16 +444,11 @@ impl RenderHtml for AnyView {
mark_branches,
extra_attrs,
);
if mark_branches && escape {
buf.close_branch(&type_id);
}
} else {
let type_id = if mark_branches && escape {
format!("{:?}", self.type_id)
} else {
Default::default()
};
if mark_branches && escape {
let type_id = mark_branches
.then(|| format!("{:?}", self.type_id))
.unwrap_or_default();
if mark_branches {
buf.open_branch(&type_id);
}
(self.to_html_async)(
@@ -474,7 +459,7 @@ impl RenderHtml for AnyView {
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch(&type_id);
}
}
@@ -498,23 +483,13 @@ impl RenderHtml for AnyView {
position: &PositionState,
) -> Self::State {
#[cfg(feature = "hydrate")]
{
if FROM_SERVER {
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
let state =
(self.hydrate_from_server)(self.value, cursor, position);
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
state
} else {
panic!(
"hydrating AnyView from inside a ViewTemplate is not \
supported."
);
}
if FROM_SERVER {
(self.hydrate_from_server)(self.value, cursor, position)
} else {
panic!(
"hydrating AnyView from inside a ViewTemplate is not \
supported."
);
}
#[cfg(not(feature = "hydrate"))]
{

View File

@@ -308,7 +308,7 @@ where
) {
match self {
Either::Left(left) => {
if mark_branches && escape {
if mark_branches {
buf.open_branch("0");
}
left.to_html_with_buf(
@@ -318,12 +318,12 @@ where
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch("0");
}
}
Either::Right(right) => {
if mark_branches && escape {
if mark_branches {
buf.open_branch("1");
}
right.to_html_with_buf(
@@ -333,7 +333,7 @@ where
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch("1");
}
}
@@ -352,7 +352,7 @@ where
{
match self {
Either::Left(left) => {
if mark_branches && escape {
if mark_branches {
buf.open_branch("0");
}
left.to_html_async_with_buf::<OUT_OF_ORDER>(
@@ -362,12 +362,12 @@ where
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch("0");
}
}
Either::Right(right) => {
if mark_branches && escape {
if mark_branches {
buf.open_branch("1");
}
right.to_html_async_with_buf::<OUT_OF_ORDER>(
@@ -377,7 +377,7 @@ where
mark_branches,
extra_attrs,
);
if mark_branches && escape {
if mark_branches {
buf.close_branch("1");
}
}
@@ -389,21 +389,14 @@ where
cursor: &Cursor,
position: &PositionState,
) -> Self::State {
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
let state = match self {
match self {
Either::Left(left) => {
Either::Left(left.hydrate::<FROM_SERVER>(cursor, position))
}
Either::Right(right) => {
Either::Right(right.hydrate::<FROM_SERVER>(cursor, position))
}
};
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
state
}
fn into_owned(self) -> Self::Owned {
@@ -856,11 +849,11 @@ macro_rules! tuples {
) {
match self {
$([<EitherOf $num>]::$ty(this) => {
if mark_branches && escape {
if mark_branches {
buf.open_branch(stringify!($ty));
}
this.to_html_with_buf(buf, position, escape, mark_branches, extra_attrs);
if mark_branches && escape {
if mark_branches {
buf.close_branch(stringify!($ty));
}
})*
@@ -879,11 +872,11 @@ macro_rules! tuples {
{
match self {
$([<EitherOf $num>]::$ty(this) => {
if mark_branches && escape {
if mark_branches {
buf.open_branch(stringify!($ty));
}
this.to_html_async_with_buf::<OUT_OF_ORDER>(buf, position, escape, mark_branches, extra_attrs);
if mark_branches && escape {
if mark_branches {
buf.close_branch(stringify!($ty));
}
})*
@@ -895,17 +888,11 @@ macro_rules! tuples {
cursor: &Cursor,
position: &PositionState,
) -> Self::State {
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
let state = match self {
$([<EitherOf $num>]::$ty(this) => {
[<EitherOf $num>]::$ty(this.hydrate::<FROM_SERVER>(cursor, position))
})*
};
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
Self::State { state }
}

View File

@@ -252,12 +252,12 @@ where
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
) {
if mark_branches && escape {
if mark_branches {
buf.open_branch("for");
}
for (index, item) in self.items.into_iter().enumerate() {
let (_, item) = (self.view_fn)(index, item);
if mark_branches && escape {
if mark_branches {
buf.open_branch("item");
}
item.to_html_with_buf(
@@ -267,12 +267,12 @@ where
mark_branches,
extra_attrs.clone(),
);
if mark_branches && escape {
if mark_branches {
buf.close_branch("item");
}
*position = Position::NextChild;
}
if mark_branches && escape {
if mark_branches {
buf.close_branch("for");
}
buf.push_str("<!>");
@@ -286,7 +286,7 @@ where
mark_branches: bool,
extra_attrs: Vec<AnyAttribute>,
) {
if mark_branches && escape {
if mark_branches {
buf.open_branch("for");
}
for (index, item) in self.items.into_iter().enumerate() {
@@ -296,7 +296,7 @@ where
format!("item-{key}")
});
let (_, item) = (self.view_fn)(index, item);
if mark_branches && escape {
if mark_branches {
buf.open_branch(branch_name.as_ref().unwrap());
}
item.to_html_async_with_buf::<OUT_OF_ORDER>(
@@ -306,12 +306,12 @@ where
mark_branches,
extra_attrs.clone(),
);
if mark_branches && escape {
if mark_branches {
buf.close_branch(branch_name.as_ref().unwrap());
}
*position = Position::NextChild;
}
if mark_branches && escape {
if mark_branches {
buf.close_branch("for");
}
buf.push_sync("<!>");
@@ -322,10 +322,6 @@ where
cursor: &Cursor,
position: &PositionState,
) -> Self::State {
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
// get parent and position
let current = cursor.current();
let parent = if position.get() == Position::FirstChild {
@@ -346,22 +342,11 @@ where
for (index, item) in items.enumerate() {
hashed_items.insert((self.key_fn)(&item));
let (set_index, view) = (self.view_fn)(index, item);
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
let item = view.hydrate::<FROM_SERVER>(cursor, position);
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
rendered_items.push(Some((set_index, item)));
}
let marker = cursor.next_placeholder(position);
position.set(Position::NextChild);
if cfg!(feature = "mark_branches") {
cursor.advance_to_placeholder(position);
}
KeyedState {
parent: Some(parent),
marker,