@accelint/map-toolkit 0.4.0 → 0.5.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/CHANGELOG.md +52 -24
- package/README.md +3 -0
- package/catalog-info.yaml +6 -7
- package/dist/_virtual/rolldown_runtime.js +22 -0
- package/dist/camera/events.d.ts +15 -0
- package/dist/camera/events.js +29 -0
- package/dist/camera/events.js.map +1 -0
- package/dist/camera/index.d.ts +16 -0
- package/dist/camera/index.js +17 -0
- package/dist/camera/types.d.ts +84 -0
- package/dist/camera/types.js +12 -0
- package/dist/camera/use-camera-state.d.ts +153 -0
- package/dist/camera/use-camera-state.js +419 -0
- package/dist/camera/use-camera-state.js.map +1 -0
- package/dist/cursor-coordinates/use-cursor-coordinates.js +1 -1
- package/dist/deckgl/base-map/constants.d.ts +6 -1
- package/dist/deckgl/base-map/constants.js +6 -1
- package/dist/deckgl/base-map/constants.js.map +1 -1
- package/dist/deckgl/base-map/controls.d.ts +34 -0
- package/dist/deckgl/base-map/controls.js +50 -0
- package/dist/deckgl/base-map/controls.js.map +1 -0
- package/dist/deckgl/base-map/events.d.ts +4 -0
- package/dist/deckgl/base-map/events.js +5 -1
- package/dist/deckgl/base-map/events.js.map +1 -1
- package/dist/deckgl/base-map/index.d.ts +8 -23
- package/dist/deckgl/base-map/index.js +82 -42
- package/dist/deckgl/base-map/index.js.map +1 -1
- package/dist/deckgl/base-map/provider.d.ts +2 -2
- package/dist/deckgl/base-map/types.d.ts +43 -2
- package/dist/deckgl/index.d.ts +5 -4
- package/dist/deckgl/index.js +2 -1
- package/dist/deckgl/saved-viewports/index.d.ts +32 -0
- package/dist/deckgl/saved-viewports/index.js +52 -0
- package/dist/deckgl/saved-viewports/index.js.map +1 -0
- package/dist/deckgl/saved-viewports/storage.d.ts +21 -0
- package/dist/deckgl/saved-viewports/storage.js +39 -0
- package/dist/deckgl/saved-viewports/storage.js.map +1 -0
- package/dist/maplibre/hooks/use-maplibre.d.ts +2 -2
- package/dist/maplibre/hooks/use-maplibre.js +2 -2
- package/dist/maplibre/hooks/use-maplibre.js.map +1 -1
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js +21 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js.map +1 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js +63 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js.map +1 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fly-to-viewport.js +14 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js +20 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js.map +1 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/index.js +19 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js +25 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js.map +1 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/normalize-viewport-props.js +14 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js +59 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js.map +1 -0
- package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-viewport.js +16 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js +29 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js +29 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js +54 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/layer.js +15 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js +29 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js +91 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js +88 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js +29 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js +69 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js +35 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/source.js +15 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js +29 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js +40 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js +23 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/index.js +27 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js +57 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js +343 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js +28 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js +31 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js +57 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js +30 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js +53 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js +52 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js.map +1 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js +22 -0
- package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js +812 -0
- package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js.map +1 -0
- package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js +35 -0
- package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js +195 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js +76 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js.map +1 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js +39 -0
- package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js.map +1 -0
- package/dist/node_modules/.pnpm/react-map-gl@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-map-gl/dist/maplibre.js +16 -0
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js +27 -0
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js.map +1 -0
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +45 -0
- package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js +78 -0
- package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/constants.js +47 -0
- package/dist/packages/hotkey-manager/dist/constants.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/enums/keycode.js +130 -0
- package/dist/packages/hotkey-manager/dist/enums/keycode.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/lib/is-client/index.js +22 -0
- package/dist/packages/hotkey-manager/dist/lib/is-client/index.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js +24 -0
- package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js +39 -0
- package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js +27 -0
- package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js.map +1 -0
- package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js +95 -0
- package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js.map +1 -0
- package/package.json +98 -85
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
# @accelint/map-toolkit
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dde1386: Introduced a new camera feature in map-toolkit:
|
|
8
|
+
Added camera state management, types, events, documentation, and Storybook stories.
|
|
9
|
+
Added tests for camera state logic.
|
|
10
|
+
Created a new postcss config for map-toolkit.
|
|
11
|
+
Updated deckgl base map to integrate camera controls.
|
|
12
|
+
- 62da9ee: Add saved viewports library
|
|
13
|
+
- b0a37a0: Add events to disable/enable panning and zoom via event bus.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 208b48d: With the changes to the basemap we now are explicitly rendering a `<MapLibre>` component and attatching a ref manually as opposed to calling the previous hook. The underlying api changes so we have to account for that in the MapControls component
|
|
18
|
+
|
|
19
|
+
## 0.4.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- bb73a1e: Ensure dependencies all follow the same semver range across devtk, maptk, and designtk.
|
|
24
|
+
- Updated dependencies [bb73a1e]
|
|
25
|
+
- @accelint/core@0.5.2
|
|
26
|
+
- @accelint/bus@3.0.2
|
|
27
|
+
- @accelint/geo@0.4.2
|
|
28
|
+
|
|
3
29
|
## 0.4.0
|
|
30
|
+
|
|
4
31
|
### Minor Changes
|
|
5
32
|
|
|
6
33
|
- 8802d14: Add map-cursor controller to map-toolkit.
|
|
@@ -21,62 +48,62 @@
|
|
|
21
48
|
- @accelint/geo@0.4.0
|
|
22
49
|
|
|
23
50
|
## 0.3.0
|
|
51
|
+
|
|
24
52
|
### Minor Changes
|
|
25
53
|
|
|
26
54
|
- 7131cc0: Add `useCursorCoordinates`, a hook to retrieve the current coordinates for the mouse hovered position
|
|
27
55
|
- 874edd5: ## Breaking Change: Structured Clone Constraint
|
|
28
|
-
|
|
56
|
+
|
|
29
57
|
The event bus payload is now constrained to values that are serializable by the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm). This constraint aligns the TypeScript types with the actual runtime behavior of the `BroadcastChannel` API.
|
|
30
|
-
|
|
58
|
+
|
|
31
59
|
### What this means
|
|
32
|
-
|
|
60
|
+
|
|
33
61
|
You can no longer pass the following types in event payloads:
|
|
34
|
-
|
|
35
62
|
- Functions
|
|
36
63
|
- Symbols
|
|
37
64
|
- DOM nodes
|
|
38
65
|
- Prototype chains (class instances lose their methods)
|
|
39
66
|
- Properties with `undefined` values (they're omitted)
|
|
40
|
-
|
|
67
|
+
|
|
41
68
|
### How to migrate
|
|
42
|
-
|
|
69
|
+
|
|
43
70
|
**❌ Before:**
|
|
44
|
-
|
|
71
|
+
|
|
45
72
|
```typescript
|
|
46
|
-
bus.emit(
|
|
47
|
-
callback: () => console.log(
|
|
73
|
+
bus.emit("user-action", {
|
|
74
|
+
callback: () => console.log("done"), // ❌ Function
|
|
48
75
|
userData: userClass, // ❌ Class instance with methods
|
|
49
|
-
element: document.getElementById(
|
|
76
|
+
element: document.getElementById("foo"), // ❌ DOM node
|
|
50
77
|
});
|
|
51
78
|
```
|
|
52
|
-
|
|
79
|
+
|
|
53
80
|
**✅ After:**
|
|
54
|
-
|
|
81
|
+
|
|
55
82
|
```typescript
|
|
56
83
|
// Option 1: Send only data, handle logic separately
|
|
57
|
-
bus.emit(
|
|
58
|
-
actionType:
|
|
84
|
+
bus.emit("user-action", {
|
|
85
|
+
actionType: "complete", // ✅ Primitive
|
|
59
86
|
userData: { id: userClass.id, name: userClass.name }, // ✅ Plain object
|
|
60
|
-
elementId:
|
|
87
|
+
elementId: "foo", // ✅ Reference by ID
|
|
61
88
|
});
|
|
62
|
-
|
|
89
|
+
|
|
63
90
|
// Option 2: Use event types to trigger behavior
|
|
64
|
-
bus.on(
|
|
65
|
-
console.log(
|
|
91
|
+
bus.on("user-action-complete", () => {
|
|
92
|
+
console.log("done"); // Handle callback logic in listener
|
|
66
93
|
});
|
|
67
94
|
```
|
|
68
|
-
|
|
95
|
+
|
|
69
96
|
### Supported types
|
|
70
|
-
|
|
71
97
|
- Primitives (string, number, boolean, null, BigInt)
|
|
72
98
|
- Plain objects and arrays
|
|
73
99
|
- Date, RegExp, Map, Set
|
|
74
100
|
- Typed arrays (Uint8Array, etc.)
|
|
75
101
|
- ArrayBuffer, Blob, File
|
|
76
|
-
|
|
102
|
+
|
|
77
103
|
### Finding issues
|
|
78
|
-
|
|
104
|
+
|
|
79
105
|
TypeScript will now catch most violations at compile time. Runtime errors from `BroadcastChannel.postMessage()` indicate non-serializable values that slipped through.
|
|
106
|
+
|
|
80
107
|
- e8535c4: Adds ViewportSize component that shows the width and height of the viewport and updates with changes.
|
|
81
108
|
Adds useViewportState for more fine-grained control of viewport data (lat/lon/zoom/bounds). Exports `useEffectEvent` ponyfill from `@accelint/bus/react`.
|
|
82
109
|
|
|
@@ -86,10 +113,11 @@
|
|
|
86
113
|
- 99f6cd5: Add map-mode/store getCurrentModeOwner method to access the current map mode owner.
|
|
87
114
|
- 80db585: BREAKING CHANGES:
|
|
88
115
|
Design Toolkit no longer exports `tv`, this is now available from Design Foundation
|
|
89
|
-
|
|
116
|
+
|
|
90
117
|
Created new package @accelint/design-foundation that houses all of the Tailwind tokens, variants, base styles and utilities for easier reuse without having a dependency on the larger Design Toolkit
|
|
91
|
-
|
|
118
|
+
|
|
92
119
|
Updated Map Toolkit Storybook and NextJS demo app styles to import the new Design Foundation
|
|
120
|
+
|
|
93
121
|
- f157e42: update picking info to remove more unserializable properties in map-toolkit
|
|
94
122
|
- 7539bbb: update vite config in map-toolkit to re-enable base-map render in storybook preview
|
|
95
123
|
- 86a95cf: refactor map mode to use module useSyncExternalStore pattern instead of class.
|
package/README.md
CHANGED
|
@@ -50,6 +50,9 @@ import { /* components */ } from '@accelint/map-toolkit/maplibre';
|
|
|
50
50
|
|
|
51
51
|
// React/Fiber components
|
|
52
52
|
import { /* components */ } from '@accelint/map-toolkit/deckgl/fiber';
|
|
53
|
+
|
|
54
|
+
// React util function
|
|
55
|
+
import { createSavedViewport } from '@accelint/map-toolkit/deckgl/saved-viewports';
|
|
53
56
|
```
|
|
54
57
|
|
|
55
58
|
For detailed examples and interactive demos, see the [Storybook documentation](https://map-toolkit.accelint.io/?path=/docs/deckgl-symbol-layer--docs).
|
package/catalog-info.yaml
CHANGED
|
@@ -11,15 +11,14 @@ metadata:
|
|
|
11
11
|
|
|
12
12
|
Dependencies:
|
|
13
13
|
|
|
14
|
-
accelint_biome-config@1.0.2, accelint_bus@3.0.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
accelint_vitest-config@0.1.5
|
|
14
|
+
accelint_biome-config@1.0.2, accelint_bus@3.0.2, accelint_core@0.5.2,
|
|
15
|
+
accelint_design-foundation@2.0.0, accelint_design-toolkit@9.0.0,
|
|
16
|
+
accelint_geo@0.4.2, accelint_postcss-tailwind-css-modules@1.0.1,
|
|
17
|
+
accelint_typescript-config@0.1.4, accelint_vitest-config@0.1.6
|
|
19
18
|
annotations:
|
|
20
19
|
backstage.io/edit-url: https://github.com/gohypergiant/standard-toolkit/blob/main/packages/map-toolkit/catalog-info.yaml
|
|
21
20
|
backstage.io/techdocs-ref: dir:.
|
|
22
|
-
package/version: 0.
|
|
21
|
+
package/version: 0.5.0
|
|
23
22
|
github.com/project-slug: gohypergiant/standard-toolkit
|
|
24
23
|
links:
|
|
25
24
|
- url: https://github.com/gohypergiant/standard-toolkit/tree/main/packages/map-toolkit
|
|
@@ -38,10 +37,10 @@ spec:
|
|
|
38
37
|
dependsOn:
|
|
39
38
|
- component:accelint_biome-config
|
|
40
39
|
- component:accelint_bus
|
|
41
|
-
- component:accelint_constellation-tracker
|
|
42
40
|
- component:accelint_core
|
|
43
41
|
- component:accelint_design-foundation
|
|
44
42
|
- component:accelint_design-toolkit
|
|
45
43
|
- component:accelint_geo
|
|
44
|
+
- component:accelint_postcss-tailwind-css-modules
|
|
46
45
|
- component:accelint_typescript-config
|
|
47
46
|
- component:accelint_vitest-config
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
//#region rolldown:runtime
|
|
15
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
16
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
17
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
18
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { __commonJSMin, __require };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/camera/events.d.ts
|
|
2
|
+
declare const CameraEventNamespace = "camera";
|
|
3
|
+
declare const CameraEventTypes: {
|
|
4
|
+
readonly setView: "camera:setView";
|
|
5
|
+
readonly setProjection: "camera:setProjection";
|
|
6
|
+
readonly setZoom: "camera:setZoom";
|
|
7
|
+
readonly setRotation: "camera:setRotation";
|
|
8
|
+
readonly setPitch: "camera:setPitch";
|
|
9
|
+
readonly setCenter: "camera:setCenter";
|
|
10
|
+
readonly fitBounds: "camera:fitBounds";
|
|
11
|
+
readonly reset: "camera:reset";
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CameraEventNamespace, CameraEventTypes };
|
|
15
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
//#region src/camera/events.ts
|
|
15
|
+
const CameraEventNamespace = "camera";
|
|
16
|
+
const CameraEventTypes = {
|
|
17
|
+
setView: `${CameraEventNamespace}:setView`,
|
|
18
|
+
setProjection: `${CameraEventNamespace}:setProjection`,
|
|
19
|
+
setZoom: `${CameraEventNamespace}:setZoom`,
|
|
20
|
+
setRotation: `${CameraEventNamespace}:setRotation`,
|
|
21
|
+
setPitch: `${CameraEventNamespace}:setPitch`,
|
|
22
|
+
setCenter: `${CameraEventNamespace}:setCenter`,
|
|
23
|
+
fitBounds: `${CameraEventNamespace}:fitBounds`,
|
|
24
|
+
reset: `${CameraEventNamespace}:reset`
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { CameraEventNamespace, CameraEventTypes };
|
|
29
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../src/camera/events.ts"],"sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const CameraEventNamespace = 'camera';\n\nexport const CameraEventTypes = {\n setView: `${CameraEventNamespace}:setView`,\n setProjection: `${CameraEventNamespace}:setProjection`,\n setZoom: `${CameraEventNamespace}:setZoom`,\n setRotation: `${CameraEventNamespace}:setRotation`,\n setPitch: `${CameraEventNamespace}:setPitch`,\n setCenter: `${CameraEventNamespace}:setCenter`,\n fitBounds: `${CameraEventNamespace}:fitBounds`,\n reset: `${CameraEventNamespace}:reset`,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,uBAAuB;AAEpC,MAAa,mBAAmB;CAC9B,SAAS,GAAG,qBAAqB;CACjC,eAAe,GAAG,qBAAqB;CACvC,SAAS,GAAG,qBAAqB;CACjC,aAAa,GAAG,qBAAqB;CACrC,UAAU,GAAG,qBAAqB;CAClC,WAAW,GAAG,qBAAqB;CACnC,WAAW,GAAG,qBAAqB;CACnC,OAAO,GAAG,qBAAqB;CAChC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { CameraEventNamespace, CameraEventTypes } from "./events.js";
|
|
14
|
+
import { CameraState, UseCameraStateProps, clearCameraState, useCameraState } from "./use-camera-state.js";
|
|
15
|
+
import { CameraEvent, CameraFitBoundsEvent, CameraResetEvent, CameraSetCenterEvent, CameraSetPitchEvent, CameraSetProjectionEvent, CameraSetRotationEvent, CameraSetViewEvent, CameraSetZoomEvent, ProjectionType, ViewType } from "./types.js";
|
|
16
|
+
export { type CameraEvent, CameraEventNamespace, CameraEventTypes, type CameraFitBoundsEvent, type CameraResetEvent, type CameraSetCenterEvent, type CameraSetPitchEvent, type CameraSetProjectionEvent, type CameraSetRotationEvent, type CameraSetViewEvent, type CameraSetZoomEvent, type CameraState, type ProjectionType, type UseCameraStateProps, type ViewType, clearCameraState, useCameraState };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import { CameraEventNamespace, CameraEventTypes } from "./events.js";
|
|
15
|
+
import { clearCameraState, useCameraState } from "./use-camera-state.js";
|
|
16
|
+
|
|
17
|
+
export { CameraEventNamespace, CameraEventTypes, clearCameraState, useCameraState };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { CameraEventTypes } from "./events.js";
|
|
14
|
+
import { Bounds } from "../deckgl/base-map/types.js";
|
|
15
|
+
import { Payload } from "@accelint/bus";
|
|
16
|
+
import { UniqueId } from "@accelint/core/utility/uuid";
|
|
17
|
+
|
|
18
|
+
//#region src/camera/types.d.ts
|
|
19
|
+
type ProjectionType = 'mercator' | 'globe';
|
|
20
|
+
type ViewType = '2D' | '2.5D' | '3D';
|
|
21
|
+
type CameraSetCenterPayload = {
|
|
22
|
+
/** Identifier of the camera */
|
|
23
|
+
id: UniqueId;
|
|
24
|
+
/** Latitude of the target coordinate */
|
|
25
|
+
latitude: number;
|
|
26
|
+
/** Longitude of the target coordinate */
|
|
27
|
+
longitude: number;
|
|
28
|
+
/** Optional zoom level */
|
|
29
|
+
zoom?: number;
|
|
30
|
+
/** Optional heading angle */
|
|
31
|
+
heading?: number;
|
|
32
|
+
/** Optional pitch angle */
|
|
33
|
+
pitch?: number;
|
|
34
|
+
};
|
|
35
|
+
type CameraFitBoundsPayload = {
|
|
36
|
+
/** Identifier of the camera */
|
|
37
|
+
id: UniqueId;
|
|
38
|
+
/** Bounds of the area to fit [minLon, minLat, maxLon, maxLat] */
|
|
39
|
+
bounds: Bounds;
|
|
40
|
+
/** Viewport width in pixels */
|
|
41
|
+
width: number;
|
|
42
|
+
/** Viewport height in pixels */
|
|
43
|
+
height: number;
|
|
44
|
+
/** Optional padding in pixels */
|
|
45
|
+
padding?: number;
|
|
46
|
+
/** Optional heading angle */
|
|
47
|
+
heading?: number;
|
|
48
|
+
/** Optional pitch angle */
|
|
49
|
+
pitch?: number;
|
|
50
|
+
};
|
|
51
|
+
type CameraResetPayload = {
|
|
52
|
+
/** Identifier of the camera */
|
|
53
|
+
id: UniqueId;
|
|
54
|
+
zoom?: boolean;
|
|
55
|
+
pitch?: boolean;
|
|
56
|
+
rotation?: boolean;
|
|
57
|
+
};
|
|
58
|
+
type CameraSetCenterEvent = Payload<typeof CameraEventTypes.setCenter, CameraSetCenterPayload>;
|
|
59
|
+
type CameraFitBoundsEvent = Payload<typeof CameraEventTypes.fitBounds, CameraFitBoundsPayload>;
|
|
60
|
+
type CameraSetProjectionEvent = Payload<typeof CameraEventTypes.setProjection, {
|
|
61
|
+
id: UniqueId;
|
|
62
|
+
projection: ProjectionType;
|
|
63
|
+
}>;
|
|
64
|
+
type CameraSetViewEvent = Payload<typeof CameraEventTypes.setView, {
|
|
65
|
+
id: UniqueId;
|
|
66
|
+
view: ViewType;
|
|
67
|
+
}>;
|
|
68
|
+
type CameraSetZoomEvent = Payload<typeof CameraEventTypes.setZoom, {
|
|
69
|
+
id: UniqueId;
|
|
70
|
+
zoom: number;
|
|
71
|
+
}>;
|
|
72
|
+
type CameraSetRotationEvent = Payload<typeof CameraEventTypes.setRotation, {
|
|
73
|
+
id: UniqueId;
|
|
74
|
+
rotation: number;
|
|
75
|
+
}>;
|
|
76
|
+
type CameraSetPitchEvent = Payload<typeof CameraEventTypes.setPitch, {
|
|
77
|
+
id: UniqueId;
|
|
78
|
+
pitch: number;
|
|
79
|
+
}>;
|
|
80
|
+
type CameraResetEvent = Payload<typeof CameraEventTypes.reset, CameraResetPayload>;
|
|
81
|
+
type CameraEvent = CameraSetCenterEvent | CameraFitBoundsEvent | CameraSetProjectionEvent | CameraSetViewEvent | CameraSetZoomEvent | CameraSetRotationEvent | CameraSetPitchEvent | CameraResetEvent;
|
|
82
|
+
//#endregion
|
|
83
|
+
export { CameraEvent, CameraFitBoundsEvent, CameraFitBoundsPayload, CameraResetEvent, CameraResetPayload, CameraSetCenterEvent, CameraSetCenterPayload, CameraSetPitchEvent, CameraSetProjectionEvent, CameraSetRotationEvent, CameraSetViewEvent, CameraSetZoomEvent, ProjectionType, ViewType };
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useSyncExternalStore } from "react";
|
|
14
|
+
import { UniqueId } from "@accelint/core";
|
|
15
|
+
|
|
16
|
+
//#region src/camera/use-camera-state.d.ts
|
|
17
|
+
type CameraState2D = {
|
|
18
|
+
latitude: number;
|
|
19
|
+
longitude: number;
|
|
20
|
+
zoom: number;
|
|
21
|
+
pitch: 0;
|
|
22
|
+
rotation: number;
|
|
23
|
+
projection: 'mercator';
|
|
24
|
+
view: '2D';
|
|
25
|
+
};
|
|
26
|
+
type CameraState3D = {
|
|
27
|
+
latitude: number;
|
|
28
|
+
longitude: number;
|
|
29
|
+
zoom: number;
|
|
30
|
+
pitch: 0;
|
|
31
|
+
rotation: number;
|
|
32
|
+
projection: 'globe';
|
|
33
|
+
view: '3D';
|
|
34
|
+
};
|
|
35
|
+
type CameraState2Point5D = {
|
|
36
|
+
latitude: number;
|
|
37
|
+
longitude: number;
|
|
38
|
+
zoom: number;
|
|
39
|
+
pitch: number;
|
|
40
|
+
rotation: number;
|
|
41
|
+
projection: 'mercator';
|
|
42
|
+
view: '2.5D';
|
|
43
|
+
};
|
|
44
|
+
type CameraState = CameraState2D | CameraState3D | CameraState2Point5D;
|
|
45
|
+
type UseCameraStateProps = {
|
|
46
|
+
instanceId: UniqueId;
|
|
47
|
+
initialCameraState?: Partial<CameraState>;
|
|
48
|
+
subscribe?: Parameters<typeof useSyncExternalStore<CameraState>>[0];
|
|
49
|
+
getSnapshot?: Parameters<typeof useSyncExternalStore<CameraState>>[1];
|
|
50
|
+
getServerSnapshot?: Parameters<typeof useSyncExternalStore<CameraState>>[2];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Updates the camera state for a given map instance and notifies subscribers.
|
|
54
|
+
*
|
|
55
|
+
* @param instanceId - The unique identifier for the map
|
|
56
|
+
* @param state - The new state to set, will be merged with existing state
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* // Update camera state manually
|
|
61
|
+
* setCameraState('my-map-instance', {
|
|
62
|
+
* latitude: 37.7749,
|
|
63
|
+
* longitude: -122.4194,
|
|
64
|
+
* zoom: 10,
|
|
65
|
+
* pitch: 30,
|
|
66
|
+
* rotation: 0,
|
|
67
|
+
* projection: 'mercator',
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function setCameraState(instanceId: UniqueId, state: Partial<CameraState>): void;
|
|
72
|
+
/**
|
|
73
|
+
* Hook to access camera state actions.
|
|
74
|
+
*
|
|
75
|
+
* This hook uses `useSyncExternalStore` to subscribe to camera state changes,
|
|
76
|
+
* providing concurrent-safe mode state updates. Uses a fan-out pattern where
|
|
77
|
+
* a single bus listener per map instance notifies N React component subscribers.
|
|
78
|
+
*
|
|
79
|
+
* A thin wrapper around [useSyncExternalStore](https://react.dev/reference/react/useSyncExternalStore).
|
|
80
|
+
*
|
|
81
|
+
* @param instanceId - Unique identifier for the camera to track
|
|
82
|
+
* @param initialCameraState - Optional initial camera state to set
|
|
83
|
+
* @param subscribe - Optional custom subscription function
|
|
84
|
+
* @param getSnapshot - Optional custom snapshot getter
|
|
85
|
+
* @param getServerSnapshot - Optional server-side snapshot getter
|
|
86
|
+
* @returns Current camera state including latitude, longitude, zoom, pitch, rotation, projection
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* function MapInfo({ instanceId }) {
|
|
91
|
+
* const { latitude, longitude, zoom } = useCameraState({
|
|
92
|
+
* instanceId
|
|
93
|
+
* });
|
|
94
|
+
*
|
|
95
|
+
* return (
|
|
96
|
+
* <div>
|
|
97
|
+
* Lat: {latitude?.toFixed(2)}, Lon: {longitude?.toFixed(2)}, Zoom: {zoom}
|
|
98
|
+
* </div>
|
|
99
|
+
* );
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* // With custom subscribe/getSnapshot for advanced use cases
|
|
106
|
+
* function CustomMapInfo() {
|
|
107
|
+
* const customSubscribe = (onStoreChange) => {
|
|
108
|
+
* // Custom subscription logic
|
|
109
|
+
* return () => { // cleanup }
|
|
110
|
+
* }
|
|
111
|
+
*
|
|
112
|
+
* const customGetSnapshot = () => {
|
|
113
|
+
* // Custom snapshot logic
|
|
114
|
+
* return { latitude: 0, longitude: 0, zoom: 1 };
|
|
115
|
+
* };
|
|
116
|
+
*
|
|
117
|
+
* const viewState = useCameraState({
|
|
118
|
+
* instanceId: 'some-uuid',
|
|
119
|
+
* subscribe: customSubscribe,
|
|
120
|
+
* getSnapshot: customGetSnapshot,
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* return <div>Custom camera state</div>;
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function useCameraState({
|
|
128
|
+
instanceId,
|
|
129
|
+
initialCameraState,
|
|
130
|
+
subscribe,
|
|
131
|
+
getSnapshot,
|
|
132
|
+
getServerSnapshot
|
|
133
|
+
}: UseCameraStateProps): {
|
|
134
|
+
cameraState: CameraState;
|
|
135
|
+
setCameraState: typeof setCameraState;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Manually clear camera state for a specific instanceId.
|
|
139
|
+
* This is typically not needed as cleanup happens automatically when all subscribers unmount.
|
|
140
|
+
* Use this only in advanced scenarios where manual cleanup is required.
|
|
141
|
+
*
|
|
142
|
+
* @param instanceId - The unique identifier for the camera to clear
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* // Manual cleanup (rarely needed)
|
|
147
|
+
* clearCameraState('my-map-instance');
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
declare function clearCameraState(instanceId: UniqueId): void;
|
|
151
|
+
//#endregion
|
|
152
|
+
export { CameraState, UseCameraStateProps, clearCameraState, useCameraState };
|
|
153
|
+
//# sourceMappingURL=use-camera-state.d.ts.map
|