dioxus_leaflet/lib.rs
1//! # Dioxus Leaflet
2//!
3//! A general-purpose Leaflet map component for Dioxus applications.
4//!
5//! ## Features
6//!
7//! - Easy-to-use map component with customizable markers
8//! - Support for popups and custom styling
9//! - Extensible marker system
10//! - TypeScript-like props system
11//! - Flexible Leaflet integration: CDN (with version selection) or local files
12//! - Configurable Leaflet resources with integrity checking
13//!
14//! ## Basic Usage
15//!
16//! ```rust
17//! use dioxus::prelude::*;
18//! use dioxus_leaflet::{Map, MapPosition, MapMarker};
19//!
20//! fn App() -> Element {
21//! let markers = vec![
22//! MapMarker::new(51.505, -0.09, "London")
23//! .with_description("Capital of England")
24//! ];
25//!
26//! rsx! {
27//! Map {
28//! initial_position: MapPosition::new(51.505, -0.09, 13.0),
29//! markers: markers,
30//! height: "400px",
31//! width: "100%"
32//! }
33//! }
34//! }
35//! ```
36//!
37//! ## Advanced Configuration
38//!
39//! ### Using a specific Leaflet version from CDN
40//!
41//! ```rust
42//! use dioxus::prelude::*;
43//! use dioxus_leaflet::{Map, MapPosition, MapOptions, LeafletResources};
44//!
45//! fn App() -> Element {
46//! let options = MapOptions::default()
47//! .with_leaflet_resources(LeafletResources::cdn("1.9.3"));
48//!
49//! rsx! {
50//! Map {
51//! initial_position: MapPosition::default(),
52//! options: options,
53//! height: "400px",
54//! width: "100%"
55//! }
56//! }
57//! }
58//! ```
59//!
60//! ### Using local Leaflet files
61//!
62//! ```rust
63//! use dioxus::prelude::*;
64//! use dioxus_leaflet::{Map, MapPosition, MapOptions, LeafletResources};
65//!
66//! fn App() -> Element {
67//! let options = MapOptions::default()
68//! .with_leaflet_resources(LeafletResources::local(
69//! "/static/css/leaflet.css",
70//! "/static/js/leaflet.js"
71//! ));
72//!
73//! rsx! {
74//! Map {
75//! initial_position: MapPosition::default(),
76//! options: options,
77//! height: "400px",
78//! width: "100%"
79//! }
80//! }
81//! }
82//! ```
83
84pub mod components;
85pub mod types;
86pub mod utils;
87
88// Re-export main types and components
89pub use components::*;
90pub use types::*;
91pub use utils::*;