@accelint/map-toolkit 1.5.0 → 3.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 (224) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +8 -1
  3. package/catalog-info.yaml +9 -6
  4. package/dist/camera/events.js +1 -1
  5. package/dist/camera/index.d.ts +1 -1
  6. package/dist/camera/index.js +1 -1
  7. package/dist/camera/store.d.ts +1 -1
  8. package/dist/camera/store.js +3 -5
  9. package/dist/camera/store.js.map +1 -1
  10. package/dist/camera/types.d.ts +1 -1
  11. package/dist/camera/types.js +1 -1
  12. package/dist/cursor-coordinates/constants.js +1 -1
  13. package/dist/cursor-coordinates/index.d.ts +1 -1
  14. package/dist/cursor-coordinates/index.js +1 -1
  15. package/dist/cursor-coordinates/store.d.ts +1 -1
  16. package/dist/cursor-coordinates/store.js +1 -1
  17. package/dist/cursor-coordinates/types.d.ts +1 -1
  18. package/dist/cursor-coordinates/types.js +1 -1
  19. package/dist/cursor-coordinates/use-cursor-coordinates.d.ts +1 -1
  20. package/dist/cursor-coordinates/use-cursor-coordinates.js +4 -9
  21. package/dist/cursor-coordinates/use-cursor-coordinates.js.map +1 -1
  22. package/dist/deckgl/base-map/constants.js +1 -1
  23. package/dist/deckgl/base-map/controls.d.ts +1 -1
  24. package/dist/deckgl/base-map/controls.js +1 -1
  25. package/dist/deckgl/base-map/events.js +1 -1
  26. package/dist/deckgl/base-map/index.d.ts +3 -3
  27. package/dist/deckgl/base-map/index.js +1 -1
  28. package/dist/deckgl/base-map/provider.d.ts +1 -1
  29. package/dist/deckgl/base-map/provider.js +1 -1
  30. package/dist/deckgl/base-map/types.d.ts +1 -1
  31. package/dist/deckgl/base-map/types.js +1 -1
  32. package/dist/deckgl/extensions/coffin-corner/coffin-corner-extension.d.ts +144 -0
  33. package/dist/deckgl/extensions/coffin-corner/coffin-corner-extension.js +535 -0
  34. package/dist/deckgl/extensions/coffin-corner/coffin-corner-extension.js.map +1 -0
  35. package/dist/deckgl/extensions/coffin-corner/index.d.ts +17 -0
  36. package/dist/deckgl/extensions/coffin-corner/index.js +19 -0
  37. package/dist/deckgl/extensions/coffin-corner/store.d.ts +96 -0
  38. package/dist/deckgl/extensions/coffin-corner/store.js +173 -0
  39. package/dist/deckgl/extensions/coffin-corner/store.js.map +1 -0
  40. package/dist/deckgl/extensions/coffin-corner/types.d.ts +76 -0
  41. package/dist/deckgl/extensions/coffin-corner/types.js +27 -0
  42. package/dist/deckgl/extensions/coffin-corner/types.js.map +1 -0
  43. package/dist/deckgl/extensions/coffin-corner/use-coffin-corner.d.ts +81 -0
  44. package/dist/deckgl/extensions/coffin-corner/use-coffin-corner.js +75 -0
  45. package/dist/deckgl/extensions/coffin-corner/use-coffin-corner.js.map +1 -0
  46. package/dist/deckgl/extensions/index.d.ts +15 -0
  47. package/dist/deckgl/extensions/index.js +16 -0
  48. package/dist/deckgl/index.d.ts +9 -4
  49. package/dist/deckgl/index.js +6 -2
  50. package/dist/deckgl/saved-viewports/index.d.ts +1 -1
  51. package/dist/deckgl/saved-viewports/index.js +1 -1
  52. package/dist/deckgl/saved-viewports/storage.d.ts +1 -1
  53. package/dist/deckgl/saved-viewports/storage.js +5 -10
  54. package/dist/deckgl/saved-viewports/storage.js.map +1 -1
  55. package/dist/deckgl/shapes/display-shape-layer/constants.js +70 -26
  56. package/dist/deckgl/shapes/display-shape-layer/constants.js.map +1 -1
  57. package/dist/deckgl/shapes/display-shape-layer/fiber.d.ts +1 -1
  58. package/dist/deckgl/shapes/display-shape-layer/fiber.js +1 -1
  59. package/dist/deckgl/shapes/display-shape-layer/index.d.ts +93 -38
  60. package/dist/deckgl/shapes/display-shape-layer/index.js +433 -187
  61. package/dist/deckgl/shapes/display-shape-layer/index.js.map +1 -1
  62. package/dist/deckgl/shapes/display-shape-layer/shape-label-layer.js +1 -1
  63. package/dist/deckgl/shapes/display-shape-layer/store.js +1 -1
  64. package/dist/deckgl/shapes/display-shape-layer/types.d.ts +116 -19
  65. package/dist/deckgl/shapes/display-shape-layer/types.js +1 -1
  66. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.d.ts +1 -1
  67. package/dist/deckgl/shapes/display-shape-layer/use-select-shape.js +1 -1
  68. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js +66 -36
  69. package/dist/deckgl/shapes/display-shape-layer/utils/display-style.js.map +1 -1
  70. package/dist/deckgl/shapes/display-shape-layer/utils/elevation.js +407 -0
  71. package/dist/deckgl/shapes/display-shape-layer/utils/elevation.js.map +1 -0
  72. package/dist/deckgl/shapes/display-shape-layer/utils/icon-config.js +106 -0
  73. package/dist/deckgl/shapes/display-shape-layer/utils/icon-config.js.map +1 -0
  74. package/dist/deckgl/shapes/display-shape-layer/utils/labels.d.ts +1 -1
  75. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js +28 -39
  76. package/dist/deckgl/shapes/display-shape-layer/utils/labels.js.map +1 -1
  77. package/dist/deckgl/shapes/display-shape-layer/utils/radius-label.js +53 -0
  78. package/dist/deckgl/shapes/display-shape-layer/utils/radius-label.js.map +1 -0
  79. package/dist/deckgl/shapes/draw-shape-layer/constants.js +1 -1
  80. package/dist/deckgl/shapes/draw-shape-layer/events.d.ts +1 -1
  81. package/dist/deckgl/shapes/draw-shape-layer/events.js +1 -1
  82. package/dist/deckgl/shapes/draw-shape-layer/fiber.js +1 -1
  83. package/dist/deckgl/shapes/draw-shape-layer/index.d.ts +8 -4
  84. package/dist/deckgl/shapes/draw-shape-layer/index.js +11 -17
  85. package/dist/deckgl/shapes/draw-shape-layer/index.js.map +1 -1
  86. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js +6 -5
  87. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-circle-mode-with-tooltip.js.map +1 -1
  88. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js +4 -3
  89. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-ellipse-mode-with-tooltip.js.map +1 -1
  90. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js +6 -20
  91. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-line-string-mode-with-tooltip.js.map +1 -1
  92. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js +6 -33
  93. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-polygon-mode-with-tooltip.js.map +1 -1
  94. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js +16 -12
  95. package/dist/deckgl/shapes/draw-shape-layer/modes/draw-rectangle-mode-with-tooltip.js.map +1 -1
  96. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js +2 -32
  97. package/dist/deckgl/shapes/draw-shape-layer/modes/index.js.map +1 -1
  98. package/dist/deckgl/shapes/draw-shape-layer/store.js +1 -1
  99. package/dist/deckgl/shapes/draw-shape-layer/types.d.ts +3 -3
  100. package/dist/deckgl/shapes/draw-shape-layer/types.js +1 -1
  101. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.d.ts +1 -1
  102. package/dist/deckgl/shapes/draw-shape-layer/use-draw-shape.js +1 -1
  103. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js +3 -8
  104. package/dist/deckgl/shapes/draw-shape-layer/utils/feature-conversion.js.map +1 -1
  105. package/dist/deckgl/shapes/edit-shape-layer/constants.js +17 -2
  106. package/dist/deckgl/shapes/edit-shape-layer/constants.js.map +1 -1
  107. package/dist/deckgl/shapes/edit-shape-layer/events.d.ts +1 -1
  108. package/dist/deckgl/shapes/edit-shape-layer/events.js +1 -1
  109. package/dist/deckgl/shapes/edit-shape-layer/fiber.d.ts +1 -1
  110. package/dist/deckgl/shapes/edit-shape-layer/fiber.js +1 -1
  111. package/dist/deckgl/shapes/edit-shape-layer/index.d.ts +12 -6
  112. package/dist/deckgl/shapes/edit-shape-layer/index.js +72 -27
  113. package/dist/deckgl/shapes/edit-shape-layer/index.js.map +1 -1
  114. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js +4 -1
  115. package/dist/deckgl/shapes/edit-shape-layer/modes/base-transform-mode.js.map +1 -1
  116. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js +4 -3
  117. package/dist/deckgl/shapes/edit-shape-layer/modes/bounding-transform-mode.js.map +1 -1
  118. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js +5 -3
  119. package/dist/deckgl/shapes/edit-shape-layer/modes/circle-transform-mode.js.map +1 -1
  120. package/dist/deckgl/shapes/edit-shape-layer/modes/index.js +1 -1
  121. package/dist/deckgl/shapes/edit-shape-layer/modes/point-translate-mode.js +1 -1
  122. package/dist/deckgl/shapes/edit-shape-layer/modes/point-translate-mode.js.map +1 -1
  123. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js +1 -1
  124. package/dist/deckgl/shapes/edit-shape-layer/modes/rotate-mode-with-snap.js.map +1 -1
  125. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js +1 -1
  126. package/dist/deckgl/shapes/edit-shape-layer/modes/scale-mode-with-free-transform.js.map +1 -1
  127. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js +1 -1
  128. package/dist/deckgl/shapes/edit-shape-layer/modes/vertex-transform-mode.js.map +1 -1
  129. package/dist/deckgl/shapes/edit-shape-layer/store.js +83 -14
  130. package/dist/deckgl/shapes/edit-shape-layer/store.js.map +1 -1
  131. package/dist/deckgl/shapes/edit-shape-layer/types.d.ts +18 -4
  132. package/dist/deckgl/shapes/edit-shape-layer/types.js +1 -1
  133. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.d.ts +2 -2
  134. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js +8 -4
  135. package/dist/deckgl/shapes/edit-shape-layer/use-edit-shape.js.map +1 -1
  136. package/dist/deckgl/shapes/index.d.ts +5 -4
  137. package/dist/deckgl/shapes/index.js +3 -2
  138. package/dist/deckgl/shapes/shared/constants.d.ts +4 -3
  139. package/dist/deckgl/shapes/shared/constants.js +51 -11
  140. package/dist/deckgl/shapes/shared/constants.js.map +1 -1
  141. package/dist/deckgl/shapes/shared/events.d.ts +5 -1
  142. package/dist/deckgl/shapes/shared/events.js +1 -1
  143. package/dist/deckgl/shapes/shared/events.js.map +1 -1
  144. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js +19 -16
  145. package/dist/deckgl/shapes/shared/hooks/use-shift-zoom-disable.js.map +1 -1
  146. package/dist/deckgl/shapes/shared/types.d.ts +182 -54
  147. package/dist/deckgl/shapes/shared/types.js +155 -2
  148. package/dist/deckgl/shapes/shared/types.js.map +1 -1
  149. package/dist/deckgl/shapes/shared/utils/duplicate-shape.d.ts +56 -0
  150. package/dist/deckgl/shapes/shared/utils/duplicate-shape.js +131 -0
  151. package/dist/deckgl/shapes/shared/utils/duplicate-shape.js.map +1 -0
  152. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js +29 -24
  153. package/dist/deckgl/shapes/shared/utils/geometry-measurements.js.map +1 -1
  154. package/dist/deckgl/shapes/shared/utils/layer-config.js +15 -9
  155. package/dist/deckgl/shapes/shared/utils/layer-config.js.map +1 -1
  156. package/dist/deckgl/shapes/shared/utils/mode-utils.js +50 -20
  157. package/dist/deckgl/shapes/shared/utils/mode-utils.js.map +1 -1
  158. package/dist/deckgl/shapes/shared/utils/pick-filtering.js +22 -15
  159. package/dist/deckgl/shapes/shared/utils/pick-filtering.js.map +1 -1
  160. package/dist/deckgl/shapes/shared/utils/style-utils.d.ts +38 -14
  161. package/dist/deckgl/shapes/shared/utils/style-utils.js +43 -32
  162. package/dist/deckgl/shapes/shared/utils/style-utils.js.map +1 -1
  163. package/dist/deckgl/symbol-layer/fiber.d.ts +4 -2
  164. package/dist/deckgl/symbol-layer/fiber.js +1 -1
  165. package/dist/deckgl/symbol-layer/fiber.js.map +1 -1
  166. package/dist/deckgl/symbol-layer/index.d.ts +1 -1
  167. package/dist/deckgl/symbol-layer/index.js +1 -1
  168. package/dist/deckgl/text-layer/character-sets.js +1 -1
  169. package/dist/deckgl/text-layer/default-settings.d.ts +1 -1
  170. package/dist/deckgl/text-layer/default-settings.js +1 -1
  171. package/dist/deckgl/text-layer/fiber.d.ts +1 -1
  172. package/dist/deckgl/text-layer/fiber.js +1 -1
  173. package/dist/deckgl/text-layer/index.d.ts +1 -1
  174. package/dist/deckgl/text-layer/index.js +1 -1
  175. package/dist/deckgl/text-settings.d.ts +3 -3
  176. package/dist/deckgl/text-settings.js +1 -1
  177. package/dist/map-cursor/events.js +1 -1
  178. package/dist/map-cursor/index.d.ts +1 -1
  179. package/dist/map-cursor/index.js +1 -1
  180. package/dist/map-cursor/store.d.ts +1 -1
  181. package/dist/map-cursor/store.js +1 -1
  182. package/dist/map-cursor/types.d.ts +1 -1
  183. package/dist/map-cursor/types.js +1 -1
  184. package/dist/map-cursor/use-map-cursor.d.ts +1 -1
  185. package/dist/map-cursor/use-map-cursor.js +1 -1
  186. package/dist/map-mode/events.js +1 -1
  187. package/dist/map-mode/index.d.ts +1 -1
  188. package/dist/map-mode/index.js +1 -1
  189. package/dist/map-mode/store.d.ts +1 -1
  190. package/dist/map-mode/store.js +3 -8
  191. package/dist/map-mode/store.js.map +1 -1
  192. package/dist/map-mode/types.d.ts +1 -1
  193. package/dist/map-mode/types.js +1 -1
  194. package/dist/map-mode/use-map-mode.d.ts +1 -1
  195. package/dist/map-mode/use-map-mode.js +1 -1
  196. package/dist/maplibre/hooks/use-maplibre.d.ts +1 -1
  197. package/dist/maplibre/hooks/use-maplibre.js +1 -1
  198. package/dist/maplibre/index.d.ts +1 -1
  199. package/dist/maplibre/index.js +1 -1
  200. package/dist/shared/cleanup.d.ts +1 -1
  201. package/dist/shared/cleanup.js +1 -1
  202. package/dist/shared/constants.js +1 -1
  203. package/dist/shared/create-map-store.d.ts +1 -1
  204. package/dist/shared/create-map-store.js +1 -1
  205. package/dist/shared/logger.js +31 -0
  206. package/dist/shared/logger.js.map +1 -0
  207. package/dist/shared/units.d.ts +15 -56
  208. package/dist/shared/units.js +2 -53
  209. package/dist/shared/units.js.map +1 -1
  210. package/dist/viewport/index.d.ts +3 -4
  211. package/dist/viewport/index.js +2 -3
  212. package/dist/viewport/store.d.ts +1 -1
  213. package/dist/viewport/store.js +1 -1
  214. package/dist/viewport/types.d.ts +9 -5
  215. package/dist/viewport/types.js +1 -1
  216. package/dist/viewport/utils.d.ts +4 -4
  217. package/dist/viewport/utils.js +17 -9
  218. package/dist/viewport/utils.js.map +1 -1
  219. package/dist/viewport/viewport-size.d.ts +7 -6
  220. package/dist/viewport/viewport-size.js +3 -3
  221. package/dist/viewport/viewport-size.js.map +1 -1
  222. package/package.json +29 -20
  223. package/dist/hotkey-manager/dist/react/use-hotkey.js +0 -39
  224. package/dist/hotkey-manager/dist/react/use-hotkey.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -13,61 +13,10 @@
13
13
 
14
14
  //#region src/shared/units.ts
15
15
  /**
16
- * Map of Turf.js unit names to display abbreviations.
17
- * These are the practical units users would select for map measurements.
18
- */
19
- const DISTANCE_UNIT_ABBREVIATIONS = {
20
- kilometers: "km",
21
- meters: "m",
22
- nauticalmiles: "nm",
23
- miles: "mi",
24
- feet: "ft"
25
- };
26
- /**
27
16
  * Default distance units for geographic measurements.
28
17
  */
29
18
  const DEFAULT_DISTANCE_UNITS = "kilometers";
30
- /**
31
- * Get the full Turf.js unit name from an abbreviation.
32
- *
33
- * @param abbrev - The abbreviation (e.g., 'km', 'nm')
34
- * @returns The full unit name (e.g., 'kilometers', 'nauticalmiles') or undefined
35
- *
36
- * @example
37
- * ```typescript
38
- * import { getDistanceUnitFromAbbreviation } from '@accelint/map-toolkit/shared';
39
- *
40
- * const unit = getDistanceUnitFromAbbreviation('km');
41
- * console.log(unit); // 'kilometers'
42
- *
43
- * const unknown = getDistanceUnitFromAbbreviation('invalid');
44
- * console.log(unknown); // undefined
45
- * ```
46
- */
47
- function getDistanceUnitFromAbbreviation(abbrev) {
48
- return Object.entries(DISTANCE_UNIT_ABBREVIATIONS).find(([, a]) => a === abbrev)?.[0];
49
- }
50
- /**
51
- * Get the abbreviation for a Turf.js unit name.
52
- *
53
- * @param unit - The full unit name (e.g., 'kilometers')
54
- * @returns The abbreviation (e.g., 'km') or the input if not found
55
- *
56
- * @example
57
- * ```typescript
58
- * import { getDistanceUnitAbbreviation } from '@accelint/map-toolkit/shared';
59
- *
60
- * const abbrev = getDistanceUnitAbbreviation('kilometers');
61
- * console.log(abbrev); // 'km'
62
- *
63
- * const fallback = getDistanceUnitAbbreviation('unknown');
64
- * console.log(fallback); // 'unknown'
65
- * ```
66
- */
67
- function getDistanceUnitAbbreviation(unit) {
68
- return DISTANCE_UNIT_ABBREVIATIONS[unit] ?? unit;
69
- }
70
19
 
71
20
  //#endregion
72
- export { DEFAULT_DISTANCE_UNITS, DISTANCE_UNIT_ABBREVIATIONS, getDistanceUnitAbbreviation, getDistanceUnitFromAbbreviation };
21
+ export { DEFAULT_DISTANCE_UNITS };
73
22
  //# sourceMappingURL=units.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"units.js","names":["DEFAULT_DISTANCE_UNITS: DistanceUnit"],"sources":["../../src/shared/units.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 * Map of Turf.js unit names to display abbreviations.\n * These are the practical units users would select for map measurements.\n */\nexport const DISTANCE_UNIT_ABBREVIATIONS = {\n kilometers: 'km',\n meters: 'm',\n nauticalmiles: 'nm',\n miles: 'mi',\n feet: 'ft',\n} as const;\n\n/**\n * Turf.js unit name (e.g., 'kilometers', 'nauticalmiles').\n */\nexport type DistanceUnit = keyof typeof DISTANCE_UNIT_ABBREVIATIONS;\n\n/**\n * Display abbreviation (e.g., 'km', 'nm').\n */\nexport type DistanceUnitAbbreviation =\n (typeof DISTANCE_UNIT_ABBREVIATIONS)[DistanceUnit];\n\n/**\n * Default distance units for geographic measurements.\n */\nexport const DEFAULT_DISTANCE_UNITS: DistanceUnit = 'kilometers';\n\n/**\n * Get the full Turf.js unit name from an abbreviation.\n *\n * @param abbrev - The abbreviation (e.g., 'km', 'nm')\n * @returns The full unit name (e.g., 'kilometers', 'nauticalmiles') or undefined\n *\n * @example\n * ```typescript\n * import { getDistanceUnitFromAbbreviation } from '@accelint/map-toolkit/shared';\n *\n * const unit = getDistanceUnitFromAbbreviation('km');\n * console.log(unit); // 'kilometers'\n *\n * const unknown = getDistanceUnitFromAbbreviation('invalid');\n * console.log(unknown); // undefined\n * ```\n */\nexport function getDistanceUnitFromAbbreviation(\n abbrev: string,\n): DistanceUnit | undefined {\n const entry = Object.entries(DISTANCE_UNIT_ABBREVIATIONS).find(\n ([, a]) => a === abbrev,\n );\n return entry?.[0] as DistanceUnit | undefined;\n}\n\n/**\n * Get the abbreviation for a Turf.js unit name.\n *\n * @param unit - The full unit name (e.g., 'kilometers')\n * @returns The abbreviation (e.g., 'km') or the input if not found\n *\n * @example\n * ```typescript\n * import { getDistanceUnitAbbreviation } from '@accelint/map-toolkit/shared';\n *\n * const abbrev = getDistanceUnitAbbreviation('kilometers');\n * console.log(abbrev); // 'km'\n *\n * const fallback = getDistanceUnitAbbreviation('unknown');\n * console.log(fallback); // 'unknown'\n * ```\n */\nexport function getDistanceUnitAbbreviation(unit: string): string {\n return DISTANCE_UNIT_ABBREVIATIONS[unit as DistanceUnit] ?? unit;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAa,8BAA8B;CACzC,YAAY;CACZ,QAAQ;CACR,eAAe;CACf,OAAO;CACP,MAAM;CACP;;;;AAgBD,MAAaA,yBAAuC;;;;;;;;;;;;;;;;;;AAmBpD,SAAgB,gCACd,QAC0B;AAI1B,QAHc,OAAO,QAAQ,4BAA4B,CAAC,MACvD,GAAG,OAAO,MAAM,OAClB,GACc;;;;;;;;;;;;;;;;;;;AAoBjB,SAAgB,4BAA4B,MAAsB;AAChE,QAAO,4BAA4B,SAAyB"}
1
+ {"version":3,"file":"units.js","names":["DEFAULT_DISTANCE_UNITS: DistanceUnit"],"sources":["../../src/shared/units.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 { DistanceUnit } from '@accelint/constants/units';\n\n/**\n * Default distance units for geographic measurements.\n */\nexport const DEFAULT_DISTANCE_UNITS: DistanceUnit = 'kilometers';\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAaA,yBAAuC"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -10,9 +10,8 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { DISTANCE_UNIT_ABBREVIATIONS, DistanceUnit, DistanceUnitAbbreviation, getDistanceUnitFromAbbreviation } from "../shared/units.js";
14
13
  import { clearViewportState, useMapViewport, viewportStore } from "./store.js";
15
- import { GeoCoordinate, GetViewportSizeArgs, SupportedDistanceUnit } from "./types.js";
14
+ import { GeoCoordinate, GetViewportSizeArgs } from "./types.js";
16
15
  import { getViewportSize } from "./utils.js";
17
16
  import { ViewportSize, ViewportSizeProps } from "./viewport-size.js";
18
- export { DISTANCE_UNIT_ABBREVIATIONS, type DistanceUnit, type DistanceUnitAbbreviation, type GeoCoordinate, type GetViewportSizeArgs, type SupportedDistanceUnit, ViewportSize, type ViewportSizeProps, clearViewportState, getDistanceUnitFromAbbreviation, getViewportSize, useMapViewport, viewportStore };
17
+ export { type GeoCoordinate, type GetViewportSizeArgs, ViewportSize, type ViewportSizeProps, clearViewportState, getViewportSize, useMapViewport, viewportStore };
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -11,9 +11,8 @@
11
11
  */
12
12
 
13
13
 
14
- import { DISTANCE_UNIT_ABBREVIATIONS, getDistanceUnitFromAbbreviation } from "../shared/units.js";
15
14
  import { clearViewportState, useMapViewport, viewportStore } from "./store.js";
16
15
  import { getViewportSize } from "./utils.js";
17
16
  import { ViewportSize } from "./viewport-size.js";
18
17
 
19
- export { DISTANCE_UNIT_ABBREVIATIONS, ViewportSize, clearViewportState, getDistanceUnitFromAbbreviation, getViewportSize, useMapViewport, viewportStore };
18
+ export { ViewportSize, clearViewportState, getViewportSize, useMapViewport, viewportStore };
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -11,22 +11,26 @@
11
11
  */
12
12
 
13
13
  import { Bounds } from "../deckgl/base-map/types.js";
14
- import { DistanceUnitAbbreviation } from "../shared/units.js";
14
+ import { DistanceUnitSymbol } from "@accelint/constants/units";
15
15
 
16
16
  //#region src/viewport/types.d.ts
17
- type SupportedDistanceUnit = DistanceUnitAbbreviation;
17
+ /** Arguments for {@link getViewportSize}. */
18
18
  type GetViewportSizeArgs = {
19
19
  /** Geographic bounds, undefined if viewport not yet initialized */
20
20
  bounds?: Bounds;
21
+ /** Map zoom level for meters-per-pixel calculation. */
21
22
  zoom: number;
22
23
  /** Viewport width in pixels */
23
24
  width: number;
24
25
  /** Viewport height in pixels */
25
26
  height: number;
26
- unit?: SupportedDistanceUnit;
27
+ /** Distance unit symbol. Defaults to `'NM'`. */
28
+ unit?: DistanceUnitSymbol;
29
+ /** Number formatter for localization. Defaults to `en-US`. */
27
30
  formatter?: Intl.NumberFormat;
28
31
  };
32
+ /** A geographic coordinate as `[longitude, latitude]`. */
29
33
  type GeoCoordinate = [longitude: number, latitude: number];
30
34
  //#endregion
31
- export { GeoCoordinate, GetViewportSizeArgs, SupportedDistanceUnit };
35
+ export { GeoCoordinate, GetViewportSizeArgs };
32
36
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -26,17 +26,17 @@ import { GetViewportSizeArgs } from "./types.js";
26
26
  * @param args.zoom - Zoom level for meters-per-pixel calculation
27
27
  * @param args.width - Viewport width in pixels
28
28
  * @param args.height - Viewport height in pixels
29
- * @param args.unit - Unit of distance measurement: `km | m | nm | mi | ft`. Defaults to `nm`
29
+ * @param args.unit - Unit symbol: `km | m | NM | mi | ft`. Defaults to `NM`
30
30
  * @param args.formatter - Number formatter for localization (defaults to en-US)
31
31
  * @returns Formatted string like "660 x 1,801 NM" or "-- x -- NM" if invalid
32
32
  *
33
33
  * @example
34
34
  * ```typescript
35
- * getViewportSize({ bounds: [-82, 22, -71, 52], zoom: 5, width: 800, height: 600, unit: 'nm' })
35
+ * getViewportSize({ bounds: [-82, 22, -71, 52], zoom: 5, width: 800, height: 600, unit: 'NM' })
36
36
  * // returns "612 x 459 NM"
37
37
  *
38
38
  * getViewportSize({ bounds: [170, 50, -170, 60], zoom: 4, width: 1024, height: 768, unit: 'km' })
39
- * // returns "2,050 x 1,538 KM"
39
+ * // returns "2,050 x 1,538 km"
40
40
  * ```
41
41
  */
42
42
  declare function getViewportSize({
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -11,9 +11,11 @@
11
11
  */
12
12
 
13
13
 
14
- import { getDistanceUnitFromAbbreviation } from "../shared/units.js";
14
+ import { createLoggerDomain } from "../shared/logger.js";
15
+ import { DISTANCE_UNIT_BY_SYMBOL, DISTANCE_UNIT_SYMBOLS } from "@accelint/constants/units";
15
16
 
16
17
  //#region src/viewport/utils.ts
18
+ const logger = createLoggerDomain("[Viewport]");
17
19
  const numberFormatter = Intl.NumberFormat("en-US");
18
20
  /**
19
21
  * Web Mercator constant: meters per pixel at zoom 0, equator.
@@ -42,21 +44,27 @@ const METERS_TO_UNIT = {
42
44
  * @param args.zoom - Zoom level for meters-per-pixel calculation
43
45
  * @param args.width - Viewport width in pixels
44
46
  * @param args.height - Viewport height in pixels
45
- * @param args.unit - Unit of distance measurement: `km | m | nm | mi | ft`. Defaults to `nm`
47
+ * @param args.unit - Unit symbol: `km | m | NM | mi | ft`. Defaults to `NM`
46
48
  * @param args.formatter - Number formatter for localization (defaults to en-US)
47
49
  * @returns Formatted string like "660 x 1,801 NM" or "-- x -- NM" if invalid
48
50
  *
49
51
  * @example
50
52
  * ```typescript
51
- * getViewportSize({ bounds: [-82, 22, -71, 52], zoom: 5, width: 800, height: 600, unit: 'nm' })
53
+ * getViewportSize({ bounds: [-82, 22, -71, 52], zoom: 5, width: 800, height: 600, unit: 'NM' })
52
54
  * // returns "612 x 459 NM"
53
55
  *
54
56
  * getViewportSize({ bounds: [170, 50, -170, 60], zoom: 4, width: 1024, height: 768, unit: 'km' })
55
- * // returns "2,050 x 1,538 KM"
57
+ * // returns "2,050 x 1,538 km"
56
58
  * ```
57
59
  */
58
- function getViewportSize({ bounds, zoom, width: pixelWidth, height: pixelHeight, unit = "nm", formatter = numberFormatter }) {
59
- const defaultValue = `-- x -- ${unit.toUpperCase()}`;
60
+ function getViewportSize({ bounds, zoom, width: pixelWidth, height: pixelHeight, unit = "NM", formatter = numberFormatter }) {
61
+ const defaultValue = `-- x -- ${unit}`;
62
+ const unitKey = DISTANCE_UNIT_BY_SYMBOL[unit];
63
+ if (!unitKey) {
64
+ const validSymbols = Object.values(DISTANCE_UNIT_SYMBOLS).join(", ");
65
+ logger.error(`Invalid distance unit symbol: "${unit}". Expected one of: ${validSymbols}`);
66
+ return defaultValue;
67
+ }
60
68
  if (!bounds || bounds.every((b) => Number.isNaN(b))) return defaultValue;
61
69
  if (Number.isNaN(zoom) || pixelWidth === 0 || pixelHeight === 0) return defaultValue;
62
70
  const [, minLat, , maxLat] = bounds;
@@ -65,10 +73,10 @@ function getViewportSize({ bounds, zoom, width: pixelWidth, height: pixelHeight,
65
73
  const metersPerPixel = METERS_PER_PIXEL_AT_ZOOM_0 * Math.cos(centerLat * Math.PI / 180) / 2 ** zoom;
66
74
  const widthMeters = pixelWidth * metersPerPixel;
67
75
  const heightMeters = pixelHeight * metersPerPixel;
68
- const conversionFactor = METERS_TO_UNIT[getDistanceUnitFromAbbreviation(unit)];
76
+ const conversionFactor = METERS_TO_UNIT[unitKey];
69
77
  const widthDistance = Math.round(widthMeters * conversionFactor);
70
78
  const heightDistance = Math.round(heightMeters * conversionFactor);
71
- return `${formatter.format(widthDistance)} x ${formatter.format(heightDistance)} ${unit.toUpperCase()}`;
79
+ return `${formatter.format(widthDistance)} x ${formatter.format(heightDistance)} ${unit}`;
72
80
  }
73
81
 
74
82
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../../src/viewport/utils.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 {\n type DistanceUnit,\n getDistanceUnitFromAbbreviation,\n} from '../shared/units';\nimport type { GetViewportSizeArgs } from './types';\n\nconst numberFormatter = Intl.NumberFormat('en-US');\n\n/**\n * Web Mercator constant: meters per pixel at zoom 0, equator.\n * This is Earth's circumference (40075016.686m) divided by 256 (tile size).\n */\nconst METERS_PER_PIXEL_AT_ZOOM_0 = 156543.03392;\n\n/**\n * Unit conversion factors from meters.\n */\nconst METERS_TO_UNIT = {\n kilometers: 0.001,\n meters: 1,\n nauticalmiles: 0.000539957,\n miles: 0.000621371,\n feet: 3.28084,\n} as const;\n\n/**\n * Returns a formatted viewport size string i.e. `660 x 1,801 NM`\n *\n * Calculates the geographic distance of the viewport using zoom level and\n * pixel dimensions with the Web Mercator projection formula. This approach\n * provides stable results without the edge cases of bounds-based calculations.\n *\n * @param args - Viewport size calculation arguments\n * @param args.bounds - Geographic bounds [minLon, minLat, maxLon, maxLat]\n * @param args.zoom - Zoom level for meters-per-pixel calculation\n * @param args.width - Viewport width in pixels\n * @param args.height - Viewport height in pixels\n * @param args.unit - Unit of distance measurement: `km | m | nm | mi | ft`. Defaults to `nm`\n * @param args.formatter - Number formatter for localization (defaults to en-US)\n * @returns Formatted string like \"660 x 1,801 NM\" or \"-- x -- NM\" if invalid\n *\n * @example\n * ```typescript\n * getViewportSize({ bounds: [-82, 22, -71, 52], zoom: 5, width: 800, height: 600, unit: 'nm' })\n * // returns \"612 x 459 NM\"\n *\n * getViewportSize({ bounds: [170, 50, -170, 60], zoom: 4, width: 1024, height: 768, unit: 'km' })\n * // returns \"2,050 x 1,538 KM\"\n * ```\n */\nexport function getViewportSize({\n bounds,\n zoom,\n width: pixelWidth,\n height: pixelHeight,\n unit = 'nm',\n formatter = numberFormatter,\n}: GetViewportSizeArgs) {\n const defaultValue = `-- x -- ${unit.toUpperCase()}`;\n\n // Validate inputs\n if (!bounds || bounds.every((b) => Number.isNaN(b))) {\n return defaultValue;\n }\n\n if (Number.isNaN(zoom) || pixelWidth === 0 || pixelHeight === 0) {\n return defaultValue;\n }\n\n const [, minLat, , maxLat] = bounds;\n\n // Validate latitude bounds are within valid geographic ranges\n if (minLat < -90 || minLat > 90 || maxLat < -90 || maxLat > 90) {\n return defaultValue;\n }\n\n // Calculate center latitude for the viewport\n const centerLat = (minLat + maxLat) / 2;\n\n // Web Mercator formula: meters per pixel at given zoom and latitude\n // Resolution = 156543.03392 * cos(latitude * π/180) / 2^zoom\n const metersPerPixel =\n (METERS_PER_PIXEL_AT_ZOOM_0 * Math.cos((centerLat * Math.PI) / 180)) /\n 2 ** zoom;\n\n // Calculate distances in meters\n const widthMeters = pixelWidth * metersPerPixel;\n const heightMeters = pixelHeight * metersPerPixel;\n\n // Convert to requested unit\n const unitKey = getDistanceUnitFromAbbreviation(unit) as DistanceUnit;\n const conversionFactor = METERS_TO_UNIT[unitKey];\n\n const widthDistance = Math.round(widthMeters * conversionFactor);\n const heightDistance = Math.round(heightMeters * conversionFactor);\n\n const width = formatter.format(widthDistance);\n const height = formatter.format(heightDistance);\n\n return `${width} x ${height} ${unit.toUpperCase()}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,kBAAkB,KAAK,aAAa,QAAQ;;;;;AAMlD,MAAM,6BAA6B;;;;AAKnC,MAAM,iBAAiB;CACrB,YAAY;CACZ,QAAQ;CACR,eAAe;CACf,OAAO;CACP,MAAM;CACP;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BD,SAAgB,gBAAgB,EAC9B,QACA,MACA,OAAO,YACP,QAAQ,aACR,OAAO,MACP,YAAY,mBACU;CACtB,MAAM,eAAe,WAAW,KAAK,aAAa;AAGlD,KAAI,CAAC,UAAU,OAAO,OAAO,MAAM,OAAO,MAAM,EAAE,CAAC,CACjD,QAAO;AAGT,KAAI,OAAO,MAAM,KAAK,IAAI,eAAe,KAAK,gBAAgB,EAC5D,QAAO;CAGT,MAAM,GAAG,UAAU,UAAU;AAG7B,KAAI,SAAS,OAAO,SAAS,MAAM,SAAS,OAAO,SAAS,GAC1D,QAAO;CAIT,MAAM,aAAa,SAAS,UAAU;CAItC,MAAM,iBACH,6BAA6B,KAAK,IAAK,YAAY,KAAK,KAAM,IAAI,GACnE,KAAK;CAGP,MAAM,cAAc,aAAa;CACjC,MAAM,eAAe,cAAc;CAInC,MAAM,mBAAmB,eADT,gCAAgC,KAAK;CAGrD,MAAM,gBAAgB,KAAK,MAAM,cAAc,iBAAiB;CAChE,MAAM,iBAAiB,KAAK,MAAM,eAAe,iBAAiB;AAKlE,QAAO,GAHO,UAAU,OAAO,cAAc,CAG7B,KAFD,UAAU,OAAO,eAAe,CAEnB,GAAG,KAAK,aAAa"}
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../../src/viewport/utils.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 {\n DISTANCE_UNIT_BY_SYMBOL,\n DISTANCE_UNIT_SYMBOLS,\n} from '@accelint/constants/units';\nimport { createLoggerDomain } from '../shared/logger';\nimport type { GetViewportSizeArgs } from './types';\n\nconst logger = createLoggerDomain('[Viewport]');\n\nconst numberFormatter = Intl.NumberFormat('en-US');\n\n/**\n * Web Mercator constant: meters per pixel at zoom 0, equator.\n * This is Earth's circumference (40075016.686m) divided by 256 (tile size).\n */\nconst METERS_PER_PIXEL_AT_ZOOM_0 = 156543.03392;\n\n/**\n * Unit conversion factors from meters.\n */\nconst METERS_TO_UNIT = {\n kilometers: 0.001,\n meters: 1,\n nauticalmiles: 0.000539957,\n miles: 0.000621371,\n feet: 3.28084,\n} as const;\n\n/**\n * Returns a formatted viewport size string i.e. `660 x 1,801 NM`\n *\n * Calculates the geographic distance of the viewport using zoom level and\n * pixel dimensions with the Web Mercator projection formula. This approach\n * provides stable results without the edge cases of bounds-based calculations.\n *\n * @param args - Viewport size calculation arguments\n * @param args.bounds - Geographic bounds [minLon, minLat, maxLon, maxLat]\n * @param args.zoom - Zoom level for meters-per-pixel calculation\n * @param args.width - Viewport width in pixels\n * @param args.height - Viewport height in pixels\n * @param args.unit - Unit symbol: `km | m | NM | mi | ft`. Defaults to `NM`\n * @param args.formatter - Number formatter for localization (defaults to en-US)\n * @returns Formatted string like \"660 x 1,801 NM\" or \"-- x -- NM\" if invalid\n *\n * @example\n * ```typescript\n * getViewportSize({ bounds: [-82, 22, -71, 52], zoom: 5, width: 800, height: 600, unit: 'NM' })\n * // returns \"612 x 459 NM\"\n *\n * getViewportSize({ bounds: [170, 50, -170, 60], zoom: 4, width: 1024, height: 768, unit: 'km' })\n * // returns \"2,050 x 1,538 km\"\n * ```\n */\nexport function getViewportSize({\n bounds,\n zoom,\n width: pixelWidth,\n height: pixelHeight,\n unit = 'NM',\n formatter = numberFormatter,\n}: GetViewportSizeArgs) {\n const defaultValue = `-- x -- ${unit}`;\n const unitKey = DISTANCE_UNIT_BY_SYMBOL[unit];\n\n if (!unitKey) {\n const validSymbols = Object.values(DISTANCE_UNIT_SYMBOLS).join(', ');\n\n logger.error(\n `Invalid distance unit symbol: \"${unit}\". Expected one of: ${validSymbols}`,\n );\n\n return defaultValue;\n }\n\n // Validate inputs\n if (!bounds || bounds.every((b) => Number.isNaN(b))) {\n return defaultValue;\n }\n\n if (Number.isNaN(zoom) || pixelWidth === 0 || pixelHeight === 0) {\n return defaultValue;\n }\n\n const [, minLat, , maxLat] = bounds;\n\n // Validate latitude bounds are within valid geographic ranges\n if (minLat < -90 || minLat > 90 || maxLat < -90 || maxLat > 90) {\n return defaultValue;\n }\n\n // Calculate center latitude for the viewport\n const centerLat = (minLat + maxLat) / 2;\n\n // Web Mercator formula: meters per pixel at given zoom and latitude\n // Resolution = 156543.03392 * cos(latitude * π/180) / 2^zoom\n const metersPerPixel =\n (METERS_PER_PIXEL_AT_ZOOM_0 * Math.cos((centerLat * Math.PI) / 180)) /\n 2 ** zoom;\n\n // Calculate distances in meters\n const widthMeters = pixelWidth * metersPerPixel;\n const heightMeters = pixelHeight * metersPerPixel;\n\n // Convert to requested unit\n const conversionFactor = METERS_TO_UNIT[unitKey];\n\n const widthDistance = Math.round(widthMeters * conversionFactor);\n const heightDistance = Math.round(heightMeters * conversionFactor);\n\n const width = formatter.format(widthDistance);\n const height = formatter.format(heightDistance);\n\n return `${width} x ${height} ${unit}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAM,SAAS,mBAAmB,aAAa;AAE/C,MAAM,kBAAkB,KAAK,aAAa,QAAQ;;;;;AAMlD,MAAM,6BAA6B;;;;AAKnC,MAAM,iBAAiB;CACrB,YAAY;CACZ,QAAQ;CACR,eAAe;CACf,OAAO;CACP,MAAM;CACP;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BD,SAAgB,gBAAgB,EAC9B,QACA,MACA,OAAO,YACP,QAAQ,aACR,OAAO,MACP,YAAY,mBACU;CACtB,MAAM,eAAe,WAAW;CAChC,MAAM,UAAU,wBAAwB;AAExC,KAAI,CAAC,SAAS;EACZ,MAAM,eAAe,OAAO,OAAO,sBAAsB,CAAC,KAAK,KAAK;AAEpE,SAAO,MACL,kCAAkC,KAAK,sBAAsB,eAC9D;AAED,SAAO;;AAIT,KAAI,CAAC,UAAU,OAAO,OAAO,MAAM,OAAO,MAAM,EAAE,CAAC,CACjD,QAAO;AAGT,KAAI,OAAO,MAAM,KAAK,IAAI,eAAe,KAAK,gBAAgB,EAC5D,QAAO;CAGT,MAAM,GAAG,UAAU,UAAU;AAG7B,KAAI,SAAS,OAAO,SAAS,MAAM,SAAS,OAAO,SAAS,GAC1D,QAAO;CAIT,MAAM,aAAa,SAAS,UAAU;CAItC,MAAM,iBACH,6BAA6B,KAAK,IAAK,YAAY,KAAK,KAAM,IAAI,GACnE,KAAK;CAGP,MAAM,cAAc,aAAa;CACjC,MAAM,eAAe,cAAc;CAGnC,MAAM,mBAAmB,eAAe;CAExC,MAAM,gBAAgB,KAAK,MAAM,cAAc,iBAAiB;CAChE,MAAM,iBAAiB,KAAK,MAAM,eAAe,iBAAiB;AAKlE,QAAO,GAHO,UAAU,OAAO,cAAc,CAG7B,KAFD,UAAU,OAAO,eAAe,CAEnB,GAAG"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -10,15 +10,16 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { SupportedDistanceUnit } from "./types.js";
14
13
  import { ComponentPropsWithRef } from "react";
15
14
  import { UniqueId } from "@accelint/core";
16
- import * as react_jsx_runtime1 from "react/jsx-runtime";
15
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
16
+ import { DistanceUnitSymbol } from "@accelint/constants/units";
17
17
 
18
18
  //#region src/viewport/viewport-size.d.ts
19
+ /** Props for {@link ViewportSize}. */
19
20
  type ViewportSizeProps = ComponentPropsWithRef<'span'> & {
20
21
  instanceId: UniqueId;
21
- unit?: SupportedDistanceUnit;
22
+ unit?: DistanceUnitSymbol;
22
23
  };
23
24
  /**
24
25
  * A span element displaying the current viewport bounds in the specified unit.
@@ -28,7 +29,7 @@ type ViewportSizeProps = ComponentPropsWithRef<'span'> & {
28
29
  *
29
30
  * @param props - Extends `<span>` props
30
31
  * @param props.instanceId - The id of the view to subscribe to
31
- * @param props.unit - Measure of distance: `km | m | nm | mi | ft`. Defaults to `nm`
32
+ * @param props.unit - Measure of distance: `km | m | NM | mi | ft`. Defaults to `NM`
32
33
  * @param props.className - CSS classes for styling
33
34
  *
34
35
  * @example
@@ -48,7 +49,7 @@ declare function ViewportSize({
48
49
  instanceId,
49
50
  unit,
50
51
  ...rest
51
- }: ViewportSizeProps): react_jsx_runtime1.JSX.Element;
52
+ }: ViewportSizeProps): react_jsx_runtime0.JSX.Element;
52
53
  //#endregion
53
54
  export { ViewportSize, ViewportSizeProps };
54
55
  //# sourceMappingURL=viewport-size.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
2
+ * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
3
3
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  * you may not use this file except in compliance with the License. You may obtain a copy
5
5
  * of the License at https://www.apache.org/licenses/LICENSE-2.0
@@ -24,7 +24,7 @@ import { jsx } from "react/jsx-runtime";
24
24
  *
25
25
  * @param props - Extends `<span>` props
26
26
  * @param props.instanceId - The id of the view to subscribe to
27
- * @param props.unit - Measure of distance: `km | m | nm | mi | ft`. Defaults to `nm`
27
+ * @param props.unit - Measure of distance: `km | m | NM | mi | ft`. Defaults to `NM`
28
28
  * @param props.className - CSS classes for styling
29
29
  *
30
30
  * @example
@@ -40,7 +40,7 @@ import { jsx } from "react/jsx-runtime";
40
40
  * />
41
41
  * ```
42
42
  */
43
- function ViewportSize({ instanceId, unit = "nm", ...rest }) {
43
+ function ViewportSize({ instanceId, unit = "NM", ...rest }) {
44
44
  const { bounds, zoom, width, height } = useMapViewport(instanceId);
45
45
  return /* @__PURE__ */ jsx("span", {
46
46
  ...rest,
@@ -1 +1 @@
1
- {"version":3,"file":"viewport-size.js","names":[],"sources":["../../src/viewport/viewport-size.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useMapViewport } from './store';\nimport { getViewportSize } from './utils';\nimport type { UniqueId } from '@accelint/core';\nimport type { ComponentPropsWithRef } from 'react';\nimport type { SupportedDistanceUnit } from './types';\n\nexport type ViewportSizeProps = ComponentPropsWithRef<'span'> & {\n instanceId: UniqueId;\n unit?: SupportedDistanceUnit;\n};\n\n/**\n * A span element displaying the current viewport bounds in the specified unit.\n *\n * Displays the viewport dimensions in a format like `660 x 1,801 NM`.\n * Updates automatically as the viewport changes by subscribing to viewport events.\n *\n * @param props - Extends `<span>` props\n * @param props.instanceId - The id of the view to subscribe to\n * @param props.unit - Measure of distance: `km | m | nm | mi | ft`. Defaults to `nm`\n * @param props.className - CSS classes for styling\n *\n * @example\n * ```tsx\n * // Basic usage with default nautical miles\n * <ViewportSize instanceId=\"some-uuid\" />\n *\n * // With custom unit and styling\n * <ViewportSize\n * instanceId=\"some-uuid\"\n * unit=\"km\"\n * className=\"text-sm text-gray-600\"\n * />\n * ```\n */\nexport function ViewportSize({\n instanceId,\n unit = 'nm',\n ...rest\n}: ViewportSizeProps) {\n const { bounds, zoom, width, height } = useMapViewport(instanceId);\n\n return (\n <span {...rest}>\n {getViewportSize({ bounds, unit, zoom, width, height })}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,SAAgB,aAAa,EAC3B,YACA,OAAO,MACP,GAAG,QACiB;CACpB,MAAM,EAAE,QAAQ,MAAM,OAAO,WAAW,eAAe,WAAW;AAElE,QACE,oBAAC;EAAK,GAAI;YACP,gBAAgB;GAAE;GAAQ;GAAM;GAAM;GAAO;GAAQ,CAAC;GAClD"}
1
+ {"version":3,"file":"viewport-size.js","names":[],"sources":["../../src/viewport/viewport-size.tsx"],"sourcesContent":["/*\n * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { useMapViewport } from './store';\nimport { getViewportSize } from './utils';\nimport type { DistanceUnitSymbol } from '@accelint/constants/units';\nimport type { UniqueId } from '@accelint/core';\nimport type { ComponentPropsWithRef } from 'react';\n\n/** Props for {@link ViewportSize}. */\nexport type ViewportSizeProps = ComponentPropsWithRef<'span'> & {\n instanceId: UniqueId;\n unit?: DistanceUnitSymbol;\n};\n\n/**\n * A span element displaying the current viewport bounds in the specified unit.\n *\n * Displays the viewport dimensions in a format like `660 x 1,801 NM`.\n * Updates automatically as the viewport changes by subscribing to viewport events.\n *\n * @param props - Extends `<span>` props\n * @param props.instanceId - The id of the view to subscribe to\n * @param props.unit - Measure of distance: `km | m | NM | mi | ft`. Defaults to `NM`\n * @param props.className - CSS classes for styling\n *\n * @example\n * ```tsx\n * // Basic usage with default nautical miles\n * <ViewportSize instanceId=\"some-uuid\" />\n *\n * // With custom unit and styling\n * <ViewportSize\n * instanceId=\"some-uuid\"\n * unit=\"km\"\n * className=\"text-sm text-gray-600\"\n * />\n * ```\n */\nexport function ViewportSize({\n instanceId,\n unit = 'NM',\n ...rest\n}: ViewportSizeProps) {\n const { bounds, zoom, width, height } = useMapViewport(instanceId);\n\n return (\n <span {...rest}>\n {getViewportSize({ bounds, unit, zoom, width, height })}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,aAAa,EAC3B,YACA,OAAO,MACP,GAAG,QACiB;CACpB,MAAM,EAAE,QAAQ,MAAM,OAAO,WAAW,eAAe,WAAW;AAElE,QACE,oBAAC;EAAK,GAAI;YACP,gBAAgB;GAAE;GAAQ;GAAM;GAAM;GAAO;GAAQ,CAAC;GAClD"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@accelint/map-toolkit",
3
3
  "description": "A collection of components and utilities to simplify visualizing and working with geospatial data.",
4
- "version": "1.5.0",
4
+ "version": "3.0.0",
5
5
  "author": "https://hypergiant.com",
6
6
  "$schema": "https://json.schemastore.org/package",
7
7
  "devDependencies": {
8
- "@deck.gl-community/editable-layers": "~9.1",
9
- "@deck.gl/core": "~9.1",
10
- "@deck.gl/extensions": "~9.1",
11
- "@deck.gl/layers": "~9.1",
8
+ "@deck.gl-community/editable-layers": "~9.2",
9
+ "@deck.gl/core": "~9.2",
10
+ "@deck.gl/extensions": "~9.2",
11
+ "@deck.gl/layers": "~9.2",
12
12
  "@deckgl-fiber-renderer/dom": "^1.4.0",
13
13
  "@deckgl-fiber-renderer/shared": "^1.4.0",
14
14
  "@deckgl-fiber-renderer/types": "^1.4.0",
@@ -43,14 +43,17 @@
43
43
  "vite": "^7.2.7",
44
44
  "vitest": "^4.0.15",
45
45
  "@accelint/biome-config": "1.1.0",
46
- "@accelint/bus": "3.0.2",
47
- "@accelint/core": "0.5.2",
48
- "@accelint/design-foundation": "3.0.0",
49
- "@accelint/design-toolkit": "9.7.0",
46
+ "@accelint/bus": "4.0.0",
47
+ "@accelint/constants": "0.3.0",
48
+ "@accelint/core": "0.6.0",
49
+ "@accelint/design-foundation": "3.0.2",
50
+ "@accelint/design-toolkit": "9.9.0",
50
51
  "@accelint/geo": "0.6.0",
51
- "@accelint/logger": "1.0.0",
52
- "@accelint/smeegl": "0.3.5",
52
+ "@accelint/hotkey-manager": "1.0.2",
53
+ "@accelint/logger": "1.1.0",
53
54
  "@accelint/postcss-tailwind-css-modules": "1.0.1",
55
+ "@accelint/predicates": "0.5.2",
56
+ "@accelint/smeegl": "0.3.5",
54
57
  "@accelint/typescript-config": "0.1.4",
55
58
  "@accelint/vitest-config": "0.1.6"
56
59
  },
@@ -75,6 +78,11 @@
75
78
  "./deckgl/base-map/events": "./dist/deckgl/base-map/events.js",
76
79
  "./deckgl/base-map/provider": "./dist/deckgl/base-map/provider.js",
77
80
  "./deckgl/base-map/types": "./dist/deckgl/base-map/types.js",
81
+ "./deckgl/extensions": "./dist/deckgl/extensions/index.js",
82
+ "./deckgl/extensions/coffin-corner": "./dist/deckgl/extensions/coffin-corner/index.js",
83
+ "./deckgl/extensions/coffin-corner/coffin-corner-extension": "./dist/deckgl/extensions/coffin-corner/coffin-corner-extension.js",
84
+ "./deckgl/extensions/coffin-corner/types": "./dist/deckgl/extensions/coffin-corner/types.js",
85
+ "./deckgl/extensions/coffin-corner/use-coffin-corner": "./dist/deckgl/extensions/coffin-corner/use-coffin-corner.js",
78
86
  "./deckgl/saved-viewports": "./dist/deckgl/saved-viewports/index.js",
79
87
  "./deckgl/saved-viewports/storage": "./dist/deckgl/saved-viewports/storage.js",
80
88
  "./deckgl/shapes": "./dist/deckgl/shapes/index.js",
@@ -139,10 +147,10 @@
139
147
  ],
140
148
  "license": "Apache-2.0",
141
149
  "optionalDependencies": {
142
- "@deck.gl-community/editable-layers": "~9.1",
143
- "@deck.gl/core": "~9.1",
144
- "@deck.gl/extensions": "~9.1",
145
- "@deck.gl/layers": "~9.1",
150
+ "@deck.gl-community/editable-layers": "~9.2",
151
+ "@deck.gl/core": "~9.2",
152
+ "@deck.gl/extensions": "~9.2",
153
+ "@deck.gl/layers": "~9.2",
146
154
  "@deckgl-fiber-renderer/dom": "^1.4.0",
147
155
  "@deckgl-fiber-renderer/shared": "^1.4.0",
148
156
  "@deckgl-fiber-renderer/types": "^1.4.0",
@@ -152,17 +160,18 @@
152
160
  "maplibre-gl": "^5.7.1",
153
161
  "milsymbol": "^3.0.2",
154
162
  "mjolnir.js": "^3.0.0",
155
- "react-map-gl": "^8.1.0",
156
- "@accelint/hotkey-manager": "1.0.1"
163
+ "react-map-gl": "^8.1.0"
157
164
  },
158
165
  "owner": "default/pathfinder",
159
166
  "peerDependencies": {
160
167
  "@types/geojson": "^7946.0.14",
161
168
  "react": "^19",
162
- "@accelint/bus": "3.0.2",
163
- "@accelint/core": "0.5.2",
169
+ "@accelint/bus": "4.0.0",
170
+ "@accelint/constants": "0.3.0",
171
+ "@accelint/core": "0.6.0",
164
172
  "@accelint/geo": "0.6.0",
165
- "@accelint/logger": "1.0.0"
173
+ "@accelint/hotkey-manager": "1.0.2",
174
+ "@accelint/logger": "1.1.0"
166
175
  },
167
176
  "private": false,
168
177
  "publishConfig": {
@@ -1,39 +0,0 @@
1
- /*
2
- * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.
3
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- * you may not use this file except in compliance with the License. You may obtain a copy
5
- * of the License at https://www.apache.org/licenses/LICENSE-2.0
6
- *
7
- * Unless required by applicable law or agreed to in writing, software distributed under
8
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- * OF ANY KIND, either express or implied. See the License for the specific language
10
- * governing permissions and limitations under the License.
11
- */
12
-
13
-
14
- import { useEffect } from "react";
15
-
16
- //#region ../hotkey-manager/dist/react/use-hotkey.js
17
- /**
18
- * A React hook that binds a HotkeyManager on mount and unbinds on unmount.
19
- *
20
- * @param manager - The hotkey manager to bind.
21
- * @returns void
22
- *
23
- * @example
24
- * ```tsx
25
- * const myHotkey = registerHotkey({ key: { code: Keycode.KeyA }, onKeyUp: handler });
26
- *
27
- * function MyComponent() {
28
- * useHotkey(myHotkey);
29
- * return <div />;
30
- * }
31
- * ```
32
- */
33
- function useHotkey(manager) {
34
- useEffect(() => manager.bind(), [manager]);
35
- }
36
-
37
- //#endregion
38
- export { useHotkey };
39
- //# sourceMappingURL=use-hotkey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-hotkey.js","names":[],"sources":["../../../../../hotkey-manager/dist/react/use-hotkey.js"],"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\nimport { useEffect } from \"react\";\n\n//#region src/react/use-hotkey.ts\n/**\n* A React hook that binds a HotkeyManager on mount and unbinds on unmount.\n*\n* @param manager - The hotkey manager to bind.\n* @returns void\n*\n* @example\n* ```tsx\n* const myHotkey = registerHotkey({ key: { code: Keycode.KeyA }, onKeyUp: handler });\n*\n* function MyComponent() {\n* useHotkey(myHotkey);\n* return <div />;\n* }\n* ```\n*/\nfunction useHotkey(manager) {\n\tuseEffect(() => manager.bind(), [manager]);\n}\n/**\n* Creates a React hook from a HotkeyManager for module-level usage.\n* This is useful when you want to define the hotkey at module scope and use it as a hook.\n*\n* @param manager - The hotkey manager to wrap.\n* @returns A React hook that binds the hotkey on mount.\n*\n* @example\n* ```tsx\n* const myHotkey = registerHotkey({ key: { code: Keycode.KeyA }, onKeyUp: handler });\n* const useMyHotkey = createUseHotkey(myHotkey);\n*\n* function MyComponent() {\n* useMyHotkey();\n* return <div />;\n* }\n* ```\n*/\nfunction createUseHotkey(manager) {\n\treturn function useHotkeyHook() {\n\t\tuseEffect(() => manager.bind(), []);\n\t};\n}\n\n//#endregion\nexport { createUseHotkey, useHotkey };\n//# sourceMappingURL=use-hotkey.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,UAAU,SAAS;AAC3B,iBAAgB,QAAQ,MAAM,EAAE,CAAC,QAAQ,CAAC"}