@prushforth/map 1.0.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +89 -0
- package/demo/index.html +78 -0
- package/dist/cjs/AttributionButton-DgbgLHy4.js +106 -0
- package/dist/cjs/MapTileLayer-D4vp8bR4.js +454 -0
- package/dist/cjs/app-globals-DY--Q2Nl.js +775 -0
- package/dist/cjs/calculatePosition-CDcdNl7C.js +92 -0
- package/dist/cjs/gcds-ext-map.cjs.js +47 -0
- package/dist/cjs/gcds-ext-map_2.cjs.entry.js +8081 -0
- package/dist/cjs/index-CW_WOSnc.js +32697 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +14 -0
- package/dist/cjs/locale-_4nEyxeO.js +153 -0
- package/dist/cjs/map-a.cjs.entry.js +16 -0
- package/dist/cjs/map-caption.cjs.entry.js +55 -0
- package/dist/cjs/map-extent.cjs.entry.js +993 -0
- package/dist/cjs/map-feature.cjs.entry.js +636 -0
- package/dist/cjs/map-featurecaption.cjs.entry.js +14 -0
- package/dist/cjs/map-geometry.cjs.entry.js +36 -0
- package/dist/cjs/map-input.cjs.entry.js +348 -0
- package/dist/cjs/map-link.cjs.entry.js +6055 -0
- package/dist/cjs/map-meta.cjs.entry.js +40 -0
- package/dist/cjs/map-properties.cjs.entry.js +14 -0
- package/dist/cjs/map-select.cjs.entry.js +100 -0
- package/dist/cjs/map-span.cjs.entry.js +14 -0
- package/dist/cjs/map-style.cjs.entry.js +127 -0
- package/dist/cjs/map-tile.cjs.entry.js +274 -0
- package/dist/cjs/renderStyles-yOMXvf12.js +59 -0
- package/dist/collection/assets/canada.json +1 -0
- package/dist/collection/assets/images/w3community.ico +0 -0
- package/dist/collection/assets/mapml/en/apstile/arctic +18 -0
- package/dist/collection/assets/mapml/en/cbmtile/canvec +22 -0
- package/dist/collection/assets/mapml/en/cbmtile/cbmt +24 -0
- package/dist/collection/assets/mapml/en/cbmtile/cbmtgeom +20 -0
- package/dist/collection/assets/mapml/en/cbmtile/cbmtsimple +20 -0
- package/dist/collection/assets/mapml/en/cbmtile/current_conditions +33 -0
- package/dist/collection/assets/mapml/en/cbmtile/toporama +25 -0
- package/dist/collection/assets/mapml/en/custom/arcticsdi.mapml +18 -0
- package/dist/collection/assets/mapml/en/osmtile/cbmt +24 -0
- package/dist/collection/assets/mapml/en/osmtile/current_conditions +32 -0
- package/dist/collection/assets/mapml/en/osmtile/dark.mapml +19 -0
- package/dist/collection/assets/mapml/en/osmtile/light.mapml +19 -0
- package/dist/collection/assets/mapml/en/osmtile/osm +19 -0
- package/dist/collection/assets/mapml/en/osmtile/toporama +25 -0
- package/dist/collection/assets/mapml/fr/apstile/arctic +19 -0
- package/dist/collection/assets/mapml/fr/cbmtile/canvec +22 -0
- package/dist/collection/assets/mapml/fr/cbmtile/cbmt +24 -0
- package/dist/collection/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
- package/dist/collection/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
- package/dist/collection/assets/mapml/fr/cbmtile/current_conditions +25 -0
- package/dist/collection/assets/mapml/fr/cbmtile/toporama +25 -0
- package/dist/collection/assets/mapml/fr/osmtile/cbmt +24 -0
- package/dist/collection/assets/mapml/fr/osmtile/current_conditions +24 -0
- package/dist/collection/assets/mapml/fr/osmtile/dark.mapml +19 -0
- package/dist/collection/assets/mapml/fr/osmtile/light.mapml +19 -0
- package/dist/collection/assets/mapml/fr/osmtile/osm +19 -0
- package/dist/collection/assets/mapml/fr/osmtile/toporama +25 -0
- package/dist/collection/assets/pmtiles/darkTheme.js +19 -0
- package/dist/collection/assets/pmtiles/lightTheme.js +19 -0
- package/dist/collection/collection-manifest.json +28 -0
- package/dist/collection/components/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
- package/dist/collection/components/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
- package/dist/collection/components/gcds-ext-map/gcds-ext-map.css +2138 -0
- package/dist/collection/components/gcds-ext-map/gcds-ext-map.js +1517 -0
- package/dist/collection/components/gcds-ext-map/stories/gcds-ext-map.stories.js +367 -0
- package/dist/collection/components/map-a/map-a.js +89 -0
- package/dist/collection/components/map-caption/map-caption.js +52 -0
- package/dist/collection/components/map-extent/map-extent.js +809 -0
- package/dist/collection/components/map-feature/map-feature.js +724 -0
- package/dist/collection/components/map-featurecaption/map-featurecaption.js +6 -0
- package/dist/collection/components/map-geometry/map-geometry.js +57 -0
- package/dist/collection/components/map-input/map-input.js +355 -0
- package/dist/collection/components/map-layer/map-layer.js +1245 -0
- package/dist/collection/components/map-layer/stories/map-layer.stories.js +101 -0
- package/dist/collection/components/map-link/map-link.js +1149 -0
- package/dist/collection/components/map-meta/map-meta.js +82 -0
- package/dist/collection/components/map-properties/map-properties.js +7 -0
- package/dist/collection/components/map-select/map-select.js +145 -0
- package/dist/collection/components/map-span/map-span.js +7 -0
- package/dist/collection/components/map-style/map-style.js +144 -0
- package/dist/collection/components/map-tile/map-tile.js +370 -0
- package/dist/collection/components/utils/mapml/DOMTokenList.js +123 -0
- package/dist/collection/components/utils/mapml/DefaultMapOptions.js +11 -0
- package/dist/collection/components/utils/mapml/Util.js +1601 -0
- package/dist/collection/components/utils/mapml/control/AttributionButton.js +101 -0
- package/dist/collection/components/utils/mapml/control/FullscreenButton.js +181 -0
- package/dist/collection/components/utils/mapml/control/GeolocationButton.js +70 -0
- package/dist/collection/components/utils/mapml/control/LayerControl.js +212 -0
- package/dist/collection/components/utils/mapml/control/ReloadButton.js +75 -0
- package/dist/collection/components/utils/mapml/control/ScaleBar.js +108 -0
- package/dist/collection/components/utils/mapml/control/SearchButton.js +565 -0
- package/dist/collection/components/utils/mapml/elementSupport/extents/createLayerControlForExtent.js +259 -0
- package/dist/collection/components/utils/mapml/elementSupport/inputs/heightInput.js +18 -0
- package/dist/collection/components/utils/mapml/elementSupport/inputs/hiddenInput.js +19 -0
- package/dist/collection/components/utils/mapml/elementSupport/inputs/locationInput.js +127 -0
- package/dist/collection/components/utils/mapml/elementSupport/inputs/widthInput.js +18 -0
- package/dist/collection/components/utils/mapml/elementSupport/inputs/zoomInput.js +30 -0
- package/dist/collection/components/utils/mapml/elementSupport/layers/calculatePosition.js +88 -0
- package/dist/collection/components/utils/mapml/elementSupport/layers/createLayerControlForLayer.js +326 -0
- package/dist/collection/components/utils/mapml/elementSupport/layers/renderStyles.js +55 -0
- package/dist/collection/components/utils/mapml/elementSupport/viewers/matchMedia.js +251 -0
- package/dist/collection/components/utils/mapml/features/featureRenderer.js +342 -0
- package/dist/collection/components/utils/mapml/features/geometry.js +268 -0
- package/dist/collection/components/utils/mapml/features/path.js +485 -0
- package/dist/collection/components/utils/mapml/handlers/AnnounceMovement.js +154 -0
- package/dist/collection/components/utils/mapml/handlers/ContextMenu.js +1436 -0
- package/dist/collection/components/utils/mapml/handlers/FeatureIndex.js +116 -0
- package/dist/collection/components/utils/mapml/handlers/QueryHandler.js +476 -0
- package/dist/collection/components/utils/mapml/handlers/keyboard.js +60 -0
- package/dist/collection/components/utils/mapml/layers/Crosshair.js +108 -0
- package/dist/collection/components/utils/mapml/layers/DebugOverlay.js +357 -0
- package/dist/collection/components/utils/mapml/layers/FeatureIndexOverlay.js +239 -0
- package/dist/collection/components/utils/mapml/layers/ImageLayer.js +136 -0
- package/dist/collection/components/utils/mapml/layers/MapExtentLayer.js +114 -0
- package/dist/collection/components/utils/mapml/layers/MapFeatureLayer.js +623 -0
- package/dist/collection/components/utils/mapml/layers/MapLayer.js +640 -0
- package/dist/collection/components/utils/mapml/layers/MapTileLayer.js +450 -0
- package/dist/collection/components/utils/mapml/layers/TemplatedFeaturesOrTilesLayer.js +346 -0
- package/dist/collection/components/utils/mapml/layers/TemplatedImageLayer.js +276 -0
- package/dist/collection/components/utils/mapml/layers/TemplatedPMTilesLayer.js +135 -0
- package/dist/collection/components/utils/mapml/layers/TemplatedTileLayer.js +664 -0
- package/dist/collection/components/utils/utils.js +26 -0
- package/dist/collection/fonts/icons/LICENSE.txt +92 -0
- package/dist/collection/fonts/icons/README.md +543 -0
- package/dist/collection/fonts/icons/gcds-icons.css +110 -0
- package/dist/collection/fonts/icons/gcds-icons.eot +0 -0
- package/dist/collection/fonts/icons/gcds-icons.svg +82 -0
- package/dist/collection/fonts/icons/gcds-icons.ttf +0 -0
- package/dist/collection/fonts/icons/gcds-icons.woff +0 -0
- package/dist/collection/fonts/lato/LICENSE.txt +48 -0
- package/dist/collection/fonts/lato/README.md +195 -0
- package/dist/collection/fonts/lato/gcds-lato-italic.woff +0 -0
- package/dist/collection/fonts/lato/gcds-lato-italic.woff2 +0 -0
- package/dist/collection/fonts/lato/gcds-lato.css +30 -0
- package/dist/collection/fonts/lato/gcds-lato.woff +0 -0
- package/dist/collection/fonts/lato/gcds-lato.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/LICENSE.txt +43 -0
- package/dist/collection/fonts/noto-sans/README.md +423 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
- package/dist/collection/fonts/noto-sans/gcds-noto-sans.css +89 -0
- package/dist/collection/fonts/noto-sans-mono/LICENSE.txt +93 -0
- package/dist/collection/fonts/noto-sans-mono/README.md +135 -0
- package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
- package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
- package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
- package/dist/collection/generated/locale.js +148 -0
- package/dist/collection/global/mapml-globals.js +916 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/leaflet-src.esm.js +14419 -0
- package/dist/components/gcds-ext-map.d.ts +11 -0
- package/dist/components/gcds-ext-map.js +10 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/map-a.d.ts +11 -0
- package/dist/components/map-a.js +1 -0
- package/dist/components/map-caption.d.ts +11 -0
- package/dist/components/map-caption.js +1 -0
- package/dist/components/map-extent.d.ts +11 -0
- package/dist/components/map-extent.js +1 -0
- package/dist/components/map-feature.d.ts +11 -0
- package/dist/components/map-feature.js +1 -0
- package/dist/components/map-featurecaption.d.ts +11 -0
- package/dist/components/map-featurecaption.js +1 -0
- package/dist/components/map-geometry.d.ts +11 -0
- package/dist/components/map-geometry.js +1 -0
- package/dist/components/map-input.d.ts +11 -0
- package/dist/components/map-input.js +1 -0
- package/dist/components/map-layer.d.ts +11 -0
- package/dist/components/map-layer.js +1 -0
- package/dist/components/map-link.d.ts +11 -0
- package/dist/components/map-link.js +1 -0
- package/dist/components/map-meta.d.ts +11 -0
- package/dist/components/map-meta.js +1 -0
- package/dist/components/map-properties.d.ts +11 -0
- package/dist/components/map-properties.js +1 -0
- package/dist/components/map-select.d.ts +11 -0
- package/dist/components/map-select.js +1 -0
- package/dist/components/map-span.d.ts +11 -0
- package/dist/components/map-span.js +1 -0
- package/dist/components/map-style.d.ts +11 -0
- package/dist/components/map-style.js +1 -0
- package/dist/components/map-tile.d.ts +11 -0
- package/dist/components/map-tile.js +1 -0
- package/dist/components/p-B4YLD_Og.js +1 -0
- package/dist/components/p-BE41zrui.js +1 -0
- package/dist/components/p-Bpv_U_Lb.js +1 -0
- package/dist/components/p-CwRxGZga.js +5 -0
- package/dist/components/p-EYVT9Efh.js +1 -0
- package/dist/components/p-gwC_yeRa.js +1 -0
- package/dist/esm/AttributionButton-CfaoSLCu.js +103 -0
- package/dist/esm/MapTileLayer-DvC_iOIS.js +451 -0
- package/dist/esm/app-globals-De5ze2BD.js +773 -0
- package/dist/esm/calculatePosition-B4YLD_Og.js +90 -0
- package/dist/esm/gcds-ext-map.js +43 -0
- package/dist/esm/gcds-ext-map_2.entry.js +8078 -0
- package/dist/esm/index-BUsJ7i5g.js +32656 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +12 -0
- package/dist/esm/locale-Bpv_U_Lb.js +150 -0
- package/dist/esm/map-a.entry.js +14 -0
- package/dist/esm/map-caption.entry.js +53 -0
- package/dist/esm/map-extent.entry.js +991 -0
- package/dist/esm/map-feature.entry.js +634 -0
- package/dist/esm/map-featurecaption.entry.js +12 -0
- package/dist/esm/map-geometry.entry.js +34 -0
- package/dist/esm/map-input.entry.js +346 -0
- package/dist/esm/map-link.entry.js +6035 -0
- package/dist/esm/map-meta.entry.js +38 -0
- package/dist/esm/map-properties.entry.js +12 -0
- package/dist/esm/map-select.entry.js +98 -0
- package/dist/esm/map-span.entry.js +12 -0
- package/dist/esm/map-style.entry.js +125 -0
- package/dist/esm/map-tile.entry.js +272 -0
- package/dist/esm/renderStyles-EYVT9Efh.js +57 -0
- package/dist/gcds-ext-map/assets/canada.json +1 -0
- package/dist/gcds-ext-map/assets/images/w3community.ico +0 -0
- package/dist/gcds-ext-map/assets/mapml/en/apstile/arctic +18 -0
- package/dist/gcds-ext-map/assets/mapml/en/cbmtile/canvec +22 -0
- package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmt +24 -0
- package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtgeom +20 -0
- package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtsimple +20 -0
- package/dist/gcds-ext-map/assets/mapml/en/cbmtile/current_conditions +33 -0
- package/dist/gcds-ext-map/assets/mapml/en/cbmtile/toporama +25 -0
- package/dist/gcds-ext-map/assets/mapml/en/custom/arcticsdi.mapml +18 -0
- package/dist/gcds-ext-map/assets/mapml/en/osmtile/cbmt +24 -0
- package/dist/gcds-ext-map/assets/mapml/en/osmtile/current_conditions +32 -0
- package/dist/gcds-ext-map/assets/mapml/en/osmtile/dark.mapml +19 -0
- package/dist/gcds-ext-map/assets/mapml/en/osmtile/light.mapml +19 -0
- package/dist/gcds-ext-map/assets/mapml/en/osmtile/osm +19 -0
- package/dist/gcds-ext-map/assets/mapml/en/osmtile/toporama +25 -0
- package/dist/gcds-ext-map/assets/mapml/fr/apstile/arctic +19 -0
- package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/canvec +22 -0
- package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmt +24 -0
- package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
- package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
- package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/current_conditions +25 -0
- package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/toporama +25 -0
- package/dist/gcds-ext-map/assets/mapml/fr/osmtile/cbmt +24 -0
- package/dist/gcds-ext-map/assets/mapml/fr/osmtile/current_conditions +24 -0
- package/dist/gcds-ext-map/assets/mapml/fr/osmtile/dark.mapml +19 -0
- package/dist/gcds-ext-map/assets/mapml/fr/osmtile/light.mapml +19 -0
- package/dist/gcds-ext-map/assets/mapml/fr/osmtile/osm +19 -0
- package/dist/gcds-ext-map/assets/mapml/fr/osmtile/toporama +25 -0
- package/dist/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
- package/dist/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
- package/dist/gcds-ext-map/fonts/icons/LICENSE.txt +92 -0
- package/dist/gcds-ext-map/fonts/icons/README.md +543 -0
- package/dist/gcds-ext-map/fonts/icons/gcds-icons.css +110 -0
- package/dist/gcds-ext-map/fonts/icons/gcds-icons.eot +0 -0
- package/dist/gcds-ext-map/fonts/icons/gcds-icons.svg +82 -0
- package/dist/gcds-ext-map/fonts/icons/gcds-icons.ttf +0 -0
- package/dist/gcds-ext-map/fonts/icons/gcds-icons.woff +0 -0
- package/dist/gcds-ext-map/fonts/lato/LICENSE.txt +48 -0
- package/dist/gcds-ext-map/fonts/lato/README.md +195 -0
- package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff +0 -0
- package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/lato/gcds-lato.css +30 -0
- package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff +0 -0
- package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/LICENSE.txt +43 -0
- package/dist/gcds-ext-map/fonts/noto-sans/README.md +423 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans.css +89 -0
- package/dist/gcds-ext-map/fonts/noto-sans-mono/LICENSE.txt +93 -0
- package/dist/gcds-ext-map/fonts/noto-sans-mono/README.md +135 -0
- package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
- package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
- package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
- package/dist/gcds-ext-map/gcds-ext-map.esm.js +1 -0
- package/dist/gcds-ext-map/index.esm.js +0 -0
- package/dist/gcds-ext-map/leaflet-src.esm.js +14419 -0
- package/dist/gcds-ext-map/p-1b22f774.entry.js +1 -0
- package/dist/gcds-ext-map/p-29b4ba34.entry.js +1 -0
- package/dist/gcds-ext-map/p-2dd09d44.entry.js +1 -0
- package/dist/gcds-ext-map/p-3fef47e5.entry.js +1 -0
- package/dist/gcds-ext-map/p-4e324a1d.entry.js +1 -0
- package/dist/gcds-ext-map/p-4f4a6873.entry.js +1 -0
- package/dist/gcds-ext-map/p-9cc5ad37.entry.js +1 -0
- package/dist/gcds-ext-map/p-9edfea7d.entry.js +1 -0
- package/dist/gcds-ext-map/p-B4YLD_Og.js +1 -0
- package/dist/gcds-ext-map/p-B8Id5Ptd.js +1 -0
- package/dist/gcds-ext-map/p-BUsJ7i5g.js +6 -0
- package/dist/gcds-ext-map/p-Bpv_U_Lb.js +1 -0
- package/dist/gcds-ext-map/p-CtOuMgy9.js +1 -0
- package/dist/gcds-ext-map/p-Dd474fsL.js +1 -0
- package/dist/gcds-ext-map/p-EYVT9Efh.js +1 -0
- package/dist/gcds-ext-map/p-a67d721d.entry.js +1 -0
- package/dist/gcds-ext-map/p-b16e862b.entry.js +1 -0
- package/dist/gcds-ext-map/p-b9cbf1e0.entry.js +10 -0
- package/dist/gcds-ext-map/p-cab5246e.entry.js +1 -0
- package/dist/gcds-ext-map/p-d58d409b.entry.js +1 -0
- package/dist/gcds-ext-map/p-dfa21368.entry.js +1 -0
- package/dist/gcds-ext-map/p-f211048a.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/gcds-ext-map/gcds-ext-map.d.ts +125 -0
- package/dist/types/components/gcds-ext-map/stories/gcds-ext-map.stories.d.ts +230 -0
- package/dist/types/components/map-a/map-a.d.ts +7 -0
- package/dist/types/components/map-caption/map-caption.d.ts +7 -0
- package/dist/types/components/map-extent/map-extent.d.ts +53 -0
- package/dist/types/components/map-feature/map-feature.d.ts +50 -0
- package/dist/types/components/map-featurecaption/map-featurecaption.d.ts +3 -0
- package/dist/types/components/map-geometry/map-geometry.d.ts +7 -0
- package/dist/types/components/map-input/map-input.d.ts +24 -0
- package/dist/types/components/map-layer/map-layer.d.ts +85 -0
- package/dist/types/components/map-layer/stories/map-layer.stories.d.ts +96 -0
- package/dist/types/components/map-link/map-link.d.ts +66 -0
- package/dist/types/components/map-meta/map-meta.d.ts +11 -0
- package/dist/types/components/map-properties/map-properties.d.ts +3 -0
- package/dist/types/components/map-select/map-select.d.ts +13 -0
- package/dist/types/components/map-span/map-span.d.ts +5 -0
- package/dist/types/components/map-style/map-style.d.ts +17 -0
- package/dist/types/components/map-tile/map-tile.d.ts +32 -0
- package/dist/types/components/utils/mapml/DOMTokenList.d.ts +30 -0
- package/dist/types/components/utils/mapml/elementSupport/inputs/heightInput.d.ts +7 -0
- package/dist/types/components/utils/mapml/elementSupport/inputs/hiddenInput.d.ts +7 -0
- package/dist/types/components/utils/mapml/elementSupport/inputs/locationInput.d.ts +14 -0
- package/dist/types/components/utils/mapml/elementSupport/inputs/widthInput.d.ts +7 -0
- package/dist/types/components/utils/mapml/elementSupport/inputs/zoomInput.d.ts +11 -0
- package/dist/types/components/utils/mapml/layers/MapLayer.d.ts +69 -0
- package/dist/types/components/utils/utils.d.ts +2 -0
- package/dist/types/components.d.ts +521 -0
- package/dist/types/gcds-ext-map.d.ts +17 -0
- package/dist/types/generated/locale.d.ts +146 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/stencil-public-runtime.d.ts +1861 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +87 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=e.link||e.styleElement;if(void 0===t)return;let n=(e=>{const t=Array.from(this._container.querySelectorAll(':scope > style, :scope > link[rel="stylesheet"]'));if(0===t.length){const e=this._container.lastChild;if(!e)return{position:"afterbegin",node:this._container};const t="SVG"===e.nodeName,n=e.classList?.contains("mapml-vector-container")||e.classList?.contains("mapml-extentlayer-container");return t||n?{position:"beforebegin",node:e}:{position:"afterend",node:e}}const n=e.mapStyle||e.mapLink;for(let e=0;e<t.length;e++){const o=t[e],i=o.mapStyle||o.mapLink;if(i&&n.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING)return{position:"beforebegin",node:o}}return{position:"afterend",node:t.at(-1)}})(t);n.node.insertAdjacentElement(n.position,t)}export{e as r}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as t,U as i}from"./p-CwRxGZga.js";var s=t.GridLayer.extend({initialize:function(i){t.GridLayer.prototype.initialize.call(this,i),this._mapTiles=i.mapTiles||[],this._tileMap={},this._pendingTiles={},this._buildTileMap(),this._container=t.DomUtil.create("div","leaflet-layer"),i.zIndex&&(this._container.style.zIndex=i.zIndex),t.DomUtil.addClass(this._container,"mapml-static-tile-container")},getEvents:function(){const i=t.GridLayer.prototype.getEvents?t.GridLayer.prototype.getEvents.call(this):{};return i.zoomend=this._handleZoomChange,i},onAdd:function(i){this.options.pane.appendChild(this._container),t.GridLayer.prototype.onAdd.call(this,i)},onRemove:function(){this._pendingTiles={},t.DomUtil.remove(this._container)},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&null!=this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_handleZoomChange:function(){const t=this._map.getZoom();for(const i in this._tiles)this._keyToTileCoords(i).z!==t&&this._removeTile(i)},addMapTile:function(t){this._mapTiles.includes(t)||(this._mapTiles.push(t),this._addToTileMap(t),this._updateBounds(),this._map&&this.redraw())},removeMapTile:function(t){const i=this._mapTiles.indexOf(t);-1!==i&&(this._mapTiles.splice(i,1),this._removeFromTileMap(t),this._updateBounds(),this._map&&this.redraw())},removeMapTileAt:function(t,i){const s=this._mapTiles.indexOf(t);-1!==s&&(this._mapTiles.splice(s,1),this._removeFromTileMapAt(i),t._tileDiv&&(t._tileDiv._mapTile=null,t._tileDiv=null),this._updateBounds(),this._map&&this.redraw())},isVisible:function(){if(!this._map)return!1;this.layerBounds||this._updateBounds();let t=this._map,s=t.getZoom(),n=this.zoomBounds,o=this.layerBounds;return s<=n.maxZoom&&s>=n.minZoom&&this._mapTiles&&o&&o.overlaps(i.pixelToPCRSBounds(t.getPixelBounds(),s,t.options.projection))},createTile:function(i,s){const n=this._tileCoordsToKey(i),o=this.getTileSize(),e=document.createElement("div");e.setAttribute("col",i.x),e.setAttribute("row",i.y),e.setAttribute("zoom",i.z),t.DomUtil.addClass(e,"leaflet-tile"),e.style.width=o.x+"px",e.style.height=o.y+"px";const h=this._tileMap[n];if(h){const i=document.createElement("img");i.src=h.src,i.width=o.x,i.height=o.y,i.alt="",i.setAttribute("role","presentation"),e._mapTile=h,h._tileDiv=e,e.appendChild(i),t.DomUtil.addClass(e,"leaflet-tile-loaded"),s(null,e)}else this._pendingTiles||(this._pendingTiles={}),this._pendingTiles[n]={element:e,done:s};return e},_buildTileMap:function(){this._tileMap={};for(const t of this._mapTiles)this._addToTileMap(t)},_addToTileMap:function(i){const s=`${i.col}:${i.row}:${i.zoom}`;if(this._tileMap[s]=i,this._pendingTiles&&this._pendingTiles[s]){const n=this._pendingTiles[s],o=n.element,e=n.done,h=this.getTileSize(),l=document.createElement("img");l.src=i.src,l.width=h.x,l.height=h.y,l.alt="",l.setAttribute("role","presentation"),o._mapTile=i,i._tileDiv=o,o.appendChild(l),t.DomUtil.addClass(o,"leaflet-tile-loaded"),e&&e(null,o),delete this._pendingTiles[s]}},_removeFromTileMap:function(t){const i=`${t.col}:${t.row}:${t.zoom}`;delete this._tileMap[i],t._tileDiv&&(t._tileDiv._mapTile=null,t._tileDiv=null),this._pendingTiles&&this._pendingTiles[i]&&delete this._pendingTiles[i]},_removeFromTileMapAt:function(t){const i=`${t.col}:${t.row}:${t.zoom}`;delete this._tileMap[i],this._pendingTiles&&this._pendingTiles[i]&&delete this._pendingTiles[i]},_updateBounds:function(){this.layerBounds=this._computeLayerBounds(),this.zoomBounds=this._computeZoomBounds()},_computeLayerBounds:function(){if(0===this._mapTiles.length)return t.bounds([0,0],[0,0]);const s={},n=this.options.projection,o=M[n].options.crs.tile.bounds.max.x;for(const t of this._mapTiles){const i=t.zoom;s[i]||(s[i]=[]),s[i].push({x:t.col,y:t.row,z:i})}const e={};for(const h in s){const l=s[h];let c=null;for(const i of l){const s=i.x*o,n=i.y*o;c?(c.extend(t.point(s,n)),c.extend(t.point(s+o,n+o))):c=t.bounds(t.point(s,n),t.point(s+o,n+o))}c&&(e[h]=i.pixelToPCRSBounds(c,parseInt(h),n))}let h=null;for(const t in e)h?(h.extend(e[t].min),h.extend(e[t].max)):h=e[t].pad(0);return h||t.bounds([0,0],[0,0])},_computeZoomBounds:function(){const t={minZoom:1/0,maxZoom:-1/0,minNativeZoom:1/0,maxNativeZoom:-1/0};if(0===this._mapTiles.length)return{minZoom:0,maxZoom:22,minNativeZoom:0,maxNativeZoom:22};for(const i of this._mapTiles){const s=i.zoom;t.minNativeZoom=Math.min(t.minNativeZoom,s),t.maxNativeZoom=Math.max(t.maxNativeZoom,s)}return t.minZoom=t.minNativeZoom,t.maxZoom=t.maxNativeZoom,t}}),n=function(t){return new s(t)};export{s as M,n as m}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { l as leafletSrcExports } from './index-BUsJ7i5g.js';
|
|
2
|
+
|
|
3
|
+
var AttributionButton = leafletSrcExports.Control.Attribution.extend({
|
|
4
|
+
_getLocale: function () {
|
|
5
|
+
return this.options.mapEl && this.options.mapEl.locale
|
|
6
|
+
? this.options.mapEl.locale
|
|
7
|
+
: M.options.locale;
|
|
8
|
+
},
|
|
9
|
+
onAdd: function (map) {
|
|
10
|
+
map.attributionControl = this;
|
|
11
|
+
this._container = leafletSrcExports.DomUtil.create('details', 'leaflet-control-attribution');
|
|
12
|
+
leafletSrcExports.DomEvent.disableClickPropagation(this._container);
|
|
13
|
+
|
|
14
|
+
for (var i in map._layers) {
|
|
15
|
+
if (map._layers[i].getAttribution) {
|
|
16
|
+
this.addAttribution(map._layers[i].getAttribution());
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this._update();
|
|
21
|
+
|
|
22
|
+
map.on('layeradd', this._addAttribution, this);
|
|
23
|
+
|
|
24
|
+
let dialog = document.createElement('dialog');
|
|
25
|
+
dialog.setAttribute('class', 'shortcuts-dialog');
|
|
26
|
+
dialog.setAttribute('autofocus', '');
|
|
27
|
+
dialog.onclick = function (e) {
|
|
28
|
+
e.stopPropagation();
|
|
29
|
+
};
|
|
30
|
+
let locale = this._getLocale();
|
|
31
|
+
dialog.innerHTML =
|
|
32
|
+
`<b>${locale.kbdShortcuts} </b><button aria-label="Close" onclick='this.parentElement.close()'><span class="gcds-icon-close" aria-hidden="true"></span></button>` +
|
|
33
|
+
`<ul><b>${locale.kbdMovement}</b><li><kbd>↑</kbd> ${locale.kbdPanUp}</li><li><kbd>↓</kbd> ${locale.kbdPanDown}</li><li><kbd>←</kbd> ${locale.kbdPanLeft}</li><li><kbd>→</kbd> ${locale.kbdPanRight}</li><li><kbd>+</kbd> ${locale.btnZoomIn}</li><li><kbd>-</kbd> ${locale.btnZoomOut}</li><li><kbd>shift</kbd> + <kbd>←/↑/→/↓</kbd> 3x ${locale.kbdPanIncrement}</li><li><kbd>ctrl</kbd> + <kbd>←/↑/→/↓</kbd> 0.2x ${locale.kbdPanIncrement}</li><li><kbd>shift</kbd> + <kbd>+/-</kbd> ${locale.kbdZoom}</li></ul>` +
|
|
34
|
+
`<ul><b>${locale.kbdFeature}</b><li><kbd>←/↑</kbd> ${locale.kbdPrevFeature}</li><li><kbd>→/↓</kbd> ${locale.kbdNextFeature}</li></ul>`;
|
|
35
|
+
map._container.appendChild(dialog);
|
|
36
|
+
|
|
37
|
+
return this._container;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
_update: function () {
|
|
41
|
+
if (!this._map) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var attribs = [];
|
|
46
|
+
|
|
47
|
+
for (var i in this._attributions) {
|
|
48
|
+
if (this._attributions[i]) {
|
|
49
|
+
attribs.push(i);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var prefixAndAttribs = [];
|
|
54
|
+
|
|
55
|
+
if (this.options.prefix) {
|
|
56
|
+
prefixAndAttribs.push(this.options.prefix);
|
|
57
|
+
}
|
|
58
|
+
if (attribs.length) {
|
|
59
|
+
prefixAndAttribs.push(attribs.join(', '));
|
|
60
|
+
}
|
|
61
|
+
let locale = this._getLocale();
|
|
62
|
+
this._container.innerHTML =
|
|
63
|
+
`<summary><svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="30px" viewBox="0 0 24 24" width="30px" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></svg></summary>` +
|
|
64
|
+
'<div class="mapml-attribution-container">' +
|
|
65
|
+
`<button onclick="this.closest(\'.leaflet-container\').querySelector(\'.shortcuts-dialog\').showModal()" class="shortcuts-button mapml-button">${locale.kbdShortcuts}</button> | ` +
|
|
66
|
+
prefixAndAttribs.join(' <span aria-hidden="true">|</span> ') +
|
|
67
|
+
'</div>';
|
|
68
|
+
this._container.setAttribute('role', 'group');
|
|
69
|
+
this._container.setAttribute('aria-label', `${locale.btnAttribution}`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
leafletSrcExports.Map.mergeOptions({
|
|
74
|
+
attributionControl: false,
|
|
75
|
+
toggleableAttributionControl: true
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
leafletSrcExports.Map.addInitHook(function () {
|
|
79
|
+
if (this.options.toggleableAttributionControl) {
|
|
80
|
+
attributionButton({ mapEl: this.options.mapEl }).addTo(this);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
var attributionButton = function (opts) {
|
|
85
|
+
// Inline the Canada flag icon as data URL to avoid asset path resolution issues
|
|
86
|
+
const flagIcon = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIxMiIgdmlld0JveD0iMCAwIDE1NS4zOCA3NS4wMSI+PHBhdGggZD0iTTAsMCAzNi44NCwwIDM2Ljg0LDc1LjAxIDAsNzUuMDF6IE0xMTguNTQsMCAxNTUuMzgsMCAxNTUuMzgsNzUuMDEgMTE4LjU0LDc1LjAxeiBNNzIuNTgsMTUuNjEsNzcuODQsNC45bDUuMjIsMTAuMzJjLjY1LDEuMDksMS4xOCwxLDIuMjIuNDhsNC40OS0yLjIyTDg2Ljg1LDI3Ljg5Yy0uNjEsMi44MywxLDMuNjYsMi43NSwxLjc0TDk2LDIyLjc5bDEuNywzLjg3Yy41NywxLjE3LDEuNDMsMSwyLjU3Ljc5bDYuNjEtMS4zOS0yLjIyLDguMzUsMCwuMThjLS4yNiwxLjA5LS43OCwyLC40NCwyLjUzbDIuMzUsMS4xN0w5My43Nyw0OS44MmMtMS4zOSwxLjQzLS45MSwxLjg3LS4zOSwzLjQ4bDEuMjYsMy44Ny0xMi43MS0yLjNjLTEuNTctLjM5LTIuNjYtLjM5LTIuNy44N2wuNTIsMTQuNThINzUuOTNsLjUyLTE0LjU0YzAtMS40My0xLjA5LTEuMzktMy42Ni0uODZMNjEsNTcuMThsMS41Mi0zLjg3Yy41Mi0xLjQ4LjY2LTIuNDgtLjUyLTMuNDhMNDguMTEsMzguNDZsMi41Ny0xLjU3Yy43NC0uNTcuNzgtMS4xNy4zOS0yLjQ0TDQ4LjQ2LDI2bDYuNywxLjQzYzEuODcuNDQsMi4zOSwwLDIuODctMWwxLjg3LTMuODNMNjYuNTIsMzBjMS4xNywxLjM5LDIuODMuNDgsMi4zMS0xLjUyTDY1LjY1LDEyLjg2bDQuOTIsMi44M2MuNzguNDgsMS42MS42MSwyLjA5LS4zIiBmaWxsPSIjRUIyRDM3Ii8+PC9zdmc+';
|
|
87
|
+
const isFr = opts.mapEl && opts.mapEl.closest && opts.mapEl.closest(':lang(fr)') === opts.mapEl;
|
|
88
|
+
const gcdsHref = isFr
|
|
89
|
+
? 'https://nrcan.github.io/gcds-ext-map/fr/composants/composants-de-carte/'
|
|
90
|
+
: 'https://nrcan.github.io/gcds-ext-map/en/components/map-components/';
|
|
91
|
+
const gcdsLabel = isFr
|
|
92
|
+
? 'Système de design GC - Cartes'
|
|
93
|
+
: 'GC Design System - Maps';
|
|
94
|
+
const gcdsAlt = isFr
|
|
95
|
+
? 'Système de design du gouvernement du Canada - Cartes'
|
|
96
|
+
: 'Government of Canada Design System - Maps';
|
|
97
|
+
const options = Object.assign(opts, {
|
|
98
|
+
prefix: `<img src="${flagIcon}" style="position: relative; top: 2px" alt="${gcdsAlt}"> <a href="${gcdsHref}">${gcdsLabel}</a> `
|
|
99
|
+
});
|
|
100
|
+
return new AttributionButton(options);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { AttributionButton, attributionButton };
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { l as leafletSrcExports, U as Util } from './index-BUsJ7i5g.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Leaflet layer for handling map-tile elements
|
|
5
|
+
* Extends GridLayer to create tiles based on map-tile elements
|
|
6
|
+
*
|
|
7
|
+
* Similar in intent to MapFeatureLayer, which is a receiver for
|
|
8
|
+
* map-feature elements' leaflet layer object
|
|
9
|
+
*
|
|
10
|
+
* This layer will be inserted into the LayerGroup hosted by the <map-link> or
|
|
11
|
+
* <map-layer> immediately after creation, so that its index within the _layers array of
|
|
12
|
+
* that LayerGroup will be equal to its z-index within the LayerGroup's container
|
|
13
|
+
*
|
|
14
|
+
* <map-tile row="10" col="12" src="url1"></map-tile> LayerGroup._layers[0] <- each *set* of adjacent tiles
|
|
15
|
+
* <map-tile row="11" col="12" src="url2"></map-tile> LayerGroup._layers[0] <- is a *single* MapTileLayer
|
|
16
|
+
* <map-extent units="OSMTILE" checked hidden> LayerGroup._layers[1] *each* <map-extent> is a LayerGroup of Templated*Layer.js
|
|
17
|
+
* <map-feature id="a"> LayerGroup._layers[2] <- each *set* of adjacent features
|
|
18
|
+
* <map-feature id="b"> LayerGroup._layers[2] <- is a single MapFeatureLayer FeatureGroup
|
|
19
|
+
* <map-tile row="10" col="12" src="url3"></map-tile> LayerGroup._layers[3]
|
|
20
|
+
* <map-tile row="11" col="12" src="url4"></map-tile> LayerGroup._layers[3]
|
|
21
|
+
* <map-feature id="c"> LayerGroup._layers[4]
|
|
22
|
+
* <map-feature id="d"> LayerGroup._layers[4]
|
|
23
|
+
* and so on
|
|
24
|
+
*/
|
|
25
|
+
var MapTileLayer = leafletSrcExports.GridLayer.extend({
|
|
26
|
+
initialize: function (options) {
|
|
27
|
+
leafletSrcExports.GridLayer.prototype.initialize.call(this, options);
|
|
28
|
+
this._mapTiles = options.mapTiles || [];
|
|
29
|
+
this._tileMap = {};
|
|
30
|
+
this._pendingTiles = {};
|
|
31
|
+
this._buildTileMap();
|
|
32
|
+
this._container = leafletSrcExports.DomUtil.create('div', 'leaflet-layer');
|
|
33
|
+
if (options.zIndex) {
|
|
34
|
+
this._container.style.zIndex = options.zIndex;
|
|
35
|
+
}
|
|
36
|
+
leafletSrcExports.DomUtil.addClass(this._container, 'mapml-static-tile-container');
|
|
37
|
+
// Store bounds for visibility checks
|
|
38
|
+
// this.layerBounds = this._computeLayerBounds();
|
|
39
|
+
// this.zoomBounds = this._computeZoomBounds();
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
getEvents: function () {
|
|
43
|
+
const events = leafletSrcExports.GridLayer.prototype.getEvents
|
|
44
|
+
? leafletSrcExports.GridLayer.prototype.getEvents.call(this)
|
|
45
|
+
: {};
|
|
46
|
+
|
|
47
|
+
// Add our custom zoom change handler
|
|
48
|
+
events.zoomend = this._handleZoomChange;
|
|
49
|
+
|
|
50
|
+
return events;
|
|
51
|
+
},
|
|
52
|
+
onAdd: function (map) {
|
|
53
|
+
this.options.pane.appendChild(this._container);
|
|
54
|
+
// Call the parent method
|
|
55
|
+
leafletSrcExports.GridLayer.prototype.onAdd.call(this, map);
|
|
56
|
+
},
|
|
57
|
+
onRemove: function (map) {
|
|
58
|
+
// Clean up pending tiles
|
|
59
|
+
this._pendingTiles = {};
|
|
60
|
+
// remove _container from the dom, but don't delete it
|
|
61
|
+
leafletSrcExports.DomUtil.remove(this._container);
|
|
62
|
+
},
|
|
63
|
+
setZIndex: function (zIndex) {
|
|
64
|
+
this.options.zIndex = zIndex;
|
|
65
|
+
this._updateZIndex();
|
|
66
|
+
|
|
67
|
+
return this;
|
|
68
|
+
},
|
|
69
|
+
_updateZIndex: function () {
|
|
70
|
+
if (
|
|
71
|
+
this._container &&
|
|
72
|
+
this.options.zIndex !== undefined &&
|
|
73
|
+
this.options.zIndex !== null
|
|
74
|
+
) {
|
|
75
|
+
this._container.style.zIndex = this.options.zIndex;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
_handleZoomChange: function () {
|
|
80
|
+
// this is necessary for CBMTILE in particular, I think because
|
|
81
|
+
// Leaflet relies on Web Mercator powers of 2 inter-zoom tile relations
|
|
82
|
+
// to calculate what tiles to clean up/remove. CBMTILE doesn't have that
|
|
83
|
+
// relationship between zoom levels /tiles.
|
|
84
|
+
//
|
|
85
|
+
// Force removal of all tiles that don't match current zoom
|
|
86
|
+
const currentZoom = this._map.getZoom();
|
|
87
|
+
|
|
88
|
+
for (const key in this._tiles) {
|
|
89
|
+
const coords = this._keyToTileCoords(key);
|
|
90
|
+
if (coords.z !== currentZoom) {
|
|
91
|
+
this._removeTile(key);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Adds a map-tile element to the layer
|
|
97
|
+
* @param {HTMLTileElement} mapTile - The map-tile element to add
|
|
98
|
+
*/
|
|
99
|
+
addMapTile: function (mapTile) {
|
|
100
|
+
if (!this._mapTiles.includes(mapTile)) {
|
|
101
|
+
this._mapTiles.push(mapTile);
|
|
102
|
+
this._addToTileMap(mapTile);
|
|
103
|
+
this._updateBounds();
|
|
104
|
+
if (this._map) {
|
|
105
|
+
this.redraw();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Removes a map-tile element from the layer
|
|
112
|
+
* @param {HTMLTileElement} mapTile - The map-tile element to remove
|
|
113
|
+
*/
|
|
114
|
+
removeMapTile: function (mapTile) {
|
|
115
|
+
const index = this._mapTiles.indexOf(mapTile);
|
|
116
|
+
if (index !== -1) {
|
|
117
|
+
this._mapTiles.splice(index, 1);
|
|
118
|
+
this._removeFromTileMap(mapTile);
|
|
119
|
+
this._updateBounds();
|
|
120
|
+
if (this._map) {
|
|
121
|
+
this.redraw();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Removes a map-tile element from the layer using specific coordinates
|
|
128
|
+
* Used when tile coordinates have changed and we need to remove based on old coordinates
|
|
129
|
+
* @param {HTMLTileElement} mapTile - The map-tile element to remove
|
|
130
|
+
* @param {Object} coords - The coordinates to use for removal {col, row, zoom}
|
|
131
|
+
*/
|
|
132
|
+
removeMapTileAt: function (mapTile, coords) {
|
|
133
|
+
const index = this._mapTiles.indexOf(mapTile);
|
|
134
|
+
if (index !== -1) {
|
|
135
|
+
this._mapTiles.splice(index, 1);
|
|
136
|
+
this._removeFromTileMapAt(coords);
|
|
137
|
+
// Clean up bidirectional links using current tile reference
|
|
138
|
+
if (mapTile._tileDiv) {
|
|
139
|
+
mapTile._tileDiv._mapTile = null;
|
|
140
|
+
mapTile._tileDiv = null;
|
|
141
|
+
}
|
|
142
|
+
this._updateBounds();
|
|
143
|
+
if (this._map) {
|
|
144
|
+
this.redraw();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Checks if the layer is currently visible on the map
|
|
151
|
+
* @returns {boolean} - True if the layer is visible, false otherwise
|
|
152
|
+
*/
|
|
153
|
+
isVisible: function () {
|
|
154
|
+
if (!this._map) return false;
|
|
155
|
+
if (!this.layerBounds) this._updateBounds();
|
|
156
|
+
// approach copied/refactored from MapFeatureLayer
|
|
157
|
+
let map = this._map,
|
|
158
|
+
mapZoom = map.getZoom(),
|
|
159
|
+
zoomBounds = this.zoomBounds,
|
|
160
|
+
layerBounds = this.layerBounds,
|
|
161
|
+
withinZoom =
|
|
162
|
+
mapZoom <= zoomBounds.maxZoom && mapZoom >= zoomBounds.minZoom;
|
|
163
|
+
return (
|
|
164
|
+
withinZoom &&
|
|
165
|
+
this._mapTiles &&
|
|
166
|
+
layerBounds &&
|
|
167
|
+
layerBounds.overlaps(
|
|
168
|
+
Util.pixelToPCRSBounds(
|
|
169
|
+
map.getPixelBounds(),
|
|
170
|
+
mapZoom,
|
|
171
|
+
map.options.projection
|
|
172
|
+
)
|
|
173
|
+
)
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Overrides GridLayer createTile to use map-tile elements
|
|
179
|
+
* @param {Object} coords - Tile coordinates
|
|
180
|
+
* @param {Function} done - Callback to be called when the tile is ready, with error and tile element params
|
|
181
|
+
* @returns {HTMLElement} - The created tile element
|
|
182
|
+
*/
|
|
183
|
+
createTile: function (coords, done) {
|
|
184
|
+
const tileKey = this._tileCoordsToKey(coords);
|
|
185
|
+
const tileSize = this.getTileSize();
|
|
186
|
+
|
|
187
|
+
// Create container element
|
|
188
|
+
const tileElement = document.createElement('div');
|
|
189
|
+
tileElement.setAttribute('col', coords.x);
|
|
190
|
+
tileElement.setAttribute('row', coords.y);
|
|
191
|
+
tileElement.setAttribute('zoom', coords.z);
|
|
192
|
+
leafletSrcExports.DomUtil.addClass(tileElement, 'leaflet-tile');
|
|
193
|
+
|
|
194
|
+
// Set size
|
|
195
|
+
tileElement.style.width = tileSize.x + 'px';
|
|
196
|
+
tileElement.style.height = tileSize.y + 'px';
|
|
197
|
+
|
|
198
|
+
// Find matching tile in our map
|
|
199
|
+
const matchingTile = this._tileMap[tileKey];
|
|
200
|
+
|
|
201
|
+
if (matchingTile) {
|
|
202
|
+
// Create an image element with the src from the matching map-tile
|
|
203
|
+
const img = document.createElement('img');
|
|
204
|
+
img.src = matchingTile.src;
|
|
205
|
+
img.width = tileSize.x;
|
|
206
|
+
img.height = tileSize.y;
|
|
207
|
+
img.alt = '';
|
|
208
|
+
img.setAttribute('role', 'presentation');
|
|
209
|
+
// bidirectional link map-tile element and rendered div
|
|
210
|
+
tileElement._mapTile = matchingTile;
|
|
211
|
+
matchingTile._tileDiv = tileElement;
|
|
212
|
+
|
|
213
|
+
tileElement.appendChild(img);
|
|
214
|
+
|
|
215
|
+
// Add the loaded class manually to ensure tile is visible
|
|
216
|
+
leafletSrcExports.DomUtil.addClass(tileElement, 'leaflet-tile-loaded');
|
|
217
|
+
|
|
218
|
+
// Call the done callback to signal that the tile is ready
|
|
219
|
+
done(null, tileElement);
|
|
220
|
+
} else {
|
|
221
|
+
// The tile might be added later, register a pending tile
|
|
222
|
+
if (!this._pendingTiles) {
|
|
223
|
+
this._pendingTiles = {};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Store the tile element and done callback for later update
|
|
227
|
+
this._pendingTiles[tileKey] = {
|
|
228
|
+
element: tileElement,
|
|
229
|
+
done: done
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Don't call done yet - we'll call it when the map-tile is added
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return tileElement;
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Builds the tile map from the current map-tile elements
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
_buildTileMap: function () {
|
|
243
|
+
this._tileMap = {};
|
|
244
|
+
for (const mapTile of this._mapTiles) {
|
|
245
|
+
this._addToTileMap(mapTile);
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Adds a map-tile element to the tile map
|
|
251
|
+
* @param {HTMLTileElement} mapTile - The map-tile element to add
|
|
252
|
+
* @private
|
|
253
|
+
*/
|
|
254
|
+
_addToTileMap: function (mapTile) {
|
|
255
|
+
const tileKey = `${mapTile.col}:${mapTile.row}:${mapTile.zoom}`;
|
|
256
|
+
this._tileMap[tileKey] = mapTile;
|
|
257
|
+
|
|
258
|
+
// Check if this tile was requested but not available at that time
|
|
259
|
+
if (this._pendingTiles && this._pendingTiles[tileKey]) {
|
|
260
|
+
const pendingTile = this._pendingTiles[tileKey];
|
|
261
|
+
const tileElement = pendingTile.element;
|
|
262
|
+
const doneCallback = pendingTile.done;
|
|
263
|
+
|
|
264
|
+
// Create and append the image to the tile
|
|
265
|
+
const tileSize = this.getTileSize();
|
|
266
|
+
const img = document.createElement('img');
|
|
267
|
+
img.src = mapTile.src;
|
|
268
|
+
img.width = tileSize.x;
|
|
269
|
+
img.height = tileSize.y;
|
|
270
|
+
img.alt = '';
|
|
271
|
+
img.setAttribute('role', 'presentation');
|
|
272
|
+
|
|
273
|
+
// bidirectional link map-tile element and rendered div
|
|
274
|
+
tileElement._mapTile = mapTile;
|
|
275
|
+
mapTile._tileDiv = tileElement;
|
|
276
|
+
|
|
277
|
+
tileElement.appendChild(img);
|
|
278
|
+
|
|
279
|
+
// Add the loaded class manually to ensure tile is visible
|
|
280
|
+
leafletSrcExports.DomUtil.addClass(tileElement, 'leaflet-tile-loaded');
|
|
281
|
+
|
|
282
|
+
// Call the done callback to signal that the tile is now ready
|
|
283
|
+
if (doneCallback) {
|
|
284
|
+
doneCallback(null, tileElement);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Remove from pending tiles
|
|
288
|
+
delete this._pendingTiles[tileKey];
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
/**
|
|
292
|
+
* Removes a map-tile element from the tile map
|
|
293
|
+
* @param {HTMLTileElement} mapTile - The map-tile element to remove
|
|
294
|
+
* @private
|
|
295
|
+
*/
|
|
296
|
+
_removeFromTileMap: function (mapTile) {
|
|
297
|
+
const tileKey = `${mapTile.col}:${mapTile.row}:${mapTile.zoom}`;
|
|
298
|
+
delete this._tileMap[tileKey];
|
|
299
|
+
|
|
300
|
+
// Clean up bidirectional links
|
|
301
|
+
if (mapTile._tileDiv) {
|
|
302
|
+
mapTile._tileDiv._mapTile = null;
|
|
303
|
+
mapTile._tileDiv = null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Also remove from pending tiles if it exists there
|
|
307
|
+
if (this._pendingTiles && this._pendingTiles[tileKey]) {
|
|
308
|
+
delete this._pendingTiles[tileKey];
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Removes a tile from the tile map using specific coordinates
|
|
314
|
+
* @param {Object} coords - The coordinates {col, row, zoom}
|
|
315
|
+
* @private
|
|
316
|
+
*/
|
|
317
|
+
_removeFromTileMapAt: function (coords) {
|
|
318
|
+
const tileKey = `${coords.col}:${coords.row}:${coords.zoom}`;
|
|
319
|
+
delete this._tileMap[tileKey];
|
|
320
|
+
|
|
321
|
+
// Also remove from pending tiles if it exists there
|
|
322
|
+
if (this._pendingTiles && this._pendingTiles[tileKey]) {
|
|
323
|
+
delete this._pendingTiles[tileKey];
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Updates layer bounds when tiles are added or removed
|
|
329
|
+
* @private
|
|
330
|
+
*/
|
|
331
|
+
_updateBounds: function () {
|
|
332
|
+
this.layerBounds = this._computeLayerBounds();
|
|
333
|
+
this.zoomBounds = this._computeZoomBounds();
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Computes the layer bounds from all map-tile elements
|
|
338
|
+
* @returns {L.Bounds} - The computed layer bounds
|
|
339
|
+
* @private
|
|
340
|
+
*/
|
|
341
|
+
_computeLayerBounds: function () {
|
|
342
|
+
if (this._mapTiles.length === 0) {
|
|
343
|
+
return leafletSrcExports.bounds([0, 0], [0, 0]);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const tilesByZoom = {};
|
|
347
|
+
const projection = this.options.projection;
|
|
348
|
+
const tileSize = M[projection].options.crs.tile.bounds.max.x;
|
|
349
|
+
|
|
350
|
+
// Group tiles by zoom
|
|
351
|
+
for (const mapTile of this._mapTiles) {
|
|
352
|
+
const zoom = mapTile.zoom;
|
|
353
|
+
|
|
354
|
+
if (!tilesByZoom[zoom]) {
|
|
355
|
+
tilesByZoom[zoom] = [];
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
tilesByZoom[zoom].push({
|
|
359
|
+
x: mapTile.col,
|
|
360
|
+
y: mapTile.row,
|
|
361
|
+
z: zoom
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Calculate bounds for each zoom level
|
|
366
|
+
const layerBoundsByZoom = {};
|
|
367
|
+
for (const zoom in tilesByZoom) {
|
|
368
|
+
const tiles = tilesByZoom[zoom];
|
|
369
|
+
let pixelBounds = null;
|
|
370
|
+
|
|
371
|
+
for (const tile of tiles) {
|
|
372
|
+
const pixelX = tile.x * tileSize;
|
|
373
|
+
const pixelY = tile.y * tileSize;
|
|
374
|
+
|
|
375
|
+
if (!pixelBounds) {
|
|
376
|
+
pixelBounds = leafletSrcExports.bounds(
|
|
377
|
+
leafletSrcExports.point(pixelX, pixelY),
|
|
378
|
+
leafletSrcExports.point(pixelX + tileSize, pixelY + tileSize)
|
|
379
|
+
);
|
|
380
|
+
} else {
|
|
381
|
+
pixelBounds.extend(leafletSrcExports.point(pixelX, pixelY));
|
|
382
|
+
pixelBounds.extend(leafletSrcExports.point(pixelX + tileSize, pixelY + tileSize));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (pixelBounds) {
|
|
387
|
+
layerBoundsByZoom[zoom] = Util.pixelToPCRSBounds(
|
|
388
|
+
pixelBounds,
|
|
389
|
+
parseInt(zoom),
|
|
390
|
+
projection
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Combine all zoom level bounds
|
|
396
|
+
let combinedBounds = null;
|
|
397
|
+
for (const zoom in layerBoundsByZoom) {
|
|
398
|
+
if (!combinedBounds) {
|
|
399
|
+
// makes a clone of the bounds, including methods
|
|
400
|
+
combinedBounds = layerBoundsByZoom[zoom].pad(0);
|
|
401
|
+
} else {
|
|
402
|
+
combinedBounds.extend(layerBoundsByZoom[zoom].min);
|
|
403
|
+
combinedBounds.extend(layerBoundsByZoom[zoom].max);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return combinedBounds || leafletSrcExports.bounds([0, 0], [0, 0]);
|
|
408
|
+
},
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Computes zoom bounds from all map-tile elements
|
|
412
|
+
* @returns {Object} - The computed zoom bounds
|
|
413
|
+
* @private
|
|
414
|
+
*/
|
|
415
|
+
_computeZoomBounds: function () {
|
|
416
|
+
const result = {
|
|
417
|
+
minZoom: Infinity,
|
|
418
|
+
maxZoom: -Infinity,
|
|
419
|
+
minNativeZoom: Infinity,
|
|
420
|
+
maxNativeZoom: -Infinity
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
if (this._mapTiles.length === 0) {
|
|
424
|
+
return {
|
|
425
|
+
minZoom: 0,
|
|
426
|
+
maxZoom: 22,
|
|
427
|
+
minNativeZoom: 0,
|
|
428
|
+
maxNativeZoom: 22
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// Find min/max zoom from map-tile elements
|
|
433
|
+
for (const mapTile of this._mapTiles) {
|
|
434
|
+
const zoom = mapTile.zoom;
|
|
435
|
+
result.minNativeZoom = Math.min(result.minNativeZoom, zoom);
|
|
436
|
+
result.maxNativeZoom = Math.max(result.maxNativeZoom, zoom);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Set min/max zoom based on native zoom
|
|
440
|
+
result.minZoom = result.minNativeZoom;
|
|
441
|
+
result.maxZoom = result.maxNativeZoom;
|
|
442
|
+
|
|
443
|
+
return result;
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
var mapTileLayer = function (options) {
|
|
448
|
+
return new MapTileLayer(options);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
export { MapTileLayer as M, mapTileLayer as m };
|