diff --git a/examples/accessibility.rs b/examples/accessibility.rs deleted file mode 100644 index 24cfce92..00000000 --- a/examples/accessibility.rs +++ /dev/null @@ -1,20 +0,0 @@ -use dioxus::prelude::*; - -fn main() { - dioxus_native::launch(app); -} - -fn app() -> Element { - rsx! { - body { - App {} - } - } -} - -#[component] -fn App() -> Element { - rsx! { - div { "Dioxus for all" } - } -} diff --git a/examples/bare_style.rs b/examples/bare_style.rs deleted file mode 100644 index c5c420f7..00000000 --- a/examples/bare_style.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Example: dioxus + css + stylo -// -// Create a style context for a dioxus document. -use dioxus::prelude::*; - -fn root() -> Element { - let css = r#" - h1 { - background-color: red; - } - - h2 { - background-color: green; - } - - h3 { - background-color: blue; - } - - h4 { - background-color: yellow; - } - - "#; - - rsx! { - style { {css} } - h1 { "H1" } - h2 { "H2" } - h3 { "H3" } - h4 { "H4" } - } -} - -fn main() { - dioxus_native::launch(root); - - // let document = blitz_dom::Document::new(); - - // let styled_dom = blitz::style_lazy_nodes(css, nodes); - - // print_styles(&styled_dom); -} - -// fn print_styles(markup: &blitz::RealDom) { -// use style::dom::{TElement, TNode}; - -// let root = markup.root_node(); -// for node in 0..markup.nodes.len() { -// let Some(el) = root.with(node).as_element() else { -// continue; -// }; - -// let data = el.borrow_data().unwrap(); -// let primary = data.styles.primary(); -// let bg_color = &primary.get_background().background_color; - -// println!( -// "Styles for node {node_idx}:\n{:#?}", -// bg_color, -// node_idx = node -// ); -// } -// } diff --git a/examples/flex_order.rs b/examples/flex_order.rs deleted file mode 100644 index 7235b377..00000000 --- a/examples/flex_order.rs +++ /dev/null @@ -1,42 +0,0 @@ -/* -Servo doesn't have: -- space-evenly? -- gap -*/ - -use dioxus::prelude::*; - -fn main() { - dioxus_native::launch(app); -} - -fn app() -> Element { - rsx! { - style { {CSS} } - main { - display: "flex", - article { "Article" } - nav { "Nav" } - aside { "Aside" } - } - } -} - -const CSS: &str = r#" -main { - display: flex; - text-align: center; -} -main > article { - flex: 1; - order: 2; -} -main > nav { - width: 200px; - order: 1; -} -main > aside { - width: 200px; - order: 3; -} -"#; diff --git a/examples/google.png b/examples/google.png deleted file mode 100644 index 490cd995..00000000 Binary files a/examples/google.png and /dev/null differ diff --git a/examples/google.rs b/examples/google.rs deleted file mode 100644 index 25fab33c..00000000 --- a/examples/google.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Render google.com! - -use blitz_shell::Config; - -fn main() { - blitz_shell::launch_static_html_cfg( - &get_html(), - Config { - stylesheets: Vec::new(), - base_url: Some(String::from("https://www.google.com/")), - }, - ); -} - -fn get_html() -> std::borrow::Cow<'static, str> { - // Fetch HTML from google.com - // let content = tokio::runtime::Handle::current().block_on(async move { - // let client = reqwest::Client::builder() - // .user_agent("Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0") - // .build() - // .unwrap(); - - // client - // .get("https://google.com") - // .send() - // .await - // .unwrap() - // .text() - // .await - // .unwrap() - // }); - - // Load static HTML - let content = include_str!("./assets/google.html"); - - content.into() -} diff --git a/examples/gosub.rs b/examples/gosub.rs deleted file mode 100644 index dbe8605c..00000000 --- a/examples/gosub.rs +++ /dev/null @@ -1,11 +0,0 @@ -use blitz_shell::Config; - -fn main() { - blitz_shell::launch_static_html_cfg( - include_str!("./assets/gosub_reduced.html"), - Config { - stylesheets: Vec::new(), - base_url: Some(String::from("https://gosub.io/")), - }, - ); -} diff --git a/examples/inline_block.rs b/examples/inline.rs similarity index 54% rename from examples/inline_block.rs rename to examples/inline.rs index 3fed7961..a85d10e9 100644 --- a/examples/inline_block.rs +++ b/examples/inline.rs @@ -34,6 +34,55 @@ fn app() -> Element { span { class: "c", "venenatis" } " gravida nisl sit amet facilisis. Nullam cursus fermentum velit sed laoreet. " } + div { id: "a", + "Some text" + em { "Another block of text" } + "Should connect no space between" + } + h1 { "ul" } + ul { + li { "Item 1" } + li { "Item 2" } + li { + class: "square", + "Square item" + } + li { + class: "circle", + "Circle item" + } + li { + class: "disclosure-open", + "Disclosure open item" + } + li { + class: "disclosure-closed", + "Disclosure closed item" + } + } + h1 { "ol - decimal" } + ol { + li { "Item 1" } + li { "Item 2" } + li { + ul { + li { "Nested Item 1" } + li { "Nested Item 2" } + } + } + li { "Item 3" } + li { "Item 4" } + ol { + li { "Sub 1" } + li { "Sub 2" } + } + } + h1 { "ol - alpha" } + ol { class: "alpha", + li { "Item 1" } + li { "Item 2" } + li { "Item 3" } + } } } } @@ -65,4 +114,26 @@ span.c { border: 1px solid blue; background-color: yellow; } + +#a { +} +h1 { + font-size: 20px; +} +ol.alpha { + list-style-type: lower-alpha; +} +li.square { + list-style-type: square; +} +li.circle { + list-style-type: circle; +} +li.disclosure-open { + list-style-type: disclosure-open; +} +li.disclosure-closed { + list-style-type: disclosure-closed; +} + "#; diff --git a/examples/layout_debug.rs b/examples/layout_debug.rs deleted file mode 100644 index b90c1d82..00000000 --- a/examples/layout_debug.rs +++ /dev/null @@ -1,59 +0,0 @@ -// background: rgb(2,0,36); -// background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%); - -use dioxus::prelude::*; - -fn main() { - dioxus_native::launch(app); -} - -fn app() -> Element { - rsx! { - head { - style { {CSS} } - } - div { class: "test", "hi " } - // div { - // display: "flex", - // flex_direction: "column", - // justify_content: "space-evenly", - // height: "400px", - // div { class: "subdiv" } - // div { class: "subdiv" } - // div { class: "subdiv" } - // div { class: "subdiv" } - // } - div { - class: "parent", - dangerous_inner_html: r#" -
-
-
-
- "# - } - } -} - -const CSS: &str = r#" -.test { - border: 5px solid white; - padding: 10px; - width: 100px; - height: 100px; -} - -.parent { - display: flex; - flex-direction: column; - justify-content: space-between; - height: 400px; -} - -.subdiv { - width: 50px; - height: 50px; - background-color: #333; -} - -"#; diff --git a/examples/parse_debug.rs b/examples/parse_debug.rs deleted file mode 100644 index 2b678a5f..00000000 --- a/examples/parse_debug.rs +++ /dev/null @@ -1,5 +0,0 @@ -//! Render minimal html5 page - -fn main() { - blitz_shell::launch_static_html(include_str!("./assets/google_reduced.html")); -} diff --git a/examples/screenshot.png b/examples/screenshot.png deleted file mode 100644 index 8fd8e9be..00000000 Binary files a/examples/screenshot.png and /dev/null differ diff --git a/examples/scroll.rs b/examples/scroll.rs deleted file mode 100644 index 33f3e670..00000000 --- a/examples/scroll.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Example: scrolling. -// Creates a scrollable element to demo being able to scroll elements when their content size -// exceeds their layout size -use dioxus::prelude::*; - -fn root() -> Element { - let css = r#" - .scrollable { - background-color: green; - overflow: scroll; - height: 200px; - } - - .gap { - height: 300px; - margin: 8px; - background: #11ff11; - display: flex; - align-items: center; - color: white; - } - - .gap:hover { - background: red; - } - - .not-scrollable { - background-color: yellow; - padding-top: 16px; - padding-bottom: 16px; - "#; - - rsx! { - style { {css} } - div { class: "not-scrollable", "Not scrollable" } - div { class: "scrollable", - div { - "Scroll me" - } - div { - class: "gap", - onclick: |_| println!("Gap clicked!"), - "gap" - } - div { - "Hello" - } - } - div { class: "not-scrollable", "Not scrollable" } - } -} - -fn main() { - dioxus_native::launch(root); -} diff --git a/examples/servo.rs b/examples/servo.rs deleted file mode 100644 index cec2469a..00000000 --- a/examples/servo.rs +++ /dev/null @@ -1,14 +0,0 @@ -use blitz_shell::Config; -use std::path::Path; - -fn main() { - let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/assets/servo.html"); - let url = format!("file://{}", dir.display()); - blitz_shell::launch_static_html_cfg( - include_str!("./assets/servo.html"), - Config { - stylesheets: Vec::new(), - base_url: Some(url), - }, - ); -} diff --git a/examples/tailwind.rs b/examples/tailwind.rs deleted file mode 100644 index 0854b909..00000000 --- a/examples/tailwind.rs +++ /dev/null @@ -1,55 +0,0 @@ -//! Drive the renderer from Dioxus -//! -//! -//! -//! - -use dioxus::prelude::*; - -fn main() { - dioxus_native::launch(app); -} - -fn app() -> Element { - rsx! { - style { {CSS} } - for _row in 0..3 { - div { class: "flex flex-row", - div { id: "cool", "h123456789asdjkahskj\nhiiiii" } - div { id: "cool-inset", "h123456789asdjkahskj\nhiiiii" } - p { class: "cool", "hi" } - for x in 1..=9 { - div { class: "bg-red-{x}00 border", "{x}" } - } - } - } - } -} - -const CSS: &str = r#" -p.cool { background-color: purple; } -#cool { - background-color: blue; - font-size: 32px; - box-shadow: 16px 16px 16px rgba(0,0,0,0.6); -} -#cool-inset { - margin-top: 16px; - background-color: purple; - font-size: 32px; - box-shadow: inset 16px 16px 16px rgba(255,255,255,0.6); -} -.bg-red-100 { background-color: rgb(254 226 226); } -.bg-red-200 { background-color: rgb(254 202 202); } -.bg-red-300 { background-color: rgb(252 165 165); } -.bg-red-400 { background-color: rgb(248 113 113); } -.bg-red-500 { background-color: rgb(239 68 68); } -.bg-red-600 { background-color: rgb(220 38 38); } -.bg-red-700 { background-color: rgb(185 28 28); } -.bg-red-800 { background-color: rgb(153 27 27); } -.bg-red-900 { background-color: rgb(127 29 29); } -.bg-red-950 { background-color: rgb(69 10 10); } -.border { - border: 1rem solid; -} -"#; diff --git a/examples/text.rs b/examples/text.rs deleted file mode 100644 index e2af5952..00000000 --- a/examples/text.rs +++ /dev/null @@ -1,87 +0,0 @@ -use dioxus::prelude::*; - -fn main() { - tracing_subscriber::fmt::init(); - - dioxus_native::launch(app); -} - -fn app() -> Element { - rsx! { - body { - style { {CSS} } - div { id: "a", - "Some text" - em { "Another block of text" } - "Should connect no space between" - } - h1 { "ul" } - ul { - li { "Item 1" } - li { "Item 2" } - li { - class: "square", - "Square item" - } - li { - class: "circle", - "Circle item" - } - li { - class: "disclosure-open", - "Disclosure open item" - } - li { - class: "disclosure-closed", - "Disclosure closed item" - } - } - h1 { "ol - decimal" } - ol { - li { "Item 1" } - li { "Item 2" } - li { - ul { - li { "Nested Item 1" } - li { "Nested Item 2" } - } - } - li { "Item 3" } - li { "Item 4" } - ol { - li { "Sub 1" } - li { "Sub 2" } - } - } - h1 { "ol - alpha" } - ol { class: "alpha", - li { "Item 1" } - li { "Item 2" } - li { "Item 3" } - } - } - } -} - -const CSS: &str = r#" -#a { -} -h1 { - font-size: 20px; -} -ol.alpha { - list-style-type: lower-alpha; -} -li.square { - list-style-type: square; -} -li.circle { - list-style-type: circle; -} -li.disclosure-open { - list-style-type: disclosure-open; -} -li.disclosure-closed { - list-style-type: disclosure-closed; -} -"#;