@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
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../../../src/deckgl/base-map/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 MapEventsNamespace = 'map';\n\nexport const MapEvents = {\n click: `${MapEventsNamespace}:click`,\n hover: `${MapEventsNamespace}:hover`,\n viewport: `${MapEventsNamespace}:viewport`,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,qBAAqB;AAElC,MAAa,YAAY;CACvB,OAAO,GAAG,mBAAmB;CAC7B,OAAO,GAAG,mBAAmB;CAC7B,UAAU,GAAG,mBAAmB;CACjC"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../../src/deckgl/base-map/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 MapEventsNamespace = 'map';\n\nexport const MapEvents = {\n click: `${MapEventsNamespace}:click`,\n hover: `${MapEventsNamespace}:hover`,\n viewport: `${MapEventsNamespace}:viewport`,\n // Control events\n enablePan: `${MapEventsNamespace}:enablePan`,\n disablePan: `${MapEventsNamespace}:disablePan`,\n enableZoom: `${MapEventsNamespace}:enableZoom`,\n disableZoom: `${MapEventsNamespace}:disableZoom`,\n} as const;\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,qBAAqB;AAElC,MAAa,YAAY;CACvB,OAAO,GAAG,mBAAmB;CAC7B,OAAO,GAAG,mBAAmB;CAC7B,UAAU,GAAG,mBAAmB;CAEhC,WAAW,GAAG,mBAAmB;CACjC,YAAY,GAAG,mBAAmB;CAClC,YAAY,GAAG,mBAAmB;CAClC,aAAa,GAAG,mBAAmB;CACpC"}
@@ -10,29 +10,11 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { UniqueId } from "@accelint/core";
14
- import * as react_jsx_runtime1 from "react/jsx-runtime";
15
- import { DeckglProps } from "@deckgl-fiber-renderer/types";
13
+ import { BaseMapProps } from "./types.js";
14
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
16
15
 
17
16
  //#region src/deckgl/base-map/index.d.ts
18
- /**
19
- * Props for the BaseMap component.
20
- * Extends all Deck.gl props and adds additional map-specific properties.
21
- */
22
- type BaseMapProps = DeckglProps & {
23
- /** Optional CSS class name to apply to the map container element */
24
- className?: string;
25
- /**
26
- * Unique identifier for this map instance (required).
27
- *
28
- * Used to isolate map mode state between multiple map instances (e.g., main map vs minimap).
29
- * This should be a UUID generated using `uuid()` from `@accelint/core`.
30
- *
31
- * The same id should be passed to `useMapMode()` when accessing map mode state
32
- * from components rendered outside of the BaseMap's children (i.e., as siblings).
33
- */
34
- id: UniqueId;
35
- };
17
+
36
18
  /**
37
19
  * A React component that provides a Deck.gl-powered base map with MapLibre GL integration.
38
20
  *
@@ -111,15 +93,20 @@ declare function BaseMap({
111
93
  className,
112
94
  children,
113
95
  controller,
96
+ enableControlEvents,
114
97
  interleaved,
115
98
  parameters,
99
+ styleUrl,
116
100
  useDevicePixels,
117
101
  widgets: widgetsProp,
102
+ defaultView,
103
+ initialViewState,
118
104
  onClick,
119
105
  onHover,
120
106
  onViewStateChange,
107
+ pickingRadius,
121
108
  ...rest
122
- }: BaseMapProps): react_jsx_runtime1.JSX.Element;
109
+ }: BaseMapProps): react_jsx_runtime0.JSX.Element;
123
110
  //#endregion
124
- export { BaseMap, BaseMapProps };
111
+ export { BaseMap };
125
112
  //# sourceMappingURL=index.d.ts.map
@@ -13,16 +13,17 @@
13
13
 
14
14
  'use client';
15
15
 
16
+ import { useCameraState } from "../../camera/use-camera-state.js";
16
17
  import { MapEvents } from "./events.js";
17
18
  import { getCursor } from "../../map-cursor/store.js";
18
19
  import { MapProvider } from "./provider.js";
19
- import { INITIAL_VIEW_STATE } from "../../maplibre/constants.js";
20
- import { useMapLibre } from "../../maplibre/hooks/use-maplibre.js";
21
- import { BASE_MAP_STYLE, PARAMETERS } from "./constants.js";
22
- import { useCallback, useId, useMemo } from "react";
23
- import { jsx } from "react/jsx-runtime";
20
+ import { DARK_BASE_MAP_STYLE, DEFAULT_VIEW_STATE, PARAMETERS, PICKING_RADIUS } from "./constants.js";
21
+ import { MapControls } from "./controls.js";
22
+ import { useCallback, useId, useMemo, useRef } from "react";
23
+ import { jsx, jsxs } from "react/jsx-runtime";
24
24
  import { useEffectEvent, useEmit } from "@accelint/bus/react";
25
25
  import { Deckgl, useDeckgl } from "@deckgl-fiber-renderer/dom";
26
+ import { Map, useControl } from "react-map-gl/maplibre";
26
27
 
27
28
  //#region src/deckgl/base-map/index.tsx
28
29
  /**
@@ -45,6 +46,11 @@ function serializeMjolnirEvent(event) {
45
46
  }
46
47
  return rest;
47
48
  }
49
+ function AddDeckglControl() {
50
+ const deckglInstance = useDeckgl();
51
+ useControl(() => deckglInstance);
52
+ return null;
53
+ }
48
54
  /**
49
55
  * A React component that provides a Deck.gl-powered base map with MapLibre GL integration.
50
56
  *
@@ -118,19 +124,44 @@ function serializeMjolnirEvent(event) {
118
124
  * }
119
125
  * ```
120
126
  */
121
- function BaseMap({ id, className, children, controller = true, interleaved = true, parameters = {}, useDevicePixels = false, widgets: widgetsProp = [], onClick, onHover, onViewStateChange, ...rest }) {
127
+ function BaseMap({ id, className, children, controller = true, enableControlEvents = true, interleaved = true, parameters = {}, styleUrl = DARK_BASE_MAP_STYLE, useDevicePixels = false, widgets: widgetsProp = [], defaultView = "2D", initialViewState, onClick, onHover, onViewStateChange, pickingRadius, ...rest }) {
122
128
  const deckglInstance = useDeckgl();
123
129
  const container = useId();
124
- useMapLibre(deckglInstance, BASE_MAP_STYLE, useMemo(() => ({
130
+ const mapRef = useRef(null);
131
+ const { cameraState, setCameraState } = useCameraState({
132
+ instanceId: id,
133
+ initialCameraState: {
134
+ view: defaultView,
135
+ zoom: initialViewState?.zoom ?? DEFAULT_VIEW_STATE.zoom,
136
+ latitude: initialViewState?.latitude ?? DEFAULT_VIEW_STATE.latitude,
137
+ longitude: initialViewState?.longitude ?? DEFAULT_VIEW_STATE.longitude
138
+ }
139
+ });
140
+ const viewState = useMemo(() => ({
141
+ ...deckglInstance?._deck?._getViewState(),
142
+ ...cameraState,
143
+ bearing: cameraState.rotation
144
+ }), [cameraState, deckglInstance?._deck?._getViewState]);
145
+ const mapOptions = useMemo(() => ({
125
146
  container,
126
- center: [INITIAL_VIEW_STATE.longitude, INITIAL_VIEW_STATE.latitude],
127
- zoom: INITIAL_VIEW_STATE.zoom,
147
+ zoom: viewState.zoom,
148
+ pitch: viewState.pitch,
149
+ bearing: viewState.bearing,
150
+ latitude: viewState.latitude,
151
+ longitude: viewState.longitude,
128
152
  doubleClickZoom: false,
129
153
  dragRotate: false,
130
154
  pitchWithRotate: false,
131
155
  rollEnabled: false,
132
- attributionControl: { compact: true }
133
- }), [container]));
156
+ attributionControl: { compact: true },
157
+ projection: cameraState.projection,
158
+ maxPitch: cameraState.view === "2D" ? 0 : 85
159
+ }), [
160
+ viewState,
161
+ container,
162
+ cameraState.projection,
163
+ cameraState.view
164
+ ]);
134
165
  const emitClick = useEmit(MapEvents.click);
135
166
  const emitHover = useEmit(MapEvents.hover);
136
167
  const emitViewport = useEmit(MapEvents.viewport);
@@ -176,43 +207,51 @@ function BaseMap({ id, className, children, controller = true, interleaved = tru
176
207
  });
177
208
  });
178
209
  const handleLoad = useEffectEvent(() => {
179
- deckglInstance._deck.getViewports().forEach((vp) => {
180
- handleViewStateChange({
181
- viewId: vp.id,
182
- viewState: {
183
- latitude: vp.latitude,
184
- longitude: vp.longitude,
185
- zoom: vp.zoom,
186
- id: vp.id,
187
- bounds: vp.getBounds(),
188
- width: vp.width,
189
- height: vp.height
190
- }
191
- });
210
+ const viewports = deckglInstance._deck.getViewports() ?? [];
211
+ for (const vp of viewports) handleViewStateChange({
212
+ viewId: vp.id,
213
+ viewState: {
214
+ latitude: vp.latitude,
215
+ longitude: vp.longitude,
216
+ zoom: vp.zoom,
217
+ id: vp.id,
218
+ bounds: vp.getBounds(),
219
+ width: vp.width,
220
+ height: vp.height
221
+ }
192
222
  });
193
223
  });
194
- return /* @__PURE__ */ jsx("div", {
224
+ return /* @__PURE__ */ jsxs("div", {
195
225
  id: container,
196
226
  className,
197
- children: /* @__PURE__ */ jsx(MapProvider, {
227
+ children: [enableControlEvents && /* @__PURE__ */ jsx(MapControls, {
228
+ id,
229
+ mapRef
230
+ }), /* @__PURE__ */ jsx(MapProvider, {
198
231
  id,
199
- children: /* @__PURE__ */ jsx(Deckgl, {
200
- ...rest,
201
- controller,
202
- interleaved,
203
- useDevicePixels,
204
- onClick: handleClick,
205
- onHover: handleHover,
206
- onLoad: handleLoad,
207
- onViewStateChange: handleViewStateChange,
208
- getCursor: handleGetCursor,
209
- parameters: {
210
- ...PARAMETERS,
211
- ...parameters
212
- },
213
- children
232
+ children: /* @__PURE__ */ jsx(Map, {
233
+ onMove: (evt) => setCameraState(id, evt.viewState),
234
+ mapStyle: styleUrl,
235
+ ref: mapRef,
236
+ ...mapOptions,
237
+ children: /* @__PURE__ */ jsxs(Deckgl, {
238
+ ...rest,
239
+ interleaved,
240
+ getCursor: handleGetCursor,
241
+ useDevicePixels,
242
+ onClick: handleClick,
243
+ pickingRadius: pickingRadius ?? PICKING_RADIUS,
244
+ onHover: handleHover,
245
+ onLoad: handleLoad,
246
+ onViewStateChange: handleViewStateChange,
247
+ parameters: {
248
+ ...PARAMETERS,
249
+ ...parameters
250
+ },
251
+ children: [/* @__PURE__ */ jsx(AddDeckglControl, {}), children]
252
+ })
214
253
  })
215
- })
254
+ })]
216
255
  });
217
256
  }
218
257
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/deckgl/base-map/index.tsx"],"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\n'use client';\n\nimport 'client-only';\nimport { useEffectEvent, useEmit } from '@accelint/bus/react';\nimport { Deckgl, useDeckgl } from '@deckgl-fiber-renderer/dom';\nimport { useCallback, useId, useMemo } from 'react';\nimport { getCursor } from '../../map-cursor/store';\nimport { INITIAL_VIEW_STATE } from '../../maplibre/constants';\nimport { useMapLibre } from '../../maplibre/hooks/use-maplibre';\nimport { BASE_MAP_STYLE, PARAMETERS } from './constants';\nimport { MapEvents } from './events';\nimport { MapProvider } from './provider';\nimport type { UniqueId } from '@accelint/core';\nimport type { PickingInfo, ViewStateChangeParameters } from '@deck.gl/core';\nimport type { DeckglProps } from '@deckgl-fiber-renderer/types';\nimport type { IControl } from 'maplibre-gl';\nimport type { MjolnirGestureEvent, MjolnirPointerEvent } from 'mjolnir.js';\nimport type {\n MapClickEvent,\n MapHoverEvent,\n MapViewportEvent,\n SerializablePickingInfo,\n} from './types';\n\n/**\n * Serializes PickingInfo for event bus transmission.\n * Omits viewport, layer, and sourceLayer (contain functions) but preserves layer IDs.\n */\nfunction serializePickingInfo(info: PickingInfo): SerializablePickingInfo {\n const { viewport, layer, sourceLayer, ...infoRest } = info;\n return {\n layerId: layer?.id,\n sourceLayerId: sourceLayer?.id,\n ...infoRest,\n };\n}\n\n/**\n * Strips non-serializable properties from MjolnirGestureEvent for event bus transmission.\n * Removes functions, DOM elements, and PointerEvent objects that cannot be cloned.\n */\nfunction serializeMjolnirEvent(\n event: MjolnirGestureEvent,\n): Omit<\n MjolnirGestureEvent,\n | 'stopPropagation'\n | 'preventDefault'\n | 'stopImmediatePropagation'\n | 'srcEvent'\n | 'rootElement'\n | 'target'\n | 'changedPointers'\n | 'pointers'\n>;\n/**\n * Strips non-serializable properties from MjolnirPointerEvent for event bus transmission.\n * Removes functions and DOM elements that cannot be cloned.\n */\nfunction serializeMjolnirEvent(\n event: MjolnirPointerEvent,\n): Omit<\n MjolnirPointerEvent,\n | 'stopPropagation'\n | 'preventDefault'\n | 'stopImmediatePropagation'\n | 'srcEvent'\n | 'rootElement'\n | 'target'\n>;\nfunction serializeMjolnirEvent(\n event: MjolnirGestureEvent | MjolnirPointerEvent,\n) {\n const {\n stopImmediatePropagation,\n stopPropagation,\n preventDefault,\n srcEvent,\n rootElement,\n target,\n ...rest\n } = event;\n\n // Remove pointer arrays if present (only on MjolnirGestureEvent)\n if ('changedPointers' in rest) {\n const { changedPointers, pointers, ...gestureRest } = rest;\n return gestureRest;\n }\n\n return rest;\n}\n\n/**\n * Props for the BaseMap component.\n * Extends all Deck.gl props and adds additional map-specific properties.\n */\nexport type BaseMapProps = DeckglProps & {\n /** Optional CSS class name to apply to the map container element */\n className?: string;\n /**\n * Unique identifier for this map instance (required).\n *\n * Used to isolate map mode state between multiple map instances (e.g., main map vs minimap).\n * This should be a UUID generated using `uuid()` from `@accelint/core`.\n *\n * The same id should be passed to `useMapMode()` when accessing map mode state\n * from components rendered outside of the BaseMap's children (i.e., as siblings).\n */\n id: UniqueId;\n};\n\n/**\n * A React component that provides a Deck.gl-powered base map with MapLibre GL integration.\n *\n * This component serves as the foundation for building interactive map applications with\n * support for click and hover events through a centralized event bus. It integrates\n * Deck.gl for 3D visualizations with MapLibre GL for the base map tiles.\n *\n * **Map Mode Integration**: BaseMap automatically creates a `MapProvider` internally,\n * which sets up the map mode state management for this instance.\n * - **Children**: Only Deck.gl layer components can be rendered as children. Custom Deck.gl\n * layers can use `useMapMode()` without parameters to access context.\n * - **Siblings**: UI components (buttons, toolbars, etc.) must be rendered as siblings\n * and pass `id` to `useMapMode(id)`.\n *\n * **Event Bus**: Click and hover events are emitted through the event bus with the `id`\n * included in the payload, allowing multiple map instances to coexist without interference.\n *\n * @param props - Component props including id (required), className, onClick, onHover, and all Deck.gl props\n * @returns A map component with Deck.gl and MapLibre GL integration\n *\n * @example\n * Basic usage with id (recommended: module-level constant):\n * ```tsx\n * import { BaseMap } from '@accelint/map-toolkit/deckgl';\n * import { View } from '@deckgl-fiber-renderer/dom';\n * import { uuid } from '@accelint/core';\n *\n * // Create id at module level for stability and easy sharing\n * const MAIN_MAP_ID = uuid();\n *\n * export function MapView() {\n * return (\n * <BaseMap className=\"w-full h-full\" id={MAIN_MAP_ID}>\n * <View id=\"main\" controller />\n * </BaseMap>\n * );\n * }\n * ```\n *\n * @example\n * With map mode and event handlers (module-level constant for sharing):\n * ```tsx\n * import { BaseMap } from '@accelint/map-toolkit/deckgl';\n * import { useMapMode } from '@accelint/map-toolkit/map-mode';\n * import { uuid } from '@accelint/core';\n * import type { PickingInfo } from '@deck.gl/core';\n * import type { MjolnirGestureEvent } from 'mjolnir.js';\n *\n * // Module-level constant - stable and shareable across all components\n * const MAIN_MAP_ID = uuid();\n *\n * function Toolbar() {\n * // Access map mode using the shared id\n * const { mode, requestModeChange } = useMapMode(MAIN_MAP_ID);\n * return <div>Current mode: {mode}</div>;\n * }\n *\n * export function InteractiveMap() {\n * const handleClick = (info: PickingInfo, event: MjolnirGestureEvent) => {\n * console.log('Clicked:', info.object);\n * };\n *\n * return (\n * <div className=\"relative w-full h-full\">\n * <BaseMap className=\"absolute inset-0\" id={MAIN_MAP_ID} onClick={handleClick}>\n * <View id=\"main\" controller />\n * </BaseMap>\n * <Toolbar />\n * </div>\n * );\n * }\n * ```\n */\nexport function BaseMap({\n id,\n className,\n children,\n controller = true,\n interleaved = true,\n parameters = {},\n useDevicePixels = false,\n widgets: widgetsProp = [],\n onClick,\n onHover,\n onViewStateChange,\n ...rest\n}: BaseMapProps) {\n const deckglInstance = useDeckgl();\n const container = useId();\n\n // Memoize MapLibre options to avoid creating new object on every render\n const mapOptions = useMemo(\n () => ({\n container,\n center: [INITIAL_VIEW_STATE.longitude, INITIAL_VIEW_STATE.latitude] as [\n number,\n number,\n ],\n zoom: INITIAL_VIEW_STATE.zoom,\n doubleClickZoom: false,\n dragRotate: false,\n pitchWithRotate: false,\n rollEnabled: false,\n attributionControl: { compact: true },\n }),\n [container],\n );\n\n // Use the custom hook to handle MapLibre\n useMapLibre(deckglInstance as IControl, BASE_MAP_STYLE, mapOptions);\n\n const emitClick = useEmit<MapClickEvent>(MapEvents.click);\n const emitHover = useEmit<MapHoverEvent>(MapEvents.hover);\n const emitViewport = useEmit<MapViewportEvent>(MapEvents.viewport);\n\n const handleClick = useCallback(\n (info: PickingInfo, event: MjolnirGestureEvent) => {\n // send full pickingInfo and event to user-defined onClick\n onClick?.(info, event);\n\n emitClick({\n info: serializePickingInfo(info),\n event: serializeMjolnirEvent(event),\n id,\n });\n },\n [emitClick, id, onClick],\n );\n\n const handleHover = useCallback(\n (info: PickingInfo, event: MjolnirPointerEvent) => {\n // send full pickingInfo and event to user-defined onHover\n onHover?.(info, event);\n\n emitHover({\n info: serializePickingInfo(info),\n event: serializeMjolnirEvent(event),\n id,\n });\n },\n [emitHover, id, onHover],\n );\n\n const handleGetCursor = useCallback(() => {\n return getCursor(id);\n }, [id]);\n\n const handleViewStateChange = useEffectEvent(\n (params: ViewStateChangeParameters) => {\n onViewStateChange?.(params);\n\n const {\n viewId,\n viewState: { latitude, longitude, zoom },\n } = params;\n\n // @ts-expect-error squirrelly deckglInstance typing\n const viewport = deckglInstance._deck\n .getViewports()\n // @ts-expect-error squirrelly deckglInstance typing\n ?.find((vp) => vp.id === viewId);\n\n emitViewport({\n id,\n bounds: viewport?.getBounds(),\n latitude,\n longitude,\n zoom,\n width: viewport?.width ?? 0,\n height: viewport?.height ?? 0,\n });\n },\n );\n\n const handleLoad = useEffectEvent(() => {\n //--- force update viewport state once all viewports initialized ---\n // @ts-expect-error squirrelly deckglInstance typing\n deckglInstance._deck.getViewports().forEach((vp) => {\n handleViewStateChange({\n viewId: vp.id,\n viewState: {\n latitude: vp.latitude,\n longitude: vp.longitude,\n zoom: vp.zoom,\n id: vp.id,\n bounds: vp.getBounds(),\n width: vp.width,\n height: vp.height,\n },\n } as ViewStateChangeParameters);\n });\n });\n\n return (\n <div id={container} className={className}>\n <MapProvider id={id}>\n <Deckgl\n {...rest}\n controller={controller}\n interleaved={interleaved}\n useDevicePixels={useDevicePixels}\n onClick={handleClick}\n onHover={handleHover}\n onLoad={handleLoad}\n onViewStateChange={handleViewStateChange}\n getCursor={handleGetCursor}\n // @ts-expect-error - DeckglProps parameters type is overly strict for WebGL parameter spreading.\n // The merged object is valid at runtime but TypeScript cannot verify all possible parameter combinations.\n parameters={{ ...PARAMETERS, ...parameters }}\n >\n {children}\n </Deckgl>\n </MapProvider>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,qBAAqB,MAA4C;CACxE,MAAM,EAAE,UAAU,OAAO,aAAa,GAAG,aAAa;AACtD,QAAO;EACL,SAAS,OAAO;EAChB,eAAe,aAAa;EAC5B,GAAG;EACJ;;AAmCH,SAAS,sBACP,OACA;CACA,MAAM,EACJ,0BACA,iBACA,gBACA,UACA,aACA,QACA,GAAG,SACD;AAGJ,KAAI,qBAAqB,MAAM;EAC7B,MAAM,EAAE,iBAAiB,UAAU,GAAG,gBAAgB;AACtD,SAAO;;AAGT,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FT,SAAgB,QAAQ,EACtB,IACA,WACA,UACA,aAAa,MACb,cAAc,MACd,aAAa,EAAE,EACf,kBAAkB,OAClB,SAAS,cAAc,EAAE,EACzB,SACA,SACA,mBACA,GAAG,QACY;CACf,MAAM,iBAAiB,WAAW;CAClC,MAAM,YAAY,OAAO;AAqBzB,aAAY,gBAA4B,gBAlBrB,eACV;EACL;EACA,QAAQ,CAAC,mBAAmB,WAAW,mBAAmB,SAAS;EAInE,MAAM,mBAAmB;EACzB,iBAAiB;EACjB,YAAY;EACZ,iBAAiB;EACjB,aAAa;EACb,oBAAoB,EAAE,SAAS,MAAM;EACtC,GACD,CAAC,UAAU,CACZ,CAGkE;CAEnE,MAAM,YAAY,QAAuB,UAAU,MAAM;CACzD,MAAM,YAAY,QAAuB,UAAU,MAAM;CACzD,MAAM,eAAe,QAA0B,UAAU,SAAS;CAElE,MAAM,cAAc,aACjB,MAAmB,UAA+B;AAEjD,YAAU,MAAM,MAAM;AAEtB,YAAU;GACR,MAAM,qBAAqB,KAAK;GAChC,OAAO,sBAAsB,MAAM;GACnC;GACD,CAAC;IAEJ;EAAC;EAAW;EAAI;EAAQ,CACzB;CAED,MAAM,cAAc,aACjB,MAAmB,UAA+B;AAEjD,YAAU,MAAM,MAAM;AAEtB,YAAU;GACR,MAAM,qBAAqB,KAAK;GAChC,OAAO,sBAAsB,MAAM;GACnC;GACD,CAAC;IAEJ;EAAC;EAAW;EAAI;EAAQ,CACzB;CAED,MAAM,kBAAkB,kBAAkB;AACxC,SAAO,UAAU,GAAG;IACnB,CAAC,GAAG,CAAC;CAER,MAAM,wBAAwB,gBAC3B,WAAsC;AACrC,sBAAoB,OAAO;EAE3B,MAAM,EACJ,QACA,WAAW,EAAE,UAAU,WAAW,WAChC;EAGJ,MAAM,WAAW,eAAe,MAC7B,cAAc,EAEb,MAAM,OAAO,GAAG,OAAO,OAAO;AAElC,eAAa;GACX;GACA,QAAQ,UAAU,WAAW;GAC7B;GACA;GACA;GACA,OAAO,UAAU,SAAS;GAC1B,QAAQ,UAAU,UAAU;GAC7B,CAAC;GAEL;CAED,MAAM,aAAa,qBAAqB;AAGtC,iBAAe,MAAM,cAAc,CAAC,SAAS,OAAO;AAClD,yBAAsB;IACpB,QAAQ,GAAG;IACX,WAAW;KACT,UAAU,GAAG;KACb,WAAW,GAAG;KACd,MAAM,GAAG;KACT,IAAI,GAAG;KACP,QAAQ,GAAG,WAAW;KACtB,OAAO,GAAG;KACV,QAAQ,GAAG;KACZ;IACF,CAA8B;IAC/B;GACF;AAEF,QACE,oBAAC;EAAI,IAAI;EAAsB;YAC7B,oBAAC;GAAgB;aACf,oBAAC;IACC,GAAI;IACQ;IACC;IACI;IACjB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,mBAAmB;IACnB,WAAW;IAGX,YAAY;KAAE,GAAG;KAAY,GAAG;KAAY;IAE3C;KACM;IACG;GACV"}
1
+ {"version":3,"file":"index.js","names":["MapLibre"],"sources":["../../../src/deckgl/base-map/index.tsx"],"sourcesContent":["/*\n * Copyright 2026 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\n'use client';\n\nimport 'client-only';\nimport { useEffectEvent, useEmit } from '@accelint/bus/react';\nimport { Deckgl, useDeckgl } from '@deckgl-fiber-renderer/dom';\nimport { useCallback, useId, useMemo, useRef } from 'react';\nimport {\n Map as MapLibre,\n type MapRef,\n useControl,\n type ViewState,\n} from 'react-map-gl/maplibre';\nimport { useCameraState } from '../../camera';\nimport { getCursor } from '../../map-cursor/store';\nimport {\n DARK_BASE_MAP_STYLE,\n DEFAULT_VIEW_STATE,\n PARAMETERS,\n PICKING_RADIUS,\n} from './constants';\nimport { MapControls } from './controls';\nimport { MapEvents } from './events';\nimport { MapProvider } from './provider';\nimport type { PickingInfo, ViewStateChangeParameters } from '@deck.gl/core';\nimport type { IControl } from 'maplibre-gl';\nimport type { MjolnirGestureEvent, MjolnirPointerEvent } from 'mjolnir.js';\nimport type {\n BaseMapProps,\n MapClickEvent,\n MapHoverEvent,\n MapViewportEvent,\n SerializablePickingInfo,\n} from './types';\n\n/**\n * Serializes PickingInfo for event bus transmission.\n * Omits viewport, layer, and sourceLayer (contain functions) but preserves layer IDs.\n */\nfunction serializePickingInfo(info: PickingInfo): SerializablePickingInfo {\n const { viewport, layer, sourceLayer, ...infoRest } = info;\n return {\n layerId: layer?.id,\n sourceLayerId: sourceLayer?.id,\n ...infoRest,\n };\n}\n\n/**\n * Strips non-serializable properties from MjolnirGestureEvent for event bus transmission.\n * Removes functions, DOM elements, and PointerEvent objects that cannot be cloned.\n */\nfunction serializeMjolnirEvent(\n event: MjolnirGestureEvent,\n): Omit<\n MjolnirGestureEvent,\n | 'stopPropagation'\n | 'preventDefault'\n | 'stopImmediatePropagation'\n | 'srcEvent'\n | 'rootElement'\n | 'target'\n | 'changedPointers'\n | 'pointers'\n>;\n/**\n * Strips non-serializable properties from MjolnirPointerEvent for event bus transmission.\n * Removes functions and DOM elements that cannot be cloned.\n */\nfunction serializeMjolnirEvent(\n event: MjolnirPointerEvent,\n): Omit<\n MjolnirPointerEvent,\n | 'stopPropagation'\n | 'preventDefault'\n | 'stopImmediatePropagation'\n | 'srcEvent'\n | 'rootElement'\n | 'target'\n>;\nfunction serializeMjolnirEvent(\n event: MjolnirGestureEvent | MjolnirPointerEvent,\n) {\n const {\n stopImmediatePropagation,\n stopPropagation,\n preventDefault,\n srcEvent,\n rootElement,\n target,\n ...rest\n } = event;\n\n // Remove pointer arrays if present (only on MjolnirGestureEvent)\n if ('changedPointers' in rest) {\n const { changedPointers, pointers, ...gestureRest } = rest;\n return gestureRest;\n }\n\n return rest;\n}\n\nfunction AddDeckglControl() {\n const deckglInstance = useDeckgl();\n useControl(() => deckglInstance as IControl);\n\n return null;\n}\n\n/**\n * A React component that provides a Deck.gl-powered base map with MapLibre GL integration.\n *\n * This component serves as the foundation for building interactive map applications with\n * support for click and hover events through a centralized event bus. It integrates\n * Deck.gl for 3D visualizations with MapLibre GL for the base map tiles.\n *\n * **Map Mode Integration**: BaseMap automatically creates a `MapProvider` internally,\n * which sets up the map mode state management for this instance.\n * - **Children**: Only Deck.gl layer components can be rendered as children. Custom Deck.gl\n * layers can use `useMapMode()` without parameters to access context.\n * - **Siblings**: UI components (buttons, toolbars, etc.) must be rendered as siblings\n * and pass `id` to `useMapMode(id)`.\n *\n * **Event Bus**: Click and hover events are emitted through the event bus with the `id`\n * included in the payload, allowing multiple map instances to coexist without interference.\n *\n * @param props - Component props including id (required), className, onClick, onHover, and all Deck.gl props\n * @returns A map component with Deck.gl and MapLibre GL integration\n *\n * @example\n * Basic usage with id (recommended: module-level constant):\n * ```tsx\n * import { BaseMap } from '@accelint/map-toolkit/deckgl';\n * import { View } from '@deckgl-fiber-renderer/dom';\n * import { uuid } from '@accelint/core';\n *\n * // Create id at module level for stability and easy sharing\n * const MAIN_MAP_ID = uuid();\n *\n * export function MapView() {\n * return (\n * <BaseMap className=\"w-full h-full\" id={MAIN_MAP_ID}>\n * <View id=\"main\" controller />\n * </BaseMap>\n * );\n * }\n * ```\n *\n * @example\n * With map mode and event handlers (module-level constant for sharing):\n * ```tsx\n * import { BaseMap } from '@accelint/map-toolkit/deckgl';\n * import { useMapMode } from '@accelint/map-toolkit/map-mode';\n * import { uuid } from '@accelint/core';\n * import type { PickingInfo } from '@deck.gl/core';\n * import type { MjolnirGestureEvent } from 'mjolnir.js';\n *\n * // Module-level constant - stable and shareable across all components\n * const MAIN_MAP_ID = uuid();\n *\n * function Toolbar() {\n * // Access map mode using the shared id\n * const { mode, requestModeChange } = useMapMode(MAIN_MAP_ID);\n * return <div>Current mode: {mode}</div>;\n * }\n *\n * export function InteractiveMap() {\n * const handleClick = (info: PickingInfo, event: MjolnirGestureEvent) => {\n * console.log('Clicked:', info.object);\n * };\n *\n * return (\n * <div className=\"relative w-full h-full\">\n * <BaseMap className=\"absolute inset-0\" id={MAIN_MAP_ID} onClick={handleClick}>\n * <View id=\"main\" controller />\n * </BaseMap>\n * <Toolbar />\n * </div>\n * );\n * }\n * ```\n */\nexport function BaseMap({\n id,\n className,\n children,\n controller = true,\n enableControlEvents = true,\n interleaved = true,\n parameters = {},\n styleUrl = DARK_BASE_MAP_STYLE,\n useDevicePixels = false,\n widgets: widgetsProp = [],\n defaultView = '2D',\n initialViewState,\n onClick,\n onHover,\n onViewStateChange,\n pickingRadius,\n ...rest\n}: BaseMapProps) {\n const deckglInstance = useDeckgl();\n const container = useId();\n const mapRef = useRef<MapRef>(null);\n\n const { cameraState, setCameraState } = useCameraState({\n instanceId: id,\n initialCameraState: {\n view: defaultView,\n zoom: initialViewState?.zoom ?? DEFAULT_VIEW_STATE.zoom,\n latitude: initialViewState?.latitude ?? DEFAULT_VIEW_STATE.latitude,\n longitude: initialViewState?.longitude ?? DEFAULT_VIEW_STATE.longitude,\n },\n });\n\n const viewState = useMemo<ViewState>(\n () => ({\n // @ts-expect-error squirrelly deckglInstance typing\n ...(deckglInstance?._deck?._getViewState() as ViewState),\n ...cameraState,\n bearing: cameraState.rotation,\n }),\n // @ts-expect-error squirrelly deckglInstance typing\n [cameraState, deckglInstance?._deck?._getViewState],\n );\n\n // Memoize MapLibre options to avoid creating new object on every render\n const mapOptions = useMemo(\n () => ({\n container,\n zoom: viewState.zoom,\n pitch: viewState.pitch,\n bearing: viewState.bearing,\n latitude: viewState.latitude,\n longitude: viewState.longitude,\n doubleClickZoom: false,\n dragRotate: false,\n pitchWithRotate: false,\n rollEnabled: false,\n attributionControl: { compact: true },\n projection: cameraState.projection,\n maxPitch: cameraState.view === '2D' ? 0 : 85,\n }),\n [viewState, container, cameraState.projection, cameraState.view],\n );\n\n const emitClick = useEmit<MapClickEvent>(MapEvents.click);\n const emitHover = useEmit<MapHoverEvent>(MapEvents.hover);\n const emitViewport = useEmit<MapViewportEvent>(MapEvents.viewport);\n\n const handleClick = useCallback(\n (info: PickingInfo, event: MjolnirGestureEvent) => {\n // send full pickingInfo and event to user-defined onClick\n onClick?.(info, event);\n\n emitClick({\n info: serializePickingInfo(info),\n event: serializeMjolnirEvent(event),\n id,\n });\n },\n [emitClick, id, onClick],\n );\n\n const handleHover = useCallback(\n (info: PickingInfo, event: MjolnirPointerEvent) => {\n // send full pickingInfo and event to user-defined onHover\n onHover?.(info, event);\n\n emitHover({\n info: serializePickingInfo(info),\n event: serializeMjolnirEvent(event),\n id,\n });\n },\n [emitHover, id, onHover],\n );\n\n const handleGetCursor = useCallback(() => {\n return getCursor(id);\n }, [id]);\n\n const handleViewStateChange = useEffectEvent(\n (params: ViewStateChangeParameters) => {\n onViewStateChange?.(params);\n\n const {\n viewId,\n viewState: { latitude, longitude, zoom },\n } = params;\n\n // @ts-expect-error squirrelly deckglInstance typing\n const viewport = deckglInstance._deck\n .getViewports()\n // @ts-expect-error squirrelly deckglInstance typing\n ?.find((vp) => vp.id === viewId);\n\n emitViewport({\n id,\n bounds: viewport?.getBounds(),\n latitude,\n longitude,\n zoom,\n width: viewport?.width ?? 0,\n height: viewport?.height ?? 0,\n });\n },\n );\n\n const handleLoad = useEffectEvent(() => {\n //--- force update viewport state once all viewports initialized ---\n // @ts-expect-error squirrelly deckglInstance typing\n const viewports = deckglInstance._deck.getViewports() ?? [];\n for (const vp of viewports) {\n handleViewStateChange({\n viewId: vp.id,\n viewState: {\n latitude: vp.latitude,\n longitude: vp.longitude,\n zoom: vp.zoom,\n id: vp.id,\n bounds: vp.getBounds(),\n width: vp.width,\n height: vp.height,\n },\n } as ViewStateChangeParameters);\n }\n });\n\n return (\n <div id={container} className={className}>\n {enableControlEvents && <MapControls id={id} mapRef={mapRef} />}\n <MapProvider id={id}>\n <MapLibre\n onMove={(evt) => setCameraState(id, evt.viewState)}\n mapStyle={styleUrl}\n ref={mapRef}\n {...mapOptions}\n >\n <Deckgl\n {...rest}\n interleaved={interleaved}\n getCursor={handleGetCursor}\n useDevicePixels={useDevicePixels}\n onClick={handleClick}\n pickingRadius={pickingRadius ?? PICKING_RADIUS}\n onHover={handleHover}\n onLoad={handleLoad}\n onViewStateChange={handleViewStateChange}\n // @ts-expect-error - DeckglProps parameters type is overly strict for WebGL parameter spreading.\n // The merged object is valid at runtime but TypeScript cannot verify all possible parameter combinations.\n parameters={{ ...PARAMETERS, ...parameters }}\n >\n <AddDeckglControl />\n {children}\n </Deckgl>\n </MapLibre>\n </MapProvider>\n </div>\n );\n}\n"],"mappings":"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"}
@@ -14,9 +14,43 @@ import { MapEvents } from "./events.js";
14
14
  import { Payload } from "@accelint/bus";
15
15
  import { UniqueId } from "@accelint/core";
16
16
  import { PickingInfo } from "@deck.gl/core";
17
+ import { DeckglProps } from "@deckgl-fiber-renderer/types";
17
18
  import { MjolnirGestureEvent, MjolnirPointerEvent } from "mjolnir.js";
18
19
 
19
20
  //#region src/deckgl/base-map/types.d.ts
21
+ /**
22
+ * Props for the BaseMap component.
23
+ * Extends all Deck.gl props and adds additional map-specific properties.
24
+ */
25
+ type BaseMapProps = DeckglProps & {
26
+ /** Optional CSS class name to apply to the map container element */
27
+ className?: string;
28
+ /**
29
+ * Whether to enable listening for map control events (pan/zoom enable/disable).
30
+ * When true, the map will respond to control events emitted via the event bus.
31
+ * @default true
32
+ */
33
+ enableControlEvents?: boolean;
34
+ /**
35
+ * Unique identifier for this map instance (required).
36
+ *
37
+ * Used to isolate map mode state between multiple map instances (e.g., main map vs minimap).
38
+ * This should be a UUID generated using `uuid()` from `@accelint/core`.
39
+ *
40
+ * The same id should be passed to `useMapMode()` when accessing map mode state
41
+ * from components rendered outside of the BaseMap's children (i.e., as siblings).
42
+ */
43
+ id: UniqueId;
44
+ /**
45
+ * Default view for the map: '2D', '2.5D', or '3D'. Defaults to '2D'.
46
+ */
47
+ defaultView?: '2D' | '2.5D' | '3D';
48
+ /**
49
+ * MapLibre style URL for the base map tiles.
50
+ * @default DARK_BASE_MAP_STYLE ('https://tiles.basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json')
51
+ */
52
+ styleUrl?: string;
53
+ };
20
54
  /**
21
55
  * PickingInfo modified for serialization through the event bus.
22
56
  * Omits viewport, layer, and sourceLayer (which contain non-serializable functions),
@@ -86,7 +120,19 @@ type MapClickEvent = Payload<typeof MapEvents.click, MapClickPayload>;
86
120
  */
87
121
  type MapHoverEvent = Payload<typeof MapEvents.hover, MapHoverPayload>;
88
122
  type MapViewportEvent = Payload<typeof MapEvents.viewport, MapViewportPayload>;
89
- type MapEventType = MapClickEvent | MapHoverEvent | MapViewportEvent;
123
+ /**
124
+ * Payload for map control events that target a specific map instance.
125
+ * Used for enablePan, disablePan, enableZoom, disableZoom events.
126
+ */
127
+ type MapControlPayload = {
128
+ /** The map instance to apply the control change to */
129
+ id: UniqueId;
130
+ };
131
+ type MapEnablePanEvent = Payload<typeof MapEvents.enablePan, MapControlPayload>;
132
+ type MapDisablePanEvent = Payload<typeof MapEvents.disablePan, MapControlPayload>;
133
+ type MapEnableZoomEvent = Payload<typeof MapEvents.enableZoom, MapControlPayload>;
134
+ type MapDisableZoomEvent = Payload<typeof MapEvents.disableZoom, MapControlPayload>;
135
+ type MapEventType = MapClickEvent | MapHoverEvent | MapViewportEvent | MapEnablePanEvent | MapDisablePanEvent | MapEnableZoomEvent | MapDisableZoomEvent;
90
136
  //#endregion
91
- export { Bounds, MapClickEvent, MapClickPayload, MapEventType, MapHoverEvent, MapHoverPayload, MapViewportEvent, MapViewportPayload, SerializablePickingInfo };
137
+ export { BaseMapProps, Bounds, MapClickEvent, MapClickPayload, MapControlPayload, MapDisablePanEvent, MapDisableZoomEvent, MapEnablePanEvent, MapEnableZoomEvent, MapEventType, MapHoverEvent, MapHoverPayload, MapViewportEvent, MapViewportPayload, SerializablePickingInfo };
92
138
  //# sourceMappingURL=types.d.ts.map
@@ -10,9 +10,16 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { BASE_MAP_STYLE, PARAMETERS } from "./base-map/constants.js";
14
13
  import { MapEvents, MapEventsNamespace } from "./base-map/events.js";
15
- import { BaseMap, BaseMapProps } from "./base-map/index.js";
16
- import { MapClickEvent, MapClickPayload, MapEventType, MapHoverEvent, MapHoverPayload } from "./base-map/types.js";
14
+ import { BaseMapProps, MapClickEvent, MapClickPayload, MapControlPayload, MapDisablePanEvent, MapDisableZoomEvent, MapEnablePanEvent, MapEnableZoomEvent, MapEventType, MapHoverEvent, MapHoverPayload } from "./base-map/types.js";
15
+ import { DARK_BASE_MAP_STYLE, LIGHT_BASE_MAP_STYLE, PARAMETERS } from "./base-map/constants.js";
16
+ import { BaseMap } from "./base-map/index.js";
17
+ import { SavedViewportOptions, createSavedViewport } from "./saved-viewports/index.js";
18
+ import { CircleProperties, CircleRadius, DisplayShape, EditableShape, ShapeFeature, ShapeFeatureProperties, ShapeFeatureType, ShapeFeatureTypeValues, ShapeId, StyleProperties } from "./shapes/shared/types.js";
19
+ import { DisplayShapeLayerProps, StyledFeature, StyledFeatureProperties } from "./shapes/display-shape-layer/types.js";
20
+ import { DisplayShapeLayer } from "./shapes/display-shape-layer/index.js";
21
+ import { DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_STYLE_PROPERTIES, SHAPE_LAYER_IDS, STROKE_PATTERNS, STROKE_WIDTHS } from "./shapes/shared/constants.js";
22
+ import { SHAPE_EVENTS, ShapeEventHandler, ShapeEventPayload, ShapeEventType, ShapeEvents } from "./shapes/shared/events.js";
23
+ import "./shapes/index.js";
17
24
  import { SymbolLayer, SymbolLayerProps } from "./symbol-layer/index.js";
18
- export { BASE_MAP_STYLE, BaseMap, type BaseMapProps, type MapClickEvent, type MapClickPayload, type MapEventType, MapEvents, MapEventsNamespace, type MapHoverEvent, type MapHoverPayload, PARAMETERS, SymbolLayer, type SymbolLayerProps };
25
+ export { BaseMap, type BaseMapProps, type CircleProperties, type CircleRadius, DARK_BASE_MAP_STYLE, DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_STYLE_PROPERTIES, type DisplayShape, DisplayShapeLayer, type DisplayShapeLayerProps, type EditableShape, LIGHT_BASE_MAP_STYLE, type MapClickEvent, type MapClickPayload, type MapControlPayload, type MapDisablePanEvent, type MapDisableZoomEvent, type MapEnablePanEvent, type MapEnableZoomEvent, type MapEventType, MapEvents, MapEventsNamespace, type MapHoverEvent, type MapHoverPayload, PARAMETERS, SHAPE_EVENTS, SHAPE_LAYER_IDS, STROKE_PATTERNS, STROKE_WIDTHS, type SavedViewportOptions, type ShapeEventHandler, type ShapeEventPayload, type ShapeEventType, ShapeEvents, type ShapeFeature, type ShapeFeatureProperties, ShapeFeatureType, type ShapeFeatureTypeValues, type ShapeId, type StyleProperties, type StyledFeature, type StyledFeatureProperties, SymbolLayer, type SymbolLayerProps, createSavedViewport };
@@ -12,8 +12,13 @@
12
12
 
13
13
 
14
14
  import { MapEvents, MapEventsNamespace } from "./base-map/events.js";
15
- import { BASE_MAP_STYLE, PARAMETERS } from "./base-map/constants.js";
15
+ import { DARK_BASE_MAP_STYLE, LIGHT_BASE_MAP_STYLE, PARAMETERS } from "./base-map/constants.js";
16
16
  import { BaseMap } from "./base-map/index.js";
17
+ import { createSavedViewport } from "./saved-viewports/index.js";
18
+ import { DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_STYLE_PROPERTIES, SHAPE_LAYER_IDS, STROKE_PATTERNS, STROKE_WIDTHS } from "./shapes/shared/constants.js";
19
+ import { SHAPE_EVENTS, ShapeEvents } from "./shapes/shared/events.js";
20
+ import { DisplayShapeLayer } from "./shapes/display-shape-layer/index.js";
21
+ import { ShapeFeatureType } from "./shapes/shared/types.js";
17
22
  import { SymbolLayer } from "./symbol-layer/index.js";
18
23
 
19
- export { BASE_MAP_STYLE, BaseMap, MapEvents, MapEventsNamespace, PARAMETERS, SymbolLayer };
24
+ export { BaseMap, DARK_BASE_MAP_STYLE, DASH_ARRAYS, DEFAULT_COLORS, DEFAULT_STYLE_PROPERTIES, DisplayShapeLayer, LIGHT_BASE_MAP_STYLE, MapEvents, MapEventsNamespace, PARAMETERS, SHAPE_EVENTS, SHAPE_LAYER_IDS, STROKE_PATTERNS, STROKE_WIDTHS, ShapeEvents, ShapeFeatureType, SymbolLayer, createSavedViewport };
@@ -0,0 +1,32 @@
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 { HotkeyOptions, KeyCombinationId, registerHotkey } from "@accelint/hotkey-manager";
14
+ import { MapViewState } from "@deck.gl/core";
15
+ import { RequireAllOrNone } from "type-fest";
16
+
17
+ //#region src/deckgl/saved-viewports/index.d.ts
18
+ type BaseOptions = {
19
+ uniqueIdentifier?: string;
20
+ threshold?: number;
21
+ getCurrentViewport: () => MapViewState;
22
+ setCurrentViewport: (viewport: MapViewState) => void;
23
+ };
24
+ type PersistOptions = RequireAllOrNone<{
25
+ getSavedViewport: (id: KeyCombinationId, uniqueIdentifier?: string) => MapViewState;
26
+ setSavedViewport: (id: KeyCombinationId, viewport: MapViewState, uniqueIdentifier?: string) => void;
27
+ }>;
28
+ type SavedViewportOptions = Partial<HotkeyOptions> & BaseOptions & PersistOptions;
29
+ declare const createSavedViewport: (options: SavedViewportOptions) => ReturnType<typeof registerHotkey>;
30
+ //#endregion
31
+ export { SavedViewportOptions, createSavedViewport };
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,51 @@
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 { STORAGE_ID, persist, retrieve } from "./storage.js";
15
+ import { Keycode, registerHotkey } from "@accelint/hotkey-manager";
16
+
17
+ //#region src/deckgl/saved-viewports/index.ts
18
+ const createSavedViewport = (options) => {
19
+ const setFn = options.setSavedViewport ?? persist;
20
+ const getFn = options.getSavedViewport ?? retrieve;
21
+ return registerHotkey({
22
+ id: STORAGE_ID,
23
+ heldThresholdMs: options.threshold,
24
+ key: options.key ?? [
25
+ { code: Keycode.Digit0 },
26
+ { code: Keycode.Digit1 },
27
+ { code: Keycode.Digit2 },
28
+ { code: Keycode.Digit3 },
29
+ { code: Keycode.Digit4 },
30
+ { code: Keycode.Digit5 },
31
+ { code: Keycode.Digit6 },
32
+ { code: Keycode.Digit7 },
33
+ { code: Keycode.Digit8 },
34
+ { code: Keycode.Digit9 }
35
+ ],
36
+ onKeyHeld: (e, key) => {
37
+ e.preventDefault();
38
+ const viewport = options.getCurrentViewport();
39
+ setFn(key.id, viewport, options.uniqueIdentifier);
40
+ },
41
+ onKeyUp: (e, key) => {
42
+ e.preventDefault();
43
+ const viewport = getFn(key.id, options.uniqueIdentifier);
44
+ if (viewport) options.setCurrentViewport(viewport);
45
+ }
46
+ });
47
+ };
48
+
49
+ //#endregion
50
+ export { createSavedViewport };
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/deckgl/saved-viewports/index.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\nimport {\n type HotkeyOptions,\n type KeyCombination,\n type KeyCombinationId,\n Keycode,\n registerHotkey,\n} from '@accelint/hotkey-manager';\nimport { persist, retrieve, STORAGE_ID } from './storage';\nimport type { MapViewState } from '@deck.gl/core';\nimport type { RequireAllOrNone } from 'type-fest';\n\ntype BaseOptions = {\n uniqueIdentifier?: string;\n threshold?: number;\n getCurrentViewport: () => MapViewState;\n setCurrentViewport: (viewport: MapViewState) => void;\n};\n\ntype PersistOptions = RequireAllOrNone<{\n getSavedViewport: (\n id: KeyCombinationId,\n uniqueIdentifier?: string,\n ) => MapViewState;\n setSavedViewport: (\n id: KeyCombinationId,\n viewport: MapViewState,\n uniqueIdentifier?: string,\n ) => void;\n}>;\n\nexport type SavedViewportOptions = Partial<HotkeyOptions> &\n BaseOptions &\n PersistOptions;\n\nexport const createSavedViewport = (\n options: SavedViewportOptions,\n): ReturnType<typeof registerHotkey> => {\n const setFn = options.setSavedViewport ?? persist;\n const getFn = options.getSavedViewport ?? retrieve;\n\n return registerHotkey({\n id: STORAGE_ID,\n heldThresholdMs: options.threshold,\n key: options.key ?? [\n {\n code: Keycode.Digit0,\n },\n {\n code: Keycode.Digit1,\n },\n {\n code: Keycode.Digit2,\n },\n {\n code: Keycode.Digit3,\n },\n {\n code: Keycode.Digit4,\n },\n {\n code: Keycode.Digit5,\n },\n {\n code: Keycode.Digit6,\n },\n {\n code: Keycode.Digit7,\n },\n {\n code: Keycode.Digit8,\n },\n {\n code: Keycode.Digit9,\n },\n ],\n onKeyHeld: (e: KeyboardEvent, key: KeyCombination) => {\n e.preventDefault();\n const viewport = options.getCurrentViewport();\n setFn(key.id, viewport, options.uniqueIdentifier);\n },\n onKeyUp: (e: KeyboardEvent, key: KeyCombination) => {\n e.preventDefault();\n const viewport = getFn(key.id, options.uniqueIdentifier);\n if (viewport) {\n options.setCurrentViewport(viewport);\n }\n },\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA8CA,MAAa,uBACX,YACsC;CACtC,MAAM,QAAQ,QAAQ,oBAAoB;CAC1C,MAAM,QAAQ,QAAQ,oBAAoB;AAE1C,QAAO,eAAe;EACpB,IAAI;EACJ,iBAAiB,QAAQ;EACzB,KAAK,QAAQ,OAAO;GAClB,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACD,EACE,MAAM,QAAQ,QACf;GACF;EACD,YAAY,GAAkB,QAAwB;AACpD,KAAE,gBAAgB;GAClB,MAAM,WAAW,QAAQ,oBAAoB;AAC7C,SAAM,IAAI,IAAI,UAAU,QAAQ,iBAAiB;;EAEnD,UAAU,GAAkB,QAAwB;AAClD,KAAE,gBAAgB;GAClB,MAAM,WAAW,MAAM,IAAI,IAAI,QAAQ,iBAAiB;AACxD,OAAI,SACF,SAAQ,mBAAmB,SAAS;;EAGzC,CAAC"}
@@ -0,0 +1,21 @@
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 { MapViewState } from "@deck.gl/core";
14
+
15
+ //#region src/deckgl/saved-viewports/storage.d.ts
16
+ declare const STORAGE_ID = "deckgl-saved-viewports";
17
+ declare const persist: (id: string, obj: MapViewState, uniqueIdentifier?: string) => void;
18
+ declare const retrieve: (id: string, uniqueIdentifier?: string) => any;
19
+ //#endregion
20
+ export { STORAGE_ID, persist, retrieve };
21
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1,39 @@
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/deckgl/saved-viewports/storage.ts
15
+ const STORAGE_ID = "deckgl-saved-viewports";
16
+ const getContainerKey = (uniqueIdentifier) => uniqueIdentifier ? `${STORAGE_ID}-${uniqueIdentifier}` : STORAGE_ID;
17
+ const getContainer = (containerKey) => {
18
+ try {
19
+ return JSON.parse(localStorage.getItem(containerKey) ?? "{}");
20
+ } catch {
21
+ console.warn(`Failed to parse storage container for key: ${containerKey}, returning empty container.`);
22
+ return {};
23
+ }
24
+ };
25
+ const persist = (id, obj, uniqueIdentifier) => {
26
+ const containerKey = getContainerKey(uniqueIdentifier);
27
+ const container = getContainer(containerKey);
28
+ container[id] = obj;
29
+ localStorage.setItem(containerKey, JSON.stringify(container));
30
+ };
31
+ const retrieve = (id, uniqueIdentifier) => {
32
+ const obj = getContainer(getContainerKey(uniqueIdentifier))[id];
33
+ if (!obj) console.warn(`Object with id: ${id} does not exist`);
34
+ return obj;
35
+ };
36
+
37
+ //#endregion
38
+ export { STORAGE_ID, persist, retrieve };
39
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","names":[],"sources":["../../../src/deckgl/saved-viewports/storage.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\nimport type { MapViewState } from '@deck.gl/core';\n\nexport const STORAGE_ID = 'deckgl-saved-viewports';\n\nconst getContainerKey = (uniqueIdentifier?: string) =>\n uniqueIdentifier ? `${STORAGE_ID}-${uniqueIdentifier}` : STORAGE_ID;\n\nconst getContainer = (containerKey: string) => {\n try {\n return JSON.parse(localStorage.getItem(containerKey) ?? '{}');\n } catch {\n console.warn(\n `Failed to parse storage container for key: ${containerKey}, returning empty container.`,\n );\n return {};\n }\n};\n\nexport const persist = (\n id: string,\n obj: MapViewState,\n uniqueIdentifier?: string,\n) => {\n const containerKey = getContainerKey(uniqueIdentifier);\n const container = getContainer(containerKey);\n container[id] = obj;\n localStorage.setItem(containerKey, JSON.stringify(container));\n};\n\nexport const retrieve = (id: string, uniqueIdentifier?: string) => {\n const containerKey = getContainerKey(uniqueIdentifier);\n const container = getContainer(containerKey);\n const obj = container[id];\n if (!obj) {\n console.warn(`Object with id: ${id} does not exist`);\n }\n return obj;\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,aAAa;AAE1B,MAAM,mBAAmB,qBACvB,mBAAmB,GAAG,WAAW,GAAG,qBAAqB;AAE3D,MAAM,gBAAgB,iBAAyB;AAC7C,KAAI;AACF,SAAO,KAAK,MAAM,aAAa,QAAQ,aAAa,IAAI,KAAK;SACvD;AACN,UAAQ,KACN,8CAA8C,aAAa,8BAC5D;AACD,SAAO,EAAE;;;AAIb,MAAa,WACX,IACA,KACA,qBACG;CACH,MAAM,eAAe,gBAAgB,iBAAiB;CACtD,MAAM,YAAY,aAAa,aAAa;AAC5C,WAAU,MAAM;AAChB,cAAa,QAAQ,cAAc,KAAK,UAAU,UAAU,CAAC;;AAG/D,MAAa,YAAY,IAAY,qBAA8B;CAGjE,MAAM,MADY,aADG,gBAAgB,iBAAiB,CACV,CACtB;AACtB,KAAI,CAAC,IACH,SAAQ,KAAK,mBAAmB,GAAG,iBAAiB;AAEtD,QAAO"}
@@ -0,0 +1,44 @@
1
+ //#region src/deckgl/shapes/display-shape-layer/constants.d.ts
2
+ /**
3
+ * Map interaction constants
4
+ * Values derived from ngc2 for consistency
5
+ */
6
+ declare const MAP_INTERACTION: {
7
+ readonly LINE_WIDTH_MIN_PIXELS: 1;
8
+ readonly ICON_SIZE: 38;
9
+ readonly ICON_HOVER_SIZE_INCREASE: 5;
10
+ };
11
+ /**
12
+ * Selection highlight configuration
13
+ */
14
+ declare const SELECTION_HIGHLIGHT: {
15
+ readonly COLOR: [number, number, number, number];
16
+ readonly ICON_SIZE_INCREASE: 8;
17
+ };
18
+ /**
19
+ * Coffin corners configuration for Point selection/hover feedback
20
+ * Coffin corners are bracket-like corners that appear around points
21
+ */
22
+ declare const COFFIN_CORNERS: {
23
+ /** Icon name for hover state (white corners with background fill) */
24
+ readonly HOVER_ICON: "coffin-corners-hover";
25
+ /** Icon name for selected state (blue corners, no fill) */
26
+ readonly SELECTED_ICON: "coffin-corners-selected";
27
+ /** Icon name for selected+hover state (blue corners with background fill) */
28
+ readonly SELECTED_HOVER_ICON: "coffin-corners-selected-hover";
29
+ /** Size of the coffin corners icon */
30
+ readonly SIZE: 38;
31
+ };
32
+ /**
33
+ * Default props for DisplayShapeLayer
34
+ */
35
+ declare const DEFAULT_DISPLAY_PROPS: {
36
+ pickable: boolean;
37
+ showLabels: boolean;
38
+ showHighlight: boolean;
39
+ applyBaseOpacity: boolean;
40
+ highlightColor: [number, number, number, number];
41
+ };
42
+ //#endregion
43
+ export { COFFIN_CORNERS, DEFAULT_DISPLAY_PROPS, MAP_INTERACTION, SELECTION_HIGHLIGHT };
44
+ //# sourceMappingURL=constants.d.ts.map