re export renderers in dioxus
This commit is contained in:
1 parent
b291a5c0b0
commit
af1749d7be
61 files changed
+860
-100
No files matched your search
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "dioxus-config-macro"
|
||||
version = { workspace = true }
|
||||
authors = ["Jonathan Kelley"]
|
||||
edition = "2021"
|
||||
description = "Configuration macros for Dioxus"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/DioxusLabs/dioxus/"
|
||||
homepage = "https://dioxuslabs.com"
|
||||
keywords = ["dom", "ui", "gui", "react"]
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = { version = "1.0" }
|
||||
quote = "1.0"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
fullstack = []
|
||||
desktop = []
|
||||
web = []
|
||||
ssr = []
|
||||
liveview = []
|
||||
tui = []
|
||||
@@ -0,0 +1,39 @@
|
||||
# dioxus-config-macro
|
||||
|
||||
[![Crates.io][crates-badge]][crates-url]
|
||||
[![MIT licensed][mit-badge]][mit-url]
|
||||
[![Build Status][actions-badge]][actions-url]
|
||||
[![Discord chat][discord-badge]][discord-url]
|
||||
|
||||
[crates-badge]: https://img.shields.io/crates/v/dioxus-config-macro.svg
|
||||
[crates-url]: https://crates.io/crates/dioxus-config-macro
|
||||
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[mit-url]: https://github.com/dioxuslabs/dioxus/blob/master/LICENSE
|
||||
[actions-badge]: https://github.com/dioxuslabs/dioxus/actions/workflows/main.yml/badge.svg
|
||||
[actions-url]: https://github.com/dioxuslabs/dioxus/actions?query=workflow%3ACI+branch%3Amaster
|
||||
[discord-badge]: https://img.shields.io/discord/899851952891002890.svg?logo=discord&style=flat-square
|
||||
[discord-url]: https://discord.gg/XgGxMSkvUM
|
||||
|
||||
[Website](https://dioxuslabs.com) |
|
||||
[Guides](https://dioxuslabs.com/learn/0.4/) |
|
||||
[API Docs](https://docs.rs/dioxus-config-macro/latest/dioxus_core_macro) |
|
||||
[Chat](https://discord.gg/XgGxMSkvUM)
|
||||
|
||||
## Overview
|
||||
|
||||
`dioxus-config-macro` provides a handful of helpful macros to make it easier to work with optional sections of the launch builder.
|
||||
|
||||
## Contributing
|
||||
|
||||
- Report issues on our [issue tracker](https://github.com/dioxuslabs/dioxus/issues).
|
||||
- Join the discord and ask questions!
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [MIT license].
|
||||
|
||||
[mit license]: https://github.com/DioxusLabs/dioxus/blob/master/LICENSE-MIT
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in Dioxus by you shall be licensed as MIT without any additional
|
||||
terms or conditions.
|
||||
@@ -0,0 +1,112 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
#![doc(html_logo_url = "https://avatars.githubusercontent.com/u/79236386")]
|
||||
#![doc(html_favicon_url = "https://avatars.githubusercontent.com/u/79236386")]
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use quote::quote;
|
||||
|
||||
#[proc_macro]
|
||||
pub fn server(input: TokenStream) -> TokenStream {
|
||||
if cfg!(any(feature = "ssr", feature = "liveview")) {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn client(input: TokenStream) -> TokenStream {
|
||||
if cfg!(any(feature = "desktop", feature = "web", feature = "tui")) {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn desktop(input: TokenStream) -> TokenStream {
|
||||
if cfg!(feature = "desktop") {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn fullstack(input: TokenStream) -> TokenStream {
|
||||
if cfg!(feature = "web") {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn ssr(input: TokenStream) -> TokenStream {
|
||||
if cfg!(feature = "ssr") {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn liveview(input: TokenStream) -> TokenStream {
|
||||
if cfg!(feature = "liveview") {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
#[proc_macro]
|
||||
pub fn tui(input: TokenStream) -> TokenStream {
|
||||
if cfg!(feature = "tui") {
|
||||
let input = TokenStream2::from(input);
|
||||
quote! {
|
||||
Some(#input)
|
||||
}
|
||||
} else {
|
||||
quote! {
|
||||
None
|
||||
}
|
||||
}
|
||||
.into()
|
||||
}
|
||||
Reference in new issue
Block a user