longcipher_leptos_components/
lib.rs

1//! # Leptos Components
2//!
3//! A production-ready UI component library for Leptos applications.
4//!
5//! ## Features
6//!
7//! This crate uses Cargo features to allow tree-shaking and selective inclusion
8//! of components. By default, only the `editor` feature is enabled.
9//!
10//! ### Available Features
11//!
12//! - `editor` - Core text editor component with essential functionality
13//! - `syntax-highlighting` - Syntax highlighting for code (requires `syntect`)
14//! - `markdown` - Markdown parsing and rendering (requires `comrak`)
15//! - `find-replace` - Find and replace functionality
16//! - `folding` - Code folding support
17//! - `statistics` - Document statistics (word count, character count, etc.)
18//! - `line-numbers` - Line number gutter display
19//! - `minimap` - VS Code-style minimap navigation
20//! - `editor-full` - All editor features combined
21//! - `ssr` - Server-side rendering support
22//! - `hydrate` - Hydration support
23//! - `csr` - Client-side rendering only
24//!
25//! ## Quick Start
26//!
27//! ```rust,ignore
28//! use leptos::prelude::*;
29//! use longcipher_leptos_components::editor::Editor;
30//!
31//! #[component]
32//! fn App() -> impl IntoView {
33//!     let (content, set_content) = signal(String::from("Hello, World!"));
34//!     
35//!     view! {
36//!         <Editor
37//!             value=content
38//!             on_change=move |new_value| set_content.set(new_value)
39//!             placeholder="Enter text..."
40//!         />
41//!     }
42//! }
43//! ```
44//!
45//! ## Design Principles
46//!
47//! All components in this library follow these principles:
48//!
49//! 1. **Props with `#[prop(into)]`** - Allow flexible input types
50//! 2. **Optional props with defaults** - Sensible defaults for all optional props
51//! 3. **Custom styling via `class`** - Every component accepts a `class` prop
52//! 4. **Return `impl IntoView`** - Standard Leptos return type
53//! 5. **Accessibility first** - ARIA attributes and keyboard navigation
54//! 6. **SSR compatible** - Works with server-side rendering
55//!
56//! ## Component Categories
57//!
58//! - **Editor** - Rich text and code editing components
59//! - **Display** - Read-only content display components (planned)
60//! - **Input** - Form input components (planned)
61//! - **Feedback** - Alerts, toasts, and notifications (planned)
62//! - **Navigation** - Menus, tabs, and navigation components (planned)
63
64#![cfg_attr(docsrs, feature(doc_cfg))]
65#![warn(missing_docs)]
66#![warn(clippy::all)]
67#![warn(clippy::pedantic)]
68#![allow(clippy::module_name_repetitions)]
69
70// Re-export core dependencies for convenience
71pub use leptos;
72
73// ============================================================================
74// Modules
75// ============================================================================
76
77pub mod components;
78pub mod helpers;
79
80// ============================================================================
81// Re-exports
82// ============================================================================
83
84// Re-export all public components at the crate root for convenience
85/// Editor components
86#[cfg(feature = "editor")]
87#[cfg_attr(docsrs, doc(cfg(feature = "editor")))]
88pub mod editor {
89    pub use crate::components::editor::{Editor, EditorProps};
90}
91
92// ============================================================================
93// Prelude
94// ============================================================================
95
96/// Prelude module for convenient imports
97///
98/// ```rust,ignore
99/// use longcipher_leptos_components::prelude::*;
100/// ```
101pub mod prelude {
102    #[cfg(feature = "editor")]
103    pub use crate::components::editor::*;
104}