@accelint/map-toolkit 1.4.0 → 2.0.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 (204) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/catalog-info.yaml +4 -4
  3. package/dist/camera/events.js +1 -1
  4. package/dist/camera/index.d.ts +1 -1
  5. package/dist/camera/index.js +1 -1
  6. package/dist/camera/store.d.ts +1 -1
  7. package/dist/camera/store.js +4 -6
  8. package/dist/camera/store.js.map +1 -1
  9. package/dist/camera/types.d.ts +1 -1
  10. package/dist/camera/types.js +1 -1
  11. package/dist/cursor-coordinates/constants.js +1 -1
  12. package/dist/cursor-coordinates/index.d.ts +1 -1
  13. package/dist/cursor-coordinates/index.js +1 -1
  14. package/dist/cursor-coordinates/store.d.ts +1 -1
  15. package/dist/cursor-coordinates/store.js +1 -1
  16. package/dist/cursor-coordinates/types.d.ts +1 -1
  17. package/dist/cursor-coordinates/types.js +1 -1
  18. package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +1 -1
  19. package/dist/cursor-coordinates/use-cursor-coordinates.js +4 -9
  20. package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -1
  21. package/dist/deckgl/base-map/constants.js +1 -1
  22. package/dist/deckgl/base-map/controls.d.ts +1 -1
  23. package/dist/deckgl/base-map/controls.js +1 -1
  24. package/dist/deckgl/base-map/events.js +1 -1
  25. package/dist/deckgl/base-map/index.d.ts +3 -3
  26. package/dist/deckgl/base-map/index.js +15 -7
  27. package/dist/deckgl/base-map/index.js.map +1 -1
  28. package/dist/deckgl/base-map/provider.d.ts +3 -3
  29. package/dist/deckgl/base-map/provider.js +3 -5
  30. package/dist/deckgl/base-map/provider.js.map +1 -1
  31. package/dist/deckgl/base-map/types.d.ts +1 -1
  32. package/dist/deckgl/base-map/types.js +1 -1
  33. package/dist/deckgl/index.d.ts +4 -4
  34. package/dist/deckgl/index.js +4 -4
  35. package/dist/deckgl/saved-viewports/index.d.ts +1 -1
  36. package/dist/deckgl/saved-viewports/index.js +1 -1
  37. package/dist/deckgl/saved-viewports/storage.d.ts +1 -1
  38. package/dist/deckgl/saved-viewports/storage.js +5 -10
  39. package/dist/deckgl/saved-viewports/storage.js.map +1 -1
  40. package/dist/deckgl/shapes/display-shape-layer/constants.js +66 -13
  41. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
  42. package/dist/deckgl/shapes/display-shape-layer/fiber.d.ts +1 -1
  43. package/dist/deckgl/shapes/display-shape-layer/fiber.js +1 -1
  44. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +74 -35
  45. package/dist/deckgl/shapes/display-shape-layer/index.js +381 -154
  46. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -1
  47. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +1 -1
  48. package/dist/deckgl/shapes/display-shape-layer/store.js +8 -2
  49. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -1
  50. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +108 -19
  51. package/dist/deckgl/shapes/display-shape-layer/types.js +1 -1
  52. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.d.ts +1 -1
  53. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js +1 -1
  54. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +66 -36
  55. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
  56. package/dist/deckgl/shapes/display-shape-layer/utils/elevation.js +407 -0
  57. package/dist/deckgl/shapes/display-shape-layer/utils/elevation.js.map +1 -0
  58. package/dist/deckgl/shapes/display-shape-layer/utils/icon-config.js +151 -0
  59. package/dist/deckgl/shapes/display-shape-layer/utils/icon-config.js.map +1 -0
  60. package/dist/deckgl/shapes/display-shape-layer/utils/interaction.js +50 -0
  61. package/dist/deckgl/shapes/display-shape-layer/utils/interaction.js.map +1 -0
  62. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +1 -1
  63. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +28 -39
  64. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
  65. package/dist/deckgl/shapes/draw-shape-layer/constants.js +1 -1
  66. package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +1 -1
  67. package/dist/deckgl/shapes/draw-shape-layer/events.js +1 -1
  68. package/dist/deckgl/shapes/draw-shape-layer/fiber.js +1 -1
  69. package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +3 -3
  70. package/dist/deckgl/shapes/draw-shape-layer/index.js +7 -17
  71. package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -1
  72. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +8 -9
  73. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -1
  74. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +3 -3
  75. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +4 -21
  76. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -1
  77. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +4 -34
  78. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -1
  79. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +11 -12
  80. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -1
  81. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +2 -32
  82. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -1
  83. package/dist/deckgl/shapes/draw-shape-layer/store.js +38 -4
  84. package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -1
  85. package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +1 -1
  86. package/dist/deckgl/shapes/draw-shape-layer/types.js +1 -1
  87. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +1 -1
  88. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +2 -2
  89. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +4 -9
  90. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -1
  91. package/dist/deckgl/shapes/edit-shape-layer/constants.js +17 -2
  92. package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -1
  93. package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +1 -1
  94. package/dist/deckgl/shapes/edit-shape-layer/events.js +1 -1
  95. package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +1 -1
  96. package/dist/deckgl/shapes/edit-shape-layer/fiber.js +1 -1
  97. package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +7 -4
  98. package/dist/deckgl/shapes/edit-shape-layer/index.js +52 -21
  99. package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -1
  100. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +4 -1
  101. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -1
  102. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +2 -2
  103. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -1
  104. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +7 -7
  105. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -1
  106. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +2 -2
  107. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -1
  108. package/dist/deckgl/shapes/edit-shape-layer/modes/point-translate-mode.js +1 -1
  109. package/dist/deckgl/shapes/edit-shape-layer/modes/point-translate-mode.js.map +1 -1
  110. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +2 -2
  111. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -1
  112. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +1 -1
  113. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -1
  114. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +1 -1
  115. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -1
  116. package/dist/deckgl/shapes/edit-shape-layer/store.js +78 -14
  117. package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -1
  118. package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +14 -2
  119. package/dist/deckgl/shapes/edit-shape-layer/types.js +1 -1
  120. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +1 -1
  121. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +2 -2
  122. package/dist/deckgl/shapes/index.d.ts +4 -4
  123. package/dist/deckgl/shapes/index.js +5 -5
  124. package/dist/deckgl/shapes/shared/constants.d.ts +4 -3
  125. package/dist/deckgl/shapes/shared/constants.js +55 -15
  126. package/dist/deckgl/shapes/shared/constants.js.map +1 -1
  127. package/dist/deckgl/shapes/shared/events.d.ts +5 -1
  128. package/dist/deckgl/shapes/shared/events.js +1 -1
  129. package/dist/deckgl/shapes/shared/events.js.map +1 -1
  130. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +19 -16
  131. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -1
  132. package/dist/deckgl/shapes/shared/types.d.ts +174 -53
  133. package/dist/deckgl/shapes/shared/types.js +155 -2
  134. package/dist/deckgl/shapes/shared/types.js.map +1 -1
  135. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +29 -24
  136. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -1
  137. package/dist/deckgl/shapes/shared/utils/layer-config.js +9 -6
  138. package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -1
  139. package/dist/deckgl/shapes/shared/utils/mode-utils.js +50 -20
  140. package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -1
  141. package/dist/deckgl/shapes/shared/utils/pick-filtering.js +22 -15
  142. package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -1
  143. package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +38 -14
  144. package/dist/deckgl/shapes/shared/utils/style-utils.js +43 -32
  145. package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -1
  146. package/dist/deckgl/symbol-layer/fiber.d.ts +1 -1
  147. package/dist/deckgl/symbol-layer/fiber.js +1 -1
  148. package/dist/deckgl/symbol-layer/index.d.ts +1 -1
  149. package/dist/deckgl/symbol-layer/index.js +1 -1
  150. package/dist/deckgl/text-layer/character-sets.js +1 -1
  151. package/dist/deckgl/text-layer/default-settings.d.ts +1 -1
  152. package/dist/deckgl/text-layer/default-settings.js +1 -1
  153. package/dist/deckgl/text-layer/fiber.d.ts +1 -1
  154. package/dist/deckgl/text-layer/fiber.js +1 -1
  155. package/dist/deckgl/text-layer/index.d.ts +1 -1
  156. package/dist/deckgl/text-layer/index.js +1 -1
  157. package/dist/deckgl/text-settings.d.ts +3 -3
  158. package/dist/deckgl/text-settings.js +1 -1
  159. package/dist/map-cursor/events.js +1 -1
  160. package/dist/map-cursor/index.d.ts +1 -1
  161. package/dist/map-cursor/index.js +1 -1
  162. package/dist/map-cursor/store.d.ts +1 -1
  163. package/dist/map-cursor/store.js +1 -1
  164. package/dist/map-cursor/types.d.ts +1 -1
  165. package/dist/map-cursor/types.js +1 -1
  166. package/dist/map-cursor/use-map-cursor.d.ts +1 -1
  167. package/dist/map-cursor/use-map-cursor.js +1 -1
  168. package/dist/map-mode/events.js +1 -1
  169. package/dist/map-mode/index.d.ts +1 -1
  170. package/dist/map-mode/index.js +1 -1
  171. package/dist/map-mode/store.d.ts +1 -1
  172. package/dist/map-mode/store.js +3 -8
  173. package/dist/map-mode/store.js.map +1 -1
  174. package/dist/map-mode/types.d.ts +1 -1
  175. package/dist/map-mode/types.js +1 -1
  176. package/dist/map-mode/use-map-mode.d.ts +1 -1
  177. package/dist/map-mode/use-map-mode.js +1 -1
  178. package/dist/maplibre/hooks/use-maplibre.d.ts +1 -1
  179. package/dist/maplibre/hooks/use-maplibre.js +1 -1
  180. package/dist/maplibre/index.d.ts +1 -1
  181. package/dist/maplibre/index.js +1 -1
  182. package/dist/shared/cleanup.d.ts +58 -0
  183. package/dist/shared/cleanup.js +93 -0
  184. package/dist/shared/cleanup.js.map +1 -0
  185. package/dist/shared/constants.js +1 -1
  186. package/dist/shared/create-map-store.d.ts +13 -1
  187. package/dist/shared/create-map-store.js +9 -4
  188. package/dist/shared/create-map-store.js.map +1 -1
  189. package/dist/shared/logger.js +31 -0
  190. package/dist/shared/logger.js.map +1 -0
  191. package/dist/shared/units.js +1 -1
  192. package/dist/viewport/index.d.ts +1 -1
  193. package/dist/viewport/index.js +1 -1
  194. package/dist/viewport/store.d.ts +1 -1
  195. package/dist/viewport/store.js +1 -1
  196. package/dist/viewport/types.d.ts +1 -1
  197. package/dist/viewport/types.js +1 -1
  198. package/dist/viewport/utils.d.ts +1 -1
  199. package/dist/viewport/utils.js +1 -1
  200. package/dist/viewport/viewport-size.d.ts +3 -3
  201. package/dist/viewport/viewport-size.js +1 -1
  202. package/package.json +22 -19
  203. package/dist/hotkey-manager/dist/react/use-hotkey.js +0 -39
  204. package/dist/hotkey-manager/dist/react/use-hotkey.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -13,7 +13,7 @@
13
13
  import { DistanceUnit } from "../../../shared/units.js";
14
14
  import { UniqueId } from "@accelint/core";
15
15
  import { Color } from "@deck.gl/core";
16
- import { Feature, LineString, Point, Polygon } from "geojson";
16
+ import { Feature, Geometry, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon } from "geojson";
17
17
 
18
18
  //#region src/deckgl/shapes/shared/types.d.ts
19
19
  /**
@@ -27,6 +27,7 @@ declare const ShapeFeatureType: {
27
27
  readonly LineString: "LineString";
28
28
  readonly Point: "Point";
29
29
  };
30
+ /** Union of all supported shape feature type string literals. */
30
31
  type ShapeFeatureType = (typeof ShapeFeatureType)[keyof typeof ShapeFeatureType];
31
32
  /**
32
33
  * Shape ID type - uses UniqueId from core
@@ -45,7 +46,7 @@ type LinePattern = 'solid' | 'dashed' | 'dotted';
45
46
  /**
46
47
  * Style properties for rendering shapes
47
48
  */
48
- interface StyleProperties {
49
+ type StyleProperties = {
49
50
  /** Fill color as RGBA array [r, g, b, a] where each value is 0-255 */
50
51
  fillColor: Color;
51
52
  /** Border/outline color as RGBA array [r, g, b, a] where each value is 0-255 */
@@ -79,14 +80,14 @@ interface StyleProperties {
79
80
  labelHorizontalAnchor?: 'left' | 'center' | 'right';
80
81
  /** Optional custom label coordinate anchor (position along geometry) */
81
82
  labelCoordinateAnchor?: 'center' | 'start' | 'middle' | 'end' | 'top' | 'right' | 'bottom' | 'left';
82
- }
83
+ };
83
84
  /**
84
85
  * Circle-specific properties for precise rendering
85
86
  * Stored alongside the polygon approximation
86
87
  */
87
- interface CircleProperties {
88
- /** Center point as [longitude, latitude] */
89
- center: [number, number];
88
+ type CircleProperties = {
89
+ /** Center point as [longitude, latitude] or [longitude, latitude, elevation] */
90
+ center: [number, number, number?];
90
91
  /** Radius with value and units */
91
92
  radius: {
92
93
  /** Radius value */
@@ -94,14 +95,14 @@ interface CircleProperties {
94
95
  /** Units for the radius measurement */
95
96
  units: DistanceUnit;
96
97
  };
97
- }
98
+ };
98
99
  /**
99
100
  * Ellipse-specific properties for precise rendering
100
101
  * Stored alongside the polygon approximation
101
102
  */
102
- interface EllipseProperties {
103
- /** Center point as [longitude, latitude] */
104
- center: [number, number];
103
+ type EllipseProperties = {
104
+ /** Center point as [longitude, latitude] or [longitude, latitude, elevation] */
105
+ center: [number, number, number?];
105
106
  /** X semi-axis (horizontal radius) with value and units */
106
107
  xSemiAxis: {
107
108
  /** X semi-axis value */
@@ -118,11 +119,7 @@ interface EllipseProperties {
118
119
  };
119
120
  /** Rotation angle in degrees */
120
121
  angle: number;
121
- }
122
- /**
123
- * Custom geometry types supported
124
- */
125
- type CustomGeometry = Point | LineString | Polygon;
122
+ };
126
123
  /**
127
124
  * Properties for styled features.
128
125
  *
@@ -130,7 +127,7 @@ type CustomGeometry = Point | LineString | Polygon;
130
127
  * but are guaranteed to be present for their respective shape types.
131
128
  * Use the type guards (isCircleShape, isEllipseShape) for type narrowing.
132
129
  */
133
- interface StyledFeatureProperties {
130
+ type StyledFeatureProperties = {
134
131
  /** Style properties for rendering */
135
132
  styleProperties: StyleProperties;
136
133
  /** Shape ID for correlation */
@@ -139,33 +136,37 @@ interface StyledFeatureProperties {
139
136
  circleProperties?: CircleProperties;
140
137
  /** Ellipse properties (present for Ellipse shapes) */
141
138
  ellipseProperties?: EllipseProperties;
142
- }
139
+ /** Minimum elevation in meters (optional) */
140
+ minElevation?: number;
141
+ /** Maximum elevation in meters (optional) */
142
+ maxElevation?: number;
143
+ };
143
144
  /**
144
145
  * Feature properties for Circle shapes (circleProperties required).
145
146
  * Used by CircleShape for better type narrowing.
146
147
  */
147
- interface CircleFeatureProperties extends StyledFeatureProperties {
148
+ type CircleFeatureProperties = StyledFeatureProperties & {
148
149
  /** Circle properties (required for Circle shapes) */
149
150
  circleProperties: CircleProperties;
150
- }
151
+ };
151
152
  /**
152
153
  * Feature properties for Ellipse shapes (ellipseProperties required).
153
154
  * Used by EllipseShape for better type narrowing.
154
155
  */
155
- interface EllipseFeatureProperties extends StyledFeatureProperties {
156
+ type EllipseFeatureProperties = StyledFeatureProperties & {
156
157
  /** Ellipse properties (required for Ellipse shapes) */
157
158
  ellipseProperties: EllipseProperties;
158
- }
159
+ };
159
160
  /**
160
161
  * GeoJSON Feature with style properties
161
162
  */
162
- interface StyledFeature extends Feature {
163
+ type StyledFeature = Feature & {
163
164
  properties: StyledFeatureProperties;
164
- }
165
+ };
165
166
  /**
166
- * Base shape properties shared by all shapes
167
+ * Base shape properties shared by all shapes.
167
168
  */
168
- interface BaseShape {
169
+ type BaseShape = {
169
170
  /** Unique identifier */
170
171
  id: ShapeId;
171
172
  /** Full shape name used internally and in UI */
@@ -185,53 +186,53 @@ interface BaseShape {
185
186
  * Locked shapes cannot be modified due to data restrictions or user preference
186
187
  */
187
188
  locked?: boolean;
188
- }
189
+ };
189
190
  /**
190
191
  * Circle shape with required circleProperties
191
192
  */
192
- interface CircleShape extends BaseShape {
193
+ type CircleShape = BaseShape & {
193
194
  shape: typeof ShapeFeatureType.Circle;
194
195
  feature: StyledFeature & {
195
196
  properties: CircleFeatureProperties;
196
197
  };
197
- }
198
+ };
198
199
  /**
199
200
  * Ellipse shape with required ellipseProperties
200
201
  */
201
- interface EllipseShape extends BaseShape {
202
+ type EllipseShape = BaseShape & {
202
203
  shape: typeof ShapeFeatureType.Ellipse;
203
204
  feature: StyledFeature & {
204
205
  properties: EllipseFeatureProperties;
205
206
  };
206
- }
207
+ };
207
208
  /**
208
209
  * Polygon shape
209
210
  */
210
- interface PolygonShape extends BaseShape {
211
+ type PolygonShape = BaseShape & {
211
212
  shape: typeof ShapeFeatureType.Polygon;
212
213
  feature: StyledFeature;
213
- }
214
+ };
214
215
  /**
215
216
  * Rectangle shape
216
217
  */
217
- interface RectangleShape extends BaseShape {
218
+ type RectangleShape = BaseShape & {
218
219
  shape: typeof ShapeFeatureType.Rectangle;
219
220
  feature: StyledFeature;
220
- }
221
+ };
221
222
  /**
222
223
  * LineString shape
223
224
  */
224
- interface LineStringShape extends BaseShape {
225
+ type LineStringShape = BaseShape & {
225
226
  shape: typeof ShapeFeatureType.LineString;
226
227
  feature: StyledFeature;
227
- }
228
+ };
228
229
  /**
229
230
  * Point shape
230
231
  */
231
- interface PointShape extends BaseShape {
232
+ type PointShape = BaseShape & {
232
233
  shape: typeof ShapeFeatureType.Point;
233
234
  feature: StyledFeature;
234
- }
235
+ };
235
236
  /**
236
237
  * Discriminated union of all shape types.
237
238
  *
@@ -247,10 +248,6 @@ interface PointShape extends BaseShape {
247
248
  * ```
248
249
  */
249
250
  type Shape = CircleShape | EllipseShape | PolygonShape | RectangleShape | LineStringShape | PointShape;
250
- /**
251
- * Alias for ShapeFeatureType values
252
- */
253
- type ShapeFeatureTypeValues = ShapeFeatureType;
254
251
  /**
255
252
  * Alias for StyledFeature (shape feature)
256
253
  */
@@ -263,18 +260,12 @@ type ShapeFeatureProperties = StyledFeature['properties'];
263
260
  * Circle radius type
264
261
  */
265
262
  type CircleRadius = CircleProperties['radius'];
266
- /**
267
- * Coordinate as [longitude, latitude]
268
- */
269
- type Coordinate = [number, number];
270
- /**
271
- * Function type for subscription (useSyncExternalStore pattern).
272
- * Used by draw-shape-layer and edit-shape-layer stores.
273
- */
274
- type Subscription = (onStoreChange: () => void) => () => void;
275
263
  /**
276
264
  * Type guard for Circle shapes.
277
265
  *
266
+ * @param shape - The shape to test.
267
+ * @returns True if shape is a CircleShape.
268
+ *
278
269
  * @example
279
270
  * ```typescript
280
271
  * if (isCircleShape(shape)) {
@@ -287,6 +278,9 @@ declare function isCircleShape(shape: Shape): shape is CircleShape;
287
278
  /**
288
279
  * Type guard for Ellipse shapes.
289
280
  *
281
+ * @param shape - The shape to test.
282
+ * @returns True if shape is an EllipseShape.
283
+ *
290
284
  * @example
291
285
  * ```typescript
292
286
  * if (isEllipseShape(shape)) {
@@ -298,20 +292,147 @@ declare function isCircleShape(shape: Shape): shape is CircleShape;
298
292
  declare function isEllipseShape(shape: Shape): shape is EllipseShape;
299
293
  /**
300
294
  * Type guard for Polygon shapes.
295
+ *
296
+ * @param shape - The shape to test
297
+ * @returns True if shape is a PolygonShape
298
+ * @example
299
+ * ```typescript
300
+ * if (isPolygonShape(shape)) {
301
+ * // TypeScript narrows shape to PolygonShape
302
+ * }
303
+ * ```
301
304
  */
302
305
  declare function isPolygonShape(shape: Shape): shape is PolygonShape;
303
306
  /**
304
307
  * Type guard for Rectangle shapes.
308
+ *
309
+ * @param shape - The shape to test
310
+ * @returns True if shape is a RectangleShape
311
+ * @example
312
+ * ```typescript
313
+ * if (isRectangleShape(shape)) {
314
+ * // TypeScript narrows shape to RectangleShape
315
+ * }
316
+ * ```
305
317
  */
306
318
  declare function isRectangleShape(shape: Shape): shape is RectangleShape;
307
319
  /**
308
320
  * Type guard for LineString shapes.
321
+ *
322
+ * @param shape - The shape to test
323
+ * @returns True if shape is a LineStringShape
324
+ * @example
325
+ * ```typescript
326
+ * if (isLineStringShape(shape)) {
327
+ * // TypeScript narrows shape to LineStringShape
328
+ * }
329
+ * ```
309
330
  */
310
331
  declare function isLineStringShape(shape: Shape): shape is LineStringShape;
311
332
  /**
312
333
  * Type guard for Point shapes.
334
+ *
335
+ * @param shape - The shape to test
336
+ * @returns True if shape is a PointShape
337
+ * @example
338
+ * ```typescript
339
+ * if (isPointShape(shape)) {
340
+ * // TypeScript narrows shape to PointShape
341
+ * }
342
+ * ```
313
343
  */
314
344
  declare function isPointShape(shape: Shape): shape is PointShape;
345
+ /**
346
+ * Narrow a GeoJSON geometry to the Point type.
347
+ *
348
+ * @param geometry - The GeoJSON geometry to test.
349
+ * @returns True if the geometry is a Point.
350
+ */
351
+ declare function isPointType(geometry: Geometry): geometry is Point;
352
+ /**
353
+ * Narrow a GeoJSON geometry to the MultiPoint type.
354
+ *
355
+ * @param geometry - The GeoJSON geometry to test.
356
+ * @returns True if the geometry is a MultiPoint.
357
+ */
358
+ declare function isMultiPointType(geometry: Geometry): geometry is MultiPoint;
359
+ /**
360
+ * Narrow a GeoJSON geometry to the LineString type.
361
+ *
362
+ * @param geometry - The GeoJSON geometry to test.
363
+ * @returns True if the geometry is a LineString.
364
+ */
365
+ declare function isLineStringType(geometry: Geometry): geometry is LineString;
366
+ /**
367
+ * Narrow a GeoJSON geometry to the MultiLineString type.
368
+ *
369
+ * @param geometry - The GeoJSON geometry to test.
370
+ * @returns True if the geometry is a MultiLineString.
371
+ */
372
+ declare function isMultiLineStringType(geometry: Geometry): geometry is MultiLineString;
373
+ /**
374
+ * Narrow a GeoJSON geometry to the Polygon type.
375
+ *
376
+ * @param geometry - The GeoJSON geometry to test.
377
+ * @returns True if the geometry is a Polygon.
378
+ */
379
+ declare function isPolygonType(geometry: Geometry): geometry is Polygon;
380
+ /**
381
+ * Narrow a GeoJSON geometry to the MultiPolygon type.
382
+ *
383
+ * @param geometry - The GeoJSON geometry to test.
384
+ * @returns True if the geometry is a MultiPolygon.
385
+ */
386
+ declare function isMultiPolygonType(geometry: Geometry): geometry is MultiPolygon;
387
+ /**
388
+ * Narrow a GeoJSON geometry to the GeometryCollection type.
389
+ *
390
+ * @param geometry - The GeoJSON geometry to test.
391
+ * @returns True if the geometry is a GeometryCollection.
392
+ */
393
+ declare function isGeometryCollectionType(geometry: Geometry): geometry is GeometryCollection;
394
+ /**
395
+ * Narrow a GeoJSON geometry to polygon-like types (Polygon or MultiPolygon).
396
+ *
397
+ * @param geometry - The GeoJSON geometry to test.
398
+ * @returns True if the geometry is a Polygon or MultiPolygon.
399
+ *
400
+ * @example
401
+ * ```typescript
402
+ * if (isPolygonGeometry(feature.geometry)) {
403
+ * // geometry narrowed to Polygon | MultiPolygon
404
+ * }
405
+ * ```
406
+ */
407
+ declare function isPolygonGeometry(geometry: Geometry): geometry is Polygon | MultiPolygon;
408
+ /**
409
+ * Narrow a GeoJSON geometry to line-like types (LineString or MultiLineString).
410
+ *
411
+ * @param geometry - The GeoJSON geometry to test.
412
+ * @returns True if the geometry is a LineString or MultiLineString.
413
+ *
414
+ * @example
415
+ * ```typescript
416
+ * if (isLineGeometry(feature.geometry)) {
417
+ * // geometry narrowed to LineString | MultiLineString
418
+ * }
419
+ * ```
420
+ */
421
+ declare function isLineGeometry(geometry: Geometry): geometry is LineString | MultiLineString;
422
+ /**
423
+ * Narrow a GeoJSON geometry to point-like types (Point or MultiPoint).
424
+ *
425
+ * @param geometry - The GeoJSON geometry to test.
426
+ * @returns True if the geometry is a Point or MultiPoint.
427
+ *
428
+ * @example
429
+ * ```typescript
430
+ * if (isPointGeometry(feature.geometry)) {
431
+ * // geometry narrowed to Point | MultiPoint
432
+ * }
433
+ * ```
434
+ */
435
+ declare function isPointGeometry(geometry: Geometry): geometry is Point | MultiPoint;
315
436
  //#endregion
316
- export { CircleFeatureProperties, CircleProperties, CircleRadius, CircleShape, Coordinate, CustomGeometry, EllipseFeatureProperties, EllipseProperties, EllipseShape, LinePattern, LineStringShape, LineWidth, PointShape, PolygonShape, RectangleShape, Shape, ShapeFeature, ShapeFeatureProperties, ShapeFeatureType, ShapeFeatureTypeValues, ShapeId, StyleProperties, StyledFeature, StyledFeatureProperties, Subscription, isCircleShape, isEllipseShape, isLineStringShape, isPointShape, isPolygonShape, isRectangleShape };
437
+ export { CircleFeatureProperties, CircleProperties, CircleRadius, CircleShape, EllipseFeatureProperties, EllipseProperties, EllipseShape, LinePattern, LineStringShape, LineWidth, PointShape, PolygonShape, RectangleShape, Shape, ShapeFeature, ShapeFeatureProperties, ShapeFeatureType, ShapeId, StyleProperties, StyledFeature, StyledFeatureProperties, isCircleShape, isEllipseShape, isGeometryCollectionType, isLineGeometry, isLineStringShape, isLineStringType, isMultiLineStringType, isMultiPointType, isMultiPolygonType, isPointGeometry, isPointShape, isPointType, isPolygonGeometry, isPolygonShape, isPolygonType, isRectangleShape };
317
438
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -28,6 +28,9 @@ const ShapeFeatureType = {
28
28
  /**
29
29
  * Type guard for Circle shapes.
30
30
  *
31
+ * @param shape - The shape to test.
32
+ * @returns True if shape is a CircleShape.
33
+ *
31
34
  * @example
32
35
  * ```typescript
33
36
  * if (isCircleShape(shape)) {
@@ -42,6 +45,9 @@ function isCircleShape(shape) {
42
45
  /**
43
46
  * Type guard for Ellipse shapes.
44
47
  *
48
+ * @param shape - The shape to test.
49
+ * @returns True if shape is an EllipseShape.
50
+ *
45
51
  * @example
46
52
  * ```typescript
47
53
  * if (isEllipseShape(shape)) {
@@ -55,29 +61,176 @@ function isEllipseShape(shape) {
55
61
  }
56
62
  /**
57
63
  * Type guard for Polygon shapes.
64
+ *
65
+ * @param shape - The shape to test
66
+ * @returns True if shape is a PolygonShape
67
+ * @example
68
+ * ```typescript
69
+ * if (isPolygonShape(shape)) {
70
+ * // TypeScript narrows shape to PolygonShape
71
+ * }
72
+ * ```
58
73
  */
59
74
  function isPolygonShape(shape) {
60
75
  return shape.shape === ShapeFeatureType.Polygon;
61
76
  }
62
77
  /**
63
78
  * Type guard for Rectangle shapes.
79
+ *
80
+ * @param shape - The shape to test
81
+ * @returns True if shape is a RectangleShape
82
+ * @example
83
+ * ```typescript
84
+ * if (isRectangleShape(shape)) {
85
+ * // TypeScript narrows shape to RectangleShape
86
+ * }
87
+ * ```
64
88
  */
65
89
  function isRectangleShape(shape) {
66
90
  return shape.shape === ShapeFeatureType.Rectangle;
67
91
  }
68
92
  /**
69
93
  * Type guard for LineString shapes.
94
+ *
95
+ * @param shape - The shape to test
96
+ * @returns True if shape is a LineStringShape
97
+ * @example
98
+ * ```typescript
99
+ * if (isLineStringShape(shape)) {
100
+ * // TypeScript narrows shape to LineStringShape
101
+ * }
102
+ * ```
70
103
  */
71
104
  function isLineStringShape(shape) {
72
105
  return shape.shape === ShapeFeatureType.LineString;
73
106
  }
74
107
  /**
75
108
  * Type guard for Point shapes.
109
+ *
110
+ * @param shape - The shape to test
111
+ * @returns True if shape is a PointShape
112
+ * @example
113
+ * ```typescript
114
+ * if (isPointShape(shape)) {
115
+ * // TypeScript narrows shape to PointShape
116
+ * }
117
+ * ```
76
118
  */
77
119
  function isPointShape(shape) {
78
120
  return shape.shape === ShapeFeatureType.Point;
79
121
  }
122
+ /**
123
+ * Narrow a GeoJSON geometry to the Point type.
124
+ *
125
+ * @param geometry - The GeoJSON geometry to test.
126
+ * @returns True if the geometry is a Point.
127
+ */
128
+ function isPointType(geometry) {
129
+ return geometry.type === "Point";
130
+ }
131
+ /**
132
+ * Narrow a GeoJSON geometry to the MultiPoint type.
133
+ *
134
+ * @param geometry - The GeoJSON geometry to test.
135
+ * @returns True if the geometry is a MultiPoint.
136
+ */
137
+ function isMultiPointType(geometry) {
138
+ return geometry.type === "MultiPoint";
139
+ }
140
+ /**
141
+ * Narrow a GeoJSON geometry to the LineString type.
142
+ *
143
+ * @param geometry - The GeoJSON geometry to test.
144
+ * @returns True if the geometry is a LineString.
145
+ */
146
+ function isLineStringType(geometry) {
147
+ return geometry.type === "LineString";
148
+ }
149
+ /**
150
+ * Narrow a GeoJSON geometry to the MultiLineString type.
151
+ *
152
+ * @param geometry - The GeoJSON geometry to test.
153
+ * @returns True if the geometry is a MultiLineString.
154
+ */
155
+ function isMultiLineStringType(geometry) {
156
+ return geometry.type === "MultiLineString";
157
+ }
158
+ /**
159
+ * Narrow a GeoJSON geometry to the Polygon type.
160
+ *
161
+ * @param geometry - The GeoJSON geometry to test.
162
+ * @returns True if the geometry is a Polygon.
163
+ */
164
+ function isPolygonType(geometry) {
165
+ return geometry.type === "Polygon";
166
+ }
167
+ /**
168
+ * Narrow a GeoJSON geometry to the MultiPolygon type.
169
+ *
170
+ * @param geometry - The GeoJSON geometry to test.
171
+ * @returns True if the geometry is a MultiPolygon.
172
+ */
173
+ function isMultiPolygonType(geometry) {
174
+ return geometry.type === "MultiPolygon";
175
+ }
176
+ /**
177
+ * Narrow a GeoJSON geometry to the GeometryCollection type.
178
+ *
179
+ * @param geometry - The GeoJSON geometry to test.
180
+ * @returns True if the geometry is a GeometryCollection.
181
+ */
182
+ function isGeometryCollectionType(geometry) {
183
+ return geometry.type === "GeometryCollection";
184
+ }
185
+ /**
186
+ * Narrow a GeoJSON geometry to polygon-like types (Polygon or MultiPolygon).
187
+ *
188
+ * @param geometry - The GeoJSON geometry to test.
189
+ * @returns True if the geometry is a Polygon or MultiPolygon.
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * if (isPolygonGeometry(feature.geometry)) {
194
+ * // geometry narrowed to Polygon | MultiPolygon
195
+ * }
196
+ * ```
197
+ */
198
+ function isPolygonGeometry(geometry) {
199
+ return geometry.type === "Polygon" || geometry.type === "MultiPolygon";
200
+ }
201
+ /**
202
+ * Narrow a GeoJSON geometry to line-like types (LineString or MultiLineString).
203
+ *
204
+ * @param geometry - The GeoJSON geometry to test.
205
+ * @returns True if the geometry is a LineString or MultiLineString.
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * if (isLineGeometry(feature.geometry)) {
210
+ * // geometry narrowed to LineString | MultiLineString
211
+ * }
212
+ * ```
213
+ */
214
+ function isLineGeometry(geometry) {
215
+ return geometry.type === "LineString" || geometry.type === "MultiLineString";
216
+ }
217
+ /**
218
+ * Narrow a GeoJSON geometry to point-like types (Point or MultiPoint).
219
+ *
220
+ * @param geometry - The GeoJSON geometry to test.
221
+ * @returns True if the geometry is a Point or MultiPoint.
222
+ *
223
+ * @example
224
+ * ```typescript
225
+ * if (isPointGeometry(feature.geometry)) {
226
+ * // geometry narrowed to Point | MultiPoint
227
+ * }
228
+ * ```
229
+ */
230
+ function isPointGeometry(geometry) {
231
+ return geometry.type === "Point" || geometry.type === "MultiPoint";
232
+ }
80
233
 
81
234
  //#endregion
82
- export { ShapeFeatureType, isCircleShape, isEllipseShape, isLineStringShape, isPointShape, isPolygonShape, isRectangleShape };
235
+ export { ShapeFeatureType, isCircleShape, isEllipseShape, isGeometryCollectionType, isLineGeometry, isLineStringShape, isLineStringType, isMultiLineStringType, isMultiPointType, isMultiPolygonType, isPointGeometry, isPointShape, isPointType, isPolygonGeometry, isPolygonShape, isPolygonType, isRectangleShape };
83
236
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/deckgl/shapes/shared/types.ts"],"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 type { UniqueId } from '@accelint/core';\nimport type { Color } from '@deck.gl/core';\nimport type { Feature, LineString, Point, Polygon } from 'geojson';\nimport type { DistanceUnit } from '@/shared/units';\n\n/**\n * Supported shape types\n */\nexport const ShapeFeatureType = {\n Circle: 'Circle',\n Ellipse: 'Ellipse',\n Polygon: 'Polygon',\n Rectangle: 'Rectangle',\n LineString: 'LineString',\n Point: 'Point',\n} as const;\n\nexport type ShapeFeatureType =\n (typeof ShapeFeatureType)[keyof typeof ShapeFeatureType];\n\n/**\n * Shape ID type - uses UniqueId from core\n */\nexport type ShapeId = UniqueId;\n\n/**\n * Border/outline width options (in pixels).\n * Controls the width of shape outlines.\n */\nexport type LineWidth = 1 | 2 | 4 | 8;\n\n/**\n * Border/outline pattern options.\n * Controls how shape outlines are rendered.\n */\nexport type LinePattern = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Style properties for rendering shapes\n */\nexport interface StyleProperties {\n /** Fill color as RGBA array [r, g, b, a] where each value is 0-255 */\n fillColor: Color;\n /** Border/outline color as RGBA array [r, g, b, a] where each value is 0-255 */\n lineColor: Color;\n /** Border/outline width in pixels */\n lineWidth: LineWidth;\n /** Border/outline pattern (solid, dashed, or dotted) */\n linePattern: LinePattern;\n /** Optional icon properties for Point geometries */\n icon?: {\n /** Icon atlas URL or data */\n atlas?: string;\n /** Icon mapping (name to position in atlas) */\n mapping?: Record<\n string,\n { x: number; y: number; width: number; height: number; mask?: boolean }\n >;\n /** Icon name to use from mapping */\n name?: string;\n /** Icon size in pixels */\n size?: number;\n };\n /** Optional custom label pixel offset [x, y] */\n labelOffset?: [number, number];\n /** Optional custom label vertical anchor */\n labelVerticalAnchor?: 'top' | 'middle' | 'bottom';\n /** Optional custom label horizontal anchor */\n labelHorizontalAnchor?: 'left' | 'center' | 'right';\n /** Optional custom label coordinate anchor (position along geometry) */\n labelCoordinateAnchor?:\n | 'center'\n | 'start'\n | 'middle'\n | 'end'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left';\n}\n\n/**\n * Circle-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport interface CircleProperties {\n /** Center point as [longitude, latitude] */\n center: [number, number];\n /** Radius with value and units */\n radius: {\n /** Radius value */\n value: number;\n /** Units for the radius measurement */\n units: DistanceUnit;\n };\n}\n\n/**\n * Ellipse-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport interface EllipseProperties {\n /** Center point as [longitude, latitude] */\n center: [number, number];\n /** X semi-axis (horizontal radius) with value and units */\n xSemiAxis: {\n /** X semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Y semi-axis (vertical radius) with value and units */\n ySemiAxis: {\n /** Y semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Rotation angle in degrees */\n angle: number;\n}\n\n/**\n * Custom geometry types supported\n */\nexport type CustomGeometry = Point | LineString | Polygon;\n\n/**\n * Properties for styled features.\n *\n * Note: circleProperties and ellipseProperties are optional at the type level\n * but are guaranteed to be present for their respective shape types.\n * Use the type guards (isCircleShape, isEllipseShape) for type narrowing.\n */\nexport interface StyledFeatureProperties {\n /** Style properties for rendering */\n styleProperties: StyleProperties;\n /** Shape ID for correlation */\n shapeId?: ShapeId;\n /** Circle properties (present for Circle shapes) */\n circleProperties?: CircleProperties;\n /** Ellipse properties (present for Ellipse shapes) */\n ellipseProperties?: EllipseProperties;\n}\n\n/**\n * Feature properties for Circle shapes (circleProperties required).\n * Used by CircleShape for better type narrowing.\n */\nexport interface CircleFeatureProperties extends StyledFeatureProperties {\n /** Circle properties (required for Circle shapes) */\n circleProperties: CircleProperties;\n}\n\n/**\n * Feature properties for Ellipse shapes (ellipseProperties required).\n * Used by EllipseShape for better type narrowing.\n */\nexport interface EllipseFeatureProperties extends StyledFeatureProperties {\n /** Ellipse properties (required for Ellipse shapes) */\n ellipseProperties: EllipseProperties;\n}\n\n/**\n * GeoJSON Feature with style properties\n */\nexport interface StyledFeature extends Feature {\n properties: StyledFeatureProperties;\n}\n\n/**\n * Base shape properties shared by all shapes\n */\ninterface BaseShape {\n /** Unique identifier */\n id: ShapeId;\n /** Full shape name used internally and in UI */\n name: string;\n /**\n * Optional short display label shown on the map\n * If not provided, the `name` property will be used instead\n * Useful for showing abbreviated text on the map (e.g., \"NYC\" vs \"New York City Office\")\n */\n label?: string;\n /** GeoJSON feature with geometry and style properties */\n feature: ShapeFeature;\n /** UTC timestamp (only set when saved) */\n lastUpdated?: number;\n /**\n * Whether the shape is locked for editing\n * Locked shapes cannot be modified due to data restrictions or user preference\n */\n locked?: boolean;\n}\n\n/**\n * Circle shape with required circleProperties\n */\nexport interface CircleShape extends BaseShape {\n shape: typeof ShapeFeatureType.Circle;\n feature: StyledFeature & { properties: CircleFeatureProperties };\n}\n\n/**\n * Ellipse shape with required ellipseProperties\n */\nexport interface EllipseShape extends BaseShape {\n shape: typeof ShapeFeatureType.Ellipse;\n feature: StyledFeature & { properties: EllipseFeatureProperties };\n}\n\n/**\n * Polygon shape\n */\nexport interface PolygonShape extends BaseShape {\n shape: typeof ShapeFeatureType.Polygon;\n feature: StyledFeature;\n}\n\n/**\n * Rectangle shape\n */\nexport interface RectangleShape extends BaseShape {\n shape: typeof ShapeFeatureType.Rectangle;\n feature: StyledFeature;\n}\n\n/**\n * LineString shape\n */\nexport interface LineStringShape extends BaseShape {\n shape: typeof ShapeFeatureType.LineString;\n feature: StyledFeature;\n}\n\n/**\n * Point shape\n */\nexport interface PointShape extends BaseShape {\n shape: typeof ShapeFeatureType.Point;\n feature: StyledFeature;\n}\n\n/**\n * Discriminated union of all shape types.\n *\n * Use this for type narrowing based on shape:\n * @example\n * ```typescript\n * function handleShape(shape: Shape) {\n * if (shape.shape === 'Circle') {\n * // TypeScript knows shape.feature.properties.circleProperties exists\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * }\n * ```\n */\nexport type Shape =\n | CircleShape\n | EllipseShape\n | PolygonShape\n | RectangleShape\n | LineStringShape\n | PointShape;\n\n/**\n * Alias for ShapeFeatureType values\n */\nexport type ShapeFeatureTypeValues = ShapeFeatureType;\n\n/**\n * Alias for StyledFeature (shape feature)\n */\nexport type ShapeFeature = StyledFeature;\n\n/**\n * Alias for StyledFeature properties\n */\nexport type ShapeFeatureProperties = StyledFeature['properties'];\n\n/**\n * Circle radius type\n */\nexport type CircleRadius = CircleProperties['radius'];\n\n/**\n * Coordinate as [longitude, latitude]\n */\nexport type Coordinate = [number, number];\n\n/**\n * Function type for subscription (useSyncExternalStore pattern).\n * Used by draw-shape-layer and edit-shape-layer stores.\n */\nexport type Subscription = (onStoreChange: () => void) => () => void;\n\n// =============================================================================\n// Type Guards\n// =============================================================================\n\n/**\n * Type guard for Circle shapes.\n *\n * @example\n * ```typescript\n * if (isCircleShape(shape)) {\n * // shape.feature.properties.circleProperties is available\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * ```\n */\nexport function isCircleShape(shape: Shape): shape is CircleShape {\n return shape.shape === ShapeFeatureType.Circle;\n}\n\n/**\n * Type guard for Ellipse shapes.\n *\n * @example\n * ```typescript\n * if (isEllipseShape(shape)) {\n * // shape.feature.properties.ellipseProperties is available\n * const { center, xSemiAxis, ySemiAxis } = shape.feature.properties.ellipseProperties;\n * }\n * ```\n */\nexport function isEllipseShape(shape: Shape): shape is EllipseShape {\n return shape.shape === ShapeFeatureType.Ellipse;\n}\n\n/**\n * Type guard for Polygon shapes.\n */\nexport function isPolygonShape(shape: Shape): shape is PolygonShape {\n return shape.shape === ShapeFeatureType.Polygon;\n}\n\n/**\n * Type guard for Rectangle shapes.\n */\nexport function isRectangleShape(shape: Shape): shape is RectangleShape {\n return shape.shape === ShapeFeatureType.Rectangle;\n}\n\n/**\n * Type guard for LineString shapes.\n */\nexport function isLineStringShape(shape: Shape): shape is LineStringShape {\n return shape.shape === ShapeFeatureType.LineString;\n}\n\n/**\n * Type guard for Point shapes.\n */\nexport function isPointShape(shape: Shape): shape is PointShape {\n return shape.shape === ShapeFeatureType.Point;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,SAAS;CACT,SAAS;CACT,WAAW;CACX,YAAY;CACZ,OAAO;CACR;;;;;;;;;;;;AAwSD,SAAgB,cAAc,OAAoC;AAChE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;AAc1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,iBAAiB,OAAuC;AACtE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,kBAAkB,OAAwC;AACxE,QAAO,MAAM,UAAU,iBAAiB;;;;;AAM1C,SAAgB,aAAa,OAAmC;AAC9D,QAAO,MAAM,UAAU,iBAAiB"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/deckgl/shapes/shared/types.ts"],"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 type { UniqueId } from '@accelint/core';\nimport type { Color } from '@deck.gl/core';\nimport type {\n Feature,\n Geometry,\n GeometryCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from 'geojson';\nimport type { DistanceUnit } from '@/shared/units';\n\n/**\n * Supported shape types\n */\nexport const ShapeFeatureType = {\n Circle: 'Circle',\n Ellipse: 'Ellipse',\n Polygon: 'Polygon',\n Rectangle: 'Rectangle',\n LineString: 'LineString',\n Point: 'Point',\n} as const;\n\n/** Union of all supported shape feature type string literals. */\nexport type ShapeFeatureType =\n (typeof ShapeFeatureType)[keyof typeof ShapeFeatureType];\n\n/**\n * Shape ID type - uses UniqueId from core\n */\nexport type ShapeId = UniqueId;\n\n/**\n * Border/outline width options (in pixels).\n * Controls the width of shape outlines.\n */\nexport type LineWidth = 1 | 2 | 4 | 8;\n\n/**\n * Border/outline pattern options.\n * Controls how shape outlines are rendered.\n */\nexport type LinePattern = 'solid' | 'dashed' | 'dotted';\n\n/**\n * Style properties for rendering shapes\n */\nexport type StyleProperties = {\n /** Fill color as RGBA array [r, g, b, a] where each value is 0-255 */\n fillColor: Color;\n /** Border/outline color as RGBA array [r, g, b, a] where each value is 0-255 */\n lineColor: Color;\n /** Border/outline width in pixels */\n lineWidth: LineWidth;\n /** Border/outline pattern (solid, dashed, or dotted) */\n linePattern: LinePattern;\n /** Optional icon properties for Point geometries */\n icon?: {\n /** Icon atlas URL or data */\n atlas?: string;\n /** Icon mapping (name to position in atlas) */\n mapping?: Record<\n string,\n { x: number; y: number; width: number; height: number; mask?: boolean }\n >;\n /** Icon name to use from mapping */\n name?: string;\n /** Icon size in pixels */\n size?: number;\n };\n /** Optional custom label pixel offset [x, y] */\n labelOffset?: [number, number];\n /** Optional custom label vertical anchor */\n labelVerticalAnchor?: 'top' | 'middle' | 'bottom';\n /** Optional custom label horizontal anchor */\n labelHorizontalAnchor?: 'left' | 'center' | 'right';\n /** Optional custom label coordinate anchor (position along geometry) */\n labelCoordinateAnchor?:\n | 'center'\n | 'start'\n | 'middle'\n | 'end'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left';\n};\n\n/**\n * Circle-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport type CircleProperties = {\n /** Center point as [longitude, latitude] or [longitude, latitude, elevation] */\n center: [number, number, number?];\n /** Radius with value and units */\n radius: {\n /** Radius value */\n value: number;\n /** Units for the radius measurement */\n units: DistanceUnit;\n };\n};\n\n/**\n * Ellipse-specific properties for precise rendering\n * Stored alongside the polygon approximation\n */\nexport type EllipseProperties = {\n /** Center point as [longitude, latitude] or [longitude, latitude, elevation] */\n center: [number, number, number?];\n /** X semi-axis (horizontal radius) with value and units */\n xSemiAxis: {\n /** X semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Y semi-axis (vertical radius) with value and units */\n ySemiAxis: {\n /** Y semi-axis value */\n value: number;\n /** Units for the measurement */\n units: DistanceUnit;\n };\n /** Rotation angle in degrees */\n angle: number;\n};\n\n/**\n * Properties for styled features.\n *\n * Note: circleProperties and ellipseProperties are optional at the type level\n * but are guaranteed to be present for their respective shape types.\n * Use the type guards (isCircleShape, isEllipseShape) for type narrowing.\n */\nexport type StyledFeatureProperties = {\n /** Style properties for rendering */\n styleProperties: StyleProperties;\n /** Shape ID for correlation */\n shapeId?: ShapeId;\n /** Circle properties (present for Circle shapes) */\n circleProperties?: CircleProperties;\n /** Ellipse properties (present for Ellipse shapes) */\n ellipseProperties?: EllipseProperties;\n /** Minimum elevation in meters (optional) */\n minElevation?: number;\n /** Maximum elevation in meters (optional) */\n maxElevation?: number;\n};\n\n/**\n * Feature properties for Circle shapes (circleProperties required).\n * Used by CircleShape for better type narrowing.\n */\nexport type CircleFeatureProperties = StyledFeatureProperties & {\n /** Circle properties (required for Circle shapes) */\n circleProperties: CircleProperties;\n};\n\n/**\n * Feature properties for Ellipse shapes (ellipseProperties required).\n * Used by EllipseShape for better type narrowing.\n */\nexport type EllipseFeatureProperties = StyledFeatureProperties & {\n /** Ellipse properties (required for Ellipse shapes) */\n ellipseProperties: EllipseProperties;\n};\n\n/**\n * GeoJSON Feature with style properties\n */\nexport type StyledFeature = Feature & {\n properties: StyledFeatureProperties;\n};\n\n/**\n * Base shape properties shared by all shapes.\n */\ntype BaseShape = {\n /** Unique identifier */\n id: ShapeId;\n /** Full shape name used internally and in UI */\n name: string;\n /**\n * Optional short display label shown on the map\n * If not provided, the `name` property will be used instead\n * Useful for showing abbreviated text on the map (e.g., \"NYC\" vs \"New York City Office\")\n */\n label?: string;\n /** GeoJSON feature with geometry and style properties */\n feature: ShapeFeature;\n /** UTC timestamp (only set when saved) */\n lastUpdated?: number;\n /**\n * Whether the shape is locked for editing\n * Locked shapes cannot be modified due to data restrictions or user preference\n */\n locked?: boolean;\n};\n\n/**\n * Circle shape with required circleProperties\n */\nexport type CircleShape = BaseShape & {\n shape: typeof ShapeFeatureType.Circle;\n feature: StyledFeature & { properties: CircleFeatureProperties };\n};\n\n/**\n * Ellipse shape with required ellipseProperties\n */\nexport type EllipseShape = BaseShape & {\n shape: typeof ShapeFeatureType.Ellipse;\n feature: StyledFeature & { properties: EllipseFeatureProperties };\n};\n\n/**\n * Polygon shape\n */\nexport type PolygonShape = BaseShape & {\n shape: typeof ShapeFeatureType.Polygon;\n feature: StyledFeature;\n};\n\n/**\n * Rectangle shape\n */\nexport type RectangleShape = BaseShape & {\n shape: typeof ShapeFeatureType.Rectangle;\n feature: StyledFeature;\n};\n\n/**\n * LineString shape\n */\nexport type LineStringShape = BaseShape & {\n shape: typeof ShapeFeatureType.LineString;\n feature: StyledFeature;\n};\n\n/**\n * Point shape\n */\nexport type PointShape = BaseShape & {\n shape: typeof ShapeFeatureType.Point;\n feature: StyledFeature;\n};\n\n/**\n * Discriminated union of all shape types.\n *\n * Use this for type narrowing based on shape:\n * @example\n * ```typescript\n * function handleShape(shape: Shape) {\n * if (shape.shape === 'Circle') {\n * // TypeScript knows shape.feature.properties.circleProperties exists\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * }\n * ```\n */\nexport type Shape =\n | CircleShape\n | EllipseShape\n | PolygonShape\n | RectangleShape\n | LineStringShape\n | PointShape;\n\n/**\n * Alias for StyledFeature (shape feature)\n */\nexport type ShapeFeature = StyledFeature;\n\n/**\n * Alias for StyledFeature properties\n */\nexport type ShapeFeatureProperties = StyledFeature['properties'];\n\n/**\n * Circle radius type\n */\nexport type CircleRadius = CircleProperties['radius'];\n\n// =============================================================================\n// Type Guards\n// =============================================================================\n\n/**\n * Type guard for Circle shapes.\n *\n * @param shape - The shape to test.\n * @returns True if shape is a CircleShape.\n *\n * @example\n * ```typescript\n * if (isCircleShape(shape)) {\n * // shape.feature.properties.circleProperties is available\n * const { center, radius } = shape.feature.properties.circleProperties;\n * }\n * ```\n */\nexport function isCircleShape(shape: Shape): shape is CircleShape {\n return shape.shape === ShapeFeatureType.Circle;\n}\n\n/**\n * Type guard for Ellipse shapes.\n *\n * @param shape - The shape to test.\n * @returns True if shape is an EllipseShape.\n *\n * @example\n * ```typescript\n * if (isEllipseShape(shape)) {\n * // shape.feature.properties.ellipseProperties is available\n * const { center, xSemiAxis, ySemiAxis } = shape.feature.properties.ellipseProperties;\n * }\n * ```\n */\nexport function isEllipseShape(shape: Shape): shape is EllipseShape {\n return shape.shape === ShapeFeatureType.Ellipse;\n}\n\n/**\n * Type guard for Polygon shapes.\n *\n * @param shape - The shape to test\n * @returns True if shape is a PolygonShape\n * @example\n * ```typescript\n * if (isPolygonShape(shape)) {\n * // TypeScript narrows shape to PolygonShape\n * }\n * ```\n */\nexport function isPolygonShape(shape: Shape): shape is PolygonShape {\n return shape.shape === ShapeFeatureType.Polygon;\n}\n\n/**\n * Type guard for Rectangle shapes.\n *\n * @param shape - The shape to test\n * @returns True if shape is a RectangleShape\n * @example\n * ```typescript\n * if (isRectangleShape(shape)) {\n * // TypeScript narrows shape to RectangleShape\n * }\n * ```\n */\nexport function isRectangleShape(shape: Shape): shape is RectangleShape {\n return shape.shape === ShapeFeatureType.Rectangle;\n}\n\n/**\n * Type guard for LineString shapes.\n *\n * @param shape - The shape to test\n * @returns True if shape is a LineStringShape\n * @example\n * ```typescript\n * if (isLineStringShape(shape)) {\n * // TypeScript narrows shape to LineStringShape\n * }\n * ```\n */\nexport function isLineStringShape(shape: Shape): shape is LineStringShape {\n return shape.shape === ShapeFeatureType.LineString;\n}\n\n/**\n * Type guard for Point shapes.\n *\n * @param shape - The shape to test\n * @returns True if shape is a PointShape\n * @example\n * ```typescript\n * if (isPointShape(shape)) {\n * // TypeScript narrows shape to PointShape\n * }\n * ```\n */\nexport function isPointShape(shape: Shape): shape is PointShape {\n return shape.shape === ShapeFeatureType.Point;\n}\n\n// =============================================================================\n// Geometry Type Predicates\n// =============================================================================\n// These narrow GeoJSON Geometry unions (e.g. Polygon, MultiPolygon),\n// distinct from the Shape type guards above which check shape.shape ('Circle', etc.).\n\n// --- Granular geometry predicates (single GeoJSON type) ---\n\n/**\n * Narrow a GeoJSON geometry to the Point type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a Point.\n */\nexport function isPointType(geometry: Geometry): geometry is Point {\n return geometry.type === 'Point';\n}\n\n/**\n * Narrow a GeoJSON geometry to the MultiPoint type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a MultiPoint.\n */\nexport function isMultiPointType(geometry: Geometry): geometry is MultiPoint {\n return geometry.type === 'MultiPoint';\n}\n\n/**\n * Narrow a GeoJSON geometry to the LineString type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a LineString.\n */\nexport function isLineStringType(geometry: Geometry): geometry is LineString {\n return geometry.type === 'LineString';\n}\n\n/**\n * Narrow a GeoJSON geometry to the MultiLineString type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a MultiLineString.\n */\nexport function isMultiLineStringType(\n geometry: Geometry,\n): geometry is MultiLineString {\n return geometry.type === 'MultiLineString';\n}\n\n/**\n * Narrow a GeoJSON geometry to the Polygon type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a Polygon.\n */\nexport function isPolygonType(geometry: Geometry): geometry is Polygon {\n return geometry.type === 'Polygon';\n}\n\n/**\n * Narrow a GeoJSON geometry to the MultiPolygon type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a MultiPolygon.\n */\nexport function isMultiPolygonType(\n geometry: Geometry,\n): geometry is MultiPolygon {\n return geometry.type === 'MultiPolygon';\n}\n\n/**\n * Narrow a GeoJSON geometry to the GeometryCollection type.\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a GeometryCollection.\n */\nexport function isGeometryCollectionType(\n geometry: Geometry,\n): geometry is GeometryCollection {\n return geometry.type === 'GeometryCollection';\n}\n\n// --- Composite geometry predicates (multiple GeoJSON types) ---\n\n/**\n * Narrow a GeoJSON geometry to polygon-like types (Polygon or MultiPolygon).\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a Polygon or MultiPolygon.\n *\n * @example\n * ```typescript\n * if (isPolygonGeometry(feature.geometry)) {\n * // geometry narrowed to Polygon | MultiPolygon\n * }\n * ```\n */\nexport function isPolygonGeometry(\n geometry: Geometry,\n): geometry is Polygon | MultiPolygon {\n return geometry.type === 'Polygon' || geometry.type === 'MultiPolygon';\n}\n\n/**\n * Narrow a GeoJSON geometry to line-like types (LineString or MultiLineString).\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a LineString or MultiLineString.\n *\n * @example\n * ```typescript\n * if (isLineGeometry(feature.geometry)) {\n * // geometry narrowed to LineString | MultiLineString\n * }\n * ```\n */\nexport function isLineGeometry(\n geometry: Geometry,\n): geometry is LineString | MultiLineString {\n return geometry.type === 'LineString' || geometry.type === 'MultiLineString';\n}\n\n/**\n * Narrow a GeoJSON geometry to point-like types (Point or MultiPoint).\n *\n * @param geometry - The GeoJSON geometry to test.\n * @returns True if the geometry is a Point or MultiPoint.\n *\n * @example\n * ```typescript\n * if (isPointGeometry(feature.geometry)) {\n * // geometry narrowed to Point | MultiPoint\n * }\n * ```\n */\nexport function isPointGeometry(\n geometry: Geometry,\n): geometry is Point | MultiPoint {\n return geometry.type === 'Point' || geometry.type === 'MultiPoint';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgCA,MAAa,mBAAmB;CAC9B,QAAQ;CACR,SAAS;CACT,SAAS;CACT,WAAW;CACX,YAAY;CACZ,OAAO;CACR;;;;;;;;;;;;;;;AA2RD,SAAgB,cAAc,OAAoC;AAChE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;;;;AAiB1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;;AAe1C,SAAgB,eAAe,OAAqC;AAClE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;;AAe1C,SAAgB,iBAAiB,OAAuC;AACtE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;;AAe1C,SAAgB,kBAAkB,OAAwC;AACxE,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;;;;;;;AAe1C,SAAgB,aAAa,OAAmC;AAC9D,QAAO,MAAM,UAAU,iBAAiB;;;;;;;;AAiB1C,SAAgB,YAAY,UAAuC;AACjE,QAAO,SAAS,SAAS;;;;;;;;AAS3B,SAAgB,iBAAiB,UAA4C;AAC3E,QAAO,SAAS,SAAS;;;;;;;;AAS3B,SAAgB,iBAAiB,UAA4C;AAC3E,QAAO,SAAS,SAAS;;;;;;;;AAS3B,SAAgB,sBACd,UAC6B;AAC7B,QAAO,SAAS,SAAS;;;;;;;;AAS3B,SAAgB,cAAc,UAAyC;AACrE,QAAO,SAAS,SAAS;;;;;;;;AAS3B,SAAgB,mBACd,UAC0B;AAC1B,QAAO,SAAS,SAAS;;;;;;;;AAS3B,SAAgB,yBACd,UACgC;AAChC,QAAO,SAAS,SAAS;;;;;;;;;;;;;;;AAkB3B,SAAgB,kBACd,UACoC;AACpC,QAAO,SAAS,SAAS,aAAa,SAAS,SAAS;;;;;;;;;;;;;;;AAgB1D,SAAgB,eACd,UAC0C;AAC1C,QAAO,SAAS,SAAS,gBAAgB,SAAS,SAAS;;;;;;;;;;;;;;;AAgB7D,SAAgB,gBACd,UACgC;AAChC,QAAO,SAAS,SAAS,WAAW,SAAS,SAAS"}