@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,991 @@
|
|
|
1
|
+
import { l as leafletSrcExports, r as registerInstance, g as getElement, U as Util } from './index-BUsJ7i5g.js';
|
|
2
|
+
import { r as renderStyles } from './renderStyles-EYVT9Efh.js';
|
|
3
|
+
import { c as calculatePosition } from './calculatePosition-B4YLD_Og.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Leaflet layer implementing map-extent elements
|
|
7
|
+
* Extends LayerGroup to create a single layer containing "templated" layers
|
|
8
|
+
* from child map-link[@tref] elements
|
|
9
|
+
*
|
|
10
|
+
* Similar in intent to MapFeatureLayer and MapTileLayer, which are LayerGroup or
|
|
11
|
+
* GridLayer for map-feature and map-tile elements' leaflet layer object, respectively.
|
|
12
|
+
*
|
|
13
|
+
* This layer will be inserted into the LayerGroup hosted by the <map-layer>
|
|
14
|
+
* immediately after creation, so that its index within the _layers array of
|
|
15
|
+
* that LayerGroup will be equal to its z-index within the LayerGroup's container
|
|
16
|
+
*
|
|
17
|
+
* <map-tile row="10" col="12" src="url1"></map-tile> LayerGroup._layers[0] <- each *set* of adjacent tiles
|
|
18
|
+
* <map-tile row="11" col="12" src="url2"></map-tile> LayerGroup._layers[0] <- is a *single* MapTileLayer
|
|
19
|
+
* <map-extent units="OSMTILE" checked hidden> LayerGroup._layers[1] *each* <map-extent> is a LayerGroup of Templated*Layer.js
|
|
20
|
+
* <map-feature id="a"> LayerGroup._layers[2] <- each *set* of adjacent features
|
|
21
|
+
* <map-feature id="b"> LayerGroup._layers[2] <- is a single MapFeatureLayer FeatureGroup
|
|
22
|
+
* <map-tile row="10" col="12" src="url3"></map-tile> LayerGroup._layers[3]
|
|
23
|
+
* <map-tile row="11" col="12" src="url4"></map-tile> LayerGroup._layers[3]
|
|
24
|
+
* <map-feature id="c"> LayerGroup._layers[4]
|
|
25
|
+
* <map-feature id="d"> LayerGroup._layers[4]
|
|
26
|
+
* and so on
|
|
27
|
+
*
|
|
28
|
+
* A constraint of <map-extent> is that it cannot be nested inside a templated
|
|
29
|
+
* layer i.e. if a <map-link> retrieves a text/mapml document that contains a
|
|
30
|
+
* <map-extent>, it will be ignored, otherwise there could be infinite nested
|
|
31
|
+
* fetches triggered. That is why the "TemplatedFeaturesOrTilesLayer" exists - it
|
|
32
|
+
* excludes <map-extent> elements.
|
|
33
|
+
*/
|
|
34
|
+
var MapExtentLayer = leafletSrcExports.LayerGroup.extend({
|
|
35
|
+
initialize: function (options) {
|
|
36
|
+
// Call LayerGroup's initialize to trigger Leaflet's setup
|
|
37
|
+
leafletSrcExports.LayerGroup.prototype.initialize.call(this, null, options);
|
|
38
|
+
this._container = leafletSrcExports.DomUtil.create('div', 'leaflet-layer');
|
|
39
|
+
this._extentEl = this.options.extentEl;
|
|
40
|
+
this.changeOpacity(this.options.opacity);
|
|
41
|
+
this.setZIndex(options.zIndex);
|
|
42
|
+
// Add class to the container
|
|
43
|
+
leafletSrcExports.DomUtil.addClass(this._container, 'mapml-extentlayer-container');
|
|
44
|
+
},
|
|
45
|
+
getEvents: function () {
|
|
46
|
+
return {
|
|
47
|
+
zoomstart: this._onZoomStart
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
_onZoomStart: function () {
|
|
51
|
+
this.closePopup();
|
|
52
|
+
},
|
|
53
|
+
getContainer: function () {
|
|
54
|
+
return this._container;
|
|
55
|
+
},
|
|
56
|
+
onAdd: function (map) {
|
|
57
|
+
leafletSrcExports.LayerGroup.prototype.onAdd.call(this, map);
|
|
58
|
+
let pane = this.options.extentEl.parentLayer._layer._container;
|
|
59
|
+
pane.appendChild(this._container);
|
|
60
|
+
},
|
|
61
|
+
redraw: function () {
|
|
62
|
+
this.eachLayer(function (layer) {
|
|
63
|
+
layer.redraw();
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
setZIndex: function (zIndex) {
|
|
67
|
+
this.options.zIndex = zIndex;
|
|
68
|
+
this._updateZIndex();
|
|
69
|
+
|
|
70
|
+
return this;
|
|
71
|
+
},
|
|
72
|
+
_updateZIndex: function () {
|
|
73
|
+
if (
|
|
74
|
+
this._container &&
|
|
75
|
+
this.options.zIndex !== undefined &&
|
|
76
|
+
this.options.zIndex !== null
|
|
77
|
+
) {
|
|
78
|
+
this._container.style.zIndex = this.options.zIndex;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onRemove: function () {
|
|
82
|
+
leafletSrcExports.LayerGroup.prototype.onRemove.call(this, this._map);
|
|
83
|
+
leafletSrcExports.DomUtil.remove(this._container);
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
_previousFeature: function (e) {
|
|
87
|
+
if (this._count + -1 >= 0) {
|
|
88
|
+
this._count--;
|
|
89
|
+
this._map.fire('featurepagination', {
|
|
90
|
+
i: this._count,
|
|
91
|
+
popup: this
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
_nextFeature: function (e) {
|
|
97
|
+
if (this._count + 1 < this._source._totalFeatureCount) {
|
|
98
|
+
this._count++;
|
|
99
|
+
this._map.fire('featurepagination', {
|
|
100
|
+
i: this._count,
|
|
101
|
+
popup: this
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
changeOpacity: function (opacity) {
|
|
107
|
+
this._container.style.opacity = opacity;
|
|
108
|
+
this._extentEl._opacity = opacity;
|
|
109
|
+
if (this._extentEl._opacitySlider)
|
|
110
|
+
this._extentEl._opacitySlider.value = opacity;
|
|
111
|
+
},
|
|
112
|
+
renderStyles
|
|
113
|
+
});
|
|
114
|
+
var mapExtentLayer = function (options) {
|
|
115
|
+
return new MapExtentLayer(options);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
var createLayerControlExtentHTML = function () {
|
|
119
|
+
var extent = leafletSrcExports.DomUtil.create('fieldset', 'mapml-layer-extent'),
|
|
120
|
+
extentProperties = leafletSrcExports.DomUtil.create(
|
|
121
|
+
'div',
|
|
122
|
+
'mapml-layer-item-properties',
|
|
123
|
+
extent
|
|
124
|
+
),
|
|
125
|
+
extentSettings = leafletSrcExports.DomUtil.create('div', 'mapml-layer-item-settings', extent),
|
|
126
|
+
extentLabel = leafletSrcExports.DomUtil.create(
|
|
127
|
+
'label',
|
|
128
|
+
'mapml-layer-item-toggle',
|
|
129
|
+
extentProperties
|
|
130
|
+
),
|
|
131
|
+
input = leafletSrcExports.DomUtil.create('input'),
|
|
132
|
+
svgExtentControlIcon = leafletSrcExports.SVG.create('svg'),
|
|
133
|
+
extentControlPath1 = leafletSrcExports.SVG.create('path'),
|
|
134
|
+
extentControlPath2 = leafletSrcExports.SVG.create('path'),
|
|
135
|
+
extentNameIcon = leafletSrcExports.DomUtil.create('span'),
|
|
136
|
+
extentItemControls = leafletSrcExports.DomUtil.create(
|
|
137
|
+
'div',
|
|
138
|
+
'mapml-layer-item-controls',
|
|
139
|
+
extentProperties
|
|
140
|
+
),
|
|
141
|
+
opacityControl = leafletSrcExports.DomUtil.create(
|
|
142
|
+
'details',
|
|
143
|
+
'mapml-layer-item-details mapml-control-layers',
|
|
144
|
+
extentSettings
|
|
145
|
+
),
|
|
146
|
+
extentOpacitySummary = leafletSrcExports.DomUtil.create('summary', '', opacityControl),
|
|
147
|
+
mapEl = this.getMapEl(),
|
|
148
|
+
layerEl = this.getLayerEl(),
|
|
149
|
+
opacity = leafletSrcExports.DomUtil.create('input', '', opacityControl);
|
|
150
|
+
extentSettings.hidden = true;
|
|
151
|
+
extent.setAttribute('aria-grabbed', 'false');
|
|
152
|
+
|
|
153
|
+
// append the svg paths
|
|
154
|
+
svgExtentControlIcon.setAttribute('viewBox', '0 0 24 24');
|
|
155
|
+
svgExtentControlIcon.setAttribute('height', '22');
|
|
156
|
+
svgExtentControlIcon.setAttribute('width', '22');
|
|
157
|
+
extentControlPath1.setAttribute('d', 'M0 0h24v24H0z');
|
|
158
|
+
extentControlPath1.setAttribute('fill', 'none');
|
|
159
|
+
extentControlPath2.setAttribute(
|
|
160
|
+
'd',
|
|
161
|
+
'M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z'
|
|
162
|
+
);
|
|
163
|
+
svgExtentControlIcon.appendChild(extentControlPath1);
|
|
164
|
+
svgExtentControlIcon.appendChild(extentControlPath2);
|
|
165
|
+
|
|
166
|
+
let mapSelects = this.el.querySelectorAll('map-select');
|
|
167
|
+
if (mapSelects.length) {
|
|
168
|
+
// map-select Stencil components may not have initialized yet;
|
|
169
|
+
// wait for each to be ready before accessing selectdetails
|
|
170
|
+
Promise.all(
|
|
171
|
+
Array.from(mapSelects).map((s) => s.whenReady())
|
|
172
|
+
).then(() => {
|
|
173
|
+
var frag = document.createDocumentFragment();
|
|
174
|
+
for (var i = 0; i < mapSelects.length; i++) {
|
|
175
|
+
frag.appendChild(mapSelects[i].selectdetails);
|
|
176
|
+
}
|
|
177
|
+
extentSettings.appendChild(frag);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let removeExtentButton = leafletSrcExports.DomUtil.create(
|
|
182
|
+
'button',
|
|
183
|
+
'mapml-layer-item-remove-control',
|
|
184
|
+
extentItemControls
|
|
185
|
+
);
|
|
186
|
+
removeExtentButton.type = 'button';
|
|
187
|
+
removeExtentButton.title = mapEl.locale.lmRemoveExtent;
|
|
188
|
+
removeExtentButton.innerHTML = "<span aria-hidden='true'>✕</span>";
|
|
189
|
+
removeExtentButton.classList.add('mapml-button');
|
|
190
|
+
removeExtentButton.addEventListener('click', (e) => {
|
|
191
|
+
e.preventDefault();
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
this.el.remove();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
let extentsettingsButton = leafletSrcExports.DomUtil.create(
|
|
197
|
+
'button',
|
|
198
|
+
'mapml-layer-item-settings-control',
|
|
199
|
+
extentItemControls
|
|
200
|
+
);
|
|
201
|
+
extentsettingsButton.type = 'button';
|
|
202
|
+
extentsettingsButton.title = mapEl.locale.lmExtentSettings;
|
|
203
|
+
extentsettingsButton.setAttribute('aria-expanded', false);
|
|
204
|
+
extentsettingsButton.classList.add('mapml-button');
|
|
205
|
+
leafletSrcExports.DomEvent.on(
|
|
206
|
+
extentsettingsButton,
|
|
207
|
+
'click',
|
|
208
|
+
(e) => {
|
|
209
|
+
if (extentSettings.hidden === true) {
|
|
210
|
+
extentsettingsButton.setAttribute('aria-expanded', true);
|
|
211
|
+
extentSettings.hidden = false;
|
|
212
|
+
} else {
|
|
213
|
+
extentsettingsButton.setAttribute('aria-expanded', false);
|
|
214
|
+
extentSettings.hidden = true;
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
this
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
extentNameIcon.setAttribute('aria-hidden', true);
|
|
221
|
+
extentLabel.appendChild(input);
|
|
222
|
+
extentsettingsButton.appendChild(extentNameIcon);
|
|
223
|
+
extentNameIcon.appendChild(svgExtentControlIcon);
|
|
224
|
+
extentOpacitySummary.innerText = mapEl.locale.lcOpacity;
|
|
225
|
+
extentOpacitySummary.id =
|
|
226
|
+
'mapml-extent-item-opacity-' + leafletSrcExports.stamp(extentOpacitySummary);
|
|
227
|
+
opacity.setAttribute('type', 'range');
|
|
228
|
+
opacity.setAttribute('min', '0');
|
|
229
|
+
opacity.setAttribute('max', '1.0');
|
|
230
|
+
opacity.setAttribute('step', '0.1');
|
|
231
|
+
opacity.setAttribute(
|
|
232
|
+
'aria-labelledby',
|
|
233
|
+
'mapml-extent-item-opacity-' + leafletSrcExports.stamp(extentOpacitySummary)
|
|
234
|
+
);
|
|
235
|
+
const changeOpacity = function (e) {
|
|
236
|
+
if (e && e.target && e.target.value >= 0 && e.target.value <= 1.0) {
|
|
237
|
+
this._extentLayer.changeOpacity(e.target.value);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
opacity.setAttribute('value', this.opacity);
|
|
241
|
+
opacity.value = this._extentLayer._container.style.opacity || '1.0';
|
|
242
|
+
opacity.addEventListener('change', changeOpacity.bind(this));
|
|
243
|
+
|
|
244
|
+
var extentItemNameSpan = leafletSrcExports.DomUtil.create(
|
|
245
|
+
'span',
|
|
246
|
+
'mapml-extent-item-name',
|
|
247
|
+
extentLabel
|
|
248
|
+
);
|
|
249
|
+
input.type = 'checkbox';
|
|
250
|
+
input.defaultChecked = this.checked;
|
|
251
|
+
extentItemNameSpan.innerHTML = this.label;
|
|
252
|
+
const changeCheck = function () {
|
|
253
|
+
this.checked = !this.checked;
|
|
254
|
+
this.el.dispatchEvent(new CustomEvent('map-change'));
|
|
255
|
+
};
|
|
256
|
+
// save for later access by API
|
|
257
|
+
this._layerControlCheckbox = input;
|
|
258
|
+
input.addEventListener('change', changeCheck.bind(this));
|
|
259
|
+
extentItemNameSpan.id =
|
|
260
|
+
'mapml-extent-item-name-{' + leafletSrcExports.stamp(extentItemNameSpan) + '}';
|
|
261
|
+
extent.setAttribute('aria-labelledby', extentItemNameSpan.id);
|
|
262
|
+
extentItemNameSpan.extent = this.el;
|
|
263
|
+
|
|
264
|
+
extent.ontouchstart = extent.onmousedown = (downEvent) => {
|
|
265
|
+
if (
|
|
266
|
+
(downEvent.target.parentElement.tagName.toLowerCase() === 'label' &&
|
|
267
|
+
downEvent.target.tagName.toLowerCase() !== 'input') ||
|
|
268
|
+
downEvent.target.tagName.toLowerCase() === 'label'
|
|
269
|
+
) {
|
|
270
|
+
downEvent.stopPropagation();
|
|
271
|
+
downEvent =
|
|
272
|
+
downEvent instanceof TouchEvent ? downEvent.touches[0] : downEvent;
|
|
273
|
+
|
|
274
|
+
let control = extent,
|
|
275
|
+
controls = extent.parentNode,
|
|
276
|
+
moving = false,
|
|
277
|
+
yPos = downEvent.clientY,
|
|
278
|
+
originalPosition = Array.from(
|
|
279
|
+
extent.parentElement.querySelectorAll('fieldset')
|
|
280
|
+
).indexOf(extent);
|
|
281
|
+
|
|
282
|
+
document.body.ontouchmove = document.body.onmousemove = (moveEvent) => {
|
|
283
|
+
moveEvent.preventDefault();
|
|
284
|
+
moveEvent =
|
|
285
|
+
moveEvent instanceof TouchEvent ? moveEvent.touches[0] : moveEvent;
|
|
286
|
+
|
|
287
|
+
// Fixes flickering by only moving element when there is enough space
|
|
288
|
+
let offset = moveEvent.clientY - yPos;
|
|
289
|
+
moving = Math.abs(offset) > 15 || moving;
|
|
290
|
+
if (
|
|
291
|
+
(controls && !moving) ||
|
|
292
|
+
(controls && controls.childElementCount <= 1) ||
|
|
293
|
+
controls.getBoundingClientRect().top >
|
|
294
|
+
control.getBoundingClientRect().bottom ||
|
|
295
|
+
controls.getBoundingClientRect().bottom <
|
|
296
|
+
control.getBoundingClientRect().top
|
|
297
|
+
) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
controls.classList.add('mapml-draggable');
|
|
302
|
+
control.style.transform = 'translateY(' + offset + 'px)';
|
|
303
|
+
control.style.pointerEvents = 'none';
|
|
304
|
+
|
|
305
|
+
let x = moveEvent.clientX,
|
|
306
|
+
y = moveEvent.clientY,
|
|
307
|
+
root =
|
|
308
|
+
mapEl.tagName === 'GCDS-EXT-MAP'
|
|
309
|
+
? mapEl.shadowRoot
|
|
310
|
+
: mapEl.querySelector('.mapml-web-map').shadowRoot,
|
|
311
|
+
elementAt = root.elementFromPoint(x, y),
|
|
312
|
+
swapControl =
|
|
313
|
+
!elementAt || !elementAt.closest('fieldset')
|
|
314
|
+
? control
|
|
315
|
+
: elementAt.closest('fieldset');
|
|
316
|
+
|
|
317
|
+
swapControl =
|
|
318
|
+
Math.abs(offset) <= swapControl.offsetHeight ? control : swapControl;
|
|
319
|
+
|
|
320
|
+
control.setAttribute('aria-grabbed', 'true');
|
|
321
|
+
control.setAttribute('aria-dropeffect', 'move');
|
|
322
|
+
if (swapControl && controls === swapControl.parentNode) {
|
|
323
|
+
swapControl =
|
|
324
|
+
swapControl !== control.nextSibling
|
|
325
|
+
? swapControl
|
|
326
|
+
: swapControl.nextSibling;
|
|
327
|
+
if (control !== swapControl) {
|
|
328
|
+
yPos = moveEvent.clientY;
|
|
329
|
+
control.style.transform = null;
|
|
330
|
+
}
|
|
331
|
+
controls.insertBefore(control, swapControl);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
document.body.ontouchend = document.body.onmouseup = () => {
|
|
336
|
+
let newPosition = Array.from(
|
|
337
|
+
extent.parentElement.querySelectorAll('fieldset')
|
|
338
|
+
).indexOf(extent);
|
|
339
|
+
control.setAttribute('aria-grabbed', 'false');
|
|
340
|
+
control.removeAttribute('aria-dropeffect');
|
|
341
|
+
control.style.pointerEvents = null;
|
|
342
|
+
control.style.transform = null;
|
|
343
|
+
if (originalPosition !== newPosition) {
|
|
344
|
+
let controlsElems = controls.children,
|
|
345
|
+
zIndex = 0;
|
|
346
|
+
for (let c of controlsElems) {
|
|
347
|
+
let extentEl = c.querySelector('span').extent;
|
|
348
|
+
|
|
349
|
+
extentEl.setAttribute('data-moving', '');
|
|
350
|
+
const node = layerEl.src ? layerEl.shadowRoot : layerEl;
|
|
351
|
+
node.append(extentEl);
|
|
352
|
+
extentEl.removeAttribute('data-moving');
|
|
353
|
+
|
|
354
|
+
extentEl.extentZIndex = zIndex;
|
|
355
|
+
extentEl._extentLayer.setZIndex(zIndex);
|
|
356
|
+
zIndex++;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
controls.classList.remove('mapml-draggable');
|
|
360
|
+
document.body.ontouchmove =
|
|
361
|
+
document.body.onmousemove =
|
|
362
|
+
document.body.ontouchend =
|
|
363
|
+
document.body.onmouseup =
|
|
364
|
+
null;
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
this._extentRootFieldset = extent;
|
|
369
|
+
this._opacitySlider = opacity;
|
|
370
|
+
this._opacityControl = opacityControl;
|
|
371
|
+
this._layerControlLabel = extentLabel;
|
|
372
|
+
return extent;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const GcdsMapExtent = class {
|
|
376
|
+
constructor(hostRef) {
|
|
377
|
+
registerInstance(this, hostRef);
|
|
378
|
+
}
|
|
379
|
+
get el() { return getElement(this); }
|
|
380
|
+
checked = false;
|
|
381
|
+
_label;
|
|
382
|
+
opacity = 1;
|
|
383
|
+
_opacity;
|
|
384
|
+
hidden = false;
|
|
385
|
+
units;
|
|
386
|
+
disabled = false;
|
|
387
|
+
// Internal getter for use within component
|
|
388
|
+
get label() {
|
|
389
|
+
return this._label || this.mapEl?.locale?.dfExtent || 'Sub-layer';
|
|
390
|
+
}
|
|
391
|
+
get opacityValue() {
|
|
392
|
+
return this._opacity ?? this.opacity ?? 1.0;
|
|
393
|
+
}
|
|
394
|
+
mapEl;
|
|
395
|
+
parentLayer;
|
|
396
|
+
_map;
|
|
397
|
+
_extentLayer;
|
|
398
|
+
_layerControlHTML;
|
|
399
|
+
_layerControlCheckbox;
|
|
400
|
+
_layerControlLabel;
|
|
401
|
+
_opacityControl;
|
|
402
|
+
_opacitySlider;
|
|
403
|
+
_selectdetails;
|
|
404
|
+
_observer;
|
|
405
|
+
_changeHandler;
|
|
406
|
+
_boundsCalculated = false;
|
|
407
|
+
unitsChanged(newValue, oldValue) {
|
|
408
|
+
}
|
|
409
|
+
labelChanged() {
|
|
410
|
+
if (this._layerControlHTML) {
|
|
411
|
+
this._layerControlHTML.querySelector('.mapml-extent-item-name').textContent = this.label;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
checkedChanged() {
|
|
415
|
+
if (this.parentLayer && this._extentLayer) {
|
|
416
|
+
this.parentLayer
|
|
417
|
+
.whenReady()
|
|
418
|
+
.then(() => {
|
|
419
|
+
this._handleChange();
|
|
420
|
+
this._calculateBounds();
|
|
421
|
+
if (this._layerControlCheckbox) {
|
|
422
|
+
this._layerControlCheckbox.checked = this.checked;
|
|
423
|
+
}
|
|
424
|
+
})
|
|
425
|
+
.catch((error) => {
|
|
426
|
+
console.log('Error while waiting on parentLayer for map-extent checked callback: ' +
|
|
427
|
+
error);
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
opacityChanged(newValue, oldValue) {
|
|
432
|
+
// This watcher handles programmatic changes to the opacity property
|
|
433
|
+
if (oldValue !== newValue && this._extentLayer) {
|
|
434
|
+
this._opacity = newValue;
|
|
435
|
+
this._extentLayer.changeOpacity(newValue);
|
|
436
|
+
// Update opacity slider if it exists
|
|
437
|
+
if (this._opacitySlider) {
|
|
438
|
+
this._opacitySlider.value = newValue.toString();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
hiddenChanged(newValue, oldValue) {
|
|
443
|
+
// Only process hidden changes after the extent is fully initialized
|
|
444
|
+
// During initial load, this will be handled in connectedCallback
|
|
445
|
+
if (oldValue !== newValue && this._extentLayer && this._layerControlHTML) {
|
|
446
|
+
this._applyHiddenState(newValue);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
_applyHiddenState(isHidden) {
|
|
450
|
+
if (!this._extentLayer || !this._layerControlHTML || !this.parentLayer)
|
|
451
|
+
return;
|
|
452
|
+
this.parentLayer
|
|
453
|
+
.whenReady()
|
|
454
|
+
.then(() => {
|
|
455
|
+
let extentsRootFieldset = this.parentLayer._propertiesGroupAnatomy;
|
|
456
|
+
// Get all map-extent elements and filter by component property, not DOM attribute
|
|
457
|
+
const allExtents = this.parentLayer.src
|
|
458
|
+
? Array.from(this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent'))
|
|
459
|
+
: Array.from(this.parentLayer.querySelectorAll(':scope > map-extent'));
|
|
460
|
+
// Filter visible extents using component property
|
|
461
|
+
const visibleExtents = allExtents.filter(extent => !extent.hidden);
|
|
462
|
+
let position = visibleExtents.indexOf(this.el);
|
|
463
|
+
if (isHidden) {
|
|
464
|
+
// Hidden was set to true - remove from layer control (hide from user)
|
|
465
|
+
this._layerControlHTML.remove();
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
// Hidden was set to false - add back to layer control in calculated position
|
|
469
|
+
if (position === 0) {
|
|
470
|
+
extentsRootFieldset.insertAdjacentElement('afterbegin', this._layerControlHTML);
|
|
471
|
+
}
|
|
472
|
+
else if (position > 0) {
|
|
473
|
+
Array.from(this.parentLayer.src
|
|
474
|
+
? this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent:not([hidden])')
|
|
475
|
+
: this.parentLayer.querySelectorAll(':scope > map-extent:not([hidden])'))[position - 1]._layerControlHTML.insertAdjacentElement('afterend', this._layerControlHTML);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
this._validateLayerControlContainerHidden();
|
|
479
|
+
})
|
|
480
|
+
.catch(() => {
|
|
481
|
+
console.log('Error while waiting on parentLayer for map-extent hidden callback');
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
get extent() {
|
|
485
|
+
const getExtent = (extent) => {
|
|
486
|
+
return Object.assign(Util._convertAndFormatPCRS(extent._extentLayer.bounds, M[extent.units], extent.units), { zoom: extent._extentLayer.zoomBounds });
|
|
487
|
+
};
|
|
488
|
+
const getCalculatedExtent = (extent) => {
|
|
489
|
+
extent._calculateBounds();
|
|
490
|
+
return getExtent(extent);
|
|
491
|
+
};
|
|
492
|
+
return this._extentLayer.bounds
|
|
493
|
+
? getExtent(this)
|
|
494
|
+
: getCalculatedExtent(this);
|
|
495
|
+
}
|
|
496
|
+
get position() {
|
|
497
|
+
return calculatePosition(this.el);
|
|
498
|
+
}
|
|
499
|
+
getOuterHTML() {
|
|
500
|
+
let tempElement = this.el.cloneNode(true);
|
|
501
|
+
if (this.el.querySelector('map-link')) {
|
|
502
|
+
let mapLinks = tempElement.querySelectorAll('map-link');
|
|
503
|
+
mapLinks.forEach((mapLink) => {
|
|
504
|
+
if (mapLink.hasAttribute('href')) {
|
|
505
|
+
mapLink.setAttribute('href', decodeURI(new URL(mapLink.getAttribute('href'), this.el.baseURI ? this.el.baseURI : document.baseURI).href));
|
|
506
|
+
}
|
|
507
|
+
else if (mapLink.hasAttribute('tref')) {
|
|
508
|
+
mapLink.setAttribute('tref', decodeURI(new URL(mapLink.getAttribute('tref'), this.el.baseURI ? this.el.baseURI : document.baseURI).href));
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
let outerLayer = tempElement.outerHTML;
|
|
513
|
+
tempElement.remove();
|
|
514
|
+
return outerLayer;
|
|
515
|
+
}
|
|
516
|
+
zoomTo() {
|
|
517
|
+
let extent = this.extent;
|
|
518
|
+
let map = this.getMapEl()._map, xmin = extent.topLeft.pcrs.horizontal, xmax = extent.bottomRight.pcrs.horizontal, ymin = extent.bottomRight.pcrs.vertical, ymax = extent.topLeft.pcrs.vertical, bounds = leafletSrcExports.bounds(leafletSrcExports.point(xmin, ymin), leafletSrcExports.point(xmax, ymax)), center = map.options.crs.unproject(bounds.getCenter(true)), maxZoom = extent.zoom.maxZoom, minZoom = extent.zoom.minZoom;
|
|
519
|
+
map.setView(center, Util.getMaxZoom(bounds, map, minZoom, maxZoom), {
|
|
520
|
+
animate: false
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
getMapEl() {
|
|
524
|
+
return Util.getClosest(this.el, 'gcds-ext-map');
|
|
525
|
+
}
|
|
526
|
+
getLayerEl() {
|
|
527
|
+
return Util.getClosest(this.el, 'map-layer,layer-');
|
|
528
|
+
}
|
|
529
|
+
async connectedCallback() {
|
|
530
|
+
// Initialize default values and bind handlers
|
|
531
|
+
this._opacity = this.opacityValue;
|
|
532
|
+
this._changeHandler = this._handleChange.bind(this);
|
|
533
|
+
this.parentLayer = this.el.parentLayer = this.getLayerEl();
|
|
534
|
+
if (this.el.hasAttribute('data-moving') ||
|
|
535
|
+
this.parentLayer?.hasAttribute('data-moving'))
|
|
536
|
+
return;
|
|
537
|
+
this.mapEl = this.getMapEl();
|
|
538
|
+
// Add MapML compatibility methods to the element
|
|
539
|
+
this.el.getMapEl = this.getMapEl.bind(this);
|
|
540
|
+
this.el.getLayerEl = this.getLayerEl.bind(this);
|
|
541
|
+
this.el.getLayerControlHTML = this.getLayerControlHTML.bind(this);
|
|
542
|
+
this.el.zoomTo = this.zoomTo.bind(this);
|
|
543
|
+
this.el._validateDisabled = this._validateDisabled.bind(this);
|
|
544
|
+
this.el.getMeta = this.getMeta.bind(this);
|
|
545
|
+
this.el.getOuterHTML = this.getOuterHTML.bind(this);
|
|
546
|
+
// this is necessary for true "whenReady" being true because bounds
|
|
547
|
+
// being established is pretty important. This is different from MapML.js;
|
|
548
|
+
// TODO it may be to port this idea back to MapML.js tbd.
|
|
549
|
+
Object.defineProperty(this.el, '_boundsCalculated', {
|
|
550
|
+
get: () => this._boundsCalculated,
|
|
551
|
+
configurable: true,
|
|
552
|
+
enumerable: true
|
|
553
|
+
});
|
|
554
|
+
// Add extent getter on element for MapML compatibility
|
|
555
|
+
Object.defineProperty(this.el, 'extent', {
|
|
556
|
+
get: () => {
|
|
557
|
+
return this.extent;
|
|
558
|
+
},
|
|
559
|
+
configurable: true
|
|
560
|
+
});
|
|
561
|
+
// Add label getter/setter on element for MapML compatibility
|
|
562
|
+
Object.defineProperty(this.el, 'label', {
|
|
563
|
+
get: () => {
|
|
564
|
+
return this.el.hasAttribute('label')
|
|
565
|
+
? this.el.getAttribute('label')
|
|
566
|
+
: this.mapEl?.locale?.dfExtent || 'Sub-layer';
|
|
567
|
+
},
|
|
568
|
+
set: (val) => {
|
|
569
|
+
if (val) {
|
|
570
|
+
this.el.setAttribute('label', val);
|
|
571
|
+
// Update internal prop to trigger watcher
|
|
572
|
+
this._label = val;
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
configurable: true
|
|
576
|
+
});
|
|
577
|
+
// Initialize _label from attribute if present
|
|
578
|
+
if (this.el.hasAttribute('label')) {
|
|
579
|
+
this._label = this.el.getAttribute('label');
|
|
580
|
+
}
|
|
581
|
+
if (!this.mapEl)
|
|
582
|
+
return;
|
|
583
|
+
await this.mapEl.whenProjectionDefined(this.units).catch(() => {
|
|
584
|
+
throw new Error('Undefined projection:' + this.units);
|
|
585
|
+
});
|
|
586
|
+
// when projection is changed, the parent map-layer._layer is created (so whenReady is fulfilled) but then removed,
|
|
587
|
+
// then the map-extent disconnectedCallback will be triggered by map-layer._onRemove() (clear the shadowRoot)
|
|
588
|
+
// even before connectedCallback is finished
|
|
589
|
+
// in this case, the microtasks triggered by the fulfillment of the removed MapLayer should be stopped as well
|
|
590
|
+
// !this.isConnected <=> the disconnectedCallback has run before
|
|
591
|
+
if (!this.el.isConnected)
|
|
592
|
+
return;
|
|
593
|
+
await this.mapEl.whenReady();
|
|
594
|
+
this._map = this.mapEl._map;
|
|
595
|
+
this.parentLayer?.addEventListener('map-change', this._changeHandler);
|
|
596
|
+
this.mapEl.addEventListener('map-projectionchange', this._changeHandler);
|
|
597
|
+
this._extentLayer = mapExtentLayer({
|
|
598
|
+
opacity: this.opacityValue,
|
|
599
|
+
crs: M[this.units],
|
|
600
|
+
zIndex: this.position,
|
|
601
|
+
extentEl: this.el
|
|
602
|
+
});
|
|
603
|
+
// Publish to element for MapML compatibility
|
|
604
|
+
this.el._extentLayer = this._extentLayer;
|
|
605
|
+
// this._layerControlHTML is the fieldset for the extent in the LayerControl
|
|
606
|
+
// Create layer control HTML and ensure it's captured on the component instance
|
|
607
|
+
const layerControlHTML = createLayerControlExtentHTML.call(this);
|
|
608
|
+
this._layerControlHTML = layerControlHTML;
|
|
609
|
+
// Also ensure the DOM element reference is synced (MapML compatibility)
|
|
610
|
+
this.el._layerControlHTML = layerControlHTML;
|
|
611
|
+
this.el._layerControlLabel = this._layerControlLabel;
|
|
612
|
+
this.el._layerControlCheckbox = this._layerControlCheckbox;
|
|
613
|
+
this.el._opacityControl = this._opacityControl;
|
|
614
|
+
this.el._opacitySlider = this._opacitySlider;
|
|
615
|
+
this.el._selectdetails = this._selectdetails;
|
|
616
|
+
// Wait for map-link elements to be ready before calculating bounds
|
|
617
|
+
await this._waitForTrefLinks();
|
|
618
|
+
this._calculateBounds();
|
|
619
|
+
// Handle initial checked state - add extent layer to parent if checked
|
|
620
|
+
this._handleChange();
|
|
621
|
+
// instead of children using parents' whenReady which can be cyclic,
|
|
622
|
+
// when this element is ready, run stuff that is only available after
|
|
623
|
+
// initialization
|
|
624
|
+
this._runMutationObserver(this.el.children);
|
|
625
|
+
// make sure same thing happens when children are added
|
|
626
|
+
this._bindMutationObserver();
|
|
627
|
+
}
|
|
628
|
+
/*
|
|
629
|
+
* Set up a function to watch additions of child elements of map-extent
|
|
630
|
+
* and to invoke desired side effects of those additions via
|
|
631
|
+
* _runMutationObserver
|
|
632
|
+
*/
|
|
633
|
+
_bindMutationObserver() {
|
|
634
|
+
this._observer = new MutationObserver((mutationList) => {
|
|
635
|
+
for (let mutation of mutationList) {
|
|
636
|
+
// Handle attribute removals for 'label'
|
|
637
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'label') {
|
|
638
|
+
if (!this.el.hasAttribute('label')) {
|
|
639
|
+
this._label = this.mapEl?.locale?.dfExtent || 'Sub-layer';
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
// the attributes changes should be handled by attributeChangedCallback()
|
|
643
|
+
if (mutation.type === 'childList') {
|
|
644
|
+
this._runMutationObserver(mutation.addedNodes);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
// Observe both childList and attribute changes for 'label'
|
|
649
|
+
this._observer.observe(this.el, {
|
|
650
|
+
childList: true,
|
|
651
|
+
attributes: true,
|
|
652
|
+
attributeFilter: ['label']
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
_runMutationObserver(elementsGroup) {
|
|
656
|
+
const _addMetaElement = (_mapMeta) => {
|
|
657
|
+
this.whenReady().then(() => {
|
|
658
|
+
this._calculateBounds();
|
|
659
|
+
this._validateDisabled();
|
|
660
|
+
});
|
|
661
|
+
};
|
|
662
|
+
const _addStylesheetLink = (mapLink) => {
|
|
663
|
+
this.whenReady().then(() => {
|
|
664
|
+
this._extentLayer.renderStyles(mapLink);
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
const _addStyleElement = (mapStyle) => {
|
|
668
|
+
this.whenReady().then(() => {
|
|
669
|
+
this._extentLayer.renderStyles(mapStyle);
|
|
670
|
+
});
|
|
671
|
+
};
|
|
672
|
+
for (let i = 0; i < elementsGroup.length; ++i) {
|
|
673
|
+
let element = elementsGroup[i];
|
|
674
|
+
switch (element.nodeName) {
|
|
675
|
+
case 'MAP-META':
|
|
676
|
+
const name = element.hasAttribute('name') &&
|
|
677
|
+
(element.getAttribute('name').toLowerCase() === 'zoom' ||
|
|
678
|
+
element.getAttribute('name').toLowerCase() === 'extent');
|
|
679
|
+
if (name && element.hasAttribute('content')) {
|
|
680
|
+
_addMetaElement();
|
|
681
|
+
}
|
|
682
|
+
break;
|
|
683
|
+
case 'MAP-LINK':
|
|
684
|
+
if (element.link && !element.link.isConnected)
|
|
685
|
+
_addStylesheetLink(element);
|
|
686
|
+
break;
|
|
687
|
+
case 'MAP-STYLE':
|
|
688
|
+
if (element.styleElement && !element.styleElement.isConnected) {
|
|
689
|
+
_addStyleElement(element);
|
|
690
|
+
}
|
|
691
|
+
break;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
getLayerControlHTML() {
|
|
696
|
+
return this._layerControlHTML;
|
|
697
|
+
}
|
|
698
|
+
_projectionMatch() {
|
|
699
|
+
return (this.units.toUpperCase() === this._map.options.projection.toUpperCase());
|
|
700
|
+
}
|
|
701
|
+
_validateDisabled() {
|
|
702
|
+
if (!this._extentLayer)
|
|
703
|
+
return;
|
|
704
|
+
let templates = this.el.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]');
|
|
705
|
+
const noTemplateVisible = () => {
|
|
706
|
+
let totalTemplateCount = templates.length, disabledTemplateCount = 0;
|
|
707
|
+
for (let j = 0; j < templates.length; j++) {
|
|
708
|
+
if (!templates[j].isVisible()) {
|
|
709
|
+
disabledTemplateCount++;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
return disabledTemplateCount === totalTemplateCount;
|
|
713
|
+
};
|
|
714
|
+
if (!this._projectionMatch() || noTemplateVisible()) {
|
|
715
|
+
this.el.setAttribute('disabled', '');
|
|
716
|
+
this.disabled = true;
|
|
717
|
+
}
|
|
718
|
+
else {
|
|
719
|
+
this.el.removeAttribute('disabled');
|
|
720
|
+
this.disabled = false;
|
|
721
|
+
}
|
|
722
|
+
this.toggleLayerControlDisabled();
|
|
723
|
+
this._handleChange();
|
|
724
|
+
return this.disabled;
|
|
725
|
+
}
|
|
726
|
+
getMeta(metaName) {
|
|
727
|
+
let name = metaName.toLowerCase();
|
|
728
|
+
if (name !== 'extent' && name !== 'zoom' && name !== 'cs')
|
|
729
|
+
return;
|
|
730
|
+
return this.parentLayer.src
|
|
731
|
+
? this.el.querySelector(`:scope > map-meta[name=${name}]`) ||
|
|
732
|
+
this.parentLayer.shadowRoot.querySelector(`:host > map-meta[name=${name}]`)
|
|
733
|
+
: this.el.querySelector(`:scope > map-meta[name=${name}]`) ||
|
|
734
|
+
this.parentLayer.querySelector(`:scope > map-meta[name=${name}]`);
|
|
735
|
+
}
|
|
736
|
+
// disable/italicize layer control elements based on the map-extent.disabled property
|
|
737
|
+
toggleLayerControlDisabled() {
|
|
738
|
+
let input = this._layerControlCheckbox, label = this._layerControlLabel, // access to the label for the specific map-extent
|
|
739
|
+
opacityControl = this._opacityControl, opacitySlider = this._opacitySlider, selectDetails = this._selectdetails;
|
|
740
|
+
if (this.disabled) {
|
|
741
|
+
// update the status of layerControl
|
|
742
|
+
input.disabled = true;
|
|
743
|
+
opacitySlider.disabled = true;
|
|
744
|
+
label.style.fontStyle = 'italic';
|
|
745
|
+
opacityControl.style.fontStyle = 'italic';
|
|
746
|
+
if (selectDetails) {
|
|
747
|
+
selectDetails.forEach((i) => {
|
|
748
|
+
i.querySelectorAll('select').forEach((j) => {
|
|
749
|
+
j.disabled = true;
|
|
750
|
+
j.style.fontStyle = 'italic';
|
|
751
|
+
});
|
|
752
|
+
i.style.fontStyle = 'italic';
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
input.disabled = false;
|
|
758
|
+
opacitySlider.disabled = false;
|
|
759
|
+
label.style.fontStyle = 'normal';
|
|
760
|
+
opacityControl.style.fontStyle = 'normal';
|
|
761
|
+
if (selectDetails) {
|
|
762
|
+
selectDetails.forEach((i) => {
|
|
763
|
+
i.querySelectorAll('select').forEach((j) => {
|
|
764
|
+
j.disabled = false;
|
|
765
|
+
j.style.fontStyle = 'normal';
|
|
766
|
+
});
|
|
767
|
+
i.style.fontStyle = 'normal';
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
_handleChange() {
|
|
773
|
+
// add _extentLayer to map if map-extent is checked, otherwise remove it
|
|
774
|
+
if (this.checked && !this.disabled && this.parentLayer._layer) {
|
|
775
|
+
// can be added to MapLayer LayerGroup no matter map-layer is checked or not
|
|
776
|
+
this._extentLayer.addTo(this.parentLayer._layer);
|
|
777
|
+
this._extentLayer.setZIndex(this.position);
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
this.parentLayer._layer?.removeLayer(this._extentLayer);
|
|
781
|
+
}
|
|
782
|
+
// change the checkbox in the layer control to match map-extent.checked
|
|
783
|
+
// doesn't trigger the event handler because it's not user-caused AFAICT
|
|
784
|
+
}
|
|
785
|
+
_validateLayerControlContainerHidden() {
|
|
786
|
+
let extentsFieldset = this.parentLayer._propertiesGroupAnatomy;
|
|
787
|
+
if (!extentsFieldset)
|
|
788
|
+
return;
|
|
789
|
+
// Get all map-extent elements (not just non-hidden ones)
|
|
790
|
+
const allExtents = this.parentLayer.src
|
|
791
|
+
? Array.from(this.parentLayer.shadowRoot.querySelectorAll(':host > map-extent'))
|
|
792
|
+
: Array.from(this.parentLayer.querySelectorAll(':scope > map-extent'));
|
|
793
|
+
// Count visible extents using component property, not DOM attribute
|
|
794
|
+
const numberOfVisibleSublayers = allExtents.filter(extent => !extent.hidden).length;
|
|
795
|
+
if (numberOfVisibleSublayers === 0) {
|
|
796
|
+
extentsFieldset.setAttribute('hidden', '');
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
extentsFieldset.removeAttribute('hidden');
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
disconnectedCallback() {
|
|
803
|
+
// in case of projection change, the disconnectedcallback will be triggered by removing map-layer._layer even before
|
|
804
|
+
// map-extent.connectedcallback is finished (because it will wait for the map-layer to be ready)
|
|
805
|
+
// !this._extentLayer <=> this.connectedCallback has not yet been finished before disconnectedCallback is triggered
|
|
806
|
+
if (this.el.hasAttribute('data-moving') ||
|
|
807
|
+
this.parentLayer?.hasAttribute('data-moving') ||
|
|
808
|
+
!this._extentLayer)
|
|
809
|
+
return;
|
|
810
|
+
this._validateLayerControlContainerHidden();
|
|
811
|
+
// remove layer control for map-extent from layer control DOM
|
|
812
|
+
// TODO: for the case of projection change, the layer control for map-extent has been created while _extentLayer has not yet been ready
|
|
813
|
+
if (this._layerControlHTML) {
|
|
814
|
+
this._layerControlHTML.remove();
|
|
815
|
+
}
|
|
816
|
+
if (this.parentLayer?._layer) {
|
|
817
|
+
this.parentLayer._layer.removeLayer(this._extentLayer);
|
|
818
|
+
}
|
|
819
|
+
if (this.parentLayer) {
|
|
820
|
+
this.parentLayer.removeEventListener('map-change', this._changeHandler);
|
|
821
|
+
}
|
|
822
|
+
if (this.mapEl) {
|
|
823
|
+
this.mapEl.removeEventListener('map-projectionchange', this._changeHandler);
|
|
824
|
+
}
|
|
825
|
+
this._boundsCalculated = false;
|
|
826
|
+
delete this._extentLayer;
|
|
827
|
+
if (this.parentLayer?._layer)
|
|
828
|
+
delete this.parentLayer._layer.bounds;
|
|
829
|
+
}
|
|
830
|
+
async _waitForTrefLinks() {
|
|
831
|
+
// Wait only for links with explicit tref attributes to have _templateVars initialized
|
|
832
|
+
// This is needed because _calculateBounds() calls link.getZoomBounds() and link.getBounds()
|
|
833
|
+
// which depend on _templateVars being set
|
|
834
|
+
// Links without tref would create circular dependency if we waited for them
|
|
835
|
+
const templates = this.el.querySelectorAll('map-link[rel=image][tref],map-link[rel=tile][tref],map-link[rel=features][tref],map-link[rel=query][tref]');
|
|
836
|
+
const linksVarsReady = [];
|
|
837
|
+
for (let link of Array.from(templates)) {
|
|
838
|
+
// Wait for _templateVars to be set, not for _templatedLayer to be created
|
|
839
|
+
linksVarsReady.push(new Promise((resolve) => {
|
|
840
|
+
if (link._templateVars) {
|
|
841
|
+
resolve();
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
const checkInterval = setInterval(() => {
|
|
845
|
+
if (link._templateVars) {
|
|
846
|
+
clearInterval(checkInterval);
|
|
847
|
+
resolve();
|
|
848
|
+
}
|
|
849
|
+
}, 10);
|
|
850
|
+
// Timeout after 1 second
|
|
851
|
+
setTimeout(() => {
|
|
852
|
+
clearInterval(checkInterval);
|
|
853
|
+
resolve(); // Resolve anyway to not block forever
|
|
854
|
+
}, 1000);
|
|
855
|
+
}
|
|
856
|
+
}));
|
|
857
|
+
}
|
|
858
|
+
return Promise.all(linksVarsReady);
|
|
859
|
+
}
|
|
860
|
+
_calculateBounds() {
|
|
861
|
+
delete this._extentLayer.bounds;
|
|
862
|
+
delete this._extentLayer.zoomBounds;
|
|
863
|
+
if (this.parentLayer._layer)
|
|
864
|
+
delete this.parentLayer._layer.bounds;
|
|
865
|
+
let templates = this.el.querySelectorAll('map-link[rel=image]:not([disabled]),map-link[rel=tile]:not([disabled]),map-link[rel=features]:not([disabled]),map-link[rel=query]:not([disabled])');
|
|
866
|
+
// initialize bounds from this.scope > map-meta
|
|
867
|
+
let bounds = this.el.querySelector(':scope > map-meta[name=extent][content]')
|
|
868
|
+
? Util.getBoundsFromMeta(this.el) // TODO rewrite this pile of doo doo
|
|
869
|
+
: undefined;
|
|
870
|
+
// initialize zoom bounds from this.scope > map-meta
|
|
871
|
+
let zoomBounds = this.el.querySelector(':scope > map-meta[name=zoom][content]')
|
|
872
|
+
? Util.getZoomBoundsFromMeta(this.el) // TODO rewrite this pile of doo doo
|
|
873
|
+
: undefined;
|
|
874
|
+
// bounds should be able to be calculated unconditionally, not depend on map-extent.checked
|
|
875
|
+
for (let j = 0; j < templates.length; j++) {
|
|
876
|
+
const templateZoomBounds = templates[j].getZoomBounds(), templateBounds = templates[j].getBounds();
|
|
877
|
+
let zoomMax = zoomBounds && zoomBounds.hasOwnProperty('maxZoom')
|
|
878
|
+
? zoomBounds.maxZoom
|
|
879
|
+
: -Infinity, zoomMin = zoomBounds && zoomBounds.hasOwnProperty('minZoom')
|
|
880
|
+
? zoomBounds.minZoom
|
|
881
|
+
: Infinity, minNativeZoom = zoomBounds && zoomBounds.hasOwnProperty('minNativeZoom')
|
|
882
|
+
? zoomBounds.minNativeZoom
|
|
883
|
+
: Infinity, maxNativeZoom = zoomBounds && zoomBounds.hasOwnProperty('maxNativeZoom')
|
|
884
|
+
? zoomBounds.maxNativeZoom
|
|
885
|
+
: -Infinity;
|
|
886
|
+
if (!zoomBounds) {
|
|
887
|
+
zoomBounds = Object.assign({}, templateZoomBounds);
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
890
|
+
zoomMax = Math.max(zoomMax, templateZoomBounds.maxZoom);
|
|
891
|
+
zoomMin = Math.min(zoomMin, templateZoomBounds.minZoom);
|
|
892
|
+
maxNativeZoom = Math.max(maxNativeZoom, templateZoomBounds.maxNativeZoom);
|
|
893
|
+
minNativeZoom = Math.min(minNativeZoom, templateZoomBounds.minNativeZoom);
|
|
894
|
+
zoomBounds.minZoom = zoomMin;
|
|
895
|
+
zoomBounds.maxZoom = zoomMax;
|
|
896
|
+
zoomBounds.minNativeZoom = minNativeZoom;
|
|
897
|
+
zoomBounds.maxNativeZoom = maxNativeZoom;
|
|
898
|
+
}
|
|
899
|
+
if (!bounds) {
|
|
900
|
+
bounds = leafletSrcExports.bounds(templateBounds.min, templateBounds.max);
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
bounds.extend(templateBounds);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
if (bounds) {
|
|
907
|
+
this._extentLayer.bounds = bounds;
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
this._extentLayer.bounds = leafletSrcExports.bounds(M[this.units].options.bounds.min, M[this.units].options.bounds.max);
|
|
911
|
+
}
|
|
912
|
+
if (!zoomBounds)
|
|
913
|
+
zoomBounds = {};
|
|
914
|
+
if (!zoomBounds.hasOwnProperty('minZoom')) {
|
|
915
|
+
zoomBounds.minZoom = 0;
|
|
916
|
+
}
|
|
917
|
+
if (!zoomBounds.hasOwnProperty('maxZoom')) {
|
|
918
|
+
zoomBounds.maxZoom = M[this.units].options.resolutions.length - 1;
|
|
919
|
+
}
|
|
920
|
+
if (!zoomBounds.hasOwnProperty('minNativeZoom') ||
|
|
921
|
+
zoomBounds.minNativeZoom === Infinity) {
|
|
922
|
+
zoomBounds.minNativeZoom = zoomBounds.minZoom;
|
|
923
|
+
}
|
|
924
|
+
if (!zoomBounds.hasOwnProperty('maxNativeZoom') ||
|
|
925
|
+
zoomBounds.maxNativeZoom === -Infinity) {
|
|
926
|
+
zoomBounds.maxNativeZoom = zoomBounds.maxZoom;
|
|
927
|
+
}
|
|
928
|
+
this._extentLayer.zoomBounds = zoomBounds;
|
|
929
|
+
this._boundsCalculated = true;
|
|
930
|
+
}
|
|
931
|
+
async whenReady() {
|
|
932
|
+
return new Promise((resolve, reject) => {
|
|
933
|
+
let interval, failureTimer;
|
|
934
|
+
if (this._extentLayer && this._boundsCalculated) {
|
|
935
|
+
resolve();
|
|
936
|
+
}
|
|
937
|
+
else {
|
|
938
|
+
let extentElement = this.el;
|
|
939
|
+
interval = setInterval(testForExtent, 300, extentElement);
|
|
940
|
+
failureTimer = setTimeout(extentNotDefined, 10000);
|
|
941
|
+
}
|
|
942
|
+
function testForExtent(extentElement) {
|
|
943
|
+
if (extentElement._extentLayer && extentElement._boundsCalculated) {
|
|
944
|
+
clearInterval(interval);
|
|
945
|
+
clearTimeout(failureTimer);
|
|
946
|
+
resolve();
|
|
947
|
+
}
|
|
948
|
+
else if (!extentElement.isConnected) {
|
|
949
|
+
clearInterval(interval);
|
|
950
|
+
clearTimeout(failureTimer);
|
|
951
|
+
reject('map-extent was disconnected while waiting to be ready');
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
function extentNotDefined() {
|
|
955
|
+
clearInterval(interval);
|
|
956
|
+
clearTimeout(failureTimer);
|
|
957
|
+
reject('Timeout reached waiting for extent to be ready');
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
render() {
|
|
962
|
+
return null;
|
|
963
|
+
}
|
|
964
|
+
async whenLinksReady() {
|
|
965
|
+
let templates = this.el.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features],map-link[rel=query]');
|
|
966
|
+
let linksReady = [];
|
|
967
|
+
for (let link of Array.from(templates)) {
|
|
968
|
+
linksReady.push(link.whenReady());
|
|
969
|
+
}
|
|
970
|
+
return Promise.allSettled(linksReady);
|
|
971
|
+
}
|
|
972
|
+
static get watchers() { return {
|
|
973
|
+
"units": [{
|
|
974
|
+
"unitsChanged": 0
|
|
975
|
+
}],
|
|
976
|
+
"_label": [{
|
|
977
|
+
"labelChanged": 0
|
|
978
|
+
}],
|
|
979
|
+
"checked": [{
|
|
980
|
+
"checkedChanged": 0
|
|
981
|
+
}],
|
|
982
|
+
"_opacity": [{
|
|
983
|
+
"opacityChanged": 0
|
|
984
|
+
}],
|
|
985
|
+
"hidden": [{
|
|
986
|
+
"hiddenChanged": 0
|
|
987
|
+
}]
|
|
988
|
+
}; }
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
export { GcdsMapExtent as map_extent };
|