Chore: remove html crate

This commit is contained in:
Jonathan Kelley committed 2021-02-28 17:30:10 -05:00
1 parent c32a6ef7fe
commit 9dcee01b33
8 files changed
+25 -90

No files matched your search

+2 -2
View File
@@ -18,8 +18,8 @@ members = [
# "packages/hooks",
"packages/cli",
"examples",
"packages/html-macro",
"packages/html-macro-2",
# "packages/html-macro",
# "packages/html-macro-2",
#
#
#
+1
View File
@@ -16,6 +16,7 @@ proc-macro-hack = "0.5.19"
proc-macro2 = "1.0.6"
quote = "1.0"
syn = { version = "1.0.11", features = ["full"] }
style-shared = { git = "https://github.com/derekdreery/style" }
# testing
[dev-dependencies]
@@ -13,7 +13,7 @@
//!
//!
use ::{
use {
proc_macro::TokenStream,
proc_macro2::{Span, TokenStream as TokenStream2},
quote::{quote, ToTokens, TokenStreamExt},
@@ -25,21 +25,10 @@ use ::{
},
};
/// The html! macro makes it easy for developers to write jsx-style markup in their components.
/// We aim to keep functional parity with html templates.
#[proc_macro]
pub fn html(s: TokenStream) -> TokenStream {
let html: HtmlRender = match syn::parse(s) {
Ok(s) => s,
Err(e) => return e.to_compile_error().into(),
};
html.to_token_stream().into()
}
// ==============================================
// Parse any stream coming from the html! macro
// ==============================================
struct HtmlRender {
pub struct HtmlRender {
kind: NodeOrList,
}
@@ -402,6 +391,8 @@ impl ToTokens for ToToksCtx<&LitStr> {
}
}
mod styles {}
#[cfg(test)]
mod test {
fn parse(input: &str) -> super::Result<super::HtmlRender> {
+15 -2
View File
@@ -1,3 +1,4 @@
use proc_macro::TokenStream;
use quote::{quote, quote_spanned, ToTokens};
use syn::spanned::Spanned;
use syn::{
@@ -9,12 +10,24 @@ use syn::{
};
mod fc;
mod htm;
mod ifmt;
/// The html! macro makes it easy for developers to write jsx-style markup in their components.
/// We aim to keep functional parity with html templates.
#[proc_macro]
pub fn html(s: TokenStream) -> TokenStream {
let html: htm::HtmlRender = match syn::parse(s) {
Ok(s) => s,
Err(e) => return e.to_compile_error().into(),
};
html.to_token_stream().into()
}
/// Label a function or static closure as a functional component.
/// This macro reduces the need to create a separate properties struct.
#[proc_macro_attribute]
pub fn fc(attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -> proc_macro::TokenStream {
pub fn fc(attr: TokenStream, item: TokenStream) -> TokenStream {
use fc::{function_component_impl, FunctionComponent};
let item = parse_macro_input!(item as FunctionComponent);
@@ -28,7 +41,7 @@ pub fn fc(attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -> proc_
}
#[proc_macro]
pub fn format_args_f(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
pub fn format_args_f(input: TokenStream) -> TokenStream {
use ifmt::*;
let item = parse_macro_input!(input as IfmtInput);
+1 -1
View File
@@ -12,7 +12,7 @@ description = "Core functionality for Dioxus - a concurrent renderer-agnostic Vi
[dependencies]
# dodrio-derive = { path = "../html-macro-2", version = "0.1.0" }
# dioxus-html-macro = { path = "../html-macro", version = "0.1.0" }
dioxus-html-2 = { path = "../html-macro-2", version = "0.1.0" }
# dioxus-html-2 = { path = "../html-macro-2", version = "0.1.0" }
dioxus-core-macro = { path = "../core-macro", version = "0.1.0" }
# Backs some static data
once_cell = "1.5.2"
+2 -3
View File
@@ -116,8 +116,7 @@ pub(crate) mod innerlude {
// Re-export the FC macro
pub use crate as dioxus;
pub use crate::nodebuilder as builder;
pub use dioxus_core_macro::fc;
pub use dioxus_html_2::html;
pub use dioxus_core_macro::{fc, html};
}
/// Re-export common types for ease of development use.
@@ -145,7 +144,7 @@ pub mod prelude {
pub use crate::nodebuilder as builder;
// pub use dioxus_core_macro::fc;
pub use dioxus_core_macro::format_args_f;
pub use dioxus_html_2::html;
pub use dioxus_core_macro::{fc, html};
// pub use crate::diff::DiffMachine;
pub use crate::dodriodiff::DiffMachine;
-21
View File
@@ -1,21 +0,0 @@
[package]
name = "dioxus-html-2"
version = "0.1.0"
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
edition = "2018"
[lib]
proc-macro = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
syn = "1.0.18"
quote = "1.0.3"
proc-macro-hack = "0.5.15"
proc-macro2 = "1.0.10"
style-shared = { git = "https://github.com/derekdreery/style" }
[dev-dependencies]
bumpalo = "*"
-48
View File
@@ -1,48 +0,0 @@
use bumpalo::Bump;
use dioxus_html_2::html;
mod dioxus {
pub use bumpalo;
pub mod builder {
use bumpalo::Bump;
}
}
fn main() {
/*
Th below code is not meant to compile, but it is meant to expand properly
*/
// let l = html! {
// <div>
// <div>
// <h1>"asdl"</h1>
// <h1>"asdl"</h1>
// <h1>"asdl"</h1>
// <h1>"asdl"</h1>
// </div>
// </div>
// };
// let l = move |bump| {
// dioxus::builder::div(bump)
// .children([dioxus::builder::div(bump)
// .children([
// dioxus::builder::h1(bump)
// .children([dioxus::builder::text("asdl")])
// .finish(),
// dioxus::builder::h1(bump)
// .children([dioxus::builder::text("asdl")])
// .finish(),
// dioxus::builder::h1(bump)
// .children([dioxus::builder::text("asdl")])
// .finish(),
// dioxus::builder::h1(bump)
// .children([dioxus::builder::text("asdl")])
// .finish(),
// ])
// .finish()])
// .finish()
// };
}