@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,108 @@
|
|
|
1
|
+
import { Layer, DomUtil, DomEvent } from 'leaflet';
|
|
2
|
+
|
|
3
|
+
export var Crosshair = Layer.extend({
|
|
4
|
+
onAdd: function (map) {
|
|
5
|
+
// SVG crosshair design from https://github.com/xguaita/Leaflet.MapCenterCoord/blob/master/src/icons/MapCenterCoordIcon1.svg?short_path=81a5c76
|
|
6
|
+
// Optimized with SVGOMG: https://jakearchibald.github.io/svgomg/
|
|
7
|
+
let svgInnerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>`;
|
|
8
|
+
|
|
9
|
+
this._container = DomUtil.create('div', 'mapml-crosshair', map._container);
|
|
10
|
+
this._container.innerHTML = svgInnerHTML;
|
|
11
|
+
map.isFocused = false;
|
|
12
|
+
this._isQueryable = false;
|
|
13
|
+
|
|
14
|
+
map.on(
|
|
15
|
+
'layerchange layeradd layerremove overlayremove',
|
|
16
|
+
this._toggleEvents,
|
|
17
|
+
this
|
|
18
|
+
);
|
|
19
|
+
map.on('popupopen', this._isMapFocused, this);
|
|
20
|
+
DomEvent.on(
|
|
21
|
+
map._container,
|
|
22
|
+
'keydown keyup mousedown',
|
|
23
|
+
this._isMapFocused,
|
|
24
|
+
this
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
this._addOrRemoveCrosshair();
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
onRemove: function (map) {
|
|
31
|
+
map.off(
|
|
32
|
+
'layerchange layeradd layerremove overlayremove',
|
|
33
|
+
this._toggleEvents
|
|
34
|
+
);
|
|
35
|
+
map.off('popupopen', this._isMapFocused);
|
|
36
|
+
DomEvent.off(map._container, 'keydown keyup mousedown', this._isMapFocused);
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
_toggleEvents: function () {
|
|
40
|
+
if (this._hasQueryableLayer()) {
|
|
41
|
+
this._map.on('viewreset move moveend', this._addOrRemoveCrosshair, this);
|
|
42
|
+
} else {
|
|
43
|
+
this._map.off('viewreset move moveend', this._addOrRemoveCrosshair, this);
|
|
44
|
+
}
|
|
45
|
+
this._addOrRemoveCrosshair();
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
_addOrRemoveCrosshair: function (e) {
|
|
49
|
+
if (this._hasQueryableLayer()) {
|
|
50
|
+
this._container.removeAttribute('hidden');
|
|
51
|
+
} else {
|
|
52
|
+
this._container.setAttribute('hidden', '');
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
_addOrRemoveMapOutline: function (e) {
|
|
57
|
+
let mapContainer = this._map._container;
|
|
58
|
+
if (this._map.isFocused && !this._outline) {
|
|
59
|
+
this._outline = DomUtil.create('div', 'mapml-outline', mapContainer);
|
|
60
|
+
} else if (!this._map.isFocused && this._outline) {
|
|
61
|
+
DomUtil.remove(this._outline);
|
|
62
|
+
delete this._outline;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
_hasQueryableLayer: function () {
|
|
67
|
+
let layers = this._map.options.mapEl.layers;
|
|
68
|
+
if (this._map.isFocused) {
|
|
69
|
+
for (let layer of layers) {
|
|
70
|
+
if (layer.queryable && layer.queryable()) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// TODO: should be merged with the 'mapfocused' event emitted by mapml-viewer and map, not trivial
|
|
79
|
+
_isMapFocused: function (e) {
|
|
80
|
+
//set this._map.isFocused = true if arrow buttons are used
|
|
81
|
+
if (!this._map._container.parentNode.activeElement) {
|
|
82
|
+
this._map.isFocused = false;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
let isLeafletContainer =
|
|
86
|
+
this._map._container.parentNode.activeElement.classList.contains(
|
|
87
|
+
'leaflet-container'
|
|
88
|
+
);
|
|
89
|
+
if (
|
|
90
|
+
isLeafletContainer &&
|
|
91
|
+
['keydown'].includes(e.type) &&
|
|
92
|
+
e.shiftKey &&
|
|
93
|
+
e.keyCode === 9
|
|
94
|
+
) {
|
|
95
|
+
this._map.isFocused = false;
|
|
96
|
+
} else
|
|
97
|
+
this._map.isFocused =
|
|
98
|
+
isLeafletContainer && ['keyup', 'keydown'].includes(e.type);
|
|
99
|
+
|
|
100
|
+
if (this._map.isFocused) this._map.fire('mapkeyboardfocused');
|
|
101
|
+
this._addOrRemoveMapOutline();
|
|
102
|
+
this._addOrRemoveCrosshair();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export var crosshair = function (options) {
|
|
107
|
+
return new Crosshair(options);
|
|
108
|
+
};
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Layer,
|
|
3
|
+
DomUtil,
|
|
4
|
+
GridLayer,
|
|
5
|
+
LayerGroup,
|
|
6
|
+
Path,
|
|
7
|
+
point,
|
|
8
|
+
circle,
|
|
9
|
+
bounds,
|
|
10
|
+
setOptions
|
|
11
|
+
} from 'leaflet';
|
|
12
|
+
|
|
13
|
+
export var DebugOverlay = Layer.extend({
|
|
14
|
+
onAdd: function (map) {
|
|
15
|
+
let mapSize = map.getSize();
|
|
16
|
+
|
|
17
|
+
//conditionally show container for debug panel/banner only when the map has enough space for it
|
|
18
|
+
if (mapSize.x > 400 || mapSize.y > 300) {
|
|
19
|
+
this._container = DomUtil.create('table', 'mapml-debug', map._container);
|
|
20
|
+
|
|
21
|
+
this._panel = debugPanel({
|
|
22
|
+
className: 'mapml-debug-panel',
|
|
23
|
+
pane: this._container
|
|
24
|
+
});
|
|
25
|
+
map.addLayer(this._panel);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
this._grid = debugGrid({
|
|
29
|
+
className: 'mapml-debug-grid',
|
|
30
|
+
pane: map._panes.mapPane,
|
|
31
|
+
zIndex: 400,
|
|
32
|
+
tileSize: map.options.crs.options.crs.tile.bounds.max.x
|
|
33
|
+
});
|
|
34
|
+
map.addLayer(this._grid);
|
|
35
|
+
|
|
36
|
+
this._vectors = debugVectors({
|
|
37
|
+
className: 'mapml-debug-vectors',
|
|
38
|
+
pane: map._panes.mapPane,
|
|
39
|
+
toolPane: this._container
|
|
40
|
+
});
|
|
41
|
+
map.addLayer(this._vectors);
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
onRemove: function (map) {
|
|
45
|
+
map.removeLayer(this._grid);
|
|
46
|
+
map.removeLayer(this._vectors);
|
|
47
|
+
if (this._panel) {
|
|
48
|
+
//conditionally remove the panel, as it's not always added
|
|
49
|
+
map.removeLayer(this._panel);
|
|
50
|
+
DomUtil.remove(this._container);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export var debugOverlay = function () {
|
|
56
|
+
return new DebugOverlay();
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export var DebugPanel = Layer.extend({
|
|
60
|
+
initialize: function (options) {
|
|
61
|
+
setOptions(this, options);
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
onAdd: function (map) {
|
|
65
|
+
this._title = DomUtil.create(
|
|
66
|
+
'caption',
|
|
67
|
+
'mapml-debug-banner',
|
|
68
|
+
this.options.pane
|
|
69
|
+
);
|
|
70
|
+
this._title.innerHTML = 'Debug mode';
|
|
71
|
+
|
|
72
|
+
map.debug = {};
|
|
73
|
+
map.debug._infoContainer = this._debugContainer = DomUtil.create(
|
|
74
|
+
'tbody',
|
|
75
|
+
'mapml-debug-panel',
|
|
76
|
+
this.options.pane
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
let infoContainer = map.debug._infoContainer;
|
|
80
|
+
|
|
81
|
+
map.debug._tileCoord = DomUtil.create(
|
|
82
|
+
'tr',
|
|
83
|
+
'mapml-debug-coordinates',
|
|
84
|
+
infoContainer
|
|
85
|
+
);
|
|
86
|
+
map.debug._tileMatrixCoord = DomUtil.create(
|
|
87
|
+
'tr',
|
|
88
|
+
'mapml-debug-coordinates',
|
|
89
|
+
infoContainer
|
|
90
|
+
);
|
|
91
|
+
map.debug._mapCoord = DomUtil.create(
|
|
92
|
+
'tr',
|
|
93
|
+
'mapml-debug-coordinates',
|
|
94
|
+
infoContainer
|
|
95
|
+
);
|
|
96
|
+
map.debug._tcrsCoord = DomUtil.create(
|
|
97
|
+
'tr',
|
|
98
|
+
'mapml-debug-coordinates',
|
|
99
|
+
infoContainer
|
|
100
|
+
);
|
|
101
|
+
map.debug._pcrsCoord = DomUtil.create(
|
|
102
|
+
'tr',
|
|
103
|
+
'mapml-debug-coordinates',
|
|
104
|
+
infoContainer
|
|
105
|
+
);
|
|
106
|
+
map.debug._gcrsCoord = DomUtil.create(
|
|
107
|
+
'tr',
|
|
108
|
+
'mapml-debug-coordinates',
|
|
109
|
+
infoContainer
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
this._map.on('mousemove', this._updateCoords);
|
|
113
|
+
},
|
|
114
|
+
onRemove: function () {
|
|
115
|
+
DomUtil.remove(this._title);
|
|
116
|
+
if (this._debugContainer) {
|
|
117
|
+
DomUtil.remove(this._debugContainer);
|
|
118
|
+
this._map.off('mousemove', this._updateCoords);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
_updateCoords: function (e) {
|
|
122
|
+
if (this.contextMenu._visible) return;
|
|
123
|
+
let mapEl = this.options.mapEl,
|
|
124
|
+
pointCoords = mapEl._map.project(e.latlng),
|
|
125
|
+
scale = mapEl._map.options.crs.scale(+mapEl.zoom),
|
|
126
|
+
pcrs = mapEl._map.options.crs.transformation.untransform(
|
|
127
|
+
pointCoords,
|
|
128
|
+
scale
|
|
129
|
+
),
|
|
130
|
+
tileSize = mapEl._map.options.crs.options.crs.tile.bounds.max.x,
|
|
131
|
+
pointI = pointCoords.x % tileSize,
|
|
132
|
+
pointJ = pointCoords.y % tileSize;
|
|
133
|
+
|
|
134
|
+
if (pointI < 0) pointI += tileSize;
|
|
135
|
+
if (pointJ < 0) pointJ += tileSize;
|
|
136
|
+
|
|
137
|
+
this.debug._tileCoord.innerHTML = `
|
|
138
|
+
<th scope="row">tile: </th>
|
|
139
|
+
<td>i: ${Math.trunc(pointI)}, </td>
|
|
140
|
+
<td>j: ${Math.trunc(pointJ)}</td>
|
|
141
|
+
`;
|
|
142
|
+
this.debug._mapCoord.innerHTML = `
|
|
143
|
+
<th scope="row">map: </th>
|
|
144
|
+
<td>i: ${Math.trunc(e.containerPoint.x)}, </td>
|
|
145
|
+
<td>j: ${Math.trunc(e.containerPoint.y)}</td>
|
|
146
|
+
`;
|
|
147
|
+
this.debug._gcrsCoord.innerHTML = `
|
|
148
|
+
<th scope="row">gcrs: </th>
|
|
149
|
+
<td>lon: ${e.latlng.lng.toFixed(6)}, </td>
|
|
150
|
+
<td>lat: ${e.latlng.lat.toFixed(6)}</td>
|
|
151
|
+
`;
|
|
152
|
+
this.debug._tcrsCoord.innerHTML = `
|
|
153
|
+
<th scope="row">tcrs: </th>
|
|
154
|
+
<td>x: ${Math.trunc(pointCoords.x)}, </td>
|
|
155
|
+
<td>y: ${Math.trunc(pointCoords.y)}</td>
|
|
156
|
+
`;
|
|
157
|
+
this.debug._tileMatrixCoord.innerHTML = `
|
|
158
|
+
<th scope="row">tilematrix: </th>
|
|
159
|
+
<td>column: ${Math.trunc(pointCoords.x / tileSize)}, </td>
|
|
160
|
+
<td>row: ${Math.trunc(pointCoords.y / tileSize)}</td>
|
|
161
|
+
`;
|
|
162
|
+
this.debug._pcrsCoord.innerHTML = `
|
|
163
|
+
<th scope="row">pcrs: </th>
|
|
164
|
+
<td>easting: ${pcrs.x.toFixed(2)}, </td>
|
|
165
|
+
<td>northing: ${pcrs.y.toFixed(2)}</td>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
export var debugPanel = function (options) {
|
|
171
|
+
return new DebugPanel(options);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export var DebugGrid = GridLayer.extend({
|
|
175
|
+
initialize: function (options) {
|
|
176
|
+
setOptions(this, options);
|
|
177
|
+
GridLayer.prototype.initialize.call(this, this._map);
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
createTile: function (coords) {
|
|
181
|
+
let tile = DomUtil.create('div', 'mapml-debug-tile');
|
|
182
|
+
tile.setAttribute('col', coords.x);
|
|
183
|
+
tile.setAttribute('row', coords.y);
|
|
184
|
+
tile.setAttribute('zoom', coords.z);
|
|
185
|
+
tile.innerHTML = [
|
|
186
|
+
`col: ${coords.x}`,
|
|
187
|
+
`row: ${coords.y}`,
|
|
188
|
+
`zoom: ${coords.z}`
|
|
189
|
+
].join(', ');
|
|
190
|
+
|
|
191
|
+
tile.style.outline = '1px dashed red';
|
|
192
|
+
return tile;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export var debugGrid = function (options) {
|
|
197
|
+
return new DebugGrid(options);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export var DebugVectors = LayerGroup.extend({
|
|
201
|
+
initialize: function (options) {
|
|
202
|
+
setOptions(this, options);
|
|
203
|
+
LayerGroup.prototype.initialize.call(this, this._map, options);
|
|
204
|
+
},
|
|
205
|
+
onAdd: function (map) {
|
|
206
|
+
map.on('overlayremove', this._mapLayerUpdate, this);
|
|
207
|
+
map.on('overlayadd', this._mapLayerUpdate, this);
|
|
208
|
+
let center = map.options.crs.transformation.transform(
|
|
209
|
+
point(0, 0),
|
|
210
|
+
map.options.crs.scale(0)
|
|
211
|
+
);
|
|
212
|
+
this._centerVector = circle(map.options.crs.pointToLatLng(center, 0), {
|
|
213
|
+
radius: 250,
|
|
214
|
+
className: 'mapml-debug-vectors projection-centre'
|
|
215
|
+
});
|
|
216
|
+
this._centerVector.bindTooltip('Projection Center');
|
|
217
|
+
|
|
218
|
+
this._addBounds(map);
|
|
219
|
+
},
|
|
220
|
+
onRemove: function (map) {
|
|
221
|
+
this.clearLayers();
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
_addBounds: function (map) {
|
|
225
|
+
// to delay the addBounds to wait for the layer.extentbounds / layer.layerbounds to be ready when the map-layer checked attribute is changed
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
let id = Object.keys(map._layers),
|
|
228
|
+
layers = map._layers,
|
|
229
|
+
colors = ['#FF5733', '#8DFF33', '#3397FF', '#E433FF', '#F3FF33'],
|
|
230
|
+
j = 0;
|
|
231
|
+
|
|
232
|
+
this.addLayer(this._centerVector);
|
|
233
|
+
|
|
234
|
+
for (let i of id) {
|
|
235
|
+
if (layers[i].layerBounds || layers[i].extentBounds) {
|
|
236
|
+
let boundsArray;
|
|
237
|
+
if (layers[i].layerBounds) {
|
|
238
|
+
boundsArray = [
|
|
239
|
+
layers[i].layerBounds.min,
|
|
240
|
+
point(layers[i].layerBounds.max.x, layers[i].layerBounds.min.y),
|
|
241
|
+
layers[i].layerBounds.max,
|
|
242
|
+
point(layers[i].layerBounds.min.x, layers[i].layerBounds.max.y)
|
|
243
|
+
];
|
|
244
|
+
} else {
|
|
245
|
+
boundsArray = [
|
|
246
|
+
layers[i].extentBounds.min,
|
|
247
|
+
point(layers[i].extentBounds.max.x, layers[i].extentBounds.min.y),
|
|
248
|
+
layers[i].extentBounds.max,
|
|
249
|
+
point(layers[i].extentBounds.min.x, layers[i].extentBounds.max.y)
|
|
250
|
+
];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// boundsTestTag adds the value of from the <map-layer@data-testid> element
|
|
254
|
+
// if it exists. this simplifies debugging because the svg path will be
|
|
255
|
+
// tagged with the layer it came from
|
|
256
|
+
let boundsTestTag =
|
|
257
|
+
layers[i].extentBounds &&
|
|
258
|
+
layers[i].options.linkEl.getLayerEl().hasAttribute('data-testid')
|
|
259
|
+
? layers[i].options.linkEl
|
|
260
|
+
.getLayerEl()
|
|
261
|
+
.getAttribute('data-testid')
|
|
262
|
+
: layers[i].layerBounds &&
|
|
263
|
+
layers[i].options?._leafletLayer?._layerEl?.hasAttribute(
|
|
264
|
+
'data-testid'
|
|
265
|
+
)
|
|
266
|
+
? layers[i].options._leafletLayer._layerEl.getAttribute(
|
|
267
|
+
'data-testid'
|
|
268
|
+
)
|
|
269
|
+
: '';
|
|
270
|
+
let boundsRect = projectedExtent(boundsArray, {
|
|
271
|
+
className: this.options.className.concat(' ', boundsTestTag),
|
|
272
|
+
color: colors[j % colors.length],
|
|
273
|
+
weight: 2,
|
|
274
|
+
opacity: 1,
|
|
275
|
+
fillOpacity: 0.01,
|
|
276
|
+
fill: true
|
|
277
|
+
});
|
|
278
|
+
if (layers[i].options._leafletLayer)
|
|
279
|
+
boundsRect.bindTooltip(layers[i].options._leafletLayer._title, {
|
|
280
|
+
sticky: true
|
|
281
|
+
});
|
|
282
|
+
this.addLayer(boundsRect);
|
|
283
|
+
j++;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (map.totalLayerBounds) {
|
|
288
|
+
let totalBoundsArray = [
|
|
289
|
+
map.totalLayerBounds.min,
|
|
290
|
+
point(map.totalLayerBounds.max.x, map.totalLayerBounds.min.y),
|
|
291
|
+
map.totalLayerBounds.max,
|
|
292
|
+
point(map.totalLayerBounds.min.x, map.totalLayerBounds.max.y)
|
|
293
|
+
];
|
|
294
|
+
|
|
295
|
+
let totalBounds = projectedExtent(totalBoundsArray, {
|
|
296
|
+
className: 'mapml-debug-vectors mapml-total-bounds',
|
|
297
|
+
color: '#808080',
|
|
298
|
+
weight: 5,
|
|
299
|
+
opacity: 0.5,
|
|
300
|
+
fill: false
|
|
301
|
+
});
|
|
302
|
+
this.addLayer(totalBounds);
|
|
303
|
+
}
|
|
304
|
+
}, 0);
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
_mapLayerUpdate: function (e) {
|
|
308
|
+
this.clearLayers();
|
|
309
|
+
this._addBounds(e.target);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
export var debugVectors = function (options) {
|
|
314
|
+
return new DebugVectors(options);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
var ProjectedExtent = Path.extend({
|
|
318
|
+
getCenter: function (round) {
|
|
319
|
+
let crs = this._map.options.crs;
|
|
320
|
+
return crs.unproject(bounds(this._locations).getCenter());
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
options: {
|
|
324
|
+
className: 'mapml-debug-extent'
|
|
325
|
+
},
|
|
326
|
+
initialize: function (locations, options) {
|
|
327
|
+
//locations passed in as pcrs coordinates
|
|
328
|
+
this._locations = locations;
|
|
329
|
+
setOptions(this, options);
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
_project: function () {
|
|
333
|
+
this._rings = [];
|
|
334
|
+
let scale = this._map.options.crs.scale(this._map.getZoom()),
|
|
335
|
+
map = this._map;
|
|
336
|
+
for (let i = 0; i < this._locations.length; i++) {
|
|
337
|
+
let pt0 = map.options.crs.transformation.transform(
|
|
338
|
+
this._locations[i],
|
|
339
|
+
scale
|
|
340
|
+
);
|
|
341
|
+
//substract the pixel origin from the pixel coordinates to get the location relative to map viewport
|
|
342
|
+
this._rings.push(point(pt0.x, pt0.y)._subtract(map.getPixelOrigin()));
|
|
343
|
+
}
|
|
344
|
+
//leaflet SVG renderer looks for and array of arrays to build polygons,
|
|
345
|
+
//in this case it only deals with a rectangle so one closed array or points
|
|
346
|
+
this._parts = [this._rings];
|
|
347
|
+
},
|
|
348
|
+
|
|
349
|
+
_update: function () {
|
|
350
|
+
if (!this._map) return;
|
|
351
|
+
this._renderer._updatePoly(this, true); //passing true creates a closed path i.e. a rectangle
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
var projectedExtent = function (locations, options) {
|
|
356
|
+
return new ProjectedExtent(locations, options);
|
|
357
|
+
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { Layer, DomUtil, point, bounds } from 'leaflet';
|
|
2
|
+
import { Util } from '../Util.js';
|
|
3
|
+
|
|
4
|
+
export var FeatureIndexOverlay = Layer.extend({
|
|
5
|
+
onAdd: function (map) {
|
|
6
|
+
let svgInnerHTML = `<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><path fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M0 0h100v100H0z" color="#000" overflow="visible"/></svg>`;
|
|
7
|
+
|
|
8
|
+
this._container = DomUtil.create(
|
|
9
|
+
'div',
|
|
10
|
+
'mapml-feature-index-box',
|
|
11
|
+
map._container
|
|
12
|
+
);
|
|
13
|
+
this._container.innerHTML = svgInnerHTML;
|
|
14
|
+
|
|
15
|
+
this._output = DomUtil.create(
|
|
16
|
+
'output',
|
|
17
|
+
'mapml-feature-index',
|
|
18
|
+
map._container
|
|
19
|
+
);
|
|
20
|
+
this._output.setAttribute('role', 'status');
|
|
21
|
+
this._output.setAttribute('aria-live', 'polite');
|
|
22
|
+
this._output.setAttribute('aria-atomic', 'true');
|
|
23
|
+
this._body = DomUtil.create(
|
|
24
|
+
'span',
|
|
25
|
+
'mapml-feature-index-content',
|
|
26
|
+
this._output
|
|
27
|
+
);
|
|
28
|
+
this._body.index = 0;
|
|
29
|
+
this._output.initialFocus = false;
|
|
30
|
+
map.on('focus blur popupclose', this._addOrRemoveFeatureIndex, this);
|
|
31
|
+
map.on('moveend focus templatedfeatureslayeradd', this._checkOverlap, this);
|
|
32
|
+
map.on('keydown', this._onKeyDown, this);
|
|
33
|
+
this._addOrRemoveFeatureIndex();
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
_calculateReticleBounds: function () {
|
|
37
|
+
let bnds = this._map.getPixelBounds();
|
|
38
|
+
let center = bnds.getCenter();
|
|
39
|
+
let wRatio =
|
|
40
|
+
Math.abs(bnds.min.x - bnds.max.x) / this._map.options.mapEl.width;
|
|
41
|
+
let hRatio =
|
|
42
|
+
Math.abs(bnds.min.y - bnds.max.y) / this._map.options.mapEl.height;
|
|
43
|
+
|
|
44
|
+
let reticleDimension = getComputedStyle(this._container).width.replace(
|
|
45
|
+
/[^\d.]/g,
|
|
46
|
+
''
|
|
47
|
+
);
|
|
48
|
+
if (getComputedStyle(this._container).width.slice(-1) === '%') {
|
|
49
|
+
reticleDimension =
|
|
50
|
+
(reticleDimension * this._map.options.mapEl.width) / 100;
|
|
51
|
+
}
|
|
52
|
+
let w = (wRatio * reticleDimension) / 2;
|
|
53
|
+
let h = (hRatio * reticleDimension) / 2;
|
|
54
|
+
let minPoint = point(center.x - w, center.y + h);
|
|
55
|
+
let maxPoint = point(center.x + w, center.y - h);
|
|
56
|
+
let b = bounds(minPoint, maxPoint);
|
|
57
|
+
return Util.pixelToPCRSBounds(
|
|
58
|
+
b,
|
|
59
|
+
this._map.getZoom(),
|
|
60
|
+
this._map.options.projection
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
_checkOverlap: function (e) {
|
|
65
|
+
if (e.type === 'focus') this._output.initialFocus = true;
|
|
66
|
+
if (!this._output.initialFocus) return;
|
|
67
|
+
if (this._output.popupClosed) {
|
|
68
|
+
this._output.popupClosed = false;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this._map.fire('mapkeyboardfocused');
|
|
73
|
+
|
|
74
|
+
let featureIndexBounds = this._calculateReticleBounds();
|
|
75
|
+
let features = this._map.featureIndex.inBoundFeatures;
|
|
76
|
+
let index = 1;
|
|
77
|
+
let keys = Object.keys(features);
|
|
78
|
+
let body = this._body;
|
|
79
|
+
let noFeaturesMessage = document.createElement('span');
|
|
80
|
+
noFeaturesMessage.innerHTML =
|
|
81
|
+
this._map.options.mapEl.locale.fIndexNoFeatures;
|
|
82
|
+
|
|
83
|
+
body.innerHTML = '';
|
|
84
|
+
body.index = 0;
|
|
85
|
+
|
|
86
|
+
body.allFeatures = [];
|
|
87
|
+
keys.forEach((i) => {
|
|
88
|
+
let layer = features[i].layer;
|
|
89
|
+
let layers = features[i].layer._layers;
|
|
90
|
+
let b = bounds();
|
|
91
|
+
|
|
92
|
+
if (layers) {
|
|
93
|
+
let keys = Object.keys(layers);
|
|
94
|
+
keys.forEach((j) => {
|
|
95
|
+
if (!b)
|
|
96
|
+
b = bounds(
|
|
97
|
+
layer._layers[j]._bounds.min,
|
|
98
|
+
layer._layers[j]._bounds.max
|
|
99
|
+
);
|
|
100
|
+
b.extend(layer._layers[j]._bounds.min);
|
|
101
|
+
b.extend(layer._layers[j]._bounds.max);
|
|
102
|
+
});
|
|
103
|
+
} else if (layer._bounds) {
|
|
104
|
+
b = bounds(layer._bounds.min, layer._bounds.max);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (featureIndexBounds.overlaps(b)) {
|
|
108
|
+
let label = features[i].path.getAttribute('aria-label');
|
|
109
|
+
|
|
110
|
+
if (index < 8) {
|
|
111
|
+
body.appendChild(this._updateOutput(label, index, index));
|
|
112
|
+
}
|
|
113
|
+
if (index % 7 === 0 || index === 1) {
|
|
114
|
+
body.allFeatures.push([]);
|
|
115
|
+
}
|
|
116
|
+
body.allFeatures[Math.floor((index - 1) / 7)].push({
|
|
117
|
+
label,
|
|
118
|
+
index,
|
|
119
|
+
layer
|
|
120
|
+
});
|
|
121
|
+
if (body.allFeatures[1] && body.allFeatures[1].length === 1) {
|
|
122
|
+
body.appendChild(this._updateOutput('More results', 0, 9));
|
|
123
|
+
}
|
|
124
|
+
index += 1;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
this._addToggleKeys();
|
|
128
|
+
if (index === 1) {
|
|
129
|
+
body.appendChild(noFeaturesMessage);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
_updateOutput: function (label, index, key) {
|
|
134
|
+
let span = document.createElement('span');
|
|
135
|
+
span.setAttribute('data-index', index);
|
|
136
|
+
//", " adds a brief auditory pause when a screen reader is reading through the feature index
|
|
137
|
+
//also prevents names with numbers + key from being combined when read
|
|
138
|
+
span.innerHTML = `<kbd>${key}</kbd>` + ' ' + label + '<span>, </span>';
|
|
139
|
+
return span;
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
_addToggleKeys: function () {
|
|
143
|
+
let allFeatures = this._body.allFeatures;
|
|
144
|
+
for (let i = 0; i < allFeatures.length; i++) {
|
|
145
|
+
if (allFeatures[i].length === 0) return;
|
|
146
|
+
if (allFeatures[i - 1]) {
|
|
147
|
+
let label = 'Previous results';
|
|
148
|
+
allFeatures[i].push({ label });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (allFeatures[i + 1] && allFeatures[i + 1].length > 0) {
|
|
152
|
+
let label = 'More results';
|
|
153
|
+
allFeatures[i].push({ label });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
_onKeyDown: function (e) {
|
|
159
|
+
let body = this._body;
|
|
160
|
+
let key = e.originalEvent.keyCode;
|
|
161
|
+
if (key >= 49 && key <= 55) {
|
|
162
|
+
if (!body.allFeatures[body.index]) return;
|
|
163
|
+
let feature = body.allFeatures[body.index][key - 49];
|
|
164
|
+
if (!feature) return;
|
|
165
|
+
let layer = feature.layer;
|
|
166
|
+
if (layer) {
|
|
167
|
+
this._map.featureIndex.currentIndex = feature.index - 1;
|
|
168
|
+
if (layer._popup) {
|
|
169
|
+
this._map.closePopup();
|
|
170
|
+
layer.openPopup();
|
|
171
|
+
} else layer.options.group.focus();
|
|
172
|
+
}
|
|
173
|
+
} else if (key === 56) {
|
|
174
|
+
this._newContent(body, -1);
|
|
175
|
+
} else if (key === 57) {
|
|
176
|
+
this._newContent(body, 1);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
_newContent: function (body, direction) {
|
|
181
|
+
let index = body.firstChild.getAttribute('data-index');
|
|
182
|
+
let newContent = body.allFeatures[Math.floor((index - 1) / 7 + direction)];
|
|
183
|
+
if (newContent && newContent.length > 0) {
|
|
184
|
+
body.innerHTML = '';
|
|
185
|
+
body.index += direction;
|
|
186
|
+
for (let i = 0; i < newContent.length; i++) {
|
|
187
|
+
let feature = newContent[i];
|
|
188
|
+
let index = feature.index ? feature.index : 0;
|
|
189
|
+
let key = i + 1;
|
|
190
|
+
if (feature.label === 'More results') key = 9;
|
|
191
|
+
if (feature.label === 'Previous results') key = 8;
|
|
192
|
+
body.appendChild(this._updateOutput(feature.label, index, key));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
_addOrRemoveFeatureIndex: function (e) {
|
|
198
|
+
//Toggle aria-hidden attribute so screen reader rereads the feature index on focus
|
|
199
|
+
if (!this._output.initialFocus) {
|
|
200
|
+
this._output.setAttribute('aria-hidden', 'true');
|
|
201
|
+
} else if (this._output.hasAttribute('aria-hidden')) {
|
|
202
|
+
let obj = this;
|
|
203
|
+
setTimeout(function () {
|
|
204
|
+
obj._output.removeAttribute('aria-hidden');
|
|
205
|
+
}, 100);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (e && e.type === 'popupclose') {
|
|
209
|
+
this._output.setAttribute('aria-hidden', 'true');
|
|
210
|
+
this._output.popupClosed = true;
|
|
211
|
+
} else if (e && e.type === 'focus') {
|
|
212
|
+
this._container.removeAttribute('hidden');
|
|
213
|
+
this._output.classList.remove('mapml-screen-reader-output');
|
|
214
|
+
// this is a very subtle branch. The event that gets handled below is a blur
|
|
215
|
+
// event, which happens to have the e.target._popup property
|
|
216
|
+
// when there will be a popup. Because blur gets handled here, it doesn't
|
|
217
|
+
// get handled in the next else if block, which would hide both the reticle
|
|
218
|
+
// and the index menu, and then recursively call this method with no event
|
|
219
|
+
// argument, which manipulates the aria-hidden attribute on the output
|
|
220
|
+
// in order to have the screenreader read its contents when the focus returns
|
|
221
|
+
// to (what exactly???).
|
|
222
|
+
} else if (e && e.target._popup) {
|
|
223
|
+
this._container.setAttribute('hidden', '');
|
|
224
|
+
} else if (e && e.type === 'blur') {
|
|
225
|
+
this._container.setAttribute('hidden', '');
|
|
226
|
+
this._output.classList.add('mapml-screen-reader-output');
|
|
227
|
+
this._output.initialFocus = false;
|
|
228
|
+
this._addOrRemoveFeatureIndex();
|
|
229
|
+
} else {
|
|
230
|
+
// this is the default block, called when no event is passed (recursive call)
|
|
231
|
+
this._container.setAttribute('hidden', '');
|
|
232
|
+
this._output.classList.add('mapml-screen-reader-output');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
export var featureIndexOverlay = function (options) {
|
|
238
|
+
return new FeatureIndexOverlay(options);
|
|
239
|
+
};
|