@accelint/map-toolkit 0.4.1 → 0.6.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +3 -0
  3. package/catalog-info.yaml +6 -3
  4. package/dist/camera/events.d.ts +15 -0
  5. package/dist/camera/events.js +29 -0
  6. package/dist/camera/events.js.map +1 -0
  7. package/dist/camera/index.d.ts +16 -0
  8. package/dist/camera/index.js +17 -0
  9. package/dist/camera/types.d.ts +84 -0
  10. package/dist/{decorators/deckgl.d.ts → camera/types.js} +0 -7
  11. package/dist/camera/use-camera-state.d.ts +153 -0
  12. package/dist/camera/use-camera-state.js +418 -0
  13. package/dist/camera/use-camera-state.js.map +1 -0
  14. package/dist/cursor-coordinates/use-cursor-coordinates.js +1 -1
  15. package/dist/deckgl/base-map/constants.d.ts +14 -2
  16. package/dist/deckgl/base-map/constants.js +14 -2
  17. package/dist/deckgl/base-map/constants.js.map +1 -1
  18. package/dist/deckgl/base-map/controls.d.ts +34 -0
  19. package/dist/deckgl/base-map/controls.js +50 -0
  20. package/dist/deckgl/base-map/controls.js.map +1 -0
  21. package/dist/deckgl/base-map/events.d.ts +4 -0
  22. package/dist/deckgl/base-map/events.js +5 -1
  23. package/dist/deckgl/base-map/events.js.map +1 -1
  24. package/dist/deckgl/base-map/index.d.ts +10 -23
  25. package/dist/deckgl/base-map/index.js +81 -42
  26. package/dist/deckgl/base-map/index.js.map +1 -1
  27. package/dist/deckgl/base-map/types.d.ts +48 -2
  28. package/dist/deckgl/index.d.ts +11 -4
  29. package/dist/deckgl/index.js +7 -2
  30. package/dist/deckgl/saved-viewports/index.d.ts +32 -0
  31. package/dist/deckgl/saved-viewports/index.js +51 -0
  32. package/dist/deckgl/saved-viewports/index.js.map +1 -0
  33. package/dist/deckgl/saved-viewports/storage.d.ts +21 -0
  34. package/dist/deckgl/saved-viewports/storage.js +39 -0
  35. package/dist/deckgl/saved-viewports/storage.js.map +1 -0
  36. package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +44 -0
  37. package/dist/deckgl/shapes/display-shape-layer/constants.js +61 -0
  38. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -0
  39. package/dist/deckgl/shapes/display-shape-layer/fiber.d.ts +25 -0
  40. package/dist/deckgl/shapes/display-shape-layer/fiber.js +21 -0
  41. package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -0
  42. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +206 -0
  43. package/dist/deckgl/shapes/display-shape-layer/index.js +416 -0
  44. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -0
  45. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +66 -0
  46. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +116 -0
  47. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -0
  48. package/dist/deckgl/shapes/display-shape-layer/store.d.ts +87 -0
  49. package/dist/deckgl/shapes/display-shape-layer/store.js +316 -0
  50. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -0
  51. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +115 -0
  52. package/dist/deckgl/shapes/display-shape-layer/types.js +12 -0
  53. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.d.ts +89 -0
  54. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js +88 -0
  55. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +1 -0
  56. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +61 -0
  57. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +111 -0
  58. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -0
  59. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +196 -0
  60. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +368 -0
  61. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -0
  62. package/dist/deckgl/shapes/index.d.ts +20 -0
  63. package/dist/deckgl/shapes/index.js +20 -0
  64. package/dist/deckgl/shapes/shared/constants.d.ts +78 -0
  65. package/dist/deckgl/shapes/shared/constants.js +109 -0
  66. package/dist/deckgl/shapes/shared/constants.js.map +1 -0
  67. package/dist/deckgl/shapes/shared/events.d.ts +73 -0
  68. package/dist/deckgl/shapes/shared/events.js +58 -0
  69. package/dist/deckgl/shapes/shared/events.js.map +1 -0
  70. package/dist/deckgl/shapes/shared/types.d.ts +158 -0
  71. package/dist/{decorators/deckgl.js → deckgl/shapes/shared/types.js} +12 -15
  72. package/dist/deckgl/shapes/shared/types.js.map +1 -0
  73. package/dist/deckgl/symbol-layer/index.d.ts +1 -1
  74. package/dist/maplibre/hooks/use-maplibre.d.ts +2 -2
  75. package/dist/maplibre/hooks/use-maplibre.js +2 -2
  76. package/dist/maplibre/hooks/use-maplibre.js.map +1 -1
  77. package/dist/viewport/viewport-size.d.ts +2 -2
  78. package/package.json +50 -23
  79. package/dist/decorators/deckgl.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @accelint/map-toolkit
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7c62ee3: Add display shapes layer to map-toolkit
8
+ - cebdbe7: Expose styleUrl in BaseMap props, update BASE_MAP_STYLE constant to DARK_BASE_MAP_STYLE and provide LIGHT_BASE_MAP_STYLE constant
9
+
10
+ ### Patch Changes
11
+
12
+ - a7d3a1e: Fix bad build by updating configs
13
+ - aa296da: Update the shape labels and point icon behavior to match designs
14
+ - Updated dependencies [308023f]
15
+ - @accelint/geo@0.5.0
16
+
17
+ ## 0.5.0
18
+
19
+ ### Minor Changes
20
+
21
+ - dde1386: Introduced a new camera feature in map-toolkit:
22
+ Added camera state management, types, events, documentation, and Storybook stories.
23
+ Added tests for camera state logic.
24
+ Created a new postcss config for map-toolkit.
25
+ Updated deckgl base map to integrate camera controls.
26
+ - 62da9ee: Add saved viewports library
27
+ - b0a37a0: Add events to disable/enable panning and zoom via event bus.
28
+
29
+ ### Patch Changes
30
+
31
+ - 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
32
+
3
33
  ## 0.4.1
4
34
 
5
35
  ### Patch Changes
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
@@ -12,13 +12,14 @@ metadata:
12
12
  Dependencies:
13
13
 
14
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.1, accelint_typescript-config@0.1.4,
15
+ accelint_design-foundation@2.0.0, accelint_design-toolkit@9.1.1,
16
+ accelint_geo@0.4.2, accelint_postcss-tailwind-css-modules@1.0.1,
17
+ accelint_smeegl@0.3.4, accelint_typescript-config@0.1.4,
17
18
  accelint_vitest-config@0.1.6
18
19
  annotations:
19
20
  backstage.io/edit-url: https://github.com/gohypergiant/standard-toolkit/blob/main/packages/map-toolkit/catalog-info.yaml
20
21
  backstage.io/techdocs-ref: dir:.
21
- package/version: 0.4.1
22
+ package/version: 0.6.0
22
23
  github.com/project-slug: gohypergiant/standard-toolkit
23
24
  links:
24
25
  - url: https://github.com/gohypergiant/standard-toolkit/tree/main/packages/map-toolkit
@@ -41,5 +42,7 @@ spec:
41
42
  - component:accelint_design-foundation
42
43
  - component:accelint_design-toolkit
43
44
  - component:accelint_geo
45
+ - component:accelint_postcss-tailwind-css-modules
46
+ - component:accelint_smeegl
44
47
  - component:accelint_typescript-config
45
48
  - component:accelint_vitest-config
@@ -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
@@ -10,10 +10,3 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { Decorator } from "@storybook/react-vite";
14
-
15
- //#region src/decorators/deckgl.d.ts
16
- declare const withDeckGL: () => Decorator;
17
- //#endregion
18
- export { withDeckGL };
19
- //# sourceMappingURL=deckgl.d.ts.map
@@ -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