{# Map Components — MapLibre GL Reusable macros for MapLibre GL map containers with dark theme. ALL maps in Tusk use MapLibre GL (no Leaflet). Macros: map_assets, map_container, map_dark_styles, carto_dark_style Map initialization (new maplibregl.Map) remains in JS files. These macros standardize the container, CDN tags, basemap, and dark theme. #} {% macro map_assets() %} {# MapLibre GL CDN script and CSS tags. Place in {% block extra_head %} or at the top of {% block scripts %}. #} {% endmacro %} {% macro map_container(id, height="100%", extra_classes="", rounded=true) %} {# Container div for a MapLibre instance. Args: id: DOM element ID (used by maplibregl.Map to attach) height: CSS height value (default "100%") extra_classes: Additional CSS classes rounded: Whether to round corners (default true) #}
{% endmacro %} {% macro map_dark_styles() %} {# Dark theme CSS for MapLibre popups. Outputs a {% endmacro %} {% macro carto_dark_style() %} {# CARTO Dark Matter basemap style object for MapLibre GL. Use directly in JS as the style parameter for new maplibregl.Map(). #} { version: 8, sources: { 'carto-dark': { type: 'raster', tiles: ['https://basemaps.cartocdn.com/dark_all/{z}/{x}/{y}@2x.png'], tileSize: 256, attribution: '© CARTO' } }, layers: [{ id: 'carto-dark-layer', type: 'raster', source: 'carto-dark', minzoom: 0, maxzoom: 22 }] } {% endmacro %}