@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
package/dist/collection/components/utils/mapml/elementSupport/layers/createLayerControlForLayer.js
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { DomUtil, SVG, DomEvent, stamp } from 'leaflet';
|
|
2
|
+
export var createLayerControlHTML = async function () {
|
|
3
|
+
var fieldset = DomUtil.create('fieldset', 'mapml-layer-item'),
|
|
4
|
+
input = DomUtil.create('input'),
|
|
5
|
+
layerItemName = DomUtil.create('span', 'mapml-layer-item-name'),
|
|
6
|
+
settingsButtonNameIcon = DomUtil.create('span'),
|
|
7
|
+
layerItemProperty = DomUtil.create(
|
|
8
|
+
'div',
|
|
9
|
+
'mapml-layer-item-properties',
|
|
10
|
+
fieldset
|
|
11
|
+
),
|
|
12
|
+
layerItemSettings = DomUtil.create(
|
|
13
|
+
'div',
|
|
14
|
+
'mapml-layer-item-settings',
|
|
15
|
+
fieldset
|
|
16
|
+
),
|
|
17
|
+
itemToggleLabel = DomUtil.create(
|
|
18
|
+
'label',
|
|
19
|
+
'mapml-layer-item-toggle',
|
|
20
|
+
layerItemProperty
|
|
21
|
+
),
|
|
22
|
+
layerItemControls = DomUtil.create(
|
|
23
|
+
'div',
|
|
24
|
+
'mapml-layer-item-controls',
|
|
25
|
+
layerItemProperty
|
|
26
|
+
),
|
|
27
|
+
opacityControl = DomUtil.create(
|
|
28
|
+
'details',
|
|
29
|
+
'mapml-layer-item-opacity mapml-control-layers',
|
|
30
|
+
layerItemSettings
|
|
31
|
+
),
|
|
32
|
+
opacity = DomUtil.create('input'),
|
|
33
|
+
opacityControlSummary = DomUtil.create('summary'),
|
|
34
|
+
svgSettingsControlIcon = SVG.create('svg'),
|
|
35
|
+
settingsControlPath1 = SVG.create('path'),
|
|
36
|
+
settingsControlPath2 = SVG.create('path'),
|
|
37
|
+
extentsFieldset = DomUtil.create('fieldset', 'mapml-layer-grouped-extents'),
|
|
38
|
+
mapEl = this.parentNode;
|
|
39
|
+
opacity.setAttribute('data-testid', 'layer-item-opacity');
|
|
40
|
+
|
|
41
|
+
// append the paths in svg for the remove layer and toggle icons
|
|
42
|
+
svgSettingsControlIcon.setAttribute('viewBox', '0 0 24 24');
|
|
43
|
+
svgSettingsControlIcon.setAttribute('height', '22');
|
|
44
|
+
svgSettingsControlIcon.setAttribute('width', '22');
|
|
45
|
+
svgSettingsControlIcon.setAttribute('fill', 'currentColor');
|
|
46
|
+
settingsControlPath1.setAttribute('d', 'M0 0h24v24H0z');
|
|
47
|
+
settingsControlPath1.setAttribute('fill', 'none');
|
|
48
|
+
settingsControlPath2.setAttribute(
|
|
49
|
+
'd',
|
|
50
|
+
'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'
|
|
51
|
+
);
|
|
52
|
+
svgSettingsControlIcon.appendChild(settingsControlPath1);
|
|
53
|
+
svgSettingsControlIcon.appendChild(settingsControlPath2);
|
|
54
|
+
|
|
55
|
+
layerItemSettings.hidden = true;
|
|
56
|
+
settingsButtonNameIcon.setAttribute('aria-hidden', true);
|
|
57
|
+
|
|
58
|
+
let removeControlButton = DomUtil.create(
|
|
59
|
+
'button',
|
|
60
|
+
'mapml-layer-item-remove-control',
|
|
61
|
+
layerItemControls
|
|
62
|
+
);
|
|
63
|
+
removeControlButton.type = 'button';
|
|
64
|
+
removeControlButton.title = mapEl.locale.lmRemoveLayer;
|
|
65
|
+
removeControlButton.innerHTML = "<span aria-hidden='true'>✕</span>";
|
|
66
|
+
removeControlButton.classList.add('mapml-button');
|
|
67
|
+
DomEvent.on(removeControlButton, 'click', DomEvent.stop);
|
|
68
|
+
DomEvent.on(
|
|
69
|
+
removeControlButton,
|
|
70
|
+
'click',
|
|
71
|
+
(e) => {
|
|
72
|
+
let fieldset = 0,
|
|
73
|
+
elem,
|
|
74
|
+
root;
|
|
75
|
+
root =
|
|
76
|
+
mapEl.tagName === 'GCDS-EXT-MAP'
|
|
77
|
+
? mapEl.shadowRoot
|
|
78
|
+
: mapEl.querySelector('.mapml-web-map').shadowRoot;
|
|
79
|
+
if (
|
|
80
|
+
e.target.closest('fieldset').nextElementSibling &&
|
|
81
|
+
!e.target.closest('fieldset').nextElementSibling.disbaled
|
|
82
|
+
) {
|
|
83
|
+
elem = e.target.closest('fieldset').previousElementSibling;
|
|
84
|
+
while (elem) {
|
|
85
|
+
fieldset += 2; // find the next layer menu item
|
|
86
|
+
elem = elem.previousElementSibling;
|
|
87
|
+
}
|
|
88
|
+
} else {
|
|
89
|
+
// focus on the link
|
|
90
|
+
elem = 'link';
|
|
91
|
+
}
|
|
92
|
+
mapEl.removeChild(
|
|
93
|
+
e.target.closest('fieldset').querySelector('span').layer._layerEl
|
|
94
|
+
);
|
|
95
|
+
elem = elem
|
|
96
|
+
? root.querySelector('.leaflet-control-attribution').firstElementChild
|
|
97
|
+
: (elem = root.querySelectorAll('input')[fieldset]);
|
|
98
|
+
elem.focus();
|
|
99
|
+
},
|
|
100
|
+
this._layer
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
let itemSettingControlButton = DomUtil.create(
|
|
104
|
+
'button',
|
|
105
|
+
'mapml-layer-item-settings-control',
|
|
106
|
+
layerItemControls
|
|
107
|
+
);
|
|
108
|
+
itemSettingControlButton.type = 'button';
|
|
109
|
+
itemSettingControlButton.title = mapEl.locale.lmLayerSettings;
|
|
110
|
+
itemSettingControlButton.setAttribute('aria-expanded', false);
|
|
111
|
+
itemSettingControlButton.classList.add('mapml-button');
|
|
112
|
+
DomEvent.on(
|
|
113
|
+
itemSettingControlButton,
|
|
114
|
+
'click',
|
|
115
|
+
(e) => {
|
|
116
|
+
let layerControl = this._layer._layerEl._layerControl._container;
|
|
117
|
+
if (!layerControl._isExpanded && e.pointerType === 'touch') {
|
|
118
|
+
layerControl._isExpanded = true;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (layerItemSettings.hidden === true) {
|
|
122
|
+
itemSettingControlButton.setAttribute('aria-expanded', true);
|
|
123
|
+
layerItemSettings.hidden = false;
|
|
124
|
+
} else {
|
|
125
|
+
itemSettingControlButton.setAttribute('aria-expanded', false);
|
|
126
|
+
layerItemSettings.hidden = true;
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
this._layer
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
input.defaultChecked = this.checked;
|
|
133
|
+
input.type = 'checkbox';
|
|
134
|
+
input.setAttribute('class', 'leaflet-control-layers-selector');
|
|
135
|
+
input.setAttribute('data-testid', 'layer-item-checkbox');
|
|
136
|
+
layerItemName.layer = this._layer;
|
|
137
|
+
const changeCheck = function () {
|
|
138
|
+
this.checked = !this.checked;
|
|
139
|
+
this.dispatchEvent(new CustomEvent('map-change'));
|
|
140
|
+
this._layerControlCheckbox.focus();
|
|
141
|
+
};
|
|
142
|
+
input.addEventListener('change', changeCheck.bind(this));
|
|
143
|
+
if (this._layer._legendUrl) {
|
|
144
|
+
var legendLink = document.createElement('a');
|
|
145
|
+
legendLink.text = ' ' + this._layer._title;
|
|
146
|
+
legendLink.href = this._layer._legendUrl;
|
|
147
|
+
legendLink.target = '_blank';
|
|
148
|
+
legendLink.draggable = false;
|
|
149
|
+
layerItemName.appendChild(legendLink);
|
|
150
|
+
} else {
|
|
151
|
+
layerItemName.innerHTML = this._layer._title;
|
|
152
|
+
}
|
|
153
|
+
layerItemName.id = 'mapml-layer-item-name-{' + stamp(layerItemName) + '}';
|
|
154
|
+
opacityControlSummary.innerText = mapEl.locale.lcOpacity;
|
|
155
|
+
opacityControlSummary.id =
|
|
156
|
+
'mapml-layer-item-opacity-' + stamp(opacityControlSummary);
|
|
157
|
+
opacityControl.appendChild(opacityControlSummary);
|
|
158
|
+
opacityControl.appendChild(opacity);
|
|
159
|
+
opacity.setAttribute('type', 'range');
|
|
160
|
+
opacity.setAttribute('min', '0');
|
|
161
|
+
opacity.setAttribute('max', '1.0');
|
|
162
|
+
opacity.setAttribute('value', this._opacity || '1.0');
|
|
163
|
+
opacity.setAttribute('step', '0.1');
|
|
164
|
+
opacity.setAttribute(
|
|
165
|
+
'aria-labelledby',
|
|
166
|
+
'mapml-layer-item-opacity-' + stamp(opacityControlSummary)
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const changeOpacity = function (e) {
|
|
170
|
+
if (e && e.target && e.target.value >= 0 && e.target.value <= 1.0) {
|
|
171
|
+
this._layer.changeOpacity(e.target.value);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
opacity.value = this._opacity || '1.0';
|
|
175
|
+
opacity.addEventListener('change', changeOpacity.bind(this));
|
|
176
|
+
|
|
177
|
+
fieldset.setAttribute('aria-grabbed', 'false');
|
|
178
|
+
fieldset.setAttribute('aria-labelledby', layerItemName.id);
|
|
179
|
+
|
|
180
|
+
fieldset.ontouchstart = fieldset.onmousedown = (downEvent) => {
|
|
181
|
+
if (
|
|
182
|
+
(downEvent.target.parentElement.tagName.toLowerCase() === 'label' &&
|
|
183
|
+
downEvent.target.tagName.toLowerCase() !== 'input') ||
|
|
184
|
+
downEvent.target.tagName.toLowerCase() === 'label'
|
|
185
|
+
) {
|
|
186
|
+
downEvent =
|
|
187
|
+
downEvent instanceof TouchEvent ? downEvent.touches[0] : downEvent;
|
|
188
|
+
let control = fieldset,
|
|
189
|
+
controls = fieldset.parentNode,
|
|
190
|
+
moving = false,
|
|
191
|
+
yPos = downEvent.clientY,
|
|
192
|
+
originalPosition = Array.from(
|
|
193
|
+
controls.querySelectorAll('fieldset')
|
|
194
|
+
).indexOf(fieldset);
|
|
195
|
+
|
|
196
|
+
document.body.ontouchmove = document.body.onmousemove = (moveEvent) => {
|
|
197
|
+
moveEvent.preventDefault();
|
|
198
|
+
moveEvent =
|
|
199
|
+
moveEvent instanceof TouchEvent ? moveEvent.touches[0] : moveEvent;
|
|
200
|
+
|
|
201
|
+
// Fixes flickering by only moving element when there is enough space
|
|
202
|
+
let offset = moveEvent.clientY - yPos;
|
|
203
|
+
moving = Math.abs(offset) > 15 || moving;
|
|
204
|
+
if (
|
|
205
|
+
(controls && !moving) ||
|
|
206
|
+
(controls && controls.childElementCount <= 1) ||
|
|
207
|
+
controls.getBoundingClientRect().top >
|
|
208
|
+
control.getBoundingClientRect().bottom ||
|
|
209
|
+
controls.getBoundingClientRect().bottom <
|
|
210
|
+
control.getBoundingClientRect().top
|
|
211
|
+
) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
controls.classList.add('mapml-draggable');
|
|
216
|
+
control.style.transform = 'translateY(' + offset + 'px)';
|
|
217
|
+
control.style.pointerEvents = 'none';
|
|
218
|
+
|
|
219
|
+
let x = moveEvent.clientX,
|
|
220
|
+
y = moveEvent.clientY,
|
|
221
|
+
root =
|
|
222
|
+
mapEl.tagName === 'GCDS-EXT-MAP'
|
|
223
|
+
? mapEl.shadowRoot
|
|
224
|
+
: mapEl.querySelector('.mapml-web-map').shadowRoot,
|
|
225
|
+
elementAt = root.elementFromPoint(x, y),
|
|
226
|
+
swapControl =
|
|
227
|
+
!elementAt || !elementAt.closest('fieldset')
|
|
228
|
+
? control
|
|
229
|
+
: elementAt.closest('fieldset');
|
|
230
|
+
|
|
231
|
+
swapControl =
|
|
232
|
+
Math.abs(offset) <= swapControl.offsetHeight ? control : swapControl;
|
|
233
|
+
|
|
234
|
+
control.setAttribute('aria-grabbed', 'true');
|
|
235
|
+
control.setAttribute('aria-dropeffect', 'move');
|
|
236
|
+
if (swapControl && controls === swapControl.parentNode) {
|
|
237
|
+
swapControl =
|
|
238
|
+
swapControl !== control.nextSibling
|
|
239
|
+
? swapControl
|
|
240
|
+
: swapControl.nextSibling;
|
|
241
|
+
if (control !== swapControl) {
|
|
242
|
+
yPos = moveEvent.clientY;
|
|
243
|
+
control.style.transform = null;
|
|
244
|
+
}
|
|
245
|
+
controls.insertBefore(control, swapControl);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
document.body.ontouchend = document.body.onmouseup = () => {
|
|
250
|
+
let newPosition = Array.from(
|
|
251
|
+
controls.querySelectorAll('fieldset')
|
|
252
|
+
).indexOf(fieldset);
|
|
253
|
+
control.setAttribute('aria-grabbed', 'false');
|
|
254
|
+
control.removeAttribute('aria-dropeffect');
|
|
255
|
+
control.style.pointerEvents = null;
|
|
256
|
+
control.style.transform = null;
|
|
257
|
+
if (originalPosition !== newPosition) {
|
|
258
|
+
let controlsElems = controls.children,
|
|
259
|
+
zIndex = 1;
|
|
260
|
+
// re-order layer elements DOM order
|
|
261
|
+
for (let c of controlsElems) {
|
|
262
|
+
let layerEl = c.querySelector('span').layer._layerEl;
|
|
263
|
+
layerEl.setAttribute('data-moving', '');
|
|
264
|
+
mapEl.insertAdjacentElement('beforeend', layerEl);
|
|
265
|
+
layerEl.removeAttribute('data-moving');
|
|
266
|
+
}
|
|
267
|
+
// update zIndex of all map-layer elements
|
|
268
|
+
let layers = mapEl.querySelectorAll('map-layer,layer-');
|
|
269
|
+
for (let i = 0; i < layers.length; i++) {
|
|
270
|
+
let layer = layers[i]._layer;
|
|
271
|
+
if (layer.options.zIndex !== zIndex) {
|
|
272
|
+
layer.setZIndex(zIndex);
|
|
273
|
+
}
|
|
274
|
+
zIndex++;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
controls.classList.remove('mapml-draggable');
|
|
278
|
+
document.body.ontouchmove =
|
|
279
|
+
document.body.onmousemove =
|
|
280
|
+
document.body.onmouseup =
|
|
281
|
+
null;
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
itemToggleLabel.appendChild(input);
|
|
287
|
+
itemToggleLabel.appendChild(layerItemName);
|
|
288
|
+
itemSettingControlButton.appendChild(settingsButtonNameIcon);
|
|
289
|
+
settingsButtonNameIcon.appendChild(svgSettingsControlIcon);
|
|
290
|
+
|
|
291
|
+
let mapml = this.src ? this.shadowRoot : this;
|
|
292
|
+
var styleLinks = mapml.querySelectorAll(
|
|
293
|
+
'map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]'
|
|
294
|
+
);
|
|
295
|
+
let styles;
|
|
296
|
+
if (styleLinks) {
|
|
297
|
+
styles = this.getAlternateStyles(styleLinks);
|
|
298
|
+
if (styles) {
|
|
299
|
+
layerItemSettings.appendChild(styles);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
this._layerControlCheckbox = input;
|
|
304
|
+
this._layerControlLabel = itemToggleLabel;
|
|
305
|
+
this._opacityControl = opacityControl;
|
|
306
|
+
this._opacitySlider = opacity;
|
|
307
|
+
this._layerControlHTML = fieldset;
|
|
308
|
+
this._layerItemSettingsHTML = layerItemSettings;
|
|
309
|
+
this._propertiesGroupAnatomy = extentsFieldset;
|
|
310
|
+
this._styles = styles;
|
|
311
|
+
extentsFieldset.setAttribute('aria-label', 'Sublayers');
|
|
312
|
+
extentsFieldset.setAttribute('hidden', '');
|
|
313
|
+
let mapExtents = mapml.querySelectorAll('map-extent:not([hidden])');
|
|
314
|
+
let mapExtentLayerControls = [];
|
|
315
|
+
for (let i = 0; i < mapExtents.length; i++) {
|
|
316
|
+
mapExtentLayerControls.push(mapExtents[i].whenReady());
|
|
317
|
+
// if any map-extent is not hidden, the parent fieldset should not be hidden
|
|
318
|
+
extentsFieldset.removeAttribute('hidden');
|
|
319
|
+
}
|
|
320
|
+
await Promise.all(mapExtentLayerControls);
|
|
321
|
+
for (let i = 0; i < mapExtents.length; i++) {
|
|
322
|
+
extentsFieldset.appendChild(mapExtents[i].getLayerControlHTML());
|
|
323
|
+
}
|
|
324
|
+
layerItemSettings.appendChild(extentsFieldset);
|
|
325
|
+
return this._layerControlHTML;
|
|
326
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export function renderStyles(mapStyleOrLink) {
|
|
2
|
+
let e = mapStyleOrLink.link || mapStyleOrLink.styleElement;
|
|
3
|
+
if (e === undefined) return;
|
|
4
|
+
|
|
5
|
+
const getStylePositionAndNode = (styleOrLink) => {
|
|
6
|
+
// Get all already rendered <style> or <link> elements in the shadow DOM container
|
|
7
|
+
const renderedSiblingStyles = Array.from(
|
|
8
|
+
this._container.querySelectorAll(':scope > style, :scope > link[rel="stylesheet"]')
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
// If there are no rendered styles or links yet, insert before any content
|
|
12
|
+
if (renderedSiblingStyles.length === 0) {
|
|
13
|
+
const lastChild = this._container.lastChild;
|
|
14
|
+
if (!lastChild) {
|
|
15
|
+
return { position: 'afterbegin', node: this._container };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const isSVG = lastChild.nodeName === 'SVG';
|
|
19
|
+
const isContainer = lastChild.classList?.contains('mapml-vector-container') ||
|
|
20
|
+
lastChild.classList?.contains('mapml-extentlayer-container');
|
|
21
|
+
|
|
22
|
+
return (isSVG || isContainer)
|
|
23
|
+
? { position: 'beforebegin', node: lastChild }
|
|
24
|
+
: { position: 'afterend', node: lastChild };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Peek into the light DOM context for comparison
|
|
28
|
+
const mapStyleOrLinkLightDOMElement =
|
|
29
|
+
styleOrLink.mapStyle || styleOrLink.mapLink;
|
|
30
|
+
|
|
31
|
+
// Traverse the rendered siblings in the shadow DOM
|
|
32
|
+
for (let i = 0; i < renderedSiblingStyles.length; i++) {
|
|
33
|
+
const rendered = renderedSiblingStyles[i];
|
|
34
|
+
const siblingMapStyleOrLinkLightDOMElement =
|
|
35
|
+
rendered.mapStyle || rendered.mapLink;
|
|
36
|
+
|
|
37
|
+
// Compare the light DOM order
|
|
38
|
+
if (
|
|
39
|
+
siblingMapStyleOrLinkLightDOMElement &&
|
|
40
|
+
mapStyleOrLinkLightDOMElement.compareDocumentPosition(
|
|
41
|
+
siblingMapStyleOrLinkLightDOMElement
|
|
42
|
+
) & Node.DOCUMENT_POSITION_FOLLOWING
|
|
43
|
+
) {
|
|
44
|
+
// Insert the new style or link before the already-rendered sibling element
|
|
45
|
+
return { position: 'beforebegin', node: rendered };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// If no preceding sibling was found, insert after the last rendered element
|
|
50
|
+
return { position: 'afterend', node: renderedSiblingStyles.at(-1) };
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
let positionAndNode = getStylePositionAndNode(e);
|
|
54
|
+
positionAndNode.node.insertAdjacentElement(positionAndNode.position, e);
|
|
55
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { parseMediaQueryList } from 'media-query-parser';
|
|
2
|
+
import { solveMediaQueryList } from 'media-query-solver';
|
|
3
|
+
|
|
4
|
+
export const matchMedia = function (query) {
|
|
5
|
+
// useful features for maps: prefers-color-scheme, prefers-lang, projection, zoom, extent
|
|
6
|
+
const parsedQuery = parseMediaQueryList(query);
|
|
7
|
+
|
|
8
|
+
// less obviously useful: aspect-ratio, orientation, (device) resolution, overflow-block, overflow-inline
|
|
9
|
+
|
|
10
|
+
const map = this;
|
|
11
|
+
const features = {
|
|
12
|
+
'prefers-lang': {
|
|
13
|
+
type: 'discrete',
|
|
14
|
+
get values() {
|
|
15
|
+
return [navigator.language.substring(0, 2)];
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
'map-projection': {
|
|
19
|
+
type: 'discrete',
|
|
20
|
+
get values() {
|
|
21
|
+
return [map.projection.toLowerCase()];
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
'map-zoom': {
|
|
25
|
+
type: 'range',
|
|
26
|
+
valueType: 'integer',
|
|
27
|
+
canBeNegative: false,
|
|
28
|
+
canBeZero: true,
|
|
29
|
+
get extraValues() {
|
|
30
|
+
return {
|
|
31
|
+
min: 0,
|
|
32
|
+
max: map.zoom
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
'map-top-left-easting': {
|
|
37
|
+
type: 'range',
|
|
38
|
+
valueType: 'integer',
|
|
39
|
+
canBeNegative: true,
|
|
40
|
+
canBeZero: true,
|
|
41
|
+
get values() {
|
|
42
|
+
return [Math.trunc(map.extent.topLeft.pcrs.horizontal)];
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
'map-top-left-northing': {
|
|
46
|
+
type: 'range',
|
|
47
|
+
valueType: 'integer',
|
|
48
|
+
canBeNegative: true,
|
|
49
|
+
canBeZero: true,
|
|
50
|
+
get values() {
|
|
51
|
+
return [Math.trunc(map.extent.topLeft.pcrs.vertical)];
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
'map-bottom-right-easting': {
|
|
55
|
+
type: 'range',
|
|
56
|
+
valueType: 'integer',
|
|
57
|
+
canBeNegative: true,
|
|
58
|
+
canBeZero: true,
|
|
59
|
+
get values() {
|
|
60
|
+
return [Math.trunc(map.extent.bottomRight.pcrs.horizontal)];
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
'map-bottom-right-northing': {
|
|
64
|
+
type: 'range',
|
|
65
|
+
valueType: 'integer',
|
|
66
|
+
canBeNegative: true,
|
|
67
|
+
canBeZero: true,
|
|
68
|
+
get values() {
|
|
69
|
+
return [Math.trunc(map.extent.bottomRight.pcrs.vertical)];
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
'prefers-color-scheme': {
|
|
73
|
+
type: 'discrete',
|
|
74
|
+
get values() {
|
|
75
|
+
return [
|
|
76
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
77
|
+
? 'dark'
|
|
78
|
+
: 'light'
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
'prefers-map-content': {
|
|
83
|
+
type: 'discrete',
|
|
84
|
+
get values() {
|
|
85
|
+
return M.options.contentPreference;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const solveUnknownFeature = (featureNode) => {
|
|
91
|
+
let feature = featureNode.feature;
|
|
92
|
+
let queryValue = featureNode.value.value;
|
|
93
|
+
|
|
94
|
+
if (feature === 'prefers-lang') {
|
|
95
|
+
return features['prefers-lang'].values.includes(queryValue).toString();
|
|
96
|
+
} else if (
|
|
97
|
+
feature === 'map-zoom' ||
|
|
98
|
+
feature === 'map-top-left-easting' ||
|
|
99
|
+
feature === 'map-top-left-northing' ||
|
|
100
|
+
feature === 'map-bottom-right-easting' ||
|
|
101
|
+
feature === 'map-bottom-right-northing'
|
|
102
|
+
) {
|
|
103
|
+
return solveRangeFeature(featureNode);
|
|
104
|
+
} else if (feature === 'map-projection') {
|
|
105
|
+
return features['map-projection'].values
|
|
106
|
+
.some((p) => p === queryValue)
|
|
107
|
+
.toString();
|
|
108
|
+
} else if (feature === 'prefers-color-scheme') {
|
|
109
|
+
return features['prefers-color-scheme'].values
|
|
110
|
+
.some((s) => s === queryValue)
|
|
111
|
+
.toString();
|
|
112
|
+
} else if (feature === 'prefers-map-content') {
|
|
113
|
+
return features[feature].values
|
|
114
|
+
.some((pref) => pref === queryValue)
|
|
115
|
+
.toString();
|
|
116
|
+
}
|
|
117
|
+
return 'false';
|
|
118
|
+
};
|
|
119
|
+
let matches =
|
|
120
|
+
solveMediaQueryList(parsedQuery, {
|
|
121
|
+
features,
|
|
122
|
+
solveUnknownFeature
|
|
123
|
+
}) === 'true'
|
|
124
|
+
? true
|
|
125
|
+
: false;
|
|
126
|
+
|
|
127
|
+
function solveRangeFeature(featureNode) {
|
|
128
|
+
const { context, feature, value, op } = featureNode;
|
|
129
|
+
|
|
130
|
+
if (!feature.startsWith('map-')) {
|
|
131
|
+
return 'unknown';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const currentValue = getMapFeatureValue(feature);
|
|
135
|
+
|
|
136
|
+
if (currentValue === undefined) {
|
|
137
|
+
return 'unknown';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (context === 'value') {
|
|
141
|
+
// Plain case: <mf-name>: <mf-value>
|
|
142
|
+
// Example: (map-zoom: 15)
|
|
143
|
+
return currentValue === value.value ? 'true' : 'false';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (context === 'range') {
|
|
147
|
+
// Range case: <mf-name> <mf-comparison> <mf-value>
|
|
148
|
+
// Example: (0 <= map-zoom < 15)
|
|
149
|
+
switch (op) {
|
|
150
|
+
case '<':
|
|
151
|
+
return currentValue < value.value ? 'true' : 'false';
|
|
152
|
+
case '<=':
|
|
153
|
+
return currentValue <= value.value ? 'true' : 'false';
|
|
154
|
+
case '>':
|
|
155
|
+
return currentValue > value.value ? 'true' : 'false';
|
|
156
|
+
case '>=':
|
|
157
|
+
return currentValue >= value.value ? 'true' : 'false';
|
|
158
|
+
case '=':
|
|
159
|
+
return currentValue === value.value ? 'true' : 'false';
|
|
160
|
+
default:
|
|
161
|
+
return 'unknown';
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return 'unknown'; // If the context is neither "value" nor "range"
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function getMapFeatureValue(feature) {
|
|
169
|
+
switch (feature) {
|
|
170
|
+
case 'map-zoom':
|
|
171
|
+
return map.zoom;
|
|
172
|
+
case 'map-top-left-easting':
|
|
173
|
+
return Math.trunc(map.extent.topLeft.pcrs.horizontal);
|
|
174
|
+
case 'map-top-left-northing':
|
|
175
|
+
return Math.trunc(map.extent.topLeft.pcrs.vertical);
|
|
176
|
+
case 'map-bottom-right-easting':
|
|
177
|
+
return Math.trunc(map.extent.bottomRight.pcrs.horizontal);
|
|
178
|
+
case 'map-bottom-right-northing':
|
|
179
|
+
return Math.trunc(map.extent.bottomRight.pcrs.vertical);
|
|
180
|
+
default:
|
|
181
|
+
return undefined; // Unsupported or unknown feature
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Make mediaQueryList an EventTarget for dispatching events
|
|
186
|
+
const mediaQueryList = Object.assign(new EventTarget(), {
|
|
187
|
+
matches,
|
|
188
|
+
media: query,
|
|
189
|
+
listeners: [],
|
|
190
|
+
// this is a client facing api
|
|
191
|
+
addEventListener(event, listener) {
|
|
192
|
+
if (event === 'change') {
|
|
193
|
+
this.listeners.push(listener);
|
|
194
|
+
|
|
195
|
+
// Start observing properties only if there is at least one listener
|
|
196
|
+
if (this.listeners.length !== 0) {
|
|
197
|
+
observeProperties();
|
|
198
|
+
}
|
|
199
|
+
EventTarget.prototype.addEventListener.call(this, event, listener);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
// this is a client facing api
|
|
204
|
+
removeEventListener(event, listener) {
|
|
205
|
+
if (event === 'change') {
|
|
206
|
+
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
207
|
+
|
|
208
|
+
// Stop observing if there are no more listeners
|
|
209
|
+
if (this.listeners.length === 0) {
|
|
210
|
+
stopObserving();
|
|
211
|
+
}
|
|
212
|
+
EventTarget.prototype.removeEventListener.call(this, event, listener);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const observeProperties = () => {
|
|
218
|
+
const notifyIfChanged = () => {
|
|
219
|
+
const newMatches =
|
|
220
|
+
solveMediaQueryList(parsedQuery, {
|
|
221
|
+
features,
|
|
222
|
+
solveUnknownFeature
|
|
223
|
+
}) === 'true'
|
|
224
|
+
? true
|
|
225
|
+
: false;
|
|
226
|
+
if (newMatches !== mediaQueryList.matches) {
|
|
227
|
+
mediaQueryList.matches = newMatches;
|
|
228
|
+
|
|
229
|
+
// Dispatch a "change" event to notify listeners of the update
|
|
230
|
+
mediaQueryList.dispatchEvent(new Event('change'));
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
notifyIfChanged.bind(this);
|
|
234
|
+
// Subscribe to internal events for changes in projection, zoom, and extent
|
|
235
|
+
this.addEventListener('map-projectionchange', notifyIfChanged);
|
|
236
|
+
this.addEventListener('map-moveend', notifyIfChanged);
|
|
237
|
+
const colorSchemeQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
238
|
+
colorSchemeQuery.addEventListener('change', notifyIfChanged);
|
|
239
|
+
|
|
240
|
+
// Stop observing function
|
|
241
|
+
stopObserving = () => {
|
|
242
|
+
this.removeEventListener('map-projectionchange', notifyIfChanged);
|
|
243
|
+
this.removeEventListener('map-moveend', notifyIfChanged);
|
|
244
|
+
colorSchemeQuery.removeEventListener('change', notifyIfChanged);
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
let stopObserving; // Declare here so it can be assigned within observeProperties
|
|
249
|
+
|
|
250
|
+
return mediaQueryList;
|
|
251
|
+
};
|