@honua/app-platform 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 (381) 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 +11 -2
  14. package/contract/index.d.ts.map +1 -1
  15. package/contract/index.js +4 -1
  16. package/contract/pmtiles.d.ts +31 -0
  17. package/contract/pmtiles.d.ts.map +1 -1
  18. package/contract/pmtiles.js +60 -20
  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 +35 -17
  32. package/contract/source.d.ts.map +1 -1
  33. package/contract/source.js +267 -71
  34. package/contract/types.d.ts +140 -4
  35. package/contract/types.d.ts.map +1 -1
  36. package/contract/types.js +6 -14
  37. package/core/bounded-json.d.ts +4 -0
  38. package/core/bounded-json.d.ts.map +1 -0
  39. package/core/bounded-json.js +38 -0
  40. package/core/cache-state.d.ts +9 -0
  41. package/core/cache-state.d.ts.map +1 -1
  42. package/core/cache-state.js +10 -0
  43. package/core/capabilities-xml.d.ts +33 -0
  44. package/core/capabilities-xml.d.ts.map +1 -0
  45. package/core/capabilities-xml.js +331 -0
  46. package/core/client.d.ts +4 -1
  47. package/core/client.d.ts.map +1 -1
  48. package/core/client.js +115 -29
  49. package/core/error-classifications.d.ts +153 -0
  50. package/core/error-classifications.d.ts.map +1 -0
  51. package/core/error-classifications.js +140 -0
  52. package/core/error-code-registry.d.ts +158 -0
  53. package/core/error-code-registry.d.ts.map +1 -0
  54. package/core/error-code-registry.js +143 -0
  55. package/core/error-envelope.d.ts +68 -0
  56. package/core/error-envelope.d.ts.map +1 -0
  57. package/core/error-envelope.js +357 -0
  58. package/core/errors.d.ts +45 -29
  59. package/core/errors.d.ts.map +1 -1
  60. package/core/errors.js +97 -50
  61. package/core/geoparquet-sql.d.ts +30 -2
  62. package/core/geoparquet-sql.d.ts.map +1 -1
  63. package/core/geoparquet-sql.js +38 -3
  64. package/core/odata-key-path.d.ts +12 -0
  65. package/core/odata-key-path.d.ts.map +1 -0
  66. package/core/odata-key-path.js +28 -0
  67. package/core/odata-write-codec.d.ts +66 -0
  68. package/core/odata-write-codec.d.ts.map +1 -0
  69. package/core/odata-write-codec.js +1083 -0
  70. package/core/odata.d.ts +59 -7
  71. package/core/odata.d.ts.map +1 -1
  72. package/core/odata.js +431 -99
  73. package/core/ogc-features.d.ts.map +1 -1
  74. package/core/ogc-features.js +3 -0
  75. package/core/ogc-maps.d.ts +7 -0
  76. package/core/ogc-maps.d.ts.map +1 -1
  77. package/core/ogc-maps.js +46 -7
  78. package/core/ogc-processes.d.ts +2 -1
  79. package/core/ogc-processes.d.ts.map +1 -1
  80. package/core/ogc-processes.js +33 -5
  81. package/core/ogc-records.d.ts +9 -0
  82. package/core/ogc-records.d.ts.map +1 -1
  83. package/core/ogc-records.js +78 -29
  84. package/core/ogc-tiles.d.ts +10 -1
  85. package/core/ogc-tiles.d.ts.map +1 -1
  86. package/core/ogc-tiles.js +56 -17
  87. package/core/path-utils.d.ts +9 -0
  88. package/core/path-utils.d.ts.map +1 -1
  89. package/core/path-utils.js +19 -0
  90. package/core/protocol-transport.d.ts +1 -0
  91. package/core/protocol-transport.d.ts.map +1 -1
  92. package/core/request-pipeline.d.ts.map +1 -1
  93. package/core/request-pipeline.js +1 -1
  94. package/core/spatial-filter.d.ts +8 -4
  95. package/core/spatial-filter.d.ts.map +1 -1
  96. package/core/spatial-filter.js +206 -16
  97. package/core/stac-static.d.ts +6 -2
  98. package/core/stac-static.d.ts.map +1 -1
  99. package/core/stac-static.js +260 -69
  100. package/core/surfaces.d.ts.map +1 -1
  101. package/core/surfaces.js +69 -5
  102. package/core/types.d.ts +125 -7
  103. package/core/types.d.ts.map +1 -1
  104. package/core/wfs-capabilities.d.ts +2 -0
  105. package/core/wfs-capabilities.d.ts.map +1 -1
  106. package/core/wfs-capabilities.js +8 -1
  107. package/core/wfs.d.ts.map +1 -1
  108. package/core/wfs.js +10 -0
  109. package/core/wms-capabilities.d.ts +56 -84
  110. package/core/wms-capabilities.d.ts.map +1 -1
  111. package/core/wms-capabilities.js +212 -509
  112. package/core/wmts-capabilities.d.ts +62 -62
  113. package/core/wmts-capabilities.d.ts.map +1 -1
  114. package/core/wmts-capabilities.js +224 -371
  115. package/esri-compat/editor.d.ts +8 -0
  116. package/esri-compat/editor.d.ts.map +1 -1
  117. package/esri-compat/editor.js +13 -0
  118. package/esri-compat/feature-layer.d.ts +2 -0
  119. package/esri-compat/feature-layer.d.ts.map +1 -1
  120. package/esri-compat/feature-layer.js +1 -0
  121. package/esri-compat/layer-list.d.ts +11 -0
  122. package/esri-compat/layer-list.d.ts.map +1 -1
  123. package/esri-compat/layer-list.js +49 -0
  124. package/esri-compat/legend.d.ts +10 -0
  125. package/esri-compat/legend.d.ts.map +1 -1
  126. package/esri-compat/legend.js +27 -0
  127. package/esri-compat/portal.d.ts +197 -0
  128. package/esri-compat/portal.d.ts.map +1 -0
  129. package/esri-compat/portal.js +251 -0
  130. package/esri-compat/renderer-objects.d.ts +40 -0
  131. package/esri-compat/renderer-objects.d.ts.map +1 -0
  132. package/esri-compat/renderer-objects.js +62 -0
  133. package/esri-compat/sketch.d.ts +43 -0
  134. package/esri-compat/sketch.d.ts.map +1 -1
  135. package/esri-compat/sketch.js +46 -0
  136. package/esri-compat/snapping.d.ts +43 -0
  137. package/esri-compat/snapping.d.ts.map +1 -0
  138. package/esri-compat/snapping.js +45 -0
  139. package/esri-compat/url.d.ts.map +1 -1
  140. package/esri-compat/url.js +1 -1
  141. package/esri-compat/widget-host.d.ts +84 -0
  142. package/esri-compat/widget-host.d.ts.map +1 -0
  143. package/esri-compat/widget-host.js +159 -0
  144. package/generated-app/errors.d.ts +18 -2
  145. package/generated-app/errors.d.ts.map +1 -1
  146. package/generated-app/errors.js +44 -11
  147. package/geocoding/index.d.ts +7 -0
  148. package/geocoding/index.d.ts.map +1 -1
  149. package/geocoding/index.js +5 -0
  150. package/geocoding/provider-http.d.ts +37 -0
  151. package/geocoding/provider-http.d.ts.map +1 -0
  152. package/geocoding/provider-http.js +91 -0
  153. package/geocoding/provider.d.ts +145 -0
  154. package/geocoding/provider.d.ts.map +1 -0
  155. package/geocoding/provider.js +41 -0
  156. package/geocoding/providers/honua.d.ts +28 -0
  157. package/geocoding/providers/honua.d.ts.map +1 -0
  158. package/geocoding/providers/honua.js +68 -0
  159. package/geocoding/providers/nominatim.d.ts +47 -0
  160. package/geocoding/providers/nominatim.d.ts.map +1 -0
  161. package/geocoding/providers/nominatim.js +105 -0
  162. package/geocoding/providers/pelias.d.ts +40 -0
  163. package/geocoding/providers/pelias.d.ts.map +1 -0
  164. package/geocoding/providers/pelias.js +115 -0
  165. package/geocoding/providers/photon.d.ts +39 -0
  166. package/geocoding/providers/photon.d.ts.map +1 -0
  167. package/geocoding/providers/photon.js +107 -0
  168. package/geometry/convert.d.ts +13 -0
  169. package/geometry/convert.d.ts.map +1 -0
  170. package/geometry/convert.js +12 -0
  171. package/geometry/index.d.ts +17 -0
  172. package/geometry/index.d.ts.map +1 -0
  173. package/geometry/index.js +15 -0
  174. package/geometry/internal.d.ts +25 -0
  175. package/geometry/internal.d.ts.map +1 -0
  176. package/geometry/internal.js +40 -0
  177. package/geometry/ops.d.ts +71 -0
  178. package/geometry/ops.d.ts.map +1 -0
  179. package/geometry/ops.js +147 -0
  180. package/geometry/project.d.ts +40 -0
  181. package/geometry/project.d.ts.map +1 -0
  182. package/geometry/project.js +88 -0
  183. package/geometry/types.d.ts +36 -0
  184. package/geometry/types.d.ts.map +1 -0
  185. package/geometry/types.js +12 -0
  186. package/map/automatic-mount-integration.d.ts +134 -0
  187. package/map/automatic-mount-integration.d.ts.map +1 -0
  188. package/map/automatic-mount-integration.js +305 -0
  189. package/map/automatic-source-strategy.d.ts +125 -0
  190. package/map/automatic-source-strategy.d.ts.map +1 -0
  191. package/map/automatic-source-strategy.js +494 -0
  192. package/map/data-to-map-bridge.d.ts +293 -0
  193. package/map/data-to-map-bridge.d.ts.map +1 -0
  194. package/map/data-to-map-bridge.js +817 -0
  195. package/map/geojson-projection.d.ts +33 -0
  196. package/map/geojson-projection.d.ts.map +1 -0
  197. package/map/geojson-projection.js +118 -0
  198. package/map/index.d.ts +14 -0
  199. package/map/index.d.ts.map +1 -1
  200. package/map/index.js +8 -0
  201. package/map/raster-source-spec.d.ts +30 -0
  202. package/map/raster-source-spec.d.ts.map +1 -0
  203. package/map/raster-source-spec.js +190 -0
  204. package/map/raster-source-strategy.d.ts +65 -0
  205. package/map/raster-source-strategy.d.ts.map +1 -0
  206. package/map/raster-source-strategy.js +232 -0
  207. package/map/source-to-maplibre.d.ts +91 -0
  208. package/map/source-to-maplibre.d.ts.map +1 -0
  209. package/map/source-to-maplibre.js +454 -0
  210. package/map/temporal-playback.d.ts +139 -0
  211. package/map/temporal-playback.d.ts.map +1 -0
  212. package/map/temporal-playback.js +247 -0
  213. package/package.json +33 -2
  214. package/query-planner/canonical.d.ts +7 -0
  215. package/query-planner/canonical.d.ts.map +1 -0
  216. package/query-planner/canonical.js +145 -0
  217. package/query-planner/cql2-json.d.ts +17 -0
  218. package/query-planner/cql2-json.d.ts.map +1 -0
  219. package/query-planner/cql2-json.js +646 -0
  220. package/query-planner/diagnostics.d.ts +35 -0
  221. package/query-planner/diagnostics.d.ts.map +1 -0
  222. package/query-planner/diagnostics.js +373 -0
  223. package/query-planner/duckdb.d.ts +79 -0
  224. package/query-planner/duckdb.d.ts.map +1 -0
  225. package/query-planner/duckdb.js +758 -0
  226. package/query-planner/execution-context.d.ts +5 -0
  227. package/query-planner/execution-context.d.ts.map +1 -0
  228. package/query-planner/execution-context.js +50 -0
  229. package/query-planner/executor.d.ts +5 -0
  230. package/query-planner/executor.d.ts.map +1 -0
  231. package/query-planner/executor.js +223 -0
  232. package/query-planner/geoservices.d.ts +91 -0
  233. package/query-planner/geoservices.d.ts.map +1 -0
  234. package/query-planner/geoservices.js +667 -0
  235. package/query-planner/grpc.d.ts +100 -0
  236. package/query-planner/grpc.d.ts.map +1 -0
  237. package/query-planner/grpc.js +736 -0
  238. package/query-planner/index.d.ts +44 -0
  239. package/query-planner/index.d.ts.map +1 -0
  240. package/query-planner/index.js +30 -0
  241. package/query-planner/ir.d.ts +20 -0
  242. package/query-planner/ir.d.ts.map +1 -0
  243. package/query-planner/ir.js +417 -0
  244. package/query-planner/local-aggregate.d.ts +5 -0
  245. package/query-planner/local-aggregate.d.ts.map +1 -0
  246. package/query-planner/local-aggregate.js +126 -0
  247. package/query-planner/odata.d.ts +48 -0
  248. package/query-planner/odata.d.ts.map +1 -0
  249. package/query-planner/odata.js +662 -0
  250. package/query-planner/ogc-compiler.d.ts +55 -0
  251. package/query-planner/ogc-compiler.d.ts.map +1 -0
  252. package/query-planner/ogc-compiler.js +480 -0
  253. package/query-planner/ogc-features.d.ts +53 -0
  254. package/query-planner/ogc-features.d.ts.map +1 -0
  255. package/query-planner/ogc-features.js +617 -0
  256. package/query-planner/planner.d.ts +17 -0
  257. package/query-planner/planner.d.ts.map +1 -0
  258. package/query-planner/planner.js +818 -0
  259. package/query-planner/resource.d.ts +94 -0
  260. package/query-planner/resource.d.ts.map +1 -0
  261. package/query-planner/resource.js +526 -0
  262. package/query-planner/semantic-canonical.d.ts +15 -0
  263. package/query-planner/semantic-canonical.d.ts.map +1 -0
  264. package/query-planner/semantic-canonical.js +62 -0
  265. package/query-planner/semantic-compat.d.ts +10 -0
  266. package/query-planner/semantic-compat.d.ts.map +1 -0
  267. package/query-planner/semantic-compat.js +35 -0
  268. package/query-planner/semantic-compiler.d.ts +64 -0
  269. package/query-planner/semantic-compiler.d.ts.map +1 -0
  270. package/query-planner/semantic-compiler.js +81 -0
  271. package/query-planner/semantic-literals.d.ts +30 -0
  272. package/query-planner/semantic-literals.d.ts.map +1 -0
  273. package/query-planner/semantic-literals.js +133 -0
  274. package/query-planner/semantic-types.d.ts +265 -0
  275. package/query-planner/semantic-types.d.ts.map +1 -0
  276. package/query-planner/semantic-types.js +1 -0
  277. package/query-planner/semantic.d.ts +54 -0
  278. package/query-planner/semantic.d.ts.map +1 -0
  279. package/query-planner/semantic.js +1421 -0
  280. package/query-planner/types.d.ts +560 -0
  281. package/query-planner/types.d.ts.map +1 -0
  282. package/query-planner/types.js +49 -0
  283. package/query-planner/wfs-semantic.d.ts +58 -0
  284. package/query-planner/wfs-semantic.d.ts.map +1 -0
  285. package/query-planner/wfs-semantic.js +547 -0
  286. package/query-planner/wfs.d.ts +6 -0
  287. package/query-planner/wfs.d.ts.map +1 -0
  288. package/query-planner/wfs.js +71 -0
  289. package/realtime/contract.d.ts +142 -0
  290. package/realtime/contract.d.ts.map +1 -0
  291. package/realtime/contract.js +154 -0
  292. package/realtime/honua-server.d.ts.map +1 -1
  293. package/realtime/honua-server.js +13 -8
  294. package/realtime/index.d.ts +19 -4
  295. package/realtime/index.d.ts.map +1 -1
  296. package/realtime/index.js +14 -4
  297. package/realtime/odata-delta.d.ts +114 -0
  298. package/realtime/odata-delta.d.ts.map +1 -0
  299. package/realtime/odata-delta.js +483 -0
  300. package/realtime/resumable-transport.d.ts +111 -0
  301. package/realtime/resumable-transport.d.ts.map +1 -0
  302. package/realtime/resumable-transport.js +406 -0
  303. package/realtime/resumable.d.ts +104 -0
  304. package/realtime/resumable.d.ts.map +1 -0
  305. package/realtime/resumable.js +632 -0
  306. package/realtime/sse.d.ts.map +1 -1
  307. package/realtime/sse.js +27 -23
  308. package/realtime/websocket.d.ts +60 -0
  309. package/realtime/websocket.d.ts.map +1 -0
  310. package/realtime/websocket.js +157 -0
  311. package/realtime/wire.d.ts +27 -0
  312. package/realtime/wire.d.ts.map +1 -0
  313. package/realtime/wire.js +57 -0
  314. package/replica-sync/errors.d.ts +2 -1
  315. package/replica-sync/errors.d.ts.map +1 -1
  316. package/replica-sync/errors.js +33 -2
  317. package/runtime/edit-snapping.d.ts +107 -0
  318. package/runtime/edit-snapping.d.ts.map +1 -0
  319. package/runtime/edit-snapping.js +190 -0
  320. package/runtime/errors.d.ts +3 -2
  321. package/runtime/errors.d.ts.map +1 -1
  322. package/runtime/errors.js +19 -2
  323. package/runtime/index.d.ts +6 -0
  324. package/runtime/index.d.ts.map +1 -1
  325. package/runtime/index.js +3 -0
  326. package/runtime/maplibre-renderer.d.ts +41 -0
  327. package/runtime/maplibre-renderer.d.ts.map +1 -0
  328. package/runtime/maplibre-renderer.js +322 -0
  329. package/runtime/query-tiles.d.ts +2 -1
  330. package/runtime/query-tiles.d.ts.map +1 -1
  331. package/runtime/query-tiles.js +6 -2
  332. package/runtime/source-bridge.d.ts +4 -4
  333. package/runtime/source-bridge.d.ts.map +1 -1
  334. package/runtime/source-bridge.js +9 -56
  335. package/runtime/style-interactions.d.ts +3 -2
  336. package/runtime/style-interactions.d.ts.map +1 -1
  337. package/runtime/style-interactions.js +11 -3
  338. package/runtime/terra-draw-sketch.d.ts +275 -0
  339. package/runtime/terra-draw-sketch.d.ts.map +1 -0
  340. package/runtime/terra-draw-sketch.js +404 -0
  341. package/scene-workspace/index.d.ts +4 -0
  342. package/scene-workspace/index.d.ts.map +1 -1
  343. package/scene-workspace/index.js +2 -0
  344. package/scene-workspace/source-to-cesium.d.ts +116 -0
  345. package/scene-workspace/source-to-cesium.d.ts.map +1 -0
  346. package/scene-workspace/source-to-cesium.js +791 -0
  347. package/scene-workspace/state-sync.d.ts +147 -0
  348. package/scene-workspace/state-sync.d.ts.map +1 -0
  349. package/scene-workspace/state-sync.js +1123 -0
  350. package/source-capability-registry.d.ts +1 -0
  351. package/source-capability-registry.js +1 -0
  352. package/source-capability-types.d.ts +186 -0
  353. package/source-capability-types.js +7 -0
  354. package/style/index.d.ts +2 -0
  355. package/style/index.d.ts.map +1 -1
  356. package/style/index.js +2 -0
  357. package/style/renderers.d.ts +326 -0
  358. package/style/renderers.d.ts.map +1 -0
  359. package/style/renderers.js +517 -0
  360. package/web-components/controller.d.ts +2 -0
  361. package/web-components/controller.d.ts.map +1 -1
  362. package/web-components/controller.js +49 -8
  363. package/web-components/elements.d.ts +95 -1
  364. package/web-components/elements.d.ts.map +1 -1
  365. package/web-components/elements.js +458 -19
  366. package/web-components/index.d.ts +8 -1
  367. package/web-components/index.d.ts.map +1 -1
  368. package/web-components/index.js +7 -0
  369. package/web-components/maplibre-renderer.d.ts.map +1 -1
  370. package/web-components/maplibre-renderer.js +87 -0
  371. package/web-components/measurement.d.ts +69 -0
  372. package/web-components/measurement.d.ts.map +1 -0
  373. package/web-components/measurement.js +523 -0
  374. package/web-components/types.d.ts +109 -0
  375. package/web-components/types.d.ts.map +1 -1
  376. package/webmap/convert-renderer.d.ts +24 -3
  377. package/webmap/convert-renderer.d.ts.map +1 -1
  378. package/webmap/convert-renderer.js +93 -112
  379. package/webmap/index.d.ts +1 -1
  380. package/webmap/index.d.ts.map +1 -1
  381. package/webmap/index.js +1 -1
@@ -8,6 +8,8 @@ export class HonuaMapLibreRenderer {
8
8
  #lastViewportKey;
9
9
  #syncingViewport = false;
10
10
  #layerVisibility = new Map();
11
+ #layerOpacity = new Map();
12
+ #layerOrderKey;
11
13
  #selectionTarget;
12
14
  #featureStates = new Map();
13
15
  #state;
@@ -31,6 +33,8 @@ export class HonuaMapLibreRenderer {
31
33
  return;
32
34
  }
33
35
  this.#applyLayerVisibility(state);
36
+ this.#applyLayerOpacity(state);
37
+ this.#applyLayerOrder(state);
34
38
  this.#applyViewport(state);
35
39
  this.#applyFeatureStates(state.featureStates);
36
40
  this.#applySelection(state);
@@ -44,6 +48,8 @@ export class HonuaMapLibreRenderer {
44
48
  this.#map = undefined;
45
49
  this.#loadedPackageKey = undefined;
46
50
  this.#layerVisibility.clear();
51
+ this.#layerOpacity.clear();
52
+ this.#layerOrderKey = undefined;
47
53
  this.#featureStates.clear();
48
54
  this.#selectionTarget = undefined;
49
55
  this.#options.container.replaceChildren();
@@ -88,6 +94,11 @@ export class HonuaMapLibreRenderer {
88
94
  }
89
95
  this.#runtime = runtime;
90
96
  this.#loadedPackageKey = mapPackageKey(mapPackage);
97
+ // Seed the order tracker with the order the map actually renders (the
98
+ // composed style), so a controller order that already diverged — e.g. a
99
+ // layer-list reorder issued while the package was still loading — is
100
+ // replayed by the next #applyLayerOrder pass instead of being absorbed.
101
+ this.#layerOrderKey = layerOrderKey(runtime.composedStyle.layers.map((layer) => layer.id));
91
102
  this.#bindViewport(map);
92
103
  this.#bindLayerInteractions(runtime);
93
104
  map.resize?.();
@@ -115,6 +126,8 @@ export class HonuaMapLibreRenderer {
115
126
  this.#map?.remove?.();
116
127
  this.#map = undefined;
117
128
  this.#layerVisibility.clear();
129
+ this.#layerOpacity.clear();
130
+ this.#layerOrderKey = undefined;
118
131
  this.#featureStates.clear();
119
132
  this.#selectionTarget = undefined;
120
133
  this.#options.container.replaceChildren();
@@ -248,6 +261,53 @@ export class HonuaMapLibreRenderer {
248
261
  }
249
262
  }
250
263
  }
264
+ #applyLayerOpacity(state) {
265
+ const map = this.#map;
266
+ if (!map?.setPaintProperty)
267
+ return;
268
+ for (const layer of state.layers) {
269
+ if (layer.opacity === undefined)
270
+ continue;
271
+ const previous = this.#layerOpacity.get(layer.id);
272
+ if (previous === layer.opacity)
273
+ continue;
274
+ this.#layerOpacity.set(layer.id, layer.opacity);
275
+ if (map.getLayer && !map.getLayer(layer.id))
276
+ continue;
277
+ for (const property of opacityPaintProperties(layer.type)) {
278
+ try {
279
+ map.setPaintProperty(layer.id, property, layer.opacity);
280
+ }
281
+ catch (error) {
282
+ this.#emitError(error);
283
+ }
284
+ }
285
+ }
286
+ }
287
+ #applyLayerOrder(state) {
288
+ const key = layerOrderKey(state.layers.map((layer) => layer.id));
289
+ // `#layerOrderKey` is seeded from the composed style order when the map
290
+ // package loads (see #load), so a matching key means the map already
291
+ // renders this order and overlays are never hoisted above host-managed
292
+ // base layers gratuitously. Any diverging key — including a reorder
293
+ // issued while the package was still loading — is replayed onto the map.
294
+ if (key === this.#layerOrderKey)
295
+ return;
296
+ this.#layerOrderKey = key;
297
+ const map = this.#map;
298
+ if (!map?.moveLayer)
299
+ return;
300
+ for (const layer of state.layers) {
301
+ if (map.getLayer && !map.getLayer(layer.id))
302
+ continue;
303
+ try {
304
+ map.moveLayer(layer.id);
305
+ }
306
+ catch (error) {
307
+ this.#emitError(error);
308
+ }
309
+ }
310
+ }
251
311
  #applyViewport(state) {
252
312
  if (this.#syncingViewport || !this.#runtime)
253
313
  return;
@@ -384,6 +444,33 @@ function featureStateKey(target) {
384
444
  function stableKey(value) {
385
445
  return JSON.stringify(value);
386
446
  }
447
+ /** Order-tracking key over layer ids (NUL-delimited so ids with spaces stay distinct). */
448
+ function layerOrderKey(ids) {
449
+ return ids.join("\u0000");
450
+ }
451
+ /** Paint properties that carry a layer's overall opacity, by layer type. */
452
+ function opacityPaintProperties(type) {
453
+ switch (type) {
454
+ case "fill":
455
+ return ["fill-opacity"];
456
+ case "line":
457
+ return ["line-opacity"];
458
+ case "circle":
459
+ return ["circle-opacity", "circle-stroke-opacity"];
460
+ case "symbol":
461
+ return ["icon-opacity", "text-opacity"];
462
+ case "raster":
463
+ return ["raster-opacity"];
464
+ case "background":
465
+ return ["background-opacity"];
466
+ case "fill-extrusion":
467
+ return ["fill-extrusion-opacity"];
468
+ case "heatmap":
469
+ return ["heatmap-opacity"];
470
+ default:
471
+ return [];
472
+ }
473
+ }
387
474
  function viewportKey(viewport) {
388
475
  return JSON.stringify({
389
476
  bbox: viewport.bbox,
@@ -0,0 +1,69 @@
1
+ /**
2
+ * `<honua-measurement>` — the survival-tier distance/area measurement widget
3
+ * (issue #493).
4
+ *
5
+ * Unlike `<honua-measure-control>` (which requires a host-supplied drawing
6
+ * provider), this element ships a complete, deliberately simple drawing
7
+ * interaction on top of the map's own pointer events:
8
+ *
9
+ * - **click** adds a vertex;
10
+ * - **double-click** finishes the sketch (the map's double-click zoom is
11
+ * suspended while a mode is active when the map exposes the handle);
12
+ * - **Escape** (or the Cancel button) discards the in-progress sketch.
13
+ *
14
+ * Distance and area are computed with the geodesic ops from the public
15
+ * `@honua/geometry` surface (`length` / `area`), so the widget's numbers match
16
+ * `geometryEngine` parity math everywhere else in the SDK.
17
+ *
18
+ * ## Wiring
19
+ * - `element.map = map` (any MapLibre `Map`; duck-typed via
20
+ * {@link HonuaMeasurementMap}), or
21
+ * - declaratively via `for="<honua-map id>"` — the element listens for the
22
+ * `honua-map-ready` event dispatched by `<honua-map>`.
23
+ *
24
+ * When the map exposes style mutation methods (`addSource` / `addLayer`), the
25
+ * in-progress sketch renders as a line + fill overlay in a
26
+ * `honua-measurement` GeoJSON source; on plain stubs the overlay is skipped.
27
+ *
28
+ * ## Accessibility
29
+ * Mode buttons are a `role="group"` of toggle buttons with `aria-pressed`;
30
+ * the live result is announced through a `role="status"` region; Finish /
31
+ * Cancel buttons provide keyboard-operable equivalents of double-click /
32
+ * Escape. Theme via the `--honua-ui-*` CSS custom properties.
33
+ *
34
+ * @module
35
+ */
36
+ import type { HonuaMeasureMode, HonuaMeasureResult, HonuaMeasurementMap } from "./types.js";
37
+ declare const HTMLElementBase: typeof HTMLElement;
38
+ type LngLat = readonly [number, number];
39
+ export declare class HonuaMeasurementElement extends HTMLElementBase {
40
+ #private;
41
+ static get observedAttributes(): string[];
42
+ /** The MapLibre map this widget draws on. */
43
+ get map(): HonuaMeasurementMap | undefined;
44
+ set map(map: HonuaMeasurementMap | undefined);
45
+ /** Wires the widget to a MapLibre map. Equivalent to setting `.map`. */
46
+ connect(map: HonuaMeasurementMap): void;
47
+ /** The active measure mode. */
48
+ get mode(): HonuaMeasureMode;
49
+ /** The current (or last finished) measurement result. */
50
+ get result(): HonuaMeasureResult | undefined;
51
+ /** The in-progress vertex list (`[lng, lat]` positions). */
52
+ get vertices(): readonly LngLat[];
53
+ /** Activates a measure mode; `"off"` cancels any in-progress sketch. */
54
+ setMode(mode: HonuaMeasureMode): void;
55
+ /** Adds a vertex programmatically (same as a map click). */
56
+ addVertex(lngLat: LngLat): void;
57
+ /** Finishes the in-progress sketch (same as double-click). */
58
+ finish(): void;
59
+ /** Cancels the in-progress sketch (same as Escape); the mode stays active. */
60
+ cancel(): void;
61
+ attributeChangedCallback(name: string): void;
62
+ connectedCallback(): void;
63
+ disconnectedCallback(): void;
64
+ protected render(): void;
65
+ }
66
+ /** Registers `<honua-measurement>`; skipped when the tag is already defined. */
67
+ export declare function defineHonuaMeasurement(registry?: CustomElementRegistry): void;
68
+ export {};
69
+ //# sourceMappingURL=measurement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measurement.d.ts","sourceRoot":"","sources":["../../../src/web-components/measurement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAA4B,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAQtH,QAAA,MAAM,eAAe,EAAE,OAAO,WAAkF,CAAC;AAMjH,KAAK,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExC,qBAAa,uBAAwB,SAAQ,eAAe;;IAC1D,WAAkB,kBAAkB,IAAI,MAAM,EAAE,CAE/C;IAaD,6CAA6C;IAC7C,IAAW,GAAG,IAAI,mBAAmB,GAAG,SAAS,CAEhD;IAED,IAAW,GAAG,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,EAMlD;IAED,wEAAwE;IACjE,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI;IAI9C,+BAA+B;IAC/B,IAAW,IAAI,IAAI,gBAAgB,CAElC;IAED,yDAAyD;IACzD,IAAW,MAAM,IAAI,kBAAkB,GAAG,SAAS,CAElD;IAED,4DAA4D;IAC5D,IAAW,QAAQ,IAAI,SAAS,MAAM,EAAE,CAEvC;IAED,wEAAwE;IACjE,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAY5C,4DAA4D;IACrD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAatC,8DAA8D;IACvD,MAAM,IAAI,IAAI;IASrB,8EAA8E;IACvE,MAAM,IAAI,IAAI;IAUd,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ5C,iBAAiB,IAAI,IAAI;IAQzB,oBAAoB,IAAI,IAAI;IAsMnC,SAAS,CAAC,MAAM,IAAI,IAAI;CAgFzB;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,QAAQ,wBAA2B,GAAG,IAAI,CAKhF"}