@accelint/map-toolkit 0.5.0 → 1.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 (273) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/catalog-info.yaml +6 -3
  3. package/dist/camera/index.d.ts +2 -2
  4. package/dist/camera/index.js +2 -2
  5. package/dist/camera/store.d.ts +120 -0
  6. package/dist/camera/store.js +279 -0
  7. package/dist/camera/store.js.map +1 -0
  8. package/dist/deckgl/base-map/constants.d.ts +9 -7
  9. package/dist/deckgl/base-map/constants.js +9 -7
  10. package/dist/deckgl/base-map/constants.js.map +1 -1
  11. package/dist/deckgl/base-map/controls.js +2 -0
  12. package/dist/deckgl/base-map/controls.js.map +1 -1
  13. package/dist/deckgl/base-map/index.d.ts +2 -0
  14. package/dist/deckgl/base-map/index.js +14 -16
  15. package/dist/deckgl/base-map/index.js.map +1 -1
  16. package/dist/deckgl/base-map/provider.js +1 -1
  17. package/dist/deckgl/base-map/types.d.ts +6 -1
  18. package/dist/deckgl/index.d.ts +8 -2
  19. package/dist/deckgl/index.js +6 -2
  20. package/dist/deckgl/saved-viewports/index.d.ts +1 -1
  21. package/dist/deckgl/saved-viewports/index.js +1 -2
  22. package/dist/deckgl/saved-viewports/index.js.map +1 -1
  23. package/dist/deckgl/saved-viewports/storage.js +10 -2
  24. package/dist/deckgl/saved-viewports/storage.js.map +1 -1
  25. package/dist/deckgl/shapes/display-shape-layer/constants.js +58 -0
  26. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -0
  27. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js → deckgl/shapes/display-shape-layer/fiber.d.ts} +11 -7
  28. package/dist/{packages/hotkey-manager/dist/lib/is-client/index.js → deckgl/shapes/display-shape-layer/fiber.js} +6 -7
  29. package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -0
  30. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +210 -0
  31. package/dist/deckgl/shapes/display-shape-layer/index.js +449 -0
  32. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -0
  33. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +102 -0
  34. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -0
  35. package/dist/deckgl/shapes/display-shape-layer/store.js +102 -0
  36. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -0
  37. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +126 -0
  38. package/dist/{node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/layer.js → deckgl/shapes/display-shape-layer/types.js} +0 -3
  39. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.d.ts +89 -0
  40. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js +88 -0
  41. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js.map +1 -0
  42. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +50 -0
  43. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -0
  44. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +133 -0
  45. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +250 -0
  46. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -0
  47. package/dist/deckgl/shapes/draw-shape-layer/constants.js +46 -0
  48. package/dist/deckgl/shapes/draw-shape-layer/constants.js.map +1 -0
  49. package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +92 -0
  50. package/dist/deckgl/shapes/draw-shape-layer/events.js +56 -0
  51. package/dist/deckgl/shapes/draw-shape-layer/events.js.map +1 -0
  52. package/dist/deckgl/shapes/draw-shape-layer/fiber.d.ts +11 -0
  53. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js → deckgl/shapes/draw-shape-layer/fiber.js} +5 -4
  54. package/dist/deckgl/shapes/draw-shape-layer/fiber.js.map +1 -0
  55. package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +53 -0
  56. package/dist/deckgl/shapes/draw-shape-layer/index.js +95 -0
  57. package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -0
  58. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +51 -0
  59. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -0
  60. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +73 -0
  61. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -0
  62. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +87 -0
  63. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -0
  64. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +88 -0
  65. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -0
  66. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +77 -0
  67. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -0
  68. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +64 -0
  69. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -0
  70. package/dist/deckgl/shapes/draw-shape-layer/store.js +175 -0
  71. package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -0
  72. package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +86 -0
  73. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fly-to-viewport.js → deckgl/shapes/draw-shape-layer/types.js} +1 -1
  74. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +82 -0
  75. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +112 -0
  76. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js.map +1 -0
  77. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +147 -0
  78. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -0
  79. package/dist/deckgl/shapes/edit-shape-layer/constants.js +41 -0
  80. package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -0
  81. package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +92 -0
  82. package/dist/deckgl/shapes/edit-shape-layer/events.js +56 -0
  83. package/dist/deckgl/shapes/edit-shape-layer/events.js.map +1 -0
  84. package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +13 -0
  85. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-viewport.js → deckgl/shapes/edit-shape-layer/fiber.js} +1 -3
  86. package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +63 -0
  87. package/dist/deckgl/shapes/edit-shape-layer/index.js +162 -0
  88. package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -0
  89. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +154 -0
  90. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -0
  91. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +147 -0
  92. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -0
  93. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +87 -0
  94. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -0
  95. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +61 -0
  96. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -0
  97. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +109 -0
  98. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -0
  99. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +289 -0
  100. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -0
  101. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +121 -0
  102. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -0
  103. package/dist/deckgl/shapes/edit-shape-layer/store.js +194 -0
  104. package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -0
  105. package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +93 -0
  106. package/dist/{node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/normalize-viewport-props.js → deckgl/shapes/edit-shape-layer/types.js} +1 -1
  107. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +82 -0
  108. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +114 -0
  109. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js.map +1 -0
  110. package/dist/deckgl/shapes/index.d.ts +29 -0
  111. package/dist/deckgl/shapes/index.js +27 -0
  112. package/dist/deckgl/shapes/shared/constants.d.ts +73 -0
  113. package/dist/deckgl/shapes/shared/constants.js +273 -0
  114. package/dist/deckgl/shapes/shared/constants.js.map +1 -0
  115. package/dist/deckgl/shapes/shared/events.d.ts +54 -0
  116. package/dist/{packages/hotkey-manager/dist/lib/is-mac/index.js → deckgl/shapes/shared/events.js} +10 -6
  117. package/dist/deckgl/shapes/shared/events.js.map +1 -0
  118. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +84 -0
  119. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -0
  120. package/dist/deckgl/shapes/shared/types.d.ts +317 -0
  121. package/dist/deckgl/shapes/shared/types.js +83 -0
  122. package/dist/deckgl/shapes/shared/types.js.map +1 -0
  123. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +128 -0
  124. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -0
  125. package/dist/deckgl/shapes/shared/utils/layer-config.js +50 -0
  126. package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -0
  127. package/dist/deckgl/shapes/shared/utils/mode-utils.js +113 -0
  128. package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -0
  129. package/dist/deckgl/shapes/shared/utils/pick-filtering.js +57 -0
  130. package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -0
  131. package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +64 -0
  132. package/dist/deckgl/shapes/shared/utils/style-utils.js +101 -0
  133. package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -0
  134. package/dist/deckgl/symbol-layer/index.d.ts +1 -1
  135. package/dist/deckgl/text-layer/default-settings.js +4 -24
  136. package/dist/deckgl/text-layer/default-settings.js.map +1 -1
  137. package/dist/deckgl/text-settings.d.ts +77 -0
  138. package/dist/deckgl/text-settings.js +83 -0
  139. package/dist/deckgl/text-settings.js.map +1 -0
  140. package/dist/map-cursor/index.d.ts +2 -2
  141. package/dist/map-cursor/index.js +2 -2
  142. package/dist/map-cursor/store.d.ts +32 -61
  143. package/dist/map-cursor/store.js +165 -294
  144. package/dist/map-cursor/store.js.map +1 -1
  145. package/dist/map-cursor/use-map-cursor.d.ts +5 -2
  146. package/dist/map-cursor/use-map-cursor.js +33 -15
  147. package/dist/map-cursor/use-map-cursor.js.map +1 -1
  148. package/dist/map-mode/index.d.ts +2 -2
  149. package/dist/map-mode/index.js +2 -2
  150. package/dist/map-mode/store.d.ts +36 -37
  151. package/dist/map-mode/store.js +131 -237
  152. package/dist/map-mode/store.js.map +1 -1
  153. package/dist/map-mode/use-map-mode.js +6 -5
  154. package/dist/map-mode/use-map-mode.js.map +1 -1
  155. package/dist/maplibre/index.d.ts +2 -2
  156. package/dist/maplibre/index.js +2 -2
  157. package/dist/shared/constants.d.ts +19 -0
  158. package/dist/{maplibre → shared}/constants.js +9 -3
  159. package/dist/shared/constants.js.map +1 -0
  160. package/dist/shared/create-map-store.d.ts +202 -0
  161. package/dist/shared/create-map-store.js +223 -0
  162. package/dist/shared/create-map-store.js.map +1 -0
  163. package/dist/shared/units.d.ts +39 -0
  164. package/dist/shared/units.js +49 -0
  165. package/dist/shared/units.js.map +1 -0
  166. package/dist/viewport/index.d.ts +3 -3
  167. package/dist/viewport/index.js +3 -3
  168. package/dist/viewport/store.d.ts +69 -0
  169. package/dist/viewport/store.js +125 -0
  170. package/dist/viewport/store.js.map +1 -0
  171. package/dist/viewport/types.d.ts +2 -2
  172. package/dist/viewport/utils.js +2 -2
  173. package/dist/viewport/utils.js.map +1 -1
  174. package/dist/viewport/viewport-size.js +2 -2
  175. package/dist/viewport/viewport-size.js.map +1 -1
  176. package/package.json +60 -26
  177. package/dist/_virtual/rolldown_runtime.js +0 -22
  178. package/dist/camera/use-camera-state.d.ts +0 -153
  179. package/dist/camera/use-camera-state.js +0 -419
  180. package/dist/camera/use-camera-state.js.map +0 -1
  181. package/dist/decorators/deckgl.d.ts +0 -19
  182. package/dist/decorators/deckgl.js +0 -32
  183. package/dist/decorators/deckgl.js.map +0 -1
  184. package/dist/maplibre/constants.d.ts +0 -13
  185. package/dist/maplibre/constants.js.map +0 -1
  186. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/assert.js.map +0 -1
  187. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js +0 -63
  188. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/fit-bounds.js.map +0 -1
  189. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/get-bounds.js.map +0 -1
  190. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/index.js +0 -19
  191. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js +0 -25
  192. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/math-utils.js.map +0 -1
  193. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js +0 -59
  194. package/dist/node_modules/.pnpm/@math.gl_web-mercator@4.1.0/node_modules/@math.gl/web-mercator/dist/web-mercator-utils.js.map +0 -1
  195. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js +0 -29
  196. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js.map +0 -1
  197. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js +0 -29
  198. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js.map +0 -1
  199. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js +0 -54
  200. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js.map +0 -1
  201. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js +0 -29
  202. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js.map +0 -1
  203. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js +0 -91
  204. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/map.js.map +0 -1
  205. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js +0 -88
  206. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/marker.js.map +0 -1
  207. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js +0 -29
  208. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js.map +0 -1
  209. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js +0 -69
  210. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/popup.js.map +0 -1
  211. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js +0 -35
  212. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js.map +0 -1
  213. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/source.js +0 -15
  214. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js +0 -29
  215. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js.map +0 -1
  216. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js +0 -40
  217. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js.map +0 -1
  218. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js +0 -23
  219. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js.map +0 -1
  220. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/index.js +0 -27
  221. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js +0 -57
  222. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js.map +0 -1
  223. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js +0 -343
  224. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js.map +0 -1
  225. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js +0 -28
  226. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js.map +0 -1
  227. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js +0 -31
  228. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js.map +0 -1
  229. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js +0 -57
  230. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js.map +0 -1
  231. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js +0 -30
  232. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js.map +0 -1
  233. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js +0 -53
  234. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js.map +0 -1
  235. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js +0 -52
  236. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js.map +0 -1
  237. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js +0 -22
  238. package/dist/node_modules/.pnpm/@vis.gl_react-maplibre@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js.map +0 -1
  239. package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js +0 -812
  240. package/dist/node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.js.map +0 -1
  241. package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js +0 -35
  242. package/dist/node_modules/.pnpm/radashi@12.7.1/node_modules/radashi/dist/radashi.js.map +0 -1
  243. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js +0 -195
  244. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.development.js.map +0 -1
  245. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js +0 -76
  246. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/cjs/react-dom.production.js.map +0 -1
  247. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js +0 -39
  248. package/dist/node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js.map +0 -1
  249. package/dist/node_modules/.pnpm/react-map-gl@8.1.0_maplibre-gl@5.15.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/react-map-gl/dist/maplibre.js +0 -16
  250. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js +0 -27
  251. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/middleware/immer.js.map +0 -1
  252. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js +0 -45
  253. package/dist/node_modules/.pnpm/zustand@5.0.9_@types_react@19.2.7_immer@10.2.0_react@19.2.3_use-sync-external-store@1.6.0_react@19.2.3_/node_modules/zustand/esm/vanilla.js.map +0 -1
  254. package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js +0 -78
  255. package/dist/packages/hotkey-manager/dist/actions/register-hotkey/index.js.map +0 -1
  256. package/dist/packages/hotkey-manager/dist/constants.js +0 -47
  257. package/dist/packages/hotkey-manager/dist/constants.js.map +0 -1
  258. package/dist/packages/hotkey-manager/dist/enums/keycode.js +0 -130
  259. package/dist/packages/hotkey-manager/dist/enums/keycode.js.map +0 -1
  260. package/dist/packages/hotkey-manager/dist/lib/is-client/index.js.map +0 -1
  261. package/dist/packages/hotkey-manager/dist/lib/is-mac/index.js.map +0 -1
  262. package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js +0 -39
  263. package/dist/packages/hotkey-manager/dist/lib/key-to-id/index.js.map +0 -1
  264. package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js +0 -27
  265. package/dist/packages/hotkey-manager/dist/lib/key-to-string/index.js.map +0 -1
  266. package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js +0 -95
  267. package/dist/packages/hotkey-manager/dist/stores/hotkey-store/index.js.map +0 -1
  268. package/dist/viewport/constants.d.ts +0 -11
  269. package/dist/viewport/constants.js +0 -25
  270. package/dist/viewport/constants.js.map +0 -1
  271. package/dist/viewport/use-viewport-state.d.ts +0 -100
  272. package/dist/viewport/use-viewport-state.js +0 -222
  273. package/dist/viewport/use-viewport-state.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-draw-shape.js","names":[],"sources":["../../../../src/deckgl/shapes/draw-shape-layer/use-draw-shape.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\n'use client';\n\nimport 'client-only';\nimport { useBus } from '@accelint/bus/react';\nimport { useContext, useMemo } from 'react';\nimport { MapContext } from '../../base-map/provider';\nimport { DrawShapeEvents } from './events';\nimport { drawStore } from './store';\nimport type { UniqueId } from '@accelint/core';\nimport type { DrawShapeEvent } from './events';\nimport type { UseDrawShapeOptions, UseDrawShapeReturn } from './types';\n\n/**\n * Hook to access the shape drawing state and actions.\n *\n * This hook uses `useSyncExternalStore` to subscribe to drawing state changes,\n * providing concurrent-safe state updates. Uses a fan-out pattern where\n * a single bus listener per map instance notifies N React component subscribers.\n *\n * @param mapId - Optional map instance ID. If not provided, will use the ID from `MapContext`.\n * @param options - Optional callbacks for onCreate and onCancel events\n * @returns Drawing state, draw function, cancel function, and convenience flags\n * @throws Error if no `mapId` is provided and hook is used outside of `MapProvider`\n *\n * @example\n * ```tsx\n * // Inside MapProvider (within BaseMap children) - uses context\n * function DrawingToolbar() {\n * const { draw, cancel, isDrawing, activeShapeType } = useDrawShape(undefined, {\n * onCreate: (shape) => {\n * console.log('Shape created:', shape);\n * setShapes(prev => [...prev, shape]);\n * },\n * onCancel: (shapeType) => {\n * console.log('Drawing canceled:', shapeType);\n * },\n * });\n *\n * return (\n * <div>\n * <button onClick={() => draw(ShapeFeatureType.Polygon)}>\n * Draw Polygon\n * </button>\n * <button onClick={() => draw(ShapeFeatureType.Circle)}>\n * Draw Circle\n * </button>\n * {isDrawing && (\n * <button onClick={cancel}>\n * Cancel ({activeShapeType})\n * </button>\n * )}\n * </div>\n * );\n * }\n * ```\n *\n * @example\n * ```tsx\n * // Outside MapProvider - pass mapId directly\n * function ExternalDrawingControl({ mapId }: { mapId: UniqueId }) {\n * const { draw, isDrawing } = useDrawShape(mapId);\n *\n * return (\n * <button\n * onClick={() => draw(ShapeFeatureType.Point)}\n * disabled={isDrawing}\n * >\n * Add Point\n * </button>\n * );\n * }\n * ```\n */\nexport function useDrawShape(\n mapId?: UniqueId,\n options?: UseDrawShapeOptions,\n): UseDrawShapeReturn {\n const contextId = useContext(MapContext);\n const actualId = mapId ?? contextId;\n\n if (!actualId) {\n throw new Error(\n 'useDrawShape requires either a mapId parameter or to be used within a MapProvider',\n );\n }\n\n const { onCreate, onCancel } = options ?? {};\n\n // Use the v2 store API directly\n const { state: drawingState, draw, cancel } = drawStore.use(actualId);\n\n // Listen for completion/cancellation events to trigger callbacks\n // useOn handles cleanup automatically and uses useEffectEvent for stable callbacks\n const { useOn } = useBus<DrawShapeEvent>();\n\n useOn(DrawShapeEvents.drawn, (event) => {\n if (event.payload.mapId === actualId && onCreate) {\n onCreate(event.payload.shape);\n }\n });\n\n useOn(DrawShapeEvents.canceled, (event) => {\n if (event.payload.mapId === actualId && onCancel) {\n onCancel(event.payload.shapeType);\n }\n });\n\n // Memoize the return value to prevent unnecessary re-renders\n return useMemo(\n () => ({\n drawingState,\n draw,\n cancel,\n isDrawing: !!drawingState?.activeShapeType,\n activeShapeType: drawingState?.activeShapeType ?? null,\n }),\n [drawingState, draw, cancel],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAgB,aACd,OACA,SACoB;CACpB,MAAM,YAAY,WAAW,WAAW;CACxC,MAAM,WAAW,SAAS;AAE1B,KAAI,CAAC,SACH,OAAM,IAAI,MACR,oFACD;CAGH,MAAM,EAAE,UAAU,aAAa,WAAW,EAAE;CAG5C,MAAM,EAAE,OAAO,cAAc,MAAM,WAAW,UAAU,IAAI,SAAS;CAIrE,MAAM,EAAE,mBAAU,QAAwB;AAE1C,SAAM,gBAAgB,QAAQ,UAAU;AACtC,MAAI,MAAM,QAAQ,UAAU,YAAY,SACtC,UAAS,MAAM,QAAQ,MAAM;GAE/B;AAEF,SAAM,gBAAgB,WAAW,UAAU;AACzC,MAAI,MAAM,QAAQ,UAAU,YAAY,SACtC,UAAS,MAAM,QAAQ,UAAU;GAEnC;AAGF,QAAO,eACE;EACL;EACA;EACA;EACA,WAAW,CAAC,CAAC,cAAc;EAC3B,iBAAiB,cAAc,mBAAmB;EACnD,GACD;EAAC;EAAc;EAAM;EAAO,CAC7B"}
@@ -0,0 +1,147 @@
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
+ 'use client';
15
+
16
+ import { DEFAULT_STYLE_PROPERTIES } from "../../shared/constants.js";
17
+ import { ShapeFeatureType } from "../../shared/types.js";
18
+ import { DEFAULT_DISTANCE_UNITS } from "../../../../shared/units.js";
19
+ import { uuid } from "@accelint/core";
20
+ import { getLogger } from "@accelint/logger";
21
+ import { centroid, distance } from "@turf/turf";
22
+
23
+ //#region src/deckgl/shapes/draw-shape-layer/utils/feature-conversion.ts
24
+ const logger = getLogger({
25
+ enabled: process.env.NODE_ENV !== "production",
26
+ level: "warn",
27
+ prefix: "[FeatureConversion]",
28
+ pretty: true
29
+ });
30
+ /**
31
+ * Generate a default name for a shape based on its type
32
+ */
33
+ function generateShapeName(shape) {
34
+ return `New ${shape} (${(/* @__PURE__ */ new Date()).toLocaleTimeString()})`;
35
+ }
36
+ /**
37
+ * Compute circle properties from a polygon geometry (circle approximation)
38
+ *
39
+ * The EditableGeoJsonLayer creates circles as polygon approximations.
40
+ * This function extracts the center and radius from that polygon.
41
+ */
42
+ function computeCircleProperties(geometry) {
43
+ const coordinates = geometry.coordinates[0];
44
+ if (!coordinates || coordinates.length < 3) {
45
+ logger.warn("Cannot compute circle properties: polygon has insufficient coordinates");
46
+ return;
47
+ }
48
+ const center = centroid({
49
+ type: "Polygon",
50
+ coordinates: geometry.coordinates
51
+ }).geometry.coordinates;
52
+ if (!(Number.isFinite(center[0]) && Number.isFinite(center[1]))) {
53
+ logger.warn("Cannot compute circle properties: invalid center coordinates");
54
+ return;
55
+ }
56
+ const firstPoint = coordinates[0];
57
+ if (!(firstPoint && Number.isFinite(firstPoint[0]) && Number.isFinite(firstPoint[1]))) {
58
+ logger.warn("Cannot compute circle properties: invalid edge point coordinates");
59
+ return;
60
+ }
61
+ const radius = distance(center, firstPoint, { units: DEFAULT_DISTANCE_UNITS });
62
+ if (!Number.isFinite(radius) || radius <= 0) {
63
+ logger.warn("Cannot compute circle properties: invalid radius computed");
64
+ return;
65
+ }
66
+ return {
67
+ center,
68
+ radius: {
69
+ value: radius,
70
+ units: DEFAULT_DISTANCE_UNITS
71
+ }
72
+ };
73
+ }
74
+ /**
75
+ * Compute ellipse properties from a feature's editProperties
76
+ *
77
+ * The DrawEllipseUsingThreePointsMode attaches ellipse metadata to the feature's
78
+ * properties.editProperties. This function extracts and normalizes that data.
79
+ */
80
+ function computeEllipseProperties(feature) {
81
+ const editProps = feature.properties?.editProperties;
82
+ if (!editProps || editProps.shape !== "Ellipse") {
83
+ logger.warn("Cannot compute ellipse properties: feature missing editProperties or not an ellipse");
84
+ return;
85
+ }
86
+ return {
87
+ center: editProps.center,
88
+ xSemiAxis: {
89
+ value: editProps.xSemiAxis.value,
90
+ units: DEFAULT_DISTANCE_UNITS
91
+ },
92
+ ySemiAxis: {
93
+ value: editProps.ySemiAxis.value,
94
+ units: DEFAULT_DISTANCE_UNITS
95
+ },
96
+ angle: editProps.angle
97
+ };
98
+ }
99
+ /**
100
+ * Convert a raw GeoJSON Feature from EditableGeoJsonLayer to a Shape
101
+ *
102
+ * The returned Shape includes:
103
+ * - Auto-generated UUID
104
+ * - Auto-generated name with timestamp (e.g., "New Polygon (2:30:45 PM)")
105
+ * - Merged style properties (defaults + overrides)
106
+ * - Circle/ellipse properties computed from geometry if applicable
107
+ * - `lastUpdated` timestamp
108
+ * - `locked: false` (newly created shapes are always unlocked)
109
+ *
110
+ * @param feature - The raw GeoJSON feature from the editable layer
111
+ * @param shape - The type of shape being created
112
+ * @param styleDefaults - Optional style overrides
113
+ * @returns A complete Shape ready for use
114
+ */
115
+ function convertFeatureToShape(feature, shape, styleDefaults) {
116
+ const id = uuid();
117
+ const name = generateShapeName(shape);
118
+ const styleProperties = {
119
+ ...DEFAULT_STYLE_PROPERTIES,
120
+ ...styleDefaults ?? {}
121
+ };
122
+ let circleProperties;
123
+ if (shape === ShapeFeatureType.Circle && feature.geometry.type === "Polygon") circleProperties = computeCircleProperties(feature.geometry);
124
+ let ellipseProperties;
125
+ if (shape === ShapeFeatureType.Ellipse && feature.geometry.type === "Polygon") ellipseProperties = computeEllipseProperties(feature);
126
+ return {
127
+ id,
128
+ name,
129
+ shape,
130
+ feature: {
131
+ type: "Feature",
132
+ geometry: feature.geometry,
133
+ properties: {
134
+ styleProperties,
135
+ circleProperties,
136
+ ellipseProperties,
137
+ shapeId: id
138
+ }
139
+ },
140
+ lastUpdated: Date.now(),
141
+ locked: false
142
+ };
143
+ }
144
+
145
+ //#endregion
146
+ export { convertFeatureToShape };
147
+ //# sourceMappingURL=feature-conversion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-conversion.js","names":["styleProperties: StyleProperties","circleProperties: CircleProperties | undefined","ShapeFeatureTypeEnum","ellipseProperties: EllipseProperties | undefined"],"sources":["../../../../../src/deckgl/shapes/draw-shape-layer/utils/feature-conversion.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\n'use client';\n\nimport { uuid } from '@accelint/core';\nimport { getLogger } from '@accelint/logger';\nimport { centroid, distance } from '@turf/turf';\nimport { DEFAULT_DISTANCE_UNITS } from '@/shared/units';\nimport { DEFAULT_STYLE_PROPERTIES } from '../../shared/constants';\nimport {\n type CircleProperties,\n type EllipseProperties,\n type Shape,\n type ShapeFeature,\n type ShapeFeatureType,\n ShapeFeatureType as ShapeFeatureTypeEnum,\n type StyleProperties,\n} from '../../shared/types';\nimport type { Feature, Polygon, Position } from 'geojson';\n\nconst logger = getLogger({\n enabled: process.env.NODE_ENV !== 'production',\n level: 'warn',\n prefix: '[FeatureConversion]',\n pretty: true,\n});\n\n/**\n * Generate a default name for a shape based on its type\n */\nfunction generateShapeName(shape: ShapeFeatureType): string {\n const timestamp = new Date().toLocaleTimeString();\n return `New ${shape} (${timestamp})`;\n}\n\n/**\n * Compute circle properties from a polygon geometry (circle approximation)\n *\n * The EditableGeoJsonLayer creates circles as polygon approximations.\n * This function extracts the center and radius from that polygon.\n */\nfunction computeCircleProperties(\n geometry: Polygon,\n): CircleProperties | undefined {\n const coordinates = geometry.coordinates[0];\n if (!coordinates || coordinates.length < 3) {\n logger.warn(\n 'Cannot compute circle properties: polygon has insufficient coordinates',\n );\n return undefined;\n }\n\n // Calculate center using turf centroid\n const centerFeature = centroid({\n type: 'Polygon',\n coordinates: geometry.coordinates,\n });\n const center = centerFeature.geometry.coordinates as [number, number];\n\n // Validate center coordinates are valid numbers\n const isCenterValid =\n Number.isFinite(center[0]) && Number.isFinite(center[1]);\n if (!isCenterValid) {\n logger.warn('Cannot compute circle properties: invalid center coordinates');\n return undefined;\n }\n\n // Calculate radius as distance from center to first point\n const firstPoint = coordinates[0] as Position;\n\n // Validate first point coordinates\n const isFirstPointValid =\n firstPoint &&\n Number.isFinite(firstPoint[0]) &&\n Number.isFinite(firstPoint[1]);\n if (!isFirstPointValid) {\n logger.warn(\n 'Cannot compute circle properties: invalid edge point coordinates',\n );\n return undefined;\n }\n\n const radius = distance(center, firstPoint, {\n units: DEFAULT_DISTANCE_UNITS,\n });\n\n // Validate computed radius\n if (!Number.isFinite(radius) || radius <= 0) {\n logger.warn('Cannot compute circle properties: invalid radius computed');\n return undefined;\n }\n\n return {\n center,\n radius: {\n value: radius,\n units: DEFAULT_DISTANCE_UNITS,\n },\n };\n}\n\n/**\n * Edit properties attached by DrawEllipseUsingThreePointsMode\n */\ninterface EllipseEditProperties {\n shape: 'Ellipse';\n xSemiAxis: { value: number; unit: string };\n ySemiAxis: { value: number; unit: string };\n angle: number;\n center: [number, number];\n}\n\n/**\n * Compute ellipse properties from a feature's editProperties\n *\n * The DrawEllipseUsingThreePointsMode attaches ellipse metadata to the feature's\n * properties.editProperties. This function extracts and normalizes that data.\n */\nfunction computeEllipseProperties(\n feature: Feature,\n): EllipseProperties | undefined {\n const editProps = (\n feature.properties as { editProperties?: EllipseEditProperties } | null\n )?.editProperties;\n\n if (!editProps || editProps.shape !== 'Ellipse') {\n logger.warn(\n 'Cannot compute ellipse properties: feature missing editProperties or not an ellipse',\n );\n return undefined;\n }\n\n return {\n center: editProps.center,\n xSemiAxis: {\n value: editProps.xSemiAxis.value,\n units: DEFAULT_DISTANCE_UNITS,\n },\n ySemiAxis: {\n value: editProps.ySemiAxis.value,\n units: DEFAULT_DISTANCE_UNITS,\n },\n angle: editProps.angle,\n };\n}\n\n/**\n * Convert a raw GeoJSON Feature from EditableGeoJsonLayer to a Shape\n *\n * The returned Shape includes:\n * - Auto-generated UUID\n * - Auto-generated name with timestamp (e.g., \"New Polygon (2:30:45 PM)\")\n * - Merged style properties (defaults + overrides)\n * - Circle/ellipse properties computed from geometry if applicable\n * - `lastUpdated` timestamp\n * - `locked: false` (newly created shapes are always unlocked)\n *\n * @param feature - The raw GeoJSON feature from the editable layer\n * @param shape - The type of shape being created\n * @param styleDefaults - Optional style overrides\n * @returns A complete Shape ready for use\n */\nexport function convertFeatureToShape(\n feature: Feature,\n shape: ShapeFeatureType,\n styleDefaults?: Partial<StyleProperties> | null,\n): Shape {\n const id = uuid();\n const name = generateShapeName(shape);\n\n // Merge default styles with any provided defaults\n const styleProperties: StyleProperties = {\n ...DEFAULT_STYLE_PROPERTIES,\n ...(styleDefaults ?? {}),\n };\n\n // Compute circle properties if this is a circle\n let circleProperties: CircleProperties | undefined;\n if (\n shape === ShapeFeatureTypeEnum.Circle &&\n feature.geometry.type === 'Polygon'\n ) {\n circleProperties = computeCircleProperties(feature.geometry);\n }\n\n // Compute ellipse properties if this is an ellipse\n let ellipseProperties: EllipseProperties | undefined;\n if (\n shape === ShapeFeatureTypeEnum.Ellipse &&\n feature.geometry.type === 'Polygon'\n ) {\n ellipseProperties = computeEllipseProperties(feature);\n }\n\n // Create the styled feature\n const styledFeature: ShapeFeature = {\n type: 'Feature',\n geometry: feature.geometry,\n properties: {\n styleProperties,\n circleProperties,\n ellipseProperties,\n shapeId: id,\n },\n };\n\n // Type assertion needed because TypeScript can't narrow the return type\n // based on the runtime shape value. The constructed object satisfies\n // the Shape union at runtime based on which shape was passed in.\n return {\n id,\n name,\n shape,\n feature: styledFeature,\n lastUpdated: Date.now(),\n locked: false,\n } as Shape;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAS,UAAU;CACvB,SAAS,QAAQ,IAAI,aAAa;CAClC,OAAO;CACP,QAAQ;CACR,QAAQ;CACT,CAAC;;;;AAKF,SAAS,kBAAkB,OAAiC;AAE1D,QAAO,OAAO,MAAM,qBADF,IAAI,MAAM,EAAC,oBAAoB,CACf;;;;;;;;AASpC,SAAS,wBACP,UAC8B;CAC9B,MAAM,cAAc,SAAS,YAAY;AACzC,KAAI,CAAC,eAAe,YAAY,SAAS,GAAG;AAC1C,SAAO,KACL,yEACD;AACD;;CAQF,MAAM,SAJgB,SAAS;EAC7B,MAAM;EACN,aAAa,SAAS;EACvB,CAAC,CAC2B,SAAS;AAKtC,KAAI,EADF,OAAO,SAAS,OAAO,GAAG,IAAI,OAAO,SAAS,OAAO,GAAG,GACtC;AAClB,SAAO,KAAK,+DAA+D;AAC3E;;CAIF,MAAM,aAAa,YAAY;AAO/B,KAAI,EAHF,cACA,OAAO,SAAS,WAAW,GAAG,IAC9B,OAAO,SAAS,WAAW,GAAG,GACR;AACtB,SAAO,KACL,mEACD;AACD;;CAGF,MAAM,SAAS,SAAS,QAAQ,YAAY,EAC1C,OAAO,wBACR,CAAC;AAGF,KAAI,CAAC,OAAO,SAAS,OAAO,IAAI,UAAU,GAAG;AAC3C,SAAO,KAAK,4DAA4D;AACxE;;AAGF,QAAO;EACL;EACA,QAAQ;GACN,OAAO;GACP,OAAO;GACR;EACF;;;;;;;;AAoBH,SAAS,yBACP,SAC+B;CAC/B,MAAM,YACJ,QAAQ,YACP;AAEH,KAAI,CAAC,aAAa,UAAU,UAAU,WAAW;AAC/C,SAAO,KACL,sFACD;AACD;;AAGF,QAAO;EACL,QAAQ,UAAU;EAClB,WAAW;GACT,OAAO,UAAU,UAAU;GAC3B,OAAO;GACR;EACD,WAAW;GACT,OAAO,UAAU,UAAU;GAC3B,OAAO;GACR;EACD,OAAO,UAAU;EAClB;;;;;;;;;;;;;;;;;;AAmBH,SAAgB,sBACd,SACA,OACA,eACO;CACP,MAAM,KAAK,MAAM;CACjB,MAAM,OAAO,kBAAkB,MAAM;CAGrC,MAAMA,kBAAmC;EACvC,GAAG;EACH,GAAI,iBAAiB,EAAE;EACxB;CAGD,IAAIC;AACJ,KACE,UAAUC,iBAAqB,UAC/B,QAAQ,SAAS,SAAS,UAE1B,oBAAmB,wBAAwB,QAAQ,SAAS;CAI9D,IAAIC;AACJ,KACE,UAAUD,iBAAqB,WAC/B,QAAQ,SAAS,SAAS,UAE1B,qBAAoB,yBAAyB,QAAQ;AAkBvD,QAAO;EACL;EACA;EACA;EACA,SAlBkC;GAClC,MAAM;GACN,UAAU,QAAQ;GAClB,YAAY;IACV;IACA;IACA;IACA,SAAS;IACV;GACF;EAUC,aAAa,KAAK,KAAK;EACvB,QAAQ;EACT"}
@@ -0,0 +1,41 @@
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
+ 'use client';
15
+
16
+ import { COMPLETION_EDIT_TYPES, CONTINUOUS_EDIT_TYPES } from "../shared/constants.js";
17
+
18
+ //#region src/deckgl/shapes/edit-shape-layer/constants.ts
19
+ /**
20
+ * Mode name for the map-mode integration
21
+ */
22
+ const EDIT_SHAPE_MODE = "edit-shape";
23
+ /**
24
+ * Identifier for the edit shape layer.
25
+ * Used as the owner for map-mode/cursor and as the default layer ID.
26
+ */
27
+ const EDIT_SHAPE_LAYER_ID = "edit-shape-layer";
28
+ /**
29
+ * Cursor mapping for each edit mode
30
+ */
31
+ const EDIT_CURSOR_MAP = {
32
+ view: "default",
33
+ "bounding-transform": "crosshair",
34
+ "vertex-transform": "crosshair",
35
+ "circle-transform": "crosshair",
36
+ translate: "crosshair"
37
+ };
38
+
39
+ //#endregion
40
+ export { EDIT_CURSOR_MAP, EDIT_SHAPE_LAYER_ID, EDIT_SHAPE_MODE };
41
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["EDIT_CURSOR_MAP: Record<EditMode, CSSCursorType>"],"sources":["../../../../src/deckgl/shapes/edit-shape-layer/constants.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\n'use client';\n\nimport type { CSSCursorType } from '@/map-cursor/types';\nimport type { EditMode } from './types';\n\n// Re-export edit event type sets from shared constants\nexport {\n COMPLETION_EDIT_TYPES,\n CONTINUOUS_EDIT_TYPES,\n} from '../shared/constants';\n\n/**\n * Mode name for the map-mode integration\n */\nexport const EDIT_SHAPE_MODE = 'edit-shape';\n\n/**\n * Identifier for the edit shape layer.\n * Used as the owner for map-mode/cursor and as the default layer ID.\n */\nexport const EDIT_SHAPE_LAYER_ID = 'edit-shape-layer';\n\n/**\n * Cursor mapping for each edit mode\n */\nexport const EDIT_CURSOR_MAP: Record<EditMode, CSSCursorType> = {\n view: 'default',\n 'bounding-transform': 'crosshair',\n 'vertex-transform': 'crosshair',\n 'circle-transform': 'crosshair',\n translate: 'crosshair',\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,kBAAkB;;;;;AAM/B,MAAa,sBAAsB;;;;AAKnC,MAAaA,kBAAmD;CAC9D,MAAM;CACN,sBAAsB;CACtB,oBAAoB;CACpB,oBAAoB;CACpB,WAAW;CACZ"}
@@ -0,0 +1,92 @@
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 { Shape } from "../shared/types.js";
14
+ import { UniqueId } from "@accelint/core";
15
+
16
+ //#region src/deckgl/shapes/edit-shape-layer/events.d.ts
17
+ /**
18
+ * Edit shape lifecycle events
19
+ */
20
+ declare const EditShapeEvents: {
21
+ /** Editing has started for a shape */
22
+ readonly editing: "shapes:editing";
23
+ /** Shape has been successfully updated */
24
+ readonly updated: "shapes:updated";
25
+ /** Editing was canceled */
26
+ readonly canceled: "shapes:edit-canceled";
27
+ };
28
+ type EditShapeEventType = (typeof EditShapeEvents)[keyof typeof EditShapeEvents];
29
+ /**
30
+ * Payload for shapes:editing event.
31
+ */
32
+ type ShapeEditingPayload = {
33
+ /** The shape being edited */
34
+ shape: Shape;
35
+ /** Map instance ID for multi-map event isolation */
36
+ mapId: UniqueId;
37
+ };
38
+ /**
39
+ * Event payload for shapes:editing
40
+ * Emitted when editing starts
41
+ */
42
+ type ShapeEditingEvent = {
43
+ type: 'shapes:editing';
44
+ payload: ShapeEditingPayload;
45
+ source: UniqueId;
46
+ target?: UniqueId;
47
+ };
48
+ /**
49
+ * Payload for shapes:updated event.
50
+ */
51
+ type ShapeUpdatedPayload = {
52
+ /** The updated shape with new geometry */
53
+ shape: Shape;
54
+ /** Map instance ID for multi-map event isolation */
55
+ mapId: UniqueId;
56
+ };
57
+ /**
58
+ * Event payload for shapes:updated
59
+ * Emitted when shape edits are saved
60
+ */
61
+ type ShapeUpdatedEvent = {
62
+ type: 'shapes:updated';
63
+ payload: ShapeUpdatedPayload;
64
+ source: UniqueId;
65
+ target?: UniqueId;
66
+ };
67
+ /**
68
+ * Payload for shapes:edit-canceled event.
69
+ */
70
+ type ShapeEditCanceledPayload = {
71
+ /** The shape that was being edited (original, unchanged) */
72
+ shape: Shape;
73
+ /** Map instance ID for multi-map event isolation */
74
+ mapId: UniqueId;
75
+ };
76
+ /**
77
+ * Event payload for shapes:edit-canceled
78
+ * Emitted when editing is canceled
79
+ */
80
+ type ShapeEditCanceledEvent = {
81
+ type: 'shapes:edit-canceled';
82
+ payload: ShapeEditCanceledPayload;
83
+ source: UniqueId;
84
+ target?: UniqueId;
85
+ };
86
+ /**
87
+ * Union of all edit shape event types
88
+ */
89
+ type EditShapeEvent = ShapeEditingEvent | ShapeUpdatedEvent | ShapeEditCanceledEvent;
90
+ //#endregion
91
+ export { EditShapeEvent, EditShapeEventType, EditShapeEvents, ShapeEditCanceledEvent, ShapeEditCanceledPayload, ShapeEditingEvent, ShapeEditingPayload, ShapeUpdatedEvent, ShapeUpdatedPayload };
92
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1,56 @@
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
+ 'use client';
15
+
16
+ //#region src/deckgl/shapes/edit-shape-layer/events.ts
17
+ /**
18
+ * Edit Shape Events
19
+ *
20
+ * Note on event payload structure:
21
+ * These events define explicit payload types rather than using the `Payload<T, P>` helper
22
+ * from @accelint/bus. This is because the `Shape` type contains GeoJSON `Feature` objects
23
+ * from the `geojson` package, which don't satisfy TypeScript's `StructuredCloneable` type
24
+ * constraint used by the bus.
25
+ *
26
+ * The issue: `StructuredCloneable` (from type-fest) requires objects to have an index
27
+ * signature `[key: string]: StructuredCloneable`, but GeoJSON interfaces define strict
28
+ * property types without index signatures. At runtime, GeoJSON data IS structurally
29
+ * cloneable (can be passed through postMessage, stored in IndexedDB, etc.), but
30
+ * TypeScript can't verify this statically.
31
+ *
32
+ * Events that only contain primitive values (like ShapeId, mapId) can use the `Payload`
33
+ * helper directly - see shared/events.ts for examples.
34
+ *
35
+ * When emitting these events via the bus, use type assertions:
36
+ * @example
37
+ * ```ts
38
+ * bus.emit('shapes:updated', {
39
+ * type: 'shapes:updated',
40
+ * payload: { shape, mapId },
41
+ * source: componentId,
42
+ * } as unknown as Payload);
43
+ * ```
44
+ */
45
+ /**
46
+ * Edit shape lifecycle events
47
+ */
48
+ const EditShapeEvents = {
49
+ editing: "shapes:editing",
50
+ updated: "shapes:updated",
51
+ canceled: "shapes:edit-canceled"
52
+ };
53
+
54
+ //#endregion
55
+ export { EditShapeEvents };
56
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../../../src/deckgl/shapes/edit-shape-layer/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\n/**\n * Edit Shape Events\n *\n * Note on event payload structure:\n * These events define explicit payload types rather than using the `Payload<T, P>` helper\n * from @accelint/bus. This is because the `Shape` type contains GeoJSON `Feature` objects\n * from the `geojson` package, which don't satisfy TypeScript's `StructuredCloneable` type\n * constraint used by the bus.\n *\n * The issue: `StructuredCloneable` (from type-fest) requires objects to have an index\n * signature `[key: string]: StructuredCloneable`, but GeoJSON interfaces define strict\n * property types without index signatures. At runtime, GeoJSON data IS structurally\n * cloneable (can be passed through postMessage, stored in IndexedDB, etc.), but\n * TypeScript can't verify this statically.\n *\n * Events that only contain primitive values (like ShapeId, mapId) can use the `Payload`\n * helper directly - see shared/events.ts for examples.\n *\n * When emitting these events via the bus, use type assertions:\n * @example\n * ```ts\n * bus.emit('shapes:updated', {\n * type: 'shapes:updated',\n * payload: { shape, mapId },\n * source: componentId,\n * } as unknown as Payload);\n * ```\n */\n\n'use client';\n\nimport type { UniqueId } from '@accelint/core';\nimport type { Shape } from '../shared/types';\n\n/**\n * Edit shape lifecycle events\n */\nexport const EditShapeEvents = {\n /** Editing has started for a shape */\n editing: 'shapes:editing',\n /** Shape has been successfully updated */\n updated: 'shapes:updated',\n /** Editing was canceled */\n canceled: 'shapes:edit-canceled',\n} as const;\n\nexport type EditShapeEventType =\n (typeof EditShapeEvents)[keyof typeof EditShapeEvents];\n\n/**\n * Payload for shapes:editing event.\n */\nexport type ShapeEditingPayload = {\n /** The shape being edited */\n shape: Shape;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n};\n\n/**\n * Event payload for shapes:editing\n * Emitted when editing starts\n */\nexport type ShapeEditingEvent = {\n type: 'shapes:editing';\n payload: ShapeEditingPayload;\n source: UniqueId;\n target?: UniqueId;\n};\n\n/**\n * Payload for shapes:updated event.\n */\nexport type ShapeUpdatedPayload = {\n /** The updated shape with new geometry */\n shape: Shape;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n};\n\n/**\n * Event payload for shapes:updated\n * Emitted when shape edits are saved\n */\nexport type ShapeUpdatedEvent = {\n type: 'shapes:updated';\n payload: ShapeUpdatedPayload;\n source: UniqueId;\n target?: UniqueId;\n};\n\n/**\n * Payload for shapes:edit-canceled event.\n */\nexport type ShapeEditCanceledPayload = {\n /** The shape that was being edited (original, unchanged) */\n shape: Shape;\n /** Map instance ID for multi-map event isolation */\n mapId: UniqueId;\n};\n\n/**\n * Event payload for shapes:edit-canceled\n * Emitted when editing is canceled\n */\nexport type ShapeEditCanceledEvent = {\n type: 'shapes:edit-canceled';\n payload: ShapeEditCanceledPayload;\n source: UniqueId;\n target?: UniqueId;\n};\n\n/**\n * Union of all edit shape event types\n */\nexport type EditShapeEvent =\n | ShapeEditingEvent\n | ShapeUpdatedEvent\n | ShapeEditCanceledEvent;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,kBAAkB;CAE7B,SAAS;CAET,SAAS;CAET,UAAU;CACX"}
@@ -0,0 +1,13 @@
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 "../draw-shape-layer/fiber.js";
@@ -11,6 +11,4 @@
11
11
  */
12
12
 
13
13
 
14
- import "./web-mercator-utils.js";
15
- import "./fit-bounds.js";
16
- import "./get-bounds.js";
14
+ import "../draw-shape-layer/fiber.js";
@@ -0,0 +1,63 @@
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 { EditShapeLayerProps } from "./types.js";
14
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
15
+
16
+ //#region src/deckgl/shapes/edit-shape-layer/index.d.ts
17
+
18
+ /**
19
+ * EditShapeLayer - A React component for editing existing shapes on the map.
20
+ *
21
+ * This component wraps the EditableGeoJsonLayer from @deck.gl-community/editable-layers
22
+ * and integrates with the map-mode and map-cursor systems for proper coordination.
23
+ *
24
+ * Key features:
25
+ * - Renders only when actively editing (returns null otherwise)
26
+ * - Uses cached mode instances to prevent deck.gl assertion errors
27
+ * - Integrates with the editing store for state management
28
+ * - Neutral mode authorization (lets UI decide how to handle mode conflicts)
29
+ * - Circles use ResizeCircleMode with tooltip, other shapes use ModifyMode
30
+ * - Fill colors rendered at 20% opacity, edit handles are white
31
+ * - Live dimension/area tooltips during editing
32
+ * - requestAnimationFrame() batching for smooth drag performance
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * // Import the fiber registration for JSX support
37
+ * import '@accelint/map-toolkit/deckgl/shapes/edit-shape-layer/fiber';
38
+ * import '@accelint/map-toolkit/deckgl/shapes/display-shape-layer/fiber';
39
+ *
40
+ * function Map({ mapId }) {
41
+ * const { editingShape } = useEditShape(mapId);
42
+ *
43
+ * return (
44
+ * <BaseMap id={mapId}>
45
+ * <displayShapeLayer
46
+ * data={shapes}
47
+ * mapId={mapId}
48
+ * selectedShapeId={editingShape?.id}
49
+ * />
50
+ * <EditShapeLayer mapId={mapId} />
51
+ * </BaseMap>
52
+ * );
53
+ * }
54
+ * ```
55
+ */
56
+ declare function EditShapeLayer({
57
+ id,
58
+ mapId,
59
+ unit
60
+ }: EditShapeLayerProps): react_jsx_runtime3.JSX.Element | null;
61
+ //#endregion
62
+ export { EditShapeLayer };
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,162 @@
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
+ 'use client';
15
+
16
+ import { MapContext } from "../../base-map/provider.js";
17
+ import { COMPLETION_EDIT_TYPES, CONTINUOUS_EDIT_TYPES } from "../shared/constants.js";
18
+ import { getFillColor, getLineColor } from "../shared/utils/style-utils.js";
19
+ import { ShapeFeatureType } from "../shared/types.js";
20
+ import { useShiftZoomDisable } from "../shared/hooks/use-shift-zoom-disable.js";
21
+ import { getDefaultEditableLayerProps } from "../shared/utils/layer-config.js";
22
+ import { EDIT_SHAPE_LAYER_ID } from "./constants.js";
23
+ import { getEditModeInstance } from "./modes/index.js";
24
+ import { cancelEditingFromLayer, editStore, updateFeatureFromLayer } from "./store.js";
25
+ import { useContext, useEffect, useRef } from "react";
26
+ import { jsx } from "react/jsx-runtime";
27
+
28
+ //#region src/deckgl/shapes/edit-shape-layer/index.tsx
29
+ function isContinuousEditType(editType) {
30
+ return CONTINUOUS_EDIT_TYPES.has(editType);
31
+ }
32
+ function isCompletionEditType(editType) {
33
+ return COMPLETION_EDIT_TYPES.has(editType);
34
+ }
35
+ /**
36
+ * Convert a GeoJSON Feature to a FeatureCollection for EditableGeoJsonLayer.
37
+ * The editable-layers library accepts standard GeoJSON FeatureCollection at runtime,
38
+ * but has stricter internal types. We use the geojson types which are compatible.
39
+ *
40
+ * For circles, adds the `shape: 'Circle'` property required by ResizeCircleMode.
41
+ * ResizeCircleMode checks `properties.shape.includes('Circle')` to identify circles.
42
+ *
43
+ * For rectangles, adds the `shape: 'Rectangle'` property required by ModifyMode's
44
+ * lockRectangles feature. ModifyMode checks `properties.shape === 'Rectangle'`.
45
+ */
46
+ function toFeatureCollection(feature, shape) {
47
+ let shapeProperty;
48
+ if (shape === ShapeFeatureType.Circle) shapeProperty = "Circle";
49
+ else if (shape === ShapeFeatureType.Rectangle) shapeProperty = "Rectangle";
50
+ return {
51
+ type: "FeatureCollection",
52
+ features: [shapeProperty ? {
53
+ ...feature,
54
+ properties: {
55
+ ...feature.properties,
56
+ shape: shapeProperty
57
+ }
58
+ } : feature]
59
+ };
60
+ }
61
+ /**
62
+ * EditShapeLayer - A React component for editing existing shapes on the map.
63
+ *
64
+ * This component wraps the EditableGeoJsonLayer from @deck.gl-community/editable-layers
65
+ * and integrates with the map-mode and map-cursor systems for proper coordination.
66
+ *
67
+ * Key features:
68
+ * - Renders only when actively editing (returns null otherwise)
69
+ * - Uses cached mode instances to prevent deck.gl assertion errors
70
+ * - Integrates with the editing store for state management
71
+ * - Neutral mode authorization (lets UI decide how to handle mode conflicts)
72
+ * - Circles use ResizeCircleMode with tooltip, other shapes use ModifyMode
73
+ * - Fill colors rendered at 20% opacity, edit handles are white
74
+ * - Live dimension/area tooltips during editing
75
+ * - requestAnimationFrame() batching for smooth drag performance
76
+ *
77
+ * @example
78
+ * ```tsx
79
+ * // Import the fiber registration for JSX support
80
+ * import '@accelint/map-toolkit/deckgl/shapes/edit-shape-layer/fiber';
81
+ * import '@accelint/map-toolkit/deckgl/shapes/display-shape-layer/fiber';
82
+ *
83
+ * function Map({ mapId }) {
84
+ * const { editingShape } = useEditShape(mapId);
85
+ *
86
+ * return (
87
+ * <BaseMap id={mapId}>
88
+ * <displayShapeLayer
89
+ * data={shapes}
90
+ * mapId={mapId}
91
+ * selectedShapeId={editingShape?.id}
92
+ * />
93
+ * <EditShapeLayer mapId={mapId} />
94
+ * </BaseMap>
95
+ * );
96
+ * }
97
+ * ```
98
+ */
99
+ function EditShapeLayer({ id = EDIT_SHAPE_LAYER_ID, mapId, unit }) {
100
+ const contextId = useContext(MapContext);
101
+ const actualMapId = mapId ?? contextId;
102
+ if (!actualMapId) throw new Error("EditShapeLayer requires either a mapId prop or to be used within a MapProvider");
103
+ const { state: editingState } = editStore.use(actualMapId);
104
+ useShiftZoomDisable(actualMapId, editingState?.editingShape != null);
105
+ const pendingUpdateRef = useRef(null);
106
+ useEffect(() => {
107
+ return () => {
108
+ if (pendingUpdateRef.current) cancelAnimationFrame(pendingUpdateRef.current.rafId);
109
+ };
110
+ }, []);
111
+ if (!editingState?.editingShape) return null;
112
+ const { editingShape, editMode, featureBeingEdited } = editingState;
113
+ const mode = getEditModeInstance(editMode);
114
+ const data = toFeatureCollection(featureBeingEdited ?? editingShape.feature, editingShape.shape);
115
+ const cancelPendingUpdate = () => {
116
+ if (pendingUpdateRef.current) {
117
+ cancelAnimationFrame(pendingUpdateRef.current.rafId);
118
+ pendingUpdateRef.current = null;
119
+ }
120
+ };
121
+ const handleEdit = ({ updatedData, editType }) => {
122
+ const feature = updatedData.features[0];
123
+ if (isContinuousEditType(editType) && feature) {
124
+ cancelPendingUpdate();
125
+ pendingUpdateRef.current = {
126
+ feature,
127
+ rafId: requestAnimationFrame(() => {
128
+ updateFeatureFromLayer(actualMapId, feature);
129
+ pendingUpdateRef.current = null;
130
+ })
131
+ };
132
+ return;
133
+ }
134
+ if (isCompletionEditType(editType)) {
135
+ cancelPendingUpdate();
136
+ if (feature) updateFeatureFromLayer(actualMapId, feature);
137
+ return;
138
+ }
139
+ if (editType === "cancelFeature") {
140
+ cancelPendingUpdate();
141
+ cancelEditingFromLayer(actualMapId);
142
+ }
143
+ };
144
+ const fillColor = getFillColor(editingShape.feature, true);
145
+ const lineColor = getLineColor(editingShape.feature);
146
+ return /* @__PURE__ */ jsx("editableGeoJsonLayer", {
147
+ id,
148
+ data,
149
+ mode,
150
+ selectedFeatureIndexes: [0],
151
+ onEdit: handleEdit,
152
+ getFillColor: fillColor,
153
+ getLineColor: lineColor,
154
+ getTentativeFillColor: fillColor,
155
+ getTentativeLineColor: lineColor,
156
+ ...getDefaultEditableLayerProps(unit)
157
+ });
158
+ }
159
+
160
+ //#endregion
161
+ export { EditShapeLayer };
162
+ //# sourceMappingURL=index.js.map