@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,101 @@
|
|
|
1
|
+
import { Control, DomUtil, DomEvent, Map } from 'leaflet';
|
|
2
|
+
|
|
3
|
+
export var AttributionButton = 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 = DomUtil.create('details', 'leaflet-control-attribution');
|
|
12
|
+
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
|
+
Map.mergeOptions({
|
|
74
|
+
attributionControl: false,
|
|
75
|
+
toggleableAttributionControl: true
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
Map.addInitHook(function () {
|
|
79
|
+
if (this.options.toggleableAttributionControl) {
|
|
80
|
+
attributionButton({ mapEl: this.options.mapEl }).addTo(this);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export 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
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Control, DomUtil, DomEvent, Map, Util as LeafletUtil } from 'leaflet';
|
|
2
|
+
import { Util } from '../Util.js';
|
|
3
|
+
|
|
4
|
+
export var FullscreenButton = Control.extend({
|
|
5
|
+
options: {
|
|
6
|
+
position: 'topleft',
|
|
7
|
+
title: {
|
|
8
|
+
false: M.options.locale.btnFullScreen,
|
|
9
|
+
true: M.options.locale.btnExitFullScreen
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
_getLocale: function (map) {
|
|
13
|
+
return map.options.mapEl && map.options.mapEl.locale
|
|
14
|
+
? map.options.mapEl.locale
|
|
15
|
+
: M.options.locale;
|
|
16
|
+
},
|
|
17
|
+
onAdd: function (map) {
|
|
18
|
+
let locale = this._getLocale(map);
|
|
19
|
+
this.options.title = {
|
|
20
|
+
false: locale.btnFullScreen,
|
|
21
|
+
true: locale.btnExitFullScreen
|
|
22
|
+
};
|
|
23
|
+
var container = DomUtil.create(
|
|
24
|
+
'div',
|
|
25
|
+
'leaflet-control-fullscreen leaflet-bar leaflet-control'
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
this.link = DomUtil.create(
|
|
29
|
+
'a',
|
|
30
|
+
'leaflet-control-fullscreen-button leaflet-bar-part',
|
|
31
|
+
container
|
|
32
|
+
);
|
|
33
|
+
this.link.href = '#';
|
|
34
|
+
this.link.setAttribute('role', 'button');
|
|
35
|
+
|
|
36
|
+
this._map = map;
|
|
37
|
+
this._map.on('fullscreenchange', this._toggleTitle, this);
|
|
38
|
+
this._toggleTitle();
|
|
39
|
+
|
|
40
|
+
DomEvent.on(this.link, 'click', this._click, this);
|
|
41
|
+
|
|
42
|
+
return container;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
onRemove: function (map) {
|
|
46
|
+
map.off('fullscreenchange', this._toggleTitle, this);
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
_click: function (e) {
|
|
50
|
+
DomEvent.stopPropagation(e);
|
|
51
|
+
DomEvent.preventDefault(e);
|
|
52
|
+
this._map.toggleFullscreen(this.options);
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
_toggleTitle: function () {
|
|
56
|
+
this.link.title = this.options.title[this._map.isFullscreen()];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
Map.include({
|
|
61
|
+
isFullscreen: function () {
|
|
62
|
+
return this._isFullscreen || false;
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
toggleFullscreen: function (options) {
|
|
66
|
+
// <gcds-ext-map> can contain a shadow root, so return it directly
|
|
67
|
+
var mapEl = Util.getClosest(
|
|
68
|
+
this.getContainer(),
|
|
69
|
+
'gcds-ext-map'
|
|
70
|
+
);
|
|
71
|
+
if (this.isFullscreen()) {
|
|
72
|
+
if (options && options.pseudoFullscreen) {
|
|
73
|
+
this._disablePseudoFullscreen(mapEl);
|
|
74
|
+
} else if (document.exitFullscreen) {
|
|
75
|
+
document.exitFullscreen();
|
|
76
|
+
} else if (document.mozCancelFullScreen) {
|
|
77
|
+
document.mozCancelFullScreen();
|
|
78
|
+
} else if (document.webkitCancelFullScreen) {
|
|
79
|
+
document.webkitCancelFullScreen();
|
|
80
|
+
} else if (document.msExitFullscreen) {
|
|
81
|
+
document.msExitFullscreen();
|
|
82
|
+
} else {
|
|
83
|
+
this._disablePseudoFullscreen(mapEl);
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
if (options && options.pseudoFullscreen) {
|
|
87
|
+
this._enablePseudoFullscreen(mapEl);
|
|
88
|
+
} else if (mapEl.requestFullscreen) {
|
|
89
|
+
mapEl.requestFullscreen();
|
|
90
|
+
} else if (mapEl.mozRequestFullScreen) {
|
|
91
|
+
mapEl.mozRequestFullScreen();
|
|
92
|
+
} else if (mapEl.webkitRequestFullscreen) {
|
|
93
|
+
mapEl.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
|
94
|
+
} else if (mapEl.msRequestFullscreen) {
|
|
95
|
+
mapEl.msRequestFullscreen();
|
|
96
|
+
} else {
|
|
97
|
+
this._enablePseudoFullscreen(mapEl);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.getContainer().focus();
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
_enablePseudoFullscreen: function (container) {
|
|
104
|
+
DomUtil.addClass(container, 'leaflet-pseudo-fullscreen');
|
|
105
|
+
this._setFullscreen(true);
|
|
106
|
+
this.fire('fullscreenchange');
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
_disablePseudoFullscreen: function (container) {
|
|
110
|
+
DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen');
|
|
111
|
+
this._setFullscreen(false);
|
|
112
|
+
this.fire('fullscreenchange');
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
_setFullscreen: function (fullscreen) {
|
|
116
|
+
this._isFullscreen = fullscreen;
|
|
117
|
+
var container = Util.getClosest(
|
|
118
|
+
this.getContainer(),
|
|
119
|
+
'gcds-ext-map'
|
|
120
|
+
);
|
|
121
|
+
if (fullscreen) {
|
|
122
|
+
DomUtil.addClass(container, 'mapml-fullscreen-on');
|
|
123
|
+
} else {
|
|
124
|
+
DomUtil.removeClass(container, 'mapml-fullscreen-on');
|
|
125
|
+
}
|
|
126
|
+
this.invalidateSize();
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
_onFullscreenChange: function (e) {
|
|
130
|
+
var fullscreenElement = Util.getClosest(this.getContainer(), ':fullscreen'),
|
|
131
|
+
mapEl = Util.getClosest(this.getContainer(), 'gcds-ext-map');
|
|
132
|
+
if (fullscreenElement === mapEl && !this._isFullscreen) {
|
|
133
|
+
this._setFullscreen(true);
|
|
134
|
+
this.fire('fullscreenchange');
|
|
135
|
+
} else if (fullscreenElement !== mapEl && this._isFullscreen) {
|
|
136
|
+
this._setFullscreen(false);
|
|
137
|
+
this.fire('fullscreenchange');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
Map.mergeOptions({
|
|
143
|
+
fullscreenControl: false
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
Map.addInitHook(function () {
|
|
147
|
+
if (this.options.fullscreenControl) {
|
|
148
|
+
this.fullscreenControl = new FullscreenButton(
|
|
149
|
+
this.options.fullscreenControl
|
|
150
|
+
);
|
|
151
|
+
this.addControl(this.fullscreenControl);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var fullscreenchange;
|
|
155
|
+
|
|
156
|
+
if ('onfullscreenchange' in document) {
|
|
157
|
+
fullscreenchange = 'fullscreenchange';
|
|
158
|
+
} else if ('onmozfullscreenchange' in document) {
|
|
159
|
+
fullscreenchange = 'mozfullscreenchange';
|
|
160
|
+
} else if ('onwebkitfullscreenchange' in document) {
|
|
161
|
+
fullscreenchange = 'webkitfullscreenchange';
|
|
162
|
+
} else if ('onmsfullscreenchange' in document) {
|
|
163
|
+
fullscreenchange = 'MSFullscreenChange';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (fullscreenchange) {
|
|
167
|
+
var onFullscreenChange = LeafletUtil.bind(this._onFullscreenChange, this);
|
|
168
|
+
|
|
169
|
+
this.whenReady(function () {
|
|
170
|
+
DomEvent.on(document, fullscreenchange, onFullscreenChange);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
this.on('unload', function () {
|
|
174
|
+
DomEvent.off(document, fullscreenchange, onFullscreenChange);
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
export var fullscreenButton = function (options) {
|
|
180
|
+
return new FullscreenButton(options);
|
|
181
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Control } from 'leaflet';
|
|
2
|
+
import { LocateControl } from 'leaflet.locatecontrol';
|
|
3
|
+
|
|
4
|
+
export var GeolocationButton = Control.extend({
|
|
5
|
+
options: {
|
|
6
|
+
position: 'bottomright'
|
|
7
|
+
},
|
|
8
|
+
_getLocale: function (map) {
|
|
9
|
+
return map.options.mapEl && map.options.mapEl.locale
|
|
10
|
+
? map.options.mapEl.locale
|
|
11
|
+
: M.options.locale;
|
|
12
|
+
},
|
|
13
|
+
onAdd: function (map) {
|
|
14
|
+
// customize locate control to focus map after start/stop, so that
|
|
15
|
+
// featureIndexOverlay is correctly displayed
|
|
16
|
+
Control.CustomLocate = LocateControl.extend({
|
|
17
|
+
start: function () {
|
|
18
|
+
LocateControl.prototype.start.call(this);
|
|
19
|
+
map.getContainer().focus();
|
|
20
|
+
},
|
|
21
|
+
stop: function () {
|
|
22
|
+
LocateControl.prototype.stop.call(this);
|
|
23
|
+
map.getContainer().focus();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
let locale = this._getLocale(map);
|
|
27
|
+
|
|
28
|
+
this.locateControl = new Control.CustomLocate({
|
|
29
|
+
showPopup: false,
|
|
30
|
+
strings: {
|
|
31
|
+
title: locale.btnLocTrackOff
|
|
32
|
+
},
|
|
33
|
+
position: this.options.position,
|
|
34
|
+
locateOptions: {
|
|
35
|
+
maxZoom: 16
|
|
36
|
+
}
|
|
37
|
+
}).addTo(map);
|
|
38
|
+
|
|
39
|
+
var container = this.locateControl._container;
|
|
40
|
+
var button = this.locateControl;
|
|
41
|
+
var observer = new MutationObserver(function (mutations) {
|
|
42
|
+
if (
|
|
43
|
+
container.classList.contains('active') &&
|
|
44
|
+
container.classList.contains('following')
|
|
45
|
+
) {
|
|
46
|
+
container.firstChild.title = locale.btnLocTrackOn;
|
|
47
|
+
button._marker.bindTooltip(locale.btnMyLocTrackOn, {
|
|
48
|
+
permanent: true
|
|
49
|
+
});
|
|
50
|
+
} else if (container.classList.contains('active')) {
|
|
51
|
+
container.firstChild.title = locale.btnLocTrackLastKnown;
|
|
52
|
+
button._marker.bindTooltip(locale.btnMyLastKnownLocTrackOn);
|
|
53
|
+
} else {
|
|
54
|
+
container.firstChild.title = locale.btnLocTrackOff;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var observerConfig = { attributes: true, attributeFilter: ['class'] };
|
|
58
|
+
observer.observe(container, observerConfig);
|
|
59
|
+
|
|
60
|
+
return container;
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
stop: function () {
|
|
64
|
+
return this.locateControl.stop();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export var geolocationButton = function (options) {
|
|
69
|
+
return new GeolocationButton(options);
|
|
70
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { Control, DomEvent, DomUtil, setOptions, stamp } from 'leaflet';
|
|
2
|
+
|
|
3
|
+
// Refactored LayerControl to remove global L dependency
|
|
4
|
+
export var LayerControl = Control.Layers.extend({
|
|
5
|
+
options: {
|
|
6
|
+
autoZIndex: false,
|
|
7
|
+
sortLayers: true,
|
|
8
|
+
sortFunction: function (layerA, layerB) {
|
|
9
|
+
return layerA.options.zIndex < layerB.options.zIndex
|
|
10
|
+
? -1
|
|
11
|
+
: layerA.options.zIndex > layerB.options.zIndex
|
|
12
|
+
? 1
|
|
13
|
+
: 0;
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
initialize: function (overlays, options) {
|
|
17
|
+
setOptions(this, options);
|
|
18
|
+
|
|
19
|
+
// the _layers array contains objects like {layer: layer, name: "name", overlay: true}
|
|
20
|
+
// the array index is the id of the layer returned by stamp(layer) which I guess is a unique hash
|
|
21
|
+
this._layerControlInputs = [];
|
|
22
|
+
this._layers = [];
|
|
23
|
+
this._lastZIndex = 0;
|
|
24
|
+
this._handlingClick = false;
|
|
25
|
+
|
|
26
|
+
for (var i in overlays) {
|
|
27
|
+
this._addLayer(overlays[i], i, true);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
onAdd: function () {
|
|
31
|
+
this._initLayout();
|
|
32
|
+
// Adding event on layer control button
|
|
33
|
+
DomEvent.on(
|
|
34
|
+
this._container.getElementsByTagName('a')[0],
|
|
35
|
+
'keydown',
|
|
36
|
+
this._focusFirstLayer,
|
|
37
|
+
this._container
|
|
38
|
+
);
|
|
39
|
+
DomEvent.on(
|
|
40
|
+
this._container,
|
|
41
|
+
'contextmenu',
|
|
42
|
+
this._preventDefaultContextMenu,
|
|
43
|
+
this
|
|
44
|
+
);
|
|
45
|
+
this._update();
|
|
46
|
+
if (this._layers.length < 1 && !this._map._showControls) {
|
|
47
|
+
this._container.setAttribute('hidden', '');
|
|
48
|
+
} else {
|
|
49
|
+
this._map._showControls = true;
|
|
50
|
+
}
|
|
51
|
+
return this._container;
|
|
52
|
+
},
|
|
53
|
+
onRemove: function (map) {
|
|
54
|
+
DomEvent.off(
|
|
55
|
+
this._container.getElementsByTagName('a')[0],
|
|
56
|
+
'keydown',
|
|
57
|
+
this._focusFirstLayer,
|
|
58
|
+
this._container
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
addOrUpdateOverlay: function (layer, name) {
|
|
62
|
+
var alreadyThere = false;
|
|
63
|
+
for (var i = 0; i < this._layers.length; i++) {
|
|
64
|
+
if (this._layers[i].layer === layer) {
|
|
65
|
+
alreadyThere = true;
|
|
66
|
+
this._layers[i].name = name;
|
|
67
|
+
// replace the controls with updated controls if necessary.
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!alreadyThere) {
|
|
72
|
+
this.addOverlay(layer, name);
|
|
73
|
+
}
|
|
74
|
+
if (this._layers.length > 0) {
|
|
75
|
+
this._container.removeAttribute('hidden');
|
|
76
|
+
this._map._showControls = true;
|
|
77
|
+
}
|
|
78
|
+
return this._map ? this._update() : this;
|
|
79
|
+
},
|
|
80
|
+
removeLayer: function (layer) {
|
|
81
|
+
Control.Layers.prototype.removeLayer.call(this, layer);
|
|
82
|
+
if (this._layers.length === 0) {
|
|
83
|
+
this._container.setAttribute('hidden', '');
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
_checkDisabledLayers: function () {},
|
|
88
|
+
|
|
89
|
+
// focus the first layer in the layer control when enter is pressed
|
|
90
|
+
_focusFirstLayer: function (e) {
|
|
91
|
+
if (
|
|
92
|
+
e.key === 'Enter' &&
|
|
93
|
+
this.className ===
|
|
94
|
+
'leaflet-control-layers leaflet-control leaflet-control-layers-expanded'
|
|
95
|
+
) {
|
|
96
|
+
var elem =
|
|
97
|
+
this.children[1].children[2].children[0].children[0].children[0]
|
|
98
|
+
.children[0];
|
|
99
|
+
if (elem) setTimeout(() => elem.focus(), 0);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// imported from leaflet with slight modifications
|
|
104
|
+
// for layerControl ordering based on zIndex
|
|
105
|
+
_update: function () {
|
|
106
|
+
if (!this._container) {
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
DomUtil.empty(this._baseLayersList);
|
|
111
|
+
DomUtil.empty(this._overlaysList);
|
|
112
|
+
|
|
113
|
+
this._layerControlInputs = [];
|
|
114
|
+
var baseLayersPresent,
|
|
115
|
+
overlaysPresent,
|
|
116
|
+
i,
|
|
117
|
+
obj,
|
|
118
|
+
baseLayersCount = 0;
|
|
119
|
+
|
|
120
|
+
// <----------- MODIFICATION from the default _update method
|
|
121
|
+
// sort the layercontrol layers object based on the zIndex
|
|
122
|
+
// provided by MapLayer
|
|
123
|
+
if (this.options.sortLayers) {
|
|
124
|
+
this._layers.sort((a, b) =>
|
|
125
|
+
this.options.sortFunction(a.layer, b.layer, a.name, b.name)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
for (i = 0; i < this._layers.length; i++) {
|
|
130
|
+
obj = this._layers[i];
|
|
131
|
+
this._addItem(obj);
|
|
132
|
+
overlaysPresent = overlaysPresent || obj.overlay;
|
|
133
|
+
baseLayersPresent = baseLayersPresent || !obj.overlay;
|
|
134
|
+
baseLayersCount += !obj.overlay ? 1 : 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Hide base layers section if there's only one layer.
|
|
138
|
+
if (this.options.hideSingleBase) {
|
|
139
|
+
baseLayersPresent = baseLayersPresent && baseLayersCount > 1;
|
|
140
|
+
this._baseLayersList.style.display = baseLayersPresent ? '' : 'none';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
this._separator.style.display =
|
|
144
|
+
overlaysPresent && baseLayersPresent ? '' : 'none';
|
|
145
|
+
|
|
146
|
+
return this;
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
_addItem: function (obj) {
|
|
150
|
+
var layercontrols = obj.layer._layerEl._layerControlHTML;
|
|
151
|
+
// the input is required by Leaflet...
|
|
152
|
+
obj.input = layercontrols.querySelector(
|
|
153
|
+
'input.leaflet-control-layers-selector'
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
this._layerControlInputs.push(obj.input);
|
|
157
|
+
obj.input.layerId = stamp(obj.layer);
|
|
158
|
+
|
|
159
|
+
this._overlaysList.appendChild(layercontrols);
|
|
160
|
+
return layercontrols;
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
//overrides collapse and conditionally collapses the panel
|
|
164
|
+
collapse: function (e) {
|
|
165
|
+
// if layer control is not expanded, return
|
|
166
|
+
if (!this._container.className.includes('expanded')) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
// return if layer contextmenu is still open
|
|
170
|
+
if (
|
|
171
|
+
!this._map.contextMenu._extentLayerMenu.hidden ||
|
|
172
|
+
!this._map.contextMenu._layerMenu.hidden
|
|
173
|
+
) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (
|
|
177
|
+
e.target.tagName === 'SELECT' ||
|
|
178
|
+
(e.relatedTarget &&
|
|
179
|
+
e.relatedTarget.parentElement &&
|
|
180
|
+
(e.relatedTarget.className === 'mapml-contextmenu mapml-layer-menu' ||
|
|
181
|
+
e.relatedTarget.parentElement.className ===
|
|
182
|
+
'mapml-contextmenu mapml-layer-menu')) ||
|
|
183
|
+
(this._map && this._map.contextMenu._layerMenu.style.display === 'block')
|
|
184
|
+
)
|
|
185
|
+
return this;
|
|
186
|
+
|
|
187
|
+
DomUtil.removeClass(this._container, 'leaflet-control-layers-expanded');
|
|
188
|
+
if (e.originalEvent?.pointerType === 'touch') {
|
|
189
|
+
this._container._isExpanded = false;
|
|
190
|
+
}
|
|
191
|
+
return this;
|
|
192
|
+
},
|
|
193
|
+
_preventDefaultContextMenu: function (e) {
|
|
194
|
+
let latlng = this._map.mouseEventToLatLng(e);
|
|
195
|
+
let containerPoint = this._map.mouseEventToContainerPoint(e);
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
// for touch devices, when the layer control is not expanded,
|
|
198
|
+
// the layer context menu should not show on map
|
|
199
|
+
if (!this._container._isExpanded && e.pointerType === 'touch') {
|
|
200
|
+
this._container._isExpanded = true;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this._map.fire('contextmenu', {
|
|
204
|
+
originalEvent: e,
|
|
205
|
+
containerPoint: containerPoint,
|
|
206
|
+
latlng: latlng
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
export var layerControl = function (layers, options) {
|
|
211
|
+
return new LayerControl(layers, options);
|
|
212
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Control, DomUtil, DomEvent } from 'leaflet';
|
|
2
|
+
|
|
3
|
+
export var ReloadButton = Control.extend({
|
|
4
|
+
options: {
|
|
5
|
+
position: 'topleft'
|
|
6
|
+
},
|
|
7
|
+
_getLocale: function (map) {
|
|
8
|
+
return map.options.mapEl && map.options.mapEl.locale
|
|
9
|
+
? map.options.mapEl.locale
|
|
10
|
+
: M.options.locale;
|
|
11
|
+
},
|
|
12
|
+
onAdd: function (map) {
|
|
13
|
+
let locale = this._getLocale(map);
|
|
14
|
+
let container = DomUtil.create('div', 'mapml-reload-button leaflet-bar');
|
|
15
|
+
|
|
16
|
+
let link = DomUtil.create('button', 'mapml-reload-button', container);
|
|
17
|
+
link.innerHTML = "<span aria-hidden='true'>↺</span>";
|
|
18
|
+
link.title = locale.cmReload;
|
|
19
|
+
link.setAttribute('type', 'button');
|
|
20
|
+
link.classList.add('mapml-button');
|
|
21
|
+
link.setAttribute('aria-label', 'Reload');
|
|
22
|
+
|
|
23
|
+
DomEvent.disableClickPropagation(link);
|
|
24
|
+
DomEvent.on(link, 'click', DomEvent.stop);
|
|
25
|
+
DomEvent.on(link, 'click', this._goReload, this);
|
|
26
|
+
|
|
27
|
+
this._reloadButton = link;
|
|
28
|
+
|
|
29
|
+
this._updateDisabled();
|
|
30
|
+
map.on('moveend', this._updateDisabled, this);
|
|
31
|
+
|
|
32
|
+
return container;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
onRemove: function (map) {
|
|
36
|
+
map.off('moveend', this._updateDisabled, this);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
disable: function () {
|
|
40
|
+
this._disabled = true;
|
|
41
|
+
this._updateDisabled();
|
|
42
|
+
return this;
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
enable: function () {
|
|
46
|
+
this._disabled = false;
|
|
47
|
+
this._updateDisabled();
|
|
48
|
+
return this;
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
_goReload: function (e) {
|
|
52
|
+
if (!this._disabled && this._map.options.mapEl._history.length > 1) {
|
|
53
|
+
this._map.options.mapEl.reload();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
_updateDisabled: function () {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
DomUtil.removeClass(this._reloadButton, 'leaflet-disabled');
|
|
60
|
+
this._reloadButton.setAttribute('aria-disabled', 'false');
|
|
61
|
+
|
|
62
|
+
if (
|
|
63
|
+
this._map &&
|
|
64
|
+
(this._disabled || this._map.options.mapEl._history.length <= 1)
|
|
65
|
+
) {
|
|
66
|
+
DomUtil.addClass(this._reloadButton, 'leaflet-disabled');
|
|
67
|
+
this._reloadButton.setAttribute('aria-disabled', 'true');
|
|
68
|
+
}
|
|
69
|
+
}, 0);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export var reloadButton = function (options) {
|
|
74
|
+
return new ReloadButton(options);
|
|
75
|
+
};
|