diff --git a/package.json b/package.json index 4198a664..f4707956 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,9 @@ "@biomejs/biome": "1.9.4", "@types/arcgis-rest-api": "^10.4.8", "@types/browser-update": "^3.3.3", - "@types/node": "^22.10.7", - "@vitest/coverage-istanbul": "^3.0.3", - "@vitest/coverage-v8": "^3.0.3", + "@types/node": "^22.10.9", + "@vitest/coverage-istanbul": "^3.0.4", + "@vitest/coverage-v8": "^3.0.4", "browserslist-to-esbuild": "^2.1.1", "cspell": "^8.17.2", "jsdom": "^26.0.0", @@ -51,7 +51,7 @@ "tsx": "^4.19.2", "typescript": "^5.7.3", "vite": "^6.0.11", - "vitest": "^3.0.3" + "vitest": "^3.0.4" }, "repository": { "url": "https://github.com/WSDOT-GIS/wsdot-mp-map.git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 56510b78..facaebff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,14 +58,14 @@ importers: specifier: ^3.3.3 version: 3.3.3 '@types/node': - specifier: ^22.10.7 - version: 22.10.7 + specifier: ^22.10.9 + version: 22.10.9 '@vitest/coverage-istanbul': - specifier: ^3.0.3 - version: 3.0.3(vitest@3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)) + specifier: ^3.0.4 + version: 3.0.4(vitest@3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)) '@vitest/coverage-v8': - specifier: ^3.0.3 - version: 3.0.3(vitest@3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)) + specifier: ^3.0.4 + version: 3.0.4(vitest@3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0)) browserslist-to-esbuild: specifier: ^2.1.1 version: 2.1.1(browserslist@4.24.4) @@ -77,7 +77,7 @@ importers: version: 26.0.0 msw: specifier: ^2.7.0 - version: 2.7.0(@types/node@22.10.7)(typescript@5.7.3) + version: 2.7.0(@types/node@22.10.9)(typescript@5.7.3) optionator: specifier: ^0.9.4 version: 0.9.4 @@ -95,10 +95,10 @@ importers: version: 5.7.3 vite: specifier: ^6.0.11 - version: 6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0) + version: 6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0) vitest: - specifier: ^3.0.3 - version: 3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0) + specifier: ^3.0.4 + version: 3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0) packages: @@ -1047,8 +1047,8 @@ packages: '@types/geojson@7946.0.15': resolution: {integrity: sha512-9oSxFzDCT2Rj6DfcHF8G++jxBKS7mBqXl5xrRW+Kbvjry6Uduya2iiwqHPhVXpasAVMBYKkEPGgKhd3+/HZ6xA==} - '@types/node@22.10.7': - resolution: {integrity: sha512-V09KvXxFiutGp6B7XkpaDXlNadZxrzajcY50EuoLIpQ6WWYCSvf19lVIazzfIzQvhUN2HjX12spLojTnhuKlGg==} + '@types/node@22.10.9': + resolution: {integrity: sha512-Ir6hwgsKyNESl/gLOcEz3krR4CBGgliDqBQ2ma4wIhEx0w+xnoeTq3tdrNw15kU3SxogDjOgv9sqdtLW8mIHaw==} '@types/sortablejs@1.15.8': resolution: {integrity: sha512-b79830lW+RZfwaztgs1aVPgbasJ8e7AXtZYHTELNXZPsERt4ymJdjV4OccDbHQAvHrCcFpbF78jkm0R6h/pZVg==} @@ -1105,25 +1105,25 @@ packages: resolution: {integrity: sha512-8r4TNknD7OJQADe3VygeofFR7UNAXZ2/jjBFP5dgI8+2uMfnuGYgbuHivasKr9WSQ64sPej6m8rDoM1uSllXjQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - '@vitest/coverage-istanbul@3.0.3': - resolution: {integrity: sha512-W3+GsuJ3/HvTdOyqiCHa1pxmmYk/Qn/JMDmX7WKjr1rUGq8e3ySnP5mfjc8ui4Mi8SGROtX7qPVdlg9nZppbKQ==} + '@vitest/coverage-istanbul@3.0.4': + resolution: {integrity: sha512-a+SgPMom0PlRTuDasoucL2V7FDpS8j7p6jpHLNgt3d7oOSWYwtAFVCfZ3iQ+a+cOnh76g4mOftVR5Y9HokB/GQ==} peerDependencies: - vitest: 3.0.3 + vitest: 3.0.4 - '@vitest/coverage-v8@3.0.3': - resolution: {integrity: sha512-uVbJ/xhImdNtzPnLyxCZJMTeTIYdgcC2nWtBBBpR1H6z0w8m7D+9/zrDIx2nNxgMg9r+X8+RY2qVpUDeW2b3nw==} + '@vitest/coverage-v8@3.0.4': + resolution: {integrity: sha512-f0twgRCHgbs24Dp8cLWagzcObXMcuKtAwgxjJV/nnysPAJJk1JiKu/W0gIehZLmkljhJXU/E0/dmuQzsA/4jhA==} peerDependencies: - '@vitest/browser': 3.0.3 - vitest: 3.0.3 + '@vitest/browser': 3.0.4 + vitest: 3.0.4 peerDependenciesMeta: '@vitest/browser': optional: true - '@vitest/expect@3.0.3': - resolution: {integrity: sha512-SbRCHU4qr91xguu+dH3RUdI5dC86zm8aZWydbp961aIR7G8OYNN6ZiayFuf9WAngRbFOfdrLHCGgXTj3GtoMRQ==} + '@vitest/expect@3.0.4': + resolution: {integrity: sha512-Nm5kJmYw6P2BxhJPkO3eKKhGYKRsnqJqf+r0yOGRKpEP+bSCBDsjXgiu1/5QFrnPMEgzfC38ZEjvCFgaNBC0Eg==} - '@vitest/mocker@3.0.3': - resolution: {integrity: sha512-XT2XBc4AN9UdaxJAeIlcSZ0ILi/GzmG5G8XSly4gaiqIvPV3HMTSIDZWJVX6QRJ0PX1m+W8Cy0K9ByXNb/bPIA==} + '@vitest/mocker@3.0.4': + resolution: {integrity: sha512-gEef35vKafJlfQbnyOXZ0Gcr9IBUsMTyTLXsEQwuyYAerpHqvXhzdBnDFuHLpFqth3F7b6BaFr4qV/Cs1ULx5A==} peerDependencies: msw: ^2.4.9 vite: ^5.0.0 || ^6.0.0 @@ -1133,20 +1133,20 @@ packages: vite: optional: true - '@vitest/pretty-format@3.0.3': - resolution: {integrity: sha512-gCrM9F7STYdsDoNjGgYXKPq4SkSxwwIU5nkaQvdUxiQ0EcNlez+PdKOVIsUJvh9P9IeIFmjn4IIREWblOBpP2Q==} + '@vitest/pretty-format@3.0.4': + resolution: {integrity: sha512-ts0fba+dEhK2aC9PFuZ9LTpULHpY/nd6jhAQ5IMU7Gaj7crPCTdCFfgvXxruRBLFS+MLraicCuFXxISEq8C93g==} - '@vitest/runner@3.0.3': - resolution: {integrity: sha512-Rgi2kOAk5ZxWZlwPguRJFOBmWs6uvvyAAR9k3MvjRvYrG7xYvKChZcmnnpJCS98311CBDMqsW9MzzRFsj2gX3g==} + '@vitest/runner@3.0.4': + resolution: {integrity: sha512-dKHzTQ7n9sExAcWH/0sh1elVgwc7OJ2lMOBrAm73J7AH6Pf9T12Zh3lNE1TETZaqrWFXtLlx3NVrLRb5hCK+iw==} - '@vitest/snapshot@3.0.3': - resolution: {integrity: sha512-kNRcHlI4txBGztuJfPEJ68VezlPAXLRT1u5UCx219TU3kOG2DplNxhWLwDf2h6emwmTPogzLnGVwP6epDaJN6Q==} + '@vitest/snapshot@3.0.4': + resolution: {integrity: sha512-+p5knMLwIk7lTQkM3NonZ9zBewzVp9EVkVpvNta0/PlFWpiqLaRcF4+33L1it3uRUCh0BGLOaXPPGEjNKfWb4w==} - '@vitest/spy@3.0.3': - resolution: {integrity: sha512-7/dgux8ZBbF7lEIKNnEqQlyRaER9nkAL9eTmdKJkDO3hS8p59ATGwKOCUDHcBLKr7h/oi/6hP+7djQk8049T2A==} + '@vitest/spy@3.0.4': + resolution: {integrity: sha512-sXIMF0oauYyUy2hN49VFTYodzEAu744MmGcPR3ZBsPM20G+1/cSW/n1U+3Yu/zHxX2bIDe1oJASOkml+osTU6Q==} - '@vitest/utils@3.0.3': - resolution: {integrity: sha512-f+s8CvyzPtMFY1eZKkIHGhPsQgYo5qCm6O8KZoim9qm1/jT64qBgGpO5tHscNH6BzRHM+edLNOP+3vO8+8pE/A==} + '@vitest/utils@3.0.4': + resolution: {integrity: sha512-8BqC1ksYsHtbWH+DfpOAKrFw3jl3Uf9J7yeFh85Pz52IWuh1hBBtyfEbRNNZNjl8H8A5yMLH9/t+k7HIKzQcZQ==} '@webcomponents/shadycss@1.11.2': resolution: {integrity: sha512-vRq+GniJAYSBmTRnhCYPAPq6THYqovJ/gzGThWbgEZUQaBccndGTi1hdiUP15HzEco0I6t4RCtXyX0rsSmwgPw==} @@ -1451,8 +1451,8 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - electron-to-chromium@1.5.84: - resolution: {integrity: sha512-I+DQ8xgafao9Ha6y0qjHHvpZ9OfyA1qKlkHkjywxzniORU2awxyz7f/iVJcULmrF2yrM3nHQf+iDjJtbbexd/g==} + electron-to-chromium@1.5.86: + resolution: {integrity: sha512-/D7GAAaCRBQFBBcop6SfAAGH37djtpWkOuYhyAajw0l5vsfeSsUQYxaFPwr1c/mC/flARCDdKFo5gpFqNI+18w==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -2115,8 +2115,8 @@ packages: url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - vite-node@3.0.3: - resolution: {integrity: sha512-0sQcwhwAEw/UJGojbhOrnq3HtiZ3tC7BzpAa0lx3QaTX0S3YX70iGcik25UBdB96pmdwjyY2uyKNYruxCDmiEg==} + vite-node@3.0.4: + resolution: {integrity: sha512-7JZKEzcYV2Nx3u6rlvN8qdo3QV7Fxyt6hx+CCKz9fbWxdX5IvUOmTWEAxMrWxaiSf7CKGLJQ5rFu8prb/jBjOA==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true @@ -2160,20 +2160,23 @@ packages: yaml: optional: true - vitest@3.0.3: - resolution: {integrity: sha512-dWdwTFUW9rcnL0LyF2F+IfvNQWB0w9DERySCk8VMG75F8k25C7LsZoh6XfCjPvcR8Nb+Lqi9JKr6vnzH7HSrpQ==} + vitest@3.0.4: + resolution: {integrity: sha512-6XG8oTKy2gnJIFTHP6LD7ExFeNLxiTkK3CfMvT7IfR8IN+BYICCf0lXUQmX7i7JoxUP8QmeP4mTnWXgflu4yjw==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 - '@vitest/browser': 3.0.3 - '@vitest/ui': 3.0.3 + '@vitest/browser': 3.0.4 + '@vitest/ui': 3.0.4 happy-dom: '*' jsdom: '*' peerDependenciesMeta: '@edge-runtime/vm': optional: true + '@types/debug': + optional: true '@types/node': optional: true '@vitest/browser': @@ -2932,16 +2935,16 @@ snapshots: '@fontsource/overpass@5.1.2': {} - '@inquirer/confirm@5.1.1(@types/node@22.10.7)': + '@inquirer/confirm@5.1.1(@types/node@22.10.9)': dependencies: - '@inquirer/core': 10.1.2(@types/node@22.10.7) - '@inquirer/type': 3.0.2(@types/node@22.10.7) - '@types/node': 22.10.7 + '@inquirer/core': 10.1.2(@types/node@22.10.9) + '@inquirer/type': 3.0.2(@types/node@22.10.9) + '@types/node': 22.10.9 - '@inquirer/core@10.1.2(@types/node@22.10.7)': + '@inquirer/core@10.1.2(@types/node@22.10.9)': dependencies: '@inquirer/figures': 1.0.9 - '@inquirer/type': 3.0.2(@types/node@22.10.7) + '@inquirer/type': 3.0.2(@types/node@22.10.9) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -2954,9 +2957,9 @@ snapshots: '@inquirer/figures@1.0.9': {} - '@inquirer/type@3.0.2(@types/node@22.10.7)': + '@inquirer/type@3.0.2(@types/node@22.10.9)': dependencies: - '@types/node': 22.10.7 + '@types/node': 22.10.9 '@interactjs/types@1.10.27': {} @@ -3104,7 +3107,7 @@ snapshots: '@types/geojson@7946.0.15': {} - '@types/node@22.10.7': + '@types/node@22.10.9': dependencies: undici-types: 6.20.0 @@ -3224,7 +3227,7 @@ snapshots: dependencies: '@vaadin/vaadin-development-mode-detector': 2.0.7 - '@vitest/coverage-istanbul@3.0.3(vitest@3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0))': + '@vitest/coverage-istanbul@3.0.4(vitest@3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0))': dependencies: '@istanbuljs/schema': 0.1.3 debug: 4.4.0 @@ -3236,11 +3239,11 @@ snapshots: magicast: 0.3.5 test-exclude: 7.0.1 tinyrainbow: 2.0.0 - vitest: 3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0) + vitest: 3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0) transitivePeerDependencies: - supports-color - '@vitest/coverage-v8@3.0.3(vitest@3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0))': + '@vitest/coverage-v8@3.0.4(vitest@3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 1.0.2 @@ -3254,48 +3257,48 @@ snapshots: std-env: 3.8.0 test-exclude: 7.0.1 tinyrainbow: 2.0.0 - vitest: 3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0) + vitest: 3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0) transitivePeerDependencies: - supports-color - '@vitest/expect@3.0.3': + '@vitest/expect@3.0.4': dependencies: - '@vitest/spy': 3.0.3 - '@vitest/utils': 3.0.3 + '@vitest/spy': 3.0.4 + '@vitest/utils': 3.0.4 chai: 5.1.2 tinyrainbow: 2.0.0 - '@vitest/mocker@3.0.3(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(vite@6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0))': + '@vitest/mocker@3.0.4(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(vite@6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0))': dependencies: - '@vitest/spy': 3.0.3 + '@vitest/spy': 3.0.4 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.7.0(@types/node@22.10.7)(typescript@5.7.3) - vite: 6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0) + msw: 2.7.0(@types/node@22.10.9)(typescript@5.7.3) + vite: 6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0) - '@vitest/pretty-format@3.0.3': + '@vitest/pretty-format@3.0.4': dependencies: tinyrainbow: 2.0.0 - '@vitest/runner@3.0.3': + '@vitest/runner@3.0.4': dependencies: - '@vitest/utils': 3.0.3 + '@vitest/utils': 3.0.4 pathe: 2.0.2 - '@vitest/snapshot@3.0.3': + '@vitest/snapshot@3.0.4': dependencies: - '@vitest/pretty-format': 3.0.3 + '@vitest/pretty-format': 3.0.4 magic-string: 0.30.17 pathe: 2.0.2 - '@vitest/spy@3.0.3': + '@vitest/spy@3.0.4': dependencies: tinyspy: 3.0.2 - '@vitest/utils@3.0.3': + '@vitest/utils@3.0.4': dependencies: - '@vitest/pretty-format': 3.0.3 + '@vitest/pretty-format': 3.0.4 loupe: 3.1.2 tinyrainbow: 2.0.0 @@ -3376,7 +3379,7 @@ snapshots: browserslist@4.24.4: dependencies: caniuse-lite: 1.0.30001695 - electron-to-chromium: 1.5.84 + electron-to-chromium: 1.5.86 node-releases: 2.0.19 update-browserslist-db: 1.1.2(browserslist@4.24.4) @@ -3638,7 +3641,7 @@ snapshots: eastasianwidth@0.2.0: {} - electron-to-chromium@1.5.84: {} + electron-to-chromium@1.5.86: {} emoji-regex@8.0.0: {} @@ -4032,12 +4035,12 @@ snapshots: ms@2.1.3: {} - msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3): + msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3): dependencies: '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.1.1(@types/node@22.10.7) + '@inquirer/confirm': 5.1.1(@types/node@22.10.9) '@mswjs/interceptors': 0.37.3 '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 @@ -4336,13 +4339,13 @@ snapshots: querystringify: 2.2.0 requires-port: 1.0.0 - vite-node@3.0.3(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0): + vite-node@3.0.4(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 2.0.2 - vite: 6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0) + vite: 6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0) transitivePeerDependencies: - '@types/node' - jiti @@ -4357,26 +4360,26 @@ snapshots: - tsx - yaml - vite@6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0): + vite@6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0): dependencies: esbuild: 0.24.2 postcss: 8.5.1 rollup: 4.31.0 optionalDependencies: - '@types/node': 22.10.7 + '@types/node': 22.10.9 fsevents: 2.3.3 tsx: 4.19.2 yaml: 2.7.0 - vitest@3.0.3(@types/node@22.10.7)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0): + vitest@3.0.4(@types/node@22.10.9)(jsdom@26.0.0)(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(tsx@4.19.2)(yaml@2.7.0): dependencies: - '@vitest/expect': 3.0.3 - '@vitest/mocker': 3.0.3(msw@2.7.0(@types/node@22.10.7)(typescript@5.7.3))(vite@6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0)) - '@vitest/pretty-format': 3.0.3 - '@vitest/runner': 3.0.3 - '@vitest/snapshot': 3.0.3 - '@vitest/spy': 3.0.3 - '@vitest/utils': 3.0.3 + '@vitest/expect': 3.0.4 + '@vitest/mocker': 3.0.4(msw@2.7.0(@types/node@22.10.9)(typescript@5.7.3))(vite@6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0)) + '@vitest/pretty-format': 3.0.4 + '@vitest/runner': 3.0.4 + '@vitest/snapshot': 3.0.4 + '@vitest/spy': 3.0.4 + '@vitest/utils': 3.0.4 chai: 5.1.2 debug: 4.4.0 expect-type: 1.1.0 @@ -4387,11 +4390,11 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.0.2 tinyrainbow: 2.0.0 - vite: 6.0.11(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0) - vite-node: 3.0.3(@types/node@22.10.7)(tsx@4.19.2)(yaml@2.7.0) + vite: 6.0.11(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0) + vite-node: 3.0.4(@types/node@22.10.9)(tsx@4.19.2)(yaml@2.7.0) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.10.7 + '@types/node': 22.10.9 jsdom: 26.0.0 transitivePeerDependencies: - jiti diff --git a/src/main.ts b/src/main.ts index 55dcd966..27c8c401 100644 --- a/src/main.ts +++ b/src/main.ts @@ -497,6 +497,10 @@ if (!testWebGL2Support()) { popupEnabled: false, }); + import("./widgets/ScreenshotButton").then(({ setupScreenshotButton }) => { + setupScreenshotButton(view); + }); + // Uncomment this section to debug scale changes 👇 // if (import.meta.env.DEV) { // view.watch("scale", (scale) => { diff --git a/src/widgets/ScreenshotButton.ts b/src/widgets/ScreenshotButton.ts new file mode 100644 index 00000000..061a04aa --- /dev/null +++ b/src/widgets/ScreenshotButton.ts @@ -0,0 +1,42 @@ +import type MapView from "@arcgis/core/views/MapView"; + +/** + * Sets up a screenshot button in the provided MapView. + * When clicked, the button captures a screenshot of the map view and + * downloads it as a PNG file. + * + * @param mapView - The MapView to which the screenshot button will be added. + * @returns The created calcite-button element. + */ +export async function setupScreenshotButton(mapView: MapView) { + await mapView.when(); + + const screenshotButton = document.createElement("calcite-button"); + screenshotButton.id = "screenshotButton"; + screenshotButton.iconStart = "camera"; + screenshotButton.title = "Take Screenshot"; + + mapView.ui.add(screenshotButton, { + position: "top-left", + }); + + const buttonEventListener: NonNullable< + typeof screenshotButton.onclick + > = () => { + mapView + .takeScreenshot({ + format: "png", + ignoreBackground: true, + }) + .then((screenshot) => { + const link = document.createElement("a"); + link.download = "screenshot.png"; + link.href = screenshot.dataUrl; + link.click(); + }); + }; + + screenshotButton.addEventListener("click", buttonEventListener); + + return screenshotButton; +}