create hot-reload-context flag
This commit is contained in:
1 parent
3165c90e9f
commit
a42ed7d445
4 files changed
+12
-1
No files matched your search
@@ -12,7 +12,7 @@ keywords = ["dom", "ui", "gui", "react", "wasm"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus-core = { path = "../core", version = "^0.2.1" }
|
dioxus-core = { path = "../core", version = "^0.2.1" }
|
||||||
dioxus-rsx = { path = "../rsx" }
|
dioxus-rsx = { path = "../rsx", optional = true }
|
||||||
serde = { version = "1", features = ["derive"], optional = true }
|
serde = { version = "1", features = ["derive"], optional = true }
|
||||||
serde_repr = { version = "0.1", optional = true }
|
serde_repr = { version = "0.1", optional = true }
|
||||||
wasm-bindgen = { version = "0.2.79", optional = true }
|
wasm-bindgen = { version = "0.2.79", optional = true }
|
||||||
@@ -48,3 +48,4 @@ serde_json = "*"
|
|||||||
default = ["serialize"]
|
default = ["serialize"]
|
||||||
serialize = ["serde", "serde_repr", "euclid/serde", "keyboard-types/serde", "dioxus-core/serialize"]
|
serialize = ["serde", "serde_repr", "euclid/serde", "keyboard-types/serde", "dioxus-core/serialize"]
|
||||||
wasm-bind = ["web-sys", "wasm-bindgen"]
|
wasm-bind = ["web-sys", "wasm-bindgen"]
|
||||||
|
hot-reload-context = ["dioxus-rsx"]
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
use crate::{map_global_attributes, map_svg_attributes};
|
use crate::{map_global_attributes, map_svg_attributes};
|
||||||
use crate::{GlobalAttributes, SvgAttributes};
|
use crate::{GlobalAttributes, SvgAttributes};
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
use dioxus_rsx::HotReloadingContext;
|
use dioxus_rsx::HotReloadingContext;
|
||||||
|
|
||||||
pub type AttributeDiscription = (&'static str, Option<&'static str>, bool);
|
pub type AttributeDiscription = (&'static str, Option<&'static str>, bool);
|
||||||
@@ -42,6 +44,7 @@ macro_rules! impl_attribute {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
macro_rules! impl_attribute_match {
|
macro_rules! impl_attribute_match {
|
||||||
(
|
(
|
||||||
$attr:ident $fil:ident: $vil:ident (DEFAULT),
|
$attr:ident $fil:ident: $vil:ident (DEFAULT),
|
||||||
@@ -134,6 +137,7 @@ macro_rules! impl_element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
macro_rules! impl_element_match {
|
macro_rules! impl_element_match {
|
||||||
(
|
(
|
||||||
$el:ident $name:ident None {
|
$el:ident $name:ident None {
|
||||||
@@ -160,6 +164,7 @@ macro_rules! impl_element_match {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
macro_rules! impl_element_match_attributes {
|
macro_rules! impl_element_match_attributes {
|
||||||
(
|
(
|
||||||
$el:ident $attr:ident $name:ident None {
|
$el:ident $attr:ident $name:ident None {
|
||||||
@@ -206,8 +211,10 @@ macro_rules! builder_constructors {
|
|||||||
};
|
};
|
||||||
)*
|
)*
|
||||||
) => {
|
) => {
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
pub struct HtmlCtx;
|
pub struct HtmlCtx;
|
||||||
|
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
impl HotReloadingContext for HtmlCtx {
|
impl HotReloadingContext for HtmlCtx {
|
||||||
fn map_attribute(element: &str, attribute: &str) -> Option<(&'static str, Option<&'static str>)> {
|
fn map_attribute(element: &str, attribute: &str) -> Option<(&'static str, Option<&'static str>)> {
|
||||||
$(
|
$(
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ macro_rules! trait_method {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
macro_rules! trait_method_mapping {
|
macro_rules! trait_method_mapping {
|
||||||
(
|
(
|
||||||
$matching:ident;
|
$matching:ident;
|
||||||
@@ -97,6 +98,7 @@ macro_rules! trait_methods {
|
|||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
pub(crate) fn $fn(attr: &str) -> Option<(&'static str, Option<&'static str>)> {
|
pub(crate) fn $fn(attr: &str) -> Option<(&'static str, Option<&'static str>)> {
|
||||||
$(
|
$(
|
||||||
trait_method_mapping! {
|
trait_method_mapping! {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
//! Currently, we don't validate for structures, but do validate attributes.
|
//! Currently, we don't validate for structures, but do validate attributes.
|
||||||
|
|
||||||
mod elements;
|
mod elements;
|
||||||
|
#[cfg(feature = "hot-reload-context")]
|
||||||
pub use elements::HtmlCtx;
|
pub use elements::HtmlCtx;
|
||||||
pub mod events;
|
pub mod events;
|
||||||
pub mod geometry;
|
pub mod geometry;
|
||||||
|
|||||||
Reference in new issue
Block a user