@npm9912/v-map 0.1.0
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 +185 -0
- package/dist/cjs/_commonjsHelpers-B83fTs8d.js +36 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/cesium-provider-BiFFyAl9.js +2598 -0
- package/dist/cjs/deck-provider-Ctq3Q8a1.js +47824 -0
- package/dist/cjs/geotiff-CEwvF9cG.js +47 -0
- package/dist/cjs/geotiff-source-RaNzzWkC.js +1522 -0
- package/dist/cjs/index-B1oGO1g-.js +10658 -0
- package/dist/cjs/index-B8LHqjyg.js +1765 -0
- package/dist/cjs/index-BIL4VsgP.js +310 -0
- package/dist/cjs/index-Blku2QY8.js +167 -0
- package/dist/cjs/index-CJvvX4yx.js +21 -0
- package/dist/cjs/index-CbVT-Con.js +699 -0
- package/dist/cjs/index-ISOEpMC3.js +20478 -0
- package/dist/cjs/index-JSwBbvGA.js +1621 -0
- package/dist/cjs/index.browser-DQhD8Jwl.js +6873 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/layer-extension-B_olS0rc.js +65 -0
- package/dist/cjs/leaflet-provider-DOqfs7g5.js +1815 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/main-dist-7TykwFci.js +2655 -0
- package/dist/cjs/messages-D7h4m8Tx.js +186 -0
- package/dist/cjs/openlayers-provider-Dfeg6L4n.js +1604 -0
- package/dist/cjs/polygon-layer-B9PrN7vr.js +1300 -0
- package/dist/cjs/scenegraph-layer-DwNoxQdi.js +2530 -0
- package/dist/cjs/styleconfig-CVRqArk-.js +23 -0
- package/dist/cjs/v-map-builder.cjs.entry.js +3786 -0
- package/dist/cjs/v-map-layer-geojson_12.cjs.entry.js +40894 -0
- package/dist/cjs/v-map-layer-helper-iAzxAg9I.js +285 -0
- package/dist/cjs/v-map-layer-terrain-geotiff.cjs.entry.js +258 -0
- package/dist/cjs/v-map-layercontrol.cjs.entry.js +247 -0
- package/dist/cjs/v-map.cjs.js +25 -0
- package/dist/cjs/v-map.v-map-layer-osm.v-map-layergroup-BsXp3BoL.js +582 -0
- package/dist/cjs/v-map_3.cjs.entry.js +12 -0
- package/dist/collection/collection-manifest.json +30 -0
- package/dist/collection/components/v-map/v-map.css +3 -0
- package/dist/collection/components/v-map/v-map.js +467 -0
- package/dist/collection/components/v-map/v-map.test.js +33 -0
- package/dist/collection/components/v-map-builder/v-map-builder.css +1 -0
- package/dist/collection/components/v-map-builder/v-map-builder.js +913 -0
- package/dist/collection/components/v-map-builder/v-map-builder.test.js +56 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.js +862 -0
- package/dist/collection/components/v-map-layer-geojson/v-map-layer-geojson.test.js +42 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.css +4 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.js +500 -0
- package/dist/collection/components/v-map-layer-geotiff/v-map-layer-geotiff.test.js +38 -0
- package/dist/collection/components/v-map-layer-google/v-map-layer-google.css +1 -0
- package/dist/collection/components/v-map-layer-google/v-map-layer-google.js +442 -0
- package/dist/collection/components/v-map-layer-osm/error-api.test.js +108 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.css +4 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.js +311 -0
- package/dist/collection/components/v-map-layer-osm/v-map-layer-osm.test.js +36 -0
- package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.css +1 -0
- package/dist/collection/components/v-map-layer-scatterplot/v-map-layer-scatterplot.js +305 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.css +3 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.js +548 -0
- package/dist/collection/components/v-map-layer-terrain/v-map-layer-terrain.test.js +36 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.css +3 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.js +735 -0
- package/dist/collection/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.js +42 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.css +3 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.js +449 -0
- package/dist/collection/components/v-map-layer-tile3d/v-map-layer-tile3d.test.js +50 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.css +1 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.js +448 -0
- package/dist/collection/components/v-map-layer-wcs/v-map-layer-wcs.test.js +39 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.css +1 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.js +489 -0
- package/dist/collection/components/v-map-layer-wfs/v-map-layer-wfs.test.js +43 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.css +1 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.js +811 -0
- package/dist/collection/components/v-map-layer-wkt/v-map-layer-wkt.test.js +34 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.css +1 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.js +453 -0
- package/dist/collection/components/v-map-layer-wms/v-map-layer-wms.test.js +36 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.css +1 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.js +331 -0
- package/dist/collection/components/v-map-layer-xyz/v-map-layer-xyz.test.js +28 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.css +74 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.js +277 -0
- package/dist/collection/components/v-map-layercontrol/v-map-layercontrol.test.js +134 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.css +4 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.js +212 -0
- package/dist/collection/components/v-map-layergroup/v-map-layergroup.test.js +39 -0
- package/dist/collection/components/v-map-style/v-map-style.css +38 -0
- package/dist/collection/components/v-map-style/v-map-style.js +492 -0
- package/dist/collection/components/v-map-style/v-map-style.unit.js +62 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/layer/v-map-layer-helper.js +281 -0
- package/dist/collection/layer/v-map-layer-helper.unit.js +234 -0
- package/dist/collection/lib/cesium-loader.js +58 -0
- package/dist/collection/lib/ensure-importmap.js +12 -0
- package/dist/collection/lib/ensure-importmap.unit.js +57 -0
- package/dist/collection/lib/versions.gen.js +6 -0
- package/dist/collection/lib/vstyle.js +8 -0
- package/dist/collection/map-provider/cesium/CesiumGeoTIFFTerrainProvider.js +285 -0
- package/dist/collection/map-provider/cesium/CesiumLayerGroups.js +159 -0
- package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.js +192 -0
- package/dist/collection/map-provider/cesium/GeoTIFFImageryProvider.test.js +57 -0
- package/dist/collection/map-provider/cesium/cesium-provider.js +1408 -0
- package/dist/collection/map-provider/cesium/i-layer.js +1 -0
- package/dist/collection/map-provider/cesium/layer-manager.js +467 -0
- package/dist/collection/map-provider/deck/DeckGLGeoTIFFLayer.js +483 -0
- package/dist/collection/map-provider/deck/DeckGLGeoTIFFTerrainLayer.js +410 -0
- package/dist/collection/map-provider/deck/LayerGroupWithModel.js +169 -0
- package/dist/collection/map-provider/deck/LayerGroups.js +192 -0
- package/dist/collection/map-provider/deck/LayerModel.js +1 -0
- package/dist/collection/map-provider/deck/RenderableGroup.js +1 -0
- package/dist/collection/map-provider/deck/deck-provider.js +1563 -0
- package/dist/collection/map-provider/geotiff/geotiff-source.js +172 -0
- package/dist/collection/map-provider/geotiff/utils/AABB2D.js +24 -0
- package/dist/collection/map-provider/geotiff/utils/BVHNode2D.js +166 -0
- package/dist/collection/map-provider/geotiff/utils/GeoTIFFTileProcessor.js +484 -0
- package/dist/collection/map-provider/geotiff/utils/Triangle.js +1 -0
- package/dist/collection/map-provider/geotiff/utils/Triangulation.js +321 -0
- package/dist/collection/map-provider/geotiff/utils/colormap-utils.js +190 -0
- package/dist/collection/map-provider/geotiff/utils/normalization-utils.js +122 -0
- package/dist/collection/map-provider/geotiff/utils/sampling-utils.js +108 -0
- package/dist/collection/map-provider/leaflet/GeoTIFFGridLayer.js +147 -0
- package/dist/collection/map-provider/leaflet/WCSGridLayer.js +124 -0
- package/dist/collection/map-provider/leaflet/google-map-tiles-layer.js +352 -0
- package/dist/collection/map-provider/leaflet/leaflet-helpers.js +94 -0
- package/dist/collection/map-provider/leaflet/leaflet-provider.js +1095 -0
- package/dist/collection/map-provider/ol/CustomGeoTiff.js +145 -0
- package/dist/collection/map-provider/ol/openlayers-helper.js +26 -0
- package/dist/collection/map-provider/ol/openlayers-provider.js +1427 -0
- package/dist/collection/map-provider/provider-factory.js +44 -0
- package/dist/collection/map-provider/provider-factory.unit.js +66 -0
- package/dist/collection/testing/browser-test-utils.js +49 -0
- package/dist/collection/testing/e2e-testing.js +122 -0
- package/dist/collection/testing/e2e-utils.js +70 -0
- package/dist/collection/testing/geotiff-test-server.js +100 -0
- package/dist/collection/testing/mocks/geostyler-lyrx-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-mapbox-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-qgis-parser.js +12 -0
- package/dist/collection/testing/mocks/geostyler-sld-parser.js +13 -0
- package/dist/collection/testing/mocks/geostyler-style.js +5 -0
- package/dist/collection/testing/setupTests.browser.js +1 -0
- package/dist/collection/testing/setupTests.stencil.js +20 -0
- package/dist/collection/testing/setupTests.vitest.js +59 -0
- package/dist/collection/testing/stencil-testing-wrapper.js +43 -0
- package/dist/collection/testing/styleMock.js +1 -0
- package/dist/collection/types/color.js +1 -0
- package/dist/collection/types/cssmode.js +1 -0
- package/dist/collection/types/flavour.js +1 -0
- package/dist/collection/types/layerconfig.js +1 -0
- package/dist/collection/types/lonlat.js +1 -0
- package/dist/collection/types/mapinitoptions.js +1 -0
- package/dist/collection/types/mapprovider.js +1 -0
- package/dist/collection/types/provideroptions.js +1 -0
- package/dist/collection/types/styleconfig.js +19 -0
- package/dist/collection/types/styling.js +13 -0
- package/dist/collection/types/styling.unit.js +37 -0
- package/dist/collection/types/vmaplayer.js +1 -0
- package/dist/collection/utils/async-mutex.js +28 -0
- package/dist/collection/utils/diff.js +142 -0
- package/dist/collection/utils/diff.unit.js +59 -0
- package/dist/collection/utils/dom-env.js +43 -0
- package/dist/collection/utils/dom-env.unit.js +92 -0
- package/dist/collection/utils/events.js +8 -0
- package/dist/collection/utils/logger.js +183 -0
- package/dist/collection/utils/logger.unit.js +98 -0
- package/dist/collection/utils/messages.js +12 -0
- package/dist/collection/utils/spatial-utils.js +27 -0
- package/dist/collection/utils/spatial-utils.unit.js +24 -0
- package/dist/components/_commonjsHelpers.js +1 -0
- package/dist/components/cesium-provider.js +1 -0
- package/dist/components/deck-provider.js +1 -0
- package/dist/components/events.js +1 -0
- package/dist/components/geotiff-source.js +1 -0
- package/dist/components/geotiff.js +4 -0
- package/dist/components/index.browser.js +15 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +1 -0
- package/dist/components/index3.js +1 -0
- package/dist/components/index4.js +1 -0
- package/dist/components/index5.js +1 -0
- package/dist/components/index6.js +1 -0
- package/dist/components/index7.js +1 -0
- package/dist/components/index8.js +7 -0
- package/dist/components/layer-extension.js +1 -0
- package/dist/components/leaflet-provider.js +1 -0
- package/dist/components/main-dist.js +1 -0
- package/dist/components/messages.js +1 -0
- package/dist/components/openlayers-provider.js +1 -0
- package/dist/components/polygon-layer.js +1 -0
- package/dist/components/scenegraph-layer.js +1 -0
- package/dist/components/styleconfig.js +1 -0
- package/dist/components/styling.js +1 -0
- package/dist/components/v-map-builder.d.ts +11 -0
- package/dist/components/v-map-builder.js +2 -0
- package/dist/components/v-map-layer-geojson.d.ts +11 -0
- package/dist/components/v-map-layer-geojson.js +1 -0
- package/dist/components/v-map-layer-geojson2.js +1 -0
- package/dist/components/v-map-layer-geotiff.d.ts +11 -0
- package/dist/components/v-map-layer-geotiff.js +1 -0
- package/dist/components/v-map-layer-geotiff2.js +1 -0
- package/dist/components/v-map-layer-google.d.ts +11 -0
- package/dist/components/v-map-layer-google.js +1 -0
- package/dist/components/v-map-layer-google2.js +1 -0
- package/dist/components/v-map-layer-helper.js +1 -0
- package/dist/components/v-map-layer-osm.d.ts +11 -0
- package/dist/components/v-map-layer-osm.js +1 -0
- package/dist/components/v-map-layer-osm2.js +1 -0
- package/dist/components/v-map-layer-scatterplot.d.ts +11 -0
- package/dist/components/v-map-layer-scatterplot.js +1 -0
- package/dist/components/v-map-layer-scatterplot2.js +1 -0
- package/dist/components/v-map-layer-terrain-geotiff.d.ts +11 -0
- package/dist/components/v-map-layer-terrain-geotiff.js +1 -0
- package/dist/components/v-map-layer-terrain.d.ts +11 -0
- package/dist/components/v-map-layer-terrain.js +1 -0
- package/dist/components/v-map-layer-terrain2.js +1 -0
- package/dist/components/v-map-layer-tile3d.d.ts +11 -0
- package/dist/components/v-map-layer-tile3d.js +1 -0
- package/dist/components/v-map-layer-tile3d2.js +1 -0
- package/dist/components/v-map-layer-wcs.d.ts +11 -0
- package/dist/components/v-map-layer-wcs.js +1 -0
- package/dist/components/v-map-layer-wcs2.js +1 -0
- package/dist/components/v-map-layer-wfs.d.ts +11 -0
- package/dist/components/v-map-layer-wfs.js +1 -0
- package/dist/components/v-map-layer-wfs2.js +1 -0
- package/dist/components/v-map-layer-wkt.d.ts +11 -0
- package/dist/components/v-map-layer-wkt.js +1 -0
- package/dist/components/v-map-layer-wkt2.js +1 -0
- package/dist/components/v-map-layer-wms.d.ts +11 -0
- package/dist/components/v-map-layer-wms.js +1 -0
- package/dist/components/v-map-layer-wms2.js +1 -0
- package/dist/components/v-map-layer-xyz.d.ts +11 -0
- package/dist/components/v-map-layer-xyz.js +1 -0
- package/dist/components/v-map-layer-xyz2.js +1 -0
- package/dist/components/v-map-layercontrol.d.ts +11 -0
- package/dist/components/v-map-layercontrol.js +1 -0
- package/dist/components/v-map-layergroup.d.ts +11 -0
- package/dist/components/v-map-layergroup.js +1 -0
- package/dist/components/v-map-layergroup2.js +1 -0
- package/dist/components/v-map-style.d.ts +11 -0
- package/dist/components/v-map-style.js +1 -0
- package/dist/components/v-map-style2.js +10 -0
- package/dist/components/v-map.d.ts +11 -0
- package/dist/components/v-map.js +1 -0
- package/dist/components/v-map2.js +1 -0
- package/dist/esm/_commonjsHelpers-E-ZsRS8r.js +32 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/cesium-provider-BJfAup3w.js +2596 -0
- package/dist/esm/deck-provider-C7U9VDEq.js +47709 -0
- package/dist/esm/geotiff-BEWxTIfH.js +45 -0
- package/dist/esm/geotiff-source-esnDnC-u.js +1516 -0
- package/dist/esm/index-B1zwA4IC.js +685 -0
- package/dist/esm/index-BBpiaTpT.js +165 -0
- package/dist/esm/index-BIEmlzCf.js +1697 -0
- package/dist/esm/index-BUHa4Jj0.js +307 -0
- package/dist/esm/index-DbSdn93t.js +20461 -0
- package/dist/esm/index-RpJarvr_.js +10656 -0
- package/dist/esm/index-jN06TXUp.js +14 -0
- package/dist/esm/index-jzneDarq.js +1613 -0
- package/dist/esm/index.browser-DhQAXuA7.js +6860 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/layer-extension-CZXK5goK.js +63 -0
- package/dist/esm/leaflet-provider-Q41TB6ku.js +1794 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/main-dist-CwnA7_Xn.js +2652 -0
- package/dist/esm/messages-CMKJzsgL.js +180 -0
- package/dist/esm/openlayers-provider-CMsDsQTQ.js +1602 -0
- package/dist/esm/polygon-layer-ByhxGhWC.js +1295 -0
- package/dist/esm/scenegraph-layer-09K_B6DT.js +2526 -0
- package/dist/esm/styleconfig-B-bAcABs.js +21 -0
- package/dist/esm/v-map-builder.entry.js +3784 -0
- package/dist/esm/v-map-layer-geojson_12.entry.js +40881 -0
- package/dist/esm/v-map-layer-helper-Dys44Cgo.js +283 -0
- package/dist/esm/v-map-layer-terrain-geotiff.entry.js +256 -0
- package/dist/esm/v-map-layercontrol.entry.js +245 -0
- package/dist/esm/v-map.js +21 -0
- package/dist/esm/v-map.v-map-layer-osm.v-map-layergroup-B4pFHuSf.js +572 -0
- package/dist/esm/v-map_3.entry.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/cesium-augment.d.ts +5 -0
- package/dist/types/components/v-map/v-map.d.ts +70 -0
- package/dist/types/components/v-map/v-map.test.d.ts +1 -0
- package/dist/types/components/v-map-builder/v-map-builder.d.ts +48 -0
- package/dist/types/components/v-map-builder/v-map-builder.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.d.ts +129 -0
- package/dist/types/components/v-map-layer-geojson/v-map-layer-geojson.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.d.ts +74 -0
- package/dist/types/components/v-map-layer-geotiff/v-map-layer-geotiff.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-google/v-map-layer-google.d.ts +78 -0
- package/dist/types/components/v-map-layer-osm/error-api.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-osm/v-map-layer-osm.d.ts +50 -0
- package/dist/types/components/v-map-layer-osm/v-map-layer-osm.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-scatterplot/v-map-layer-scatterplot.d.ts +54 -0
- package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.d.ts +74 -0
- package/dist/types/components/v-map-layer-terrain/v-map-layer-terrain.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.d.ts +117 -0
- package/dist/types/components/v-map-layer-terrain-geotiff/v-map-layer-terrain-geotiff.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.d.ts +69 -0
- package/dist/types/components/v-map-layer-tile3d/v-map-layer-tile3d.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.d.ts +47 -0
- package/dist/types/components/v-map-layer-wcs/v-map-layer-wcs.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.d.ts +59 -0
- package/dist/types/components/v-map-layer-wfs/v-map-layer-wfs.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.d.ts +132 -0
- package/dist/types/components/v-map-layer-wkt/v-map-layer-wkt.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-wms/v-map-layer-wms.d.ts +76 -0
- package/dist/types/components/v-map-layer-wms/v-map-layer-wms.test.d.ts +1 -0
- package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.d.ts +59 -0
- package/dist/types/components/v-map-layer-xyz/v-map-layer-xyz.test.d.ts +1 -0
- package/dist/types/components/v-map-layercontrol/v-map-layercontrol.d.ts +44 -0
- package/dist/types/components/v-map-layercontrol/v-map-layercontrol.test.d.ts +1 -0
- package/dist/types/components/v-map-layergroup/v-map-layergroup.d.ts +31 -0
- package/dist/types/components/v-map-layergroup/v-map-layergroup.test.d.ts +1 -0
- package/dist/types/components/v-map-style/v-map-style.d.ts +75 -0
- package/dist/types/components/v-map-style/v-map-style.unit.d.ts +1 -0
- package/dist/types/components.d.ts +2391 -0
- package/dist/types/globals.d.ts +16 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/layer/v-map-layer-helper.d.ts +45 -0
- package/dist/types/layer/v-map-layer-helper.unit.d.ts +1 -0
- package/dist/types/leaflet-augment.d.ts +15 -0
- package/dist/types/lib/cesium-loader.d.ts +3 -0
- package/dist/types/lib/ensure-importmap.d.ts +3 -0
- package/dist/types/lib/ensure-importmap.unit.d.ts +1 -0
- package/dist/types/lib/versions.gen.d.ts +5 -0
- package/dist/types/lib/vstyle.d.ts +44 -0
- package/dist/types/map-provider/cesium/CesiumGeoTIFFTerrainProvider.d.ts +92 -0
- package/dist/types/map-provider/cesium/CesiumLayerGroups.d.ts +64 -0
- package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.d.ts +75 -0
- package/dist/types/map-provider/cesium/GeoTIFFImageryProvider.test.d.ts +1 -0
- package/dist/types/map-provider/cesium/cesium-provider.d.ts +87 -0
- package/dist/types/map-provider/cesium/i-layer.d.ts +11 -0
- package/dist/types/map-provider/cesium/layer-manager.d.ts +31 -0
- package/dist/types/map-provider/deck/DeckGLGeoTIFFLayer.d.ts +91 -0
- package/dist/types/map-provider/deck/DeckGLGeoTIFFTerrainLayer.d.ts +82 -0
- package/dist/types/map-provider/deck/LayerGroupWithModel.d.ts +55 -0
- package/dist/types/map-provider/deck/LayerGroups.d.ts +63 -0
- package/dist/types/map-provider/deck/LayerModel.d.ts +8 -0
- package/dist/types/map-provider/deck/RenderableGroup.d.ts +20 -0
- package/dist/types/map-provider/deck/deck-provider.d.ts +92 -0
- package/dist/types/map-provider/geotiff/geotiff-source.d.ts +30 -0
- package/dist/types/map-provider/geotiff/utils/AABB2D.d.ts +28 -0
- package/dist/types/map-provider/geotiff/utils/BVHNode2D.d.ts +36 -0
- package/dist/types/map-provider/geotiff/utils/GeoTIFFTileProcessor.d.ts +116 -0
- package/dist/types/map-provider/geotiff/utils/Triangle.d.ts +5 -0
- package/dist/types/map-provider/geotiff/utils/Triangulation.d.ts +94 -0
- package/dist/types/map-provider/geotiff/utils/colormap-utils.d.ts +47 -0
- package/dist/types/map-provider/geotiff/utils/normalization-utils.d.ts +39 -0
- package/dist/types/map-provider/geotiff/utils/sampling-utils.d.ts +13 -0
- package/dist/types/map-provider/leaflet/GeoTIFFGridLayer.d.ts +34 -0
- package/dist/types/map-provider/leaflet/WCSGridLayer.d.ts +38 -0
- package/dist/types/map-provider/leaflet/google-map-tiles-layer.d.ts +73 -0
- package/dist/types/map-provider/leaflet/leaflet-helpers.d.ts +6 -0
- package/dist/types/map-provider/leaflet/leaflet-provider.d.ts +73 -0
- package/dist/types/map-provider/ol/CustomGeoTiff.d.ts +14 -0
- package/dist/types/map-provider/ol/openlayers-helper.d.ts +2 -0
- package/dist/types/map-provider/ol/openlayers-provider.d.ts +80 -0
- package/dist/types/map-provider/provider-factory.d.ts +12 -0
- package/dist/types/map-provider/provider-factory.unit.d.ts +1 -0
- package/dist/types/namespaces.d.ts +3 -0
- package/dist/types/ol-augment.d.ts +3 -0
- package/dist/types/ol-override.d.ts +7 -0
- package/dist/types/ol.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/testing/browser-test-utils.d.ts +6 -0
- package/dist/types/testing/e2e-testing.d.ts +5 -0
- package/dist/types/testing/e2e-utils.d.ts +4 -0
- package/dist/types/testing/geotiff-test-server.d.ts +5 -0
- package/dist/types/testing/mocks/geostyler-lyrx-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-mapbox-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-qgis-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-sld-parser.d.ts +11 -0
- package/dist/types/testing/mocks/geostyler-style.d.ts +5 -0
- package/dist/types/testing/setupTests.browser.d.ts +1 -0
- package/dist/types/testing/setupTests.stencil.d.ts +1 -0
- package/dist/types/testing/setupTests.vitest.d.ts +1 -0
- package/dist/types/testing/stencil-testing-wrapper.d.ts +3 -0
- package/dist/types/types/color.d.ts +1 -0
- package/dist/types/types/cssmode.d.ts +1 -0
- package/dist/types/types/flavour.d.ts +1 -0
- package/dist/types/types/layerconfig.d.ts +207 -0
- package/dist/types/types/lonlat.d.ts +1 -0
- package/dist/types/types/mapinitoptions.d.ts +4 -0
- package/dist/types/types/mapprovider.d.ts +46 -0
- package/dist/types/types/provideroptions.d.ts +8 -0
- package/dist/types/types/styleconfig.d.ts +27 -0
- package/dist/types/types/styling.d.ts +24 -0
- package/dist/types/types/styling.unit.d.ts +1 -0
- package/dist/types/types/vmaplayer.d.ts +10 -0
- package/dist/types/utils/async-mutex.d.ts +7 -0
- package/dist/types/utils/diff.d.ts +64 -0
- package/dist/types/utils/diff.unit.d.ts +1 -0
- package/dist/types/utils/dom-env.d.ts +5 -0
- package/dist/types/utils/dom-env.unit.d.ts +1 -0
- package/dist/types/utils/events.d.ts +29 -0
- package/dist/types/utils/logger.d.ts +47 -0
- package/dist/types/utils/logger.unit.d.ts +1 -0
- package/dist/types/utils/messages.d.ts +12 -0
- package/dist/types/utils/spatial-utils.d.ts +6 -0
- package/dist/types/utils/spatial-utils.unit.d.ts +1 -0
- package/dist/types/versions.d.ts +7 -0
- package/dist/v-map/index.esm.js +0 -0
- package/dist/v-map/p--vVleK-M.js +1 -0
- package/dist/v-map/p-09d10db0.entry.js +1 -0
- package/dist/v-map/p-5eba6058.entry.js +10 -0
- package/dist/v-map/p-6b102336.entry.js +1 -0
- package/dist/v-map/p-B-bAcABs.js +1 -0
- package/dist/v-map/p-BBpiaTpT.js +1 -0
- package/dist/v-map/p-BdijL4Av.js +1 -0
- package/dist/v-map/p-Be3r33VF.js +4 -0
- package/dist/v-map/p-BeFu0ap4.js +1 -0
- package/dist/v-map/p-BxFJezdK.js +1 -0
- package/dist/v-map/p-CMKJzsgL.js +1 -0
- package/dist/v-map/p-CXfA_q8m.js +1 -0
- package/dist/v-map/p-CZqY0yW4.js +1 -0
- package/dist/v-map/p-CafTHT9i.js +1 -0
- package/dist/v-map/p-DCTHyf58.js +1 -0
- package/dist/v-map/p-DQuL1Twl.js +1 -0
- package/dist/v-map/p-DR9McdNX.js +1 -0
- package/dist/v-map/p-Dckgonw8.js +1 -0
- package/dist/v-map/p-DhQAXuA7.js +15 -0
- package/dist/v-map/p-DmICdG34.js +7 -0
- package/dist/v-map/p-DrOQ9V4h.js +1 -0
- package/dist/v-map/p-DvHXtWUg.js +1 -0
- package/dist/v-map/p-E-ZsRS8r.js +1 -0
- package/dist/v-map/p-MyTSFnEk.js +1 -0
- package/dist/v-map/p-RpJarvr_.js +1 -0
- package/dist/v-map/p-WaMDUuAz.js +1 -0
- package/dist/v-map/p-aa410e64.entry.js +2 -0
- package/dist/v-map/p-c21c93fe.entry.js +1 -0
- package/dist/v-map/p-jzneDarq.js +2 -0
- package/dist/v-map/p-uiIP-taz.js +1 -0
- package/dist/v-map/v-map.esm.js +1 -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 +193 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default style configuration values
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_STYLE = {
|
|
5
|
+
// Fill styling
|
|
6
|
+
fillColor: 'rgba(0, 100, 255, 0.3)',
|
|
7
|
+
fillOpacity: 0.3,
|
|
8
|
+
// Stroke styling
|
|
9
|
+
strokeColor: 'rgba(0, 100, 255, 1)',
|
|
10
|
+
strokeWidth: 2,
|
|
11
|
+
strokeOpacity: 1,
|
|
12
|
+
// Point styling
|
|
13
|
+
pointRadius: 6,
|
|
14
|
+
pointColor: 'rgba(0, 100, 255, 1)',
|
|
15
|
+
pointOpacity: 1,
|
|
16
|
+
// Text styling
|
|
17
|
+
textColor: '#000000',
|
|
18
|
+
textSize: 12,
|
|
19
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function isArrayLike(val) {
|
|
2
|
+
return (val != null &&
|
|
3
|
+
typeof val.length === 'number' &&
|
|
4
|
+
(Array.isArray(val) || typeof val[0] !== 'undefined'));
|
|
5
|
+
}
|
|
6
|
+
export function isGeoStylerStyle(obj) {
|
|
7
|
+
// Schnell‑Abbruch, wenn kein Objekt vorliegt
|
|
8
|
+
if (typeof obj !== 'object' || obj === null)
|
|
9
|
+
return false;
|
|
10
|
+
const u = obj;
|
|
11
|
+
// Pflichtfelder prüfen
|
|
12
|
+
return typeof u.name === 'string' && isArrayLike(u.rules);
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { isGeoStylerStyle } from "./styling";
|
|
3
|
+
describe('isGeoStylerStyle', () => {
|
|
4
|
+
it('returns true for a style-like object with a name and rules array', () => {
|
|
5
|
+
expect(isGeoStylerStyle({
|
|
6
|
+
name: 'Style',
|
|
7
|
+
rules: [],
|
|
8
|
+
})).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
it('returns true for array-like rules', () => {
|
|
11
|
+
expect(isGeoStylerStyle({
|
|
12
|
+
name: 'Style',
|
|
13
|
+
rules: { 0: { name: 'rule' }, length: 1 },
|
|
14
|
+
})).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
it('returns false for null and non-objects', () => {
|
|
17
|
+
expect(isGeoStylerStyle(null)).toBe(false);
|
|
18
|
+
expect(isGeoStylerStyle('style')).toBe(false);
|
|
19
|
+
expect(isGeoStylerStyle(42)).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
it('returns false when name is missing or not a string', () => {
|
|
22
|
+
expect(isGeoStylerStyle({ rules: [] })).toBe(false);
|
|
23
|
+
expect(isGeoStylerStyle({
|
|
24
|
+
name: 123,
|
|
25
|
+
rules: [],
|
|
26
|
+
})).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
it('returns false when rules are missing or not array-like', () => {
|
|
29
|
+
expect(isGeoStylerStyle({
|
|
30
|
+
name: 'Style',
|
|
31
|
+
})).toBe(false);
|
|
32
|
+
expect(isGeoStylerStyle({
|
|
33
|
+
name: 'Style',
|
|
34
|
+
rules: {},
|
|
35
|
+
})).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// utils/async-mutex.ts
|
|
2
|
+
export class AsyncMutex {
|
|
3
|
+
locked = false;
|
|
4
|
+
queue = [];
|
|
5
|
+
async runExclusive(fn) {
|
|
6
|
+
await this.acquire();
|
|
7
|
+
try {
|
|
8
|
+
return await fn();
|
|
9
|
+
}
|
|
10
|
+
finally {
|
|
11
|
+
this.release();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
acquire() {
|
|
15
|
+
if (!this.locked) {
|
|
16
|
+
this.locked = true;
|
|
17
|
+
return Promise.resolve();
|
|
18
|
+
}
|
|
19
|
+
return new Promise(resolve => this.queue.push(resolve));
|
|
20
|
+
}
|
|
21
|
+
release() {
|
|
22
|
+
const next = this.queue.shift();
|
|
23
|
+
if (next)
|
|
24
|
+
next();
|
|
25
|
+
else
|
|
26
|
+
this.locked = false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const EPS = 1e-9;
|
|
2
|
+
function toBoolString(v) {
|
|
3
|
+
if (v == null)
|
|
4
|
+
return undefined;
|
|
5
|
+
if (typeof v === 'boolean')
|
|
6
|
+
return v ? 'true' : 'false';
|
|
7
|
+
const s = String(v).toLowerCase();
|
|
8
|
+
if (s === 'true' || s === '1')
|
|
9
|
+
return 'true';
|
|
10
|
+
if (s === 'false' || s === '0')
|
|
11
|
+
return 'false';
|
|
12
|
+
return s;
|
|
13
|
+
}
|
|
14
|
+
function toNumOrUndef(v) {
|
|
15
|
+
if (v == null)
|
|
16
|
+
return undefined;
|
|
17
|
+
const n = typeof v === 'number' ? v : Number(v);
|
|
18
|
+
return Number.isFinite(n) ? n : undefined;
|
|
19
|
+
}
|
|
20
|
+
/** stable JSON for objects (key-sorted) */
|
|
21
|
+
function stableStringify(obj) {
|
|
22
|
+
if (obj == null)
|
|
23
|
+
return undefined;
|
|
24
|
+
if (typeof obj !== 'object')
|
|
25
|
+
return JSON.stringify(obj);
|
|
26
|
+
const keys = Object.keys(obj).sort();
|
|
27
|
+
const acc = {};
|
|
28
|
+
for (const k of keys)
|
|
29
|
+
acc[k] = obj[k];
|
|
30
|
+
return JSON.stringify(acc);
|
|
31
|
+
}
|
|
32
|
+
function eqNum(a, b) {
|
|
33
|
+
if (a == null && b == null)
|
|
34
|
+
return true;
|
|
35
|
+
if (a == null || b == null)
|
|
36
|
+
return false;
|
|
37
|
+
return Math.abs(a - b) <= EPS;
|
|
38
|
+
}
|
|
39
|
+
function eqStr(a, b) {
|
|
40
|
+
return (a ?? undefined) === (b ?? undefined);
|
|
41
|
+
}
|
|
42
|
+
/** Compare fields relevant for rendering; returns patch (only changed fields) */
|
|
43
|
+
export function diffRelevantFields(a, b) {
|
|
44
|
+
const changes = {};
|
|
45
|
+
if (a.type !== b.type)
|
|
46
|
+
changes.type = { old: a.type, new: b.type };
|
|
47
|
+
const aVisible = toBoolString(a.visible);
|
|
48
|
+
const bVisible = toBoolString(b.visible);
|
|
49
|
+
if (!eqStr(aVisible, bVisible))
|
|
50
|
+
changes.visible = { old: aVisible, new: bVisible };
|
|
51
|
+
const aOpacity = toNumOrUndef(a.opacity);
|
|
52
|
+
const bOpacity = toNumOrUndef(b.opacity);
|
|
53
|
+
if (!eqNum(aOpacity, bOpacity))
|
|
54
|
+
changes.opacity = { old: aOpacity, new: bOpacity };
|
|
55
|
+
const aZ = toNumOrUndef(a.zIndex);
|
|
56
|
+
const bZ = toNumOrUndef(b.zIndex);
|
|
57
|
+
if (!eqNum(aZ, bZ))
|
|
58
|
+
changes.zIndex = { old: aZ, new: bZ };
|
|
59
|
+
if (!eqStr(a.url, b.url))
|
|
60
|
+
changes.url = { old: a.url, new: b.url };
|
|
61
|
+
if (!eqStr(a.layers, b.layers))
|
|
62
|
+
changes.layers = { old: a.layers, new: b.layers };
|
|
63
|
+
const aTiled = toBoolString(a.tiled);
|
|
64
|
+
const bTiled = toBoolString(b.tiled);
|
|
65
|
+
if (!eqStr(aTiled, bTiled))
|
|
66
|
+
changes.tiled = { old: aTiled, new: bTiled };
|
|
67
|
+
const aStyle = stableStringify(a.style);
|
|
68
|
+
const bStyle = stableStringify(b.style);
|
|
69
|
+
if (!eqStr(aStyle, bStyle))
|
|
70
|
+
changes.style = { old: a.style, new: b.style };
|
|
71
|
+
const aData = stableStringify(a.data);
|
|
72
|
+
const bData = stableStringify(b.data);
|
|
73
|
+
if (!eqStr(aData, bData))
|
|
74
|
+
changes.data = { old: a.data, new: b.data };
|
|
75
|
+
return changes;
|
|
76
|
+
}
|
|
77
|
+
/** Longest Common Subsequence for stable move detection (by IDs) */
|
|
78
|
+
function lcs(a, b) {
|
|
79
|
+
const m = a.length, n = b.length;
|
|
80
|
+
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
81
|
+
for (let i = m - 1; i >= 0; i--) {
|
|
82
|
+
for (let j = n - 1; j >= 0; j--) {
|
|
83
|
+
dp[i][j] =
|
|
84
|
+
a[i] === b[j]
|
|
85
|
+
? dp[i + 1][j + 1] + 1
|
|
86
|
+
: Math.max(dp[i + 1][j], dp[i][j + 1]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const seq = [];
|
|
90
|
+
let i = 0, j = 0;
|
|
91
|
+
while (i < m && j < n) {
|
|
92
|
+
if (a[i] === b[j]) {
|
|
93
|
+
seq.push(a[i]);
|
|
94
|
+
i++;
|
|
95
|
+
j++;
|
|
96
|
+
}
|
|
97
|
+
else if (dp[i + 1][j] >= dp[i][j + 1])
|
|
98
|
+
i++;
|
|
99
|
+
else
|
|
100
|
+
j++;
|
|
101
|
+
}
|
|
102
|
+
return seq;
|
|
103
|
+
}
|
|
104
|
+
/** Computes added/removed/updated/moved/unchanged */
|
|
105
|
+
export function diffLayers(oldLayers, newLayers) {
|
|
106
|
+
const oldById = new Map(oldLayers.map(l => [l.id, l]));
|
|
107
|
+
const newById = new Map(newLayers.map(l => [l.id, l]));
|
|
108
|
+
const added = [];
|
|
109
|
+
const removed = [];
|
|
110
|
+
const updated = [];
|
|
111
|
+
const unchangedIds = [];
|
|
112
|
+
for (const newL of newLayers) {
|
|
113
|
+
const oldL = oldById.get(newL.id);
|
|
114
|
+
if (!oldL) {
|
|
115
|
+
added.push(newL);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const changes = diffRelevantFields(oldL, newL);
|
|
119
|
+
if (Object.keys(changes).length)
|
|
120
|
+
updated.push({ id: newL.id, changes });
|
|
121
|
+
else
|
|
122
|
+
unchangedIds.push(newL.id);
|
|
123
|
+
}
|
|
124
|
+
for (const oldL of oldLayers) {
|
|
125
|
+
if (!newById.has(oldL.id))
|
|
126
|
+
removed.push(oldL);
|
|
127
|
+
}
|
|
128
|
+
const oldIds = oldLayers.filter(l => newById.has(l.id)).map(l => l.id);
|
|
129
|
+
const newIds = newLayers.filter(l => oldById.has(l.id)).map(l => l.id);
|
|
130
|
+
const seq = lcs(oldIds, newIds);
|
|
131
|
+
const keep = new Set(seq);
|
|
132
|
+
const moved = [];
|
|
133
|
+
for (const id of newIds) {
|
|
134
|
+
if (!keep.has(id) && !added.find(a => a.id === id)) {
|
|
135
|
+
const from = oldIds.indexOf(id);
|
|
136
|
+
const to = newIds.indexOf(id);
|
|
137
|
+
if (from !== -1 && to !== -1)
|
|
138
|
+
moved.push({ id, from, to });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return { added, removed, updated, moved, unchangedIds };
|
|
142
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { diffLayers, diffRelevantFields, } from "./diff";
|
|
3
|
+
function baseLayer(overrides = {}) {
|
|
4
|
+
return {
|
|
5
|
+
id: 'layer-1',
|
|
6
|
+
type: 'wms',
|
|
7
|
+
visible: true,
|
|
8
|
+
opacity: 1,
|
|
9
|
+
zIndex: 10,
|
|
10
|
+
url: 'https://example.com/wms',
|
|
11
|
+
layers: 'base',
|
|
12
|
+
tiled: 'false',
|
|
13
|
+
style: { color: 'red', width: 2 },
|
|
14
|
+
data: { key: 'value' },
|
|
15
|
+
...overrides,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
describe('diff unit', () => {
|
|
19
|
+
it('treats normalized visible, opacity, zIndex and object order as unchanged', () => {
|
|
20
|
+
const before = baseLayer({
|
|
21
|
+
visible: true,
|
|
22
|
+
opacity: '1',
|
|
23
|
+
zIndex: '10',
|
|
24
|
+
style: { width: 2, color: 'red' },
|
|
25
|
+
});
|
|
26
|
+
const after = baseLayer({
|
|
27
|
+
visible: '1',
|
|
28
|
+
opacity: 1,
|
|
29
|
+
zIndex: 10,
|
|
30
|
+
style: { color: 'red', width: 2 },
|
|
31
|
+
});
|
|
32
|
+
expect(diffRelevantFields(before, after)).toEqual({});
|
|
33
|
+
});
|
|
34
|
+
it('returns added, removed, updated and moved layers separately', () => {
|
|
35
|
+
const oldLayers = [
|
|
36
|
+
baseLayer({ id: 'a', type: 'osm' }),
|
|
37
|
+
baseLayer({ id: 'b', opacity: 0.7 }),
|
|
38
|
+
baseLayer({ id: 'c', type: 'xyz' }),
|
|
39
|
+
];
|
|
40
|
+
const newLayers = [
|
|
41
|
+
baseLayer({ id: 'b', opacity: 0.9 }),
|
|
42
|
+
baseLayer({ id: 'a', type: 'osm' }),
|
|
43
|
+
baseLayer({ id: 'd', type: 'geojson' }),
|
|
44
|
+
];
|
|
45
|
+
const result = diffLayers(oldLayers, newLayers);
|
|
46
|
+
expect(result.added).toEqual([baseLayer({ id: 'd', type: 'geojson' })]);
|
|
47
|
+
expect(result.removed).toEqual([baseLayer({ id: 'c', type: 'xyz' })]);
|
|
48
|
+
expect(result.updated).toEqual([
|
|
49
|
+
{
|
|
50
|
+
id: 'b',
|
|
51
|
+
changes: {
|
|
52
|
+
opacity: { old: 0.7, new: 0.9 },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
]);
|
|
56
|
+
expect(result.moved).toEqual([{ id: 'a', from: 0, to: 1 }]);
|
|
57
|
+
expect(result.unchangedIds).toEqual(['a']);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2
|
+
export const supportsAdoptedStyleSheets = () => isBrowser() &&
|
|
3
|
+
'adoptedStyleSheets' in document &&
|
|
4
|
+
typeof CSSStyleSheet.prototype.replaceSync === 'function';
|
|
5
|
+
function onNextTick(fn) {
|
|
6
|
+
if (typeof requestAnimationFrame !== 'undefined')
|
|
7
|
+
requestAnimationFrame(fn);
|
|
8
|
+
else
|
|
9
|
+
setTimeout(fn, 0);
|
|
10
|
+
}
|
|
11
|
+
/** Beobachtet Größenänderungen des Targets. Nutzt ResizeObserver wenn vorhanden, sonst Fallback. */
|
|
12
|
+
export function watchElementResize(target, cb, mutationObserverInit) {
|
|
13
|
+
// Native ResizeObserver vorhanden?
|
|
14
|
+
if (typeof globalThis.ResizeObserver !== 'undefined') {
|
|
15
|
+
const ro = new globalThis.ResizeObserver(() => cb());
|
|
16
|
+
ro.observe(target);
|
|
17
|
+
return () => ro.disconnect();
|
|
18
|
+
}
|
|
19
|
+
// Fallback: Fenster-Resize + Mutations (Attribute-Änderungen, z.B. style.width/height)
|
|
20
|
+
const onWinResize = () => onNextTick(cb);
|
|
21
|
+
if (typeof window !== 'undefined') {
|
|
22
|
+
window.addEventListener('resize', onWinResize);
|
|
23
|
+
}
|
|
24
|
+
let mo;
|
|
25
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
26
|
+
mo = new MutationObserver(() => onNextTick(cb));
|
|
27
|
+
if (mutationObserverInit) {
|
|
28
|
+
mo.observe(target, mutationObserverInit);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
mo.observe(target);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Letzter Fallback: leichtes Polling (nur im Test sinnvoll)
|
|
35
|
+
const pollId = typeof window === 'undefined' ? undefined : setInterval(() => cb(), 250);
|
|
36
|
+
return () => {
|
|
37
|
+
if (typeof window !== 'undefined')
|
|
38
|
+
window.removeEventListener('resize', onWinResize);
|
|
39
|
+
mo?.disconnect();
|
|
40
|
+
if (pollId)
|
|
41
|
+
clearInterval(pollId);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { isBrowser, supportsAdoptedStyleSheets, watchElementResize, } from "./dom-env";
|
|
3
|
+
describe('dom-env unit', () => {
|
|
4
|
+
afterEach(() => {
|
|
5
|
+
vi.unstubAllGlobals();
|
|
6
|
+
vi.restoreAllMocks();
|
|
7
|
+
});
|
|
8
|
+
it('returns false when window and document are unavailable', () => {
|
|
9
|
+
vi.stubGlobal('window', undefined);
|
|
10
|
+
vi.stubGlobal('document', undefined);
|
|
11
|
+
expect(isBrowser()).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
it('detects adoptedStyleSheets support from the relevant globals', () => {
|
|
14
|
+
class FakeSheet {
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(FakeSheet.prototype, 'replaceSync', {
|
|
17
|
+
configurable: true,
|
|
18
|
+
value: () => undefined,
|
|
19
|
+
});
|
|
20
|
+
vi.stubGlobal('window', {});
|
|
21
|
+
vi.stubGlobal('document', { adoptedStyleSheets: [] });
|
|
22
|
+
vi.stubGlobal('CSSStyleSheet', FakeSheet);
|
|
23
|
+
expect(supportsAdoptedStyleSheets()).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it('uses ResizeObserver when available and disconnects on unsubscribe', () => {
|
|
26
|
+
const observe = vi.fn();
|
|
27
|
+
const disconnect = vi.fn();
|
|
28
|
+
const callbacks = [];
|
|
29
|
+
class MockResizeObserver {
|
|
30
|
+
constructor(cb) {
|
|
31
|
+
callbacks.push(cb);
|
|
32
|
+
}
|
|
33
|
+
observe = observe;
|
|
34
|
+
disconnect = disconnect;
|
|
35
|
+
}
|
|
36
|
+
vi.stubGlobal('ResizeObserver', MockResizeObserver);
|
|
37
|
+
const cb = vi.fn();
|
|
38
|
+
const target = {};
|
|
39
|
+
const unsubscribe = watchElementResize(target, cb);
|
|
40
|
+
callbacks[0]();
|
|
41
|
+
expect(observe).toHaveBeenCalledWith(target);
|
|
42
|
+
expect(cb).toHaveBeenCalledTimes(1);
|
|
43
|
+
unsubscribe();
|
|
44
|
+
expect(disconnect).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
it('falls back to window resize, MutationObserver and polling when ResizeObserver is unavailable', () => {
|
|
47
|
+
const addEventListener = vi.fn();
|
|
48
|
+
const removeEventListener = vi.fn();
|
|
49
|
+
let resizeHandler;
|
|
50
|
+
addEventListener.mockImplementation((type, handler) => {
|
|
51
|
+
if (type === 'resize')
|
|
52
|
+
resizeHandler = handler;
|
|
53
|
+
});
|
|
54
|
+
const rafCallbacks = [];
|
|
55
|
+
const requestAnimationFrame = vi.fn((cb) => {
|
|
56
|
+
rafCallbacks.push(cb);
|
|
57
|
+
return 1;
|
|
58
|
+
});
|
|
59
|
+
const setIntervalSpy = vi.fn(() => 123);
|
|
60
|
+
const clearIntervalSpy = vi.fn();
|
|
61
|
+
const observe = vi.fn();
|
|
62
|
+
const disconnect = vi.fn();
|
|
63
|
+
const mutationCallbacks = [];
|
|
64
|
+
class MockMutationObserver {
|
|
65
|
+
constructor(cb) {
|
|
66
|
+
mutationCallbacks.push(cb);
|
|
67
|
+
}
|
|
68
|
+
observe = observe;
|
|
69
|
+
disconnect = disconnect;
|
|
70
|
+
}
|
|
71
|
+
vi.stubGlobal('ResizeObserver', undefined);
|
|
72
|
+
vi.stubGlobal('window', { addEventListener, removeEventListener });
|
|
73
|
+
vi.stubGlobal('requestAnimationFrame', requestAnimationFrame);
|
|
74
|
+
vi.stubGlobal('setInterval', setIntervalSpy);
|
|
75
|
+
vi.stubGlobal('clearInterval', clearIntervalSpy);
|
|
76
|
+
vi.stubGlobal('MutationObserver', MockMutationObserver);
|
|
77
|
+
const cb = vi.fn();
|
|
78
|
+
const target = {};
|
|
79
|
+
const mutationObserverInit = { attributes: true };
|
|
80
|
+
const unsubscribe = watchElementResize(target, cb, mutationObserverInit);
|
|
81
|
+
resizeHandler?.();
|
|
82
|
+
mutationCallbacks[0]();
|
|
83
|
+
rafCallbacks.forEach((fn) => fn());
|
|
84
|
+
expect(observe).toHaveBeenCalledWith(target, mutationObserverInit);
|
|
85
|
+
expect(setIntervalSpy).toHaveBeenCalledWith(expect.any(Function), 250);
|
|
86
|
+
expect(cb).toHaveBeenCalledTimes(2);
|
|
87
|
+
unsubscribe();
|
|
88
|
+
expect(removeEventListener).toHaveBeenCalledWith('resize', resizeHandler);
|
|
89
|
+
expect(disconnect).toHaveBeenCalledTimes(1);
|
|
90
|
+
expect(clearIntervalSpy).toHaveBeenCalledWith(123);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Build } from "@stencil/core";
|
|
2
|
+
/** Stencil-nativ: prod = !Build.isDev */
|
|
3
|
+
export const isProd = !Build.isDev;
|
|
4
|
+
// ---- Exposure-Gate (macht Konsole-APIs auch in Prod verfügbar, wenn explizit aktiviert) ----
|
|
5
|
+
const EXPOSE_KEY = '@pt9912/v-map:exposeConsoleAPI';
|
|
6
|
+
const urlHasDebugFlag = (() => {
|
|
7
|
+
try {
|
|
8
|
+
return (typeof location !== 'undefined' &&
|
|
9
|
+
new URLSearchParams(location.search).has('vmapDebug'));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
})();
|
|
15
|
+
const exposureEnabled = !isProd ||
|
|
16
|
+
urlHasDebugFlag ||
|
|
17
|
+
(typeof localStorage !== 'undefined' &&
|
|
18
|
+
localStorage.getItem(EXPOSE_KEY) === '1');
|
|
19
|
+
/* ------------------------- Storage-Helfer -------------------------- */
|
|
20
|
+
const LS_KEY = '@pt9912/v-map:logLevel';
|
|
21
|
+
function getLocalStorage() {
|
|
22
|
+
try {
|
|
23
|
+
if (typeof window !== 'undefined' && 'localStorage' in window) {
|
|
24
|
+
return window.localStorage;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
/* no-op (Privacy/Storage blocked o. Ä.) */
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function readPersistedLevel() {
|
|
33
|
+
const ls = getLocalStorage();
|
|
34
|
+
if (!ls)
|
|
35
|
+
return null;
|
|
36
|
+
const raw = ls.getItem(LS_KEY);
|
|
37
|
+
if (!raw)
|
|
38
|
+
return null;
|
|
39
|
+
if (raw === 'none' ||
|
|
40
|
+
raw === 'error' ||
|
|
41
|
+
raw === 'warn' ||
|
|
42
|
+
raw === 'info' ||
|
|
43
|
+
raw === 'debug') {
|
|
44
|
+
return raw;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function writePersistedLevel(level) {
|
|
49
|
+
const ls = getLocalStorage();
|
|
50
|
+
if (!ls)
|
|
51
|
+
return;
|
|
52
|
+
try {
|
|
53
|
+
ls.setItem(LS_KEY, level);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
/* no-op */
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/* ---------- 1️⃣ Runtime-Konfiguration (Log-Level, Transport) ---------- */
|
|
60
|
+
/** Standard-Default: prod -> bis warn, dev -> bis debug */
|
|
61
|
+
const DEFAULT_LEVEL = isProd ? 'warn' : 'debug';
|
|
62
|
+
/** Initiales Level: persisted > default */
|
|
63
|
+
let currentLevel = readPersistedLevel() ?? DEFAULT_LEVEL;
|
|
64
|
+
/** Standard-Transport: schreibt in die native Browser-Console. */
|
|
65
|
+
class ConsoleTransport {
|
|
66
|
+
log(level, args, ns) {
|
|
67
|
+
const prefix = ns ? `[${ns}]` : undefined;
|
|
68
|
+
const enhancedArgs = [...args];
|
|
69
|
+
if (level === 'debug' || level === 'warn' || level === 'error') {
|
|
70
|
+
const showTrace = level === 'debug' || level === 'warn' || level === 'error';
|
|
71
|
+
const stackTrace = showTrace
|
|
72
|
+
? new Error().stack?.split('\n')[4]?.trim()
|
|
73
|
+
: null;
|
|
74
|
+
if (stackTrace) {
|
|
75
|
+
enhancedArgs.push(`${stackTrace}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
switch (level) {
|
|
79
|
+
case 'debug':
|
|
80
|
+
case 'info':
|
|
81
|
+
if (prefix)
|
|
82
|
+
console.log(prefix, ...enhancedArgs);
|
|
83
|
+
else
|
|
84
|
+
console.log(...enhancedArgs);
|
|
85
|
+
break;
|
|
86
|
+
case 'warn':
|
|
87
|
+
if (prefix)
|
|
88
|
+
console.warn(prefix, ...enhancedArgs);
|
|
89
|
+
else
|
|
90
|
+
console.warn(...enhancedArgs);
|
|
91
|
+
break;
|
|
92
|
+
case 'error':
|
|
93
|
+
if (prefix)
|
|
94
|
+
console.error(prefix, ...enhancedArgs);
|
|
95
|
+
else
|
|
96
|
+
console.error(...enhancedArgs);
|
|
97
|
+
break;
|
|
98
|
+
// 'none' wird nicht geroutet
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
let transport = new ConsoleTransport();
|
|
103
|
+
/**
|
|
104
|
+
* Ändert das globale Log-Level zur Laufzeit und persistiert es.
|
|
105
|
+
* Praktisch für Tests, Feature-Flags und DevTools.
|
|
106
|
+
*/
|
|
107
|
+
export function setLogLevel(level) {
|
|
108
|
+
currentLevel = level;
|
|
109
|
+
writePersistedLevel(level);
|
|
110
|
+
}
|
|
111
|
+
/** Aktuelles Log-Level abfragen (z. B. in DevTools) */
|
|
112
|
+
export function getLogLevel() {
|
|
113
|
+
return currentLevel;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Ersetzt den aktiven Transport (z. B. für Remote-Logging).
|
|
117
|
+
*/
|
|
118
|
+
export function setTransport(t) {
|
|
119
|
+
transport = t;
|
|
120
|
+
}
|
|
121
|
+
/* ---------------------- 2️⃣ Hilfsfunktionen ---------------------- */
|
|
122
|
+
/** Prüft, ob ein gegebener Level laut aktueller Konfiguration ausgegeben werden darf. */
|
|
123
|
+
function shouldLog(level) {
|
|
124
|
+
const order = {
|
|
125
|
+
none: 0,
|
|
126
|
+
error: 1,
|
|
127
|
+
warn: 2,
|
|
128
|
+
info: 3,
|
|
129
|
+
debug: 4,
|
|
130
|
+
};
|
|
131
|
+
return order[level] <= order[currentLevel];
|
|
132
|
+
}
|
|
133
|
+
/** Kern-Logger – wird von den öffentlichen Methoden genutzt. */
|
|
134
|
+
function _log(level, args, namespace) {
|
|
135
|
+
if (!shouldLog(level))
|
|
136
|
+
return;
|
|
137
|
+
transport.log(level, args, namespace);
|
|
138
|
+
}
|
|
139
|
+
/* ---------------------- 3️⃣ Öffentliche API ---------------------- */
|
|
140
|
+
/**
|
|
141
|
+
* Erzeugt eine Logger-Instanz mit Namespace-Präfix.
|
|
142
|
+
* Ideal für Komponenten: `const log = createLogger('MyComponent');`
|
|
143
|
+
*/
|
|
144
|
+
export function createLogger(namespace) {
|
|
145
|
+
return {
|
|
146
|
+
debug: (...args) => _log('debug', args, namespace),
|
|
147
|
+
info: (...args) => _log('info', args, namespace),
|
|
148
|
+
warn: (...args) => _log('warn', args, namespace),
|
|
149
|
+
error: (...args) => _log('error', args, namespace),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/* ----------- 4️⃣ Convenience-Wrapper für globale Nutzung ------------ */
|
|
153
|
+
export const log = (...args) => _log('debug', args);
|
|
154
|
+
export const info = (...args) => _log('info', args);
|
|
155
|
+
export const warn = (...args) => _log('warn', args);
|
|
156
|
+
export const error = (...args) => _log('error', args);
|
|
157
|
+
if (exposureEnabled && typeof globalThis !== 'undefined') {
|
|
158
|
+
const g = globalThis;
|
|
159
|
+
g.setLogLevel = setLogLevel;
|
|
160
|
+
g.getLogLevel = getLogLevel;
|
|
161
|
+
g.log = (...args) => log(...args);
|
|
162
|
+
g.info = (...args) => info(...args);
|
|
163
|
+
g.warn = (...args) => warn(...args);
|
|
164
|
+
g.error = (...args) => error(...args);
|
|
165
|
+
}
|
|
166
|
+
//devtools
|
|
167
|
+
//http://localhost:6006/?path=/docs/...&vmapDebug
|
|
168
|
+
/*
|
|
169
|
+
localStorage.setItem('@pt9912/v-map:exposeConsoleAPI', '1');
|
|
170
|
+
localStorage.getItem('@pt9912/v-map:exposeConsoleAPI');
|
|
171
|
+
location.reload();
|
|
172
|
+
*/
|
|
173
|
+
/*
|
|
174
|
+
const LOG_LEVEL='debug'
|
|
175
|
+
const KEY = '@pt9912/v-map:logLevel';
|
|
176
|
+
for (let i = 0; i < top.frames.length; i++) {
|
|
177
|
+
try { top.frames[i].localStorage.setItem(KEY, LOG_LEVEL); } catch {}
|
|
178
|
+
}
|
|
179
|
+
try { window.localStorage.setItem(KEY, LOG_LEVEL); } catch {}
|
|
180
|
+
top.location.reload();
|
|
181
|
+
*/
|
|
182
|
+
//getLogLevel()
|
|
183
|
+
//setLogLevel('info')
|