@honua/react 0.0.20-alpha.0 → 0.1.1-beta.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 (363) hide show
  1. package/contract/discovery.d.ts +231 -0
  2. package/contract/discovery.d.ts.map +1 -0
  3. package/contract/discovery.js +554 -0
  4. package/contract/edit-sketch.d.ts +8 -0
  5. package/contract/edit-sketch.d.ts.map +1 -1
  6. package/contract/edit-sketch.js +15 -0
  7. package/contract/edit-snapping.d.ts +160 -0
  8. package/contract/edit-snapping.d.ts.map +1 -0
  9. package/contract/edit-snapping.js +675 -0
  10. package/contract/generated/projjson-v0.7-crs-validator.d.ts +35 -0
  11. package/contract/generated/projjson-v0.7-crs-validator.d.ts.map +1 -0
  12. package/contract/generated/projjson-v0.7-crs-validator.js +3941 -0
  13. package/contract/index.d.ts +12 -1
  14. package/contract/index.d.ts.map +1 -1
  15. package/contract/index.js +4 -0
  16. package/contract/pmtiles.d.ts +193 -0
  17. package/contract/pmtiles.d.ts.map +1 -0
  18. package/contract/pmtiles.js +195 -0
  19. package/contract/protocol-module.d.ts +70 -0
  20. package/contract/protocol-module.d.ts.map +1 -0
  21. package/contract/protocol-module.js +1 -0
  22. package/contract/schema-envelope.d.ts +26 -0
  23. package/contract/schema-envelope.d.ts.map +1 -0
  24. package/contract/schema-envelope.js +25 -0
  25. package/contract/schema.d.ts +582 -0
  26. package/contract/schema.d.ts.map +1 -0
  27. package/contract/schema.js +2483 -0
  28. package/contract/source-capability-support.d.ts +6 -0
  29. package/contract/source-capability-support.d.ts.map +1 -0
  30. package/contract/source-capability-support.js +154 -0
  31. package/contract/source.d.ts +57 -15
  32. package/contract/source.d.ts.map +1 -1
  33. package/contract/source.js +368 -65
  34. package/contract/types.d.ts +171 -6
  35. package/contract/types.d.ts.map +1 -1
  36. package/contract/types.js +14 -14
  37. package/core/auth/client-credentials-provider.d.ts +51 -0
  38. package/core/auth/client-credentials-provider.d.ts.map +1 -0
  39. package/core/auth/client-credentials-provider.js +115 -0
  40. package/core/auth/credential-store.d.ts +52 -0
  41. package/core/auth/credential-store.d.ts.map +1 -0
  42. package/core/auth/credential-store.js +82 -0
  43. package/core/auth/index.d.ts +23 -0
  44. package/core/auth/index.d.ts.map +1 -0
  45. package/core/auth/index.js +20 -0
  46. package/core/auth/oauth2-provider.d.ts +114 -0
  47. package/core/auth/oauth2-provider.d.ts.map +1 -0
  48. package/core/auth/oauth2-provider.js +408 -0
  49. package/core/auth/pkce.d.ts +25 -0
  50. package/core/auth/pkce.d.ts.map +1 -0
  51. package/core/auth/pkce.js +46 -0
  52. package/core/auth/static-providers.d.ts +20 -0
  53. package/core/auth/static-providers.d.ts.map +1 -0
  54. package/core/auth/static-providers.js +26 -0
  55. package/core/auth/token-endpoint.d.ts +40 -0
  56. package/core/auth/token-endpoint.d.ts.map +1 -0
  57. package/core/auth/token-endpoint.js +133 -0
  58. package/core/auth/types.d.ts +144 -0
  59. package/core/auth/types.d.ts.map +1 -0
  60. package/core/auth/types.js +8 -0
  61. package/core/bounded-json.d.ts +4 -0
  62. package/core/bounded-json.d.ts.map +1 -0
  63. package/core/bounded-json.js +38 -0
  64. package/core/cache-state.d.ts +9 -0
  65. package/core/cache-state.d.ts.map +1 -1
  66. package/core/cache-state.js +10 -0
  67. package/core/capabilities-xml.d.ts +33 -0
  68. package/core/capabilities-xml.d.ts.map +1 -0
  69. package/core/capabilities-xml.js +331 -0
  70. package/core/client.d.ts +35 -2
  71. package/core/client.d.ts.map +1 -1
  72. package/core/client.js +167 -29
  73. package/core/error-classifications.d.ts +153 -0
  74. package/core/error-classifications.d.ts.map +1 -0
  75. package/core/error-classifications.js +140 -0
  76. package/core/error-code-registry.d.ts +158 -0
  77. package/core/error-code-registry.d.ts.map +1 -0
  78. package/core/error-code-registry.js +143 -0
  79. package/core/error-envelope.d.ts +68 -0
  80. package/core/error-envelope.d.ts.map +1 -0
  81. package/core/error-envelope.js +357 -0
  82. package/core/errors.d.ts +73 -25
  83. package/core/errors.d.ts.map +1 -1
  84. package/core/errors.js +113 -46
  85. package/core/geoparquet-sql.d.ts +190 -0
  86. package/core/geoparquet-sql.d.ts.map +1 -0
  87. package/core/geoparquet-sql.js +368 -0
  88. package/core/odata-key-path.d.ts +12 -0
  89. package/core/odata-key-path.d.ts.map +1 -0
  90. package/core/odata-key-path.js +28 -0
  91. package/core/odata-write-codec.d.ts +66 -0
  92. package/core/odata-write-codec.d.ts.map +1 -0
  93. package/core/odata-write-codec.js +1083 -0
  94. package/core/odata.d.ts +59 -7
  95. package/core/odata.d.ts.map +1 -1
  96. package/core/odata.js +431 -99
  97. package/core/ogc-endpoint-layout.d.ts +70 -0
  98. package/core/ogc-endpoint-layout.d.ts.map +1 -0
  99. package/core/ogc-endpoint-layout.js +173 -0
  100. package/core/ogc-features.d.ts.map +1 -1
  101. package/core/ogc-features.js +35 -17
  102. package/core/ogc-maps.d.ts +7 -0
  103. package/core/ogc-maps.d.ts.map +1 -1
  104. package/core/ogc-maps.js +46 -7
  105. package/core/ogc-processes.d.ts +2 -1
  106. package/core/ogc-processes.d.ts.map +1 -1
  107. package/core/ogc-processes.js +33 -5
  108. package/core/ogc-records.d.ts +9 -0
  109. package/core/ogc-records.d.ts.map +1 -1
  110. package/core/ogc-records.js +78 -29
  111. package/core/ogc-tiles.d.ts +10 -1
  112. package/core/ogc-tiles.d.ts.map +1 -1
  113. package/core/ogc-tiles.js +56 -17
  114. package/core/path-utils.d.ts +9 -0
  115. package/core/path-utils.d.ts.map +1 -1
  116. package/core/path-utils.js +19 -0
  117. package/core/protocol-transport.d.ts +1 -0
  118. package/core/protocol-transport.d.ts.map +1 -1
  119. package/core/request-pipeline.d.ts.map +1 -1
  120. package/core/request-pipeline.js +1 -1
  121. package/core/spatial-filter.d.ts +8 -4
  122. package/core/spatial-filter.d.ts.map +1 -1
  123. package/core/spatial-filter.js +206 -16
  124. package/core/stac-static.d.ts +55 -0
  125. package/core/stac-static.d.ts.map +1 -0
  126. package/core/stac-static.js +386 -0
  127. package/core/stac.d.ts +12 -0
  128. package/core/stac.d.ts.map +1 -1
  129. package/core/stac.js +45 -15
  130. package/core/surfaces.d.ts +13 -0
  131. package/core/surfaces.d.ts.map +1 -1
  132. package/core/surfaces.js +127 -16
  133. package/core/types.d.ts +174 -7
  134. package/core/types.d.ts.map +1 -1
  135. package/core/wfs-capabilities.d.ts +12 -0
  136. package/core/wfs-capabilities.d.ts.map +1 -1
  137. package/core/wfs-capabilities.js +22 -3
  138. package/core/wfs.d.ts +13 -0
  139. package/core/wfs.d.ts.map +1 -1
  140. package/core/wfs.js +35 -5
  141. package/core/wms-capabilities.d.ts +56 -84
  142. package/core/wms-capabilities.d.ts.map +1 -1
  143. package/core/wms-capabilities.js +212 -509
  144. package/core/wmts-capabilities.d.ts +62 -62
  145. package/core/wmts-capabilities.d.ts.map +1 -1
  146. package/core/wmts-capabilities.js +224 -371
  147. package/esri-compat/editor.d.ts +8 -0
  148. package/esri-compat/editor.d.ts.map +1 -1
  149. package/esri-compat/editor.js +13 -0
  150. package/esri-compat/feature-layer.d.ts +2 -0
  151. package/esri-compat/feature-layer.d.ts.map +1 -1
  152. package/esri-compat/feature-layer.js +1 -0
  153. package/esri-compat/identity-manager.d.ts +43 -0
  154. package/esri-compat/identity-manager.d.ts.map +1 -1
  155. package/esri-compat/identity-manager.js +131 -1
  156. package/esri-compat/layer-list.d.ts +11 -0
  157. package/esri-compat/layer-list.d.ts.map +1 -1
  158. package/esri-compat/layer-list.js +49 -0
  159. package/esri-compat/legend.d.ts +10 -0
  160. package/esri-compat/legend.d.ts.map +1 -1
  161. package/esri-compat/legend.js +27 -0
  162. package/esri-compat/oauth-info.d.ts +15 -0
  163. package/esri-compat/oauth-info.d.ts.map +1 -1
  164. package/esri-compat/oauth-info.js +27 -0
  165. package/esri-compat/portal.d.ts +197 -0
  166. package/esri-compat/portal.d.ts.map +1 -0
  167. package/esri-compat/portal.js +251 -0
  168. package/esri-compat/renderer-objects.d.ts +40 -0
  169. package/esri-compat/renderer-objects.d.ts.map +1 -0
  170. package/esri-compat/renderer-objects.js +62 -0
  171. package/esri-compat/sketch.d.ts +43 -0
  172. package/esri-compat/sketch.d.ts.map +1 -1
  173. package/esri-compat/sketch.js +46 -0
  174. package/esri-compat/snapping.d.ts +43 -0
  175. package/esri-compat/snapping.d.ts.map +1 -0
  176. package/esri-compat/snapping.js +45 -0
  177. package/esri-compat/url.d.ts.map +1 -1
  178. package/esri-compat/url.js +1 -1
  179. package/esri-compat/widget-host.d.ts +84 -0
  180. package/esri-compat/widget-host.d.ts.map +1 -0
  181. package/esri-compat/widget-host.js +159 -0
  182. package/filter-registry/index.d.ts +145 -0
  183. package/filter-registry/index.d.ts.map +1 -0
  184. package/filter-registry/index.js +531 -0
  185. package/generated-app/errors.d.ts +18 -2
  186. package/generated-app/errors.d.ts.map +1 -1
  187. package/generated-app/errors.js +44 -11
  188. package/map/automatic-mount-integration.d.ts +134 -0
  189. package/map/automatic-mount-integration.d.ts.map +1 -0
  190. package/map/automatic-mount-integration.js +305 -0
  191. package/map/automatic-source-strategy.d.ts +125 -0
  192. package/map/automatic-source-strategy.d.ts.map +1 -0
  193. package/map/automatic-source-strategy.js +494 -0
  194. package/map/data-to-map-bridge.d.ts +293 -0
  195. package/map/data-to-map-bridge.d.ts.map +1 -0
  196. package/map/data-to-map-bridge.js +817 -0
  197. package/map/geojson-projection.d.ts +33 -0
  198. package/map/geojson-projection.d.ts.map +1 -0
  199. package/map/geojson-projection.js +118 -0
  200. package/map/index.d.ts +14 -0
  201. package/map/index.d.ts.map +1 -1
  202. package/map/index.js +8 -0
  203. package/map/raster-source-spec.d.ts +30 -0
  204. package/map/raster-source-spec.d.ts.map +1 -0
  205. package/map/raster-source-spec.js +190 -0
  206. package/map/raster-source-strategy.d.ts +65 -0
  207. package/map/raster-source-strategy.d.ts.map +1 -0
  208. package/map/raster-source-strategy.js +232 -0
  209. package/map/source-to-maplibre.d.ts +91 -0
  210. package/map/source-to-maplibre.d.ts.map +1 -0
  211. package/map/source-to-maplibre.js +454 -0
  212. package/map/temporal-playback.d.ts +139 -0
  213. package/map/temporal-playback.d.ts.map +1 -0
  214. package/map/temporal-playback.js +247 -0
  215. package/package.json +19 -1
  216. package/query-planner/canonical.d.ts +7 -0
  217. package/query-planner/canonical.d.ts.map +1 -0
  218. package/query-planner/canonical.js +145 -0
  219. package/query-planner/cql2-json.d.ts +17 -0
  220. package/query-planner/cql2-json.d.ts.map +1 -0
  221. package/query-planner/cql2-json.js +646 -0
  222. package/query-planner/diagnostics.d.ts +35 -0
  223. package/query-planner/diagnostics.d.ts.map +1 -0
  224. package/query-planner/diagnostics.js +373 -0
  225. package/query-planner/duckdb.d.ts +79 -0
  226. package/query-planner/duckdb.d.ts.map +1 -0
  227. package/query-planner/duckdb.js +758 -0
  228. package/query-planner/execution-context.d.ts +5 -0
  229. package/query-planner/execution-context.d.ts.map +1 -0
  230. package/query-planner/execution-context.js +50 -0
  231. package/query-planner/executor.d.ts +5 -0
  232. package/query-planner/executor.d.ts.map +1 -0
  233. package/query-planner/executor.js +223 -0
  234. package/query-planner/geoservices.d.ts +91 -0
  235. package/query-planner/geoservices.d.ts.map +1 -0
  236. package/query-planner/geoservices.js +667 -0
  237. package/query-planner/grpc.d.ts +100 -0
  238. package/query-planner/grpc.d.ts.map +1 -0
  239. package/query-planner/grpc.js +736 -0
  240. package/query-planner/index.d.ts +44 -0
  241. package/query-planner/index.d.ts.map +1 -0
  242. package/query-planner/index.js +30 -0
  243. package/query-planner/ir.d.ts +20 -0
  244. package/query-planner/ir.d.ts.map +1 -0
  245. package/query-planner/ir.js +417 -0
  246. package/query-planner/local-aggregate.d.ts +5 -0
  247. package/query-planner/local-aggregate.d.ts.map +1 -0
  248. package/query-planner/local-aggregate.js +126 -0
  249. package/query-planner/odata.d.ts +48 -0
  250. package/query-planner/odata.d.ts.map +1 -0
  251. package/query-planner/odata.js +662 -0
  252. package/query-planner/ogc-compiler.d.ts +55 -0
  253. package/query-planner/ogc-compiler.d.ts.map +1 -0
  254. package/query-planner/ogc-compiler.js +480 -0
  255. package/query-planner/ogc-features.d.ts +53 -0
  256. package/query-planner/ogc-features.d.ts.map +1 -0
  257. package/query-planner/ogc-features.js +617 -0
  258. package/query-planner/planner.d.ts +17 -0
  259. package/query-planner/planner.d.ts.map +1 -0
  260. package/query-planner/planner.js +818 -0
  261. package/query-planner/resource.d.ts +94 -0
  262. package/query-planner/resource.d.ts.map +1 -0
  263. package/query-planner/resource.js +526 -0
  264. package/query-planner/semantic-canonical.d.ts +15 -0
  265. package/query-planner/semantic-canonical.d.ts.map +1 -0
  266. package/query-planner/semantic-canonical.js +62 -0
  267. package/query-planner/semantic-compat.d.ts +10 -0
  268. package/query-planner/semantic-compat.d.ts.map +1 -0
  269. package/query-planner/semantic-compat.js +35 -0
  270. package/query-planner/semantic-compiler.d.ts +64 -0
  271. package/query-planner/semantic-compiler.d.ts.map +1 -0
  272. package/query-planner/semantic-compiler.js +81 -0
  273. package/query-planner/semantic-literals.d.ts +30 -0
  274. package/query-planner/semantic-literals.d.ts.map +1 -0
  275. package/query-planner/semantic-literals.js +133 -0
  276. package/query-planner/semantic-types.d.ts +265 -0
  277. package/query-planner/semantic-types.d.ts.map +1 -0
  278. package/query-planner/semantic-types.js +1 -0
  279. package/query-planner/semantic.d.ts +54 -0
  280. package/query-planner/semantic.d.ts.map +1 -0
  281. package/query-planner/semantic.js +1421 -0
  282. package/query-planner/types.d.ts +560 -0
  283. package/query-planner/types.d.ts.map +1 -0
  284. package/query-planner/types.js +49 -0
  285. package/query-planner/wfs-semantic.d.ts +58 -0
  286. package/query-planner/wfs-semantic.d.ts.map +1 -0
  287. package/query-planner/wfs-semantic.js +547 -0
  288. package/query-planner/wfs.d.ts +6 -0
  289. package/query-planner/wfs.d.ts.map +1 -0
  290. package/query-planner/wfs.js +71 -0
  291. package/react/external-map.d.ts +67 -0
  292. package/react/external-map.d.ts.map +1 -0
  293. package/react/external-map.js +63 -0
  294. package/react/honua-map.d.ts.map +1 -1
  295. package/react/honua-map.js +3 -2
  296. package/react/honua-source-layer.d.ts +110 -0
  297. package/react/honua-source-layer.d.ts.map +1 -0
  298. package/react/honua-source-layer.js +101 -0
  299. package/react/hooks.d.ts +28 -0
  300. package/react/hooks.d.ts.map +1 -1
  301. package/react/hooks.js +26 -4
  302. package/react/index.d.ts +8 -0
  303. package/react/index.d.ts.map +1 -1
  304. package/react/index.js +5 -0
  305. package/react/query-cache.d.ts +26 -4
  306. package/react/query-cache.d.ts.map +1 -1
  307. package/react/query-cache.js +51 -8
  308. package/react/selection.d.ts +177 -0
  309. package/react/selection.d.ts.map +1 -0
  310. package/react/selection.js +0 -0
  311. package/react/use-mounted-source.d.ts +69 -0
  312. package/react/use-mounted-source.d.ts.map +1 -0
  313. package/react/use-mounted-source.js +346 -0
  314. package/runtime/edit-snapping.d.ts +107 -0
  315. package/runtime/edit-snapping.d.ts.map +1 -0
  316. package/runtime/edit-snapping.js +190 -0
  317. package/runtime/errors.d.ts +3 -2
  318. package/runtime/errors.d.ts.map +1 -1
  319. package/runtime/errors.js +19 -2
  320. package/runtime/index.d.ts +8 -2
  321. package/runtime/index.d.ts.map +1 -1
  322. package/runtime/index.js +4 -4
  323. package/runtime/load-package.d.ts.map +1 -1
  324. package/runtime/load-package.js +8 -0
  325. package/runtime/map-package-validation.d.ts +0 -13
  326. package/runtime/map-package-validation.d.ts.map +1 -1
  327. package/runtime/map-package-validation.js +0 -12
  328. package/runtime/map-package.d.ts +1 -1
  329. package/runtime/map-package.d.ts.map +1 -1
  330. package/runtime/maplibre-renderer.d.ts +41 -0
  331. package/runtime/maplibre-renderer.d.ts.map +1 -0
  332. package/runtime/maplibre-renderer.js +322 -0
  333. package/runtime/pmtiles-protocol.d.ts +77 -0
  334. package/runtime/pmtiles-protocol.d.ts.map +1 -0
  335. package/runtime/pmtiles-protocol.js +120 -0
  336. package/runtime/query-tiles.d.ts +2 -1
  337. package/runtime/query-tiles.d.ts.map +1 -1
  338. package/runtime/query-tiles.js +6 -2
  339. package/runtime/source-bridge.d.ts +4 -4
  340. package/runtime/source-bridge.d.ts.map +1 -1
  341. package/runtime/source-bridge.js +36 -56
  342. package/runtime/style-interactions.d.ts +3 -2
  343. package/runtime/style-interactions.d.ts.map +1 -1
  344. package/runtime/style-interactions.js +11 -3
  345. package/runtime/terra-draw-sketch.d.ts +275 -0
  346. package/runtime/terra-draw-sketch.d.ts.map +1 -0
  347. package/runtime/terra-draw-sketch.js +404 -0
  348. package/source-capability-registry.d.ts +1 -0
  349. package/source-capability-registry.js +1 -0
  350. package/source-capability-types.d.ts +186 -0
  351. package/source-capability-types.js +7 -0
  352. package/style/index.d.ts +2 -0
  353. package/style/index.d.ts.map +1 -1
  354. package/style/index.js +2 -0
  355. package/style/renderers.d.ts +326 -0
  356. package/style/renderers.d.ts.map +1 -0
  357. package/style/renderers.js +517 -0
  358. package/webmap/convert-renderer.d.ts +24 -3
  359. package/webmap/convert-renderer.d.ts.map +1 -1
  360. package/webmap/convert-renderer.js +93 -112
  361. package/webmap/index.d.ts +1 -1
  362. package/webmap/index.d.ts.map +1 -1
  363. package/webmap/index.js +1 -1
@@ -0,0 +1,275 @@
1
+ /**
2
+ * terra-draw binding for edit-sketch workflows.
3
+ *
4
+ * Adapts [terra-draw](https://terradraw.io) draw modes (point, linestring,
5
+ * polygon, rectangle, circle, freehand, select) to the renderer-neutral
6
+ * {@link EditSketchWorkflowModel}, so completed and edited geometries flow
7
+ * through the contract edit-session path — undo/redo, validation, and
8
+ * `applyEdits` submission all apply unchanged.
9
+ *
10
+ * terra-draw is an OPTIONAL peer dependency. This module never imports it at
11
+ * module scope: {@link bindTerraDrawSketch} accepts a duck-typed instance the
12
+ * app constructed itself, and {@link createTerraDrawSketch} pulls in
13
+ * `terra-draw` + `terra-draw-maplibre-gl-adapter` lazily via dynamic
14
+ * `import()` the first time it is called. Importing the SDK without terra-draw
15
+ * installed stays side-effect free.
16
+ *
17
+ * Snapping bridges through terra-draw's own pointer pipeline:
18
+ * {@link createTerraDrawSnapping} produces a function with terra-draw's
19
+ * `Snapping.toCustom` shape backed by the SDK {@link SnapIndex}, so the
20
+ * linestring / polygon / polyline modes snap against SDK-indexed features.
21
+ * Modes without a `snapping` option (point, rectangle, circle, freehand) keep
22
+ * terra-draw's native behavior; that seam is documented rather than papered
23
+ * over.
24
+ *
25
+ * @module
26
+ */
27
+ import type { EditSketchTool, EditSketchToolCapability, EditSketchToolCapabilityInput, EditSketchWorkflowModel } from "../contract/edit-sketch.js";
28
+ import { type SnapIndex, type SnapResolution, type SnappingConfig } from "../contract/edit-snapping.js";
29
+ /** terra-draw feature ids are strings (uuid4 by default) or numbers. @experimental */
30
+ export type TerraDrawSketchFeatureId = string | number;
31
+ /** GeoJSON-shaped feature as stored by terra-draw. @experimental */
32
+ export interface TerraDrawSketchFeature {
33
+ id?: TerraDrawSketchFeatureId;
34
+ type?: string;
35
+ geometry: Record<string, unknown>;
36
+ properties?: Record<string, unknown>;
37
+ }
38
+ /** Context passed to terra-draw `finish` listeners. @experimental */
39
+ export interface TerraDrawSketchFinishContext {
40
+ /** The terra-draw mode that finished (e.g. `"polygon"`). */
41
+ mode: string;
42
+ /** The finishing action (`"draw"`, `"dragCoordinate"`, `"dragFeature"`, ...). */
43
+ action: string;
44
+ }
45
+ type TerraDrawFinishListener = (id: TerraDrawSketchFeatureId, context: TerraDrawSketchFinishContext) => void;
46
+ type TerraDrawChangeListener = (ids: TerraDrawSketchFeatureId[], type: string, context?: unknown) => void;
47
+ type TerraDrawSelectionListener = (id: TerraDrawSketchFeatureId) => void;
48
+ /**
49
+ * Minimal duck-typed subset of a terra-draw `TerraDraw` instance used by the
50
+ * binding, so the SDK carries no compile- or run-time dependency on the
51
+ * optional `terra-draw` peer (same pattern as `SnappingMap`).
52
+ *
53
+ * @experimental
54
+ */
55
+ export interface TerraDrawSketchInstance {
56
+ on(event: "finish", listener: TerraDrawFinishListener): void;
57
+ on(event: "change", listener: TerraDrawChangeListener): void;
58
+ on(event: "select", listener: TerraDrawSelectionListener): void;
59
+ on(event: "deselect", listener: TerraDrawSelectionListener): void;
60
+ off(event: "finish", listener: TerraDrawFinishListener): void;
61
+ off(event: "change", listener: TerraDrawChangeListener): void;
62
+ off(event: "select", listener: TerraDrawSelectionListener): void;
63
+ off(event: "deselect", listener: TerraDrawSelectionListener): void;
64
+ setMode(mode: string): void;
65
+ getSnapshot(): TerraDrawSketchFeature[];
66
+ getSnapshotFeature?(id: TerraDrawSketchFeatureId): TerraDrawSketchFeature | undefined;
67
+ addFeatures?(features: TerraDrawSketchFeature[]): unknown;
68
+ removeFeatures?(ids: TerraDrawSketchFeatureId[]): void;
69
+ }
70
+ /**
71
+ * Canonical terra-draw mode for each {@link EditSketchTool}. `buffer` has no
72
+ * terra-draw equivalent (it needs geometry-service support) and maps to
73
+ * `undefined`.
74
+ *
75
+ * @experimental
76
+ */
77
+ export declare const TERRA_DRAW_SKETCH_TOOL_MODES: Readonly<Record<EditSketchTool, string | undefined>>;
78
+ /**
79
+ * Map a terra-draw mode name to the {@link EditSketchTool} it produces.
80
+ * Freehand and sector/sensor modes draw polygons; marker draws points.
81
+ * Returns `undefined` for modes with no sketch-tool equivalent (`select`,
82
+ * `render`, `static`, custom modes).
83
+ *
84
+ * @experimental
85
+ */
86
+ export declare function editSketchToolForTerraDrawMode(mode: string): EditSketchTool | undefined;
87
+ /**
88
+ * Sketch-tool capability overrides for a workflow driven by terra-draw.
89
+ *
90
+ * The contract defaults mark `rectangle` and `circle` as unsupported because
91
+ * they need renderer support; terra-draw provides it. Pass the registered
92
+ * terra-draw mode names (defaults to every canonical drawing mode) and feed
93
+ * the result to `createEditSketchWorkflow({ sketchTools })`.
94
+ *
95
+ * @experimental
96
+ */
97
+ export declare function terraDrawSketchToolCapabilities(modes?: readonly string[]): Partial<Record<EditSketchTool, EditSketchToolCapabilityInput>>;
98
+ /** A finished terra-draw sketch as applied (or not) to the workflow model. @experimental */
99
+ export interface TerraDrawSketchFinishEvent {
100
+ featureId: TerraDrawSketchFeatureId;
101
+ /** The sketch tool the finished mode mapped to, when one exists. */
102
+ tool?: EditSketchTool;
103
+ /** The terra-draw mode that produced the feature. */
104
+ mode: string;
105
+ /** The terra-draw finishing action (`"draw"`, `"dragFeature"`, ...). */
106
+ action: string;
107
+ /** Geometry handed to the model (after `transformGeometry`). */
108
+ geometry: Record<string, unknown> | null;
109
+ /** Whether the model accepted the geometry (mapped + supported tool). */
110
+ applied: boolean;
111
+ }
112
+ /** @experimental */
113
+ export interface BindTerraDrawSketchOptions<T = Record<string, unknown>> {
114
+ /** Sketch workflow that receives finished geometries. */
115
+ model: EditSketchWorkflowModel<T>;
116
+ /**
117
+ * Transform a completed terra-draw geometry (always EPSG:4326 GeoJSON)
118
+ * before it reaches the model — e.g. `(g) => toWebMercator(g, 4326)` from
119
+ * `@honua/sdk-js/geometry` when the edit source stores Web Mercator.
120
+ */
121
+ transformGeometry?(geometry: Record<string, unknown>): Record<string, unknown>;
122
+ /**
123
+ * Inverse of {@link BindTerraDrawSketchOptions.transformGeometry}, used when
124
+ * pushing model geometry back into terra-draw after undo/redo.
125
+ */
126
+ restoreGeometry?(geometry: Record<string, unknown>): Record<string, unknown>;
127
+ /**
128
+ * Scope which terra-draw features drive the model. Features rejected by the
129
+ * filter still surface through {@link BindTerraDrawSketchOptions.onFinish}
130
+ * with `applied: false`.
131
+ */
132
+ featureFilter?(id: TerraDrawSketchFeatureId, feature: TerraDrawSketchFeature): boolean;
133
+ /** Override the terra-draw mode → sketch tool mapping. */
134
+ toolForMode?(mode: string): EditSketchTool | undefined;
135
+ /** Fired after every terra-draw `finish` event, applied or not. */
136
+ onFinish?(event: TerraDrawSketchFinishEvent): void;
137
+ /** Fired when the tracked sketch feature is deleted in terra-draw. */
138
+ onDelete?(featureId: TerraDrawSketchFeatureId): void;
139
+ onSelect?(featureId: TerraDrawSketchFeatureId): void;
140
+ onDeselect?(featureId: TerraDrawSketchFeatureId): void;
141
+ }
142
+ /** @experimental */
143
+ export interface TerraDrawSketchHandle {
144
+ /** The terra-draw feature currently backing the model geometry. */
145
+ readonly activeFeatureId: TerraDrawSketchFeatureId | undefined;
146
+ /** The feature currently selected in terra-draw select mode, if any. */
147
+ readonly selectedFeatureId: TerraDrawSketchFeatureId | undefined;
148
+ /**
149
+ * Activate the terra-draw mode for `tool` and arm the model
150
+ * (`model.startSketch`). Returns the tool capability; unsupported tools do
151
+ * not change the terra-draw mode.
152
+ */
153
+ setTool(tool: EditSketchTool): EditSketchToolCapability;
154
+ /** Switch terra-draw to select mode for update/reshape editing. */
155
+ select(): void;
156
+ /** Leave any drawing/select mode (terra-draw `"static"`). */
157
+ cancel(): void;
158
+ /** Undo via the workflow model, then sync terra-draw to the model. */
159
+ undo(): boolean;
160
+ /** Redo via the workflow model, then sync terra-draw to the model. */
161
+ redo(): boolean;
162
+ /**
163
+ * Replace the tracked terra-draw feature with the model's current geometry
164
+ * (applying `restoreGeometry` first). Returns `false` when the instance
165
+ * cannot mutate features (`addFeatures`/`removeFeatures` missing).
166
+ */
167
+ syncFromModel(): boolean;
168
+ /** Detach every terra-draw listener. */
169
+ remove(): void;
170
+ }
171
+ /**
172
+ * Bind a terra-draw instance to an {@link EditSketchWorkflowModel} (REQ-001).
173
+ *
174
+ * Every terra-draw `finish` event (freshly drawn features and select-mode
175
+ * edits: dragged features, dragged/inserted/deleted coordinates) maps the
176
+ * finishing mode to an {@link EditSketchTool} and applies the feature geometry
177
+ * through `model.setSketchGeometry`, so workflow undo/redo and validation
178
+ * cover terra-draw edits. Deleting the tracked feature stages a `null`
179
+ * geometry through the same undoable path.
180
+ *
181
+ * The caller owns the terra-draw instance lifecycle (`start`/`stop`); the
182
+ * binding only attaches listeners and detaches them in `remove()`.
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * const workflow = createEditSketchWorkflow({ source, sketchTools: terraDrawSketchToolCapabilities() });
187
+ * const handle = bindTerraDrawSketch(draw, { model: workflow });
188
+ * handle.setTool("polygon"); // draw.setMode("polygon") + workflow arming
189
+ * // ... user draws; workflow.snapshot().sketch.geometry now tracks terra-draw
190
+ * handle.undo(); // workflow history, mirrored back into terra-draw
191
+ * await workflow.submit(); // edit-session applyEdits path, unchanged
192
+ * ```
193
+ *
194
+ * @experimental
195
+ */
196
+ export declare function bindTerraDrawSketch<T = Record<string, unknown>>(draw: TerraDrawSketchInstance, options: BindTerraDrawSketchOptions<T>): TerraDrawSketchHandle;
197
+ /** Pointer event shape terra-draw hands to `Snapping.toCustom`. @experimental */
198
+ export interface TerraDrawSnapEvent {
199
+ lng: number;
200
+ lat: number;
201
+ containerX: number;
202
+ containerY: number;
203
+ }
204
+ /** Context shape terra-draw hands to `Snapping.toCustom`. @experimental */
205
+ export interface TerraDrawSnapContext {
206
+ project(lng: number, lat: number): {
207
+ x: number;
208
+ y: number;
209
+ };
210
+ }
211
+ /** @experimental */
212
+ export interface CreateTerraDrawSnappingOptions<T = Record<string, unknown>> {
213
+ /** Snap index over the loaded snap-source features. */
214
+ index: SnapIndex;
215
+ /** Workflow whose live snapping config gates resolution. */
216
+ model?: EditSketchWorkflowModel<T>;
217
+ /** Snapping configuration when no model is bound (or one-off overrides). */
218
+ config?: Partial<SnappingConfig>;
219
+ /** Fired on every resolved pointer position (snapped or not). */
220
+ onResolve?(resolution: SnapResolution): void;
221
+ }
222
+ /**
223
+ * Build a snapping function with terra-draw's `Snapping.toCustom` shape backed
224
+ * by the SDK snapping engine (REQ-004).
225
+ *
226
+ * terra-draw exposes per-mode snapping on its linestring, polygon, and
227
+ * polyline modes; pass the result as `snapping.toCustom` when constructing
228
+ * those modes and every drawn vertex snaps against the {@link SnapIndex}
229
+ * with the SDK's deterministic candidate ordering. Point, rectangle, circle,
230
+ * and freehand modes do not accept a `snapping` option in terra-draw — for
231
+ * those, terra-draw's pointer pipeline has no custom-snapping seam, so only
232
+ * terra-draw-native behavior applies.
233
+ *
234
+ * @example
235
+ * ```ts
236
+ * const snap = createTerraDrawSnapping({ index, model: workflow });
237
+ * new TerraDrawPolygonMode({ snapping: { toCustom: snap } });
238
+ * ```
239
+ *
240
+ * @experimental
241
+ */
242
+ export declare function createTerraDrawSnapping<T = Record<string, unknown>>(options: CreateTerraDrawSnappingOptions<T>): (event: TerraDrawSnapEvent, context: TerraDrawSnapContext) => [number, number] | undefined;
243
+ /** @experimental */
244
+ export interface CreateTerraDrawSketchOptions<T = Record<string, unknown>> extends Omit<BindTerraDrawSketchOptions<T>, never> {
245
+ /** Wire SDK snapping into the linestring/polygon modes' `toCustom` hook. */
246
+ snapping?: CreateTerraDrawSnappingOptions<T>;
247
+ }
248
+ /** @experimental */
249
+ export interface TerraDrawSketchController<T = Record<string, unknown>> extends TerraDrawSketchHandle {
250
+ /** The constructed terra-draw instance (duck-typed). */
251
+ readonly draw: TerraDrawSketchInstance;
252
+ /** The bound workflow model. */
253
+ readonly model: EditSketchWorkflowModel<T>;
254
+ /** Stop terra-draw and detach the binding. */
255
+ stop(): void;
256
+ }
257
+ /**
258
+ * One-call terra-draw sketch setup for a MapLibre map.
259
+ *
260
+ * Dynamically imports the optional `terra-draw` and
261
+ * `terra-draw-maplibre-gl-adapter` peers (throwing a descriptive error when
262
+ * either is missing), registers the canonical drawing modes (point,
263
+ * linestring, polygon, rectangle, circle, freehand, select), wires SDK
264
+ * snapping into the modes that accept a custom snapping hook, starts the
265
+ * instance, and returns it bound to the workflow model via
266
+ * {@link bindTerraDrawSketch}.
267
+ *
268
+ * Apps that need custom mode options should construct terra-draw themselves
269
+ * and call {@link bindTerraDrawSketch} directly.
270
+ *
271
+ * @experimental
272
+ */
273
+ export declare function createTerraDrawSketch<T = Record<string, unknown>>(map: unknown, options: CreateTerraDrawSketchOptions<T>): Promise<TerraDrawSketchController<T>>;
274
+ export {};
275
+ //# sourceMappingURL=terra-draw-sketch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terra-draw-sketch.d.ts","sourceRoot":"","sources":["../../../src/runtime/terra-draw-sketch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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