fix: correct re-exports for islands with props (closes #2723)

This commit is contained in:
Greg Johnston 2024-07-26 11:58:48 -04:00
parent 1c05389707
commit 30cf1167f2
3 changed files with 19 additions and 12 deletions

View File

@ -296,10 +296,17 @@ pub mod spawn {
} }
} }
// these reexports are used in islands
#[cfg(feature = "experimental-islands")]
#[doc(hidden)] #[doc(hidden)]
pub use wasm_bindgen; // used in islands pub use serde;
#[cfg(feature = "experimental-islands")]
#[doc(hidden)] #[doc(hidden)]
pub use web_sys; // used in islands pub use serde_json;
#[doc(hidden)]
pub use wasm_bindgen;
#[doc(hidden)]
pub use web_sys;
/*mod additional_attributes; /*mod additional_attributes;
pub use additional_attributes::*; pub use additional_attributes::*;

View File

@ -375,16 +375,15 @@ impl ToTokens for Model {
} else { } else {
quote! {} quote! {}
}; };
let deserialize_island_props = quote! {}; /*if is_island_with_other_props { let deserialize_island_props = if is_island_with_other_props {
quote! { quote! {
let props = el.dataset().get("props") // TODO ::leptos::wasm_bindgen::intern("props")) let props = el.dataset().get(::leptos::wasm_bindgen::intern("props"))
.and_then(|data| ::leptos::serde_json::from_str::<#props_serialized_name>(&data).ok()) .and_then(|data| ::leptos::serde_json::from_str::<#props_serialized_name>(&data).ok())
.expect("could not deserialize props"); .expect("could not deserialize props");
} }
} else { } else {
quote! {} quote! {}
};*/ };
// TODO
quote! { quote! {
#[::leptos::wasm_bindgen::prelude::wasm_bindgen(wasm_bindgen = ::leptos::wasm_bindgen)] #[::leptos::wasm_bindgen::prelude::wasm_bindgen(wasm_bindgen = ::leptos::wasm_bindgen)]

View File

@ -42,6 +42,7 @@ web-sys = { version = "0.3", features = [
"CssStyleDeclaration", "CssStyleDeclaration",
"ShadowRoot", "ShadowRoot",
"HtmlCollection", "HtmlCollection",
"DomStringMap",
# Events we cast to in leptos_macro -- added here so we don't force users to import them # Events we cast to in leptos_macro -- added here so we don't force users to import them
"AddEventListenerOptions", "AddEventListenerOptions",