Skip to main content

nightshade_api/
web.rs

1//! Leptos (CSR) components for building the page around an engine viewport,
2//! plus a general set of themed UI patterns: panels, forms, menus, tables,
3//! trees, a command palette, keybindings, a code editor, toasts, a status bar,
4//! drag and drop, and a resizable app shell, all driven from one set of CSS
5//! custom properties.
6//!
7//! Enabled by the `leptos` cargo feature. The module is engine-free: it talks
8//! to a render worker over the [`crate::wire`] messages, so a page crate can
9//! depend on `nightshade-api` with `default-features = false` and
10//! `features = ["leptos"]` without compiling the engine.
11//!
12//! Drop [`UiStyles`] and a [`ThemeProvider`] at the root, then compose
13//! components. For a worker-backed render surface, create an [`Engine`] with
14//! [`use_engine`] and render an [`EngineViewport`]; the worker side pairs with
15//! [`crate::offscreen::run_offscreen`] behind the `offscreen` feature.
16//!
17//! ```ignore
18//! use nightshade_api::web::prelude::*;
19//!
20//! #[component]
21//! fn App() -> impl IntoView {
22//!     let engine = use_engine("runtime/worker.js");
23//!     view! {
24//!         <UiStyles />
25//!         <ThemeProvider>
26//!             <WebGpuGate>
27//!                 <EngineViewport engine=engine />
28//!                 <Loader ready=engine.state.ready />
29//!             </WebGpuGate>
30//!         </ThemeProvider>
31//!     }
32//! }
33//! ```
34
35mod ansi_terminal;
36mod asset_grid;
37mod base;
38mod browser;
39mod chat;
40mod code_editor;
41mod code_surface;
42mod command;
43mod diff;
44mod disclosure;
45mod dock;
46mod dynamic_form;
47mod editor_shell;
48mod engine;
49mod files;
50mod floating;
51mod forms;
52mod hud;
53mod inspector;
54mod jump;
55mod keymap;
56mod list_editor;
57mod log_view;
58mod markdown;
59mod menus;
60mod multi_editor;
61mod palette;
62mod pointer_drag;
63mod search_list;
64mod status_bar;
65mod styles;
66mod table;
67mod terminal;
68mod theme;
69mod toolbar;
70mod tree;
71mod undo_tree;
72mod util;
73mod viewport;
74mod virtual_list;
75mod workspace;
76
77pub use ansi_terminal::*;
78pub use asset_grid::*;
79pub use base::*;
80pub use browser::*;
81pub use chat::*;
82pub use code_editor::*;
83pub use code_surface::*;
84pub use command::*;
85pub use diff::*;
86pub use disclosure::*;
87pub use dock::*;
88pub use dynamic_form::*;
89pub use editor_shell::*;
90pub use engine::*;
91pub use files::*;
92pub use floating::*;
93pub use forms::*;
94pub use hud::*;
95pub use inspector::*;
96pub use jump::*;
97pub use keymap::*;
98pub use list_editor::*;
99pub use log_view::*;
100pub use markdown::*;
101pub use menus::*;
102pub use multi_editor::*;
103pub use palette::*;
104pub use pointer_drag::*;
105pub use search_list::*;
106pub use status_bar::*;
107pub use styles::{UiStyles, stylesheet};
108pub use table::*;
109pub use terminal::*;
110pub use theme::*;
111pub use toolbar::*;
112pub use tree::*;
113pub use undo_tree::*;
114pub use util::*;
115pub use viewport::*;
116pub use virtual_list::*;
117pub use workspace::*;
118
119pub use crate::wire::*;
120
121/// Everything in one import for a page crate.
122///
123/// ```ignore
124/// use nightshade_api::web::prelude::*;
125/// ```
126pub mod prelude {
127    pub use super::*;
128    pub use leptos::prelude::*;
129}