@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,640 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LayerGroup,
|
|
3
|
+
setOptions,
|
|
4
|
+
DomUtil,
|
|
5
|
+
DomEvent,
|
|
6
|
+
bounds,
|
|
7
|
+
latLng,
|
|
8
|
+
latLngBounds
|
|
9
|
+
} from 'leaflet';
|
|
10
|
+
import { Util } from '../Util.js';
|
|
11
|
+
import { MapFeatureLayer } from './MapFeatureLayer.js';
|
|
12
|
+
import { MapTileLayer } from './MapTileLayer.js';
|
|
13
|
+
import { featureRenderer } from '../features/featureRenderer.js';
|
|
14
|
+
import { renderStyles } from '../elementSupport/layers/renderStyles.js';
|
|
15
|
+
|
|
16
|
+
export var MapLayer = LayerGroup.extend({
|
|
17
|
+
options: {
|
|
18
|
+
zIndex: 0,
|
|
19
|
+
opacity: '1.0'
|
|
20
|
+
},
|
|
21
|
+
// initialize is executed before the layer is added to a map
|
|
22
|
+
initialize: function (href, layerEl, options) {
|
|
23
|
+
// in the custom element, the attribute is actually 'src'
|
|
24
|
+
// the _href version is the URL received from map-layer@src
|
|
25
|
+
LayerGroup.prototype.initialize.call(this, null, options);
|
|
26
|
+
if (href) {
|
|
27
|
+
this._href = href;
|
|
28
|
+
}
|
|
29
|
+
this._layerEl = layerEl;
|
|
30
|
+
this._content = layerEl.src ? layerEl.shadowRoot : layerEl;
|
|
31
|
+
setOptions(this, options);
|
|
32
|
+
this._container = DomUtil.create('div', 'leaflet-layer');
|
|
33
|
+
this.changeOpacity(this.options.opacity);
|
|
34
|
+
DomUtil.addClass(this._container, 'mapml-layer');
|
|
35
|
+
|
|
36
|
+
// hit the service to determine what its extent might be
|
|
37
|
+
// OR use the extent of the content provided
|
|
38
|
+
|
|
39
|
+
this._initialize(this._content);
|
|
40
|
+
},
|
|
41
|
+
getContainer: function () {
|
|
42
|
+
return this._container;
|
|
43
|
+
},
|
|
44
|
+
setZIndex: function (zIndex) {
|
|
45
|
+
this.options.zIndex = zIndex;
|
|
46
|
+
this._updateZIndex();
|
|
47
|
+
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
getHref: function () {
|
|
51
|
+
return this._href ?? '';
|
|
52
|
+
},
|
|
53
|
+
_updateZIndex: function () {
|
|
54
|
+
if (
|
|
55
|
+
this._container &&
|
|
56
|
+
this.options.zIndex !== undefined &&
|
|
57
|
+
this.options.zIndex !== null
|
|
58
|
+
) {
|
|
59
|
+
this._container.style.zIndex = this.options.zIndex;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
changeOpacity: function (opacity) {
|
|
63
|
+
this._container.style.opacity = opacity;
|
|
64
|
+
this._layerEl._opacity = opacity;
|
|
65
|
+
if (this._layerEl._opacitySlider)
|
|
66
|
+
this._layerEl._opacitySlider.value = opacity;
|
|
67
|
+
},
|
|
68
|
+
titleIsReadOnly() {
|
|
69
|
+
return !!this._titleIsReadOnly;
|
|
70
|
+
},
|
|
71
|
+
setName(newName) {
|
|
72
|
+
// a layer's accessible name is set by the <map-title>, if present
|
|
73
|
+
// if it's not available the <map-layer label="accessible-name"> attribute
|
|
74
|
+
// can be used
|
|
75
|
+
if (!this.titleIsReadOnly()) {
|
|
76
|
+
this._title = newName;
|
|
77
|
+
this._layerEl._layerControlHTML.querySelector(
|
|
78
|
+
'.mapml-layer-item-name'
|
|
79
|
+
).innerHTML = newName;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
getName() {
|
|
83
|
+
return this._title;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
onAdd: function (map) {
|
|
87
|
+
this.getPane().appendChild(this._container);
|
|
88
|
+
LayerGroup.prototype.onAdd.call(this, map);
|
|
89
|
+
|
|
90
|
+
this.setZIndex(this.options.zIndex);
|
|
91
|
+
map.on('popupopen', this._attachSkipButtons, this);
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
_calculateBounds: function () {
|
|
95
|
+
delete this.bounds;
|
|
96
|
+
delete this.zoomBounds;
|
|
97
|
+
let bnds, zoomBounds;
|
|
98
|
+
let layerTypes = ['_staticTileLayer', '_mapmlvectors', '_extentLayer'];
|
|
99
|
+
bnds =
|
|
100
|
+
this._layerEl.src &&
|
|
101
|
+
this._layerEl.shadowRoot.querySelector(
|
|
102
|
+
':host > map-meta[name=extent][content]'
|
|
103
|
+
)
|
|
104
|
+
? Util.getBoundsFromMeta(this._layerEl.shadowRoot)
|
|
105
|
+
: this._layerEl.querySelector(':scope > map-meta[name=extent][content]')
|
|
106
|
+
? Util.getBoundsFromMeta(this._layerEl)
|
|
107
|
+
: undefined;
|
|
108
|
+
zoomBounds =
|
|
109
|
+
this._layerEl.src &&
|
|
110
|
+
this._layerEl.shadowRoot.querySelector(
|
|
111
|
+
':host > map-meta[name=zoom][content]'
|
|
112
|
+
)
|
|
113
|
+
? Util.getZoomBoundsFromMeta(this._layerEl.shadowRoot)
|
|
114
|
+
: this._layerEl.querySelector(':scope > map-meta[name=zoom][content]')
|
|
115
|
+
? Util.getZoomBoundsFromMeta(this._layerEl)
|
|
116
|
+
: undefined;
|
|
117
|
+
const mapExtents = this._layerEl.src
|
|
118
|
+
? this._layerEl.shadowRoot.querySelectorAll('map-extent')
|
|
119
|
+
: this._layerEl.querySelectorAll('map-extent');
|
|
120
|
+
layerTypes.forEach((type) => {
|
|
121
|
+
let zoomMax, zoomMin, minNativeZoom, maxNativeZoom;
|
|
122
|
+
if (zoomBounds) {
|
|
123
|
+
zoomMax = zoomBounds.maxZoom;
|
|
124
|
+
zoomMin = zoomBounds.minZoom;
|
|
125
|
+
maxNativeZoom = zoomBounds.maxNativeZoom
|
|
126
|
+
? zoomBounds.maxNativeZoom
|
|
127
|
+
: -Infinity;
|
|
128
|
+
minNativeZoom = zoomBounds.minNativeZoom
|
|
129
|
+
? zoomBounds.minNativeZoom
|
|
130
|
+
: Infinity;
|
|
131
|
+
}
|
|
132
|
+
if (type === '_extentLayer' && mapExtents.length) {
|
|
133
|
+
for (let i = 0; i < mapExtents.length; i++) {
|
|
134
|
+
if (mapExtents[i]._extentLayer?.bounds) {
|
|
135
|
+
let mapExtentLayer = mapExtents[i]._extentLayer;
|
|
136
|
+
if (!bnds) {
|
|
137
|
+
bnds = bounds(
|
|
138
|
+
mapExtentLayer.bounds.min,
|
|
139
|
+
mapExtentLayer.bounds.max
|
|
140
|
+
);
|
|
141
|
+
} else {
|
|
142
|
+
bnds.extend(mapExtentLayer.bounds);
|
|
143
|
+
}
|
|
144
|
+
if (mapExtentLayer.zoomBounds) {
|
|
145
|
+
if (!zoomBounds) {
|
|
146
|
+
zoomBounds = mapExtentLayer.zoomBounds;
|
|
147
|
+
} else {
|
|
148
|
+
// Extend layer zoombounds
|
|
149
|
+
zoomMax = Math.max(zoomMax, mapExtentLayer.zoomBounds.maxZoom);
|
|
150
|
+
zoomMin = Math.min(zoomMin, mapExtentLayer.zoomBounds.minZoom);
|
|
151
|
+
maxNativeZoom = Math.max(
|
|
152
|
+
maxNativeZoom,
|
|
153
|
+
mapExtentLayer.zoomBounds.maxNativeZoom
|
|
154
|
+
);
|
|
155
|
+
minNativeZoom = Math.min(
|
|
156
|
+
minNativeZoom,
|
|
157
|
+
mapExtentLayer.zoomBounds.minNativeZoom
|
|
158
|
+
);
|
|
159
|
+
zoomBounds.minZoom = zoomMin;
|
|
160
|
+
zoomBounds.maxZoom = zoomMax;
|
|
161
|
+
zoomBounds.minNativeZoom = minNativeZoom;
|
|
162
|
+
zoomBounds.maxNativeZoom = maxNativeZoom;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} else if (type === '_mapmlvectors') {
|
|
168
|
+
// Iterate through individual MapFeatureLayer instances in the LayerGroup
|
|
169
|
+
this.eachLayer(function (layer) {
|
|
170
|
+
// Check if this is a MapFeatureLayer
|
|
171
|
+
if (layer instanceof MapFeatureLayer && layer.layerBounds) {
|
|
172
|
+
if (!bnds) {
|
|
173
|
+
bnds = layer.layerBounds;
|
|
174
|
+
} else {
|
|
175
|
+
bnds.extend(layer.layerBounds);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (layer instanceof MapFeatureLayer && layer.zoomBounds) {
|
|
179
|
+
if (!zoomBounds) {
|
|
180
|
+
zoomBounds = layer.zoomBounds;
|
|
181
|
+
} else {
|
|
182
|
+
// Extend layer zoombounds
|
|
183
|
+
zoomMax = Math.max(zoomMax, layer.zoomBounds.maxZoom);
|
|
184
|
+
zoomMin = Math.min(zoomMin, layer.zoomBounds.minZoom);
|
|
185
|
+
maxNativeZoom = Math.max(
|
|
186
|
+
maxNativeZoom,
|
|
187
|
+
layer.zoomBounds.maxNativeZoom
|
|
188
|
+
);
|
|
189
|
+
minNativeZoom = Math.min(
|
|
190
|
+
minNativeZoom,
|
|
191
|
+
layer.zoomBounds.minNativeZoom
|
|
192
|
+
);
|
|
193
|
+
zoomBounds.minZoom = zoomMin;
|
|
194
|
+
zoomBounds.maxZoom = zoomMax;
|
|
195
|
+
zoomBounds.minNativeZoom = minNativeZoom;
|
|
196
|
+
zoomBounds.maxNativeZoom = maxNativeZoom;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
// inline tiles
|
|
202
|
+
this.eachLayer((layer) => {
|
|
203
|
+
if (layer instanceof MapTileLayer) {
|
|
204
|
+
if (layer.layerBounds) {
|
|
205
|
+
if (!bnds) {
|
|
206
|
+
bnds = layer.layerBounds;
|
|
207
|
+
} else {
|
|
208
|
+
bnds.extend(layer.layerBounds);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (layer.zoomBounds) {
|
|
213
|
+
// Extend zoomBounds with layer zoomBounds
|
|
214
|
+
zoomMax = Math.max(zoomMax, layer.zoomBounds.maxZoom);
|
|
215
|
+
zoomMin = Math.min(zoomMin, layer.zoomBounds.minZoom);
|
|
216
|
+
maxNativeZoom = Math.max(
|
|
217
|
+
maxNativeZoom,
|
|
218
|
+
layer.zoomBounds.maxNativeZoom
|
|
219
|
+
);
|
|
220
|
+
minNativeZoom = Math.min(
|
|
221
|
+
minNativeZoom,
|
|
222
|
+
layer.zoomBounds.minNativeZoom
|
|
223
|
+
);
|
|
224
|
+
zoomBounds.minZoom = zoomMin;
|
|
225
|
+
zoomBounds.maxZoom = zoomMax;
|
|
226
|
+
zoomBounds.minNativeZoom = minNativeZoom;
|
|
227
|
+
zoomBounds.maxNativeZoom = maxNativeZoom;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
if (bnds) {
|
|
234
|
+
this.bounds = bnds;
|
|
235
|
+
} else {
|
|
236
|
+
let projectionBounds = M[this.options.projection].options.bounds;
|
|
237
|
+
this.bounds = bounds(projectionBounds.min, projectionBounds.max);
|
|
238
|
+
}
|
|
239
|
+
// we could get here and zoomBounds might still not be defined (empty layer)
|
|
240
|
+
if (!zoomBounds) zoomBounds = {};
|
|
241
|
+
if (!zoomBounds.minZoom) {
|
|
242
|
+
zoomBounds.minZoom = 0;
|
|
243
|
+
}
|
|
244
|
+
if (!zoomBounds.maxZoom) {
|
|
245
|
+
zoomBounds.maxZoom =
|
|
246
|
+
M[this.options.projection].options.resolutions.length - 1;
|
|
247
|
+
}
|
|
248
|
+
if (zoomBounds.minNativeZoom === Infinity) {
|
|
249
|
+
zoomBounds.minNativeZoom = zoomBounds.minZoom;
|
|
250
|
+
}
|
|
251
|
+
if (zoomBounds.maxNativeZoom === -Infinity) {
|
|
252
|
+
zoomBounds.maxNativeZoom = zoomBounds.maxZoom;
|
|
253
|
+
}
|
|
254
|
+
this.zoomBounds = zoomBounds;
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
onRemove: function (map) {
|
|
258
|
+
LayerGroup.prototype.onRemove.call(this, map);
|
|
259
|
+
DomUtil.remove(this._container);
|
|
260
|
+
map.off('popupopen', this._attachSkipButtons);
|
|
261
|
+
},
|
|
262
|
+
getAttribution: function () {
|
|
263
|
+
return this.options.attribution;
|
|
264
|
+
},
|
|
265
|
+
getBase: function () {
|
|
266
|
+
return new URL(
|
|
267
|
+
this._content.querySelector('map-base')
|
|
268
|
+
? this._content.querySelector('map-base').getAttribute('href')
|
|
269
|
+
: this._content.nodeName === 'MAP-LAYER' ||
|
|
270
|
+
this._content.nodeName === 'LAYER-'
|
|
271
|
+
? this._content.baseURI
|
|
272
|
+
: this._href,
|
|
273
|
+
this._href
|
|
274
|
+
).href;
|
|
275
|
+
},
|
|
276
|
+
renderStyles,
|
|
277
|
+
_initialize: function () {
|
|
278
|
+
var layer = this;
|
|
279
|
+
var base = layer.getBase(),
|
|
280
|
+
mapml = this._content;
|
|
281
|
+
parseLicenseAndLegend();
|
|
282
|
+
setLayerTitle();
|
|
283
|
+
// update controls if needed based on mapml-viewer controls/controlslist attribute
|
|
284
|
+
if (layer._layerEl.parentElement) {
|
|
285
|
+
// if layer does not have a parent Element, do not need to set Controls
|
|
286
|
+
layer._layerEl.parentElement._toggleControls();
|
|
287
|
+
}
|
|
288
|
+
// local functions
|
|
289
|
+
function setLayerTitle() {
|
|
290
|
+
if (mapml.querySelector('map-title')) {
|
|
291
|
+
layer._title = mapml.querySelector('map-title').textContent.trim();
|
|
292
|
+
layer._titleIsReadOnly = true;
|
|
293
|
+
} else if (layer._layerEl && layer._layerEl.hasAttribute('label')) {
|
|
294
|
+
layer._title = layer._layerEl.getAttribute('label').trim();
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function parseLicenseAndLegend() {
|
|
298
|
+
var licenseLink = mapml.querySelector('map-link[rel=license]'),
|
|
299
|
+
licenseTitle,
|
|
300
|
+
licenseUrl,
|
|
301
|
+
attText;
|
|
302
|
+
if (licenseLink) {
|
|
303
|
+
licenseTitle = licenseLink.getAttribute('title');
|
|
304
|
+
licenseUrl = licenseLink.getAttribute('href');
|
|
305
|
+
attText =
|
|
306
|
+
'<a href="' +
|
|
307
|
+
licenseUrl +
|
|
308
|
+
'" title="' +
|
|
309
|
+
licenseTitle +
|
|
310
|
+
'">' +
|
|
311
|
+
licenseTitle +
|
|
312
|
+
'</a>';
|
|
313
|
+
}
|
|
314
|
+
setOptions(layer, { attribution: attText });
|
|
315
|
+
var legendLink = mapml.querySelector('map-link[rel=legend]');
|
|
316
|
+
if (legendLink) {
|
|
317
|
+
layer._legendUrl = legendLink.getAttribute('href');
|
|
318
|
+
}
|
|
319
|
+
if (layer._map) {
|
|
320
|
+
// if the layer is checked in the layer control, force the addition
|
|
321
|
+
// of the attribution just received
|
|
322
|
+
if (layer._map.hasLayer(layer)) {
|
|
323
|
+
layer._map.attributionControl.addAttribution(layer.getAttribution());
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
getQueryTemplates: function (location, zoom) {
|
|
329
|
+
const queryLinks = this._layerEl.querySelectorAll(
|
|
330
|
+
'map-extent[checked] map-link[rel=query]'
|
|
331
|
+
).length
|
|
332
|
+
? this._layerEl.querySelectorAll(
|
|
333
|
+
'map-extent[checked] map-link[rel=query]'
|
|
334
|
+
)
|
|
335
|
+
: this._layerEl.shadowRoot.querySelectorAll(
|
|
336
|
+
'map-extent[checked] map-link[rel=query]'
|
|
337
|
+
).length
|
|
338
|
+
? this._layerEl.shadowRoot.querySelectorAll(
|
|
339
|
+
'map-extent[checked] map-link[rel=query]'
|
|
340
|
+
)
|
|
341
|
+
: null;
|
|
342
|
+
if (queryLinks) {
|
|
343
|
+
var templates = [];
|
|
344
|
+
for (let i = 0; i < queryLinks.length; i++) {
|
|
345
|
+
const minZoom = queryLinks[i].extent.zoom.minZoom,
|
|
346
|
+
maxZoom = queryLinks[i].extent.zoom.maxZoom,
|
|
347
|
+
withinZoomBounds = (z) => {
|
|
348
|
+
return minZoom <= z && z <= maxZoom;
|
|
349
|
+
},
|
|
350
|
+
bounds = queryLinks[i].getBounds();
|
|
351
|
+
|
|
352
|
+
if (bounds.contains(location) && withinZoomBounds(zoom)) {
|
|
353
|
+
templates.push(queryLinks[i]._templateVars);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return templates;
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
_attachSkipButtons: function (e) {
|
|
360
|
+
let popup = e.popup,
|
|
361
|
+
map = e.target,
|
|
362
|
+
layer,
|
|
363
|
+
group,
|
|
364
|
+
content = popup._container.getElementsByClassName(
|
|
365
|
+
'mapml-popup-content'
|
|
366
|
+
)[0];
|
|
367
|
+
|
|
368
|
+
popup._container.setAttribute('role', 'dialog');
|
|
369
|
+
content.setAttribute('tabindex', '-1');
|
|
370
|
+
// https://github.com/Maps4HTML/MapML.js/pull/467#issuecomment-844307818
|
|
371
|
+
content.setAttribute('role', 'document');
|
|
372
|
+
popup._count = 0; // used for feature pagination
|
|
373
|
+
|
|
374
|
+
if (popup._source._eventParents) {
|
|
375
|
+
// check if the popup is for a feature or query
|
|
376
|
+
layer =
|
|
377
|
+
popup._source._eventParents[
|
|
378
|
+
Object.keys(popup._source._eventParents)[0]
|
|
379
|
+
]; // get first parent of feature, there should only be one
|
|
380
|
+
group = popup._source.group;
|
|
381
|
+
// if the popup is for a static / templated feature, the "zoom to here" link can be attached once the popup opens
|
|
382
|
+
attachZoomLink.call(popup);
|
|
383
|
+
} else {
|
|
384
|
+
// getting access to the first map-extent to get access to _extentLayer to use it's (possibly) generic _previousFeature + _nextFeature methods.
|
|
385
|
+
const mapExtent =
|
|
386
|
+
popup._source._layerEl.querySelector('map-extent') ||
|
|
387
|
+
popup._source._layerEl.shadowRoot.querySelector('map-extent');
|
|
388
|
+
layer = mapExtent._extentLayer;
|
|
389
|
+
// if the popup is for a query, the "zoom to here" link should be re-attached every time new pagination features are displayed
|
|
390
|
+
map.on('attachZoomLink', attachZoomLink, popup);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (popup._container.querySelector('nav[class="mapml-focus-buttons"]')) {
|
|
394
|
+
DomUtil.remove(
|
|
395
|
+
popup._container.querySelector('nav[class="mapml-focus-buttons"]')
|
|
396
|
+
);
|
|
397
|
+
DomUtil.remove(popup._container.querySelector('hr'));
|
|
398
|
+
}
|
|
399
|
+
//add when popopen event happens instead
|
|
400
|
+
let div = DomUtil.create('nav', 'mapml-focus-buttons');
|
|
401
|
+
// creates |< button, focuses map
|
|
402
|
+
let mapFocusButton = DomUtil.create('button', 'mapml-popup-button', div);
|
|
403
|
+
mapFocusButton.type = 'button';
|
|
404
|
+
mapFocusButton.title = map.options.mapEl.locale.kbdFocusMap;
|
|
405
|
+
mapFocusButton.innerHTML = "<span aria-hidden='true'>|❮</span>";
|
|
406
|
+
DomEvent.on(
|
|
407
|
+
mapFocusButton,
|
|
408
|
+
'click',
|
|
409
|
+
(e) => {
|
|
410
|
+
DomEvent.stop(e);
|
|
411
|
+
map.featureIndex._sortIndex();
|
|
412
|
+
map.closePopup();
|
|
413
|
+
map._container.focus();
|
|
414
|
+
},
|
|
415
|
+
popup
|
|
416
|
+
);
|
|
417
|
+
|
|
418
|
+
// creates < button, focuses previous feature, if none exists focuses the current feature
|
|
419
|
+
let previousButton = DomUtil.create('button', 'mapml-popup-button', div);
|
|
420
|
+
previousButton.type = 'button';
|
|
421
|
+
previousButton.title = map.options.mapEl.locale.kbdPrevFeature;
|
|
422
|
+
previousButton.innerHTML = "<span aria-hidden='true'>❮</span>";
|
|
423
|
+
DomEvent.on(previousButton, 'click', layer._previousFeature, popup);
|
|
424
|
+
|
|
425
|
+
// static feature counter that 1/1
|
|
426
|
+
let featureCount = DomUtil.create('p', 'mapml-feature-count', div),
|
|
427
|
+
totalFeatures = this._totalFeatureCount ? this._totalFeatureCount : 1;
|
|
428
|
+
featureCount.innerText = popup._count + 1 + '/' + totalFeatures;
|
|
429
|
+
|
|
430
|
+
// creates > button, focuses next feature, if none exists focuses the current feature
|
|
431
|
+
let nextButton = DomUtil.create('button', 'mapml-popup-button', div);
|
|
432
|
+
nextButton.type = 'button';
|
|
433
|
+
nextButton.title = map.options.mapEl.locale.kbdNextFeature;
|
|
434
|
+
nextButton.innerHTML = "<span aria-hidden='true'>❯</span>";
|
|
435
|
+
DomEvent.on(nextButton, 'click', layer._nextFeature, popup);
|
|
436
|
+
|
|
437
|
+
// creates >| button, focuses map controls
|
|
438
|
+
let controlFocusButton = DomUtil.create(
|
|
439
|
+
'button',
|
|
440
|
+
'mapml-popup-button',
|
|
441
|
+
div
|
|
442
|
+
);
|
|
443
|
+
controlFocusButton.type = 'button';
|
|
444
|
+
controlFocusButton.title = map.options.mapEl.locale.kbdFocusControls;
|
|
445
|
+
controlFocusButton.innerHTML = "<span aria-hidden='true'>❯|</span>";
|
|
446
|
+
DomEvent.on(
|
|
447
|
+
controlFocusButton,
|
|
448
|
+
'click',
|
|
449
|
+
(e) => {
|
|
450
|
+
map.featureIndex._sortIndex();
|
|
451
|
+
map.featureIndex.currentIndex =
|
|
452
|
+
map.featureIndex.inBoundFeatures.length - 1;
|
|
453
|
+
map.featureIndex.inBoundFeatures[0]?.path.setAttribute('tabindex', -1);
|
|
454
|
+
map.featureIndex.inBoundFeatures[
|
|
455
|
+
map.featureIndex.currentIndex
|
|
456
|
+
]?.path.setAttribute('tabindex', 0);
|
|
457
|
+
DomEvent.stop(e);
|
|
458
|
+
map.closePopup();
|
|
459
|
+
map._controlContainer.querySelector('A:not([hidden])').focus();
|
|
460
|
+
},
|
|
461
|
+
popup
|
|
462
|
+
);
|
|
463
|
+
|
|
464
|
+
let divider = DomUtil.create('hr', 'mapml-popup-divider');
|
|
465
|
+
|
|
466
|
+
popup._navigationBar = div;
|
|
467
|
+
popup._content.parentElement.parentElement.appendChild(divider);
|
|
468
|
+
popup._content.parentElement.parentElement.appendChild(div);
|
|
469
|
+
|
|
470
|
+
content.focus();
|
|
471
|
+
|
|
472
|
+
if (group && !M.options.featureIndexOverlayOption) {
|
|
473
|
+
// e.target = this._map
|
|
474
|
+
// Looks for keydown, more specifically tab and shift tab
|
|
475
|
+
group.setAttribute('aria-expanded', 'true');
|
|
476
|
+
map.on('keydown', focusFeature);
|
|
477
|
+
} else {
|
|
478
|
+
map.on('keydown', focusMap);
|
|
479
|
+
}
|
|
480
|
+
// When popup is open, what gets focused with tab needs to be done using JS as the DOM order is not in an accessibility friendly manner
|
|
481
|
+
function focusFeature(focusEvent) {
|
|
482
|
+
let path =
|
|
483
|
+
focusEvent.originalEvent.path ||
|
|
484
|
+
focusEvent.originalEvent.composedPath();
|
|
485
|
+
let isTab = focusEvent.originalEvent.keyCode === 9,
|
|
486
|
+
shiftPressed = focusEvent.originalEvent.shiftKey;
|
|
487
|
+
if (
|
|
488
|
+
(path[0].classList.contains('leaflet-popup-close-button') &&
|
|
489
|
+
isTab &&
|
|
490
|
+
!shiftPressed) ||
|
|
491
|
+
focusEvent.originalEvent.keyCode === 27 ||
|
|
492
|
+
(path[0].classList.contains('leaflet-popup-close-button') &&
|
|
493
|
+
focusEvent.originalEvent.keyCode === 13)
|
|
494
|
+
) {
|
|
495
|
+
setTimeout(() => {
|
|
496
|
+
map.closePopup(popup);
|
|
497
|
+
group.focus();
|
|
498
|
+
DomEvent.stop(focusEvent);
|
|
499
|
+
}, 0);
|
|
500
|
+
} else if (
|
|
501
|
+
path[0].classList.contains('mapml-popup-content') &&
|
|
502
|
+
isTab &&
|
|
503
|
+
shiftPressed
|
|
504
|
+
) {
|
|
505
|
+
setTimeout(() => {
|
|
506
|
+
//timeout needed so focus of the feature is done even after the keypressup event occurs
|
|
507
|
+
map.closePopup(popup);
|
|
508
|
+
group.focus();
|
|
509
|
+
DomEvent.stop(focusEvent);
|
|
510
|
+
}, 0);
|
|
511
|
+
} else if (
|
|
512
|
+
path[0] === popup._content.querySelector('a') &&
|
|
513
|
+
isTab &&
|
|
514
|
+
shiftPressed
|
|
515
|
+
) {
|
|
516
|
+
setTimeout(() => {
|
|
517
|
+
map.closePopup(popup);
|
|
518
|
+
group.focus();
|
|
519
|
+
DomEvent.stop(focusEvent);
|
|
520
|
+
}, 0);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function focusMap(focusEvent) {
|
|
525
|
+
let path =
|
|
526
|
+
focusEvent.originalEvent.path ||
|
|
527
|
+
focusEvent.originalEvent.composedPath();
|
|
528
|
+
let isTab = focusEvent.originalEvent.keyCode === 9,
|
|
529
|
+
shiftPressed = focusEvent.originalEvent.shiftKey;
|
|
530
|
+
|
|
531
|
+
if (
|
|
532
|
+
(focusEvent.originalEvent.keyCode === 13 &&
|
|
533
|
+
path[0].classList.contains('leaflet-popup-close-button')) ||
|
|
534
|
+
focusEvent.originalEvent.keyCode === 27
|
|
535
|
+
) {
|
|
536
|
+
DomEvent.stopPropagation(focusEvent);
|
|
537
|
+
map.closePopup(popup);
|
|
538
|
+
map._container.focus();
|
|
539
|
+
if (focusEvent.originalEvent.keyCode !== 27) map._popupClosed = true;
|
|
540
|
+
} else if (
|
|
541
|
+
isTab &&
|
|
542
|
+
path[0].classList.contains('leaflet-popup-close-button')
|
|
543
|
+
) {
|
|
544
|
+
map.closePopup(popup);
|
|
545
|
+
} else if (
|
|
546
|
+
path[0].classList.contains('mapml-popup-content') &&
|
|
547
|
+
isTab &&
|
|
548
|
+
shiftPressed
|
|
549
|
+
) {
|
|
550
|
+
map.closePopup(popup);
|
|
551
|
+
setTimeout(() => {
|
|
552
|
+
//timeout needed so focus of the feature is done even after the keypressup event occurs
|
|
553
|
+
DomEvent.stop(focusEvent);
|
|
554
|
+
map._container.focus();
|
|
555
|
+
}, 0);
|
|
556
|
+
} else if (
|
|
557
|
+
path[0] === popup._content.querySelector('a') &&
|
|
558
|
+
isTab &&
|
|
559
|
+
shiftPressed
|
|
560
|
+
) {
|
|
561
|
+
map.closePopup(popup);
|
|
562
|
+
setTimeout(() => {
|
|
563
|
+
DomEvent.stop(focusEvent);
|
|
564
|
+
map.getContainer.focus();
|
|
565
|
+
}, 0);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function attachZoomLink(e) {
|
|
570
|
+
// this === popup
|
|
571
|
+
let popupWrapper = this._wrapper,
|
|
572
|
+
featureEl = e ? e.currFeature : this._source._groupLayer._featureEl;
|
|
573
|
+
if (popupWrapper.querySelector('a.mapml-zoom-link')) {
|
|
574
|
+
popupWrapper.querySelector('a.mapml-zoom-link').remove();
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// return early if feature doesn't have map-geometry
|
|
578
|
+
if (!featureEl.querySelector('map-geometry')) return;
|
|
579
|
+
|
|
580
|
+
// calculate zoom parameters
|
|
581
|
+
let tL = featureEl.extent.topLeft.gcrs,
|
|
582
|
+
bR = featureEl.extent.bottomRight.gcrs,
|
|
583
|
+
center = latLngBounds(
|
|
584
|
+
latLng(tL.horizontal, tL.vertical),
|
|
585
|
+
latLng(bR.horizontal, bR.vertical)
|
|
586
|
+
).getCenter(true);
|
|
587
|
+
|
|
588
|
+
// construct zoom link
|
|
589
|
+
let zoomLink = document.createElement('a');
|
|
590
|
+
zoomLink.href = `#${featureEl.getZoomToZoom()},${center.lng},${
|
|
591
|
+
center.lat
|
|
592
|
+
}`;
|
|
593
|
+
zoomLink.innerHTML = `${map.options.mapEl.locale.popupZoom}`;
|
|
594
|
+
zoomLink.className = 'mapml-zoom-link';
|
|
595
|
+
|
|
596
|
+
// handle zoom link interactions
|
|
597
|
+
zoomLink.onclick = zoomLink.onkeydown = function (e) {
|
|
598
|
+
if (!(e instanceof MouseEvent) && e.keyCode !== 13) return;
|
|
599
|
+
e.preventDefault();
|
|
600
|
+
featureEl.zoomTo();
|
|
601
|
+
map.closePopup();
|
|
602
|
+
map.getContainer().focus();
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
// we found that the popupopen event is fired as many times as there
|
|
606
|
+
// are layers on the map (<map-layer> elements / MapLayers that is).
|
|
607
|
+
// In each case the target layer is always this layer, so we can't
|
|
608
|
+
// detect and conditionally add the zoomLink if the target is not this.
|
|
609
|
+
// so, like Ahmad, we are taking a 'delete everyting each time'
|
|
610
|
+
// approach (see _attachSkipButtons for this approach taken with
|
|
611
|
+
// feature navigation buttons); obviously he dealt with this leaflet bug
|
|
612
|
+
// this way some time ago, and we can't figure out how to get around it
|
|
613
|
+
// apart from this slightly non-optimal method. Revisit sometime!
|
|
614
|
+
let link = popupWrapper.querySelector('.mapml-zoom-link');
|
|
615
|
+
if (link) link.remove();
|
|
616
|
+
|
|
617
|
+
// attach link to popup
|
|
618
|
+
popupWrapper.insertBefore(
|
|
619
|
+
zoomLink,
|
|
620
|
+
popupWrapper.querySelector('hr.mapml-popup-divider')
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// if popup closes then the focusFeature handler can be removed
|
|
625
|
+
map.on('popupclose', removeHandlers);
|
|
626
|
+
function removeHandlers(removeEvent) {
|
|
627
|
+
if (removeEvent.popup === popup) {
|
|
628
|
+
map.off('keydown', focusFeature);
|
|
629
|
+
map.off('keydown', focusMap);
|
|
630
|
+
map.off('popupopen', attachZoomLink);
|
|
631
|
+
map.off('popupclose', removeHandlers);
|
|
632
|
+
if (group) group.setAttribute('aria-expanded', 'false');
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
export var mapLayer = function (url, node, options) {
|
|
638
|
+
if (!url && !node) return null;
|
|
639
|
+
return new MapLayer(url, node, options);
|
|
640
|
+
};
|