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//! ```
85mod components;
86mod types;
87mod interop;
88
89// Re-export main types and components
90pub use components::{
91    Map, 
92    Marker, 
93    Polygon, 
94    Popup,
95};
96pub use types::{
97    Color, 
98    LineCap,
99    LineJoin,
100    PathOptions, 
101    
102    LatLng, 
103    LeafletResources,
104    MapOptions, 
105    MapPosition, 
106    MarkerIcon, 
107    PopupOptions, 
108    TileLayer,
109};