@accelint/map-toolkit 0.6.0 → 1.1.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 (207) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/catalog-info.yaml +7 -6
  3. package/dist/camera/events.js.map +1 -1
  4. package/dist/camera/index.d.ts +2 -2
  5. package/dist/camera/index.js +2 -2
  6. package/dist/camera/store.d.ts +120 -0
  7. package/dist/camera/store.js +279 -0
  8. package/dist/camera/store.js.map +1 -0
  9. package/dist/cursor-coordinates/index.d.ts +4 -2
  10. package/dist/cursor-coordinates/index.js +3 -2
  11. package/dist/cursor-coordinates/store.d.ts +48 -0
  12. package/dist/cursor-coordinates/store.js +92 -0
  13. package/dist/cursor-coordinates/store.js.map +1 -0
  14. package/dist/cursor-coordinates/types.d.ts +87 -0
  15. package/dist/cursor-coordinates/types.js +12 -0
  16. package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +41 -37
  17. package/dist/cursor-coordinates/use-cursor-coordinates.js +131 -202
  18. package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -1
  19. package/dist/deckgl/base-map/constants.d.ts +1 -6
  20. package/dist/deckgl/base-map/constants.js +1 -6
  21. package/dist/deckgl/base-map/constants.js.map +1 -1
  22. package/dist/deckgl/base-map/controls.js +2 -0
  23. package/dist/deckgl/base-map/controls.js.map +1 -1
  24. package/dist/deckgl/base-map/events.js.map +1 -1
  25. package/dist/deckgl/base-map/index.d.ts +2 -2
  26. package/dist/deckgl/base-map/index.js +10 -11
  27. package/dist/deckgl/base-map/index.js.map +1 -1
  28. package/dist/deckgl/base-map/provider.d.ts +2 -2
  29. package/dist/deckgl/base-map/provider.js +1 -1
  30. package/dist/deckgl/base-map/provider.js.map +1 -1
  31. package/dist/deckgl/index.d.ts +4 -4
  32. package/dist/deckgl/index.js +4 -4
  33. package/dist/deckgl/saved-viewports/index.js.map +1 -1
  34. package/dist/deckgl/saved-viewports/storage.js +10 -2
  35. package/dist/deckgl/saved-viewports/storage.js.map +1 -1
  36. package/dist/deckgl/shapes/display-shape-layer/constants.js +5 -8
  37. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
  38. package/dist/deckgl/shapes/display-shape-layer/fiber.js.map +1 -1
  39. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +18 -14
  40. package/dist/deckgl/shapes/display-shape-layer/index.js +63 -30
  41. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -1
  42. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +2 -16
  43. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js.map +1 -1
  44. package/dist/deckgl/shapes/display-shape-layer/store.js +58 -272
  45. package/dist/deckgl/shapes/display-shape-layer/store.js.map +1 -1
  46. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +22 -11
  47. package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.d.ts → use-select-shape.d.ts} +9 -9
  48. package/dist/deckgl/shapes/display-shape-layer/{use-shape-selection.js → use-select-shape.js} +12 -12
  49. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js.map +1 -0
  50. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +5 -66
  51. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
  52. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +2 -65
  53. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +3 -121
  54. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
  55. package/dist/deckgl/shapes/draw-shape-layer/constants.js +46 -0
  56. package/dist/deckgl/shapes/draw-shape-layer/constants.js.map +1 -0
  57. package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +92 -0
  58. package/dist/deckgl/shapes/draw-shape-layer/events.js +56 -0
  59. package/dist/deckgl/shapes/draw-shape-layer/events.js.map +1 -0
  60. package/dist/deckgl/shapes/draw-shape-layer/fiber.d.ts +11 -0
  61. package/dist/{maplibre/constants.js → deckgl/shapes/draw-shape-layer/fiber.js} +6 -12
  62. package/dist/deckgl/shapes/draw-shape-layer/fiber.js.map +1 -0
  63. package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +53 -0
  64. package/dist/deckgl/shapes/draw-shape-layer/index.js +95 -0
  65. package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -0
  66. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +51 -0
  67. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -0
  68. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +73 -0
  69. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -0
  70. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +87 -0
  71. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -0
  72. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +88 -0
  73. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -0
  74. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +77 -0
  75. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -0
  76. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +64 -0
  77. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -0
  78. package/dist/deckgl/shapes/draw-shape-layer/store.js +175 -0
  79. package/dist/deckgl/shapes/draw-shape-layer/store.js.map +1 -0
  80. package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +86 -0
  81. package/dist/{viewport/constants.js → deckgl/shapes/draw-shape-layer/types.js} +1 -12
  82. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +82 -0
  83. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +112 -0
  84. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js.map +1 -0
  85. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +147 -0
  86. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -0
  87. package/dist/deckgl/shapes/edit-shape-layer/constants.js +41 -0
  88. package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -0
  89. package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +92 -0
  90. package/dist/deckgl/shapes/edit-shape-layer/events.js +56 -0
  91. package/dist/deckgl/shapes/edit-shape-layer/events.js.map +1 -0
  92. package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +13 -0
  93. package/dist/deckgl/shapes/edit-shape-layer/fiber.js +14 -0
  94. package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +63 -0
  95. package/dist/deckgl/shapes/edit-shape-layer/index.js +162 -0
  96. package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -0
  97. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +154 -0
  98. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -0
  99. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +147 -0
  100. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -0
  101. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +87 -0
  102. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -0
  103. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +61 -0
  104. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js.map +1 -0
  105. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +109 -0
  106. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -0
  107. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +289 -0
  108. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -0
  109. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +121 -0
  110. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -0
  111. package/dist/deckgl/shapes/edit-shape-layer/store.js +194 -0
  112. package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -0
  113. package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +93 -0
  114. package/dist/deckgl/shapes/edit-shape-layer/types.js +14 -0
  115. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +82 -0
  116. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +114 -0
  117. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js.map +1 -0
  118. package/dist/deckgl/shapes/index.d.ts +15 -6
  119. package/dist/deckgl/shapes/index.js +12 -5
  120. package/dist/deckgl/shapes/shared/constants.d.ts +27 -32
  121. package/dist/deckgl/shapes/shared/constants.js +189 -25
  122. package/dist/deckgl/shapes/shared/constants.js.map +1 -1
  123. package/dist/deckgl/shapes/shared/events.d.ts +1 -20
  124. package/dist/deckgl/shapes/shared/events.js +1 -31
  125. package/dist/deckgl/shapes/shared/events.js.map +1 -1
  126. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +84 -0
  127. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -0
  128. package/dist/deckgl/shapes/shared/types.d.ts +187 -28
  129. package/dist/deckgl/shapes/shared/types.js +55 -1
  130. package/dist/deckgl/shapes/shared/types.js.map +1 -1
  131. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +128 -0
  132. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -0
  133. package/dist/deckgl/shapes/shared/utils/layer-config.js +50 -0
  134. package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -0
  135. package/dist/deckgl/shapes/shared/utils/mode-utils.js +113 -0
  136. package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -0
  137. package/dist/deckgl/shapes/shared/utils/pick-filtering.js +57 -0
  138. package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -0
  139. package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +64 -0
  140. package/dist/deckgl/shapes/shared/utils/style-utils.js +101 -0
  141. package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -0
  142. package/dist/deckgl/symbol-layer/fiber.js.map +1 -1
  143. package/dist/deckgl/symbol-layer/index.js.map +1 -1
  144. package/dist/deckgl/text-layer/character-sets.js.map +1 -1
  145. package/dist/deckgl/text-layer/default-settings.js +4 -24
  146. package/dist/deckgl/text-layer/default-settings.js.map +1 -1
  147. package/dist/deckgl/text-layer/fiber.js.map +1 -1
  148. package/dist/deckgl/text-layer/index.js.map +1 -1
  149. package/dist/deckgl/text-settings.d.ts +77 -0
  150. package/dist/deckgl/text-settings.js +83 -0
  151. package/dist/deckgl/text-settings.js.map +1 -0
  152. package/dist/map-cursor/events.js.map +1 -1
  153. package/dist/map-cursor/index.d.ts +2 -2
  154. package/dist/map-cursor/index.js +2 -2
  155. package/dist/map-cursor/store.d.ts +32 -61
  156. package/dist/map-cursor/store.js +165 -294
  157. package/dist/map-cursor/store.js.map +1 -1
  158. package/dist/map-cursor/use-map-cursor.d.ts +5 -2
  159. package/dist/map-cursor/use-map-cursor.js +33 -15
  160. package/dist/map-cursor/use-map-cursor.js.map +1 -1
  161. package/dist/map-mode/events.js.map +1 -1
  162. package/dist/map-mode/index.d.ts +2 -2
  163. package/dist/map-mode/index.js +2 -2
  164. package/dist/map-mode/store.d.ts +36 -37
  165. package/dist/map-mode/store.js +131 -237
  166. package/dist/map-mode/store.js.map +1 -1
  167. package/dist/map-mode/use-map-mode.js +6 -5
  168. package/dist/map-mode/use-map-mode.js.map +1 -1
  169. package/dist/maplibre/hooks/use-maplibre.js.map +1 -1
  170. package/dist/maplibre/index.d.ts +2 -2
  171. package/dist/maplibre/index.js +2 -2
  172. package/dist/shared/constants.d.ts +19 -0
  173. package/dist/shared/constants.js +33 -0
  174. package/dist/shared/constants.js.map +1 -0
  175. package/dist/shared/create-map-store.d.ts +202 -0
  176. package/dist/shared/create-map-store.js +223 -0
  177. package/dist/shared/create-map-store.js.map +1 -0
  178. package/dist/shared/units.d.ts +39 -0
  179. package/dist/shared/units.js +49 -0
  180. package/dist/shared/units.js.map +1 -0
  181. package/dist/viewport/index.d.ts +3 -3
  182. package/dist/viewport/index.js +3 -3
  183. package/dist/viewport/store.d.ts +69 -0
  184. package/dist/viewport/store.js +125 -0
  185. package/dist/viewport/store.js.map +1 -0
  186. package/dist/viewport/types.d.ts +2 -2
  187. package/dist/viewport/utils.js +2 -2
  188. package/dist/viewport/utils.js.map +1 -1
  189. package/dist/viewport/viewport-size.d.ts +2 -2
  190. package/dist/viewport/viewport-size.js +2 -2
  191. package/dist/viewport/viewport-size.js.map +1 -1
  192. package/package.json +39 -19
  193. package/dist/camera/use-camera-state.d.ts +0 -153
  194. package/dist/camera/use-camera-state.js +0 -418
  195. package/dist/camera/use-camera-state.js.map +0 -1
  196. package/dist/deckgl/shapes/display-shape-layer/constants.d.ts +0 -44
  197. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.d.ts +0 -66
  198. package/dist/deckgl/shapes/display-shape-layer/store.d.ts +0 -87
  199. package/dist/deckgl/shapes/display-shape-layer/use-shape-selection.js.map +0 -1
  200. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.d.ts +0 -61
  201. package/dist/maplibre/constants.d.ts +0 -13
  202. package/dist/maplibre/constants.js.map +0 -1
  203. package/dist/viewport/constants.d.ts +0 -11
  204. package/dist/viewport/constants.js.map +0 -1
  205. package/dist/viewport/use-viewport-state.d.ts +0 -100
  206. package/dist/viewport/use-viewport-state.js +0 -222
  207. package/dist/viewport/use-viewport-state.js.map +0 -1
@@ -0,0 +1,83 @@
1
+ /*
2
+ * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+
14
+ //#region src/deckgl/text-settings.ts
15
+ /**
16
+ * Shared font settings for SDF (Signed Distance Field) text rendering.
17
+ *
18
+ * These settings are optimized for cross-platform legibility, particularly
19
+ * on Windows machines where text can appear thin/hard to read without
20
+ * proper SDF configuration.
21
+ *
22
+ * Used by:
23
+ * - TextLayer component
24
+ * - Shape label layers
25
+ * - Draw/edit mode tooltips
26
+ */
27
+ const SDF_FONT_SETTINGS = {
28
+ fontSize: 22,
29
+ sdf: true,
30
+ buffer: 10,
31
+ cutoff: .19,
32
+ radius: 10,
33
+ smoothing: .1
34
+ };
35
+ /**
36
+ * Default text size in pixels for deck.gl TextLayer.
37
+ * Works in conjunction with SDF_FONT_SETTINGS for proper rendering.
38
+ */
39
+ const DEFAULT_TEXT_SIZE = 12;
40
+ /**
41
+ * Default text color (white) for deck.gl TextLayer.
42
+ */
43
+ const DEFAULT_TEXT_COLOR = [
44
+ 255,
45
+ 255,
46
+ 255,
47
+ 255
48
+ ];
49
+ /**
50
+ * Default text outline color (black) for deck.gl TextLayer.
51
+ */
52
+ const DEFAULT_TEXT_OUTLINE_COLOR = [
53
+ 0,
54
+ 0,
55
+ 0,
56
+ 255
57
+ ];
58
+ /**
59
+ * Default text outline width in pixels for deck.gl TextLayer.
60
+ */
61
+ const DEFAULT_TEXT_OUTLINE_WIDTH = 2;
62
+ /**
63
+ * Default font weight for deck.gl TextLayer.
64
+ */
65
+ const DEFAULT_FONT_WEIGHT = 500;
66
+ /**
67
+ * Combined default text style settings for deck.gl TextLayer.
68
+ * Spread this object into TextLayer props for consistent cross-platform rendering.
69
+ *
70
+ * Includes: fontSettings, fontWeight, getSize, getColor, outlineWidth, outlineColor
71
+ */
72
+ const DEFAULT_TEXT_STYLE = {
73
+ fontSettings: { ...SDF_FONT_SETTINGS },
74
+ fontWeight: DEFAULT_FONT_WEIGHT,
75
+ getSize: DEFAULT_TEXT_SIZE,
76
+ getColor: DEFAULT_TEXT_COLOR,
77
+ outlineWidth: DEFAULT_TEXT_OUTLINE_WIDTH,
78
+ outlineColor: DEFAULT_TEXT_OUTLINE_COLOR
79
+ };
80
+
81
+ //#endregion
82
+ export { DEFAULT_FONT_WEIGHT, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_OUTLINE_COLOR, DEFAULT_TEXT_OUTLINE_WIDTH, DEFAULT_TEXT_SIZE, DEFAULT_TEXT_STYLE, SDF_FONT_SETTINGS };
83
+ //# sourceMappingURL=text-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-settings.js","names":["SDF_FONT_SETTINGS: NonNullable<TextLayerProps['fontSettings']>","DEFAULT_TEXT_COLOR: Color","DEFAULT_TEXT_OUTLINE_COLOR: Color"],"sources":["../../src/deckgl/text-settings.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\nimport type { Color } from '@deck.gl/core';\nimport type { TextLayerProps } from '@deck.gl/layers';\n\n/**\n * Shared font settings for SDF (Signed Distance Field) text rendering.\n *\n * These settings are optimized for cross-platform legibility, particularly\n * on Windows machines where text can appear thin/hard to read without\n * proper SDF configuration.\n *\n * Used by:\n * - TextLayer component\n * - Shape label layers\n * - Draw/edit mode tooltips\n */\nexport const SDF_FONT_SETTINGS: NonNullable<TextLayerProps['fontSettings']> = {\n fontSize: 22,\n sdf: true,\n buffer: 10,\n cutoff: 0.19,\n radius: 10,\n smoothing: 0.1,\n};\n\n/**\n * Default text size in pixels for deck.gl TextLayer.\n * Works in conjunction with SDF_FONT_SETTINGS for proper rendering.\n */\nexport const DEFAULT_TEXT_SIZE = 12;\n\n/**\n * Default text color (white) for deck.gl TextLayer.\n */\nexport const DEFAULT_TEXT_COLOR: Color = [255, 255, 255, 255];\n\n/**\n * Default text outline color (black) for deck.gl TextLayer.\n */\nexport const DEFAULT_TEXT_OUTLINE_COLOR: Color = [0, 0, 0, 255];\n\n/**\n * Default text outline width in pixels for deck.gl TextLayer.\n */\nexport const DEFAULT_TEXT_OUTLINE_WIDTH = 2;\n\n/**\n * Default font weight for deck.gl TextLayer.\n */\nexport const DEFAULT_FONT_WEIGHT = 500;\n\n/**\n * Combined default text style settings for deck.gl TextLayer.\n * Spread this object into TextLayer props for consistent cross-platform rendering.\n *\n * Includes: fontSettings, fontWeight, getSize, getColor, outlineWidth, outlineColor\n */\nexport const DEFAULT_TEXT_STYLE = {\n fontSettings: { ...SDF_FONT_SETTINGS },\n fontWeight: DEFAULT_FONT_WEIGHT,\n getSize: DEFAULT_TEXT_SIZE,\n getColor: DEFAULT_TEXT_COLOR,\n outlineWidth: DEFAULT_TEXT_OUTLINE_WIDTH,\n outlineColor: DEFAULT_TEXT_OUTLINE_COLOR,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAaA,oBAAiE;CAC5E,UAAU;CACV,KAAK;CACL,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,WAAW;CACZ;;;;;AAMD,MAAa,oBAAoB;;;;AAKjC,MAAaC,qBAA4B;CAAC;CAAK;CAAK;CAAK;CAAI;;;;AAK7D,MAAaC,6BAAoC;CAAC;CAAG;CAAG;CAAG;CAAI;;;;AAK/D,MAAa,6BAA6B;;;;AAK1C,MAAa,sBAAsB;;;;;;;AAQnC,MAAa,qBAAqB;CAChC,cAAc,EAAE,GAAG,mBAAmB;CACtC,YAAY;CACZ,SAAS;CACT,UAAU;CACV,cAAc;CACd,cAAc;CACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../../src/map-cursor/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 * Event keys for map cursor state changes.\n * These events are used for communication between cursor stores and consumers.\n */\nexport const MapCursorEvents = {\n /** Emitted when a component requests a cursor change */\n changeRequest: 'cursor:change-request',\n /** Emitted when the cursor has been changed */\n changed: 'cursor:changed',\n /** Emitted when a cursor change request is rejected */\n rejected: 'cursor:rejected',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;CAE7B,eAAe;CAEf,SAAS;CAET,UAAU;CACX"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../src/map-cursor/events.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/**\n * Event keys for map cursor state changes.\n * These events are used for communication between cursor stores and consumers.\n */\nexport const MapCursorEvents = {\n /** Emitted when a component requests a cursor change */\n changeRequest: 'cursor:change-request',\n /** Emitted when the cursor has been changed */\n changed: 'cursor:changed',\n /** Emitted when a cursor change request is rejected */\n rejected: 'cursor:rejected',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB;CAE7B,eAAe;CAEf,SAAS;CAET,UAAU;CACX"}
@@ -12,6 +12,6 @@
12
12
 
13
13
  import { MapCursorEvents } from "./events.js";
14
14
  import { CSSCursorType, CursorChangeRequestEvent, CursorChangedEvent, CursorRejectedEvent, MapCursorEventType } from "./types.js";
15
- import { destroyStore, getOrCreateStore } from "./store.js";
15
+ import { clearCursorState, cursorStore, getCursor } from "./store.js";
16
16
  import { UseMapCursorReturn, useMapCursor, useMapCursorEffect } from "./use-map-cursor.js";
17
- export { type CSSCursorType, type CursorChangeRequestEvent, type CursorChangedEvent, type CursorRejectedEvent, type MapCursorEventType, MapCursorEvents, type UseMapCursorReturn, destroyStore, getOrCreateStore, useMapCursor, useMapCursorEffect };
17
+ export { type CSSCursorType, type CursorChangeRequestEvent, type CursorChangedEvent, type CursorRejectedEvent, type MapCursorEventType, MapCursorEvents, type UseMapCursorReturn, clearCursorState, cursorStore, getCursor, useMapCursor, useMapCursorEffect };
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
  import { MapCursorEvents } from "./events.js";
15
- import { destroyStore, getOrCreateStore } from "./store.js";
15
+ import { clearCursorState, cursorStore, getCursor } from "./store.js";
16
16
  import { useMapCursor, useMapCursorEffect } from "./use-map-cursor.js";
17
17
 
18
- export { MapCursorEvents, destroyStore, getOrCreateStore, useMapCursor, useMapCursorEffect };
18
+ export { MapCursorEvents, clearCursorState, cursorStore, getCursor, useMapCursor, useMapCursorEffect };
@@ -10,84 +10,55 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
+ import { MapStore } from "../shared/create-map-store.js";
13
14
  import { CSSCursorType } from "./types.js";
14
15
  import { UniqueId } from "@accelint/core";
15
16
 
16
17
  //#region src/map-cursor/store.d.ts
17
18
  /**
18
- * Creates or retrieves a cached subscription function for a given instanceId.
19
- * Uses a fan-out pattern: 1 bus listener -> N React subscribers.
20
- * Automatically cleans up cursor state when the last subscriber unsubscribes.
21
- *
22
- * @param instanceId - The unique identifier for the map cursor instance
23
- * @returns A subscription function for useSyncExternalStore
19
+ * State shape for map cursor
24
20
  */
25
- declare function getOrCreateSubscription(instanceId: UniqueId): (onStoreChange: () => void) => () => void;
21
+ type CursorState = {
22
+ /** Map of owner -> cursor */
23
+ cursorOwners: Map<string, CSSCursorType>;
24
+ /** Current active cursor (for priority tracking) */
25
+ currentCursor: CSSCursorType | null;
26
+ /** Current cursor owner (for priority tracking) */
27
+ currentOwner: string | null;
28
+ };
26
29
  /**
27
- * Creates or retrieves a cached snapshot function for a given instanceId.
28
- * The cursor returned gets equality checked, so it needs to be stable or React re-renders unnecessarily.
29
- *
30
- * @param instanceId - The unique identifier for the map cursor instance
31
- * @returns A snapshot function for useSyncExternalStore
30
+ * Actions for cursor management
32
31
  */
33
- declare function getOrCreateSnapshot(instanceId: UniqueId): () => CSSCursorType;
32
+ type CursorActions = {
33
+ /** Request a cursor change */
34
+ requestCursorChange: (cursor: CSSCursorType, owner: string) => void;
35
+ /** Clear cursor for an owner */
36
+ clearCursor: (owner: string) => void;
37
+ };
34
38
  /**
35
- * Creates or retrieves a cached server snapshot function for a given instanceId.
36
- * Server snapshots always return the default cursor since cursor state is client-only.
37
- * Required for SSR/RSC compatibility with useSyncExternalStore.
38
- *
39
- * @param instanceId - The unique identifier for the map cursor instance
40
- * @returns A server snapshot function for useSyncExternalStore
39
+ * Cursor store
41
40
  */
42
- declare function getOrCreateServerSnapshot(instanceId: UniqueId): () => CSSCursorType;
41
+ declare const cursorStore: MapStore<CursorState, CursorActions>;
43
42
  /**
44
- * Creates or retrieves a cached requestCursorChange function for a given instanceId.
45
- * This maintains referential stability for the function reference.
46
- *
47
- * @param instanceId - The unique identifier for the map cursor instance
48
- * @returns A requestCursorChange function for this instance
43
+ * Get effective cursor (computed from state)
49
44
  */
50
- declare function getOrCreateRequestCursorChange(instanceId: UniqueId): (cursor: CSSCursorType, owner: string) => void;
45
+ declare function getCursor(mapId: UniqueId): CSSCursorType;
51
46
  /**
52
- * Creates or retrieves a cached clearCursor function for a given instanceId.
53
- * This maintains referential stability for the function reference.
47
+ * Hook for effective cursor value.
54
48
  *
55
- * @param instanceId - The unique identifier for the map cursor instance
56
- * @returns A clearCursor function for this instance
57
- */
58
- declare function getOrCreateClearCursor(instanceId: UniqueId): (owner: string) => void;
59
- /**
60
- * Get the current cursor for a given instance (direct access, not reactive).
61
- * @internal - For internal map-toolkit use only
49
+ * **Internal use only** - not exported from the public API.
50
+ * Use `useMapCursor` instead, which provides:
51
+ * - MapContext integration (auto-resolves mapId inside MapProvider)
52
+ * - Actions (requestCursorChange, clearCursor)
53
+ * - Better ergonomics for consumers
62
54
  *
63
- * @param instanceId - The unique identifier for the map instance
64
- * @returns The current cursor
55
+ * This hook exists for internal composition (used by useMapCursor).
65
56
  */
66
- declare function getCursor(instanceId: UniqueId): CSSCursorType;
57
+ declare function useCursor(mapId: UniqueId): CSSCursorType;
67
58
  /**
68
- * Manually clear all cursor state for a specific instanceId.
69
- * This is typically not needed as cleanup happens automatically when all subscribers unmount.
70
- * Use this only in advanced scenarios where manual cleanup is required.
71
- *
72
- * @param instanceId - The unique identifier for the map cursor instance to clear
73
- *
74
- * @example
75
- * ```tsx
76
- * // Manual cleanup (rarely needed)
77
- * clearCursorState('my-map-instance');
78
- * ```
59
+ * Clear cursor state
79
60
  */
80
- declare function clearCursorState(instanceId: UniqueId): void;
81
- /** @deprecated Use module functions directly */
82
- declare function getOrCreateStore(id: UniqueId): {
83
- getSnapshot: () => CSSCursorType;
84
- };
85
- /** @deprecated Use clearCursorState instead */
86
- declare function destroyStore(id: UniqueId): void;
87
- /** @deprecated Use direct function calls instead */
88
- declare function getStore(id: UniqueId): {
89
- getSnapshot: () => CSSCursorType;
90
- } | undefined;
61
+ declare function clearCursorState(mapId: UniqueId): void;
91
62
  //#endregion
92
- export { clearCursorState, destroyStore, getCursor, getOrCreateClearCursor, getOrCreateRequestCursorChange, getOrCreateServerSnapshot, getOrCreateSnapshot, getOrCreateStore, getOrCreateSubscription, getStore };
63
+ export { clearCursorState, cursorStore, getCursor, useCursor };
93
64
  //# sourceMappingURL=store.d.ts.map