leptos_column_browser/lib.rs
1//! `leptos-column-browser` — multi-pane hierarchical navigator for Leptos.
2//!
3//! Provides both a low-level [`BrowserView`] and a high-level
4//! [`ColumnBrowser`] component for navigating deeply nested trees via an
5//! async [`TopologyProvider`] you implement.
6//!
7//! # Quick Start
8//!
9//! ```rust,ignore
10//! use leptos::prelude::*;
11//! use leptos_column_browser::{
12//! ColumnBrowser, Node, NodeId, StaticTopologyProvider,
13//! };
14//!
15//! #[component]
16//! fn App() -> impl IntoView {
17//! let tree = vec![
18//! Node::container(NodeId::root("docs"), "Documents".into(), "folder")
19//! .with_child(Node::leaf(
20//! NodeId::from_segments(["docs", "readme.md"]),
21//! "readme.md".into(),
22//! "file",
23//! )),
24//! ];
25//!
26//! view! {
27//! <ColumnBrowser
28//! provider=StaticTopologyProvider { nodes: tree }
29//! root_id=NodeId::root("__root__")
30//! on_open=Callback::new(|id| log::info!("opened {id}"))
31//! />
32//! }
33//! }
34//! ```
35#![cfg_attr(docsrs, feature(doc_cfg))]
36#![allow(unreachable_pub)]
37
38/// High-level stateful components.
39#[cfg(feature = "ui")]
40#[cfg_attr(docsrs, doc(cfg(feature = "ui")))]
41pub mod components;
42/// Domain types and traits for hierarchical navigation.
43pub mod topology;
44/// Leptos UI components for column rendering.
45#[cfg(feature = "ui")]
46#[cfg_attr(docsrs, doc(cfg(feature = "ui")))]
47pub mod ui;
48
49// Flat re-exports for the happy path
50#[cfg(feature = "ui")]
51#[cfg_attr(docsrs, doc(cfg(feature = "ui")))]
52pub use components::column_browser::ColumnBrowser;
53pub use topology::{
54 BrowserError, Node, NodeFilter, NodeId, NodeKind, NodeView, NoopTopologyProvider,
55 StaticTopologyProvider, TopologyProvider,
56};
57#[cfg(feature = "ui")]
58#[cfg_attr(docsrs, doc(cfg(feature = "ui")))]
59pub use ui::column::ColumnSizeConfig;
60#[cfg(feature = "ui")]
61#[cfg_attr(docsrs, doc(cfg(feature = "ui")))]
62pub use ui::icons::{
63 DEFAULT_CONTAINER_ICON, DEFAULT_LEAF_ICON, IconRenderer, container_leaf_icon_renderer,
64 default_icon_renderer,
65};
66#[cfg(feature = "ui")]
67#[cfg_attr(docsrs, doc(cfg(feature = "ui")))]
68pub use ui::{BrowserView, DrillPath};