publish: move macro crate out of core

This commit is contained in:
Jonathan Kelley 2021-09-24 21:46:23 -04:00
parent 10d335ae31
commit 7bdad1e2e6
25 changed files with 44 additions and 31 deletions

View file

@ -10,8 +10,6 @@ description = "Core functionality for Dioxus - a concurrent renderer-agnostic Vi
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
# todo: use wast for faster load/compile
dioxus-core-macro = { path = "../core-macro", version = "0.1.2" }
# Bumpalo is used as a micro heap backing each component
bumpalo = { version = "3.6.0", features = ["collections", "boxed"] }
@ -41,7 +39,6 @@ serde = { version = "1", features = ["derive"], optional = true }
indexmap = "1.7.0"
[dev-dependencies]
anyhow = "1.0.42"
async-std = { version = "1.9.0", features = ["attributes"] }
@ -50,7 +47,7 @@ dioxus-html = { path = "../html" }
fern = { version = "0.6.0", features = ["colored"] }
rand = { version = "0.8.4", features = ["small_rng"] }
simple_logger = "1.13.0"
dioxus-core-macro = { path = "../core-macro", version = "0.1.2" }
[features]
default = ["serialize"]

View file

@ -15,6 +15,7 @@
use criterion::{criterion_group, criterion_main, Criterion};
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
use rand::prelude::*;

View file

@ -1,5 +1,6 @@
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
use rand::prelude::*;
use std::fmt::Display;

View file

@ -55,14 +55,12 @@ pub(crate) mod innerlude {
pub type DomTree<'a> = Option<VNode<'a>>;
pub type FC<P> = for<'a> fn(Context<'a>, &'a P) -> DomTree<'a>;
pub use dioxus_core_macro::{format_args_f, html, rsx};
}
pub use crate::innerlude::{
format_args_f, html, rsx, Context, DioxusElement, DomEdit, DomTree, ElementId, EventPriority,
LazyNodes, MountType, Mutations, NodeFactory, Properties, ScopeId, SuspendedContext,
SyntheticEvent, TaskHandle, TestDom, UserEvent, VNode, VirtualDom, FC,
Context, DioxusElement, DomEdit, DomTree, ElementId, EventPriority, LazyNodes, MountType,
Mutations, NodeFactory, Properties, ScopeId, SuspendedContext, SyntheticEvent, TaskHandle,
TestDom, UserEvent, VNode, VirtualDom, FC,
};
pub mod prelude {
@ -72,7 +70,6 @@ pub mod prelude {
pub use crate::innerlude::{DioxusElement, DomTree, LazyNodes, Mutations, NodeFactory, FC};
pub use crate::nodes::VNode;
pub use crate::VirtualDom;
pub use dioxus_core_macro::{format_args_f, html, rsx, Props};
}
pub mod exports {

View file

@ -1,5 +1,6 @@
use dioxus::{nodes::VSuspended, prelude::*, DomEdit, TestDom};
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
static Parent: FC<()> = |cx, props| {

View file

@ -5,6 +5,7 @@
use dioxus::{prelude::*, DomEdit};
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
mod test_logging;

View file

@ -6,6 +6,7 @@
use dioxus::{nodes::VSuspended, prelude::*, DomEdit, TestDom};
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
mod test_logging;

View file

@ -8,6 +8,7 @@ use std::{cell::RefCell, rc::Rc};
use anyhow::{Context, Result};
use dioxus::prelude::*;
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
mod test_logging;

View file

@ -3,6 +3,7 @@ use bumpalo::Bump;
use anyhow::{Context, Result};
use dioxus::{prelude::*, DomEdit};
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
#[async_std::test]

View file

@ -5,7 +5,9 @@ use std::{cell::RefCell, rc::Rc};
use anyhow::{Context, Result};
use dioxus::prelude::*;
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
mod test_logging;
const IS_LOGGING_ENABLED: bool = true;

View file

@ -1,6 +1,8 @@
use dioxus::{nodes::VSuspended, prelude::*, DomEdit, TestDom};
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
use DomEdit::*;
mod test_logging;

View file

@ -10,6 +10,7 @@
use dioxus::prelude::*;
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
#[test]

View file

@ -21,3 +21,4 @@ argh = "0.1.4"
serde = "1.0.120"
serde_json = "1.0.61"
fs_extra = "1.2.0"
dioxus-core-macro = { path = "../core-macro" }

View file

@ -1,8 +1,8 @@
use dioxus::virtual_dom::VirtualDom;
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
fn main() {
let mut dom = VirtualDom::new(App);
dom.rebuild();
@ -12,7 +12,7 @@ fn main() {
)
}
pub static App: FC<()> = |cx, props|{
pub static App: FC<()> = |cx, props| {
cx.render(rsx!(
div {
class: "overflow-hidden"

View file

@ -4,6 +4,7 @@
use dioxus::virtual_dom::VirtualDom;
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_hooks::use_state;
use dioxus_html as dioxus_elements;

View file

@ -1,6 +1,7 @@
use dioxus::virtual_dom::VirtualDom;
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_hooks::use_state;
use dioxus_html as dioxus_elements;
use dioxus_html::{GlobalAttributes, SvgAttributes};
@ -23,7 +24,7 @@ fn main() {
.unwrap();
}
pub static App: FC<()> = |cx, props|{
pub static App: FC<()> = |cx, props| {
cx.render(rsx!(
div { class: "overflow-hidden"
link { href:"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel:"stylesheet" }
@ -38,7 +39,7 @@ pub static App: FC<()> = |cx, props|{
))
};
pub static Header: FC<()> = |cx, props|{
pub static Header: FC<()> = |cx, props| {
cx.render(rsx! {
div {
header { class: "text-gray-400 bg-gray-900 body-font"
@ -64,7 +65,7 @@ pub static Header: FC<()> = |cx, props|{
})
};
pub static Hero: FC<()> = |cx, props|{
pub static Hero: FC<()> = |cx, props| {
//
cx.render(rsx! {
section{ class: "text-gray-400 bg-gray-900 body-font"
@ -102,7 +103,7 @@ pub static Hero: FC<()> = |cx, props|{
}
})
};
pub static Entry: FC<()> = |cx, props|{
pub static Entry: FC<()> = |cx, props| {
//
cx.render(rsx! {
section{ class: "text-gray-400 bg-gray-900 body-font"
@ -115,7 +116,7 @@ pub static Entry: FC<()> = |cx, props|{
})
};
pub static StacksIcon: FC<()> = |cx, props|{
pub static StacksIcon: FC<()> = |cx, props| {
cx.render(rsx!(
svg {
// xmlns: "http://www.w3.org/2000/svg"
@ -130,7 +131,7 @@ pub static StacksIcon: FC<()> = |cx, props|{
}
))
};
pub static RightArrowIcon: FC<()> = |cx, props|{
pub static RightArrowIcon: FC<()> = |cx, props| {
cx.render(rsx!(
svg {
fill: "none"

View file

@ -241,6 +241,7 @@ mod tests {
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_html as dioxus_elements;
use dioxus_core_macro::*;
static SIMPLE_APP: FC<()> = |cx, props|{
cx.render(rsx!(div {

View file

@ -75,7 +75,7 @@ uuid = { version = "0.8.2", features = ["v4", "wasm-bindgen"] }
dioxus-hooks = { path = "../hooks" }
serde = { version = "1.0.126", features = ["derive"] }
reqwest = { version = "0.11", features = ["json"] }
dioxus-core-macro = { path = "../core-macro" }
# rand = { version="0.8.4", features=["small_rng"] }
# surf = { version = "2.3.1", default-features = false, features = [
# "wasm-client",

View file

@ -3,6 +3,7 @@ use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;
use dioxus_core_macro::*;
fn main() {
console_error_panic_hook::set_once();

View file

@ -1,6 +1,7 @@
//! Basic example that renders a simple VNode to the browser.
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;

View file

@ -3,9 +3,9 @@
use dioxus::events::on::MouseEvent;
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;
// use wasm_timer;
use std::future::Future;

View file

@ -11,6 +11,7 @@
use dioxus::prelude::*;
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;
@ -22,7 +23,7 @@ fn main() {
// dioxus::web::launch(App, |c| c);
}
static App: FC<()> = |cx, props|{
static App: FC<()> = |cx, props| {
dbg!("rednering parent");
cx.render(rsx! {
div {
@ -39,7 +40,7 @@ static App: FC<()> = |cx, props|{
})
};
static But: FC<()> = |cx, props|{
static But: FC<()> = |cx, props| {
let mut count = use_state(cx, || 0);
// let d = Dropper { name: "asd" };

View file

@ -4,9 +4,9 @@ Tiny CRM: A port of the Yew CRM example to Dioxus.
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;
fn main() {
// Setup logging
wasm_logger::init(wasm_logger::Config::new(log::Level::Debug));

View file

@ -3,10 +3,9 @@
use dioxus::events::on::MouseEvent;
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
use dioxus_core_macro::*;
use dioxus_hooks::*;
use dioxus_html as dioxus_elements;
// use wasm_timer;
use std::future::Future;
use std::{pin::Pin, time::Duration};
@ -25,7 +24,7 @@ fn main() {
dioxus_web::launch(App, |c| c)
}
pub static App: FC<()> = |cx, props|{
pub static App: FC<()> = |cx, props| {
cx.render(rsx!(
div { class: "overflow-hidden"
link { href:"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel:"stylesheet" }
@ -40,7 +39,7 @@ pub static App: FC<()> = |cx, props|{
))
};
pub static Header: FC<()> = |cx, props|{
pub static Header: FC<()> = |cx, props| {
cx.render(rsx! {
div {
header { class: "text-gray-400 bg-gray-900 body-font"
@ -66,7 +65,7 @@ pub static Header: FC<()> = |cx, props|{
})
};
pub static Hero: FC<()> = |cx, props|{
pub static Hero: FC<()> = |cx, props| {
//
cx.render(rsx! {
section{ class: "text-gray-400 bg-gray-900 body-font"
@ -104,7 +103,7 @@ pub static Hero: FC<()> = |cx, props|{
}
})
};
pub static Entry: FC<()> = |cx, props|{
pub static Entry: FC<()> = |cx, props| {
//
cx.render(rsx! {
section{ class: "text-gray-400 bg-gray-900 body-font"
@ -117,7 +116,7 @@ pub static Entry: FC<()> = |cx, props|{
})
};
pub static StacksIcon: FC<()> = |cx, props|{
pub static StacksIcon: FC<()> = |cx, props| {
cx.render(rsx!(
svg {
// xmlns: "http://www.w3.org/2000/svg"
@ -132,7 +131,7 @@ pub static StacksIcon: FC<()> = |cx, props|{
}
))
};
pub static RightArrowIcon: FC<()> = |cx, props|{
pub static RightArrowIcon: FC<()> = |cx, props| {
cx.render(rsx!(
svg {
fill: "none"

View file

@ -193,6 +193,7 @@ pub mod debug {}
pub mod prelude {
//! A glob import that includes helper types like FC, rsx!, html!, and required traits
pub use dioxus_core::prelude::*;
use dioxus_core_macro::{format_args_f, html, rsx, Props};
pub use dioxus_elements::{GlobalAttributes, SvgAttributes};
pub use dioxus_hooks::*;
pub use dioxus_html as dioxus_elements;