@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,1149 @@
|
|
|
1
|
+
import { bounds, point, DomEvent, stamp, Util as LeafletUtil } from "leaflet";
|
|
2
|
+
import { Util } from "../utils/mapml/Util";
|
|
3
|
+
import { templatedImageLayer } from "../utils/mapml/layers/TemplatedImageLayer";
|
|
4
|
+
import { templatedTileLayer } from "../utils/mapml/layers/TemplatedTileLayer";
|
|
5
|
+
import { templatedFeaturesOrTilesLayer } from "../utils/mapml/layers/TemplatedFeaturesOrTilesLayer";
|
|
6
|
+
import { templatedPMTilesLayer } from "../utils/mapml/layers/TemplatedPMTilesLayer";
|
|
7
|
+
export class MapLink {
|
|
8
|
+
el;
|
|
9
|
+
// Core attributes - using getters/setters pattern from MapML
|
|
10
|
+
type;
|
|
11
|
+
// Getter that provides default value without reflecting it to the DOM attribute
|
|
12
|
+
get typeValue() {
|
|
13
|
+
return this.type || 'image/*';
|
|
14
|
+
}
|
|
15
|
+
rel;
|
|
16
|
+
href;
|
|
17
|
+
hreflang;
|
|
18
|
+
tref;
|
|
19
|
+
// Getter that provides default value (matching MapML behavior)
|
|
20
|
+
get trefValue() {
|
|
21
|
+
return this.tref || M.BLANK_TT_TREF;
|
|
22
|
+
}
|
|
23
|
+
media;
|
|
24
|
+
tms;
|
|
25
|
+
projection;
|
|
26
|
+
disabled;
|
|
27
|
+
_templatedLayer;
|
|
28
|
+
_templateVars;
|
|
29
|
+
_alternate;
|
|
30
|
+
_styleOption;
|
|
31
|
+
_stylesheetHost;
|
|
32
|
+
_pmtilesRules;
|
|
33
|
+
_mql;
|
|
34
|
+
_changeHandler;
|
|
35
|
+
// the layer registry is a semi-private Map stored on each map-link and map-layer element
|
|
36
|
+
// structured as follows: position -> {layer: layerInstance, count: number}
|
|
37
|
+
// where layer is either a MapTileLayer or a MapFeatureLayer,
|
|
38
|
+
// and count is the number of tiles or features in that layer
|
|
39
|
+
_layerRegistry = new Map();
|
|
40
|
+
parentExtent;
|
|
41
|
+
mapEl;
|
|
42
|
+
zoomInput;
|
|
43
|
+
zIndex;
|
|
44
|
+
link;
|
|
45
|
+
typeChanged(newValue, oldValue) {
|
|
46
|
+
if (oldValue !== newValue) {
|
|
47
|
+
// Handle side effects if needed
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
relChanged(newValue, oldValue) {
|
|
51
|
+
if (oldValue !== newValue) {
|
|
52
|
+
// Handle side effects
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
hrefChanged(newValue, oldValue) {
|
|
56
|
+
if (oldValue !== newValue) {
|
|
57
|
+
// Handle side effects
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
hreflangChanged(newValue, oldValue) {
|
|
61
|
+
if (oldValue !== newValue) {
|
|
62
|
+
// Handle side effects
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
trefChanged(newValue, oldValue) {
|
|
66
|
+
if (oldValue !== newValue) {
|
|
67
|
+
this._initTemplateVars();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
mediaChanged(newValue, oldValue) {
|
|
71
|
+
if (oldValue !== newValue) {
|
|
72
|
+
this._registerMediaQuery(newValue);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
tmsChanged(newValue, oldValue) {
|
|
76
|
+
if (oldValue !== newValue) {
|
|
77
|
+
// Handle side effects
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
projectionChanged(newValue, oldValue) {
|
|
81
|
+
if (oldValue !== newValue) {
|
|
82
|
+
// Handle side effects
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
disabledChanged(newValue) {
|
|
86
|
+
if (newValue) {
|
|
87
|
+
this._disableLink();
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
this._enableLink();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
get extent() {
|
|
94
|
+
return this._templateVars
|
|
95
|
+
? Object.assign(Util._convertAndFormatPCRS(this.getBounds(), M[this.parentExtent.units], this.parentExtent.units), { zoom: this.getZoomBounds() })
|
|
96
|
+
: null;
|
|
97
|
+
}
|
|
98
|
+
getMapEl() {
|
|
99
|
+
return Util.getClosest(this.el, 'gcds-ext-map');
|
|
100
|
+
}
|
|
101
|
+
getLayerEl() {
|
|
102
|
+
return Util.getClosest(this.el, 'map-layer,layer-');
|
|
103
|
+
}
|
|
104
|
+
getBase() {
|
|
105
|
+
// Look for map-base element in the shadow root (for remote content)
|
|
106
|
+
const shadowRoot = this.el.getRootNode();
|
|
107
|
+
if (shadowRoot instanceof ShadowRoot) {
|
|
108
|
+
const mapBase = shadowRoot.querySelector('map-base[href]');
|
|
109
|
+
if (mapBase) {
|
|
110
|
+
return mapBase.getAttribute('href');
|
|
111
|
+
}
|
|
112
|
+
// Fallback: resolve against the layer's src
|
|
113
|
+
const layer = shadowRoot.host;
|
|
114
|
+
return new URL(layer.src, layer.baseURI).href;
|
|
115
|
+
}
|
|
116
|
+
// Light DOM: check for map-base or use element's baseURI
|
|
117
|
+
const mapBase = this.el.getRootNode().querySelector('map-base[href]');
|
|
118
|
+
return mapBase ? mapBase.getAttribute('href') : this.el.baseURI;
|
|
119
|
+
}
|
|
120
|
+
async connectedCallback() {
|
|
121
|
+
if (this.getLayerEl()?.hasAttribute('data-moving') ||
|
|
122
|
+
(this.parentExtent && this.parentExtent.hasAttribute('data-moving')))
|
|
123
|
+
return;
|
|
124
|
+
this.el._layerRegistry = this._layerRegistry;
|
|
125
|
+
// Publish MapML compatibility methods on element
|
|
126
|
+
// Note: Methods decorated with @Method() (whenReady)
|
|
127
|
+
// are automatically available on the element
|
|
128
|
+
this.el.getMapEl = this.getMapEl.bind(this);
|
|
129
|
+
this.el.getLayerEl = this.getLayerEl.bind(this);
|
|
130
|
+
this.el.zoomTo = this.zoomTo.bind(this);
|
|
131
|
+
this.el.getZoomBounds = this.getZoomBounds.bind(this);
|
|
132
|
+
this.el.getBounds = this.getBounds.bind(this);
|
|
133
|
+
this.el.isVisible = this.isVisible.bind(this);
|
|
134
|
+
this.el.getLayerControlOption = this.getLayerControlOption.bind(this);
|
|
135
|
+
// Expose extent property on DOM element for MapML compatibility
|
|
136
|
+
Object.defineProperty(this.el, 'extent', {
|
|
137
|
+
get: () => this.extent,
|
|
138
|
+
configurable: true,
|
|
139
|
+
enumerable: true
|
|
140
|
+
});
|
|
141
|
+
switch (this.rel?.toLowerCase()) {
|
|
142
|
+
case 'tile':
|
|
143
|
+
case 'image':
|
|
144
|
+
case 'features':
|
|
145
|
+
case 'query':
|
|
146
|
+
if (!this.disabled) {
|
|
147
|
+
this._initTemplateVars();
|
|
148
|
+
await this._createTemplatedLink();
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
case 'style':
|
|
152
|
+
case 'self':
|
|
153
|
+
case 'style self':
|
|
154
|
+
case 'self style':
|
|
155
|
+
this._createSelfOrStyleLink();
|
|
156
|
+
break;
|
|
157
|
+
case 'zoomin':
|
|
158
|
+
case 'zoomout':
|
|
159
|
+
break;
|
|
160
|
+
case 'legend':
|
|
161
|
+
break;
|
|
162
|
+
case 'stylesheet':
|
|
163
|
+
if (!this.disabled) {
|
|
164
|
+
this._createStylesheetLink();
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
case 'alternate':
|
|
168
|
+
this._createAlternateLink();
|
|
169
|
+
break;
|
|
170
|
+
case 'license':
|
|
171
|
+
break;
|
|
172
|
+
case 'search':
|
|
173
|
+
case 'suggestions':
|
|
174
|
+
// no-op: discoverable via DOM query from SearchButton
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
await this._registerMediaQuery(this.media);
|
|
178
|
+
}
|
|
179
|
+
disconnectedCallback() {
|
|
180
|
+
switch (this.rel?.toLowerCase()) {
|
|
181
|
+
case 'stylesheet':
|
|
182
|
+
if (this._stylesheetHost) {
|
|
183
|
+
this.link?.remove();
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
default:
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
this._layerRegistry.clear();
|
|
190
|
+
}
|
|
191
|
+
_disableLink() {
|
|
192
|
+
switch (this.rel?.toLowerCase()) {
|
|
193
|
+
case 'tile':
|
|
194
|
+
case 'image':
|
|
195
|
+
case 'features':
|
|
196
|
+
if (this._templatedLayer &&
|
|
197
|
+
this.parentExtent?._extentLayer?.hasLayer(this._templatedLayer)) {
|
|
198
|
+
this.parentExtent._extentLayer.removeLayer(this._templatedLayer);
|
|
199
|
+
delete this._templatedLayer;
|
|
200
|
+
if (this.el.shadowRoot) {
|
|
201
|
+
this.el.shadowRoot.innerHTML = '';
|
|
202
|
+
}
|
|
203
|
+
this.getLayerEl()?._validateDisabled();
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
case 'query':
|
|
207
|
+
delete this._templateVars;
|
|
208
|
+
if (this.el.shadowRoot) {
|
|
209
|
+
this.el.shadowRoot.innerHTML = '';
|
|
210
|
+
}
|
|
211
|
+
this.getLayerEl()?._validateDisabled();
|
|
212
|
+
break;
|
|
213
|
+
case 'stylesheet':
|
|
214
|
+
delete this._pmtilesRules;
|
|
215
|
+
delete this._stylesheetHost;
|
|
216
|
+
if (this.link) {
|
|
217
|
+
this.link.remove();
|
|
218
|
+
delete this.link;
|
|
219
|
+
}
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async _enableLink() {
|
|
224
|
+
switch (this.rel?.toLowerCase()) {
|
|
225
|
+
case 'tile':
|
|
226
|
+
case 'image':
|
|
227
|
+
case 'features':
|
|
228
|
+
case 'query':
|
|
229
|
+
this._initTemplateVars();
|
|
230
|
+
await this._createTemplatedLink();
|
|
231
|
+
this.getLayerEl()?._validateDisabled();
|
|
232
|
+
break;
|
|
233
|
+
case 'stylesheet':
|
|
234
|
+
this._createStylesheetLink();
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
async _registerMediaQuery(mq) {
|
|
239
|
+
if (!this._changeHandler) {
|
|
240
|
+
this._changeHandler = () => {
|
|
241
|
+
this.disabled = !this._mql.matches;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
if (mq) {
|
|
245
|
+
const map = this.getMapEl();
|
|
246
|
+
if (!map)
|
|
247
|
+
return;
|
|
248
|
+
await map.whenReady();
|
|
249
|
+
if (this._mql) {
|
|
250
|
+
this._mql.removeEventListener('change', this._changeHandler);
|
|
251
|
+
}
|
|
252
|
+
this._mql = map.matchMedia(mq);
|
|
253
|
+
this._changeHandler();
|
|
254
|
+
this._mql.addEventListener('change', this._changeHandler);
|
|
255
|
+
}
|
|
256
|
+
else if (this._mql) {
|
|
257
|
+
this._mql.removeEventListener('change', this._changeHandler);
|
|
258
|
+
delete this._mql;
|
|
259
|
+
this.disabled = false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
_createAlternateLink() {
|
|
263
|
+
if (this.href && this.projection)
|
|
264
|
+
this._alternate = true;
|
|
265
|
+
}
|
|
266
|
+
_createStylesheetLink() {
|
|
267
|
+
if (this.type === 'application/pmtiles+stylesheet') {
|
|
268
|
+
const pmtilesStyles = new URL(this.href, this.getBase()).href;
|
|
269
|
+
// Use webpackIgnore magic comment to prevent storybook Webpack from analyzing this dynamic import
|
|
270
|
+
import(/* webpackIgnore: true */ pmtilesStyles)
|
|
271
|
+
.then((module) => module.pmtilesRulesReady)
|
|
272
|
+
.then((initializedRules) => {
|
|
273
|
+
this._pmtilesRules = initializedRules;
|
|
274
|
+
this.el._pmtilesRules = initializedRules;
|
|
275
|
+
})
|
|
276
|
+
.catch((reason) => {
|
|
277
|
+
console.error('Error importing pmtiles symbolizer rules or theme: \n' + reason);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
this._stylesheetHost =
|
|
282
|
+
this.el.getRootNode() instanceof ShadowRoot
|
|
283
|
+
? this.el.getRootNode().host
|
|
284
|
+
: this.el.parentElement;
|
|
285
|
+
if (this._stylesheetHost === undefined)
|
|
286
|
+
return;
|
|
287
|
+
this.link = document.createElement('link');
|
|
288
|
+
this.el.link = this.link;
|
|
289
|
+
this.link.mapLink = this.el;
|
|
290
|
+
this.link.setAttribute('href', new URL(this.href, this.getBase()).href);
|
|
291
|
+
this._copyAttributes(this.el, this.link);
|
|
292
|
+
// Explicitly set disabled based on the property value, not the attribute
|
|
293
|
+
// (which may be stale during re-enabling)
|
|
294
|
+
this.link.disabled = this.disabled || false;
|
|
295
|
+
// Try to render immediately if parent is ready
|
|
296
|
+
// If parent isn't ready yet, the parent's mutation observer will pick this up
|
|
297
|
+
// and render it after the parent becomes ready
|
|
298
|
+
if (this._stylesheetHost._layer) {
|
|
299
|
+
this._stylesheetHost._layer.renderStyles(this.el);
|
|
300
|
+
}
|
|
301
|
+
else if (this._stylesheetHost._templatedLayer) {
|
|
302
|
+
this._stylesheetHost._templatedLayer.renderStyles(this.el);
|
|
303
|
+
}
|
|
304
|
+
else if (this._stylesheetHost._extentLayer) {
|
|
305
|
+
this._stylesheetHost._extentLayer.renderStyles(this.el);
|
|
306
|
+
}
|
|
307
|
+
// If none of the above exist yet, the parent's mutation observer
|
|
308
|
+
// or initialization will call renderStyles when it's ready
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
_copyAttributes(source, target) {
|
|
312
|
+
Array.from(source.attributes).forEach((attribute) => {
|
|
313
|
+
// Don't copy href, media, or disabled - these are handled separately
|
|
314
|
+
if (attribute.nodeName !== 'href' &&
|
|
315
|
+
attribute.nodeName !== 'media' &&
|
|
316
|
+
attribute.nodeName !== 'disabled')
|
|
317
|
+
target.setAttribute(attribute.nodeName, attribute.nodeValue);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
// Create templated layer based on rel type
|
|
321
|
+
async _createTemplatedLink() {
|
|
322
|
+
// conditions check
|
|
323
|
+
// the tms and type attributes are optional, may need to be checked in future
|
|
324
|
+
this.parentExtent =
|
|
325
|
+
this.el.parentNode?.nodeName.toUpperCase() === 'MAP-EXTENT'
|
|
326
|
+
? this.el.parentNode
|
|
327
|
+
: this.el.parentNode?.host;
|
|
328
|
+
if (this.disabled || !this.parentExtent) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
await this.parentExtent.whenReady();
|
|
333
|
+
await this._templateVars?.inputsReady;
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
console.log('Error while creating templated link: ' + error);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
this.mapEl = this.getMapEl();
|
|
340
|
+
// create the layer type appropriate to the rel value
|
|
341
|
+
this.zIndex = Array.from(this.parentExtent.querySelectorAll('map-link[rel=image],map-link[rel=tile],map-link[rel=features]')).indexOf(this.el);
|
|
342
|
+
if ((this.rel === 'tile' && this.type === 'application/pmtiles') ||
|
|
343
|
+
this.type === 'application/vnd.mapbox-vector-tile') {
|
|
344
|
+
const s = 'map-link[rel="stylesheet"][type="application/pmtiles+stylesheet"]:not([disabled])';
|
|
345
|
+
let pmtilesStylesheetLink = this.getLayerEl()?.src
|
|
346
|
+
? this.el.closest('map-extent')?.querySelector(s) ??
|
|
347
|
+
this.el.getRootNode().querySelector(':host > ' + s)
|
|
348
|
+
: Util.getClosest(this.el, 'map-extent:has(' +
|
|
349
|
+
s +
|
|
350
|
+
'),map-layer:has(' +
|
|
351
|
+
s +
|
|
352
|
+
'),layer-:has(' +
|
|
353
|
+
s +
|
|
354
|
+
')')?.querySelector(s);
|
|
355
|
+
if (pmtilesStylesheetLink) {
|
|
356
|
+
await pmtilesStylesheetLink.whenReady();
|
|
357
|
+
const options = {
|
|
358
|
+
zoomBounds: this.getZoomBounds(),
|
|
359
|
+
extentBounds: this.getBounds(),
|
|
360
|
+
crs: M[this.parentExtent.units],
|
|
361
|
+
zIndex: this.zIndex,
|
|
362
|
+
pane: this.parentExtent._extentLayer.getContainer(),
|
|
363
|
+
linkEl: this.el,
|
|
364
|
+
pmtilesRules: pmtilesStylesheetLink?._pmtilesRules
|
|
365
|
+
};
|
|
366
|
+
this._templatedLayer = templatedPMTilesLayer(this._templateVars, options).addTo(this.parentExtent._extentLayer);
|
|
367
|
+
// Publish for MapML compatibility
|
|
368
|
+
this.el._templatedLayer = this._templatedLayer;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
console.warn('Stylesheet not found for ' + this._templateVars.template);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else if (this.rel === 'tile') {
|
|
375
|
+
this._templatedLayer = templatedTileLayer(this._templateVars, {
|
|
376
|
+
zoomBounds: this.getZoomBounds(),
|
|
377
|
+
extentBounds: this.getBounds(),
|
|
378
|
+
crs: M[this.parentExtent.units],
|
|
379
|
+
errorTileUrl: 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==',
|
|
380
|
+
zIndex: this.zIndex,
|
|
381
|
+
pane: this.parentExtent._extentLayer.getContainer(),
|
|
382
|
+
linkEl: this.el
|
|
383
|
+
}).addTo(this.parentExtent._extentLayer);
|
|
384
|
+
// Publish for MapML compatibility
|
|
385
|
+
this.el._templatedLayer = this._templatedLayer;
|
|
386
|
+
}
|
|
387
|
+
else if (this.rel === 'image') {
|
|
388
|
+
this._templatedLayer = templatedImageLayer(this._templateVars, {
|
|
389
|
+
zoomBounds: this.getZoomBounds(),
|
|
390
|
+
extentBounds: this.getBounds(),
|
|
391
|
+
zIndex: this.zIndex,
|
|
392
|
+
pane: this.parentExtent._extentLayer.getContainer(),
|
|
393
|
+
linkEl: this.el
|
|
394
|
+
}).addTo(this.parentExtent._extentLayer);
|
|
395
|
+
// Publish for MapML compatibility
|
|
396
|
+
this.el._templatedLayer = this._templatedLayer;
|
|
397
|
+
}
|
|
398
|
+
else if (this.rel === 'features') {
|
|
399
|
+
// map-feature retrieved by link will be stored in shadowRoot owned by link
|
|
400
|
+
if (!this.el.shadowRoot) {
|
|
401
|
+
this.el.attachShadow({ mode: 'open' });
|
|
402
|
+
}
|
|
403
|
+
// Use the FeaturesTilesLayerGroup to handle both map-feature and map-tile elements
|
|
404
|
+
this._templatedLayer = templatedFeaturesOrTilesLayer(this._templateVars, {
|
|
405
|
+
zoomBounds: this.getZoomBounds(),
|
|
406
|
+
extentBounds: this.getBounds(),
|
|
407
|
+
zIndex: this.zIndex,
|
|
408
|
+
pane: this.parentExtent._extentLayer.getContainer(),
|
|
409
|
+
linkEl: this.el,
|
|
410
|
+
projection: this.mapEl._map.options.projection
|
|
411
|
+
}).addTo(this.parentExtent._extentLayer);
|
|
412
|
+
// Publish for MapML compatibility
|
|
413
|
+
this.el._templatedLayer = this._templatedLayer;
|
|
414
|
+
}
|
|
415
|
+
else if (this.rel === 'query') {
|
|
416
|
+
if (!this.el.shadowRoot) {
|
|
417
|
+
this.el.attachShadow({ mode: 'open' });
|
|
418
|
+
}
|
|
419
|
+
Object.assign(this._templateVars, this._setupQueryVars(this._templateVars));
|
|
420
|
+
Object.assign(this._templateVars, { extentBounds: this.getBounds() });
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
_setupQueryVars(template) {
|
|
424
|
+
// process the inputs associated to template and create an object named
|
|
425
|
+
// query with member properties as follows:
|
|
426
|
+
// {width: 'widthvarname',
|
|
427
|
+
// height: 'heightvarname',
|
|
428
|
+
// left: 'leftvarname',
|
|
429
|
+
// right: 'rightvarname',
|
|
430
|
+
// top: 'topvarname',
|
|
431
|
+
// bottom: 'bottomvarname'
|
|
432
|
+
// i: 'ivarname'
|
|
433
|
+
// j: 'jvarname'}
|
|
434
|
+
// x: 'xvarname' x being the tcrs x axis
|
|
435
|
+
// y: 'yvarname' y being the tcrs y axis
|
|
436
|
+
// z: 'zvarname' zoom
|
|
437
|
+
// title: link title
|
|
438
|
+
const queryVarNames = { query: {} };
|
|
439
|
+
const inputs = template.values;
|
|
440
|
+
for (let i = 0; i < template.values.length; i++) {
|
|
441
|
+
const type = inputs[i].getAttribute('type');
|
|
442
|
+
const units = inputs[i].getAttribute('units');
|
|
443
|
+
const axis = inputs[i].getAttribute('axis');
|
|
444
|
+
const name = inputs[i].getAttribute('name');
|
|
445
|
+
const position = inputs[i].getAttribute('position');
|
|
446
|
+
const rel = inputs[i].getAttribute('rel');
|
|
447
|
+
const select = inputs[i].tagName.toLowerCase() === 'map-select';
|
|
448
|
+
if (type === 'width') {
|
|
449
|
+
queryVarNames.query.width = name;
|
|
450
|
+
}
|
|
451
|
+
else if (type === 'height') {
|
|
452
|
+
queryVarNames.query.height = name;
|
|
453
|
+
}
|
|
454
|
+
else if (type === 'location') {
|
|
455
|
+
switch (axis) {
|
|
456
|
+
case 'x':
|
|
457
|
+
case 'y':
|
|
458
|
+
case 'column':
|
|
459
|
+
case 'row':
|
|
460
|
+
queryVarNames.query[axis] = name;
|
|
461
|
+
break;
|
|
462
|
+
case 'longitude':
|
|
463
|
+
case 'easting':
|
|
464
|
+
if (position) {
|
|
465
|
+
if (position.match(/.*?-left/i)) {
|
|
466
|
+
if (rel === 'pixel') {
|
|
467
|
+
queryVarNames.query.pixelleft = name;
|
|
468
|
+
}
|
|
469
|
+
else if (rel === 'tile') {
|
|
470
|
+
queryVarNames.query.tileleft = name;
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
queryVarNames.query.mapleft = name;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
else if (position.match(/.*?-right/i)) {
|
|
477
|
+
if (rel === 'pixel') {
|
|
478
|
+
queryVarNames.query.pixelright = name;
|
|
479
|
+
}
|
|
480
|
+
else if (rel === 'tile') {
|
|
481
|
+
queryVarNames.query.tileright = name;
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
queryVarNames.query.mapright = name;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
queryVarNames.query[axis] = name;
|
|
490
|
+
}
|
|
491
|
+
break;
|
|
492
|
+
case 'latitude':
|
|
493
|
+
case 'northing':
|
|
494
|
+
if (position) {
|
|
495
|
+
if (position.match(/top-.*?/i)) {
|
|
496
|
+
if (rel === 'pixel') {
|
|
497
|
+
queryVarNames.query.pixeltop = name;
|
|
498
|
+
}
|
|
499
|
+
else if (rel === 'tile') {
|
|
500
|
+
queryVarNames.query.tiletop = name;
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
queryVarNames.query.maptop = name;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
else if (position.match(/bottom-.*?/i)) {
|
|
507
|
+
if (rel === 'pixel') {
|
|
508
|
+
queryVarNames.query.pixelbottom = name;
|
|
509
|
+
}
|
|
510
|
+
else if (rel === 'tile') {
|
|
511
|
+
queryVarNames.query.tilebottom = name;
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
queryVarNames.query.mapbottom = name;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
queryVarNames.query[axis] = name;
|
|
520
|
+
}
|
|
521
|
+
break;
|
|
522
|
+
case 'i':
|
|
523
|
+
if (units === 'tile') {
|
|
524
|
+
queryVarNames.query.tilei = name;
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
queryVarNames.query.mapi = name;
|
|
528
|
+
}
|
|
529
|
+
break;
|
|
530
|
+
case 'j':
|
|
531
|
+
if (units === 'tile') {
|
|
532
|
+
queryVarNames.query.tilej = name;
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
queryVarNames.query.mapj = name;
|
|
536
|
+
}
|
|
537
|
+
break;
|
|
538
|
+
default:
|
|
539
|
+
// unsupported axis value
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
else if (type === 'zoom') {
|
|
543
|
+
//<input name="..." type="zoom" value="0" min="0" max="17">
|
|
544
|
+
queryVarNames.query.zoom = name;
|
|
545
|
+
}
|
|
546
|
+
else if (select) {
|
|
547
|
+
const parsedselect = inputs[i].htmlselect;
|
|
548
|
+
queryVarNames.query[name] = function () {
|
|
549
|
+
return parsedselect.value;
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
const input = inputs[i];
|
|
554
|
+
queryVarNames.query[name] = function () {
|
|
555
|
+
return input.getAttribute('value');
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return queryVarNames;
|
|
560
|
+
}
|
|
561
|
+
_initTemplateVars() {
|
|
562
|
+
const varNamesRe = new RegExp('(?:{)(.*?)(?:})', 'g');
|
|
563
|
+
const zoomInput = this.el.parentElement?.querySelector('map-input[type="zoom" i]');
|
|
564
|
+
let includesZoom = false;
|
|
565
|
+
let linkedZoomInput;
|
|
566
|
+
let template = this.trefValue;
|
|
567
|
+
if (template === M.BLANK_TT_TREF) {
|
|
568
|
+
const mapInputs = this.el.parentElement?.querySelectorAll('map-input');
|
|
569
|
+
if (mapInputs) {
|
|
570
|
+
mapInputs.forEach((i) => {
|
|
571
|
+
template += `{${i.getAttribute('name')}}`;
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
this.zoomInput = zoomInput;
|
|
576
|
+
// Publish for MapML compatibility
|
|
577
|
+
this.el.zoomInput = zoomInput;
|
|
578
|
+
let v;
|
|
579
|
+
const vcount = template.match(varNamesRe) || [];
|
|
580
|
+
const inputs = [];
|
|
581
|
+
const inputsReady = [];
|
|
582
|
+
while ((v = varNamesRe.exec(template)) !== null) {
|
|
583
|
+
const varName = v[1];
|
|
584
|
+
const inp = this.el.parentElement?.querySelector(`map-input[name=${varName}],map-select[name=${varName}]`);
|
|
585
|
+
if (inp) {
|
|
586
|
+
inputs.push(inp);
|
|
587
|
+
inputsReady.push(inp.whenReady());
|
|
588
|
+
if (inp.hasAttribute('type') &&
|
|
589
|
+
inp.getAttribute('type').toLowerCase() === 'zoom') {
|
|
590
|
+
linkedZoomInput = inp;
|
|
591
|
+
includesZoom = true;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
console.log('input with name=' +
|
|
596
|
+
varName +
|
|
597
|
+
' not found for template variable of same name');
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (template && vcount.length === inputs.length) {
|
|
601
|
+
if (!includesZoom && zoomInput) {
|
|
602
|
+
inputs.push(zoomInput);
|
|
603
|
+
inputsReady.push(zoomInput.whenReady());
|
|
604
|
+
linkedZoomInput = zoomInput;
|
|
605
|
+
}
|
|
606
|
+
const step = zoomInput ? zoomInput.getAttribute('step') : 1;
|
|
607
|
+
// Validate step: if not set, is '0', or not a number, default to 1
|
|
608
|
+
let validStep = step;
|
|
609
|
+
if (!step || step === '0' || isNaN(step))
|
|
610
|
+
validStep = 1;
|
|
611
|
+
this._templateVars = {
|
|
612
|
+
template: decodeURI(new URL(template, this.getBase()).href),
|
|
613
|
+
linkEl: this.el,
|
|
614
|
+
rel: this.rel,
|
|
615
|
+
type: this.typeValue,
|
|
616
|
+
values: inputs,
|
|
617
|
+
inputsReady: Promise.allSettled(inputsReady),
|
|
618
|
+
zoom: linkedZoomInput,
|
|
619
|
+
projection: this.el.parentElement?.getAttribute('units'),
|
|
620
|
+
tms: this.tms,
|
|
621
|
+
step: validStep
|
|
622
|
+
};
|
|
623
|
+
// Publish for MapML compatibility
|
|
624
|
+
this.el._templateVars = this._templateVars;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
// Stub implementations for bounds methods - to be completed
|
|
628
|
+
getZoomBounds() {
|
|
629
|
+
return this._getZoomBounds(this._templateVars?.zoom);
|
|
630
|
+
}
|
|
631
|
+
_getZoomBounds(zoomInput) {
|
|
632
|
+
const zoomBounds = {};
|
|
633
|
+
const meta = this.el.parentElement?.getMeta?.('zoom');
|
|
634
|
+
const metaMin = meta
|
|
635
|
+
? +Util._metaContentToObject(meta.getAttribute('content'))?.min
|
|
636
|
+
: null;
|
|
637
|
+
zoomBounds.minZoom =
|
|
638
|
+
metaMin || (zoomInput ? +zoomInput.getAttribute('min') : 0);
|
|
639
|
+
zoomBounds.minNativeZoom = zoomInput
|
|
640
|
+
? +zoomInput.getAttribute('min')
|
|
641
|
+
: zoomBounds.minZoom;
|
|
642
|
+
const metaMax = meta
|
|
643
|
+
? +Util._metaContentToObject(meta.getAttribute('content'))?.max
|
|
644
|
+
: null;
|
|
645
|
+
zoomBounds.maxZoom =
|
|
646
|
+
metaMax ||
|
|
647
|
+
(zoomInput
|
|
648
|
+
? +zoomInput.getAttribute('max')
|
|
649
|
+
: M[this.el.parentElement?.getAttribute('units')]?.options.resolutions.length - 1);
|
|
650
|
+
zoomBounds.maxNativeZoom = zoomInput
|
|
651
|
+
? +zoomInput.getAttribute('max')
|
|
652
|
+
: zoomBounds.maxZoom;
|
|
653
|
+
return zoomBounds;
|
|
654
|
+
}
|
|
655
|
+
getBounds() {
|
|
656
|
+
const template = this._templateVars;
|
|
657
|
+
if (!template)
|
|
658
|
+
return null;
|
|
659
|
+
const inputs = template.values;
|
|
660
|
+
const projection = this.el.parentElement?.getAttribute('units');
|
|
661
|
+
const boundsUnit = {};
|
|
662
|
+
boundsUnit.name = M.FALLBACK_CS;
|
|
663
|
+
let bnds = M[projection].options.crs.tilematrix.bounds(0);
|
|
664
|
+
let locInputs = false;
|
|
665
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
666
|
+
if (inputs[i].getAttribute('type') === 'location') {
|
|
667
|
+
if (!inputs[i].getAttribute('max') || !inputs[i].getAttribute('min'))
|
|
668
|
+
continue;
|
|
669
|
+
const max = +inputs[i].getAttribute('max');
|
|
670
|
+
const min = +inputs[i].getAttribute('min');
|
|
671
|
+
switch (inputs[i].getAttribute('axis')?.toLowerCase()) {
|
|
672
|
+
case 'x':
|
|
673
|
+
case 'longitude':
|
|
674
|
+
case 'column':
|
|
675
|
+
case 'easting':
|
|
676
|
+
boundsUnit.name = Util.axisToCS(inputs[i].getAttribute('axis').toLowerCase());
|
|
677
|
+
bnds.min.x = min;
|
|
678
|
+
bnds.max.x = max;
|
|
679
|
+
boundsUnit.horizontalAxis = inputs[i]
|
|
680
|
+
.getAttribute('axis')
|
|
681
|
+
.toLowerCase();
|
|
682
|
+
break;
|
|
683
|
+
case 'y':
|
|
684
|
+
case 'latitude':
|
|
685
|
+
case 'row':
|
|
686
|
+
case 'northing':
|
|
687
|
+
boundsUnit.name = Util.axisToCS(inputs[i].getAttribute('axis').toLowerCase());
|
|
688
|
+
bnds.min.y = min;
|
|
689
|
+
bnds.max.y = max;
|
|
690
|
+
boundsUnit.verticalAxis = inputs[i]
|
|
691
|
+
.getAttribute('axis')
|
|
692
|
+
.toLowerCase();
|
|
693
|
+
break;
|
|
694
|
+
default:
|
|
695
|
+
break;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
if (boundsUnit.horizontalAxis &&
|
|
700
|
+
boundsUnit.verticalAxis &&
|
|
701
|
+
((boundsUnit.horizontalAxis === 'x' && boundsUnit.verticalAxis === 'y') ||
|
|
702
|
+
(boundsUnit.horizontalAxis === 'longitude' &&
|
|
703
|
+
boundsUnit.verticalAxis === 'latitude') ||
|
|
704
|
+
(boundsUnit.horizontalAxis === 'column' &&
|
|
705
|
+
boundsUnit.verticalAxis === 'row') ||
|
|
706
|
+
(boundsUnit.horizontalAxis === 'easting' &&
|
|
707
|
+
boundsUnit.verticalAxis === 'northing'))) {
|
|
708
|
+
locInputs = true;
|
|
709
|
+
}
|
|
710
|
+
if (locInputs) {
|
|
711
|
+
const zoomValue = this._templateVars.zoom?.hasAttribute('value')
|
|
712
|
+
? +this._templateVars.zoom.getAttribute('value')
|
|
713
|
+
: 0;
|
|
714
|
+
bnds = Util.boundsToPCRSBounds(bnds, zoomValue, projection, boundsUnit.name);
|
|
715
|
+
}
|
|
716
|
+
else if (!locInputs) {
|
|
717
|
+
bnds = this.getFallbackBounds(projection);
|
|
718
|
+
}
|
|
719
|
+
return bnds;
|
|
720
|
+
}
|
|
721
|
+
getFallbackBounds(projection) {
|
|
722
|
+
let bnds;
|
|
723
|
+
let zoom = 0;
|
|
724
|
+
const metaExtent = this.el.parentElement?.getMeta?.('extent');
|
|
725
|
+
if (metaExtent) {
|
|
726
|
+
const content = Util._metaContentToObject(metaExtent.getAttribute('content'));
|
|
727
|
+
let cs;
|
|
728
|
+
zoom = content.zoom || zoom;
|
|
729
|
+
const metaKeys = Object.keys(content);
|
|
730
|
+
for (let i = 0; i < metaKeys.length; i++) {
|
|
731
|
+
if (!metaKeys[i].includes('zoom')) {
|
|
732
|
+
cs = Util.axisToCS(metaKeys[i].split('-')[2]);
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
const axes = Util.csToAxes(cs);
|
|
737
|
+
bnds = Util.boundsToPCRSBounds(bounds(point(+content[`top-left-${axes[0]}`], +content[`top-left-${axes[1]}`]), point(+content[`bottom-right-${axes[0]}`], +content[`bottom-right-${axes[1]}`])), zoom, projection, cs);
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
const crs = M[projection];
|
|
741
|
+
bnds = crs?.options.crs.pcrs.bounds;
|
|
742
|
+
}
|
|
743
|
+
return bnds;
|
|
744
|
+
}
|
|
745
|
+
isVisible() {
|
|
746
|
+
if (this.disabled)
|
|
747
|
+
return false;
|
|
748
|
+
let isVisible = false;
|
|
749
|
+
const map = this.getMapEl();
|
|
750
|
+
const mapZoom = map?.zoom;
|
|
751
|
+
const extent = map?.extent;
|
|
752
|
+
if (!extent)
|
|
753
|
+
return false;
|
|
754
|
+
const xmin = extent.topLeft.pcrs.horizontal;
|
|
755
|
+
const xmax = extent.bottomRight.pcrs.horizontal;
|
|
756
|
+
const ymin = extent.bottomRight.pcrs.vertical;
|
|
757
|
+
const ymax = extent.topLeft.pcrs.vertical;
|
|
758
|
+
const mapBounds = bounds(point(xmin, ymin), point(xmax, ymax));
|
|
759
|
+
if (this._templatedLayer) {
|
|
760
|
+
isVisible = this._templatedLayer.isVisible();
|
|
761
|
+
}
|
|
762
|
+
else if (this.rel === 'query') {
|
|
763
|
+
const minZoom = this.extent?.zoom.minZoom;
|
|
764
|
+
const maxZoom = this.extent?.zoom.maxZoom;
|
|
765
|
+
const withinZoomBounds = (z) => {
|
|
766
|
+
return minZoom <= z && z <= maxZoom;
|
|
767
|
+
};
|
|
768
|
+
const linkBounds = this.getBounds();
|
|
769
|
+
if (linkBounds?.overlaps(mapBounds) && withinZoomBounds(mapZoom)) {
|
|
770
|
+
isVisible = true;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
return isVisible;
|
|
774
|
+
}
|
|
775
|
+
zoomTo() {
|
|
776
|
+
const extent = this.extent;
|
|
777
|
+
if (!extent)
|
|
778
|
+
return;
|
|
779
|
+
const map = this.getMapEl()._map;
|
|
780
|
+
const xmin = extent.topLeft.pcrs.horizontal;
|
|
781
|
+
const xmax = extent.bottomRight.pcrs.horizontal;
|
|
782
|
+
const ymin = extent.bottomRight.pcrs.vertical;
|
|
783
|
+
const ymax = extent.topLeft.pcrs.vertical;
|
|
784
|
+
const newBounds = bounds(point(xmin, ymin), point(xmax, ymax));
|
|
785
|
+
const center = map.options.crs.unproject(newBounds.getCenter(true));
|
|
786
|
+
const maxZoom = extent.zoom.maxZoom;
|
|
787
|
+
const minZoom = extent.zoom.minZoom;
|
|
788
|
+
map.setView(center, Util.getMaxZoom(newBounds, map, minZoom, maxZoom), {
|
|
789
|
+
animate: false
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
_createSelfOrStyleLink() {
|
|
793
|
+
const layerEl = this.getLayerEl();
|
|
794
|
+
const changeStyle = function (e) {
|
|
795
|
+
DomEvent.stop(e);
|
|
796
|
+
layerEl.dispatchEvent(new CustomEvent('changestyle', {
|
|
797
|
+
detail: {
|
|
798
|
+
src: e.target.getAttribute('data-href')
|
|
799
|
+
}
|
|
800
|
+
}));
|
|
801
|
+
};
|
|
802
|
+
const styleOption = document.createElement('div');
|
|
803
|
+
const styleOptionInput = styleOption.appendChild(document.createElement('input'));
|
|
804
|
+
styleOptionInput.setAttribute('type', 'radio');
|
|
805
|
+
styleOptionInput.setAttribute('id', 'rad-' + stamp(styleOptionInput));
|
|
806
|
+
styleOptionInput.setAttribute('name', 'styles-' + stamp(styleOption));
|
|
807
|
+
styleOptionInput.setAttribute('value', this.el.getAttribute('title'));
|
|
808
|
+
styleOptionInput.setAttribute('data-href', new URL(this.href, this.getBase()).href);
|
|
809
|
+
const styleOptionLabel = styleOption.appendChild(document.createElement('label'));
|
|
810
|
+
styleOptionLabel.setAttribute('for', 'rad-' + stamp(styleOptionInput));
|
|
811
|
+
styleOptionLabel.innerText = this.el.getAttribute('title');
|
|
812
|
+
if (this.rel === 'style self' || this.rel === 'self style') {
|
|
813
|
+
styleOptionInput.checked = true;
|
|
814
|
+
}
|
|
815
|
+
this._styleOption = styleOption;
|
|
816
|
+
styleOptionInput.addEventListener('click', changeStyle.bind(this));
|
|
817
|
+
}
|
|
818
|
+
getLayerControlOption() {
|
|
819
|
+
return this._styleOption;
|
|
820
|
+
}
|
|
821
|
+
resolve() {
|
|
822
|
+
if (this.trefValue !== M.BLANK_TT_TREF) {
|
|
823
|
+
const obj = {};
|
|
824
|
+
const inputs = this.el.parentElement?.querySelectorAll('map-input');
|
|
825
|
+
if (this.rel === 'image') {
|
|
826
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
827
|
+
const inp = inputs[i];
|
|
828
|
+
obj[inp.getAttribute('name')] = inp.value;
|
|
829
|
+
}
|
|
830
|
+
return LeafletUtil.template(this.trefValue, obj);
|
|
831
|
+
}
|
|
832
|
+
else if (this.rel === 'tile') {
|
|
833
|
+
return obj;
|
|
834
|
+
}
|
|
835
|
+
else if (this.rel === 'query') {
|
|
836
|
+
// TODO
|
|
837
|
+
}
|
|
838
|
+
else if (this.rel === 'features') {
|
|
839
|
+
// TODO
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
async whenReady() {
|
|
844
|
+
return new Promise((resolve, reject) => {
|
|
845
|
+
let interval, failureTimer, ready;
|
|
846
|
+
switch (this.rel?.toLowerCase()) {
|
|
847
|
+
case 'tile':
|
|
848
|
+
case 'image':
|
|
849
|
+
case 'features':
|
|
850
|
+
ready = '_templatedLayer';
|
|
851
|
+
if (this.disabled)
|
|
852
|
+
resolve();
|
|
853
|
+
break;
|
|
854
|
+
case 'style':
|
|
855
|
+
case 'self':
|
|
856
|
+
case 'style self':
|
|
857
|
+
case 'self style':
|
|
858
|
+
ready = '_styleOption';
|
|
859
|
+
break;
|
|
860
|
+
case 'query':
|
|
861
|
+
ready = 'shadowRoot';
|
|
862
|
+
if (this.disabled)
|
|
863
|
+
resolve();
|
|
864
|
+
break;
|
|
865
|
+
case 'alternate':
|
|
866
|
+
ready = '_alternate';
|
|
867
|
+
break;
|
|
868
|
+
case 'stylesheet':
|
|
869
|
+
if (this.type === 'application/pmtiles+stylesheet') {
|
|
870
|
+
ready = '_pmtilesRules';
|
|
871
|
+
}
|
|
872
|
+
else {
|
|
873
|
+
ready = '_stylesheetHost';
|
|
874
|
+
}
|
|
875
|
+
break;
|
|
876
|
+
case 'zoomin':
|
|
877
|
+
case 'zoomout':
|
|
878
|
+
case 'legend':
|
|
879
|
+
case 'license':
|
|
880
|
+
case 'search':
|
|
881
|
+
case 'suggestions':
|
|
882
|
+
resolve();
|
|
883
|
+
return;
|
|
884
|
+
default:
|
|
885
|
+
resolve();
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
if (this[ready]) {
|
|
889
|
+
resolve();
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
interval = setInterval(testForLinkReady, 300, this);
|
|
893
|
+
failureTimer = setTimeout(linkNotDefined, 1000);
|
|
894
|
+
function testForLinkReady(linkElement) {
|
|
895
|
+
if (linkElement.el[ready]) {
|
|
896
|
+
clearInterval(interval);
|
|
897
|
+
clearTimeout(failureTimer);
|
|
898
|
+
resolve();
|
|
899
|
+
}
|
|
900
|
+
else if (!linkElement.el.isConnected) {
|
|
901
|
+
clearInterval(interval);
|
|
902
|
+
clearTimeout(failureTimer);
|
|
903
|
+
reject('map-link was disconnected while waiting to be ready');
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
function linkNotDefined() {
|
|
907
|
+
clearInterval(interval);
|
|
908
|
+
clearTimeout(failureTimer);
|
|
909
|
+
reject('Timeout reached waiting for link to be ready');
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
render() {
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
static get is() { return "map-link"; }
|
|
917
|
+
static get encapsulation() { return "shadow"; }
|
|
918
|
+
static get properties() {
|
|
919
|
+
return {
|
|
920
|
+
"type": {
|
|
921
|
+
"type": "string",
|
|
922
|
+
"mutable": false,
|
|
923
|
+
"complexType": {
|
|
924
|
+
"original": "string",
|
|
925
|
+
"resolved": "string",
|
|
926
|
+
"references": {}
|
|
927
|
+
},
|
|
928
|
+
"required": false,
|
|
929
|
+
"optional": true,
|
|
930
|
+
"docs": {
|
|
931
|
+
"tags": [],
|
|
932
|
+
"text": ""
|
|
933
|
+
},
|
|
934
|
+
"getter": false,
|
|
935
|
+
"setter": false,
|
|
936
|
+
"reflect": true,
|
|
937
|
+
"attribute": "type"
|
|
938
|
+
},
|
|
939
|
+
"rel": {
|
|
940
|
+
"type": "string",
|
|
941
|
+
"mutable": false,
|
|
942
|
+
"complexType": {
|
|
943
|
+
"original": "string",
|
|
944
|
+
"resolved": "string",
|
|
945
|
+
"references": {}
|
|
946
|
+
},
|
|
947
|
+
"required": false,
|
|
948
|
+
"optional": true,
|
|
949
|
+
"docs": {
|
|
950
|
+
"tags": [],
|
|
951
|
+
"text": ""
|
|
952
|
+
},
|
|
953
|
+
"getter": false,
|
|
954
|
+
"setter": false,
|
|
955
|
+
"reflect": true,
|
|
956
|
+
"attribute": "rel"
|
|
957
|
+
},
|
|
958
|
+
"href": {
|
|
959
|
+
"type": "string",
|
|
960
|
+
"mutable": false,
|
|
961
|
+
"complexType": {
|
|
962
|
+
"original": "string",
|
|
963
|
+
"resolved": "string",
|
|
964
|
+
"references": {}
|
|
965
|
+
},
|
|
966
|
+
"required": false,
|
|
967
|
+
"optional": true,
|
|
968
|
+
"docs": {
|
|
969
|
+
"tags": [],
|
|
970
|
+
"text": ""
|
|
971
|
+
},
|
|
972
|
+
"getter": false,
|
|
973
|
+
"setter": false,
|
|
974
|
+
"reflect": true,
|
|
975
|
+
"attribute": "href"
|
|
976
|
+
},
|
|
977
|
+
"hreflang": {
|
|
978
|
+
"type": "string",
|
|
979
|
+
"mutable": false,
|
|
980
|
+
"complexType": {
|
|
981
|
+
"original": "string",
|
|
982
|
+
"resolved": "string",
|
|
983
|
+
"references": {}
|
|
984
|
+
},
|
|
985
|
+
"required": false,
|
|
986
|
+
"optional": true,
|
|
987
|
+
"docs": {
|
|
988
|
+
"tags": [],
|
|
989
|
+
"text": ""
|
|
990
|
+
},
|
|
991
|
+
"getter": false,
|
|
992
|
+
"setter": false,
|
|
993
|
+
"reflect": true,
|
|
994
|
+
"attribute": "hreflang"
|
|
995
|
+
},
|
|
996
|
+
"tref": {
|
|
997
|
+
"type": "string",
|
|
998
|
+
"mutable": false,
|
|
999
|
+
"complexType": {
|
|
1000
|
+
"original": "string",
|
|
1001
|
+
"resolved": "string",
|
|
1002
|
+
"references": {}
|
|
1003
|
+
},
|
|
1004
|
+
"required": false,
|
|
1005
|
+
"optional": true,
|
|
1006
|
+
"docs": {
|
|
1007
|
+
"tags": [],
|
|
1008
|
+
"text": ""
|
|
1009
|
+
},
|
|
1010
|
+
"getter": false,
|
|
1011
|
+
"setter": false,
|
|
1012
|
+
"reflect": true,
|
|
1013
|
+
"attribute": "tref"
|
|
1014
|
+
},
|
|
1015
|
+
"media": {
|
|
1016
|
+
"type": "string",
|
|
1017
|
+
"mutable": false,
|
|
1018
|
+
"complexType": {
|
|
1019
|
+
"original": "string",
|
|
1020
|
+
"resolved": "string",
|
|
1021
|
+
"references": {}
|
|
1022
|
+
},
|
|
1023
|
+
"required": false,
|
|
1024
|
+
"optional": true,
|
|
1025
|
+
"docs": {
|
|
1026
|
+
"tags": [],
|
|
1027
|
+
"text": ""
|
|
1028
|
+
},
|
|
1029
|
+
"getter": false,
|
|
1030
|
+
"setter": false,
|
|
1031
|
+
"reflect": true,
|
|
1032
|
+
"attribute": "media"
|
|
1033
|
+
},
|
|
1034
|
+
"tms": {
|
|
1035
|
+
"type": "boolean",
|
|
1036
|
+
"mutable": false,
|
|
1037
|
+
"complexType": {
|
|
1038
|
+
"original": "boolean",
|
|
1039
|
+
"resolved": "boolean",
|
|
1040
|
+
"references": {}
|
|
1041
|
+
},
|
|
1042
|
+
"required": false,
|
|
1043
|
+
"optional": true,
|
|
1044
|
+
"docs": {
|
|
1045
|
+
"tags": [],
|
|
1046
|
+
"text": ""
|
|
1047
|
+
},
|
|
1048
|
+
"getter": false,
|
|
1049
|
+
"setter": false,
|
|
1050
|
+
"reflect": true,
|
|
1051
|
+
"attribute": "tms"
|
|
1052
|
+
},
|
|
1053
|
+
"projection": {
|
|
1054
|
+
"type": "string",
|
|
1055
|
+
"mutable": false,
|
|
1056
|
+
"complexType": {
|
|
1057
|
+
"original": "string",
|
|
1058
|
+
"resolved": "string",
|
|
1059
|
+
"references": {}
|
|
1060
|
+
},
|
|
1061
|
+
"required": false,
|
|
1062
|
+
"optional": true,
|
|
1063
|
+
"docs": {
|
|
1064
|
+
"tags": [],
|
|
1065
|
+
"text": ""
|
|
1066
|
+
},
|
|
1067
|
+
"getter": false,
|
|
1068
|
+
"setter": false,
|
|
1069
|
+
"reflect": true,
|
|
1070
|
+
"attribute": "projection"
|
|
1071
|
+
},
|
|
1072
|
+
"disabled": {
|
|
1073
|
+
"type": "boolean",
|
|
1074
|
+
"mutable": true,
|
|
1075
|
+
"complexType": {
|
|
1076
|
+
"original": "boolean",
|
|
1077
|
+
"resolved": "boolean",
|
|
1078
|
+
"references": {}
|
|
1079
|
+
},
|
|
1080
|
+
"required": false,
|
|
1081
|
+
"optional": true,
|
|
1082
|
+
"docs": {
|
|
1083
|
+
"tags": [],
|
|
1084
|
+
"text": ""
|
|
1085
|
+
},
|
|
1086
|
+
"getter": false,
|
|
1087
|
+
"setter": false,
|
|
1088
|
+
"reflect": true,
|
|
1089
|
+
"attribute": "disabled"
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
static get methods() {
|
|
1094
|
+
return {
|
|
1095
|
+
"whenReady": {
|
|
1096
|
+
"complexType": {
|
|
1097
|
+
"signature": "() => Promise<void>",
|
|
1098
|
+
"parameters": [],
|
|
1099
|
+
"references": {
|
|
1100
|
+
"Promise": {
|
|
1101
|
+
"location": "global",
|
|
1102
|
+
"id": "global::Promise"
|
|
1103
|
+
},
|
|
1104
|
+
"MapLink": {
|
|
1105
|
+
"location": "global",
|
|
1106
|
+
"id": "global::MapLink"
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
"return": "Promise<void>"
|
|
1110
|
+
},
|
|
1111
|
+
"docs": {
|
|
1112
|
+
"text": "",
|
|
1113
|
+
"tags": []
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
static get elementRef() { return "el"; }
|
|
1119
|
+
static get watchers() {
|
|
1120
|
+
return [{
|
|
1121
|
+
"propName": "type",
|
|
1122
|
+
"methodName": "typeChanged"
|
|
1123
|
+
}, {
|
|
1124
|
+
"propName": "rel",
|
|
1125
|
+
"methodName": "relChanged"
|
|
1126
|
+
}, {
|
|
1127
|
+
"propName": "href",
|
|
1128
|
+
"methodName": "hrefChanged"
|
|
1129
|
+
}, {
|
|
1130
|
+
"propName": "hreflang",
|
|
1131
|
+
"methodName": "hreflangChanged"
|
|
1132
|
+
}, {
|
|
1133
|
+
"propName": "tref",
|
|
1134
|
+
"methodName": "trefChanged"
|
|
1135
|
+
}, {
|
|
1136
|
+
"propName": "media",
|
|
1137
|
+
"methodName": "mediaChanged"
|
|
1138
|
+
}, {
|
|
1139
|
+
"propName": "tms",
|
|
1140
|
+
"methodName": "tmsChanged"
|
|
1141
|
+
}, {
|
|
1142
|
+
"propName": "projection",
|
|
1143
|
+
"methodName": "projectionChanged"
|
|
1144
|
+
}, {
|
|
1145
|
+
"propName": "disabled",
|
|
1146
|
+
"methodName": "disabledChanged"
|
|
1147
|
+
}];
|
|
1148
|
+
}
|
|
1149
|
+
}
|