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::{LatLng, Map, MapPosition, Marker, Popup};
19//! 
20//! fn App() -> Element {
21//!     rsx! {
22//!         Map {
23//!             initial_position: MapPosition::new(51.505, -0.09, 13.0),
24//!             height: "400px",
25//!             width: "100%",
26//!             Marker {
27//!                 coordinate: LatLng::new(51.505, -0.09),
28//!                 Popup {
29//!                     b { "London" }
30//!                     br { }
31//!                     "Capital of England"
32//!                 }
33//!             }
34//!         }
35//!     }
36//! }
37//! ```
38//! 
39//! ## Advanced Configuration
40//! 
41//! ### Using a specific Leaflet version from CDN
42//! 
43//! ```rust
44//! use dioxus::prelude::*;
45//! use dioxus_leaflet::{Map, MapPosition, MapOptions, LeafletResources};
46//! 
47//! fn App() -> Element {
48//!     let options = MapOptions::default()
49//!         .with_leaflet_resources(LeafletResources::cdn("1.9.3"));
50//! 
51//!     rsx! {
52//!         Map {
53//!             initial_position: MapPosition::default(),
54//!             options: options,
55//!             height: "400px",
56//!             width: "100%"
57//!         }
58//!     }
59//! }
60//! ```
61//! 
62//! ### Using local Leaflet files
63//! 
64//! ```rust
65//! use dioxus::prelude::*;
66//! use dioxus_leaflet::{Map, MapPosition, MapOptions, LeafletResources};
67//! 
68//! fn App() -> Element {
69//!     let options = MapOptions::default()
70//!         .with_leaflet_resources(LeafletResources::local(
71//!             "/static/css/leaflet.css",
72//!             "/static/js/leaflet.js"
73//!         ));
74//! 
75//!     rsx! {
76//!         Map {
77//!             initial_position: MapPosition::default(),
78//!             options: options,
79//!             height: "400px",
80//!             width: "100%"
81//!         }
82//!     }
83//! }
84//! ```
85
86mod components;
87mod types;
88mod interop;
89
90// Re-export main types and components
91pub use components::{
92    Map, 
93    Marker, 
94    Polygon, 
95    Popup,
96};
97pub use types::{
98    Color, 
99    LineCap,
100    LineJoin,
101    PathOptions, 
102    
103    LatLng, 
104    LeafletResources,
105    MapOptions, 
106    MapPosition, 
107    MarkerIcon, 
108    PopupOptions, 
109    TileLayer,
110};