@webquark/core 1.1.0-dev.8 → 1.1.0-dev.9

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 (969) hide show
  1. package/README.md +10 -138
  2. package/dist/browser/components/index.d.ts +1 -0
  3. package/dist/browser/components/index.js +1 -0
  4. package/dist/browser/components/q-accordion.d.ts +1 -0
  5. package/dist/browser/components/q-accordion.js +1 -0
  6. package/dist/browser/components/q-alert.d.ts +1 -0
  7. package/dist/browser/components/q-alert.js +1 -0
  8. package/dist/browser/components/q-avatar.d.ts +1 -0
  9. package/dist/browser/components/q-avatar.js +1 -0
  10. package/dist/browser/components/q-banner.d.ts +1 -0
  11. package/dist/browser/components/q-banner.js +1 -0
  12. package/dist/browser/components/q-button.d.ts +1 -0
  13. package/dist/browser/components/q-button.js +1 -0
  14. package/dist/browser/components/q-card.d.ts +1 -0
  15. package/dist/browser/components/q-card.js +1 -0
  16. package/dist/browser/components/q-carousel.d.ts +1 -0
  17. package/dist/browser/components/q-carousel.js +1 -0
  18. package/dist/browser/components/q-chip.d.ts +1 -0
  19. package/dist/browser/components/q-chip.js +1 -0
  20. package/dist/browser/components/q-conversation-bubble.d.ts +1 -0
  21. package/dist/browser/components/q-conversation-bubble.js +1 -0
  22. package/dist/browser/components/q-data-table.d.ts +1 -0
  23. package/dist/browser/components/q-data-table.js +1 -0
  24. package/dist/browser/components/q-dialog.d.ts +1 -0
  25. package/dist/browser/components/q-dialog.js +1 -0
  26. package/dist/browser/components/q-dropdown.d.ts +1 -0
  27. package/dist/browser/components/q-dropdown.js +1 -0
  28. package/dist/browser/components/q-form.d.ts +1 -0
  29. package/dist/browser/components/q-form.js +1 -0
  30. package/dist/browser/components/q-grid.d.ts +1 -0
  31. package/dist/browser/components/q-grid.js +1 -0
  32. package/dist/browser/components/q-icon.d.ts +1 -0
  33. package/dist/browser/components/q-icon.js +1 -0
  34. package/dist/browser/components/q-image-comparison.d.ts +1 -0
  35. package/dist/browser/components/q-image-comparison.js +1 -0
  36. package/dist/browser/components/q-inline.d.ts +1 -0
  37. package/dist/browser/components/q-inline.js +1 -0
  38. package/dist/browser/components/q-input.d.ts +1 -0
  39. package/dist/browser/components/q-input.js +1 -0
  40. package/dist/browser/components/q-link.d.ts +1 -0
  41. package/dist/browser/components/q-link.js +1 -0
  42. package/dist/browser/components/q-map.d.ts +1 -0
  43. package/dist/browser/components/q-map.js +1 -0
  44. package/dist/browser/components/q-media.d.ts +1 -0
  45. package/dist/browser/components/q-media.js +1 -0
  46. package/dist/browser/components/q-navbar.d.ts +1 -0
  47. package/dist/browser/components/q-navbar.js +1 -0
  48. package/dist/browser/components/q-pagination.d.ts +1 -0
  49. package/dist/browser/components/q-pagination.js +1 -0
  50. package/dist/browser/components/q-panel.d.ts +1 -0
  51. package/dist/browser/components/q-panel.js +1 -0
  52. package/dist/browser/components/q-progress.d.ts +1 -0
  53. package/dist/browser/components/q-progress.js +1 -0
  54. package/dist/browser/components/q-quantity-selector.d.ts +1 -0
  55. package/dist/browser/components/q-quantity-selector.js +1 -0
  56. package/dist/browser/components/q-radio-group.d.ts +1 -0
  57. package/dist/browser/components/q-radio-group.js +1 -0
  58. package/dist/browser/components/q-reel.d.ts +1 -0
  59. package/dist/browser/components/q-reel.js +1 -0
  60. package/dist/browser/components/q-scrollable.d.ts +1 -0
  61. package/dist/browser/components/q-scrollable.js +1 -0
  62. package/dist/browser/components/q-section.d.ts +1 -0
  63. package/dist/browser/components/q-section.js +1 -0
  64. package/dist/browser/components/q-sidepanel.d.ts +1 -0
  65. package/dist/browser/components/q-sidepanel.js +1 -0
  66. package/dist/browser/components/q-stack.d.ts +1 -0
  67. package/dist/browser/components/q-stack.js +1 -0
  68. package/dist/browser/components/q-step-diagram-item.d.ts +1 -0
  69. package/dist/browser/components/q-step-diagram-item.js +1 -0
  70. package/dist/browser/components/q-step-diagram.d.ts +1 -0
  71. package/dist/browser/components/q-step-diagram.js +1 -0
  72. package/dist/browser/components/q-syntax-box.d.ts +1 -0
  73. package/dist/browser/components/q-syntax-box.js +1 -0
  74. package/dist/browser/components/q-tabs.d.ts +1 -0
  75. package/dist/browser/components/q-tabs.js +1 -0
  76. package/dist/browser/components/q-textarea.d.ts +1 -0
  77. package/dist/browser/components/q-textarea.js +1 -0
  78. package/dist/browser/components/q-thumbnail.d.ts +1 -0
  79. package/dist/browser/components/q-thumbnail.js +1 -0
  80. package/dist/browser/components/q-toast.d.ts +1 -0
  81. package/dist/browser/components/q-toast.js +1 -0
  82. package/dist/browser/components/q-toggle.d.ts +1 -0
  83. package/dist/browser/components/q-toggle.js +1 -0
  84. package/dist/browser/components/q-toolbar.d.ts +1 -0
  85. package/dist/browser/components/q-toolbar.js +1 -0
  86. package/dist/browser/components/q-tooltip.d.ts +1 -0
  87. package/dist/browser/components/q-tooltip.js +1 -0
  88. package/dist/browser/index.cjs +1 -0
  89. package/dist/browser/index.d.ts +1 -0
  90. package/dist/browser/index.js +1 -0
  91. package/dist/browser/loader/index.cjs +1 -0
  92. package/dist/browser/loader/index.d.ts +1 -0
  93. package/dist/browser/loader/index.js +1 -0
  94. package/dist/playground/build/index.esm.js +1 -1
  95. package/dist/playground/build/{p-1d1f7bc3.entry.js → p-888e46a8.entry.js} +1 -1
  96. package/dist/playground/build/{p-GHhpSfZU.js → p-CpI3m4_T.js} +1 -1
  97. package/dist/{webquark/webquark.esm.js → playground/build/p-c923c9c0.js} +1 -1
  98. package/dist/playground/build/p-e0bb74ae.css +1 -0
  99. package/dist/playground/build/webquark.esm.js +1 -1
  100. package/dist/playground/index.html +1 -29
  101. package/dist/playground/playground.js +10 -2
  102. package/dist/playground/views/tooling/adoption/CHANGELOG.md +13 -0
  103. package/dist/playground/views/tooling/adoption/README.md +47 -0
  104. package/dist/playground/views/tooling/adoption/changelog.config.ts +12 -0
  105. package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/README.md +3 -0
  106. package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/images/release-panel.svg +7 -0
  107. package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/visuals.json +16 -0
  108. package/dist/playground/views/tooling/adoption/docs/changelog/v0.1.0/README.md +3 -0
  109. package/dist/playground/views/tooling/adoption/generate.ts +13 -0
  110. package/dist/playground/views/tooling/adoption/package.json +10 -0
  111. package/dist/playground/views/tooling/adoption/serve.ts +24 -0
  112. package/dist/playground/views/tooling/adoption/viewer.html +16 -0
  113. package/dist/playground/views/tooling/adoption/viewer.js +54 -0
  114. package/dist/playground/views/tooling/sample-feed.json +13 -0
  115. package/dist/playground/views/tooling/sample-notes.md +14 -0
  116. package/dist/playground/views/tooling/tooling.html +69 -0
  117. package/dist/tooling/changelog/index.d.ts +1 -0
  118. package/dist/tooling/changelog/index.js +1 -0
  119. package/package.json +54 -160
  120. package/scripts/package.json +1 -0
  121. package/scripts/webquark-serve.js +3 -1
  122. package/scripts/wq-changelog.js +4 -0
  123. package/scripts/wq-switch/README.md +32 -12
  124. package/scripts/wq-switch/dist/index.js +706 -95
  125. package/scripts/wq-switch/dist/setup.js +578 -52
  126. package/dist/cjs/Leaflet.GoogleMutant-i4bYl6qy.js +0 -768
  127. package/dist/cjs/action.props-N0urQtdP.js +0 -35
  128. package/dist/cjs/chevron-up-D4t2OSHA.js +0 -30
  129. package/dist/cjs/collection-identity-CV5HLD9Z.js +0 -141
  130. package/dist/cjs/data-table-cell-8uUCk2Qz.js +0 -51
  131. package/dist/cjs/dom-Dk77oFF6.js +0 -247
  132. package/dist/cjs/field-CsrQGhG-.js +0 -14
  133. package/dist/cjs/form-control-validity-D1ukC0_e.js +0 -49
  134. package/dist/cjs/form-field-adapter-D0CJ6poh.js +0 -51
  135. package/dist/cjs/form-field-state-P63wN30v.js +0 -51
  136. package/dist/cjs/form-submit-action-C6c4aq6C.js +0 -227
  137. package/dist/cjs/image-crop-BZD5Cxd7.js +0 -53
  138. package/dist/cjs/index-DWXhKHCB.js +0 -1869
  139. package/dist/cjs/index.cjs.js +0 -34
  140. package/dist/cjs/leaflet-maplibre-gl-JIaCQ-7v.js +0 -1025
  141. package/dist/cjs/leaflet-src-mrRg-Srs.js +0 -14551
  142. package/dist/cjs/loader.cjs.js +0 -12
  143. package/dist/cjs/map.types-BWymIRql.js +0 -24
  144. package/dist/cjs/q-accordion.cjs.entry.js +0 -18
  145. package/dist/cjs/q-alert.cjs.entry.js +0 -52
  146. package/dist/cjs/q-avatar.cjs.entry.js +0 -101
  147. package/dist/cjs/q-banner.cjs.entry.js +0 -19
  148. package/dist/cjs/q-button_2.cjs.entry.js +0 -462
  149. package/dist/cjs/q-card.cjs.entry.js +0 -88
  150. package/dist/cjs/q-carousel.cjs.entry.js +0 -718
  151. package/dist/cjs/q-chip.cjs.entry.js +0 -124
  152. package/dist/cjs/q-conversation-bubble.cjs.entry.js +0 -70
  153. package/dist/cjs/q-data-table.cjs.entry.js +0 -611
  154. package/dist/cjs/q-dialog.cjs.entry.js +0 -271
  155. package/dist/cjs/q-dropdown.cjs.entry.js +0 -699
  156. package/dist/cjs/q-form.cjs.entry.js +0 -1002
  157. package/dist/cjs/q-grid.cjs.entry.js +0 -24
  158. package/dist/cjs/q-icon.cjs.entry.js +0 -439
  159. package/dist/cjs/q-image-comparison.cjs.entry.js +0 -201
  160. package/dist/cjs/q-inline.cjs.entry.js +0 -22
  161. package/dist/cjs/q-input_2.cjs.entry.js +0 -438
  162. package/dist/cjs/q-link.cjs.entry.js +0 -80
  163. package/dist/cjs/q-map.cjs.entry.js +0 -3509
  164. package/dist/cjs/q-media.cjs.entry.js +0 -21
  165. package/dist/cjs/q-navbar.cjs.entry.js +0 -415
  166. package/dist/cjs/q-pagination.cjs.entry.js +0 -68
  167. package/dist/cjs/q-panel.cjs.entry.js +0 -76
  168. package/dist/cjs/q-quantity-selector.cjs.entry.js +0 -204
  169. package/dist/cjs/q-radio-group.cjs.entry.js +0 -261
  170. package/dist/cjs/q-reel.cjs.entry.js +0 -170
  171. package/dist/cjs/q-scrollable.cjs.entry.js +0 -449
  172. package/dist/cjs/q-section.cjs.entry.js +0 -20
  173. package/dist/cjs/q-sidepanel.cjs.entry.js +0 -793
  174. package/dist/cjs/q-stack.cjs.entry.js +0 -20
  175. package/dist/cjs/q-step-diagram-item.cjs.entry.js +0 -45
  176. package/dist/cjs/q-step-diagram.cjs.entry.js +0 -56
  177. package/dist/cjs/q-syntax-box.cjs.entry.js +0 -782
  178. package/dist/cjs/q-tabs.cjs.entry.js +0 -155
  179. package/dist/cjs/q-textarea.cjs.entry.js +0 -295
  180. package/dist/cjs/q-thumbnail.cjs.entry.js +0 -51
  181. package/dist/cjs/q-toast.cjs.entry.js +0 -400
  182. package/dist/cjs/q-toggle.cjs.entry.js +0 -233
  183. package/dist/cjs/q-toolbar.cjs.entry.js +0 -33
  184. package/dist/cjs/registry-C3IYlNMp.js +0 -323
  185. package/dist/cjs/toast-controller-CIXagxbV.js +0 -111
  186. package/dist/cjs/tokens-RMRaIOqv.js +0 -957
  187. package/dist/cjs/utils-DGQOjEwT.js +0 -33
  188. package/dist/cjs/webquark.cjs.js +0 -24
  189. package/dist/collection/assets/icons/braces.svg +0 -14
  190. package/dist/collection/assets/icons/check.svg +0 -1
  191. package/dist/collection/assets/icons/chevron-down.svg +0 -1
  192. package/dist/collection/assets/icons/chevron-left.svg +0 -1
  193. package/dist/collection/assets/icons/chevron-right.svg +0 -1
  194. package/dist/collection/assets/icons/chevron-up.svg +0 -1
  195. package/dist/collection/assets/icons/copy.svg +0 -4
  196. package/dist/collection/assets/icons/eye-off.svg +0 -1
  197. package/dist/collection/assets/icons/eye.svg +0 -1
  198. package/dist/collection/assets/icons/minus.svg +0 -1
  199. package/dist/collection/assets/icons/play.svg +0 -1
  200. package/dist/collection/assets/icons/plus.svg +0 -1
  201. package/dist/collection/assets/icons/search.svg +0 -1
  202. package/dist/collection/assets/icons/spinner.svg +0 -1
  203. package/dist/collection/assets/icons/trash-2.svg +0 -1
  204. package/dist/collection/assets/icons/x.svg +0 -1
  205. package/dist/collection/collection-manifest.json +0 -56
  206. package/dist/collection/components/actions/action.props.js +0 -130
  207. package/dist/collection/components/actions/button/button.css +0 -242
  208. package/dist/collection/components/actions/button/button.js +0 -748
  209. package/dist/collection/components/actions/button/button.types.js +0 -1
  210. package/dist/collection/components/actions/button/button.utils.js +0 -9
  211. package/dist/collection/components/actions/button/button.utils.unit.test.js +0 -44
  212. package/dist/collection/components/actions/button/test/button-slots.cmp.test.js +0 -70
  213. package/dist/collection/components/actions/link/link.css +0 -102
  214. package/dist/collection/components/actions/link/link.js +0 -316
  215. package/dist/collection/components/actions/link/link.types.js +0 -1
  216. package/dist/collection/components/communication/alert/alert.css +0 -118
  217. package/dist/collection/components/communication/alert/alert.js +0 -208
  218. package/dist/collection/components/communication/alert/alert.types.js +0 -1
  219. package/dist/collection/components/communication/conversation-bubble/conversation-bubble.css +0 -154
  220. package/dist/collection/components/communication/conversation-bubble/conversation-bubble.js +0 -207
  221. package/dist/collection/components/communication/conversation-bubble/conversation-bubble.types.js +0 -1
  222. package/dist/collection/components/communication/toast/internals/icons.js +0 -25
  223. package/dist/collection/components/communication/toast/internals/queue.js +0 -64
  224. package/dist/collection/components/communication/toast/internals/timers.js +0 -75
  225. package/dist/collection/components/communication/toast/test/toast.cmp.test.js +0 -38
  226. package/dist/collection/components/communication/toast/test/toast.unit.test.js +0 -104
  227. package/dist/collection/components/communication/toast/toast-controller.js +0 -105
  228. package/dist/collection/components/communication/toast/toast.css +0 -141
  229. package/dist/collection/components/communication/toast/toast.js +0 -556
  230. package/dist/collection/components/communication/toast/toast.types.js +0 -1
  231. package/dist/collection/components/content/banner/banner.css +0 -1
  232. package/dist/collection/components/content/banner/banner.js +0 -84
  233. package/dist/collection/components/content/banner/banner.types.js +0 -1
  234. package/dist/collection/components/content/card/card.css +0 -105
  235. package/dist/collection/components/content/card/card.js +0 -308
  236. package/dist/collection/components/content/card/card.types.js +0 -1
  237. package/dist/collection/components/content/card/card.utils.js +0 -15
  238. package/dist/collection/components/content/carousel/carousel.css +0 -254
  239. package/dist/collection/components/content/carousel/carousel.js +0 -956
  240. package/dist/collection/components/content/carousel/carousel.types.js +0 -1
  241. package/dist/collection/components/content/carousel/carousel.utils.js +0 -1
  242. package/dist/collection/components/content/carousel/internals/autoplay.js +0 -64
  243. package/dist/collection/components/content/carousel/internals/metrics.js +0 -59
  244. package/dist/collection/components/content/carousel/internals/slide-state.js +0 -50
  245. package/dist/collection/components/content/carousel/test/transitions.cmp.test.js +0 -328
  246. package/dist/collection/components/data-display/accordion/accordion.css +0 -1
  247. package/dist/collection/components/data-display/accordion/accordion.js +0 -54
  248. package/dist/collection/components/data-display/accordion/accordion.types.js +0 -1
  249. package/dist/collection/components/data-display/chip/chip.css +0 -219
  250. package/dist/collection/components/data-display/chip/chip.js +0 -381
  251. package/dist/collection/components/data-display/chip/chip.types.js +0 -1
  252. package/dist/collection/components/data-display/data-table/data-table-cell.js +0 -44
  253. package/dist/collection/components/data-display/data-table/data-table.css +0 -429
  254. package/dist/collection/components/data-display/data-table/data-table.js +0 -862
  255. package/dist/collection/components/data-display/data-table/data-table.types.js +0 -1
  256. package/dist/collection/components/data-display/data-table/internals/data-access.js +0 -43
  257. package/dist/collection/components/data-display/data-table/internals/render-row-actions.js +0 -22
  258. package/dist/collection/components/data-display/data-table/internals/render-sort-indicator.js +0 -5
  259. package/dist/collection/components/data-display/data-table/internals/render-table-body.js +0 -59
  260. package/dist/collection/components/data-display/data-table/internals/render-table-head.js +0 -42
  261. package/dist/collection/components/data-display/data-table/internals/render-toolbar.js +0 -6
  262. package/dist/collection/components/data-display/data-table/internals/row-events.js +0 -27
  263. package/dist/collection/components/data-display/data-table/internals/selection.js +0 -31
  264. package/dist/collection/components/data-display/data-table/internals/sort.js +0 -57
  265. package/dist/collection/components/data-display/data-table/internals/table-model.js +0 -92
  266. package/dist/collection/components/data-display/data-table/test/row-gutter.cmp.test.js +0 -104
  267. package/dist/collection/components/data-display/data-table/test/two-line-rows.cmp.test.js +0 -164
  268. package/dist/collection/components/data-display/map/internals/base-layer.js +0 -140
  269. package/dist/collection/components/data-display/map/internals/bounds.js +0 -66
  270. package/dist/collection/components/data-display/map/internals/buffered-tile-layer.js +0 -128
  271. package/dist/collection/components/data-display/map/internals/cluster-collision.js +0 -73
  272. package/dist/collection/components/data-display/map/internals/google-maps.js +0 -117
  273. package/dist/collection/components/data-display/map/internals/google-mutant.js +0 -51
  274. package/dist/collection/components/data-display/map/internals/maplibre.js +0 -50
  275. package/dist/collection/components/data-display/map/internals/marker-cluster-index.js +0 -136
  276. package/dist/collection/components/data-display/map/internals/marker-controller.js +0 -425
  277. package/dist/collection/components/data-display/map/internals/marker-presentation.js +0 -266
  278. package/dist/collection/components/data-display/map/internals/marker-visibility.js +0 -158
  279. package/dist/collection/components/data-display/map/internals/markers.js +0 -191
  280. package/dist/collection/components/data-display/map/internals/tile-layer-readiness.js +0 -67
  281. package/dist/collection/components/data-display/map/internals/tile-preload-buffer.js +0 -8
  282. package/dist/collection/components/data-display/map/internals/vector-padding.js +0 -8
  283. package/dist/collection/components/data-display/map/map.css +0 -742
  284. package/dist/collection/components/data-display/map/map.js +0 -1595
  285. package/dist/collection/components/data-display/map/map.types.js +0 -12
  286. package/dist/collection/components/data-display/map/test/map.cmp.test.js +0 -961
  287. package/dist/collection/components/data-display/pagination/pagination.css +0 -81
  288. package/dist/collection/components/data-display/pagination/pagination.js +0 -240
  289. package/dist/collection/components/data-display/pagination/test/pagination.cmp.test.js +0 -57
  290. package/dist/collection/components/data-display/syntax-box/internals/clipboard.js +0 -9
  291. package/dist/collection/components/data-display/syntax-box/internals/editor-key-action.js +0 -14
  292. package/dist/collection/components/data-display/syntax-box/internals/value-sync.js +0 -10
  293. package/dist/collection/components/data-display/syntax-box/internals/value-sync.unit.test.js +0 -25
  294. package/dist/collection/components/data-display/syntax-box/syntax-box.css +0 -209
  295. package/dist/collection/components/data-display/syntax-box/syntax-box.js +0 -678
  296. package/dist/collection/components/data-display/syntax-box/syntax-box.types.js +0 -1
  297. package/dist/collection/components/data-display/syntax-box/syntax-box.utils.js +0 -1
  298. package/dist/collection/components/data-display/syntax-box/test/format-fixtures.js +0 -20
  299. package/dist/collection/components/data-display/syntax-box/test/syntax-box.cmp.test.js +0 -241
  300. package/dist/collection/components/data-display/syntax-box/test/syntax-fixtures.js +0 -14
  301. package/dist/collection/components/data-display/syntax-box/test/syntax-format.cmp.test.js +0 -157
  302. package/dist/collection/components/indicators/progress/progress.css +0 -223
  303. package/dist/collection/components/indicators/progress/progress.js +0 -275
  304. package/dist/collection/components/indicators/progress/progress.types.js +0 -1
  305. package/dist/collection/components/indicators/step-diagram/step-diagram.css +0 -21
  306. package/dist/collection/components/indicators/step-diagram/step-diagram.js +0 -143
  307. package/dist/collection/components/indicators/step-diagram/step-diagram.types.js +0 -1
  308. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.css +0 -252
  309. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +0 -185
  310. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.types.js +0 -1
  311. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.utils.js +0 -3
  312. package/dist/collection/components/inputs/dropdown/dropdown.css +0 -387
  313. package/dist/collection/components/inputs/dropdown/dropdown.js +0 -1236
  314. package/dist/collection/components/inputs/dropdown/dropdown.types.js +0 -1
  315. package/dist/collection/components/inputs/dropdown/internals/options.js +0 -30
  316. package/dist/collection/components/inputs/dropdown/internals/position.js +0 -35
  317. package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +0 -62
  318. package/dist/collection/components/inputs/form/form.css +0 -85
  319. package/dist/collection/components/inputs/form/form.js +0 -808
  320. package/dist/collection/components/inputs/form/form.types.js +0 -1
  321. package/dist/collection/components/inputs/form/internals/controls.js +0 -173
  322. package/dist/collection/components/inputs/form/internals/enter-behavior.js +0 -25
  323. package/dist/collection/components/inputs/form/internals/field-state.js +0 -129
  324. package/dist/collection/components/inputs/form/internals/reset.js +0 -50
  325. package/dist/collection/components/inputs/form/internals/submission.js +0 -140
  326. package/dist/collection/components/inputs/form/internals/values.js +0 -199
  327. package/dist/collection/components/inputs/form/internals/values.unit.test.js +0 -59
  328. package/dist/collection/components/inputs/form/test/form-reset-state.cmp.test.js +0 -559
  329. package/dist/collection/components/inputs/form/test/form-submit-transport.cmp.test.js +0 -352
  330. package/dist/collection/components/inputs/form/test/form-submit.cmp.test.js +0 -438
  331. package/dist/collection/components/inputs/form/test/form-values.cmp.test.js +0 -440
  332. package/dist/collection/components/inputs/form/test/form.cmp.test.js +0 -157
  333. package/dist/collection/components/inputs/input/input.css +0 -293
  334. package/dist/collection/components/inputs/input/input.js +0 -907
  335. package/dist/collection/components/inputs/input/input.types.js +0 -1
  336. package/dist/collection/components/inputs/input/input.utils.js +0 -3
  337. package/dist/collection/components/inputs/quantity-selector/internals/number-value.js +0 -64
  338. package/dist/collection/components/inputs/quantity-selector/quantity-selector.css +0 -171
  339. package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +0 -390
  340. package/dist/collection/components/inputs/quantity-selector/quantity-selector.types.js +0 -1
  341. package/dist/collection/components/inputs/radio-group/radio-group.css +0 -224
  342. package/dist/collection/components/inputs/radio-group/radio-group.js +0 -668
  343. package/dist/collection/components/inputs/radio-group/radio-group.types.js +0 -1
  344. package/dist/collection/components/inputs/radio-group/radio-group.utils.js +0 -18
  345. package/dist/collection/components/inputs/textarea/textarea.css +0 -172
  346. package/dist/collection/components/inputs/textarea/textarea.js +0 -799
  347. package/dist/collection/components/inputs/textarea/textarea.types.js +0 -1
  348. package/dist/collection/components/inputs/toggle/toggle.css +0 -252
  349. package/dist/collection/components/inputs/toggle/toggle.js +0 -610
  350. package/dist/collection/components/inputs/toggle/toggle.types.js +0 -1
  351. package/dist/collection/components/inputs/toggle/toggle.utils.js +0 -3
  352. package/dist/collection/components/layout/grid/grid.css +0 -11
  353. package/dist/collection/components/layout/grid/grid.js +0 -152
  354. package/dist/collection/components/layout/inline/inline.css +0 -4
  355. package/dist/collection/components/layout/inline/inline.js +0 -118
  356. package/dist/collection/components/layout/navbar/navbar.css +0 -584
  357. package/dist/collection/components/layout/navbar/navbar.js +0 -848
  358. package/dist/collection/components/layout/navbar/navbar.types.js +0 -1
  359. package/dist/collection/components/layout/navbar/navbar.utils.js +0 -13
  360. package/dist/collection/components/layout/navbar/test/navbar.cmp.test.js +0 -369
  361. package/dist/collection/components/layout/panel/panel.css +0 -114
  362. package/dist/collection/components/layout/panel/panel.js +0 -394
  363. package/dist/collection/components/layout/panel/panel.types.js +0 -1
  364. package/dist/collection/components/layout/scrollable/internals/metrics.js +0 -61
  365. package/dist/collection/components/layout/scrollable/internals/native-scrollbar.js +0 -41
  366. package/dist/collection/components/layout/scrollable/scrollable.css +0 -123
  367. package/dist/collection/components/layout/scrollable/scrollable.js +0 -565
  368. package/dist/collection/components/layout/scrollable/scrollable.types.js +0 -1
  369. package/dist/collection/components/layout/section/section.css +0 -1
  370. package/dist/collection/components/layout/section/section.js +0 -98
  371. package/dist/collection/components/layout/section/section.types.js +0 -1
  372. package/dist/collection/components/layout/sidepanel/internals/drawer.js +0 -98
  373. package/dist/collection/components/layout/sidepanel/internals/groups.js +0 -56
  374. package/dist/collection/components/layout/sidepanel/internals/nav-items.js +0 -30
  375. package/dist/collection/components/layout/sidepanel/sidepanel.css +0 -1035
  376. package/dist/collection/components/layout/sidepanel/sidepanel.js +0 -1001
  377. package/dist/collection/components/layout/sidepanel/sidepanel.types.js +0 -1
  378. package/dist/collection/components/layout/sidepanel/sidepanel.utils.js +0 -17
  379. package/dist/collection/components/layout/sidepanel/test/nav-drawer-transitions.cmp.test.js +0 -120
  380. package/dist/collection/components/layout/sidepanel/test/panel-transitions.cmp.test.js +0 -180
  381. package/dist/collection/components/layout/stack/stack.css +0 -4
  382. package/dist/collection/components/layout/stack/stack.js +0 -76
  383. package/dist/collection/components/layout/tabs/tabs.css +0 -248
  384. package/dist/collection/components/layout/tabs/tabs.js +0 -322
  385. package/dist/collection/components/layout/tabs/tabs.types.js +0 -1
  386. package/dist/collection/components/layout/tabs/tabs.utils.js +0 -31
  387. package/dist/collection/components/layout/tabs/test/tabs.cmp.test.js +0 -165
  388. package/dist/collection/components/layout/toolbar/toolbar.css +0 -168
  389. package/dist/collection/components/layout/toolbar/toolbar.js +0 -251
  390. package/dist/collection/components/layout/toolbar/toolbar.types.js +0 -1
  391. package/dist/collection/components/media/avatar/avatar.css +0 -71
  392. package/dist/collection/components/media/avatar/avatar.js +0 -302
  393. package/dist/collection/components/media/avatar/avatar.types.js +0 -1
  394. package/dist/collection/components/media/icon/icon.css +0 -42
  395. package/dist/collection/components/media/icon/icon.js +0 -510
  396. package/dist/collection/components/media/icon/icon.types.js +0 -1
  397. package/dist/collection/components/media/icon/internals/constants.js +0 -3
  398. package/dist/collection/components/media/icon/internals/fetch-icon.js +0 -47
  399. package/dist/collection/components/media/icon/internals/fetch-icon.unit.test.js +0 -51
  400. package/dist/collection/components/media/icon/internals/policy.js +0 -184
  401. package/dist/collection/components/media/icon/internals/policy.unit.test.js +0 -65
  402. package/dist/collection/components/media/icon/internals/registry-lucide.unit.test.js +0 -78
  403. package/dist/collection/components/media/icon/internals/registry.js +0 -122
  404. package/dist/collection/components/media/icon/internals/registry.unit.test.js +0 -42
  405. package/dist/collection/components/media/icon/internals/render-definition.js +0 -24
  406. package/dist/collection/components/media/icon/internals/sanitize-svg.js +0 -86
  407. package/dist/collection/components/media/icon/internals/size.js +0 -12
  408. package/dist/collection/components/media/icon/internals/url.js +0 -52
  409. package/dist/collection/components/media/icon/internals/url.unit.test.js +0 -34
  410. package/dist/collection/components/media/icon/test/icon-fixtures.js +0 -47
  411. package/dist/collection/components/media/icon/test/icon.cmp.test.js +0 -223
  412. package/dist/collection/components/media/image-comparison/image-comparison.css +0 -124
  413. package/dist/collection/components/media/image-comparison/image-comparison.js +0 -468
  414. package/dist/collection/components/media/image-comparison/test/image-comparison.cmp.test.js +0 -234
  415. package/dist/collection/components/media/media/media.css +0 -1
  416. package/dist/collection/components/media/media/media.js +0 -125
  417. package/dist/collection/components/media/media/media.types.js +0 -1
  418. package/dist/collection/components/media/reel/reel.css +0 -193
  419. package/dist/collection/components/media/reel/reel.js +0 -279
  420. package/dist/collection/components/media/reel/reel.types.js +0 -1
  421. package/dist/collection/components/media/thumbnail/thumbnail.css +0 -111
  422. package/dist/collection/components/media/thumbnail/thumbnail.js +0 -184
  423. package/dist/collection/components/media/thumbnail/thumbnail.types.js +0 -1
  424. package/dist/collection/components/overlays/dialog/dialog.css +0 -264
  425. package/dist/collection/components/overlays/dialog/dialog.js +0 -743
  426. package/dist/collection/components/overlays/dialog/dialog.types.js +0 -1
  427. package/dist/collection/components/overlays/dialog/internals/backdrop.js +0 -9
  428. package/dist/collection/components/overlays/dialog/internals/lifecycle.js +0 -53
  429. package/dist/collection/components/overlays/tooltip/internals/aria.js +0 -27
  430. package/dist/collection/components/overlays/tooltip/internals/positioning.js +0 -84
  431. package/dist/collection/components/overlays/tooltip/internals/scroll-listeners.js +0 -18
  432. package/dist/collection/components/overlays/tooltip/tooltip.css +0 -69
  433. package/dist/collection/components/overlays/tooltip/tooltip.js +0 -196
  434. package/dist/collection/components/overlays/tooltip/tooltip.types.js +0 -1
  435. package/dist/collection/components/shared/field.js +0 -8
  436. package/dist/collection/components/shared/test/orientation.cmp.test.js +0 -36
  437. package/dist/collection/index.js +0 -16
  438. package/dist/collection/playground/assets/comparison-after.svg +0 -1
  439. package/dist/collection/playground/assets/comparison-before.svg +0 -1
  440. package/dist/collection/playground/components/playground-code-preview/playground-code-preview.js +0 -48
  441. package/dist/collection/playground/components/playground-event-log/playground-event-log.js +0 -63
  442. package/dist/collection/playground/components/playground-header/playground-header.js +0 -65
  443. package/dist/collection/playground/components/playground-sidebar/playground-sidebar.js +0 -112
  444. package/dist/collection/playground/components/properties-panel/properties-panel.js +0 -146
  445. package/dist/collection/playground/components/properties-panel/property-row.js +0 -31
  446. package/dist/collection/playground/components/properties-panel/slot-row.js +0 -27
  447. package/dist/collection/playground/components/sandbox-viewport/sandbox-panel.js +0 -338
  448. package/dist/collection/playground/components/sandbox-viewport/sandbox-viewport.js +0 -159
  449. package/dist/collection/playground/components/sandbox-viewport/variant-card.js +0 -86
  450. package/dist/collection/playground/components/sandbox-viewport/viewport-tabs.js +0 -39
  451. package/dist/collection/playground/components/theme-designer/theme-designer.js +0 -69
  452. package/dist/collection/playground/components/theme-designer/token-row.js +0 -89
  453. package/dist/collection/playground/components/theme-designer/token-section.js +0 -19
  454. package/dist/collection/playground/dom-factory.js +0 -76
  455. package/dist/collection/playground/events.js +0 -37
  456. package/dist/collection/playground/logo.svg +0 -8
  457. package/dist/collection/playground/playground.bundled.js +0 -3865
  458. package/dist/collection/playground/playground.js +0 -10
  459. package/dist/collection/playground/state.js +0 -158
  460. package/dist/collection/playground/utils/color.js +0 -26
  461. package/dist/collection/playground/utils/dom.js +0 -38
  462. package/dist/collection/playground/utils/index.js +0 -2
  463. package/dist/collection/playground/views/q-button-view/q-button-view.js +0 -6
  464. package/dist/collection/playground/views/q-input-view/q-input-view.js +0 -6
  465. package/dist/collection/theme/test/foundation.cmp.test.js +0 -353
  466. package/dist/collection/theme/test/presets.cmp.test.js +0 -129
  467. package/dist/collection/theme/tokens.js +0 -960
  468. package/dist/collection/utils/collection-identity.js +0 -136
  469. package/dist/collection/utils/collection-identity.unit.test.js +0 -107
  470. package/dist/collection/utils/dom.js +0 -236
  471. package/dist/collection/utils/form-control-validity.js +0 -44
  472. package/dist/collection/utils/form-field-adapter.js +0 -44
  473. package/dist/collection/utils/form-field-state.js +0 -45
  474. package/dist/collection/utils/form-reset-action.js +0 -60
  475. package/dist/collection/utils/form-submit-action.js +0 -151
  476. package/dist/collection/utils/form-submit-action.unit.test.js +0 -15
  477. package/dist/collection/utils/formatter.js +0 -156
  478. package/dist/collection/utils/formatter.unit.test.js +0 -71
  479. package/dist/collection/utils/image-crop.js +0 -47
  480. package/dist/collection/utils/image-crop.unit.test.js +0 -57
  481. package/dist/collection/utils/math.js +0 -19
  482. package/dist/collection/utils/syntax.js +0 -239
  483. package/dist/collection/utils/syntax.unit.test.js +0 -134
  484. package/dist/collection/utils/utils.js +0 -28
  485. package/dist/collection/utils/utils.unit.test.js +0 -16
  486. package/dist/components/index.d.ts +0 -35
  487. package/dist/components/index.js +0 -1
  488. package/dist/components/p-6PPZ2sIO.js +0 -1
  489. package/dist/components/p-B4Mg1xEw.js +0 -1
  490. package/dist/components/p-BH4gQWub.js +0 -1
  491. package/dist/components/p-BIIQL66b.js +0 -1
  492. package/dist/components/p-BJiYCN3i.js +0 -1
  493. package/dist/components/p-BOdNg0jc.js +0 -1
  494. package/dist/components/p-BcL0NVv0.js +0 -1
  495. package/dist/components/p-Bj2RJb2E.js +0 -1
  496. package/dist/components/p-BofcK-7Z.js +0 -1
  497. package/dist/components/p-ByfrUWx1.js +0 -1
  498. package/dist/components/p-C6vxokHH.js +0 -1
  499. package/dist/components/p-CGZPmEUB.js +0 -1
  500. package/dist/components/p-CGml_DQ8.js +0 -1
  501. package/dist/components/p-CKuPOxKN.js +0 -1
  502. package/dist/components/p-CN1ut2Lb.js +0 -1
  503. package/dist/components/p-C_RztzNv.js +0 -5
  504. package/dist/components/p-CoIMrUb3.js +0 -1
  505. package/dist/components/p-DKrPmn2y.js +0 -13
  506. package/dist/components/p-DQhiqYeq.js +0 -1
  507. package/dist/components/p-DT6k8Yhx.js +0 -1
  508. package/dist/components/p-DYMWBqU1.js +0 -5
  509. package/dist/components/p-Dfp_If-_.js +0 -1
  510. package/dist/components/p-DstNl_WY.js +0 -1
  511. package/dist/components/p-DuX-9GOi.js +0 -1
  512. package/dist/components/p-GHhpSfZU.js +0 -1
  513. package/dist/components/p-SzKf4WZF.js +0 -1
  514. package/dist/components/p-ye27qtRo.js +0 -1
  515. package/dist/components/q-accordion.d.ts +0 -11
  516. package/dist/components/q-accordion.js +0 -1
  517. package/dist/components/q-alert.d.ts +0 -11
  518. package/dist/components/q-alert.js +0 -1
  519. package/dist/components/q-avatar.d.ts +0 -11
  520. package/dist/components/q-avatar.js +0 -1
  521. package/dist/components/q-banner.d.ts +0 -11
  522. package/dist/components/q-banner.js +0 -1
  523. package/dist/components/q-button.d.ts +0 -11
  524. package/dist/components/q-button.js +0 -1
  525. package/dist/components/q-card.d.ts +0 -11
  526. package/dist/components/q-card.js +0 -1
  527. package/dist/components/q-carousel.d.ts +0 -11
  528. package/dist/components/q-carousel.js +0 -1
  529. package/dist/components/q-chip.d.ts +0 -11
  530. package/dist/components/q-chip.js +0 -1
  531. package/dist/components/q-conversation-bubble.d.ts +0 -11
  532. package/dist/components/q-conversation-bubble.js +0 -1
  533. package/dist/components/q-data-table.d.ts +0 -11
  534. package/dist/components/q-data-table.js +0 -1
  535. package/dist/components/q-dialog.d.ts +0 -11
  536. package/dist/components/q-dialog.js +0 -1
  537. package/dist/components/q-dropdown.d.ts +0 -11
  538. package/dist/components/q-dropdown.js +0 -1
  539. package/dist/components/q-form.d.ts +0 -11
  540. package/dist/components/q-form.js +0 -1
  541. package/dist/components/q-grid.d.ts +0 -11
  542. package/dist/components/q-grid.js +0 -1
  543. package/dist/components/q-icon.d.ts +0 -11
  544. package/dist/components/q-icon.js +0 -1
  545. package/dist/components/q-image-comparison.d.ts +0 -11
  546. package/dist/components/q-image-comparison.js +0 -1
  547. package/dist/components/q-inline.d.ts +0 -11
  548. package/dist/components/q-inline.js +0 -1
  549. package/dist/components/q-input.d.ts +0 -11
  550. package/dist/components/q-input.js +0 -1
  551. package/dist/components/q-link.d.ts +0 -11
  552. package/dist/components/q-link.js +0 -1
  553. package/dist/components/q-map.d.ts +0 -11
  554. package/dist/components/q-map.js +0 -1
  555. package/dist/components/q-media.d.ts +0 -11
  556. package/dist/components/q-media.js +0 -1
  557. package/dist/components/q-navbar.d.ts +0 -11
  558. package/dist/components/q-navbar.js +0 -1
  559. package/dist/components/q-pagination.d.ts +0 -11
  560. package/dist/components/q-pagination.js +0 -1
  561. package/dist/components/q-panel.d.ts +0 -11
  562. package/dist/components/q-panel.js +0 -1
  563. package/dist/components/q-progress.d.ts +0 -11
  564. package/dist/components/q-progress.js +0 -1
  565. package/dist/components/q-quantity-selector.d.ts +0 -11
  566. package/dist/components/q-quantity-selector.js +0 -1
  567. package/dist/components/q-radio-group.d.ts +0 -11
  568. package/dist/components/q-radio-group.js +0 -1
  569. package/dist/components/q-reel.d.ts +0 -11
  570. package/dist/components/q-reel.js +0 -1
  571. package/dist/components/q-scrollable.d.ts +0 -11
  572. package/dist/components/q-scrollable.js +0 -1
  573. package/dist/components/q-section.d.ts +0 -11
  574. package/dist/components/q-section.js +0 -1
  575. package/dist/components/q-sidepanel.d.ts +0 -11
  576. package/dist/components/q-sidepanel.js +0 -13
  577. package/dist/components/q-stack.d.ts +0 -11
  578. package/dist/components/q-stack.js +0 -1
  579. package/dist/components/q-step-diagram-item.d.ts +0 -11
  580. package/dist/components/q-step-diagram-item.js +0 -1
  581. package/dist/components/q-step-diagram.d.ts +0 -11
  582. package/dist/components/q-step-diagram.js +0 -1
  583. package/dist/components/q-syntax-box.d.ts +0 -11
  584. package/dist/components/q-syntax-box.js +0 -13
  585. package/dist/components/q-tabs.d.ts +0 -11
  586. package/dist/components/q-tabs.js +0 -1
  587. package/dist/components/q-textarea.d.ts +0 -11
  588. package/dist/components/q-textarea.js +0 -1
  589. package/dist/components/q-thumbnail.d.ts +0 -11
  590. package/dist/components/q-thumbnail.js +0 -1
  591. package/dist/components/q-toast.d.ts +0 -11
  592. package/dist/components/q-toast.js +0 -1
  593. package/dist/components/q-toggle.d.ts +0 -11
  594. package/dist/components/q-toggle.js +0 -1
  595. package/dist/components/q-toolbar.d.ts +0 -11
  596. package/dist/components/q-toolbar.js +0 -1
  597. package/dist/components/q-tooltip.d.ts +0 -11
  598. package/dist/components/q-tooltip.js +0 -1
  599. package/dist/esm/Leaflet.GoogleMutant-MpxOb4Jm.js +0 -766
  600. package/dist/esm/action.props-CpnGza8z.js +0 -32
  601. package/dist/esm/chevron-up-DKrPmn2y.js +0 -27
  602. package/dist/esm/collection-identity-CGZPmEUB.js +0 -138
  603. package/dist/esm/data-table-cell-SzKf4WZF.js +0 -46
  604. package/dist/esm/dom-ByfrUWx1.js +0 -238
  605. package/dist/esm/field-zfD6OQ02.js +0 -11
  606. package/dist/esm/form-control-validity-Bj2RJb2E.js +0 -46
  607. package/dist/esm/form-field-adapter-CGml_DQ8.js +0 -46
  608. package/dist/esm/form-field-state-DstNl_WY.js +0 -47
  609. package/dist/esm/form-submit-action-CoEIvDqE.js +0 -213
  610. package/dist/esm/image-crop-BcL0NVv0.js +0 -49
  611. package/dist/esm/index-B5ElFlHv.js +0 -1858
  612. package/dist/esm/index.js +0 -7
  613. package/dist/esm/leaflet-maplibre-gl-BvKlNmWf.js +0 -1020
  614. package/dist/esm/leaflet-src-DYMWBqU1.js +0 -14547
  615. package/dist/esm/loader.js +0 -10
  616. package/dist/esm/map.types-CoIMrUb3.js +0 -14
  617. package/dist/esm/q-accordion.entry.js +0 -16
  618. package/dist/esm/q-alert.entry.js +0 -50
  619. package/dist/esm/q-avatar.entry.js +0 -99
  620. package/dist/esm/q-banner.entry.js +0 -17
  621. package/dist/esm/q-button_2.entry.js +0 -459
  622. package/dist/esm/q-card.entry.js +0 -86
  623. package/dist/esm/q-carousel.entry.js +0 -716
  624. package/dist/esm/q-chip.entry.js +0 -122
  625. package/dist/esm/q-conversation-bubble.entry.js +0 -68
  626. package/dist/esm/q-data-table.entry.js +0 -609
  627. package/dist/esm/q-dialog.entry.js +0 -269
  628. package/dist/esm/q-dropdown.entry.js +0 -697
  629. package/dist/esm/q-form.entry.js +0 -1000
  630. package/dist/esm/q-grid.entry.js +0 -22
  631. package/dist/esm/q-icon.entry.js +0 -437
  632. package/dist/esm/q-image-comparison.entry.js +0 -199
  633. package/dist/esm/q-inline.entry.js +0 -20
  634. package/dist/esm/q-input_2.entry.js +0 -435
  635. package/dist/esm/q-link.entry.js +0 -78
  636. package/dist/esm/q-map.entry.js +0 -3507
  637. package/dist/esm/q-media.entry.js +0 -19
  638. package/dist/esm/q-navbar.entry.js +0 -413
  639. package/dist/esm/q-pagination.entry.js +0 -66
  640. package/dist/esm/q-panel.entry.js +0 -74
  641. package/dist/esm/q-quantity-selector.entry.js +0 -202
  642. package/dist/esm/q-radio-group.entry.js +0 -259
  643. package/dist/esm/q-reel.entry.js +0 -168
  644. package/dist/esm/q-scrollable.entry.js +0 -447
  645. package/dist/esm/q-section.entry.js +0 -18
  646. package/dist/esm/q-sidepanel.entry.js +0 -791
  647. package/dist/esm/q-stack.entry.js +0 -18
  648. package/dist/esm/q-step-diagram-item.entry.js +0 -43
  649. package/dist/esm/q-step-diagram.entry.js +0 -54
  650. package/dist/esm/q-syntax-box.entry.js +0 -780
  651. package/dist/esm/q-tabs.entry.js +0 -153
  652. package/dist/esm/q-textarea.entry.js +0 -293
  653. package/dist/esm/q-thumbnail.entry.js +0 -49
  654. package/dist/esm/q-toast.entry.js +0 -398
  655. package/dist/esm/q-toggle.entry.js +0 -231
  656. package/dist/esm/q-toolbar.entry.js +0 -31
  657. package/dist/esm/registry-GHhpSfZU.js +0 -308
  658. package/dist/esm/toast-controller-BIIQL66b.js +0 -107
  659. package/dist/esm/tokens-B4Mg1xEw.js +0 -953
  660. package/dist/esm/utils-BJiYCN3i.js +0 -30
  661. package/dist/esm/webquark.js +0 -20
  662. package/dist/index.cjs.js +0 -1
  663. package/dist/index.js +0 -1
  664. package/dist/loader/cdn.js +0 -1
  665. package/dist/loader/index.cjs.js +0 -1
  666. package/dist/loader/index.d.ts +0 -24
  667. package/dist/loader/index.es2017.js +0 -1
  668. package/dist/loader/index.js +0 -2
  669. package/dist/types/components/actions/action.props.d.ts +0 -19
  670. package/dist/types/components/actions/button/button.d.ts +0 -87
  671. package/dist/types/components/actions/button/button.types.d.ts +0 -6
  672. package/dist/types/components/actions/button/button.utils.d.ts +0 -8
  673. package/dist/types/components/actions/button/button.utils.unit.test.d.ts +0 -1
  674. package/dist/types/components/actions/button/test/button-slots.cmp.test.d.ts +0 -1
  675. package/dist/types/components/actions/link/link.d.ts +0 -43
  676. package/dist/types/components/actions/link/link.types.d.ts +0 -3
  677. package/dist/types/components/communication/alert/alert.d.ts +0 -32
  678. package/dist/types/components/communication/alert/alert.types.d.ts +0 -2
  679. package/dist/types/components/communication/conversation-bubble/conversation-bubble.d.ts +0 -38
  680. package/dist/types/components/communication/conversation-bubble/conversation-bubble.types.d.ts +0 -1
  681. package/dist/types/components/communication/toast/internals/icons.d.ts +0 -2
  682. package/dist/types/components/communication/toast/internals/queue.d.ts +0 -19
  683. package/dist/types/components/communication/toast/internals/timers.d.ts +0 -12
  684. package/dist/types/components/communication/toast/test/toast.cmp.test.d.ts +0 -2
  685. package/dist/types/components/communication/toast/test/toast.unit.test.d.ts +0 -1
  686. package/dist/types/components/communication/toast/toast-controller.d.ts +0 -9
  687. package/dist/types/components/communication/toast/toast.d.ts +0 -44
  688. package/dist/types/components/communication/toast/toast.types.d.ts +0 -30
  689. package/dist/types/components/content/banner/banner.d.ts +0 -12
  690. package/dist/types/components/content/banner/banner.types.d.ts +0 -2
  691. package/dist/types/components/content/card/card.d.ts +0 -35
  692. package/dist/types/components/content/card/card.types.d.ts +0 -1
  693. package/dist/types/components/content/card/card.utils.d.ts +0 -5
  694. package/dist/types/components/content/carousel/carousel.d.ts +0 -123
  695. package/dist/types/components/content/carousel/carousel.types.d.ts +0 -10
  696. package/dist/types/components/content/carousel/carousel.utils.d.ts +0 -1
  697. package/dist/types/components/content/carousel/internals/autoplay.d.ts +0 -22
  698. package/dist/types/components/content/carousel/internals/metrics.d.ts +0 -23
  699. package/dist/types/components/content/carousel/internals/slide-state.d.ts +0 -8
  700. package/dist/types/components/content/carousel/test/transitions.cmp.test.d.ts +0 -1
  701. package/dist/types/components/data-display/accordion/accordion.d.ts +0 -9
  702. package/dist/types/components/data-display/accordion/accordion.types.d.ts +0 -1
  703. package/dist/types/components/data-display/chip/chip.d.ts +0 -55
  704. package/dist/types/components/data-display/chip/chip.types.d.ts +0 -13
  705. package/dist/types/components/data-display/data-table/data-table-cell.d.ts +0 -7
  706. package/dist/types/components/data-display/data-table/data-table.d.ts +0 -95
  707. package/dist/types/components/data-display/data-table/data-table.types.d.ts +0 -56
  708. package/dist/types/components/data-display/data-table/internals/data-access.d.ts +0 -9
  709. package/dist/types/components/data-display/data-table/internals/render-row-actions.d.ts +0 -9
  710. package/dist/types/components/data-display/data-table/internals/render-sort-indicator.d.ts +0 -5
  711. package/dist/types/components/data-display/data-table/internals/render-table-body.d.ts +0 -13
  712. package/dist/types/components/data-display/data-table/internals/render-table-head.d.ts +0 -8
  713. package/dist/types/components/data-display/data-table/internals/render-toolbar.d.ts +0 -9
  714. package/dist/types/components/data-display/data-table/internals/row-events.d.ts +0 -1
  715. package/dist/types/components/data-display/data-table/internals/selection.d.ts +0 -10
  716. package/dist/types/components/data-display/data-table/internals/sort.d.ts +0 -3
  717. package/dist/types/components/data-display/data-table/internals/table-model.d.ts +0 -56
  718. package/dist/types/components/data-display/data-table/test/row-gutter.cmp.test.d.ts +0 -1
  719. package/dist/types/components/data-display/data-table/test/two-line-rows.cmp.test.d.ts +0 -1
  720. package/dist/types/components/data-display/map/internals/base-layer.d.ts +0 -63
  721. package/dist/types/components/data-display/map/internals/bounds.d.ts +0 -23
  722. package/dist/types/components/data-display/map/internals/buffered-tile-layer.d.ts +0 -10
  723. package/dist/types/components/data-display/map/internals/cluster-collision.d.ts +0 -15
  724. package/dist/types/components/data-display/map/internals/google-maps.d.ts +0 -9
  725. package/dist/types/components/data-display/map/internals/google-mutant-module.d.ts +0 -11
  726. package/dist/types/components/data-display/map/internals/google-mutant.d.ts +0 -18
  727. package/dist/types/components/data-display/map/internals/maplibre.d.ts +0 -14
  728. package/dist/types/components/data-display/map/internals/marker-cluster-index.d.ts +0 -36
  729. package/dist/types/components/data-display/map/internals/marker-controller.d.ts +0 -57
  730. package/dist/types/components/data-display/map/internals/marker-presentation.d.ts +0 -8
  731. package/dist/types/components/data-display/map/internals/marker-visibility.d.ts +0 -10
  732. package/dist/types/components/data-display/map/internals/markers.d.ts +0 -4
  733. package/dist/types/components/data-display/map/internals/tile-layer-readiness.d.ts +0 -11
  734. package/dist/types/components/data-display/map/internals/tile-preload-buffer.d.ts +0 -4
  735. package/dist/types/components/data-display/map/internals/vector-padding.d.ts +0 -4
  736. package/dist/types/components/data-display/map/map.d.ts +0 -175
  737. package/dist/types/components/data-display/map/map.types.d.ts +0 -132
  738. package/dist/types/components/data-display/map/test/map.cmp.test.d.ts +0 -1
  739. package/dist/types/components/data-display/pagination/pagination.d.ts +0 -33
  740. package/dist/types/components/data-display/pagination/test/pagination.cmp.test.d.ts +0 -2
  741. package/dist/types/components/data-display/syntax-box/internals/clipboard.d.ts +0 -2
  742. package/dist/types/components/data-display/syntax-box/internals/editor-key-action.d.ts +0 -12
  743. package/dist/types/components/data-display/syntax-box/internals/value-sync.d.ts +0 -15
  744. package/dist/types/components/data-display/syntax-box/internals/value-sync.unit.test.d.ts +0 -1
  745. package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +0 -72
  746. package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +0 -2
  747. package/dist/types/components/data-display/syntax-box/syntax-box.utils.d.ts +0 -1
  748. package/dist/types/components/data-display/syntax-box/test/format-fixtures.d.ts +0 -6
  749. package/dist/types/components/data-display/syntax-box/test/syntax-box.cmp.test.d.ts +0 -1
  750. package/dist/types/components/data-display/syntax-box/test/syntax-fixtures.d.ts +0 -9
  751. package/dist/types/components/data-display/syntax-box/test/syntax-format.cmp.test.d.ts +0 -1
  752. package/dist/types/components/indicators/progress/progress.d.ts +0 -30
  753. package/dist/types/components/indicators/progress/progress.types.d.ts +0 -3
  754. package/dist/types/components/indicators/step-diagram/step-diagram.d.ts +0 -19
  755. package/dist/types/components/indicators/step-diagram/step-diagram.types.d.ts +0 -3
  756. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.d.ts +0 -26
  757. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.types.d.ts +0 -5
  758. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.utils.d.ts +0 -1
  759. package/dist/types/components/inputs/dropdown/dropdown.d.ts +0 -108
  760. package/dist/types/components/inputs/dropdown/dropdown.types.d.ts +0 -9
  761. package/dist/types/components/inputs/dropdown/internals/options.d.ts +0 -6
  762. package/dist/types/components/inputs/dropdown/internals/position.d.ts +0 -26
  763. package/dist/types/components/inputs/dropdown/test/dropdown.cmp.test.d.ts +0 -1
  764. package/dist/types/components/inputs/form/form.d.ts +0 -80
  765. package/dist/types/components/inputs/form/form.types.d.ts +0 -40
  766. package/dist/types/components/inputs/form/internals/controls.d.ts +0 -8
  767. package/dist/types/components/inputs/form/internals/enter-behavior.d.ts +0 -2
  768. package/dist/types/components/inputs/form/internals/field-state.d.ts +0 -19
  769. package/dist/types/components/inputs/form/internals/reset.d.ts +0 -3
  770. package/dist/types/components/inputs/form/internals/submission.d.ts +0 -17
  771. package/dist/types/components/inputs/form/internals/values.d.ts +0 -10
  772. package/dist/types/components/inputs/form/internals/values.unit.test.d.ts +0 -1
  773. package/dist/types/components/inputs/form/test/form-reset-state.cmp.test.d.ts +0 -1
  774. package/dist/types/components/inputs/form/test/form-submit-transport.cmp.test.d.ts +0 -1
  775. package/dist/types/components/inputs/form/test/form-submit.cmp.test.d.ts +0 -1
  776. package/dist/types/components/inputs/form/test/form-values.cmp.test.d.ts +0 -1
  777. package/dist/types/components/inputs/form/test/form.cmp.test.d.ts +0 -4
  778. package/dist/types/components/inputs/input/input.d.ts +0 -89
  779. package/dist/types/components/inputs/input/input.types.d.ts +0 -3
  780. package/dist/types/components/inputs/input/input.utils.d.ts +0 -1
  781. package/dist/types/components/inputs/quantity-selector/internals/number-value.d.ts +0 -13
  782. package/dist/types/components/inputs/quantity-selector/quantity-selector.d.ts +0 -37
  783. package/dist/types/components/inputs/quantity-selector/quantity-selector.types.d.ts +0 -3
  784. package/dist/types/components/inputs/radio-group/radio-group.d.ts +0 -70
  785. package/dist/types/components/inputs/radio-group/radio-group.types.d.ts +0 -12
  786. package/dist/types/components/inputs/radio-group/radio-group.utils.d.ts +0 -2
  787. package/dist/types/components/inputs/textarea/textarea.d.ts +0 -79
  788. package/dist/types/components/inputs/textarea/textarea.types.d.ts +0 -1
  789. package/dist/types/components/inputs/toggle/toggle.d.ts +0 -67
  790. package/dist/types/components/inputs/toggle/toggle.types.d.ts +0 -3
  791. package/dist/types/components/inputs/toggle/toggle.utils.d.ts +0 -1
  792. package/dist/types/components/layout/grid/grid.d.ts +0 -13
  793. package/dist/types/components/layout/inline/inline.d.ts +0 -12
  794. package/dist/types/components/layout/navbar/navbar.d.ts +0 -94
  795. package/dist/types/components/layout/navbar/navbar.types.d.ts +0 -33
  796. package/dist/types/components/layout/navbar/navbar.utils.d.ts +0 -2
  797. package/dist/types/components/layout/navbar/test/navbar.cmp.test.d.ts +0 -1
  798. package/dist/types/components/layout/panel/panel.d.ts +0 -41
  799. package/dist/types/components/layout/panel/panel.types.d.ts +0 -3
  800. package/dist/types/components/layout/scrollable/internals/metrics.d.ts +0 -26
  801. package/dist/types/components/layout/scrollable/internals/native-scrollbar.d.ts +0 -4
  802. package/dist/types/components/layout/scrollable/scrollable.d.ts +0 -67
  803. package/dist/types/components/layout/scrollable/scrollable.types.d.ts +0 -6
  804. package/dist/types/components/layout/section/section.d.ts +0 -13
  805. package/dist/types/components/layout/section/section.types.d.ts +0 -1
  806. package/dist/types/components/layout/sidepanel/internals/drawer.d.ts +0 -2
  807. package/dist/types/components/layout/sidepanel/internals/groups.d.ts +0 -7
  808. package/dist/types/components/layout/sidepanel/internals/nav-items.d.ts +0 -2
  809. package/dist/types/components/layout/sidepanel/sidepanel.d.ts +0 -110
  810. package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +0 -43
  811. package/dist/types/components/layout/sidepanel/sidepanel.utils.d.ts +0 -2
  812. package/dist/types/components/layout/sidepanel/test/nav-drawer-transitions.cmp.test.d.ts +0 -1
  813. package/dist/types/components/layout/sidepanel/test/panel-transitions.cmp.test.d.ts +0 -1
  814. package/dist/types/components/layout/stack/stack.d.ts +0 -10
  815. package/dist/types/components/layout/tabs/tabs.d.ts +0 -29
  816. package/dist/types/components/layout/tabs/tabs.types.d.ts +0 -14
  817. package/dist/types/components/layout/tabs/tabs.utils.d.ts +0 -4
  818. package/dist/types/components/layout/tabs/test/tabs.cmp.test.d.ts +0 -1
  819. package/dist/types/components/layout/toolbar/toolbar.d.ts +0 -27
  820. package/dist/types/components/layout/toolbar/toolbar.types.d.ts +0 -1
  821. package/dist/types/components/media/avatar/avatar.d.ts +0 -37
  822. package/dist/types/components/media/avatar/avatar.types.d.ts +0 -2
  823. package/dist/types/components/media/icon/icon.d.ts +0 -48
  824. package/dist/types/components/media/icon/icon.types.d.ts +0 -30
  825. package/dist/types/components/media/icon/internals/constants.d.ts +0 -3
  826. package/dist/types/components/media/icon/internals/fetch-icon.d.ts +0 -1
  827. package/dist/types/components/media/icon/internals/fetch-icon.unit.test.d.ts +0 -1
  828. package/dist/types/components/media/icon/internals/policy.d.ts +0 -19
  829. package/dist/types/components/media/icon/internals/policy.unit.test.d.ts +0 -1
  830. package/dist/types/components/media/icon/internals/registry-lucide.unit.test.d.ts +0 -1
  831. package/dist/types/components/media/icon/internals/registry.d.ts +0 -11
  832. package/dist/types/components/media/icon/internals/registry.unit.test.d.ts +0 -1
  833. package/dist/types/components/media/icon/internals/render-definition.d.ts +0 -2
  834. package/dist/types/components/media/icon/internals/sanitize-svg.d.ts +0 -2
  835. package/dist/types/components/media/icon/internals/size.d.ts +0 -2
  836. package/dist/types/components/media/icon/internals/url.d.ts +0 -11
  837. package/dist/types/components/media/icon/internals/url.unit.test.d.ts +0 -1
  838. package/dist/types/components/media/icon/test/icon-fixtures.d.ts +0 -4
  839. package/dist/types/components/media/icon/test/icon.cmp.test.d.ts +0 -1
  840. package/dist/types/components/media/image-comparison/image-comparison.d.ts +0 -63
  841. package/dist/types/components/media/image-comparison/test/image-comparison.cmp.test.d.ts +0 -1
  842. package/dist/types/components/media/media/media.d.ts +0 -13
  843. package/dist/types/components/media/media/media.types.d.ts +0 -2
  844. package/dist/types/components/media/reel/reel.d.ts +0 -34
  845. package/dist/types/components/media/reel/reel.types.d.ts +0 -3
  846. package/dist/types/components/media/thumbnail/thumbnail.d.ts +0 -21
  847. package/dist/types/components/media/thumbnail/thumbnail.types.d.ts +0 -7
  848. package/dist/types/components/overlays/dialog/dialog.d.ts +0 -83
  849. package/dist/types/components/overlays/dialog/dialog.types.d.ts +0 -1
  850. package/dist/types/components/overlays/dialog/internals/backdrop.d.ts +0 -2
  851. package/dist/types/components/overlays/dialog/internals/lifecycle.d.ts +0 -21
  852. package/dist/types/components/overlays/tooltip/internals/aria.d.ts +0 -13
  853. package/dist/types/components/overlays/tooltip/internals/positioning.d.ts +0 -7
  854. package/dist/types/components/overlays/tooltip/internals/scroll-listeners.d.ts +0 -2
  855. package/dist/types/components/overlays/tooltip/tooltip.d.ts +0 -33
  856. package/dist/types/components/overlays/tooltip/tooltip.types.d.ts +0 -1
  857. package/dist/types/components/shared/field.d.ts +0 -3
  858. package/dist/types/components/shared/test/orientation.cmp.test.d.ts +0 -1
  859. package/dist/types/components.d.ts +0 -6047
  860. package/dist/types/declarations.d.ts +0 -14
  861. package/dist/types/index.d.ts +0 -31
  862. package/dist/types/playground/components/playground-code-preview/playground-code-preview.d.ts +0 -9
  863. package/dist/types/playground/components/playground-event-log/playground-event-log.d.ts +0 -11
  864. package/dist/types/playground/components/playground-header/playground-header.d.ts +0 -10
  865. package/dist/types/playground/components/playground-sidebar/playground-sidebar.d.ts +0 -13
  866. package/dist/types/playground/components/properties-panel/properties-panel.d.ts +0 -15
  867. package/dist/types/playground/components/properties-panel/property-row.d.ts +0 -6
  868. package/dist/types/playground/components/properties-panel/slot-row.d.ts +0 -7
  869. package/dist/types/playground/components/sandbox-viewport/sandbox-panel.d.ts +0 -15
  870. package/dist/types/playground/components/sandbox-viewport/sandbox-viewport.d.ts +0 -14
  871. package/dist/types/playground/components/sandbox-viewport/variant-card.d.ts +0 -7
  872. package/dist/types/playground/components/sandbox-viewport/viewport-tabs.d.ts +0 -5
  873. package/dist/types/playground/components/theme-designer/theme-designer.d.ts +0 -15
  874. package/dist/types/playground/components/theme-designer/token-row.d.ts +0 -14
  875. package/dist/types/playground/components/theme-designer/token-section.d.ts +0 -7
  876. package/dist/types/playground/dom-factory.d.ts +0 -12
  877. package/dist/types/playground/events.d.ts +0 -24
  878. package/dist/types/playground/playground.d.ts +0 -7
  879. package/dist/types/playground/state.d.ts +0 -44
  880. package/dist/types/playground/utils/color.d.ts +0 -8
  881. package/dist/types/playground/utils/dom.d.ts +0 -15
  882. package/dist/types/playground/utils/index.d.ts +0 -2
  883. package/dist/types/stencil-public-runtime.d.ts +0 -1879
  884. package/dist/types/theme/test/assets.d.ts +0 -4
  885. package/dist/types/theme/test/foundation.cmp.test.d.ts +0 -16
  886. package/dist/types/theme/test/presets.cmp.test.d.ts +0 -7
  887. package/dist/types/theme/tokens.d.ts +0 -141
  888. package/dist/types/utils/collection-identity.d.ts +0 -55
  889. package/dist/types/utils/collection-identity.unit.test.d.ts +0 -1
  890. package/dist/types/utils/dom.d.ts +0 -68
  891. package/dist/types/utils/form-control-validity.d.ts +0 -14
  892. package/dist/types/utils/form-field-adapter.d.ts +0 -17
  893. package/dist/types/utils/form-field-state.d.ts +0 -4
  894. package/dist/types/utils/form-reset-action.d.ts +0 -5
  895. package/dist/types/utils/form-submit-action.d.ts +0 -17
  896. package/dist/types/utils/form-submit-action.unit.test.d.ts +0 -1
  897. package/dist/types/utils/formatter.d.ts +0 -15
  898. package/dist/types/utils/formatter.unit.test.d.ts +0 -1
  899. package/dist/types/utils/image-crop.d.ts +0 -30
  900. package/dist/types/utils/image-crop.unit.test.d.ts +0 -1
  901. package/dist/types/utils/math.d.ts +0 -10
  902. package/dist/types/utils/syntax.d.ts +0 -13
  903. package/dist/types/utils/syntax.unit.test.d.ts +0 -1
  904. package/dist/types/utils/utils.d.ts +0 -11
  905. package/dist/types/utils/utils.unit.test.d.ts +0 -1
  906. package/dist/webquark/index.esm.js +0 -1
  907. package/dist/webquark/native-content.css +0 -24
  908. package/dist/webquark/p-023f8437.entry.js +0 -1
  909. package/dist/webquark/p-030ecde3.entry.js +0 -1
  910. package/dist/webquark/p-04c8cb9e.entry.js +0 -1
  911. package/dist/webquark/p-059daa8a.entry.js +0 -1
  912. package/dist/webquark/p-09cca7b9.entry.js +0 -1
  913. package/dist/webquark/p-0aa74ad6.entry.js +0 -1
  914. package/dist/webquark/p-0ae43d6c.entry.js +0 -1
  915. package/dist/webquark/p-0c3aac3f.entry.js +0 -1
  916. package/dist/webquark/p-144ef339.entry.js +0 -1
  917. package/dist/webquark/p-1d1f7bc3.entry.js +0 -1
  918. package/dist/webquark/p-296fbdb1.entry.js +0 -1
  919. package/dist/webquark/p-36118d90.entry.js +0 -1
  920. package/dist/webquark/p-3bc4629c.entry.js +0 -1
  921. package/dist/webquark/p-48fb5228.entry.js +0 -1
  922. package/dist/webquark/p-4d61b70d.entry.js +0 -1
  923. package/dist/webquark/p-5f232b44.entry.js +0 -13
  924. package/dist/webquark/p-64096386.entry.js +0 -1
  925. package/dist/webquark/p-6bfffa79.entry.js +0 -1
  926. package/dist/webquark/p-6e28cfe2.entry.js +0 -1
  927. package/dist/webquark/p-70d9ffde.entry.js +0 -1
  928. package/dist/webquark/p-8ece2c62.entry.js +0 -1
  929. package/dist/webquark/p-90b0858c.entry.js +0 -1
  930. package/dist/webquark/p-91fff6b6.entry.js +0 -1
  931. package/dist/webquark/p-923dac41.entry.js +0 -1
  932. package/dist/webquark/p-97a89cae.entry.js +0 -1
  933. package/dist/webquark/p-99d785ca.entry.js +0 -1
  934. package/dist/webquark/p-9e78b796.entry.js +0 -1
  935. package/dist/webquark/p-9ff7e5a4.entry.js +0 -1
  936. package/dist/webquark/p-B4Mg1xEw.js +0 -1
  937. package/dist/webquark/p-B5ElFlHv.js +0 -3
  938. package/dist/webquark/p-BIIQL66b.js +0 -1
  939. package/dist/webquark/p-BJiYCN3i.js +0 -1
  940. package/dist/webquark/p-BOdNg0jc.js +0 -1
  941. package/dist/webquark/p-BcL0NVv0.js +0 -1
  942. package/dist/webquark/p-Bj2RJb2E.js +0 -1
  943. package/dist/webquark/p-ByfrUWx1.js +0 -1
  944. package/dist/webquark/p-CGZPmEUB.js +0 -1
  945. package/dist/webquark/p-CGml_DQ8.js +0 -1
  946. package/dist/webquark/p-C_RztzNv.js +0 -5
  947. package/dist/webquark/p-CoIMrUb3.js +0 -1
  948. package/dist/webquark/p-DKrPmn2y.js +0 -13
  949. package/dist/webquark/p-DWO-pleQ.js +0 -1
  950. package/dist/webquark/p-DYMWBqU1.js +0 -5
  951. package/dist/webquark/p-Dhsn99q4.js +0 -1
  952. package/dist/webquark/p-DstNl_WY.js +0 -1
  953. package/dist/webquark/p-DuX-9GOi.js +0 -1
  954. package/dist/webquark/p-GHhpSfZU.js +0 -1
  955. package/dist/webquark/p-SzKf4WZF.js +0 -1
  956. package/dist/webquark/p-c523ec6f.entry.js +0 -1
  957. package/dist/webquark/p-d0253d64.entry.js +0 -1
  958. package/dist/webquark/p-d0fbd2b1.entry.js +0 -1
  959. package/dist/webquark/p-dd115868.entry.js +0 -1
  960. package/dist/webquark/p-f1bac94c.entry.js +0 -1
  961. package/dist/webquark/p-f4f97e74.entry.js +0 -1
  962. package/dist/webquark/p-f63b7214.entry.js +0 -1
  963. package/dist/webquark/p-f98f9439.entry.js +0 -1
  964. package/dist/webquark/p-f9ad63ff.entry.js +0 -1
  965. package/dist/webquark/p-fe200f68.entry.js +0 -1
  966. package/dist/webquark/p-fe8c634a.entry.js +0 -13
  967. package/dist/webquark/p-fec6fe0a.entry.js +0 -1
  968. /package/dist/{collection → browser}/native-content.css +0 -0
  969. /package/dist/{webquark → browser}/webquark.css +0 -0
@@ -1,3507 +0,0 @@
1
- import { r as registerInstance, c as createEvent, a as getElement, h } from './index-B5ElFlHv.js';
2
- import { g as Q_MAP_MARKER_VARIANTS, d as Q_MAP_MARKER_KINDS, e as Q_MAP_MARKER_RINGS, f as Q_MAP_MARKER_SIZES, a as Q_MAP_MARKER_CALLOUT_PLACEMENTS, b as Q_MAP_MARKER_CALLOUT_STAT_LAYOUTS, c as Q_MAP_MARKER_CALLOUT_VISIBILITIES, Q as Q_MAP_DEFAULT_CLUSTER_GROUP } from './map.types-CoIMrUb3.js';
3
-
4
- function isTilePreloadBufferRelevant(requestedProvider, activeProvider) {
5
- return requestedProvider === 'tiles' || activeProvider === 'tiles';
6
- }
7
- function isVectorPaddingRelevant(requestedProvider, activeProvider) {
8
- return requestedProvider === 'vector' || activeProvider === 'vector';
9
- }
10
- /** Coordinates asynchronous provider creation and atomic base-layer replacement. */
11
- class MapBaseLayerController {
12
- operations;
13
- revision = 0;
14
- active;
15
- pendingAttachController;
16
- constructor(operations) {
17
- this.operations = operations;
18
- }
19
- getActiveState() {
20
- return {
21
- activeProvider: this.active?.provider,
22
- usingFallback: this.active?.usingFallback ?? false,
23
- };
24
- }
25
- async sync(config) {
26
- const revision = ++this.revision;
27
- this.abortPendingAttach();
28
- if (!this.isConfigured(config)) {
29
- this.clearActiveLayer();
30
- return { kind: 'empty', activeProvider: undefined, usingFallback: false };
31
- }
32
- const primary = await this.createCandidate(config.requestedProvider, config, revision);
33
- if (primary.kind === 'stale')
34
- return primary;
35
- const primaryResult = primary.kind === 'ready'
36
- ? await this.commit(primary.candidate, config.requestedProvider, false, revision)
37
- : primary;
38
- if (primaryResult.kind === 'stale' || primaryResult.kind === 'ready')
39
- return primaryResult;
40
- if (config.requestedProvider === 'tiles' || !config.tileUrl.trim()) {
41
- return { kind: 'error', error: primaryResult.error, ...this.getActiveState() };
42
- }
43
- const fallback = await this.createCandidate('tiles', config, revision);
44
- if (fallback.kind === 'stale')
45
- return fallback;
46
- if (fallback.kind === 'error') {
47
- return { kind: 'error', error: primaryResult.error, fallbackError: fallback.error, ...this.getActiveState() };
48
- }
49
- const result = await this.commit(fallback.candidate, 'tiles', true, revision);
50
- if (result.kind === 'ready')
51
- return { ...result, warning: primaryResult.error };
52
- if (result.kind === 'error') {
53
- return { kind: 'error', error: primaryResult.error, fallbackError: result.error, ...this.getActiveState() };
54
- }
55
- return result;
56
- }
57
- destroy() {
58
- this.revision += 1;
59
- this.abortPendingAttach();
60
- this.clearActiveLayer();
61
- }
62
- isConfigured(config) {
63
- if (config.requestedProvider === 'google') {
64
- return config.googleApiAvailable || config.googleApiKey.trim().length > 0;
65
- }
66
- if (config.requestedProvider === 'vector') {
67
- return config.vectorStyleUrl.trim().length > 0;
68
- }
69
- return config.tileUrl.trim().length > 0;
70
- }
71
- async createCandidate(provider, config, revision) {
72
- try {
73
- const candidate = provider === 'google'
74
- ? await this.operations.createGoogle(config)
75
- : provider === 'vector'
76
- ? await this.operations.createVector(config)
77
- : this.operations.createTiles(config);
78
- if (revision !== this.revision) {
79
- this.removeLayer(candidate);
80
- return { kind: 'stale' };
81
- }
82
- return { kind: 'ready', candidate };
83
- }
84
- catch (error) {
85
- return revision === this.revision ? { kind: 'error', error } : { kind: 'stale' };
86
- }
87
- }
88
- async commit(candidate, provider, usingFallback, revision) {
89
- if (revision !== this.revision) {
90
- this.removeLayer(candidate);
91
- return { kind: 'stale' };
92
- }
93
- const attachController = new AbortController();
94
- this.pendingAttachController = attachController;
95
- try {
96
- await this.operations.attach(candidate, provider, {
97
- replacing: this.active !== undefined,
98
- signal: attachController.signal,
99
- });
100
- }
101
- catch (error) {
102
- this.clearPendingAttach(attachController);
103
- this.removeLayer(candidate);
104
- if (revision !== this.revision || attachController.signal.aborted) {
105
- return { kind: 'stale' };
106
- }
107
- return { kind: 'error', error, ...this.getActiveState() };
108
- }
109
- this.clearPendingAttach(attachController);
110
- if (revision !== this.revision) {
111
- this.removeLayer(candidate);
112
- return { kind: 'stale' };
113
- }
114
- const previous = this.active;
115
- this.active = { layer: candidate, provider, usingFallback };
116
- if (previous?.layer !== candidate)
117
- this.removeLayer(previous?.layer);
118
- return { kind: 'ready', activeProvider: provider, usingFallback };
119
- }
120
- clearActiveLayer() {
121
- this.removeLayer(this.active?.layer);
122
- this.active = undefined;
123
- }
124
- abortPendingAttach() {
125
- this.pendingAttachController?.abort();
126
- this.pendingAttachController = undefined;
127
- }
128
- clearPendingAttach(controller) {
129
- if (this.pendingAttachController === controller) {
130
- this.pendingAttachController = undefined;
131
- }
132
- }
133
- removeLayer(layer) {
134
- if (!layer)
135
- return;
136
- try {
137
- layer.remove();
138
- }
139
- catch {
140
- // Cleanup is best-effort; Leaflet may already have detached the layer.
141
- }
142
- }
143
- }
144
-
145
- const TILE_SEAM_OVERLAP_PX = 1;
146
- function createRasterTileLayerOptions(minZoom, maxZoom, preloadBuffer, loadingPolicy = 'full-batch') {
147
- return {
148
- attribution: '',
149
- minZoom,
150
- maxZoom,
151
- ...(loadingPolicy === 'progressive'
152
- ? { updateWhenZooming: true }
153
- : {}),
154
- ...(preloadBuffer > 0
155
- ? {
156
- updateInterval: 50,
157
- updateWhenIdle: false,
158
- updateWhenZooming: true,
159
- }
160
- : {}),
161
- };
162
- }
163
- /**
164
- * Extends Leaflet's requested tile bounds so raster imagery is already loaded
165
- * just outside the visible viewport.
166
- */
167
- function createBufferedTileLayer(leaflet, tileUrl, options, preloadBuffer, loadingPolicy = 'full-batch') {
168
- const layer = leaflet.tileLayer(tileUrl, options);
169
- const initializeTile = layer._initTile.bind(layer);
170
- layer._initTile = tile => {
171
- initializeTile(tile);
172
- const tileSize = layer.getTileSize();
173
- tile.style.width = `${tileSize.x + TILE_SEAM_OVERLAP_PX}px`;
174
- tile.style.height = `${tileSize.y + TILE_SEAM_OVERLAP_PX}px`;
175
- };
176
- if (loadingPolicy === 'progressive') {
177
- configureProgressiveTileLayer(requireProgressiveTileLayer(layer));
178
- }
179
- if (preloadBuffer === 0)
180
- return layer;
181
- const getVisiblePixelBounds = layer._getTiledPixelBounds.bind(layer);
182
- layer._getTiledPixelBounds = center => {
183
- const bounds = getVisiblePixelBounds(center);
184
- const tileSize = layer.getTileSize();
185
- const horizontalBuffer = tileSize.x * preloadBuffer;
186
- const verticalBuffer = tileSize.y * preloadBuffer;
187
- return new leaflet.Bounds(bounds.min.subtract([horizontalBuffer, verticalBuffer]), bounds.max.add([horizontalBuffer, verticalBuffer]));
188
- };
189
- return layer;
190
- }
191
- function requireProgressiveTileLayer(layer) {
192
- const candidate = layer;
193
- if (typeof candidate._pruneTiles !== 'function' ||
194
- typeof candidate._tileCoordsToKey !== 'function' ||
195
- typeof candidate._tileReady !== 'function' ||
196
- typeof candidate._updateOpacity !== 'function' ||
197
- typeof candidate.onAdd !== 'function') {
198
- throw progressiveLoadingUnsupported();
199
- }
200
- return candidate;
201
- }
202
- function configureProgressiveTileLayer(layer) {
203
- const addToMap = layer.onAdd.bind(layer);
204
- let configured = false;
205
- layer.onAdd = map => {
206
- const result = addToMap(map);
207
- requireProgressiveTileRecords(layer);
208
- if (!configured) {
209
- keepLoadedParentsUntilChildrenSucceed(layer);
210
- configured = true;
211
- }
212
- return result;
213
- };
214
- }
215
- function requireProgressiveTileRecords(layer) {
216
- if (layer._tiles === null ||
217
- typeof layer._tiles !== 'object' ||
218
- Array.isArray(layer._tiles)) {
219
- throw progressiveLoadingUnsupported();
220
- }
221
- return layer._tiles;
222
- }
223
- function progressiveLoadingUnsupported() {
224
- return new Error('Progressive raster loading is not supported by this Leaflet tile layer.');
225
- }
226
- /**
227
- * Leaflet already retains loaded parents while children are pending. A failed
228
- * image is normally marked active, which can prematurely prune that parent;
229
- * progressive layers keep failed children inactive so the coarser tile stays
230
- * visible underneath.
231
- */
232
- function keepLoadedParentsUntilChildrenSucceed(layer) {
233
- const finishTile = layer._tileReady.bind(layer);
234
- const pruneTiles = layer._pruneTiles.bind(layer);
235
- const updateOpacity = layer._updateOpacity.bind(layer);
236
- const withoutPruning = (operation) => {
237
- const activePruneTiles = layer._pruneTiles;
238
- layer._pruneTiles = () => undefined;
239
- try {
240
- operation();
241
- }
242
- finally {
243
- layer._pruneTiles = activePruneTiles;
244
- }
245
- };
246
- const keepFailedChildrenInactive = () => {
247
- for (const tile of Object.values(layer._tiles)) {
248
- if (tile.progressiveLoadFailed)
249
- tile.active = false;
250
- }
251
- };
252
- layer._tileReady = (coords, error, tile) => {
253
- const tileRecord = layer._tiles[layer._tileCoordsToKey(coords)];
254
- if (!error) {
255
- if (tileRecord)
256
- tileRecord.progressiveLoadFailed = false;
257
- finishTile(coords, error, tile);
258
- return;
259
- }
260
- withoutPruning(() => finishTile(coords, error, tile));
261
- if (tileRecord) {
262
- tileRecord.progressiveLoadFailed = true;
263
- tileRecord.active = false;
264
- }
265
- pruneTiles();
266
- };
267
- layer._updateOpacity = () => {
268
- withoutPruning(updateOpacity);
269
- keepFailedChildrenInactive();
270
- pruneTiles();
271
- };
272
- }
273
-
274
- function isRecord$1(value) {
275
- return typeof value === 'object' && value !== null;
276
- }
277
- function parseBoundsInput(bounds) {
278
- if (typeof bounds !== 'string')
279
- return { parsed: bounds, invalidJson: false };
280
- if (!bounds.trim())
281
- return { parsed: undefined, invalidJson: false };
282
- try {
283
- return { parsed: JSON.parse(bounds), invalidJson: false };
284
- }
285
- catch {
286
- return { invalidJson: true };
287
- }
288
- }
289
- function isLatitude(value) {
290
- return typeof value === 'number' && Number.isFinite(value) && value >= -90 && value <= 90;
291
- }
292
- function isLongitude(value) {
293
- return typeof value === 'number' && Number.isFinite(value) && value >= -180 && value <= 180;
294
- }
295
- function resolveMapBounds(input) {
296
- const { parsed: bounds, invalidJson } = parseBoundsInput(input);
297
- if (invalidJson)
298
- return { kind: 'invalid', message: 'maxBounds must be valid JSON or a bounds object.' };
299
- if (bounds === undefined)
300
- return { kind: 'clear' };
301
- if (!isRecord$1(bounds))
302
- return { kind: 'invalid', message: 'maxBounds must be a bounds object.' };
303
- const { southLatitude, westLongitude, northLatitude, eastLongitude } = bounds;
304
- if (!isLatitude(southLatitude) || !isLatitude(northLatitude)) {
305
- return { kind: 'invalid', message: 'maxBounds latitude values must be finite numbers from -90 to 90.' };
306
- }
307
- if (!isLongitude(westLongitude) || !isLongitude(eastLongitude)) {
308
- return { kind: 'invalid', message: 'maxBounds longitude values must be finite numbers from -180 to 180.' };
309
- }
310
- if (southLatitude >= northLatitude) {
311
- return { kind: 'invalid', message: 'maxBounds southLatitude must be below northLatitude.' };
312
- }
313
- if (westLongitude >= eastLongitude) {
314
- return { kind: 'invalid', message: 'maxBounds westLongitude must be below eastLongitude; antimeridian-crossing bounds are not supported.' };
315
- }
316
- const normalized = { southLatitude, westLongitude, northLatitude, eastLongitude };
317
- return {
318
- kind: 'valid',
319
- bounds: normalized,
320
- leafletBounds: [
321
- [normalized.southLatitude, normalized.westLongitude],
322
- [normalized.northLatitude, normalized.eastLongitude],
323
- ],
324
- };
325
- }
326
- function getInitialLeafletMapBounds(resolution) {
327
- return resolution.kind === 'valid' ? resolution.leafletBounds : undefined;
328
- }
329
- function getMapBoundsViscosity(value) {
330
- const viscosity = Number.isFinite(value) ? value : 1;
331
- return Math.max(0, Math.min(1, viscosity));
332
- }
333
- function applyMapBounds(map, resolution, viscosity) {
334
- map.options.maxBoundsViscosity = getMapBoundsViscosity(viscosity);
335
- if (resolution.kind === 'invalid')
336
- return false;
337
- map.setMaxBounds(resolution.kind === 'valid' ? resolution.leafletBounds : undefined);
338
- return true;
339
- }
340
-
341
- const GOOGLE_MAPS_VERSION = 'quarterly';
342
- const GOOGLE_MAPS_SCRIPT_URL = 'https://maps.googleapis.com/maps/api/js';
343
- let configuredApiKey;
344
- let googleMapsLoadPromise;
345
- let callbackSequence = 0;
346
- /** Returns whether the Maps JavaScript API has exposed the constructor GoogleMutant needs. */
347
- function hasGoogleMapsApi() {
348
- if (typeof window === 'undefined')
349
- return false;
350
- return typeof window.google?.maps?.Map === 'function';
351
- }
352
- /** Returns whether Google Maps is loaded or exposes an application-owned library importer. */
353
- function hasGoogleMapsConfiguration() {
354
- if (hasGoogleMapsApi())
355
- return true;
356
- if (typeof window === 'undefined')
357
- return false;
358
- return typeof window.google?.maps?.importLibrary === 'function';
359
- }
360
- /**
361
- * Loads Google Maps once per browser realm, reusing an application-owned API
362
- * and allowing a fresh key after a failed WebQuark-owned script attempt.
363
- */
364
- function loadGoogleMapsApi(apiKey) {
365
- if (typeof window === 'undefined' || typeof document === 'undefined') {
366
- return Promise.reject(new Error('QMap: Google Maps is only available in a browser environment.'));
367
- }
368
- if (hasGoogleMapsApi())
369
- return Promise.resolve();
370
- const normalizedApiKey = apiKey.trim();
371
- const externalImporter = window.google?.maps?.importLibrary;
372
- if (googleMapsLoadPromise) {
373
- if (configuredApiKey && normalizedApiKey && configuredApiKey !== normalizedApiKey) {
374
- return Promise.reject(new Error('QMap: Google Maps is already loading with a different API key.'));
375
- }
376
- return googleMapsLoadPromise;
377
- }
378
- if (externalImporter) {
379
- googleMapsLoadPromise = loadWithExternalImporter(externalImporter);
380
- return googleMapsLoadPromise;
381
- }
382
- if (!normalizedApiKey)
383
- return Promise.reject(new Error('QMap: A Google Maps API key is required.'));
384
- configuredApiKey = normalizedApiKey;
385
- googleMapsLoadPromise = loadWithScript(normalizedApiKey).catch((cause) => {
386
- configuredApiKey = undefined;
387
- googleMapsLoadPromise = undefined;
388
- throw new Error('QMap: Google Maps failed to load.', { cause });
389
- });
390
- return googleMapsLoadPromise;
391
- }
392
- function loadWithExternalImporter(importLibrary) {
393
- googleMapsLoadPromise = importLibrary('maps')
394
- .then(() => assertGoogleMapsApi())
395
- .catch((cause) => {
396
- googleMapsLoadPromise = undefined;
397
- throw new Error('QMap: Google Maps failed to load.', { cause });
398
- });
399
- return googleMapsLoadPromise;
400
- }
401
- function loadWithScript(apiKey) {
402
- const targetWindow = window;
403
- const previousGoogle = targetWindow.google;
404
- const previousMaps = previousGoogle?.maps;
405
- const callbackName = `__webquarkGoogleMapsReady${++callbackSequence}`;
406
- const callbackHost = targetWindow;
407
- const script = document.createElement('script');
408
- const params = new URLSearchParams({ callback: callbackName, key: apiKey, loading: 'async', v: GOOGLE_MAPS_VERSION });
409
- script.async = true;
410
- script.defer = true;
411
- script.src = `${GOOGLE_MAPS_SCRIPT_URL}?${params.toString()}`;
412
- script.dataset.webquarkGoogleMaps = 'true';
413
- const nonce = document.querySelector('script[nonce]')?.nonce;
414
- if (nonce)
415
- script.nonce = nonce;
416
- return new Promise((resolve, reject) => {
417
- const cleanup = (failed) => {
418
- delete callbackHost[callbackName];
419
- script.onerror = null;
420
- if (failed) {
421
- script.remove();
422
- restoreGoogleMapsNamespace(targetWindow, previousGoogle, previousMaps);
423
- }
424
- };
425
- callbackHost[callbackName] = () => {
426
- try {
427
- assertGoogleMapsApi();
428
- cleanup(false);
429
- resolve();
430
- }
431
- catch (error) {
432
- cleanup(true);
433
- reject(error);
434
- }
435
- };
436
- script.onerror = () => {
437
- cleanup(true);
438
- reject(new Error('The Google Maps script could not be loaded.'));
439
- };
440
- document.head.append(script);
441
- });
442
- }
443
- function assertGoogleMapsApi() {
444
- if (!hasGoogleMapsApi())
445
- throw new Error('The Maps library loaded without exposing google.maps.Map.');
446
- }
447
- function restoreGoogleMapsNamespace(targetWindow, previousGoogle, previousMaps) {
448
- if (!previousGoogle) {
449
- delete targetWindow.google;
450
- return;
451
- }
452
- targetWindow.google = previousGoogle;
453
- if (previousMaps)
454
- previousGoogle.maps = previousMaps;
455
- else
456
- delete previousGoogle.maps;
457
- }
458
-
459
- let googleMutantConstructorPromise;
460
- /**
461
- * Lazily loads GoogleMutant's ESM constructor without leaving Leaflet on the
462
- * global object.
463
- *
464
- * GoogleMutant 0.16.0's ESM file still executes its legacy `L.gridLayer`
465
- * factory footer. Supplying the exact ESM Leaflet namespace during module
466
- * evaluation avoids its `L is not defined` error; both incidental globals are
467
- * restored immediately afterwards. Consumers must instantiate the returned
468
- * default constructor rather than the legacy factory, whose ESM registration
469
- * is incomplete in 0.16.0.
470
- */
471
- function loadGoogleMutantConstructor(leaflet) {
472
- if (!googleMutantConstructorPromise) {
473
- googleMutantConstructorPromise = importGoogleMutantConstructor(leaflet).catch((error) => {
474
- googleMutantConstructorPromise = undefined;
475
- throw error;
476
- });
477
- }
478
- return googleMutantConstructorPromise;
479
- }
480
- async function importGoogleMutantConstructor(leaflet) {
481
- if (typeof window === 'undefined') {
482
- throw new Error('QMap: GoogleMutant is only available in a browser environment.');
483
- }
484
- const globals = globalThis;
485
- const factoryHost = leaflet.gridLayer;
486
- const hasOwn = Object.prototype.hasOwnProperty;
487
- const hadLeafletGlobal = hasOwn.call(globals, 'L');
488
- const previousLeafletGlobal = globals.L;
489
- const hadGoogleMutantFactory = hasOwn.call(factoryHost, 'googleMutant');
490
- const previousGoogleMutantFactory = factoryHost.googleMutant;
491
- globals.L = leaflet;
492
- try {
493
- const module = await import('./Leaflet.GoogleMutant-MpxOb4Jm.js');
494
- if (typeof module.default !== 'function') {
495
- throw new Error('QMap: GoogleMutant did not expose its default constructor.');
496
- }
497
- return module.default;
498
- }
499
- finally {
500
- if (hadGoogleMutantFactory)
501
- factoryHost.googleMutant = previousGoogleMutantFactory;
502
- else
503
- delete factoryHost.googleMutant;
504
- if (hadLeafletGlobal)
505
- globals.L = previousLeafletGlobal;
506
- else
507
- delete globals.L;
508
- }
509
- }
510
-
511
- const VECTOR_STYLE_LOAD_TIMEOUT_MS = 15_000;
512
- let mapLibreLayerFactoryPromise;
513
- /** Lazily loads MapLibre's Leaflet adapter and returns its registered layer factory. */
514
- function loadMapLibreLayerFactory(leaflet) {
515
- if (!mapLibreLayerFactoryPromise) {
516
- mapLibreLayerFactoryPromise = importMapLibreLayerFactory(leaflet).catch((error) => {
517
- mapLibreLayerFactoryPromise = undefined;
518
- throw error;
519
- });
520
- }
521
- return mapLibreLayerFactoryPromise;
522
- }
523
- async function importMapLibreLayerFactory(leaflet) {
524
- if (typeof window === 'undefined') {
525
- throw new Error('QMap: the vector provider is only available in a browser environment.');
526
- }
527
- await import('./leaflet-maplibre-gl-BvKlNmWf.js');
528
- const factory = leaflet.maplibreGL;
529
- if (typeof factory !== 'function') {
530
- throw new Error('QMap: MapLibre did not register its Leaflet layer factory.');
531
- }
532
- return factory;
533
- }
534
- /** Waits until the vector style has loaded so provider fallback remains transactional. */
535
- function waitForMapLibreLayerReady(layer) {
536
- const getMaplibreMap = layer.getMaplibreMap;
537
- if (typeof getMaplibreMap !== 'function') {
538
- return Promise.reject(new Error('QMap: the vector layer did not expose its MapLibre map.'));
539
- }
540
- const map = getMaplibreMap.call(layer);
541
- if (map.loaded())
542
- return Promise.resolve();
543
- return new Promise((resolve, reject) => {
544
- const handleLoad = () => finish(resolve);
545
- const handleError = (event) => {
546
- finish(() => reject(event.error ?? new Error('QMap: the vector style failed to load.')));
547
- };
548
- const timeout = window.setTimeout(() => {
549
- finish(() => reject(new Error('QMap: the vector style timed out while loading.')));
550
- }, VECTOR_STYLE_LOAD_TIMEOUT_MS);
551
- const finish = (complete) => {
552
- window.clearTimeout(timeout);
553
- map.off('load', handleLoad);
554
- map.off('error', handleError);
555
- complete();
556
- };
557
- map.on('load', handleLoad);
558
- map.on('error', handleError);
559
- });
560
- }
561
-
562
- const ARRAY_TYPES = [
563
- Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,
564
- Int32Array, Uint32Array, Float32Array, Float64Array
565
- ];
566
-
567
- /** @typedef {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor} TypedArrayConstructor */
568
- /** @typedef {Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array} TypedArray */
569
-
570
- const VERSION = 1; // serialized format version
571
- const HEADER_SIZE = 8;
572
-
573
- // Shared scratch stack for iterative DFS in range/within. Sized for the worst case:
574
- // 3 ints per frame * (treeHeight + 1), with treeHeight ≤ ceil(log2(2^32 / 3)) ≈ 31.
575
- const STACK = new Uint32Array(96);
576
-
577
- class KDBush {
578
-
579
- /**
580
- * Creates an index from raw `ArrayBuffer` data.
581
- * @param {ArrayBufferLike} data
582
- */
583
- static from(data) {
584
- // @ts-expect-error duck typing array buffers
585
- if (!data || data.byteLength === undefined || data.buffer) {
586
- throw new Error('Data must be an instance of ArrayBuffer or SharedArrayBuffer.');
587
- }
588
- const [magic, versionAndType] = new Uint8Array(data, 0, 2);
589
- if (magic !== 0xdb) {
590
- throw new Error('Data does not appear to be in a KDBush format.');
591
- }
592
- const version = versionAndType >> 4;
593
- if (version !== VERSION) {
594
- throw new Error(`Got v${version} data when expected v${VERSION}.`);
595
- }
596
- const ArrayType = ARRAY_TYPES[versionAndType & 0x0f];
597
- if (!ArrayType) {
598
- throw new Error('Unrecognized array type.');
599
- }
600
- const [nodeSize] = new Uint16Array(data, 2, 1);
601
- const [numItems] = new Uint32Array(data, 4, 1);
602
-
603
- return new KDBush(numItems, nodeSize, ArrayType, undefined, data);
604
- }
605
-
606
- /**
607
- * Creates an index that will hold a given number of items.
608
- * @param {number} numItems
609
- * @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
610
- * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
611
- * @param {ArrayBufferConstructor | SharedArrayBufferConstructor} [ArrayBufferType=ArrayBuffer] The array buffer type used for storage (`ArrayBuffer` by default).
612
- * @param {ArrayBufferLike} [data] (For internal use only)
613
- */
614
- constructor(numItems, nodeSize = 64, ArrayType = Float64Array, ArrayBufferType = ArrayBuffer, data) {
615
- if (isNaN(numItems) || numItems < 0) throw new Error(`Unexpected numItems value: ${numItems}.`);
616
-
617
- this.numItems = +numItems;
618
- this.nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
619
- this.ArrayType = ArrayType;
620
- this.IndexArrayType = numItems < 65536 ? Uint16Array : Uint32Array;
621
-
622
- const arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);
623
- const coordsByteSize = numItems * 2 * this.ArrayType.BYTES_PER_ELEMENT;
624
- const idsByteSize = numItems * this.IndexArrayType.BYTES_PER_ELEMENT;
625
- const padCoords = (8 - idsByteSize % 8) % 8;
626
-
627
- if (arrayTypeIndex < 0) {
628
- throw new Error(`Unexpected typed array class: ${ArrayType}.`);
629
- }
630
-
631
- if (data) { // reconstruct an index from a buffer
632
- this.data = data;
633
- // @ts-expect-error TS can't handle SharedArrayBuffer overloads
634
- this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);
635
- // @ts-expect-error TS can't handle SharedArrayBuffer overloads
636
- this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
637
- this._pos = numItems * 2;
638
- this._finished = true;
639
-
640
- } else { // initialize a new index
641
- const data = this.data = new ArrayBufferType(HEADER_SIZE + coordsByteSize + idsByteSize + padCoords);
642
- // @ts-expect-error TS can't handle SharedArrayBuffer overloads
643
- this.ids = new this.IndexArrayType(data, HEADER_SIZE, numItems);
644
- // @ts-expect-error TS can't handle SharedArrayBuffer overloads
645
- this.coords = new ArrayType(data, HEADER_SIZE + idsByteSize + padCoords, numItems * 2);
646
- this._pos = 0;
647
- this._finished = false;
648
-
649
- // set header
650
- new Uint8Array(data, 0, 2).set([0xdb, (VERSION << 4) + arrayTypeIndex]);
651
- new Uint16Array(data, 2, 1)[0] = nodeSize;
652
- new Uint32Array(data, 4, 1)[0] = numItems;
653
- }
654
- }
655
-
656
- /**
657
- * Add a point to the index.
658
- * @param {number} x
659
- * @param {number} y
660
- * @returns {number} An incremental index associated with the added item (starting from `0`).
661
- */
662
- add(x, y) {
663
- const index = this._pos >> 1;
664
- this.ids[index] = index;
665
- this.coords[this._pos++] = x;
666
- this.coords[this._pos++] = y;
667
- return index;
668
- }
669
-
670
- /**
671
- * Perform indexing of the added points.
672
- */
673
- finish() {
674
- const numAdded = this._pos >> 1;
675
- if (numAdded !== this.numItems) {
676
- throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);
677
- }
678
- // kd-sort both arrays for efficient search
679
- sort(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0);
680
-
681
- this._finished = true;
682
- return this;
683
- }
684
-
685
- /**
686
- * Search the index for items within a given bounding box.
687
- * @param {number} minX
688
- * @param {number} minY
689
- * @param {number} maxX
690
- * @param {number} maxY
691
- * @returns {number[]} An array of indices correponding to the found items.
692
- */
693
- range(minX, minY, maxX, maxY) {
694
- if (!this._finished) throw new Error('Data not yet indexed - call index.finish().');
695
-
696
- const {ids, coords, nodeSize} = this;
697
- STACK[0] = 0;
698
- STACK[1] = ids.length - 1;
699
- STACK[2] = 0;
700
- let sp = 3;
701
- const result = [];
702
-
703
- // recursively search for items in range in the kd-sorted arrays
704
- while (sp > 0) {
705
- const axis = STACK[--sp];
706
- const right = STACK[--sp];
707
- const left = STACK[--sp];
708
-
709
- // if we reached "tree node", search linearly
710
- if (right - left <= nodeSize) {
711
- for (let i = left; i <= right; i++) {
712
- const x = coords[2 * i];
713
- const y = coords[2 * i + 1];
714
- if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[i]);
715
- }
716
- continue;
717
- }
718
-
719
- // otherwise find the middle index
720
- const m = (left + right) >> 1;
721
-
722
- // include the middle item if it's in range
723
- const x = coords[2 * m];
724
- const y = coords[2 * m + 1];
725
- if (x >= minX && x <= maxX && y >= minY && y <= maxY) result.push(ids[m]);
726
-
727
- // queue search in halves that intersect the query
728
- if (axis === 0 ? minX <= x : minY <= y) {
729
- STACK[sp++] = left;
730
- STACK[sp++] = m - 1;
731
- STACK[sp++] = 1 - axis;
732
- }
733
- if (axis === 0 ? maxX >= x : maxY >= y) {
734
- STACK[sp++] = m + 1;
735
- STACK[sp++] = right;
736
- STACK[sp++] = 1 - axis;
737
- }
738
- }
739
-
740
- return result;
741
- }
742
-
743
- /**
744
- * Search the index for items within a given radius.
745
- * @param {number} qx
746
- * @param {number} qy
747
- * @param {number} r Query radius.
748
- * @returns {number[]} An array of indices correponding to the found items.
749
- */
750
- within(qx, qy, r) {
751
- const result = /** @type {number[]} */ ([]);
752
- this.withinInto(qx, qy, r, result);
753
- return result;
754
- }
755
-
756
- /**
757
- * Search the index for items within a given radius, writing matching ids into `out`
758
- * via indexed assignment (`out[i] = id`). Accepts any indexed-writable container —
759
- * a typed array sized to the expected upper bound (allocation-free, fast) or a plain
760
- * `Array` (which will grow as needed). Returns the number of matches written.
761
- * @param {number} qx
762
- * @param {number} qy
763
- * @param {number} r Query radius.
764
- * @param {number[] | TypedArray} out Container to write matching ids into.
765
- * @returns {number} The number of matches written to `out`.
766
- */
767
- withinInto(qx, qy, r, out) {
768
- if (!this._finished) throw new Error('Data not yet indexed - call index.finish().');
769
-
770
- const {ids, coords, nodeSize} = this;
771
- STACK[0] = 0;
772
- STACK[1] = ids.length - 1;
773
- STACK[2] = 0;
774
- let sp = 3;
775
- let count = 0;
776
- const r2 = r * r;
777
-
778
- // recursively search for items within radius in the kd-sorted arrays
779
- while (sp > 0) {
780
- const axis = STACK[--sp];
781
- const right = STACK[--sp];
782
- const left = STACK[--sp];
783
-
784
- // if we reached "tree node", search linearly
785
- if (right - left <= nodeSize) {
786
- for (let i = left; i <= right; i++) {
787
- if (sqDist(coords[2 * i], coords[2 * i + 1], qx, qy) <= r2) out[count++] = ids[i];
788
- }
789
- continue;
790
- }
791
-
792
- // otherwise find the middle index
793
- const m = (left + right) >> 1;
794
-
795
- // include the middle item if it's in range
796
- const x = coords[2 * m];
797
- const y = coords[2 * m + 1];
798
- if (sqDist(x, y, qx, qy) <= r2) out[count++] = ids[m];
799
-
800
- // queue search in halves that intersect the query
801
- if (axis === 0 ? qx - r <= x : qy - r <= y) {
802
- STACK[sp++] = left;
803
- STACK[sp++] = m - 1;
804
- STACK[sp++] = 1 - axis;
805
- }
806
- if (axis === 0 ? qx + r >= x : qy + r >= y) {
807
- STACK[sp++] = m + 1;
808
- STACK[sp++] = right;
809
- STACK[sp++] = 1 - axis;
810
- }
811
- }
812
-
813
- return count;
814
- }
815
- }
816
-
817
- /**
818
- * @param {Uint16Array | Uint32Array} ids
819
- * @param {TypedArray} coords
820
- * @param {number} nodeSize
821
- * @param {number} left
822
- * @param {number} right
823
- * @param {number} axis
824
- */
825
- function sort(ids, coords, nodeSize, left, right, axis) {
826
- if (right - left <= nodeSize) return;
827
-
828
- const m = (left + right) >> 1; // middle index
829
-
830
- // sort ids and coords around the middle index so that the halves lie
831
- // either left/right or top/bottom correspondingly (taking turns)
832
- select(ids, coords, m, left, right, axis);
833
-
834
- // recursively kd-sort first half and second half on the opposite axis
835
- sort(ids, coords, nodeSize, left, m - 1, 1 - axis);
836
- sort(ids, coords, nodeSize, m + 1, right, 1 - axis);
837
- }
838
-
839
- /**
840
- * Custom Floyd-Rivest selection algorithm: sort ids and coords so that
841
- * [left..k-1] items are smaller than k-th item (on either x or y axis)
842
- * @param {Uint16Array | Uint32Array} ids
843
- * @param {TypedArray} coords
844
- * @param {number} k
845
- * @param {number} left
846
- * @param {number} right
847
- * @param {number} axis
848
- */
849
- function select(ids, coords, k, left, right, axis) {
850
-
851
- while (right > left) {
852
- if (right - left > 600) {
853
- const n = right - left + 1;
854
- const m = k - left + 1;
855
- const z = Math.log(n);
856
- const s = 0.5 * Math.exp(2 * z / 3);
857
- const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
858
- const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
859
- const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
860
- select(ids, coords, k, newLeft, newRight, axis);
861
- }
862
-
863
- const t = coords[2 * k + axis];
864
- let i = left;
865
- let j = right;
866
-
867
- swapItem(ids, coords, left, k);
868
- if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);
869
-
870
- while (i < j) {
871
- swapItem(ids, coords, i, j);
872
- i++;
873
- j--;
874
- while (coords[2 * i + axis] < t) i++;
875
- while (coords[2 * j + axis] > t) j--;
876
- }
877
-
878
- if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);
879
- else {
880
- j++;
881
- swapItem(ids, coords, j, right);
882
- }
883
-
884
- if (j <= k) left = j + 1;
885
- if (k <= j) right = j - 1;
886
- }
887
- }
888
-
889
- /**
890
- * @param {Uint16Array | Uint32Array} ids
891
- * @param {TypedArray} coords
892
- * @param {number} i
893
- * @param {number} j
894
- */
895
- function swapItem(ids, coords, i, j) {
896
- swap(ids, i, j);
897
- swap(coords, 2 * i, 2 * j);
898
- swap(coords, 2 * i + 1, 2 * j + 1);
899
- }
900
-
901
- /**
902
- * @param {TypedArray} arr
903
- * @param {number} i
904
- * @param {number} j
905
- */
906
- function swap(arr, i, j) {
907
- const tmp = arr[i];
908
- arr[i] = arr[j];
909
- arr[j] = tmp;
910
- }
911
-
912
- /**
913
- * @param {number} ax
914
- * @param {number} ay
915
- * @param {number} bx
916
- * @param {number} by
917
- */
918
- function sqDist(ax, ay, bx, by) {
919
- const dx = ax - bx;
920
- const dy = ay - by;
921
- return dx * dx + dy * dy;
922
- }
923
-
924
- const defaultOptions = {
925
- minZoom: 0, // min zoom to generate clusters on
926
- maxZoom: 16, // max zoom level to cluster the points on
927
- minPoints: 2, // minimum points to form a cluster
928
- radius: 40, // cluster radius in pixels
929
- extent: 512, // tile extent (radius is calculated relative to it)
930
- nodeSize: 64, // size of the KD-tree leaf node, affects performance
931
- log: false, // whether to log timing info
932
-
933
- // whether to generate numeric ids for input features (in vector tiles)
934
- generateId: false,
935
-
936
- // a reduce function for calculating custom cluster properties
937
- reduce: null, // (accumulated, props) => { accumulated.sum += props.sum; }
938
-
939
- // properties to use for individual points when running the reducer
940
- map: props => props // props => ({sum: props.my_value})
941
- };
942
-
943
- // Int32 encoding of source coords in [0, 1]: (coord - 0.5) * SCALE in [-2^29, 2^29].
944
- // Keeps every stored value AND sqDist subtractions inside V8's 31-bit SMI fast path.
945
- const SCALE = 0x40000000; // 2^30
946
- const INV_SCALE = 1 / SCALE;
947
- const encode = c => (c - 0.5) * SCALE;
948
- const decode = v => v * INV_SCALE + 0.5;
949
-
950
- const OFFSET_ZOOM = 2;
951
- const OFFSET_ID = 3;
952
- const OFFSET_PARENT = 4;
953
- const OFFSET_NUM = 5;
954
- const OFFSET_PROP = 6;
955
-
956
- class Supercluster {
957
- constructor(options) {
958
- const opts = this.options = Object.assign(Object.create(defaultOptions), options);
959
- opts.maxZoom = Math.min(opts.maxZoom, 30);
960
- opts.minZoom = Math.min(opts.minZoom, opts.maxZoom);
961
- this.trees = new Array(opts.maxZoom + 1);
962
- this.stride = opts.reduce ? 7 : 6;
963
- this.clusterProps = [];
964
- }
965
-
966
- load(points) {
967
- const {log, minZoom, maxZoom} = this.options;
968
-
969
- if (log) console.time('total time');
970
-
971
- const notProcessed = maxZoom + 1; // sentinel for "not yet processed at any zoom"
972
- const timerId = `z${notProcessed}: ${points.length} points`;
973
- if (log) console.time(timerId);
974
-
975
- const stride = this.stride;
976
-
977
- // MultiPoint features expand into one internal point per coordinate, so count first
978
- let numPoints = points.length;
979
- for (const p of points) {
980
- const g = p.geometry;
981
- if (g && g.type === 'MultiPoint') numPoints += g.coordinates.length - 1;
982
- }
983
- this.numPoints = numPoints;
984
-
985
- // retain only per-point fields used by output paths; drop the GeoJSON wrappers
986
- const props = this.props = new Array(numPoints);
987
- // original Float64 mercator coords for drift-free single-point output
988
- const coords = this.coords = new Float64Array(numPoints * 2);
989
- let ids = null;
990
-
991
- // generate a cluster object for each point and index input points into a KD-tree
992
- const data = new Int32Array(numPoints * stride);
993
- let w = 0;
994
- let i = 0; // index of the individual point (multiple per MultiPoint feature)
995
- for (const p of points) {
996
- const g = p.geometry;
997
- if (!g) { // keep the slot so point indices stay aligned with input features
998
- i++;
999
- continue;
1000
- }
1001
- const cs = g.coordinates;
1002
- const multi = g.type === 'MultiPoint';
1003
-
1004
- for (let c = 0, n = multi ? cs.length : 1; c < n; c++, i++) {
1005
- const [lng, lat] = multi ? cs[c] : cs;
1006
- const px = lngX(lng);
1007
- const py = latY(lat);
1008
- coords[2 * i] = px;
1009
- coords[2 * i + 1] = py;
1010
- // store internal point/cluster data in flat typed arrays for performance
1011
- data[w] = encode(px);
1012
- data[w + 1] = encode(py);
1013
- data[w + OFFSET_ZOOM] = notProcessed;
1014
- data[w + OFFSET_ID] = i;
1015
- data[w + OFFSET_PARENT] = -1;
1016
- data[w + OFFSET_NUM] = 1;
1017
- props[i] = p.properties;
1018
- if (p.id !== undefined) {
1019
- if (!ids) ids = new Array(numPoints);
1020
- ids[i] = p.id;
1021
- }
1022
- w += stride;
1023
- }
1024
- }
1025
- this.ids = ids;
1026
- let prev = w === data.length ? data : data.subarray(0, w);
1027
- let prevNum = w / stride;
1028
- this.trees[maxZoom + 1] = this._createTree(prev, prevNum);
1029
-
1030
- if (log) console.timeEnd(timerId);
1031
-
1032
- // cluster points on max zoom, then cluster the results on previous zoom, etc.;
1033
- // results in a cluster hierarchy across zoom levels
1034
- let recycled = null;
1035
- for (let z = maxZoom; z >= minZoom; z--) {
1036
- const now = performance.now();
1037
-
1038
- // allocate a tight Int32 slab for this zoom; output is strictly <= input length.
1039
- // on a plateau zoom prev/prevNum don't advance, so the slab is the right size
1040
- // for the next iteration too — carry it forward instead of re-allocating.
1041
- const out = recycled || new Int32Array(prevNum * stride);
1042
- recycled = null;
1043
- const written = this._cluster(prev, prevNum, z, out);
1044
-
1045
- if (written === prevNum) {
1046
- // No clusters formed: output coords are bit-identical to input. Reuse the
1047
- // parent tree (same coords, same order) and recycle the out slab — its
1048
- // only differences vs prev are OFFSET_ZOOM mutations that query paths
1049
- // don't read, and _cluster overwrites every slot it uses on next call.
1050
- this.trees[z] = this.trees[z + 1];
1051
- recycled = out;
1052
- } else {
1053
- this.trees[z] = this._createTree(out, written);
1054
- prev = out;
1055
- prevNum = written;
1056
- }
1057
-
1058
- if (log) console.log(`z${z}: ${this.trees[z].numItems} clusters in ${(performance.now() - now).toFixed(2)}ms`);
1059
- }
1060
-
1061
- if (log) console.timeEnd('total time');
1062
-
1063
- return this;
1064
- }
1065
-
1066
- getClusters(bbox, zoom) {
1067
- let minLng = ((bbox[0] + 180) % 360 + 360) % 360 - 180;
1068
- const minLat = Math.max(-90, Math.min(90, bbox[1]));
1069
- let maxLng = bbox[2] === 180 ? 180 : ((bbox[2] + 180) % 360 + 360) % 360 - 180;
1070
- const maxLat = Math.max(-90, Math.min(90, bbox[3]));
1071
-
1072
- if (bbox[2] - bbox[0] >= 360) {
1073
- minLng = -180;
1074
- maxLng = 180;
1075
- } else if (minLng > maxLng) {
1076
- const easternHem = this.getClusters([minLng, minLat, 180, maxLat], zoom);
1077
- const westernHem = this.getClusters([-180, minLat, maxLng, maxLat], zoom);
1078
- return easternHem.concat(westernHem);
1079
- }
1080
-
1081
- const tree = this.trees[this._limitZoom(zoom)];
1082
- const ids = tree.range(encode(lngX(minLng)), encode(latY(maxLat)), encode(lngX(maxLng)), encode(latY(minLat)));
1083
- const data = tree.data;
1084
- const clusters = [];
1085
- for (const id of ids) clusters.push(this._featureJSON(data, this.stride * id));
1086
- return clusters;
1087
- }
1088
-
1089
- getChildren(clusterId) {
1090
- const originId = this._getOriginId(clusterId);
1091
- const originZoom = this._getOriginZoom(clusterId);
1092
- const errorMsg = 'No cluster with the specified id.';
1093
-
1094
- const tree = this.trees[originZoom];
1095
- if (!tree) throw new Error(errorMsg);
1096
-
1097
- const data = tree.data;
1098
- if (originId >= tree.numItems) throw new Error(errorMsg);
1099
-
1100
- const r = this.options.radius / (this.options.extent * Math.pow(2, originZoom - 1));
1101
- const x = data[originId * this.stride];
1102
- const y = data[originId * this.stride + 1];
1103
- const ids = tree.within(x, y, r * SCALE);
1104
- const children = [];
1105
- for (const id of ids) {
1106
- const k = id * this.stride;
1107
- if (data[k + OFFSET_PARENT] === clusterId) children.push(this._featureJSON(data, k));
1108
- }
1109
-
1110
- if (children.length === 0) throw new Error(errorMsg);
1111
-
1112
- return children;
1113
- }
1114
-
1115
- getLeaves(clusterId, limit, offset) {
1116
- limit = limit || 10;
1117
- offset = offset || 0;
1118
-
1119
- const leaves = [];
1120
- this._appendLeaves(leaves, clusterId, limit, offset, 0);
1121
-
1122
- return leaves;
1123
- }
1124
-
1125
- getTile(z, x, y) {
1126
- return this._getTile(z, x, y, false);
1127
- }
1128
-
1129
- // Same tiles as getTile, but with each feature's coords inline (`type: 4`, `x`/`y`) instead of
1130
- // wrapped in a nested `geometry` array — the shape geojson-vt's getTileRaw produces.
1131
- getTileRaw(z, x, y) {
1132
- return this._getTile(z, x, y, true);
1133
- }
1134
-
1135
- _getTile(z, x, y, raw) {
1136
- const tree = this.trees[this._limitZoom(z)];
1137
- const z2 = Math.pow(2, z);
1138
- const {extent, radius} = this.options;
1139
- const p = radius / extent;
1140
- const top = encode((y - p) / z2);
1141
- const bottom = encode((y + 1 + p) / z2);
1142
-
1143
- const tile = {features: []};
1144
-
1145
- this._addTileFeatures(
1146
- tree.range(encode((x - p) / z2), top, encode((x + 1 + p) / z2), bottom),
1147
- tree.data, x, y, z2, tile, raw);
1148
-
1149
- if (x === 0) {
1150
- this._addTileFeatures(
1151
- tree.range(encode(1 - p / z2), top, encode(1), bottom),
1152
- tree.data, z2, y, z2, tile, raw);
1153
- }
1154
- if (x === z2 - 1) {
1155
- this._addTileFeatures(
1156
- tree.range(encode(0), top, encode(p / z2), bottom),
1157
- tree.data, -1, y, z2, tile, raw);
1158
- }
1159
-
1160
- return tile.features.length ? tile : null;
1161
- }
1162
-
1163
- getClusterExpansionZoom(clusterId) {
1164
- let expansionZoom = this._getOriginZoom(clusterId) - 1;
1165
- while (expansionZoom <= this.options.maxZoom) {
1166
- const children = this.getChildren(clusterId);
1167
- expansionZoom++;
1168
- if (children.length !== 1) break;
1169
- clusterId = children[0].properties.cluster_id;
1170
- }
1171
- return expansionZoom;
1172
- }
1173
-
1174
- _appendLeaves(result, clusterId, limit, offset, skipped) {
1175
- const children = this.getChildren(clusterId);
1176
-
1177
- for (const child of children) {
1178
- const props = child.properties;
1179
-
1180
- if (props && props.cluster) {
1181
- if (skipped + props.point_count <= offset) {
1182
- // skip the whole cluster
1183
- skipped += props.point_count;
1184
- } else {
1185
- // enter the cluster
1186
- skipped = this._appendLeaves(result, props.cluster_id, limit, offset, skipped);
1187
- // exit the cluster
1188
- }
1189
- } else if (skipped < offset) {
1190
- // skip a single point
1191
- skipped++;
1192
- } else {
1193
- // add a single point
1194
- result.push(child);
1195
- }
1196
- if (result.length === limit) break;
1197
- }
1198
-
1199
- return skipped;
1200
- }
1201
-
1202
- _createTree(data, numItems) {
1203
- const tree = new KDBush(numItems, this.options.nodeSize, Int32Array);
1204
- const stride = this.stride;
1205
- for (let i = 0; i < numItems; i++) tree.add(data[i * stride], data[i * stride + 1]);
1206
- tree.finish();
1207
- tree.data = data;
1208
- return tree;
1209
- }
1210
-
1211
- _addTileFeatures(ids, data, x, y, z2, tile, raw) {
1212
- for (const i of ids) {
1213
- const k = i * this.stride;
1214
- const isCluster = data[k + OFFSET_NUM] > 1;
1215
-
1216
- let tags, px, py;
1217
- if (isCluster) {
1218
- tags = getClusterProperties(data, k, this.clusterProps);
1219
- px = decode(data[k]);
1220
- py = decode(data[k + 1]);
1221
- } else {
1222
- const origIndex = data[k + OFFSET_ID];
1223
- tags = this.props[origIndex];
1224
- px = this.coords[2 * origIndex];
1225
- py = this.coords[2 * origIndex + 1];
1226
- }
1227
-
1228
- const tx = Math.round(this.options.extent * (px * z2 - x));
1229
- const ty = Math.round(this.options.extent * (py * z2 - y));
1230
- const f = raw ? {type: 4, x: tx, y: ty, tags} : {type: 1, geometry: [[tx, ty]], tags};
1231
-
1232
- // assign id: cluster id, generated point id, or original input id
1233
- const origIndex = data[k + OFFSET_ID];
1234
- const id = isCluster || this.options.generateId ? origIndex :
1235
- this.ids ? this.ids[origIndex] : undefined;
1236
- if (id !== undefined) f.id = id;
1237
-
1238
- tile.features.push(f);
1239
- }
1240
- }
1241
-
1242
- _limitZoom(z) {
1243
- return Math.max(this.options.minZoom, Math.min(Math.floor(+z), this.options.maxZoom + 1));
1244
- }
1245
-
1246
- _cluster(data, numItems, zoom, out) {
1247
- const {radius, extent, reduce, minPoints, maxZoom} = this.options;
1248
- const r = radius / (extent * (1 << zoom)) * SCALE;
1249
- const notProcessed = maxZoom + 1;
1250
- const tree = this.trees[zoom + 1];
1251
- const stride = this.stride;
1252
- const limit = numItems * stride;
1253
- const neighborIds = new Uint32Array(numItems);
1254
- let cursor = 0;
1255
-
1256
- // loop through each point
1257
- for (let i = 0; i < limit; i += stride) {
1258
- // if we've already visited the point at this zoom level, skip it
1259
- if (data[i + OFFSET_ZOOM] <= zoom) continue;
1260
- data[i + OFFSET_ZOOM] = zoom;
1261
-
1262
- // find all nearby points
1263
- const x = data[i];
1264
- const y = data[i + 1];
1265
- const neighborCount = tree.withinInto(x, y, r, neighborIds);
1266
-
1267
- const numPointsOrigin = data[i + OFFSET_NUM];
1268
- let numPoints = numPointsOrigin;
1269
-
1270
- // count the number of points in a potential cluster
1271
- for (let n = 0; n < neighborCount; n++) {
1272
- const k = neighborIds[n] * stride;
1273
- // filter out neighbors that are already processed
1274
- if (data[k + OFFSET_ZOOM] > zoom) numPoints += data[k + OFFSET_NUM];
1275
- }
1276
-
1277
- // if there were neighbors to merge, and there are enough points to form a cluster
1278
- if (numPoints > numPointsOrigin && numPoints >= minPoints) {
1279
- let wx = x * numPointsOrigin;
1280
- let wy = y * numPointsOrigin;
1281
-
1282
- let clusterProperties;
1283
- let clusterPropIndex = -1;
1284
-
1285
- // encode both zoom and point index on which the cluster originated -- offset by total length of features
1286
- const id = ((i / stride | 0) << 5) + (zoom + 1) + this.numPoints;
1287
-
1288
- for (let n = 0; n < neighborCount; n++) {
1289
- const k = neighborIds[n] * stride;
1290
-
1291
- if (data[k + OFFSET_ZOOM] <= zoom) continue;
1292
- data[k + OFFSET_ZOOM] = zoom; // save the zoom (so it doesn't get processed twice)
1293
-
1294
- const numPoints2 = data[k + OFFSET_NUM];
1295
- wx += data[k] * numPoints2; // accumulate coordinates for calculating weighted center
1296
- wy += data[k + 1] * numPoints2;
1297
-
1298
- data[k + OFFSET_PARENT] = id;
1299
-
1300
- if (reduce) {
1301
- if (!clusterProperties) {
1302
- clusterProperties = this._map(data, i, true);
1303
- clusterPropIndex = this.clusterProps.length;
1304
- this.clusterProps.push(clusterProperties);
1305
- }
1306
- reduce(clusterProperties, this._map(data, k));
1307
- }
1308
- }
1309
-
1310
- data[i + OFFSET_PARENT] = id;
1311
- out[cursor] = wx / numPoints;
1312
- out[cursor + 1] = wy / numPoints;
1313
- out[cursor + OFFSET_ZOOM] = notProcessed;
1314
- out[cursor + OFFSET_ID] = id;
1315
- out[cursor + OFFSET_PARENT] = -1;
1316
- out[cursor + OFFSET_NUM] = numPoints;
1317
- if (reduce) out[cursor + OFFSET_PROP] = clusterPropIndex;
1318
- cursor += stride;
1319
-
1320
- } else { // left points as unclustered
1321
- for (let j = 0; j < stride; j++) out[cursor + j] = data[i + j];
1322
- cursor += stride;
1323
-
1324
- if (numPoints > 1) {
1325
- for (let n = 0; n < neighborCount; n++) {
1326
- const k = neighborIds[n] * stride;
1327
- if (data[k + OFFSET_ZOOM] <= zoom) continue;
1328
- data[k + OFFSET_ZOOM] = zoom;
1329
- for (let j = 0; j < stride; j++) out[cursor + j] = data[k + j];
1330
- cursor += stride;
1331
- }
1332
- }
1333
- }
1334
- }
1335
-
1336
- return cursor / stride;
1337
- }
1338
-
1339
- // get index of the point from which the cluster originated
1340
- _getOriginId(clusterId) {
1341
- return (clusterId - this.numPoints) >> 5;
1342
- }
1343
-
1344
- // get zoom of the point from which the cluster originated
1345
- _getOriginZoom(clusterId) {
1346
- return (clusterId - this.numPoints) % 32;
1347
- }
1348
-
1349
- _featureJSON(data, k) {
1350
- const i = data[k + OFFSET_ID];
1351
- const isCluster = data[k + OFFSET_NUM] > 1;
1352
- const id = isCluster ? i : this.ids ? this.ids[i] : undefined;
1353
- const properties = isCluster ? getClusterProperties(data, k, this.clusterProps) : this.props[i];
1354
- const coordinates = isCluster ?
1355
- [xLng(decode(data[k])), yLat(decode(data[k + 1]))] :
1356
- [xLng(this.coords[2 * i]), yLat(this.coords[2 * i + 1])];
1357
- const f = {type: 'Feature', properties, geometry: {type: 'Point', coordinates}};
1358
- if (id !== undefined) f.id = id;
1359
- return f;
1360
- }
1361
-
1362
- _map(data, i, clone) {
1363
- if (data[i + OFFSET_NUM] > 1) {
1364
- const props = this.clusterProps[data[i + OFFSET_PROP]];
1365
- return clone ? Object.assign({}, props) : props;
1366
- }
1367
- const original = this.props[data[i + OFFSET_ID]];
1368
- const result = this.options.map(original);
1369
- return clone && result === original ? Object.assign({}, result) : result;
1370
- }
1371
- }
1372
-
1373
- function getClusterProperties(data, i, clusterProps) {
1374
- const count = data[i + OFFSET_NUM];
1375
- const abbrev =
1376
- count >= 10000 ? `${Math.round(count / 1000) }k` :
1377
- count >= 1000 ? `${Math.round(count / 100) / 10 }k` : count;
1378
- const propIndex = data[i + OFFSET_PROP];
1379
- const properties = propIndex === -1 ? {} : Object.assign({}, clusterProps[propIndex]);
1380
-
1381
- return Object.assign(properties, {
1382
- cluster: true,
1383
- 'cluster_id': data[i + OFFSET_ID],
1384
- 'point_count': count,
1385
- 'point_count_abbreviated': abbrev
1386
- });
1387
- }
1388
-
1389
- // longitude/latitude to spherical mercator in [0..1] range
1390
- function lngX(lng) {
1391
- return lng / 360 + 0.5;
1392
- }
1393
- function latY(lat) {
1394
- const sin = Math.sin(lat * Math.PI / 180);
1395
- const y = (0.5 - 0.25 * Math.log((1 + sin) / (1 - sin)) / Math.PI);
1396
- return y < 0 ? 0 : y > 1 ? 1 : y;
1397
- }
1398
-
1399
- // spherical mercator to longitude/latitude
1400
- function xLng(x) {
1401
- return (x - 0.5) * 360;
1402
- }
1403
- function yLat(y) {
1404
- const y2 = (180 - y * 360) * Math.PI / 180;
1405
- return 360 * Math.atan(Math.exp(y2)) / Math.PI - 90;
1406
- }
1407
-
1408
- const MARKER_VARIANTS = new Set(Q_MAP_MARKER_VARIANTS);
1409
- const MARKER_KINDS = new Set(Q_MAP_MARKER_KINDS);
1410
- const MARKER_RINGS = new Set(Q_MAP_MARKER_RINGS);
1411
- const MARKER_SIZES = new Set(Q_MAP_MARKER_SIZES);
1412
- const CALLOUT_PLACEMENTS = new Set(Q_MAP_MARKER_CALLOUT_PLACEMENTS);
1413
- const CALLOUT_STAT_LAYOUTS = new Set(Q_MAP_MARKER_CALLOUT_STAT_LAYOUTS);
1414
- const CALLOUT_VISIBILITIES = new Set(Q_MAP_MARKER_CALLOUT_VISIBILITIES);
1415
- const MAX_CALLOUT_STATS = 6;
1416
- function isRecord(value) {
1417
- return typeof value === 'object' && value !== null;
1418
- }
1419
- function parseMarkerInput(markers) {
1420
- if (Array.isArray(markers))
1421
- return markers;
1422
- try {
1423
- const parsed = JSON.parse(markers);
1424
- return Array.isArray(parsed) ? parsed : [];
1425
- }
1426
- catch {
1427
- return [];
1428
- }
1429
- }
1430
- function isMarkerId(value) {
1431
- return (typeof value === 'string' && value.trim().length > 0) || (typeof value === 'number' && Number.isFinite(value));
1432
- }
1433
- function getMarkerVariant(value) {
1434
- return typeof value === 'string' && MARKER_VARIANTS.has(value) ? value : 'default';
1435
- }
1436
- function getOptionalEnum(value, allowed) {
1437
- return typeof value === 'string' && allowed.has(value) ? value : undefined;
1438
- }
1439
- function getOptionalText(value) {
1440
- if (typeof value !== 'string')
1441
- return undefined;
1442
- const normalized = value.trim();
1443
- return normalized.length > 0 ? normalized : undefined;
1444
- }
1445
- function getOptionalFiniteNumber(value) {
1446
- return typeof value === 'number' && Number.isFinite(value)
1447
- ? value
1448
- : undefined;
1449
- }
1450
- function getOptionalPixelPair(value, positive) {
1451
- if (!Array.isArray(value) || value.length !== 2)
1452
- return undefined;
1453
- const first = getOptionalFiniteNumber(value[0]);
1454
- const second = getOptionalFiniteNumber(value[1]);
1455
- if (first === undefined || second === undefined || (positive && (first <= 0 || second <= 0)))
1456
- return undefined;
1457
- return [first, second];
1458
- }
1459
- function normalizeBadge(value) {
1460
- if (!isRecord(value))
1461
- return undefined;
1462
- const ariaLabel = getOptionalText(value.ariaLabel);
1463
- const icon = getOptionalText(value.icon);
1464
- const text = getOptionalText(value.text);
1465
- if (!ariaLabel || (!icon && !text))
1466
- return undefined;
1467
- return {
1468
- ariaLabel,
1469
- variant: getMarkerVariant(value.variant),
1470
- ...(icon ? { icon } : {}),
1471
- ...(text ? { text } : {}),
1472
- };
1473
- }
1474
- function normalizeClusterGroup(value) {
1475
- return getOptionalText(value) ?? Q_MAP_DEFAULT_CLUSTER_GROUP;
1476
- }
1477
- function getMapMarkerClusterGroup(marker) {
1478
- return normalizeClusterGroup(marker.clusterGroup);
1479
- }
1480
- function normalizeCalloutStatus(value) {
1481
- if (!isRecord(value))
1482
- return undefined;
1483
- const label = getOptionalText(value.label);
1484
- if (!label)
1485
- return undefined;
1486
- return {
1487
- label,
1488
- variant: getMarkerVariant(value.variant),
1489
- };
1490
- }
1491
- function normalizeCalloutStat(value) {
1492
- if (!isRecord(value))
1493
- return undefined;
1494
- const label = getOptionalText(value.label);
1495
- const statValue = typeof value.value === 'number' && Number.isFinite(value.value)
1496
- ? value.value
1497
- : getOptionalText(value.value);
1498
- if (!label || statValue === undefined)
1499
- return undefined;
1500
- return {
1501
- label,
1502
- value: statValue,
1503
- layout: getOptionalEnum(value.layout, CALLOUT_STAT_LAYOUTS) ?? 'compact',
1504
- };
1505
- }
1506
- function normalizeCalloutStats(value) {
1507
- if (!Array.isArray(value))
1508
- return undefined;
1509
- const stats = value
1510
- .map(normalizeCalloutStat)
1511
- .filter((stat) => stat !== undefined)
1512
- .slice(0, MAX_CALLOUT_STATS);
1513
- return stats.length > 0 ? stats : undefined;
1514
- }
1515
- function normalizeCallout(value) {
1516
- if (!isRecord(value))
1517
- return undefined;
1518
- const title = getOptionalText(value.title);
1519
- if (!title)
1520
- return undefined;
1521
- const subtitle = getOptionalText(value.subtitle);
1522
- const meta = getOptionalText(value.meta);
1523
- const stats = normalizeCalloutStats(value.stats);
1524
- const status = normalizeCalloutStatus(value.status);
1525
- const placement = getOptionalEnum(value.placement, CALLOUT_PLACEMENTS) ?? 'auto';
1526
- const visibility = getOptionalEnum(value.visibility, CALLOUT_VISIBILITIES) ?? 'always';
1527
- return {
1528
- title,
1529
- variant: getMarkerVariant(value.variant),
1530
- placement,
1531
- visibility,
1532
- ...(subtitle ? { subtitle } : {}),
1533
- ...(meta ? { meta } : {}),
1534
- ...(stats ? { stats } : {}),
1535
- ...(status ? { status } : {}),
1536
- };
1537
- }
1538
- function normalizeMarker(value) {
1539
- if (!isRecord(value) || !isMarkerId(value.id))
1540
- return undefined;
1541
- if (typeof value.latitude !== 'number' || !Number.isFinite(value.latitude) || value.latitude < -90 || value.latitude > 90)
1542
- return undefined;
1543
- if (typeof value.longitude !== 'number' || !Number.isFinite(value.longitude) || value.longitude < -180 || value.longitude > 180)
1544
- return undefined;
1545
- const label = typeof value.label === 'string' && value.label.trim().length > 0 ? value.label : String(value.id);
1546
- const imageUrl = getOptionalText(value.imageUrl);
1547
- const imageSize = getOptionalPixelPair(value.imageSize, true);
1548
- const imageAnchor = getOptionalPixelPair(value.imageAnchor, false);
1549
- const fallbackText = getOptionalText(value.fallbackText);
1550
- const icon = getOptionalText(value.icon);
1551
- const iconSize = getOptionalFiniteNumber(value.iconSize);
1552
- const iconOffsetX = getOptionalFiniteNumber(value.iconOffsetX);
1553
- const iconOffsetY = getOptionalFiniteNumber(value.iconOffsetY);
1554
- const requestedKind = getOptionalEnum(value.kind, MARKER_KINDS);
1555
- const kind = (requestedKind === 'icon' && !icon) || (requestedKind === 'image' && !imageUrl)
1556
- ? 'dot'
1557
- : requestedKind;
1558
- const size = getOptionalEnum(value.size, MARKER_SIZES);
1559
- const ring = getOptionalEnum(value.ring, MARKER_RINGS);
1560
- const badge = normalizeBadge(value.badge);
1561
- const callout = normalizeCallout(value.callout);
1562
- return {
1563
- id: value.id,
1564
- latitude: value.latitude,
1565
- longitude: value.longitude,
1566
- label,
1567
- clusterable: value.clusterable !== false,
1568
- clusterGroup: normalizeClusterGroup(value.clusterGroup),
1569
- variant: getMarkerVariant(value.variant),
1570
- ...(imageUrl ? { imageUrl } : {}),
1571
- ...(imageSize ? { imageSize } : {}),
1572
- ...(imageAnchor ? { imageAnchor } : {}),
1573
- ...(fallbackText ? { fallbackText } : {}),
1574
- ...(kind ? { kind } : {}),
1575
- ...(icon ? { icon } : {}),
1576
- ...(iconSize !== undefined ? { iconSize } : {}),
1577
- ...(iconOffsetX !== undefined ? { iconOffsetX } : {}),
1578
- ...(iconOffsetY !== undefined ? { iconOffsetY } : {}),
1579
- ...(size ? { size } : {}),
1580
- ...(ring ? { ring } : {}),
1581
- ...(value.pulse === true ? { pulse: true } : {}),
1582
- ...(badge ? { badge } : {}),
1583
- ...(callout ? { callout } : {}),
1584
- };
1585
- }
1586
- function getMapMarkerKey(id) {
1587
- return typeof id === 'number' ? `number:${id}` : `string:${id}`;
1588
- }
1589
- function getMapMarkers(markers) {
1590
- const uniqueMarkers = new Map();
1591
- for (const value of parseMarkerInput(markers)) {
1592
- const marker = normalizeMarker(value);
1593
- if (marker)
1594
- uniqueMarkers.set(getMapMarkerKey(marker.id), marker);
1595
- }
1596
- return [...uniqueMarkers.values()];
1597
- }
1598
-
1599
- function clampInteger(value, minimum, maximum) {
1600
- return Math.max(minimum, Math.min(maximum, Math.round(value)));
1601
- }
1602
- function normalizeMapMarkerClusteringOptions(enabled, radius, minPoints, requestedMaxZoom, mapMaxZoom) {
1603
- const normalizedMapMaxZoom = Number.isFinite(mapMaxZoom) ? Math.max(0, Math.floor(mapMaxZoom)) : 19;
1604
- return {
1605
- enabled,
1606
- radius: Number.isFinite(radius) ? clampInteger(radius, 1, 200) : 48,
1607
- minPoints: Number.isFinite(minPoints) ? clampInteger(minPoints, 2, 1000) : 2,
1608
- maxZoom: Number.isFinite(requestedMaxZoom)
1609
- ? clampInteger(requestedMaxZoom, 0, normalizedMapMaxZoom)
1610
- : Math.max(0, normalizedMapMaxZoom - 1),
1611
- };
1612
- }
1613
- function sourceSignature(markers, options) {
1614
- return `${options.radius}:${options.minPoints}:${options.maxZoom}:${markers
1615
- .map(marker => `${getMapMarkerKey(marker.id)}@${marker.longitude},${marker.latitude}`)
1616
- .sort()
1617
- .join('|')}`;
1618
- }
1619
- function isClusterFeature(feature) {
1620
- return 'cluster' in feature.properties && feature.properties.cluster === true;
1621
- }
1622
- function createClusterIndex(markers, options) {
1623
- const index = new Supercluster({
1624
- radius: options.radius,
1625
- minPoints: options.minPoints,
1626
- maxZoom: options.maxZoom,
1627
- });
1628
- index.load(markers.map(marker => ({
1629
- type: 'Feature',
1630
- geometry: {
1631
- type: 'Point',
1632
- coordinates: [marker.longitude, marker.latitude],
1633
- },
1634
- properties: {
1635
- markerKey: getMapMarkerKey(marker.id),
1636
- },
1637
- })));
1638
- return index;
1639
- }
1640
- /** Keeps the clustering library private and returns deterministic q-map records. */
1641
- class MapMarkerClusterIndex {
1642
- clusterGroups = new Map();
1643
- standaloneMarkers = new Map();
1644
- load(markers, options) {
1645
- const ordered = [...markers].sort((left, right) => getMapMarkerKey(left.id).localeCompare(getMapMarkerKey(right.id)));
1646
- this.standaloneMarkers.clear();
1647
- const groupedMarkers = new Map();
1648
- for (const marker of ordered) {
1649
- const key = getMapMarkerKey(marker.id);
1650
- if (marker.clusterable === false) {
1651
- this.standaloneMarkers.set(key, marker);
1652
- }
1653
- else {
1654
- const clusterGroup = getMapMarkerClusterGroup(marker);
1655
- const groupMarkers = groupedMarkers.get(clusterGroup) ?? [];
1656
- groupMarkers.push(marker);
1657
- groupedMarkers.set(clusterGroup, groupMarkers);
1658
- }
1659
- }
1660
- const nextClusterGroups = new Map();
1661
- const orderedGroups = [...groupedMarkers].sort(([left], [right]) => left.localeCompare(right));
1662
- for (const [clusterGroup, groupMarkers] of orderedGroups) {
1663
- const groupMarkerMap = new Map(groupMarkers.map(marker => [getMapMarkerKey(marker.id), marker]));
1664
- const signature = sourceSignature(groupMarkers, options);
1665
- const current = this.clusterGroups.get(clusterGroup);
1666
- nextClusterGroups.set(clusterGroup, {
1667
- index: current?.signature === signature
1668
- ? current.index
1669
- : createClusterIndex(groupMarkers, options),
1670
- markers: groupMarkerMap,
1671
- signature,
1672
- });
1673
- }
1674
- this.clusterGroups = nextClusterGroups;
1675
- }
1676
- getViewportItems(bounds, zoom, selectedMarkerId) {
1677
- const selectedKey = selectedMarkerId === undefined ? undefined : getMapMarkerKey(selectedMarkerId);
1678
- const items = new Map();
1679
- for (const [clusterGroup, group] of this.clusterGroups) {
1680
- for (const feature of group.index.getClusters(bounds, Math.max(0, Math.floor(zoom)))) {
1681
- if (!isClusterFeature(feature)) {
1682
- const marker = group.markers.get(feature.properties.markerKey);
1683
- if (marker) {
1684
- const key = getMapMarkerKey(marker.id);
1685
- items.set(key, { kind: 'marker', key, marker });
1686
- }
1687
- continue;
1688
- }
1689
- const sourceClusterId = feature.properties.cluster_id;
1690
- const markerKeys = group.index
1691
- .getLeaves(sourceClusterId, Infinity)
1692
- .map(leaf => leaf.properties.markerKey)
1693
- .filter(key => group.markers.has(key))
1694
- .sort();
1695
- const markerIds = markerKeys
1696
- .map(key => group.markers.get(key)?.id)
1697
- .filter((id) => id !== undefined);
1698
- const clusterId = String(sourceClusterId);
1699
- const key = `cluster:${encodeURIComponent(clusterGroup)}:${clusterId}`;
1700
- items.set(key, {
1701
- kind: 'cluster',
1702
- key,
1703
- clusterId,
1704
- clusterGroup,
1705
- markerIds,
1706
- markerKeys,
1707
- latitude: feature.geometry.coordinates[1],
1708
- longitude: feature.geometry.coordinates[0],
1709
- count: markerIds.length,
1710
- expansionZoom: group.index.getClusterExpansionZoom(sourceClusterId),
1711
- containsSelection: selectedKey !== undefined && markerKeys.includes(selectedKey),
1712
- });
1713
- }
1714
- }
1715
- for (const [key, marker] of this.standaloneMarkers) {
1716
- if (!isMarkerInBounds(marker, bounds))
1717
- continue;
1718
- items.set(key, { kind: 'marker', key, marker });
1719
- }
1720
- return [...items.values()].sort((left, right) => left.key.localeCompare(right.key));
1721
- }
1722
- clear() {
1723
- this.clusterGroups.clear();
1724
- this.standaloneMarkers.clear();
1725
- }
1726
- }
1727
- function isMarkerInBounds(marker, [west, south, east, north]) {
1728
- return (marker.longitude >= west &&
1729
- marker.longitude <= east &&
1730
- marker.latitude >= south &&
1731
- marker.latitude <= north);
1732
- }
1733
-
1734
- const COLLISION_FOOTPRINT_DIAMETER_RATIO = 0.75;
1735
- const COLLISION_RESOLUTION_PASSES = 12;
1736
- const COLLISION_EPSILON = 0.01;
1737
- /**
1738
- * Separates every visible map marker and cluster while allowing their full
1739
- * circles to overlap. The collision footprint is 75% of the rendered diameter.
1740
- */
1741
- function resolveMapMarkerCollisionOffsets(items) {
1742
- const nodes = items
1743
- .filter(item => (Number.isFinite(item.x)
1744
- && Number.isFinite(item.y)
1745
- && Number.isFinite(item.diameter)
1746
- && item.diameter > 0))
1747
- .map(item => ({
1748
- ...item,
1749
- collisionRadius: item.diameter * COLLISION_FOOTPRINT_DIAMETER_RATIO * 0.5,
1750
- offset: { x: 0, y: 0 },
1751
- }))
1752
- .sort((left, right) => left.key.localeCompare(right.key));
1753
- const largestCollisionRadius = Math.max(0, ...nodes.map(node => node.collisionRadius));
1754
- for (let pass = 0; pass < COLLISION_RESOLUTION_PASSES; pass += 1) {
1755
- let adjusted = false;
1756
- const ordered = [...nodes].sort((left, right) => (centerX(left) - centerX(right)
1757
- || centerY(left) - centerY(right)
1758
- || left.key.localeCompare(right.key)));
1759
- for (let leftIndex = 0; leftIndex < ordered.length; leftIndex += 1) {
1760
- const left = ordered[leftIndex];
1761
- if (!left)
1762
- continue;
1763
- for (let rightIndex = leftIndex + 1; rightIndex < ordered.length; rightIndex += 1) {
1764
- const right = ordered[rightIndex];
1765
- if (!right)
1766
- continue;
1767
- const xDistance = centerX(right) - centerX(left);
1768
- if (xDistance >= left.collisionRadius + largestCollisionRadius)
1769
- break;
1770
- const xDelta = centerX(right) - centerX(left);
1771
- const yDelta = centerY(right) - centerY(left);
1772
- const distance = Math.hypot(xDelta, yDelta);
1773
- const minimumDistance = left.collisionRadius + right.collisionRadius;
1774
- if (distance + COLLISION_EPSILON >= minimumDistance)
1775
- continue;
1776
- const direction = distance > COLLISION_EPSILON
1777
- ? { x: xDelta / distance, y: yDelta / distance }
1778
- : stableCollisionDirection(left.key, right.key);
1779
- const pushDistance = (minimumDistance - distance) * 0.5;
1780
- left.offset.x -= direction.x * pushDistance;
1781
- left.offset.y -= direction.y * pushDistance;
1782
- right.offset.x += direction.x * pushDistance;
1783
- right.offset.y += direction.y * pushDistance;
1784
- adjusted = true;
1785
- }
1786
- }
1787
- if (!adjusted)
1788
- break;
1789
- }
1790
- return new Map(nodes.map(node => [node.key, node.offset]));
1791
- }
1792
- function centerX(node) {
1793
- return node.x + node.offset.x;
1794
- }
1795
- function centerY(node) {
1796
- return node.y + node.offset.y;
1797
- }
1798
- function stableCollisionDirection(leftKey, rightKey) {
1799
- let hash = 2_166_136_261;
1800
- for (const character of `${leftKey}\u0000${rightKey}`) {
1801
- hash ^= character.charCodeAt(0);
1802
- hash = Math.imul(hash, 16_777_619);
1803
- }
1804
- const angle = ((hash >>> 0) % 360) * (Math.PI / 180);
1805
- return { x: Math.cos(angle), y: Math.sin(angle) };
1806
- }
1807
-
1808
- const KIND_CLASSES = ['kind-dot', 'kind-avatar', 'kind-icon', 'kind-image'];
1809
- const RING_CLASSES = ['ring-none', 'ring-solid', 'ring-dashed'];
1810
- const ICON_SIZE_PROPERTY = '--q-map-marker-icon-size';
1811
- const ICON_OFFSET_X_PROPERTY = '--q-map-marker-icon-offset-x';
1812
- const ICON_OFFSET_Y_PROPERTY = '--q-map-marker-icon-offset-y';
1813
- function createIcon(document, className) {
1814
- const icon = document.createElement('q-icon');
1815
- icon.className = className;
1816
- icon.setAttribute('size', '100%');
1817
- icon.setAttribute('aria-hidden', 'true');
1818
- return icon;
1819
- }
1820
- function updateIcon(icon, name) {
1821
- icon.hidden = !name;
1822
- if (name)
1823
- icon.setAttribute('name', name);
1824
- else
1825
- icon.removeAttribute('name');
1826
- }
1827
- function createMarkerContent(document) {
1828
- const surface = document.createElement('span');
1829
- surface.className = 'q-map-marker';
1830
- surface.setAttribute('part', 'marker');
1831
- const content = document.createElement('span');
1832
- content.className = 'q-map-marker__content';
1833
- content.setAttribute('aria-hidden', 'true');
1834
- const center = document.createElement('span');
1835
- center.className = 'q-map-marker__center';
1836
- const fallback = document.createElement('span');
1837
- fallback.className = 'q-map-marker__fallback';
1838
- fallback.hidden = true;
1839
- const image = document.createElement('img');
1840
- image.className = 'q-map-marker__image';
1841
- image.alt = '';
1842
- image.decoding = 'async';
1843
- image.draggable = false;
1844
- image.hidden = true;
1845
- image.setAttribute('aria-hidden', 'true');
1846
- image.addEventListener('load', () => {
1847
- if (image.dataset.source !== image.getAttribute('src'))
1848
- return;
1849
- if (surface.dataset.markerKind === 'image' && (!image.complete || image.naturalWidth <= 0))
1850
- return;
1851
- image.hidden = false;
1852
- center.classList.add('has-image');
1853
- syncImageMarkerPresentation(surface, image);
1854
- });
1855
- image.addEventListener('error', () => {
1856
- if (image.dataset.source !== image.getAttribute('src'))
1857
- return;
1858
- if (surface.dataset.markerKind === 'image' && (!image.complete || image.naturalWidth > 0))
1859
- return;
1860
- image.hidden = true;
1861
- center.classList.remove('has-image');
1862
- syncImageMarkerPresentation(surface, image);
1863
- });
1864
- const icon = createIcon(document, 'q-map-marker__icon');
1865
- icon.hidden = true;
1866
- const badge = document.createElement('span');
1867
- badge.className = 'q-map-marker__badge';
1868
- badge.setAttribute('part', 'marker-badge');
1869
- badge.hidden = true;
1870
- const badgeIcon = createIcon(document, 'q-map-marker__badge-icon');
1871
- badgeIcon.hidden = true;
1872
- const badgeText = document.createElement('span');
1873
- badgeText.className = 'q-map-marker__badge-text';
1874
- badgeText.hidden = true;
1875
- center.append(fallback, image, icon);
1876
- badge.append(badgeIcon, badgeText);
1877
- content.append(center, badge);
1878
- surface.append(content);
1879
- return surface;
1880
- }
1881
- function syncImageMarkerPresentation(element, image) {
1882
- const position = element.parentElement;
1883
- const requested = element.dataset.markerKind === 'image';
1884
- const active = requested && !image.hidden;
1885
- if (active) {
1886
- element.classList.add('kind-image');
1887
- position?.classList.add('is-image');
1888
- }
1889
- else {
1890
- element.classList.remove('kind-image');
1891
- position?.classList.remove('is-image');
1892
- }
1893
- if (!requested)
1894
- return;
1895
- element.classList.toggle('kind-dot', !active);
1896
- element.classList.toggle('has-content', active);
1897
- if (!active || !position)
1898
- return;
1899
- const naturalWidth = image.naturalWidth || 32;
1900
- const naturalHeight = image.naturalHeight || 32;
1901
- const scale = Math.min(1, 48 / naturalWidth, 48 / naturalHeight);
1902
- const width = Number(image.dataset.width) || naturalWidth * scale;
1903
- const height = Number(image.dataset.height) || naturalHeight * scale;
1904
- const anchorX = image.dataset.anchorX === undefined ? width / 2 : Number(image.dataset.anchorX);
1905
- const anchorY = image.dataset.anchorY === undefined ? height : Number(image.dataset.anchorY);
1906
- position.style.setProperty('--q-map-image-width', `${width}px`);
1907
- position.style.setProperty('--q-map-image-height', `${height}px`);
1908
- position.style.setProperty('--q-map-image-anchor-x', `${anchorX}px`);
1909
- position.style.setProperty('--q-map-image-anchor-y', `${anchorY}px`);
1910
- }
1911
- function updateImage(center, image, imageUrl) {
1912
- if (!imageUrl) {
1913
- image.hidden = true;
1914
- image.removeAttribute('src');
1915
- delete image.dataset.source;
1916
- center.classList.remove('has-image');
1917
- return;
1918
- }
1919
- if (image.dataset.source === imageUrl)
1920
- return;
1921
- image.hidden = true;
1922
- center.classList.remove('has-image');
1923
- image.dataset.source = imageUrl;
1924
- image.src = imageUrl;
1925
- }
1926
- function getMarkerAccessibleLabel(marker) {
1927
- return marker.badge ? `${marker.label}. ${marker.badge.ariaLabel}` : marker.label;
1928
- }
1929
- function updateMarkerPresentation(element, marker, selected) {
1930
- for (const variant of Q_MAP_MARKER_VARIANTS)
1931
- element.classList.remove(`variant-${variant}`);
1932
- element.classList.remove(...KIND_CLASSES, ...RING_CLASSES);
1933
- element.classList.add(`variant-${marker.variant ?? 'default'}`, `ring-${marker.ring ?? 'none'}`);
1934
- const kind = marker.kind === 'icon' && !marker.icon ? 'dot' : marker.kind;
1935
- if (kind)
1936
- element.classList.add(`kind-${kind}`);
1937
- element.dataset.markerKind = kind ?? '';
1938
- element.classList.toggle('is-pulsing', marker.pulse === true);
1939
- element.classList.toggle('is-selected', selected);
1940
- syncFinitePixelProperty(element, ICON_SIZE_PROPERTY, marker.iconSize);
1941
- syncFinitePixelProperty(element, ICON_OFFSET_X_PROPERTY, marker.iconOffsetX);
1942
- syncFinitePixelProperty(element, ICON_OFFSET_Y_PROPERTY, marker.iconOffsetY);
1943
- const center = element.querySelector('.q-map-marker__center');
1944
- const fallback = center?.querySelector('.q-map-marker__fallback');
1945
- const image = center?.querySelector('.q-map-marker__image');
1946
- const icon = center?.querySelector('.q-map-marker__icon');
1947
- if (!center || !fallback || !image || !icon)
1948
- return;
1949
- const avatarContent = kind === 'avatar' || kind === undefined;
1950
- const fallbackText = avatarContent ? marker.fallbackText ?? '' : '';
1951
- const imageUrl = avatarContent || kind === 'image' ? marker.imageUrl : undefined;
1952
- const iconName = kind === 'icon' ? marker.icon : undefined;
1953
- fallback.textContent = fallbackText;
1954
- fallback.hidden = !fallbackText;
1955
- for (const [key, value] of Object.entries({
1956
- width: marker.imageSize?.[0],
1957
- height: marker.imageSize?.[1],
1958
- anchorX: marker.imageAnchor?.[0],
1959
- anchorY: marker.imageAnchor?.[1],
1960
- })) {
1961
- if (value === undefined)
1962
- delete image.dataset[key];
1963
- else
1964
- image.dataset[key] = String(value);
1965
- }
1966
- updateImage(center, image, imageUrl);
1967
- updateIcon(icon, iconName);
1968
- element.classList.toggle('has-content', Boolean(fallbackText || imageUrl || iconName));
1969
- syncImageMarkerPresentation(element, image);
1970
- const badge = element.querySelector('.q-map-marker__badge');
1971
- const badgeIcon = badge?.querySelector('.q-map-marker__badge-icon');
1972
- const badgeText = badge?.querySelector('.q-map-marker__badge-text');
1973
- if (!badge || !badgeIcon || !badgeText)
1974
- return;
1975
- for (const variant of Q_MAP_MARKER_VARIANTS)
1976
- badge.classList.remove(`variant-${variant}`);
1977
- badge.hidden = !marker.badge;
1978
- badge.classList.add(`variant-${marker.badge?.variant ?? 'default'}`);
1979
- updateIcon(badgeIcon, marker.badge?.icon);
1980
- badgeText.textContent = marker.badge?.text ?? '';
1981
- badgeText.hidden = !marker.badge?.text;
1982
- }
1983
- function syncFinitePixelProperty(element, property, value) {
1984
- if (!Number.isFinite(value)) {
1985
- element.style.removeProperty(property);
1986
- return;
1987
- }
1988
- element.style.setProperty(property, `${Object.is(value, -0) ? 0 : value}px`);
1989
- }
1990
- function createClusterContent(document) {
1991
- const surface = document.createElement('span');
1992
- surface.className = 'q-map-cluster';
1993
- surface.setAttribute('part', 'cluster');
1994
- const content = document.createElement('span');
1995
- content.className = 'q-map-cluster__content';
1996
- content.setAttribute('aria-hidden', 'true');
1997
- const count = document.createElement('span');
1998
- count.className = 'q-map-cluster__count';
1999
- content.append(count);
2000
- surface.append(content);
2001
- return surface;
2002
- }
2003
- function updateClusterPresentation(element, count, containsSelection) {
2004
- const countElement = element.querySelector('.q-map-cluster__count');
2005
- if (countElement)
2006
- countElement.textContent = count > 999 ? `${Math.floor(count / 100) / 10}k` : String(count);
2007
- element.classList.toggle('contains-selection', containsSelection);
2008
- }
2009
- function createCalloutContent(document) {
2010
- const content = document.createElement('div');
2011
- content.className = 'q-map-callout__content';
2012
- content.setAttribute('aria-hidden', 'true');
2013
- const heading = document.createElement('span');
2014
- heading.className = 'q-map-callout__heading';
2015
- const title = document.createElement('span');
2016
- title.className = 'q-map-callout__title';
2017
- const status = document.createElement('span');
2018
- status.className = 'q-map-callout__status';
2019
- status.hidden = true;
2020
- const subtitle = document.createElement('span');
2021
- subtitle.className = 'q-map-callout__subtitle';
2022
- subtitle.hidden = true;
2023
- const meta = document.createElement('span');
2024
- meta.className = 'q-map-callout__meta';
2025
- meta.hidden = true;
2026
- const stats = document.createElement('dl');
2027
- stats.className = 'q-map-callout__stats';
2028
- stats.hidden = true;
2029
- heading.append(title, status);
2030
- content.append(heading, subtitle, meta, stats);
2031
- return content;
2032
- }
2033
- function updateCalloutContent(element, callout) {
2034
- const title = element.querySelector('.q-map-callout__title');
2035
- const subtitle = element.querySelector('.q-map-callout__subtitle');
2036
- const status = element.querySelector('.q-map-callout__status');
2037
- const meta = element.querySelector('.q-map-callout__meta');
2038
- const stats = element.querySelector('.q-map-callout__stats');
2039
- if (!title || !subtitle || !status || !meta || !stats)
2040
- return;
2041
- for (const variant of Q_MAP_MARKER_VARIANTS)
2042
- element.classList.remove(`variant-${variant}`);
2043
- element.classList.add(`variant-${callout.variant ?? 'default'}`);
2044
- title.textContent = callout.title;
2045
- subtitle.textContent = callout.subtitle ?? '';
2046
- subtitle.hidden = !callout.subtitle;
2047
- for (const variant of Q_MAP_MARKER_VARIANTS)
2048
- status.classList.remove(`variant-${variant}`);
2049
- status.classList.add(`variant-${callout.status?.variant ?? 'default'}`);
2050
- status.textContent = callout.status?.label ?? '';
2051
- status.hidden = !callout.status;
2052
- meta.textContent = callout.meta ?? '';
2053
- meta.hidden = !callout.meta;
2054
- updateCalloutStats(stats, callout.stats ?? []);
2055
- }
2056
- function updateCalloutStats(element, stats) {
2057
- const items = stats.map((stat) => {
2058
- const item = element.ownerDocument.createElement('div');
2059
- item.className = `q-map-callout__stat layout-${stat.layout ?? 'compact'}`;
2060
- const label = element.ownerDocument.createElement('dt');
2061
- label.className = 'q-map-callout__stat-label';
2062
- label.textContent = stat.label;
2063
- const value = element.ownerDocument.createElement('dd');
2064
- value.className = 'q-map-callout__stat-value';
2065
- value.textContent = String(stat.value);
2066
- item.append(label, value);
2067
- return item;
2068
- });
2069
- element.textContent = '';
2070
- element.append(...items);
2071
- element.hidden = items.length === 0;
2072
- }
2073
-
2074
- const STANDALONE_MARKER_Z_INDEX_OFFSET = 2_000;
2075
- const DEFAULT_MARKER_DIAMETER = 20;
2076
- const DEFAULT_CLUSTER_DIAMETER = 32;
2077
- const MARKER_SIZE_CLASSES = Q_MAP_MARKER_SIZES.map(size => markerSizeClassName(size));
2078
- /** Owns marker normalization, clustering, stable reconciliation, accessibility, and cleanup. */
2079
- class MapMarkerController {
2080
- options;
2081
- layers = new Map();
2082
- markers = new Map();
2083
- clusterIndex = new MapMarkerClusterIndex();
2084
- visibleItems = new Map();
2085
- pendingFocusMarkerKey;
2086
- markerResizeObserver;
2087
- collisionFrame;
2088
- handleViewportChange = () => this.reconcile();
2089
- constructor(options) {
2090
- this.options = options;
2091
- options.map.on('moveend zoomend', this.handleViewportChange);
2092
- if (typeof ResizeObserver !== 'undefined') {
2093
- this.markerResizeObserver = new ResizeObserver(() => {
2094
- if (this.collisionFrame !== undefined)
2095
- return;
2096
- this.collisionFrame = requestAnimationFrame(() => {
2097
- this.collisionFrame = undefined;
2098
- this.syncCollisionOffsets([...this.visibleItems.values()]);
2099
- });
2100
- });
2101
- }
2102
- }
2103
- sync(markers) {
2104
- const normalized = getMapMarkers(markers);
2105
- this.markers.clear();
2106
- for (const marker of normalized)
2107
- this.markers.set(getMapMarkerKey(marker.id), marker);
2108
- const clustering = this.options.getClusteringOptions();
2109
- if (clustering.enabled)
2110
- this.clusterIndex.load(normalized, clustering);
2111
- else
2112
- this.clusterIndex.clear();
2113
- this.reconcile();
2114
- }
2115
- syncSelection() {
2116
- this.reconcile();
2117
- }
2118
- getVisibilityTarget(markerId) {
2119
- const markerKey = getMapMarkerKey(markerId);
2120
- const marker = this.markers.get(markerKey);
2121
- if (!marker)
2122
- return undefined;
2123
- const directLayer = this.layers.get(markerKey);
2124
- if (directLayer?.kind === 'marker') {
2125
- return {
2126
- latitude: marker.latitude,
2127
- longitude: marker.longitude,
2128
- rendered: { kind: directLayer.kind, element: directLayer.element },
2129
- };
2130
- }
2131
- for (const layer of this.layers.values()) {
2132
- if (!layer.markerKeys.includes(markerKey))
2133
- continue;
2134
- return {
2135
- latitude: marker.latitude,
2136
- longitude: marker.longitude,
2137
- rendered: { kind: layer.kind, element: layer.element },
2138
- };
2139
- }
2140
- return { latitude: marker.latitude, longitude: marker.longitude };
2141
- }
2142
- destroy() {
2143
- this.markerResizeObserver?.disconnect();
2144
- if (this.collisionFrame !== undefined)
2145
- cancelAnimationFrame(this.collisionFrame);
2146
- this.collisionFrame = undefined;
2147
- this.options.map.off('moveend zoomend', this.handleViewportChange);
2148
- for (const key of [...this.layers.keys()])
2149
- this.remove(key);
2150
- this.visibleItems.clear();
2151
- this.markers.clear();
2152
- this.clusterIndex.clear();
2153
- }
2154
- reconcile() {
2155
- const focusIntent = this.captureFocusIntent();
2156
- const items = this.getVisibleItems();
2157
- this.visibleItems = new Map(items.map(item => [item.key, item]));
2158
- for (const key of [...this.layers.keys()]) {
2159
- if (!this.visibleItems.has(key))
2160
- this.remove(key);
2161
- }
2162
- for (const item of items) {
2163
- const current = this.layers.get(item.key);
2164
- if (current && current.kind !== item.kind)
2165
- this.remove(item.key);
2166
- const record = this.layers.get(item.key) ?? this.add(item);
2167
- if (record)
2168
- this.update(record, item);
2169
- }
2170
- this.syncCollisionOffsets(items);
2171
- const preservedFocus = focusIntent
2172
- && this.layers.get(focusIntent.renderKey)?.element === focusIntent.element;
2173
- if (this.pendingFocusMarkerKey) {
2174
- const restored = this.restoreFocus(this.pendingFocusMarkerKey);
2175
- if (restored)
2176
- this.pendingFocusMarkerKey = undefined;
2177
- }
2178
- else if (focusIntent && !preservedFocus) {
2179
- if (!this.restoreFocus(focusIntent.markerKey))
2180
- this.options.map.getContainer().focus();
2181
- }
2182
- }
2183
- getVisibleItems() {
2184
- const clustering = this.options.getClusteringOptions();
2185
- if (!clustering.enabled) {
2186
- return [...this.markers].map(([key, marker]) => ({ kind: 'marker', key, marker }));
2187
- }
2188
- const bounds = this.options.map.getBounds().pad(0.2);
2189
- const south = Math.max(-90, bounds.getSouth());
2190
- const north = Math.min(90, bounds.getNorth());
2191
- const west = Math.max(-180, bounds.getWest());
2192
- const east = Math.min(180, bounds.getEast());
2193
- const safeBounds = east > west
2194
- ? [west, south, east, north]
2195
- : [-180, south, 180, north];
2196
- return this.clusterIndex.getViewportItems(safeBounds, this.options.map.getZoom(), this.options.getSelectedMarkerId());
2197
- }
2198
- add(item) {
2199
- const document = this.options.map.getContainer().ownerDocument;
2200
- const surface = item.kind === 'marker'
2201
- ? createMarkerContent(document)
2202
- : createClusterContent(document);
2203
- const className = item.kind === 'marker'
2204
- ? 'q-map-marker-position'
2205
- : 'q-map-cluster-position';
2206
- const label = item.kind === 'marker' ? item.marker.label : `${item.count} map markers`;
2207
- const layer = this.options.leaflet.marker([this.getLatitude(item), this.getLongitude(item)], {
2208
- bubblingMouseEvents: false,
2209
- icon: this.options.leaflet.divIcon({
2210
- className,
2211
- html: surface,
2212
- iconAnchor: [0, 0],
2213
- iconSize: [0, 0],
2214
- }),
2215
- keyboard: false,
2216
- riseOnHover: true,
2217
- riseOffset: 1000,
2218
- title: label,
2219
- zIndexOffset: this.getZIndexOffset(item),
2220
- });
2221
- layer.addTo(this.options.map);
2222
- const positionElement = layer.getElement();
2223
- if (positionElement)
2224
- this.markerResizeObserver?.observe(positionElement);
2225
- const element = layer.getElement();
2226
- if (!element) {
2227
- layer.remove();
2228
- return undefined;
2229
- }
2230
- if (!element.contains(surface)) {
2231
- layer.remove();
2232
- return undefined;
2233
- }
2234
- const click = (event) => {
2235
- event.stopPropagation();
2236
- this.activate(item.key, event);
2237
- };
2238
- const keydown = (event) => {
2239
- if (event.key !== 'Enter' && event.key !== ' ')
2240
- return;
2241
- event.preventDefault();
2242
- event.stopPropagation();
2243
- this.activate(item.key, event);
2244
- };
2245
- surface.addEventListener('click', click);
2246
- surface.addEventListener('keydown', keydown);
2247
- const record = {
2248
- kind: item.kind,
2249
- layer,
2250
- element: surface,
2251
- markerKeys: [],
2252
- click,
2253
- keydown,
2254
- };
2255
- this.layers.set(item.key, record);
2256
- return record;
2257
- }
2258
- update(record, item) {
2259
- record.layer.setLatLng([this.getLatitude(item), this.getLongitude(item)]);
2260
- record.layer.setZIndexOffset(this.getZIndexOffset(item));
2261
- record.markerKeys = item.kind === 'marker'
2262
- ? [getMapMarkerKey(item.marker.id)]
2263
- : item.markerKeys;
2264
- if (item.kind === 'marker') {
2265
- const selected = this.isSelected(item.marker.id);
2266
- this.syncMarkerSize(record, item.marker.size);
2267
- updateMarkerPresentation(record.element, item.marker, selected);
2268
- record.element.setAttribute('role', 'button');
2269
- record.element.setAttribute('tabindex', '0');
2270
- record.element.setAttribute('aria-label', getMarkerAccessibleLabel(item.marker));
2271
- record.element.setAttribute('aria-pressed', selected ? 'true' : 'false');
2272
- record.element.setAttribute('data-marker-id', item.key);
2273
- record.element.setAttribute('title', item.marker.label);
2274
- this.syncCallout(record, item.marker, selected);
2275
- return;
2276
- }
2277
- this.unbindCallout(record);
2278
- updateClusterPresentation(record.element, item.count, item.containsSelection);
2279
- record.element.setAttribute('role', 'button');
2280
- record.element.setAttribute('tabindex', '0');
2281
- record.element.setAttribute('aria-label', `${item.count} map markers${item.containsSelection ? ', including the selected marker' : ''}`);
2282
- record.element.setAttribute('part', `cluster ${clusterGroupPartName(item.clusterGroup)}`);
2283
- record.element.setAttribute('data-cluster-id', item.clusterId);
2284
- record.element.setAttribute('data-cluster-group', item.clusterGroup);
2285
- record.element.setAttribute('title', `${item.count} map markers`);
2286
- record.element.removeAttribute('aria-pressed');
2287
- }
2288
- getZIndexOffset(item) {
2289
- return item.kind === 'marker' && item.marker.clusterable === false
2290
- ? STANDALONE_MARKER_Z_INDEX_OFFSET
2291
- : 0;
2292
- }
2293
- syncMarkerSize(record, size) {
2294
- const position = record.layer.getElement();
2295
- if (!position)
2296
- return;
2297
- position.classList.remove(...MARKER_SIZE_CLASSES);
2298
- if (size)
2299
- position.classList.add(markerSizeClassName(size));
2300
- }
2301
- syncCollisionOffsets(items) {
2302
- const collisionItems = [];
2303
- for (const item of items) {
2304
- const record = this.layers.get(item.key);
2305
- if (!record || record.kind !== item.kind)
2306
- continue;
2307
- const point = this.options.map.latLngToContainerPoint([
2308
- this.getLatitude(item),
2309
- this.getLongitude(item),
2310
- ]);
2311
- const position = record.layer.getElement();
2312
- const bounds = position?.getBoundingClientRect();
2313
- const diameter = Math.max(bounds?.width ?? 0, bounds?.height ?? 0)
2314
- || (item.kind === 'cluster'
2315
- ? DEFAULT_CLUSTER_DIAMETER
2316
- : DEFAULT_MARKER_DIAMETER);
2317
- collisionItems.push({
2318
- key: item.key,
2319
- x: point.x,
2320
- y: point.y,
2321
- diameter,
2322
- });
2323
- }
2324
- const offsets = resolveMapMarkerCollisionOffsets(collisionItems);
2325
- for (const item of collisionItems) {
2326
- const record = this.layers.get(item.key);
2327
- if (!record)
2328
- continue;
2329
- const offset = offsets.get(item.key);
2330
- if (!offset || (Math.abs(offset.x) < 0.01 && Math.abs(offset.y) < 0.01)) {
2331
- record.element.style.removeProperty('translate');
2332
- this.syncCalloutCollisionOffset(record, 0, 0);
2333
- continue;
2334
- }
2335
- record.element.style.setProperty('translate', `${formatCollisionOffset(offset.x)}px ${formatCollisionOffset(offset.y)}px`);
2336
- this.syncCalloutCollisionOffset(record, offset.x, offset.y);
2337
- }
2338
- }
2339
- syncCalloutCollisionOffset(record, x, y) {
2340
- const tooltip = record.layer.getTooltip();
2341
- if (!tooltip)
2342
- return;
2343
- const normalizedX = formatCollisionOffset(x);
2344
- const normalizedY = formatCollisionOffset(y);
2345
- const collisionOffset = `${normalizedX}:${normalizedY}`;
2346
- if (record.calloutCollisionOffset === collisionOffset
2347
- || (record.calloutCollisionOffset === undefined
2348
- && normalizedX === 0
2349
- && normalizedY === 0))
2350
- return;
2351
- record.calloutCollisionOffset = collisionOffset;
2352
- tooltip.options.offset = this.options.leaflet.point(normalizedX, normalizedY);
2353
- tooltip.update();
2354
- }
2355
- syncCallout(record, marker, selected) {
2356
- const callout = marker.callout;
2357
- const visible = callout && (callout.visibility !== 'selected' || selected);
2358
- if (!callout || !visible) {
2359
- this.unbindCallout(record);
2360
- return;
2361
- }
2362
- const placement = callout.placement ?? 'auto';
2363
- if (record.calloutBound && record.calloutPlacement !== placement)
2364
- this.unbindCallout(record);
2365
- record.calloutContent ??= createCalloutContent(record.element.ownerDocument);
2366
- updateCalloutContent(record.calloutContent, callout);
2367
- record.calloutPlacement = placement;
2368
- if (!record.calloutBound) {
2369
- record.layer.bindTooltip(record.calloutContent, {
2370
- className: 'q-map-callout',
2371
- direction: placement,
2372
- interactive: false,
2373
- opacity: 1,
2374
- permanent: true,
2375
- });
2376
- record.calloutBound = true;
2377
- }
2378
- record.layer.setTooltipContent(record.calloutContent);
2379
- record.layer.openTooltip();
2380
- const tooltip = record.layer.getTooltip()?.getElement();
2381
- tooltip?.setAttribute('part', 'marker-callout');
2382
- tooltip?.setAttribute('aria-hidden', 'true');
2383
- }
2384
- unbindCallout(record) {
2385
- if (!record.calloutBound)
2386
- return;
2387
- record.layer.unbindTooltip();
2388
- record.calloutBound = false;
2389
- record.calloutCollisionOffset = undefined;
2390
- }
2391
- activate(key, originalEvent) {
2392
- const item = this.visibleItems.get(key);
2393
- if (!item)
2394
- return;
2395
- if (item.kind === 'marker') {
2396
- this.options.onMarkerSelect(item.marker, originalEvent);
2397
- return;
2398
- }
2399
- this.activateCluster(item, originalEvent);
2400
- }
2401
- activateCluster(item, originalEvent) {
2402
- const expansionZoom = Math.min(this.options.map.getMaxZoom(), Math.max(this.options.map.getZoom() + 1, item.expansionZoom));
2403
- const prevented = this.options.onClusterSelect({
2404
- clusterId: item.clusterId,
2405
- clusterGroup: item.clusterGroup,
2406
- markerIds: item.markerIds,
2407
- latitude: item.latitude,
2408
- longitude: item.longitude,
2409
- expansionZoom,
2410
- originalEvent,
2411
- });
2412
- if (prevented)
2413
- return;
2414
- if (originalEvent instanceof KeyboardEvent) {
2415
- const selected = this.options.getSelectedMarkerId();
2416
- const selectedKey = selected === undefined ? undefined : getMapMarkerKey(selected);
2417
- this.pendingFocusMarkerKey = selectedKey && item.markerKeys.includes(selectedKey)
2418
- ? selectedKey
2419
- : item.markerKeys[0];
2420
- }
2421
- this.options.map.setView([item.latitude, item.longitude], expansionZoom, {
2422
- animate: !this.options.prefersReducedMotion(),
2423
- });
2424
- }
2425
- captureFocusIntent() {
2426
- for (const [renderKey, record] of this.layers) {
2427
- const root = record.element.getRootNode();
2428
- if (root.activeElement !== record.element)
2429
- continue;
2430
- const selected = this.options.getSelectedMarkerId();
2431
- const selectedKey = selected === undefined ? undefined : getMapMarkerKey(selected);
2432
- return {
2433
- element: record.element,
2434
- renderKey,
2435
- markerKey: selectedKey && record.markerKeys.includes(selectedKey)
2436
- ? selectedKey
2437
- : record.markerKeys[0],
2438
- };
2439
- }
2440
- return undefined;
2441
- }
2442
- restoreFocus(markerKey) {
2443
- const marker = this.layers.get(markerKey);
2444
- if (marker?.kind === 'marker') {
2445
- marker.element.focus();
2446
- return true;
2447
- }
2448
- for (const record of this.layers.values()) {
2449
- if (record.kind === 'cluster' && record.markerKeys.includes(markerKey)) {
2450
- record.element.focus();
2451
- return true;
2452
- }
2453
- }
2454
- return false;
2455
- }
2456
- isSelected(id) {
2457
- const selectedId = this.options.getSelectedMarkerId();
2458
- return selectedId !== undefined && getMapMarkerKey(selectedId) === getMapMarkerKey(id);
2459
- }
2460
- getLatitude(item) {
2461
- return item.kind === 'marker' ? item.marker.latitude : item.latitude;
2462
- }
2463
- getLongitude(item) {
2464
- return item.kind === 'marker' ? item.marker.longitude : item.longitude;
2465
- }
2466
- remove(key) {
2467
- const record = this.layers.get(key);
2468
- if (!record)
2469
- return;
2470
- const positionElement = record.layer.getElement();
2471
- if (positionElement)
2472
- this.markerResizeObserver?.unobserve(positionElement);
2473
- record.element.removeEventListener('click', record.click);
2474
- record.element.removeEventListener('keydown', record.keydown);
2475
- this.unbindCallout(record);
2476
- record.layer.remove();
2477
- this.layers.delete(key);
2478
- }
2479
- }
2480
- function markerSizeClassName(size) {
2481
- return `size-${size}`;
2482
- }
2483
- function clusterGroupPartName(clusterGroup) {
2484
- const normalizedGroup = clusterGroup
2485
- .toLowerCase()
2486
- .replace(/[^a-z0-9_-]+/g, '-')
2487
- .replace(/-+/g, '-')
2488
- .replace(/^-|-$/g, '');
2489
- return `cluster-group-${normalizedGroup || 'default'}`;
2490
- }
2491
- function formatCollisionOffset(value) {
2492
- return Math.round(value * 100) / 100;
2493
- }
2494
-
2495
- const GEOMETRY_EPSILON = 0.01;
2496
- const SELECTED_MARKER_RING_OUTSET = 3;
2497
- const CLUSTER_RING_OUTSET = 4;
2498
- const SELECTED_CLUSTER_RING_OUTSET = 7;
2499
- /** Finds the shortest screen-space translation that fully exposes a target. */
2500
- function getMinimalVisibleTranslation(target, viewport, occlusions) {
2501
- const normalizedTarget = normalizeRect(target);
2502
- const normalizedViewport = normalizeRect(viewport);
2503
- if (!normalizedTarget || !normalizedViewport)
2504
- return undefined;
2505
- if (getWidth(normalizedTarget) > getWidth(normalizedViewport) + GEOMETRY_EPSILON
2506
- || getHeight(normalizedTarget) > getHeight(normalizedViewport) + GEOMETRY_EPSILON)
2507
- return undefined;
2508
- const clippedOcclusions = occlusions
2509
- .map(normalizeRect)
2510
- .filter((rect) => rect !== undefined)
2511
- .map(rect => intersectRects(rect, normalizedViewport))
2512
- .filter((rect) => rect !== undefined);
2513
- const xCandidates = new Set([
2514
- 0,
2515
- normalizedViewport.left - normalizedTarget.left,
2516
- normalizedViewport.right - normalizedTarget.right,
2517
- ]);
2518
- const yCandidates = new Set([
2519
- 0,
2520
- normalizedViewport.top - normalizedTarget.top,
2521
- normalizedViewport.bottom - normalizedTarget.bottom,
2522
- ]);
2523
- for (const occlusion of clippedOcclusions) {
2524
- xCandidates.add(occlusion.left - normalizedTarget.right);
2525
- xCandidates.add(occlusion.right - normalizedTarget.left);
2526
- yCandidates.add(occlusion.top - normalizedTarget.bottom);
2527
- yCandidates.add(occlusion.bottom - normalizedTarget.top);
2528
- }
2529
- let best;
2530
- let bestDistance = Number.POSITIVE_INFINITY;
2531
- for (const x of xCandidates) {
2532
- for (const y of yCandidates) {
2533
- const translated = translateRect(normalizedTarget, x, y);
2534
- if (!containsRect(normalizedViewport, translated))
2535
- continue;
2536
- if (clippedOcclusions.some(occlusion => overlapsRect(translated, occlusion)))
2537
- continue;
2538
- const distance = x * x + y * y;
2539
- if (distance + GEOMETRY_EPSILON < bestDistance) {
2540
- best = { x, y };
2541
- bestDistance = distance;
2542
- }
2543
- }
2544
- }
2545
- return best;
2546
- }
2547
- function isRectFullyVisible(target, viewport, occlusions) {
2548
- const normalizedTarget = normalizeRect(target);
2549
- const normalizedViewport = normalizeRect(viewport);
2550
- if (!normalizedTarget || !normalizedViewport)
2551
- return false;
2552
- if (!containsRect(normalizedViewport, normalizedTarget))
2553
- return false;
2554
- return !occlusions.some(occlusion => {
2555
- const normalizedOcclusion = normalizeRect(occlusion);
2556
- return normalizedOcclusion ? overlapsRect(normalizedTarget, normalizedOcclusion) : false;
2557
- });
2558
- }
2559
- /** Measures the intentional marker/cluster footprint without pulse or callout overflow. */
2560
- function getRenderedMapItemRect(element, kind) {
2561
- const elementBounds = fromDomRect(element.getBoundingClientRect());
2562
- if (kind === 'marker') {
2563
- const ringOutset = Math.max(getMarkerRingOutset(element), element.classList.contains('is-selected') ? SELECTED_MARKER_RING_OUTSET : 0);
2564
- let bounds = expandRect(elementBounds, ringOutset);
2565
- const badge = element.querySelector('.q-map-marker__badge:not([hidden])');
2566
- if (badge)
2567
- bounds = unionRects(bounds, fromDomRect(badge.getBoundingClientRect()));
2568
- return bounds;
2569
- }
2570
- return expandRect(elementBounds, element.classList.contains('contains-selection')
2571
- ? SELECTED_CLUSTER_RING_OUTSET
2572
- : CLUSTER_RING_OUTSET);
2573
- }
2574
- function normalizeRect(rect) {
2575
- const { top, right, bottom, left } = rect;
2576
- if (![top, right, bottom, left].every(Number.isFinite))
2577
- return undefined;
2578
- if (right <= left || bottom <= top)
2579
- return undefined;
2580
- return { top, right, bottom, left };
2581
- }
2582
- function getWidth(rect) {
2583
- return rect.right - rect.left;
2584
- }
2585
- function getHeight(rect) {
2586
- return rect.bottom - rect.top;
2587
- }
2588
- function fromDomRect(rect) {
2589
- return {
2590
- top: rect.top,
2591
- right: rect.right,
2592
- bottom: rect.bottom,
2593
- left: rect.left,
2594
- };
2595
- }
2596
- function getMarkerRingOutset(element) {
2597
- if (!element.classList.contains('ring-solid') && !element.classList.contains('ring-dashed'))
2598
- return 0;
2599
- const view = element.ownerDocument.defaultView;
2600
- if (!view)
2601
- return 7;
2602
- const style = view.getComputedStyle(element, '::after');
2603
- const outsets = [style.top, style.right, style.bottom, style.left]
2604
- .map(value => Number.parseFloat(value))
2605
- .filter(Number.isFinite)
2606
- .map(value => Math.max(0, -value));
2607
- return Math.max(7, ...outsets);
2608
- }
2609
- function expandRect(rect, outset) {
2610
- return {
2611
- top: rect.top - outset,
2612
- right: rect.right + outset,
2613
- bottom: rect.bottom + outset,
2614
- left: rect.left - outset,
2615
- };
2616
- }
2617
- function unionRects(first, second) {
2618
- return {
2619
- top: Math.min(first.top, second.top),
2620
- right: Math.max(first.right, second.right),
2621
- bottom: Math.max(first.bottom, second.bottom),
2622
- left: Math.min(first.left, second.left),
2623
- };
2624
- }
2625
- function translateRect(rect, x, y) {
2626
- return {
2627
- top: rect.top + y,
2628
- right: rect.right + x,
2629
- bottom: rect.bottom + y,
2630
- left: rect.left + x,
2631
- };
2632
- }
2633
- function intersectRects(first, second) {
2634
- return normalizeRect({
2635
- top: Math.max(first.top, second.top),
2636
- right: Math.min(first.right, second.right),
2637
- bottom: Math.min(first.bottom, second.bottom),
2638
- left: Math.max(first.left, second.left),
2639
- });
2640
- }
2641
- function containsRect(container, target) {
2642
- return target.left >= container.left - GEOMETRY_EPSILON
2643
- && target.top >= container.top - GEOMETRY_EPSILON
2644
- && target.right <= container.right + GEOMETRY_EPSILON
2645
- && target.bottom <= container.bottom + GEOMETRY_EPSILON;
2646
- }
2647
- function overlapsRect(first, second) {
2648
- return first.left < second.right - GEOMETRY_EPSILON
2649
- && first.right > second.left + GEOMETRY_EPSILON
2650
- && first.top < second.bottom - GEOMETRY_EPSILON
2651
- && first.bottom > second.top + GEOMETRY_EPSILON;
2652
- }
2653
-
2654
- const DEFAULT_TILE_PRELOAD_BUFFER = 0;
2655
- const MAX_TILE_PRELOAD_BUFFER = 4;
2656
- /** Normalizes the number of offscreen raster-tile rows and columns to preload. */
2657
- function normalizeTilePreloadBuffer(value) {
2658
- if (!Number.isFinite(value))
2659
- return DEFAULT_TILE_PRELOAD_BUFFER;
2660
- return Math.min(MAX_TILE_PRELOAD_BUFFER, Math.max(0, Math.round(value)));
2661
- }
2662
-
2663
- const TILE_LAYER_READY_TIMEOUT_MS = 10_000;
2664
- /** Waits for enough of a replacement raster layer to be safely presented. */
2665
- function waitForInitialTileLayerReady(layer, options = {}) {
2666
- const { loadingPolicy = 'full-batch', signal, startLoading, timeoutMs = TILE_LAYER_READY_TIMEOUT_MS, } = options;
2667
- return new Promise((resolve, reject) => {
2668
- if (signal?.aborted) {
2669
- reject(createAbortError());
2670
- return;
2671
- }
2672
- let timeout;
2673
- let settled = false;
2674
- const cleanup = () => {
2675
- layer.off('load', handleLoad);
2676
- layer.off('tileload', handleTileLoad);
2677
- layer.off('tileerror', handleTileError);
2678
- signal?.removeEventListener('abort', handleAbort);
2679
- if (timeout !== undefined)
2680
- clearTimeout(timeout);
2681
- };
2682
- const settle = (error) => {
2683
- if (settled)
2684
- return;
2685
- settled = true;
2686
- cleanup();
2687
- if (error)
2688
- reject(error);
2689
- else
2690
- resolve();
2691
- };
2692
- const handleLoad = () => loadingPolicy === 'full-batch'
2693
- ? settle()
2694
- : settle(new Error('Raster tiles failed to load.'));
2695
- const handleTileLoad = () => {
2696
- if (loadingPolicy === 'progressive')
2697
- settle();
2698
- };
2699
- const handleTileError = () => {
2700
- if (loadingPolicy === 'full-batch') {
2701
- settle(new Error('Raster tiles failed to load.'));
2702
- }
2703
- };
2704
- const handleAbort = () => settle(createAbortError());
2705
- layer.on('load', handleLoad);
2706
- layer.on('tileload', handleTileLoad);
2707
- layer.on('tileerror', handleTileError);
2708
- signal?.addEventListener('abort', handleAbort, { once: true });
2709
- timeout = setTimeout(() => settle(new Error('Raster tile loading timed out.')), Math.max(0, timeoutMs));
2710
- if (startLoading) {
2711
- try {
2712
- startLoading();
2713
- if (!layer.isLoading())
2714
- settle();
2715
- }
2716
- catch (error) {
2717
- settle(toError(error));
2718
- }
2719
- }
2720
- });
2721
- }
2722
- function createAbortError() {
2723
- const error = new Error('Raster tile loading was cancelled.');
2724
- error.name = 'AbortError';
2725
- return error;
2726
- }
2727
- function toError(error) {
2728
- return error instanceof Error ? error : new Error(String(error));
2729
- }
2730
-
2731
- const DEFAULT_VECTOR_PADDING = 0.2;
2732
- const MAX_VECTOR_PADDING = 0.5;
2733
- /** Normalizes the relative MapLibre viewport padding used for off-screen tile loading. */
2734
- function normalizeVectorPadding(value) {
2735
- if (!Number.isFinite(value))
2736
- return DEFAULT_VECTOR_PADDING;
2737
- return Math.max(0, Math.min(MAX_VECTOR_PADDING, value));
2738
- }
2739
-
2740
- const mapCss = () => `:host{display:block;width:100%;height:var(--q-map-height, 100%);min-width:0;min-height:var(--q-map-min-height, 240px);box-sizing:border-box}.map-surface{position:relative;width:100%;height:100%;min-height:inherit;box-sizing:border-box;overflow:hidden;background:var(--q-map-bg, var(--q-bg-surface-1, #1f2937));border:var(--q-map-border, var(--q-border, 1px solid var(--q-border-color, #374151)));border-radius:var(--q-map-radius, var(--q-radius-lg, 11px))}.map-canvas{width:100%;height:100%;min-height:inherit;background:inherit;outline:none}.map-canvas:focus-visible{box-shadow:inset 0 0 0 2px var(--q-color-primary, #60a5fa)}.map-icon-registration{display:none}.map-empty{position:absolute;z-index:900;top:50%;left:50%;max-width:calc(100% - 32px);padding:8px 12px;transform:translate(-50%, -50%);border:var(--q-border, 1px solid var(--q-border-color, #374151));border-radius:var(--q-radius-md, 8px);background:var(--q-bg-base, #111827);color:var(--q-fg-muted, #9ca3af);box-shadow:var(--q-shadow-low, 0 2px 4px rgba(0, 0, 0, 0.2));font-family:var(--q-font-family, inherit);font-size:var(--q-font-size-sm, 0.8rem);line-height:1.4;text-align:center;pointer-events:none}.map-error{color:var(--q-color-danger, #ef4444)}.map-attribution{position:absolute;z-index:1000;right:0;bottom:0;max-width:calc(100% - 8px);padding:2px 6px;overflow:hidden;background:var(--q-map-attribution-bg, var(--q-bg-base, #111827));color:var(--q-map-attribution-color, var(--q-fg-muted, #9ca3af));font-family:var(--q-font-family, inherit);font-size:var(--q-font-size-xs, 0.7rem);line-height:1.4;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}a.map-attribution:hover,a.map-attribution:focus-visible{color:var(--q-fg-base, #f9fafb);text-decoration:underline}a.map-attribution:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:-2px}.visually-hidden{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-tooltip-pane{position:absolute;top:0;left:0}.leaflet-container{overflow:hidden;-webkit-tap-highlight-color:transparent;touch-action:none}.maplibregl-map{position:relative;overflow:hidden;-webkit-tap-highlight-color:transparent}.maplibregl-canvas{position:absolute;top:0;left:0}.maplibregl-control-container{display:none}.leaflet-zoom-animated{transform-origin:0 0}.leaflet-tile-container.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{transition:transform 250ms cubic-bezier(0, 0, 0.25, 1);will-change:transform}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{display:block;user-select:none;-webkit-user-drag:none}.leaflet-container .leaflet-tile-pane img,.leaflet-container .leaflet-tile{width:auto;max-width:none !important;max-height:none !important;padding:0}.leaflet-tile-pane{filter:var(--q-map-tile-filter, none)}.leaflet-tile{visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{position:relative;z-index:800;float:left;clear:both;pointer-events:auto}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive{pointer-events:auto}.leaflet-grab{cursor:grab}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-marker-draggable{cursor:grabbing}.leaflet-interactive{cursor:pointer}.leaflet-bar{overflow:hidden;border:var(--q-border, 1px solid var(--q-border-color, #374151));border-radius:var(--q-radius-md, 8px);background:var(--q-bg-base, #111827);box-shadow:var(--q-shadow-low, 0 2px 4px rgba(0, 0, 0, 0.2))}.leaflet-bar a{display:block;width:30px;height:30px;border-bottom:1px solid var(--q-border-color, #374151);background:var(--q-bg-base, #111827);color:var(--q-fg-base, #f9fafb);font:700 18px/30px var(--q-font-family, sans-serif);text-align:center;text-decoration:none}.leaflet-bar a:last-child{border-bottom:0}.leaflet-bar a:hover,.leaflet-bar a:focus-visible{background:var(--q-bg-surface-2, #374151);color:var(--q-color-primary, #60a5fa)}.leaflet-bar a:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:-2px}.leaflet-bar a.leaflet-disabled{color:var(--q-fg-disabled, #6b7280);cursor:default}.q-map-marker-position{--q-map-marker-rendered-size:var(--q-map-marker-size, 20px);width:var(--q-map-marker-rendered-size) !important;height:var(--q-map-marker-rendered-size) !important;margin-top:calc(var(--q-map-marker-rendered-size) * -0.5) !important;margin-left:calc(var(--q-map-marker-rendered-size) * -0.5) !important}.q-map-marker-position.size-small{--q-map-marker-rendered-size:var(--q-map-marker-size-small, 16px)}.q-map-marker-position.size-medium{--q-map-marker-rendered-size:var(--q-map-marker-size-medium, var(--q-map-marker-size, 20px))}.q-map-marker-position.size-large{--q-map-marker-rendered-size:var(--q-map-marker-size-large, 24px)}.q-map-marker{position:relative;display:grid;width:100%;height:100%;place-items:center;box-sizing:border-box;border:3px solid var(--q-bg-base, #111827);border-radius:50%;background:var(--q-map-marker-color, var(--q-color-primary, #60a5fa));box-shadow:var(--q-shadow-low, 0 2px 4px rgba(0, 0, 0, 0.3));outline:none;transition:box-shadow 160ms ease}.q-map-marker.variant-success{background:var(--q-map-marker-success, var(--q-color-success, #22c55e))}.q-map-marker.variant-warning{background:var(--q-map-marker-warning, var(--q-color-warning, #f59e0b))}.q-map-marker.variant-danger{background:var(--q-map-marker-danger, var(--q-color-danger, #ef4444))}.q-map-marker.variant-muted{background:var(--q-map-marker-muted, var(--q-fg-muted, #9ca3af))}.q-map-marker.is-selected{box-shadow:0 0 0 3px var(--q-map-marker-selected-color, var(--q-fg-base, #f9fafb)), var( --q-map-marker-selected-shadow, var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3)) )}.q-map-marker:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:4px}.q-map-marker__center{display:grid;width:30%;height:30%;place-items:center;overflow:hidden;border-radius:50%;background:var(--q-bg-base, #111827);pointer-events:none}.q-map-marker.has-content{padding:var(--q-map-marker-content-gap, 2px)}.q-map-marker.has-content .q-map-marker__center{width:100%;height:100%;background:var(--q-map-marker-content-bg, var(--q-bg-base, #111827));color:var(--q-map-marker-content-color, var(--q-fg-base, #f9fafb));font:700 clamp(0.5rem, calc(var(--q-map-marker-rendered-size, var(--q-map-marker-size, 20px)) * 0.25), 0.75rem) / 1 var(--q-font-family, sans-serif)}.q-map-marker__fallback,.q-map-marker__image{grid-area:1 / 1}.q-map-marker__fallback{max-width:100%;overflow:hidden;text-overflow:clip;white-space:nowrap}.q-map-marker__image{display:block;width:100%;height:100%;border-radius:inherit;object-fit:cover}.q-map-marker__image[hidden]{display:none}.q-map-marker__content{position:relative;z-index:1;display:grid;width:100%;height:100%;place-items:center;pointer-events:none}.q-map-marker.kind-icon{border-radius:var(--q-radius-md, 8px)}.q-map-marker.kind-icon .q-map-marker__center{border-radius:calc(var(--q-radius-md, 8px) - 3px)}.q-map-marker__icon{width:var(--q-map-marker-icon-size, 58%) !important;height:var(--q-map-marker-icon-size, 58%) !important;transform:translate( var(--q-map-marker-icon-offset-x, 0), var(--q-map-marker-icon-offset-y, 0) );color:var(--q-map-marker-content-color, var(--q-fg-base, #f9fafb));pointer-events:none}.q-map-marker__icon[hidden]{display:none}.q-map-marker-position.is-image{width:var(--q-map-image-width) !important;height:var(--q-map-image-height) !important;margin-left:calc(var(--q-map-image-anchor-x) * -1) !important;margin-top:calc(var(--q-map-image-anchor-y) * -1) !important}.q-map-marker.kind-image{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.q-map-marker.kind-image.is-selected{filter:drop-shadow(0 0 3px var(--q-map-marker-selected-color, var(--q-fg-base, #f9fafb)))}.q-map-marker.kind-image .q-map-marker__center{width:100%;height:100%;overflow:visible;border-radius:0;background:transparent}.q-map-marker.kind-image .q-map-marker__image{object-fit:contain}.q-map-marker.ring-solid::after,.q-map-marker.ring-dashed::after{position:absolute;z-index:0;inset:-7px;box-sizing:border-box;border:2px solid var(--q-map-marker-ring-color, currentColor);border-radius:inherit;content:'';pointer-events:none}.q-map-marker.ring-dashed::after{border-style:dashed}.q-map-marker.is-pulsing::before{position:absolute;z-index:0;inset:-4px;border:2px solid var(--q-map-marker-pulse-color, var(--q-color-primary, #60a5fa));border-radius:inherit;content:'';pointer-events:none;animation:q-map-marker-pulse 1.8s ease-out infinite}@keyframes q-map-marker-pulse{0%{opacity:0.85;transform:scale(0.9)}75%,100%{opacity:0;transform:scale(1.8)}}.q-map-marker__badge{position:absolute;z-index:3;right:-7px;bottom:-6px;display:inline-flex;min-width:14px;height:14px;padding:0 3px;align-items:center;justify-content:center;gap:2px;box-sizing:border-box;border:2px solid var(--q-bg-base, #111827);border-radius:999px;background:var(--q-map-marker-color, var(--q-color-primary, #60a5fa));color:var(--q-fg-base, #f9fafb);font:700 8px/1 var(--q-font-family, sans-serif);white-space:nowrap}.q-map-marker__badge[hidden]{display:none}.q-map-marker__badge.variant-success{background:var(--q-map-marker-success, var(--q-color-success, #22c55e))}.q-map-marker__badge.variant-warning{background:var(--q-map-marker-warning, var(--q-color-warning, #f59e0b))}.q-map-marker__badge.variant-danger{background:var(--q-map-marker-danger, var(--q-color-danger, #ef4444))}.q-map-marker__badge.variant-muted{background:var(--q-map-marker-muted, var(--q-fg-muted, #9ca3af))}.q-map-marker__badge-icon{width:8px !important;height:8px !important}.q-map-marker__badge-icon[hidden],.q-map-marker__badge-text[hidden]{display:none}.q-map-cluster-position{width:var(--q-map-marker-cluster-size, 32px) !important;height:var(--q-map-marker-cluster-size, 32px) !important;margin-top:calc(var(--q-map-marker-cluster-size, 32px) * -0.5) !important;margin-left:calc(var(--q-map-marker-cluster-size, 32px) * -0.5) !important}.q-map-cluster{position:relative;display:grid;width:100%;height:100%;place-items:center;box-sizing:border-box;border:2px solid color-mix(in srgb, var(--q-color-primary, #60a5fa) 70%, white);border-radius:50%;background:color-mix(in srgb, var(--q-color-primary, #60a5fa) 24%, var(--q-bg-base, #111827));box-shadow:0 0 0 4px color-mix(in srgb, var(--q-color-primary, #60a5fa) 18%, transparent), var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3));color:var(--q-fg-base, #f9fafb);outline:none;transition:box-shadow 160ms ease}.q-map-cluster.contains-selection{box-shadow:0 0 0 3px var(--q-map-marker-selected-color, var(--q-fg-base, #f9fafb)), 0 0 0 7px color-mix(in srgb, var(--q-color-primary, #60a5fa) 28%, transparent), var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3))}.q-map-cluster:focus-visible{outline:var(--q-focus-ring, 2px solid var(--q-color-primary, #60a5fa));outline-offset:4px}.q-map-cluster__content{display:grid;width:100%;height:100%;place-items:center;pointer-events:none}.q-map-cluster__count{font:700 0.7rem/1 var(--q-font-family, sans-serif)}.leaflet-tooltip{position:absolute;box-sizing:border-box;white-space:nowrap;pointer-events:none;user-select:none}.q-map-callout{width:var(--q-map-marker-callout-width, var(--q-map-marker-callout-max-width, 220px));max-width:calc(100vw - 24px);padding:7px 9px;border:var(--q-border, 1px solid var(--q-border-color, #374151));border-radius:var(--q-radius-md, 8px);background:var(--q-map-marker-callout-bg, color-mix(in srgb, var(--q-bg-base, #111827) 94%, transparent));color:var(--q-fg-base, #f9fafb);box-shadow:var(--q-shadow-medium, 0 8px 16px rgba(0, 0, 0, 0.3));font-family:var(--q-font-family, sans-serif)}.q-map-callout.leaflet-tooltip-top{margin-top:-20px}.q-map-callout.leaflet-tooltip-bottom{margin-top:20px}.q-map-callout.leaflet-tooltip-left{margin-left:-20px}.q-map-callout.leaflet-tooltip-right{margin-left:20px}.q-map-callout__content{display:grid;min-width:0;gap:2px}.q-map-callout__heading{display:flex;min-width:0;align-items:center;gap:6px}.q-map-callout__title,.q-map-callout__subtitle,.q-map-callout__meta{overflow:hidden;text-overflow:ellipsis}.q-map-callout__title{flex:1 1 auto;min-width:0;color:inherit;font-size:var(--q-font-size-sm, 0.8rem);font-weight:700}.q-map-callout__subtitle,.q-map-callout__meta{color:var(--q-fg-muted, #9ca3af);font-size:var(--q-font-size-xs, 0.7rem)}.q-map-callout__subtitle{min-width:0}.q-map-callout__status{--q-map-marker-callout-status-accent:var(--q-color-primary, #60a5fa);display:inline-flex;flex:none;max-width:var(--q-map-marker-callout-status-max-width, 45%);margin-inline-start:auto;min-height:18px;padding:2px 6px;align-items:center;overflow:hidden;box-sizing:border-box;border:1px solid color-mix(in srgb, var(--q-map-marker-callout-status-accent) 34%, transparent);border-radius:999px;background:color-mix(in srgb, var(--q-map-marker-callout-status-accent) 16%, transparent);color:var(--q-map-marker-callout-status-accent);font-size:var(--q-font-size-xs, 0.7rem);font-weight:600;line-height:1;text-overflow:ellipsis;white-space:nowrap}.q-map-callout__status.variant-success{--q-map-marker-callout-status-accent:var(--q-color-success, #34d399)}.q-map-callout__status.variant-warning{--q-map-marker-callout-status-accent:var(--q-color-warning, #fbbf24)}.q-map-callout__status.variant-danger{--q-map-marker-callout-status-accent:var(--q-color-danger, #f87171)}.q-map-callout__status.variant-muted{--q-map-marker-callout-status-accent:var(--q-fg-muted, #9ca3af)}.q-map-callout__meta{color:var(--q-map-marker-callout-meta-color, var(--q-color-primary, #60a5fa))}.q-map-callout__stats{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:6px 8px;margin:4px 0 0;padding:5px 0 0;border-top:1px solid color-mix(in srgb, var(--q-border-color, #374151) 70%, transparent)}.q-map-callout__stat{min-width:0}.q-map-callout__stat.layout-wide{grid-column:1 / -1}.q-map-callout__stat-label,.q-map-callout__stat-value{margin:0;overflow:hidden;text-overflow:ellipsis}.q-map-callout__stat-label{color:var(--q-fg-muted, #9ca3af);font-size:var(--q-font-size-2xs, 0.625rem);line-height:1.2;white-space:nowrap}.q-map-callout__stat-value{margin-top:1px;color:inherit;font-size:var(--q-font-size-xs, 0.7rem);font-weight:600;line-height:1.25;white-space:nowrap}.q-map-callout__stat.layout-wide .q-map-callout__stat-value{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;white-space:normal}.q-map-callout__subtitle[hidden],.q-map-callout__status[hidden],.q-map-callout__meta[hidden],.q-map-callout__stats[hidden]{display:none}@media (prefers-reduced-motion: reduce){.q-map-marker,.q-map-cluster{transition:none}.q-map-marker.is-pulsing::before{opacity:0.65;animation:none;transform:none}}`;
2741
-
2742
- const GOOGLE_MAP_TYPES = ['roadmap', 'satellite', 'terrain', 'hybrid'];
2743
- const SMOOTH_ZOOM_DELTA = 0.5;
2744
- const SMOOTH_ZOOM_SNAP = 0.25;
2745
- const SMOOTH_WHEEL_DEBOUNCE_MS = 16;
2746
- const SMOOTH_WHEEL_PIXELS_PER_LEVEL = 120;
2747
- const VECTOR_SYMBOL_FADE_DURATION_MS = 750;
2748
- const MARKER_VISIBILITY_ATTEMPTS = 3;
2749
- const MARKER_VISIBILITY_MIN_ANIMATION_MS = 275;
2750
- const MARKER_VISIBILITY_SETTLE_TIMEOUT_MS = 500;
2751
- const QMap = class {
2752
- constructor(hostRef) {
2753
- registerInstance(this, hostRef);
2754
- this.qReady = createEvent(this, "qReady");
2755
- this.qMapClick = createEvent(this, "qMapClick");
2756
- this.qMarkerSelect = createEvent(this, "qMarkerSelect");
2757
- this.qClusterSelect = createEvent(this, "qClusterSelect");
2758
- this.qStatusChange = createEvent(this, "qStatusChange");
2759
- this.qError = createEvent(this, "qError");
2760
- }
2761
- get el() { return getElement(this); }
2762
- /** Rendered for raster tiles and styled vectors. */
2763
- attribution = '';
2764
- /** Links attribution only for HTTP(S) URLs. */
2765
- attributionUrl = '';
2766
- /** Accepts an array or JSON and reconciles markers using type-stable IDs. */
2767
- markers = [];
2768
- /** Preserves stable source IDs while grouping nearby markers. */
2769
- clusterMarkers = false;
2770
- /** Screen-pixel radius clamped from 1 to 200. */
2771
- clusterRadius = 48;
2772
- clusterMinPoints = 2;
2773
- /** Defaults to one below `maxZoom`. */
2774
- clusterMaxZoom;
2775
- /** Finite values are clamped to the geographic range. */
2776
- centerLatitude = 0;
2777
- /** Finite values are clamped to the geographic range. */
2778
- centerLongitude = 0;
2779
- /** Clamped between the normalized zoom limits. */
2780
- zoom = 2;
2781
- zoomControls = true;
2782
- /** Enables mouse-wheel zoom without changing touch, keyboard, or button controls. */
2783
- scrollWheelZoom = true;
2784
- /** Non-finite values normalize to zero. */
2785
- minZoom = 0;
2786
- /** Never resolves below `minZoom`. */
2787
- maxZoom = 19;
2788
- /** Accepts an object or JSON; malformed updates preserve the last valid bounds. */
2789
- maxBounds;
2790
- /** Clamped from zero to one. */
2791
- maxBoundsViscosity = 1;
2792
- /** Controls the selected visual and `aria-pressed` state. */
2793
- selectedMarkerId;
2794
- /** Non-tile provider failures may fall back to `tileUrl`. */
2795
- provider = 'tiles';
2796
- /** Tile template used by the tiles provider and optional provider fallback. */
2797
- tileUrl = '';
2798
- /** Preloads zero to four raster-tile rows and columns beyond the viewport. */
2799
- tilePreloadBuffer = DEFAULT_TILE_PRELOAD_BUFFER;
2800
- /** Selects full-batch or progressive raster replacement and zoom loading. */
2801
- rasterTileLoadingPolicy = 'full-batch';
2802
- /** MapLibre Style Specification URL for the vector provider. */
2803
- vectorStyleUrl = '';
2804
- /** Extends rendering beyond the viewport; clamped from zero to one-half. */
2805
- vectorPadding = DEFAULT_VECTOR_PADDING;
2806
- /** Browser-restricted key used only when WebQuark loads Google Maps. */
2807
- googleApiKey = '';
2808
- /** Unsupported values normalize to `roadmap`. */
2809
- googleMapType = 'roadmap';
2810
- /** Accessible name for the interactive map region. */
2811
- ariaLabel = 'Interactive map';
2812
- /** Emitted after Leaflet setup and the initial provider attempt complete. */
2813
- qReady;
2814
- /** Excludes drags and interactive-layer clicks. */
2815
- qMapClick;
2816
- /** Does not mutate `selectedMarkerId`. */
2817
- qMarkerSelect;
2818
- /** Emitted before the default center-and-zoom action; cancel to prevent it. */
2819
- qClusterSelect;
2820
- /** Includes the active fallback provider. */
2821
- qStatusChange;
2822
- /** Reports serializable configuration and initialization failures. */
2823
- qError;
2824
- providerStatus = 'initializing';
2825
- activeProvider;
2826
- usingFallback = false;
2827
- errorMessage;
2828
- leaflet;
2829
- map;
2830
- canvas;
2831
- resizeObserver;
2832
- initializationToken = 0;
2833
- markerVisibilityToken = 0;
2834
- cancelMarkerVisibilityPan;
2835
- layerController;
2836
- markerController;
2837
- lastInvalidBoundsInput;
2838
- reportedRequestedProvider;
2839
- baseLayerSyncQueued = false;
2840
- hasLoaded = false;
2841
- connected = false;
2842
- connectedCallback() {
2843
- this.connected = true;
2844
- if (this.hasLoaded)
2845
- void this.initializeMap();
2846
- }
2847
- componentDidLoad() {
2848
- this.hasLoaded = true;
2849
- void this.initializeMap();
2850
- }
2851
- disconnectedCallback() {
2852
- this.connected = false;
2853
- this.initializationToken += 1;
2854
- this.destroyMap();
2855
- }
2856
- /** Fits the latest valid marker coordinates without changing the configured center or zoom props. */
2857
- async fitMarkers(options = {}) {
2858
- const map = this.map;
2859
- const markers = getMapMarkers(this.markers);
2860
- if (!map || !this.connected || markers.length === 0)
2861
- return false;
2862
- map.invalidateSize({ animate: false, pan: false });
2863
- const size = map.getSize();
2864
- if (size.x <= 0 || size.y <= 0)
2865
- return false;
2866
- const { minimum, maximum } = this.getZoomLimits();
2867
- const maxZoom = Number.isFinite(options.maxZoom)
2868
- ? Math.max(minimum, Math.min(maximum, options.maxZoom))
2869
- : maximum;
2870
- const requestedPadding = Number.isFinite(options.padding) ? Math.max(0, options.padding) : 0;
2871
- const padding = Math.min(requestedPadding, Math.max(0, (Math.min(size.x, size.y) - 1) / 2));
2872
- this.markerVisibilityToken += 1;
2873
- this.cancelMarkerVisibilityPan?.();
2874
- this.markerController?.sync(this.markers);
2875
- map.fitBounds(markers.map(marker => [marker.latitude, marker.longitude]), {
2876
- animate: false,
2877
- padding: [padding, padding],
2878
- maxZoom,
2879
- });
2880
- return true;
2881
- }
2882
- /** Minimally pans to fully expose a marker or its current cluster without changing zoom. */
2883
- async ensureMarkerVisible(markerId, occlusions) {
2884
- const operationToken = ++this.markerVisibilityToken;
2885
- this.cancelMarkerVisibilityPan?.();
2886
- if (!this.isMarkerVisibilityCurrent(operationToken))
2887
- return 'unavailable';
2888
- let panned = false;
2889
- for (let attempt = 0; attempt < MARKER_VISIBILITY_ATTEMPTS; attempt += 1) {
2890
- if (!this.isMarkerVisibilityCurrent(operationToken))
2891
- return 'unavailable';
2892
- const map = this.map;
2893
- const canvas = this.canvas;
2894
- const controller = this.markerController;
2895
- if (!map || !canvas || !controller)
2896
- return 'unavailable';
2897
- const target = controller.getVisibilityTarget(markerId);
2898
- if (!target)
2899
- return 'unavailable';
2900
- const viewport = this.toViewportRect(canvas.getBoundingClientRect());
2901
- const obstacles = this.getMarkerVisibilityOcclusions(occlusions);
2902
- const targetRect = target.rendered
2903
- ? getRenderedMapItemRect(target.rendered.element, target.rendered.kind)
2904
- : this.getCoordinateRect(target.latitude, target.longitude, viewport);
2905
- if (target.rendered && isRectFullyVisible(targetRect, viewport, obstacles)) {
2906
- return panned ? 'panned' : 'visible';
2907
- }
2908
- const translation = getMinimalVisibleTranslation(targetRect, viewport, obstacles);
2909
- if (!translation)
2910
- return 'constrained';
2911
- if (Math.abs(translation.x) < 0.01 && Math.abs(translation.y) < 0.01) {
2912
- controller.syncSelection();
2913
- if (!this.isMarkerVisibilityCurrent(operationToken))
2914
- return 'unavailable';
2915
- await this.waitForMarkerLayout();
2916
- if (!this.isMarkerVisibilityCurrent(operationToken))
2917
- return 'unavailable';
2918
- continue;
2919
- }
2920
- if (!this.isMarkerVisibilityCurrent(operationToken))
2921
- return 'unavailable';
2922
- await this.panByMarkerTranslation(map, translation.x, translation.y, operationToken);
2923
- if (!this.isMarkerVisibilityCurrent(operationToken))
2924
- return 'unavailable';
2925
- panned = true;
2926
- if (!this.isMarkerVisibilityCurrent(operationToken))
2927
- return 'unavailable';
2928
- await this.waitForMarkerLayout();
2929
- if (!this.isMarkerVisibilityCurrent(operationToken))
2930
- return 'unavailable';
2931
- }
2932
- if (!this.isMarkerVisibilityCurrent(operationToken))
2933
- return 'unavailable';
2934
- const map = this.map;
2935
- const canvas = this.canvas;
2936
- const target = this.markerController?.getVisibilityTarget(markerId);
2937
- if (!map || !canvas || !target)
2938
- return 'unavailable';
2939
- if (!target.rendered)
2940
- return 'constrained';
2941
- const viewport = this.toViewportRect(canvas.getBoundingClientRect());
2942
- const targetRect = getRenderedMapItemRect(target.rendered.element, target.rendered.kind);
2943
- return isRectFullyVisible(targetRect, viewport, this.getMarkerVisibilityOcclusions(occlusions)) ? (panned ? 'panned' : 'visible') : 'constrained';
2944
- }
2945
- handleBaseLayerChange() {
2946
- this.scheduleBaseLayerSync();
2947
- }
2948
- handleTilePreloadBufferChange() {
2949
- const requestedProvider = this.getProvider();
2950
- const activeProvider = this.layerController?.getActiveState().activeProvider;
2951
- if (isTilePreloadBufferRelevant(requestedProvider, activeProvider)) {
2952
- this.scheduleBaseLayerSync();
2953
- }
2954
- }
2955
- handleVectorPaddingChange() {
2956
- const requestedProvider = this.getProvider();
2957
- const activeProvider = this.layerController?.getActiveState().activeProvider;
2958
- if (isVectorPaddingRelevant(requestedProvider, activeProvider)) {
2959
- this.scheduleBaseLayerSync();
2960
- }
2961
- }
2962
- scheduleBaseLayerSync() {
2963
- if (!this.map) {
2964
- void this.initializeMap();
2965
- return;
2966
- }
2967
- if (this.baseLayerSyncQueued)
2968
- return;
2969
- this.baseLayerSyncQueued = true;
2970
- queueMicrotask(() => {
2971
- this.baseLayerSyncQueued = false;
2972
- if (this.connected && this.map)
2973
- void this.syncBaseLayer();
2974
- });
2975
- }
2976
- handleMarkersChange() {
2977
- this.markerController?.sync(this.markers);
2978
- }
2979
- handleMarkerClusteringChange() {
2980
- this.markerController?.sync(this.markers);
2981
- }
2982
- handleSelectedMarkerChange() {
2983
- this.markerController?.syncSelection();
2984
- }
2985
- handleViewChange() {
2986
- this.syncView(true);
2987
- }
2988
- handleZoomLimitsChange() {
2989
- if (!this.map)
2990
- return;
2991
- const { minimum, maximum } = this.getZoomLimits();
2992
- this.map.setMinZoom(minimum);
2993
- this.map.setMaxZoom(maximum);
2994
- this.syncView();
2995
- void this.syncBaseLayer();
2996
- this.markerController?.sync(this.markers);
2997
- }
2998
- handleBoundsChange() {
2999
- this.syncBounds(true);
3000
- }
3001
- handleScrollWheelZoomChange() {
3002
- if (this.scrollWheelZoom)
3003
- this.map?.scrollWheelZoom.enable();
3004
- else
3005
- this.map?.scrollWheelZoom.disable();
3006
- }
3007
- handleZoomControlsChange() {
3008
- if (!this.map)
3009
- return;
3010
- this.destroyMap();
3011
- void this.initializeMap();
3012
- }
3013
- setCanvas = (element) => {
3014
- this.canvas = element ?? undefined;
3015
- };
3016
- handleMapClick = (event) => {
3017
- this.qMapClick.emit({
3018
- latitude: event.latlng.lat,
3019
- longitude: event.latlng.lng,
3020
- originalEvent: event.originalEvent,
3021
- });
3022
- };
3023
- async initializeMap() {
3024
- if (this.map || !this.canvas || !this.connected || typeof window === 'undefined')
3025
- return;
3026
- const token = ++this.initializationToken;
3027
- this.setProviderStatus('initializing', undefined, false, true);
3028
- try {
3029
- const leaflet = this.leaflet ?? (await import('./leaflet-src-DYMWBqU1.js').then(function (n) { return n.L; }));
3030
- this.leaflet = leaflet;
3031
- if (token !== this.initializationToken || !this.canvas || !this.connected || !this.el.isConnected)
3032
- return;
3033
- const { minimum, maximum } = this.getZoomLimits();
3034
- const boundsResolution = resolveMapBounds(this.maxBounds);
3035
- const smoothMotion = !this.prefersReducedMotion();
3036
- this.map = leaflet.map(this.canvas, {
3037
- attributionControl: false,
3038
- fadeAnimation: smoothMotion,
3039
- inertia: false,
3040
- keyboard: true,
3041
- markerZoomAnimation: smoothMotion,
3042
- maxBounds: getInitialLeafletMapBounds(boundsResolution),
3043
- maxBoundsViscosity: getMapBoundsViscosity(this.maxBoundsViscosity),
3044
- maxZoom: maximum,
3045
- minZoom: minimum,
3046
- trackResize: false,
3047
- wheelDebounceTime: smoothMotion ? SMOOTH_WHEEL_DEBOUNCE_MS : 40,
3048
- wheelPxPerZoomLevel: smoothMotion ? SMOOTH_WHEEL_PIXELS_PER_LEVEL : 60,
3049
- zoomAnimation: smoothMotion,
3050
- zoomControl: this.zoomControls,
3051
- scrollWheelZoom: this.scrollWheelZoom,
3052
- zoomDelta: smoothMotion ? SMOOTH_ZOOM_DELTA : 1,
3053
- zoomSnap: smoothMotion ? SMOOTH_ZOOM_SNAP : 1,
3054
- });
3055
- if (boundsResolution.kind === 'invalid')
3056
- this.reportInvalidBounds(boundsResolution.message);
3057
- else
3058
- this.lastInvalidBoundsInput = undefined;
3059
- this.bindMapEvents(this.map);
3060
- this.createControllers(this.map, leaflet);
3061
- this.syncView();
3062
- await this.syncBaseLayer();
3063
- if (token !== this.initializationToken || !this.map || !this.connected)
3064
- return;
3065
- this.markerController?.sync(this.markers);
3066
- this.observeResize();
3067
- this.map.invalidateSize({ animate: false, pan: true });
3068
- this.qReady.emit();
3069
- }
3070
- catch (error) {
3071
- if (token !== this.initializationToken)
3072
- return;
3073
- this.destroyMap();
3074
- this.errorMessage = 'Map failed to initialize.';
3075
- this.setProviderStatus('error', undefined, false);
3076
- this.reportError('leaflet-initialization-failed', error, false);
3077
- }
3078
- }
3079
- bindMapEvents(map) {
3080
- map.on('click', this.handleMapClick);
3081
- }
3082
- unbindMapEvents(map) {
3083
- map.off('click', this.handleMapClick);
3084
- }
3085
- createControllers(map, leaflet) {
3086
- this.layerController = new MapBaseLayerController({
3087
- attach: async (layer, provider, context) => {
3088
- if (provider === 'tiles') {
3089
- const tileLayer = layer;
3090
- if (context.replacing) {
3091
- await waitForInitialTileLayerReady(tileLayer, {
3092
- loadingPolicy: this.getRasterTileLoadingPolicy(),
3093
- signal: context.signal,
3094
- startLoading: () => layer.addTo(map),
3095
- });
3096
- }
3097
- else {
3098
- layer.addTo(map);
3099
- }
3100
- }
3101
- else {
3102
- layer.addTo(map);
3103
- }
3104
- if (provider === 'vector')
3105
- await waitForMapLibreLayerReady(layer);
3106
- },
3107
- createGoogle: async (config) => {
3108
- await loadGoogleMapsApi(config.googleApiKey);
3109
- const GoogleMutant = await loadGoogleMutantConstructor(leaflet);
3110
- return new GoogleMutant({
3111
- type: config.googleMapType,
3112
- minZoom: config.minZoom,
3113
- maxZoom: config.maxZoom,
3114
- });
3115
- },
3116
- createTiles: config => {
3117
- const loadingPolicy = this.getRasterTileLoadingPolicy();
3118
- return createBufferedTileLayer(leaflet, config.tileUrl, createRasterTileLayerOptions(config.minZoom, config.maxZoom, config.tilePreloadBuffer, loadingPolicy), config.tilePreloadBuffer, loadingPolicy);
3119
- },
3120
- createVector: async (config) => {
3121
- const createMapLibreLayer = await loadMapLibreLayerFactory(leaflet);
3122
- return createMapLibreLayer({
3123
- attributionControl: false,
3124
- fadeDuration: VECTOR_SYMBOL_FADE_DURATION_MS,
3125
- interactive: false,
3126
- maxTileCacheZoomLevels: 6,
3127
- maxZoom: config.maxZoom,
3128
- minZoom: config.minZoom,
3129
- padding: config.vectorPadding,
3130
- style: config.vectorStyleUrl,
3131
- updateInterval: 16,
3132
- });
3133
- },
3134
- });
3135
- this.markerController = new MapMarkerController({
3136
- map,
3137
- leaflet,
3138
- getSelectedMarkerId: () => this.selectedMarkerId,
3139
- getClusteringOptions: () => normalizeMapMarkerClusteringOptions(this.clusterMarkers, this.clusterRadius, this.clusterMinPoints, this.clusterMaxZoom, map.getMaxZoom()),
3140
- prefersReducedMotion: () => this.prefersReducedMotion(),
3141
- onMarkerSelect: (marker, originalEvent) => this.qMarkerSelect.emit({ marker, originalEvent }),
3142
- onClusterSelect: detail => this.qClusterSelect.emit(detail).defaultPrevented,
3143
- });
3144
- }
3145
- async syncBaseLayer() {
3146
- const controller = this.layerController;
3147
- if (!controller)
3148
- return;
3149
- const requestedProvider = this.getProvider();
3150
- const current = controller.getActiveState();
3151
- this.errorMessage = undefined;
3152
- this.setProviderStatus('initializing', current.activeProvider, current.usingFallback);
3153
- const { minimum, maximum } = this.getZoomLimits();
3154
- const result = await controller.sync({
3155
- requestedProvider,
3156
- tileUrl: this.tileUrl.trim(),
3157
- tilePreloadBuffer: normalizeTilePreloadBuffer(this.tilePreloadBuffer),
3158
- vectorStyleUrl: this.vectorStyleUrl.trim(),
3159
- vectorPadding: normalizeVectorPadding(this.vectorPadding),
3160
- googleApiKey: this.googleApiKey.trim(),
3161
- googleApiAvailable: hasGoogleMapsConfiguration(),
3162
- googleMapType: this.getGoogleMapType(),
3163
- minZoom: minimum,
3164
- maxZoom: maximum,
3165
- });
3166
- if (controller !== this.layerController || result.kind === 'stale')
3167
- return;
3168
- if (result.kind === 'empty') {
3169
- this.setProviderStatus('empty', undefined, false);
3170
- return;
3171
- }
3172
- if (result.kind === 'ready') {
3173
- if (result.warning)
3174
- this.reportError('provider-initialization-failed', result.warning, true);
3175
- this.setProviderStatus('ready', result.activeProvider, result.usingFallback);
3176
- return;
3177
- }
3178
- this.reportError('provider-initialization-failed', result.error, true);
3179
- if (result.fallbackError)
3180
- this.reportError('fallback-initialization-failed', result.fallbackError, true);
3181
- this.errorMessage = result.activeProvider
3182
- ? 'The requested map provider failed. The previous map remains available.'
3183
- : 'Map imagery failed to load.';
3184
- this.setProviderStatus('error', result.activeProvider, result.usingFallback);
3185
- }
3186
- getZoomLimits() {
3187
- const minimum = Number.isFinite(this.minZoom) ? this.minZoom : 0;
3188
- const requestedMaximum = Number.isFinite(this.maxZoom) ? this.maxZoom : 19;
3189
- return { minimum, maximum: Math.max(minimum, requestedMaximum) };
3190
- }
3191
- getCenter() {
3192
- const latitude = Number.isFinite(this.centerLatitude) ? Math.max(-90, Math.min(90, this.centerLatitude)) : 0;
3193
- const longitude = Number.isFinite(this.centerLongitude) ? Math.max(-180, Math.min(180, this.centerLongitude)) : 0;
3194
- return [latitude, longitude];
3195
- }
3196
- getZoom() {
3197
- const { minimum, maximum } = this.getZoomLimits();
3198
- const zoom = Number.isFinite(this.zoom) ? this.zoom : minimum;
3199
- return Math.max(minimum, Math.min(maximum, zoom));
3200
- }
3201
- getProvider() {
3202
- return this.provider === 'google' || this.provider === 'vector' ? this.provider : 'tiles';
3203
- }
3204
- getRasterTileLoadingPolicy() {
3205
- return this.rasterTileLoadingPolicy === 'progressive'
3206
- ? 'progressive'
3207
- : 'full-batch';
3208
- }
3209
- getGoogleMapType() {
3210
- return GOOGLE_MAP_TYPES.includes(this.googleMapType) ? this.googleMapType : 'roadmap';
3211
- }
3212
- syncView(animate = false) {
3213
- this.map?.setView(this.getCenter(), this.getZoom(), {
3214
- animate: animate && !this.prefersReducedMotion(),
3215
- });
3216
- }
3217
- getMarkerVisibilityOcclusions(occlusions) {
3218
- const obstacles = [...occlusions];
3219
- const root = this.el.shadowRoot;
3220
- if (!root)
3221
- return obstacles;
3222
- for (const element of Array.from(root.querySelectorAll('.leaflet-control, .map-attribution'))) {
3223
- const style = element.ownerDocument.defaultView?.getComputedStyle(element);
3224
- if (style?.display === 'none' || style?.visibility === 'hidden')
3225
- continue;
3226
- const rect = element.getBoundingClientRect();
3227
- if (rect.width <= 0 || rect.height <= 0)
3228
- continue;
3229
- obstacles.push(this.toViewportRect(rect));
3230
- }
3231
- return obstacles;
3232
- }
3233
- getCoordinateRect(latitude, longitude, viewport) {
3234
- const point = this.map?.latLngToContainerPoint([latitude, longitude]);
3235
- const x = viewport.left + (point?.x ?? 0);
3236
- const y = viewport.top + (point?.y ?? 0);
3237
- return {
3238
- top: y - 0.5,
3239
- right: x + 0.5,
3240
- bottom: y + 0.5,
3241
- left: x - 0.5,
3242
- };
3243
- }
3244
- toViewportRect(rect) {
3245
- return {
3246
- top: rect.top,
3247
- right: rect.right,
3248
- bottom: rect.bottom,
3249
- left: rect.left,
3250
- };
3251
- }
3252
- async panByMarkerTranslation(map, x, y, operationToken) {
3253
- const animate = !this.prefersReducedMotion();
3254
- await new Promise(resolve => {
3255
- const view = this.el.ownerDocument.defaultView;
3256
- const startedAt = Date.now();
3257
- let settled = false;
3258
- let settleTimeout;
3259
- let animationTimeout;
3260
- const complete = () => {
3261
- if (settled)
3262
- return;
3263
- settled = true;
3264
- map.off('moveend', finish);
3265
- if (settleTimeout !== undefined)
3266
- view?.clearTimeout(settleTimeout);
3267
- if (animationTimeout !== undefined)
3268
- view?.clearTimeout(animationTimeout);
3269
- if (this.cancelMarkerVisibilityPan === cancel) {
3270
- this.cancelMarkerVisibilityPan = undefined;
3271
- }
3272
- resolve();
3273
- };
3274
- const finish = () => {
3275
- if (settled)
3276
- return;
3277
- map.off('moveend', finish);
3278
- if (settleTimeout !== undefined)
3279
- view?.clearTimeout(settleTimeout);
3280
- const remainingAnimation = animate
3281
- ? Math.max(0, MARKER_VISIBILITY_MIN_ANIMATION_MS - (Date.now() - startedAt))
3282
- : 0;
3283
- if (remainingAnimation > 0 && view) {
3284
- animationTimeout = view.setTimeout(complete, remainingAnimation);
3285
- }
3286
- else
3287
- complete();
3288
- };
3289
- const cancel = () => {
3290
- if (settled)
3291
- return;
3292
- map.stop();
3293
- complete();
3294
- };
3295
- if (!this.isMarkerVisibilityCurrent(operationToken)) {
3296
- complete();
3297
- return;
3298
- }
3299
- this.cancelMarkerVisibilityPan = cancel;
3300
- map.once('moveend', finish);
3301
- settleTimeout = view?.setTimeout(finish, MARKER_VISIBILITY_SETTLE_TIMEOUT_MS);
3302
- map.panBy([
3303
- -roundPanOffset(x),
3304
- -roundPanOffset(y),
3305
- ], { animate });
3306
- });
3307
- }
3308
- async waitForMarkerLayout() {
3309
- await new Promise(resolve => {
3310
- const view = this.el.ownerDocument.defaultView;
3311
- if (!view || typeof view.requestAnimationFrame !== 'function') {
3312
- queueMicrotask(resolve);
3313
- return;
3314
- }
3315
- view.requestAnimationFrame(() => resolve());
3316
- });
3317
- }
3318
- isMarkerVisibilityCurrent(operationToken) {
3319
- return operationToken === this.markerVisibilityToken && this.connected;
3320
- }
3321
- prefersReducedMotion() {
3322
- return typeof window !== 'undefined'
3323
- && typeof window.matchMedia === 'function'
3324
- && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
3325
- }
3326
- syncBounds(reportInvalid) {
3327
- if (!this.map)
3328
- return;
3329
- const resolution = resolveMapBounds(this.maxBounds);
3330
- applyMapBounds(this.map, resolution, this.maxBoundsViscosity);
3331
- if (resolution.kind === 'invalid') {
3332
- if (reportInvalid)
3333
- this.reportInvalidBounds(resolution.message);
3334
- }
3335
- else {
3336
- this.lastInvalidBoundsInput = undefined;
3337
- }
3338
- }
3339
- reportInvalidBounds(message) {
3340
- if (this.lastInvalidBoundsInput === this.maxBounds)
3341
- return;
3342
- this.lastInvalidBoundsInput = this.maxBounds;
3343
- this.reportError('invalid-max-bounds', new Error(message), true);
3344
- }
3345
- setProviderStatus(status, activeProvider, usingFallback, force = false) {
3346
- const changed = status !== this.providerStatus
3347
- || activeProvider !== this.activeProvider
3348
- || usingFallback !== this.usingFallback
3349
- || this.getProvider() !== this.reportedRequestedProvider;
3350
- this.providerStatus = status;
3351
- this.activeProvider = activeProvider;
3352
- this.usingFallback = usingFallback;
3353
- this.reportedRequestedProvider = this.getProvider();
3354
- if (changed || force) {
3355
- this.qStatusChange.emit({
3356
- status,
3357
- requestedProvider: this.getProvider(),
3358
- activeProvider,
3359
- usingFallback,
3360
- });
3361
- }
3362
- }
3363
- reportError(code, error, recoverable) {
3364
- this.qError.emit({
3365
- code,
3366
- message: error instanceof Error ? error.message : String(error),
3367
- requestedProvider: this.getProvider(),
3368
- recoverable,
3369
- });
3370
- }
3371
- observeResize() {
3372
- if (!this.canvas || typeof ResizeObserver === 'undefined')
3373
- return;
3374
- this.resizeObserver?.disconnect();
3375
- // Update before paint so a changing frame never paints the previous frame's center.
3376
- this.resizeObserver = new ResizeObserver(() => this.resizeMap());
3377
- this.resizeObserver.observe(this.canvas);
3378
- }
3379
- resizeMap() {
3380
- this.map?.invalidateSize({
3381
- animate: false,
3382
- debounceMoveend: true,
3383
- pan: true,
3384
- });
3385
- this.syncBounds(false);
3386
- }
3387
- destroyMap() {
3388
- this.markerVisibilityToken += 1;
3389
- this.cancelMarkerVisibilityPan?.();
3390
- this.cancelMarkerVisibilityPan = undefined;
3391
- this.resizeObserver?.disconnect();
3392
- this.resizeObserver = undefined;
3393
- this.markerController?.destroy();
3394
- this.markerController = undefined;
3395
- this.layerController?.destroy();
3396
- this.layerController = undefined;
3397
- const map = this.map;
3398
- if (map) {
3399
- this.unbindMapEvents(map);
3400
- map.remove();
3401
- }
3402
- this.map = undefined;
3403
- }
3404
- renderAttribution() {
3405
- if (this.activeProvider !== 'tiles' && this.activeProvider !== 'vector')
3406
- return null;
3407
- const attribution = this.attribution.trim();
3408
- if (!attribution)
3409
- return null;
3410
- const attributionUrl = this.getAttributionUrl();
3411
- if (!attributionUrl)
3412
- return h("span", { class: "map-attribution", part: "attribution" }, attribution);
3413
- return (h("a", { class: "map-attribution", part: "attribution", href: attributionUrl, target: "_blank", rel: "noopener noreferrer" }, attribution, h("span", { class: "visually-hidden" }, " (opens in a new tab)")));
3414
- }
3415
- getAttributionUrl() {
3416
- const value = this.attributionUrl.trim();
3417
- if (!value)
3418
- return undefined;
3419
- try {
3420
- const url = new URL(value, this.el.ownerDocument.baseURI);
3421
- return url.protocol === 'https:' || url.protocol === 'http:' ? value : undefined;
3422
- }
3423
- catch {
3424
- return undefined;
3425
- }
3426
- }
3427
- render() {
3428
- return (h("div", { key: '033fd7a2d32834e77a2558c65534977586ceedeb', class: "map-surface", part: "surface" }, h("div", { key: 'e478148f947ed36790471bb2fbf793de05aa8c85', class: "map-canvas", part: "canvas", role: "region", "aria-label": this.ariaLabel, "aria-busy": this.providerStatus === 'initializing' ? 'true' : undefined, ref: this.setCanvas }), h("q-icon", { key: 'f2257ff57c557e82e0373fed177892c37190cbeb', class: "map-icon-registration", "aria-hidden": "true" }), this.providerStatus === 'empty' && (h("div", { key: '1473bd03ecda753ae602340396a342a9f36d0869', class: "map-empty", part: "empty", role: "status" }, h("slot", { key: '3459312eb6bf78f542c6bd3f700304097dc1add8', name: "empty" }, "Map provider is not configured."))), this.providerStatus === 'error' && (h("div", { key: '7477ce15ffad0b72381973c7ffd6e3dc64557159', class: "map-empty map-error", part: "error", role: "alert" }, h("slot", { key: 'ae647a72990bde7889aed466fdb005088c47e83d', name: "error" }, this.errorMessage ?? 'Map imagery is unavailable.'))), this.renderAttribution()));
3429
- }
3430
- static get watchers() { return {
3431
- "provider": [{
3432
- "handleBaseLayerChange": 0
3433
- }],
3434
- "tileUrl": [{
3435
- "handleBaseLayerChange": 0
3436
- }],
3437
- "rasterTileLoadingPolicy": [{
3438
- "handleBaseLayerChange": 0
3439
- }],
3440
- "vectorStyleUrl": [{
3441
- "handleBaseLayerChange": 0
3442
- }],
3443
- "googleApiKey": [{
3444
- "handleBaseLayerChange": 0
3445
- }],
3446
- "googleMapType": [{
3447
- "handleBaseLayerChange": 0
3448
- }],
3449
- "tilePreloadBuffer": [{
3450
- "handleTilePreloadBufferChange": 0
3451
- }],
3452
- "vectorPadding": [{
3453
- "handleVectorPaddingChange": 0
3454
- }],
3455
- "markers": [{
3456
- "handleMarkersChange": 0
3457
- }],
3458
- "clusterMarkers": [{
3459
- "handleMarkerClusteringChange": 0
3460
- }],
3461
- "clusterRadius": [{
3462
- "handleMarkerClusteringChange": 0
3463
- }],
3464
- "clusterMinPoints": [{
3465
- "handleMarkerClusteringChange": 0
3466
- }],
3467
- "clusterMaxZoom": [{
3468
- "handleMarkerClusteringChange": 0
3469
- }],
3470
- "selectedMarkerId": [{
3471
- "handleSelectedMarkerChange": 0
3472
- }],
3473
- "centerLatitude": [{
3474
- "handleViewChange": 0
3475
- }],
3476
- "centerLongitude": [{
3477
- "handleViewChange": 0
3478
- }],
3479
- "zoom": [{
3480
- "handleViewChange": 0
3481
- }],
3482
- "minZoom": [{
3483
- "handleZoomLimitsChange": 0
3484
- }],
3485
- "maxZoom": [{
3486
- "handleZoomLimitsChange": 0
3487
- }],
3488
- "maxBounds": [{
3489
- "handleBoundsChange": 0
3490
- }],
3491
- "maxBoundsViscosity": [{
3492
- "handleBoundsChange": 0
3493
- }],
3494
- "scrollWheelZoom": [{
3495
- "handleScrollWheelZoomChange": 0
3496
- }],
3497
- "zoomControls": [{
3498
- "handleZoomControlsChange": 0
3499
- }]
3500
- }; }
3501
- };
3502
- function roundPanOffset(value) {
3503
- return Math.sign(value) * Math.ceil(Math.abs(value));
3504
- }
3505
- QMap.style = mapCss();
3506
-
3507
- export { QMap as q_map };