1mod component;
2mod data;
3mod router;
4
5mod generated {
6 include!(concat!(env!("OUT_DIR"), "/docs_gen.rs"));
7}
8
9pub use std::{cell::RefCell, fmt::Debug, rc::Rc};
10
11pub(crate) use {
12 component::*,
13 data::*,
14 js_sys::{Promise, decode_uri_component, eval},
15 router::*,
16 web_sys::{Event, HtmlInputElement, KeyboardEvent, Location},
17};
18
19use {
20 euv::{wasm_bindgen::prelude::*, web_sys::*, *},
21 euv_ui::*,
22 wasm_bindgen_futures::{JsFuture, spawn_local},
23};
24
25#[wasm_bindgen]
26pub fn main() {
27 console_error_panic_hook::set_once();
28 inject_app_global_css();
29 Css::inject_css(EUV_MD_CSS);
30 Css::inject_css(
31 ".md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 { padding-left: 0 !important; } \
32 .md-body .header-anchor, .md-body h1:hover .header-anchor, .md-body h2:hover .header-anchor, .md-body h3:hover .header-anchor, .md-body h4:hover .header-anchor, .md-body h5:hover .header-anchor, .md-body h6:hover .header-anchor { display: none !important; } \
33 .md-body img { display: inline-block; width: auto !important; max-width: 100% !important; height: auto; vertical-align: baseline; } \
34 .md-body a > img { display: inline-block; } \
35 .md-body img[src$='.svg'], .md-body img[src*='shields.io'], .md-body img[src*='github.com'] { max-height: 20px; max-width: 100%; } \
36 .md-body table img { max-height: 1.4em; } \
37 \
38 .c_app_main { padding-top: 4.75rem !important; display: flex !important; flex-direction: column !important; min-height: 0 !important; overflow: visible !important; } \
39 \
40 .c_nav_footer_divider { left: 0.75rem !important; right: 0.75rem !important; } \
41 .c_nav_section_label { padding-left: 0.75rem !important; } \
42 .c_nav_footer { padding-left: 0.75rem !important; } \
43 /* Nested sidebar tree alignment. The base euv-ui CSS indents children \
44 * containers via margin-left (20px) + border-left (1px) + padding-left \
45 * (12px) = 33px, so nested items naturally sit 33px to the right of \
46 * their parent. We keep that natural indentation so each nesting level \
47 * reads as visually distinct — group titles and leaf links at the same \
48 * level share the same text position. For hover/active we shift the \
49 * background leftward (margin-left: -13) so the highlight extends back \
50 * to the parent containers dashed border, giving the visual impression \
51 * of selecting within the tree. Text does NOT jump — it sits at the \
52 * natural nested x in all states. The dashed border itself stays 1px; \
53 * it never thickens on hover/active. */ \
54 .c_euv_sidebar_children { margin-left: 20px !important; padding-left: 12px !important; } \
55 \
56 /* Hover on nested items: visible bg flush with the dashed border, text \
57 * stays put. Uses literal rgba because the upstream accent-muted token \
58 * equals the background color in the light theme, which would otherwise \
59 * make hover invisible. */ \
60 .c_euv_sidebar_children a.c_euv_sidebar_link:hover, \
61 .c_euv_sidebar_children .c_euv_sidebar_group_title:hover { margin-left: -13px !important; padding-left: 33px !important; background: rgba(0, 0, 0, 0.08) !important; color: var(--foreground, #000) !important; box-shadow: none !important; } \
62 .c_theme_dark .c_euv_sidebar_children a.c_euv_sidebar_link:hover, \
63 .c_theme_dark .c_euv_sidebar_children .c_euv_sidebar_group_title:hover { background: rgba(255, 255, 255, 0.10) !important; color: var(--foreground, #fff) !important; } \
64 \
65 /* Active page (nested): solid black fill, anchored to the dashed border. \
66 * Same margin hack as hover, but with full-strength background. Text \
67 * does not shift because padding-left compensates. */ \
68 .c_euv_sidebar_children a.c_euv_sidebar_link.c_euv_sidebar_link_active, \
69 .c_euv_sidebar_children .c_euv_sidebar_group_title.c_euv_sidebar_group_title_active { margin-left: -13px !important; padding-left: 33px !important; background: var(--foreground, #000) !important; color: var(--background, #fff) !important; font-weight: 600; box-shadow: none !important; } \
70 \
71 /* Top-level items: same visible hover/active treatment so the visual \
72 * language stays consistent whether the item lives inside a children \
73 * container or not. */ \
74 .c_euv_sidebar_link:hover, .c_euv_sidebar_group_title:hover { background: rgba(0, 0, 0, 0.08) !important; color: var(--foreground, #000) !important; box-shadow: none !important; } \
75 .c_theme_dark .c_euv_sidebar_link:hover, .c_theme_dark .c_euv_sidebar_group_title:hover { background: rgba(255, 255, 255, 0.10) !important; color: var(--foreground, #fff) !important; } \
76 .c_euv_sidebar_link_active, .c_euv_sidebar_group_title_active { background: var(--foreground, #000) !important; color: var(--background, #fff) !important; font-weight: 600; } \
77 \
78 .c_euv_doc_layout { max-width: 1160px !important; display: flex !important; flex-direction: row !important; min-height: 0 !important; width: 100% !important; } \
79 .c_euv_doc_content { display: flex !important; flex-direction: column !important; flex: 1 !important; min-height: 0 !important; } \
80 .c_euv_doc_content > div:not(.c_euv_doc_toc):not(.c_euv_doc_content):not(article) { display: flex !important; flex-direction: column !important; min-height: 0 !important; } \
81 .c_euv_doc_content article.md-body { flex: 0 0 auto !important; min-height: 0 !important; overflow: visible !important; } \
82 .c_euv_doc_toc { width: 280px !important; flex-shrink: 0 !important; } \
83 .c_euv_toc_link_nested { padding-left: 0.75rem !important; font-size: var(--font-sm, 0.875rem) !important; color: var(--muted-foreground, #555) !important; line-height: 1.5 !important; } \
84 .c_euv_toc_link_nested:hover { color: var(--accent, #000) !important; } \
85 \
86 .c_euv_pagination { margin-top: var(--space-4xl, 4rem) !important; padding-top: var(--space-4xl, 4rem) !important; padding-bottom: var(--space-xl, 1.25rem) !important; gap: var(--gap-component, 1rem) !important; } \
87 .c_euv_pagination_link { padding: var(--space-md, 0.75rem) !important; gap: var(--space-2xs, 0.25rem) !important; } \
88 .c_euv_footer { margin-top: auto !important; padding-top: var(--space-lg, 1rem) !important; padding-bottom: var(--space-md, 0.75rem) !important; } \
89 \
90 .c_docs_page_title { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem 0; padding-top: 0; color: var(--foreground, #000); } \
91 \
92 .c_feature_card { border: 1px dashed var(--foreground, #000) !important; border-radius: 0 !important; padding: 1rem !important; background: transparent !important; } \
93 .c_home_btn_secondary { background: transparent !important; color: #000 !important; border: 1.5px solid #000 !important; } \
94 .c_home_btn_secondary:hover { background: rgba(0,0,0,0.06) !important; } \
95 .c_theme_dark .c_home_btn_secondary { background: transparent !important; color: #fff !important; border-color: #fff !important; } \
96 .c_theme_dark .c_home_btn_secondary:hover { background: rgba(255,255,255,0.10) !important; } \
97 \
98 .c_docs_feature_grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; } \
99 @media (max-width: 767px) { .c_docs_feature_grid { grid-template-columns: minmax(0, 1fr); } } \
100 .c_docs_feature_card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1rem; border: 1px dashed var(--foreground, #000); border-radius: 0; background: transparent; text-decoration: none; color: inherit; transition: background 0.15s ease-out, border-color 0.15s ease-out; min-width: 0; } \
101 .c_docs_feature_card:hover { background: var(--accent-muted, rgba(0,0,0,0.06)); border-color: var(--foreground, #000); } \
102 .c_theme_dark .c_docs_feature_card:hover { background: var(--accent-muted, rgba(255,255,255,0.08)); } \
103 .c_docs_feature_card_inner { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; } \
104 .c_docs_feature_card_icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; } \
105 .c_docs_feature_card_title { font-size: 1.125rem; font-weight: 600; overflow-wrap: anywhere; } \
106 .c_docs_feature_card_details { font-size: 0.875rem; color: var(--muted-foreground, #555); overflow-wrap: anywhere; } \
107 \
108 .docs-container-tip, .docs-container-note, .docs-container-important, .docs-container-info { border: 1px dashed var(--foreground, #000); border-left-width: 4px; padding: 0.75rem 1rem; margin: 1rem 0; background: var(--accent-muted, rgba(0,0,0,0.04)); } \
109 .docs-container-warning, .docs-container-caution { border: 1px solid var(--foreground, #000); border-left-width: 4px; padding: 0.75rem 1rem; margin: 1rem 0; background: var(--accent-muted, rgba(0,0,0,0.04)); } \
110 .docs-container-danger { border: 1px solid var(--foreground, #000); border-left-width: 4px; padding: 0.75rem 1rem; margin: 1rem 0; background: rgba(0,0,0,0.06); } \
111 .docs-container-title { font-weight: 600; margin: 0 0 0.25rem 0; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; } \
112 .docs-container-title:empty { display: none; } \
113 \
114 .c_docs_page_title { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 1rem 0; padding-top: 0; color: var(--foreground, #000); } \
115 \
116 .md-body img:not([data-loaded]) { height: 0px !important; margin: 0px !important; visibility: hidden; } \
117 .md-body img[data-loaded] { transition: opacity 0.2s ease-out; }",
118 );
119 App::mount("#app", app);
120 let _ = js_sys::eval(
121 "(function(){var p=function(i){if(i.dataset.loaded)return;var m=function(){i.dataset.loaded='1';};if(i.complete&&i.naturalWidth>0){m();}else{i.addEventListener('load',m);i.addEventListener('error',m);}};var o=new MutationObserver(function(ms){ms.forEach(function(d){d.addedNodes.forEach(function(n){if(n.tagName==='IMG'){p(n);}if(n.querySelectorAll){n.querySelectorAll('img').forEach(p);}});});});o.observe(document.body,{childList:true,subtree:true});document.querySelectorAll('img').forEach(p);}());",
122 );
123}