diff --git a/Makefile b/Makefile index 920ea613..bdeb913d 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,9 @@ init: wq.js: init npm run rollup -- -c cp -p packages/app/css/wq.css static/app/css/wq.css - cp -p node_modules/mapbox-gl/dist/mapbox-gl.css static/app/css/mapbox-gl.css - cp -p node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css static/app/css/mapbox-gl-draw.css + cp -p node_modules/maplibre-gl/dist/maplibre-gl.js* static/app/js/ + cp -p node_modules/maplibre-gl/dist/maplibre-gl.css* static/app/css/ + cp -p node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css* static/app/css/ clean: rm -rf static diff --git a/index.js b/index.js index 411371ee..ebe5fbd2 100644 --- a/index.js +++ b/index.js @@ -3,6 +3,9 @@ import material from "@wq/material"; import mapgl from "@wq/map-gl"; import modules from "./modules"; import version from "./version"; +import maplibre from "maplibre-gl"; + +mapgl.setEngine(maplibre); app.use([material, mapgl]); diff --git a/modules.js b/modules.js index 5818cd2a..1a07feed 100644 --- a/modules.js +++ b/modules.js @@ -3,16 +3,11 @@ import ReactDOM from "react-dom"; import ReactIs from "react-is"; import PropTypes from "prop-types"; import * as formik from "formik"; -import * as muiUtils from "@material-ui/utils"; -import * as muiStyles from "@material-ui/styles"; -import ButtonBase from "@material-ui/core/ButtonBase"; -import Paper from "@material-ui/core/Paper"; -import withStyles from "@material-ui/core/styles/withStyles"; -import * as colorManipulator from "@material-ui/core/styles/colorManipulator"; -import mapboxgl from "mapbox-gl"; -import ReactMapboxGl, * as reactMapboxGlExports from "react-mapbox-gl"; +import * as muiUtils from "@mui/utils"; +import ButtonBase from "@mui/material/ButtonBase"; +import Paper from "@mui/material/Paper"; +import Map, * as reactMapGlExports from "react-map-gl"; import MapboxDraw from "@mapbox/mapbox-gl-draw"; -import DrawControl from "react-mapbox-gl-draw"; import app from "@wq/app"; import material, * as materialExports from "@wq/material"; @@ -27,19 +22,14 @@ export default { "react-is": ReactIs, "prop-types": PropTypes, formik: formik, - "@material-ui/utils": muiUtils, - "@material-ui/styles": muiStyles, - "@material-ui/core/ButtonBase": ButtonBase, - "@material-ui/core/Paper": Paper, - "@material-ui/core/styles/withStyles": withStyles, - "@material-ui/core/styles/colorManipulator": colorManipulator, - "mapbox-gl": mapboxgl, - "react-mapbox-gl": { - default: ReactMapboxGl, - ...reactMapboxGlExports, + "@mui/utils": muiUtils, + "@mui/material/ButtonBase": ButtonBase, + "@mui/material/Paper": Paper, + "react-map-gl": { + default: Map, + ...reactMapGlExports, }, "@mapbox/mapbox-gl-draw": MapboxDraw, - "react-mapbox-gl-draw": DrawControl, "@wq/app": app, "@wq/react": { default: react, diff --git a/package-lock.json b/package-lock.json index 766cb664..8f8bd209 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "husky": "^8.0.0", "jest": "^29.3.1", "jest-environment-jsdom": "^29.3.1", + "maplibre-gl": "^2.4.0", "metro-react-native-babel-preset": "^0.74.0", "precise-commits": "^1.0.2", "prettier": "^2.8.3", @@ -3179,6 +3180,28 @@ "geojson-normalize": "geojson-normalize" } }, + "node_modules/@mapbox/geojson-rewind": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz", + "integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==", + "dev": true, + "dependencies": { + "get-stream": "^6.0.1", + "minimist": "^1.2.6" + }, + "bin": { + "geojson-rewind": "geojson-rewind" + } + }, + "node_modules/@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/@mapbox/mapbox-gl-draw": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-draw/-/mapbox-gl-draw-1.3.0.tgz", @@ -3193,11 +3216,47 @@ "xtend": "^4.0.2" } }, + "node_modules/@mapbox/mapbox-gl-supported": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz", + "integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ==", + "dev": true + }, "node_modules/@mapbox/point-geometry": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==" }, + "node_modules/@mapbox/tiny-sdf": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.5.tgz", + "integrity": "sha512-OhXt2lS//WpLdkqrzo/KwB7SRD8AiNTFFzuo9n14IBupzIMa67yGItcK7I2W9D8Ghpa4T04Sw9FWsKCJG50Bxw==", + "dev": true + }, + "node_modules/@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", + "dev": true + }, + "node_modules/@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "dev": true, + "dependencies": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "node_modules/@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@mui/base": { "version": "5.0.0-alpha.114", "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.114.tgz", @@ -3904,6 +3963,11 @@ "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", "dev": true }, + "node_modules/@types/geojson": { + "version": "7946.0.10", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz", + "integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==" + }, "node_modules/@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -3963,6 +4027,31 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "node_modules/@types/mapbox__point-geometry": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.2.tgz", + "integrity": "sha512-D0lgCq+3VWV85ey1MZVkE8ZveyuvW5VAfuahVTQRpXFQTxw03SuIf1/K4UQ87MMIXVKzpFjXFiFMZzLj2kU+iA==", + "dev": true + }, + "node_modules/@types/mapbox__vector-tile": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@types/mapbox__vector-tile/-/mapbox__vector-tile-1.3.0.tgz", + "integrity": "sha512-kDwVreQO5V4c8yAxzZVQLE5tyWF+IPToAanloQaSnwfXmIcJ7cyOrv8z4Ft4y7PsLYmhWXmON8MBV8RX0Rgr8g==", + "dev": true, + "dependencies": { + "@types/geojson": "*", + "@types/mapbox__point-geometry": "*", + "@types/pbf": "*" + } + }, + "node_modules/@types/mapbox-gl": { + "version": "2.7.10", + "resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.7.10.tgz", + "integrity": "sha512-nMVEcu9bAcenvx6oPWubQSPevsekByjOfKjlkr+8P91vawtkxTnopDoXXq1Qn/f4cg3zt0Z2W9DVsVsKRNXJTw==", + "dependencies": { + "@types/geojson": "*" + } + }, "node_modules/@types/node": { "version": "18.11.18", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", @@ -3974,6 +4063,12 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "node_modules/@types/pbf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.2.tgz", + "integrity": "sha512-EDrLIPaPXOZqDjrkzxxbX7UlJSeQVgah3i0aA4pOSzmK9zq3BIh7/MZIQxED7slJByvKM4Gc6Hypyu2lJzh3SQ==", + "dev": true + }, "node_modules/@types/prettier": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", @@ -5114,6 +5209,12 @@ "node": ">= 8" } }, + "node_modules/csscolorparser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", + "integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==", + "dev": true + }, "node_modules/cssom": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", @@ -5343,6 +5444,12 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==" }, + "node_modules/earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", + "dev": true + }, "node_modules/electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", @@ -6332,6 +6439,12 @@ "resolved": "https://registry.npmjs.org/geojson-flatten/-/geojson-flatten-1.1.1.tgz", "integrity": "sha512-k/6BCd0qAt7vdqdM1LkLfAy72EsLDy0laNwX0x2h49vfYCiQkRc4PSra8DNEdJ10EKRpwEvDXMb0dBknTJuWpQ==" }, + "node_modules/geojson-vt": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", + "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==", + "dev": true + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -6392,6 +6505,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==", + "dev": true + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -6424,6 +6543,32 @@ "node": ">= 6" } }, + "node_modules/global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "dependencies": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -6681,6 +6826,26 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -6763,6 +6928,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "node_modules/internal-slot": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz", @@ -8998,6 +9169,21 @@ "node": ">=4.0" } }, + "node_modules/kdbush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", + "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==", + "dev": true + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -9179,6 +9365,45 @@ "tmpl": "1.0.5" } }, + "node_modules/mapbox-gl": { + "name": "empty-npm-package", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/empty-npm-package/-/empty-npm-package-1.0.0.tgz", + "integrity": "sha512-q4Mq/+XO7UNDdMiPpR/LIBIW1Zl4V0Z6UT9aKGqIAnBCtCb3lvZJM1KbDbdzdC8fKflwflModfjR29Nt0EpcwA==" + }, + "node_modules/maplibre-gl": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.4.0.tgz", + "integrity": "sha512-csNFylzntPmHWidczfgCZpvbTSmhaWvLRj9e1ezUDBEPizGgshgm3ea1T5TCNEEBq0roauu7BPuRZjA3wO4KqA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@mapbox/geojson-rewind": "^0.5.2", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.5", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@types/geojson": "^7946.0.10", + "@types/mapbox__point-geometry": "^0.1.2", + "@types/mapbox__vector-tile": "^1.3.0", + "@types/pbf": "^3.0.2", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.4", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.4.3", + "global-prefix": "^3.0.0", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.2", + "quickselect": "^2.0.0", + "supercluster": "^7.1.5", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.3" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -9297,6 +9522,15 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -9349,6 +9583,12 @@ "react-dom": ">= 17.0" } }, + "node_modules/murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==", + "dev": true + }, "node_modules/mustache": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", @@ -9752,6 +9992,19 @@ "node": ">=8" } }, + "node_modules/pbf": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", + "dev": true, + "dependencies": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + }, + "bin": { + "pbf": "bin/pbf" + } + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -9851,6 +10104,12 @@ "node": ">=8" } }, + "node_modules/potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", + "dev": true + }, "node_modules/precise-commits": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/precise-commits/-/precise-commits-1.0.2.tgz", @@ -10140,6 +10399,12 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "dev": true + }, "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -10203,6 +10468,12 @@ } ] }, + "node_modules/quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", + "dev": true + }, "node_modules/ramda": { "version": "0.26.1", "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz", @@ -10274,6 +10545,18 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, + "node_modules/react-map-gl": { + "version": "7.0.21", + "resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-7.0.21.tgz", + "integrity": "sha512-Cmokphv6VHfRJsHVjCtn7nw5mf8rl89CHdvPSaif0OWZZqe+pxM2/5hEr4EvPWeTokRPCo1XTrBpGbShkEuktQ==", + "dependencies": { + "@types/mapbox-gl": "^2.6.0" + }, + "peerDependencies": { + "mapbox-gl": "*", + "react": ">=16.3.0" + } + }, "node_modules/react-redux": { "version": "8.0.5", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz", @@ -10645,6 +10928,15 @@ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" }, + "node_modules/resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "dev": true, + "dependencies": { + "protocol-buffers-schema": "^3.3.1" + } + }, "node_modules/resolve.exports": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.1.tgz", @@ -11228,6 +11520,15 @@ "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz", "integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==" }, + "node_modules/supercluster": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.5.tgz", + "integrity": "sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==", + "dev": true, + "dependencies": { + "kdbush": "^3.0.0" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -11315,6 +11616,12 @@ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" }, + "node_modules/tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==", + "dev": true + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -11662,6 +11969,17 @@ "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" }, + "node_modules/vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "dev": true, + "dependencies": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -12024,10 +12342,12 @@ "version": "1.3.0", "license": "MIT", "dependencies": { - "@mapbox/mapbox-gl-draw": "^1.2.0", + "@mapbox/mapbox-gl-draw": "^1.3.0", "@turf/circle": "^6.5.0", "@wq/map": "^1.3.0", - "@wq/material": "../material" + "@wq/material": "../material", + "mapbox-gl": "npm:empty-npm-package@^1.0.0", + "react-map-gl": "^7.0.21" }, "devDependencies": { "@wq/material-web": "file:../material-web", @@ -14350,6 +14670,22 @@ "resolved": "https://registry.npmjs.org/@mapbox/geojson-normalize/-/geojson-normalize-0.0.1.tgz", "integrity": "sha512-82V7YHcle8lhgIGqEWwtXYN5cy0QM/OHq3ypGhQTbvHR57DF0vMHMjjVSQKFfVXBe/yWCBZTyOuzvK7DFFnx5Q==" }, + "@mapbox/geojson-rewind": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@mapbox/geojson-rewind/-/geojson-rewind-0.5.2.tgz", + "integrity": "sha512-tJaT+RbYGJYStt7wI3cq4Nl4SXxG8W7JDG5DMJu97V25RnbNg3QtQtf+KD+VLjNpWKYsRvXDNmNrBgEETr1ifA==", + "dev": true, + "requires": { + "get-stream": "^6.0.1", + "minimist": "^1.2.6" + } + }, + "@mapbox/jsonlint-lines-primitives": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@mapbox/jsonlint-lines-primitives/-/jsonlint-lines-primitives-2.0.2.tgz", + "integrity": "sha512-rY0o9A5ECsTQRVhv7tL/OyDpGAoUB4tTvLiW1DSzQGq4bvTPhNw1VpSNjDJc5GFZ2XuyOtSWSVN05qOtcD71qQ==", + "dev": true + }, "@mapbox/mapbox-gl-draw": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-draw/-/mapbox-gl-draw-1.3.0.tgz", @@ -14364,11 +14700,44 @@ "xtend": "^4.0.2" } }, + "@mapbox/mapbox-gl-supported": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-2.0.1.tgz", + "integrity": "sha512-HP6XvfNIzfoMVfyGjBckjiAOQK9WfX0ywdLubuPMPv+Vqf5fj0uCbgBQYpiqcWZT6cbyyRnTSXDheT1ugvF6UQ==", + "dev": true + }, "@mapbox/point-geometry": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@mapbox/point-geometry/-/point-geometry-0.1.0.tgz", "integrity": "sha512-6j56HdLTwWGO0fJPlrZtdU/B13q8Uwmo18Ck2GnGgN9PCFyKTZ3UbXeEdRFh18i9XQ92eH2VdtpJHpBD3aripQ==" }, + "@mapbox/tiny-sdf": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-2.0.5.tgz", + "integrity": "sha512-OhXt2lS//WpLdkqrzo/KwB7SRD8AiNTFFzuo9n14IBupzIMa67yGItcK7I2W9D8Ghpa4T04Sw9FWsKCJG50Bxw==", + "dev": true + }, + "@mapbox/unitbezier": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@mapbox/unitbezier/-/unitbezier-0.0.1.tgz", + "integrity": "sha512-nMkuDXFv60aBr9soUG5q+GvZYL+2KZHVvsqFCzqnkGEf46U2fvmytHaEVc1/YZbiLn8X+eR3QzX1+dwDO1lxlw==", + "dev": true + }, + "@mapbox/vector-tile": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@mapbox/vector-tile/-/vector-tile-1.3.1.tgz", + "integrity": "sha512-MCEddb8u44/xfQ3oD+Srl/tNcQoqTw3goGk2oLsrFxOTc3dUp+kAnby3PvAeeBYSMSjSPD1nd1AJA6W49WnoUw==", + "dev": true, + "requires": { + "@mapbox/point-geometry": "~0.1.0" + } + }, + "@mapbox/whoots-js": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz", + "integrity": "sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==", + "dev": true + }, "@mui/base": { "version": "5.0.0-alpha.114", "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.114.tgz", @@ -14778,6 +15147,11 @@ "integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==", "dev": true }, + "@types/geojson": { + "version": "7946.0.10", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.10.tgz", + "integrity": "sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==" + }, "@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -14837,6 +15211,31 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "@types/mapbox__point-geometry": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@types/mapbox__point-geometry/-/mapbox__point-geometry-0.1.2.tgz", + "integrity": "sha512-D0lgCq+3VWV85ey1MZVkE8ZveyuvW5VAfuahVTQRpXFQTxw03SuIf1/K4UQ87MMIXVKzpFjXFiFMZzLj2kU+iA==", + "dev": true + }, + "@types/mapbox__vector-tile": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@types/mapbox__vector-tile/-/mapbox__vector-tile-1.3.0.tgz", + "integrity": "sha512-kDwVreQO5V4c8yAxzZVQLE5tyWF+IPToAanloQaSnwfXmIcJ7cyOrv8z4Ft4y7PsLYmhWXmON8MBV8RX0Rgr8g==", + "dev": true, + "requires": { + "@types/geojson": "*", + "@types/mapbox__point-geometry": "*", + "@types/pbf": "*" + } + }, + "@types/mapbox-gl": { + "version": "2.7.10", + "resolved": "https://registry.npmjs.org/@types/mapbox-gl/-/mapbox-gl-2.7.10.tgz", + "integrity": "sha512-nMVEcu9bAcenvx6oPWubQSPevsekByjOfKjlkr+8P91vawtkxTnopDoXXq1Qn/f4cg3zt0Z2W9DVsVsKRNXJTw==", + "requires": { + "@types/geojson": "*" + } + }, "@types/node": { "version": "18.11.18", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", @@ -14848,6 +15247,12 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "@types/pbf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.2.tgz", + "integrity": "sha512-EDrLIPaPXOZqDjrkzxxbX7UlJSeQVgah3i0aA4pOSzmK9zq3BIh7/MZIQxED7slJByvKM4Gc6Hypyu2lJzh3SQ==", + "dev": true + }, "@types/prettier": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", @@ -15086,14 +15491,16 @@ "@wq/map-gl-web": { "version": "file:packages/map-gl-web", "requires": { - "@mapbox/mapbox-gl-draw": "^1.2.0", + "@mapbox/mapbox-gl-draw": "^1.3.0", "@turf/circle": "^6.5.0", "@wq/map": "^1.3.0", "@wq/material": "../material", "@wq/material-web": "file:../material-web", "@wq/model": "^1.3.0", "@wq/react": "../react", - "@wq/store": "^1.3.0" + "@wq/store": "^1.3.0", + "mapbox-gl": "npm:empty-npm-package@^1.0.0", + "react-map-gl": "^7.0.21" } }, "@wq/material": { @@ -15782,6 +16189,12 @@ "which": "^2.0.1" } }, + "csscolorparser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/csscolorparser/-/csscolorparser-1.0.3.tgz", + "integrity": "sha512-umPSgYwZkdFoUrH5hIq5kf0wPSXiro51nPw0j2K/c83KflkPSTBGMz6NJvMB+07VlL0y7VPo6QJcDjcgKTTm3w==", + "dev": true + }, "cssom": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", @@ -15964,6 +16377,12 @@ } } }, + "earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", + "dev": true + }, "electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", @@ -16691,6 +17110,12 @@ "resolved": "https://registry.npmjs.org/geojson-flatten/-/geojson-flatten-1.1.1.tgz", "integrity": "sha512-k/6BCd0qAt7vdqdM1LkLfAy72EsLDy0laNwX0x2h49vfYCiQkRc4PSra8DNEdJ10EKRpwEvDXMb0dBknTJuWpQ==" }, + "geojson-vt": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/geojson-vt/-/geojson-vt-3.2.1.tgz", + "integrity": "sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==", + "dev": true + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -16730,6 +17155,12 @@ "get-intrinsic": "^1.1.1" } }, + "gl-matrix": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", + "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==", + "dev": true + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -16753,6 +17184,28 @@ "is-glob": "^4.0.1" } }, + "global-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz", + "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==", + "dev": true, + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -16936,6 +17389,12 @@ "safer-buffer": ">= 2.1.2 < 3.0.0" } }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, "ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -16997,6 +17456,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, "internal-slot": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz", @@ -18634,6 +19099,18 @@ "object.assign": "^4.1.3" } }, + "kdbush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", + "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, "kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -18789,6 +19266,43 @@ "tmpl": "1.0.5" } }, + "mapbox-gl": { + "version": "npm:empty-npm-package@1.0.0", + "resolved": "https://registry.npmjs.org/empty-npm-package/-/empty-npm-package-1.0.0.tgz", + "integrity": "sha512-q4Mq/+XO7UNDdMiPpR/LIBIW1Zl4V0Z6UT9aKGqIAnBCtCb3lvZJM1KbDbdzdC8fKflwflModfjR29Nt0EpcwA==" + }, + "maplibre-gl": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.4.0.tgz", + "integrity": "sha512-csNFylzntPmHWidczfgCZpvbTSmhaWvLRj9e1ezUDBEPizGgshgm3ea1T5TCNEEBq0roauu7BPuRZjA3wO4KqA==", + "dev": true, + "requires": { + "@mapbox/geojson-rewind": "^0.5.2", + "@mapbox/jsonlint-lines-primitives": "^2.0.2", + "@mapbox/mapbox-gl-supported": "^2.0.1", + "@mapbox/point-geometry": "^0.1.0", + "@mapbox/tiny-sdf": "^2.0.5", + "@mapbox/unitbezier": "^0.0.1", + "@mapbox/vector-tile": "^1.3.1", + "@mapbox/whoots-js": "^3.1.0", + "@types/geojson": "^7946.0.10", + "@types/mapbox__point-geometry": "^0.1.2", + "@types/mapbox__vector-tile": "^1.3.0", + "@types/pbf": "^3.0.2", + "csscolorparser": "~1.0.3", + "earcut": "^2.2.4", + "geojson-vt": "^3.2.1", + "gl-matrix": "^3.4.3", + "global-prefix": "^3.0.0", + "murmurhash-js": "^1.0.0", + "pbf": "^3.2.1", + "potpack": "^1.0.2", + "quickselect": "^2.0.0", + "supercluster": "^7.1.5", + "tinyqueue": "^2.0.3", + "vt-pbf": "^3.1.3" + } + }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -18886,6 +19400,12 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true + }, "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -18919,6 +19439,12 @@ "react-dropzone": "^10.2.1" } }, + "murmurhash-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/murmurhash-js/-/murmurhash-js-1.0.0.tgz", + "integrity": "sha512-TvmkNhkv8yct0SVBSy+o8wYzXjE4Zz3PCesbfs8HiCXXdcTuocApFv11UWlNFWKYsP2okqrhb7JNlSm9InBhIw==", + "dev": true + }, "mustache": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", @@ -19226,6 +19752,16 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, + "pbf": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", + "dev": true, + "requires": { + "ieee754": "^1.1.12", + "resolve-protobuf-schema": "^2.1.0" + } + }, "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -19297,6 +19833,12 @@ } } }, + "potpack": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", + "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", + "dev": true + }, "precise-commits": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/precise-commits/-/precise-commits-1.0.2.tgz", @@ -19520,6 +20062,12 @@ } } }, + "protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", + "dev": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -19560,6 +20108,12 @@ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, + "quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", + "dev": true + }, "ramda": { "version": "0.26.1", "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz", @@ -19617,6 +20171,14 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, + "react-map-gl": { + "version": "7.0.21", + "resolved": "https://registry.npmjs.org/react-map-gl/-/react-map-gl-7.0.21.tgz", + "integrity": "sha512-Cmokphv6VHfRJsHVjCtn7nw5mf8rl89CHdvPSaif0OWZZqe+pxM2/5hEr4EvPWeTokRPCo1XTrBpGbShkEuktQ==", + "requires": { + "@types/mapbox-gl": "^2.6.0" + } + }, "react-redux": { "version": "8.0.5", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.0.5.tgz", @@ -19897,6 +20459,15 @@ "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-2.2.0.tgz", "integrity": "sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==" }, + "resolve-protobuf-schema": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", + "dev": true, + "requires": { + "protocol-buffers-schema": "^3.3.1" + } + }, "resolve.exports": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-1.1.1.tgz", @@ -20345,6 +20916,15 @@ "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz", "integrity": "sha512-GP6WDNWf+o403jrEp9c5jibKavrtLW+/qYGhFxFrG8maXhwTBI7gLLhiBb0o7uFccWN+EOS9aMO6cGHWAO07OA==" }, + "supercluster": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.5.tgz", + "integrity": "sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==", + "dev": true, + "requires": { + "kdbush": "^3.0.0" + } + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -20416,6 +20996,12 @@ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" }, + "tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==", + "dev": true + }, "tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -20670,6 +21256,17 @@ "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-0.4.0.tgz", "integrity": "sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==" }, + "vt-pbf": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/vt-pbf/-/vt-pbf-3.1.3.tgz", + "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", + "dev": true, + "requires": { + "@mapbox/point-geometry": "0.1.0", + "@mapbox/vector-tile": "^1.3.1", + "pbf": "^3.2.1" + } + }, "w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", diff --git a/package.json b/package.json index 7212c427..2b652f56 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "husky": "^8.0.0", "jest": "^29.3.1", "jest-environment-jsdom": "^29.3.1", + "maplibre-gl": "^2.4.0", "metro-react-native-babel-preset": "^0.74.0", "precise-commits": "^1.0.2", "prettier": "^2.8.3", diff --git a/packages/app/css/wq.css b/packages/app/css/wq.css index 4dec8769..56b2e867 100644 --- a/packages/app/css/wq.css +++ b/packages/app/css/wq.css @@ -1,2 +1,2 @@ -@import url("./mapbox-gl.css"); +@import url("./maplibre-gl.css"); @import url("./mapbox-gl-draw.css"); diff --git a/packages/map-gl-web/.gitignore b/packages/map-gl-web/.gitignore index 4d45bb61..b8655d3a 100644 --- a/packages/map-gl-web/.gitignore +++ b/packages/map-gl-web/.gitignore @@ -1,5 +1,6 @@ /index.js /util.js +/hooks.js /components/ /basemaps/ /overlays/ diff --git a/packages/map-gl-web/package.json b/packages/map-gl-web/package.json index 477e2e53..e5ce310a 100644 --- a/packages/map-gl-web/package.json +++ b/packages/map-gl-web/package.json @@ -31,10 +31,12 @@ }, "homepage": "https://wq.io/@wq/map-gl", "dependencies": { - "@mapbox/mapbox-gl-draw": "^1.2.0", + "@mapbox/mapbox-gl-draw": "^1.3.0", "@turf/circle": "^6.5.0", "@wq/map": "^1.3.0", - "@wq/material": "../material" + "@wq/material": "../material", + "mapbox-gl": "npm:empty-npm-package@^1.0.0", + "react-map-gl": "^7.0.21" }, "devDependencies": { "@wq/material-web": "file:../material-web", diff --git a/packages/map-gl-web/src/components/Map.js b/packages/map-gl-web/src/components/Map.js index d29095ba..a6c9997f 100644 --- a/packages/map-gl-web/src/components/Map.js +++ b/packages/map-gl-web/src/components/Map.js @@ -1,29 +1,17 @@ -import React, { useMemo, useCallback } from "react"; +import React from "react"; import { usePlugin } from "@wq/react"; import PropTypes from "prop-types"; -import ReactMapboxGl from "react-mapbox-gl"; +import Root from "react-map-gl"; import { findBasemapStyle } from "../util"; export default function Map({ - name, + mapId, initBounds, children, mapProps, containerStyle, }) { - const { ready } = usePlugin("map"), - Root = useMemo(() => ReactMapboxGl(mapProps || {}), [mapProps]), - fitBounds = useMemo(() => { - const [[xmin, ymin], [xmax, ymax]] = initBounds; - return [ - [xmin, ymin], - [xmax, ymax], - ]; - }, [initBounds]), - onStyleLoad = useCallback( - (instance) => ready(instance, name), - [ready, name] - ), + const { engine } = usePlugin("map-gl"), style = findBasemapStyle(children); containerStyle = { @@ -32,12 +20,21 @@ export default function Map({ ...containerStyle, }; + if (!engine) { + throw new Error( + "Must pass maplibre-gl or mapbox-gl to mapgl.setEngine()! See https://wq.io/@wq/map-gl" + ); + } + return ( {children} @@ -45,7 +42,7 @@ export default function Map({ } Map.propTypes = { - name: PropTypes.string, + mapId: PropTypes.string, initBounds: PropTypes.array, children: PropTypes.node, mapProps: PropTypes.object, diff --git a/packages/map-gl-web/src/components/MapAutoZoom.js b/packages/map-gl-web/src/components/MapAutoZoom.js index 70e8c376..7bea8c1e 100644 --- a/packages/map-gl-web/src/components/MapAutoZoom.js +++ b/packages/map-gl-web/src/components/MapAutoZoom.js @@ -1,8 +1,15 @@ import { useEffect } from "react"; -import { useMapInstance, computeBounds } from "@wq/map"; +import { computeBounds } from "@wq/map"; +import { useMapInstance } from "../hooks"; -export default function MapAutoZoom({ name, context, wait, maxZoom, animate }) { - const map = useMapInstance(name); +export default function MapAutoZoom({ + mapId, + context, + wait, + maxZoom, + animate, +}) { + const map = useMapInstance(mapId); useEffect(() => { if (!map || !context) { diff --git a/packages/map-gl-web/src/components/MapInteraction.js b/packages/map-gl-web/src/components/MapInteraction.js index 87ff6788..2912478a 100644 --- a/packages/map-gl-web/src/components/MapInteraction.js +++ b/packages/map-gl-web/src/components/MapInteraction.js @@ -1,11 +1,10 @@ import React from "react"; -import { ZoomControl, ScaleControl, RotationControl } from "react-mapbox-gl"; +import { NavigationControl, ScaleControl } from "react-map-gl"; export default function MapInteraction() { return ( <> - - + ); diff --git a/packages/map-gl-web/src/components/MapProvider.js b/packages/map-gl-web/src/components/MapProvider.js new file mode 100644 index 00000000..19d5452d --- /dev/null +++ b/packages/map-gl-web/src/components/MapProvider.js @@ -0,0 +1,3 @@ +import { MapProvider } from "react-map-gl"; + +export default MapProvider; diff --git a/packages/map-gl-web/src/components/index.js b/packages/map-gl-web/src/components/index.js index f19a626f..5c779b5a 100644 --- a/packages/map-gl-web/src/components/index.js +++ b/packages/map-gl-web/src/components/index.js @@ -1,7 +1,15 @@ import Map from "./Map"; +import MapProvider from "./MapProvider"; import MapInteraction from "./MapInteraction"; import MapAutoZoom from "./MapAutoZoom"; import MapIdentify from "./MapIdentify"; import MapLayers from "./MapLayers"; -export { Map, MapInteraction, MapAutoZoom, MapIdentify, MapLayers }; +export { + Map, + MapProvider, + MapInteraction, + MapAutoZoom, + MapIdentify, + MapLayers, +}; diff --git a/packages/map-gl-web/src/hooks.js b/packages/map-gl-web/src/hooks.js new file mode 100644 index 00000000..1681f907 --- /dev/null +++ b/packages/map-gl-web/src/hooks.js @@ -0,0 +1,6 @@ +import { useMap } from "react-map-gl"; + +export function useMapInstance(mapId) { + const maps = useMap(); + return mapId ? maps[mapId] : maps.current; +} diff --git a/packages/map-gl-web/src/index.js b/packages/map-gl-web/src/index.js index 667479f3..27100f60 100644 --- a/packages/map-gl-web/src/index.js +++ b/packages/map-gl-web/src/index.js @@ -2,12 +2,15 @@ import map from "@wq/map"; import { Map, + MapProvider, MapInteraction, MapAutoZoom, MapIdentify, MapLayers, } from "./components/index"; +import { useMapInstance } from "./hooks"; + import { VectorTile, Tile } from "./basemaps/index"; import { @@ -24,8 +27,13 @@ import { zoomToLocation } from "./util"; export default { name: "map-gl", dependencies: [map], + setEngine(engine) { + this.engine = engine; + }, components: { Map, + MapProvider, + useMapInstance, MapInteraction, MapAutoZoom, MapIdentify, diff --git a/packages/map-gl-web/src/overlays/Draw.js b/packages/map-gl-web/src/overlays/Draw.js index 1c352802..99e85ddc 100644 --- a/packages/map-gl-web/src/overlays/Draw.js +++ b/packages/map-gl-web/src/overlays/Draw.js @@ -1,6 +1,7 @@ -import React, { useRef, useEffect } from "react"; +import { useRef, useEffect } from "react"; import PropTypes from "prop-types"; -import DrawControl from "react-mapbox-gl-draw"; +import { useControl } from "react-map-gl"; +import MapboxDraw from "@mapbox/mapbox-gl-draw"; export default function Draw({ type, required, data, setData }) { const types = type === "all" ? ["point", "line_string", "polygon"] : [type], @@ -12,32 +13,46 @@ export default function Draw({ type, required, data, setData }) { if (!required) { controls.trash = true; } + const draw = useControl( + (props) => + new MapboxDraw({ + ...props, + displayControlsDefault: false, + controls, + }), + ({ map }) => { + map.on("draw.create", handleChange); + map.on("draw.delete", handleChange); + map.on("draw.update", handleChange); + map.on("draw.combine", handleChange); + map.on("draw.uncombine", handleChange); + }, + ({ map }) => { + map.off("draw.create", handleChange); + map.off("draw.delete", handleChange); + map.off("draw.update", handleChange); + map.off("draw.combine", handleChange); + map.off("draw.uncombine", handleChange); + }, + { position: "top-right" } + ); + + useEffect(() => { + ref.current = { draw }; + }, [draw]); useEffect(() => { - if (data && ref.current) { - const { draw } = ref.current; + if (draw && data) { draw.set(data); } - }, [ref, data]); + }, [draw, data]); function handleChange() { const { draw } = ref.current; setData(draw.getAll()); } - return ( - - ); + return null; } Draw.propTypes = { diff --git a/packages/map-gl-web/src/overlays/GeoJSONLayer.js b/packages/map-gl-web/src/overlays/GeoJSONLayer.js index 1b5bae49..e11f323d 100644 --- a/packages/map-gl-web/src/overlays/GeoJSONLayer.js +++ b/packages/map-gl-web/src/overlays/GeoJSONLayer.js @@ -1,3 +1,68 @@ -import { GeoJSONLayer } from "react-mapbox-gl"; +import React, { useMemo } from "react"; +import { Source, Layer } from "react-map-gl"; +import PropTypes from "prop-types"; -export default GeoJSONLayer; +const types = ["symbol", "line", "fill", "circle"]; + +// Same API as react-mapbox-gl's GeoJSONLayer but implemented via react-map-gl + +export default function GeoJSONLayer({ id, before, data, ...rest }) { + if (!id) { + const ids = + data && data.features + ? data.features.map((feature) => feature.id) + : []; + id = `_geojson_${ids.join("_")}`; + } + const { + symbolLayout, + symbolPaint, + fillLayout, + fillPaint, + lineLayout, + linePaint, + circleLayout, + circlePaint, + } = rest; + const [source, layers] = useMemo(() => { + const source = { + id, + type: "geojson", + data, + }; + const layers = types.map((type) => ({ + id: `${id}-${type}`, + type, + paint: rest[`${type}Paint`] || {}, + layout: rest[`${type}Layout`] || {}, + })); + + return [source, layers]; + }, [ + id, + before, + data, + symbolLayout, + symbolPaint, + fillLayout, + fillPaint, + lineLayout, + linePaint, + circleLayout, + circlePaint, + ]); + + return ( + + {layers.map((layer) => ( + + ))} + + ); +} + +GeoJSONLayer.propTypes = { + id: PropTypes.string, + before: PropTypes.string, + data: PropTypes.object, +}; diff --git a/packages/map-gl-web/src/overlays/Tile.js b/packages/map-gl-web/src/overlays/Tile.js index 197ae578..6b2fe003 100644 --- a/packages/map-gl-web/src/overlays/Tile.js +++ b/packages/map-gl-web/src/overlays/Tile.js @@ -1,6 +1,6 @@ import React, { useMemo } from "react"; import PropTypes from "prop-types"; -import { Source, Layer } from "react-mapbox-gl"; +import { Source, Layer } from "react-map-gl"; export default function Tile({ name, active, url, tileSize, layout, paint }) { const source = useMemo(() => { @@ -16,16 +16,9 @@ export default function Tile({ name, active, url, tileSize, layout, paint }) { } return ( - <> - - - + + + ); } diff --git a/packages/map-gl-web/src/overlays/VectorTile.js b/packages/map-gl-web/src/overlays/VectorTile.js index 84a829c2..3449925a 100644 --- a/packages/map-gl-web/src/overlays/VectorTile.js +++ b/packages/map-gl-web/src/overlays/VectorTile.js @@ -1,58 +1,15 @@ import React, { useState, useEffect } from "react"; import PropTypes from "prop-types"; -import { Source, Layer } from "react-mapbox-gl"; +import { Source, Layer } from "react-map-gl"; -function AutoSource({ id, type, ...rest }) { - let geoJsonSource, tileJsonSource; - if (type === "geojson") { - geoJsonSource = { type, ...rest }; - } else { - tileJsonSource = { type, ...rest }; - } - return ( - - ); -} - -function AutoLayer({ - active, - before, - id, - type, - layout, - paint, - metadata, - source: sourceId, - ["source-layer"]: sourceLayer, - minzoom: minZoom, - maxzoom: maxZoom, - filter, -}) { +function AutoLayer({ id, active, before, layout, ...rest }) { if (active === false) { layout = { ...(layout || {}), visibility: "none", }; } - return ( - - ); + return ; } export default function VectorTile({ name, active, before, url, style }) { @@ -75,7 +32,7 @@ export default function VectorTile({ name, active, before, url, style }) { return ( <> {Object.entries(sources).map(([id, source]) => ( - + ))} {layers.map((layer) => ( { mapProps: undefined, mapId: undefined, highlight: null, - instance: null, - instances: {}, }); map.setBasemap("Basemap 2"); diff --git a/packages/map/src/components/AutoMap.js b/packages/map/src/components/AutoMap.js index cd5c4d70..1c5ada59 100644 --- a/packages/map/src/components/AutoMap.js +++ b/packages/map/src/components/AutoMap.js @@ -5,6 +5,7 @@ import PropTypes from "prop-types"; export default function AutoMap({ name, + mapId, toolbar = true, containerStyle, context, @@ -40,10 +41,11 @@ export default function AutoMap({ const identify = overlays.some((overlay) => !!overlay.popup); return ( - + {toolbar && ( - + {!!autoZoom && ( - + + )} + {identify && ( + )} - {identify && } {basemaps.map((conf) => ( @@ -82,16 +92,9 @@ export default function AutoMap({ ); } -AutoMap.makeComponent = (props) => { - function Component() { - return ; - } - - return Component; -}; - AutoMap.propTypes = { name: PropTypes.string, + mapId: PropTypes.string, toolbar: PropTypes.bool, containerStyle: PropTypes.object, context: PropTypes.object, diff --git a/packages/map/src/components/GeoTools.js b/packages/map/src/components/GeoTools.js index 95adb17e..4111529d 100644 --- a/packages/map/src/components/GeoTools.js +++ b/packages/map/src/components/GeoTools.js @@ -4,10 +4,11 @@ import { useMinWidth } from "@wq/material"; import { useGeoTools } from "../hooks"; import PropTypes from "prop-types"; -export default function GeoTools({ name, type }) { +export default function GeoTools({ name, type, mapId }) { const { toggleProps, setLocation, ActiveTool, value } = useGeoTools( name, - type + type, + mapId ), { View } = useComponents(), { Toggle } = useInputComponents(), @@ -63,4 +64,5 @@ export default function GeoTools({ name, type }) { GeoTools.propTypes = { name: PropTypes.string, type: PropTypes.string, + mapId: PropTypes.string, }; diff --git a/packages/map/src/components/Map.js b/packages/map/src/components/Map.js index 59c12370..fa8546bb 100644 --- a/packages/map/src/components/Map.js +++ b/packages/map/src/components/Map.js @@ -4,10 +4,7 @@ import PropTypes from "prop-types"; export default function Map({ children }) { return (
-

- No map integration library loaded - use @wq/leaflet or - @wq/map-gl. -

+

No map integration library loaded - install @wq/map-gl.

{children}
); diff --git a/packages/map/src/components/MapProvider.js b/packages/map/src/components/MapProvider.js new file mode 100644 index 00000000..fbee249b --- /dev/null +++ b/packages/map/src/components/MapProvider.js @@ -0,0 +1,3 @@ +import { Fragment } from "react"; + +export default Fragment; diff --git a/packages/map/src/components/MapToolbar.js b/packages/map/src/components/MapToolbar.js index 9fb6f16d..fc4d59b2 100644 --- a/packages/map/src/components/MapToolbar.js +++ b/packages/map/src/components/MapToolbar.js @@ -1,10 +1,9 @@ import React from "react"; import PropTypes from "prop-types"; import { useComponents } from "@wq/react"; -import { useMapInstance } from "../hooks"; export default function MapToolbar({ - name, + mapId, overlays, basemaps, showOverlay, @@ -12,9 +11,15 @@ export default function MapToolbar({ setBasemap, children, }) { - const { SidePanel, List, ListSubheader, OverlayToggle, BasemapToggle } = - useComponents(), - map = useMapInstance(name), + const { + SidePanel, + List, + ListSubheader, + OverlayToggle, + BasemapToggle, + useMapInstance, + } = useComponents(), + map = useMapInstance(mapId), hasMultipleOverlays = overlays && (overlays.length > 1 || overlays.some((conf) => conf.legend)), @@ -73,7 +78,7 @@ export default function MapToolbar({ } MapToolbar.propTypes = { - name: PropTypes.string, + mapId: PropTypes.string, overlays: PropTypes.arrayOf(PropTypes.object), basemaps: PropTypes.arrayOf(PropTypes.object), showOverlay: PropTypes.func, diff --git a/packages/map/src/components/OffscreenMaps.js b/packages/map/src/components/OffscreenMaps.js deleted file mode 100644 index 63a48698..00000000 --- a/packages/map/src/components/OffscreenMaps.js +++ /dev/null @@ -1,85 +0,0 @@ -import React, { useEffect } from "react"; -import { useComponents, usePluginReducer } from "@wq/react"; -import { makeStyles } from "@material-ui/core/styles"; -import { createReparentableSpace } from "react-reparenting"; - -const { Reparentable, sendReparentableChild } = createReparentableSpace(); - -export { Reparentable }; - -const OFFSCREEN_ID = "offscreen-maps"; - -const useStyles = makeStyles({ - offscreen: { - "&> *": { - position: "absolute !important", - top: "-2000px !important", - width: "100vw", - height: "calc(100vh - 120px)", - }, - }, -}); - -export function moveOffscreen(mapId) { - sendReparentableChild(mapId, OFFSCREEN_ID, mapId, 0); -} - -export default function OffscreenMaps() { - const { AutoMap } = useComponents(), - classes = useStyles(); - const [{ mapId, stickyMaps, stickyMapId }, { setStickyMapId }] = - usePluginReducer("map"); - - useEffect(() => { - if ((!mapId && !stickyMapId) || mapId === stickyMapId) { - return; - } - - if (stickyMapId) { - moveOffscreen(stickyMapId); - } - - if ( - mapId && - stickyMaps && - stickyMaps[mapId] && - stickyMaps[mapId].props - ) { - sendReparentableChild(OFFSCREEN_ID, mapId, mapId, 0); - setStickyMapId(mapId); - } else { - setStickyMapId(null); - } - }, [mapId, stickyMapId, stickyMaps]); - - return ( -
- - {Object.entries(stickyMaps || {}).map( - ([ - mapId, - { - props: { - name, - containerStyle, - state, - children, - } = {}, - }, - ]) => - mapId !== stickyMapId && - state && ( - - {children} - - ) - )} - -
- ); -} diff --git a/packages/map/src/components/OffscreenMaps.native.js b/packages/map/src/components/OffscreenMaps.native.js deleted file mode 100644 index 8023ccda..00000000 --- a/packages/map/src/components/OffscreenMaps.native.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function FIXME() { - return null; -} diff --git a/packages/map/src/components/StickyMap.js b/packages/map/src/components/StickyMap.js deleted file mode 100644 index e526d61b..00000000 --- a/packages/map/src/components/StickyMap.js +++ /dev/null @@ -1,80 +0,0 @@ -import React, { useEffect } from "react"; -import { useComponents, usePluginReducer } from "@wq/react"; -import PropTypes from "prop-types"; -import { Reparentable, moveOffscreen } from "./OffscreenMaps"; - -export default function StickyMap({ - mapId, - name, - containerStyle, - context, - children, -}) { - const [mapState, { setStickyProps }] = usePluginReducer("map"), - { stickyMapId, stickyMaps } = mapState, - currentProps = - stickyMaps && stickyMaps[mapId] && stickyMaps[mapId].props, - { AutoMap } = useComponents(); - - useEffect(() => { - if (mapState.mapId !== mapId) { - return; - } - - const nextState = {}; - Object.keys(mapState).forEach((key) => { - if (key === "stickyMapId" || key === "stickyMaps") { - return; - } - nextState[key] = mapState[key]; - }); - - if ( - currentProps && - currentProps.name === name && - currentProps.containerStyle === containerStyle && - currentProps.context === context && - Object.keys(nextState).every( - (key) => nextState[key] === currentProps.state[key] - ) - ) { - return; - } - - setStickyProps({ - name, - containerStyle, - context, - state: nextState, - children, - }); - }, [ - mapId, - mapState, - currentProps, - name, - containerStyle, - context, - children, - ]); - - useEffect(() => { - return () => { - moveOffscreen(mapId); - }; - }, [mapId]); - - return ( - - {mapId === stickyMapId && } - - ); -} - -StickyMap.propTypes = { - mapId: PropTypes.string, - name: PropTypes.string, - containerStyle: PropTypes.object, - context: PropTypes.object, - children: PropTypes.node, -}; diff --git a/packages/map/src/components/index.js b/packages/map/src/components/index.js index cf029504..a53e901f 100644 --- a/packages/map/src/components/index.js +++ b/packages/map/src/components/index.js @@ -1,10 +1,9 @@ import AutoMap from "./AutoMap"; import AutoBasemap from "./AutoBasemap"; import AutoOverlay from "./AutoOverlay"; -import StickyMap from "./StickyMap"; -import OffscreenMaps from "./OffscreenMaps"; import HighlightPopup from "./HighlightPopup"; import PropertyTable from "./PropertyTable"; +import MapProvider from "./MapProvider"; import MapContainer from "./MapContainer"; import MapToolbar from "./MapToolbar"; import Map from "./Map"; @@ -19,10 +18,9 @@ export { AutoMap, AutoBasemap, AutoOverlay, - StickyMap, - OffscreenMaps, HighlightPopup, PropertyTable, + MapProvider, MapContainer, MapToolbar, Map, diff --git a/packages/map/src/hooks.js b/packages/map/src/hooks.js index 0a44b103..a32908ac 100644 --- a/packages/map/src/hooks.js +++ b/packages/map/src/hooks.js @@ -6,6 +6,7 @@ import { usePluginState, useRenderContext, useApp, + useComponents, usePluginComponentMap, } from "@wq/react"; import Mustache from "mustache"; @@ -24,12 +25,13 @@ export function useOverlayComponents() { return usePluginComponentMap("map", "overlays"); } -export function useGeoTools(name, type) { +export function useGeoTools(name, type, mapId) { const { zoomToLocation } = usePlugin("map").config, tools = usePluginComponentMap("map", "geotools", true), toggleName = `${name}_method`, mapState = useMapState(), - instance = useMapInstance(name), + { useMapInstance } = useComponents(), + instance = useMapInstance(mapId), [, { value }, { setValue }] = useField(name), [, , { setValue: setAccuracy }] = useField(`${name}_accuracy`), [, { value: activeTool }, { setValue: setActiveTool }] = @@ -121,17 +123,12 @@ export function useMapState() { } } -export function useMapInstance(name = null) { - const mapState = useMapState(); - if (mapState) { - if (name) { - return mapState.instances[name]; - } else { - return mapState.instance; - } - } else { - return null; - } +export function useMapInstance() { + throw new Error( + "@wq/map's useMapInstance() export is deprecated." + + " Load useMapInstance() via useComponents()," + + " or import it directly from @wq/map-gl" + ); } function checkGroupLayers(layerconf) { diff --git a/packages/map/src/index.js b/packages/map/src/index.js index e71b2765..72050f26 100644 --- a/packages/map/src/index.js +++ b/packages/map/src/index.js @@ -16,8 +16,6 @@ import { AutoMap, AutoBasemap, AutoOverlay, - StickyMap, - OffscreenMaps, HighlightPopup, PropertyTable, MapToolbar, @@ -46,8 +44,6 @@ export { AutoMap, AutoBasemap, AutoOverlay, - StickyMap, - OffscreenMaps, HighlightPopup, PropertyTable, MapToolbar, diff --git a/packages/map/src/inputs/Geo.js b/packages/map/src/inputs/Geo.js index f5f3dfa4..5b2e2b87 100644 --- a/packages/map/src/inputs/Geo.js +++ b/packages/map/src/inputs/Geo.js @@ -12,6 +12,7 @@ import PropTypes from "prop-types"; export default function Geo({ name, type, + mapId = null, required, label, hint, @@ -45,9 +46,10 @@ export default function Geo({ return (
- + @@ -69,6 +71,7 @@ export default function Geo({ Geo.propTypes = { name: PropTypes.string, type: PropTypes.string, + mapId: PropTypes.string, required: PropTypes.bool, label: PropTypes.string, hint: PropTypes.string, diff --git a/packages/map/src/map.js b/packages/map/src/map.js index 6d5abcb5..9414867c 100644 --- a/packages/map/src/map.js +++ b/packages/map/src/map.js @@ -2,10 +2,9 @@ import { AutoMap, AutoBasemap, AutoOverlay, - StickyMap, - OffscreenMaps, HighlightPopup, PropertyTable, + MapProvider, MapContainer, MapToolbar, Map, @@ -20,9 +19,6 @@ import { Geo } from "./inputs/index"; import { GeoHelp, GeoLocate, GeoCode, GeoCoords } from "./geotools/index"; import { DefaultList, DefaultDetail, DefaultPopup } from "./views/index"; import reducer, { - MAP_READY, - MAP_SET_STICKY_PROPS, - MAP_SET_STICKY_ID, MAP_SHOW_OVERLAY, MAP_HIDE_OVERLAY, MAP_SET_BASEMAP, @@ -54,24 +50,6 @@ const map = { }; }, actions: { - ready(instance, name = null) { - return { - type: MAP_READY, - payload: { instance, name }, - }; - }, - setStickyProps(props) { - return { - type: MAP_SET_STICKY_PROPS, - payload: props, - }; - }, - setStickyMapId(id) { - return { - type: MAP_SET_STICKY_ID, - payload: id, - }; - }, setBasemap(name) { return { type: MAP_SET_BASEMAP, @@ -124,10 +102,10 @@ const map = { AutoMap, AutoBasemap, AutoOverlay, - StickyMap, - OffscreenMaps, HighlightPopup, PropertyTable, + MapProvider, + useMapInstance: () => null, MapContainer, MapToolbar, Map, @@ -322,9 +300,6 @@ map.init = function (config) { }); }; -// Plugin API -map.runComponent = "OffscreenMaps"; - // Default base map configuration - override to customize function _defaultBasemaps() { var cdn = diff --git a/packages/map/src/reducer.js b/packages/map/src/reducer.js index b7033557..29243c0a 100644 --- a/packages/map/src/reducer.js +++ b/packages/map/src/reducer.js @@ -1,10 +1,7 @@ import { routeMapConf } from "./hooks"; const RENDER = "RENDER"; -export const MAP_READY = "MAP_READY", - MAP_SET_STICKY_PROPS = "MAP_SET_STICKY_PROPS", - MAP_SET_STICKY_ID = "MAP_SET_STICKY_ID", - MAP_SHOW_OVERLAY = "MAP_SHOW_OVERLAY", +export const MAP_SHOW_OVERLAY = "MAP_SHOW_OVERLAY", MAP_HIDE_OVERLAY = "MAP_HIDE_OVERLAY", MAP_SET_BASEMAP = "MAP_SET_BASEMAP", MAP_SET_HIGHLIGHT = "MAP_SET_HIGHLIGHT", @@ -31,21 +28,13 @@ export default function reducer(state = {}, action, config) { ); _lastRouteInfo = routeInfo; let nextState = {}; - const { - stickyMaps, - stickyMapId, - activeBasemap, - activeOverlays, - } = state; + const { stickyMaps, activeBasemap, activeOverlays } = state; if (!conf) { nextState = { stickyMaps, activeBasemap, activeOverlays }; } else { const { mapId } = conf, - { - highlight = null, - instance = (isSameView && state.instance) || null, - instances = (isSameView && state.instances) || {}, - } = (mapId && stickyMaps && stickyMaps[mapId]) || {}; + { highlight = null } = + (mapId && stickyMaps && stickyMaps[mapId]) || {}; nextState = { basemaps: reduceBasemaps( state.basemaps, @@ -62,44 +51,22 @@ export default function reducer(state = {}, action, config) { autoZoom: conf.autoZoom, mapProps: conf.mapProps, highlight, - instance, - instances, mapId, - stickyMapId: - isSameView && stickyMapId === mapId ? mapId : null, stickyMaps, activeBasemap, activeOverlays, }; } - [ - "stickyMaps", - "stickyMapId", - "activeBasemap", - "activeOverlays", - ].forEach((key) => { - if (!nextState[key]) { - delete nextState[key]; + ["stickyMaps", "activeBasemap", "activeOverlays"].forEach( + (key) => { + if (!nextState[key]) { + delete nextState[key]; + } } - }); + ); return nextState; } } - case MAP_READY: { - const { name, instance } = action.payload; - if (name) { - return reduceMapState({ - ...state, - instances: { ...state.instances, [name]: instance }, - }); - } else { - return reduceMapState({ ...state, instance }); - } - } - case MAP_SET_STICKY_PROPS: - return reduceMapState(state, { props: action.payload }); - case MAP_SET_STICKY_ID: - return { ...state, stickyMapId: action.payload }; case MAP_SHOW_OVERLAY: return { ...state, @@ -318,15 +285,15 @@ function checkEmpty(geojson) { } } -function reduceMapState(state, stickyState) { - const { mapId, instance, instances, highlight } = state; +function reduceMapState(state) { + const { mapId, highlight } = state; if (mapId) { const stickyMaps = state.stickyMaps || {}; return { ...state, stickyMaps: { ...stickyMaps, - [mapId]: { instance, instances, highlight, ...stickyState }, + [mapId]: { highlight }, }, }; } else { diff --git a/packages/map/src/views/DefaultDetail.js b/packages/map/src/views/DefaultDetail.js index 9f50281f..e0f6728f 100644 --- a/packages/map/src/views/DefaultDetail.js +++ b/packages/map/src/views/DefaultDetail.js @@ -4,25 +4,16 @@ import { DefaultDetail, useComponents, useRenderContext } from "@wq/react"; export default function DefaultDetailWithMap() { const mapState = useMapState(), - { AutoMap, StickyMap } = useComponents(), + { MapProvider, AutoMap } = useComponents(), context = useRenderContext(); if (mapState) { const { mapId } = mapState; - if (mapId) { - return ( - <> - - - - ); - } else { - return ( - <> - - - - ); - } + return ( + + + + + ); } else { return ; } diff --git a/packages/map/src/views/DefaultList.js b/packages/map/src/views/DefaultList.js index fa73eecf..ba4b7e0a 100644 --- a/packages/map/src/views/DefaultList.js +++ b/packages/map/src/views/DefaultList.js @@ -4,27 +4,17 @@ import { DefaultList, useComponents, useList } from "@wq/react"; export default function DefaultListWithMap() { const mapState = useMapState(), - { AutoMap, StickyMap, HighlightPopup } = useComponents(), + { MapProvider, AutoMap, HighlightPopup } = useComponents(), context = useList(); if (mapState) { const { mapId } = mapState; - if (mapId) { - return ( - <> - - - - - ); - } else { - return ( - <> - - - - - ); - } + return ( + + + + + + ); } else { return ; } diff --git a/rollup.config.js b/rollup.config.js index 55dc3f64..bc36f484 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -39,6 +39,9 @@ const deps = { "@wq/map-gl-web": "./packages/map-gl-web/src/index.js", }; function resolveId(id) { + if (id == "maplibre-gl") { + return { id: "./maplibre-gl.js", external: true }; + } return deps[id]; } @@ -101,24 +104,18 @@ export default [ }), replace({ "process.env.NODE_ENV": '"production"', - "require('fs')": "NOT_SUPPORTED", - "require('path')": "NOT_SUPPORTED", - "require.main": "'NOT_SUPPORTED'", - "import * as MapboxGl from 'mapbox-gl'": - "import MapboxGl from 'mapbox-gl'", - "const isEqual = require('deep-equal')": - "import isEqual from 'deep-equal'", - "require('mapbox-gl/dist/mapbox-gl.css')": "", - "from 'react-mapbox-gl'": "from 'react-mapbox-gl/src/index'", - 'require("react-mapbox-gl")': - "require('react-mapbox-gl/src/index')", + "import maplibre from": "import", + "mapgl.setEngine(maplibre)": + "mapgl.setEngine(window.maplibregl)", delimiters: ["", ""], + preventAssignment: true, }), commonjs(), json(), ], output: { file: "static/app/js/wq.js", + inlineDynamicImports: true, banner, format: "esm", sourcemap: true,