@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,485 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Path as LeafletPath,
|
|
3
|
+
setOptions,
|
|
4
|
+
DomEvent,
|
|
5
|
+
point,
|
|
6
|
+
bounds
|
|
7
|
+
} from 'leaflet';
|
|
8
|
+
|
|
9
|
+
import { Util } from '../Util.js';
|
|
10
|
+
/**
|
|
11
|
+
* M.Path is a extension of Path that understands mapml feature markup
|
|
12
|
+
* It converts the markup to the following structure (abstract enough to encompass all feature types) for example:
|
|
13
|
+
* this._outlinePath = HTMLElement;
|
|
14
|
+
* this._parts = [
|
|
15
|
+
* {
|
|
16
|
+
* path: HTMLElement,
|
|
17
|
+
* rings:[
|
|
18
|
+
* {points:[{x:1,y:1}, ...]},
|
|
19
|
+
* ...
|
|
20
|
+
* ],
|
|
21
|
+
* subrings:[
|
|
22
|
+
* {points:[{x:2, y:2}, ...], cls:"Span Class Name", path: HTMLElement,},
|
|
23
|
+
* ...
|
|
24
|
+
* ],
|
|
25
|
+
* cls:"className",
|
|
26
|
+
* },
|
|
27
|
+
* ...
|
|
28
|
+
* ];
|
|
29
|
+
*/
|
|
30
|
+
export var Path = LeafletPath.extend({
|
|
31
|
+
/**
|
|
32
|
+
* Initializes the M.Path
|
|
33
|
+
* @param {HTMLElement} markup - The markup representation of the feature
|
|
34
|
+
* @param {Object} options - The options of the feature
|
|
35
|
+
*/
|
|
36
|
+
initialize: function (markup, options) {
|
|
37
|
+
this.type = markup.tagName.toUpperCase();
|
|
38
|
+
|
|
39
|
+
if (this.type === 'MAP-POINT' || this.type === 'MAP-MULTIPOINT')
|
|
40
|
+
options.fillOpacity = 1;
|
|
41
|
+
|
|
42
|
+
if (options.wrappers.length > 0)
|
|
43
|
+
options = Object.assign(this._convertWrappers(options.wrappers), options);
|
|
44
|
+
setOptions(this, options);
|
|
45
|
+
|
|
46
|
+
this.group = this.options.group;
|
|
47
|
+
this.options.interactive =
|
|
48
|
+
this.options.link ||
|
|
49
|
+
(this.options.properties && this.options.onEachFeature);
|
|
50
|
+
|
|
51
|
+
this._parts = [];
|
|
52
|
+
this._markup = markup;
|
|
53
|
+
this.options.zoom = markup.zoom ?? this.options.nativeZoom;
|
|
54
|
+
|
|
55
|
+
this._convertMarkup();
|
|
56
|
+
|
|
57
|
+
if (markup.querySelector('map-span') || markup.querySelector('map-a')) {
|
|
58
|
+
this._generateOutlinePoints();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
this.isClosed = this._isClosed();
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Attaches link handler to the sub parts' paths
|
|
66
|
+
* @param {SVGElement} elem - The element to add listeners to, either path or g elements
|
|
67
|
+
* @param {Object} link - The link object that contains the url, type and target data
|
|
68
|
+
* @param leafletLayer
|
|
69
|
+
*/
|
|
70
|
+
attachLinkHandler: function (elem, link, leafletLayer) {
|
|
71
|
+
let dragStart,
|
|
72
|
+
container = document.createElement('div'),
|
|
73
|
+
p = document.createElement('p'),
|
|
74
|
+
hovered = false;
|
|
75
|
+
container.classList.add('mapml-link-preview');
|
|
76
|
+
container.appendChild(p);
|
|
77
|
+
elem.classList.add('map-a');
|
|
78
|
+
if (link.visited) elem.classList.add('map-a-visited');
|
|
79
|
+
elem.mousedown = (e) => (dragStart = { x: e.clientX, y: e.clientY });
|
|
80
|
+
DomEvent.on(elem, 'mousedown', elem.mousedown, this);
|
|
81
|
+
elem.mouseup = (e) => {
|
|
82
|
+
if (e.button !== 0) return; // don't trigger when button isn't left click
|
|
83
|
+
let onTop = true,
|
|
84
|
+
nextLayer = this.options._leafletLayer._layerEl.nextElementSibling;
|
|
85
|
+
while (nextLayer && onTop) {
|
|
86
|
+
if (
|
|
87
|
+
nextLayer.tagName &&
|
|
88
|
+
(nextLayer.tagName.toUpperCase() === 'MAP-LAYER' ||
|
|
89
|
+
nextLayer.tagName.toUpperCase() === 'LAYER-')
|
|
90
|
+
)
|
|
91
|
+
onTop = !(nextLayer.queryable && nextLayer.queryable());
|
|
92
|
+
nextLayer = nextLayer.nextElementSibling;
|
|
93
|
+
}
|
|
94
|
+
if (onTop && dragStart) {
|
|
95
|
+
//Util._handleLink gets called twice, once in the target phase on the path
|
|
96
|
+
//element, then in the bubble phase on the g element
|
|
97
|
+
//Using stopPropagation leaves the mouse in the mousedown state
|
|
98
|
+
if (e.eventPhase === Event.BUBBLING_PHASE) return;
|
|
99
|
+
let dist = Math.sqrt(
|
|
100
|
+
Math.pow(dragStart.x - e.clientX, 2) +
|
|
101
|
+
Math.pow(dragStart.y - e.clientY, 2)
|
|
102
|
+
);
|
|
103
|
+
if (dist <= 5) {
|
|
104
|
+
link.visited = true;
|
|
105
|
+
elem.setAttribute('stroke', '#6c00a2');
|
|
106
|
+
elem.classList.add('map-a-visited');
|
|
107
|
+
Util._handleLink(link, leafletLayer);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
DomEvent.on(elem, 'mouseup', elem.mouseup, this);
|
|
112
|
+
DomEvent.on(
|
|
113
|
+
elem,
|
|
114
|
+
'keypress',
|
|
115
|
+
(e) => {
|
|
116
|
+
DomEvent.stop(e);
|
|
117
|
+
if (e.keyCode === 13 || e.keyCode === 32) {
|
|
118
|
+
link.visited = true;
|
|
119
|
+
elem.setAttribute('stroke', '#6c00a2');
|
|
120
|
+
elem.classList.add('map-a-visited');
|
|
121
|
+
Util._handleLink(link, leafletLayer);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
this
|
|
125
|
+
);
|
|
126
|
+
DomEvent.on(
|
|
127
|
+
elem,
|
|
128
|
+
'mouseenter keyup',
|
|
129
|
+
(e) => {
|
|
130
|
+
if (e.target !== e.currentTarget) return;
|
|
131
|
+
hovered = true;
|
|
132
|
+
let resolver = document.createElement('a');
|
|
133
|
+
resolver.href = link.url;
|
|
134
|
+
p.innerHTML = resolver.href;
|
|
135
|
+
|
|
136
|
+
this._map.getContainer().appendChild(container);
|
|
137
|
+
|
|
138
|
+
// setTimeout(() => {
|
|
139
|
+
// if (hovered) p.innerHTML = resolver.href;
|
|
140
|
+
// }, 1000);
|
|
141
|
+
},
|
|
142
|
+
this
|
|
143
|
+
);
|
|
144
|
+
DomEvent.on(
|
|
145
|
+
elem,
|
|
146
|
+
'mouseout keydown mousedown',
|
|
147
|
+
(e) => {
|
|
148
|
+
if (e.target !== e.currentTarget || !container.parentElement) return;
|
|
149
|
+
hovered = false;
|
|
150
|
+
this._map.getContainer().removeChild(container);
|
|
151
|
+
},
|
|
152
|
+
this
|
|
153
|
+
);
|
|
154
|
+
leafletLayer.on('add', addMouseHandler, leafletLayer);
|
|
155
|
+
function handleMouse(e) {
|
|
156
|
+
//adds a lot of event handlers
|
|
157
|
+
if (!container.parentElement) return;
|
|
158
|
+
hovered = false;
|
|
159
|
+
this._map.getContainer().removeChild(container);
|
|
160
|
+
}
|
|
161
|
+
function addMouseHandler() {
|
|
162
|
+
DomEvent.on(
|
|
163
|
+
this._map.getContainer(),
|
|
164
|
+
'mouseout mouseenter click',
|
|
165
|
+
handleMouse,
|
|
166
|
+
this
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
leafletLayer.on('remove', removeMouseHandler, leafletLayer);
|
|
170
|
+
function removeMouseHandler() {
|
|
171
|
+
DomEvent.off(this._map.getContainer(), {
|
|
172
|
+
mouseout: handleMouse,
|
|
173
|
+
mouseenter: handleMouse,
|
|
174
|
+
click: handleMouse
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Updates internal structure of the feature to the new map state, the structure can be found in this._parts
|
|
181
|
+
* @param {Map} addedMap - The map that the feature is part of, can be left blank in the case of static features
|
|
182
|
+
* @param {Point} tileOrigin - The tile origin for the feature, if blank then it takes the maps pixel origin in the function
|
|
183
|
+
* @param {int} zoomingTo - The zoom the map is animating to, if left blank then it takes the map zoom, its provided because in templated tiles zoom is delayed
|
|
184
|
+
* @private
|
|
185
|
+
*/
|
|
186
|
+
_project: function (addedMap, tileOrigin = undefined, zoomingTo = undefined) {
|
|
187
|
+
let map = addedMap || this._map,
|
|
188
|
+
origin = tileOrigin || map.getPixelOrigin(),
|
|
189
|
+
zoom = zoomingTo === undefined ? map.getZoom() : zoomingTo;
|
|
190
|
+
for (let p of this._parts) {
|
|
191
|
+
p.pixelRings = this._convertRing(p.rings, map, origin, zoom);
|
|
192
|
+
for (let subP of p.subrings) {
|
|
193
|
+
subP.pixelSubrings = this._convertRing([subP], map, origin, zoom);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (!this._outline) return;
|
|
197
|
+
this.pixelOutline = [];
|
|
198
|
+
for (let o of this._outline) {
|
|
199
|
+
this.pixelOutline = this.pixelOutline.concat(
|
|
200
|
+
this._convertRing(o, map, origin, zoom)
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Converts the PCRS points to pixel points that can be used to create the SVG
|
|
207
|
+
* @param {Point[][]} r - Is the rings of a feature, either the mainParts, subParts or outline
|
|
208
|
+
* @param {Map} map - The map that the feature is part of
|
|
209
|
+
* @param {Point} origin - The origin used to calculate the pixel points
|
|
210
|
+
* @param {int} zoom - The current zoom level of the map
|
|
211
|
+
* @returns {Point[][]}
|
|
212
|
+
* @private
|
|
213
|
+
*/
|
|
214
|
+
_convertRing: function (r, map, origin, zoom) {
|
|
215
|
+
// TODO: Implement Ramer-Douglas-Peucer Algo for simplifying points
|
|
216
|
+
let scale = map.options.crs.scale(zoom),
|
|
217
|
+
parts = [];
|
|
218
|
+
for (let sub of r) {
|
|
219
|
+
let interm = [];
|
|
220
|
+
for (let p of sub.points) {
|
|
221
|
+
let conv = map.options.crs.transformation.transform(p, scale);
|
|
222
|
+
interm.push(point(conv.x, conv.y)._subtract(origin).round());
|
|
223
|
+
}
|
|
224
|
+
parts.push(interm);
|
|
225
|
+
}
|
|
226
|
+
return parts;
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Updates the features
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
_update: function () {
|
|
234
|
+
if (!this._map) return;
|
|
235
|
+
this._renderer._updateFeature(this);
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Converts the map-spans, a and divs around a geometry subtype into options for the feature
|
|
240
|
+
* @param {HTMLElement[]} elems - The current zoom level of the map
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
_convertWrappers: function (elems) {
|
|
244
|
+
if (!elems || elems.length === 0) return;
|
|
245
|
+
let classList = '',
|
|
246
|
+
output = {};
|
|
247
|
+
for (let elem of elems) {
|
|
248
|
+
if (elem.tagName.toUpperCase() !== 'MAP-A' && elem.className) {
|
|
249
|
+
classList += `${elem.className} `;
|
|
250
|
+
} else if (!output.link && elem.getAttribute('href')) {
|
|
251
|
+
let link = {};
|
|
252
|
+
link.url = elem.getAttribute('href');
|
|
253
|
+
if (elem.hasAttribute('target'))
|
|
254
|
+
link.target = elem.getAttribute('target');
|
|
255
|
+
if (elem.hasAttribute('type')) link.type = elem.getAttribute('type');
|
|
256
|
+
if (elem.hasAttribute('inplace')) link.inPlace = true;
|
|
257
|
+
output.link = link;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
output.className = `${classList} ${this.options.className}`.trim();
|
|
261
|
+
return output;
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Converts this._markup to the internal structure of features
|
|
266
|
+
* @private
|
|
267
|
+
*/
|
|
268
|
+
_convertMarkup: function () {
|
|
269
|
+
if (!this._markup) return;
|
|
270
|
+
|
|
271
|
+
let attr = this._markup.attributes;
|
|
272
|
+
this.featureAttributes = {};
|
|
273
|
+
if (
|
|
274
|
+
this.options.link &&
|
|
275
|
+
this._markup.parentElement.tagName.toUpperCase() === 'MAP-A' &&
|
|
276
|
+
this._markup.parentElement.parentElement.tagName.toUpperCase() !==
|
|
277
|
+
'MAP-GEOMETRY'
|
|
278
|
+
)
|
|
279
|
+
this.featureAttributes.tabindex = '0';
|
|
280
|
+
for (let i = 0; i < attr.length; i++) {
|
|
281
|
+
this.featureAttributes[attr[i].name] = attr[i].value;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
let first = true;
|
|
285
|
+
for (let c of this._markup.querySelectorAll('map-coordinates')) {
|
|
286
|
+
//loops through the coordinates of the child
|
|
287
|
+
let ring = [],
|
|
288
|
+
subRings = [];
|
|
289
|
+
this._coordinateToArrays(c, ring, subRings, this.options.className); //creates an array of pcrs points for the main ring and the subparts
|
|
290
|
+
if (!first && this.type === 'MAP-POLYGON') {
|
|
291
|
+
this._parts[0].rings.push(ring[0]);
|
|
292
|
+
if (subRings.length > 0)
|
|
293
|
+
this._parts[0].subrings = this._parts[0].subrings.concat(subRings);
|
|
294
|
+
} else if (this.type === 'MAP-MULTIPOINT') {
|
|
295
|
+
for (let pt of ring[0].points.concat(subRings)) {
|
|
296
|
+
this._parts.push({
|
|
297
|
+
rings: [{ points: [pt] }],
|
|
298
|
+
subrings: [],
|
|
299
|
+
cls: `${pt.cls || ''} ${this.options.className || ''}`.trim()
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
this._parts.push({
|
|
304
|
+
rings: ring,
|
|
305
|
+
subrings: subRings,
|
|
306
|
+
cls: `${this.featureAttributes.class || ''} ${
|
|
307
|
+
this.options.className || ''
|
|
308
|
+
}`.trim()
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
first = false;
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Generates the feature outline, subtracting the map-spans to generate those separately
|
|
317
|
+
* @private
|
|
318
|
+
*/
|
|
319
|
+
_generateOutlinePoints: function () {
|
|
320
|
+
if (
|
|
321
|
+
this.type === 'MAP-MULTIPOINT' ||
|
|
322
|
+
this.type === 'MAP-POINT' ||
|
|
323
|
+
this.type === 'MAP-LINESTRING' ||
|
|
324
|
+
this.type === 'MAP-MULTILINESTRING'
|
|
325
|
+
)
|
|
326
|
+
return;
|
|
327
|
+
|
|
328
|
+
this._outline = [];
|
|
329
|
+
for (let coords of this._markup.querySelectorAll('map-coordinates')) {
|
|
330
|
+
let nodes = coords.childNodes,
|
|
331
|
+
cur = 0,
|
|
332
|
+
tempDiv = document.createElement('div'),
|
|
333
|
+
nodeLength = nodes.length;
|
|
334
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
335
|
+
if (nodes[i].textContent.trim().length === 0) {
|
|
336
|
+
nodes[i].remove();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
for (let n of nodes) {
|
|
340
|
+
let line = [];
|
|
341
|
+
if (!n.tagName) {
|
|
342
|
+
//no tagName means it's text content
|
|
343
|
+
let c = '',
|
|
344
|
+
ind = (((cur - 1) % nodes.length) + nodes.length) % nodes.length; // this equation turns Javascript's % to how it behaves in C for example
|
|
345
|
+
if (nodes[ind].tagName) {
|
|
346
|
+
let prev = nodes[ind].textContent.trim().split(/\s+/);
|
|
347
|
+
c += `${prev[prev.length - 2]} ${prev[prev.length - 1]} `;
|
|
348
|
+
}
|
|
349
|
+
c += n.textContent;
|
|
350
|
+
ind = (((cur + 1) % nodes.length) + nodes.length) % nodes.length; // this is equivalent to C/C++'s (cur + 1) % nodes.length
|
|
351
|
+
if (nodes[ind].tagName) {
|
|
352
|
+
let next = nodes[ind].textContent.trim().split(/\s+/);
|
|
353
|
+
c += ` ${next[0]} ${next[1]} `;
|
|
354
|
+
}
|
|
355
|
+
tempDiv.innerHTML = c;
|
|
356
|
+
this._coordinateToArrays(
|
|
357
|
+
tempDiv,
|
|
358
|
+
line,
|
|
359
|
+
[],
|
|
360
|
+
true,
|
|
361
|
+
this.featureAttributes.class || this.options.className
|
|
362
|
+
);
|
|
363
|
+
this._outline.push(line);
|
|
364
|
+
}
|
|
365
|
+
cur++;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Converts map-coordinates element to an object representing the parts and subParts
|
|
372
|
+
* @param {HTMLElement} coords - A single map-coordinates element
|
|
373
|
+
* @param {Object[]} main - An empty array representing the main parts
|
|
374
|
+
* @param {Object[]} subParts - An empty array representing the sub parts
|
|
375
|
+
* @param {boolean} isFirst - A true | false representing if the current HTML element is the parent map-coordinates element or not
|
|
376
|
+
* @param {string} cls - The class of the coordinate/span
|
|
377
|
+
* @param parents
|
|
378
|
+
* @private
|
|
379
|
+
*/
|
|
380
|
+
_coordinateToArrays: function (
|
|
381
|
+
coords,
|
|
382
|
+
main,
|
|
383
|
+
subParts,
|
|
384
|
+
isFirst = true,
|
|
385
|
+
cls = undefined,
|
|
386
|
+
parents = []
|
|
387
|
+
) {
|
|
388
|
+
for (let span of coords.children) {
|
|
389
|
+
this._coordinateToArrays(
|
|
390
|
+
span,
|
|
391
|
+
main,
|
|
392
|
+
subParts,
|
|
393
|
+
false,
|
|
394
|
+
span.getAttribute('class'),
|
|
395
|
+
parents.concat([span])
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
let noSpan = coords.textContent.replace(/(<([^>]+)>)/gi, ''),
|
|
399
|
+
pairs = noSpan.trim().match(/(\S+\s+\S+)/gim),
|
|
400
|
+
local = [],
|
|
401
|
+
bnds;
|
|
402
|
+
for (let p of pairs) {
|
|
403
|
+
let numPair = [];
|
|
404
|
+
p.split(/\s+/gim).forEach(Util._parseNumber, numPair);
|
|
405
|
+
let pt = Util.pointToPCRSPoint(
|
|
406
|
+
point(numPair),
|
|
407
|
+
this.options.zoom,
|
|
408
|
+
this.options.projection,
|
|
409
|
+
this.options.nativeCS
|
|
410
|
+
);
|
|
411
|
+
local.push(pt);
|
|
412
|
+
bnds = bnds ? bnds.extend(pt) : bounds(pt, pt);
|
|
413
|
+
}
|
|
414
|
+
if (this._bounds) {
|
|
415
|
+
this._bounds.extend(bnds.min);
|
|
416
|
+
this._bounds.extend(bnds.max);
|
|
417
|
+
} else {
|
|
418
|
+
this._bounds = bnds;
|
|
419
|
+
}
|
|
420
|
+
if (isFirst) {
|
|
421
|
+
main.push({ points: local });
|
|
422
|
+
} else {
|
|
423
|
+
let attrMap = {},
|
|
424
|
+
attr = coords.attributes,
|
|
425
|
+
wrapperAttr = this._convertWrappers(parents);
|
|
426
|
+
if (wrapperAttr.link) attrMap.tabindex = '0';
|
|
427
|
+
for (let i = 0; i < attr.length; i++) {
|
|
428
|
+
if (attr[i].name === 'class') continue;
|
|
429
|
+
attrMap[attr[i].name] = attr[i].value;
|
|
430
|
+
}
|
|
431
|
+
subParts.unshift({
|
|
432
|
+
points: local,
|
|
433
|
+
center: bnds.getCenter(),
|
|
434
|
+
cls: `${cls || ''} ${wrapperAttr.className || ''}`.trim(),
|
|
435
|
+
attr: attrMap,
|
|
436
|
+
link: wrapperAttr.link,
|
|
437
|
+
linkTarget: wrapperAttr.linkTarget,
|
|
438
|
+
linkType: wrapperAttr.linkType
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Returns if the feature is closed or open, useful when styling
|
|
445
|
+
* @returns {boolean}
|
|
446
|
+
* @private
|
|
447
|
+
*/
|
|
448
|
+
_isClosed: function () {
|
|
449
|
+
switch (this.type) {
|
|
450
|
+
case 'MAP-POLYGON':
|
|
451
|
+
case 'MAP-MULTIPOLYGON':
|
|
452
|
+
case 'MAP-POINT':
|
|
453
|
+
case 'MAP-MULTIPOINT':
|
|
454
|
+
return true;
|
|
455
|
+
case 'MAP-LINESTRING':
|
|
456
|
+
case 'MAP-MULTILINESTRING':
|
|
457
|
+
return false;
|
|
458
|
+
default:
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Returns the center of the entire feature
|
|
465
|
+
* @returns {Point}
|
|
466
|
+
*/
|
|
467
|
+
getCenter: function () {
|
|
468
|
+
if (!this._bounds) return null;
|
|
469
|
+
return this._map.options.crs.unproject(this._bounds.getCenter());
|
|
470
|
+
},
|
|
471
|
+
|
|
472
|
+
getPCRSCenter: function () {
|
|
473
|
+
return this._bounds.getCenter();
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
*
|
|
479
|
+
* @param {HTMLElement} markup - The markup of the feature
|
|
480
|
+
* @param {Object} options - Options of the feature
|
|
481
|
+
* @returns {M.Path}
|
|
482
|
+
*/
|
|
483
|
+
export var path = function (markup, options) {
|
|
484
|
+
return new Path(markup, options);
|
|
485
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Handler } from 'leaflet';
|
|
2
|
+
import { Util } from '../Util.js';
|
|
3
|
+
export var AnnounceMovement = Handler.extend({
|
|
4
|
+
addHooks: function () {
|
|
5
|
+
this._map.on({
|
|
6
|
+
layeradd: this.totalBounds,
|
|
7
|
+
layerremove: this.totalBounds
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
this._map.options.mapEl.addEventListener(
|
|
11
|
+
'map-moveend',
|
|
12
|
+
this.announceBounds
|
|
13
|
+
);
|
|
14
|
+
this._map.dragging._draggable.addEventListener('dragstart', this.dragged);
|
|
15
|
+
this._map.options.mapEl.addEventListener(
|
|
16
|
+
'mapfocused',
|
|
17
|
+
this.focusAnnouncement
|
|
18
|
+
);
|
|
19
|
+
},
|
|
20
|
+
removeHooks: function () {
|
|
21
|
+
this._map.off({
|
|
22
|
+
layeradd: this.totalBounds,
|
|
23
|
+
layerremove: this.totalBounds
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
this._map.options.mapEl.removeEventListener(
|
|
27
|
+
'map-moveend',
|
|
28
|
+
this.announceBounds
|
|
29
|
+
);
|
|
30
|
+
this._map.dragging._draggable.removeEventListener(
|
|
31
|
+
'dragstart',
|
|
32
|
+
this.dragged
|
|
33
|
+
);
|
|
34
|
+
this._map.options.mapEl.removeEventListener(
|
|
35
|
+
'mapfocused',
|
|
36
|
+
this.focusAnnouncement
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
focusAnnouncement: function () {
|
|
41
|
+
let mapEl = this;
|
|
42
|
+
let locale = this.locale;
|
|
43
|
+
setTimeout(function () {
|
|
44
|
+
let el = mapEl.querySelector('.mapml-web-map')
|
|
45
|
+
? mapEl
|
|
46
|
+
.querySelector('.mapml-web-map')
|
|
47
|
+
.shadowRoot.querySelector('.leaflet-container')
|
|
48
|
+
: mapEl.shadowRoot.querySelector('.leaflet-container');
|
|
49
|
+
|
|
50
|
+
let mapZoom = mapEl._map.getZoom();
|
|
51
|
+
let standard = locale.amZoom + ' ' + mapZoom;
|
|
52
|
+
|
|
53
|
+
if (mapZoom === mapEl._map.getMaxZoom()) {
|
|
54
|
+
standard = locale.amMaxZoom + ' ' + standard;
|
|
55
|
+
} else if (mapZoom === mapEl._map._layersMinZoom) {
|
|
56
|
+
standard = locale.amMinZoom + ' ' + standard;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
el.setAttribute('aria-roledescription', 'region ' + standard);
|
|
60
|
+
setTimeout(function () {
|
|
61
|
+
el.removeAttribute('aria-roledescription');
|
|
62
|
+
}, 2000);
|
|
63
|
+
}, 0);
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
announceBounds: function () {
|
|
67
|
+
if (this._traversalCall > 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let locale = this.locale;
|
|
71
|
+
let mapZoom = this._map.getZoom();
|
|
72
|
+
let mapBounds = Util.pixelToPCRSBounds(
|
|
73
|
+
this._map.getPixelBounds(),
|
|
74
|
+
mapZoom,
|
|
75
|
+
this._map.options.projection
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
let visible = true;
|
|
79
|
+
if (this._map.totalLayerBounds) {
|
|
80
|
+
visible =
|
|
81
|
+
mapZoom <= this._map.getMaxZoom() &&
|
|
82
|
+
mapZoom >= this._map.getMinZoom() &&
|
|
83
|
+
this._map.totalLayerBounds.overlaps(mapBounds);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let output = this.querySelector('.mapml-web-map')
|
|
87
|
+
? this.querySelector('.mapml-web-map').shadowRoot.querySelector(
|
|
88
|
+
'.mapml-screen-reader-output'
|
|
89
|
+
)
|
|
90
|
+
: this.shadowRoot.querySelector('.mapml-screen-reader-output');
|
|
91
|
+
|
|
92
|
+
let standard = locale.amZoom + ' ' + mapZoom;
|
|
93
|
+
|
|
94
|
+
if (!visible) {
|
|
95
|
+
let outOfBoundsPos = this._history[this._historyIndex];
|
|
96
|
+
let inBoundsPos = this._history[this._historyIndex - 1];
|
|
97
|
+
this.back();
|
|
98
|
+
this._history.pop();
|
|
99
|
+
|
|
100
|
+
if (outOfBoundsPos.zoom !== inBoundsPos.zoom) {
|
|
101
|
+
output.innerText = locale.amZoomedOut;
|
|
102
|
+
} else if (this._map.dragging._draggable.wasDragged) {
|
|
103
|
+
output.innerText = locale.amDraggedOut;
|
|
104
|
+
} else if (outOfBoundsPos.x > inBoundsPos.x) {
|
|
105
|
+
output.innerText = locale.amEastBound;
|
|
106
|
+
} else if (outOfBoundsPos.x < inBoundsPos.x) {
|
|
107
|
+
output.innerText = locale.amWestBound;
|
|
108
|
+
} else if (outOfBoundsPos.y < inBoundsPos.y) {
|
|
109
|
+
output.innerText = locale.amNorthBound;
|
|
110
|
+
} else if (outOfBoundsPos.y > inBoundsPos.y) {
|
|
111
|
+
output.innerText = locale.amSouthBound;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
let prevZoom = this._history[this._historyIndex - 1]
|
|
115
|
+
? this._history[this._historyIndex - 1].zoom
|
|
116
|
+
: this._history[this._historyIndex].zoom;
|
|
117
|
+
if (mapZoom === this._map.getMaxZoom() && mapZoom !== prevZoom) {
|
|
118
|
+
output.innerText = locale.amMaxZoom + ' ' + standard;
|
|
119
|
+
} else if (mapZoom === this._map._layersMinZoom && mapZoom !== prevZoom) {
|
|
120
|
+
output.innerText = locale.amMinZoom + ' ' + standard;
|
|
121
|
+
} else {
|
|
122
|
+
output.innerText = standard;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
this._map.dragging._draggable.wasDragged = false;
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
totalBounds: function (e) {
|
|
129
|
+
// don't bother with non-MapLayer layers...
|
|
130
|
+
if (!e.layer._layerEl) return;
|
|
131
|
+
let map = this.options.mapEl;
|
|
132
|
+
map.whenLayersReady().then(() => {
|
|
133
|
+
let layers = map.querySelectorAll('map-layer,layer-');
|
|
134
|
+
let bounds;
|
|
135
|
+
for (let i = 0; i < layers.length; i++) {
|
|
136
|
+
// the _layer may no longer exist if this is invoked by layerremove
|
|
137
|
+
if (layers[i]._layer) {
|
|
138
|
+
let extent = layers[i].extent;
|
|
139
|
+
if (bounds && extent) {
|
|
140
|
+
bounds.extend(Util.extentToBounds(extent, 'pcrs'));
|
|
141
|
+
} else if (extent) {
|
|
142
|
+
bounds = Util.extentToBounds(extent, 'pcrs');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.totalLayerBounds = bounds;
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
dragged: function () {
|
|
152
|
+
this.wasDragged = true;
|
|
153
|
+
}
|
|
154
|
+
});
|